:root {
  --fg: #1d2330;
  --muted: #5f6b7a;
  --bg: #f6f7f9;
  --card: #fff;
  --line: #dde1e7;
  --accent: #1f5fbf;
  --bad: #b3261e;
  --bad-bg: #fde8e7;
  --ok: #1b7a3d;
  --ok-bg: #e5f4ea;
  --warn-bg: #fff4d6;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; padding-bottom: 4.5rem; }
h1 { font-size: 2rem; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.4rem; margin: 1rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
h4 { margin: 1rem 0 .25rem; font-size: .95rem; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: #eef1f5; padding: 0 .25em; border-radius: 3px; }
button { font: inherit; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
select, input[type=number] { font: inherit; padding: .2rem .3rem; }
input[type=number] { width: 6rem; }
textarea { width: 100%; font: 13px ui-monospace, monospace; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; }

.banner { background: var(--warn-bg); border-bottom: 1px solid #ecd48a; padding: .4rem 1rem; font-weight: 600; text-align: center; }
.top { display: flex; gap: 1rem; align-items: baseline; padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: .9em; }

#stepper ol { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: .5rem 1.5rem; background: #fff; border-bottom: 1px solid var(--line); }
#stepper a { display: block; padding: .3rem .7rem; border-radius: 999px; color: var(--muted); text-decoration: none; }
#stepper a[aria-current=step] { background: var(--accent); color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: .5rem 1.5rem 2rem; }
.navbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.5rem; background: #fff; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: .75rem 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.grid3 .card { margin: 0; }
.lede { font-size: 1.1rem; max-width: 60rem; }
.big { font-size: 1.8rem; font-weight: 700; margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; border: 1px solid; white-space: nowrap; vertical-align: middle; }
.b-rep { color: #7a4b00; border-color: #d9a441; background: #fff6e0; }
.b-ill { color: #6a1b9a; border-color: #b58ad0; background: #f6ecfb; }
.b-cls { color: #005a70; border-color: #5fb3c8; background: #e6f6fa; }
.b-ext { color: #3b4a5c; border-color: #9aa8b8; background: #eef2f6; }
.b-rul { color: #1b5e20; border-color: #74b27a; background: #eaf6eb; }
.cite { font: 11.5px ui-monospace, monospace; color: #34495e; background: #eef1f5; border-radius: 3px; padding: 0 .3em; white-space: nowrap; }
mark { background: #ffe58a; padding: 0 1px; }
mark.illus { background: #f0dcfa; outline: 1px dashed #9c5ec2; }

.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: .75rem; }
.doc { margin: 0; }
.doc header { margin-bottom: .2rem; }
.docid { display: inline-block; min-width: 2.2rem; font-weight: 700; color: var(--accent); }
.meta, .note { font-size: .85rem; color: var(--muted); margin: .2rem 0; }
.prov { margin: .3rem 0; }
pre.raw { white-space: pre-wrap; font: 12px/1.45 ui-monospace, monospace; background: #fbfaf5; border: 1px solid #ece8d8; padding: .5rem; border-radius: 4px; margin: .4rem 0; }

.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.tbl thead th { background: #f0f2f5; font-size: .85rem; }
.kv { border-collapse: collapse; font-size: .88rem; width: 100%; }
.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: .1rem .5rem .1rem 0; width: 45%; vertical-align: top; }
.kv td { padding: .1rem 0; }
.kw { font: 11.5px ui-monospace, monospace; background: #ffe58a; border-radius: 3px; padding: 0 .25em; }
.kw-header { outline: 2px solid #e0b400; }
td.ok, span.ok { color: var(--ok); font-weight: 700; }
td.bad, span.bad { color: var(--bad); font-weight: 700; }
.matrix td.bad { background: var(--bad-bg); }
.matrix td.copy { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.05) 6px 8px); font-style: italic; }
.matrix td.empty { background: #fafbfc; }
.swatch { display: inline-block; width: 1em; height: 1em; vertical-align: middle; border: 1px solid var(--line); }
.swatch.bad { background: var(--bad-bg); }
.swatch.copy { background-image: repeating-linear-gradient(45deg, #fff 0 3px, #ccc 3px 4px); }
.scroll { overflow-x: auto; }
.callout { border-left: 4px solid var(--bad); background: var(--bad-bg); padding: .7rem 1rem; margin: 1rem 0; border-radius: 0 6px 6px 0; }

.tabs, .summary { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.tabs button[aria-selected=true], .segsum[aria-pressed=true] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip { display: inline-block; font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 4px; }
.st-GAP { background: var(--bad-bg); color: var(--bad); }
.st-TVC_COMPLETE { background: var(--ok-bg); color: var(--ok); }
.st-OUT_OF_SCOPE { background: #eceff3; color: #4a5563; }
.chip.whatif { background: #ffe9c7; color: #8a5300; }
.pill { display: inline-block; font-size: .82rem; padding: .05rem .5rem; border: 1px solid var(--line); border-radius: 999px; margin-left: .3rem; }
.pill.on { border-color: var(--bad); color: var(--bad); }
.status-line { margin: .8rem 0; }
.decide { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr); gap: 1rem; }
.decide > .card { margin: 0; }
.what-if { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .5rem; background: #f7f8fa; border-radius: 6px; }
.flags li { color: var(--bad); }
.trail td { font-size: .82rem; }
.methods li { margin: .25rem 0; }
details summary { cursor: pointer; }
.report ul { margin: 0; padding-left: 1.1rem; }
.report-head h2 { margin-bottom: .2rem; }
.print-only { display: none; }

/* minmax(0, …) so the evidence-trail table can't widen the stacked column past the viewport. */
@media (max-width: 800px) { .decide { grid-template-columns: minmax(0, 1fr); } }

/* Phone. Screen-only so the print layout is untouched. */
@media screen and (max-width: 700px) {
  :root { font-size: 16px; }
  body { padding-bottom: 5rem; }
  code, .badge, .cite, .kw { font-size: 13px; }
  pre.raw { font-size: 14px; }
  textarea { font-size: 16px; }
  pre, code, textarea { max-width: 100%; overflow-wrap: anywhere; }
  img, svg, video { max-width: 100%; height: auto; }

  .top { flex-wrap: wrap; gap: .1rem .75rem; padding: .5rem 1rem; }
  #stepper ol { gap: 0; padding: .25rem 1rem; }
  #stepper a { display: flex; align-items: center; min-height: 44px; padding: 0 .6rem; }
  main { padding: .5rem 1rem 2rem; }
  .navbar { padding: .5rem 1rem; }

  button, select, input[type=number] { min-height: 44px; }
  .what-if label { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; }
  input[type=checkbox] { width: 1.25rem; height: 1.25rem; margin: 0; }
  details summary { min-height: 44px; padding: .5rem 0; }

  .grid3, .docs { grid-template-columns: minmax(0, 1fr); }
  /* Wide data tables scroll inside themselves instead of the page. The matrix already sits in .scroll. */
  .tbl:not(.matrix) { display: block; overflow-x: auto; }
}

@media print {
  @page { size: landscape; margin: 12mm; }
  :root { font-size: 10.5pt; background: #fff; }
  body { padding: 0; }
  .no-print, .navbar, #stepper, .top { display: none !important; }
  .print-only { display: block !important; }
  .banner { border: 1px solid #999; }
  .tbl { font-size: 9pt; }
  .tbl tr { break-inside: avoid; }
  .badge, .chip, .cite, .matrix td.bad { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
