/* tuwi control: lights-out design system.
   Identity carried over from the original tuwi dashboard: a pure black canvas,
   URW Gothic for the interface with Source Code Pro for code, hairline rules and the Claude Code CLI
   glyphs (❯ prompt, ● turn and tool bullets, ✻ activity). Depth comes from
   neutral surface steps, never tinted greys. Orange marks the agent and live
   activity; white is the primary action; status colours carry meaning only.
   Order: fonts, tokens, base, controls, shell, home, conversation, dock,
   overlays, responsive. */

@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-latin.woff2?v=8b774aaa5137') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-latin-italic.woff2?v=97f01332aeda') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'URW Gothic';
  src: url('/fonts/urw-gothic-book.woff2?v=53bc26291fc4') format('woff2');
  font-weight: 100 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'URW Gothic';
  src: url('/fonts/urw-gothic-book-oblique.woff2?v=613d4aa9713a') format('woff2');
  font-weight: 100 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'URW Gothic';
  src: url('/fonts/urw-gothic-demi.woff2?v=39d1418b9d30') format('woff2');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'URW Gothic';
  src: url('/fonts/urw-gothic-demi-oblique.woff2?v=d5bc5c4ace33') format('woff2');
  font-weight: 600 900;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Surfaces: black canvas, neutral steps for depth. */
  --bg: #000;
  --bg-1: #0a0a0a;
  --bg-2: #111;
  --bg-3: #171717;
  --bg-4: #1f1f1f;
  --code-bg: #070707;
  /* Lines. */
  --line: #1a1a1a;
  --line-2: #262626;
  --line-3: #383838;
  /* Text. */
  --text: #ededed;
  --text-2: #a1a1a1;
  --text-3: #7a7a7a;
  --text-4: #4d4d4d;
  /* Accent: the agent's orange. */
  --accent: #ff9933;
  --accent-2: #ffad5c;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  /* Status, daltonized like the CLI: success reads blue. */
  --run: #ff9933;
  --attn: #c49bff;
  --ok: #3399ff;
  --err: #ff6666;
  --warn: #ffcc00;
  --info: #99ccff;
  --muted: #5c5c5c;
  --link: #99ccff;
  --code-ink: #99ccff;
  --claude: #ff9933;
  --codex: #5fd7af;
  /* Type. */
  --mono: 'Source Code Pro', ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', 'DejaVu Sans Mono', 'Noto Sans Mono', Menlo, Consolas, monospace;
  --sans: 'URW Gothic', 'Century Gothic', 'Avant Garde', 'Avenir', sans-serif;
  --font: var(--sans);
  --fs-body: 13.5px;
  --lh-body: 1.7;
  /* Shape and rhythm. */
  --r-xs: 3px;
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 10px;
  --col: 880px;
  --gutter: 28px;
  --side: 268px;
  --control: 32px;
  --control-sm: 26px;
  --shadow: 0 0 0 1px rgb(0 0 0 / 0.9), 0 16px 48px rgb(0 0 0 / 0.85);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: var(--font);
  font-size: 13px;
  font-variant-ligatures: none;
  font-feature-settings: 'zero' 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-color: #2a2a2a transparent;
}
* { box-sizing: border-box; }
*:hover { scrollbar-color: #3d3d3d transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); overflow: hidden; font-size: 13px; line-height: 1.5; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
a { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
::selection { background: #2e2e2e; color: #fff; }

[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Code, tool output, diffs and logs stay in the terminal face. */
.mono { font-family: var(--sans); font-variant-numeric: tabular-nums; }
/* The code font is for code and command output only; every interface label, value,
   path and input uses the interface font. JSON editors stay in the code font. */
pre, code, kbd, samp, textarea.mono { font-family: var(--mono); }
.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-more path, .icon-info path { stroke-width: 2; }
.icon-more path { stroke-width: 2.8; }
.icon-stop path, .icon-play path { fill: currentColor; stroke-width: 1; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

/* ---------- Controls ---------- */
button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control);
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}
button:hover:not(:disabled) { background: var(--bg-3); border-color: var(--line-3); }
button:active:not(:disabled) { background: var(--bg-4); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button .icon { color: var(--text-2); }
button:hover:not(:disabled) .icon { color: var(--text); }
button.primary { background: var(--text); border-color: var(--text); color: #000; font-weight: 600; }
button.primary .icon, button.primary:hover:not(:disabled) .icon { color: #000; }
button.primary:hover:not(:disabled) { background: #fff; border-color: #fff; }
button.primary:active:not(:disabled) { background: #d4d4d4; }
button.primary:disabled { opacity: 1; background: var(--bg-3); border-color: var(--line-2); color: var(--text-4); }
button.primary:disabled .icon { color: var(--text-4); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--text); border-color: transparent; }
button.danger { color: var(--err); }
button.danger .icon { color: var(--err); }
button.danger:hover:not(:disabled) { border-color: color-mix(in srgb, var(--err) 45%, var(--line-2)); background: color-mix(in srgb, var(--err) 7%, var(--bg-1)); }
button.danger-solid { background: var(--err); border-color: var(--err); color: #1a0000; font-weight: 600; }
button.danger-solid .icon { color: #1a0000; }
button.danger-solid:hover:not(:disabled) { background: #ff8080; border-color: #ff8080; }
button.small { height: var(--control-sm); padding: 0 9px; font-size: 12px; border-radius: var(--r-xs); gap: 6px; }
button.wide { width: 100%; }
button.busy { cursor: progress; }
button.busy::after { content: ''; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.icon-button { width: var(--control); padding: 0; }
.icon-button.small { width: var(--control-sm); height: var(--control-sm); }
.link-button { height: auto; padding: 6px 0 0; border: 0; background: none; color: var(--link); font-size: 12px; font-weight: 400; }
.clipped-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.clipped-text { color: var(--text-3); font-size: 12px; line-height: 1.4; }
.link-button:hover:not(:disabled) { background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }

input, textarea, select {
  font: inherit;
  font-size: 13px;
  width: 100%;
  min-width: 0;
  height: var(--control);
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; }
input:hover, textarea:hover, select:hover { border-color: var(--line-3); }
input:focus, textarea:focus, select:focus { outline: none; border-color: #555; box-shadow: 0 0 0 3px rgb(255 255 255 / 0.06); }
input::placeholder, textarea::placeholder { color: var(--text-4); opacity: 1; }
#message::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input.mono, textarea.mono { font-size: 12.5px; }
/* Checkboxes and radios drawn in the interface style: a square or round outline, white when on. */
input[type='checkbox'], input[type='radio'] { appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; width: 16px; height: 16px; margin: 1px 0 0; padding: 0; flex: none; border: 1px solid var(--line-3); border-radius: 3px; background: var(--bg); box-shadow: none; cursor: pointer; transition: background-color 0.12s, border-color 0.12s; }
input[type='radio'] { border-radius: 50%; }
input[type='checkbox']:hover, input[type='radio']:hover { border-color: var(--text-3); }
input[type='checkbox']:checked { border-color: var(--text); background: var(--text) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
input[type='checkbox']:indeterminate { border-color: var(--text); background: var(--text) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
input[type='radio']:checked { border-color: var(--text); background: radial-gradient(circle, var(--text) 0 3.5px, var(--bg) 4px); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23a1a1a1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 10px center / 12px no-repeat; text-overflow: ellipsis; }
select:disabled { opacity: 0.5; cursor: not-allowed; }
input[type='checkbox']:focus-visible, input[type='radio']:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
input[type='checkbox']:disabled, input[type='radio']:disabled { opacity: 0.45; cursor: not-allowed; }
/* File fields: a secondary button and the chosen name; the native control stays focusable. */
.file-pick { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.file-pick input[type='file'] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.file-button { display: inline-flex; align-items: center; gap: 7px; flex: none; height: var(--control-sm); padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text); font-size: 12.5px; }
.file-pick:hover .file-button { border-color: var(--line-3); background: var(--bg-2); }
.file-pick:has(input:focus-visible) .file-button { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.file-name.chosen { color: var(--text-2); }
/* Two fields side by side (host and port); stacks on phones. */
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 12px; }
.field-row > .field { min-width: 0; }
/* An input with its action button on the same line. */
.input-action { display: flex; gap: 8px; align-items: center; }
.input-action > input { flex: 1; }
.input-action > button { flex: none; }
.field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 16px; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.hint { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; cursor: pointer; }
.check:hover { color: var(--text); }
.form-error { color: var(--err); font-size: 12px; line-height: 1.5; }
.form-error:empty { display: none; }
#dialog-error { margin-top: 14px; }

.choices.cards { display: flex; flex-direction: column; gap: 6px; }
/* Card and grid choices carry no margin of their own, so the next control in the same group
   (a field, a check, another block) starts a field's gap below them instead of touching. */
:is(.choices.cards, .choices.option-grid):not(:last-child):not(:has(+ .section-note, + .hint)) { margin-bottom: 16px; }
.choice { position: relative; display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); cursor: pointer; transition: border-color 0.12s, background-color 0.12s; }
.choice:hover { border-color: var(--line-3); background: var(--bg-1); }
.choice:has(input:checked) { border-color: var(--text-2); background: var(--bg-2); }
.choice:has(input:focus-visible) { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.choice-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.choice-label { font-size: 13px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.choice-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.5; overflow-wrap: anywhere; }
.choices.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); max-width: 100%; flex-wrap: wrap; }
.segmented .choice { border: 0; background: none; padding: 5px 12px; border-radius: var(--r-xs); }
.segmented .choice:hover { background: var(--bg-2); }
.segmented .choice input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .choice:has(input:checked) { background: var(--bg-4); }
.segmented .choice-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.segmented .choice:has(input:checked) .choice-label { color: var(--text); }
.choice:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.choice:has(input:disabled):hover { border-color: var(--line-2); background: var(--bg); }
.choice-tag { margin-left: auto; flex: none; align-self: center; }
/* Even grid of equal tiles (effort levels): wraps by whole tiles, never into ragged rows. */
.choices.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 6px; }
.option-grid .choice { align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 10px; text-align: center; }
.option-grid .choice input { position: absolute; opacity: 0; pointer-events: none; }
.option-grid .choice-text { align-items: center; }
.option-grid .choice-label { font-size: 12.5px; color: var(--text-2); }
.option-grid .choice:has(input:checked) { border-color: var(--text); background: var(--bg-3); }
.option-grid .choice:has(input:checked) .choice-label { color: var(--text); }
.option-grid .choice-tag { margin-left: 0; }
@media (pointer: coarse) { .option-grid .choice { min-height: 44px; } }
/* Model list: one bordered list of rows that scrolls on its own, so effort stays in view. */
.choices.cards.model-list { gap: 0; max-height: min(38dvh, 340px); overflow-y: auto; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); overscroll-behavior: contain; scrollbar-width: thin; }
.model-list .choice { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 9px 12px; }
.model-list .choice:first-child { border-top: 0; }
.model-list .choice:has(input:checked) { background: var(--bg-2); }
.model-list .choice[hidden] { display: none; }

/* Status: dots, chips, agent badges, tags. */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.tone-run .dot, .dot.run { background: var(--run); }
.tone-attn .dot, .dot.attn { background: var(--attn); }
.tone-ok .dot, .dot.ok { background: var(--ok); }
.tone-err .dot, .dot.err { background: var(--err); }
.tone-info .dot, .dot.info { background: var(--info); }
.tone-run .dot, .tone-attn .dot { animation: pulse 1.6s ease-in-out infinite; }
.tone-attn .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--attn) 22%, transparent); }
.status-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--bg-1); color: var(--text-2); flex: none; }
.status-chip .dot { width: 6px; height: 6px; box-shadow: none; }
.status-chip.tone-run { color: var(--run); border-color: color-mix(in srgb, var(--run) 30%, var(--line)); background: color-mix(in srgb, var(--run) 7%, var(--bg)); }
.status-chip.tone-attn { color: var(--attn); border-color: color-mix(in srgb, var(--attn) 32%, var(--line)); background: color-mix(in srgb, var(--attn) 8%, var(--bg)); }
.status-chip.tone-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, var(--line)); background: color-mix(in srgb, var(--ok) 7%, var(--bg)); }
.status-chip.tone-err { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--line)); background: color-mix(in srgb, var(--err) 7%, var(--bg)); }
.status-chip.tone-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 26%, var(--line)); background: color-mix(in srgb, var(--info) 6%, var(--bg)); }
.agent-badge { display: inline-grid; place-items: center; width: 22px; height: 18px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font: 600 9.5px/1 var(--sans); letter-spacing: 0; flex: none; background: var(--bg); }
.agent-badge.claude { color: var(--claude); border-color: color-mix(in srgb, var(--claude) 30%, var(--line-2)); }
.agent-badge.codex { color: var(--codex); border-color: color-mix(in srgb, var(--codex) 30%, var(--line-2)); }
.agent-badge.dsh { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 30%, var(--line-2)); }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font-size: 10.5px; font-weight: 500; background: var(--bg); color: var(--text-2); white-space: nowrap; }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, var(--line)); }
.tag.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }

/* ---------- Brand & sign in ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-flex; align-items: center; gap: 7px; font: 700 15px/1 var(--mono); letter-spacing: 0.02em; color: var(--text); }
.brand-mark::before { content: '❯'; color: var(--accent); font-weight: 700; }
.brand-sub { padding: 2px 5px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font-size: 10.5px; font-weight: 500; color: var(--text-3); }

/* ---------- App shell ---------- */
#app { height: 100dvh; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); background: var(--bg); }
#sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--line); padding: 12px 10px 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px 6px; min-height: 36px; }
#close-nav { display: none; }
/* New thread: a plus beside the brand, the sidebar's one primary action. */
.side-top-actions { display: inline-flex; align-items: center; gap: 4px; }
#new-session { color: var(--accent); }
#new-session:hover:not(:disabled) { background: var(--bg-3); color: var(--accent-2); }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 12px; scrollbar-width: thin; }
.side-heading { display: flex; align-items: center; justify-content: space-between; margin: 16px 4px 4px 9px; min-height: 26px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.side-heading .icon-button { color: var(--text-3); }
/* One row aligned to the sidebar grid: the dot sits on the machine-dot column, the text on
   the nav-label column, and the icon buttons on the section-heading icon column. */
.side-foot { display: flex; align-items: center; gap: 8px; min-height: 42px; margin: 0 -10px -10px; padding: 0 14px 0 26.5px; border-top: 1px solid var(--line); }
.side-foot-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.side-foot-actions .icon-button { width: 26px; height: 26px; color: var(--text-3); }
.side-foot-actions .icon-button:hover { color: var(--text); }
.side-foot-actions button[hidden] { display: none; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.side-foot .sync { display: flex; gap: 12.5px; flex: 1; min-width: 0; font-size: 12px; }
.side-foot #sync-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sync .dot { width: 6px; height: 6px; }
.side-foot .sync .dot { width: 7px; height: 7px; }
.sync.live .dot { background: var(--ok); }
.sync.down .dot { background: var(--run); animation: pulse 1.6s ease-in-out infinite; }

.nav-row { position: relative; display: flex; align-items: center; }
.computer, .session { position: relative; width: 100%; height: auto; min-height: 46px; justify-content: flex-start; gap: 10px; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; text-align: left; font-weight: 400; color: var(--text); letter-spacing: 0; }
.computer:hover:not(:disabled), .session:hover:not(:disabled) { background: var(--bg-2); border-color: transparent; }
.computer.selected, .session.selected { background: var(--bg-2); border-color: var(--line-2); }
.computer.offline .nav-lead > .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.session.selected::before { content: ''; position: absolute; left: -7px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
/* Every sidebar row starts with the same 22 px slot (status dot, agent badge, folder or
   chevron), so names line up in one column down the whole sidebar. */
.nav-lead { display: inline-grid; place-items: center; width: 22px; flex: none; }
.nav-lead > .dot { width: 7px; height: 7px; }
.computer .nav-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.computer .nav-title .nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-title { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); overflow: hidden; white-space: nowrap; }
.nav-sub .dot { width: 6px; height: 6px; box-shadow: none; }
.nav-sub .label { overflow: hidden; text-overflow: ellipsis; }
.nav-sub.tone-run .label { color: var(--run); }
.nav-sub.tone-attn .label { color: var(--attn); }
.nav-sub.tone-err .label { color: var(--err); }
.nav-row .nav-tool { position: absolute; right: 5px; opacity: 0; transition: opacity 0.12s; }
.session.has-actions { padding-right: 38px; }
.nav-row:hover .nav-tool, .nav-row:focus-within .nav-tool, .nav-row .nav-tool[aria-expanded='true'] { opacity: 1; }
.computer.offline .nav-title { color: var(--text-2); }
.group-head { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 6px 8px 2px 9px; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.group-head .icon { color: var(--text-4); }
.group-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .host-name { color: var(--text-4); flex: none; }
.session .state-label { margin-left: auto; font-size: 11px; flex: none; }
.session .state-label.tone-run { color: var(--run); }
.session .state-label.tone-attn { color: var(--attn); }
.session .state-label.tone-err { color: var(--err); }
.session.ended .nav-title { color: var(--text-2); }
.session.ended .agent-badge { opacity: 0.6; }
.nav-empty { padding: 8px 9px; font-size: 11.5px; color: var(--text-3); line-height: 1.6; }
details.ended-group > summary, details.disconnected-group > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 34px; margin-top: 6px; padding: 4px 9px; font-size: 11.5px; color: var(--text-3); cursor: pointer; border-radius: var(--r-xs); }
details.ended-group > summary::-webkit-details-marker, details.disconnected-group > summary::-webkit-details-marker { display: none; }
details.ended-group > summary:hover, details.disconnected-group > summary:hover { color: var(--text); }
details.ended-group > summary .icon, details.disconnected-group > summary .icon { transition: transform 0.15s var(--ease); color: var(--text-4); }
details.ended-group[open] > summary .icon, details.disconnected-group[open] > summary .icon { transform: rotate(90deg); }

/* The main column is a size container: everything inside it responds to the column's own
   width (window minus sidebar), not to the viewport. */
#main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); container: main / inline-size; }
/* Wrapping is the structural guarantee: if the controls ever exceed the row they move to a
   second right-aligned row instead of overlapping the title or clipping More. */
#topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; row-gap: 4px; min-height: 48px; padding: 6px 12px 6px 24px; border-bottom: 1px solid var(--line); flex: none; }
#menu { display: none; }
.title-block { flex: 1 1 180px; min-width: 0; overflow: hidden; }
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-row > h1 { flex: 0 1 auto; min-width: 0; }
.top-controls { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; margin-left: auto; }
#session-title { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#session-detail { margin-top: 3px; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#session-detail:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 2px; flex: none; }
/* The model chip is the one bordered control; the other thread actions are quiet until hovered. */
.top-actions > button:not(.model-button) { border-color: transparent; background: none; color: var(--text-2); padding: 0 9px; }
.top-actions > button:not(.model-button):hover:not(:disabled) { border-color: transparent; background: var(--bg-3); color: var(--text); }
.top-actions > .icon-button { padding: 0; }
.top-actions > .model-button { margin-right: 6px; }
.top-actions button { height: 30px; }
.top-actions .icon-button { width: 30px; }
.model-button { max-width: 240px; }
.model-button span { overflow: hidden; text-overflow: ellipsis; }

.banner { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 24px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--text-2); flex: none; background: var(--bg-1); }
.banner p { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.banner .icon { flex: none; }
.banner.warn { background: color-mix(in srgb, var(--warn) 5%, var(--bg)); border-bottom-color: color-mix(in srgb, var(--warn) 18%, var(--line)); color: color-mix(in srgb, var(--warn) 80%, var(--text)); }
.banner.err { background: color-mix(in srgb, var(--err) 6%, var(--bg)); border-bottom-color: color-mix(in srgb, var(--err) 20%, var(--line)); color: color-mix(in srgb, var(--err) 75%, var(--text)); }
.banner.info { background: color-mix(in srgb, var(--info) 5%, var(--bg)); border-bottom-color: color-mix(in srgb, var(--info) 16%, var(--line)); color: color-mix(in srgb, var(--info) 75%, var(--text)); }
.banner.muted { color: var(--text-2); }
.banner-actions { display: flex; gap: 6px; flex: none; }
.banner-actions:not(:has(button:not([hidden]))) { display: none; }
/* Reconnecting: one row, spinner aligned to the first line, text wraps beside it. */
#conn-banner { align-items: flex-start; }
#conn-banner .icon { margin-top: 2px; animation: spin 1.1s linear infinite; }
#conn-banner p { flex: 1 1 0; }
#conn-banner p span { color: var(--text-3); }

/* ---------- Home ---------- */
#home { flex: 1; min-height: 0; overflow-y: auto; padding: 32px var(--gutter) 48px; }
.home-inner { max-width: 960px; margin: 0 auto; }
.home-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.home-head p { margin-top: 8px; font-size: 12.5px; color: var(--text-3); line-height: 1.65; max-width: 620px; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.home-stat { display: flex; flex-direction: column; gap: 10px; padding: 15px 18px 16px; border-left: 1px solid var(--line-2); min-width: 0; }
.home-stat:first-child { border-left: 0; }
.home-stat span { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-stat b { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.home-stat.tone-run b { color: var(--run); }
.home-stat.tone-attn b { color: var(--attn); }
.home-section { margin-top: 30px; }
.home-section > h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.home-section > h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.host-card { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); transition: border-color 0.15s; overflow: hidden; }
.host-card:hover { border-color: var(--line-3); }
.host-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 16px 16px 14px; }
.host-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); flex: none; }
.host-card-head .nav-text { gap: 3px; }
.host-card-head strong { font-size: 13.5px; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-card-head .nav-sub { font-size: 11px; }
.host-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0 16px; padding: 12px 0 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }
.host-stat { display: flex; align-items: baseline; gap: 6px; padding-right: 14px; margin-right: 14px; border-right: 1px solid var(--line); }
.host-stat:last-of-type { border-right: 0; }
.host-stat b { font-size: 14px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.host-meta .tag { margin-left: auto; }
.host-actions { display: flex; gap: 8px; margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.host-actions button:first-child { flex: 1; }
.activity-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.activity-list .session { border: 0; border-radius: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.activity-list .session:last-child { border-bottom: 0; }
.activity-list .session:hover:not(:disabled) { background: var(--bg-2); }
.activity-list .session.selected::before { display: none; }
.onboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 28px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.onboard-step { padding: 18px; border-left: 1px solid var(--line-2); }
.onboard-step:first-child { border-left: 0; }
.onboard-step b { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.onboard-step p { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.onboard-step .step-n { font-size: 11px; font-weight: 600; color: var(--accent); }
.onboard-step .step-n::before { content: '❯ '; }
.home-cta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- Conversation ---------- */
#chat { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 28px var(--gutter) 20px; overscroll-behavior: contain; scrollbar-gutter: stable; outline: none; font-size: var(--fs-body); }
#transcript > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.msg { margin-bottom: 20px; overflow-wrap: anywhere; content-visibility: auto; contain-intrinsic-size: auto 96px; }
/* A growing row must expose its current height before following the tail. The
   browser's remembered auto size is updated after layout, one frame too late. */
.msg.streaming { content-visibility: visible; }
details.tool { content-visibility: auto; contain-intrinsic-size: auto 48px; }
.search-hit { outline: 1.5px solid var(--accent); outline-offset: 4px; border-radius: var(--r-xs); }
.session.unread .nav-title { color: var(--text); }
.unread-dot { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.msg-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 11px; color: var(--text-3); }
.msg-meta .who { color: var(--text-2); font-weight: 600; }
.msg-time { display: block; margin-top: 5px; font-size: 10px; color: var(--text-4); opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-time, .msg:focus-within .msg-time { opacity: 1; }
@media (pointer: coarse) { .msg-time { opacity: 0.65; } }
.msg-text { white-space: pre-wrap; font-size: var(--fs-body); line-height: var(--lh-body); }
/* User turn: the CLI's "❯" row on a raised strip. */
.msg.user { position: relative; margin-top: 8px; padding: 9px 14px 9px calc(14px + 2ch); border: 1px solid var(--line); border-left: 2px solid var(--line-3); border-radius: var(--r-xs) var(--r-sm) var(--r-sm) var(--r-xs); background: var(--bg-2); }
.msg.user::before { content: '❯'; position: absolute; left: 13px; top: 9px; color: var(--text-3); line-height: var(--lh-body); font-size: var(--fs-body); }
.msg.user .msg-text { color: var(--text); }
.msg.user .msg-meta { margin-bottom: 3px; }
.msg.user:not(.queued) .msg-meta:has(> .who:only-child) { display: none; }
/* Attachments on a sent message: image previews as tiles, other files as cards. */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-text + .msg-attachments { margin-top: 10px; }
.msg-meta + .msg-attachments { margin-top: 2px; }
.msg-attach { display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 260px; height: 46px; padding: 0 12px 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text-3); }
.msg-attach-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.msg-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text); }
.msg-attach-size { font-size: 11px; color: var(--text-3); }
.msg-attach.has-thumb { height: 88px; max-width: 180px; padding: 0; overflow: hidden; background: var(--bg); }
button.msg-attach { font: inherit; text-align: left; cursor: zoom-in; }
.image-view { display: block; max-width: 100%; max-height: 70dvh; margin: 0 auto; object-fit: contain; }
.msg-attach.has-thumb img { display: block; height: 100%; width: auto; max-width: 180px; object-fit: cover; }
.msg.queued { background: transparent; border: 1px dashed var(--line-3); border-left-width: 1px; color: var(--text-2); }
.msg.queued { padding-left: 14px; }
.msg.queued::before { content: none; }
.msg.queued .msg-text { color: var(--text-2); }
.msg.queued .who { color: var(--info); }
.queue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.queue-actions button { min-height: 44px; }
.queue-hint { margin-top: 8px; color: var(--text-3); font-size: 11px; line-height: 1.6; }
.msg.other { padding-left: 14px; border-left: 1px solid var(--line-3); color: var(--text-2); }
.msg.other .msg-text { font-size: 12.5px; max-height: 240px; overflow: auto; }
.msg-error { display: block; margin-top: 8px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--err) 25%, var(--line)); border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.55; color: var(--err); background: color-mix(in srgb, var(--err) 6%, var(--bg)); }
/* Assistant turn: "●" bullet, text indented two columns. */
.msg.assistant { position: relative; padding-left: 2ch; }
.msg.assistant::before { content: '●'; position: absolute; left: 0; top: 0; width: 2ch; font-size: 0.8em; line-height: calc(var(--lh-body) * var(--fs-body)); color: var(--text); }
.msg.assistant:has(> .thinking:first-child)::before, .msg.assistant:has(> .msg-meta:first-child)::before { line-height: 26px; }
.msg.assistant.streaming::before { color: var(--accent); animation: blink 1s steps(2, start) infinite; }
.msg-actions { display: flex; align-items: center; gap: 4px; margin: 6px 0 0 -6px; }
.msg-actions button.ghost { color: var(--text-3); }
.msg-actions .msg-time { display: inline; margin: 0 0 0 8px; }
.msg.assistant + .msg.assistant { margin-top: -6px; }

.md { font-size: var(--fs-body); line-height: var(--lh-body); color: #e0e0e0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.75em; }
.md .md-h { margin: 1.3em 0 0.5em; font-size: 1em; font-weight: 700; line-height: 1.45; letter-spacing: -0.01em; color: #fff; }
.md h3.md-h { font-size: 1.12em; }
.md h4.md-h { font-size: 1.05em; }
.md ul, .md ol { margin: 0 0 0.75em; padding-left: 2ch; }
.md ul > li::marker { content: '-  '; color: var(--text-3); }
.md ol > li::marker { color: var(--text-3); }
.md ol { padding-left: 3ch; }
.md li { margin: 0.2em 0; padding-left: 0.2ch; }
.md li > div + * { margin-top: 0.3em; }
.md li > ul, .md li > ol { margin-bottom: 0.2em; }
.md li.task { list-style: none; margin-left: -2ch; }
.md li.task::marker { content: none; }
.md .task-box { margin-right: 7px; color: var(--text-3); }
.md code { font-family: var(--mono); font-size: 1em; color: var(--code-ink); overflow-wrap: anywhere; }
.md a code { color: inherit; }
.md strong { font-weight: 700; color: #fff; }
.md em { color: #f2f2f2; }
.md blockquote { margin: 0 0 0.75em; padding: 1px 0 1px 14px; border-left: 2px solid var(--line-3); color: var(--text-2); }
.quote-actions { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.quote-actions button.ghost { color: var(--text-3); }
.quote-content > :first-child { margin-top: 0; }
.quote-content > :last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.4em 0; }
.table-wrap { margin: 0.4em 0 1em; overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.md table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.md th, .md td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md td + td, .md th + th { border-left: 1px solid var(--line); }
.md th { color: var(--text-2); font-weight: 600; background: var(--bg-1); white-space: nowrap; }
.md tbody tr:hover { background: var(--bg-1); }
.md tr:last-child td { border-bottom: 0; }
.codeblock { margin: 0.4em 0 1em; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--code-bg); overflow: hidden; }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 3px 0 12px; border-bottom: 1px solid var(--line); background: var(--bg-1); font-size: 11px; color: var(--text-3); }
.codeblock-head .icon-button { width: 24px; height: 24px; color: var(--text-3); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 12.5px/1.65 var(--mono); tab-size: 4; color: #dcdcdc; scrollbar-width: thin; }
.codeblock code { font: inherit; color: inherit; overflow-wrap: normal; }

.thinking { margin: 0 0 6px; }
.thinking > summary { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 8px 0 0; border-radius: var(--r-xs); list-style: none; font-size: 12.5px; font-style: italic; color: var(--text-3); cursor: pointer; }
.thinking > summary::-webkit-details-marker { display: none; }
.thinking > summary:hover { color: var(--text); }
.thinking > summary .icon-thinking { display: none; }
.thinking > summary .icon-chevronRight { transition: transform 0.15s var(--ease); color: var(--text-4); }
.thinking[open] > summary .icon-chevronRight { transform: rotate(90deg); }
.thinking-body { margin: 4px 0 10px; padding: 2px 0 2px 14px; border-left: 1px solid var(--line-3); color: var(--text-3); font-size: 12.5px; font-style: italic; line-height: 1.7; white-space: pre-wrap; max-height: 340px; overflow: auto; }
.msg.streaming[data-thinking] .thinking > summary span { animation: breathe 1.6s ease-in-out infinite; }

/* Tool calls: "● name summary" rows; the body hangs off a tree rule. */
details.tool { margin: 1px 0; }
details.tool > summary { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 4px 8px 4px 0; border-radius: var(--r-xs); list-style: none; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
details.tool > summary::-webkit-details-marker { display: none; }
details.tool > summary:hover .tool-name { color: #fff; }
details.tool > summary:hover .tool-summary { color: var(--text-2); }
details.tool > summary .icon-chevronRight { color: var(--text-4); opacity: 0; transition: transform 0.15s var(--ease), opacity 0.12s; }
details.tool > summary:hover .icon-chevronRight, details.tool[open] > summary .icon-chevronRight, details.tool > summary:focus-visible .icon-chevronRight { opacity: 1; }
details.tool[open] > summary .icon-chevronRight { transform: rotate(90deg); }
.tool + .msg, .tool + .sys { margin-top: 14px; }
.msg + .tool { margin-top: -10px; }
.tool-state { display: inline-grid; place-items: center; width: 1.6ch; height: 16px; margin-left: 0; flex: none; font-size: 11px; line-height: 1; color: var(--text-3); }
.tool-state .icon { display: none; }
.tool-state::before { content: '●'; }
.tool-state.done { color: var(--ok); }
.tool-state.error { color: var(--err); }
.tool-state.pending { color: var(--text-4); }
.tool-state.pending::before { content: '○'; }
.tool-state.running { color: var(--accent); font-size: 13px; }
.tool-state.running::before { content: '✻'; animation: cc-spinner 1.44s steps(1) infinite; }
.tool-state.stale, .tool-state.muted { color: var(--text-4); }
.tool-state.stale::before, .tool-state.muted::before { content: '○'; }
.tool-name { color: var(--text); font-weight: 600; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-summary { flex: 1; min-width: 0; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.tool-meta { flex: none; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
details.tool.running .tool-name { color: var(--accent); }
.tool.error .tool-name { color: var(--err); }
.tool-body { position: relative; margin: 2px 0 10px 0.75ch; padding: 4px 0 4px calc(1.25ch + 10px); border-left: 1px solid var(--line-2); }
.tool-section + .tool-section { margin-top: 8px; }
.tool-section-head { display: flex; align-items: center; justify-content: space-between; min-height: 26px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.tool-section-head .icon-button { width: 24px; height: 24px; color: var(--text-3); }
.tool-pre { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--code-bg); font: 12px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; scrollbar-width: thin; }
.tool-pre.clamped { max-height: 300px; }
.tool-pre.error { color: var(--err); border-color: color-mix(in srgb, var(--err) 22%, var(--line)); }
.tool-pre.diff { padding: 8px 0; }
.diff span { display: block; padding: 0 12px; }
.diff .del { color: #ffa3a3; background: color-mix(in srgb, var(--err) 10%, transparent); }
.diff .add { color: #b3d9ff; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.diff .diff-gap { color: var(--text-4); }
.tool-image { display: block; max-width: 100%; margin-top: 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.tool-note { margin-top: 8px; font-size: 11.5px; color: var(--text-3); }

.sys { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; margin-bottom: 10px; font-size: 12px; line-height: 1.55; color: var(--text-3); overflow-wrap: anywhere; }
.sys .icon { margin-top: 2px; color: var(--text-4); }
.sys.err, .sys.err .icon { color: var(--err); }
.sys.run, .sys.run .icon { color: var(--run); }
.sys.ok .icon { color: var(--ok); }
.sys.info .icon { color: var(--info); }
/* Activity line: the CLI spinner. */
.working { display: flex; align-items: center; gap: 1ch; margin-top: 10px; margin-bottom: 6px; font-size: 12.5px; color: var(--accent); }
.pulse { display: inline-grid; place-items: center; min-width: 1.2em; font-size: 14px; line-height: 1; margin-left: -0.15em; }
.pulse::before { content: '✻'; animation: cc-spinner 1.44s steps(1) infinite; }
.working > span:last-child::after { content: '…'; }
.working.attention { color: var(--attn); }
.working.attention .pulse::before { content: '◆'; animation: pulse 1.6s ease-in-out infinite; font-size: 11px; }
.working.attention > span:last-child::after { content: ''; }

.jump { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); height: 28px; padding: 0 12px; border-radius: 999px; font-size: 11.5px; background: var(--bg-2); border-color: var(--line-3); box-shadow: var(--shadow); z-index: 4; }
/* Native-style command discovery, anchored just above the composer. */
.command-menu { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(var(--col), calc(100% - 2 * var(--gutter))); max-height: min(40dvh, 320px); overflow-y: auto; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); box-shadow: 0 18px 50px rgb(0 0 0 / 0.75); z-index: 5; }
.command-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; height: auto; min-height: 34px; padding: 6px 9px; border: 0; border-radius: var(--r-xs); background: none; color: var(--text-2); text-align: left; letter-spacing: 0; white-space: normal; }
.command-item:hover, .command-item.active { background: var(--bg-2); color: var(--text); }
.command-item .cmd-name { font-family: var(--mono); font-size: 12px; color: var(--text); }
.command-item.active .cmd-name { color: var(--accent); }
.command-item .cmd-desc { font-size: 11px; line-height: 1.45; color: var(--text-3); overflow-wrap: anywhere; }
.command-empty { padding: 8px 10px; font-size: 11.5px; color: var(--text-3); }

/* ---------- Dock: requests + composer ---------- */
/* Same scrollbar gutter as the transcript so the composer shares its column.
   Children use auto side margins to centre, which disables flex stretching, so
   each sets width: 100% (capped by --col) instead of shrinking to its content. */
#dock { flex: none; display: flex; flex-direction: column; max-height: min(72dvh, calc(100dvh - 110px)); margin-top: -4px; padding: 4px var(--gutter) max(16px, env(safe-area-inset-bottom)); position: relative; overflow: hidden; scrollbar-gutter: stable; }
/* Each card fits the dock on its own: the body scrolls (one scroller, no nested
   ones), the action row is pinned so Allow/Deny/answers are always reachable. */
/* Account quota is a status line under the composer, as in the CLIs, aligned
   with the composer's text column. */
.account-usage { display: block; width: 100%; max-width: var(--col); height: auto; margin: 6px auto 0; padding: 0 clamp(14px, 2cqw, 20px); border: 0; background: none; color: var(--text-3); text-align: left; white-space: normal; overflow: visible; overflow-wrap: anywhere; font-size: 11px; font-weight: 400; letter-spacing: 0; line-height: 1.6; flex: none; }
.account-usage:hover:not(:disabled) { color: var(--text); background: none; }
.account-usage.context-full { color: var(--warn); }
/* Inline pieces form one sentence, keeping reset times with provider windows. A window
   under 20% left turns amber and under 10% red. */
.au-seg { display: inline; }
.au-mode { font-weight: 600; }
.au-win.low { color: var(--warn); }
.au-win.crit { color: var(--err); }
#requests { --requests-max: min(48dvh, 440px); flex: 0 1 auto; min-height: 64px; width: 100%; max-width: var(--col); margin: 0 auto 10px; max-height: none; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.request { position: relative; display: flex; flex-direction: column; flex: none; max-height: min(var(--requests-max), 100%); border: 1px solid color-mix(in srgb, var(--attn) 35%, var(--line-2)); border-radius: var(--r); background: color-mix(in srgb, var(--attn) 4%, var(--bg-1)); overflow: hidden; }
.request::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--attn); z-index: 1; }
.request.busy { opacity: 0.55; }
.request-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 13px 14px 12px 16px; scrollbar-width: thin; }
.request-head { display: flex; gap: 10px; align-items: flex-start; color: var(--attn); }
.request-head .icon { margin-top: 1px; }
.request-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.request-title strong { color: var(--text); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.request-title span { font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; }
.request-label { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--attn); overflow-wrap: anywhere; }
.request-label + .request-message { margin-top: 4px; }
.request-question { color: var(--text); font-size: 13px; }
.request-message { margin-top: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-summary { display: block; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--code-bg); font: 12px/1.55 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.request-questions { margin: 8px 0 0; padding-left: 26px; font-size: 12.5px; color: var(--text); line-height: 1.6; }
.request-input { margin-top: 8px; }
.request-input > summary { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; list-style: none; cursor: pointer; font-size: 11.5px; color: var(--text-3); padding: 2px 4px 2px 0; }
.request-input > summary:hover { color: var(--text); }
.request-input > summary::-webkit-details-marker { display: none; }
.request-input > summary .icon { transition: transform 0.15s var(--ease); }
.request-input[open] > summary .icon { transform: rotate(90deg); }
.request-input pre { margin: 6px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--code-bg); font: 11.5px/1.55 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.request-diff { margin-top: 8px; }
.request-diff-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 5px; font-size: 12px; color: var(--text-2); }
.request-diff-head strong { color: var(--text); }
.request-diff pre { max-height: 240px; overflow: auto; margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--code-bg); font: 11.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-del { color: var(--err); }
.diff-add { color: var(--ok); }
.request-options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.request-options > button { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; width: 100%; height: auto; min-height: var(--control); padding: 8px 12px; background: var(--bg); white-space: normal; text-align: left; letter-spacing: 0; }
.request-options > button > span { color: var(--text); font-size: 12.5px; overflow-wrap: anywhere; }
.request-options > button > small { color: var(--text-3); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.request-options > button:hover:not(:disabled) { border-color: var(--text-3); background: var(--bg-2); }
.request-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 10px 14px 12px 16px; border-top: 1px solid color-mix(in srgb, var(--attn) 14%, var(--line)); }
.request-actions > button:first-child { margin-right: auto; }

#composer { width: 100%; max-width: var(--col); margin: 0 auto; padding: 10px 8px 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-1); transition: border-color 0.15s, box-shadow 0.15s; flex: none; }
#composer:focus-within { border-color: #4a4a4a; box-shadow: 0 0 0 3px rgb(255 255 255 / 0.04); }
.prompt-line { display: flex; align-items: flex-start; gap: 1ch; padding-right: 4px; }
.prompt-glyph { flex: none; width: 1ch; font-size: var(--fs-body); line-height: 1.6; padding-top: 3px; color: var(--text-3); transition: color 0.15s; }
#composer:focus-within .prompt-glyph { color: var(--accent); }
#message { display: block; height: auto; min-height: 28px; max-height: min(38dvh, 240px, max(48px, calc(100dvh - 300px))); padding: 3px 0; border: 0; border-radius: 0; background: none; resize: none; box-shadow: none; font-size: var(--fs-body); line-height: 1.6; overflow-y: auto; }
#message:disabled { cursor: not-allowed; }
.composer-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; min-width: 0; }
.composer-row button { height: 28px; padding: 0 10px; font-size: 12px; }
.composer-row { flex-wrap: nowrap; }
/* The status, delivery hint and Queue/Steer choice form one strip. On wide screens its parts
   sit in the action row as before; on a phone it becomes a band above the prompt. */
.composer-strip { display: contents; }
.mode-hint { display: none; }
/* Queue and Steer: a recessed two-way switch. The chosen side is lifted, never a white block. */
.composer-mode { display: inline-flex; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.composer-mode[hidden] { display: none; }
.composer-row .composer-mode button { position: relative; height: 24px; padding: 0 9px; gap: 5px; border: 0; border-radius: var(--r-sm); color: var(--text-3); background: none; }
.composer-mode button .icon { color: var(--text-4); }
.composer-mode button[aria-pressed='true'] { color: var(--text); background: var(--bg-4); }
.composer-mode button[aria-pressed='true'] .icon { color: var(--accent); }
.composer-mode button:hover:not(:disabled):not([aria-pressed='true']) { background: var(--bg-3); color: var(--text-2); border-color: transparent; }
.composer-mode button:disabled { opacity: .4; }
.composer-row #send { padding: 0 12px; }
.exec-state { display: inline-flex; align-items: center; gap: 7px; min-width: 0; margin-right: auto; padding-left: 2px; font-size: 11px; color: var(--text-3); overflow: hidden; white-space: nowrap; }
.exec-state .dot { width: 6px; height: 6px; box-shadow: none; }
.exec-state span:last-child { overflow: hidden; text-overflow: ellipsis; }
.exec-state.tone-run { color: var(--run); }
.exec-state.tone-attn { color: var(--attn); }
.exec-state.tone-err { color: var(--err); }
.composer-hint { font-size: 10.5px; color: var(--text-4); white-space: nowrap; margin-right: 4px; }
#composer .stop .icon { color: var(--err); }
/* Orchestrator mode: the toggle, the composer border and the Send label (Plan) show it. */
#work-mode.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); background: var(--accent-soft); }
#work-mode.on .icon { color: var(--accent); }
#composer.orchestrate { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
/* An implementation handoff names itself above the plan; the plan stays ordinary markdown. */
.handoff-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line-2); border-left: 2px solid var(--accent); border-radius: var(--r-xs); background: var(--bg-1); font-size: 12px; color: var(--text-3); }
.handoff-bar strong { color: var(--text); }
.handoff-bar .icon { color: var(--accent); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin: -2px -0px 10px -4px; padding: 7px 8px 7px 11px; border: 1px solid color-mix(in srgb, var(--warn) 22%, var(--line)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 5%, var(--bg)); }
.composer-bar p { flex: 1; font-size: 11.5px; line-height: 1.5; color: color-mix(in srgb, var(--warn) 75%, var(--text)); }
.dialog-failure { margin-top: 14px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--err) 24%, var(--line)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--err) 5%, var(--bg)); }
.dialog-failure p + p { margin-top: 7px; }
.dialog-failure .form-error { margin: 0; }

/* Hover and keyboard hints share one surface above dialogs and scrolling panels. */
.tooltip { position: fixed; inset: auto; margin: 0; width: max-content; max-width: min(320px, calc(100vw - 16px)); padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 0; background: var(--bg-3); color: var(--text-2); font: 12px/1.5 var(--sans); overflow-wrap: anywhere; z-index: 10000; box-shadow: none; }
.tooltip[hidden] { display: none; }

/* ---------- Dialog ---------- */
dialog { width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(86dvh, 860px); padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-1); color: var(--text); box-shadow: 0 0 0 1px #000, 0 30px 100px rgb(0 0 0 / 0.9); overflow: hidden; }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog.compact { width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.78); }
dialog[open] { display: flex; animation: dialog-in 0.16s var(--ease); }
#dialog-form:focus { outline: none; }
#dialog-form { display: flex; flex-direction: column; flex: 1; min-height: 0; max-height: min(86dvh, 860px); width: 100%; }
.dialog-head { display: flex; align-items: flex-start; gap: 6px; padding: 16px 12px 14px 22px; border-bottom: 1px solid var(--line); flex: none; }
#dialog-back { margin: -1px 2px 0 -12px; }
.dialog-titles { flex: 1; min-width: 0; padding-top: 5px; }
.dialog-titles h2 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.dialog-titles p { margin-top: 4px; font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
dialog.danger .dialog-titles h2 { color: var(--err); }
dialog.danger { border-color: color-mix(in srgb, var(--err) 30%, var(--line-2)); }
.dialog-head .icon-button { margin-top: -2px; color: var(--text-3); }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 22px; overscroll-behavior: contain; }
#dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); flex: none; }
#dialog-actions:empty { display: none; }
#dialog-actions .spacer { margin-right: auto; }
.dialog-section { margin: 0 0 24px; }
.dialog-section:last-child { margin-bottom: 0; }
.dialog-section > h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.lead { margin: 0 0 16px; font-size: 12.5px; line-height: 1.65; color: var(--text-2); overflow-wrap: anywhere; }
.muted-text { color: var(--text-3); font-size: 12px; line-height: 1.6; }
.md-clipped { color: var(--text-3); font-size: 12px; line-height: 1.6; }
.callout { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); }
.callout p { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.callout .icon { margin-top: 2px; color: var(--info); }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 28%, var(--line)); background: color-mix(in srgb, var(--warn) 4%, var(--bg)); }
.callout.warn .icon { color: var(--warn); }
.callout.danger { border-color: color-mix(in srgb, var(--err) 32%, var(--line)); background: color-mix(in srgb, var(--err) 5%, var(--bg)); }
.callout.danger .icon { color: var(--err); }
.callout.success { border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); background: color-mix(in srgb, var(--ok) 5%, var(--bg)); }
.callout.success .icon { color: var(--ok); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.kv dd.mono { font-size: 12px; padding-top: 1px; }
pre.code { margin: 0 0 12px; padding: 10px 12px; max-height: 52dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--code-bg); font: 12px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code.log { white-space: pre; overflow-wrap: normal; font-size: 11.5px; }
.code-inline { font: 12px var(--mono); padding: 7px 10px; border-radius: var(--r-sm); background: var(--code-bg); border: 1px solid var(--line-2); overflow-wrap: anywhere; display: block; color: var(--text); }
.secret { font-size: 14px; font-weight: 600; letter-spacing: 0.04em; padding: 14px; text-align: center; user-select: all; color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.folder-filter { align-items: center; margin-bottom: 8px; }
.folder-filter input[type='search'] { flex: 1; min-width: 140px; height: 34px; }
.folder-filter .inline-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; white-space: nowrap; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0 0 12px; font-size: 12px; color: var(--text-4); }
.breadcrumbs button { height: 26px; padding: 0 6px; font-size: 12px; border-radius: var(--r-xs); }
.breadcrumbs button[aria-current='page'] { color: var(--text); font-weight: 600; }
.list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.list-row { display: flex; align-items: center; gap: 11px; width: 100%; height: auto; min-height: 42px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; font-weight: 400; color: var(--text); letter-spacing: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover:not(:disabled) { background: var(--bg-2); border-color: var(--line); }
.list-row > .icon { color: var(--text-3); }
.list-row .icon-folder { color: var(--text-2); }
.list-row .icon-chevronRight { color: var(--text-4); margin-left: auto; }
.list-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
.list-row .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--text-3); }
.list.scroll { max-height: 46dvh; overflow-y: auto; }
/* An empty list would draw a bare bordered line; a note above a list keeps a small gap. */
.list:empty { display: none; }
.hint + .list { margin-top: 10px; }
.empty-state { padding: 28px 16px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--text-3); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; margin: 0 0 18px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--line-2); overflow: hidden; }
.metric { padding: 12px 14px; background: var(--bg); min-width: 0; }
.metric span { display: block; font-size: 11px; color: var(--text-3); }
.metric b { display: block; margin-top: 6px; font-size: 16px; font-weight: 500; letter-spacing: -0.02em; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meter { height: 4px; margin: 8px 0 4px; border-radius: 99px; background: var(--bg-4); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--text); }
.meter.run > span { background: var(--run); }
.meter.err > span { background: var(--err); }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th, table.data td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; }
table.data th { color: var(--text-3); font-weight: 500; font-size: 11px; }
table.data td { font-size: 12px; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin: 0 0 14px; }
.flow { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.flow .flow-node { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.flow .flow-node span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow > .icon { color: var(--accent); flex: none; }
/* Terminals dialog: live bar, short note, one card per server with
   grid rows (badge | details | action). On phones the action drops under the
   details, aligned to the text column and full width. */
.ext-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--control-sm); margin: 0 0 8px; }
.ext-top .sync { min-width: 0; }
.ext-top .sync > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ext-top > button { flex: none; }
.ext-note { margin: 0 0 22px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); overflow-wrap: anywhere; }
.ext-host + .ext-host { margin-top: 24px; }
.ext-host-head { display: flex; align-items: center; gap: 9px; min-width: 0; margin: 0 0 10px 2px; }
.ext-host-head .icon { color: var(--text-3); }
.ext-host-head h3 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text); letter-spacing: -0.01em; }
.ext-host.offline .ext-host-head h3 { color: var(--text-2); }
.ext-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font-size: 10.5px; font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--text-2); background: var(--bg); }
.ext-list { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.ext-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ext-row:last-child { border-bottom: 0; }
.ext-lead { align-self: start; margin-top: 1px; }
.ext-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ext-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 20px; color: var(--text); }
.ext-path { display: flex; min-width: 0; font: 11.5px/1.5 var(--sans); color: var(--text-3); }
.ext-path > span:first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-path > span:last-child { flex: 0 0 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ext-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ext-meta .status-chip { height: 20px; padding: 0 7px; font-size: 10.5px; }
.ext-reason { margin: 2px 0 0; font-size: 11.5px; line-height: 1.55; color: color-mix(in srgb, var(--warn) 75%, var(--text)); overflow-wrap: anywhere; }
.ext-action { justify-self: end; min-width: 132px; }
.ext-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; justify-self: end; min-width: 132px; }
.ext-actions button { width: 100%; }
.ext-move { display: inline-grid; place-items: center; width: 22px; height: 20px; }
.ext-move .dot { width: 7px; height: 7px; }
.ext-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 20px 28px; text-align: center; }
.ext-empty > .icon { width: 34px; height: 34px; padding: 8px; margin-bottom: 4px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text-3); }
.ext-empty b { font-size: 12.5px; color: var(--text); }
.ext-empty p { max-width: 380px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); overflow-wrap: anywhere; }
.ext-empty.error .icon { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, var(--line-2)); }
.ext-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px 16px; font-size: 11.5px; color: var(--text-3); }
.ext-spinner { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--text-4); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.ext-select-all { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 11.5px; color: var(--text-3); cursor: pointer; white-space: nowrap; }
.ext-select-all[hidden] { display: none; }
.ext-select-all input { width: 15px; height: 15px; margin: 0; accent-color: var(--text); cursor: pointer; }
.ext-select-all input:disabled { cursor: not-allowed; opacity: 0.35; }
.ext-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); }
.ext-bulk[hidden] { display: none; }
.ext-bulk-count { flex: 1 1 120px; min-width: 0; font-size: 11.5px; color: var(--text-2); }
.ext-lead-group { display: flex; align-items: center; gap: 8px; align-self: start; min-width: 0; }
.ext-lead-group .ext-lead { align-self: center; }
.ext-select { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; cursor: pointer; }
.ext-select input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); cursor: pointer; }
.ext-select input:disabled { cursor: not-allowed; opacity: 0.35; }
.ext-row.selected { background: var(--bg-2); }
.ext-bulk-list { display: flex; flex-direction: column; gap: 8px; }
.ext-bulk-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); }
.ext-bulk-actions { display: flex; flex-direction: column; gap: 6px; justify-self: end; }
.ext-bulk-detail { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--text-3); overflow-wrap: anywhere; }
.ext-bulk-summary { margin: 0 0 10px; font-size: 12px; line-height: 1.6; color: var(--text-2); }
@media (max-width: 640px) {
  .ext-bulk-item { grid-template-columns: auto minmax(0, 1fr); }
  .ext-bulk-actions { grid-column: 2; flex-direction: row; justify-self: stretch; }
  .ext-bulk-actions button { flex: 1 1 0; }
}
@media (max-width: 640px) {
  .ext-row { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; padding: 14px; }
  .ext-action { grid-column: 2; justify-self: stretch; min-width: 0; }
  .ext-actions { grid-column: 2; justify-self: stretch; min-width: 0; flex-direction: row; }
  .ext-actions button { flex: 1 1 0; }
  .ext-note { margin-bottom: 18px; }
}
.job { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.job:last-child { border-bottom: 0; }
.job .grow { flex: 1; min-width: 0; }
.job .row-sub { display: block; font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
/* Server settings: titled groups of cards; each row is text left, controls right. */
.mg .mg-group { margin: 0 0 22px; }
.mg-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; margin: 0 0 8px; }
.mg-group-head h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-2); }
.mg-card { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.mg-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); }
.mg-card > :first-child { border-top: 0; }
/* Loading lines, notes and callouts placed directly in a card keep the card's inset. */
.mg-card > p.muted-text, .mg-card > .lead { margin: 0; padding: 14px 16px; }
/* A note or empty state after rows is its own row, divided like them. */
.mg-card > p.muted-text:not(:first-child) { border-top: 1px solid var(--line); }
.mg-card > .callout { margin: 12px 16px; }
.mg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mg-text strong { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; font-size: 13px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
/* The status dot and tag stay on the title's line; only the title text wraps. */
.mg-text strong > .dot { width: 7px; height: 7px; flex: none; }
.mg-text strong > .tag { flex: none; }
.mg-text strong > span:not(.dot, .tag) { min-width: 0; }
.mg-text strong > .tag { font-weight: 500; }
.mg-text p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--text-3); overflow-wrap: anywhere; }
.mg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; }
.mg-actions > button { min-width: 108px; }
.mg-actions > button.ghost { min-width: 0; }
.mg-overview .kv { padding: 14px 16px; grid-template-columns: 160px minmax(0, 1fr); }
.mg-overview .kv dd { white-space: pre-line; }
.mg-overview .mg-health:not(:empty) { border-top: 1px solid var(--line); }
.mg-update { border-color: var(--line-3); }
.mg-update-head { display: flex; align-items: center; gap: 16px; padding: 16px; }
.mg-update-head > button { flex: none; min-width: 148px; }
.mg-update-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.mg-update-actions > .primary { min-width: 148px; }
.mg-status { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.mg-status > .dot { width: 9px; height: 9px; margin-top: 5px; }
.mg-status strong { font-size: 14px; }
.mg-update > .callout { margin: 0 16px 16px; }
.mg-steps { display: flex; gap: 0; margin: 0; padding: 0 16px 16px; list-style: none; counter-reset: step; }
.mg-steps li { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-left-width: 0; font-size: 11.5px; color: var(--text-4); background: var(--bg-1); }
.mg-steps li:first-child { border-left-width: 1px; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.mg-steps li:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.mg-steps li > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-step-mark { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.mg-steps li.done { color: var(--text-2); }
.mg-steps li.done .mg-step-mark { background: var(--ok); border-color: var(--ok); }
.mg-steps li.current { color: var(--text); background: var(--bg-2); }
.mg-steps li.current .mg-step-mark { border-color: var(--accent); background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.mg-activity { margin: 0 0 22px; }
.mg-activity > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; list-style: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-3); }
.mg-activity > summary::-webkit-details-marker { display: none; }
.mg-activity > summary:hover { color: var(--text); }
.mg-activity > summary .icon { transition: transform 0.15s var(--ease); }
.mg-activity[open] > summary .icon { transform: rotate(90deg); }
.mg-activity > .list { margin-top: 8px; }
/* Activity rows use the same inset as every other settings row. */
.mg-activity .job { padding: 12px 16px; gap: 8px; }
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { width: 40px; height: 22px; border-radius: 999px; border: 1px solid var(--line-3); background: var(--bg-3); transition: background-color 0.15s, border-color 0.15s; position: relative; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: transform 0.15s var(--ease), background-color 0.15s; }
.switch input:checked + .switch-track { background: var(--text); border-color: var(--text); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #000; }
.switch input:focus-visible + .switch-track { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }
.ext-summary { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.ext-summary > .agent-badge { margin-top: 1px; }
.ext-section { margin-top: 20px; }
.ext-section h4 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.ext-carry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; padding: 0; list-style: none; }
.ext-carry li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.ext-carry li.kept .icon { color: var(--ok); }
.ext-carry li.dropped { color: var(--text-3); }
.ext-carry li.dropped .icon { color: var(--text-4); }
.ext-foot { margin-top: 18px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); }
@media (max-width: 640px) { .ext-carry { grid-template-columns: minmax(0, 1fr); } }
.mg-picker-section { margin-top: 18px; }
.mg-picker-section h4 { margin: 0 0 4px; font-size: 13px; color: var(--text); }
.mg-picker-section > p { margin-bottom: 10px; }
.mg-picker { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.mg-pick { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.mg-pick:first-child { border-top: 0; }
.mg-pick:hover { background: var(--bg-2); }
.mg-pick input { margin-top: 3px; }
.mg-pick-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mg-pick-text strong { font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.mg-pick-text small { font-size: 11.5px; color: var(--text-3); }
.update-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); flex: none; }
.update-mark.active .icon { animation: spin 1.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .update-mark.active .icon { animation: none; } }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.action-grid button { justify-content: flex-start; height: auto; min-height: 40px; padding: 8px 12px; white-space: normal; text-align: left; }
fieldset.question { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }
fieldset.question legend { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--attn); }
.question-text { margin-bottom: 12px; font-size: 13px; line-height: 1.6; color: var(--text); }
.other-answer { margin-top: 10px; }
details.advanced { margin: 4px 0 8px; }
details.advanced > summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; font-size: 12px; color: var(--text-2); padding: 4px 0; }
details.advanced > summary:hover { color: var(--text); }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary .icon { transition: transform 0.15s var(--ease); }
details.advanced[open] > summary .icon { transform: rotate(90deg); }
details.advanced > div { padding-top: 10px; }

/* ---------- Menu & toasts ---------- */
.menu { position: fixed; z-index: 60; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); box-shadow: var(--shadow); animation: pop 0.12s var(--ease); }
.menu-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; height: auto; min-height: 34px; padding: 6px 10px; border: 0; border-radius: var(--r-xs); background: none; text-align: left; font-weight: 400; font-size: 12.5px; letter-spacing: 0; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--bg-3); outline: none; border: 0; }
.menu-item .icon { color: var(--text-3); }
.menu-item.danger, .menu-item.danger .icon { color: var(--err); }
.menu-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-text small { font-size: 11px; color: var(--text-3); white-space: normal; }
.menu-sep { height: 1px; margin: 4px -4px; background: var(--line); }
.menu-heading { padding: 8px 10px 4px; font-size: 11px; color: var(--text-3); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px 10px 13px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-2); box-shadow: var(--shadow); font-size: 12.5px; pointer-events: auto; animation: rise 0.18s var(--ease); }
.toast > .icon { margin-top: 2px; }
.toast > span { flex: 1; min-width: 0; padding-top: 1px; line-height: 1.55; overflow-wrap: anywhere; }
.toast > .icon-button { margin: -3px 0 -3px; }
.toast.error { border-color: color-mix(in srgb, var(--err) 30%, var(--line-2)); }
.toast.error > .icon { color: var(--err); }
.toast.success > .icon { color: var(--ok); }
.toast.info > .icon { color: var(--info); }
#scrim { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.72); animation: fade 0.18s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } }
@keyframes cc-spinner {
  0% { content: '·'; }
  8.33% { content: '✢'; }
  16.66% { content: '*'; }
  25% { content: '✶'; }
  33.33% { content: '✻'; }
  41.66% { content: '✽'; }
  58.33% { content: '✻'; }
  66.66% { content: '✶'; }
  75% { content: '*'; }
  83.33% { content: '✢'; }
  91.66% { content: '·'; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  :root { --side: 248px; --gutter: 22px; }
}
@media (max-width: 820px) {
  :root { --fs-body: 14px; }
  #app { grid-template-columns: minmax(0, 1fr); }
  #sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(320px, 86vw); padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-102%); transition: transform 0.22s var(--ease); border-right-color: var(--line-2); }
  body.nav-open #sidebar { transform: none; box-shadow: 24px 0 80px rgb(0 0 0 / 0.8); }
  .session.selected::before { left: -6px; }
  #close-nav { display: inline-flex; }
  #menu { display: inline-flex; margin-left: -6px; }
  #topbar { gap: 8px; min-height: 52px; padding: max(6px, env(safe-area-inset-top)) 8px 6px 10px; }
  .split { grid-template-columns: 1fr; }
  #toasts { bottom: auto; top: calc(10px + env(safe-area-inset-top)); right: auto; left: 50%; transform: translateX(-50%); }
  .toast { animation: none; }
}
@media (max-width: 640px) {
  dialog, dialog.wide, dialog.compact { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; border-bottom: 0; }
  dialog[open] { animation: sheet-in 0.22s var(--ease); }
  #dialog-form { max-height: 94dvh; }
  .dialog-head { position: relative; padding: 18px 8px 12px 18px; }
  .dialog-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-3); }
  #dialog-back { margin-left: -10px; }
  .dialog-body { padding: 16px 18px 20px; }
  #dialog-actions { padding: 10px 12px max(12px, env(safe-area-inset-bottom)); }
  #dialog-actions > button { flex: 1 1 auto; }
  .request-actions > button { flex: 1 1 auto; }
  .request-actions > button:first-child { margin-right: 0; }
  .request-actions > .primary { flex-grow: 2; }
  .kv { gap: 6px 14px; }
  .status-chip { height: 20px; padding: 0 6px; font-size: 10.5px; }
  .host-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-row, .mg-update-head { flex-wrap: wrap; gap: 12px; }
  .mg-row > .mg-actions:has(> button), .mg-update-head > button, .mg-update-actions { width: 100%; }
  .mg-actions > button, .mg-update-actions > button { flex: 1 1 0; }
  .mg-update-actions { flex-wrap: wrap; }
  .mg-row:has(.switch) { flex-wrap: nowrap; }
  .mg-steps { flex-direction: column; }
  .mg-steps li { border-left-width: 1px; border-top-width: 0; }
  .mg-steps li:first-child { border-top-width: 1px; border-radius: var(--r-sm) var(--r-sm) 0 0; }
  .mg-steps li:last-child { border-radius: 0 0 var(--r-sm) var(--r-sm); }
}
@media (pointer: coarse) {
  :root { --control: 40px; --control-sm: 34px; }
  input, textarea, select { font-size: 16px; }
  input.mono, textarea.mono { font-size: 14px; }
  /* The prompt matches the conversation text. Only iOS Safari needs 16px (it zooms the page on
     focus below that), so the larger size is limited to it. */
  #message { font-size: var(--fs-body); }
  .computer, .session { padding: 10px 10px; }
  .ext-select { width: 30px; height: 30px; }
  .ext-select input { width: 18px; height: 18px; }
  .list-row { min-height: 50px; }
  details.tool > summary { min-height: 40px; }
  details.tool > summary .icon-chevronRight { opacity: 1; }
  .nav-row .nav-tool { opacity: 1; }
  .msg-actions button, .quote-actions button { min-height: 44px; }
  .menu-item { min-height: 44px; }
  .composer-row button { height: 36px; }
  .composer-row .composer-mode button { height: 44px; }
  .top-actions button { height: 44px; }
  .top-actions .icon-button { width: 44px; }
  .segmented .choice { min-height: 44px; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Small utilities ---------- */
.spacer-6 { height: 6px; }
.spacer-8 { height: 8px; }
.spacer-10 { height: 10px; }
.spacer-12 { height: 12px; }
.spacer-14 { height: 14px; }
.spacer-16 { height: 16px; }
#dialog-content.loading { opacity: 0.55; pointer-events: none; transition: opacity 0.1s 0.12s; }
.choices.scroll-list { max-height: 46dvh; overflow-y: auto; padding-right: 2px; }
.transcript-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14vh 16px 0; text-align: center; color: var(--text-3); }
.transcript-empty .icon { width: 40px; height: 40px; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); color: var(--accent); }
.transcript-empty p { max-width: 380px; font-size: 12.5px; line-height: 1.65; }
button.brand { height: auto; padding: 6px 8px; margin: -6px -8px; border: 0; background: none; }
button.brand:hover:not(:disabled) { background: var(--bg-2); border: 0; }
.toolbar + .dialog-section { margin-top: 18px; }
.dialog-section + .list { margin-top: -8px; }
/* Owner preference: the entire interface uses a heavy terminal face. */
body, body * { font-weight: 700 !important; }
body :is(strong, b, h1, h2, h3, summary) { font-weight: 800 !important; }
body :is(p, li, td, .lead, .muted-text) { font-weight: 650 !important; }
/* Sidebar navigation: quiet rows whose icon sits in the same 22 px lead column as the
   machine dots and agent badges below, so every label starts on one line. */
#overview, #projects, #limits, #forge, #external-sessions { justify-content: flex-start; gap: 12px; height: var(--control); margin-bottom: 2px; padding: 0 8px 0 12px; border-color: transparent; background: none; color: var(--text-2); }
#overview:hover:not(:disabled), #projects:hover:not(:disabled), #limits:hover:not(:disabled), #forge:hover:not(:disabled), #external-sessions:hover:not(:disabled) { border-color: transparent; background: var(--bg-2); color: var(--text); }
/* Composer attachments: one horizontal row of chips above the prompt line. */
.image-previews { display: flex; gap: 8px; margin: 0 0 10px -4px; padding: 0 0 2px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.attach-chip { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; flex: none; width: 236px; min-height: 54px; padding: 6px 4px 6px 6px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); overflow: hidden; scroll-snap-align: start; }
.attach-thumb { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--bg-2); overflow: hidden; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb span { font-size: 9.5px; letter-spacing: 0.04em; color: var(--text-2); }
.attach-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.attach-name { display: flex; min-width: 0; font-size: 12px; color: var(--text); white-space: nowrap; }
.attach-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.attach-name > span:last-child { flex: none; }
.attach-meta { font-size: 10.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.attach-actions { display: flex; align-items: center; }
.attach-chip .icon-button { color: var(--text-3); }
.attach-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.attach-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s var(--ease); }
.attach-chip.done .attach-bar { display: none; }
.attach-chip.error { border-color: color-mix(in srgb, var(--err) 40%, var(--line-2)); }
.attach-chip.error .attach-meta { color: var(--err); }
.attach-chip.error .attach-bar > span { background: var(--err); }
.attach-chip.queued .attach-meta, .attach-chip.uploading .attach-meta { color: var(--text-2); }
#composer.dragging { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
#attach-image { flex: none; }
.search-results { display: flex; flex-direction: column; max-height: 52vh; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.search-results:empty { display: none; }
.search-result { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 3px; width: 100%; height: auto; min-height: 40px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; color: var(--text); font-size: 12.5px; letter-spacing: 0; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover:not(:disabled), .search-result.active { border-color: var(--line); background: var(--bg-2); box-shadow: inset 2px 0 0 var(--text-2); }
.search-result > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-meta { font-size: 11px; color: var(--text-3); }
/* The Go to list: icon or agent badge, the title, and its detail on the right. */
.palette-row { flex-direction: row; align-items: center; gap: 11px; min-height: 38px; padding: 7px 12px; }
.palette-row > .icon { flex: none; color: var(--text-3); }
.palette-row.active > .icon { color: var(--text); }
.palette-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-row .search-meta { flex: 0 1 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-input { height: 38px; margin: 0 0 12px; font-size: 13.5px; }
.palette-status { margin: 10px 0 0; font-size: 11px; color: var(--text-3); }
.palette-status:empty { display: none; }
.search-results + .palette-status { text-align: right; }
.search-snippet { font-size: 12px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.side-heading-actions { display: inline-flex; align-items: center; gap: 2px; }

@media (forced-colors: active) {
  .msg, .tool, .request-card, #composer, #sidebar, dialog, .menu, .toast {
    border: 1px solid CanvasText;
  }
  .status-chip, .agent-badge, .tag { border: 1px solid CanvasText; }
  .unread-dot, .dot { background: Highlight; }
}

/* ---------- Threads, agents and accounts ----------
   A thread holds several agent sessions. Chips name each agent with its badge, model
   and account; attribution lines appear only where the speaker changes. */
.agent-stack { display: inline-flex; flex: none; }
.agent-stack.multi .agent-badge + .agent-badge { margin-left: -5px; box-shadow: -1px 0 0 var(--bg); }
.session.selected .agent-stack.multi .agent-badge + .agent-badge { box-shadow: -1px 0 0 var(--bg-2); }

.thread-bar { display: flex; align-items: center; gap: 8px; padding: 6px var(--gutter) 7px; border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; }
.thread-agents { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.thread-agents::-webkit-scrollbar { display: none; }
.thread-tools { display: flex; gap: 2px; flex: none; }
.agent-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px 0 6px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; flex: none; max-width: 260px; transition: border-color 0.12s, background-color 0.12s; }
.agent-chip:hover { border-color: var(--line-3); color: var(--text); }
.agent-chip.selected { border-color: var(--text-3); background: var(--bg-2); color: var(--text); }
.agent-chip:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.agent-chip .chip-text { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.agent-chip .chip-name { font-weight: 600; white-space: nowrap; }
.agent-chip .chip-detail { color: var(--text-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.agent-chip .dot { width: 6px; height: 6px; box-shadow: none; }
.agent-chip .chip-role { height: 16px; padding: 0 5px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--r-xs); color: var(--accent); font-size: 10px; line-height: 14px; font-weight: 600; }
.agent-chip .icon { color: var(--text-3); }
.agent-tab { position: relative; display: inline-flex; flex: none; }
.agent-tab .agent-chip { padding-right: 30px; }
.agent-tab .chip-close { position: absolute; top: 50%; right: 3px; transform: translateY(-50%); width: 22px; height: 22px; color: var(--text-3); }
.agent-tab .chip-close:hover:not(:disabled) { color: var(--text); }
.thread-tools .audience.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.who-line { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 11.5px; color: var(--text-2); }
.msg.assistant > .who-line { margin-left: -2ch; }
.msg.assistant:has(> .who-line:first-child)::before { top: 26px; }
.who-line .agent-badge { width: 22px; height: 17px; }
.who-line .who-name { font-weight: 600; color: var(--text); }
.who-line .who-detail { color: var(--text-3); font-size: 11.5px; }
.tool-group { margin-top: 14px; }
.tool-group > .who-line { margin-bottom: 2px; }
.msg-meta .who { white-space: nowrap; }

.handoff-card { margin: 4px 0 20px; border: 1px solid var(--line-2); border-left: 2px solid var(--accent); border-radius: var(--r-xs); background: var(--bg-1); }
.handoff-card > summary { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 6px 12px; list-style: none; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.handoff-card > summary::-webkit-details-marker { display: none; }
.handoff-card > summary .icon-handoff { color: var(--accent); flex: none; }
.handoff-card .handoff-title { color: var(--text); font-weight: 600; }
.handoff-card .handoff-sub { color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.handoff-card > summary .icon-chevronRight { margin-left: auto; color: var(--text-4); transition: transform 0.15s var(--ease); flex: none; }
.handoff-card[open] > summary .icon-chevronRight { transform: rotate(90deg); }
.handoff-card[open] > summary { border-bottom: 1px solid var(--line); }
.handoff-card > .md { padding: 10px 14px 4px; font-size: 12.5px; max-height: 420px; overflow: auto; }

.thread-members { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); margin: 0 0 16px; }
.thread-member { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.thread-member + .thread-member { border-top: 1px solid var(--line); }
.thread-member.past { opacity: 0.62; }
.member-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member-text { display: flex; flex-direction: column; min-width: 0; }
.member-name { font-weight: 600; font-size: 12.5px; }
.member-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.member-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-actions { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 32px; }
.forward-preview { margin: 0; padding: 8px 12px; border-left: 2px solid var(--line-3); color: var(--text-2); font-size: 12.5px; white-space: pre-wrap; max-height: 180px; overflow: auto; }

.agent-cards.choices.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.agent-fields[hidden] { display: none; }
/* Launch dialog: Permissions and Mode are card rows like Agent, one column per option; the
   chosen Bypass or Full access card carries the same warning colour as the header chip. */
.access-cards.choices.cards { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px; }
.access-cards[data-count="stack"] { --cols: 1; }
.access-cards .choice { padding: 10px 12px; }
.access-cards .choice-desc { font-size: 11.5px; }
.choice.access-bypass:has(input:checked) { border-color: var(--warn); }
.choice.access-bypass:has(input:checked) .choice-label { color: var(--warn); }
.choice.access-full:has(input:checked) { border-color: var(--err); }
.choice.access-full:has(input:checked) .choice-label { color: var(--err); }
.dialog-section > .access-cards + .section-note { margin: 10px 0 0; }
/* The optional model settings close the form as a row of their own: a label, the current
   value on the right, and the fields below when opened. */
.dialog-section + details.advanced { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
details.advanced > summary .advanced-value { margin-left: auto; padding-left: 12px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.dialog-section + details.advanced > summary { display: flex; width: 100%; min-height: 30px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.dialog-section + details.advanced > div > .field:last-child { margin-bottom: 0; }

.account-agent { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px 6px 16px; border-top: 1px solid var(--line); background: var(--bg-1); }
.account-agent strong { font-size: 12.5px; }
.account-agent .ghost { margin-left: auto; }
.account-warn { margin: 4px 0 0; font-size: 12px; color: var(--warn); }
.account-remove-list { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.account-empty { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.mg-intro { margin: 0; padding: 14px 16px; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.signin-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.signin-steps .step { margin: 4px 0 0; color: var(--text-2); }
.signin-link { display: block; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); color: var(--link); font-size: 12.5px; overflow-wrap: anywhere; text-decoration: none; }
.signin-link:hover { border-color: var(--line-3); text-decoration: underline; }
.signin-code { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); }
.signin-code .mono { font-size: 22px; font-weight: 600; letter-spacing: 3px; color: var(--text); }

@media (max-width: 640px) {
  .agent-cards.choices.cards { grid-template-columns: 1fr; }
  .access-cards.choices.cards { grid-template-columns: 1fr; }
  .member-actions { padding-left: 0; }
}
@media (pointer: coarse) {
  .agent-chip { height: 44px; padding: 0 12px 0 8px; }
  .agent-tab .agent-chip { padding-right: 44px; }
  .agent-tab .chip-close { right: 0; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-chip, .handoff-card > summary .icon-chevronRight { transition: none; }
}

/* Counts as compact pills: Terminals open, and anything else that is a number on a control. */
.count-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: auto; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #0a0a0a; font: 700 10.5px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.count-badge[hidden] { display: none; }
/* Machine connection as an icon; the word is the accessible name and tooltip. */
.host-status { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: auto; border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--muted); flex: none; }
.host-status.online { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); background: color-mix(in srgb, var(--ok) 6%, var(--bg)); }

.nav-agents { display: inline-flex; gap: 3px; margin-left: 2px; }
.mini-badge { display: inline-grid; place-items: center; min-width: 17px; height: 14px; padding: 0 2px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font: 600 8.5px/1 var(--sans); color: var(--text-2); }
.mini-badge.claude { color: var(--claude); }
.mini-badge.codex { color: var(--codex); }

/* Development groups: a quiet subheading between rows of one card. */
.mg-subhead { padding: 12px 16px 6px; border-top: 1px solid var(--line); color: var(--text-3); font: 600 11px/1.4 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; }
.mg-card > .mg-subhead:first-child { border-top: 0; }
.mg-card > .mg-subhead + .mg-row { border-top: 0; }

/* tuwi Browser viewer: status, address bar, the live frame, then keys. */
.browser-view { display: flex; flex-direction: column; gap: 10px; }
.browser-status { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); }
.browser-status .grow { flex: 1; min-width: 0; }
.browser-status strong { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.browser-ask { margin: 6px 0 0; color: var(--accent-2); font-size: 12.5px; overflow-wrap: anywhere; }
.browser-bar { display: flex; align-items: center; gap: 6px; }
.browser-bar input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font: 12.5px var(--mono); }
.browser-stage { position: relative; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-2); overflow: hidden; aspect-ratio: 16 / 10; display: grid; place-items: center; }
.browser-stage img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.browser-stage.interactive { border-color: var(--accent); }
.browser-stage.interactive img { cursor: crosshair; }
.browser-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.browser-keys input { flex: 1 1 220px; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font: 12.5px var(--mono); }
.browser-keys input:disabled, .browser-bar input:disabled { opacity: 0.5; }
@media (max-width: 640px) {
  .browser-status { flex-wrap: wrap; }
  .browser-keys button.ghost { min-height: 36px; }
}
#dialog-content > .kv { margin: 0 0 16px; }
#dialog-content > .mg-card + .hint { margin-top: 10px; }

/* Inline folder picker (Add project, Copy to machine). */
.folder-picker { margin: 4px 0 14px; }
.folder-picker .toolbar { margin-bottom: 8px; }
.folder-picker .new-folder-input { flex: 1; min-width: 140px; height: 32px; }
.folder-picker .list.scroll { max-height: 34dvh; }
.folder-picker.loading { opacity: 0.6; pointer-events: none; }
.folder-selected { margin: 8px 0 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.folder-selected .muted { color: var(--text-3); }
#dialog-content > .folder-selected { margin: 0 0 14px; }

/* Conversation: one quiet divider marks history imported from the agent's own session. */
.divider { display: flex; align-items: center; gap: 12px; margin: 6px auto 22px; font-size: 11px; letter-spacing: 0.02em; color: var(--text-4); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.divider span { flex: none; }
.msg-time { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.msg.user { border-left-color: var(--accent); }
.msg.user::before { color: var(--accent); }
details.tool > summary { min-height: 28px; }
.tool-name { font-weight: 600; letter-spacing: 0.01em; }
.tool-summary { font-size: 12px; }

/* Sidebar width and collapse (desktop). Phones keep the fixed drawer, so the anchor for the
   resize handle must not apply there. */
@media (min-width: 821px) { #sidebar { position: relative; } }
#side-resize { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; z-index: 5; cursor: col-resize; touch-action: none; }
#side-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background 0.12s; }
#side-resize:hover::after, #side-resize:focus-visible::after, body.side-resizing #side-resize::after { background: var(--accent); }
#side-resize:focus-visible { outline: none; }
body.side-resizing { cursor: col-resize; user-select: none; }
body.side-resizing #app { transition: none; }
body.side-collapsed #app { grid-template-columns: 0 minmax(0, 1fr); }
body.side-collapsed #sidebar { visibility: hidden; overflow: hidden; padding: 0; border: 0; }
body.side-collapsed #menu { display: inline-flex; margin-left: -6px; }
@media (max-width: 820px) {
  #collapse-nav, #side-resize { display: none; }
  body.side-collapsed #app { grid-template-columns: minmax(0, 1fr); }
  body.side-collapsed #sidebar { visibility: visible; overflow: visible; padding: 12px 10px 10px; border-right: 1px solid var(--line-2); }
}

.md > .md-h:first-child { margin-top: 0; }
/* The time appears on hover at the top right and takes no space. */
.msg { position: relative; }
.msg-time { position: absolute; top: 0; right: 0; display: inline-block; margin: 0; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--bg-1); color: var(--text-3); pointer-events: none; }
.msg.user .msg-time { top: 8px; right: 10px; }
.msg.assistant .msg-time { top: -2px; }

/* Notices, callouts, toasts and errors share one calm style: a neutral surface, a thin
   coloured rule and icon for the tone, a bold first line and quieter detail. */
.banner { width: calc(100% - 2 * var(--gutter)); max-width: var(--col); margin: 12px auto 0; padding: 10px 14px; min-height: 0; align-items: flex-start; border: 1px solid var(--line-2); border-left: 2px solid var(--line-3); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text-2); }
.banner.warn, .banner.err, .banner.info, .banner.muted { background: var(--bg-1); color: var(--text-2); border-color: var(--line-2); }
.banner.warn { border-left-color: var(--warn); }
.banner.err { border-left-color: var(--err); }
.banner.info { border-left-color: var(--info); }
.banner.warn .icon { color: var(--warn); }
.banner.err .icon { color: var(--err); }
.banner.info .icon { color: var(--info); }
.banner > span:first-child, .banner > .icon { margin-top: 2px; }
.banner p { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; line-height: 1.55; }
.banner p strong { color: var(--text); font-weight: 600; }
.banner p span { color: var(--text-3); }
#conn-banner { border-left-color: var(--warn); }
#conn-banner .icon { color: var(--warn); }
.banner-actions { align-self: center; }
.sync.partial .dot { background: var(--warn); }
.callout, .callout.warn, .callout.danger, .callout.success { border: 1px solid var(--line-2); border-left: 2px solid var(--info); border-radius: var(--r-sm); background: var(--bg-1); color: var(--text-2); }
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--err); }
.callout.success { border-left-color: var(--ok); }
.callout p { color: var(--text-2); }
.toast { box-shadow: none; border-left: 2px solid var(--info); background: var(--bg-1); }
.toast.error { border-color: var(--line-2); border-left-color: var(--err); }
.toast.success { border-left-color: var(--ok); }
.msg-error { padding: 8px 12px; border: 1px solid var(--line-2); border-left: 2px solid var(--err); background: var(--bg-1); color: var(--text-2); }
.msg-error::before { content: 'Error'; display: block; margin-bottom: 2px; font-weight: 600; color: var(--err); font-size: 11.5px; }
.form-error { padding: 0; }
/* Move-to-tuwi progress: stacked status with even spacing; actions sit in the dialog footer. */
.move-progress { display: flex; flex-direction: column; gap: 12px; }
.move-progress > .callout { margin: 0; }
.move-progress > .muted-text { margin: 0; }
/* Forms: a short note under a section heading, the host key the machine presents, and the
   final authorization as a bordered row of its own. */
.section-note { margin: -4px 0 12px; font-size: 11.5px; line-height: 1.55; color: var(--text-3); }
.dialog-section > .section-note:last-child { margin: 10px 0 0; }
.dialog-section > .choices.segmented { margin-bottom: 14px; }
.dialog-section > .field:last-child, .dialog-section > div:last-child > .field:last-child { margin-bottom: 0; }
.probe-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); }
.probe-result[hidden] { display: none; }
.probe-label { flex-basis: 100%; font-size: 11.5px; color: var(--text-3); }
.probe-value { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; color: var(--text); }
.check.confirm { margin: 0 0 4px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); }
.check.confirm:has(input:checked) { border-color: var(--line-3); color: var(--text); }
/* Sections inside a dialog read as groups: a quiet rule between them and a heading that is
   clearly above the field labels it contains. */
.dialog-section + .dialog-section { padding-top: 20px; border-top: 1px solid var(--line); }
.dialog-section > h3 { font-size: 12.5px; color: var(--text); letter-spacing: 0.01em; }
.dialog-section > h3 + .section-note { margin-top: -6px; }
/* Open a project: the path lines up with the content edge, and the Folders heading sits on
   its filter row instead of carrying a full section gap. */
.breadcrumbs { margin-left: -6px; }
.dialog-section.folder-head { margin-bottom: 0; }
/* Grouped content that follows a control inside a section keeps a small gap (replaces spacer divs). */
.dialog-section > button + .code, .dialog-section > .code-inline + button { margin-top: 12px; }
.choices.roots { margin-bottom: 8px; }
.ext-empty.boxed { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.ext-empty > button { margin-top: 8px; }
#dialog-actions > [hidden] { display: none; }
/* Group header actions stay together on the right, however many there are. */
.mg-group-head > h3 { margin-right: auto !important; }
.mg-group-head { justify-content: flex-start; flex-wrap: wrap; gap: 4px; }
#dialog-actions:not(:has(> :not([hidden]))) { display: none; }
/* Image viewer: the image on a dark stage, then position, Previous/Next and its size. */
.image-viewer .image-view { max-height: min(70dvh, 900px); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.image-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.image-count { min-width: 56px; text-align: center; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.image-meta { font-size: 11.5px; color: var(--text-3); }
.image-bar > .image-meta:not(:only-child) { margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line-2); }
/* Composer attachments: an image's thumbnail and name open the preview. */
.attach-open { cursor: zoom-in; }
.attach-thumb.attach-open:hover, .attach-thumb.attach-open:focus-visible { outline: 1.5px solid var(--text-3); outline-offset: 1px; }
.attach-name.attach-open:hover { text-decoration: underline; text-underline-offset: 2px; }
.attach-name.attach-open:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }

/* ---------- Sign in ----------
   A split screen: what tuwi is on the canvas, the form on a raised panel behind one hairline.
   Type and spacing scale with the viewport (clamp), so the page fills a large monitor and
   folds to a single column on tablets and phones. Square, monochrome, no glow. */
#login { height: 100dvh; overflow-y: auto; background: var(--bg); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) clamp(400px, 36vw, 600px); min-height: 100%; }
.login-intro { display: grid; grid-template-columns: minmax(0, 640px); align-content: center; justify-content: center; min-width: 0; padding: 48px clamp(40px, 6vw, 120px); }
.login-mark { display: flex; align-items: center; gap: 0.22em; font: 700 clamp(52px, 5.2vw, 104px)/1 var(--mono); letter-spacing: -0.02em; color: var(--text); }
.login-glyph { color: var(--accent); font-size: 0.8em; }
.login-lede { margin: clamp(20px, 2.2vw, 36px) 0 0; max-width: 26ch; text-wrap: balance; font: 500 clamp(18px, 1.55vw, 28px)/1.4 var(--sans); color: var(--text-2); }
.login-lines { display: flex; flex-direction: column; gap: 12px; max-width: 56ch; margin: clamp(26px, 2.8vw, 48px) 0 0; padding: clamp(22px, 2.2vw, 36px) 0 0; border-top: 1px solid var(--line-2); list-style: none; font: clamp(12.5px, 0.92vw, 15.5px)/1.5 var(--mono); color: var(--text-3); }
.login-lines li { display: flex; gap: 12px; }
.login-lines li::before { content: '✻'; color: var(--accent); flex: none; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px clamp(28px, 4vw, 80px); border-left: 1px solid var(--line-2); background: var(--bg-1); }
.login-card { width: 100%; max-width: clamp(340px, 24vw, 420px); }
.login-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.login-sub { margin: 8px 0 28px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.login-card .field { margin-bottom: 18px; }
.login-card .field input { height: 42px; padding: 0 12px; font-size: 14px; background: var(--bg); }
.login-password { position: relative; }
.login-password > input { padding-right: 68px; }
/* Show or hide the password: a text toggle inside the field, backed by the checkbox. */
.login-reveal { position: absolute; top: 1px; right: 1px; bottom: 1px; display: inline-flex; align-items: center; justify-content: center; min-width: 56px; padding: 0 10px; border-left: 1px solid var(--line-2); border-radius: 0 var(--r-xs) var(--r-xs) 0; font-size: 11.5px; color: var(--text-3); cursor: pointer; user-select: none; transition: color 0.12s, background-color 0.12s; }
.login-reveal:hover { color: var(--text); background: var(--bg-2); }
.login-card .login-reveal input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.login-reveal-text::after { content: 'Show'; }
.login-reveal:has(input:checked) .login-reveal-text::after { content: 'Hide'; }
.login-reveal:has(input:focus-visible) { outline: 1.5px solid var(--accent); outline-offset: -2px; }
.login-card .primary { width: 100%; height: 42px; margin-top: 6px; font-size: 13.5px; }
#login-error { margin: 14px 0 0; padding: 9px 12px; border: 1px solid var(--line-2); border-left: 2px solid var(--err); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 26px; max-width: 460px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
  .login-intro { padding: 0; }
  .login-mark { font-size: 40px; }
  .login-lede { margin-top: 12px; max-width: none; font-size: 16px; }
  .login-lines { display: none; }
  .login-panel { padding: 24px 20px 22px; border: 1px solid var(--line-2); border-top: 2px solid var(--accent); border-radius: var(--r); }
  .login-card { max-width: none; }
  .login-card h1 { font-size: 19px; }
  .login-sub { margin-bottom: 22px; }
}
/* Tablets in portrait have the height for the three lines as well. */
@media (min-width: 560px) and (max-width: 860px) and (min-height: 760px) {
  .login-shell { max-width: 500px; gap: 34px; }
  .login-mark { font-size: 52px; }
  .login-lede { font-size: 18px; }
  .login-lines { display: flex; margin-top: 22px; padding-top: 20px; font-size: 12.5px; }
}
@media (max-width: 380px) {
  .login-shell { gap: 22px; padding-left: 14px; padding-right: 14px; }
  .login-mark { font-size: 34px; }
  .login-lede { font-size: 15px; }
  .login-panel { padding: 20px 16px 18px; }
}
@media (pointer: coarse) {
  .login-card .field input { height: 46px; font-size: 16px; }
  .login-card .primary { height: 46px; font-size: 14.5px; }
  .login-reveal { min-width: 62px; font-size: 12.5px; }
}

/* ---------- Polish (2026-11-11) ---------- */
/* A long menu scrolls inside the viewport instead of running off a phone screen. */
.menu { max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* Touch screens have no hover: the time is a quiet line under the message, never on top of it. */
@media (pointer: coarse) {
  .msg-time, .msg.user .msg-time, .msg.assistant .msg-time { position: static; display: block; margin: 4px 0 0; padding: 0; border: 0; background: none; color: var(--text-4); opacity: 1; }
}

/* Permission controls remain visible outside the desktop action group. */
.permission-chip { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 6px 9px; border: 1px solid var(--line); background: transparent; }
.permission-chip.warn { color: var(--warn); border-color: var(--warn); }
.permission-chip.danger { color: var(--err); border-color: var(--err); }
.bypass-dot { width: 6px; height: 6px; background: var(--warn); border-radius: 50%; }
.bypass-status { color: var(--warn); }
.bypass-dot.full { background: var(--err); }
.bypass-status.full { color: var(--err); }
/* Access chip: one menu button whose icon shape and colour name the level, so the icon-only
   form at narrow widths still tells Ask, Bypass and Full access apart. */
.permission-chip .chip-caret { margin-left: -2px; color: var(--text-3); }
.permission-chip.warn .chip-caret { color: var(--warn); }
.permission-chip.danger .chip-caret { color: var(--err); }
.permission-chip:disabled .chip-caret { display: none; }
.permission-chip:hover:not(:disabled) { border-color: var(--line-3); }
.permission-chip.warn:hover:not(:disabled) { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.permission-chip.danger:hover:not(:disabled) { border-color: var(--err); background: color-mix(in srgb, var(--err) 8%, transparent); }
.permission-chip[aria-expanded="true"] { background: var(--bg-2); }
/* Choice menus mark the current option with a trailing check. */
.menu-item[role="menuitemradio"] { align-items: flex-start; }
.menu-item[role="menuitemradio"] > .icon:first-child { margin-top: 1px; }
.menu-check { margin-left: auto; margin-top: 2px; visibility: hidden; color: var(--text) !important; }
.menu-item[aria-checked="true"] .menu-check { visibility: visible; }
.menu-item[aria-checked="true"] { background: var(--bg-2); }
.menu-item.danger .menu-text small { color: var(--text-3); }
/* Overview, New threads: the switch row and one compact row per machine, on the same
   surface as the machine cards above. */
.home-section > .mg-card { background: var(--bg-1); }
.home-default-row { padding-top: 11px; padding-bottom: 11px; }
.home-default-row .mg-text strong { font-size: 12.5px; font-weight: 500; }
.home-default-row .mg-actions { align-items: center; }
.tag.muted { color: var(--text-3); }

.secret-chip { display: flex; width: max-content; min-height: 36px; gap: 6px; max-width: 100%; flex-wrap: wrap; }
.secret-chip .ghost { font: inherit; }
.secret-warning { color: var(--warn); width: 100%; }
.secret-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
/* Secret form: the scope switch sits apart from the first field, Keep is a labelled field and
   the storage note keeps a gap above the masking callout. */
#dialog-content > .choices.segmented { margin-bottom: 16px; }
.field > .choices.segmented { align-self: flex-start; }
.secret-note { margin: 0 0 12px; }

.permission-chip.warn .icon, .permission-chip.warn:hover:not(:disabled) .icon { color: var(--warn); }
.permission-chip.danger .icon, .permission-chip.danger:hover:not(:disabled) .icon { color: var(--err); }

#secret-previews { flex-wrap: wrap; overflow: visible; margin-left: 0; }
.secret-chip > button:first-child { min-width: 0; flex: 1; justify-content: flex-start; height: 32px; padding: 0 6px; }
.secret-chip > button:first-child span { overflow: hidden; text-overflow: ellipsis; }
.secret-chip > small { overflow-wrap: anywhere; }

/* ---------- Main column (container queries, 2026-11-12) ----------
   Last in the file so these overrides win over the base rules they adjust. */
/* Header tiers by main-column width. Every control hidden here is offered in More
   (app.js reads the computed style, so the menu always matches what CSS collapsed). */
@container main (max-width: 1239px) {
  #usage span, #compact span, #handoff span, #add-agent span { display: none; }
  #usage, #compact, #handoff, #add-agent { width: 30px; padding: 0; }
  .model-button { max-width: 170px; }
}
@container main (max-width: 899px) {
  .permission-chip span { display: none; }
  .permission-chip { padding: 7px; }
  .composer-hint { display: none; }
}
@container main (max-width: 719px) {
  #main > * { --gutter: 14px; }
  .model-button { max-width: 150px; }
  #usage, #compact, #handoff, #add-agent { display: none; }
  #session-title { font-size: 13.5px; }
  #session-detail { font-size: 10.5px; margin-top: 2px; }
  .title-row { gap: 8px; }
  .banner { padding: 8px 14px; flex-wrap: wrap; width: calc(100% - 2 * var(--gutter)); }
  .banner p { flex-basis: calc(100% - 30px); }
  .banner-actions { margin-left: 24px; }
  .banner-actions button span { display: inline; }
  #home { padding: 24px var(--gutter) 32px; }
  .home-head h2 { font-size: 19px; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
  .home-stat { padding: 13px 14px 14px; }
  .home-stat:nth-child(3) { border-left: 0; }
  .home-stat:nth-child(n + 3) { border-top: 1px solid var(--line-2); }
  .home-stat b { font-size: 19px; }
  .home-section { margin-top: 28px; }
  .onboard-step { border-left: 0; border-top: 1px solid var(--line-2); }
  .onboard-step:first-child { border-top: 0; }
  #transcript { padding: 18px var(--gutter) 12px; scrollbar-gutter: auto; }
  .msg { margin-bottom: 16px; }
  .msg.user { padding: 8px 12px 8px calc(12px + 2ch); }
  .msg.user::before { left: 11px; top: 8px; }
  .tool-name { max-width: 46%; }
  .tool-meta { display: none; }
  .tool-body { margin-left: 0.6ch; padding-left: calc(1ch + 8px); }
  #dock { padding: 4px 8px max(8px, env(safe-area-inset-bottom)); scrollbar-gutter: auto; }
  #requests { --requests-max: min(56dvh, 520px); margin-bottom: 8px; }
  .command-menu { left: 8px; right: 8px; width: auto; transform: none; }
  .attach-chip { width: 220px; }
  .thread-bar { padding: 6px 12px; }
  .agent-chip .chip-detail { display: none; }
}
@container main (max-width: 559px) {
  #models { display: none; }
  #session-status { padding: 0 6px; }
  #session-status > span:last-child { display: none; }
  #topbar { gap: 6px; }
  .thread-tools .ghost > span { display: none; }
  .handoff-card .handoff-sub { display: none; }
}

/* Design pass (2026-11-12): touch sizes the collapsed header tier would otherwise shrink, an
   empty model list without its frame, and an odd last agent card spanning the row. */
@media (pointer: coarse) {
  @container main (max-width: 1239px) {
    #usage, #compact, #handoff, #add-agent { width: 44px; }
  }
}
.model-list:not(:has(.choice:not([hidden]))) { display: none; }
.agent-cards.choices.cards > .choice:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* 2026-11-12 popup spacing audit. Stacked blocks in a dialog never touch: each fix below
   gives a block that had no margin the gap its neighbours use. */
#dialog-content > .mg-card + .mg-card { margin-top: 12px; }
.mg-card > .mg-row + .mg-intro { padding-top: 0; margin-top: -6px; }
.folder-picker .toolbar, .folder-filter { align-items: center; }
.folder-picker .new-folder-input, .folder-filter input[type='search'] { height: var(--control-sm); }
#dialog-content > .tool-pre { margin: 0 0 12px; }
#dialog-content > .muted-text + .muted-text { margin-top: 8px; }
.ext-summary + .ext-carry, .ext-bulk-list + .ext-carry { margin-top: 20px; }
.ext-bulk-list:not(:last-child) { margin-bottom: 16px; }
.ext-carry li { align-items: flex-start; }
.ext-carry li .icon { flex: none; margin-top: 2px; }
.ext-lead.ext-move { width: 52px; display: flex; justify-content: center; }
.dialog-section > .kv + .forward-preview { margin-top: 12px; }
.palette-status + .search-results { margin-top: 8px; }
/* Agent and approval popups. */
fieldset.question > .hint { display: block; margin: -6px 0 8px; }
fieldset.question + fieldset.question { padding-top: 20px; border-top: 1px solid var(--line); }
#dialog-content > :is(p, .callout) + details.advanced { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
#dialog-content > :is(p, .callout) + details.advanced > summary { display: flex; width: 100%; min-height: 30px; font-size: 12.5px; font-weight: 600; color: var(--text); }
p.muted-text + p.muted-text { margin-top: 6px; }
/* Metric tiles draw their own dividers, so an unfilled last row is plain background. */
.metrics { gap: 0; background: var(--bg); }
.metric { box-shadow: 1px 0 0 var(--line-2), 0 1px 0 var(--line-2); }
.dialog-section + .agent-fields > .dialog-section:first-child { padding-top: 20px; border-top: 1px solid var(--line); }
.browser-bar > button, .browser-keys > button { height: 32px; }
.browser-keys input { flex: 0 1 200px; }
.request-actions > button.ghost:first-child { margin-left: -12px; }


/* Settings uses one connected page at a time. Navigation and content scroll separately. */
dialog.settings { width: min(1040px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 48px)); max-height: none; margin: auto; border-radius: 0; border-bottom: 1px solid var(--line-2); box-shadow: none; }
dialog.settings #dialog-form { max-height: 100%; min-width: 0; }
dialog.settings .dialog-body { display: flex; padding: 0; overflow: hidden; }
dialog.settings #dialog-content { display: grid; grid-template-columns: 220px minmax(0, 1fr); flex: 1; min-width: 0; min-height: 0; }
dialog.settings #dialog-error:empty { display: none; }
.settings-nav { min-height: 0; overflow-y: auto; padding: 16px 10px; border-right: 1px solid var(--line); overscroll-behavior: contain; }
.settings-nav h3 { margin: 12px 8px 8px; font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
.settings-nav h3:first-child { margin-top: 0; }
.settings-nav select { width: 100%; min-width: 0; margin: 16px 0 8px; }
.settings-nav-item { display: flex; width: 100%; min-height: 40px; height: auto; justify-content: flex-start; text-align: left; white-space: normal; padding: 10px 8px; border: 1px solid transparent; border-radius: 0; background: none; font-weight: 400; }
.settings-nav-item[aria-current='page'] { background: var(--bg-2); border-color: var(--line-2); }
.settings-nav-item:hover:not(:disabled) { background: var(--bg-2); }
.settings-pane { min-width: 0; min-height: 0; overflow-y: auto; overflow-wrap: anywhere; padding: 20px 22px; overscroll-behavior: contain; }
.settings-pane .mg-row, .settings-pane .mg-text, .settings-pane .mg-group-head { min-width: 0; }
/* A page owns its vertical rhythm; cards keep a consistent inset for notes and rows. */
.settings-pane { display: flex; flex-direction: column; gap: 24px; }
.settings-pane > * { flex-shrink: 0; }
.settings-pane > :is(.mg-group, .mg-activity, .home-section) { margin: 0; }
.settings-pane .mg-group-head { margin-bottom: 10px; min-height: 28px; gap: 8px; }
.settings-pane .mg-group-head h3 { color: var(--text-2); font-size: 13px; line-height: 20px; }
.settings-pane .mg-card > :is(p, .mg-intro, .account-empty) { margin: 0; padding: 16px; line-height: 1.6; }
.settings-pane .mg-card > .mg-row + .mg-intro { margin-top: 0; padding-top: 16px; }
.settings-pane .mg-text > .muted-text { padding: 0; }
.settings-pane .mg-row { padding: 16px; gap: 12px 20px; }
.settings-pane .mg-row > .mg-actions:has(> button:nth-child(3)) { flex: 1 1 100%; justify-content: flex-start; }
.settings-pane .mg-row > .mg-actions:has(> button:nth-child(3)) > button { flex: 0 1 auto; }
.settings-pane .mg-subhead { padding: 16px 16px 8px; }
.settings-pane .mg-intro + .mg-subhead { padding-top: 16px; }
.settings-snapshot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-3); font-size: 12px; }
.settings-pane .home-section { margin-top: 0; }
dialog.settings .tooltip { pointer-events: none; }
@media (max-width: 640px) {
  dialog.settings #dialog-content { grid-template-columns: minmax(0, 1fr); }
  dialog.settings .settings-nav { border-right: 0; }
  dialog.settings:not(.settings-detail) .settings-pane { display: none; }
  dialog.settings.settings-detail .settings-nav { display: none; }
  .settings-pane { padding: 16px 14px; }
  .settings-pane .mg-overview .kv { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
  .settings-pane .mg-row > .mg-actions:has(> button:nth-child(2)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .settings-pane .mg-row > .mg-actions:has(> button:nth-child(2)) > button { width: 100%; min-width: 0; height: auto; min-height: 44px; padding: 8px; white-space: normal; }
  .settings-pane .mg-row > .mg-actions:has(> button:nth-child(2)) > button:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

dialog.settings :is(.mg-card, .list, button, select, input, textarea, .callout) { border-radius: 0; box-shadow: none; }
dialog.settings .dialog-head::before { display: none; }
.settings-pane .mg-row, .settings-pane .mg-update-head { flex-wrap: wrap; }
.settings-pane .mg-text { flex: 1 1 220px; }
.settings-pane .mg-row:has(.switch) .mg-text, .settings-pane .home-default-row .mg-text { flex-basis: 0; }
.settings-pane .mg-actions { max-width: 100%; }
.settings-pane .mg-status { flex: 1 1 220px; }
.settings-pane .mg-update-actions { max-width: 100%; flex-wrap: wrap; }
dialog.settings .switch { align-items: center; }
@media (pointer: coarse) {
  .settings-nav-item, .settings-nav select, dialog.settings button, dialog.settings .switch { min-height: 44px; }
  dialog.settings button, dialog.settings .mg-actions > button.ghost, dialog.settings .icon-button, dialog.settings .switch { min-width: 44px; }
}
dialog.settings .mg-actions > button { flex: 1 1 auto; }
dialog.settings .mg-update-actions > button { flex: 1 1 auto; }

@media (max-width: 380px) {
  .settings-pane .mg-overview .kv { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .settings-pane .mg-overview .kv dd:not(:last-child) { margin-bottom: 12px; }
}

/* Settings, General, Servers (2026-11-13). */
.server-command { display: flex; align-items: center; gap: 4px; margin-top: 4px; min-width: 0; }
.server-command code { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.server-mode, .server-other, .server-candidates, .server-results, .server-fingerprints { display: grid; gap: 12px; }
.server-mode[hidden], .server-other[hidden] { display: none; }
.server-mode > button { justify-self: start; }

/* Settings overviews and item pages: Agents and Development (2026-11-13). */
.sp-view { display: grid; gap: 18px; min-width: 0; }
.sp-view > .mg-group, .sp-view > .callout { margin: 0; }
.sp-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sp-intro { margin: 0; max-width: 64ch; font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.sp-note { margin: 0; font-size: 11.5px; color: var(--text-4); }
.sp-loading { margin: 0; padding: 12px 0; }
/* Overview list: one row per item inside one panel, every row built the same way. */
.sp-grid { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.sp-tile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "badge body tags chevron"; align-items: center; column-gap: 14px; width: 100%; height: auto; min-height: 64px; padding: 12px 14px 12px 16px; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; font-weight: 400; letter-spacing: 0; white-space: normal; cursor: pointer; transition: background-color 0.12s; }
.sp-tile + .sp-tile { border-top: 1px solid var(--line); }
.sp-tile:hover { background: var(--bg-1); }
.sp-tile:focus-visible { outline: 1.5px solid var(--text-2); outline-offset: -3px; }
.sp-tile > .sp-badge { grid-area: badge; }
.sp-tile-body { grid-area: body; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sp-tile-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sp-tile-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.sp-tile-meta { flex: none; font: 500 11px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.sp-tile-status { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; line-height: 1.4; color: var(--text-2); }
.sp-tile-status > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tile-tags { grid-area: tags; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sp-tile > .icon { grid-area: chevron; color: var(--text-4); transition: transform 0.12s, color 0.12s; }
.sp-tile:hover > .icon { color: var(--text-2); transform: translateX(2px); }
/* A page with its own refresh control keeps only the check time from the cached-result note. */
.settings-snapshot:has(~ .sp-section-head > button) > button,
.settings-snapshot:has(~ * .sp-section-head > button) > button { display: none; }
.sp-badge { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); font: 700 11.5px/1 var(--mono); color: var(--text-2); flex: none; }
.sp-badge.large { width: 44px; height: 44px; font-size: 13.5px; }
.sp-badge.agent.claude { color: var(--claude); border-color: color-mix(in srgb, var(--claude) 32%, var(--line-2)); }
.sp-badge.agent.codex { color: var(--codex); border-color: color-mix(in srgb, var(--codex) 32%, var(--line-2)); }
.sp-badge.agent.dsh { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 32%, var(--line-2)); }
.sp-badge.dev.github { color: var(--text); }
.sp-badge.dev.cloudflare { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, var(--line-2)); }
.sp-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warn) 26%, var(--line-2)); border-radius: var(--r); background: color-mix(in srgb, var(--warn) 4%, var(--bg)); }
.sp-banner > .icon { flex: none; color: var(--warn); }
.sp-banner-text { flex: 1; min-width: 0; }
.sp-banner-text strong { display: block; font-size: 13px; color: var(--text); }
.sp-banner-text p { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }
.sp-banner > button { flex: none; }
.sp-head { display: grid; gap: 12px; }
.sp-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-3); }
.sp-back { padding-left: 4px; color: var(--text-2); }
.sp-crumb-sep { color: var(--text-4); }
.sp-crumb-here { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.sp-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); }
.sp-hero-text { flex: 1; min-width: 0; }
.sp-hero-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.sp-hero-title > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-hero-status { display: flex; align-items: center; gap: 8px; margin: 5px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.sp-hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.sp-hero-actions:empty { display: none; }
.sp-facts { display: grid; grid-template-columns: minmax(112px, max-content) minmax(0, 1fr); gap: 9px 20px; margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.5; }
.sp-facts dt { color: var(--text-3); }
.sp-facts dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.sp-facts dd.mono { font: 12px/1.5 var(--mono); }
.mg-card > .sp-facts:not(:first-child) { border-top: 1px solid var(--line); }
.mg-card > .mg-intro:not(:first-child) { border-top: 1px solid var(--line); }
.mg-actions > .sp-more, .sp-more { min-width: 0; width: var(--control-sm); padding: 0; justify-content: center; }
@media (max-width: 640px) {
  /* On a phone the tags sit under the name instead of beside it. */
  .sp-tile { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "badge body chevron" ". tags ."; row-gap: 8px; padding: 12px 12px 12px 14px; }
  .sp-tile-tags { justify-content: flex-start; }
  /* The header arrow and subtitle already show the path on a phone. */
  .sp-crumb { display: none; }
  .sp-section-head { flex-direction: column; gap: 10px; }
  .sp-hero { flex-wrap: wrap; }
  .sp-hero-actions { width: 100%; justify-content: stretch; }
  .sp-hero-actions > button { flex: 1 1 0; }
  .sp-banner { flex-wrap: wrap; }
  .sp-banner > button { width: 100%; }
  .sp-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sp-facts dd + dt { margin-top: 10px; }
  /* A row with an overflow menu stays one line: its actions share the width, the menu stays square. */
  .settings-pane .sp-view .mg-row > .mg-actions:has(> .sp-more) { display: flex; flex: 1 1 100%; flex-wrap: nowrap; gap: 8px; }
  .settings-pane .sp-view .mg-row > .mg-actions:has(> .sp-more) > button { flex: 1 1 auto; width: auto; min-width: 0; white-space: nowrap; }
  .settings-pane .sp-view .mg-row > .mg-actions:has(> .sp-more) > .sp-more { flex: 0 0 44px; }
  .settings-pane .sp-view .mg-row > .mg-actions:has(> .sp-more):has(> button:only-child) { flex: 0 0 auto; }
}
@media (pointer: coarse) {
  .sp-more { width: 44px; height: 44px; }
}

/* ---------- Phone composer (2026-11-13) ----------
   One card in four bands, top to bottom: a status strip while an agent is busy, the prompt,
   and a toolbar with the tools on the left and Stop and Send on the right. The state and the
   Queue/Steer choice share the strip, so nothing wraps and nothing appears twice. An idle
   agent shows only the prompt and the toolbar. Every control is 44px; the page keeps the
   quota to one line. Last in the file so it wins over the earlier responsive rules.
   It applies to the phone and tablet-portrait widths, where one row cannot hold it all. */
@container main (max-width: 899px) {
  #composer {
    --pad: 14px;
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto auto;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
  }
  #composer > * { grid-column: 1 / -1; }
  #outbox-bar { grid-row: 2; margin: 10px 10px 0; }
  #secret-previews { grid-row: 3; margin: 10px var(--pad) 0; }
  #image-previews { grid-row: 4; margin: 10px var(--pad) 0; }
  .prompt-line { grid-row: 5; padding: 12px var(--pad) 2px; }
  .composer-row { display: contents; }

  /* Status strip. */
  .composer-strip {
    grid-row: 1; grid-column: 1 / -1;
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px;
    padding: 0 8px 0 var(--pad);
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
  }
  #composer[data-strip='none'] .composer-strip { display: none; }
  .composer-strip .exec-state { flex: 1 1 auto; margin: 0; padding: 0; font-size: 12.5px; }
  .composer-strip .exec-state span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .mode-hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--text-3); }
  #composer[data-strip='hint'] .mode-hint { display: flex; align-items: center; gap: 10px; }
  #composer[data-strip='hint'] .exec-state, #composer[data-strip='state'] .mode-hint { display: none; }
  .composer-strip .composer-hint { display: none; }
  .composer-strip .composer-mode { flex: none; margin-left: auto; padding: 3px; border-radius: 11px; }
  .composer-row .composer-mode button { height: 36px; min-height: 36px; padding: 0 12px; gap: 6px; border-radius: 8px; font-size: 12.5px; }
  /* The visible switch is 36px; its touch area reaches 44px. */
  .composer-mode button::after { content: ''; position: absolute; inset: -4px -2px; }

  /* Toolbar. */
  #composer .composer-row > button { grid-row: 6; height: 44px; min-height: 44px; margin-bottom: 6px; border-radius: 12px; }
  #attach-image, #give-secret, #work-mode { width: 44px; padding: 0; }
  #attach-image span, #give-secret span, #work-mode span { display: none; }
  #attach-image { grid-column: 1; margin-left: 6px; }
  #give-secret { grid-column: 2; }
  #work-mode { grid-column: 3; }
  #composer .composer-row > button .icon { width: 20px; height: 20px; }
  #composer .composer-row > .ghost .icon { color: var(--text-3); }
  #composer .composer-row > .ghost:hover:not(:disabled) .icon, #work-mode.on .icon { color: var(--text); }
  #work-mode.on .icon { color: var(--accent); }
  /* Orchestrator mode cannot change mid-run, so the button leaves while a strip is showing. */
  #composer:not([data-strip='none']) #work-mode { display: none; }
  #interrupt { grid-column: 5; width: 44px; padding: 0; margin-right: 8px; border-color: color-mix(in srgb, var(--err) 38%, var(--line-2)); background: color-mix(in srgb, var(--err) 6%, var(--bg-1)); }
  #interrupt span { display: none; }
  #interrupt .icon { color: var(--err); }
  #send { grid-column: 6; min-width: 96px; justify-content: center; margin-right: 6px; padding: 0 16px 0 14px; gap: 8px; font-size: 13.5px; }
  #composer:not(:has(#interrupt:not([hidden]))) #send { grid-column: 5 / 7; justify-self: end; }

  /* Access, plan, quotas, resets and context wrap as one left-aligned sentence. */
  .account-usage { margin-top: 8px; font-size: 11.5px; line-height: 1.5; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; display: block; }
  .account-usage .au-id { display: none; }
  .account-usage > .au-id:first-child + .au-seg > .au-sep { display: none; }

  /* A reply ends in one quiet line: an icon to copy it and the time. */
  .msg-actions { margin: -4px 0 -6px -10px; }
  .msg-actions button[aria-label^='Copy'] span { display: none; }
  .msg-actions .msg-time { margin-left: 2px; font-size: 11px; color: var(--text-4); opacity: 1; }

  /* The access chip keeps its colour in the icon, not in a loud outline. */
  .permission-chip { min-width: 44px; min-height: 44px; justify-content: center; border-color: var(--line-2); border-radius: 12px; }
  .permission-chip.warn, .permission-chip.danger { border-color: var(--line-2); }
  .permission-chip.warn:hover:not(:disabled), .permission-chip.danger:hover:not(:disabled) { border-color: var(--line-3); }
}
@container main (max-width: 559px) {
  /* Only the dot of the status chip shows, so it needs no frame. */
  #session-status { padding: 0 4px; border-color: transparent; background: none; }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 820px) {
    #message { font-size: 16px; }
    .prompt-glyph { font-size: 16px; }
  }
}

/* Copy sign-ins: the same rhythm as the other dialogs. Sections sit 18px apart, a label sits
   7px above its control, and the helper line hangs 6px under the field it explains. */
.copy-signins > .lead { margin-bottom: 20px; }
.copy-signins > .field { margin-bottom: 18px; }
.copy-signins > .field:last-child { margin-bottom: 0; }
.copy-signins > .field > .hint { margin-top: -1px; }
.copy-signins .mg-picker-section { margin: 0 0 18px; }
.copy-signins .mg-picker-section h4 { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.copy-signins .mg-pick { padding: 13px 14px; align-items: center; }
.copy-signins .mg-pick input { margin-top: 0; }
.copy-signins .mg-pick:has(input:disabled) { cursor: default; opacity: 0.55; }
.copy-signins .mg-pick:has(input:disabled):hover { background: none; }
.copy-signins .mg-pick-text { gap: 4px; }
.copy-signins .mg-pick-text small { line-height: 1.5; }
.copy-signins .copy-note { margin: 10px 2px 0; font-size: 11.5px; line-height: 1.55; color: var(--text-3); }
.copy-signins > .lead + .mg-card { margin-top: 0; }

/* ---------- Status pill and Status page (2026-11-13) ----------
   The sidebar footer says how your machines and tuwi are doing in one line and opens the
   Status page. Levels use the app's status colours: operational is blue (the daltonized
   "success"), degraded amber, partial orange, major red. No glows; the dot is the signal. */
.lv-operational { --lv: var(--ok); }
.lv-degraded { --lv: var(--warn); }
.lv-partial { --lv: var(--run); }
.lv-major { --lv: var(--err); }
.side-foot .status-pill { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: auto; min-height: 32px; margin-left: -8px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); font-size: 12px; font-weight: 500; text-align: left; }
.side-foot .status-pill:hover:not(:disabled) { background: var(--bg-3); color: var(--text); border: 0; }
.status-pill .dot { width: 8px; height: 8px; flex: none; background: var(--muted); }
.status-pill #sync-text { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status-pill.tone-operational .dot { background: var(--ok); }
.status-pill.tone-degraded .dot { background: var(--warn); }
.status-pill.tone-degraded #sync-text { color: var(--warn); }
.status-pill.tone-partial .dot { background: var(--run); }
.status-pill.tone-partial #sync-text { color: var(--run); }
.status-pill.tone-major .dot { background: var(--err); }
.status-pill.tone-major #sync-text { color: var(--err); }
.status-pill.tone-down .dot, .status-pill.tone-connecting .dot { background: var(--run); animation: pulse 1.6s ease-in-out infinite; }
.status-pill.tone-down #sync-text { color: var(--run); }
.status-pill.tone-partial .dot { animation: pulse 1.6s ease-in-out infinite; }

.st-page { max-width: 960px; margin: 0 auto; }
.st-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.st-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.st-sub { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.st-head-side { display: flex; align-items: center; gap: 14px; }
.st-updated { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-banner { display: flex; align-items: center; gap: 18px; margin-top: 24px; padding: 22px 24px; border: 1px solid color-mix(in srgb, var(--lv) 34%, var(--line-2)); border-left: 3px solid var(--lv); border-radius: var(--r); background: color-mix(in srgb, var(--lv) 6%, var(--bg-1)); }
.st-mark { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 1px solid color-mix(in srgb, var(--lv) 45%, var(--line-2)); border-radius: 50%; color: var(--lv); background: color-mix(in srgb, var(--lv) 10%, var(--bg)); }
.st-banner-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.st-banner h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.st-banner p { font-size: 12.5px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.st-group { margin-top: 34px; }
.st-group > h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.st-group > h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.st-list { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; border-top: 1px solid var(--line); }
.st-row:first-child { border-top: 0; }
.st-row-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-row-text strong { font-size: 13px; font-weight: 600; color: var(--text); }
.st-row-text span { font-size: 12px; line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }
.st-state { display: inline-flex; align-items: center; flex: none; gap: 9px; font-size: 12.5px; font-weight: 500; color: var(--lv); white-space: nowrap; }
.st-state .dot { width: 8px; height: 8px; background: var(--lv); }
.st-machines { display: grid; gap: 12px; }
.st-machine { padding: 20px 22px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); }
.st-machine.lv-major { border-color: color-mix(in srgb, var(--err) 30%, var(--line-2)); }
.st-machine-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.st-machine-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-machine-name strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.st-machine-name span { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.st-reason { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--lv); }
.st-reason .icon { flex: none; margin-top: 2px; }
.st-losts { display: grid; gap: 8px; margin-top: 12px; }
.st-lost { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); }
.st-lost-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-lost-text strong { font-size: 12.5px; font-weight: 600; color: var(--text); }
.st-lost-text span { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.st-lost-actions { display: flex; gap: 8px; flex: none; }
.st-lost-name { margin-bottom: 8px; font-weight: 600; }
.st-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px 24px; margin-top: 20px; }
.st-meter { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.st-meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-3); }
.st-meter-top b { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.st-meter small { font-size: 11px; line-height: 1.4; color: var(--text-3); }
.st-bar { height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.st-bar > span { display: block; height: 100%; border-radius: 2px; background: var(--ok); }
.st-bar.blank { background: none; }
.st-bar.warn > span { background: var(--warn); }
.st-bar.err > span { background: var(--err); }
.st-machine-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }
.st-checked.stale { color: var(--warn); }
.st-note { margin-top: 16px; font-size: 12px; color: var(--text-3); }
.st-foot { margin-top: 30px; max-width: 640px; font-size: 11.5px; line-height: 1.65; color: var(--text-4); }
@container main (max-width: 719px) {
  .st-banner { gap: 14px; padding: 18px 16px; }
  .st-mark { width: 38px; height: 38px; }
  .st-banner h3 { font-size: 16px; }
  .st-row { padding: 14px 16px; align-items: flex-start; }
  .st-machine { padding: 18px 16px; }
  .st-meters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .st-head-side { width: 100%; justify-content: space-between; }
}
@container main (max-width: 379px) {
  .st-meters { grid-template-columns: minmax(0, 1fr); }
}

/* The thread name in the header is its own rename control. */
#session-title[data-rename='1'] { cursor: text; border-radius: var(--r-xs); }
#session-title[data-rename='1']:hover { text-decoration: underline dotted var(--text-4); text-underline-offset: 4px; }

/* Queue reordering (2026-11-13): up and down at the card's edge, Run next among its actions. */
.msg.queued .msg-meta { align-items: center; }
.queue-move { display: inline-flex; gap: 2px; margin-left: auto; }
.queue-move button { width: 30px; height: 28px; padding: 0; border-radius: var(--r-sm); }
@media (pointer: coarse) {
  /* A 44px touch target without making the card taller: the buttons overlap the card's padding. */
  .queue-move { margin: -9px -6px -9px auto; }
  .queue-move button { width: 44px; height: 44px; }
}

/* A plus on each folder in the thread list starts another thread there. It appears on hover or
   focus with a mouse and is always visible on touch, where there is no hover. */
.group-head { position: relative; }
.group-head .group-add { margin-left: auto; flex: none; width: 24px; height: 24px; padding: 0; border-radius: var(--r-sm); opacity: 0; color: var(--text-3); transition: opacity 0.12s; }
.group-head:hover .group-add, .group-head:focus-within .group-add, .group-head .group-add:focus-visible { opacity: 1; }
.group-head .group-add:hover:not(:disabled) { color: var(--text); background: var(--bg-3); }
.group-head .group-add:disabled { opacity: 0; }
.group-head:hover .group-add:disabled { opacity: 0.35; }
@media (hover: none), (pointer: coarse) {
  /* 44px to tap, without making the folder row taller: the button overlaps the row's padding. */
  .group-head .group-add { opacity: 1; width: 44px; height: 44px; margin: -10px -6px -10px auto; color: var(--text-2); }
  .group-head .group-add:disabled { opacity: 0.35; }
}

/* Selected Claude account copies keep the group choice distinct from its accounts. */
.copy-account-list { display: grid; gap: 8px; min-width: 0; flex: none; }
.copy-account-list > .mg-pick:not(:first-child) { margin-inline-start: 16px; }
.copy-account-list > button { justify-self: start; margin-inline-start: 16px; }

/* Model pools (2026-11-15). Header chip, Settings list and editor, launch hold. */
.pool-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 22px; min-width: 0; max-width: 340px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--bg-1); color: var(--text-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: pointer; flex: 0 1 auto; }
.pool-chip[hidden] { display: none; }
.pool-chip .icon { flex: none; }
.pool-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pool-chip:hover:not(:disabled) { border-color: var(--line-3); color: var(--text); }
.pool-chip.tone-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 26%, var(--line)); background: color-mix(in srgb, var(--info) 6%, var(--bg)); }
.pool-chip.tone-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: color-mix(in srgb, var(--warn) 6%, var(--bg)); }
.pool-chip.tone-run { color: var(--run); border-color: color-mix(in srgb, var(--run) 30%, var(--line)); background: color-mix(in srgb, var(--run) 7%, var(--bg)); }
@container main (max-width: 719px) {
  .pool-chip { height: 20px; padding: 0 6px; font-size: 10.5px; max-width: 46%; }
}
@media (pointer: coarse) {
  /* 44px to tap without a taller header: the hit area extends past the chip. */
  .pool-chip::after { content: ''; position: absolute; inset: -12px -4px; }
}

.pools-intro { margin: 0 0 4px; font-size: 12px; line-height: 1.55; color: var(--text-3); }
.pool-row { align-items: flex-start; }
.pool-members { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.pool-member { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-height: 28px; font-size: 12px; color: var(--text-2); }
.pool-rank { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border: 1px solid var(--line-2); border-radius: var(--r-xs); font: 600 10.5px/1 var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.pool-member-name { min-width: 0; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.pool-member-meta { font-size: 11px; color: var(--text-3); }
.tag.pool-state.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.tag.pool-state.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }
.pool-member .pool-clear { height: 24px; padding: 0 8px; }

.pool-form > .mg-card { display: grid; gap: 10px; padding: 14px 16px 16px; }
.pool-form .field, .pool-edit-fields .field { margin: 0; }
.pool-form-members > .mg-card { padding: 0; }
.pool-members-intro { margin: 0; padding: 12px 16px; font-size: 12px; line-height: 1.55; color: var(--text-3); }
.pool-edit-members { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.pool-edit-member { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.pool-add-row { padding: 12px 16px; border-top: 1px solid var(--line); }
.pool-edit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pool-edit-head .grow { flex: 1; }
.pool-edit-role { font-size: 12.5px; color: var(--text); }
.pool-edit-head .pool-move { width: 32px; height: 30px; padding: 0; border-radius: var(--r-xs); }
.pool-edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.pool-edit-fields > .agent-fields { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.pool-edit-fields > .agent-fields > .hint { grid-column: 1 / -1; }
.pool-edit-fields [hidden] { display: none; }
.pool-sub { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--text-2); }
.pool-sub:first-child { margin-top: 0; }
.pool-error:empty { display: none; }
.pool-edit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pool-edit-actions > .danger { margin-right: auto; }
@media (max-width: 640px) {
  .pool-edit-fields, .pool-edit-fields > .agent-fields { grid-template-columns: minmax(0, 1fr); }
  .pool-edit-actions > button { flex: 1 1 auto; }
}
@media (pointer: coarse) {
  .pool-edit-head { margin: -6px -8px 8px 0; }
  .pool-edit-head .pool-move { width: 44px; height: 44px; }
  .pool-member .pool-clear { height: 36px; }
}
.dialog-section.held-by-pool .choices { opacity: 0.45; }

/* Collaborative Agents (2026-11-15, T4/T5): team strip, panel, launcher, agent-to-agent rows. */
.team-strip { display: grid; gap: 6px; padding: 7px var(--gutter) 8px; border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; }
.team-strip[hidden] { display: none; }
.team-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-title { display: inline-flex; align-items: center; justify-content: flex-start; gap: 7px; min-width: 0; flex: 1 1 auto; height: 28px; padding: 0 6px; margin-left: -6px; border: 0; background: none; color: var(--text-2); font-size: 12px; text-align: left; }
.team-title .icon { flex: none; color: var(--accent); }
.team-label { font-weight: 600; color: var(--text); flex: none; }
.team-goal { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.team-facts { display: inline-flex; align-items: center; gap: 8px; flex: none; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.team-asks.tone-warn { color: var(--warn); }
.team-head .thread-tools { flex: none; }
.team-paused { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 6%, var(--bg)); font-size: 12px; color: var(--text-2); }
.team-paused .icon { align-self: center; color: var(--warn); flex: none; }
.team-paused strong { color: var(--warn); font-weight: 600; }
.team-members { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.team-members::-webkit-scrollbar { display: none; }
.team-member { display: grid; justify-content: stretch; justify-items: stretch; align-content: start; gap: 2px; flex: 1 0 168px; max-width: 280px; min-width: 0; height: auto; padding: 7px 10px 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); font: inherit; font-size: 11.5px; text-align: left; cursor: pointer; scroll-snap-align: start; }
.team-member:hover:not(:disabled) { border-color: var(--line-3); background: var(--bg-1); }
.team-member.selected { border-color: var(--text-3); background: var(--bg-2); }
.team-member:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.tm-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tm-top .agent-badge { width: 22px; height: 17px; }
.tm-name { font-weight: 600; font-size: 12.5px; color: var(--text); white-space: nowrap; }
.tm-lead { height: 16px; padding: 0 5px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--r-xs); color: var(--accent); font-size: 10px; line-height: 14px; font-weight: 600; }
.tm-top .dot { margin-left: auto; width: 6px; height: 6px; box-shadow: none; }
.tm-line { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-task { color: var(--text); }
.tm-task.none { color: var(--text-4); }
.tm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 8px; color: var(--text-3); }
.tm-claims { flex: none; }
.tm-pool { display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: 100%; min-width: 0; overflow: hidden; color: var(--info); }
.tm-pool > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tm-pool.tone-warn { color: var(--warn); }
.tm-pool.tone-run { color: var(--run); }
@container main (max-width: 719px) {
  .team-strip { padding-top: 5px; padding-bottom: 6px; gap: 5px; }
  .team-facts .team-tasks { display: none; }
  /* The title opens the panel; one fewer list icon beside Thread. */
  .team-open { display: none; }
  .team-member { flex-basis: 150px; padding: 5px 8px 6px; gap: 1px; }
  .team-paused { padding: 5px 8px; font-size: 11.5px; line-height: 1.45; }
}
@media (pointer: coarse) {
  .team-member { min-height: 44px; }
  .team-title { height: 36px; }
}

/* Agent-to-agent messages in the transcript: the sender, not the owner, speaks. */
.msg.user.team-message { border-left-color: color-mix(in srgb, var(--accent) 55%, var(--line-3)); background: color-mix(in srgb, var(--accent) 3%, var(--bg-2)); }
.msg.user.team-message::before { content: '⇄'; color: var(--accent); }
.msg.user.team-message:not(.queued) .msg-meta:has(> .who) { display: flex; }
.msg.user.team-message .msg-meta .who { color: var(--accent); }
.msg.user.team-message .msg-text { white-space: pre-wrap; }

/* Team panel. */
.team-summary { display: grid; gap: 8px; margin-bottom: 12px; }
.team-goal-full { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.team-facts-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 12px; color: var(--text-3); }
.team-tabs { display: flex; gap: 2px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.team-tab.on { color: var(--text); background: var(--bg-2); border-color: var(--line-3); }
.team-body { display: grid; gap: 12px; min-width: 0; }
.team-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line-2); border-radius: var(--r); }
.team-list > li { padding: 10px 12px; border-top: 1px solid var(--line); min-width: 0; }
.team-list > li:first-child { border-top: 0; }
.tt-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tt-id { font: 500 11.5px var(--mono); color: var(--text-3); flex: none; }
.tt-title { min-width: 0; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.tt-status { flex: none; align-self: center; }
.tt-status.st-active { color: var(--run); border-color: color-mix(in srgb, var(--run) 30%, var(--line)); }
.tt-status.st-blocked { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.tt-status.st-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.team-task.st-done .tt-title { color: var(--text-3); }
.tt-meta, .tn-meta { margin-top: 3px; font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; }
.tt-reason { margin-top: 3px; font-size: 12px; color: var(--warn); }
.tn-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.team-note.kind-ask .tn-head strong { color: var(--accent); }
.team-note.kind-decision .tn-head strong { color: var(--info); }
.team-note.kind-system .tn-head strong { color: var(--text-3); }
.tn-time { flex: none; font-size: 11px; color: var(--text-4); }
.tn-text { margin-top: 3px; font-size: 12.5px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.team-claims > li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tc-path { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.tc-owner { flex: none; font-size: 11.5px; color: var(--text-3); }
.team-branch { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line-2); border-left-width: 2px; border-radius: var(--r-sm); font-size: 12px; color: var(--text-2); }
.team-branch code { font-size: 12px; color: var(--text); overflow-wrap: anywhere; }
.team-branch.tone-ok { border-left-color: var(--ok); }
.team-branch.tone-ok .tb-state { color: var(--ok); }
.team-branch.tone-warn { border-left-color: var(--warn); }
.team-branch.tone-warn .tb-state { color: var(--warn); }
.team-branch.tone-danger { border-left-color: var(--err); }
.team-branch.tone-danger .tb-state { color: var(--err); }
.tb-state { font-weight: 600; }
.team-branch-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Team launcher. */
.team-entry { margin-top: 10px; }
.team-participants { display: grid; gap: 10px; }
.team-participant { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.tp-number { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 22px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font: 600 11px/1 var(--mono); color: var(--text-3); }
.tp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; min-width: 0; }
.tp-fields > .agent-fields { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.tp-fields > .agent-fields > .hint { grid-column: 1 / -1; }
.tp-fields .field { margin: 0; }
.tp-fields [hidden] { display: none; }
.tp-remove { margin-top: 18px; }
.tp-remove[hidden] { display: none; }
.team-participants + button { justify-self: start; margin-top: 10px; }
@media (max-width: 640px) {
  .team-participant { gap: 8px; padding: 10px; }
  .tp-number { margin-top: 24px; }
  .tp-fields, .tp-fields > .agent-fields { grid-template-columns: minmax(0, 1fr); }
  .tp-remove { margin-top: 0; }
}
@media (pointer: coarse) {
  .tp-remove { width: 44px; height: 44px; }
}

/* Forge page (2026-11-15, F4): a workspace view at ?view=forge built on the .st-* page rules. */
.fg-page { max-width: 1000px; }
.fg-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.fg-title h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.fg-machine { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fg-machine .field, .fg-pick { margin: 0; min-width: 200px; }
.fg-machine-name { font-size: 12.5px; color: var(--text-2); }
.fg-state { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); }
.fg-state-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.fg-state-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.fg-state-text strong { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.fg-state-meta { font-size: 12px; color: var(--text-3); }
.fg-state-detail { font-size: 12px; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.fg-state .callout { margin: 12px 0 0; }
.fg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dot.warn { background: var(--warn); }
.dot.muted { background: var(--muted); }
.fg .tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.fg .tag.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }
.fg-tabs { display: flex; gap: 2px; margin-top: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.fg-tab { position: relative; gap: 6px; border-radius: var(--r-xs) var(--r-xs) 0 0; color: var(--text-3); white-space: nowrap; }
.fg-tab.on { color: var(--text); }
.fg-tab.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 1px; background: var(--text); }
.fg-tab .count-badge { margin-left: 4px; }
.fg-body { padding-bottom: 40px; }
.fg-group:first-child { margin-top: 24px; }
.fg-live { font-size: 11px; font-weight: 500; color: var(--ok); }
.fg-empty { padding: 16px 18px; font-size: 12.5px; color: var(--text-3); }
.fg-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); min-width: 0; }
.fg-row:first-child { border-top: 0; }
.fg-row-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.fg-row-text strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 500; min-width: 0; }
.fg-row-text strong > span:not(.tag):not(.dot) { overflow-wrap: anywhere; }
.fg-row-meta { font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.fg-row-reason { font-size: 11.5px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.fg-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fg-open { min-width: 0; height: auto; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.fg-open:hover span { text-decoration: underline; text-underline-offset: 3px; }
.fg-pick-one { flex: none; width: 16px; height: 16px; accent-color: var(--text); }
.fg-counts { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.fg-count { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); }
.fg-count b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fg-count span { font-size: 12px; color: var(--text-3); }
.fg-counts > button { align-self: center; }
.fg-release { display: flex; align-items: center; gap: 12px; margin: 22px 0 0; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); font-size: 12.5px; color: var(--text-2); }
.fg-release.tone-err { border-color: color-mix(in srgb, var(--err) 40%, var(--line-2)); }
.fg-tools { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.fg-tools .field { margin: 0; flex: 1 1 200px; }
.fg-filter { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); }
.fg-seg { color: var(--text-3); }
.fg-seg.on { background: var(--bg-4); color: var(--text); }
.fg-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.fg-bulk .grow { flex: 1; }
.fg-all { margin: 0; font-size: 12.5px; }
.fg-notice { margin: 12px 0 0; }
.fg-reading { margin-top: 10px; }
.fg-detail { margin-top: 18px; }
.fg-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-top: 14px; }
.fg-hero-text { min-width: 0; flex: 1 1 280px; }
.fg-hero h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.fg-hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.fg-detail .callout { margin: 14px 0 0; }
.fg-prose { font-size: 13px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.fg-pre { margin: 0; max-height: 420px; }
.fg-paths { margin: 0; padding: 0; list-style: none; font: 12px/1.8 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
.fg-checks { display: flex; flex-direction: column; gap: 6px; }
.fg-check-head { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.fg-check-head:first-child { margin-top: 0; }
.fg-checks details { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-1); }
.fg-checks details.failed { border-color: color-mix(in srgb, var(--err) 35%, var(--line-2)); }
.fg-checks summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 12.5px; }
.fg-checks details.failed summary .icon { color: var(--err); }
.fg-check-meta { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.fg-checks details > pre, .fg-checks details > p { margin: 0 12px 10px; }
.fg-turn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); }
.fg-turn:first-child { border-top: 0; }
.fg-turn-purpose { min-width: 72px; font-size: 12.5px; color: var(--text); }
.fg-find-count { margin: 14px 0 8px; }
.fg-more { margin-top: 12px; }
.fg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fg-table th { padding: 8px 10px; border-bottom: 1px solid var(--line-2); font-weight: 500; color: var(--text-3); text-align: right; }
.fg-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; color: var(--text-2); }
.fg-table th:first-child, .fg-table td:first-child { text-align: left; }
.fg-table td.absent { color: var(--text-4); }
.fg-settings { margin-top: 20px; }
.forge-settings { display: flex; flex-direction: column; gap: 22px; }
.forge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.forge-grid .field { margin: 0; }
.forge-checks { display: flex; flex-direction: column; gap: 10px; }
.forge-check { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(160px, 2fr) minmax(90px, 1fr) 100px auto; align-items: end; gap: 8px; }
.forge-check .field { margin: 0; }
.forge-save { display: flex; justify-content: flex-end; }
@container main (max-width: 719px) {
  .fg-row { flex-wrap: wrap; padding: 12px 14px; }
  .fg-row-actions { width: 100%; justify-content: flex-start; }
  .fg-machine, .fg-machine .field, .fg-pick { width: 100%; min-width: 0; }
  .fg-actions { width: 100%; }
  .fg-count { flex: 1 1 140px; }
  .forge-check { grid-template-columns: 1fr 1fr; }
  .forge-check .field:nth-child(2) { grid-column: 1 / -1; }
  .fg-table th, .fg-table td { padding: 8px 6px; }
}
@media (pointer: coarse) {
  .fg-tab, .fg-seg, .fg-row .small, .fg-actions button { min-height: 44px; }
  .fg-pick-one { width: 22px; height: 22px; }
}
/* Forge settings put fields straight into a panel card (built for rows): give them its inset. */
.forge-settings .mg-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; overflow: visible; }
.forge-settings .mg-card > p.muted-text { padding: 0; border-top: 0; }
.forge-settings .mg-card > .field, .forge-settings .mg-card > .check { margin: 0; }
.forge-settings .mg-card > .callout { margin: 0; }

/* Limits page (2026-11-16): plan limits for every account. Built on the Status page's
   header, groups and rows. A window's tone is a status colour and always has words beside
   it; the pace mark and the dashed course are arithmetic on the provider's figures. */
.lm .ok { --tone: var(--ok); }
.lm .warn { --tone: var(--warn); }
.lm .err { --tone: var(--err); }
.lm .ended { --tone: var(--text-4); }
.lm-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.lm-tile { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px 17px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.lm-tile.warn, .lm-tile.err { border-color: color-mix(in srgb, var(--tone) 34%, var(--line-2)); }
.lm-tile.warn::before, .lm-tile.err::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone); }
.lm-tile-label { font-size: 11.5px; color: var(--text-3); }
.lm-tile-value { font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; color: var(--text); }
.lm-tile-sub { font-size: 11.5px; line-height: 1.45; color: var(--text-3); overflow-wrap: anywhere; }
.lm-alerts { display: grid; gap: 8px; margin-top: 14px; }
.lm-alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; width: 100%; height: auto; padding: 13px 16px; border: 1px solid color-mix(in srgb, var(--tone) 32%, var(--line-2)); border-radius: var(--r); background: color-mix(in srgb, var(--tone) 6%, var(--bg-1)); color: var(--text); text-align: left; cursor: pointer; }
.lm-alert:hover:not(:disabled) { border-color: color-mix(in srgb, var(--tone) 55%, var(--line-2)); background: color-mix(in srgb, var(--tone) 9%, var(--bg-1)); }
.lm-alert, .lm-row { white-space: normal; }
.lm-alert > .icon, .lm-alert:hover:not(:disabled) > .icon { margin-top: 2px; color: var(--tone); }
.lm-alert-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lm-alert-text strong { font-size: 13px; color: var(--text); }
.lm-alert-text span { font-size: 12px; line-height: 1.5; color: var(--text-2); white-space: normal; }
.lm-alert-agent { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.lm-group { margin-top: 34px; }
.lm-segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-bottom: 12px; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-1); }
.lm-segmented button { height: 28px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--text-3); font-size: 12px; }
.lm-segmented button:hover:not(:disabled) { background: var(--bg-2); color: var(--text); }
.lm-segmented button.on, .lm-segmented button.on:hover:not(:disabled) { background: var(--bg-4); color: var(--text); }
.lm-rows { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); overflow: hidden; transition: opacity 160ms var(--ease); }
.lm-row { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 128px; align-items: center; gap: 22px; width: 100%; height: auto; padding: 15px 20px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--text); text-align: left; cursor: pointer; }
.lm-row:first-child { border-top: 0; }
.lm-row:hover:not(:disabled) { border-color: var(--line); background: var(--bg-2); }
.lm-row-who, .lm-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.lm-row-names, .lm-names { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm-row-names strong, .lm-names strong { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-row-names span { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-row-value { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lm-row-value b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.lm-row-value span { font-size: 11px; color: var(--text-3); white-space: nowrap; }
/* Meter: the fill is what is left, on a lighter track of the same hue; the white mark is an even pace. */
.lm-meter { position: relative; display: block; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--tone) 15%, var(--bg-3)); }
.lm-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--tone); }
.lm-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); box-shadow: 0 0 0 2px var(--bg-1); }
.lm-row:hover .lm-pace { box-shadow: 0 0 0 2px var(--bg-2); }
.lm-meter.ended .lm-fill { opacity: 0.55; }
.lm-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }
.lm-key-item { display: inline-flex; align-items: center; gap: 8px; }
.lm-key-mark { position: relative; display: inline-block; width: 16px; height: 8px; border-radius: 3px; }
.lm-key-mark.fill { background: var(--ok); }
.lm-key-mark.pace { width: 2px; height: 14px; border-radius: 1px; background: var(--text); }
.lm-key-line { display: inline-block; width: 20px; border-top: 2px solid var(--text-2); }
.lm-key-line.ahead { border-top-style: dashed; }
.lm-key-line.even { border-top: 1px solid var(--text-4); }
.lm-course-key { margin: 0 0 14px; }
.lm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 14px; transition: opacity 160ms var(--ease); }
.lm.busy .lm-cards, .lm.busy .lm-rows { opacity: 0.72; }
.lm-card { min-width: 0; padding: 20px 22px 22px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); scroll-margin-top: 16px; transition: border-color 600ms var(--ease); }
.lm-card.flash { border-color: var(--text-3); }
.lm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.lm-names strong { font-size: 14.5px; letter-spacing: -0.01em; }
.lm-email { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-stamp { display: inline-flex; align-items: center; flex: none; gap: 7px; margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lm-stamp.live { color: var(--text-2); }
.lm-stamp.stale { color: var(--warn); }
.lm-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--run); box-shadow: 0 0 0 3px color-mix(in srgb, var(--run) 18%, transparent); }
.lm-meta { margin-top: 12px; font-size: 12px; line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }
.lm-best { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.lm-best .icon { color: var(--ok); }
.lm-windows { display: grid; margin-top: 6px; }
.lm-window { padding-top: 18px; margin-top: 16px; border-top: 1px solid var(--line); }
.lm-window-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.lm-window-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.lm-window-name strong { font-size: 13px; color: var(--text); }
.lm-figure { display: inline-flex; align-items: baseline; gap: 5px; flex: none; }
.lm-figure b { font-size: 21px; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.lm-figure span { font-size: 11.5px; color: var(--text-3); }
.lm-window.ended .lm-figure b { color: var(--text-3); }
.lm-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--tone) 40%, var(--line-2)); border-radius: 999px; font-size: 11px; color: var(--tone); white-space: nowrap; }
.lm-chip.quiet { border-color: var(--line-2); color: var(--text-3); }
/* Course of one window: start to reset across, what is left up the side. */
.lm-course { margin-top: 16px; border-radius: var(--r-xs); outline-offset: 6px; }
.lm-course:focus-visible { outline: 2px solid var(--accent); }
.lm-plot { position: relative; height: 64px; }
.lm-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lm-plot line, .lm-plot polygon { vector-effect: non-scaling-stroke; }
.lm-grid { stroke: var(--line); stroke-width: 1; }
.lm-even { stroke: var(--text-4); stroke-width: 1; }
.lm-area { fill: var(--tone); fill-opacity: 0.1; stroke: none; }
.lm-so-far { stroke: var(--tone); stroke-width: 2; stroke-linecap: round; }
.lm-ahead { stroke: var(--tone); stroke-width: 2; stroke-dasharray: 4 4; stroke-linecap: round; opacity: 0.7; }
.lm-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 2px var(--bg-1); transform: translate(-50%, -50%); pointer-events: none; }
.lm-out-mark { position: absolute; bottom: -4px; width: 2px; height: 9px; margin-left: -1px; border-radius: 1px; background: var(--err); }
.lm-axis { position: relative; display: flex; justify-content: space-between; margin-top: 8px; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lm-now { position: absolute; top: 0; transform: translateX(-50%); color: var(--text-2); }
.lm-window-foot { margin-top: 12px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lm-pace-text { margin-top: 6px; font-size: 12px; line-height: 1.55; color: var(--text-2); }
.lm-empty { margin-top: 18px; font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.lm-blank { display: flex; align-items: flex-start; gap: 16px; margin-top: 24px; padding: 22px 24px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); color: var(--text-3); }
.lm-blank h3 { font-size: 15px; color: var(--text); }
.lm-blank p { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--text-3); max-width: 560px; }
.lm-note { padding: 14px 18px; font-size: 12px; color: var(--text-3); }
@container main (max-width: 819px) {
  .lm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container main (max-width: 599px) {
  .lm-tiles { gap: 10px; }
  .lm-tile { padding: 14px 14px 15px; }
  .lm-tile-value { font-size: 22px; }
  .lm-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 14px; padding: 14px 16px; }
  .lm-row > .lm-meter { grid-column: 1 / -1; grid-row: 2; }
  .lm-card { padding: 18px 16px 20px; }
  .lm-alert { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .lm-alert-agent { display: none; }
}
@media (pointer: coarse) {
  .lm-segmented button { height: 36px; padding: 0 16px; }
}
@media (forced-colors: active) {
  .lm-fill, .lm-key-mark.fill { background: CanvasText; }
  .lm-meter { border: 1px solid CanvasText; }
  .lm-pace, .lm-dot { background: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .lm-card, .lm-rows, .lm-cards { transition: none; }
}
