/* Passive Recon, styled after the web123.com.au brand:
   indigo-to-lilac hero gradient, coral call-to-action gradient,
   Public Sans bold headings, Inter body, white cards on a light grey page. */

:root {
  /* Brand */
  --brand-coral: #f3695d;
  --brand-coral-deep: #c23f34;
  --brand-coral-tint: #fdeceb;
  --brand-indigo: #493acb;
  --brand-purple: #8858d5;
  --brand-lilac: #a96ad5;
  --brand-navy: #011640;
  --hero-gradient: linear-gradient(70deg, #493acb 28%, #6f4fd1 62%, #a96ad5 100%);
  --cta-gradient: linear-gradient(180deg, #f3695d 0%, #c23f34 100%);
  --cta-gradient-hover: linear-gradient(180deg, #e95b4f 0%, #ad352b 100%);

  /* Surfaces and ink */
  --paper: #f6f6f6;
  --sheet: #ffffff;
  --sheet-2: #fff7f1;
  --ink: #1f2124;
  --ink-2: #555b63;
  --ink-3: #868c94;
  --rule: #e4e4e4;
  --rule-soft: #eeeeee;
  --link: #493acb;
  --accent-text: #493acb;
  --focus: #493acb;
  --on-hero: #ffffff;

  /* Severity (kept distinct from the brand coral) */
  --sev-critical: #9f1239;
  --sev-high: #c2410c;
  --sev-medium: #a16207;
  --sev-low: #0369a1;
  --sev-info: #64748b;
  --sev-pass: #2f7d4f;

  --font-display: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Red Hat Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius: 5px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgb(16 18 40 / 0.04), 0 4px 16px rgb(16 18 40 / 0.05);
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hero-gradient: linear-gradient(70deg, #2c2185 28%, #43308f 62%, #5e3b8f 100%);
    --brand-coral-tint: #3a1f22;
    --paper: #0f1020;
    --sheet: #181a2e;
    --sheet-2: #201f38;
    --ink: #ececf4;
    --ink-2: #b2b4c8;
    --ink-3: #82849a;
    --rule: #2c2e48;
    --rule-soft: #24263d;
    --link: #a69cff;
    --accent-text: #a69cff;
    --focus: #a69cff;
    --sev-critical: #fb7185;
    --sev-high: #fb923c;
    --sev-medium: #fbbf24;
    --sev-low: #38bdf8;
    --sev-info: #94a3b8;
    --sev-pass: #5fca8b;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --hero-gradient: linear-gradient(70deg, #2c2185 28%, #43308f 62%, #5e3b8f 100%);
  --brand-coral-tint: #3a1f22;
  --paper: #0f1020;
  --sheet: #181a2e;
  --sheet-2: #201f38;
  --ink: #ececf4;
  --ink-2: #b2b4c8;
  --ink-3: #82849a;
  --rule: #2c2e48;
  --rule-soft: #24263d;
  --link: #a69cff;
  --accent-text: #a69cff;
  --focus: #a69cff;
  --sev-critical: #fb7185;
  --sev-high: #fb923c;
  --sev-medium: #fbbf24;
  --sev-low: #38bdf8;
  --sev-info: #94a3b8;
  --sev-pass: #5fca8b;
  --shadow: none;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 15.5px/1.6 var(--font-body);
  overflow-x: hidden;
}
main { flex: 1; }

a { color: var(--link); text-underline-offset: 3px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.eyebrow {
  margin: 0 0 12px;
  font: 600 12.5px/1 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Buttons */
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

/* Coral CTA gradient, as on web123.com.au. 19px bold keeps white text within
   WCAG's large-text contrast threshold across the whole gradient. */
.primary {
  background: var(--cta-gradient);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 0 30px;
  font: 700 19px/1 var(--font-body);
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgb(194 63 52 / 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.primary:hover:not(:disabled) { background: var(--cta-gradient-hover); box-shadow: 0 6px 18px rgb(194 63 52 / 0.42); }
.primary:active:not(:disabled) { transform: translateY(1px); }

.ghost {
  background: var(--brand-coral-tint);
  color: var(--brand-coral-deep);
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
}
.ghost:hover:not(:disabled) { background: color-mix(in oklab, var(--brand-coral-tint) 70%, var(--brand-coral)); }
:root[data-theme="dark"] .ghost { color: #ff9a90; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ghost { color: #ff9a90; } }

/* ---------- Top bar */
.topbar { background: var(--sheet); border-bottom: 1px solid var(--rule); position: relative; z-index: 2; }
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { display: inline-flex; flex: none; }
.brand-logo img { display: block; height: 40px; width: auto; }
.brand-divider { width: 1px; height: 28px; background: var(--rule); flex: none; }
.brand-product {
  text-decoration: none; color: var(--ink); white-space: nowrap;
  font: 800 19px/1 var(--font-display);
  letter-spacing: -0.01em;
}
.brand-product:hover { color: var(--accent-text); }

/* Shown on a public PHP install with no access password. */
.notice {
  margin: 0; padding: 10px var(--gutter);
  background: var(--brand-coral-tint); color: var(--ink);
  font-size: 14px; text-align: center;
  border-bottom: 1px solid var(--rule);
}
.notice code { background: var(--sheet); padding: 1px 5px; border-radius: 3px; }

/* Sign-in dialog */
.login-dialog { width: min(440px, calc(100vw - 32px)); }
.login-dialog .dialog-body { display: grid; gap: 10px; }
.field-label { font-size: 14px; font-weight: 600; }
.field {
  font: 500 17px/1 var(--font-body); color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 12px 14px;
}
.field:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.login-dialog .primary { padding: 14px; margin-top: 4px; }
.login-dialog .form-error { margin: 0; padding: 0; background: none; }

.footer-brand { margin-top: 10px !important; color: rgb(255 255 255 / 0.6); font-size: 13px; }
.footer-brand a { color: #fff; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill-btn {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 500;
  display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--brand-indigo); }
.pill-count { font: 600 12.5px/1 var(--font-mono); color: var(--accent-text); }

/* ---------- Survey (hero) */
.survey {
  position: relative;
  background: var(--hero-gradient);
  color: var(--on-hero);
  overflow: hidden;
}
.terrain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.terrain path { fill: none; stroke: #fff; stroke-width: 1; opacity: 0.13; vector-effect: non-scaling-stroke; }
.terrain path.index { stroke-width: 1.6; opacity: 0.24; }
.terrain .spot { fill: var(--brand-coral); opacity: 0.95; }
.terrain .spot-label { fill: #fff; opacity: 0.75; font: 600 11px var(--font-mono); letter-spacing: 0.08em; }
.terrain.drawing path { opacity: 0; animation: contour-in 700ms ease forwards; }
.terrain.drawing path.index { animation-name: contour-in-index; }
@keyframes contour-in { to { opacity: 0.13; } }
@keyframes contour-in-index { to { opacity: 0.24; } }

.survey-inner {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 92px) var(--gutter) clamp(40px, 6vw, 76px);
}
.survey-copy { max-width: 760px; }
.survey .eyebrow { color: rgb(255 255 255 / 0.82); }
.survey h1 {
  margin: 0 0 18px;
  font: 800 clamp(36px, 5.6vw, 64px)/1.06 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.lede { margin: 0 0 30px; max-width: 60ch; color: rgb(255 255 255 / 0.9); font-size: 17px; }

.scan-form { max-width: 700px; }
.input-row {
  display: flex;
  background: var(--sheet);
  border-radius: var(--radius-lg);
  padding: 6px;
  gap: 6px;
  box-shadow: 0 10px 30px rgb(20 12 80 / 0.28);
}
.input-row:focus-within { outline: 3px solid rgb(255 255 255 / 0.6); outline-offset: 2px; }
.input-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 clamp(17px, 2.2vw, 21px)/1 var(--font-mono);
  padding: 14px 12px;
}
.input-row input:focus { outline: none; }
.input-row input::placeholder { color: var(--ink-3); }
.form-error {
  margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius);
  background: #fff; color: var(--sev-critical); font-weight: 600; font-size: 14.5px;
}

.options { border: 0; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.option { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 14.5px; color: rgb(255 255 255 / 0.85); cursor: pointer; }
.option input { margin: 3px 0 0; width: 17px; height: 17px; accent-color: var(--brand-coral); }
.option strong { display: block; color: #fff; font-weight: 600; }
.option:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }

.quota-line {
  margin: 22px 0 0;
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font-size: 14px; color: rgb(255 255 255 / 0.9);
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
}
.quota-line b { color: #fff; font-weight: 700; }
.quota-line button {
  background: #fff; color: var(--brand-indigo); border: 0; border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600;
}

/* ---------- Report */
.report { max-width: var(--max); margin: 0 auto; padding: clamp(28px, 5vw, 56px) var(--gutter) 64px; }

.sheet-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.sheet-title { min-width: 0; flex: 1 1 420px; }
.sheet-title .eyebrow { color: var(--accent-text); }
.sheet-title h2 {
  margin: 0;
  font: 800 clamp(34px, 6vw, 64px)/1.02 var(--font-display);
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.sheet-meta { margin: 10px 0 0; font: 400 13px/1.5 var(--font-mono); color: var(--ink-2); }

.grade {
  width: 132px; height: 132px; flex: none;
  border-radius: var(--radius-lg);
  display: grid; place-items: center; align-content: center;
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  position: relative;
}
.grade::before { content: 'GRADE'; position: absolute; top: 10px; left: 12px; font: 600 10.5px/1 var(--font-body); letter-spacing: 0.14em; color: var(--ink-3); }
.grade-letter { font: 800 72px/0.9 var(--font-display); color: var(--ink-3); }
.grade-score { font: 500 12px/1 var(--font-mono); color: var(--ink-2); margin-top: 6px; }
.grade[data-grade="A"] .grade-letter { color: var(--sev-pass); }
.grade[data-grade="B"] .grade-letter { color: var(--accent-text); }
.grade[data-grade="C"] .grade-letter { color: var(--sev-medium); }
.grade[data-grade="D"] .grade-letter { color: var(--sev-high); }
.grade[data-grade="F"] .grade-letter { color: var(--sev-critical); }

/* Contact ledger */
.ledger {
  margin: 28px 0 20px;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  border-radius: var(--radius-lg);
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ledger > div { padding: 20px 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ledger-target { border-right: 1px solid var(--rule); background: var(--sheet-2); }
.ledger-num { font: 800 48px/0.95 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ledger-target .ledger-num { color: var(--sev-pass); }
.ledger-target.touched .ledger-num { color: var(--brand-coral-deep); }
.ledger-third .ledger-num { color: var(--accent-text); }
.ledger-label { font-size: 14px; color: var(--ink-2); flex: 1 1 140px; }
.ledger-label span { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.ledger-chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.ledger-chips li {
  font: 400 12px/1 var(--font-mono);
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  animation: pop 260ms ease both;
}
.ledger-chips li b { color: var(--ink); font-weight: 500; }
@keyframes pop { from { opacity: 0; transform: translateY(3px); } }

/* Severity tally / filter */
.tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.tally button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 13px 6px 11px; font-size: 13.5px; font-weight: 500;
}
.tally button[aria-pressed="false"] { opacity: 0.45; }
.tally button b { font: 600 13px/1 var(--font-mono); }
.tally .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sev); }

.report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 30px; }
.action-status { font-size: 13px; color: var(--ink-2); }

/* Fix-first list */
/* Coral bar along the top edge, echoing the brand's CTA gradient. */
.priority {
  margin-bottom: 36px;
  background: linear-gradient(90deg, var(--brand-coral), var(--brand-coral-deep)) top / 100% 4px no-repeat, var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px clamp(16px, 2.6vw, 26px) 6px;
  box-shadow: var(--shadow);
}
.priority h3 { margin: 0 0 10px; font: 800 24px/1.1 var(--font-display); letter-spacing: -0.015em; }
.priority-list { list-style: none; margin: 0; padding: 0; }
.priority-list li { border-top: 1px solid var(--rule-soft); padding: 12px 0; display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: baseline; }
.priority-list .where { font: 400 12px/1.3 var(--font-mono); color: var(--ink-3); text-align: right; }
.priority-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.priority-list a:hover { color: var(--link); text-decoration: underline; }

/* Severity badges */
.sev {
  --sev: var(--sev-info);
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sev);
  white-space: nowrap;
}
.sev::before { content: ''; width: 9px; height: 9px; border-radius: 2px; background: var(--sev); flex: none; }
[data-sev="critical"] { --sev: var(--sev-critical); }
[data-sev="high"] { --sev: var(--sev-high); }
[data-sev="medium"] { --sev: var(--sev-medium); }
[data-sev="low"] { --sev: var(--sev-low); }
[data-sev="info"] { --sev: var(--sev-info); }
[data-sev="pass"] { --sev: var(--sev-pass); }

/* ---------- Modules */
.modules-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.module-index { position: sticky; top: 16px; }
.module-index ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.module-index a {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 7px 0 7px 14px; margin-left: -2px;
  border-left: 2px solid transparent;
  text-decoration: none; font-size: 14px; color: var(--ink-2);
}
.module-index a:hover { color: var(--accent-text); border-left-color: var(--brand-coral); }
.module-index .count { font: 600 12px/1.6 var(--font-mono); color: var(--ink-3); }
.module-index .count[data-sev] { color: var(--sev); }

.modules { display: grid; gap: 20px; }
.module {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.6vw, 26px);
  scroll-margin-top: 16px;
}
.module-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.module-title { margin: 0; font: 800 23px/1.15 var(--font-display); letter-spacing: -0.015em; }
.module-summary { margin: 5px 0 0; color: var(--ink-2); font-size: 14.5px; max-width: 70ch; }
.module-status { font: 500 12px/1.4 var(--font-mono); color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.module-status.running::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--brand-coral);
  animation: spin 800ms linear infinite;
}
.module-status.direct { color: var(--brand-coral-deep); }
@keyframes spin { to { transform: rotate(360deg); } }

.module-sources { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.module-sources li {
  font: 400 12px/1 var(--font-mono);
  padding: 6px 10px 6px 9px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  display: inline-flex; gap: 6px; align-items: center;
  cursor: default;
}
.module-sources li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.module-sources li[data-status="ok"]::before { background: var(--sev-pass); }
.module-sources li[data-status="error"]::before { background: var(--sev-critical); }
.module-sources li[data-status="limited"]::before { background: var(--sev-medium); }
.module-sources li[data-status="unconfigured"] { opacity: 0.7; }
.module-sources li[data-status="unconfigured"]::before { background: transparent; border: 1px solid var(--ink-3); }

.findings { list-style: none; margin: 18px 0 0; padding: 0; }
.finding { padding: 13px 0; border-top: 1px solid var(--rule-soft); display: grid; grid-template-columns: 92px 1fr; gap: 14px; }
.finding:first-child { border-top: 1px solid var(--rule); }
.finding h4 { margin: 0; font: 600 15.5px/1.4 var(--font-body); }
.finding p { margin: 4px 0 0; color: var(--ink-2); font-size: 14.5px; overflow-wrap: anywhere; }
.finding .sev { align-self: start; padding-top: 5px; }
.priority-list .sev { align-self: center; }
.finding[hidden] { display: none; }
.empty-note { margin: 16px 0 0; color: var(--ink-3); font-size: 14px; }

.passes { margin-top: 2px; }
.passes details { border-top: 1px solid var(--rule-soft); }
.passes summary { padding: 12px 0; cursor: pointer; font-size: 14px; color: var(--sev-pass); font-weight: 600; }
.passes ul { list-style: none; margin: 0; padding: 0 0 8px; }
.passes li { padding: 6px 0 6px 106px; font-size: 14px; color: var(--ink-2); position: relative; }
.passes li::before { content: 'âœ“'; position: absolute; left: 0; color: var(--sev-pass); font-weight: 700; }
.passes li b { color: var(--ink); font-weight: 600; }

.panels { margin-top: 10px; display: grid; gap: 8px; }
.panel { border: 1px solid var(--rule-soft); border-radius: var(--radius); background: var(--paper); }
.panel > summary {
  padding: 10px 14px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: flex; justify-content: space-between; gap: 12px;
  list-style: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: '+'; font-family: var(--font-mono); color: var(--brand-coral-deep); font-weight: 600; }
.panel[open] > summary::after { content: 'âˆ’'; }
.panel-body { padding: 0 14px 14px; overflow-x: auto; }
.panel-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: minmax(120px, 210px) 1fr; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-2); padding: 6px 12px 6px 0; border-top: 1px solid var(--rule); }
.kv dd { margin: 0; padding: 6px 0; border-top: 1px solid var(--rule); font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }

.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); font-family: var(--font-mono); vertical-align: top; overflow-wrap: anywhere; max-width: 60ch; }

.data-list { list-style: none; margin: 0; padding: 0; columns: 3 220px; column-gap: 24px; font-size: 13px; }
.data-list li { padding: 3px 0; break-inside: avoid; overflow-wrap: anywhere; }
.data-list.mono li { font-family: var(--font-mono); }

/* ---------- Footer */
.footer { background: var(--brand-navy); color: rgb(255 255 255 / 0.78); }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 30px var(--gutter) 44px; font-size: 14px; }
.footer p { max-width: 80ch; margin: 0; }
.footer strong { color: #fff; }

/* ---------- Dialogs */
.sheet-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(86vh, 920px);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--sheet);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 60px rgb(10 10 40 / 0.3);
}
.sheet-dialog::backdrop { background: rgb(17 12 60 / 0.5); }
.dialog-head {
  position: sticky; top: 0; z-index: 1;
  background: linear-gradient(90deg, var(--brand-coral), var(--brand-coral-deep)) top / 100% 4px no-repeat, var(--sheet);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 24px 24px 10px;
}
.dialog-head h2 { margin: 0; font: 800 26px/1.1 var(--font-display); letter-spacing: -0.015em; }
.dialog-lede { margin: 0 24px 10px; color: var(--ink-2); font-size: 14.5px; }
.dialog-body { padding: 0 24px 24px; }

.src-group h3 { margin: 20px 0 6px; font: 600 12px/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); }
.src-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.src-row .name { font-weight: 600; }
.src-row .note { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; }
.src-row .state { font: 500 12px/1.6 var(--font-mono); white-space: nowrap; }
.src-row .state.on { color: var(--sev-pass); }
.src-row .state.off { color: var(--ink-3); }
.src-row code { background: var(--paper); padding: 1px 5px; border-radius: 3px; }

/* Usage dialog */
.usage-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 18px; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stat-value { margin: 6px 0 0; font: 800 34px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font: 500 14px/1 var(--font-body); color: var(--ink-3); letter-spacing: 0; }
.stat-note { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-3); }
.stat.highlight { background: var(--hero-gradient); color: #fff; }
.stat.highlight .stat-label, .stat.highlight .stat-note { color: rgb(255 255 255 / 0.85); }
.stat.highlight .stat-value small { color: rgb(255 255 255 / 0.8); }

.usage-scroll { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.usage-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.usage-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.usage-table .num { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.usage-table .prov { font-weight: 600; }
.usage-table .prov small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 2px; max-width: 36ch; }
.usage-table tr.inactive td { color: var(--ink-3); }
.usage-table tr.inactive .prov { font-weight: 500; }
.meter { width: 96px; height: 6px; border-radius: 999px; background: var(--rule); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--brand-indigo); border-radius: inherit; }
.meter.warn span { background: var(--cta-gradient); }
.usage-foot { margin: 14px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------- Responsive */
@media (max-width: 900px) {
  .modules-layout { grid-template-columns: 1fr; }
  .module-index { display: none; }
}
@media (max-width: 640px) {
  .terrain .spot, .terrain .spot-label { display: none; }
  .topbar-inner { flex-wrap: wrap; }
  .brand-logo img { height: 34px; }
  .brand-product { font-size: 17px; }
  .input-row { flex-direction: column; }
  .primary { padding: 15px; }
  .ledger { grid-template-columns: 1fr; }
  .ledger-target { border-right: 0; border-bottom: 1px solid var(--rule); }
  .grade { width: 104px; height: 104px; }
  .grade-letter { font-size: 56px; }
  .finding, .priority-list li { grid-template-columns: 1fr; gap: 6px; }
  .priority-list .where { text-align: left; }
  .passes li { padding-left: 22px; }
  .module-head { flex-direction: column; gap: 8px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { border-top: 0; padding-top: 0; }
  .usage-stats { grid-template-columns: 1fr; }
  .usage-table .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
