/* Vector — internal operations UI.
   Light (default): enterprise — white work surface, navy sidebar, dense tables, 2px corners.
   Dark ([data-theme="dark"]): analyst terminal — near-black, mono headings and figures, hairline grid. */

:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --paper: #f7f8fa;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e3e6eb;
  --line-2: #cfd4dc;
  --accent: #1f4e8c;
  --accent-2: #2b63ad;
  --accent-soft: #e8eef8;
  --accent-ink: #ffffff;
  --nav-bg: #12233f;
  --nav-ink: #c9d3e3;
  --nav-muted: #7f8ea8;
  --nav-active: #ffffff;
  --nav-active-bg: #1f3a63;
  --top-bg: #ffffff;
  --good: #0f7a3d;  --good-bg: #e6f4ec;
  --ok: #2a6f97;    --ok-bg: #e7f0f6;
  --warn: #9a5b00;  --warn-bg: #fdf3e1;
  --bad: #b42318;   --bad-bg: #fdecea;
  --mute-bg: #f1f2f4;
  --row-hover: #f4f7fb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 2px;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --head: var(--sans);
  --fig: var(--sans);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --chart-line: #2a78d6; --chart-sub: #eb6834;
  --nav-w: 216px; --dock-w: 400px; --top-h: 44px; --status-h: 24px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #07090c;
  --surface: #0c0f13;
  --paper: #10141a;
  --ink: #d8dee6;
  --ink-2: #aab3bf;
  --muted: #6f7a87;
  --line: #1a2028;
  --line-2: #26303b;
  --accent: #4c9aff;
  --accent-2: #74b0ff;
  --accent-soft: #0f1d30;
  --accent-ink: #04070b;
  --nav-bg: #05070a;
  --nav-ink: #9aa5b3;
  --nav-muted: #56616e;
  --nav-active: #e6edf5;
  --nav-active-bg: #0f1d30;
  --top-bg: #05070a;
  --good: #3ddc84;  --good-bg: #0b2016;
  --ok: #5eb1e6;    --ok-bg: #0b1a26;
  --warn: #f0b429;  --warn-bg: #241b07;
  --bad: #ff6b6b;   --bad-bg: #2a0f10;
  --mute-bg: #11161c;
  --row-hover: #0f141a;
  --shadow: none;
  --head: var(--mono);
  --fig: var(--mono);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --chart-line: #3987e5; --chart-sub: #d95926;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 12px; }
h1, h2, h3, h4 { font-family: var(--head); margin: 0; font-weight: 600; letter-spacing: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.eyebrow { margin: 0 0 2px; font: 600 10.5px/1.4 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.error { color: var(--bad); min-height: 1em; margin: 6px 0; font-size: 12px; }
.warn-text { color: var(--warn); }
:root[data-theme="dark"] .eyebrow, :root[data-theme="dark"] h3, :root[data-theme="dark"] h4 { text-transform: uppercase; letter-spacing: .06em; }
:root[data-theme="dark"] h3 { font-size: 14px; }
:root[data-theme="dark"] h4 { font-size: 11.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: 500 13px/1 var(--sans); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--paper); text-decoration: none; border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger, .btn.confirm { color: var(--bad); }
.btn.confirm { border-color: var(--bad); }
.btn.block { width: 100%; justify-content: center; height: 34px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
select.btn { padding-right: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius); background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--paper); }
.text-btn { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.input, .inline-form input, .inline-form select, textarea.json, .field input, .field select {
  height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 13px var(--sans); min-width: 0; }
.input.sm { height: 26px; font-size: 12px; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 12px; align-items: end; }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
textarea.json { width: 100%; height: 320px; padding: 8px; font: 12px/1.5 var(--mono); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- sign in */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--nav-bg); }
.auth-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { font-size: 18px; }
.auth-brand { display: flex; align-items: center; gap: 8px; font: 700 13px var(--mono); letter-spacing: .14em; }
.auth-fund { margin-left: auto; font: 500 12px var(--sans); letter-spacing: 0; color: var(--muted); }
.auth-foot { margin: 4px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
.logo { width: 18px; height: 18px; border-radius: 2px; flex: none; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 5l4.5 8.5L13.5 5' fill='none' stroke='%23fff' stroke-width='2.2'/%3E%3C/svg%3E") center/18px no-repeat; }

/* ---------------------------------------------------------------- shell */
.shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--nav-w) 1fr auto; grid-template-rows: var(--top-h) 1fr var(--status-h);
  grid-template-areas: "top top top" "nav view dock" "status status status"; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--top-bg); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font: 700 12.5px var(--mono); letter-spacing: .14em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .fund-name { font: 500 12px var(--sans); letter-spacing: 0; color: var(--muted); }
.brand-sep { width: 1px; height: 16px; background: var(--line-2); }
.nav-toggle { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.crumbs span:last-child { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 11px; font-size: 11.5px; color: var(--ink-2); background: var(--paper); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--good); }
.pill.busy .dot { background: var(--ok); animation: pulse 1.2s infinite; }
.pill.bad .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.dock-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
.user { position: relative; }
.avatar { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font: 600 11px var(--sans); cursor: pointer; }
.menu { position: absolute; right: 0; top: 34px; min-width: 200px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 50; padding: 4px; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head span { font-size: 12px; color: var(--muted); }
.menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; color: var(--ink); font: 13px var(--sans); cursor: pointer; border-radius: var(--radius); }
.menu button:hover { background: var(--paper); }

.sidenav { grid-area: nav; background: var(--nav-bg); color: var(--nav-ink); padding: 10px 8px; overflow-y: auto; border-right: 1px solid var(--line); }
.nav-group { margin-bottom: 14px; }
.nav-label { margin: 0 0 4px; padding: 0 10px; font: 600 10.5px/2 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--nav-muted); }
.sidenav a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--nav-ink); border-radius: var(--radius); font-size: 13px; border-left: 2px solid transparent; }
.sidenav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: var(--nav-active); }
.sidenav a.active { background: var(--nav-active-bg); color: var(--nav-active); border-left-color: var(--accent-2); font-weight: 500; }
.count { margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font: 600 10.5px/18px var(--sans); text-align: center; }
:root[data-theme="dark"] .sidenav a, :root[data-theme="dark"] .nav-label { font-family: var(--mono); font-size: 12px; }

.view { grid-area: view; overflow-y: auto; min-width: 0; }
.view.view-chat { overflow: hidden; display: flex; }
.statusbar { grid-area: status; display: flex; gap: 18px; align-items: center; padding: 0 12px; background: var(--nav-bg); color: var(--nav-muted); font: 11px var(--mono); white-space: nowrap; overflow: hidden; }
#sb-time { margin-left: auto; }

/* ---------------------------------------------------------------- page content */
.panel { padding: 16px 20px 32px; max-width: 1480px; }
.panel-head, .deal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3, .deal-head h3 { font-size: 17px; }
.panel-head p, .deal-head p { margin: 3px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); min-width: 0; }
.card h4 { font-size: 13px; margin-bottom: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-head h4 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 12px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.tile { background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-top: 3px solid transparent; }
.t-label { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.t-value { font: 600 22px/1.2 var(--fig); color: var(--ink); }
.t-sub { font-size: 11.5px; color: var(--muted); }
.tile.good { border-top-color: var(--good); } .tile.warn { border-top-color: var(--warn); } .tile.bad { border-top-color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip { height: 24px; padding: 0 10px; display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink-2); font-size: 12px; background: var(--surface); }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.empty-state { color: var(--muted); font-size: 12.5px; padding: 10px 0; margin: 0; }
.note-box { background: var(--warn-bg); border: 1px solid var(--line); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: var(--radius); margin: 0 0 12px; font-size: 12.5px; }
pre.box { background: var(--paper); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); overflow: auto; max-height: 420px; white-space: pre-wrap; margin: 6px 0; }
.score { font: 600 28px/1.1 var(--fig); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0; font-size: 12.5px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
details summary { cursor: pointer; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; margin-bottom: 12px; }
.drop input { display: none; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card .tbl-wrap { border: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; background: var(--paper); text-align: left; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl.dense td { padding: 5px 10px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-family: var(--fig); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl tr.bad td { background: var(--bad-bg); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl td.actions .btn + .btn { margin-left: 4px; }
td.src { font: 11px var(--mono); color: var(--muted); word-break: break-all; }
:root[data-theme="dark"] .tbl th { font-family: var(--mono); }

/* badges and states */
.badge { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--radius); font: 500 11px var(--sans); color: var(--ink-2); background: var(--paper); white-space: nowrap; }
.badge.accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.warn { color: var(--warn); border-color: currentColor; background: var(--warn-bg); }
.badge.bad { color: var(--bad); border-color: currentColor; background: var(--bad-bg); }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.st.ok::before, .st.done::before, .st.pass::before, .st.green::before { background: var(--good); }
.st.running::before, .st.queued::before { background: var(--ok); }
.st.awaiting_human::before, .st.warn::before, .st.yellow::before, .st.missing::before { background: var(--warn); }
.st.failed::before, .st.fail::before, .st.red::before { background: var(--bad); }
.label-Confirmed { color: var(--good); } .label-Source { color: var(--ok); } .label-Working { color: var(--warn); } .label-Inferred { color: var(--muted); }
.flag, .phase { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: var(--radius); font: 600 11px var(--sans); white-space: nowrap; background: var(--mute-bg); color: var(--ink-2); }
.flag::before, .phase::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.flag.good, .phase.good { background: var(--good-bg); color: var(--good); }
.flag.ok, .phase.ok { background: var(--ok-bg); color: var(--ok); }
.flag.warn, .phase.warn { background: var(--warn-bg); color: var(--warn); }
.flag.bad, .phase.bad { background: var(--bad-bg); color: var(--bad); }
.flag.mute, .phase.mute { color: var(--muted); }
:root[data-theme="dark"] .flag, :root[data-theme="dark"] .phase { font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; }
.conf { font-size: 11.5px; text-transform: capitalize; }
.conf.high { color: var(--good); } .conf.medium { color: var(--ink-2); } .conf.low { color: var(--warn); }

/* needs you, board, deal */
.need { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.need:last-child { border-bottom: 0; }
.need p { margin: 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.col { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-height: 160px; }
.col-head { display: flex; justify-content: space-between; padding: 7px 9px; border-bottom: 1px solid var(--line); font-size: 12px; background: var(--surface); }
.col-body { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.dcard { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); color: var(--ink); font-size: 12px; }
.dcard:hover { text-decoration: none; border-color: var(--accent); }
.dcard.stale { border-left-color: var(--warn); }
.dcard .name { font-weight: 600; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.closed-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0; }
.vline { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.vline:last-child { border-bottom: 0; }
.vline ul { margin: 4px 0; padding-left: 18px; }
.ov { font-size: 12px; color: var(--warn); }

/* market watch */
.spark { display: block; overflow: visible; }
.spark path { stroke: var(--chart-line); }
.spark circle { fill: var(--chart-line); }
.spark.sub path { stroke: var(--chart-sub); }
.spark.sub circle { fill: var(--chart-sub); }
.spark-empty { color: var(--muted); }
.evidence { list-style: none; margin: 0; padding: 0; }
.evidence li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.evidence li:last-child { border-bottom: 0; }
.evidence p { margin: 0 0 2px; }
.theme-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.theme-row .input[name=name] { width: 220px; }
.lc { min-width: 0; }
.lc + .lc { margin-top: 10px; }
.lc-head { display: flex; justify-content: space-between; gap: 8px; font: 600 12px var(--sans); margin-bottom: 4px; }
.lc-plot { position: relative; }
.lc svg { display: block; overflow: visible; }
.lc .grid { stroke: var(--line); stroke-width: 1; }
.lc text { fill: var(--muted); font: 10.5px var(--fig); }
.lc .line { stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; }
.lc .area { fill: var(--chart-line); opacity: .08; }
.lc .cross { stroke: var(--line-2); stroke-width: 1; }
.lc .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.lc .hit { cursor: crosshair; }
.lc-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); background: var(--ink); color: var(--surface); padding: 4px 8px; border-radius: var(--radius); font-size: 11.5px; pointer-events: none; display: flex; flex-direction: column; white-space: nowrap; }
.lc-tip b { font-family: var(--fig); }
.lc-table summary { font-size: 11px; color: var(--muted); margin-top: 2px; }
.lc-table .tbl-wrap { max-height: 200px; overflow: auto; }
.note.prose { font-size: 13.5px; max-width: 760px; }
ul.feed { list-style: none; margin: 0; padding: 0; }
ul.feed li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.feed p { margin: 0; }
.secret { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); }
.secret div { flex: 1; } .secret p { margin: 0; }

/* ---------------------------------------------------------------- chat (dock + page) */
.dock { grid-area: dock; width: var(--dock-w); border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.dock-head { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.dock-tools { display: flex; gap: 2px; }
.dock-body { flex: 1; min-height: 0; display: flex; }
.chat { flex: 1; display: flex; min-width: 0; min-height: 0; position: relative; background: var(--surface); }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convos { display: none; flex-direction: column; gap: 8px; width: 240px; padding: 10px; border-right: 1px solid var(--line); background: var(--paper); overflow: hidden; }
.chat.page .convos { display: flex; }
.convos.open { display: flex; position: absolute; z-index: 20; left: 0; top: 0; bottom: 0; box-shadow: 4px 0 16px rgba(0,0,0,.12); }
.convos-head .btn { width: 100%; justify-content: center; }
.convo-list { flex: 1; overflow-y: auto; }
.convo-group { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 10px 4px 4px; }
.convo { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-radius: var(--radius); cursor: pointer; font-size: 12.5px; }
.convo:hover { background: var(--row-hover); }
.convo.active { background: var(--accent-soft); color: var(--accent); }
.convo .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo .acts { display: none; gap: 2px; }
.convo:hover .acts { display: flex; }
.convo .acts button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 3px; }
.convo-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; }
.convo-archived { font-size: 12px; align-self: flex-start; }
.convo-archived.on { font-weight: 600; }
.chat-bar { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.chat.page #convo-toggle { display: none; }
.chat-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { flex: 1; overflow-y: auto; padding: 14px 14px 6px; }
.chat.page .thread { padding: 20px max(20px, calc((100% - 820px) / 2)); }
.empty h2 { font-size: 18px; margin: 2px 0 14px; }
.suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.suggest button { text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 12.5px/1.4 var(--sans); cursor: pointer; }
.suggest button:hover { border-color: var(--accent); }
.suggest small { display: block; font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 2px; }
.messages { display: flex; flex-direction: column; gap: 14px; }
.msg.user { align-self: flex-end; max-width: 85%; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); padding: 7px 11px; border-radius: var(--radius); white-space: pre-wrap; }
.msg.assistant { max-width: 100%; }
.who { font: 600 10.5px var(--mono); letter-spacing: .12em; color: var(--accent); margin-bottom: 3px; }
.msg .meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.msg.action-note .body { font-size: 12.5px; color: var(--ink-2); padding: 6px 10px; border-left: 2px solid var(--good); background: var(--paper); }
.msg.action-note .body p { margin: 0; display: inline; }
.prose p { margin: 0 0 8px; }
.prose ul, .prose ol { margin: 0 0 8px; padding-left: 20px; }
.prose li { margin: 2px 0; }
.prose h3, .prose h4, .prose h5, .prose h6 { font-size: 13px; margin: 10px 0 4px; }
.prose blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 2px solid var(--line-2); color: var(--ink-2); }
.prose .tbl-wrap { margin: 6px 0 8px; }
.prose code { background: var(--paper); padding: 0 3px; border-radius: 2px; }
.typing { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.action-card { margin-top: 8px; border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 8px 10px; background: var(--paper); }
.action-card.done { border-left-color: var(--good); } .action-card.failed { border-left-color: var(--bad); } .action-card.cancelled { opacity: .7; border-left-color: var(--muted); }
.ac-head { display: flex; justify-content: space-between; font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ac-sum { margin: 4px 0; font-size: 12.5px; }
.ac-res { font-size: 12px; color: var(--ink-2); }
.ac-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.composer { border-top: 1px solid var(--line); padding: 8px 10px 10px; background: var(--surface); }
.chat.page .composer { padding: 10px max(20px, calc((100% - 820px) / 2)) 14px; }
.ctx { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; padding: 1px 4px 1px 8px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; }
.ctx button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; }
.composer-row { display: flex; gap: 6px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 34px; max-height: 180px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 13px/1.45 var(--sans); }
.send { height: 34px; }
figure.viz { margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.viz-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.viz-tools button { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 11px var(--sans); padding: 2px 6px; margin-left: 3px; border-radius: var(--radius); cursor: pointer; }
.viz-tools button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.viz-body { height: 240px; padding: 8px; position: relative; }
.viz-body:has(.tbl-wrap), .viz-body.diagram { height: auto; }
.viz-note, .viz-loading { margin: 0; padding: 4px 8px 6px; font-size: 11px; color: var(--muted); }
.viz-src { margin: 0 8px 8px; padding: 6px; background: var(--paper); white-space: pre-wrap; }

.toast { position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: var(--radius); font-size: 12.5px; transition: .2s; z-index: 100; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1100px) {
  body.dock-open .dock { position: fixed; right: 0; top: var(--top-h); bottom: var(--status-h); z-index: 30; box-shadow: -8px 0 24px rgba(0,0,0,.15); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "view" "status"; }
  .nav-toggle { display: inline-grid; }
  .sidenav { position: fixed; left: 0; top: var(--top-h); bottom: var(--status-h); width: 240px; z-index: 40; transform: translateX(-100%); transition: transform .15s; }
  .sidenav.open { transform: none; }
  .crumbs, .brand .fund-name, .brand-sep, #queue-pill, .dock-btn span { display: none; }
  .topbar { gap: 6px; padding: 0 8px; }
  body.dock-open .dock { left: 0; width: auto; }
  .panel { padding: 12px 16px 24px; }
  .grid-side { grid-template-columns: 1fr; }
  .need { grid-template-columns: 1fr; }
  .chat.page .convos { display: none; }
  .chat.page #convo-toggle { display: inline; }
  .chat.page .thread, .chat.page .composer { padding-left: 12px; padding-right: 12px; }
  .statusbar #sb-data { display: none; }
}

/* ---------------------------------------------------------------- client wordmark (as on atomiccapital.in) */
.client-logo { font: 500 13px/1 "Inter Tight", var(--sans); text-transform: uppercase; color: #171717; letter-spacing: .01em; white-space: nowrap; }
:root[data-theme="dark"] .client-logo { color: #f2f2f0; }
.brand .client-logo { font-size: 13.5px; }
.auth-fund.client-logo { margin-left: auto; font-size: 13px; color: #171717; }

/* ---------------------------------------------------------------- the maker's mark: present, not noticed */
.sidenav { display: flex; flex-direction: column; }
.sidenav .credit { margin: auto 0 0; padding: 14px 10px 2px; }
.credit { font: 400 9.5px/1.3 var(--sans); letter-spacing: .02em; color: var(--nav-muted); opacity: .38; user-select: none; }
.credit:hover { opacity: .6; }
.auth { position: relative; }
.auth-credit { position: absolute; left: 14px; bottom: 10px; margin: 0; }

/* ---------------------------------------------------------------- settings */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; }
.tabs a { padding: 7px 14px; color: var(--ink-2); font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.field-row:last-of-type { border-bottom: 0; }
.field-label { font-size: 12px; color: var(--muted); }
.radios { display: flex; flex-wrap: wrap; gap: 14px; }
.radio { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.section-label { margin: 14px 0 6px; }
.section-label:first-of-type { margin-top: 4px; }

/* ---------------------------------------------------------------- fresh chat: centred, like ChatGPT / Claude */
.chat-main > .thread { order: 1; } .chat-main > .composer { order: 3; } .chat-main > .suggest { order: 2; }
.chat-main > .suggest { display: none; padding: 0 14px 10px; }
.chat.fresh .chat-main > .suggest { display: grid; }
.chat.page.fresh .chat-main { justify-content: center; }
.chat.page.fresh .thread { flex: 0 0 auto; overflow: visible; padding-bottom: 8px; }
.chat.page.fresh .empty { text-align: center; }
.chat.page.fresh .empty h2 { font-size: 24px; margin-bottom: 4px; }
.chat.page.fresh .chat-main > .composer { order: 2; border-top: 0; width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 0; background: none; }
.chat.page.fresh .composer textarea { min-height: 52px; padding: 14px 14px; font-size: 14px; box-shadow: 0 2px 10px rgba(16, 24, 40, .06); }
.chat.page.fresh .send { height: 52px; padding: 0 18px; }
.chat.page.fresh .chat-main > .suggest { order: 3; width: min(760px, calc(100% - 32px)); margin: 14px auto 0; padding: 0; }
.chat.page.fresh .chat-bar { display: none; }
