:root {
  --ground: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --ink: #141923;
  --ink-2: #384355;
  --muted: #667287;
  --line: #D8DFEA;
  --line-2: #E7ECF3;
  --accent: #314C75;
  --accent-2: #233957;
  --accent-ink: #FFFFFF;
  --accent-soft: #E5ECF6;
  --warn: #A86A12;
  --warn-soft: #F7ECD8;
  --danger: #A3362E;
  --danger-soft: #F6E2DF;
  --info: #2D5B8A;
  --info-soft: #E2EBF5;
  --rail: #080B10;
  --rail-2: #141A25;
  --rail-ink: #E6EAF2;
  --rail-muted: #929CAD;
  --paper: #FFFFFF;
  --verify: #FFF1A8;
  --shadow: 0 1px 2px rgba(15, 31, 27, .06), 0 8px 24px rgba(15, 31, 27, .06);
  --r: 8px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0D1017; --surface: #151A24; --surface-2: #1A2230; --ink: #E8EDF7; --ink-2: #CAD4E4; --muted: #9AA9BE;
    --line: #2D384B; --line-2: #253043; --accent: #B8C7E0; --accent-2: #D1DCEF; --accent-ink: #0D1017; --accent-soft: #25344E;
    --warn: #E2AA4F; --warn-soft: #2E2616; --danger: #E47C70; --danger-soft: #331D1A; --info: #86B1DD; --info-soft: #1A2735;
    --rail: #080A0F; --rail-2: #111722; --paper: #181E29; --verify: #5A4B12; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0D1017; --surface: #151A24; --surface-2: #1A2230; --ink: #E8EDF7; --ink-2: #CAD4E4; --muted: #9AA9BE;
  --line: #2D384B; --line-2: #253043; --accent: #B8C7E0; --accent-2: #D1DCEF; --accent-ink: #0D1017; --accent-soft: #25344E;
  --warn: #E2AA4F; --warn-soft: #2E2616; --danger: #E47C70; --danger-soft: #331D1A; --info: #86B1DD; --info-soft: #1A2735;
  --rail: #080A0F; --rail-2: #111722; --paper: #181E29; --verify: #5A4B12; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); }
legend { padding: 0 6px; font-weight: 600; }
img { max-width: 100%; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font: 500 30px/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font: 500 21px/1.25 var(--serif); }
h3 { font: 600 15px/1.35 var(--sans); }
p { margin: 0; }
.eyebrow { font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 14px; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.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.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=color], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 9px 11px; min-width: 0; }
input[type=color] { padding: 2px; height: 38px; width: 64px; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-error { color: var(--danger); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; font: 500 12px/1 var(--mono); letter-spacing: .04em; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- pills & meters ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.6;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.pill.met, .pill.approved, .pill.ready-rec { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.partial, .pill.strengthen { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.pill.missing { border-style: dashed; color: var(--muted); background: transparent; }
.pill.not_ready, .pill.error { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.pill.running, .pill.generating, .pill.analyzing, .pill.pending { border-color: var(--info); color: var(--info); background: var(--info-soft); }
.pill.ready { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill.new { border-color: var(--info); color: var(--info); }
.pill.demo { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.pulse .dot, .pill.running .dot, .pill.generating .dot, .pill.analyzing .dot, .pill.pending .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.meter { display: inline-grid; grid-template-columns: repeat(5, 1fr); gap: 3px; width: 86px; vertical-align: middle; }
.meter i { height: 7px; border-radius: 2px; background: var(--line-2); border: 1px solid var(--line); }
.meter i.on { background: var(--accent); border-color: var(--accent); }
.meter.warn i.on { background: var(--warn); border-color: var(--warn); }
.score { font: 600 14px/1 var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
#app { min-height: 100%; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-brand { background: var(--rail); color: var(--rail-ink); padding: 48px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.login-brand h1 { font-size: clamp(30px, 3.6vw, 46px); color: #F2F7F4; max-width: 15ch; }
.login-brand p { color: var(--rail-muted); max-width: 46ch; }
.login-brand .cites { font: 12px/1.9 var(--mono); color: var(--rail-muted); border-top: 1px solid rgba(220, 231, 226, .14); padding-top: 18px; }
.login-brand .cites b { color: var(--rail-ink); font-weight: 500; }
.guilloche { position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; opacity: .18; pointer-events: none; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.demo-box { border: 1px dashed var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.demo-box button { text-align: left; }

.brand-mark { display: inline-flex; align-items: center; gap: 10px; font: italic 500 22px/1 var(--serif); color: inherit; text-decoration: none; }
.seal { width: 30px; height: 30px; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; gap: 22px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.rail .firm { font-size: 12.5px; color: var(--rail-muted); padding: 0 8px; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--rail-ink); text-decoration: none; padding: 8px 10px; border-radius: 7px; font-weight: 500; font-size: 14px; }
.rail nav a:hover { background: var(--rail-2); }
.rail nav a.active { background: var(--rail-2); box-shadow: inset 2px 0 0 #B8C7E0; }
.rail nav .count { font: 500 11px/1 var(--mono); background: #B8C7E0; color: #080B10; border-radius: 999px; padding: 3px 7px; }
.rail .foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; font-size: 13px; }
.rail .foot .who { color: var(--rail-ink); font-weight: 500; }
.rail .foot .role { color: var(--rail-muted); font-size: 12px; }
.rail .seg { border-color: rgba(220, 231, 226, .2); }
.rail .seg button { color: var(--rail-muted); }
.rail .seg button[aria-pressed="true"] { background: #B8C7E0; color: #080B10; }
.rail .btn.ghost { color: var(--rail-muted); justify-content: flex-start; padding-left: 0; }
.rail .btn.ghost:hover { background: transparent; color: var(--rail-ink); }
.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 28px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .stack { gap: 6px; }

.banner { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); }
.banner.info { border-color: var(--info); background: var(--info-soft); }

/* ---------- KPIs & tables ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .v { font: 500 30px/1 var(--serif); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font: 500 11px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
.who-cell { display: flex; flex-direction: column; gap: 2px; }
.who-cell b { font-weight: 600; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- stage tracker ---------- */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.stages li { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stages li::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); }
.stages li.done::before { background: var(--accent); }
.stages li.now::before { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }
.stages li.now { color: var(--ink); font-weight: 600; }
.stages li.done { color: var(--ink-2); }
.mini-stage { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.mini-stage .bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.mini-stage .bars i { height: 4px; border-radius: 1px; background: var(--line); }
.mini-stage .bars i.on { background: var(--accent); }

/* ---------- case header & tabs ---------- */
.case-head { display: flex; flex-direction: column; gap: 18px; }
.case-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.case-meta b { color: var(--ink); font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font: 500 11px/1 var(--mono); color: var(--muted); }

.section { display: flex; flex-direction: column; gap: 14px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- assessment ---------- */
.verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.ring { width: 104px; height: 104px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; }
.ring .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .val b { font: 500 30px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ring .val span { font: 10px/1.2 var(--mono); color: var(--muted); letter-spacing: .06em; }
.criteria { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.crit { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line-2); align-items: start; }
.crit:first-child { border-top: 0; }
.crit .ref { font: 500 12px/1.4 var(--mono); color: var(--muted); padding-top: 2px; }
.crit .body { display: flex; flex-direction: column; gap: 4px; }
.crit .body p { font-size: 13.5px; color: var(--ink-2); }
.crit .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.crit .ex { font: 12px/1 var(--mono); color: var(--muted); }
.list-plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.threshold { font: 500 13px/1.4 var(--mono); }

/* ---------- evidence ---------- */
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface); padding: 22px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .stack { gap: 4px; }
.docs { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.doc-group { padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.doc-group:first-child { border-top: 0; border-radius: var(--r) var(--r) 0 0; }
.doc { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line-2); align-items: start; }
.doc.excluded { opacity: .55; }
.doc .exno { font: 500 12px/1.3 var(--mono); color: var(--muted); padding-top: 2px; }
.doc .exno b { display: block; font: 500 20px/1 var(--serif); color: var(--ink); }
.doc .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doc .title { font-weight: 600; overflow-wrap: anywhere; }
.doc .file { font: 12px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.doc .facts { display: flex; gap: 6px; flex-wrap: wrap; }
.doc .facts span { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 7px; }
.doc .issues { font-size: 13px; color: var(--warn); display: flex; flex-direction: column; gap: 2px; }
.doc .side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.doc .side select { width: auto; font-size: 13px; padding: 5px 8px; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 500; }
details.more[open] summary { margin-bottom: 8px; }

/* ---------- drafts ---------- */
.drafts { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.draft-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.draft-list a { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border-top: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.draft-list a:first-child { border-top: 0; }
.draft-list a.active { background: var(--accent-soft); }
.draft-list a:hover { background: var(--surface-2); }
.new-draft { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.new-draft .btn { justify-content: flex-start; white-space: normal; text-align: left; }
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: clamp(20px, 5vw, 56px) clamp(18px, 6vw, 64px); font: 17px/1.62 var(--serif); color: var(--ink); max-width: 820px; overflow-wrap: anywhere; }
.paper h1, .paper h2, .paper h3, .paper h4 { font-family: var(--serif); margin: 1.2em 0 .45em; }
.paper h2 { font-size: 20px; }
.paper h3 { font-size: 17px; font-weight: 600; }
.paper p { margin: 0 0 .85em; }
.paper ul, .paper ol { margin: 0 0 .85em; padding-left: 1.4em; }
.paper table { border-collapse: collapse; width: 100%; font: 14px/1.45 var(--sans); margin: 0 0 1em; }
.paper th, .paper td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.paper blockquote { border-left: 3px solid var(--line); margin: 0 0 1em; padding-left: 12px; color: var(--ink-2); }
.paper-wrap { overflow-x: auto; }
mark.verify { background: var(--verify); color: inherit; padding: 0 2px; border-radius: 2px; font-family: var(--mono); font-size: .8em; }
.watermark { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--danger); border: 1px solid var(--danger); padding: 6px 10px; border-radius: 4px; display: inline-block; margin-bottom: 22px; }
.approval { border-radius: var(--r); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 13.5px; }
.approval.no { background: var(--warn-soft); border: 1px solid var(--warn); }
.approval.yes { background: var(--accent-soft); border: 1px solid var(--accent); }
.editor { font: 14px/1.6 var(--mono); min-height: 60vh; }
.typing::after { content: "▍"; animation: pulse 1s steps(2) infinite; color: var(--accent); }

/* ---------- messages ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; display: flex; flex-direction: column; gap: 4px; }
.msg .bubble { padding: 10px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--accent-soft); border-color: transparent; }
.msg .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.msg .tr { font-size: 13px; color: var(--ink-2); border-left: 2px solid var(--line); padding-left: 8px; font-style: italic; }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 52px; }

/* ---------- activity ---------- */
.timeline { display: flex; flex-direction: column; border-left: 1px solid var(--line); margin-left: 6px; }
.timeline .ev { position: relative; padding: 0 0 14px 18px; font-size: 13.5px; }
.timeline .ev::before { content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline .ev time { display: block; font: 11.5px/1.4 var(--mono); color: var(--muted); }

/* ---------- leads ---------- */
.lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { border: 1px solid var(--line-2); border-radius: 7px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); }
.pill.fit-strong, .pill.fit-good { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.fit-possible { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.pill.fit-weak { border-style: dashed; color: var(--muted); }
.pill.fit-not_eligible { border-color: var(--danger); color: var(--danger); }

/* ---------- arguments & precedents ---------- */
.arg { border-top: 1px solid var(--line-2); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.arg p { font-size: 14px; color: var(--ink-2); }
.strategy { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.strategy p { font-size: 14px; }
.auths { display: flex; flex-wrap: wrap; gap: 6px; }
.auth { font: 500 11.5px/1.4 var(--mono); color: var(--accent); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; text-decoration: none; }
.auth:hover { border-color: var(--accent); }
.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- client portal ---------- */
.steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.step3 { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--ink); font-size: 13px; }
.step3 span:not(.n) { color: var(--muted); }
.step3 .n { width: 26px; height: 26px; border-radius: 50%; background: var(--firm, var(--accent)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 600 13px/1 var(--mono); margin-bottom: 4px; }
.step3.done .n::after { content: " ✓"; }
.step3:hover { border-color: var(--firm, var(--accent)); }
.tips { border-left: 4px solid var(--firm, var(--accent)); background: var(--surface); border-radius: 0 var(--r) var(--r) 0; padding: 12px 16px; font-size: 14px; }
.tips ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.portal { min-height: 100%; }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.portal-top .in { max-width: 980px; margin: 0 auto; padding: 12px 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.portal-top .firmname { font: 500 18px/1.2 var(--serif); display: flex; align-items: center; gap: 10px; }
.firm-chip { width: 12px; height: 28px; border-radius: 3px; background: var(--firm, var(--accent)); display: inline-block; }
.portal .page { max-width: 980px; }
.hello { display: flex; flex-direction: column; gap: 10px; }
.hello h1 { font-size: clamp(28px, 4vw, 38px); }
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.check .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px dashed var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--accent-ink); }
.check.got .box { background: var(--accent); border: 0; }
.check p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.powered { text-align: center; font: 11px/1.4 var(--mono); color: var(--muted); letter-spacing: .05em; padding: 20px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 16, 13, .5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cred { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font: 13px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- intake ---------- */
.intake { max-width: 720px; margin: 0 auto; padding: 36px 20px 64px; display: flex; flex-direction: column; gap: 22px; }
.intake-head { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--firm, var(--accent)); padding-left: 16px; }

@media (max-width: 980px) {
  .split, .drafts, .lead { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; }
  .rail .firm { display: none; }
  .rail nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .rail nav a { white-space: nowrap; }
  .rail .foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .rail .foot .who, .rail .foot .role { display: none; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 28px 20px; gap: 20px; }
  .login-brand .cites { display: none; }
  .page { padding: 20px 16px 48px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .checklist, .new-draft, .steps3 { grid-template-columns: minmax(0, 1fr); }
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .doc, .crit { grid-template-columns: minmax(0, 1fr); }
  .doc .side, .crit .side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .verdict { grid-template-columns: minmax(0, 1fr); }
  .msg { max-width: 92%; }
  h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Zion X Intelligence identity */
:root { --serif: var(--sans); --r: 12px; }
h1 { font-weight: 600; letter-spacing: -.035em; }
h2 { font-weight: 600; letter-spacing: -.02em; }
.brand-mark { font-family: var(--sans); }
.brand-mark > span { display: none; }
.brand-logo { display: block; width: 210px; height: 74px; object-fit: cover; background: #050505; border-radius: 7px; flex: none; }
.login-brand .brand-logo { width: 270px; height: 95px; }
.rail .brand-mark { margin: -6px -10px 12px; }
.rail .brand-logo { width: 210px; height: 72px; }
.login-brand { background: radial-gradient(ellipse at 70% 30%, #1c2535 0, #080b10 55%); }
.guilloche { display: none; }
.login-brand::after { content: ""; position: absolute; width: 620px; height: 1px; background: linear-gradient(90deg, transparent, #8c9db8, transparent); transform: rotate(-34deg); right: -160px; top: 39%; pointer-events: none; }
.login-brand h1 { max-width: 16ch; font-weight: 500; }
.login-form form { padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.rail nav a { border-radius: 8px; margin: 3px 0; }
.card { border-radius: 13px; }
.portal-top { background: #080b10; color: #e8edf7; border-bottom-color: #253043; }
.portal-top .muted { color: #a6b4c9; }
.portal-top .btn { color: #e8edf7; border-color: #384355; background: #151a24; }
@media(max-width:680px) { .login-brand .brand-logo { width: 225px; height: 80px; } .login-form form { padding: 23px; } }

.portal-top .brand-logo { width: 145px; height: 52px; }

/* Keep the supplied wordmark; render the subtitle as readable text. */
.zion-symbol { display: block; position: relative; width: 100%; aspect-ratio: 1510 / 310; overflow: hidden; }
.zion-symbol img { position: absolute; display: block; width: 117.4835%; max-width: none; height: auto; left: -11.9205%; top: -64.5161%; object-fit: initial; }
.zion-caption { display: block; color: #e4e8ef; text-align: center; font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: .28em; padding-left: .28em; margin-top: 7px; }

.brand-logo, .rail .brand-logo, .login-brand .brand-logo, .portal-top .brand-logo { height: auto; padding: 9px 6px; }
.login-brand .zion-caption { font-size: 14px; }
.portal-top .zion-caption { font-size: 10px; letter-spacing: .2em; }
@media(max-width:680px) { .login-brand .brand-logo { height: auto; } .login-brand .zion-caption { font-size: 12px; } }

.legal-notice { padding: 26px 32px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.8; }
.legal-notice h2 { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.legal-notice p { max-width: 1100px; margin: 0; }
#app:has(.shell) + .legal-notice { margin-left: 236px; }
@media(max-width:860px) { #app:has(.shell) + .legal-notice { margin-left: 0; } .legal-notice { padding: 24px 20px; } }
