/* NovaSoft Orbit — design system. Royal blue + navy on calm neutrals. Light and dark follow the system. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", ui-monospace, Consolas, "Liberation Mono", monospace;
  /* Restrained monochrome: neutral greys, near-black ink for actions, one muted blue for links and focus only. */
  --bg: #fafafa; --surface: #ffffff; --surface-2: #f4f4f5; --sunken: #efeff1;
  --line: #e7e7ea; --line-strong: #d4d4d9;
  --text: #111113; --text-2: #52525b; --text-3: #8a8a93;
  --ink: #111113; --on-ink: #ffffff;
  --brand: #2f5fd0; --brand-hover: #264fb0; --brand-ink: #111113; --brand-soft: #f4f4f5; --brand-line: #dedee2;
  --navy: #111113;
  --ok: #1f7a54; --ok-soft: #f4f4f5; --warn: #8a5a12; --warn-soft: #f7f5f0; --danger: #b4232f; --danger-soft: #fbf1f1;
  --add: #eaf6ee; --add-ink: #1b6b42; --del: #fbeeee; --del-ink: #a5252f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 14px;
  --sidebar-w: 264px; --panel-w: 460px; --col-w: 720px;
  --logo-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0f; --surface: #141416; --surface-2: #1b1b1e; --sunken: #101012;
    --line: #26262a; --line-strong: #36363b;
    --text: #ededee; --text-2: #a3a3ab; --text-3: #75757e;
    --ink: #ededee; --on-ink: #111113;
    --brand: #8aa8ff; --brand-hover: #a6bcff; --brand-ink: #ededee; --brand-soft: #1b1b1e; --brand-line: #303035;
    --navy: #ededee;
    --ok: #5fc79a; --ok-soft: #1b1b1e; --warn: #e0b060; --warn-soft: #1d1b17; --danger: #ff8a93; --danger-soft: #241617;
    --add: #12261c; --add-ink: #78d9a6; --del: #2a1517; --del-ink: #ff9ca4;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
    --logo-filter: none; --logo-src: url('/logo-light.png');
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0d0d0f; --surface: #141416; --surface-2: #1b1b1e; --sunken: #101012;
    --line: #26262a; --line-strong: #36363b;
    --text: #ededee; --text-2: #a3a3ab; --text-3: #75757e;
    --ink: #ededee; --on-ink: #111113;
    --brand: #8aa8ff; --brand-hover: #a6bcff; --brand-ink: #ededee; --brand-soft: #1b1b1e; --brand-line: #303035;
    --navy: #ededee;
    --ok: #5fc79a; --ok-soft: #1b1b1e; --warn: #e0b060; --warn-soft: #1d1b17; --danger: #ff8a93; --danger-soft: #241617;
    --add: #12261c; --add-ink: #78d9a6; --del: #2a1517; --del-ink: #ff9ca4;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
    --logo-filter: none; --logo-src: url('/logo-light.png');
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); z-index: 100; box-shadow: var(--shadow-md); }
.skip:focus { top: 12px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; } svg.i.lg { width: 22px; height: 22px; }

/* ---------- Buttons & fields ---------- */
.work-lede { max-width: 480px; margin: 16px auto 24px; color: var(--text-2); line-height: 1.6; font-size: 15px; }
.work-intro .kicker { color: var(--text-2); margin-bottom: 16px; }
.work-suggestion { display: flex; align-items: center; gap: 12px; padding: 16px; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); font-size: 13px; }
.work-suggestion .grow { min-width: 0; }
.work-suggestion p { margin: 4px 0 0; color: var(--text-2); line-height: 1.5; }
.work-suggestion .btn { flex-shrink: 0; }
.work-hint { width: min(var(--col-w), 100%); margin-inline: auto; }
.work-hint .work-suggestion { margin-top: 0; }
@media (max-width: 600px) {
  .work-suggestion { flex-wrap: wrap; gap: 8px; padding: 12px; }
  .work-suggestion .grow { flex-basis: calc(100% - 36px); }
  .work-suggestion .primary { margin-left: 24px; }
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 560; font-size: 14px; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; } .btn.icon.sm { width: 30px; }
.field, .select { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
textarea.field { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 560; border: 1px solid var(--line); white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.kbd { font: 600 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--text-2); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100dvh; }
.app.panel-open.has-panel { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--panel-w); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 14px; }
.logo { display: block; width: 150px; height: auto; filter: var(--logo-filter); margin: 2px 4px 2px; }
.new-row { display: flex; gap: 8px; }
.new-row .btn.primary { flex: 1; height: 40px; border-radius: 12px; }
.search-btn { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-3); width: 100%; text-align: left; }
.search-btn:hover { border-color: var(--line-strong); }
.search-btn .kbd { margin-left: auto; }
.side-scroll { flex: 1; overflow: auto; padding: 4px 10px 12px; min-height: 0; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.side-h button { border: 0; background: none; color: var(--text-3); padding: 2px; border-radius: 6px; display: grid; place-items: center; }
.side-h button:hover { background: var(--surface-2); color: var(--text); }
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; background: none; border-radius: 9px; text-align: left; color: var(--text-2); position: relative; }
.row:hover { background: var(--surface-2); color: var(--text); }
.row[aria-current="true"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.row .more { opacity: 0; border: 0; background: none; padding: 3px; border-radius: 6px; color: var(--text-3); display: grid; place-items: center; }
.row:hover .more, .row:focus-within .more, .row .more[aria-expanded="true"] { opacity: 1; }
.row .more:hover { background: var(--line); color: var(--text); }
.row .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.row.sub { color: var(--text-3); font-size: 13px; }
.side-group { padding: 10px 8px 2px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.mode-pill { display: flex; align-items: center; gap: 8px; margin: 6px 6px 2px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; background: var(--warn-soft); color: var(--warn); border: 0; text-align: left; width: calc(100% - 12px); }
.mode-pill.live { background: var(--ok-soft); color: var(--ok); }
.mode-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.topbar { height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.topbar .menu-btn { display: none; }
.title-wrap { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.crumb { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.crumb button { border: 0; background: none; padding: 0; color: var(--text-3); } .crumb button:hover { color: var(--brand); text-decoration: underline; }
.conv-title { font-size: 16px; font-weight: 650; margin: 0; border: 0; background: transparent; padding: 2px 6px; margin-left: -6px; border-radius: 6px; width: 100%; max-width: 520px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.conv-title:hover { background: var(--surface-2); }
.conv-title:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 18px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner svg { margin-top: 2px; }

/* ---------- Thread ---------- */
.thread-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.thread { width: min(var(--col-w), 100% - 40px); margin: 0 auto; padding: 28px 0 24px; display: flex; flex-direction: column; gap: 26px; }
.msg { display: flex; flex-direction: column; gap: 6px; position: relative; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { max-width: 86%; background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.orb { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 210deg, var(--brand), #7aa2ff, var(--navy), var(--brand)); display: inline-block; flex: none; box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 30%, transparent); }
.msg.assistant .body { font-size: 15.5px; line-height: 1.7; overflow-wrap: anywhere; }
.msg-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .12s; margin-left: -6px; flex-wrap: wrap; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg-actions.show { opacity: 1; }
.msg.user .msg-actions { margin: 0 -6px 0 0; justify-content: flex-end; }
.ico-btn { border: 0; background: none; padding: 5px 7px; border-radius: 8px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 560; }
.ico-btn:hover { background: var(--surface-2); color: var(--text); }
.ico-btn.on { color: var(--brand); }
.pinned-flag { color: var(--brand); display: inline-flex; }
.caret::after { content: ""; display: inline-block; width: 8px; height: 1.05em; background: var(--brand); margin-left: 3px; vertical-align: text-bottom; border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 5px; align-items: center; color: var(--text-3); font-size: 14px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.state-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; border: 1px solid var(--line); background: var(--surface); }
.state-card.error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: var(--danger-soft); color: var(--danger); }
.state-card.stopped { background: var(--surface-2); color: var(--text-2); }
.state-card .grow { flex: 1; } .state-card .btn { margin-top: 8px; }
.notice { font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); display: flex; gap: 8px; }
.ctx-pop { font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--shadow-sm); display: grid; gap: 4px; }
.ctx-pop b { color: var(--text); }

/* ---------- Markdown ---------- */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .7em 0; } .md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 1.3em 0 .5em; letter-spacing: -.01em; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.28em; } .md h3 { font-size: 1.1em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.4em; margin: .6em 0; } .md li { margin: .25em 0; } .md li > ul, .md li > ol { margin: .2em 0; }
.md blockquote { margin: .8em 0; padding: .1em 1em; border-left: 3px solid var(--brand-line); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.md code { font: 0.88em var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: .08em .35em; border-radius: 6px; }
.md table { border-collapse: collapse; margin: .9em 0; width: 100%; font-size: .93em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; } .md th { background: var(--surface-2); font-weight: 650; }
.codeblock { margin: 1em 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--sunken); }
.codeblock .cb-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 5px 14px; font: 600 12px var(--mono); color: var(--text-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.codeblock pre { margin: 0; padding: 14px; overflow-x: auto; font: 13.5px/1.6 var(--mono); tab-size: 2; }
.codeblock .cb-actions { display: flex; gap: 2px; }

/* ---------- Empty state ---------- */
.empty { width: min(780px, 100% - 40px); margin: 0 auto; padding: min(10vh, 90px) 0 20px; }
.empty .kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.empty h2 { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.03em; line-height: 1.1; margin: 14px 0 12px; font-weight: 650; }
.empty p.lede { color: var(--text-2); font-size: 17px; max-width: 520px; margin: 0 0 30px; }
.starters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.starter { display: flex; gap: 14px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: border-color .12s, box-shadow .12s, transform .12s; }
.starter:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.starter .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.starter b { display: block; font-size: 15px; } .starter span.d { display: block; color: var(--text-2); font-size: 13.5px; margin-top: 2px; line-height: 1.45; }

/* ---------- Composer ---------- */
.composer-wrap { flex: none; padding: 0 20px 14px; }
.composer { width: min(var(--col-w), 100%); margin: 0 auto; border: 1px solid var(--line-strong); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-md); transition: border-color .12s, box-shadow .12s; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow-md); }
.composer.drag { border-color: var(--brand); background: var(--brand-soft); }
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px 0; }
.attach { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 5px 6px 5px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.attach .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach.uploading { opacity: .7; } .attach.err { border-color: var(--danger); color: var(--danger); }
.composer textarea { display: block; width: 100%; border: 0; background: transparent; resize: none; padding: 16px 18px 6px; min-height: 52px; max-height: 240px; line-height: 1.55; font-size: 15.5px; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--text-3); }
.c-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 10px 10px; }
.modes { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.modes::-webkit-scrollbar { display: none; }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; background: none; border-radius: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 560; white-space: nowrap; }
.mode-chip:hover { color: var(--text); }
.mode-chip[aria-checked="true"] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.c-bar .spacer { flex: 1; }
.speed { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 560; color: var(--text-2); }
.speed:hover { border-color: var(--line-strong); color: var(--text); }
.send { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; transition: background .12s, transform .05s; }
.send:hover { background: var(--brand-hover); } .send:disabled { background: var(--sunken); color: var(--text-3); cursor: not-allowed; }
.send.stop { background: var(--navy); }
.c-foot { width: min(var(--col-w), 100%); margin: 8px auto 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); padding: 0 8px; min-height: 20px; }
.mode-desc { display: flex; gap: 6px; align-items: center; }
#live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Menus, popovers, modals, toasts ---------- */
.menu { position: fixed; z-index: 60; min-width: 220px; max-width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6px; }
.menu button, .menu a { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--text); text-decoration: none; font-size: 14px; }
.menu button:hover, .menu button:focus-visible, .menu a:hover { background: var(--surface-2); outline: none; }
.menu button .d { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; line-height: 1.35; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .ck { margin-left: auto; color: var(--brand); }
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 31, .5); z-index: 70; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px); animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: min(86dvh, 820px); display: flex; flex-direction: column; border: 1px solid var(--line); animation: pop .14s ease-out; }
.modal.wide { width: min(880px, 100%); } .modal.narrow { width: min(440px, 100%); }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; } .modal-h h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-b { padding: 8px 22px 18px; overflow: auto; } .modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, 100% - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .16s ease-out; max-width: 100%; }
.toast.error { background: var(--danger); } .toast button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; padding: 5px 10px; border-radius: 8px; font-weight: 600; }
.toast button:hover { background: rgba(255, 255, 255, .26); }
.palette { width: min(640px, 100%); align-self: start; margin-top: 12vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { width: 100%; height: 56px; padding: 0 22px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 17px; outline: none; }
.palette-list { max-height: 52dvh; overflow: auto; padding: 8px; }
.pal-h { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.pal-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; width: 100%; border: 0; background: none; text-align: left; }
.pal-item[aria-selected="true"] { background: var(--brand-soft); }
.pal-item .s { font-size: 13px; color: var(--text-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.pal-item mark, .snippet mark { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Side panel ---------- */
.panel { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; align-items: center; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 12px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); } .tab[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; background: var(--surface-2); border-radius: 9px; padding: 1px 6px; color: var(--text-2); } .tab .count.alert { background: var(--brand); color: #fff; }
.tabs .spacer { flex: 1; }
.panel-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.pad { padding: 18px; }
.section-t { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 8px; }
.card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; } .hstack { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; min-width: 0; }
.empty-panel { text-align: center; padding: 48px 28px; color: var(--text-2); } .empty-panel .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; } .empty-panel h4 { margin: 0 0 6px; color: var(--text); font-size: 16px; } .empty-panel p { margin: 0 auto 16px; max-width: 320px; font-size: 14px; }

/* Workspace */
.ws-head { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.ws-title { border: 0; background: transparent; font-size: 17px; font-weight: 650; padding: 3px 6px; margin-left: -6px; border-radius: 6px; width: 100%; letter-spacing: -.01em; }
.ws-title:hover { background: var(--surface-2); } .ws-title:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); background: var(--surface); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border: 0; background: none; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); } .seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.doc-view { flex: 1; overflow: auto; padding: 20px 22px 28px; }
.doc-view .section { position: relative; border-radius: 10px; margin: 0 -10px; padding: 0 10px; transition: background .12s; }
.doc-view .section:hover { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.doc-view .section .revise-btn { position: absolute; right: 8px; top: 6px; opacity: 0; }
.doc-view .section:hover .revise-btn, .doc-view .section:focus-within .revise-btn { opacity: 1; }
.doc-view .section.sel { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.editor { flex: 1; width: 100%; border: 0; resize: none; padding: 20px 22px; background: var(--surface); font: 14px/1.7 var(--mono); outline: none; min-height: 240px; tab-size: 2; }
.editor.prose { font: 15px/1.75 var(--font); }
.sel-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--brand-line); background: var(--brand-soft); flex: none; }
.sel-bar .hstack input { background: var(--surface); }
.quick-edits { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-edits button { border: 1px solid var(--brand-line); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; color: var(--brand-ink); font-weight: 560; }
.quick-edits button:hover { background: var(--brand-soft); }
.ws-foot { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); flex: none; }
.dirty { color: var(--warn); font-weight: 600; }
.ver-list { display: flex; flex-direction: column; }
.ver { display: flex; gap: 12px; padding: 10px 12px; border-radius: 10px; align-items: flex-start; border: 1px solid transparent; }
.ver:hover { background: var(--surface-2); } .ver.cur { background: var(--brand-soft); border-color: var(--brand-line); }
.ver .vn { font: 700 12px var(--mono); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; margin-top: 2px; } .ver.cur .vn { background: var(--brand); color: #fff; }

/* Diff */
.diff { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; font: 13px/1.55 var(--mono); background: var(--surface); }
.diff .hunk + .hunk { border-top: 1px dashed var(--line-strong); }
.diff .ln { display: grid; grid-template-columns: 36px 36px 18px 1fr; } .diff .ln > span { padding: 1px 6px; } .diff .ln .no { color: var(--text-3); text-align: right; user-select: none; font-size: 11.5px; }
.diff .ln .tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .ln.add { background: var(--add); color: var(--add-ink); } .diff .ln.del { background: var(--del); color: var(--del-ink); }
.diff .ln .sg { text-align: center; user-select: none; font-weight: 700; }
.diff ins { background: color-mix(in srgb, var(--add-ink) 24%, transparent); text-decoration: none; border-radius: 3px; } .diff del { background: color-mix(in srgb, var(--del-ink) 24%, transparent); border-radius: 3px; }
.change-sum { display: grid; gap: 6px; font-size: 13.5px; margin: 0 0 14px; }
.change-sum .it { display: flex; gap: 8px; align-items: baseline; }
.proposal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.proposal-cols .box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; font-size: 14px; background: var(--surface-2); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.proposal-cols .box.new { background: var(--add); border-color: transparent; } .proposal-cols .box.old { background: var(--del); border-color: transparent; }

/* Research (cited answers) */
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; margin: 0 1px; font: 700 11.5px var(--font); color: var(--brand-ink); background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 6px; vertical-align: 1px; line-height: 1; cursor: pointer; }
.cite:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.cite.unv { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.seg-ans { margin: .55em 0; padding-left: 12px; border-left: 3px solid var(--brand-line); }
.seg-ans.inference { border-left-color: var(--line-strong); border-left-style: dashed; color: var(--text-2); }
.seg-ans.uncertain { border-left-color: var(--warn); } .seg-ans.unsupported { border-left-color: var(--danger); background: var(--danger-soft); padding: 6px 12px; border-radius: 0 10px 10px 0; }
.kind-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; margin-right: 6px; vertical-align: 1px; background: var(--surface-2); color: var(--text-2); }
.kind-tag.evidence { background: var(--ok-soft); color: var(--ok); } .kind-tag.uncertain { background: var(--warn-soft); color: var(--warn); } .kind-tag.unsupported { background: var(--danger); color: #fff; }
.research-meta { margin-top: 14px; display: grid; gap: 10px; }
.rm { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; font-size: 14px; background: var(--surface); }
.rm h5 { margin: 0 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); } .rm ul { margin: 0; padding-left: 18px; }
.rm.conflict { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); } .rm.conflict h5 { color: var(--warn); }
.src-list { display: grid; gap: 8px; }
.src { display: grid; gap: 4px; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.src:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.src .q { font-size: 13.5px; color: var(--text); border-left: 3px solid var(--brand-line); padding-left: 10px; }
.src .loc { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.src .n { font: 700 11.5px var(--font); background: var(--brand); color: #fff; border-radius: 6px; padding: 1px 6px; }
.file-text { font: 13.5px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px 18px; counter-reset: l; }
.file-text .pas { border-radius: 6px; padding: 1px 0; } .file-text .pas.focus { background: color-mix(in srgb, var(--brand) 12%, transparent); outline: 2px solid var(--brand-line); outline-offset: 2px; }
.file-text mark.hit { background: #ffe58a; color: #3a2a00; border-radius: 3px; padding: 1px 0; scroll-margin: 120px; }
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); width: 100%; text-align: left; }
.file-row:hover { border-color: var(--brand-line); } .file-row .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); padding: 18px; text-align: center; color: var(--text-2); font-size: 14px; background: var(--surface-2); }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; } table.grid th, table.grid td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; white-space: nowrap; } table.grid th { background: var(--surface-2); position: sticky; top: 0; }
.table-wrap { overflow: auto; max-height: 280px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.calc { font: 12.5px/1.55 var(--mono); }
.calc .step { padding: 6px 0; border-top: 1px dashed var(--line); } .calc .step:first-child { border-top: 0; } .calc .f { color: var(--brand-ink); } .calc .r { color: var(--text-2); word-break: break-word; }

/* Brief & actions */
.brief-sec { margin-bottom: 20px; }
.item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; }
.item:hover { background: var(--surface-2); } .item .tx { flex: 1; min-width: 0; outline: none; padding: 1px 4px; border-radius: 5px; margin: -1px -4px; overflow-wrap: anywhere; font-size: 14.5px; }
.item .tx:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.item.done .tx { text-decoration: line-through; color: var(--text-3); }
.item .acts { display: flex; opacity: 0; } .item:hover .acts, .item:focus-within .acts { opacity: 1; }
.sugg { border: 1px solid var(--brand-line); background: var(--brand-soft); border-radius: var(--r-md); padding: 12px 14px; }
.sugg + .sugg { margin-top: 8px; } .sugg .why { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.check { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.draft { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.draft + .draft { margin-top: 10px; } .draft.approved { background: var(--ok-soft); border-color: transparent; } .draft.discarded { opacity: .55; }
.draft .fields { display: grid; gap: 8px; margin: 10px 0; }
.preview-box { font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; margin: 8px 0; }

/* Pages (project, workflows, settings) */
.page-scroll { flex: 1; overflow: auto; }
.page { width: min(980px, 100% - 40px); margin: 0 auto; padding: 32px 0 60px; }
.page h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; } .page .lede { color: var(--text-2); margin: 0 0 24px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.resume { border-radius: var(--r-xl); background: linear-gradient(135deg, var(--navy), #1a3a9e 70%, var(--brand)); color: #fff; padding: 26px 28px; margin-bottom: 22px; box-shadow: var(--shadow-md); }
.resume h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; } .resume p { margin: 0; opacity: .85; }
.resume .stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; } .resume .stat b { display: block; font-size: 24px; } .resume .stat span { font-size: 12.5px; opacity: .8; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; align-items: center; }
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.meter { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; } .meter > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; } table.plain th, table.plain td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); } table.plain th { color: var(--text-3); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.cap-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; } .cap-row:last-child { border-bottom: 0; }
.step-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); } .step-card + .step-card { margin-top: 10px; }
.step-card.current { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; } .step-card.current .num { background: var(--brand); color: #fff; } .step-card.approved .num { background: var(--ok); color: #fff; }

/* ---------- Responsive ---------- */
.overlay-scrim { display: none; }
@media (max-width: 1180px) {
  .app.panel-open.has-panel { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(520px, 100vw); z-index: 40; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .2s; visibility: hidden; }
  .app.panel-open .panel { transform: none; visibility: visible; }
  .app.panel-open .overlay-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(8, 14, 31, .35); }
}
@media (max-width: 860px) {
  .app, .app.panel-open.has-panel { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); visibility: hidden; }
  .app.nav-open .sidebar { transform: none; visibility: visible; }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(8, 14, 31, .45); }
  .topbar .menu-btn { display: inline-flex; } .topbar { padding: 0 10px; }
  .starters, .grid2, .grid3, .proposal-cols { grid-template-columns: 1fr; }
  .composer-wrap { padding: 0 10px 10px; } .thread { width: calc(100% - 28px); padding-top: 18px; } .msg.user .bubble { max-width: 94%; }
  .c-foot .mode-desc { display: none; } .page { width: calc(100% - 28px); padding-top: 20px; } .kv { grid-template-columns: 1fr; }
  .modes .mode-chip span { display: none; } .modes .mode-chip[aria-checked="true"] span { display: inline; } .modes .mode-chip { padding: 0 9px; }
  .msg-actions { opacity: 1; } .row .more { opacity: 1; } .doc-view .section .revise-btn, .item .acts { opacity: 1; }
  .panel { width: 100vw; }
}
@media (hover: none) { .msg-actions, .row .more, .item .acts, .doc-view .section .revise-btn { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
.nav-scrim { display: none; }

#view{display:contents}
.row.sub{cursor:default}

/* --- refinements after visual review --- */
.tab { padding: 0 11px; gap: 6px; font-size: 13.5px; }
.tabs { padding: 4px 8px 0; gap: 0; }
.doc-view .section .md > :first-child { margin-top: .55em; }
.doc-view .section .md > :last-child { margin-bottom: .55em; }
.doc-view .section:first-child .md > :first-child { margin-top: 0; }
.doc-view .section h1 { font-size: 1.55em; letter-spacing: -.02em; }
.composer { container-type: inline-size; }
@container (max-width: 640px) {
  .mode-chip span { display: none; }
  .mode-chip[aria-checked="true"] span { display: inline; }
  .mode-chip { padding: 0 9px; }
}
.src .loc { gap: 6px 8px; }
.ws-title { text-overflow: ellipsis; }
.card + .card { margin-top: 0; }
.page .card + .card { margin-top: 0; }
.draft + .draft, .sugg + .sugg { margin-top: 10px; }
.crumb { min-width: 0; white-space: nowrap; }
.crumb button { overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
@media (max-width: 860px) { .top-actions .btn .lbl { display: none; } .top-actions .btn.sm { padding: 0 8px; } .conv-title { font-size: 15px; } }
.file-text .pas.focus { outline: none; background: color-mix(in srgb, var(--brand) 9%, transparent); }

/* ======================= Clean, sleek override layer ======================= */
body { font-size: 14.5px; letter-spacing: -.005em; }
.skip { opacity: 0; box-shadow: none; pointer-events: none; } .skip:focus { opacity: 1; pointer-events: auto; box-shadow: var(--shadow-md); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn { border-radius: 8px; font-weight: 500; height: 34px; border-color: var(--line-strong); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); opacity: .88; }
.btn.sm { height: 28px; border-radius: 7px; }
.btn.danger { color: var(--danger); border-color: var(--line-strong); } .btn.danger:hover { background: var(--danger-soft); }
.field, .select { border-radius: 8px; height: 36px; border-color: var(--line-strong); }
.field:focus, .select:focus { border-color: var(--text-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent); }
.chip { background: transparent; border: 1px solid var(--line); color: var(--text-2); font-weight: 500; height: 22px; font-size: 11.5px; }
.chip.brand, .chip.ok, .chip.warn, .chip.danger { background: transparent; border-color: var(--line); }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.danger { color: var(--danger); }
.kbd { border-radius: 5px; font-weight: 500; }

/* shell */
.sidebar { background: var(--bg); }
.sidebar-top { padding: 16px 14px 8px; gap: 12px; }
.logo { width: 132px; margin: 4px 6px; }
.new-row .btn.primary { height: 36px; border-radius: 8px; }
.search-btn { background: var(--surface); border-radius: 8px; height: 34px; }
.side-h { font-size: 11px; letter-spacing: .04em; text-transform: none; font-weight: 600; color: var(--text-3); padding: 14px 8px 4px; }
.side-group { font-size: 11.5px; font-weight: 500; }
.row { border-radius: 7px; min-height: 32px; color: var(--text-2); }
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--surface-2); color: var(--text); font-weight: 500; }
.row .t { font-size: 13.5px; }
.row .badge { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); font-weight: 600; height: 17px; }
.side-foot { border-top: 1px solid var(--line); }
.mode-pill, .mode-pill.live { background: transparent; color: var(--text-3); padding: 6px 8px; font-size: 12px; border: 0; margin: 2px 4px 2px; width: calc(100% - 8px); }
.mode-pill:hover { color: var(--text); }
.mode-pill .dot { width: 6px; height: 6px; background: var(--text-3); } .mode-pill.live .dot { background: var(--ok); }
.topbar { height: 52px; background: var(--bg); backdrop-filter: none; border-bottom: 1px solid var(--line); }
.conv-title { font-size: 14.5px; font-weight: 600; }
.crumb { font-size: 11.5px; }
.banner, .banner.warn { background: var(--surface-2); color: var(--text-2); border-bottom: 1px solid var(--line); font-size: 12.5px; }

/* conversation */
.thread { gap: 22px; padding-top: 24px; }
.msg.user .bubble { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 9px 14px; }
.msg.assistant .body { font-size: 15px; line-height: 1.7; }
.msg-head { font-size: 12px; font-weight: 500; }
.orb { width: 16px; height: 16px; background: var(--ink); box-shadow: none; position: relative; }
.orb::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg); }
.thinking i { background: var(--text-3); }
.caret::after { background: var(--text); }
.state-card { border-radius: 8px; font-size: 13.5px; }
.state-card.error { background: var(--danger-soft); }
.notice { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.ico-btn { border-radius: 6px; }
.ico-btn.on { color: var(--text); }
.md h1, .md h2, .md h3 { font-weight: 600; letter-spacing: -.015em; }
.md blockquote { border-left-color: var(--line-strong); }
.md a { color: var(--brand); }
.md code { border-radius: 5px; }
.codeblock { border-radius: 8px; }

/* empty state */
.empty { padding-top: min(12vh, 110px); }
.empty .kicker { color: var(--text-3); font-weight: 500; letter-spacing: .08em; font-size: 11px; }
.empty h2 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 600; letter-spacing: -.03em; margin: 10px 0 10px; }
.empty p.lede { font-size: 15px; color: var(--text-2); margin-bottom: 26px; }
.starters { gap: 10px; }
.starter { border-radius: 10px; padding: 14px; gap: 12px; align-items: flex-start; box-shadow: none; }
.starter:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: none; background: var(--surface); }
.starter .ico { background: transparent; color: var(--text-2); width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; }
.starter b { font-size: 14px; font-weight: 600; } .starter span.d { font-size: 13px; }

/* composer */
.composer { border-radius: 14px; border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.composer:focus-within { border-color: var(--text-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent), var(--shadow-md); }
.composer.drag { background: var(--surface-2); border-color: var(--text-2); }
.composer textarea { font-size: 15px; padding: 14px 16px 4px; }
.modes { background: transparent; padding: 0; gap: 2px; }
.mode-chip { height: 28px; border-radius: 7px; font-weight: 500; font-size: 13px; color: var(--text-3); }
.mode-chip:hover { background: var(--surface-2); color: var(--text); }
.mode-chip[aria-checked="true"] { background: var(--surface-2); color: var(--text); box-shadow: none; }
.speed { border-radius: 8px; height: 30px; font-weight: 500; }
.send { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: var(--on-ink); }
.send:hover { background: var(--ink); opacity: .88; } .send:disabled { background: var(--surface-2); color: var(--text-3); opacity: 1; }
.send.stop { background: var(--ink); color: var(--on-ink); }
.attach { border-radius: 8px; background: var(--surface-2); }

/* menus, dialogs */
.menu { border-radius: 10px; } .menu button, .menu a { border-radius: 6px; }
.modal { border-radius: 14px; } .modal-h h3 { font-size: 16px; font-weight: 600; }
.toast { background: var(--ink); color: var(--on-ink); border-radius: 10px; font-size: 13.5px; }
.toast button { background: color-mix(in srgb, var(--on-ink) 18%, transparent); color: var(--on-ink); }
.palette { border-radius: 14px; } .pal-item[aria-selected="true"] { background: var(--surface-2); }
.pal-item mark, .snippet mark { background: #ffe98a55; }

/* panel */
.tab { color: var(--text-3); font-weight: 500; } .tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--ink); }
.tab .count, .tab .count.alert { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); font-weight: 600; }
.seg { background: var(--surface-2); border-radius: 8px; } .seg button { font-weight: 500; border-radius: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.doc-view .section:hover { background: var(--surface-2); } .doc-view .section.sel { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--ink); }
.sel-bar { background: var(--surface-2); border-top: 1px solid var(--line); }
.quick-edits button { border-color: var(--line-strong); color: var(--text-2); background: var(--surface); font-weight: 500; }
.quick-edits button:hover { background: var(--surface-2); color: var(--text); }
.ver.cur { background: var(--surface-2); border-color: var(--line); } .ver.cur .vn { background: var(--ink); color: var(--on-ink); }
.dirty { color: var(--warn); }
.proposal-cols .box.new { background: var(--add); } .proposal-cols .box.old { background: var(--del); }
.empty-panel .ico { background: transparent; border: 1px solid var(--line); color: var(--text-2); border-radius: 10px; }

/* verifiable answers */
.cite { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); border-radius: 5px; }
.cite:hover { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cite.unv { background: var(--warn-soft); color: var(--warn); }
.seg-ans { border-left: 2px solid var(--line-strong); }
.seg-ans.inference { border-left-style: dashed; } .seg-ans.uncertain { border-left-color: var(--warn); }
.seg-ans.unsupported { background: var(--danger-soft); border-left-color: var(--danger); }
.kind-tag { background: transparent; border: 1px solid var(--line); color: var(--text-3); border-radius: 4px; font-weight: 600; font-size: 10px; }
.kind-tag.evidence { color: var(--ok); } .kind-tag.uncertain { color: var(--warn); } .kind-tag.unsupported { background: var(--danger); color: #fff; border-color: var(--danger); }
.rm { border-radius: 8px; } .rm.conflict { background: var(--warn-soft); border-color: var(--line-strong); }
.src:hover { background: var(--surface-2); border-color: var(--line-strong); } .src .q { border-left-color: var(--line-strong); }
.src .n { background: var(--ink); color: var(--on-ink); }
.file-text .pas.focus { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* brief, actions, pages */
.sugg { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.draft { border-radius: 8px; } .draft.approved { background: var(--surface-2); }
.card, .step-card, .file-row, .starter, .draft { border-radius: 10px; }
.resume { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; border-radius: 12px; padding: 22px 24px; }
.resume h2 { font-size: 18px; font-weight: 600; } .resume p { opacity: 1; color: var(--text-2); }
.resume .stats { gap: 28px; margin-top: 16px; } .resume .stat b { font-size: 22px; font-weight: 600; } .resume .stat span { color: var(--text-3); opacity: 1; }
.page h1 { font-size: 24px; font-weight: 600; letter-spacing: -.025em; }
.settings-nav .btn.primary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.step-card.current { border-color: var(--ink); box-shadow: none; } .num { background: var(--surface-2); } .step-card.current .num { background: var(--ink); color: var(--on-ink); } .step-card.approved .num { background: var(--ok); }
.meter > i { background: var(--ink); }
.check { accent-color: var(--ink); }
.cap-row .chip { min-width: 88px; justify-content: center; }
.pinned-flag { color: var(--text-3); }
.ico-btn.on { color: var(--text); }

/* ======================= Advanced interaction layer ======================= */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; border: 2px solid transparent; }
.thread-scroll, .page-scroll { animation: viewIn .22s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }
.topbar .menu-btn { display: inline-flex; }

/* collapsible sidebar (desktop) */
@media (min-width: 861px) {
  .app { transition: grid-template-columns .2s ease; }
  .app.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .app.side-collapsed.panel-open.has-panel { grid-template-columns: 0 minmax(0, 1fr) var(--panel-w); }
  .app.side-collapsed .sidebar { visibility: hidden; overflow: hidden; border-right: 0; }
}

/* resizable panel */
.panel { position: relative; }
.panel-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 5; }
.panel-resize::after { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: transparent; transition: background .12s, width .12s; }
.panel-resize:hover::after, .panel-resize:focus-visible::after, body.resizing .panel-resize::after { background: var(--text-3); width: 2px; left: 3px; }
body.resizing { cursor: col-resize; user-select: none; }
@media (max-width: 1180px) { .panel-resize { display: none; } }

/* slash commands */
.composer-wrap { position: relative; }
.slash-menu { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% - 4px); width: min(var(--col-w), calc(100% - 20px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 20; max-height: 280px; overflow: auto; }
.slash-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--text-2); }
.slash-item b { color: var(--text); font: 600 13px var(--mono); min-width: 86px; }
.slash-item .d { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-item[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

/* home: pick up where you left off */
.recents { margin-top: 30px; }
.recent-list { display: grid; gap: 6px; }
.recent { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-3); }
.recent:hover { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.recent .rt { display: block; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .rm2 { display: block; font-size: 12.5px; color: var(--text-3); }

/* syntax highlighting */
.tok-k { color: var(--text); font-weight: 600; }
.tok-s { color: var(--ok); }
.tok-n { color: var(--warn); }
.tok-c { color: var(--text-3); font-style: italic; }

/* side-by-side diff */
.sdiff { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font: 12.5px/1.55 var(--mono); background: var(--surface); }
.sd { display: grid; grid-template-columns: 34px 1fr; min-width: 0; }
.sd .no { color: var(--text-3); text-align: right; padding: 1px 6px; font-size: 11px; user-select: none; }
.sd .tx { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 8px 1px 4px; }
.sd.del { background: var(--del); color: var(--del-ink); }
.sd.add { background: var(--add); color: var(--add-ink); }
.sd.empty { background: var(--surface-2); }
.sd:nth-child(odd) { border-right: 1px solid var(--line); }
.sd-gap { grid-column: 1 / -1; text-align: center; color: var(--text-3); background: var(--surface-2); font-size: 11px; line-height: 1.2; padding: 2px; }
.sdiff ins { background: color-mix(in srgb, var(--add-ink) 24%, transparent); text-decoration: none; border-radius: 3px; }
.sdiff del { background: color-mix(in srgb, var(--del-ink) 24%, transparent); border-radius: 3px; }
@media (max-width: 860px) { .sdiff { grid-template-columns: 1fr; } .sd:nth-child(odd) { border-right: 0; } }

@container (max-width: 780px) {
  .mode-chip span { display: none; }
  .mode-chip[aria-checked="true"] span { display: inline; }
  .mode-chip { padding: 0 9px; }
}

/* logo placement: header row aligned with the top bar */
.sidebar-top { padding: 0 14px 10px; gap: 14px; }
.brand-row { height: 52px; display: flex; align-items: center; margin: 0 -14px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand-row a { display: inline-flex; align-items: center; border-radius: 6px; }
.logo { width: 128px; margin: 0; }
@media (max-width: 860px) { .brand-row { padding: 0 20px; } }

/* agent: step timeline and proposals */
.agent-steps { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 2px 0 4px; }
.agent-steps > summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); list-style: none; }
.agent-steps > summary::-webkit-details-marker { display: none; }
.agent-steps > summary svg:last-child { margin-left: auto; transition: transform .15s; }
.agent-steps[open] > summary svg:last-child { transform: rotate(180deg); }
.astep-list { list-style: none; margin: 0; padding: 2px 12px 10px; display: grid; gap: 2px; }
.astep { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.astep:first-child { border-top: 0; }
.astep-ico { width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-2); flex: none; margin-top: 1px; }
.astep.failed .astep-ico { color: var(--danger); }
.astep-body { min-width: 0; flex: 1; }
.astep-t { display: flex; align-items: center; gap: 8px; font-size: 13.5px; flex-wrap: wrap; }
.astep-t b { font-weight: 550; }
.astep-ms { margin-left: auto; font: 11.5px var(--mono); color: var(--text-3); }
.astep-why { font-size: 12.5px; color: var(--text-3); font-style: italic; }
.astep-r { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.astep.failed .astep-r { color: var(--danger); }
i.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--text); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.proposal { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: var(--surface); display: grid; gap: 4px; }
.proposal.done { opacity: .75; }
.prop-diff > summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 4px 0; }
.prop-diff .diff { margin-top: 6px; max-height: 320px; overflow: auto; }

.brand-row { padding-left: 12px; }
.logo { margin-left: -2px; }
@media (max-width: 860px) { .brand-row { padding-left: 12px; } }

/* markets */
.mk-disclaimer { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.mk-disclaimer svg { margin-top: 2px; flex: none; }
.markets { display: grid; gap: 6px; }
.mk-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mk-sym { font: 700 15px var(--mono); letter-spacing: .02em; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.mk-sum { margin: 4px 0 0; }
.mk-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.mk-scen { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.mk-scen .rm h5 { text-transform: uppercase; }
@media (max-width: 860px) { .mk-cols { grid-template-columns: 1fr; } }
.mk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mk-stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.mk-stat b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.mk-stat span { font-size: 12px; color: var(--text-3); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.mk-journal { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.mk-journal:first-child { border-top: 0; padding-top: 0; }
.mk-chart { width: 100%; height: 200px; display: block; margin: 8px 0 4px; background: var(--surface-2); border-radius: 8px; }
.mk-line-s { stroke: var(--text); stroke-width: 2; }
.mk-line-b { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 3; }
.mk-key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--text); margin: 0 6px 0 12px; }
.mk-key.b { border-top: 2px dashed var(--text-3); }
/* Local table charts: exact values remain visible in the table and chart labels. */
.table-chart{margin-top:20px;border:1px solid var(--line,#d8dce5);border-radius:10px;padding:14px}.table-chart summary{cursor:pointer;font-weight:600}.table-chart-controls{display:flex;flex-wrap:wrap;gap:14px;margin:16px 0}.table-chart-controls label{display:grid;gap:5px;font-size:12px}.table-chart-controls select{max-width:220px;padding:6px;font:inherit}.table-chart-bars{display:grid;gap:12px;margin-top:15px}.table-chart-row{display:grid;grid-template-columns:minmax(50px,1fr) minmax(90px,3fr) minmax(45px,1fr);gap:10px;align-items:center;font-size:12px}.table-chart-label,.table-chart-value{overflow-wrap:anywhere}.table-chart-value{text-align:right;font-variant-numeric:tabular-nums}.table-chart-track{position:relative;height:20px;background:var(--surface-2,#edf0f7);border-radius:3px}.table-chart-zero{position:absolute;top:-3px;bottom:-3px;width:1px;background:var(--ink,#65718a)}.table-chart-fill{position:absolute;top:3px;bottom:3px;background:var(--brand,#3159c8);border-radius:2px}.table-chart-fill.negative{background:var(--danger,#9c4f2f)}

/* Canvas uses Orbit's existing monochrome surfaces and blue action color. */
.canvas-page { max-width: 1420px; width: 100%; margin: 0 auto; padding: 32px 40px 60px; overflow-y: auto; height: 100%; }
.canvas-heading h1 { margin: 0; font-size: 30px; letter-spacing: -.8px; font-weight: 620; }
.canvas-heading p { color: var(--text-2); margin: 6px 0 0; }
.canvas-status { min-height: 24px; color: var(--text-2); margin: 20px 0 24px; }
.canvas-layout { display: grid; grid-template-columns: minmax(260px, 350px) minmax(0, 1fr); gap: 40px; align-items: start; }
.canvas-input, .canvas-output { min-width: 0; }
.canvas-allowance { display: flex; flex-direction: column; gap: 5px; margin-bottom: 26px; font-size: 13px; }
.canvas-allowance strong { font-size: 16px; font-weight: 600; }
.canvas-allowance>span { color: var(--text-2); }
.canvas-form { display: flex; flex-direction: column; gap: 12px; }
.canvas-form .lbl { margin: 0; font-size: 14px; }
.canvas-form textarea { min-height: 180px; }
.canvas-form>.hint { margin: 0; }
.canvas-security { min-height: 0; max-width: 100%; }
.canvas-preview { min-height: 420px; padding: 24px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.canvas-preview[aria-busy="true"] { opacity: .65; }
.canvas-preview img { display: block; max-width: 100%; max-height: 580px; width: auto; height: auto; object-fit: contain; border-radius: 6px; }
.canvas-empty { max-width: 300px; text-align: center; color: var(--text-2); }
.canvas-empty>svg { width: 42px; height: 42px; color: var(--text-3); }
.canvas-empty h2 { color: var(--text); font-size: 22px; font-weight: 550; letter-spacing: -.5px; margin: 18px 0 10px; }
.canvas-empty p { font-size: 14px; margin-bottom: 22px; }
.canvas-preview-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.canvas-preview>.hint { text-align: center; margin: 0; }
.canvas-history { margin-top: 30px; }
.canvas-history h2 { font-size: 16px; font-weight: 600; }
.canvas-history-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; width: 100%; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-size: 13px; }
@media (max-width: 1050px) { .canvas-page { padding: 24px; } .canvas-layout { gap: 24px; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); } }
@media (max-width: 720px) { .canvas-page { padding: 22px 18px 50px; } .canvas-layout { grid-template-columns: 1fr; gap: 28px; } .canvas-preview { min-height: 300px; padding: 20px 14px; } .canvas-heading h1 { font-size: 27px; } }

/* empty chat: a heading, four suggestions, recent work. Nothing else. */
.empty { padding-top: min(16vh, 140px); }
.starters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.starter { align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.starter:hover { color: var(--text); }
.recents { margin-top: 44px; }

/* logo: the image is cropped tight, the dark theme swaps to a version with a white wordmark and a lighter blue mark */
.logo { content: var(--logo-src); width: 138px; height: auto; margin: 0; filter: none; }
.brand-row a { padding: 0; }
.logo { margin-left: 2px; }

/* Mobile controls stay usable without widening the conversation. */
@media (max-width: 860px) {
  .app { height: 100dvh; }
  .topbar { min-height: calc(60px + env(safe-area-inset-top)); height: auto; padding-top: env(safe-area-inset-top); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); gap: 6px; }
  .top-actions { gap: 4px; flex-shrink: 0; }
  .topbar .btn, .topbar .btn.sm, .btn.icon, .btn.icon.sm { min-width: 44px; min-height: 44px; }
  .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .side-scroll { overscroll-behavior: contain; }
  .row { min-height: 44px; }
  .row .more, .side-h button { min-width: 36px; min-height: 36px; }
  .composer-wrap { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .composer textarea, .field, .select, .editor, .conv-title { font-size: 16px; }
  .composer textarea { max-height: min(180px, 25dvh); }
  .c-bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; padding: 8px; }
  .c-bar .modes { grid-column: 1 / -1; grid-row: 1; min-width: 0; max-width: 100%; gap: 8px; padding-bottom: 4px; overscroll-behavior-x: contain; }
  .modes .mode-chip { flex: none; min-height: 44px; padding-inline: 12px; }
  .modes .mode-chip span { display: inline; }
  .c-bar > .btn { grid-column: 1; grid-row: 2; width: 44px; height: 44px; }
  .c-bar > .spacer { display: none; }
  .c-bar > button.speed { grid-column: 2; grid-row: 2; min-width: 0; max-width: 100%; height: 44px; justify-content: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .c-bar > select.speed { grid-column: 1 / -1; grid-row: 3; width: 100%; min-width: 0; height: 44px; font-size: 16px; }
  .c-bar .send { grid-column: 3; grid-row: 2; width: 44px; height: 44px; }
  .c-foot { flex-wrap: wrap; gap: 4px 12px; padding-inline: 2px; font-size: 12px; }
  .c-foot .kbd { display: none; }
  .empty { width: calc(100% - 32px); padding-top: clamp(20px, 5dvh, 44px); }
  .empty h2 { font-size: clamp(26px, 7vw, 34px); }
  .starter { min-width: 0; min-height: 52px; }
  .thread, .page, .panel-body, .modal-b { overflow-wrap: anywhere; }
  .thread-scroll, .page-scroll { min-height: 0; }
  .msg.assistant .body, .codeblock, .md, .page .card { min-width: 0; max-width: 100%; }
  .page { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .page .flex, .card .flex { flex-wrap: wrap; }
  .settings-nav { gap: 8px; }
  .settings-nav .btn, .modal-f .btn, .page .btn { min-height: 44px; }
  .panel { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .scrim { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .modal-h, .modal-b, .modal-f { padding-inline: 16px; }
  .modal-h { gap: 12px; }
  .modal-b { min-height: 0; }
  .modal-f .btn { white-space: normal; height: auto; padding-block: 10px; }
  .menu { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; }
  .menu button, .menu a { min-height: 44px; }
  .msg-actions .ico-btn { min-height: 36px; min-width: 36px; }
}
@media (max-width: 380px) {
  .modal-f { flex-direction: column; }
  .modal-f .btn { width: 100%; }
  .top-actions { gap: 0; }
}
@media (max-width: 860px) and (max-height: 500px) {
  .empty { padding-top: 16px; }
  .starters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer textarea { max-height: 90px; }
}

/* Account recovery stays accessible when new Guest sessions are limited. */
.app.auth-only { grid-template-columns: minmax(0, 1fr); }
.auth-only .sidebar { display: none; }
.auth-only .page { max-width: 560px; }
.auth-only .topbar a { color: var(--text); text-decoration: none; font-weight: 600; }

/* live activity: what Orbit is doing right now */
.activity { display: grid; gap: 10px; margin: 2px 0 8px; }
.act-now { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.act-orb { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--brand); animation: orbpulse 1.6s infinite; }
@keyframes orbpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.act-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.shimmer { background: linear-gradient(90deg, var(--text-3) 0%, var(--text) 45%, var(--text-3) 90%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.act-meta { margin-left: auto; display: flex; gap: 12px; flex: none; font: 11.5px var(--mono); color: var(--text-3); }
.act-web { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; }
.act-web-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.act-query { font-size: 13px; color: var(--text-2); margin: 6px 0 2px; overflow-wrap: anywhere; }
.act-sites { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.act-site { display: flex; align-items: center; gap: 10px; min-width: 0; animation: siteIn .35s ease both; }
@keyframes siteIn { from { opacity: 0; transform: translateY(4px); } }
.host-av { width: 22px; height: 22px; flex: none; border-radius: 6px; display: grid; place-items: center; color: #fff; font: 700 11px var(--font); }
.act-site .host { font-weight: 550; font-size: 13.5px; color: var(--text); text-decoration: none; flex: none; } .act-site .host:hover { text-decoration: underline; }
.act-site .t { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.astep.running .astep-body::after { content: ""; display: block; height: 2px; margin-top: 7px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--brand), transparent) no-repeat; background-size: 40% 100%; animation: slide 1.3s linear infinite; }
@keyframes slide { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) { .act-orb, .act-site, .astep.running .astep-body::after { animation: none; } .shimmer { animation: none; background: none; color: var(--text-2); } }
@media (max-width: 640px) { .act-meta .act-time ~ *, .act-meta span:not(.act-time) { display: none; } }
.privacy-switch { min-height: 44px; cursor: pointer; }
