/* Blizzard: calm, map-first working tool. Tokens first; light and dark themes via custom properties. */

:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #18211d;
  --muted: #56635d;
  --rule: #d5dcd8;
  --accent: #0f6b45;
  --accent-ink: #ffffff;
  --accent-soft: #d7ebe1;
  --focus: #1d5fd1;

  --st-clear: #0f6b45;
  --st-clear-soft: #e1f1e8;
  --st-review: #8a5a00;
  --st-review-soft: #fbefd5;
  --st-blocked: #b4432f;
  --st-blocked-soft: #f8e3de;
  --st-na: #6c7772;
  --st-na-soft: #eceff0;

  --corridor: #2f4b7c;
  --county-line: #3c4743;
  --town-line: #6a4c93;
  --town-fill: #e7defa;
  --overlay: #b8326b;
  --parcel: #7a6a55;
  --parcel-strong: #a8580c;

  --own-1: #1f77b4;
  --own-2: #d9480f;
  --own-3: #6a4c93;
  --own-4: #2b8a3e;
  --own-5: #c2255c;
  --own-6: #0b7285;
  --own-other: #8c9590;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.06), 0 4px 16px rgba(16, 24, 20, 0.06);
  --topbar-h: 56px;

  --f-display: "Overpass", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513;
    --surface: #18201c;
    --surface-2: #1d2621;
    --ink: #e7ece9;
    --muted: #9ba8a1;
    --rule: #2d3933;
    --accent: #3fbf84;
    --accent-ink: #0d1411;
    --accent-soft: #173527;
    --focus: #7fb0ff;
    --st-clear: #4cc98e;
    --st-clear-soft: #16352a;
    --st-review: #e8b54f;
    --st-review-soft: #3a2f16;
    --st-blocked: #f08a75;
    --st-blocked-soft: #3d2420;
    --st-na: #98a39e;
    --st-na-soft: #252e2a;
    --corridor: #8fb2ee;
    --county-line: #c4cec9;
    --town-line: #b79ce6;
    --town-fill: #2f2643;
    --overlay: #f27cad;
    --parcel: #c9b593;
    --parcel-strong: #f0a35a;
    --own-1: #5aa9e6;
    --own-2: #ff8a50;
    --own-3: #b79ce6;
    --own-4: #69db7c;
    --own-5: #f783ac;
    --own-6: #4dd4e6;
    --own-other: #7d8883;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #101513;
  --surface: #18201c;
  --surface-2: #1d2621;
  --ink: #e7ece9;
  --muted: #9ba8a1;
  --rule: #2d3933;
  --accent: #3fbf84;
  --accent-ink: #0d1411;
  --accent-soft: #173527;
  --focus: #7fb0ff;
  --st-clear: #4cc98e;
  --st-clear-soft: #16352a;
  --st-review: #e8b54f;
  --st-review-soft: #3a2f16;
  --st-blocked: #f08a75;
  --st-blocked-soft: #3d2420;
  --st-na: #98a39e;
  --st-na-soft: #252e2a;
  --corridor: #8fb2ee;
  --county-line: #c4cec9;
  --town-line: #b79ce6;
  --town-fill: #2f2643;
  --overlay: #f27cad;
  --parcel: #c9b593;
  --parcel-strong: #f0a35a;
  --own-1: #5aa9e6;
  --own-2: #ff8a50;
  --own-3: #b79ce6;
  --own-4: #69db7c;
  --own-5: #f783ac;
  --own-6: #4dd4e6;
  --own-other: #7d8883;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; }
h4 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 2000; padding: 8px 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius);
}
.skip-link:focus { top: 8px; }

.eyebrow {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.lede { font-size: 16px; max-width: 72ch; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.mono { font-family: var(--f-mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 13px; height: 13px; vertical-align: -2px; }

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 16px;
  min-height: var(--topbar-h);
  padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font: 800 18px var(--f-display); color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark .post { fill: var(--ink); }
.mainnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  padding: 8px 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.mainnav a:hover { color: var(--ink); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.region-picker select { min-width: 170px; }
.user-box { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; color: var(--muted); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 6px 12px; }
  .mainnav { order: 3; width: 100%; }
  .user-name { display: none; }
  .region-picker select { min-width: 0; max-width: 46vw; }
}

/* ------------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.icon-btn:hover { background: var(--surface-2); }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  min-height: 36px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); max-width: 100%;
}
textarea { width: 100%; resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select { width: 100%; }
.field-inline { display: grid; gap: 2px; }
.field-inline label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-inline.grow { flex: 1 1 220px; }
.field-inline.grow input { width: 100%; }
.field-inline input[type="number"] { width: 130px; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.segmented { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segment span { display: block; padding: 7px 14px; font-weight: 600; font-size: 14px; color: var(--muted); }
.segment + .segment span { border-left: 1px solid var(--rule); }
.segment input:checked + span { background: var(--accent); color: var(--accent-ink); }
.segment input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

.status-filter { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.check-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; position: relative;
}
.check-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.check-chip:has(input:checked).tone-clear { background: var(--st-clear-soft); border-color: var(--st-clear); color: var(--st-clear); }
.check-chip:has(input:checked).tone-review { background: var(--st-review-soft); border-color: var(--st-review); color: var(--st-review); }
.check-chip:has(input:checked).tone-blocked { background: var(--st-blocked-soft); border-color: var(--st-blocked); color: var(--st-blocked); }
.check-chip:has(input:not(:checked)) { color: var(--muted); text-decoration: line-through; }
.check-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.chip-static { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--st-na-soft); color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ status marks (icon + text, colour is secondary) */

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-weight: 700; font-size: 13px; border: 1.5px solid currentColor; white-space: nowrap;
}
.badge-prefix { font-weight: 600; }
.st-clear { color: var(--st-clear); background: var(--st-clear-soft); }
.st-review { color: var(--st-review); background: var(--st-review-soft); border-style: dashed; }
.st-blocked { color: var(--st-blocked); background: var(--st-blocked-soft); }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-row-lg .badge { font-size: 14px; padding: 5px 12px 5px 9px; }

.mark { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.oc-pass, .oc-clear { color: var(--st-clear); }
.oc-fail, .oc-blocked { color: var(--st-blocked); }
.oc-review { color: var(--st-review); }
.oc-na { color: var(--st-na); font-weight: 600; }
.mark-compact .icon { width: 18px; height: 18px; }
.tone-clear { color: var(--st-clear); }
.tone-review { color: var(--st-review); }
.tone-blocked { color: var(--st-blocked); }
.tone-na { color: var(--st-na); }
.th-status { display: inline-flex; gap: 4px; align-items: center; }

.cite { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-mono); font-size: 13px; font-weight: 600; }
.confidence { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.conf-medium { color: var(--st-review); }
.conf-low { color: var(--st-blocked); }

/* ------------------------------------------------------------------ states */

.state { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 16px; color: var(--muted); }
.state-loading { grid-auto-flow: column; justify-content: center; align-items: center; gap: 10px; }
.state-title { font-weight: 700; color: var(--ink); font-size: 16px; }
.state-detail { max-width: 60ch; }
.state-error .icon { width: 28px; height: 28px; color: var(--st-blocked); }
.state-empty { border: 1px dashed var(--rule); border-radius: var(--radius); background: var(--surface-2); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--rule); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { padding: 24px; text-align: center; }
.form-error { color: var(--st-blocked); font-weight: 600; display: flex; gap: 6px; align-items: flex-start; }
.error-text { color: var(--st-blocked); }

/* ------------------------------------------------------------------ page layout */

.page {
  max-width: 1180px; margin: 0 auto; display: grid; gap: 20px; align-content: start;
  padding: 24px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left));
}
.page-wide { max-width: 1440px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.page-head > div { display: grid; gap: 6px; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 16px 18px; display: grid; gap: 12px; align-content: start; min-width: 0;
}
.card-title { font-size: 18px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.facts-list { display: grid; margin: 0; }
.fact-row { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.fact-row:last-child { border-bottom: 0; }
.fact-row dt { color: var(--muted); font-size: 13px; }
.fact-row dd { margin: 0; overflow-wrap: anywhere; }
.facts-inline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; }
.facts-inline .fact-row { display: flex; gap: 6px; border: 0; padding: 0; }
.facts-inline dt::after { content: ":"; }
.facts-inline dd { margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.card > .table-wrap, .table-wrap.card { border-radius: var(--radius); }
.table-wrap.card { padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table thead th {
  position: sticky; top: 0; background: var(--surface); font: 600 12px var(--f-mono); letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap; z-index: 1;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody th { font-weight: 600; }
.compact .data-table th, .compact .data-table td { padding: 6px 10px; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.row-link { font-weight: 700; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--st-review-soft); border: 1px solid var(--st-review); }
.callout .icon { color: var(--st-review); margin-top: 2px; }
.callout-warn { background: var(--st-blocked-soft); border-color: var(--st-blocked); }
.callout-warn .icon { color: var(--st-blocked); }

/* ------------------------------------------------------------------ sign in */

body.signed-out { background: var(--bg); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: 28px 26px; display: grid; gap: 14px; box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .brand-mark { width: 34px; height: 34px; }
.login-form { display: grid; gap: 14px; margin-top: 6px; }

/* ------------------------------------------------------------------ overview */

.region-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 18px; }
.region-card.is-selected { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.region-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.region-name { font-size: 22px; }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.funnel-stage { padding: 12px; display: grid; gap: 2px; align-content: start; border-right: 1px solid var(--rule); position: relative; }
.funnel-stage:last-child { border-right: 0; background: var(--accent-soft); }
.funnel-value { font: 800 26px var(--f-display); font-variant-numeric: tabular-nums; line-height: 1; }
.funnel-stage:last-child .funnel-value { color: var(--accent); }
.funnel-label { font-size: 13px; font-weight: 600; }
.funnel-sub { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-stage { border-bottom: 1px solid var(--rule); }
  .funnel-stage:nth-child(2n) { border-right: 0; }
  .funnel-stage:last-child { grid-column: 1 / -1; border-bottom: 0; }
}
.overview-detail { display: grid; gap: 18px; }

/* ------------------------------------------------------------------ map */

main.full-bleed { padding: 0; }
.map-view { display: grid; grid-template-rows: auto minmax(0, 1fr); height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
.map-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.filter-count { font-size: 13px; color: var(--muted); margin-left: auto; align-self: center; }
.map-body { position: relative; min-height: 0; }
.map-canvas { position: absolute; inset: 0; background: var(--bg); }
.map-notice {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 900; max-width: min(560px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; box-shadow: var(--shadow); font-size: 13px;
}
.layer-box {
  position: absolute; top: 10px; right: 10px; z-index: 900; width: 270px; max-height: calc(100% - 20px); overflow: auto;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
}
.layer-box summary { display: flex; gap: 8px; align-items: center; padding: 9px 12px; cursor: pointer; font-weight: 700; list-style: none; }
.layer-box summary::-webkit-details-marker { display: none; }
.layer-list { display: grid; gap: 10px; padding: 0 12px 12px; }
.layer-item { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--rule); }
.layer-toggle { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; }
.layer-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.layer-hint { margin-left: 24px; }
.legend { list-style: none; margin: 0 0 0 24px; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend-inline { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.legend-site { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.legend-clear { background: var(--st-clear); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--st-clear); }
.legend-review { background: var(--surface); border: 3px solid var(--st-review); }
.legend-blocked { width: 9px; height: 9px; margin: 0 2.5px; background: var(--st-blocked); border: 1px solid var(--ink); }
.legend-line { width: 22px; height: 7px; border-radius: 2px; flex: none; }
.legend-gap { background: var(--st-clear); opacity: 0.6; }
.legend-gap-review { background: repeating-linear-gradient(90deg, var(--st-review) 0 7px, transparent 7px 11px); opacity: 0.8; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; border: 1px solid var(--surface); }
.legend-swatch { width: 14px; height: 12px; border-radius: 2px; flex: none; border: 1.5px solid currentColor; }
.swatch-clear { color: var(--st-clear); background: var(--st-clear-soft); }
.swatch-review { color: var(--st-review); background: var(--st-review-soft); }
.swatch-blocked { color: var(--st-blocked); background: var(--st-blocked-soft); }
.swatch-na { color: var(--st-na); background: var(--st-na-soft); }

.map-panel {
  position: absolute; top: 10px; left: 10px; bottom: 10px; z-index: 950; width: min(380px, calc(100% - 20px)); overflow: auto;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: grid; gap: 12px; align-content: start;
}
.map-panel:focus-visible { outline: 2px solid var(--focus); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.panel-title { font-size: 19px; overflow-wrap: anywhere; }
.panel-sub { color: var(--muted); font-size: 14px; }
.panel-subhead { font-size: 14px; }
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.attention-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; align-items: start; }
.attention-kind { font-weight: 600; }
.attention-where { color: var(--muted); }

@media (max-width: 700px) {
  .map-filters { gap: 8px; }
  .map-filters .field-inline input[type="number"] { width: 110px; }
  .layer-box { width: calc(100% - 20px); max-height: 50%; }
  .map-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62%; border-radius: 12px 12px 0 0; }
  .filter-count { margin-left: 0; width: 100%; }
}

.leaflet-container { background: var(--bg); font-family: var(--f-body); }
/* Calm the basemap so data layers stand out; invert it for the dark theme. */
.basemap-tiles { filter: grayscale(0.55) contrast(0.95) brightness(1.03); }
:root[data-theme="dark"] .basemap-tiles { filter: grayscale(0.7) invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .basemap-tiles { filter: grayscale(0.7) invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9); }
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.45; min-width: 200px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--ink); border-bottom-color: var(--rule); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-tooltip { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.popup { display: grid; gap: 6px; }
.popup-title { font: 700 15px var(--f-display); }
.popup-facts .fact-row { grid-template-columns: 90px minmax(0, 1fr); padding: 3px 0; gap: 8px; }

/* ------------------------------------------------------------------ sites */

.filters { gap: 10px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.sites-table td { white-space: nowrap; }
.sites-table td:nth-child(2), .sites-table td:nth-child(3) { white-space: normal; min-width: 180px; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
}
.sort-btn.is-active { color: var(--ink); }
.sort-arrow { font-size: 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 0; }
.pager-text { color: var(--muted); font-size: 14px; }
.results { display: grid; gap: 8px; }

/* ------------------------------------------------------------------ dossier */

.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; margin-bottom: 4px; width: fit-content; }
.dossier-head h1 { overflow-wrap: anywhere; }
.score-dial {
  display: grid; justify-items: center; gap: 2px; padding: 12px 18px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); min-width: 120px;
}
.score-value { font: 800 40px var(--f-display); line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.score-label { font-size: 12px; color: var(--muted); }
.tier-chip { margin-top: 4px; padding: 1px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.stat { padding: 12px 14px; display: grid; gap: 2px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat-value { font: 800 22px var(--f-display); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
}

.dossier-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.dossier-main, .dossier-side { display: grid; gap: 18px; min-width: 0; }
@media (max-width: 1000px) {
  .dossier-grid { grid-template-columns: minmax(0, 1fr); }
  .dossier-side { order: -1; }
}
.locator-map { height: 260px; border-radius: var(--radius); border: 1px solid var(--rule); }
.lead-form { display: grid; gap: 12px; }
.lead-status { min-height: 1.5em; }
.stack-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stack-list li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.stack-level { color: var(--muted); font-size: 13px; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) 3.5rem; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { height: 10px; border-radius: 5px; background: var(--st-na-soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bar-value { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.rule-group { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--rule); }
.rule-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check {
  display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--radius); background: var(--surface-2);
}
.check-fail { border-left-color: var(--st-blocked); }
.check-review { border-left-color: var(--st-review); border-left-style: dashed; }
.check-pass { border-left-color: var(--st-clear); }
.check-na, .check-plain { border-left-color: var(--rule); }
.check-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.check-where { font-size: 13px; color: var(--muted); }
.check-text { max-width: 80ch; }
.check-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .check-results { grid-template-columns: minmax(0, 1fr); } }
.result-cell { display: grid; gap: 3px; align-content: start; padding: 8px 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.result-class { font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.result-numbers { font-size: 13px; }
.result-detail { font-size: 13px; color: var(--muted); }
.quote { margin: 0; padding: 6px 12px; border-left: 3px solid var(--rule); color: var(--ink); font-style: italic; max-width: 80ch; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.na-details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; padding: 4px 0; }
.checks-na { margin-top: 8px; }

.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.step { counter-increment: step; position: relative; padding: 10px 12px 10px 48px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 6px; }
.step::before {
  content: counter(step); position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px;
}
.step-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; justify-content: space-between; }
.question-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.question-list li { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.question-list li > span:last-child { flex: 1 1 240px; }
.question-list .is-resolved { color: var(--muted); }

/* ------------------------------------------------------------------ regulations */

.reg-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.tree-picker { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); overflow: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.tree-picker > summary { padding: 10px 12px; font-weight: 700; cursor: pointer; }
@media (min-width: 900px) { .tree-picker > summary { display: none; } }
@media (max-width: 900px) {
  .reg-layout { grid-template-columns: minmax(0, 1fr); }
  .tree-picker { position: static; max-height: none; }
}
.tree { padding: 6px; }
.tree-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tree-list .tree-list { margin-left: 12px; padding-left: 8px; border-left: 1px solid var(--rule); }
.tree-link { display: grid; padding: 6px 8px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tree-link:hover { background: var(--surface-2); }
.tree-link.is-active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tree-level { font: 600 10px var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tree-name { font-weight: 600; font-size: 14px; }
.tree-meta { font-size: 12px; color: var(--muted); }
.reg-detail { display: grid; gap: 18px; min-width: 0; }
.reg-head { display: grid; gap: 8px; }
.reg-title { font-size: clamp(22px, 3vw, 30px); }
.reg-headline { font-size: 17px; max-width: 75ch; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--muted); }
.policy-row { display: flex; flex-wrap: wrap; gap: 10px; }
.policy { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid currentColor; border-radius: var(--radius); background: var(--surface); }
.policy-label { font-size: 12px; color: var(--muted); }
.policy-value { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; }
.compare-table tr.is-current { background: var(--accent-soft); }
.rule-kind { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--rule); }
.param-list { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 2px; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

/* ------------------------------------------------------------------ data */

.sources-table td:first-child { min-width: 220px; }
.sources-table tr.is-disabled { opacity: 0.65; }
.ingest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; scroll-behavior: auto !important; }
}
