:root {
  color-scheme: dark;
  --bg: #05060a;
  --card: rgba(8, 12, 22, 0.94);
  --line: rgba(51, 65, 85, 0.72);
  --text: #e6f1ff;
  --muted: #c3cfdd;
  --dim: #9aa8ba;
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.16);
  --amber: #fb923c;
  --violet: #c4b5fd;
  --severe: #fca5a5;
  --elevated: #fdba74;
  --watch: #fde047;
  --low: #67e8f9;
  --surface: #0b1220;
  --surface-2: #070b12;
  --surface-3: #0c1222;
  --tip-bg: #060b18;
  --border: #334155;
  --border-2: #1e293b;
  --ink: #e2e8f0;
  --on-accent: #041016;
  --severe-ink: #fecaca;
  --nav-bg: rgba(5, 6, 10, 0.94);
  --accent-line: rgba(34, 211, 238, 0.5);
  --glow: radial-gradient(900px 420px at 0% -10%, rgba(34, 211, 238, 0.08), transparent 55%);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    var(--glow),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
  padding: 20px 22px 40px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--cyan);
  color: var(--on-accent);
  padding: 8px 12px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.jump {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  font-family: var(--font-num);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

h1 span { color: var(--cyan); }

h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.health {
  margin: 0;
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  max-width: min(520px, 100%);
}

.health.ok {
  color: var(--low);
  border-color: var(--accent-line);
  background: rgba(34, 211, 238, 0.08);
}

.health.warn {
  color: var(--elevated);
  border-color: rgba(251, 146, 60, 0.5);
  background: rgba(251, 146, 60, 0.08);
}

.health.bad {
  color: var(--severe);
  border-color: rgba(252, 165, 165, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

.banner {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(252, 165, 165, 0.45);
  background: rgba(239, 68, 68, 0.08);
  color: var(--severe-ink);
  border-radius: 8px;
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.45;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 16px 0 18px;
}

.api-details { grid-column: 1 / -1; }

.dataset-picker {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px 10px;
}

.dataset-picker legend {
  padding: 0 4px;
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.dataset-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-num);
  font-size: 15px;
  cursor: pointer;
}

.chip input {
  width: auto;
  margin: 0;
}

.chip:has(input:checked) {
  border-color: var(--cyan);
}

.chip:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.loan-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.loan-filters {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.loan-filters .field { min-width: 140px; }

.naics-chip { margin-bottom: 1px; }

.api-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.api-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

@media (min-width: 721px) {
  .api-details,
  .api-row { display: contents; }
  .api-details summary { display: none; }
}

.field { min-width: 0; }

.grow { min-width: 0; }

label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select, button {
  font: 13px/1.3 var(--font-num);
  text-transform: none;
  letter-spacing: 0;
}

input, select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
}

button {
  background: var(--cyan);
  color: var(--on-accent);
  font-family: var(--font-ui);
  font-weight: 700;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  height: 38px;
  touch-action: manipulation;
}

button.ghost, button.textish {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-num);
  font-weight: 500;
  height: auto;
}

button.textish {
  border: 0;
  padding: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

button.tiny {
  padding: 3px 8px;
  font-size: 14px;
}

button.ghost.active {
  border-color: var(--amber);
  color: var(--amber);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.layout > * { min-width: 0; }

.card, .dossier {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.card-head, .dossier-head {
  padding: 14px 16px 8px;
}

.card-head p, .dossier-head p, .note {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.5;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 0 16px 8px;
}

.legend label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}

.legend input { width: auto; }

.swatch {
  width: 22px;
  height: 3px;
  border-radius: 99px;
  display: inline-block;
}

.swatch.peer {
  background: repeating-linear-gradient(90deg, var(--violet) 0 5px, transparent 5px 8px);
}

.radar-wrap {
  padding: 0 8px 4px;
}

.radar-stage {
  position: relative;
  width: 100%;
}

.radar-canvas {
  position: relative;
}

#radar {
  width: 100%;
  height: auto;
  display: block;
}

#radar text {
  font-family: var(--font-ui);
  fill: var(--ink);
}

#radar .spoke-hit { pointer-events: all; }
#radar .spoke-bg { pointer-events: none; }

#radar .spoke-bg.is-hot {
  fill: rgba(34, 211, 238, 0.14);
}

#radar .spoke-line.is-hot {
  stroke: var(--ink);
  stroke-width: 1.6;
}

.ring-labels,
.radar-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ring-label {
  position: absolute;
  transform: translate(2px, -50%);
  font-family: var(--font-num);
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

.ring-label.mid {
  color: var(--ink);
  font-weight: 600;
}

button.spoke-label {
  position: absolute;
  height: auto;
  margin: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-transform: none;
  max-width: 108px;
  cursor: pointer;
  pointer-events: auto;
}

button.spoke-label.align-left { text-align: left; }
button.spoke-label.align-right { text-align: right; }
button.spoke-label.align-center { text-align: center; }

button.spoke-label .title,
button.spoke-label .unit,
button.spoke-label .read {
  display: block;
}

button.spoke-label .unit {
  margin-top: 1px;
  font-family: var(--font-num);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

button.spoke-label.level .unit { color: var(--violet); }

button.spoke-label .read {
  margin-top: 2px;
  font-family: var(--font-num);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--cyan);
}

button.spoke-label.above .read { color: var(--elevated); }
button.spoke-label.below .read { color: var(--low); }

button.spoke-label:hover,
button.spoke-label:focus-visible,
button.spoke-label.is-hot {
  background: var(--card);
  outline: none;
}

button.spoke-label:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.75);
  outline-offset: 2px;
}

.radar-stage.narrow .radar-labels {
  position: static;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 2px 4px 8px;
  pointer-events: auto;
}

.radar-stage.narrow button.spoke-label {
  position: static;
  transform: none !important;
  max-width: none;
  width: auto;
  min-height: 44px;
  padding: 6px 8px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.stack { display: flex; flex-direction: column; gap: 16px; }

.dossier.a { box-shadow: inset 0 3px 0 var(--cyan); }
.dossier.b { box-shadow: inset 0 3px 0 var(--amber); }
.dossier.peer { box-shadow: inset 0 3px 0 var(--violet); }

.dossier h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.meta {
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: 15px;
  color: var(--muted);
}

.group-title {
  margin: 0;
  padding: 8px 16px 0;
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.metric {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
}

.metric span {
  display: block;
  font-family: var(--font-num);
}

.metric .k {
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric .v {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.map-card,
.loan-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  margin-bottom: 16px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.map-head #map-target {
  flex: 0 0 auto;
  white-space: nowrap;
}

#map {
  height: 480px;
  background: var(--surface-2);
}

.leaflet-container {
  background: var(--surface-2);
  font-family: var(--font-num);
}

.leaflet-bar {
  border: 1px solid var(--border);
  box-shadow: none;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  width: 34px;
  height: 34px;
  line-height: 34px;
  background: var(--surface);
  color: var(--text);
  border-bottom-color: var(--border);
}

.leaflet-control-attribution {
  background: var(--nav-bg);
  color: var(--muted);
  font-size: 15px;
  max-width: min(280px, 70%);
}

.leaflet-control-attribution a { color: var(--cyan); }

.leaflet-tooltip.map-tip {
  background: var(--tip-bg);
  color: var(--text);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  font-family: var(--font-num);
  font-size: 15px;
  padding: 6px 8px;
}

.leaflet-tooltip-top.map-tip::before { border-top-color: var(--tip-bg); }
.leaflet-tooltip-bottom.map-tip::before { border-bottom-color: var(--tip-bg); }
.leaflet-tooltip-left.map-tip::before { border-left-color: var(--tip-bg); }
.leaflet-tooltip-right.map-tip::before { border-right-color: var(--tip-bg); }

.shade-legend { padding: 8px 16px 12px; }

.shade-bar {
  height: 10px;
  border-radius: 99px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.shade-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: 15px;
  color: var(--muted);
}

.map-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  border-top: 1px solid var(--line);
}

.map-kpis[hidden] { display: none; }

.kpi {
  padding: 8px 10px 10px;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.kpi span { display: block; font-family: var(--font-num); }

.kpi .k {
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.kpi .v {
  font-size: 15px;
  font-weight: 600;
}

.kpi .b {
  margin-top: 2px;
  font-size: 15px;
  color: var(--amber);
}

.map-status {
  margin: 0;
  padding: 12px 16px 14px;
  color: var(--elevated);
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.45;
}

.severe { color: var(--severe); }
.elevated { color: var(--elevated); }
.watch { color: var(--watch); }
.low { color: var(--low); }

.table-card { margin-top: 16px; }

.table-scroll { overflow: auto; max-height: 640px; max-width: 100%; }

.axis-scroll { max-height: none; padding: 0 8px 12px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-num);
  font-size: 15px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

th:first-child, td:first-child,
th.left, td.left { text-align: left; }

th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  z-index: 1;
}

th button {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0;
  height: auto;
  font: inherit;
  cursor: pointer;
}

th button[aria-sort="ascending"],
th button[aria-sort="descending"] { color: var(--cyan); }

tbody tr:hover { background: rgba(34, 211, 238, 0.05); }

tr.row-a { box-shadow: inset 3px 0 0 var(--cyan); }
tr.row-b { box-shadow: inset 3px 0 0 var(--amber); }

.actions { display: flex; gap: 8px; justify-content: flex-end; }

footer {
  margin-top: 18px;
  color: var(--dim);
  font-family: var(--font-num);
  font-size: 15px;
}

footer code { color: var(--muted); }

.tip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  max-width: min(320px, calc(100vw - 16px));
  padding: 10px 12px;
  background: var(--tip-bg);
  color: var(--text);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.45;
}

.tip strong { display: block; margin-bottom: 4px; font-family: var(--font-ui); }

.tip .blurb {
  color: var(--muted);
  margin-bottom: 6px;
}

.tip-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.tip-sw {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 99px;
}

.tip-name { color: var(--text); }

.tip-meta { color: var(--muted); }

.empty {
  padding: 28px 16px 32px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 15px;
}

.span-2 { grid-column: span 2; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

.loan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 12px;
}

.loan-toolbar p {
  margin: 0;
  font-family: var(--font-num);
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

.loan-toolbar button { min-height: 44px; }

.loan-list {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.loan {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
}

.loan h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.loan p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.45;
}

.loan .amt { color: var(--text); }

.loan-status {
  margin: 0;
  padding: 4px 16px 16px;
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.loan-status.warn { color: var(--elevated); }
.loan-status.bad { color: var(--severe); }

.audit-sets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.audit-set {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.audit-set h3,
.audit-match h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.audit-set p,
.audit-set dl {
  margin: 0;
}

.audit-set dl {
  display: grid;
  gap: 6px;
}

.audit-set dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.audit-set dt {
  color: var(--muted);
  font-size: 15px;
}

.audit-set dd {
  margin: 0;
  font-family: var(--font-num);
  font-size: 15px;
  text-align: right;
}

.audit-groups {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.audit-match {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  background: rgba(34, 211, 238, 0.06);
}

.audit-match.industry {
  border-left-color: var(--amber);
  background: rgba(251, 146, 60, 0.08);
}

.audit-badge {
  margin: 0 0 4px;
  font-family: var(--font-num);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
}

.audit-match.industry .audit-badge { color: var(--amber); }

.audit-key {
  margin: 0 0 8px;
  font-family: var(--font-num);
  font-size: 15px;
}

.audit-match ul {
  margin: 0;
  padding-left: 18px;
}

.audit-match li {
  margin: 4px 0;
  font-size: 15px;
  line-height: 1.4;
}

.audit-notes {
  margin: 0;
  padding: 0 16px 16px 34px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 15px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  body {
    padding:
      max(14px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .topbar { flex-direction: column; align-items: flex-start; }
  .top-actions { width: 100%; justify-content: space-between; }
  .layout { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr 1fr; }
  .span-2, #reload { grid-column: 1 / -1; }
  .api-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  input, select, button { font-size: 16px; }
  button:not(.textish), .leaflet-bar a { min-height: 44px; }
  button.tiny { padding: 8px 12px; font-size: 15px; }
  .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }
  .legend label { min-height: 44px; }
  .map-head { flex-direction: column; }
  .map-head #map-target { width: 100%; }
  #map { height: min(68vh, 560px); min-height: 320px; touch-action: none; }
  #map-caption, #radar-caption, #audit-caption {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .health { max-width: 100%; }
  #map-card, #loan-card, #audit-card, #radar-card, #counties-card { scroll-margin-top: 68px; }
  .jump {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 25;
    gap: 8px;
    margin: 0 -12px;
    padding: 8px 12px;
    overflow-x: auto;
    background: var(--nav-bg);
  }
  .jump a {
    flex: 1 0 auto;
    padding: 0 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-num);
    font-size: 15px;
  }
}

@media (min-width: 540px) and (max-width: 720px) {
  .radar-stage.narrow .radar-labels { grid-template-columns: 1fr 1fr; }
}


/* Mobile readability + lightness (v11) */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { line-height: 1.5; }
.jump { position: sticky; top: 0; z-index: 900; background: var(--bg); padding: 6px 0; }
.jump a { font-size: 15px; padding: 8px 12px; min-height: 40px; display: inline-flex; align-items: center; }
.card { margin-bottom: 18px; }
#map-load, .more-btn { display: block; width: 100%; min-height: 48px; font-size: 16px; margin: 10px 0; cursor: pointer; }
#map-load { background: var(--cyan); color: var(--on-accent); border: 0; border-radius: 10px; font-weight: 700; }
#map[hidden] { display: none !important; }
input, select, button { font-size: 16px; }
@media (max-width: 720px) {
  html, body { background: var(--bg); }
  * { backdrop-filter: none !important; animation: none !important; transition: none !important; box-shadow: none !important; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* v13 */
body { font-variant-numeric: tabular-nums; }
.health { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; letter-spacing: 0; border-radius: 14px; }
.top-actions { min-width: 0; max-width: 100%; }
.eyebrow, legend, label { letter-spacing: 0.02em; }
.picker { position: relative; }
.picker input { width: 100%; }
.picker-list { position: absolute; z-index: 1000; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; max-height: 320px; overflow-y: auto; }
.picker-list li { padding: 12px 14px; font-size: 16px; cursor: pointer; color: var(--text); }
.picker-list li.active, .picker-list li:hover { background: var(--cyan-dim); }
.picker-list li.empty { color: var(--muted); cursor: default; }
.spoke-label .title { font-size: 15px; font-weight: 700; }
.spoke-label .unit { font-size: 13px; color: var(--muted); }
.spoke-label .read { font-size: 14px; }
.legend { font-size: 15px; gap: 10px 16px; }
button.spoke-label .unit { text-transform: none; letter-spacing: 0; }

/* ---- Themes (v14): Cyber = :root defaults ---- */
html.theme-basic {
  --bg: #1c1f24; --card: #24282e; --line: #3a3f47; --text: #eceff3; --muted: #c2c8d0; --dim: #9aa1ab;
  --cyan: #7cb7ff; --cyan-dim: rgba(124, 183, 255, 0.15); --amber: #f2a65a; --violet: #c9b8f5;
  --low: #8fd0ff; --surface: #2b3037; --surface-2: #22262c; --surface-3: #2a2e35; --tip-bg: #2b3037;
  --border: #4a515b; --border-2: #3a3f47; --ink: #eceff3; --on-accent: #0d1520; --nav-bg: #1c1f24;
  --accent-line: #5a7fa8; --glow: none;
}
html.theme-white {
  color-scheme: light;
  --bg: #ffffff; --card: #ffffff; --line: #d0d7de; --text: #111827; --muted: #374151; --dim: #4b5563;
  --cyan: #0e7490; --cyan-dim: rgba(14, 116, 144, 0.1); --amber: #c2410c; --violet: #6d28d9;
  --severe: #b91c1c; --elevated: #c2410c; --watch: #a16207; --low: #0e7490;
  --surface: #ffffff; --surface-2: #f6f8fa; --surface-3: #f3f4f6; --tip-bg: #ffffff;
  --border: #9ca3af; --border-2: #d0d7de; --ink: #111827; --on-accent: #ffffff; --severe-ink: #991b1b;
  --nav-bg: #ffffff; --accent-line: #0e7490; --glow: none;
}
html.theme-basic, html.theme-white { background: var(--bg); }
html.theme-basic *, html.theme-white * { text-shadow: none !important; }
html.theme-basic .card, html.theme-white .card { backdrop-filter: none; }
html.theme-white .card { box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-color: var(--line); }
html.theme-white .health.ok, html.theme-white tbody tr:hover { background: #ecfeff; }
html.theme-white .map-tip { box-shadow: 0 4px 12px rgba(0,0,0,0.15); color: var(--text); }
html.theme-white .leaflet-container { background: #f3f4f6; }
.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.theme-switch button { background: transparent; color: var(--muted); border: 0; padding: 6px 12px; min-height: 36px; font-size: 14px; font-family: var(--font-ui); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--cyan); color: var(--on-accent); font-weight: 700; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#map-load[hidden], .more-btn[hidden] { display: none !important; }

/* v15 help */
.help-btn { width: 36px; height: 36px; min-height: 36px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; padding: 0; font-family: var(--font-ui); }
.help-btn:hover, .help-btn:focus-visible { border-color: var(--cyan); color: var(--cyan); }
dialog.help { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--text); font-family: var(--font-ui); }
html.theme-white dialog.help, html.theme-basic dialog.help { background: var(--bg); }
dialog.help::backdrop { background: rgba(0, 0, 0, 0.55); }
.help-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: inherit; border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 1.15rem; }
.help-body { padding: 4px 18px 18px; overflow-y: auto; }
.help-body h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--cyan); }
.help-body p { margin: 0; font-size: 16px; line-height: 1.55; }
.help-body b { color: var(--text); }
.help-note { margin-top: 18px !important; color: var(--muted); font-size: 14px !important; }
.to-lite { color: var(--cyan); font-size: 15px; white-space: nowrap; }

/* v21 PPP search + flags */
.ppp-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.ppp-form input[type=search] { flex: 1 1 240px; min-height: 44px; padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; font-size: 16px; }
.ppp-form button { min-height: 44px; padding: 0 18px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flag { font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--elevated); color: var(--text); background: transparent; }
.flag.none { border-color: var(--line); color: var(--muted); }
.flag-score { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.flag-score.hi { background: var(--severe); color: #1a0505; }
.flag-score.mid { background: var(--elevated); color: #1a0d05; }
.flag-score.lo { border: 1px solid var(--line); color: var(--muted); }

dialog.loan-dialog { width: min(820px, calc(100vw - 16px)); }
.loan-head-line { font-size: 17px; font-weight: 600; margin: 12px 0 0 !important; }
.flag-why, .match-list, .rel-list { margin: 6px 0 0; padding-left: 20px; }
.flag-why li, .match-list li, .rel-list li { margin: 8px 0; font-size: 15px; line-height: 1.45; }
.flag-why span { color: var(--muted); }
.rel-list .textish { text-align: left; color: var(--cyan); text-decoration: underline; background: none; border: 0; padding: 4px 0; font-size: 15px; cursor: pointer; }
.field-list { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 4px 12px; margin: 8px 0; font-size: 15px; }
.field-list dt { color: var(--muted); }
.field-list dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.loan-open { margin-top: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--cyan); background: transparent; color: var(--cyan); font-weight: 700; cursor: pointer; }
@media (max-width: 520px) { .field-list { grid-template-columns: 1fr; } .field-list dd { margin-bottom: 6px; } }

.cases-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; border: 1px solid var(--amber); border-radius: 8px; color: var(--amber); font-family: var(--font-num); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; background: transparent; }
.cases-btn:hover, .cases-btn:focus-visible { background: var(--amber); color: var(--bg, #000); }
.cases-line { margin: 4px 0 0; font-size: 15px; }
.cases-line a { color: var(--amber); font-weight: 600; }
html.theme-white .cases-btn, html.theme-white .cases-line a { color: #b45309; border-color: #b45309; }
html.theme-white .cases-btn:hover { background: #b45309; color: #fff; }
.gap-btn { border-color: var(--cyan); color: var(--cyan); }
.gap-btn:hover, .gap-btn:focus-visible { background: var(--cyan); color: var(--bg, #000); }
html.theme-white .gap-btn { color: #0e7490; border-color: #0e7490; }
html.theme-white .gap-btn:hover { background: #0e7490; color: #fff; }

/* search upgrades */
.ppp-card { border-color: var(--accent-line); }
.zip-form { margin-top: -4px; }
.zip-form .zip-l { color: var(--muted); font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.ppp-form input#zip-q { flex: 0 0 110px; }
.loan .addr-line { color: var(--text); }
.flag.ctx { border-style: dashed; border-color: var(--line); color: var(--muted); }
.flags-ctx-label { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); align-self: center; margin-left: 4px; }
.match-tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 8px; vertical-align: 2px; }
details.close-matches { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
details.close-matches summary { cursor: pointer; color: var(--muted); min-height: 36px; display: flex; align-items: center; }
.ppp-note { color: var(--elevated); margin: 0 0 8px; }
.loan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.loan-actions .copied { border-color: var(--accent-line); }
.flag-why.ctx b { font-weight: 600; color: var(--muted); }
h3.ctx-h { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
