/* The bridge between Night Desk (base.css, theme.css: the design's own styles, unchanged) and the City's parts not yet
   converted to it (look.css, shell.css). Loaded last. Two things only:
   1. The frame's glue: what the City's frame holds that the design's does not (the agent's panel inside the agent
      column, the record panel, the command bar as a real field, the keys' hints, the builders' fold, the first paint
      of a kept menu or panel, the phone's search).
   2. The older parts' light colours, read from the design's tokens so they stay readable in dark and light. Made once
      from the light colours written in look.css and shell.css; it goes away part by part as each is converted. */

/* The older stylesheets' own token names, given the design's values (theme.css has no line2 or gate). */
:root { --line2: var(--line); --gate: var(--amber); --gate-bg: var(--amber-bg); --gate-line: var(--amber-line);
  --desk-card: var(--surface); --desk-raised: var(--surface2); --desk-sans: var(--font); --desk-mono: var(--font-num); }
body { font-family: var(--font); }
.h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.voice { font-family: var(--font); font-size: 15px; color: var(--ink2); }

/* ---------- the menu ---------- */
.nav-items details.builders { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.nav-items details.builders > summary { list-style: none; cursor: pointer; }
.nav-items details.builders > summary::-webkit-details-marker { display: none; }
.nav-own { border-top: 1px solid var(--line); }
.nav-foot { position: relative; }
.nav-me { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.nav-foot form { display: none; margin: 0 0 0 auto; }
.nav-out { padding: 4px 8px; font-size: 12px; }
.brand-mark { font-family: var(--font); }
/* The menu a person left open is drawn open on the first paint (early.js marks <html>; the shell's script then marks
   the frame itself, rail-open, as the design does). The same rules as theme.css's for .rail-open. */
@media (min-width: 761px) {
  :root[data-rail="open"] .shell-rail { grid-template-columns: 232px minmax(0, 1fr) var(--chat-w); }
  :root[data-rail="open"] .shell-rail.chat-hidden { grid-template-columns: 232px minmax(0, 1fr) 0; }
}
:root[data-rail="open"] .shell-rail .nav { align-items: stretch; }
:root[data-rail="open"] .shell-rail .brand { padding: 14px 16px 10px; }
:root[data-rail="open"] .shell-rail .brand-text, :root[data-rail="open"] .shell-rail .nav-label, :root[data-rail="open"] .shell-rail .nav-foot span { display: flex; }
:root[data-rail="open"] .shell-rail .nav-group-label { display: block; padding: 6px 10px 2px; }
:root[data-rail="open"] .shell-rail .nav-item { justify-content: flex-start; padding: 8px 10px; }
:root[data-rail="open"] .shell-rail .nav-badge { position: static; }
:root[data-rail="open"] .shell-rail .nav-foot { justify-content: flex-start; padding: 12px 16px; }
:root[data-rail="open"] .shell-rail .rail-toggle { justify-content: flex-start; padding: 8px 20px; }
:root[data-rail="open"] .shell-rail .rail-toggle .nav-label { display: inline; }
:root[data-rail="open"] .shell-rail .nav-foot form, .shell-rail.rail-open .nav-foot form { display: block; }
.shell-rail.rail-open .nav-me span, :root[data-rail="open"] .shell-rail .nav-me span { display: flex; flex-direction: column; }
.nav-me > span strong { color: var(--ink); font-size: 13px; }
.nav-item .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A count in words (when a list was last read, how many features are on) is a dot on the narrow menu, and its words
   when the menu is open, in the sheet, or on the tab. */
:root:not([data-rail="open"]) .shell-rail:not(.rail-open) .nav > .nav-items .nav-badge.is-text { width: 8px; height: 8px; padding: 0; font-size: 0;
  border-radius: 50%; top: 6px; right: 10px; background: var(--mute); }
:root:not([data-rail="open"]) .shell-rail:not(.rail-open) .nav > .nav-items .nav-badge.is-text.ok { background: var(--ok); }
.page-find input { width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 13px; outline: 0; }
.page-find input:focus { border-color: var(--accent); }

/* ---------- the top bar: the command bar is a real field ---------- */
.topbar { position: relative; z-index: 6; }
.topbar .cmd { position: relative; cursor: text; }
.topbar .cmd input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; padding: 0; }
.topbar .cmd input::placeholder { color: var(--mute); }
.topbar .cmd:focus-within { border-color: var(--accent); }
.topbar .cmd .results { top: calc(100% + 6px); color: var(--ink); }
.topbar-title .prov { display: inline; font-size: inherit; color: inherit; }
/* The keys' own hints (N, /, a view's letter) are kept for the keys and for screen readers, out of sight. */
.key-hints { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-toggle .ic.to-dark, :root[data-theme="light"] .theme-toggle .ic.to-light { display: none; }
:root[data-theme="light"] .theme-toggle .ic.to-dark { display: block; }
.main-inner > .push-nudge { margin: 0 0 14px; }
.main-inner > .canvas { padding: 0; }

/* ---------- the agent's column holds the agent's panel ---------- */
.chat > .dock { display: flex; position: static; width: auto; height: auto; flex: 1 1 auto; min-height: 0; margin: 0; border-left: 0; top: auto; background: var(--chat-bg); }
.shell.chat-hidden .chat-reopen { font: 500 13px var(--font); }
/* A panel this device left open is open on the first paint (early.js), wherever it sits beside the page. */
@media (min-width: 1181px) {
  :root[data-agent-kept="1"] .shell-rail.chat-hidden { grid-template-columns: 76px minmax(0, 1fr) var(--chat-w); }
  :root[data-agent-kept="1"][data-rail="open"] .shell-rail.chat-hidden { grid-template-columns: 232px minmax(0, 1fr) var(--chat-w); }
  :root[data-agent-kept="1"] .shell.chat-hidden .chat { visibility: visible; }
  :root[data-agent-kept="1"] .shell.chat-hidden .chat-reopen { display: none; }
}
/* The panel's room: wider, or the whole window as a conversation page with a centred column. */
@media (min-width: 761px) {
  .shell-rail[data-agent-open="1"][data-agent-size="wide"] { grid-template-columns: 76px minmax(0, 1fr) min(640px, 48vw); }
  :root[data-rail="open"] .shell-rail[data-agent-open="1"][data-agent-size="wide"] { grid-template-columns: 232px minmax(0, 1fr) min(640px, 48vw); }
  .shell-rail[data-agent-open="1"][data-agent-size="full"] { grid-template-columns: 76px 0 minmax(0, 1fr); }
  :root[data-rail="open"] .shell-rail[data-agent-open="1"][data-agent-size="full"] { grid-template-columns: 232px 0 minmax(0, 1fr); }
  .shell[data-agent-open="1"][data-agent-size="full"] > .main, .shell[data-agent-open="1"][data-agent-size="full"] > .topbar { display: none; }
  .shell[data-agent-open="1"][data-agent-size="full"] > .chat { background: var(--bg); border-left: 0; }
  .shell[data-agent-open="1"][data-agent-size="full"] .stream, .shell[data-agent-open="1"][data-agent-size="full"] .dock .askwrap {
    padding-left: max(20px, calc((100% - 760px) / 2)); padding-right: max(20px, calc((100% - 760px) / 2)); }
  .shell[data-agent-open="1"][data-agent-size="full"] .stream { padding-top: 32px; gap: 22px; }
  .shell[data-agent-open="1"][data-agent-size="full"] .dock .askwrap { padding-bottom: 22px; }
  /* the Night Desk panel (chat-frame): its conversation and its box in the same centred column */
  .shell[data-agent-open="1"][data-agent-size="full"] .dock.chat-frame .chat-log,
  .shell[data-agent-open="1"][data-agent-size="full"] .dock.chat-frame .k-composer {
    padding-left: max(20px, calc((100% - 760px) / 2)); padding-right: max(20px, calc((100% - 760px) / 2)); }
}
@media (min-width: 1181px) {
  :root[data-agent-kept="1"][data-agent-room="wide"] .shell-rail.chat-hidden { grid-template-columns: 76px minmax(0, 1fr) min(640px, 48vw); }
}

/* ---------- a record opened beside the page takes the agent's place ---------- */
.shell > .record-panel { grid-area: chat; position: static; top: auto; width: auto; height: auto; min-height: 0; background: var(--chat-bg); border-left: 1px solid var(--line); }
.shell[data-agent-open="1"] > .record-panel { display: none; }
@media (min-width: 761px) {
  .shell-rail.chat-hidden:has(> .record-panel:not([hidden])) { grid-template-columns: 76px minmax(0, 1fr) 380px; }
  :root[data-rail="open"] .shell-rail.chat-hidden:has(> .record-panel:not([hidden])) { grid-template-columns: 232px minmax(0, 1fr) 380px; }
  .shell.chat-hidden:has(> .record-panel:not([hidden])) .chat-reopen { display: none; }
}

/* ---------- the phone ---------- */
.mhead-tools { display: flex; align-items: center; gap: 4px; }
/* As many even columns as the bar has items: the design's four and More, and a tab a view asks for (phone_tab). */
.tabbar { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tabbar a > span:not(.nav-badge), .tabbar button > span:not(.nav-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The sheet names every screen in words (the design's sheet inherits the narrow menu's hidden labels; here each
   screen keeps its name, as the menu does when it is open). */
.sheet .nav-item, .sheet-own .nav-item { min-height: 44px; justify-content: flex-start; padding: 8px 10px; }
.sheet .nav-item .nav-label { display: block; }
.sheet .nav-item .nav-badge { position: static; }
.sheet details.builders { border-top: 1px solid var(--line); margin-top: 4px; }
.sheet details.builders > summary { list-style: none; cursor: pointer; }
.sheet details.builders > summary::-webkit-details-marker { display: none; }
.sheet-own { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.sheet-own form { margin: 0; }
.sheet-own .nav-out { width: 100%; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
.sheet .nav-item .nav-badge { margin-left: auto; }
@media (max-width: 760px) {
  /* The one agent button sits in the head's corner as the design's agent mark (kit.js: .mhead-agent). */
  .mhead { padding-right: 56px; }
  .shell .chat-reopen, .shell.chat-hidden .chat-reopen { display: inline-grid; place-items: center; position: fixed; top: 9px; right: 14px; bottom: auto; left: auto;
    z-index: 31; width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: transparent;
    color: var(--accent); box-shadow: none; }
  .shell .chat-reopen span { display: none; }
  /* The search button opens the command bar under the head. */
  .shell.find-open > .topbar { display: flex; position: fixed; left: 0; right: 0; top: 52px; z-index: 30; padding: 8px 12px; background: var(--nav-bg); border-bottom: 1px solid var(--line); }
  .shell.find-open > .topbar .topbar-title, .shell.find-open > .topbar .theme-toggle, .shell.find-open > .topbar kbd { display: none; }
  .shell.find-open > .topbar .topbar-tools { width: 100%; max-width: none; }
  /* The agent's panel is the whole screen; its own Close puts the page back. */
  .shell[data-agent-open="1"] > .chat { display: flex; visibility: visible; position: fixed; inset: 0; z-index: 45; border-left: 0; }
  .shell > .record-panel { position: fixed; inset: 0; z-index: 35; }
  .dock .dh .room { display: none; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- the older parts, in the design's colours ---------- */
.logo{background:var(--accent);color:var(--accent-ink)}
.kbd{background:var(--surface2)}
.card{background:var(--surface)}
.cf a{text-decoration-color:var(--line)}
tr.f td{background:var(--surface2)}
.dots i{background:var(--line)}
.av{background:var(--surface2)}
.pill{background:var(--surface2)}
.btn{background:var(--surface)}
.btn.p{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.g{background:var(--amber-btn);border-color:var(--amber-btn);color:var(--amber-btn-ink)}
.gc{background:linear-gradient(180deg,var(--amber-bg),var(--amber-bg))}
.mk{background:var(--line)}
.bub{background:var(--surface2)}
.ask{background:var(--surface)}
.tabs a.on{background:var(--surface)}
.sw{background:var(--line)}
.sw::after{background:var(--surface)}
.slide{background:var(--amber-line)}
.slide i{background:var(--amber-btn);color:var(--amber-btn-ink)}
.pc{background:var(--surface)}
.shot{background:repeating-linear-gradient(135deg,var(--surface2) 0 10px,var(--surface2) 10px 20px)}
.ci{background:var(--surface)}
.li .btn.p{color:var(--accent-ink)}
.li .btn.g{color:var(--amber-btn-ink)}
.flow-step{background:var(--surface)}
.signin input{background:var(--surface)}
button.ic:hover{background:var(--surface2)}
.results{background:var(--surface)}
.results a.on,.results a:hover{background:var(--surface2)}
.tiles.strip .stat{background:var(--surface)}
@supports not selector(::-webkit-scrollbar){.scroll{scrollbar-color:var(--mute) var(--surface2)}}
.scroll::-webkit-scrollbar-track{background:var(--surface2)}
.scroll::-webkit-scrollbar-thumb{background:var(--mute);border:2px solid var(--surface2)}
.scroll::-webkit-scrollbar-thumb:hover{background:var(--mute)}
.scroll td.acts,.scroll th.acts{background:var(--surface)}
.scroll tr.f td.acts{background:var(--surface2)}
.scroll-note{background:var(--bg)}
.scroll th:first-child,.scroll td:first-child{background:var(--surface)}
.scroll tr.f td:first-child{background:var(--surface2)}
.lane{background:var(--surface2)}
.lane.drop-ok.drop-over{background:var(--surface2)}
td[data-edit]:hover{background:var(--surface)}
.cell-input{background:var(--surface)}
.cal .today .d b{background:var(--accent);color:var(--accent-ink)}
.pop{background:var(--surface)}
.toast{background:var(--ink);color:var(--bg)}
.push-nudge{background:var(--surface)}
.toast button{color:inherit}
.dock{background:var(--surface)}
.record-panel{background:var(--surface)}
.pulse.off{background:var(--line)}
.chip{background:var(--surface)}
.chip .x:hover{background:var(--surface2)}
.fields input,.fields textarea{background:var(--surface)}
.fields select{background:var(--surface)}
.mediagrid img,.mediagrid video{background:var(--surface)}
.compact .gc{background:var(--surface)}
.cv-md code,.cv-name{background:var(--surface2)}
.cv-code,.cv-diff{background:var(--surface)}
.cv-step{background:var(--surface)}
.cv-dot{background:var(--line)}
.cv-todos .mk{border:1px solid var(--line)}
.cv-opt{background:var(--surface)}
.term-tile{background:var(--surface)}
.term-rects>.term-tile{outline:3px solid var(--surface)}
.term-mark{background:var(--surface2)}
.seg-b{background:var(--surface)}
.seg-b.on{background:var(--surface2)}
.term-big:hover{background:var(--surface2)}
.term-x:hover{background:var(--surface2)}
.ask{border-color:var(--surface2)}
.ask:focus-within{border-color:var(--line)}
.ask textarea::placeholder{color:var(--mute)}
.ask-go{background:var(--accent);color:var(--accent-ink)}
.ask textarea:placeholder-shown~.ask-bar .ask-go[type=submit]{background:var(--line)}
.dock .dh .ic[aria-pressed="true"]{background:var(--surface2)}
.reply .cv-tablewrap{background:var(--surface)}
.reply .cv-table thead th{background:var(--surface)}
.stream .steps summary:hover{background:var(--surface2)}
.live-w{background:linear-gradient(90deg,var(--ink2) 0%,var(--ink2) 40%,var(--mute) 50%,var(--ink2) 60%,var(--ink2) 100%)}
.cv-n{background:var(--surface)}
.scroll tfoot td{background:var(--surface)}
.scroll tfoot td:first-child{background:var(--surface)}
.card[data-part="thread"] .th{background:var(--surface2)}
.th-day span{background:var(--surface)}
.th-b{background:var(--surface)}
.th-row.ours .th-b{border-color:var(--ok-bg)}
.th-reply{background:var(--surface)}
.th-reply textarea{background:var(--surface)}
/* Every lane of a board stays within reach of a drag on a desk (the design's lanes are 200px at least; the City's
   boards have more lanes than its sample). Here, after the design's own rule, so it holds. */
@media (min-width: 761px) { .k-board { grid-auto-columns: minmax(150px, 1fr); } }

/* ---------- the City's own pieces in the parts drawn through the design (kit/adapt.py), step 4 second half ---------- */
.k-approvals{display:grid;gap:12px}
.k-approvalsbox{display:grid;gap:8px}
.k-approvalspanel .k-approvals{padding:0 var(--pad) 4px}
.k-ap-head .k-ap-wait{margin-left:auto}
.k-ap-wait.is-late{color:var(--late)}
.k-approval .slide,.k-ap-row .slide{margin-top:8px}
[data-part="thread"] .k-thread{max-height:min(62vh,640px);overflow-y:auto}
.k-tmsg.is-focus{outline:2px solid var(--amber-line);outline-offset:2px}
.k-tmsg-sub{font-size:12.5px;font-weight:600;color:var(--ink2);margin-bottom:2px}
.k-thread .th-day{justify-self:center}
.k-replywrap{padding:0 var(--pad) var(--pad)}
.k-files{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:12px;padding:0 var(--pad) 4px}
.k-files.is-compact{grid-template-columns:minmax(0,1fr)}
.k-file img,.k-file video{display:block;width:100%;max-height:420px;object-fit:contain;background:var(--surface2)}
.k-file audio{display:block;width:calc(100% - 24px);margin:12px}
.k-file-none{padding:12px}
.k-mediapanel.is-held{background:var(--amber-bg);border-color:var(--amber-line)}
/* On a narrow page what waits for the owner comes first, as before: a side column holding cards or a held piece. */
@container(max-width:720px){.part-columns:has([data-part="approval"])>.parts-column[data-column="side"],.part-columns:has(.k-mediapanel.is-held)>.parts-column[data-column="side"]{order:-1}}
/* Pieces in a narrow cell (founder, 16 Nov 2026: a progress line's stage names ran into each other, the head's title
   broke into three lines and Export and Why spilled out of the card). Every piece's cell, and every piece in an answer,
   is a container named piece; the head wraps its tools under the title; a progress line too narrow for its stages in a
   row lists them down, each with its dot. */
[data-cell],.shown{container:piece/inline-size}
.k-panel{min-width:0}
.k-panel-head{flex-wrap:wrap;row-gap:4px}
.k-panel-head h2{min-width:0;overflow-wrap:anywhere}
.k-tools{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px 12px;font-size:12.5px;min-width:0;margin-left:auto}
.k-tools .k-src{margin:0;white-space:nowrap}
.k-tools .k-link,.k-count .k-link{white-space:nowrap}
.k-here{white-space:nowrap}
@container piece (max-width:520px){
  .k-stages{grid-template-columns:minmax(0,1fr);padding:8px var(--pad) 0}
  .k-stages li{flex-direction:row;align-items:center;text-align:left;gap:10px;padding:5px 0}
  .k-stages li::before{left:6.5px;right:auto;width:3px;height:100%;top:-50%}
  .k-stages .k-stage-name{font-size:13px}
  .k-stages .k-here{margin-left:auto}
  .k-progress-foot{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .k-progress-foot>div:first-child{grid-column:1/-1}
}
/* The slide-to-approve track's words start after its handle and are cut with an ellipsis, never drawn under it
   (founder, 16 Nov 2026: on a phone the handle covered "Slide to"). */
.slide{padding:0 14px 0 48px}
.slide>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* A tile's figure fits its tile (16 Nov 2026: on a phone an overdue amount filled its tile edge to edge). The design's
   own sizes stay the most it is drawn at (22px, compact 18px, compact on a phone 16px); only a tile too narrow for it
   draws it smaller, and an amount still too long goes on after "Rs" on a second line, never out of the tile. */
.k-tile{container-type:inline-size}
.k-tile-value{font-size:min(22px,15cqi);white-space:normal}
.k-tiles.is-compact .k-tile-value{font-size:min(18px,15cqi)}
@media (max-width:760px){.k-tiles.is-compact .k-tile-value{font-size:min(16px,15cqi)}}

/* A connection card the recipe's rules colour late (stopped, waiting for the owner) wears the design's own look for a
   connection that needs a person (base.css .k-conn.s-needs-sign-in); the design keys it to its sample's words. A card's
   name may be long: it wraps and never pushes the state chip out of the card. */
.k-conn.t-late{border-color:var(--late);box-shadow:inset 3px 0 0 var(--late)}
.k-conn-name strong{overflow-wrap:anywhere}
/* An app's icon before a page's title (one connection's page): beside the name, on its line. */
.k-header h1 .k-appicon{vertical-align:-4px;margin-right:12px}
