/* Tokens: chart chrome, accent ramp and fixed status palette (see dataviz reference palette) */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-track: #cde2fb;
  --track: #e1e0d9;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --error: #b42318;
  --notice: #e6f4e6;
  --focus: #2a78d6;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-strong: #86b6ef;
    --accent-track: #184f95;
    --track: #383835;
    --error: #f97066;
    --notice: #12301a;
    --focus: #86b6ef;
  }
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

a { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 12px; }

.container { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.header-row { display: flex; align-items: baseline; gap: 12px; padding-top: 16px; padding-bottom: 16px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.product { color: var(--ink-2); }

.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.85rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.lead { font-size: 1.15rem; color: var(--ink-2); }
.muted, .meta { color: var(--ink-2); }
.fine-print { font-size: 0.85rem; color: var(--ink-2); }

.btn {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-secondary { background: transparent; color: var(--accent-strong); }
.btn-secondary:hover { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Landing */
.hero { margin-bottom: 24px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.choice { display: flex; flex-direction: column; }
.choice .btn { margin-top: auto; align-self: flex-start; }

/* Wizard */
.wizard-header { margin-bottom: 16px; }
.progress { height: 6px; background: var(--accent-track); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.2s ease; }
.step-counter { font-size: 0.85rem; color: var(--ink-2); }
fieldset.step { border: 1px solid var(--border); min-width: 0; }
fieldset.step.missing { border-color: var(--error); }
legend { font-size: 1.25rem; font-weight: 600; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
legend + * { clear: both; }
.help { color: var(--ink-2); font-size: 0.95rem; }
.options { display: grid; gap: 8px; margin-top: 8px; }
.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.option:hover { border-color: var(--accent); }
.option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.option input { margin-top: 4px; accent-color: var(--accent); }
.option-secondary { color: var(--ink-2); }
.wizard-nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 8px; }
.wizard:not(.js) [data-action="back"],
.wizard:not(.js) [data-action="next"] { display: none; }

.alert { border: 1px solid var(--error); color: var(--error); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.validation-summary-valid { display: none; }
.notice { background: var(--notice); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }

/* Results: hero figure, status, meters */
.hero-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.hero-label { color: var(--ink-2); margin-bottom: 0; }
.hero-figure { font-size: 4rem; font-weight: 600; line-height: 1; margin: 4px 0 12px; }
.hero-max { font-size: 1.25rem; font-weight: 400; color: var(--ink-2); }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.1rem; margin-bottom: 12px; }
.status-icon { flex: none; }
.status-good .status-icon { fill: var(--good); }
.status-warning .status-icon { fill: var(--warning); }
.status-serious .status-icon { fill: var(--serious); }
.status-critical .status-icon { fill: var(--critical); }
.meter { display: block; overflow: visible; }
.meter-hero { margin: 4px 0 16px; }
.meter-track { fill: var(--track); }
.meter-fill { fill: var(--accent); }
.meter-fill-good { fill: var(--good); }
.meter-fill-warning { fill: var(--warning); }
.meter-fill-serious { fill: var(--serious); }
.meter-fill-critical { fill: var(--critical); }
.meter-list .meter-track { fill: var(--accent-track); }
.band-meaning { font-size: 1.05rem; }
.scale-note { font-size: 0.85rem; color: var(--ink-2); margin-bottom: 0; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { margin-bottom: 16px; }
.kpi-label { color: var(--ink-2); font-size: 0.9rem; margin-bottom: 4px; }
.kpi-value { font-size: 2rem; font-weight: 600; line-height: 1.1; margin-bottom: 4px; }
.kpi-note { color: var(--ink-2); font-size: 0.85rem; margin: 0; }

.callout { border-left: 4px solid var(--critical); }
.callout ul { margin: 0; padding-left: 20px; }

.meter-list { list-style: none; margin: 0; padding: 0; }
.meter-row { display: grid; grid-template-columns: minmax(140px, 260px) 1fr 3ch; align-items: center; gap: 12px; padding: 6px 0; }
.meter-name { font-size: 0.95rem; }
.meter-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 560px) {
  .meter-row { grid-template-columns: 1fr 3ch; row-gap: 4px; }
  .meter-row .meter { grid-column: 1 / -1; grid-row: 2; }
}

/* Lead form */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.9rem; font-weight: 600; }
.field input, .field select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--ink);
}
.field-error { color: var(--error); font-size: 0.85rem; }
.input-validation-error { border-color: var(--error) !important; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 8px; }
.consent input { margin-top: 4px; }
.lead-form .btn { margin-top: 12px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Detailed report */
.actions { padding-left: 20px; margin: 0; }
.action { margin-bottom: 16px; }
.action-rec { font-weight: 600; margin-bottom: 6px; }
.action-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.action-q { color: var(--ink-2); font-size: 0.9rem; }
.tag { font-size: 0.8rem; border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; color: var(--ink-2); }
.tag-critical { border-color: var(--critical); color: var(--ink); font-weight: 600; }
.tag-critical::before { content: "\25CF"; color: var(--critical); margin-right: 6px; }

.data-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 0.95rem; }
.data-table th, .data-table td { text-align: left; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-muted td { color: var(--muted); }

/* Installer and diagnostics */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 6px 0 6px 28px; position: relative; border-bottom: 1px solid var(--line); }
.checks li::before { position: absolute; left: 4px; font-weight: 700; }
.checks li.ok::before { content: "\2713"; color: var(--good); }
.checks li.warn::before { content: "!"; color: var(--warning); left: 8px; }
.checks li.error::before { content: "\2715"; color: var(--critical); }
.checks.result { margin-top: 12px; }
.code { background: var(--page); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; }
.mono, .code { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.radio-row { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.radio-row legend { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; float: none; width: auto; }
.radio-row label { display: flex; gap: 8px; align-items: center; }
.setup-form .field { margin-bottom: 12px; }
.setup-form .btn { margin-top: 4px; }
.setup-done { border-left: 4px solid var(--good); }
