/* ==========================================================================
   AI Hub base styles. Every colour, size and motion value comes from
   tokens.css, which loads first.
   ========================================================================== */
/* Fonts: Geist, Newsreader and Doto, declared in tokens.css (the Nothing look). */
/* The hidden attribute always wins over a component's own display rule. */
[hidden] { display: none !important; }


/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-weight: var(--fw-regular); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
strong, b, th, h1, h2, h3, h4, h5, h6, summary strong { font-weight: var(--fw-strong); }
code, pre, kbd, samp { font-family: var(--font-mono); }
small { font-size: max(var(--fs-12), .875em); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: var(--icon); height: var(--icon); flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; }
.muted { color: var(--muted); }
.error { min-height: 1.3em; color: var(--danger); font-size: var(--fs-14); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Native controls: one look everywhere. :where() keeps these at zero
   specificity so any component rule still wins. */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), select, textarea) {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: var(--r-8);
  background-color: var(--surface); color: var(--text);
  font-size: var(--fs-16);
}
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), select) { min-height: var(--tap); padding: 0 var(--sp-3); }
:where(textarea) { padding: var(--sp-2) var(--sp-3); }
/* The select arrow is Home's thin line chevron (--chev-down, in the theme's
   quiet ink), never the browser's or a drawn solid triangle. It is marked
   important so a component's "background:" shorthand cannot erase it. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none;
  padding-right: 36px;
  background-image: var(--chev-down) !important;
  background-position: calc(100% - 12px) 50% !important;
  background-size: 16px 16px !important;
  background-repeat: no-repeat !important;
}
/* Phones zoom into fields smaller than 16px, so fields stay at 16px there. */
@media (pointer: coarse) {
  /* Phone-first: every tap target is at least 48px. */
  .side-row { min-height: 48px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: max(var(--fs-16), 1em) !important; }
}
:where(input, select, textarea):focus { border-color: var(--line-strong); }
:where(input, select, textarea)::placeholder { color: var(--faint); }
:where(input[type="checkbox"], input[type="radio"], input[type="range"], progress) { accent-color: var(--accent); }
:where(input[type="checkbox"], input[type="radio"]) { width: 20px; height: 20px; }

/* ---------- Buttons ----------
   Four kinds, all at least 44px tall:
   Primary (.primary, the one filled button on a screen), Secondary
   (.secondary; older names .subtle, .refresh-button, .text-button,
   .toggle-button), Quiet (.quiet) and Danger (.danger-fill; .danger turns
   a Secondary button's text red). */
.primary, .secondary, .subtle, .refresh-button, .text-button, .toggle-button, .quiet, .danger-fill {
  min-height: var(--tap); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-8);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-14); font-weight: var(--fw-strong); line-height: 1.2;
  touch-action: manipulation;
}
.text-button { display: flex; align-items: center; gap: var(--sp-2); }
.text-button svg { width: 20px; height: 20px; }
.secondary:hover, .subtle:hover, .refresh-button:hover, .text-button:hover, .toggle-button:hover { background: var(--surface-strong); }
.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.primary:hover { filter: brightness(.94); }
.quiet { border-color: transparent; background: transparent; }
.quiet:hover { background: var(--surface-strong); }
.danger-fill { border-color: var(--danger); background: var(--danger); color: var(--on-danger); }
.danger { color: var(--danger); }
/* Unavailable buttons: a neutral grey outline, not a faded primary that still looks tappable. */
.primary:disabled, .secondary:disabled, .subtle:disabled, .refresh-button:disabled, .text-button:disabled, .toggle-button:disabled, .quiet:disabled, .danger-fill:disabled { opacity: 1; filter: none; border-color: var(--line); background: transparent; color: var(--muted); box-shadow: none; }
.toggle-button[aria-pressed=true] { border-color: var(--text); background: var(--text); color: var(--bg); }
.wide { width: 100%; }
.icon-button {
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--r-8);
  background: transparent; display: inline-grid; place-items: center; color: var(--muted);
  touch-action: manipulation;
}
.icon-button:hover, .icon-button:focus-visible { background: var(--surface-strong); color: var(--text); }
.icon-button:disabled { opacity: .4; }

/* Chips: small pills. Interactive chips keep a 44px touch target. */
.chip {
  min-height: 32px; display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font-size: var(--fs-14);
}
button.chip { min-height: var(--tap); }
.count {
  min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--surface-strong); color: var(--text);
  font-size: var(--fs-12); font-weight: var(--fw-strong); font-style: normal; font-variant-numeric: tabular-nums;
}
.count:empty { display: none; }
.count.attention { background: var(--warning); color: var(--bg); }
/* Estate: a single dot for an open critical problem, never a number. */
.count.badge-dot, .count.badge-dot:empty { min-width: 0; width: 9px; height: 9px; padding: 0; display: inline-block; background: var(--danger); }
.count.badge-dot.hidden { display: none; }

/* ---------- Shell layout ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: var(--app-height, 100%);
  width: 100%;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  overflow: hidden;
}
.shell.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.shell.sidebar-collapsed .sidebar { visibility: hidden; }
.shell:not(.sidebar-collapsed) #sidebar-toggle { display: none; }
/* The rail has its own New chat; the header + is for when the rail is closed. */
@media (min-width: 801px) and (min-height: 481px), (min-width: 801px) and (orientation: portrait) { .shell:not(.sidebar-collapsed) #new-chat-top { display: none; } }
.main { position: relative; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: transparent; }
.view { height: 100%; }

/* ---------- Sidebar (desktop) / drawer (phone) ----------
   Claude-like: SEAN, Work and Life head it; search, new chat and Waiting
   for you; recent chats and projects grouped by area; the account at the
   bottom. Hierarchy comes from type and space, not boxes. */
.sidebar {
  min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line);
}
.side-head { height: 60px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 0 var(--sp-2) 0 var(--sp-4); }
.side-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.01em; }
.side-brand b { font-weight: 650; }
.brand-glyph { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-8); background: var(--text); color: var(--bg); font-weight: var(--fw-strong); font-size: var(--fs-14); }
.brand-glyph.large { width: 48px; height: 48px; border-radius: var(--r-12); font-size: var(--fs-20); }
img.brand-glyph { display: block; object-fit: cover; background: none; }
.side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-1) 10px var(--sp-4); }
.side-areas, .side-actions { display: flex; flex-direction: column; gap: 2px; }
.side-actions { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.side-area, .side-action {
  width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 0 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font-size: var(--fs-16); font-weight: 500; text-align: left;
}
.side-area { font-size: 17px; font-weight: 600; }
.side-action { color: var(--text-2); }
.side-area svg, .side-action svg { width: 22px; height: 22px; color: var(--muted); }
.side-area:hover, .side-action:hover, .side-area[aria-current="page"], .side-action[aria-current="page"] { background: var(--hover); color: var(--text); }
.side-area[aria-current="page"] svg { color: var(--accent); }
.side-area-label { flex: 1 1 auto; min-width: 0; }
.sean-mark { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; }
.sean-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.side-count {
  margin-left: auto; min-width: 24px; height: 24px; padding: 0 8px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--surface-strong); color: var(--text-2);
  font-size: 13px; font-weight: 650; font-style: normal; font-variant-numeric: tabular-nums;
}
.side-count[hidden], .side-count:empty { display: none; }
.side-count.is-need { background: var(--need-bg); color: var(--need); }
.side-area[data-area="work"] .side-count { background: var(--run-bg); color: var(--run); }
.side-lists { margin-top: var(--sp-2); }
.side-group { margin-top: var(--sp-4); }
.side-group-title { margin: 0 10px var(--sp-1); display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: 13px; font-weight: 550; letter-spacing: 0; }
.side-row {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); font-size: 15px; line-height: 1.3; text-align: left;
}
.side-row svg { width: 18px; height: 18px; color: var(--muted); }
.side-row:hover, .side-row[aria-current="page"] { background: var(--hover); color: var(--text); }
.side-row-text { flex: 1 1 auto; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.side-row.is-more { color: var(--muted); font-size: 14px; }
.side-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; }
.side-dot.run { background: var(--run); }
.side-dot.need { background: var(--need); }
.side-dot.fail { background: var(--fail); }
.side-empty { margin: var(--sp-3) 10px; color: var(--muted); font-size: var(--fs-14); }
.side-foot { flex: 0 0 auto; padding: var(--sp-2) 10px calc(var(--sp-2) + var(--safe-bottom)); border-top: 1px solid var(--line); }
.side-me { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: var(--sp-2); border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.side-me:hover { background: var(--hover); }
.side-me > svg { width: 20px; height: 20px; color: var(--muted); }
.side-avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px; }
.side-who { flex: 1 1 auto; min-width: 0; display: grid; }
.side-who b { font-size: 15px; font-weight: 600; }
.side-who span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scrim { display: none; }
#sidebar:focus { outline: none; }
.connection-state { min-height: 24px; display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2); color: var(--muted); font-size: var(--fs-12); }
/* Shown only when the Hub is not connected. */
.connection-state:has(> .dot.online) { display: none; }
.dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--warning); }
.dot.online { background: var(--success); }

/* ---------- Side panel: desktop right column, phone full screen ---------- */
.hub-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.hub-panel[hidden] { display: none !important; }
.hub-panel-head { height: 60px; flex: 0 0 auto; display: flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); border-bottom: 1px solid var(--line); }
.hub-panel-head h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 17px; font-weight: 620; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#hub-panel-title:focus { outline: none; }
#hub-panel-back { display: none; }
.hub-panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-4) var(--sp-5) calc(var(--sp-6) + var(--safe-bottom)); }
@media (min-width: 801px) {
  .shell.has-panel { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w); }
  .shell.has-panel.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr) var(--panel-w); }
  .shell.has-panel .hub-panel { animation: panel-in .24s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes panel-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------- Header (chat) ---------- */
.chat-view > * { grid-column: 1; }
.topbar {
  grid-row: 1; height: var(--header-h); min-width: 0;
  display: flex; align-items: center; gap: var(--sp-1);
  padding: 0 var(--sp-2); border-bottom: 1px solid transparent; background: var(--bg);
}
.thread-heading { flex: 1 1 auto; min-width: 0; margin: 0; font-size: inherit; font-weight: inherit; }
.thread-switch {
  max-width: 100%; min-height: var(--tap); min-width: 0;
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-2); border: 0; border-radius: var(--r-8);
  background: transparent; color: var(--text); text-align: left;
}
.thread-switch:hover { background: var(--surface-strong); }
.thread-switch-text { min-width: 0; display: grid; }
#thread-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-16); font-weight: var(--fw-strong); line-height: 1.25; }
#thread-project { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; line-height: 1.3; }
#thread-project:empty { display: none; }
.thread-switch-caret { width: 20px; height: 20px; color: var(--muted); }
.thread-subheading { min-width: 0; display: flex; align-items: center; gap: var(--sp-1); }
.thread-subheading:not(:has(> :not(.hidden))) { display: none; }
.attention-host { position: relative; }
.attention-dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--warning); display: none; }
.attention-host.has-attention .attention-dot, .shell.has-attention .panel-more .attention-dot { display: block; }

/* Chat status chips that remain in the header area (hidden unless shown). */
.thread-state { min-height: 24px; padding: 2px var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font-size: var(--fs-12); white-space: nowrap; }
.thread-state.compact-route { display: none; }
.swarm-summary, .usage-chip, #usage-chip, #swarm-summary { display: none !important; }

/* ---------- Panels (secondary screens) ---------- */
.panel-view { overflow-y: auto; padding: 0 max(var(--gutter), calc((100% - 880px) / 2)) calc(var(--sp-6) + var(--safe-bottom)); background: var(--bg); }
.panel-header { min-height: 64px; display: flex; align-items: center; gap: var(--sp-2); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); }
.panel-header > div { min-width: 0; flex: 1; }
.panel-header .eyebrow { display: none; }
.panel-header h1 { margin: 0; font-size: var(--fs-24); font-weight: var(--fw-strong); letter-spacing: -.01em; }
.panel-header .panel-menu { display: none; flex: 0 0 auto; margin-left: calc(-1 * var(--sp-2)); }
.shell.sidebar-collapsed .panel-header .panel-menu { display: inline-grid; }
.panel-header .panel-more { display: none; flex: 0 0 auto; margin-right: calc(-1 * var(--sp-2)); }
.panel-actions { display: flex; align-items: center; gap: var(--sp-2); }
.compact-button { min-height: var(--tap); padding: 0 var(--sp-3); }
.panel-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-3); }
.card { grid-column: span 4; min-width: 0; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-12); background: var(--surface); }
.card.wide { grid-column: span 8; }
.card.full { grid-column: 1 / -1; }
.card h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-16); font-weight: var(--fw-strong); }
/* Eyebrows read in sentence case: never shouted, never tracked. */
.eyebrow { margin: 0 0 var(--sp-1); color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-strong); letter-spacing: normal; text-transform: lowercase; }
.eyebrow::first-letter { text-transform: uppercase; }

/* ---------- Dialogs and sheets (#modal) ----------
   Desktop: a centred dialog. Phone: a bottom sheet with a handle, a close
   button and its main action kept at the bottom. */
dialog {
  width: min(560px, calc(100% - 32px - var(--safe-left) - var(--safe-right)));
  max-height: min(86dvh, 760px); overflow-y: auto; overscroll-behavior: contain;
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-12);
  background: var(--bg); color: var(--text); box-shadow: 0 24px 80px var(--shade-40);
}
dialog::backdrop { background: var(--scrim); }
#modal.is-wide { width: min(960px, calc(100% - 32px - var(--safe-left) - var(--safe-right))); }
dialog:focus, dialog:focus-visible { outline: none; }
dialog form { position: relative; padding: 0 var(--sp-5) var(--sp-5); }
#modal-content { padding-top: 0; }
#modal-content > :first-child > :first-child:is(p, .sheet-body) { margin-top: var(--sp-1); }
.sheet-bar {
  position: sticky; top: 0; z-index: 6;
  display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-2);
  min-height: var(--tap);
  margin-inline: calc(-1 * var(--sp-5)); padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-5);
  background: var(--bg); box-shadow: 0 1px 0 transparent; transition: box-shadow .15s ease;
}
.sheet-bar.is-scrolled { box-shadow: 0 1px 0 var(--line); }
.sheet-bar-title { flex: 1 1 auto; min-width: 0; }
.sheet-bar-title:empty { display: none; }
.sheet-bar-title > h2 { margin: 0; font-size: var(--fs-20); line-height: 1.25; overflow-wrap: anywhere; }
.sheet-handle { display: none; }
.dialog-close {
  flex: 0 0 auto;
  width: var(--tap); height: var(--tap); padding: 0; display: grid; place-items: center;
  border: 0; border-radius: var(--r-8); background: var(--bg); color: var(--muted);
}
.dialog-close:hover { background: var(--surface-strong); color: var(--text); }
dialog h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-20); font-weight: var(--fw-strong); letter-spacing: -.01em; }
.dialog-form label { display: block; margin: var(--sp-3) 0; color: var(--muted); font-size: var(--fs-14); }
.dialog-form input, .dialog-form textarea, .dialog-form select { display: block; width: 100%; margin-top: 6px; padding: 10px var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-8); background-color: var(--surface); outline: 0; font-size: var(--fs-16); }
.dialog-form select { padding-right: 36px; }
.dialog-form textarea { min-height: 110px; resize: vertical; }
.dialog-form input:focus, .dialog-form textarea:focus, .dialog-form select:focus { border-color: var(--line-strong); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-4); }
.split-actions { justify-content: space-between; align-items: center; }
.split-actions > div { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* openSheet(): title, body and a footer that stays at the bottom. */
.sheet { min-width: 0; }
.sheet-title { margin: 0 0 var(--sp-3); }
.sheet-body { min-width: 0; }
.sheet-footer {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; gap: var(--sp-2); align-items: center;
  margin: var(--sp-4) calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5));
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + var(--safe-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.sheet-footer > .primary { flex: 1 1 auto; }
.screen-row-danger .nav-row-label { color: var(--danger); }
.project-settings .screen-rows { margin: var(--sp-2) 0; }
.project-settings-more > summary { min-height: var(--tap); display: flex; align-items: center; }
.project-settings-more > :not(summary) { margin-top: var(--sp-3); }
.sheet-footer > button, .dialog-actions > button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.sheet-footer svg, .dialog-actions button svg { width: 20px; height: 20px; }
.sheet-search { width: 100%; margin-bottom: var(--sp-2); }

/* Navigation rows used by the switcher, the rail and the command sheet. */
.nav-group { margin: 0 0 var(--sp-2); }
.nav-group-title { margin: 0; padding: var(--sp-3) var(--sp-2) var(--sp-1); color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-strong); }
.nav-group-title.with-action { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding-block: var(--sp-1) 0; }
.nav-row {
  width: 100%; min-height: 48px; min-width: 0;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2); border: 0; border-radius: var(--r-8);
  background: transparent; color: var(--text); text-align: left; font-size: var(--fs-16);
}
.nav-row:hover, .nav-row:focus-visible { background: var(--surface-strong); }
.nav-row[aria-current="true"] { background: var(--surface-strong); }
.nav-row > svg { width: 22px; height: 22px; color: var(--muted); }
.nav-row-text { min-width: 0; flex: 1 1 auto; display: grid; gap: 1px; }
.nav-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-14); }
.nav-row-meta.is-working { color: var(--success); }
.nav-row-meta.is-attention { color: var(--warning); }
.nav-row-meta.is-failed { color: var(--danger); }
.nav-row-trail { flex: 0 0 auto; display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-14); }
.nav-row-trail svg { width: 20px; height: 20px; }
.nav-row.is-danger, .nav-row.is-danger > svg { color: var(--danger); }
.nav-row:disabled { opacity: .45; }
.nav-row.is-more { min-height: var(--tap); color: var(--muted); font-size: var(--fs-14); }
.new-chat-in { min-width: 0; }
.new-chat-in > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-split { display: flex; align-items: stretch; gap: 2px; }
.nav-split > .nav-row { flex: 1 1 auto; }
.nav-split > .icon-button { flex: 0 0 auto; align-self: center; }
.nav-divider { height: 1px; margin: var(--sp-2) 0; border: 0; background: var(--line); }
.nav-empty { margin: 0; padding: var(--sp-2); color: var(--muted); font-size: var(--fs-14); }
.nav-more > summary { min-height: 48px; display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2); border-radius: var(--r-8); color: var(--text); cursor: pointer; list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary > svg:last-child { margin-left: auto; width: 20px; height: 20px; color: var(--muted); transition: transform .15s ease; }
.nav-more[open] > summary > svg:last-child { transform: rotate(180deg); }
.nav-more > summary > svg:first-child { width: 22px; height: 22px; color: var(--muted); }
.nav-more > summary:hover { background: var(--surface-strong); }
/* Command sheet: Go to as a two-column grid, like the desktop rail. */
.nav-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-1); }
.nav-grid > .nav-row { gap: var(--sp-2); }
.switcher-status { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2); color: var(--muted); font-size: var(--fs-12); }

/* The rail reuses the switcher rows at a denser size. */
.rail-scroll .nav-row { min-height: 40px; font-size: var(--fs-14); gap: var(--sp-2); }
.rail-scroll .nav-row.is-more { min-height: 36px; }
.rail-scroll .nav-row-meta { font-size: var(--fs-12); }
.rail-scroll .nav-row > svg { width: 20px; height: 20px; }
.rail-scroll .sheet-search { margin: var(--sp-2) 0 0; min-height: 40px; font-size: var(--fs-14); }
.rail-scroll .icon-button { width: 36px; height: 36px; }

/* Help and appearance sheets */
.help-guide section { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.help-guide h3 { margin: 0 0 var(--sp-1); font-size: var(--fs-16); }
.help-guide p { margin: 0 0 var(--sp-2); color: var(--muted); font-size: var(--fs-14); line-height: 1.5; }
.choice-rows { display: grid; gap: var(--sp-2); }
.choice-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); font-size: var(--fs-16); text-align: left; }
.choice-row[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.choice-row-text { display: grid; gap: 2px; padding: var(--sp-2) 0; }
.choice-row small { color: var(--muted); font-size: var(--fs-14); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: auto; right: auto; left: 50%; bottom: calc(var(--sp-5) + var(--safe-bottom)); z-index: 120;
  margin: 0; border: 0; height: auto; overflow: visible;
  width: max-content; max-width: min(560px, calc(100% - 32px));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px var(--sp-4); border-radius: var(--r-12);
  background: var(--text); color: var(--bg); box-shadow: 0 12px 40px var(--shade-25);
  font-size: var(--fs-14); line-height: 1.4; overflow-wrap: anywhere;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* The limit notice's single action ("Switch now"). */
.toast.has-action { display: flex; align-items: center; gap: var(--sp-3); pointer-events: auto; }
.toast-action { flex: 0 0 auto; min-height: 36px; padding: 0 var(--sp-2); border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- Phone (800px and below) ---------- */
@media (max-width: 800px) {
  .shell, .shell.sidebar-collapsed { display: block; position: relative; }
  .main { width: 100%; }
  /* The sidebar becomes a drawer over the page. */
  .sidebar, .shell.sidebar-collapsed .sidebar {
    visibility: hidden; position: fixed; z-index: 90; top: 0; bottom: 0; left: 0;
    width: min(86vw, 340px); padding-top: var(--safe-top);
    transform: translateX(-100%); transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: 0 0 0 1px var(--line);
  }
  .shell.drawer-open .sidebar { visibility: visible; transform: none; transition: transform .22s ease; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 89; border: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .shell.drawer-open .side-scrim { opacity: 1; pointer-events: auto; }
  #sidebar-toggle, .shell:not(.sidebar-collapsed) #sidebar-toggle { display: inline-grid; }
  .hub-panel { position: fixed; z-index: 80; inset: 0; padding-top: var(--safe-top); border-left: 0; animation: sheet-up .2s ease; }
  #hub-panel-back { display: inline-grid; }
  #hub-panel-close { display: none; }
  .hub-panel-body { padding: var(--sp-3) var(--gutter) calc(var(--sp-6) + var(--safe-bottom)); }
  .topbar { padding: 0 var(--sp-1) 0 var(--sp-1); }
  .panel-view { padding: 0 var(--gutter) calc(var(--sp-6) + var(--safe-bottom)); }
  .panel-header { min-height: var(--header-h); margin: 0 calc(-1 * var(--gutter)) var(--sp-4); padding: 0 var(--sp-1); position: sticky; top: 0; z-index: 10; background: var(--bg); }
  .panel-header h1 { font-size: var(--fs-20); }
  .panel-header .panel-menu, .panel-header .panel-more { display: inline-grid; margin: 0; }
  .panel-grid { display: block; }
  .card { margin-bottom: var(--sp-3); }
  dialog, #modal, #modal.is-wide {
    width: 100%; max-width: 100%; max-height: calc(92dvh - var(--safe-top));
    margin: auto 0 0; border-width: 1px 0 0; border-radius: var(--r-12) var(--r-12) 0 0;
    animation: sheet-up .22s ease;
  }
  dialog form { padding: 0 calc(var(--gutter) + var(--safe-right)) calc(var(--sp-5) + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left)); }
  .sheet-bar {
    margin-left: calc(-1 * (var(--gutter) + var(--safe-left)));
    margin-right: calc(-1 * (var(--gutter) + var(--safe-right)));
    padding: var(--sp-3) calc(var(--sp-2) + var(--safe-right)) var(--sp-1) calc(var(--gutter) + var(--safe-left));
  }
  .sheet-handle { display: block; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: var(--r-pill); background: var(--line-strong); }
  .sheet-handle::before { content: ''; position: absolute; inset: -12px -48px; }
  .sheet-handle, .sheet-bar { touch-action: none; }
  /* A sheet with a title in its bar keeps the title clear of the grab handle. */
  dialog#modal .sheet-bar:has(> .sheet-bar-title:not(:empty)) { padding-top: 24px; }
  .sheet-footer { margin: var(--sp-4) calc(-1 * var(--gutter)) calc(-1 * (var(--sp-5) + var(--safe-bottom))); padding: var(--sp-3) var(--gutter) calc(var(--sp-3) + var(--safe-bottom)); }
  /* A dialog's own action row stays reachable at the bottom of the sheet. */
  #modal-content > * > .dialog-actions:last-child, #modal-content > * > .dialog-form > .dialog-actions:last-child { position: sticky; bottom: 0; z-index: 3; padding: var(--sp-3) 0; background: var(--bg); box-shadow: 0 -1px 0 var(--line); }
  .dialog-actions > .primary { flex: 1 1 auto; }
  .toast { bottom: calc(var(--sp-4) + var(--safe-bottom)); }
}
/* Small laptops and tablets: a narrower rail leaves the chat more room. */
@media (min-width: 801px) and (max-width: 1200px) {
  :root { --rail-w: 256px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  dialog, #modal { animation: none; }
  .sidebar, .side-scrim, .hub-panel { transition: none !important; animation: none !important; }
  .toast { transition: none; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .shell, .shell.sidebar-collapsed { display: block; }
  .main { width: 100%; }
  .sidebar, .shell.sidebar-collapsed .sidebar { visibility: hidden; position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: min(60vw, 340px); transform: translateX(-100%); }
  .shell.drawer-open .sidebar { visibility: visible; transform: none; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 89; border: 0; background: var(--scrim); opacity: 0; pointer-events: none; }
  .shell.drawer-open .side-scrim { opacity: 1; pointer-events: auto; }
  #sidebar-toggle { display: inline-grid; }
  .hub-panel { position: fixed; z-index: 80; inset: 0; }
  .panel-header .panel-menu, .panel-header .panel-more { display: inline-grid; }
  .topbar { height: 48px; }
  #thread-project { display: none; }
  .thread-state.compact-route { min-width: var(--tap); height: var(--tap); display: flex; align-items: center; }
}

/* ==========================================================================
   Shared components and older rules kept until Stage 2 moves them.
   ========================================================================== */
.device-pair-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.device-pair-form label { display: grid; gap: 6px; min-width: min(100%, 250px); color: var(--muted); font-size: var(--fs-14); }
.device-pair-form input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--bg); }
.device-row h4, .device-row p { margin: 2px 0; overflow-wrap: anywhere; }
.device-actions button { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.device-live-screen { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--media-bg); border-radius: var(--r-8); touch-action: none; outline: 0; }
.device-live-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.device-platform summary { cursor: pointer; font-weight: var(--fw-strong); }
.device-platform pre { max-width: 100%; overflow: auto; padding: 10px; border-radius: var(--r-8); background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-12); }
.sean-call-bar { position: absolute; top: 72px; left: 50%; z-index: 34; width: min(430px, calc(100% - 24px)); transform: translateX(-50%); display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); box-shadow: 0 8px 24px var(--shade-20); }
.sean-call-bar > div { min-width: 0; display: grid; gap: 2px; }
.sean-call-bar strong { font-size: var(--fs-14); }
.sean-call-bar #sean-call-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-12); }
.sean-call-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); animation: sean-pulse 1.8s infinite; }
.sean-call-bar .danger-button { min-height: 34px; padding: 6px 10px; border: 1px solid var(--danger); border-radius: var(--r-8); background: var(--danger); color: var(--on-danger); font-size: var(--fs-12); }
@keyframes sean-pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chat-view { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--header-h) auto auto minmax(0, 1fr) auto auto; min-height: 0; overflow: hidden; }
.project-overview > h1,.project-overview > h2 { margin-bottom: 5px; }
.project-overview-purpose { margin: 0 0 14px; color: var(--muted); font-size: var(--fs-14); line-height: 1.5; }
.project-overview-fact { min-width: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.project-overview-fact h3 { margin: 0 0 5px; font-size: var(--fs-14); }
.project-overview-latest { margin: 8px 0; padding: 11px 13px; border-left: 3px solid var(--success); background: color-mix(in srgb,var(--success) 5%,transparent); }
.project-control-changes { margin: 9px 0; padding: 11px 13px; border: 1px solid color-mix(in srgb,var(--accent) 40%,var(--line)); border-radius: var(--r-8); background: color-mix(in srgb,var(--accent) 5%,var(--surface)); }
.project-control-section-heading h3,.project-control-changes > p { margin: 0; }
.project-control-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 9px 0; }
.project-control-list { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.project-control-list h3,.project-control-list > p { margin: 0; font-size: var(--fs-12); }
.creative-delivery-links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; min-width: 0; margin-top: 8px; }
.creative-delivery-links > a,.creative-delivery-links > button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; max-width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-12); line-height: 1.4; text-align: left; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.project-control-list .project-work-source > summary { min-height: 36px; display: flex; align-items: center; }
.project-control-more { margin-top: 9px; }
.project-control-more-note { margin: 9px 0 0; font-size: var(--fs-12); }
.project-control-actions { border-left: 3px solid var(--warning); }
.project-control-failures { border-left: 3px solid var(--danger); }
.project-coverage { margin: 14px 0; padding: 13px; border: 1px solid var(--line); border-radius: var(--r-12); background: var(--surface); }
.project-coverage > p { margin: 7px 0; font-size: var(--fs-12); line-height: 1.45; }
.project-coverage-note { color: var(--muted); }
.project-coverage-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 7px; }
.project-overview-disclosure { margin: 8px 0; border-top: 1px solid var(--line); }
.project-overview-disclosure > summary span { color: var(--muted); font-size: var(--fs-12); text-align: right; }
.project-overview-list { margin: 8px 0 14px; }
.project-overview-list h3 { margin: 0 0 6px; font-size: var(--fs-12); }
.project-overview-list p { margin: 0; font-size: var(--fs-12); line-height: 1.45; }
.project-work-records { margin-top: 12px; border-top: 1px solid var(--line); }
.project-work-counts,.project-work-intro { margin: 0; }
.project-work-controls { display: grid; gap: 7px; margin: 10px 0; }
.project-work-archived { width: max-content; max-width: 100%; }
.project-work-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.project-work-row > p { margin: 4px 0 0; font-size: var(--fs-12); }
.project-work-source { margin-top: 7px; }
.project-work-thread { margin-top: 8px; }
.thread-state:hover, .thread-state:focus-visible { border-color: color-mix(in srgb,var(--accent) 50%,var(--line)); color: var(--text); outline: none; }
.thread-state.working { border-color: color-mix(in srgb,var(--success) 45%,var(--line)); background: color-mix(in srgb,var(--success) 8%,var(--surface)); color: var(--success); }
.thread-state.queued, .thread-state.open { border-color: color-mix(in srgb,var(--accent) 42%,var(--line)); background: color-mix(in srgb,var(--accent) 7%,var(--surface)); color: var(--text); }
.thread-state.needs-you, .thread-state.blocked, .thread-state.paused, .thread-state.provider-limit, .thread-state.allowance-reached, .thread-state.failed, .thread-state.stopped { border-color: color-mix(in srgb,var(--warning) 48%,var(--line)); background: color-mix(in srgb,var(--warning) 8%,var(--surface)); color: color-mix(in srgb,var(--warning) 72%,var(--text)); }
.thread-state.failed { border-color: color-mix(in srgb,var(--danger) 48%,var(--line)); background: color-mix(in srgb,var(--danger) 7%,var(--surface)); color: var(--danger); }
.thread-state.complete { border-color: color-mix(in srgb,var(--success) 34%,var(--line)); color: var(--muted); }
.working-document-list { display: grid; gap: 8px; margin: 14px 0; }
.working-document-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.working-document-row strong { overflow-wrap: anywhere; }
.working-document-row p { margin: 4px 0 0; font-size: var(--fs-12); }
.working-document-row .dialog-actions { margin: 0; }
.working-document-preview { max-height: 40vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); font: var(--fs-12)/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.goal-banner { grid-row: 2; width: min(760px, calc(100% - 32px)); margin: 4px auto 0; padding: 8px 10px 8px 13px; border: 1px solid var(--line); border-radius: var(--r-8); display: flex; align-items: center; gap: 12px; background: var(--surface); }
.goal-banner p { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-12); }
.prompt-rail { grid-row: 4; z-index: 4; width: 24px; min-height: 0; margin: 14px 4px 14px 0; justify-self: end; align-self: stretch; position: relative; border-radius: var(--r-pill); background: color-mix(in srgb,var(--line) 35%,transparent); }
.prompt-rail-mark { position: absolute; left: 0; top: clamp(12px,var(--prompt-position),calc(100% - 12px)); width: 24px; height: 24px; margin: -12px 0 0; padding: 0; border: 0; background: transparent; outline: none; }
.prompt-rail-mobile-button { display: none; }
.prompt-navigator-search { width: 100%; height: 44px; margin-top: 16px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); font-size: var(--fs-16); outline: 0; }
.prompt-navigator-status { margin: 10px 0 0; color: var(--muted); font-size: var(--fs-12); }
.prompt-navigator-list { max-height: min(58vh,520px); margin-top: 8px; overflow: auto; border-top: 1px solid var(--line); }
.prompt-navigator-item { width: 100%; min-height: 58px; display: grid; gap: 4px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--text); text-align: left; }
.history-loader { display: flex; justify-content: center; margin: -8px 0 22px; }
.empty-state { width: min(480px, 100%); margin: 18vh auto 0; text-align: center; }
.empty-state h2 { margin: 0; font-size: var(--fs-24); letter-spacing: -.025em; }
.empty-state p { margin: 9px 0 0; color: var(--muted); font-size: var(--fs-14); }
.empty-state > button { margin-top: var(--sp-4); }
.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 13px; width: 100%; margin: 0 0 28px; }
.message-focus { border-radius: var(--r-12); outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent); outline-offset: 8px; }
.latest-completed-result { width: calc(100% - 43px); margin: -8px 0 20px 43px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--r-8); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.latest-completed-copy { min-width: 0; display: grid; gap: 2px; }
.message-meta { min-height: 21px; display: flex; align-items: center; gap: 8px; margin-bottom: 3px; color: var(--muted); font-size: var(--fs-12); }
.message-branch { width: 25px; height: 25px; margin-left: 2px; padding: 0; border: 0; border-radius: var(--r-8); background: transparent; color: var(--faint); opacity: 0; display: inline-grid; place-items: center; }
.imported-payload > summary span { margin-left: auto; color: var(--muted); font-size: var(--fs-12); }
.live-activity { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.live-activity > summary strong { font-size: var(--fs-12); }
.activity-pulse, .activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.live-activity-feed { display: grid; gap: 0; padding: 4px 12px 10px; border-top: 1px solid var(--line); }
.live-activity-row { min-width: 0; display: grid; grid-template-columns: 6px 88px minmax(0,1fr) auto; align-items: start; gap: 9px; padding: 9px 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.live-activity-row.work .activity-dot, .live-activity-row.instruction .activity-dot, .live-activity-row.coordination .activity-dot { background: var(--accent); }
.live-activity-row.tool .activity-dot { background: var(--warning); }
.live-activity-row.skill .activity-dot { background: var(--violet); }
.tool-icon { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: var(--r-8); background: var(--surface-strong); color: var(--muted); font: var(--fs-12)/1 var(--font-mono); }
.tool-activity-detail { min-width: 0; display: grid; gap: 6px; padding: 0 0 10px 26px; }
.tool-detail-label { margin: 4px 0 0; color: var(--faint); font-size: var(--fs-12); letter-spacing: .04em; text-transform: uppercase; }
.tool-detail-fact, .tool-detail-note { margin: 0; color: var(--muted); font-size: var(--fs-12); }
.tool-pre { max-height: 260px; margin: 0; padding: 8px 10px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--bg); color: var(--text); font: var(--fs-12)/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-diff .diff-add { color: var(--success); }
.tool-diff .diff-del { color: var(--danger); }
.tool-diff .diff-hunk { color: var(--faint); }
.tool-paths { margin: 0; padding: 0 0 0 16px; color: var(--muted); font: var(--fs-12)/1.5 var(--font-mono); overflow-wrap: anywhere; }
@keyframes activity-pulse { 70%,100% { box-shadow: 0 0 0 6px transparent; } }
.attempt-technical { overflow: hidden; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.attempt-technical > summary strong { color: var(--text); font-size: var(--fs-12); }
.attempt-technical > summary span { color: var(--faint); font-size: var(--fs-12); }
.work-history-summary { width: min(calc(100% - 42px), 860px); margin: 4px 0 18px 42px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-12); background: var(--surface); }
.work-history-summary > summary strong { color: var(--text); font-size: var(--fs-12); }
.work-history-summary > summary span { min-width: 0; margin-left: auto; overflow: hidden; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.work-history-body { display: grid; gap: 14px; padding: 14px; border-top: 1px solid var(--line); }
.work-history-explanation, .work-history-facts p, .work-history-incident p, .work-history-technical-body p { margin: 0; overflow-wrap: anywhere; font-size: var(--fs-12); line-height: 1.5; }
.work-history-facts { display: grid; gap: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: color-mix(in srgb,var(--surface-strong) 55%,var(--surface)); }
.work-history-incidents { display: grid; gap: 9px; }
.work-history-incidents > h2 { margin: 0 0 2px; font-size: var(--fs-14); }
.work-history-incident { min-width: 0; display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-left: 3px solid var(--warning); border-radius: var(--r-8); background: var(--bg); }
.work-history-incident-heading, .work-history-audit-heading { min-width: 0; display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.work-history-incident-heading h3 { margin: 0; font-size: var(--fs-14); line-height: 1.4; }
.work-history-checkpoint { margin-top: 3px !important; padding-top: 7px; border-top: 1px solid var(--line); }
.work-history-technical-body { display: grid; gap: 6px; padding: 0 0 8px; color: var(--muted); }
.work-history-audit > summary strong { font-size: var(--fs-12); }
.work-history-audit > summary span { color: var(--muted); font-size: var(--fs-12); }
.work-history-audit-body { display: grid; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.work-history-audit-item { min-width: 0; display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-8); }
.work-history-audit-item p { margin: 0; overflow-wrap: anywhere; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.work-history-audit-status, .work-history-audit-end, .work-history-loading { margin: 0; font-size: var(--fs-12); }
.retry-turn { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); padding: 7px 10px; color: var(--text); font-size: var(--fs-12); }
.markdown p { margin: 0 0 .75em; }
.markdown h1, .markdown h2, .markdown h3 { margin: 1.15em 0 .5em; line-height: 1.25; }
.markdown h1 { font-size: 1.35em; }
.markdown h2 { font-size: 1.2em; }
.markdown h3 { font-size: 1.08em; }
.markdown code { padding: 1px 4px; border-radius: var(--r-8); background: var(--surface-strong); font: var(--fs-12)/1.5 var(--font-mono); }
.markdown pre { margin: .7em 0; padding: 13px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.code-block-bar { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 4px 3px 13px; border-bottom: 1px solid var(--line); }
.code-copy { flex: 0 0 auto; min-height: 28px; padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--bg); color: var(--muted); font-size: var(--fs-12); }
.code-fold-toggle { display: block; width: 100%; min-height: 32px; margin: 0; padding: 6px 13px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--muted); font-size: var(--fs-12); text-align: center; }
.code-fold-toggle:hover { color: var(--text); }
.code-fold-toggle:focus-visible { outline: 2px solid color-mix(in srgb,var(--accent) 72%,var(--white)); outline-offset: -2px; }
.markdown hr { margin: 1em 0; border: 0; border-top: 1px solid var(--line); }
.markdown-table-scroll { max-width: 100%; margin: .75em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-8); }
.markdown-table th { background: var(--surface-strong); font-weight: var(--fw-strong); }
.source-prompt { margin: 5px 0 3px 23px; padding: 6px 8px; border-left: 2px solid var(--line); background: var(--surface-2); border-radius: 0 var(--r-8) var(--r-8) 0; }
.source-prompt-label { min-height: 32px; display: flex; align-items: center; cursor: pointer; list-style: none; font-size: var(--fs-12); font-weight: var(--fw-strong); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.attachments { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.current-status-card > summary strong { font-size: var(--fs-12); white-space: nowrap; }
.current-status-card > summary span { min-width: 0; overflow: hidden; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.current-status-details > .muted { margin: 0; font-size: var(--fs-12); }
.chat-decision p { margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: var(--fs-12); line-height: 1.45; }
.collaboration-review { margin-top: 10px; padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--r-8); background: transparent; color: var(--muted); font-size: var(--fs-12); }
.collaboration-agent summary { min-height: var(--tap); display: grid; grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 0 12px; cursor: pointer; }
.collaboration-result { max-height: min(52vh,520px); overflow: auto; padding: 5px 12px 12px; }
.workflow-agent-trail > p { margin: 0 0 8px; font-size: var(--fs-12); }
.workflow-trail-row.tool summary { display: grid; grid-template-columns: minmax(0,1fr) auto; min-height: 24px; padding: 0; border: 0; }
.workflow-agent-controls label { display: grid; gap: 6px; color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-strong); }
.workflow-agent-controls textarea { width: 100%; min-height: 74px; resize: vertical; }
.composer textarea { display: block; width: 100%; min-height: 56px; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent; padding: 15px 17px 5px; font-size: var(--fs-16); line-height: 1.45; }
.work-mode-control select { width: 66px; height: 28px; padding: 0 3px; border: 0; background: transparent; color: inherit; font-size: var(--fs-12); font-weight: var(--fw-strong); }
.work-mode-control select:not([multiple]) { padding: 0 16px 0 3px; background-position: calc(100% - 2px) 55% !important; background-size: 12px 12px !important; }
.composer .icon-button { width: 34px; height: 34px; }
/* The popover scrolls within the room left above or below the chip; its
   heading and close button stay in view while it does. */
.runtime-heading { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; position: sticky; top: -14px; z-index: 2; margin: -14px -14px 0; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.runtime-heading .icon-button { width: 30px; height: 30px; margin: -7px -7px -7px 4px; font-size: var(--fs-20); }
.runtime-popover label, .conversation-runtime label { display: grid; gap: 5px; color: var(--muted); font-size: var(--fs-12); }
.runtime-popover select, .runtime-popover input, .conversation-runtime select, .conversation-runtime input { width: 100%; min-width: 0; min-height: var(--tap); height: auto; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); font-size: var(--fs-14); }
.runtime-popover select:focus-visible, .runtime-popover input:focus-visible, .runtime-popover button:focus-visible, .runtime-popover summary:focus-visible,
.conversation-runtime select:focus-visible, .conversation-runtime input:focus-visible, .conversation-runtime button:focus-visible, .conversation-runtime summary:focus-visible { outline: 2px solid color-mix(in srgb,var(--accent) 72%,var(--white)); outline-offset: 2px; }
.runtime-advanced { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.runtime-advanced > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.runtime-advanced > summary::-webkit-details-marker { display: none; }
.runtime-advanced > summary::after { content: '›'; color: var(--faint); font-size: var(--fs-20); transition: transform .15s ease; }
.runtime-advanced[open] > summary::after { transform: rotate(90deg); }
.runtime-advanced > summary strong { color: var(--text); font-size: var(--fs-12); }
.runtime-advanced > summary span { margin-left: auto; color: var(--faint); font-size: var(--fs-12); }
#runtime-delegation-summary:not(:empty) { color: var(--success); font-weight: var(--fw-strong); }
.runtime-advanced-body { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 4px 0 8px; }
.runtime-advanced-body > .toggle-button { grid-column: 1 / -1; justify-self: start; }
.conversation-summary-body { display: grid; gap: 8px; padding: 4px 6px 8px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line); max-height: 60vh; overflow-y: auto; font-size: var(--fs-12); line-height: 1.45; }
.conversation-summary-body p { margin: 0; overflow-wrap: anywhere; }
.runtime-more-link > span:first-child { min-width: 0; display: grid; gap: 2px; }
.runtime-subagents { grid-column: 1 / -1; padding-top: 5px; }
.subagent-policy-form[aria-busy=true] { opacity: .72; }
.subagent-policy-error { margin: 0; padding: 9px 10px; border: 1px solid color-mix(in srgb,var(--danger) 38%,var(--line)); border-radius: var(--r-8); background: color-mix(in srgb,var(--danger) 6%,var(--surface)); color: var(--danger); font-size: var(--fs-12); line-height: 1.45; }
.subagent-capabilities { min-width: 0; margin: 0; padding: 9px 10px 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.runtime-popover .subagent-capability-option, .conversation-runtime .subagent-capability-option { min-height: 30px; display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: center; gap: 7px; color: var(--text); font-size: var(--fs-12); }
.runtime-popover .subagent-capability-option input, .conversation-runtime .subagent-capability-option input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); }
.subagent-effective-capacity { margin: 0; padding: 8px 10px; border: 1px solid color-mix(in srgb,var(--success) 34%,var(--line)); border-radius: var(--r-8); background: color-mix(in srgb,var(--success) 6%,var(--surface)); color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.subagent-budget-note { margin: 0; color: var(--faint); font-size: var(--fs-12); line-height: 1.45; }
.subagent-policy-form :disabled { cursor: not-allowed; opacity: .55; }
.runtime-section-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.runtime-section-heading strong { color: var(--text); font-size: var(--fs-12); }
.runtime-section-heading span { color: var(--faint); font-size: var(--fs-12); text-align: right; }
.runtime-toggles { grid-column: 1 / -1; display: flex; gap: 7px; padding-top: 2px; }
.choice-source { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; }
.choice-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: var(--fs-12); }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.choice-option { position: relative; min-width: 0; min-height: 64px; display: grid; align-content: center; gap: 4px; padding: 11px 12px 11px 16px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); text-align: left; }
.choice-option::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line); content: ''; }
.choice-option[data-value=chat]::before { background: var(--muted); }
.choice-option[data-value=read]::before { background: var(--success); }
.choice-option[data-value=write]::before { background: var(--accent); }
.choice-option[data-value=full]::before { background: var(--warning); }
.choice-option strong { font-size: var(--fs-12); }
.choice-option small { color: var(--muted); font-size: var(--fs-12); line-height: 1.4; white-space: normal; }
.choice-option[aria-pressed=true] { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 9%,var(--surface)); box-shadow: inset 3px 0 var(--accent); }
.choice-option[aria-pressed=true] small { color: var(--muted); }
.choice-option:disabled { cursor: not-allowed; opacity: .5; }
.choice-detail { min-height: 28px; margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.4; }
.dialog-permission-picker { display: grid; gap: 8px; margin: 16px 0; padding: 0; border: 0; }
.dialog-permission-picker legend { margin-bottom: 7px; color: var(--muted); font-size: var(--fs-12); }
.project-repository-boundary { display: grid; gap: 7px; margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.project-repository-boundary:empty { display: none; }
.project-repository-boundary strong { font-size: var(--fs-12); }
.project-repository-boundary code { overflow-wrap: anywhere; color: var(--text); font-size: var(--fs-12); }
.project-repository-boundary p,.project-repository-boundary small { margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
@media (max-width: 560px) {
.choice-grid { grid-template-columns: minmax(0,1fr); }
.choice-option { min-height: 64px; }
.choice-option small { overflow: visible; text-overflow: clip; white-space: normal; }
}
@keyframes settings-arrive { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: none; } }
/* The meter's top rule opens the usage section; its reset and 7-day line
   follows it, and the conversation totals get a rule of their own. */
.runtime-cost { grid-column: 1 / -1; min-height: 15px; padding-top: 4px; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.runtime-usage { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); }
.conversation-usage { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.conversation-usage p { margin: 0; overflow-wrap: anywhere; }
.usage-progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: var(--r-pill); appearance: none; }
.usage-progress::-moz-progress-bar { border-radius: var(--r-pill); background: var(--accent); }
.settings-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-top: 13px; }
.settings-form label { display: grid; gap: 5px; color: var(--muted); font-size: var(--fs-12); }
.settings-form select, .settings-form input { width: 100%; min-width: 0; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); }
/* 'This conversation' in Tools & settings: helpers, limit recovery and usage
   for the open conversation, moved out of the Runtime popover. */
.conversation-settings { margin-bottom: 12px; }
.conversation-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.conversation-settings-heading h3 { margin-bottom: 3px; }
.conversation-settings-heading p { margin: 0; overflow-wrap: anywhere; font-size: var(--fs-12); }
.benchmark-layout > .card { grid-column: auto; margin: 0; }
.model-research { grid-column: 1 / -1; }
.model-research h2 { margin-top: 0; }
.model-research h3 { font-size: var(--fs-16); margin: 18px 0 8px; }
.research-candidate h3 { margin: 0 0 6px; }
.research-candidate p { margin: 6px 0; }
.benchmark-setup h2, .benchmark-saved h2 { font-size: var(--fs-20); margin: 0 0 10px; }
.benchmark-setup label { display: grid; gap: 7px; font-size: var(--fs-14); min-width: 0; }
.benchmark-setup input, .benchmark-setup select { width: 100%; min-width: 0; min-height: 44px; padding: 9px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
.benchmark-preview h3 { margin-top: 0; }
.benchmark-run-list { display: grid; gap: 10px; margin-top: 14px; }
.benchmark-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.browser-status { color: var(--muted); font-size: var(--fs-12); }
.browser-transfer-status, .browser-downloads { color: var(--muted); font-size: var(--fs-12); }
.browser-download { color: var(--accent); overflow-wrap: anywhere; }
.browser-frame { width: 100%; height: 100%; min-height: 0; border: 0; background: var(--media-bg); }
.browser-input-shield { position: absolute; inset: 0; z-index: 2; border: 0; border-radius: 0; display: grid; place-content: center; gap: 5px; background: var(--media-scrim); color: var(--text); text-align: center; }
.browser-empty { margin: auto; padding: 24px; text-align: center; color: var(--muted); }
.change-summary p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-12); }
.change-state { flex: 0 0 auto; padding: 6px 9px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--warning) 13%, transparent); color: var(--warning); font-size: var(--fs-12); font-weight: var(--fw-strong); }
.change-file-disclosure { color: var(--faint); font: var(--fs-12)/1.4 var(--font-mono); }
#modal:has(.turn-diff) { width: min(960px, calc(100% - 28px - var(--safe-left) - var(--safe-right))); }
.change-file pre.turn-diff-patch { padding: 8px 0; }
.recovery-card > p { margin: -3px 0 10px; font-size: var(--fs-12); line-height: 1.5; }
.inline-link { display: inline-block; margin-top: 12px; color: var(--text); font-size: var(--fs-12); text-underline-offset: 3px; }
.connection-warning p { max-width: 650px; margin: 0 0 12px; color: var(--muted); font-size: var(--fs-14); line-height: 1.55; }
.life-summary h2 { margin: 0 0 5px; font-size: var(--fs-16); }
.life-summary p { margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.5; }
.spotify-controls-heading p:last-child, .spotify-consent-note p, .spotify-permissions p { margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.5; }
.spotify-permissions { color: var(--muted); font-size: var(--fs-12); }
.spotify-scopes { margin-top: 7px !important; overflow-wrap: anywhere; font: var(--fs-12)/1.55 var(--font-mono)!important; }
.spotify-device-row label, .spotify-track-row label, .spotify-volume label { display: grid; gap: 6px; color: var(--muted); font-size: var(--fs-12); }
.spotify-device-row select, .spotify-track-row input { width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--bg); color: var(--text); }
.spotify-volume input { width: 100%; min-height: 30px; accent-color: var(--accent); }
.spotify-feedback { min-height: 18px; color: var(--muted); font-size: var(--fs-12); }
.spotify-queue p { margin: 0; color: var(--muted); line-height: 1.45; }
.life-notice { padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); }
.connected { color: var(--success) !important; }
.disconnected { color: var(--warning) !important; }
.severity { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.obligation p { margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.obligation select { height: 32px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); padding: 0 7px; font-size: var(--fs-12); }
.action-card p { margin: 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.5; }
.action-details { width: max-content; max-width: 100%; margin-top: 8px; }
.browser-action-review .dialog-actions button { min-height: 44px; }
/* DNS setup Actions: numbered steps with copyable CNAME and cloudflared values. */
.action-setup { width: min(680px,100%); margin-top: 8px; }
.action-setup-steps { margin: 0; padding-left: 20px; color: var(--text); font-size: var(--fs-12); line-height: 1.5; }
.action-setup .code-block { margin: 6px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); }
@media (max-width: 560px) {
.action-setup .code-copy { min-width: 64px; min-height: 44px; }
}
.inline-link { width: max-content; margin-top: 7px; border: 0; background: transparent; color: var(--text); padding: 0; font: inherit; font-size: var(--fs-12); text-decoration: underline; text-underline-offset: 3px; }
.sensitive-entry { margin-top: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-8); }
.sensitive-entry p { color: var(--muted); font-size: var(--fs-12); }
.skill-search { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); outline: 0; }
.conversation-search { width: 100%; height: 43px; margin-top: var(--sp-1); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); outline: 0; font-size: var(--fs-16); }
.search-results { display: grid; gap: 2px; margin-top: 12px; }
/* A result: chat title, then where and when on its own muted line, then the excerpt. */
.search-result { width: 100%; display: grid; gap: 2px; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.search-result:hover { background: var(--surface); }
.search-result-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-14); font-weight: var(--fw-strong); }
.search-result-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: var(--fs-12); }
.search-result-excerpt { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: var(--fs-14); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.search-result-excerpt strong { color: var(--text); font-weight: var(--fw-strong); }
.checkbox-label input { width: 16px; height: 16px; }
.skill-row p, .provider-card p { margin: 0; color: var(--muted); font-size: var(--fs-12); }
.credential-list { max-height: min(52dvh, 520px); overflow-y: auto; margin-top: 12px; border-top: 1px solid var(--line); }
.rules-proof { margin: 10px 0; color: var(--warning); font-size: var(--fs-12); }
.empty-panel { padding: 13vh 20px; text-align: center; color: var(--muted); }
.empty-panel h2 { margin: 0 0 7px; color: var(--text); font-size: var(--fs-20); }
.empty-panel p { margin: 0; font-size: var(--fs-14); }
.empty-panel.compact { padding: 30px 10px; }
.panel-intro { max-width: 660px; margin: -8px 0 28px; color: var(--muted); font-size: var(--fs-14); line-height: 1.55; }
.panel-header > .work-header-actions { min-width: 0; flex: 0 1 auto; display: flex; align-items: center; gap: 10px; }
.work-section { margin: 0 0 34px; }
.work-section-heading { min-height: 42px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.work-card { margin-bottom: 10px; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--r-8); display: grid; gap: 11px; background: var(--bg); }
.work-objective { margin: 0; max-width: 740px; font-size: var(--fs-14); line-height: 1.52; overflow-wrap: anywhere; }
/* Only the short form is cut to three lines: an opened goal reads in full. */
p.work-objective { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
details.work-objective > summary { cursor: pointer; }
details.work-objective[open] > summary { color: var(--muted); font-size: var(--fs-12); }
details.work-objective > p { margin: 6px 0 0; white-space: pre-wrap; }
.work-card .eyebrow, .work-card .eyebrow::first-letter { text-transform: none; }
/* Inside Work's job page the details sit in the page's own fold, not a second card. */
.work-card.in-panel { padding: 0; border: 0; background: none; }
.work-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.work-meta { margin: -3px 0 0; color: var(--muted); font-size: var(--fs-12); line-height: 1.45; }
.work-time-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; color: var(--muted); font-size: var(--fs-12); }
.panel-view .panel-header > button, .panel-view .refresh-button, .goal-dialog-actions button { min-height: 44px; }
.dialog-form .existing-folder { margin: 14px 0; }
.dialog-form .existing-folder summary { cursor: pointer; color: var(--muted); font-size: var(--fs-12); }
.dialog-form .existing-folder label { margin: 10px 0 6px; }
.dialog-form .existing-folder-hint { margin: 0; font-size: var(--fs-12); overflow-wrap: anywhere; }
.dialog-form .hook-runs { margin: var(--sp-2) 0; font-size: var(--fs-14); overflow-wrap: anywhere; }
.dialog-form .hook-runs code { font-size: 0.9em; }
/* New chat and New project: provider and model side by side, then reasoning
   when the model has a choice, with one line on where the model came from. */
.dialog-runtime { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 12px; margin: 14px 0; }
.dialog-form .dialog-runtime > label { min-width: 0; margin: 0; }
.dialog-runtime .dialog-runtime-wide, .dialog-runtime-note { grid-column: 1 / -1; }
.dialog-runtime-note { margin: -8px 0 0; font-size: var(--fs-12); }
.dialog-runtime-note:empty { display: none; }
@media (max-width: 480px) {
.dialog-runtime { grid-template-columns: minmax(0,1fr); }
}
.coordination-list { margin-top: 16px; border-top: 1px solid var(--line); }
.coordination-item { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.coordination-item > div { min-width: 0; }
.coordination-item p { margin: 4px 0 0; overflow-wrap: anywhere; font-size: var(--fs-14); line-height: 1.45; }
.coordination-kind { color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-strong); letter-spacing: .08em; text-transform: uppercase; }
.ledger-explainer { line-height: 1.5; }
.ledger-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.ledger-tab { min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--bg); color: var(--muted); font-size: var(--fs-12); }
.ledger-tab.active { border-color: var(--text); background: var(--surface-strong); color: var(--text); }
.ledger-loading { margin: 0; padding: 28px 8px; color: var(--muted); text-align: center; font-size: var(--fs-12); }
.ledger-item-action { min-height: 44px; white-space: nowrap; }
.ledger-footer { display: flex; justify-content: center; padding-top: 14px; }
.ledger-load-more { min-height: 44px; }
.branch-summary { padding: 11px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); white-space: pre-wrap; color: var(--muted); font-size: var(--fs-12); line-height: 1.55; }
.conversation-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 18px 0 4px; }
.conversation-tool { min-height: 58px; display: grid; grid-template-columns: 24px minmax(0,1fr); align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text); text-align: left; }
.conversation-tool:hover { background: var(--surface-strong); }
.conversation-tool svg { width: 19px; height: 19px; color: var(--muted); }
.conversation-tool span { min-width: 0; display: grid; gap: 2px; }
.conversation-tool strong { font-size: var(--fs-12); }
.conversation-tool small { overflow: hidden; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.login-card { width: min(360px, 100%); text-align: center; }
.login-card h1 { margin: 0; font-size: var(--fs-24); letter-spacing: -.025em; }
.login-card h1 + label { margin-top: var(--sp-5); }
.call-surface {
  position: fixed; inset: 0; z-index: 110; display: grid; grid-template-rows: auto 1fr auto;
  min-height: 100%; padding: calc(18px + var(--safe-top)) calc(20px + var(--safe-right)) calc(22px + var(--safe-bottom)) calc(20px + var(--safe-left));
  overflow: hidden; background: var(--call-bg); color: var(--call-text);
}
.call-header { display: flex; align-items: center; justify-content: space-between; width: min(680px, 100%); margin: 0 auto; }
.call-header > div { display: flex; align-items: center; gap: 11px; }
.call-header h1 { margin: 0; font-size: var(--fs-16); line-height: 1.2; }
.call-header p { margin: 3px 0 0; color: var(--call-muted); font-size: var(--fs-12); }
.call-presence { width: 8px; height: 8px; border-radius: 50%; background: var(--call-live); box-shadow: 0 0 0 5px var(--call-live-ring); }
.call-icon { width: var(--tap); height: var(--tap); border: 1px solid var(--call-line); border-radius: 50%; display: grid; place-items: center; background: var(--call-raised); color: var(--call-soft); }
.call-stage { width: min(520px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.call-orb { position: relative; width: 164px; height: 164px; margin-bottom: 36px; display: grid; place-items: center; }
.call-orb::before, .call-orb span { content: ''; position: absolute; inset: 0; border: 1px solid var(--call-ring-1); border-radius: 50%; }
.call-orb span:first-child { inset: 16px; border-color: var(--call-ring-2); animation: call-pulse 2.6s ease-out infinite; }
.call-orb span:nth-child(2) { inset: 34px; border-color: var(--call-ring-3); animation: call-pulse 2.6s .65s ease-out infinite; }
.call-orb i { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; background: var(--call-light); color: var(--call-ink); font-size: var(--fs-24); font-style: normal; font-weight: var(--fw-strong); box-shadow: 0 18px 55px var(--shade-50); }
.call-surface.listening .call-orb::before { border-color: var(--call-live-glow); animation: call-listen 1.25s ease-in-out infinite; }
.call-surface.speaking .call-orb i { background: var(--call-live); color: var(--call-live-ink); }
.call-surface.failed .call-orb::before { border-color: color-mix(in srgb, var(--danger) 62%, transparent); }
.call-surface.failed .call-orb i { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); color: var(--danger); }
.call-surface.failed .call-caption { color: var(--danger); max-width: 620px; }
.call-status { margin: 0; font-size: var(--fs-20); font-weight: var(--fw-strong); letter-spacing: -.015em; }
.call-caption { min-height: 48px; max-width: 430px; margin: 11px 0 0; color: var(--call-soft); font-size: var(--fs-14); line-height: 1.55; }
.call-trust { max-width: 390px; margin: 20px 0 0; color: var(--call-muted); font-size: var(--fs-12); line-height: 1.45; }
.call-controls { width: min(300px, 100%); margin: 0 auto; display: flex; justify-content: center; gap: 30px; }
.call-control { min-width: 72px; border: 0; display: grid; justify-items: center; gap: 8px; background: transparent; color: var(--call-soft); font-size: var(--fs-12); }
.call-control svg { width: 52px; height: 52px; padding: 15px; border-radius: 50%; background: var(--call-control); color: var(--call-light); }
.call-control[aria-pressed=true] svg { background: var(--call-light); color: var(--call-bg); }
.call-end svg { background: var(--call-end); color: var(--white); }
@keyframes call-pulse { 0% { transform: scale(.86); opacity: .15; } 55% { opacity: .55; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes call-listen { 0%,100% { transform: scale(.96); opacity: .45; } 50% { transform: scale(1.05); opacity: 1; } }
.automation-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: -2px 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-12); background: var(--surface); }
.automation-card { margin: 0; padding: 16px; }
.automation-glance { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 12px 0; }
.automation-detail { margin-top: 9px; border-top: 1px solid var(--line); }
.automation-history { display: grid; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: var(--r-8); overflow: hidden; }
.estate-layout { width: min(100%, 980px); margin: 0 auto; }
.estate-refresh-status { width: min(100%, 980px); margin: 10px auto; color: var(--muted); font-size: var(--fs-12); line-height: 1.5; }
.estate-refresh-error { width: min(100%, 980px); margin: 12px auto; }
.estate-storage-view .estate-readable-row > strong { display: block; margin-bottom: 5px; }
.estate-routes-table td:first-child { min-width: 13em; }
@media (max-width: 480px) {
.estate-routes-table td:first-child { min-width: 0; display: block; padding-bottom: 6px; font-size: var(--fs-16); }
}
@media (max-width: 800px) {
.runtime-menu > summary, .runtime-heading .icon-button, .runtime-popover select, .runtime-popover input:not([type="checkbox"]), .runtime-popover button, #attach-button, #mic-button, .message-branch,
  .conversation-runtime select, .conversation-runtime input:not([type="checkbox"]), .conversation-runtime button { min-width: 44px; min-height: 44px; }
.runtime-popover .subagent-capability-option, .conversation-runtime .subagent-capability-option { min-height: 44px; grid-template-columns: 22px minmax(0,1fr); padding-block: 4px; }
.runtime-popover .subagent-capability-option input[type=checkbox], .conversation-runtime .subagent-capability-option input[type=checkbox] { width: 20px; height: 20px; min-width: 20px; min-height: 20px; }
.panel-intro { margin-top: -5px; margin-bottom: 22px; }
.coordination-item { grid-template-columns: minmax(0,1fr); gap: 9px; }
.ledger-item-action { width: 100%; }
.ledger-tab { flex: 1 1 calc(50% - 7px); }
.call-surface { padding-inline: calc(18px + var(--safe-left)) calc(18px + var(--safe-right)); }
.call-orb { width: 148px; height: 148px; margin-bottom: 30px; }
}
@media (max-width: 480px) {
.composer-actions.run-active #runtime-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 420px) {
.conversation-tools { grid-template-columns: minmax(0,1fr); }
.runtime-heading, .runtime-toggles, .runtime-subagents, .runtime-advanced { grid-column: 1; }
.runtime-advanced-body { grid-template-columns: minmax(0,1fr); }
}
@media (max-height: 480px) and (orientation: landscape) {
.login-card > p:not(.error) { display: none; }
/* Preserve the call header and end controls. The decorative orb and trust
     copy yield first; live status and caption remain visible in the middle. */
  .call-surface {
    inset: 0 0 auto; height: var(--app-height, 100dvh); min-height: 0;
    grid-template-rows: auto minmax(0,1fr) auto; gap: 4px;
    padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(12px + var(--safe-left));
  }
.call-stage { min-height: 0; overflow: hidden; justify-content: center; }
.call-orb, .call-trust { display: none; }
.call-status { font-size: var(--fs-16); }
.call-caption {
    min-height: 0; max-height: 30px; margin-top: 4px; overflow: hidden;
    font-size: var(--fs-12); line-height: 1.35;
  }
.call-controls { gap: 22px; }
.call-control { gap: 4px; }
.call-icon { width: 44px; height: 44px; }
.call-control svg { width: 44px; height: 44px; padding: 12px; }
html.keyboard-compact .topbar,
  html.keyboard-compact .goal-banner,
  html.keyboard-compact .chat-actions,
  html.keyboard-compact .queue,
  html.keyboard-compact .prompt-rail { display: none; }
}
#modal .goal-banner.compact-route-modal { width: 100%; margin: 0; display: flex !important; }
#modal .chat-actions.compact-route-modal { width: 100%; margin: 0; display: grid !important; }
#modal .queue.compact-route-modal { width: 100%; margin: 0; display: block !important; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
*, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
#modal:has(.cross-chat-delegation-access) .dialog-form > label,
#modal:has(.cross-chat-delegation-access) .dialog-form > label select,
#modal:has(.cross-chat-delegation-access) .dialog-form > label textarea,
#modal:has(.cross-chat-delegation-access) .dialog-actions button { min-height: 44px; }
/* Life connection review controls need their own touch targets. */
#life-view button,
#modal:has([data-life-review]) button { min-height:44px; min-width:44px; }
.publish-state.live { border-color: color-mix(in srgb,var(--success) 45%,var(--line)); color: var(--success); }
.messages:has(> .native-import-banner) { scroll-padding-top: 56px; }
/* Immersive remote viewer; browser gestures remain available outside it. */
body.device-viewer-open { overflow: hidden; }
.device-screen-panel { --viewer-bg: var(--media-bg); position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100dvh; overflow: hidden; background: var(--viewer-bg); color: var(--call-text); color-scheme: dark; font-size: var(--fs-14); overscroll-behavior: contain; }
.device-screen-panel:fullscreen { width: 100%; height: 100%; }
.device-screen-viewport { position: absolute; inset: 0; overflow: hidden; background: var(--viewer-bg); touch-action: none; user-select: none; outline: none; }
/* No frame yet: hide the empty image (and its alt text) behind the notice. */
.device-live-screen:not([src]):not(canvas) { visibility: hidden; }
.device-screen-viewport .device-live-screen { position: absolute; left: 0; top: 0; max-width: none; max-height: none; object-fit: fill; transform-origin: 0 0; border-radius: 0; pointer-events: none; }
.device-screen-cursor { position: absolute; width: 20px; height: 20px; margin: -10px; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--viewer-bg), 0 1px 5px var(--viewer-bg); border-radius: 50%; pointer-events: none; }
.device-screen-cursor::after { content: ''; position: absolute; width: 4px; height: 4px; top: 6px; left: 6px; background: var(--white); border-radius: 50%; }
.is-dragging .device-screen-cursor { border-color: var(--call-live); }
.device-screen-panel button { min-width: 44px; min-height: 44px; padding: 8px 10px; border: 0; border-radius: var(--r-8); background: var(--call-control); color: var(--call-text); font: inherit; white-space: nowrap; cursor: pointer; }
.device-screen-panel button:disabled { opacity: .5; cursor: default; }
.device-screen-panel button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.device-screen-panel button[aria-pressed="true"],.device-screen-panel .is-owner { background: var(--call-light); color: var(--call-ink); }
.viewer-toolbar { position: absolute; top: max(8px,var(--safe-top)); left: max(8px,var(--safe-left)); right: max(64px,calc(var(--safe-right) + 56px)); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: calc(100% - 72px); padding: 4px; border: 1px solid var(--call-line); border-radius: var(--r-12); background: var(--call-bg); transition: opacity .18s; }
.viewer-toolbar button { font-size: var(--fs-12); }
.viewer-desktop-fit { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; font-size: var(--fs-12); }
.viewer-desktop-fit input { width: 18px; height: 18px; margin: 0; accent-color: var(--call-live); }
.device-screen-panel .viewer-stop { position: absolute; bottom: max(8px,var(--safe-bottom)); right: max(8px,var(--safe-right)); background: var(--call-raised); color: var(--call-end); font-size: var(--fs-12); font-weight: var(--fw-strong); }
.device-screen-panel .viewer-handle { position: absolute; bottom: max(8px,var(--safe-bottom)); left: max(8px,var(--safe-left)); background: var(--call-bg); border: 1px solid var(--call-line); font-size: var(--fs-20); }
.controls-hidden .viewer-toolbar { opacity: 0; pointer-events: none; }
.viewer-notice,.viewer-rotate,.viewer-age { position: absolute; left: 50%; transform: translateX(-50%); max-width: calc(100% - 120px); padding: 8px 12px; border-radius: var(--r-8); background: var(--call-bg); color: var(--call-soft); text-align: center; font-size: var(--fs-12); pointer-events: none; }
.viewer-notice { top: 40%; }
.viewer-rotate { bottom: max(65px,calc(var(--safe-bottom) + 57px)); }
.viewer-age { bottom: max(12px,var(--safe-bottom)); }
.viewer-keys,.viewer-fkeys { position: absolute; bottom: max(4px,var(--safe-bottom)); left: 4px; right: 4px; display: flex; gap: 4px; padding: 4px; overflow-x: auto; background: var(--call-bg); border: 1px solid var(--call-line); border-radius: var(--r-8); }
.viewer-keys button,.viewer-fkeys button { flex: 0 0 auto; }
.viewer-fkeys { bottom: max(60px,calc(var(--safe-bottom) + 56px)); }
.keyboard-open .viewer-handle,.keyboard-open .viewer-age { display: none; }
/* Stop sits bottom-right, clear of remote title bars; above the keyboard it moves up. */
.keyboard-open .viewer-stop { top: max(12px,var(--safe-top)); bottom: auto; }
.viewer-keyboard-input { position: absolute; left: 50%; bottom: 1px; width: 1px; height: 1px; padding: 0; border: 0; opacity: .01; font-size: 16px; resize: none; }
@media (prefers-reduced-motion: reduce) { .viewer-toolbar { transition: none; } }

/* ---------- Replies: plain Geist at a comfortable size (the Nothing look) ---------- */
.messages .message.assistant .assistant-answer-body,
.messages .message.assistant .assistant-draft-body { font-family: var(--font-sans); font-size: 17px; line-height: 1.5; }
