/* Prototype styles. Tokens follow the UI/UX design document, section 4.3. */
:root {
  --surface: #FFFFFF; --surface-2: #F1F2F4; --text: #1F2A37; --muted: #5B6775; --line: #C9CDD3;
  --accent: #0B5C7A; --accent-soft: #E3EEF2; --s1: #2A78D6; --s2: #EB6834;
  --crit: #B3261E; --crit-soft: #FDECEC; --warn: #8A5A00; --warn-soft: #FFF4D6; --ok: #EEF5EE;
  --sample: #7A5B00; --sample-bg: #FFF4D6; --sample-line: #E3C36B;
  --radius: 8px; --max: 1200px;
  color-scheme: light;
}
/* Light is the default; dark only when the viewer picks it with the toggle. */
:root[data-theme="dark"] {
  --surface: #1A1A19; --surface-2: #262624; --text: #F0EFEC; --muted: #C3C2B7; --line: #45443F;
  --accent: #5AA9C4; --accent-soft: #1E3540; --s1: #3987E5; --s2: #D95926;
  --crit: #E66767; --crit-soft: #3A1F1E; --warn: #FAB219; --warn-soft: #3A2F14; --ok: #1F3320;
  --sample: #FAD77A; --sample-bg: #3A2F14; --sample-line: #7A5B00;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--text);
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.num, td.num, .pct b { font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }

/* sample banner */
.sample-bar { background: var(--sample-bg); color: var(--sample); border-bottom: 1px solid var(--sample-line);
  font-size: 13px; font-weight: 600; text-align: center; padding: 6px 16px; }

/* header */
header.site { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
header.site .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; white-space: nowrap; }
/* every menu item always visible: one row on wide screens, wrapped rows below 1200 px (no hidden sideways scroll) */
nav.main { display: flex; flex-wrap: wrap; gap: 0 2px; flex: 1; }
nav.main a { color: var(--text); text-decoration: none; font-size: 14px; padding: 18px 7px 16px; white-space: nowrap;
  border-bottom: 3px solid transparent; }
nav.main a[aria-current="page"] { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; flex: 0 0 160px; min-width: 0; }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; width: 100%; }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px;
  padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.menu-btn { display: none; }
@media (max-width: 1200px) {
  header.site .wrap { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  nav.main { order: 3; flex-basis: 100%; }
  nav.main a { padding: 8px 8px; }
  .search { flex: 1; min-width: 0; }
}
@media (max-width: 600px) {
  .brand { flex: 1; }
  .search { order: 4; flex-basis: 100%; }
}

/* page frame */
main { padding: 24px 0 48px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 21px; margin: 36px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 8px; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 760px; }
.meta { color: var(--muted); font-size: 13px; }
.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)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } h1 { font-size: 25px; } }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.card.soft { background: var(--surface-2); }
.card h3 { margin-top: 0; }
.stat b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 36px 0 10px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.section-head a:hover, .section-head a:focus-visible { text-decoration: underline; }

/* tags, badges, states */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: 999px; border: 1.5px solid var(--text); white-space: nowrap; vertical-align: middle; }
.badge.m { background: var(--text); color: var(--surface); }
.badge.m::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); }
.badge.p::before { content: ""; width: 7px; height: 9px; border: 1.5px solid currentColor; border-radius: 1px; }
.badge.s { border-style: dashed; } .badge.s::before { content: "↑"; }
.badge.r { border-color: var(--line); color: var(--muted); background: var(--surface-2); }
.badge.r::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.sample { border: 1px dashed var(--sample-line); color: var(--sample); background: var(--sample-bg); }
.tag.group-m { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.state { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; border: 1px solid; }
.state.disputed { color: var(--crit); border-color: var(--crit); background: var(--crit-soft); }
.state.disputed::before { content: "! "; }
.state.stale { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.state.stale::before { content: "⧗ "; }
.state.corrected { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.state.corrected::before { content: "✎ "; }
.state.notyet { color: var(--muted); border-color: var(--line); background: var(--surface-2); }
.state.notyet::before { content: "○ "; }

/* tables */
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); font-size: 13px; position: sticky; top: 0; }
th small, td small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.diff { box-shadow: inset 3px 0 0 var(--accent); }

/* chart frame */
.chart-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0 20px; }
.chart-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.chart-head h3 { margin: 0 0 2px; }
.chart { width: 100%; height: 380px; margin-top: 10px; }
.chart.short { height: 260px; } .chart.tall { height: 460px; }
.chart-foot { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; color: var(--muted); }
details.as-table summary { cursor: pointer; font-size: 14px; color: var(--accent); margin: 8px 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* filter bar, tabs, buttons, forms */
.filters { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0 14px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); font-weight: 600; }
.filters label { color: var(--muted); font-size: 13px; }
select, input[type=text], input[type=email], input[type=number], textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 10px; }
.btn { display: inline-block; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--surface); text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.form-row { display: grid; gap: 6px; margin-bottom: 14px; max-width: 560px; }
.form-row label { font-weight: 600; font-size: 14px; }
.note { border-left: 4px solid var(--sample-line); background: var(--sample-bg); padding: 10px 14px; border-radius: 4px;
  font-size: 14px; margin: 12px 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.pct { display: flex; gap: 22px; flex-wrap: wrap; }
.pct div span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.pct div b { font-size: 24px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cols { columns: 3 220px; }
.diff-old { background: var(--crit-soft); text-decoration: line-through; }
.diff-new { background: var(--ok); }
code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* footer */
footer.site { border-top: 1px solid var(--line); background: var(--surface-2); padding: 22px 0 30px; font-size: 13px; color: var(--muted); }
footer.site .links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
