/* Layout: app shell. Fixed left rail of modules, a top bar carrying client + framework version, a working canvas on the right. Collapses to a scrolling tab strip on phones. */
:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --sunk: #e4eae7;
  --ink: #13211c;
  --muted: #586a63;
  --line: #d3ddd8;
  --accent: #0b6b57;
  --accent-soft: #d6ece5;
  --on-accent: #ffffff;
  --rail: #0f2a23;
  --rail-ink: #cfe3dc;
  --rail-muted: #7fa197;
  --draft: #8a5a07;
  --draft-soft: #f8ebcf;
  --ok: #1d7a49;
  --ok-soft: #d8efe1;
  --warn: #a35f00;
  --warn-soft: #fbe8cc;
  --bad: #b02a22;
  --bad-soft: #f8dcd9;
  --na: #7b8a85;
  --na-soft: #e5ebe8;
  --font-display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Geeza Pro", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0d1412; --surface: #141d1a; --sunk: #1b2622; --ink: #e2ebe7; --muted: #94a69f; --line: #263530;
  --accent: #3fc29f; --accent-soft: #173b32; --on-accent: #062019; --rail: #08100e; --rail-ink: #cfe3dc; --rail-muted: #6f8f85;
  --draft: #e7b456; --draft-soft: #3a2c10; --ok: #55c98d; --ok-soft: #153526; --warn: #f0a640; --warn-soft: #3a2a10;
  --bad: #f07a71; --bad-soft: #3d1a17; --na: #8d9b96; --na-soft: #222c29; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0d1412; --surface: #141d1a; --sunk: #1b2622; --ink: #e2ebe7; --muted: #94a69f; --line: #263530;
  --accent: #3fc29f; --accent-soft: #173b32; --on-accent: #062019; --rail: #08100e; --rail-ink: #cfe3dc; --rail-muted: #6f8f85;
  --draft: #e7b456; --draft-soft: #3a2c10; --ok: #55c98d; --ok-soft: #153526; --warn: #f0a640; --warn-soft: #3a2a10;
  --bad: #f07a71; --bad-soft: #3d1a17; --na: #8d9b96; --na-soft: #222c29; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-body); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 500; }
.eyebrow { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.tabnum { font-variant-numeric: tabular-nums; }

/* Shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-ink); padding: 20px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 10px; padding: 0 8px; }
.brand b { font-family: var(--font-display); font-size: 1.25rem; color: #fff; font-weight: 700; }
.brand span { font-family: var(--font-ar); font-size: 1.05rem; color: var(--rail-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--rail-muted); padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--rail-ink); text-decoration: none; padding: 7px 10px; border-radius: var(--r); font-size: .9rem; }
.nav a .k { font-family: var(--font-mono); font-size: .7rem; color: var(--rail-muted); width: 18px; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a[aria-current="page"] { background: rgba(63,194,159,.16); color: #fff; }
.nav a[aria-current="page"] .k { color: #7fe0c4; }
.rail-foot { margin-top: auto; font-size: .75rem; color: var(--rail-muted); padding: 0 10px; line-height: 1.45; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.client { display: flex; flex-direction: column; min-width: 0; }
.client b { font-size: .95rem; }
.client small { color: var(--muted); font-size: .75rem; }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill.version { background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); font-weight: 500; }
.pill.sample { background: var(--sunk); color: var(--muted); border-color: var(--line); }
.pill.draft { background: var(--draft-soft); color: var(--draft); }
.pill.cond { background: var(--sunk); color: var(--ink); border-color: var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.partial { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.na { background: var(--na-soft); color: var(--na); }
.pill.pending { background: transparent; color: var(--accent); border-color: var(--accent); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: .78rem; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 9px; cursor: pointer; color: var(--muted); font-size: .8rem; }
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }

.page { padding-block: 26px 60px; padding-inline: 28px; display: flex; flex-direction: column; gap: 22px; max-width: 1280px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; justify-content: space-between; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 68ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--draft-soft); color: var(--ink); border-radius: var(--r); padding: 10px 14px; font-size: .85rem; }
.notice b { color: var(--draft); }
.notice > b { white-space: nowrap; }
td.mono, .chip.mono { white-space: nowrap; }
.notice.info { background: var(--accent-soft); }
.notice.info b { color: var(--accent); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-family: var(--font-display); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .v small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.kpi .l { color: var(--muted); font-size: .82rem; }

/* Bars */
.stack { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--sunk); }
.stack i { display: block; height: 100%; }
.c-ok { background: var(--ok); } .c-partial { background: var(--warn); } .c-bad { background: var(--bad); } .c-na { background: var(--na); opacity: .45; }
.domain-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 3.5rem; gap: 14px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.domain-row:first-child { border-top: 0; }
.domain-row .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--sunk); }
tr.selected td { background: var(--accent-soft); }

/* Library */
.lib { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select, .field select, .field input, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; min-width: 0; }
.filters input[type="search"] { flex: 1 1 100%; }
.filters select { flex: 1 1 140px; }
.ctl-list { max-height: 70vh; overflow-y: auto; margin-top: 12px; border-top: 1px solid var(--line); }
.sd-head { position: sticky; top: 0; background: var(--surface); padding: 10px 2px 6px; font-size: .78rem; font-weight: 600; color: var(--muted); display: flex; gap: 8px; border-bottom: 1px solid var(--line); z-index: 1; }
.sd-head .mono { color: var(--accent); }
.ctl-item { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.ctl-item:hover { background: var(--sunk); }
.ctl-item[aria-selected="true"] { background: var(--accent-soft); }
.ctl-item .mono { color: var(--accent); font-weight: 500; }
.ctl-item.sub .mono { padding-left: .8rem; color: var(--muted); }
.ctl-item .s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .84rem; }
.detail { display: flex; flex-direction: column; gap: 18px; }
.detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.detail-title .num { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 500; color: var(--accent); }
.crumbs { color: var(--muted); font-size: .84rem; }
.statement { font-size: 1.05rem; line-height: 1.55; max-width: 72ch; margin: 0; }
.label-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.official { border: 1px dashed var(--line); border-radius: var(--r); padding: 10px 14px; color: var(--muted); font-size: .85rem; }
.sec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.sec h3 { margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.sec h3 .tag { font-family: var(--font-body); font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sec ol, .sec ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--sunk); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; font-size: .8rem; }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--accent); color: var(--accent); }
.kv { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 6px 12px; font-size: .85rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Forms / scoping */
.q { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.q .src { font-size: .78rem; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; width: max-content; }
.seg button { border: 0; background: var(--surface); padding: 6px 16px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.btn { background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--r); padding: 8px 14px; cursor: pointer; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }

/* Document paper */
.doc-paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 28px 32px; max-width: 78ch; }
.doc-paper h2 { font-size: 1.4rem; margin-bottom: 4px; }
.doc-paper h4 { font-family: var(--font-display); font-size: 1rem; margin: 18px 0 6px; }
.doc-paper p, .doc-paper li { line-height: 1.6; }
.cite { font-family: var(--font-mono); font-size: .76rem; color: var(--accent); white-space: nowrap; }
.workflow { display: flex; flex-wrap: wrap; gap: 0; }
.workflow span { padding: 4px 12px; font-size: .78rem; border: 1px solid var(--line); margin-left: -1px; color: var(--muted); }
.workflow span.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.workflow span.done { color: var(--accent); }

.btn.sm { padding: 3px 9px; font-size: .76rem; font-weight: 500; }
.doc-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.doc-row.out { opacity: .6; }
.outline { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: .86rem; }
.outline li.h2 { margin-left: 1.1rem; color: var(--muted); }
.doc-mini { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; font-size: .86rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }

/* Playbook */
.step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 7px 0; align-items: start; }
.step input { margin-top: 4px; accent-color: var(--accent); }
.step.done label { color: var(--muted); text-decoration: line-through; }
.phase { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 10px; }

/* Matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.cell { display: inline-grid; place-items: center; min-width: 2rem; height: 1.7rem; border-radius: 4px; font-variant-numeric: tabular-nums; font-size: .8rem; border: 1px dashed var(--line); background: none; cursor: pointer; }
.cell.has { border-style: solid; border-color: var(--draft); color: var(--draft); background: var(--draft-soft); }
.cell.zero { color: var(--line); cursor: default; }

/* Audit */
.log { font-family: var(--font-mono); font-size: .8rem; }
.log td { white-space: nowrap; }
.log td.what { white-space: normal; font-family: var(--font-body); font-size: .85rem; }

.drawer { border-left: 3px solid var(--accent); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); font-size: .85rem; z-index: 20; }

@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: minmax(0, 1fr); }
  .lib { grid-template-columns: minmax(0, 1fr); }
  .ctl-list { max-height: 46vh; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; padding: 12px 16px; gap: 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav-group, .rail-foot { display: none; }
  .nav a { white-space: nowrap; }
  .topbar { padding: 10px 16px; position: static; }
  .page { padding-inline: 16px; }
  .g2, .sec-grid { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .domain-row { grid-template-columns: minmax(0, 1fr) 3rem; }
  .domain-row .stack { grid-column: 1 / -1; grid-row: 2; }
  .doc-paper { padding: 18px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) { .page { animation: rise .18s ease-out; } }
@keyframes rise { from { transform: translateY(4px); } to { transform: none; } }

/* v0.3 additions: scoping workspace, applicability decisions, multi-framework views */
.scope-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.side { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 12px; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stages button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 6px 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stages button small { color: var(--muted); font-size: .72rem; }
.stages button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.stages button.done small { color: var(--ok); }
.q-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.q-head b { max-width: 70ch; }
.req { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--draft); font-weight: 600; }
.feeds { display: flex; flex-wrap: wrap; gap: 4px; }
.feeds span { font-size: .7rem; font-family: var(--font-mono); color: var(--muted); background: var(--sunk); border-radius: 3px; padding: 0 5px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .82rem; cursor: pointer; background: var(--surface); }
.opts label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opts input { accent-color: var(--accent); margin: 0; }
.seg button[data-v="unknown"][aria-pressed="true"] { background: var(--draft); color: var(--on-accent); }
.q input[type="text"], .q input[type="number"], .q input[type="date"], .q textarea, .q select { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; width: 100%; max-width: 46rem; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.item-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px 12px; }
.item-fields .field input, .item-fields .field select { width: 100%; }
.crit { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 6px 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.crit .field { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.crit select { width: auto; flex: none; }
.fw-live { display: flex; flex-direction: column; gap: 0; }
.fw-live div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .84rem; align-items: center; }
.fw-live div:first-child { border-top: 0; }
.fw-live small { grid-column: 1 / -1; color: var(--muted); font-size: .74rem; }
.fw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.fw-card { display: flex; flex-direction: column; gap: 10px; }
.fw-card.off { opacity: .72; }
.fw-card p { margin: 0; font-size: .85rem; }
.fw-card .why { color: var(--muted); font-size: .8rem; }
.decide { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg button[data-d="include"][aria-pressed="true"] { background: var(--ok); color: var(--on-accent); }
.seg button[data-d="exclude"][aria-pressed="true"] { background: var(--bad); color: var(--on-accent); }
.seg button[data-d="defer"][aria-pressed="true"] { background: var(--draft); color: var(--on-accent); }
.notice.stale { background: var(--warn-soft); }
.notice.stale b { color: var(--warn); }
.notice .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.notice > span { min-width: 0; }
.fw-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.fw-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: .82rem; font-family: var(--font-mono); }
.fw-tabs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.fw-tabs button.dim { color: var(--muted); }
.cov-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 6.5rem; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.cov-row:first-child { border-top: 0; }
.cov-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.flow .panel { display: flex; flex-direction: column; gap: 8px; }
.flow .num { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; }
.lvl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.lvl div { border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-size: .78rem; text-align: center; }
.lvl div.on { border-color: var(--accent); background: var(--accent-soft); }
.copybox { width: 100%; min-height: 8rem; font-family: var(--font-mono); font-size: .76rem; }
@media (max-width: 1080px) { .scope-grid { grid-template-columns: minmax(0, 1fr); } .side { position: static; } .flow { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .cov-row { grid-template-columns: minmax(0, 1fr) 5.5rem; } .cov-row .stack { grid-column: 1 / -1; grid-row: 2; } .lvl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ---- Server edition additions ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--rail); padding: 20px; }
.login { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login .brand b { color: var(--ink); }
.login input { width: 100%; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px 16px; }
.form .field input, .form .field select, .form .field textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; color: var(--ink); }
.form .wide { grid-column: 1 / -1; }
.err { color: var(--bad); font-size: .85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stage-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .82rem; }
.stage-nav a .n { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
.stage-nav a.done .n { color: var(--ok); }
.stage-nav a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stage-nav a[aria-current="page"] .n { color: var(--on-accent); }
.qs { font-size: .8rem; color: var(--muted); margin: 4px 0 0; max-width: 80ch; }
select.inline, input.inline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; font-size: .82rem; max-width: 100%; color: var(--ink); }
td .inline { width: 100%; }
.ctl-row td { font-size: .84rem; }
.ctl-row .stmt { max-width: 46ch; }
.sug { background: var(--accent-soft); border-radius: var(--r); padding: 8px 10px; font-size: .8rem; margin-top: 6px; }
.sug q { font-style: italic; }
.md { white-space: pre-wrap; font-size: .86rem; line-height: 1.55; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; padding: 20px 22px; width: min(820px, 100%); max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.progress-line { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bigscore { font-family: var(--font-display); font-size: 3rem; font-weight: 700; line-height: 1; }
.stage-list { display: flex; flex-direction: column; }
.stage-list div { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: center; font-size: .86rem; }
.stage-list div:first-child { border-top: 0; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat .msg { padding: 10px 14px; border-radius: var(--r); max-width: 90ch; }
.chat .msg.user { background: var(--accent-soft); align-self: flex-end; }
.chat .msg.ai { background: var(--sunk); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: .82rem; color: var(--muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
