/* UDID Dashboard styles. Set in Atkinson Hyperlegible, designed by the Braille Institute for low-vision readers. */
:root {
  --fs: 16px;
  --ink: #16233f; --paper: #f2f5f9; --surface: #ffffff; --line: #d6dde8; --muted: #56637a;
  --accent: #b86e00; --accent-soft: #fff3de; --alert: #b4460f; --alert-soft: #fdeee4; --good: #1d6b4f;
  --b1: #e4eef7; --b2: #bcd5ea; --b3: #88b5d8; --b4: #5390c2; --b5: #2a6aa7; --b6: #0f4a85;
  --o1: #fcebd7; --o2: #f7cfa2; --o3: #efab6b; --o4: #e1843c; --o5: #c76119; --o6: #9c440b;
  --nodata: #c3ccda; --nodata-bg: #eef1f6; --border-map: #ffffff;
  --issued: #2a6aa7; --pending: #e1843c; --rejected: #8a94a8;
  --shadow: 0 8px 28px rgba(22, 35, 63, .16);
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7edf6; --paper: #0d1526; --surface: #131e34; --line: #293756; --muted: #a2afc6;
    --accent: #f2b440; --accent-soft: #2e2413; --alert: #f59b5f; --alert-soft: #33200f; --good: #5fc79e;
    --b1: #1a2d4b; --b2: #1f4574; --b3: #2a619c; --b4: #3f81c2; --b5: #6ba8df; --b6: #aad1f5;
    --o1: #3a2716; --o2: #5f3616; --o3: #8b4b18; --o4: #b9631e; --o5: #e08b3e; --o6: #f7b97c;
    --nodata: #3a4866; --nodata-bg: #172238; --border-map: #0d1526;
    --issued: #6ba8df; --pending: #e08b3e; --rejected: #7d88a0;
    --shadow: 0 8px 28px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e7edf6; --paper: #0d1526; --surface: #131e34; --line: #293756; --muted: #a2afc6;
  --accent: #f2b440; --accent-soft: #2e2413; --alert: #f59b5f; --alert-soft: #33200f; --good: #5fc79e;
  --b1: #1a2d4b; --b2: #1f4574; --b3: #2a619c; --b4: #3f81c2; --b5: #6ba8df; --b6: #aad1f5;
  --o1: #3a2716; --o2: #5f3616; --o3: #8b4b18; --o4: #b9631e; --o5: #e08b3e; --o6: #f7b97c;
  --nodata: #3a4866; --nodata-bg: #172238; --border-map: #0d1526;
  --issued: #6ba8df; --pending: #e08b3e; --rejected: #7d88a0;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
html { font-size: var(--fs); scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 1rem; line-height: 1.5;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
a { color: inherit; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1360px; margin: 0 auto; padding-left: clamp(16px, 3vw, 32px); padding-right: clamp(16px, 3vw, 32px); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding-top: 22px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 16px; flex: 1 1 420px; min-width: 0; }
.mark { width: 60px; height: auto; flex: none; }
.mark .on circle { fill: var(--accent); }
.mark .off circle { fill: none; stroke: var(--line); stroke-width: 1; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: .9375rem; max-width: 64ch; }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.find { display: flex; gap: 6px; flex: 1 1 260px; max-width: 360px; }
.find input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .9375rem; }
@media (max-width: 560px) { .find { max-width: none; flex-basis: 100%; } }
@media print { .find { display: none !important; } }
.status { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .875rem; color: var(--muted); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 700; }
.pill-demo { background: var(--accent-soft); border-color: var(--accent); }
.pill-official { background: var(--surface); border-color: var(--b5); }
.pill-stale { background: var(--alert-soft); border-color: var(--alert); color: var(--alert); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: .875rem; }
.btn:hover { border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; font-size: .875rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
.banner { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); font-size: .9375rem; }
.banner.stale { background: var(--alert-soft); border-color: var(--alert); }
.banner.official { background: var(--surface); border-color: var(--line); }
.banner p { margin: 0; }
.banner .b-sub { margin-top: 8px; font-weight: 700; }
.banner ul { margin: 4px 0 0; padding-left: 20px; }
.banner .b-src { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.banner a { color: inherit; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8125rem; color: var(--muted); font-weight: 700; min-width: 180px; flex: 1 1 180px; }
.filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: .9375rem; font-weight: 400; }
.filters select:disabled { opacity: .55; }
.filters .btn { flex: none; }

/* Scope headline */
.scope { padding: 20px 0 12px; }
.crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; font-size: .875rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs button { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; font-size: inherit; }
.crumbs button:hover { color: var(--accent); }
.scope h2 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -.02em; }
.scope-sub { margin: 6px 0 0; color: var(--muted); }
.scope-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.scope-tools:not(:has(button:not([hidden]))) { display: none; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.kpi { padding: 12px 16px 14px; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi:first-child { padding-left: 0; }
.kpi-label { font-size: .875rem; color: var(--muted); font-weight: 700; }
.kpi-value { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { display: block; font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.up { color: var(--good); font-weight: 700; }
.warn { color: var(--alert); font-weight: 700; }

/* Map and panel */
.main-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); gap: 28px; align-items: start; }
.map-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 8px; }
.map-head h3 { font-size: .9375rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-pick { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--muted); }
.group-pick select, .cmp select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: .875rem; max-width: 100%; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .875rem; }
.chip:hover { border-color: var(--ink); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }
.map-stage { position: relative; }
#map { display: block; width: 100%; height: auto; max-height: 80vh; touch-action: manipulation; }
#map path { vector-effect: non-scaling-stroke; stroke: var(--border-map); stroke-width: .8px; cursor: pointer; transition: opacity .25s; }
#map path.ctx { fill: var(--nodata-bg) !important; stroke: var(--line); }
#map path:focus { outline: none; }
#map path:hover, #map path:focus-visible { stroke: var(--ink); stroke-width: 1.6px; }
#map path.dim { opacity: .28; }
#map .districts path { stroke-width: .6px; }
#map path.active { stroke: var(--accent); stroke-width: 2.6px; }
#map .outline path { fill: none; stroke: var(--accent); stroke-width: 2.6px; pointer-events: none; }
#map path.hl { stroke: var(--accent); stroke-width: 2.6px; }
.hatch-bg { fill: var(--nodata-bg); }
.hatch-line { stroke: var(--nodata); stroke-width: 1.4; }
.back { position: absolute; top: 4px; left: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .8125rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.legend i.na { background: repeating-linear-gradient(45deg, var(--nodata-bg) 0 3px, var(--nodata) 3px 5px); }
.hint { margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
.small-uts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: .8125rem; }
.small-uts > span { color: var(--muted); font-weight: 700; margin-right: 4px; }
.small-uts .chip { padding: 4px 11px; font-size: .8125rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 20px 8px; }
.panel h3 { font-size: 1.25rem; }
.panel .rank { margin: 4px 0 0; color: var(--muted); font-size: .875rem; }
.p-sec { padding: 16px 0; border-bottom: 1px solid var(--line); }
.p-sec:last-child { border-bottom: 0; }
.p-sec h4 { font-size: .9375rem; margin-bottom: 10px; }
.p-sec .note { margin: 8px 0 0; }
.p-sec .note.tight { margin: -4px 0 10px; }
.stack { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--nodata-bg); }
.stack span { display: block; height: 100%; }
.keys { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: .875rem; }
.keys li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 8px; align-items: center; }
.keys i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.keys b { font-variant-numeric: tabular-nums; }
.keys em { font-style: normal; color: var(--muted); min-width: 4.2em; text-align: right; font-variant-numeric: tabular-nums; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: .875rem; }
.bars .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.bars .v em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 6px; }
.bars .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--nodata-bg); }
.bars .bar i { display: block; height: 100%; border-radius: 3px; background: var(--issued); }
.bars.alert .bar i { background: var(--pending); }
.bars button { all: unset; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .18em; }
.bars button:hover { color: var(--accent); }
.bars button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
details.more { margin-top: 10px; font-size: .875rem; }
details.more summary { cursor: pointer; color: var(--muted); }
details.more .bars { margin-top: 8px; }
.compare { margin: 10px 0 0; font-size: .875rem; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: .875rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.facts dd em { display: block; font-style: normal; font-weight: 400; color: var(--muted); font-size: .8125rem; }
.deltas, .hosp { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .875rem; }
.deltas li, .hosp li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.deltas b, .hosp .v { font-variant-numeric: tabular-nums; text-align: right; }
.hosp .v { font-weight: 700; }
.hosp em { font-style: normal; font-weight: 400; color: var(--muted); font-size: .8125rem; margin-left: 4px; }
.lead { margin: 0 0 6px; font-size: .9375rem; }
.lead b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .875rem; color: var(--muted); font-weight: 700; }
.cmp-table { margin-top: 10px; max-height: none; }
.cmp-table th, .cmp-table td { padding: 6px 8px; font-size: .8125rem; }
.cmp-table tbody th { font-weight: 400; color: var(--muted); text-align: left; }
.cmp-table tbody tr { cursor: default; }
.note, .empty { color: var(--muted); font-size: .875rem; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.tag-alert { background: var(--alert-soft); color: var(--alert); border-color: var(--alert); }
.tag-high { background: var(--ink); color: var(--paper); }
.tag-medium { border-color: var(--ink); }
.tag-standard { color: var(--muted); border-color: var(--line); }
.tag-off { color: var(--muted); border-color: var(--line); font-weight: 400; }

/* Trend + table blocks */
.block { margin-top: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.block-head h3 { font-size: 1.125rem; }
.block-head .note { margin: 0; }
.trend { min-height: 120px; }
.trend svg { display: block; width: 100%; height: auto; }
.trend .axis text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.trend .axis line { stroke: var(--line); }
.trend .axis path { stroke: var(--line); }
.trend .ln { fill: none; stroke-width: 2.5; }
.trend .ln-gen { stroke: var(--issued); }
.trend .ln-app { stroke: var(--muted); stroke-dasharray: 5 4; stroke-width: 2; }
.trend .area { fill: var(--issued); opacity: .1; }
.trend .rule { stroke: var(--ink); stroke-width: 1; opacity: .4; }
.trend .dot { fill: var(--surface); stroke: var(--issued); stroke-width: 2; }
.trend .pt-gen { fill: var(--issued); }
.trend .pt-app { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.trend-keys { display: flex; gap: 18px; font-size: .8125rem; color: var(--muted); margin-top: 6px; }
.trend-keys i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--issued); vertical-align: middle; margin-right: 6px; }
.trend-keys i.app { border-top: 2px dashed var(--muted); }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.table-tools input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); min-width: 200px; }
.table-scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-size: .8125rem; color: var(--muted); box-shadow: 0 1px 0 var(--line); }
thead th button { all: unset; cursor: pointer; font-weight: 700; }
thead th button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
thead th[aria-sort] button { color: var(--ink); }
thead th[aria-sort="ascending"] button::after { content: " ▲"; font-size: .7em; }
thead th[aria-sort="descending"] button::after { content: " ▼"; font-size: .7em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--paper); }
tbody tr[aria-current="true"] { background: var(--accent-soft); }
tbody td:first-child { font-weight: 700; }
td .sub { font-weight: 400; color: var(--muted); font-size: .8125rem; margin-left: 6px; }
.table-foot { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; font-size: .875rem; color: var(--muted); }

/* About + footer */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 40px; padding-top: 24px; border-top: 2px solid var(--ink); }
.about h3 { font-size: 1.125rem; margin-bottom: 12px; }
.defs { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: .9375rem; }
.defs dt { font-weight: 700; }
.defs dd { margin: 0; color: var(--muted); }
.sources p { margin: 0 0 10px; color: var(--muted); font-size: .9375rem; max-width: 70ch; }
.foot { padding-top: 24px; padding-bottom: 40px; color: var(--muted); font-size: .875rem; }

/* Tooltip + toast */
.tip { position: fixed; z-index: 40; max-width: 280px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: .875rem; pointer-events: none; }
.tip strong { display: block; font-size: 1rem; }
.tip .t-sub { display: block; color: var(--muted); font-size: .8125rem; }
.tip .t-big { display: block; font-size: 1.25rem; font-weight: 700; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.tip .t-big small { font-size: .8125rem; font-weight: 400; color: var(--muted); }
.tip dl { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; }
.tip dt { color: var(--muted); }
.tip dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tip .t-hint { display: block; margin-top: 6px; color: var(--muted); font-size: .75rem; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; z-index: 45; font-size: .9375rem; box-shadow: var(--shadow); }
.error { padding: 28px; border: 2px solid var(--alert); border-radius: 12px; background: var(--alert-soft); margin: 24px 0; }
.error code { background: var(--surface); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .main-grid, .about { grid-template-columns: 1fr; }
  .back { position: static; margin-bottom: 8px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi:first-child { padding-left: 0; padding-right: 10px; }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpi-value { font-size: 1.4rem; }
  .filters label { min-width: 100%; }
  .defs { grid-template-columns: 1fr; gap: 2px; }
  .defs dd { margin-bottom: 8px; }
  .table-tools input { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .tools, .filters, .table-tools, .small-uts, .back, .skip, .hint, #moreBtn, .scope-tools, .group-pick, .cmp { display: none !important; }
  body { background: #fff; }
  .panel, .block { break-inside: avoid; }
  .table-scroll { max-height: none; overflow: visible; }
}
