:root {
  --bg: #f7f8fa; --surface: #fff; --text: #17202b; --muted: #5b6573; --line: #dfe3e8;
  --accent: #0b5cad; --accent-ink: #fff;
  --s0: #5b6573; --s1: #2f7d32; --s2: #b26a00; --s3: #c2410c; --s4: #b91c1c;
  --g-A: #2f7d32; --g-B: #5f8f1f; --g-C: #b26a00; --g-D: #c2410c; --g-F: #b91c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141a; --surface: #171e26; --text: #e6eaef; --muted: #9aa5b1; --line: #2a3440;
          --accent: #5aa2ec; --accent-ink: #0f141a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
      white-space: pre-wrap; word-break: break-all; }
header.site, footer.site { max-width: 880px; margin: 0 auto; padding: 16px; display: flex;
                           justify-content: space-between; align-items: center; gap: 16px; }
footer.site { color: var(--muted); font-size: .85em; border-top: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 24px 0 12px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
form.scan { margin: 28px 0; }
form.scan label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=text] { flex: 1 1 260px; font: inherit; padding: 12px 14px; border: 1px solid var(--line);
                   border-radius: 8px; background: var(--surface); color: var(--text); }
button { font: inherit; font-weight: 600; padding: 12px 20px; border: 0; border-radius: 8px;
         background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.error { color: var(--s4); font-weight: 600; }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card, .finding, .callout, .facts { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.narrow { max-width: 640px; }
.center { text-align: center; margin: 48px auto; }
.spinner { width: 40px; height: 40px; margin: 0 auto; border: 4px solid var(--line); border-top-color: var(--accent);
           border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.report-head { display: flex; gap: 20px; align-items: center; margin: 16px 0 24px; }
.report-head h1 { margin: 0; font-size: 1.6rem; }
.grade { flex: none; width: 88px; height: 88px; border-radius: 16px; display: grid; place-items: center;
         font-size: 3rem; font-weight: 800; color: #fff; }
.grade-A { background: var(--g-A); } .grade-B { background: var(--g-B); } .grade-C { background: var(--g-C); }
.grade-D { background: var(--g-D); } .grade-F { background: var(--g-F); }
.tally { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.sev { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
       color: #fff; text-transform: uppercase; letter-spacing: .03em; }
.sev-0 { background: var(--s0); } .sev-1 { background: var(--s1); } .sev-2 { background: var(--s2); }
.sev-3 { background: var(--s3); } .sev-4 { background: var(--s4); }
.finding { margin: 10px 0; border-left-width: 5px; }
.sev-border-0 { border-left-color: var(--s0); } .sev-border-1 { border-left-color: var(--s1); }
.sev-border-2 { border-left-color: var(--s2); } .sev-border-3 { border-left-color: var(--s3); }
.sev-border-4 { border-left-color: var(--s4); }
.finding summary { cursor: pointer; font-weight: 600; }
.cat { color: var(--muted); font-weight: 500; font-size: .9em; margin: 0 4px; }
.callout { border-left: 5px solid var(--accent); margin: 16px 0 24px; }
.facts dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .report-head { flex-direction: column; align-items: flex-start; }
                            .facts dl { grid-template-columns: 1fr; } .facts dd { margin-bottom: 8px; } }
@media print {
  header.site nav, .print-hide, .callout a { display: none; }
  body { background: #fff; color: #000; }
  details.finding { break-inside: avoid; }
  details.finding > :not(summary) { display: block; }
}
