/* Kimma platform demo. Design note: follows docs/design/DESIGN.md ("The Quiet Ledger").
   Tokens: white page and cards, #ECECEE hairlines, #FAFAFA wells, ink #0A0A0A, zinc text
   #3F3F46 / #52525B / #71717A; one violet #6E4FF5 (links #5B3CE0) for focus, selection,
   Kimma's own marks and single-series bars. Status = tinted chip + icon + word. Primary = black.
   Type: Geist 11 to 26px (h1 24/600, section 15/600, body 14, UI 13/500, labels 12); Geist Mono
   only for Lean, code, ids and digests; tabular figures everywhere. Radii 8 / 10 / 14 / 999.
   +-------------------------------------------------------------------------------------+
   | 56px top bar: logo Kimma | NA Northwind Analytics       Demo badge  Presenter  Spec |
   +------------+--------------------------------------------------+---------------------+
   | 216px nav  | main 20px / 32px: h1 + subtitle        [primary] | spec panel, 400px   |
   | steps 1..7 | StatCards, sections, tables, agent viewports     | completeness bar    |
   |            | detail panels inline (no modals)                 | rule rows + chips   |
   +------------+--------------------------------------------------+---------------------+
   The one bold element: the docked spec panel. Rules stream in with the violet cursor and
   gain their method and verification chips. Motion lives only in the fast-forward runs. */

:root {
  --bg: #ffffff; --well: #fafafa; --hover: #f4f4f5; --selected: #f7f5ff;
  --line: #ececee; --line-control: #e4e4e7; --line-hover: #d4d4d8; --divider: #f1f1f3;
  --ink: #0a0a0a; --ink-hover: #27272a; --strong: #3f3f46; --secondary: #52525b;
  --muted: #71717a; --faint: #a1a1aa;
  --violet: #6e4ff5; --violet-600: #5b3ce0; --violet-700: #4b2fd0;
  --violet-50: #efebff; --violet-100: #e4ddfd; --violet-200: #c7bbfb; --violet-300: #a796f9;
  --green-bg: #e8f7ee; --green-fg: #1a7f45; --amber-bg: #fff4e0; --amber-fg: #9a5b00;
  --blue-bg: #eaf2ff; --blue-fg: #2357c5; --red-bg: #fdecec; --red-fg: #b42318;
  --zinc-bg: #f4f4f5; --zinc-fg: #52525b;
  --r-control: 8px; --r-row: 10px; --r-card: 14px;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* exponential ease-out */
  --panel-w: 400px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font: 400 14px/1.5 var(--sans); color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  caret-color: var(--violet); overflow: hidden;
}
button, input, select { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
button { cursor: pointer; }
code, pre, .mono { font-family: var(--mono); font-variant-ligatures: none; font-variant-numeric: tabular-nums; }
::selection { background: var(--violet-100); color: var(--ink); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
a { color: var(--violet-600); text-underline-offset: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-hover) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-hover); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.app { display: grid; height: 100dvh; grid-template-rows: 56px minmax(0, 1fr);
  grid-template-columns: 216px minmax(0, 1fr) var(--panel-w); }
.app.panel-closed { grid-template-columns: 216px minmax(0, 1fr) 0; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.logo { width: 24px; height: 24px; border-radius: 8px; background: var(--violet); display: grid; place-items: center; flex: none; }
.logo svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.wordmark { font-size: 17px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.vdiv { width: 1px; height: 20px; background: var(--line); }
.company { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--strong); white-space: nowrap; }
.company .badge { width: 22px; height: 22px; border-radius: 5px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.crumb { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .grow { flex: 1; }
.demo-badge { height: 24px; display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--line-hover); border-radius: var(--r-control); font-size: 12px; font-weight: 500; color: var(--secondary); white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.btn-spec { height: 36px; border-radius: 999px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: #fff; border: 0; font-size: 13px; font-weight: 500; transition: background-color 150ms, color 150ms, transform 150ms; }
.btn-spec:hover { background: var(--ink-hover); }
.btn-spec[aria-expanded="true"] { background: var(--violet-50); color: var(--violet-700); }
.btn-spec[aria-expanded="true"]:hover { background: var(--violet-100); }
.btn-spec:active { transform: scale(0.97); }
.btn-spec .num { font-weight: 600; }

/* presenter menu (a popover, not a modal) */
.pmenu { position: relative; }
.pmenu > summary { list-style: none; }
.pmenu > summary::-webkit-details-marker { display: none; }
.pmenu .pop { position: absolute; right: 0; top: 42px; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; z-index: 30; }
.pop h3 { font-size: 13px; font-weight: 600; margin: 14px 0 8px; }
.pop h3:first-child { margin-top: 0; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: 12px; color: var(--secondary); margin: 0; }
.keys dt { color: var(--ink); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-control); border-radius: 5px; background: var(--well); color: var(--strong); }

/* nav */
.nav { border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.nav .glabel { font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 10px 6px; }
.nav ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nitem { width: 100%; height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--r-control); color: var(--secondary); font-size: 14px; font-weight: 500; text-align: left; transition: background-color 150ms, color 150ms; }
.nitem:hover { background: var(--hover); color: var(--ink); }
.nitem[aria-current="page"] { background: var(--hover); color: var(--ink); font-weight: 600; }
.nitem[aria-disabled="true"] { height: 32px; font-size: 13px; color: var(--muted); cursor: not-allowed; }
.nitem[aria-disabled="true"]:hover { background: transparent; color: var(--strong); }
.nitem .lock { margin-left: auto; width: 12px; height: 12px; color: var(--faint); }
.stepno { width: 18px; height: 18px; border-radius: 999px; border: 1px solid var(--line-hover); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--secondary); flex: none; }
.nitem[aria-current="page"] .stepno { background: var(--ink); border-color: var(--ink); color: #fff; }
.nitem[aria-disabled="true"] .stepno { color: var(--faint); border-color: var(--line-control); }
.stepno.done { border-color: var(--green-bg); background: var(--green-bg); color: var(--green-fg); }
.stepno.done svg { width: 11px; height: 11px; stroke-width: 2.6; }
.nav .foot { margin-top: auto; border-top: 1px solid var(--divider); padding: 12px 10px 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.nav .foot b { display: block; color: var(--strong); font-weight: 500; }

/* main */
.main { overflow-y: auto; min-width: 0; padding: 20px 32px 40px; container-type: inline-size; scroll-behavior: smooth; }
.phead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; margin-bottom: 18px; }
.phead .titles { flex: 1 1 360px; min-width: 0; }
.phead h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 2px 0 6px; }
.phead p { margin: 0; font-size: 14px; color: var(--muted); max-width: 72ch; }
.phead .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statusline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--strong); margin: -6px 0 18px; min-height: 22px; }
.statusline svg { width: 16px; height: 16px; }
.statusline.ok svg { color: var(--green-fg); }
.statusline.busy { color: var(--violet-600); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row2 { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row2 > .grow { flex: 999 1 420px; min-width: 0; }
.row2 > .side { flex: 1 1 300px; max-width: 360px; min-width: 0; }
@container (max-width: 760px) { .row2 > .side { max-width: none; } }

/* buttons */
.btn { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color 150ms, border-color 150ms, color 150ms, transform 150ms; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); }
.btn-ghost { background: #fff; border-color: var(--line-control); color: var(--ink); padding: 0 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--hover); border-color: var(--line-hover); }
.btn svg { width: 14px; height: 14px; }
.btn.busy { opacity: 1; cursor: progress; }
.ibtn { width: 30px; height: 30px; border-radius: var(--r-control); border: 0; background: transparent; color: var(--secondary); display: inline-grid; place-items: center; transition: background-color 150ms; }
.ibtn:hover { background: var(--hover); }
.link { background: none; border: 0; padding: 0; color: var(--violet-600); font-size: 13px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--violet-200); text-underline-offset: 3px; transition: text-decoration-color 150ms; }
.link:hover { text-decoration-color: var(--violet); }

/* pills (radiogroup) */
.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-control); background: #fff; color: var(--strong); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background-color 150ms, border-color 150ms, color 150ms; }
.pill:hover { background: var(--hover); border-color: var(--line-hover); }
.pill[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill .cnt { color: var(--faint); }
.pill .rec { color: var(--muted); }
.pill[aria-checked="true"] .rec { color: var(--line-hover); }
.pill[aria-checked="true"] .cnt { color: var(--line-hover); }
.pills.sm .pill { height: 28px; padding: 0 10px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-control); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; transition: background-color 150ms, color 150ms; }
.chip svg { width: 12px; height: 12px; stroke-width: 2.2; }
.t-green { background: var(--green-bg); color: var(--green-fg); }
.t-amber { background: var(--amber-bg); color: var(--amber-fg); }
.t-blue { background: var(--blue-bg); color: var(--blue-fg); }
.t-violet { background: var(--violet-50); color: var(--violet-600); }
.t-red { background: var(--red-bg); color: var(--red-fg); }
.t-zinc { background: var(--zinc-bg); color: var(--zinc-fg); }
.meth { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--secondary); white-space: nowrap; }
.meth svg { width: 12px; height: 12px; stroke-width: 2; }
.meth.bad { color: var(--red-fg); }
.spin { animation: spin 0.8s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; max-width: 72ch; }
.muted { color: var(--muted); }
.sec-note { margin-top: 12px; }

/* sections and stat cards */
.sec { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; min-width: 0; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.3; }
.sec-head .aside { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sec p.body code, p.body code { overflow-wrap: anywhere; }
.sec p.body { margin: 0 0 12px; color: var(--strong); max-width: 72ch; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container (min-width: 42rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; min-width: 0; }
.stat .top-row { display: flex; align-items: center; gap: 8px; }
.stat .iframe { width: 26px; height: 26px; border-radius: var(--r-control); border: 1px solid var(--line-control); display: grid; place-items: center; color: var(--strong); flex: none; }
.stat .iframe svg { width: 14px; height: 14px; }
.stat .lbl { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .val { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.stat .num { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.nbadge { font-size: 11px; font-weight: 500; color: var(--violet-600); background: var(--violet-50); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }

/* definition lists */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 14px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.subsec { border-top: 1px solid var(--divider); padding-top: 14px; margin-top: 14px; }
.subsec h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }

/* option rows (radio) */
.opts { display: flex; flex-direction: column; gap: 4px; }
.opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line-control); border-radius: var(--r-row); background: #fff; transition: background-color 150ms, border-color 150ms, box-shadow 150ms; }
.opt:hover:not([aria-disabled="true"]) { background: var(--well); border-color: var(--line-hover); }
.opt[aria-checked="true"] { background: var(--selected); border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-50); }
.opt[aria-disabled="true"] { cursor: not-allowed; color: var(--muted); background: #fff; }
.opt .radio { width: 16px; height: 16px; border-radius: 999px; border: 1.5px solid var(--line-hover); flex: none; margin-top: 2px; display: grid; place-items: center; background: #fff; }
.opt[aria-checked="true"] .radio { border-color: var(--violet); }
.opt[aria-checked="true"] .radio::after { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--violet); }
.opt .otext { flex: 1; min-width: 0; }
.opt .otitle { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.opt .odesc { font-size: 13px; color: var(--secondary); margin-top: 2px; max-width: 72ch; }
.opt[aria-disabled="true"] .odesc, .opt[aria-disabled="true"] .otitle { color: var(--muted); }
.sysmark { width: 22px; height: 22px; border-radius: 5px; background: var(--hover); color: var(--strong); font-size: 10px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.opts.inline { flex-direction: row; flex-wrap: wrap; }
.opts.inline .opt { width: auto; flex: 1 1 260px; }

/* inputs (read-only fields) */
.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; align-items: center; }
.fields label { font-size: 13px; color: var(--secondary); }
.field { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-control); border-radius: var(--r-control); background: #fff; font-size: 14px; min-width: 0; max-width: 520px; }
.field .mono { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field .after { margin-left: auto; }

/* tables */
.tbl { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: #fff; }
.tbl .scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--well); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 11px 14px; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--divider); font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
td.num, th.num { text-align: right; }
td.sec2 { color: var(--secondary); }
tbody tr { transition: background-color 150ms; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--well); }
tbody tr[aria-selected="true"] { background: var(--selected); }
.rowbtn { background: none; border: 0; padding: 0; text-align: left; font-weight: 500; font-size: 14px; color: var(--ink); }
.rid { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 8px; }
@container (max-width: 820px) { .hide-sm { display: none; } }

/* empty state */
.empty { border: 1px dashed var(--line-control); border-radius: var(--r-card); padding: 24px 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* code (Lean, diffs) */
.code { background: var(--well); border: 1px solid var(--line); border-radius: var(--r-card); padding: 10px 0; font: 400 12px/1.7 var(--mono); overflow-x: auto; color: var(--strong); }
.code .ln { display: grid; grid-template-columns: 48px 16px max-content; padding-right: 14px; white-space: pre; }
.code.plain { padding: 12px 14px; white-space: pre; }
.code .no { color: var(--faint); text-align: right; padding-right: 10px; user-select: none; }
.code .sg { color: var(--muted); user-select: none; }
.code .add { background: var(--green-bg); }
.code .add .sg, .code .add .no { color: var(--green-fg); }
.code .del { background: var(--red-bg); }
.code .del .sg, .code .del .no { color: var(--red-fg); }
.code .hunk { color: var(--muted); padding: 2px 14px; white-space: pre; }
.tk-kw { color: var(--violet-600); }
.tk-st { color: var(--green-fg); }
.tk-cm { color: var(--muted); }
.tk-ct { color: var(--blue-fg); }

/* agent viewports */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@container (max-width: 1100px) { .mapgrid { grid-template-columns: minmax(0, 1fr); } }
.vps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vp { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: #fff; min-width: 0; }
.vp-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; min-width: 0; }
.vp-head .who { font-size: 13px; font-weight: 500; white-space: nowrap; }
.vp-head .user { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vp-head .chip { margin-left: auto; }
.vp-url { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; background: var(--well); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 400 12px/1 var(--mono); color: var(--secondary); white-space: nowrap; overflow: hidden; }
.vp-url svg { width: 12px; height: 12px; color: var(--muted); }
.vp-url span { overflow: hidden; text-overflow: ellipsis; }
.vp-screen { position: relative; aspect-ratio: 900 / 562; background: var(--well); overflow: hidden; }
.vp-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 260ms var(--ease); }
.vp-screen img.on { opacity: 1; }
.vp-screen .ptr { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 999px; border: 2px solid var(--violet); background: var(--violet-50); transition: left 420ms var(--ease), top 420ms var(--ease), opacity 200ms; pointer-events: none; }
.vp-screen.idle .ptr { opacity: 0; }
.vp-cap { padding: 8px 12px; font-size: 13px; color: var(--strong); border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-cap .count { color: var(--muted); }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: grid; grid-template-columns: 44px 20px minmax(0, 1fr); gap: 8px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--divider); font-size: 13px; color: var(--strong); line-height: 1.45; }
.feed li:last-child { border-bottom: 0; }
.feed .ts { font-size: 12px; color: var(--muted); padding-top: 1px; }
.feed .avatar.sm { margin-top: 0; }
.feed .k { background: var(--ink); }

/* experiment */
.hyp { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--divider); font-size: 14px; }
.hyp .letter { width: 22px; height: 22px; border-radius: 5px; background: var(--hover); font-size: 12px; font-weight: 600; display: grid; place-items: center; color: var(--strong); }
.hyp.out { color: var(--muted); }
.hyp.out .txt { text-decoration: line-through; text-decoration-color: var(--faint); }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--secondary); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li svg { width: 14px; height: 14px; }
.steps li.done svg { color: var(--green-fg); }
.steps li.run { color: var(--violet-600); }
.steps li.wait svg { color: var(--faint); }

/* bars */
.bar { height: 8px; background: var(--hover); border-radius: var(--r-control); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--violet); border-radius: var(--r-control); transition: width 500ms var(--ease); }
.barrow { display: grid; grid-template-columns: 140px minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.barrow .lbl { font-weight: 500; color: var(--strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barrow .track { height: 24px; background: var(--hover); border-radius: var(--r-control); overflow: hidden; }
.barrow .track i { display: block; height: 100%; width: 0; background: var(--violet); border-radius: var(--r-control); transition: width 500ms var(--ease); }
.barrow .v { font-weight: 600; text-align: right; white-space: nowrap; }
.barrow .v small { font-weight: 400; color: var(--muted); font-size: 13px; }

/* spec panel */
.spec { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fff; overflow: hidden; }
.app.panel-closed .spec { display: none; }
.spec-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.spec-head .t { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.spec-head .ctx { font-size: 12px; color: var(--muted); }
.spec-head .ibtn { margin-left: auto; }
.gauge { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.gauge .g-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.gauge .g-lbl { font-size: 13px; font-weight: 500; color: var(--strong); }
.gauge .g-val { font-size: 13px; font-weight: 600; }
.segs { display: flex; gap: 2px; height: 8px; }
.seg { background: var(--hover); border-radius: 3px; overflow: hidden; }
.seg i { display: block; height: 100%; width: 0; background: var(--violet); transition: width 500ms var(--ease); }
.gauge .note { margin-top: 8px; }
.rules { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scroll-behavior: smooth; }
.rgroup { margin-top: 12px; }
.rgroup .glabel { font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 6px 4px; display: flex; justify-content: space-between; }
.rule { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 6px 9px; border-radius: var(--r-row); transition: background-color 150ms; }
.rule:hover { background: var(--well); }
.rule[aria-current="true"] { background: var(--selected); }
.rule .rline { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px; }
.rule .rid { margin: 1px 0 0; }
.rule .rtext { font-size: 13px; line-height: 1.45; color: var(--ink); }
.rule .rtext.struck { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.rule .rwas { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rule .rchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 0 34px; }
.rule .rchips .cnt { font-size: 12px; color: var(--muted); }
.cursor { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: var(--violet); margin-left: 3px; vertical-align: 1px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.spec .empty { margin: 16px 6px; }
.spec-foot { border-top: 1px solid var(--line); padding: 10px 16px; font-size: 12px; color: var(--muted); }

/* question blocks */
.q .qtitle { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.q .ev { margin: 4px 0 12px; font-size: 14px; color: var(--secondary); max-width: 72ch; }
.q .by { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--secondary); margin-top: 10px; }
.callout { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: var(--r-row); background: var(--red-bg); color: var(--red-fg); font-size: 14px; max-width: 80ch; }
.callout svg { width: 16px; height: 16px; margin-top: 2px; stroke-width: 2.2; }
.callout.ok { background: var(--green-bg); color: var(--green-fg); }
.callout.warn { background: var(--amber-bg); color: var(--amber-fg); }
.callout b { font-weight: 600; }

/* rule detail */
.rhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.rstate { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; margin: 8px 0 10px; max-width: 64ch; }
.shot { border: 1px solid var(--line); border-radius: var(--r-row); overflow: hidden; background: var(--well); }
.shot img { display: block; width: 100%; height: auto; }
.shot .cap { font-size: 12px; color: var(--muted); padding: 8px 10px; border-top: 1px solid var(--line); background: #fff; }
.digest { display: inline-flex; align-items: center; gap: 2px; }
.digest code { font-size: 12px; }
.digest .ibtn { width: 26px; height: 26px; }
.digest .ibtn svg { width: 13px; height: 13px; }

/* risks */
.risk + .risk { border-top: 1px solid var(--divider); margin-top: 18px; padding-top: 18px; }
.risk .rtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
.risk dl.kv { margin-bottom: 12px; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--divider); align-items: start; }
.plan-list li:first-child { border-top: 0; padding-top: 0; }
.plan-list .pt { font-size: 14px; font-weight: 500; }
.plan-list .pd { font-size: 13px; color: var(--secondary); max-width: 72ch; }
.plan-list svg { width: 16px; height: 16px; color: var(--strong); margin-top: 2px; }
.patch + .patch { margin-top: 18px; }
.patch .ph { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.patch .ph .pt { font-size: 14px; font-weight: 500; }
.patch .ph code { font-size: 12px; color: var(--muted); }

/* go-live */
.signed { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--secondary); }

/* overlay panel below 1280px */
@media (max-width: 1279px) {
  .app, .app.panel-closed { grid-template-columns: 216px minmax(0, 1fr) 0; }
  .spec { position: fixed; top: 56px; right: 0; bottom: 0; width: min(400px, calc(100vw - 48px)); z-index: 20; box-shadow: -12px 0 32px rgba(10, 10, 10, 0.10); }
  .crumb { display: none; }
}
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px auto minmax(0, 1fr); }
  .nav { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; }
  .nav ol { flex-direction: row; }
  .nav .foot, .nav .glabel, .demo-badge { display: none; }
  .main { padding: 20px 16px 40px; }
}

/* Reduced motion: no tweening; the fast-forward steps through its states (see app.js). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .spin, .cursor { animation: none !important; }
}
