/* TUI control: lights-out design system.
   Identity carried over from the original TUI dashboard: a pure black canvas,
   the terminal face (Source Code Pro), 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') 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') format('woff2');
  font-weight: 200 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;
  --pi: #d4d4d4;
  --claude: #ff9933;
  /* Type. */
  --mono: 'Source Code Pro', ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', 'DejaVu Sans Mono', 'Noto Sans Mono', Menlo, Consolas, monospace;
  --font: var(--mono);
  --fs-body: 13.5px;
  --lh-body: 1.7;
  /* Shape and rhythm. */
  --r-xs: 3px;
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 10px;
  --col: 780px;
  --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; }
.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; }

/* ---------- 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; }
.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; }
input[type='checkbox'], input[type='radio'] { width: 15px; height: 15px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--text); box-shadow: 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; }
.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); }

/* 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(--mono); letter-spacing: 0; flex: none; background: var(--bg); }
.agent-badge.pi { color: var(--pi); }
.agent-badge.claude { color: var(--claude); border-color: color-mix(in srgb, var(--claude) 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: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
#login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: auto; background: var(--bg); }
.login-card { width: min(380px, 100%); padding: 32px 28px 28px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-1); box-shadow: 0 24px 80px rgb(0 0 0 / 0.6); }
.login-card .brand-mark { font-size: 20px; }
.login-card h1 { margin: 30px 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.login-card > p { color: var(--text-3); font-size: 12.5px; line-height: 1.6; margin-bottom: 24px; }
.login-card .primary { width: 100%; margin-top: 6px; height: 38px; }
.login-card input { height: 38px; }
#login-error, .login-card > p.form-error { margin: 14px 0 0; color: var(--err); }

/* ---------- 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 14px 6px; min-height: 40px; }
#close-nav { display: none; }
#new-session { margin: 0 0 4px; justify-content: flex-start; padding: 0 10px; height: 34px; background: var(--bg-1); border-color: var(--line-2); color: var(--text); font-weight: 500; }
#new-session:hover:not(:disabled) { border-color: var(--line-3); background: var(--bg-3); }
#new-session .icon { color: var(--accent); }
.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: 18px 4px 4px 8px; min-height: 26px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.side-heading .icon-button { color: var(--text-3); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -10px; padding: 10px 10px 0 18px; border-top: 1px solid var(--line); }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.sync .dot { width: 6px; height: 6px; }
.sync.live .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.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; justify-content: flex-start; gap: 10px; padding: 7px 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 > .dot { margin: 0 2px 0 4px; }
.computer.offline > .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; }
.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; }
.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: 7px; padding: 12px 8px 4px 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 { list-style: none; display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 9px 4px; font-size: 11.5px; color: var(--text-3); cursor: pointer; border-radius: var(--r-xs); }
details.ended-group > summary::-webkit-details-marker { display: none; }
details.ended-group > summary:hover { color: var(--text); }
details.ended-group > summary .icon { transition: transform 0.15s var(--ease); }
details.ended-group[open] > summary .icon { transform: rotate(90deg); }

#main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
#topbar { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px 8px 24px; border-bottom: 1px solid var(--line); flex: none; }
#menu { display: none; }
.title-block { flex: 1; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
#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: 6px; flex: none; }
.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; }
#conn-banner { justify-content: center; }

/* ---------- Home ---------- */
#home { flex: 1; min-height: 0; overflow-y: auto; padding: 40px 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: 28px; 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: 36px; }
.home-section > h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.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; }
.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-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; }
.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); }
.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; gap: 2px; margin: 4px 0 0 -6px; opacity: 0; transition: opacity 0.12s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions .icon-button { color: var(--text-3); }
/* Narration directly followed by tool calls is not worth a copy row. */
.msg.assistant:has(+ .tool) .msg-actions, .msg.assistant:has(+ .working) .msg-actions { display: none; }
@media (hover: hover) and (min-width: 1100px) {
  .msg-actions { position: absolute; top: -2px; right: -40px; margin: 0; flex-direction: column; }
}
.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); }
.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; 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: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; 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; }

/* ---------- Dock: requests + composer ---------- */
/* Same scrollbar gutter as the transcript so the composer shares its column. */
#dock { flex: none; margin-top: -4px; padding: 4px var(--gutter) max(16px, env(safe-area-inset-bottom)); position: relative; overflow: hidden; scrollbar-gutter: stable; }
#requests { max-width: var(--col); margin: 0 auto 10px; max-height: min(48dvh, 440px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.request { position: relative; padding: 13px 14px 12px 16px; 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); }
.request.busy { opacity: 0.55; }
.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-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; max-height: 140px; overflow: auto; }
.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; 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; max-height: 200px; overflow: auto; 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-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 12px; }
.request-actions > button:first-child { margin-right: auto; }
.request-actions .option { height: auto; min-height: var(--control); padding: 6px 12px; white-space: normal; text-align: left; }

#composer { 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; }
#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: 38dvh; 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 #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); }
.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 ---------- */
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::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: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.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; }
.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; }
.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; }
.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; }
.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: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; 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: 236px; max-width: 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); }
#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; }
  #usage span, #handoff span { display: none; }
  #usage, #handoff { width: 30px; padding: 0; }
  .model-button { max-width: 170px; }
}
@media (max-width: 820px) {
  :root { --gutter: 14px; --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; }
  #session-title { font-size: 13.5px; }
  #session-detail { font-size: 10.5px; margin-top: 2px; }
  .title-row { gap: 8px; }
  #models, #usage, #handoff { display: none; }
  .banner { padding: 8px 14px; flex-wrap: wrap; }
  .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 { margin-bottom: 8px; max-height: 50dvh; }
  #composer { padding: 8px 6px 6px 11px; border-radius: 12px; }
  .composer-hint { display: none; }
  #steer span, #interrupt span { display: none; }
  #steer, #interrupt { width: 32px; padding: 0; }
  .composer-row button { height: 32px; }
  .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 { 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; }
  .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)); }
}
@media (pointer: coarse) {
  :root { --control: 40px; --control-sm: 34px; }
  input, textarea, select { font-size: 16px; }
  input.mono, textarea.mono { font-size: 14px; }
  #message { font-size: 16px; }
  .prompt-glyph { font-size: 16px; padding-top: 4px; }
  .computer, .session { padding: 10px 10px; }
  .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 { opacity: 0.8; }
  .menu-item { min-height: 44px; }
  .composer-row button { height: 36px; }
  #steer, #interrupt { width: 36px; }
  .top-actions button { height: 36px; }
  .top-actions .icon-button { width: 36px; }
}
@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; }
#overview, #external-sessions { justify-content: flex-start; margin-bottom: 5px; }
.image-previews { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.image-chip { display: flex; align-items: center; gap: 6px; flex: none; max-width: 260px; border: 1px solid var(--line-2); padding: 4px; border-radius: var(--r-sm); }
.image-chip img { width: 40px; height: 40px; object-fit: cover; }
.image-chip span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#attach-image { flex: none; }
