:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #5d6066;
  --line: #dedfe2;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --good: #1d7a46;
  --warn: #a86400;
  --bad: #b3261e;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --surface: #1d1f22;
    --text: #ececee;
    --muted: #a3a6ad;
    --line: #34373c;
    --accent: #6ea1ff;
    --accent-text: #0d1220;
    --good: #5cc38a;
    --warn: #e0a54a;
    --bad: #ff8a80;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 28px 0 12px; }
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-weight: 400; color: var(--muted); margin-left: 6px; }

.facts { padding-left: 18px; }
.facts li { margin: 6px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 20px 0;
}
.card h2 { margin-top: 0; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 4px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.actions.spread { justify-content: space-between; }

.btn {
  font: inherit;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: default; }

.disclaimer { font-size: .85rem; color: var(--muted); margin: 24px 0; }
.hint { font-size: .9rem; color: var(--muted); }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 24px; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.q {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chip {
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.chip.critical { border-color: var(--bad); color: var(--bad); }
.q-text { margin: 0 0 10px; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opts label {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
}
.opts input { position: absolute; opacity: 0; pointer-events: none; }
.opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.opts label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.score { font-size: 3rem; font-weight: 700; margin: 0; line-height: 1; }
.band { margin: 6px 0 0; font-weight: 600; }
.band.good { color: var(--good); }
.band.warn { color: var(--warn); }
.band.bad { color: var(--bad); }

.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.kind { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kind b { display: block; font-size: 1.6rem; }
.kind span { font-size: .85rem; color: var(--muted); }

.sec-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 48px; gap: 10px; align-items: center; margin: 8px 0; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.sec-row .pct { text-align: right; font-variant-numeric: tabular-nums; }

.gaps { padding-left: 22px; }
.gaps li { margin: 10px 0; }
.gaps .g-clause { color: var(--muted); font-size: .85rem; }
.gaps .g-fix { display: block; margin-top: 2px; }
.gaps .g-ans { font-size: .8rem; font-weight: 600; margin-left: 6px; }
.g-ans.no { color: var(--bad); }
.g-ans.partly { color: var(--warn); }

fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-weight: 600; margin-bottom: 4px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
label input:not([type=checkbox]):not([type=radio]), label textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

.footer { font-size: .8rem; color: var(--muted); padding-bottom: 24px; }

@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: 1fr; }
  .kinds { grid-template-columns: 1fr; }
  .sec-row { grid-template-columns: minmax(0, 1fr) 80px 44px; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --line: #bbb; }
  .no-print, .topbar { display: none !important; }
  body { font-size: 12px; }
  .gaps li { break-inside: avoid; }
}
