:root {
  --bg: #f6f7fb; --card: #fff; --ink: #111827; --muted: #5b6475; --line: #e5e7ee;
  --accent: #4f46e5; --accent-ink: #fff; --accent-soft: #eef0ff;
  --ok: #15803d; --ok-bg: #e8f7ee; --fail: #b91c1c; --fail-bg: #fdecec;
  --warn: #a15c07; --warn-bg: #fdf3dc; --unv: #475569; --unv-bg: #eceff4;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { margin: 0 0 .5rem; }

.site-header { padding: 18px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; color: var(--accent);
  text-decoration: none; }
.brand { color: var(--ink); } .brand svg { color: var(--accent); }
main { margin: 0 auto; padding: 8px 20px 56px; }
main.narrow { max-width: 640px; } main.wide { max-width: 1180px; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 36px; }

.hero { padding: 24px 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.04); }
.center { text-align: center; }

.form label { display: block; font-weight: 600; margin: 16px 0 6px; }
.form label:first-of-type { margin-top: 0; }
input[type=text], input[type=password], input[type=search] {
  width: 100%; padding: 11px 13px; border: 1px solid #cdd2de; border-radius: 9px; font: inherit;
  background: #fff; color: var(--ink); }
input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; } .hint.small { font-size: .82rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.btn { display: inline-block; padding: 11px 20px; border: 1px solid var(--accent); border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; }
.btn:hover { filter: brightness(1.07); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-secondary { background: #fff; color: var(--ink); border-color: #cdd2de; }
.form .btn { width: 100%; margin-top: 22px; padding: 13px; font-size: 1.05rem; }

.alert { padding: 12px 14px; border-radius: 9px; margin: 0 0 16px; font-size: .95rem; text-align: left; }
.alert-error { background: var(--fail-bg); color: var(--fail); border: 1px solid #f3c4c4; }
.alert-note { background: var(--warn-bg); color: var(--warn); border: 1px solid #f1deaa; margin: 12px 0; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6cd; margin-top: 16px; }

.trust { display: grid; gap: 14px; margin-top: 28px; }
.trust div { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; border-left: 3px solid var(--accent-soft); }
.trust span { color: var(--muted); font-size: .92rem; }

/* progress */
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 20px auto 8px; max-width: 420px; }
.bar-fill { height: 100%; width: 5%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }

/* report */
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 16px 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--accent); font-weight: 700; margin: 0 0 4px; }
.meta { color: var(--muted); margin: 0; } .meta.small { font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  text-align: left; font: inherit; cursor: pointer; color: var(--ink); border-top: 4px solid #cdd2de; }
.stat:hover { border-color: #b4bbcc; }
.stat-n { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-l { display: block; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.stat.ok { border-top-color: var(--ok); } .stat.fail { border-top-color: var(--fail); }
.stat.warn { border-top-color: #e0a100; } .stat.unv { border-top-color: #94a3b8; }
.stats-note { margin: 10px 2px 0; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin: 22px 0 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #cdd2de; background: #fff; border-radius: 99px; padding: 6px 13px; font: inherit;
  font-size: .88rem; cursor: pointer; color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toolbar input[type=search] { max-width: 280px; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: .92rem; }
.results th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 11px 14px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.results td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.results tr:last-child td { border-bottom: 0; }
.results tr[data-verdict=FAIL] { background: #fffafa; }
.results tr[data-verdict=FAIL] td:first-child { box-shadow: inset 4px 0 0 var(--fail); }
.results tr[hidden] { display: none; }
.results td:nth-child(2) { min-width: 230px; }
.flow { font-weight: 600; }
a.flow-link { color: var(--ink); text-decoration: none; display: inline-block; }
a.flow-link:hover { color: var(--accent); text-decoration: underline; }
.ext { margin-left: 5px; opacity: .55; vertical-align: -1px; }
a.flow-link:hover .ext { opacity: 1; } .sub, .linktext { color: var(--muted); font-size: .85rem; }
a.url, .redirect a { word-break: break-all; font-size: .85rem; }
.status { font-variant-numeric: tabular-nums; white-space: nowrap; }
.details { min-width: 240px; max-width: 360px; font-size: .88rem; }
.redirect { color: var(--muted); margin-top: 4px; font-size: .85rem; }
.tag { display: inline-block; background: #f1f3f8; color: #444d60; border-radius: 6px; padding: 1px 7px;
  font-size: .75rem; margin: 4px 4px 0 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); } .b-fail { background: var(--fail-bg); color: var(--fail); }
.b-warn { background: var(--warn-bg); color: var(--warn); } .b-unverified { background: var(--unv-bg); color: var(--unv); }
.empty { text-align: center; color: var(--muted); padding: 28px; margin: 0; }
.legend { margin: 22px 0 0; color: var(--muted); font-size: .92rem; }
.legend summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 14px; align-items: baseline; margin: 12px 0 0; }
.legend dt, .legend dd { margin: 0; }

@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; } main { padding: 4px 16px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  table.results, .results tbody, .results tr, .results td { display: block; width: 100%; }
  .results thead { display: none; }
  .results tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0; }
  .results td { border: 0; padding: 6px 14px; }
  .results td::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); }
  .results tr[data-verdict=FAIL] td:first-child { box-shadow: none; }
  .legend dl { grid-template-columns: 1fr; }
}

/* print: clean, full-width, no controls */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11px; }
  .no-print, .toolbar, .legend summary::marker { display: none !important; }
  main.wide { max-width: none; padding: 0; }
  .card, .table-wrap, .stat { box-shadow: none; }
  .stat { padding: 8px 10px; } .stat-n { font-size: 1.3rem; }
  .table-wrap { overflow: visible; border: 1px solid #ccc; }
  .results tr { break-inside: avoid; }
  table.results { table-layout: fixed; width: 100%; font-size: 10px; }
  .results th, .results td { padding: 6px 8px; overflow-wrap: anywhere; }
  .results th:nth-child(1) { width: 11%; } .results th:nth-child(2) { width: 24%; }
  .results th:nth-child(3) { width: 30%; } .results th:nth-child(4) { width: 7%; } .results th:nth-child(5) { width: 28%; }
  .results td:nth-child(2) { min-width: 0; } .details { max-width: none; }
  .results thead { display: table-header-group; }
  .flow { font-size: 10.5px; } .sub, .linktext, .details, a.url, .redirect, .redirect a, .status { font-size: 9.5px; }
  .tag { font-size: 8.5px; }
  .results th { background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .results tr[data-verdict=FAIL], .results tr[data-verdict=FAIL] td:first-child, .stat { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  .legend { break-inside: avoid; } .legend[open] { display: block; }
}

/* centred status cards (progress / failed / no links) shouldn't stretch across the wide report layout */
main.wide > .card.center { max-width: 640px; margin: 24px auto; }
