/* Layout: header bar, then a two-column workbench (step rail | working sheet). Sheet sections read like a filled-in assessment form. */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #e8ecf1;
  --ink: #131922;
  --ink-2: #455060;
  --ink-3: #657083;
  --line: #d2d9e1;
  --line-strong: #aab4c0;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f7;
  --hl: #c4530c;
  --hl-ink: #ffffff;
  --hl-soft: #fdeee3;
  --low: #0ca30c;
  --med: #fab219;
  --high: #d03b3b;
  --na: #8e98a5;
  --low-text: #0a6b0a;
  --med-text: #8a5a00;
  --high-text: #a82828;
  --chip-ink: #131922;
  --seq-1: #cde2fb; --seq-2: #b7d3f6; --seq-3: #9ec5f4; --seq-4: #6da7ec; --seq-5: #5598e7;
  --seq-6: #3987e5; --seq-7: #256abf; --seq-8: #184f95; --seq-9: #0d366b;
  --seq-ink-lo: #0b1a33; --seq-ink-hi: #ffffff;
  --font-display: "IBM Plex Sans Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 6px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #171e27; --surface-2: #1f2833; --ink: #e6ebf1; --ink-2: #aab4c1; --ink-3: #8794a3;
    --line: #2c3745; --line-strong: #46536380; --accent: #5598e7; --accent-ink: #08111f; --accent-soft: #1a2d47; --hl: #f28a3c; --hl-ink: #1a0c02; --hl-soft: #3a2414;
    --low-text: #4fd04f; --med-text: #fac04a; --high-text: #f07a7a; --na: #6f7a88;
    --seq-1: #142a47; --seq-2: #183a66; --seq-3: #184f95; --seq-4: #1c5cab; --seq-5: #256abf;
    --seq-6: #3987e5; --seq-7: #5598e7; --seq-8: #86b6ef; --seq-9: #b7d3f6;
    --seq-ink-lo: #e6ebf1; --seq-ink-hi: #08111f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #171e27; --surface-2: #1f2833; --ink: #e6ebf1; --ink-2: #aab4c1; --ink-3: #8794a3;
  --line: #2c3745; --line-strong: #46536380; --accent: #5598e7; --accent-ink: #08111f; --accent-soft: #1a2d47; --hl: #f28a3c; --hl-ink: #1a0c02; --hl-soft: #3a2414;
  --low-text: #4fd04f; --med-text: #fac04a; --high-text: #f07a7a; --na: #6f7a88;
  --seq-1: #142a47; --seq-2: #183a66; --seq-3: #184f95; --seq-4: #1c5cab; --seq-5: #256abf;
  --seq-6: #3987e5; --seq-7: #5598e7; --seq-8: #86b6ef; --seq-9: #b7d3f6;
  --seq-ink-lo: #e6ebf1; --seq-ink-hi: #08111f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); }
body { margin: 0; font: 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 0.85rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.prose { max-width: 66ch; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Header */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 10px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.brand b { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.brand .tag { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 3px; white-space: normal; max-width: 100%; }
.topbar .tech { color: var(--ink-2); font-size: 0.9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 160px; }
.topbar .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.saved { font-size: 0.78rem; color: var(--ink-3); }

.btn { text-decoration: none; display: inline-block; border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: var(--radius); cursor: pointer; font-size: 0.88rem; line-height: 1.3; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.next { background: var(--hl); color: var(--hl-ink); border-color: var(--hl); font-weight: 600; }
.btn.next:hover { filter: brightness(1.08); border-color: var(--hl); }
.btn.next::after { content: " \2192"; }
.btn.hl { background: var(--hl); color: var(--hl-ink); border-color: var(--hl); font-weight: 600; }
.btn.hl:hover { filter: brightness(1.08); border-color: var(--hl); }
.rail-glossary a .n { font-weight: 700; }
.gl-letters { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.9rem; }
.glossary { margin: 0; display: flex; flex-direction: column; }
.gl-item { padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.gl-item dt { font-weight: 600; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gl-item dd { margin: 4px 0 0; color: var(--ink-2); max-width: 72ch; }
.about { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--hl); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.about h2 { font-size: 1.9rem; }
.about .lede { font-size: 1.04rem; line-height: 1.65; color: var(--ink); }
.about-cols { display: flex; flex-direction: column; gap: 12px; }
.dcode { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.tip { position: fixed; z-index: 30; max-width: min(340px, calc(100vw - 16px)); background: var(--ink); color: var(--bg); padding: 9px 11px; border-radius: 6px; font: 0.82rem/1.45 var(--font-body); pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 3px; }
.tip[hidden] { display: none; }
.tip b { font-weight: 600; }
.tip em { font-style: normal; opacity: 0.75; font-size: 0.76rem; font-family: var(--font-mono); }
.about .credit { font-size: 0.85rem; color: var(--ink-3); }
.about .credit b { color: var(--hl); font-weight: 600; }
.about .eyebrow { color: var(--hl); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 6px; }
.btn.danger { color: var(--high-text); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.big { padding: 10px 16px; font-size: 0.95rem; }

.banner { background: var(--accent-soft); border-bottom: 1px solid var(--line); padding-block: 8px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.banner b { font-weight: 600; }

/* Workbench */
.bench { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; max-width: 1240px; margin: 0 auto;
  padding-block: 28px 48px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); align-self: start; }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--line); }
.rail a { display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; padding: 9px 10px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--ink-2); }
.rail a .n { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); grid-row: span 2; padding-top: 2px; }
.rail a .t { font-weight: 600; color: var(--ink); }
.rail a .s { font-size: 0.78rem; color: var(--ink-3); }
.rail a[aria-current="step"] { border-left-color: var(--hl); background: var(--hl-soft); }
.rail a[aria-current="step"] .n, .rail a[aria-current="step"] .t { color: var(--hl); }
.rail a:hover .t { color: var(--accent); }
.sheet { min-width: 0; }
.sheet-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel.tight { padding: 14px 16px; }
.section-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 0.9rem; }
.hint { font-size: 0.82rem; color: var(--ink-3); }
input[type="text"], input[type="date"], input[type="url"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in oklab, var(--accent) 35%, transparent); outline-offset: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }

/* Rating chips (status: always letter + color) */
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; border: 1px solid var(--line-strong); color: var(--ink-3); background: var(--surface); white-space: nowrap; }
.chip.L { background: var(--low); border-color: var(--low); color: #ffffff; }
.chip.M { background: var(--med); border-color: var(--med); color: #1d1500; }
.chip.H { background: var(--high); border-color: var(--high); color: #ffffff; }
.chip.NA { background: var(--surface-2); border-color: var(--na); color: var(--ink-2); }
.warn-dot { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--med); color: #1d1500; font: 700 0.72rem/18px var(--font-mono); justify-content: center; flex: none; }
.tag-real, .tag-ill { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.tag-real { border-color: var(--accent); color: var(--accent); }

/* Scope step */
.intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
.steps-list { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.steps-list b { color: var(--ink); }
.note { border-left: 3px solid var(--line-strong); padding: 4px 0 4px 12px; color: var(--ink-2); font-size: 0.88rem; }

/* Rate step */
.rate { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; }
.dimlist { display: flex; flex-direction: column; gap: 14px; }
.dimlist .grp-name { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.dimlist button { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 0.88rem; color: var(--ink-2); }
.dimlist button .code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); }
.dimlist button .nm { line-height: 1.3; }
.dimlist button:hover { background: var(--surface-2); }
.dimlist button[aria-current="true"] { background: var(--hl-soft); box-shadow: inset 3px 0 0 var(--hl), inset 0 0 0 1px var(--hl); color: var(--ink); font-weight: 600; }
.dimlist button[aria-current="true"] .code { color: var(--hl); }
.dimlist .marks { display: inline-flex; gap: 4px; align-items: center; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }

.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.level { text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 0; cursor: pointer; display: flex; flex-direction: column; overflow: hidden; }
.level .lh { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.level .lb { padding: 10px 12px 12px; font-size: 0.86rem; color: var(--ink-2); line-height: 1.45; }
.level:hover { border-color: var(--ink-3); }
.level[aria-pressed="true"].L { border: 2px solid var(--low); background: color-mix(in oklab, var(--low) 9%, var(--surface)); }
.level[aria-pressed="true"].M { border: 2px solid var(--med); background: color-mix(in oklab, var(--med) 12%, var(--surface)); }
.level[aria-pressed="true"].H { border: 2px solid var(--high); background: color-mix(in oklab, var(--high) 9%, var(--surface)); }
.level[aria-pressed="true"] .lb { color: var(--ink); }
.na-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qlist { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
.tiers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tier { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 8px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tier .tn { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); }
.tier .tl { font-size: 0.84rem; font-weight: 600; line-height: 1.25; }
.tier[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.tier[aria-pressed="true"] .tn { color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 0.88rem; background: var(--surface-2); }
.check.ok { background: color-mix(in oklab, var(--low) 12%, var(--surface)); }
.check.warn { background: color-mix(in oklab, var(--med) 18%, var(--surface)); }
.check .ic { font-family: var(--font-mono); font-weight: 700; }
.nav-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Score step */
.scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.3fr); gap: 16px; }
.score { display: flex; flex-direction: column; gap: 4px; }
.score .num { font-family: var(--font-display); font-weight: 700; font-size: 4rem; line-height: 0.95; font-variant-numeric: tabular-nums; }
.score .of { font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink-3); }
.band { font-weight: 600; }
.counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.counts div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.counts .v { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; }
.profile { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.profile .area h4 { font-size: 0.92rem; margin-bottom: 6px; }
.tiles { display: flex; flex-direction: column; gap: 4px; }
.tile { display: grid; grid-template-columns: 6px 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 6px 8px 6px 0; font-size: 0.84rem; cursor: pointer; text-align: left; overflow: hidden; }
.tile .bar { align-self: stretch; margin: -6px 0; background: var(--line); }
.tile.L .bar { background: var(--low); } .tile.M .bar { background: var(--med); } .tile.H .bar { background: var(--high); } .tile.NA .bar { background: var(--na); }
.tile .nm { line-height: 1.3; }
.tile:hover { border-color: var(--accent); }
.vizwrap { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 24px; align-items: start; }
.heat { overflow-x: auto; }
.heat svg { display: block; max-width: none; }
.heat text { font-family: var(--font-mono); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; color: var(--ink-2); align-items: center; }
.legend svg { vertical-align: middle; }
.flaglist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.flaglist li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; }
.flaglist li > :last-child { min-width: 0; }
.what-if { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.what-if li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: 0.9rem; }
.what-if .to { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }

/* Resolve step */
.focus-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 10px 4px 5px; cursor: pointer; font-size: 0.86rem; }
.pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.tension { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.quote { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.worsen-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.wbtn { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 0.84rem; }
.wbtn .code { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.wbtn.mapped { border-style: solid; border-color: var(--accent); }
.wbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wbtn[aria-pressed="true"] .code { color: var(--accent-ink); }
.pair { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.pair-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 600; }
.arrow { font-family: var(--font-mono); color: var(--ink-3); }
.plist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plist label { display: grid; grid-template-columns: 18px 34px minmax(0, 1fr); gap: 8px; align-items: start; cursor: pointer; font-size: 0.9rem; }
.plist input { margin-top: 3px; }
.plist .pn { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); padding-top: 2px; }
.plist .pq b { font-weight: 600; }
.example { font-size: 0.86rem; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
details[open] summary { margin-bottom: 8px; }

/* Plan step */
.plan-card { display: flex; flex-direction: column; gap: 14px; }
.move-quote { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; color: var(--ink-2); font-size: 0.92rem; white-space: pre-wrap; }
.export { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.export .btn { width: 100%; }
.export .what { font-size: 0.82rem; color: var(--ink-3); margin-top: 6px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); font-size: 0.9rem; z-index: 20; max-width: calc(100% - 32px); }

.foot { max-width: 1240px; margin: 0 auto; padding-block: 0 32px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); font-size: 0.8rem; color: var(--ink-3); display: flex; flex-direction: column; gap: 6px; }
.foot-line { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot-line a, .foot-p a { white-space: nowrap; }
.foot-p { margin: 0; max-width: 110ch; }

@media (max-width: 980px) {
  .bench { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 16px; }
  .rail { position: static; }
  .rail ol { flex-direction: row; overflow-x: auto; border-left: 0; border-bottom: 2px solid var(--line); gap: 0; }
  .rail a { margin-left: 0; margin-bottom: -2px; border-left: 0; border-bottom: 2px solid transparent; grid-template-columns: auto auto; white-space: nowrap; padding: 8px 12px; }
  .rail a .n { grid-row: auto; }
  .rail a .s { display: none; }
  .rail a[aria-current="step"] { border-bottom-color: var(--hl); background: var(--hl-soft); }
  .rate { grid-template-columns: minmax(0, 1fr); }
  .dimlist { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .dimlist .grp { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .dimlist .grp-name { width: 100%; margin: 0; }
  .dimlist button { grid-template-columns: auto auto; width: auto; padding: 4px 6px; border: 1px solid var(--line); background: var(--surface); }
  .dimlist button .nm { display: none; }
  .scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scores > :last-child { grid-column: span 2; }
  .profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vizwrap { grid-template-columns: minmax(0, 1fr); }
  .intro { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  h2 { font-size: 1.45rem; }
  .grid-2, .grid-3, .levels, .tension, .export { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile { grid-template-columns: minmax(0, 1fr); }
  .scores { grid-template-columns: minmax(0, 1fr); }
  .scores > :last-child { grid-column: auto; }
  .score .num { font-size: 3.2rem; }
  .counts .v { font-size: 1.15rem; }
  .panel { padding: 16px; }
  .topbar .tech { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* TRIZ additions: staged worksheet, contradiction statement, matrix */
.stage { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
.stage-n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font: 600 0.78rem/1 var(--font-mono); color: var(--ink-3); margin-top: 1px; }
.stmt { font-size: 1rem; line-height: 1.5; padding: 10px 12px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.stmt-action { font-weight: 600; color: var(--accent); }
textarea.short { min-height: 60px; }
.sw { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 20px; padding: 0 4px; border: 1px solid var(--line-strong); border-radius: 2px; font: 0.7rem var(--font-mono); vertical-align: middle; margin-right: 4px; color: var(--ink); }
.mx-wrap { overflow-x: auto; padding-bottom: 4px; }
.mx { display: block; max-width: none; }
.mx text { font-family: var(--font-mono); }
.mx-cell { cursor: pointer; }
.mx-cell:hover rect { stroke: var(--accent); stroke-width: 2; }
.mx-detail { border-top: 1px solid var(--line); padding-top: 16px; }
.mx-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.mx-pick .field { flex: 1 1 220px; }
.mx-pick .arrow { padding-bottom: 10px; }
.mx-detail .plist label { grid-template-columns: 0 34px minmax(0, 1fr); cursor: default; }
.idea { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: start; }
.idea .pn { color: var(--accent); font-size: 0.8rem; padding-top: 6px; }
@media (max-width: 640px) { .stage { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* Multi-paradigm: provenance chips, lenses, onramp */
.srcs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.srcs-l { font-size: 0.75rem; color: var(--ink-3); }
.src { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.lenses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lens { border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.lens h4 { font-size: 1.05rem; }
.lens .src { align-self: flex-start; }
.tiny { font-size: 0.72rem; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trackbtn { text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.trackbtn[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.onramp { border-left: 3px solid var(--accent); }
.rail-extra { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }

/* Business model */
.bm-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.block-tag { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.bm-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-family: var(--font-mono); text-decoration: underline; cursor: pointer; }
.stat { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--ink-3); }
.stat.u { background: color-mix(in oklab, var(--med) 22%, var(--surface)); border-color: var(--med); color: var(--med-text); }
.stat.s { background: color-mix(in oklab, var(--low) 14%, var(--surface)); border-color: var(--low); color: var(--low-text); }
.stat.m { background: var(--surface-2); color: var(--ink-2); }
.stat.c { background: color-mix(in oklab, var(--high) 14%, var(--surface)); border-color: var(--high); color: var(--high-text); }
.margin { font-size: 0.95rem; }
.margin .neg { color: var(--high-text); }
.tablewrap { overflow-x: auto; }
table.xw { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
table.xw th, table.xw td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.xw th { font-weight: 600; background: var(--surface-2); }
details.panel > summary { font-weight: 600; }

/* Evidence: severity, stance, interview links */
.sev { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap; flex: none; border: 1px solid; }
.sev.c { background: var(--high); border-color: var(--high); color: #fff; }
.sev.u { background: var(--med); border-color: var(--med); color: #1d1500; }
.sev.i { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.stance { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; padding: 1px 6px; border-radius: 3px; border: 1px solid; white-space: nowrap; flex: none; }
.stance.s { border-color: var(--low); color: var(--low-text); }
.stance.c { border-color: var(--high); color: var(--high-text); }
.stance.m { border-color: var(--line-strong); color: var(--ink-2); }
.ivmini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.ivmini li { display: flex; gap: 8px; align-items: baseline; }
.ivmini li > span:last-child { min-width: 0; }
.bignum { font-size: 3rem; font-weight: 600; line-height: 1; }
.target { display: flex; flex-direction: column; gap: 4px; }
.target .row { justify-content: space-between; }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 2.2rem; gap: 8px; align-items: center; font-size: 0.84rem; }
.bar-row .bl { overflow-wrap: anywhere; }
.bar-row .bt { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-row .bt i { display: block; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; }
.bar-row .bn { text-align: right; }
.covgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.covcol { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cov { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-size: 0.8rem; background: var(--surface); }
.cov .cov-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.cov .cov-n { font-size: 0.75rem; color: var(--ink-2); }
.cov.gap { border: 2px solid var(--med); }
.cov.dim { opacity: 0.55; }
.ivlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ivrow { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 12px; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ivlinks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.iv-edit { border: 2px solid var(--accent); border-radius: var(--radius); padding: 14px; background: var(--bg); }
.lgrid { display: flex; flex-direction: column; gap: 6px; }
.lrow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lrow-n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); width: 2rem; }
.lchip { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; padding: 3px 7px; font: 0.78rem var(--font-mono); cursor: pointer; color: var(--ink-2); }
.lchip.static { cursor: default; }
.lchip.from { outline: 2px dashed var(--accent); outline-offset: 1px; }
.lchip.s { border-color: var(--low); background: color-mix(in oklab, var(--low) 14%, var(--surface)); color: var(--low-text); }
.lchip.c { border-color: var(--high); background: color-mix(in oklab, var(--high) 14%, var(--surface)); color: var(--high-text); }
.lchip.m { border-color: var(--ink-3); background: var(--surface-2); color: var(--ink); }
.lst { font-weight: 700; }
#imp-text { min-height: 110px; font-family: var(--font-mono); font-size: 0.8rem; }

@media (max-width: 980px) {
  .lenses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .covgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rail-extra { margin-top: 0; border-top: 0; padding-top: 0; border-left: 1px dashed var(--line); }
}
@media (max-width: 640px) {
  .lenses, .track { grid-template-columns: minmax(0, 1fr); }
  .covgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ivrow { grid-template-columns: minmax(0, 1fr) auto; }
  .ivrow > :first-child { grid-column: span 2; }
  .bar-row { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) 2rem; }
}
@media (max-width: 1440px) { .topbar .tech { display: none; } }

.gterm { color: inherit; text-decoration: underline dotted var(--hl); text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: help; }
a.gterm:hover, span.gterm:hover { color: var(--hl); }
.gl-item.flash { background: var(--hl-soft); box-shadow: inset 3px 0 0 var(--hl); padding-left: 10px; transition: background 1s; }

/* ---------- v0.2 ---------- */
.panel.tint-yellow { background: rgba(176, 128, 0, 0.14); border-color: rgba(176, 128, 0, 0.5); }
.panel.tint-red { background: rgba(170, 30, 30, 0.12); border-color: rgba(170, 30, 30, 0.45); }
.tint-yellow .what-if li { border-bottom-color: rgba(176, 128, 0, 0.35); }
textarea.bmta { min-height: 128px; }
textarea::placeholder { color: var(--ink-3); opacity: 0.85; }
.econ { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.margin p { margin: 0 0 4px; }
.win-presets { display: inline-flex; flex-wrap: wrap; gap: 2px; }
@media (max-width: 980px) { .econ { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .econ { grid-template-columns: minmax(0, 1fr); } }

/* ---------- v0.3 ---------- */
.grow { flex: 1 1 auto; }
.rail-compare a .n { font-weight: 700; }
.comp-list { display: flex; flex-direction: column; gap: 12px; }
.comp-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; background: var(--surface-2); }
.comp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 28px; }
.guide { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.guide h3 { margin-bottom: 2px; }
.guide h4 { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.gclaim { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin-top: 6px; text-transform: none; }
.gq { padding-left: 12px; border-left: 3px solid var(--hl); }
.gq p { margin: 0 0 2px; }
.delta { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 3px; margin-left: 4px; }
.delta.up { background: color-mix(in oklab, var(--low) 18%, var(--surface)); color: var(--ink); }
.delta.down { background: color-mix(in oklab, var(--high) 18%, var(--surface)); color: var(--ink); }
#mentor-q { min-height: 110px; }
.lchip.sel { border-color: var(--hl); background: var(--hl-soft); color: var(--ink); font-weight: 600; }
.newin { border-left: 3px solid var(--hl); background: var(--hl-soft); padding: 14px 20px; border-radius: 0 var(--radius) var(--radius) 0; }
.newin ul { margin: 8px 0 0; padding-left: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 36px; font-size: 0.92rem; }
.newin li.wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .newin ul { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Cohort View ---------- */
.cv-main { max-width: 1240px; margin: 0 auto; padding: 24px var(--gutter-r) 40px var(--gutter-l); display: flex; flex-direction: column; gap: 24px; }
.cv-intro h2 { margin: 0; }
.cv-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 22px 16px; text-align: center; color: var(--ink-2); cursor: pointer; background: var(--surface); }
.cv-drop:hover, .cv-drop.over, .cv-drop:focus-visible { border-color: var(--hl); background: var(--hl-soft); color: var(--ink); }
.cv-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cv-chartwrap { max-width: 760px; }
.cv-chart { width: 100%; height: auto; display: block; }
.cv-chart .cv-band { fill: var(--surface-2); }
.cv-chart .cv-band.b1 { fill: transparent; }
.cv-chart .cv-bandl { font: 600 11px var(--font-mono); fill: var(--ink-3); }
.cv-chart .cv-grid { stroke: var(--line); stroke-width: 1; }
.cv-chart .cv-diag { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.cv-chart .cv-tick { font: 11px var(--font-mono); fill: var(--ink-3); }
.cv-chart .cv-axis { font: 12px var(--font-body); fill: var(--ink-2); }
.cv-chart .cv-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; cursor: default; }
.cv-chart .cv-adj { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.cv-chart .cv-link { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 2 3; }
.cv-chart .cv-lab { font: 600 12px var(--font-body); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.cv-grid-t td, .cv-grid-t th { white-space: nowrap; }
.cv-grid-t .cv-cell { text-align: center; }
.cv-grid-t .cv-th { text-align: center; }
.cv-grid-t tr.shared td { background: var(--hl-soft); }
.cv-grid-t tr.shared td:first-child { box-shadow: inset 3px 0 0 var(--hl); }
.cv-grid-t sup { color: var(--ink-3); }
.cv-q { white-space: pre-line; }
@media (max-width: 980px) { .cv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cv-tiles > :last-child { grid-column: auto; } }
@media (max-width: 640px) { .cv-main { padding-top: 16px; } }
.gfield { max-width: 520px; }
.cv-chartwrap { overflow-x: auto; }
.cv-chart { min-width: 560px; }
.newin li.wide a { white-space: nowrap; }
.how > summary { cursor: pointer; list-style-position: outside; }
.how > summary h3 { display: inline; }
.how-list { margin: 14px 0 6px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; max-width: 80ch; }
.how-faq { margin-top: 10px; }
.how-faq h4 { margin-bottom: 4px; }
.credit-tiny { font-size: 0.74rem; color: var(--ink-3); margin: -12px 0 0; }
.credit-tiny a { color: inherit; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn svg { flex: none; }
.brand-home { color: inherit; text-decoration: none; }
.brand-home:hover b { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- logo ---------- */
:root { --logo-ink: var(--ink); --logo-blue: var(--accent); --logo-orange: var(--hl); --logo-surface: var(--surface); --logo-line: var(--line); --logo-soft: var(--accent-soft); --logo-muted: var(--ink-3); }
.brand { align-items: center; }
.brand-mark { width: 30px; height: 30px; flex: none; display: block; }
.brand-name { display: inline-flex; align-items: center; gap: 9px; }

/* ---------- v0.4: market sizing ---------- */
.badge-rec { display: inline-block; font: 600 0.72rem/1 var(--font-body); background: var(--hl); color: var(--hl-ink); padding: 4px 8px; border-radius: 999px; margin-right: 8px; vertical-align: middle; }
.mkt-why { background: var(--hl-soft); border-left: 3px solid var(--hl); padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; }
.mkt-why ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.mkt-base { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 0.6fr); gap: 12px; }
.mkt-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mkt-rings { display: flex; flex-direction: column; gap: 10px; }
.ring { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.ring-tam { border-left-color: color-mix(in oklab, var(--accent) 40%, var(--surface)); }
.ring-sam { border-left-color: var(--accent); }
.ring-som { border-left-color: var(--hl); }
.ring-top { border-left-color: var(--line-strong); border-style: dashed; border-left-style: solid; }
.ring-h b { font-family: var(--font-mono); margin-right: 4px; }
.ring-in { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.9fr); gap: 10px; align-items: end; }
.ring-v { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.ring-v b { font-size: 0.95rem; }
.mkt-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 80px; }
.mkt-viz { width: 100%; height: auto; display: block; }
.mkt-viz .mv-l { font: 600 12px var(--font-mono); fill: var(--ink-3); }
.mkt-viz .mv-v { font: 700 14px var(--font-body); fill: var(--ink); }
.sev.ok { background: color-mix(in oklab, var(--low) 16%, var(--surface)); color: var(--ink); }
.mkt-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mkt-mini div { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 1100px) { .mkt-grid { grid-template-columns: minmax(0, 1fr); } .mkt-side { position: static; } .mkt-viz { max-width: 380px; } }
@media (max-width: 700px) { .mkt-base { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ring-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .mkt-mini { grid-template-columns: minmax(0, 1fr); } }
.brand b.wrap-title { white-space: normal; }
