:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #15181d; --muted: #5d6573; --line: #dfe3e8;
  --accent: #0a64c2; --accent-text: #ffffff;
  --bad: #d92d20; --bad-bg: #fdecea; --warn: #b54708; --warn-bg: #fff4e5;
  --ok: #067647; --ok-bg: #e9f7ef; --info: #475467; --info-bg: #eef1f5;
  --series-1: #2a78d6;  /* dashboard bars: one series, one colour (dataviz slot 1, validated on #fff) */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216; --card: #191c22; --text: #e8ebf0; --muted: #a0a8b6; --line: #2b3039;
    --accent: #4f9cf0; --accent-text: #0b1220;
    --bad: #ff6b5f; --bad-bg: #3a1714; --warn: #f5a524; --warn-bg: #36260c;
    --ok: #3ccf8e; --ok-bg: #0f2b1f; --info: #b4bcc8; --info-bg: #222730;
    --series-1: #3987e5;  /* validated on #191c22 */
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 0; }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.sub, .muted, .hint { color: var(--muted); }
.sub { margin: 2px 0 0; }
.hint { margin: -4px 0 12px; font-size: 0.93rem; }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button { font: inherit; border-radius: 8px; padding: 10px 18px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: transparent; }
progress { width: 100%; height: 8px; margin-top: 12px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { padding: 14px; text-align: left; }
.seg button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg b { display: block; }
.field { display: grid; gap: 4px; margin-top: 12px; }
.field span { font-size: 0.9rem; color: var(--muted); }
select { font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--info-bg); color: var(--info); border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot { position: relative; border: 1.5px dashed var(--line); border-radius: 10px; aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; text-align: center; cursor: pointer; background: var(--bg); }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .lab { position: relative; z-index: 1; padding: 6px; font-weight: 600; }
.slot.has { border-style: solid; }
.slot.has .lab { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 0.85rem; }
.slot .x { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 0 8px; background: rgba(0, 0, 0, 0.6); color: #fff; border: 0; border-radius: 6px; }
.slot.err { border-color: var(--bad); }
.lights { margin-top: 14px; }
.lights summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

.verdict { display: grid; gap: 10px; }
.verdict .big { font-size: 1.25rem; font-weight: 700; }
.tally { display: flex; gap: 8px; flex-wrap: wrap; }
.tally span { border-radius: 8px; padding: 4px 10px; font-weight: 600; font-size: 0.92rem; }
.t-bad { background: var(--bad-bg); color: var(--bad); }
.t-warn { background: var(--warn-bg); color: var(--warn); }
.t-ok { background: var(--ok-bg); color: var(--ok); }
.t-info { background: var(--info-bg); color: var(--info); }

.group h3 { font-size: 0.95rem; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.group:first-child h3 { margin-top: 0; }
.item { display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; padding: 8px; border-radius: 8px; cursor: default; }
.item[data-photo] { cursor: pointer; }
.item[data-photo]:hover { background: var(--bg); }
.item .ic { grid-row: span 2; font-size: 1.1rem; line-height: 1.4; }
.item .nm { font-weight: 600; }
.item .tx { color: var(--muted); font-size: 0.92rem; }
.item.bad .nm { color: var(--bad); }
.item.warn .nm { color: var(--warn); }
details.more summary { cursor: pointer; color: var(--muted); margin-top: 10px; }

.photo { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 16px 0; }
.photo h3 { margin: 0 0 8px; font-size: 1rem; }
.photo canvas { width: 100%; height: auto; display: block; border-radius: 8px; }
.photo .note { margin: 8px 0 0; }
.photo.flash { outline: 3px solid var(--accent); }
.foot { padding: 8px 16px 32px; font-size: 0.85rem; }

/* step 5.4: sample cars and the SIMULATED label */
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sample { position: relative; display: grid; gap: 2px; padding: 0 0 10px; text-align: left; overflow: hidden; }
.sample img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; margin-bottom: 6px; background: var(--bg); }
.sample b, .sample .muted { padding: 0 10px; }
.sample .muted { font-size: 0.85rem; }
.sample.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tag { position: absolute; top: 6px; left: 6px; border-radius: 6px; padding: 1px 7px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.03em; }
.tag-sim { background: #b41414; color: #fff; }
.tag-real { background: rgba(0, 0, 0, 0.62); color: #fff; }
.sim-word { background: #b41414; color: #fff; border-radius: 5px; padding: 0 6px; font-size: 0.85em; letter-spacing: 0.03em; }
.sample-note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; background: var(--info-bg); }
.sample-note.sim { border-color: #b41414; background: var(--bad-bg); }
.sample-note p { margin: 0; }
.credits { margin: 6px 0 0; padding-left: 18px; font-size: 0.82rem; color: var(--muted); }
.credits a { color: inherit; }
.sim-banner { border-radius: 8px; padding: 8px 10px; background: var(--bad-bg); }

/* step 5.3: dashboard */
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.nav-link { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav-link:hover { text-decoration: underline; }
.dash-tools { margin-bottom: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile-label { color: var(--muted); font-size: 0.88rem; }
.tile-value { font-size: 1.8rem; font-weight: 650; line-height: 1.25; }
.tile-sub { font-size: 0.85rem; }
.dash-sim { margin: 12px 0 0; }
.dash-h { font-size: 0.95rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; gap: 10px; align-items: center; padding: 2px 4px; border-radius: 6px; }
.bar-row:hover, .bar-row:focus-visible { background: var(--bg); outline: none; }
.bar-name { font-size: 0.92rem; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar { height: 14px; min-width: 4px; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-row:hover .bar, .bar-row:focus-visible .bar { opacity: 0.85; }
.bar-val { font-weight: 600; font-size: 0.92rem; }
.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dash-table td:first-child { white-space: nowrap; }
.dash-table .nr { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-table .t-bad, .dash-table .t-warn, .dash-table .t-ok { border-radius: 6px; padding: 1px 6px; font-weight: 600; white-space: nowrap; }

@media (max-width: 520px) {
  .seg { grid-template-columns: 1fr 1fr; }
  .slots { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 1.5rem; }
  .bar-row { grid-template-columns: 1fr; gap: 2px; }
}

/* credits page (app/credits.html, written by scripts/build_site.mjs) */
.doc a { color: var(--accent); }
.doc ul, .doc ol { margin: 0; padding-left: 20px; }
.credit-list li { margin: 5px 0; overflow-wrap: anywhere; }
.credit-list.small { font-size: 0.85rem; color: var(--muted); }
.credit-list.small li { margin: 2px 0; break-inside: avoid; }
@media (min-width: 760px) { .credit-list.small { columns: 2; column-gap: 40px; } }
