/* =====================================================================
   SED BALOCHISTAN — School Map web application
   Government-green template: dark green chrome, white cards, icon rail.
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --pri:     #0A5230;   /* deep government green */
  --pri-2:   #0D6A3E;
  --pri-3:   #118A50;
  --accent:  #16A34A;
  --mint:    #E7F3EC;
  --ink:     #10241A;
  --ink-70:  #3D5548;
  --ink-45:  #6E8478;
  --paper:   #F4F7F4;
  --card:    #FFFFFF;
  --line:    #DCE5DE;
  --alert:   #7B4FA8;
  --font-display: "Archivo", "Segoe UI", sans-serif;
  --font-body: "Public Sans", "Segoe UI", sans-serif;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(10,82,48,.06), 0 8px 24px rgba(10,82,48,.08);
  --glass: rgba(255, 255, 255, .92);
  --glass-border: rgba(255, 255, 255, .7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

html, body { height: 100%; }
/* The canvas behind everything. Between one document unloading and the next
   painting, the browser shows <html>'s own background - unset, that is white,
   and on navigation it reads as a full-page blink. Painting it in the theme's
   paper makes the gap invisible; hud.css already does the same for dark. */
html { background: var(--paper, #F4F7F4); }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
img { max-width: 100%; }
a { color: var(--ink); }
a:hover { color: var(--pri-3); }
.muted { color: var(--ink-45); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- app bar ---------- */
.app-bar {
  background: linear-gradient(115deg, #06371F 0%, var(--pri) 45%, var(--pri-2) 100%);
  color: #fff;
  display: flex; align-items: center; gap: 13px;
  padding: 10px 16px; flex: 0 0 auto;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 4px 18px rgba(5, 44, 25, .35);
  position: relative; z-index: 900;
}
.app-bar img {
  width: 48px; height: 48px; object-fit: contain;
  background: #fff; border-radius: 12px; padding: 4px; flex: 0 0 auto;
  box-shadow: 0 3px 10px rgba(0,0,0,.3), 0 0 0 2px rgba(255,255,255,.25);
}
.app-title { line-height: 1.18; min-width: 0; }
.app-title .gov {
  display: block; font-size: 10.5px; color: #A9CBB6; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-title strong {
  font-family: var(--font-display); font-weight: 800; font-size: 18.5px; letter-spacing: -.01em;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-title small {
  color: #A9CBB6; font-size: 11px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-bar .spacer { flex: 1; }

/* hamburger */
.menu-btn {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); color: #fff;
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease;
}
.menu-btn:hover { background: rgba(255,255,255,.22); }

/* module tabs — centered white pill switcher */
.nav-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 4px;
}
.nav-tabs a {
  color: #CFE5D8; text-decoration: none; font: 700 13.5px var(--font-body); letter-spacing: .01em;
  padding: 7px 22px; border-radius: 999px; white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.nav-tabs a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav-tabs a.on { background: #fff; color: var(--pri); box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* live totals as outlined chips */
.hdr-stats { display: flex; gap: 9px; }
.hdr-stat {
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(255,255,255,.28);
  border-radius: 13px; padding: 5px 16px; text-align: center; line-height: 1.2; white-space: nowrap;
}
.hdr-stat b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 16.5px; color: #fff; font-variant-numeric: tabular-nums; }
.hdr-stat span { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #A9CBB6; }

.app-bar .about-btn {
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(255,255,255,.32); color: #fff;
  border-radius: 13px; padding: 10px 16px;
  font: 700 12.5px var(--font-body); letter-spacing: .02em; cursor: pointer; white-space: nowrap;
  transition: background .12s ease;
}
.app-bar .about-btn:hover { background: rgba(255,255,255,.16); }

/* ---------- sub line ---------- */
.app-sub {
  flex: 0 0 auto; font-size: 13px; font-weight: 600; color: var(--ink-70);
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 7px 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 10px;
}
.app-sub::before {
  content: "✓"; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 6px;
  background: var(--pri-2); color: #fff; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- content row: icon rail + module ---------- */
.content-row { flex: 1 1 auto; min-height: 0; display: flex; }

.rail {
  flex: 0 0 auto; width: 88px; background: #fff; border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 10px 8px 0; position: relative; overflow-y: auto; overflow-x: hidden; z-index: 850;
}
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; border-radius: 12px; cursor: pointer; text-decoration: none;
  color: var(--ink-70); font: 600 10.5px var(--font-body); border: 0; background: none;
  transition: background .12s ease, color .12s ease; position: relative; z-index: 1;
}
.rail-item svg { opacity: .85; }
.rail-item:hover { background: var(--mint); color: var(--pri); }
.rail-item.on { background: var(--pri-2); color: #fff; box-shadow: 0 4px 12px rgba(10,82,48,.35); }
.rail-item.on svg { opacity: 1; }
.rail-deco { margin-top: auto; opacity: .5; pointer-events: none; align-self: center; }
/* (the phone rules for the rail now live at the end of this file, AFTER the
   header-rail block - equal specificity meant source order decided, and the
   header block appended later was overriding the bottom dock) */

/* the module fills the rest */
#schoolMap { flex: 1 1 auto; min-height: 0; position: relative; background: #E6EDE7; min-width: 0; }

/* ---------- GIS layers dock (map page left sidebar) ---------- */
.gis-dock {
  flex: 0 0 auto; width: 302px; background: var(--paper); border-inline-end: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; padding: 10px; display: flex; flex-direction: column; gap: 9px; z-index: 860;
}
.dock-sec { border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); flex: 0 0 auto; }
.dock-sec > summary {
  list-style: none; cursor: pointer; user-select: none; padding: 10px 13px;
  font: 800 11.5px var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-70);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.dock-sec > summary::-webkit-details-marker { display: none; }
.dock-sec > summary:hover { color: var(--pri); }
.dock-sec[open] > summary {
  border-bottom: 1px solid var(--line); color: var(--pri);
  background: linear-gradient(90deg, var(--mint), rgba(231,243,236,0) 70%);
  border-radius: 12px 12px 0 0;
}
.dock-sec .dcaret { color: var(--pri-3); font-size: 13px; transition: transform .15s ease; transform: rotate(-90deg); }
.dock-sec[open] > summary .dcaret { transform: rotate(0deg); }
.dock-body { padding: 11px 13px; display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.dock-body input:not([type="checkbox"]), .dock-body select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font: inherit; background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.dock-body input:focus, .dock-body select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.dock-body label.small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-45); margin-bottom: -6px; }
.dock-body .clearbtn { border: 0; background: none; color: var(--pri-3); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; text-align: start; padding: 0; }
.dock-body .clearbtn:hover { text-decoration: underline; }
/* Layer list: one row, one line. Dataset names and record counts live in the
   row's tooltip — inline they wrapped every second label onto two or three
   lines and made the panel look broken. */
.chk {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.3;
  padding: 6px 8px; margin-inline: -4px; border-radius: 8px;
  transition: background .12s ease;
}
.chk:hover { background: var(--mint); }
.chk input { accent-color: var(--pri-2); width: 15px; height: 15px; flex: 0 0 auto; margin: 0; }
.chk .lyn {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.small2 { font-size: 10.5px; font-weight: 400; }
/* swatch matching the symbol the layer draws on the map */
.chk .sw {
  flex: 0 0 auto; width: 9px; height: 9px; background: var(--sw, var(--pri-2));
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px color-mix(in srgb, var(--sw, var(--pri-2)) 35%, transparent);
}
.chk .sw.dot { border-radius: 50%; }
.chk .sw.sq { border-radius: 1.5px; }
/* sub-filter groups (Schools: gender / level) */
.sub-grp {
  font: 800 9.5px var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-45); margin: 5px 0 1px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0 8px; }
.chip-row .chk { padding: 3px 6px; font-size: 12px; gap: 6px; }
.chip-row .chk input { width: 13px; height: 13px; }
.chip-row .chk .sw { width: 8px; height: 8px; }
/* the mode switcher now lives inside the Schools layer, in a narrower column */
.sub-ctl .mode-row button { padding: 6px 4px; font-size: 11px; gap: 3px; }
.sub-ctl .mode-row svg { width: 14px; height: 14px; }
.sub-ctl select { width: 100%; font-size: 12px; padding: 5px 7px; }
#heatNote { margin-top: 4px; line-height: 1.45; }
/* "how is this calculated?" affordance next to a derived filter */
.why {
  flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%; cursor: pointer;
  border: 1.3px solid var(--ink-45); background: none; color: var(--ink-45);
  font: 800 10px var(--font-display); line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  align-self: center; transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.why:hover { background: var(--pri-2); border-color: var(--pri-2); color: #fff; }
.why[aria-expanded="true"] { background: var(--pri); border-color: var(--pri); color: #fff; }
/* explanation modal — the sidebar was too narrow to show a table honestly */
.why-modal {
  position: fixed; inset: 0; z-index: 3100; background: rgba(6, 40, 24, .55);
  display: none; align-items: center; justify-content: center; padding: 24px;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.why-modal.open { display: flex; }
.why-panel {
  background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 100%;
  display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  animation: whyIn .16s ease-out;
}
@keyframes whyIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.why-head {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 16px 20px 13px; border-bottom: 2px solid #CFE3D6;
}
.why-head b { font: 800 17px var(--font-display); letter-spacing: -.01em; flex: 1; }
.why-body { padding: 18px 22px 22px; overflow: auto; font-size: 13.5px; line-height: 1.6; color: var(--ink-70); }
.why-body > b { display: block; color: var(--ink); font-size: 14.5px; line-height: 1.5; }
.why-body p { margin-top: 11px; }
.why-body .src { color: var(--ink-45); font-size: 12px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.why-t { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.why-t th {
  text-align: start; font: 800 10px var(--font-display); text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-45);
  border-bottom: 1.5px solid #CFE3D6; padding: 6px 8px; white-space: nowrap;
}
.why-t td { padding: 7px 8px; border-bottom: 1px solid #EDF2EE; }
.why-t .n { text-align: end; font-variant-numeric: tabular-nums; }
.why-t tbody tr:hover { background: var(--mint); }
.why-t .tot td { font-weight: 800; color: var(--ink); border-bottom: 0; border-top: 1.5px solid #CFE3D6; }
.why-t .tot:hover { background: none; }
/* the unit the area cascade has selected */
.poly-label.vil.sel span {
  background: #7B3FB0; color: #fff; border-color: #5B2E86;
  font-weight: 800; box-shadow: 0 2px 8px rgba(91,46,134,.45);
}
.sub-warn {
  font-size: 11px; font-weight: 700; color: #B91C1C; background: #FBEFEA;
  border-radius: 7px; padding: 5px 8px; margin-top: 4px;
}
#schHint { margin-top: 3px; line-height: 1.4; }
/* nested layer options sit under a hairline rule so the grouping is obvious */
.sub-ctl {
  margin-inline-start: 20px; display: flex; flex-direction: column; gap: 4px;
  border-inline-start: 2px solid var(--line); padding-inline-start: 8px;
  margin-block: 2px 6px;
}
.gis-dock.dock-hidden { display: none; }
.gis-dock.fs-dock {
  position: absolute; z-index: 950; inset-inline-start: 12px; top: 60px; bottom: 64px;
  width: 302px; border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 18px 54px rgba(0,0,0,.45); display: none;
}
.gis-dock.fs-dock.open { display: flex; }
.dock-toggle {
  display: none; position: absolute; top: 12px; inset-inline-start: 12px; z-index: 870;
  background: var(--pri-2); color: #fff; border: 0; border-radius: 11px; padding: 9px 15px;
  font: 700 13px var(--font-body); cursor: pointer; box-shadow: 0 5px 16px rgba(10,60,35,.4);
}
@media (max-width: 760px) {
  /* The dock used to slide in OVER the map here, with a hamburger to dismiss
     it - and on real phones people got stuck with the panel covering the map
     and no obvious way out. It is now STATIC: part of the page, stacked above
     the map, its own scroll area. Nothing floats, nothing needs dismissing. */
  .content-row { position: relative; flex-direction: column; }
  .gis-dock {
    position: static; width: 100%; max-height: 44vh;
    transform: none; transition: none; box-shadow: none;
    border-inline-end: 0; border-bottom: 2px solid var(--line);
  }
  [dir="rtl"] .gis-dock { transform: none; }
  .gis-dock.open { transform: none; }
  .dock-toggle { display: none; }
  #schoolMap { min-height: 52vh; }
}

/* ---------- page footer bar ---------- */
.app-foot {
  flex: 0 0 auto; background: linear-gradient(90deg, #06371F, var(--pri) 55%, var(--pri-2));
  color: #CFE5D8; font-size: 12px; padding: 7px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; z-index: 900;
}
.app-foot .spacer { flex: 1; }
.app-foot b { color: #fff; font-weight: 700; }
.app-foot .foot-pin { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.app-foot select {
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px; padding: 2px 8px; font: 600 12px var(--font-body); cursor: pointer;
}
.app-foot select option { color: var(--ink); background: #fff; }
@media (max-width: 700px) { .app-foot { gap: 10px; font-size: 11px; } .app-foot .foot-right { display: none; } }

/* ---------- slide-in menu drawer (auto-closes) ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 1400; background: rgba(5, 34, 19, .45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 1500; width: 286px; max-width: 86vw;
  background: linear-gradient(160deg, #06371F 0%, var(--pri) 55%, var(--pri-2) 100%);
  color: #fff; display: flex; flex-direction: column;
  border-start-end-radius: 20px; border-end-end-radius: 20px;
  box-shadow: 14px 0 44px rgba(0,0,0,.45);
  transform: translateX(-105%); transition: transform .26s cubic-bezier(.2,.8,.25,1);
  visibility: hidden;
}
[dir="rtl"] .drawer { transform: translateX(105%); }
.drawer.open { transform: translateX(0); visibility: visible; }
.drawer-head {
  display: flex; align-items: center; gap: 11px; padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.drawer-head img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.drawer-head .dh-t { line-height: 1.25; min-width: 0; flex: 1; }
.drawer-head strong { font-family: var(--font-display); font-size: 15px; display: block; }
.drawer-head small { color: #A9CBB6; font-size: 11px; }
.drawer-close {
  background: rgba(255,255,255,.12); border: 0; color: #D9EBDF; width: 28px; height: 28px;
  border-radius: 50%; font-size: 17px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.drawer-close:hover { background: rgba(255,255,255,.25); color: #fff; }
.drawer-nav { padding: 12px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.drawer-label {
  font: 700 10px var(--font-display); text-transform: uppercase; letter-spacing: .12em;
  color: #8FD6AC; padding: 12px 10px 5px;
}
.d-link {
  display: flex; align-items: center; gap: 11px; color: #D9EBDF; text-decoration: none;
  font: 600 13.5px var(--font-body); padding: 9px 12px; border-radius: 11px;
  transition: background .12s ease, color .12s ease;
}
.d-link svg { flex: 0 0 auto; opacity: .8; }
.d-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.d-link.on { background: #fff; color: var(--pri); box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.d-link.on svg { opacity: 1; }
.d-link.sec-link { font-weight: 500; font-size: 13px; padding: 7px 12px; }
.drawer-foot {
  padding: 13px 18px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 11px; color: #A9CBB6;
}

/* ---------- Leaflet chrome ---------- */
.leaflet-bar { border: 0 !important; border-radius: 12px; overflow: hidden; box-shadow: 0 5px 16px rgba(10,60,35,.28) !important; }
.leaflet-bar a { border-bottom-color: #E7EFE9 !important; }
.leaflet-popup-content-wrapper { border-radius: 14px !important; box-shadow: 0 16px 48px rgba(10,60,35,.35) !important; }
.leaflet-popup-tip { box-shadow: 0 6px 18px rgba(10,60,35,.25) !important; }
/* ---- popup close button ------------------------------------------------- */
/* Leaflet's default is a hairline glyph with almost no hit area; on a dark
   card header it all but disappears. */
.leaflet-container .leaflet-popup a.leaflet-popup-close-button {
  width: 30px; height: 30px; top: 8px; right: 8px; padding: 0;
  display: grid; place-items: center; border-radius: 50%;
  font: 400 0/1 var(--font-body); color: transparent;
  background: rgba(10,50,32,.10);
  border: 1px solid rgba(10,50,32,.16);
  transition: background .16s ease, transform .16s ease, border-color .16s ease;
}
/* draw the cross ourselves so it is crisp at any size */
.leaflet-container .leaflet-popup a.leaflet-popup-close-button::before,
.leaflet-container .leaflet-popup a.leaflet-popup-close-button::after {
  content: ""; position: absolute; width: 13px; height: 1.8px; border-radius: 2px;
  background: #0A5230;
}
.leaflet-container .leaflet-popup a.leaflet-popup-close-button::before { transform: rotate(45deg); }
.leaflet-container .leaflet-popup a.leaflet-popup-close-button::after  { transform: rotate(-45deg); }
.leaflet-container .leaflet-popup a.leaflet-popup-close-button:hover {
  background: rgba(185,28,28,.14); border-color: rgba(185,28,28,.4); transform: scale(1.06);
}
.leaflet-container .leaflet-popup a.leaflet-popup-close-button:hover::before,
.leaflet-container .leaflet-popup a.leaflet-popup-close-button:hover::after { background: #B91C1C; }
.leaflet-container .leaflet-popup a.leaflet-popup-close-button:focus-visible {
  outline: 2px solid var(--pri-2); outline-offset: 2px;
}

/* the village and area cards have a dark header, so the button inverts */
.leaflet-popup.vcard-pop a.leaflet-popup-close-button {
  background: rgba(255,255,255,.20) !important;
  border-color: rgba(255,255,255,.42) !important;
}
.leaflet-popup.vcard-pop a.leaflet-popup-close-button::before,
.leaflet-popup.vcard-pop a.leaflet-popup-close-button::after { background: #fff; }
.leaflet-popup.vcard-pop a.leaflet-popup-close-button:hover {
  background: rgba(255,255,255,.34) !important; border-color: #fff !important;
}
.leaflet-popup.vcard-pop a.leaflet-popup-close-button:hover::before,
.leaflet-popup.vcard-pop a.leaflet-popup-close-button:hover::after { background: #fff; }
@media (prefers-reduced-motion: reduce) {
  .leaflet-container .leaflet-popup a.leaflet-popup-close-button { transition: none; }
  .leaflet-container .leaflet-popup a.leaflet-popup-close-button:hover { transform: none; }
}

/* slim scrollbars inside floating panels & popups */
.map-panel-body::-webkit-scrollbar, .leaflet-popup-content div::-webkit-scrollbar { width: 7px; }
.map-panel-body::-webkit-scrollbar-thumb, .leaflet-popup-content div::-webkit-scrollbar-thumb { background: #BCCDC1; border-radius: 99px; }
.map-panel-body::-webkit-scrollbar-track, .leaflet-popup-content div::-webkit-scrollbar-track { background: transparent; }

/* ---------- about panel ---------- */
.about-box {
  position: fixed; inset: auto 16px 52px auto; z-index: 1200; width: min(430px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(10,60,35,.35); padding: 18px 20px; font-size: 13.5px; line-height: 1.55;
}
.about-box h2 { font-size: 15.5px; margin-bottom: 8px; font-family: var(--font-display); letter-spacing: -.01em; }
.about-box p { margin: 6px 0; }
.about-box .close-about {
  position: absolute; top: 10px; inset-inline-end: 12px; background: var(--mint); border: 0;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 16px; line-height: 1; cursor: pointer; color: var(--ink-45);
}
.about-box .close-about:hover { color: var(--ink); background: #D7E8DD; }

@media (max-width: 1240px) { .hdr-stats { display: none; } }
@media (max-width: 960px) { .nav-tabs a { padding: 7px 14px; } }
@media (max-width: 560px) {
  .app-title small, .app-title .gov { display: none; }
  .app-sub { font-size: 11.5px; }
  .app-bar { padding: 8px 12px; gap: 9px; }
  .app-bar .about-btn { padding: 8px 12px; }
  .nav-tabs a { padding: 6px 11px; font-size: 12px; }
}

/* =====================================================================
   ANALYTICS MODULE (analytics.html)
   ===================================================================== */
main.dash { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; padding: 10px clamp(14px, 3vw, 40px) 46px; scroll-behavior: smooth; }
.dash-inner { max-width: 1280px; margin: 0 auto; }
.dash h2 {
  font-family: var(--font-display); font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-70); margin: 0; display: flex; align-items: center; gap: 10px;
}
.dash h2::before { content: ""; width: 18px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--pri-2), var(--accent)); }
.dash h2 .sub { font: 500 11.5px var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink-45); }

/* collapsible dropdown sections */
details.sec { margin-top: 20px; }
details.sec > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: background .12s ease;
  scroll-margin-top: 10px;
}
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary:hover { background: #FBFDFB; }
details.sec > summary h2 { flex: 1; min-width: 0; }
.sec-caret {
  color: var(--pri-3); font-size: 14px; flex: 0 0 auto;
  transition: transform .18s ease; transform: rotate(-90deg);
}
details.sec[open] > summary .sec-caret { transform: rotate(0deg); }
.sec-body { padding-top: 12px; }

/* fused hero banner — school list × census × need model in one strip */
.fused-hero {
  background: linear-gradient(120deg, #06371F, #0A5230 45%, #0E6B3C 80%, #118A50);
  border-radius: 18px; padding: 18px 22px 16px; color: #fff;
  box-shadow: 0 14px 40px rgba(10, 60, 35, .35);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px;
  margin-top: 16px; position: relative; overflow: hidden;
}
.fused-hero::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,.09), transparent 70%); pointer-events: none;
}
.fused-hero .fh { min-width: 0; }
.fused-hero .fh b { display: block; font: 800 23px var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fused-hero .fh span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #A9CBB6; }
.fused-hero .fh small { display: block; font-size: 11px; color: #CDE6D6; margin-top: 1px; }
.fused-hero .fh a { color: #FDE68A; text-decoration: none; font-weight: 700; }
.fused-hero .fh a:hover { text-decoration: underline; color: #FDE68A; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px 11px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--kc, var(--accent)); border-radius: 4px 0 0 4px; }
.kpi b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 23px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-45); }
.kpi small { display: block; font-size: 11px; color: var(--ink-45); margin-top: 2px; }

/* chart / table cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: stretch; }
.dcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  box-shadow: var(--shadow); min-width: 0;
}
.dcard h3 { font-family: var(--font-display); font-size: 14px; margin-bottom: 2px; letter-spacing: -.01em; }
.dcard .note { font-size: 11.5px; color: var(--ink-45); margin-bottom: 10px; }
.dcard.wide { grid-column: 1 / -1; }

/* donut + legend */
.donut-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.dz-legend { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; flex: 1; min-width: 150px; }
.dz-legend .li { display: flex; align-items: center; gap: 7px; }
.dz-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.dz-legend .li b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.dz-legend .li .pct { color: var(--ink-45); font-size: 11px; width: 38px; text-align: end; }

/* horizontal bars */
.hbar { display: grid; grid-template-columns: minmax(96px, auto) 1fr auto; gap: 5px 10px; align-items: center; font-size: 12.5px; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .nm a { text-decoration: none; }
.hbar .nm a:hover { color: var(--pri-3); text-decoration: underline; }
.hbar .tr { background: #ECF2ED; border-radius: 99px; height: 13px; overflow: hidden; position: relative; }
.hbar .br { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--pri-2), var(--pri-3)); min-width: 3px; }
.hbar .vl { font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--ink-70); white-space: nowrap; }

/* column (funnel) chart */
.colchart { width: 100%; overflow-x: auto; }
.colchart svg { display: block; min-width: 560px; width: 100%; height: auto; }

/* data tables */
.tbl-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tbl-tools input {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; font: inherit; font-size: 13px;
  background: #fff; width: min(260px, 100%);
}
.tbl-tools input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.tbl-tools .cnt { font-size: 12px; color: var(--ink-45); }
/* the area selects sit beside the search box and match it; the dark theme
   already restyles bare input/select, so these carry no colour of their own
   beyond the light-theme ground the inputs above use */
.tbl-tools select {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font: inherit;
  font-size: 13px; background: #fff; max-width: 210px;
}
.tbl-tools select:disabled { opacity: .5; cursor: not-allowed; }
.tbl-tools select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.tbl-tools .ts-clear {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; font: inherit;
  font-size: 13px; background: #fff; cursor: pointer; color: var(--ink-45);
}
.tbl-tools .ts-clear:hover { border-color: var(--accent); color: var(--ink); }
/* the explain button and the numbered reading of the chart under it */
/* NOT scoped to .tbl-tools. It was, and the grading button sits in .cf-gradebar
   instead - so it matched nothing and rendered as a raw browser button, 2px
   outset and 19px tall, next to siblings that looked designed. A control class
   that only works inside one container is a trap for the next person. */
.ts-why {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--accent); border-radius: 99px; padding: 7px 15px 7px 12px;
  font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  background: linear-gradient(180deg, #fff, #F4FBF6); cursor: pointer; color: var(--accent);
  box-shadow: 0 1px 2px rgba(10,82,48,.07);
}
/* the question mark travels with the control, so no caller has to remember it */
.ts-why::before {
  content: "?"; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 99px; font-size: 11px; font-weight: 800;
  background: var(--accent); color: #fff; flex: 0 0 auto;
}
.ts-why:hover { background: linear-gradient(180deg,#F4FBF6,#E7F6ED); box-shadow: 0 2px 6px rgba(10,82,48,.13); }
.ts-why:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(10,82,48,.10); }
.ts-why:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(22,163,74,.28); }
.ts-why.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* the literal glyph, not a CSS hex escape - "¹5" was being parsed as ¹ + "5" and painted a stray superscript */
.ts-why.on::before { background: #fff; color: var(--accent); content: "✕"; font-size: 9px; }
.why-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.why-list { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.why-list li { font-size: 13.5px; line-height: 1.55; }
.why-list li b { display: block; font-size: 13px; letter-spacing: .01em; margin-bottom: 2px; }
.why-list li span { color: var(--ink-70, #46586B); }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.dz { border-collapse: collapse; width: 100%; font-size: 13px; }
table.dz th {
  text-align: start; background: #EFF5F0; padding: 9px 13px; white-space: nowrap; position: sticky; top: 0;
  font-family: var(--font-display); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-70);
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
table.dz th:hover { background: #E5EEE7; }
table.dz th .dir { color: var(--pri-3); }
table.dz td { padding: 8px 13px; border-bottom: 1px solid #EDF2EE; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.dz tbody tr:hover { background: #F7FAF7; }
table.dz tbody tr:last-child td { border-bottom: 0; }
table.dz td.num, table.dz th.num { text-align: end; }
table.dz a { text-decoration: none; font-weight: 600; }
table.dz a:hover { color: var(--pri-3); text-decoration: underline; }
.share-cell { display: inline-flex; align-items: center; gap: 7px; }
.share-cell .mini { width: 52px; height: 7px; background: #ECF2ED; border-radius: 99px; overflow: hidden; }
.share-cell .mini i { display: block; height: 100%; background: #E0559B; border-radius: 99px; }
.share-cell .mini.w { width: 84px; height: 8px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.pill.warn { background: #F3E4F7; color: #7B4FA8; }
.pill.ok { background: #E2F0EA; color: #1F7A5C; }
.dash-foot { margin-top: 30px; font-size: 12px; color: var(--ink-45); text-align: center; }

/* ---------- chart maximizer: expand button + full-screen viewer ---------- */
.ch-max {
  position: absolute; top: 10px; inset-inline-end: 10px; z-index: 5;
  width: 27px; height: 27px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; cursor: pointer; color: var(--ink-45); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; opacity: .5;
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.dcard:hover .ch-max { opacity: 1; }
.ch-max:hover { background: var(--mint); color: var(--pri); border-color: #BFE0CC; }
.ch-modal {
  position: fixed; inset: 0; z-index: 3000; background: rgba(6, 40, 24, .55);
  display: none; align-items: center; justify-content: center; padding: 26px;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.ch-modal.open { display: flex; }
.ch-panel {
  background: #FBFAF7; border-radius: 16px; width: min(1150px, 100%); max-height: 100%;
  display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.ch-head { display: flex; align-items: baseline; gap: 12px; padding: 16px 22px 12px; border-bottom: 2px solid #CFE3D6; flex: 0 0 auto; }
.ch-head b { font: 800 19px var(--font-display); letter-spacing: -.01em; }
.ch-head .ch-note { font-size: 13px; color: var(--ink-45); flex: 1; min-width: 0; }
.ch-close {
  border: 0; background: #ECF2ED; width: 34px; height: 34px; border-radius: 9px;
  font-size: 18px; cursor: pointer; color: var(--ink-70); flex: 0 0 auto; align-self: center;
}
.ch-close:hover { background: #DDE8DF; }
.ch-body { padding: 22px 28px 28px; overflow: auto; font-size: 14.5px; }
.ch-body h3, .ch-body .note, .ch-body .ch-max { display: none; }
.ch-body svg { max-width: 100%; height: auto; }
.ch-body .donut-row { gap: 36px; justify-content: center; }
.ch-body .donut-row > svg { width: min(420px, 58vw); }
.ch-body .dz-legend { font-size: 15px; gap: 9px; min-width: 220px; flex: 0 1 auto; }
.ch-body .dz-legend .sw { width: 13px; height: 13px; }
.ch-body .hbar { font-size: 14.5px; gap: 9px 14px; grid-template-columns: minmax(150px, auto) 1fr auto; }
.ch-body .hbar .tr { height: 19px; }
.ch-body .hbar .vl { font-size: 13.5px; }
.ch-body .share-cell .mini, .ch-body .share-cell .mini.w { width: 160px; height: 11px; }
.ch-body .tbl-scroll { max-height: none !important; overflow: visible !important; }
.ch-body table.dz { font-size: 13.5px; }
.ch-body .pie-block svg, .ch-body .colchart svg { width: 100%; }
@media (max-width: 640px) {
  .ch-modal { padding: 8px; }
  .ch-body { padding: 14px; }
  .ch-body .donut-row > svg { width: 78vw; }
}

/* ===== village card — redesigned popup (map) ===== */
.vcard { font-family: var(--font); width: 302px; margin: -2px -4px;
  max-height: min(68vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.vcard::-webkit-scrollbar { width: 7px; }
.vcard::-webkit-scrollbar-thumb { background: #CBDACE; border-radius: 99px; }
.vcard-hd {
  background: linear-gradient(135deg, #0A5230 0%, #14733F 100%);
  color: #fff; border-radius: 12px 12px 0 0; position: relative;
  /* the right gutter keeps the badge clear of Leaflet's close button */
  padding: 12px 40px 11px 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.vcard-hd > .vcard-txt { flex: 1 1 auto; min-width: 0; }
.vcard-hd h4 { font-family: var(--font-display); font-size: 16px; line-height: 1.2;
  margin: 0 0 3px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.vcard-hd .vsub { font-size: 11px; opacity: .82; display: block; line-height: 1.35;
  overflow-wrap: anywhere; }
/* in the flex row, not floating over the title */
.vcard-score {
  flex: 0 0 auto; text-align: center; order: 2;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.34);
  border-radius: 11px; padding: 4px 9px 3px; min-width: 46px;
}
.vcard-score b { display: block; font-size: 16px; line-height: 1; font-variant-numeric: tabular-nums; }
.vcard-score span { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.vcard-body { background: #fff; padding: 11px 13px 4px; }
.vsec { font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: #8AA394; margin: 11px 0 6px; display: flex; align-items: baseline;
  gap: 3px 7px; flex-wrap: wrap; }
.vsec:first-child { margin-top: 2px; }
.vsec::after { content: ""; flex: 1; height: 1px; background: #E5EDE7; }

/* facility chip grid */
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.vchip {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; line-height: 1.15;
}
.vchip i { font-style: normal; font-size: 12px; width: 13px; text-align: center; flex: none; }
.vchip.yes { background: #EAF6EE; color: #0A5230; border-color: #CBE6D6; }
.vchip.no  { background: #FDF1F1; color: #A02222; border-color: #F0D3D3; }
.vchip.yes i::before { content: "✓"; font-weight: 900; }
.vchip.no  i::before { content: "✗"; font-weight: 900; }

/* fact rows */
.vrow { display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 3.5px 0; border-bottom: 1px dashed #EDF2EE; font-size: 12px; }
.vrow:last-child { border-bottom: 0; }
.vrow > span { color: #62786C; }
.vrow > b { font-variant-numeric: tabular-nums; text-align: end; color: #17321F; font-weight: 800; }
.vrow b.bad { color: #B91C1C; }
.vrow b.good { color: #0D6A3E; }

/* mini meter */
.vmeter { height: 4px; border-radius: 99px; background: #EDF2EE; overflow: hidden; margin-top: 3px; }
.vmeter i { display: block; height: 100%; border-radius: 99px; }

/* census block */
.vcensus { background: #F6F9F6; border: 1px solid #E3ECE5; border-radius: 10px; padding: 9px 11px 7px; margin-top: 3px; }
.vcensus .vsec { margin-top: 0; color: #4A7A5E; }
/* the village's own Census 2023 record — the headline, not the surrounding circle */
.vcensus.own { background: #F2F8F3; border-color: #C9E0CF; border-inline-start: 4px solid #0D6A3E; margin-top: 6px; }
.vcensus.own .vsec { color: #0A5230; font-weight: 800; }
.vcensus.ctx { background: #FAFAF8; border-color: #E7E7E1; margin-top: 6px; opacity: .92; }
.vcensus.ctx .vsec { color: #6B7280; }
.vsrc { font-weight:600; font-size:9px; letter-spacing:.02em; text-transform:none;
  color:var(--ink-45); margin-inline-start:0; line-height:1.35; }
.vcensus .vsec2 { font: 800 9.5px var(--font-display); text-transform: uppercase; letter-spacing: .07em; color: #6B7280; margin: 8px 0 3px; padding-top: 6px; border-top: 1px solid #DFE8E1; }
.vbig { display: flex; gap: 8px; margin-bottom: 7px; }
.vbig div { flex: 1; background: #fff; border: 1px solid #E3ECE5; border-radius: 8px; padding: 6px 8px; }
.vbig b { display: block; font-size: 14.5px; color: #0A5230; font-variant-numeric: tabular-nums; line-height: 1.1; }
.vbig span { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: #7A9186; }
.vcard-ft { padding: 8px 13px 11px; font-size: 10px; color: #94A99C; line-height: 1.45; }
.vcard-ft a { color: #0A5230; font-weight: 700; text-decoration: none; }
.vcard-acts { display: flex; gap: 6px; padding: 0 13px 10px; }
.vcard-acts a {
  flex: 1; text-align: center; font-size: 11px; font-weight: 800; padding: 6px 4px;
  border-radius: 8px; background: #0A5230; color: #fff; text-decoration: none;
}
.vcard-acts a.alt { background: #fff; color: #0A5230; border: 1.5px solid #0A5230; }
.leaflet-popup-content-wrapper:has(.vcard) { padding: 0; border-radius: 13px; overflow: hidden; }
.leaflet-popup-content:has(.vcard) { margin: 0; width: 302px !important; }
.vcard > .vcard-hd { position: sticky; top: 0; z-index: 3; }

/* village card — school list, notes */
.vnote { font-size: 10px; color: #7A9186; line-height: 1.45; margin: -2px 0 7px; }
.vschools { display: grid; gap: 4px; margin: 6px 0 2px; }
.vsch { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 8px;
  background: #F6F9F6; border: 1px solid #E3ECE5; text-decoration: none; color: #17321F; }
.vsch:hover { border-color: #0A5230; background: #EFF6F1; }
.vsch i { width: 7px; height: 7px; border-radius: 99px; flex: none; }
.vsch i.gb { background: #23557E; } .vsch i.gg { background: #E0559B; } .vsch i.gm { background: #6E8093; }
.vsch .nm { flex: 1; font-size: 11.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsch .mt { font-size: 10px; color: #6E8478; font-variant-numeric: tabular-nums; flex: none; }
.vmore { font-size: 10.5px; color: #7A9186; padding: 2px 8px; }
.vcard-acts a[data-vpdf] { cursor: pointer; }

/* village cluster bubbles — brick, to read apart from the green school clusters */
.vil-cluster {
  background: radial-gradient(circle at 32% 28%, #A8461C 0%, #7C2D12 72%);
  border: 2.5px solid rgba(255,255,255,.92); border-radius: 50%;
  box-shadow: 0 2px 8px rgba(90,30,10,.42); display: flex; align-items: center; justify-content: center;
}
.vil-cluster span {
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 12.5px;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.poly-label.vil span { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- area report inside the Schools filter ------------------------------- */
.area-rep { margin: 8px 0 2px; padding: 9px 10px 8px; border: 1px solid #E3ECE5;
            border-radius: 10px; background: linear-gradient(#FBFDFB, #F4F8F5); }
.area-rep .vsec { margin-top: 0; color: #0A5230; }
.area-rep .vsec2 { margin-top: 9px; padding-top: 7px; border-top: 1px solid #E3ECE5;
                   color: #6B7280; }
.area-rep .vrow { padding: 3px 0; font-size: 11px; }
.area-rep .vbig div { background: #fff; }
.area-rep .vnote { margin: 7px 0 0; }
.area-rep .vfoot { font-size: 9.5px; line-height: 1.45; color: #8A6D3B; background: #FFF8E7;
                   border: 1px solid #F0E2C0; border-radius: 6px; padding: 4px 6px; margin: 4px 0 2px; }
.area-rep .vfoot b { color: #6B5320; font-variant-numeric: tabular-nums; }
.area-rep .arep-acts { margin-top: 8px; padding-top: 8px; border-top: 1px solid #E3ECE5;
                       display: flex; flex-direction: column; gap: 5px; }
.area-rep .arep-acts .clearbtn { margin: 0; text-align: start; line-height: 1.35; }
.area-rep .arep-acts .clearbtn b { display: block; }

/* --- dark operations basemap: re-tint the overlays that sit on the map ----- */
body.map-dark .legend-chip,
body.map-dark .map-panel {
  background: rgba(11, 20, 17, .82);
  border-color: rgba(120, 220, 170, .22);
  color: #C8DCD1;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
}
body.map-dark .legend-chip .lbl { color: #EAF6EF; }
body.map-dark .legend-chip .lg .dot,
body.map-dark .legend-chip .lg .rline { border-color: rgba(255, 255, 255, .35); }
body.map-dark .leaflet-control-zoom a {
  background: rgba(11, 20, 17, .88);
  color: #D6EDE1;
  border-color: rgba(120, 220, 170, .2);
}
body.map-dark .leaflet-control-zoom a:hover { background: rgba(22, 40, 32, .95); color: #fff; }
body.map-dark .leaflet-control-attribution {
  background: rgba(11, 20, 17, .72); color: #8FA79A;
}
body.map-dark .leaflet-control-attribution a { color: #7FD3A8; }
body.map-dark .leaflet-control-scale-line {
  background: rgba(11, 20, 17, .7); color: #C8DCD1; border-color: rgba(120, 220, 170, .35);
}

  /* =====================================================================
     COMMAND CONSOLE - the in-map operations HUD.
     z-index 820: above .legend-chip / .leaflet-control (800), below
     .gis-dock (860), .dock-toggle (870) and .fs-dock (950), so the zoom
     control, the tools button and the attribution can never be covered.
     The palette is the project's own dark language, not an imported one.
     Physical `right`, not inset-inline-end, on purpose: Leaflet does not
     mirror its control corners in RTL and .legend-chip already uses a
     physical `left`, so a logical inset would land this on the zoom control.
     ===================================================================== */
  .hud-console {
    --hud-bg:   rgba(8,16,13,.90);
    --hud-bg2:  rgba(6,12,10,.94);
    --hud-line: rgba(120,220,170,.22);
    --hud-edge: rgba(127,211,168,.55);
    --hud-neon: #7FD3A8;
    --hud-txt:  #C8DCD1;
    --hud-hi:   #EAF6EF;
    --hud-mute: #9DB6A8;
    --hud-bad:  #FF9A9A;
    --hud-ring: rgba(255,255,255,.30);
    --hud-ease: cubic-bezier(.32,.72,.28,1);
    --hud-mono: ui-monospace,"Cascadia Mono","Segoe UI Mono",Consolas,"SF Mono",Menlo,"DejaVu Sans Mono",monospace;
    position:absolute; top:112px; right:12px; z-index:820;
    width:272px; max-width:calc(100% - 24px);
    max-height:min(calc(100% - 124px), max(210px, calc(100% - 200px)));
    display:flex; flex-direction:column; overflow:hidden; isolation:isolate;
    background:linear-gradient(180deg,var(--hud-bg),var(--hud-bg2));
    border:1px solid var(--hud-line); border-radius:14px;
    -webkit-backdrop-filter:blur(10px) saturate(1.15);
            backdrop-filter:blur(10px) saturate(1.15);
    /* a dark panel on a PALE street map separates by an OUTER highlight -
       an inner one is invisible against its own dark glass */
    box-shadow:0 0 0 1px var(--hud-ring), 0 14px 40px rgba(0,0,0,.45);
    color:var(--hud-txt); font-family:var(--font-body); font-size:12px; line-height:1.35;
    transition:opacity .22s var(--hud-ease);
    animation:hudBoot .40s var(--hud-ease) both;
  }
  /* the operations basemap is already dark - lighten the glass, drop the ring */
  body.map-dark .hud-console {
    --hud-bg:rgba(11,20,17,.78); --hud-bg2:rgba(8,15,13,.86);
    --hud-ring:rgba(120,220,170,.20);
  }
  @supports not ((backdrop-filter:blur(2px)) or (-webkit-backdrop-filter:blur(2px))) {
    .hud-console { --hud-bg:rgba(8,16,13,.97); --hud-bg2:rgba(6,12,10,.98); }
  }
  @keyframes hudBoot { from { opacity:0; transform:translateY(-8px) scale(.986); } }

  /* corner brackets - inside the panel's own box, never inset from the map,
     so they can never paint over the legend chip or a Leaflet control */
  .hud-frame { position:absolute; inset:0; pointer-events:none; z-index:3; }
  .hud-frame i { position:absolute; width:16px; height:16px; border:0 solid var(--hud-edge); }
  .hud-frame .tl { top:5px;    left:5px;  border-width:1.5px 0 0 1.5px; border-radius:9px 0 0 0; }
  .hud-frame .tr { top:5px;    right:5px; border-width:1.5px 1.5px 0 0; border-radius:0 9px 0 0; }
  .hud-frame .bl { bottom:5px; left:5px;  border-width:0 0 1.5px 1.5px; border-radius:0 0 0 9px; }
  .hud-frame .br { bottom:5px; right:5px; border-width:0 1.5px 1.5px 0; border-radius:0 0 9px 0; }

  /* the header strip is also the collapse control */
  .hud-bar {
    -webkit-appearance:none; appearance:none; display:flex; align-items:center; gap:9px;
    margin:0; padding:9px 13px 8px; border:0; border-bottom:1px solid var(--hud-line);
    background:
      repeating-linear-gradient(180deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px),
      linear-gradient(180deg, rgba(127,211,168,.11), rgba(127,211,168,0));
    color:var(--hud-hi); cursor:pointer; text-align:start; width:100%; font:inherit;
    transition:background .2s var(--hud-ease);
  }
  .hud-bar:hover { background:linear-gradient(180deg, rgba(127,211,168,.18), rgba(127,211,168,.02)); }
  .hud-bar:focus-visible { outline:2px solid var(--hud-neon); outline-offset:-3px; }
  .hud-live {
    display:inline-flex; align-items:center; gap:6px;
    font:800 9.5px/1 var(--font-display);
    text-transform:uppercase; letter-spacing:.12em; color:var(--hud-neon);
  }
  /* named hudBeat, not sedPulse: that name is already declared twice in this app */
  .hud-live i {
    width:7px; height:7px; border-radius:50%; background:#4ADE80; flex:0 0 auto;
    box-shadow:0 0 0 0 rgba(74,222,128,.55);
    animation:hudBeat 2.6s var(--hud-ease) infinite;
  }
  @keyframes hudBeat {
    0%   { box-shadow:0 0 0 0 rgba(74,222,128,.55); }
    70%  { box-shadow:0 0 0 7px rgba(74,222,128,0); }
    100% { box-shadow:0 0 0 0 rgba(74,222,128,0); }
  }
  .hud-lvl {
    margin-inline-start:auto;
    font:800 9.5px/1 var(--font-display);
    text-transform:uppercase; letter-spacing:.14em; color:var(--hud-mute);
    border:1px solid var(--hud-line); border-radius:5px; padding:3px 7px;
    transition:color .25s var(--hud-ease), border-color .25s var(--hud-ease);
  }
  .hud-console:not([data-scope="province"]) .hud-lvl { color:var(--hud-neon); border-color:var(--hud-edge); }
  .hud-caret { color:var(--hud-mute); font-size:11px; line-height:1; }

  .hud-body { padding:11px 13px 10px; overflow-y:auto; overscroll-behavior:contain; }
  .hud-console.hud-min .hud-body { display:none; }

  .hud-name {
    font:800 16px/1.15 var(--font-display); color:var(--hud-hi);
    letter-spacing:.005em; overflow-wrap:anywhere;
  }
  .hud-sub { margin-top:2px; font-size:10.5px; color:var(--hud-mute); }

  /* the one moving line. Its rest state is off-panel, so killing the
     animation hides it cleanly - nothing sits there inert. */
  .hud-rule {
    position:relative; height:2px; margin:9px 0 10px; overflow:hidden; border-radius:2px;
    background:linear-gradient(90deg, transparent, var(--hud-line) 12%, var(--hud-line) 88%, transparent);
  }
  .hud-rule i {
    position:absolute; top:0; bottom:0; left:0; width:38%;
    background:linear-gradient(90deg, transparent, var(--hud-neon), transparent);
    transform:translateX(-130%);
    animation:hudScan 9s var(--hud-ease) infinite;
  }
  @keyframes hudScan { 0%,66% { transform:translateX(-130%); } 100% { transform:translateX(300%); } }

  /* the scope assertion - the most instrument-looking element on the panel
     and simultaneously the disclaimer. Never display:none it. */
  .hud-scope { display:flex; align-items:center; gap:7px; margin-bottom:9px; }
  .hud-scope > span:last-child { font-size:9.5px; line-height:1.3; color:var(--hud-mute); }
  .hud-brk {
    flex:0 0 auto; display:inline-flex; align-items:center; padding:2px 4px;
    font:800 8.5px/1 var(--font-display); text-transform:uppercase; letter-spacing:.16em;
    color:var(--hud-neon); white-space:nowrap;
  }
  .hud-brk::before, .hud-brk::after { content:""; width:4px; height:11px; border:1px solid var(--hud-edge); }
  .hud-brk::before { border-inline-end:0; margin-inline-end:5px; }
  .hud-brk::after  { border-inline-start:0; margin-inline-start:5px; }

  .hud-heroes { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .hud-hero {
    border:1px solid var(--hud-line); border-radius:9px; padding:7px 9px 6px;
    background:linear-gradient(180deg, rgba(127,211,168,.07), rgba(127,211,168,0));
  }
  .hud-hero b {
    display:block; font:800 19px/1.05 var(--font-display); color:var(--hud-hi);
    font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1;
  }
  .hud-hero span {
    display:block; margin-top:3px;
    font:800 8.5px/1.2 var(--font-display); text-transform:uppercase;
    letter-spacing:.08em; color:var(--hud-mute);
  }
  .hud-hero em { display:block; margin-top:2px; font-style:normal; font-size:9px; color:var(--hud-mute); }
  .hud-hero em i { font-style:normal; font-variant-numeric:tabular-nums; }

  /* solid hairlines, not dotted leaders: a dotted leader is an invoice idiom
     and is what made the first draft read as a settings panel painted black */
  .hud-rows { margin:9px 0 0; }
  .hud-row {
    display:flex; align-items:baseline; gap:10px;
    padding:5px 0; border-bottom:1px solid rgba(127,211,168,.10);
  }
  .hud-row:last-child { border-bottom:0; }
  .hud-row .k { flex:1 1 auto; font-size:11px; color:var(--hud-txt); }
  .hud-row .k em { display:block; margin-top:1px; font-style:normal; font-size:9px; color:var(--hud-mute); }
  .hud-row .k em i { font-style:normal; font-variant-numeric:tabular-nums; }
  .hud-row > b {
    flex:0 0 auto; color:var(--hud-hi);
    font-family:var(--hud-mono); font-size:12.5px; font-weight:600;
    font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"zero" 1;
  }
  .hud-row > b.bad { color:var(--hud-bad); }

  .hud-sec {
    margin:11px 0 5px; padding-top:8px; border-top:1px solid var(--hud-line);
    font:800 8.5px/1.2 var(--font-display); text-transform:uppercase;
    letter-spacing:.11em; color:var(--hud-neon);
  }

  .hud-mix {
    display:flex; height:7px; border-radius:99px; overflow:hidden;
    background:rgba(255,255,255,.07); box-shadow:inset 0 0 0 1px var(--hud-line);
  }
  .hud-mix i { display:block; width:0; transition:width .32s var(--hud-ease); }
  /* the categorical hexes are load-bearing - identical to the legend chip, the
     dock swatches and the PDF plates. Neon comes from a same-hue glow, never a
     hue shift and never a white overlay, which would desaturate them to chalk. */
  .hud-mix .p { background:#1F7A5C; } .hud-mix .m { background:#C2802B; }
  .hud-mix .h { background:#23557E; } .hud-mix .s { background:#7B4FA8; }
  .hud-keys { display:flex; flex-wrap:wrap; gap:4px 11px; margin-top:7px; }
  .hud-keys .k {
    display:inline-flex; align-items:center; gap:5px;
    font:800 9px/1 var(--font-display); letter-spacing:.07em; color:var(--hud-mute);
  }
  .hud-keys .k i { width:7px; height:7px; border-radius:2px; }
  .hud-keys .p i { background:#1F7A5C; box-shadow:0 0 7px rgba(31,122,92,.95); }
  .hud-keys .m i { background:#C2802B; box-shadow:0 0 7px rgba(194,128,43,.95); }
  .hud-keys .h i { background:#23557E; box-shadow:0 0 7px rgba(35,85,126,.95); }
  .hud-keys .s i { background:#7B4FA8; box-shadow:0 0 7px rgba(123,79,168,.95); }
  .hud-keys .k b {
    font-family:var(--hud-mono); font-size:10.5px; color:var(--hud-hi);
    font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"zero" 1;
  }

  /* the caveat strip, kept in the same mint temperature as the panel so it does
     not read as a warning label taped onto the glass */
  .hud-note {
    margin:7px 0 0; padding:6px 8px; border-radius:7px; font-size:9.5px; line-height:1.42;
    color:#B9D6C6; background:rgba(127,211,168,.07);
    border:1px solid rgba(127,211,168,.20);
  }

  .hud-state { display:flex; align-items:baseline; gap:9px; margin:0 0 4px; font-size:10.5px; }
  .hud-state > span {
    flex:0 0 auto; font:800 8.5px/1.4 var(--font-display);
    text-transform:uppercase; letter-spacing:.09em; color:var(--hud-mute);
  }
  .hud-state > i {
    font-style:normal; flex:1 1 auto; text-align:end; color:var(--hud-txt);
    font-weight:600; overflow-wrap:anywhere;
  }

  .hud-foot {
    display:flex; flex-wrap:wrap; gap:3px 10px; margin-top:10px; padding-top:8px;
    border-top:1px solid var(--hud-line);
    font-family:var(--hud-mono); font-size:9.5px; color:var(--hud-mute);
    font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"zero" 1;
  }
  .hud-foot span:nth-child(2) { color:var(--hud-neon); }

  .hud-sr { position:absolute; width:1px; height:1px; margin:0; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; }

  /* a school card can be dragged under the console - fade, never hide */
  .hud-console.hud-quiet { opacity:.32; }
  .hud-console.hud-quiet:hover, .hud-console.hud-quiet:focus-within { opacity:1; }
  /* the Area Intelligence Report owns the screen at z 1200 - stand down */
  body.imx-open .hud-console { opacity:0; pointer-events:none; }

  @media (prefers-reduced-motion: reduce) {
    .hud-console, .hud-rule i, .hud-live i, .hud-mix i, .hud-bar, .hud-lvl {
      animation:none !important; transition:none !important;
    }
    .hud-rule i { opacity:0; }
    .hud-live i { box-shadow:0 0 0 2.5px rgba(74,222,128,.30); }
  }

  /* 760px, not 700px: that is where the dock becomes an off-canvas overlay */
  @media (max-width:760px) {
    .hud-console {
      top:126px; left:10px; right:10px; width:auto; max-width:none;
      max-height:min(calc(100% - 138px), max(190px, min(50vh, calc(100% - 220px))));
      border-radius:12px;
    }
    .hud-name { font-size:15px; }
    .hud-heroes { grid-template-columns:1fr 1fr; }
    .hud-rows { display:grid; grid-template-columns:1fr 1fr; column-gap:16px; }
    .hud-row { border-bottom:1px solid rgba(127,211,168,.10); }
    .hud-row:nth-last-child(2) { border-bottom:0; }
    /* .hud-note, .hud-scope and .hud-foot are NEVER hidden - the caveat and the
       coverage / as-of line are the honesty structure, not decoration. */
    .hud-note { font-size:9px; padding:5px 7px; }
    .hud-foot { font-size:9px; }
    .hud-console.hud-min { max-height:none; }
  }
  @media (max-width:480px) {
    .hud-console { max-height:min(calc(100% - 138px), max(180px, min(46vh, calc(100% - 210px)))); }
    .hud-rows { grid-template-columns:1fr; }
    .hud-row:nth-last-child(2) { border-bottom:1px solid rgba(127,211,168,.10); }
    .hud-row:last-child { border-bottom:0; }
  }


  /* ---- the sense of data moving through the console ---------------------
     hudTick fires only on a value that actually changed, so it marks a real
     recomputation. The other two are texture, attached to no figure. */
  @keyframes hudTick {
    0%   { text-shadow:0 0 0 rgba(127,211,168,0); }
    16%  { text-shadow:0 0 12px rgba(127,211,168,.95); }
    100% { text-shadow:0 0 0 rgba(127,211,168,0); }
  }
  .hud-tick-a, .hud-tick-b { animation:hudTick .62s var(--hud-ease); }

  .hud-body { position:relative; isolation:isolate; }
  .hud-body::before {
    content:""; position:absolute; inset:-40px 0; z-index:-1; pointer-events:none;
    background:repeating-linear-gradient(180deg,
      rgba(127,211,168,.055) 0 1px, transparent 1px 23px);
    -webkit-mask-image:linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
            mask-image:linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
    animation:hudFlow 6s linear infinite;
  }
  @keyframes hudFlow { to { transform:translateY(23px); } }

  .hud-mix { position:relative; }
  .hud-mix::after {
    content:""; position:absolute; inset:0; border-radius:99px; pointer-events:none;
    background:linear-gradient(90deg, transparent, rgba(255,255,255,.40), transparent);
    transform:translateX(-100%);
    animation:hudSheen 4.6s var(--hud-ease) infinite;
  }
  @keyframes hudSheen { 0%,55% { transform:translateX(-100%); } 100% { transform:translateX(100%); } }

  @media (prefers-reduced-motion: reduce) {
    .hud-tick-a, .hud-tick-b, .hud-body::before, .hud-mix::after {
      animation:none !important;
    }
    .hud-body::before, .hud-mix::after { opacity:0; }
  }

  /* a map with nothing in its top-right corner does not need the 112px reserve */
  .hud-console.hud-flush { top:12px; }
  .hud-console.hud-flush { max-height:min(calc(100% - 24px), max(210px, calc(100% - 100px))); }

  /* the Intelligence console shades by rank on a ramp, not by school level, so
     its bar carries the ramp's own colours rather than the categorical hexes */
  .hud-mix.q .q1 { background:#D7EBDF; }
  .hud-mix.q .q2 { background:#7FC79E; }
  .hud-mix.q .q3 { background:#2E9160; }
  .hud-mix.q .q4 { background:#0A5230; }
  .hud-keys .q1 i { background:#D7EBDF; box-shadow:0 0 7px rgba(215,235,223,.55); }
  .hud-keys .q2 i { background:#7FC79E; box-shadow:0 0 7px rgba(127,199,158,.75); }
  .hud-keys .q3 i { background:#2E9160; box-shadow:0 0 7px rgba(46,145,96,.85); }
  .hud-keys .q4 i { background:#0A5230; box-shadow:0 0 8px rgba(22,163,74,.85); }

  /* ---- console donuts, class ladder and the recommendation block --------- */
  .hud-pies { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:2px; }
  .hud-pie { position:relative; text-align:center; }
  .hud-pie svg { display:block; width:100%; height:auto; max-width:96px; margin:0 auto; }
  /* the flow: a share change sweeps the ring rather than jumping */
  .hud-pie svg circle { transition:stroke-dasharray .55s var(--hud-ease), stroke-dashoffset .55s var(--hud-ease); }
  .hud-pie > b {
    position:absolute; inset-inline:0; top:50%; transform:translateY(-52%);
    font-family:var(--hud-mono); font-size:12px; font-weight:600; color:var(--hud-hi);
    font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"zero" 1;
    pointer-events:none;
  }
  .hud-pie > span {
    display:block; margin-top:4px;
    font:800 8.5px/1.2 var(--font-display); text-transform:uppercase;
    letter-spacing:.08em; color:var(--hud-mute);
  }
  .hud-keys .gb i { background:#23557E; box-shadow:0 0 7px rgba(35,85,126,.95); }
  .hud-keys .gg i { background:#E0559B; box-shadow:0 0 7px rgba(224,85,155,.95); }
  .hud-keys .gm i { background:#6E8093; box-shadow:0 0 7px rgba(110,128,147,.85); }
  .hud-keys .c0 i { background:#C2802B; box-shadow:0 0 7px rgba(194,128,43,.95); }
  .hud-keys .c1 i { background:#1F7A5C; box-shadow:0 0 7px rgba(31,122,92,.95); }
  .hud-keys .c2 i { background:#23557E; box-shadow:0 0 7px rgba(35,85,126,.95); }
  .hud-keys .c3 i { background:#7B4FA8; box-shadow:0 0 7px rgba(123,79,168,.95); }
  .hud-keys .c4 i { background:#E0559B; box-shadow:0 0 7px rgba(224,85,155,.95); }

  .hud-load {
    -webkit-appearance:none; appearance:none; width:100%; margin-top:7px;
    padding:6px 9px; border-radius:8px; cursor:pointer; text-align:start;
    border:1px dashed var(--hud-line); background:rgba(127,211,168,.05);
    color:var(--hud-txt); font:600 10.5px/1.3 var(--font-body);
  }
  .hud-load:hover { background:rgba(127,211,168,.12); border-style:solid; }
  .hud-load em { display:block; font-style:normal; font-size:9px; color:var(--hud-mute); margin-top:1px; }

  .hud-rec {
    margin-top:7px; padding:7px 9px; border-radius:8px;
    border:1px solid var(--hud-line);
    background:linear-gradient(180deg, rgba(127,211,168,.09), rgba(127,211,168,0));
  }
  .hud-rec > span {
    display:block; font:800 8.5px/1.2 var(--font-display); text-transform:uppercase;
    letter-spacing:.09em; color:var(--hud-mute);
  }
  .hud-rec > b {
    display:block; margin-top:3px; font:800 12.5px/1.25 var(--font-display);
    color:var(--hud-hi); overflow-wrap:anywhere;
  }
  .hud-rec > em { display:block; margin-top:2px; font-style:normal; font-size:9.5px; color:var(--hud-neon); }
  @media (prefers-reduced-motion: reduce) { .hud-pie svg circle { transition:none !important; } }

  /* the console mounted in a side rail rather than floating over a map */
  .lv-rail .hud-console { position:static; width:auto; max-width:none; max-height:none; animation:none; }

/* ===================================================================== */
/* LIVE ANALYSIS STRIP - the panels below the map on index.html.         */
/* Dark on purpose: it is the same instrument as the console floating    */
/* over the map, not a light card that happens to sit underneath it.     */
/* ===================================================================== */
.anl {
  --a-line:#1E2F2B; --a-neon:#34D399; --a-txt:#B7C7CE; --a-mute:#7E939C;
  --a-ease:cubic-bezier(.32,.72,.28,1);
  flex:0 0 auto; background:#070D11; border-top:1px solid #14201F; z-index:880;
  display:flex; flex-direction:column;
  /* a share of the screen, so a short display still shows a map */
  max-height:min(342px, 38vh);
  transition:max-height .2s var(--a-ease);
}
.anl.anl-min { max-height:38px; }
.anl-bar {
  -webkit-appearance:none; appearance:none; display:flex; align-items:center; gap:11px;
  width:100%; padding:9px 18px; border:0; cursor:pointer; text-align:start;
  background:linear-gradient(180deg,rgba(52,211,153,.09),transparent); color:#EAF4F2; font:inherit;
}
.anl-bar:hover { background:linear-gradient(180deg,rgba(52,211,153,.16),transparent); }
.anl-bar:focus-visible { outline:2px solid var(--a-neon); outline-offset:-3px; }
.anl-t { font:800 10px/1 var(--font-display); text-transform:uppercase; letter-spacing:.13em; color:var(--a-neon); }
.anl-sc { font-size:11px; color:var(--a-mute); }
.anl-car { margin-inline-start:auto; color:var(--a-mute); font-size:12px; }
.anl-body { overflow:auto; padding:0 18px 14px; display:flex; flex-direction:column; gap:12px; }
.anl.anl-min .anl-body { display:none; }

.anl-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(184px,1fr)); gap:11px; }
.anl-kpi { position:relative; padding:12px 13px 11px; border-radius:14px; overflow:hidden;
  border:1px solid var(--a-line);
  background:linear-gradient(150deg,color-mix(in srgb,var(--c) 11%,transparent),rgba(255,255,255,.012) 62%); }
.anl-kpi .ic { width:36px; height:36px; border-radius:10px; display:grid; place-items:center; margin-bottom:9px;
  background:color-mix(in srgb,var(--c) 18%,transparent); }
.anl-kpi .ic svg { width:18px; height:18px; color:var(--c); }
.anl-kpi h3 { margin:0; font:700 9.5px/1.2 var(--font-body); text-transform:uppercase;
  letter-spacing:.1em; color:var(--c); }
.anl-kpi b { display:block; margin-top:5px; font:800 25px/1.02 var(--font-display); color:#fff;
  font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.anl-kpi .sub { display:block; margin-top:4px; font-size:10px; color:var(--a-mute); line-height:1.4; }
.anl-kpi .dl { display:inline-block; margin-top:7px; font-size:10.5px; font-weight:600; }
.anl-kpi .dl.up { color:#4ADE80; } .anl-kpi .dl.dn { color:#FB7185; } .anl-kpi .dl.flat { color:#94A3B8; }

.anl-cards { display:grid; grid-template-columns:1.45fr 1fr 1fr 1.05fr; gap:11px; }
.anl-card { border:1px solid var(--a-line); border-radius:14px; padding:12px 13px 11px;
  background:#0A121A; min-width:0; }
.anl-card > h3 { margin:0 0 11px; font:700 10px/1.2 var(--font-body); text-transform:uppercase;
  letter-spacing:.09em; color:#fff; display:flex; align-items:baseline; gap:7px; }
.anl-card > h3 em { font-style:normal; color:var(--a-mute); letter-spacing:.05em; font-size:9.5px; font-weight:500; }
.anl-card > h3 a { margin-inline-start:auto; color:#38BDF8; text-decoration:none; font-size:10px;
  text-transform:none; letter-spacing:0; font-weight:600; }
.anl-pie { display:flex; align-items:center; gap:12px; }
.anl-pie svg.dn { width:104px; height:104px; flex:0 0 auto; }
.anl-pie svg.dn circle { transition:stroke-dasharray .6s var(--a-ease), stroke-dashoffset .6s var(--a-ease); }
.anl-leg { flex:1; min-width:0; display:flex; flex-direction:column; gap:7px; }
.anl-leg .li { display:flex; align-items:center; gap:8px; font-size:11.5px; color:var(--a-txt); }
.anl-leg .li i { width:10px; height:10px; border-radius:3px; flex:0 0 auto; }
.anl-leg .li b { margin-inline-start:auto; font-size:11.5px; color:#fff; font-variant-numeric:tabular-nums; }
.anl-bars { display:flex; flex-direction:column; gap:8px; }
.anl-bar { display:flex; align-items:center; gap:9px; font-size:11.5px; }
.anl-bar > span { flex:0 0 56px; color:var(--a-txt); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.anl-bar .tr { flex:1; height:9px; border-radius:99px; background:rgba(255,255,255,.05); overflow:hidden; }
.anl-bar .tr i { display:block; height:100%; border-radius:99px; width:0; transition:width .6s var(--a-ease); }
.anl-bar > b { flex:0 0 auto; font-size:11.5px; color:#fff; font-variant-numeric:tabular-nums; }
.anl-note { margin:10px 0 0; font-size:9.5px; line-height:1.5; color:#9FC4B4;
  background:rgba(52,211,153,.06); border:1px solid rgba(52,211,153,.16); border-radius:8px; padding:7px 9px; }
.anl-tip { position:absolute; pointer-events:none; z-index:5; padding:7px 10px; border-radius:9px;
  background:#0E1B24; border:1px solid #2A4640; font-size:11px; line-height:1.45; color:var(--a-txt);
  box-shadow:0 10px 26px rgba(0,0,0,.5); white-space:nowrap; opacity:0; transition:opacity .15s var(--a-ease); }
.anl-tip b { display:block; color:#fff; font-size:12px; margin-bottom:2px; }

@media (max-width:1200px) { .anl-cards { grid-template-columns:1fr 1fr; }
  .anl { max-height:min(400px, 42vh); } }
@media (max-width:760px) { .anl-cards { grid-template-columns:1fr; } .anl { max-height:52vh; } }
@media (prefers-reduced-motion: reduce) { .anl, .anl *, .anl *::before { transition:none !important; } }

/* ---- basemap pills, on the map itself ---------------------------------- */
.bmp {
  position:absolute; top:12px; left:50%; transform:translateX(-50%); z-index:820;
  display:flex; gap:3px; padding:4px; border-radius:13px;
  background:rgba(255,255,255,.94); border:1px solid var(--line);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  box-shadow:0 6px 22px rgba(10,60,35,.20);
}
.bmp button {
  display:inline-flex; align-items:center; gap:6px; padding:7px 11px; border:0; cursor:pointer;
  border-radius:10px; background:transparent; color:var(--ink-70);
  font:700 11.5px/1 var(--font-body); white-space:nowrap;
  transition:background .18s ease, color .18s ease;
}
.bmp button svg { width:15px; height:15px; flex:0 0 auto; opacity:.75; }
.bmp button:hover { background:var(--mint); color:var(--ink); }
.bmp button:focus-visible { outline:2px solid var(--pri-2); outline-offset:-2px; }
.bmp button.on { background:linear-gradient(160deg,var(--pri-2),var(--pri)); color:#fff; }
.bmp button.on svg { opacity:1; }

/* on the dark operations basemap the group must not glare */
body.map-dark .bmp { background:rgba(11,20,17,.86); border-color:rgba(120,220,170,.22);
  box-shadow:0 8px 26px rgba(0,0,0,.5); }
body.map-dark .bmp button { color:#C8DCD1; }
body.map-dark .bmp button:hover { background:rgba(120,220,170,.14); color:#fff; }
body.map-dark .bmp button.on { background:linear-gradient(160deg,#15883B,#0A5230); color:#fff; }

/* narrow maps: drop the words, keep the icons */
@media (max-width:1080px) {
  .bmp button span { display:none; }
  .bmp button { padding:8px 10px; }
}
@media (max-width:520px) { .bmp { top:8px; } }
@media (prefers-reduced-motion: reduce) { .bmp button { transition:none; } }

/* ---- folding the layers dock ------------------------------------------- */
/* display:none, not width:0 - the dock is a flex item full of <select>s and
   its min-content width refuses to shrink. This is the same mechanism as the
   .dock-hidden class the app already ships. */
.gis-dock.dock-fold { display: none; }
.dock-tab {
  position: absolute; z-index: 872; top: 50%; transform: translateY(-50%);
  left: 302px; margin-left: -1px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 5px; border: 1px solid var(--line);
  border-top-right-radius: 11px; border-bottom-right-radius: 11px; border-left: 0;
  background: rgba(255,255,255,.95); color: var(--ink-70); cursor: pointer;
  box-shadow: 4px 0 16px rgba(10,60,35,.14);
  transition: left .22s ease, background .18s ease, color .18s ease;
}
.dock-tab:hover { background: var(--mint); color: var(--pri); }
.dock-tab:focus-visible { outline: 2px solid var(--pri-2); outline-offset: 2px; }
.dock-tab svg { width: 15px; height: 15px; transition: transform .22s ease; }
.dock-tab-l {
  writing-mode: vertical-rl; font: 800 9.5px/1 var(--font-display);
  text-transform: uppercase; letter-spacing: .13em;
}
/* left is set by fold() in index.html - the cascade would not move it here */
body.dock-folded .dock-tab svg { transform: rotate(180deg); }
body.map-dark .dock-tab { background: rgba(11,20,17,.88); color: #C8DCD1;
  border-color: rgba(120,220,170,.22); }
body.map-dark .dock-tab:hover { background: rgba(120,220,170,.16); color: #fff; }
.dock-auto { margin-top: 4px; }

/* the dock is already an off-canvas overlay here, so the tab would duplicate
   the existing hamburger */
@media (max-width: 760px) { .dock-tab { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .dock-tab, .dock-tab svg { transition: none !important; }
}

/* ---- the live legend bar (index.html, foot of the map) ------------------ */
.legend-chip {
  inset-inline: 14px !important; bottom: 30px !important; left: 14px !important;
  right: 14px !important; width: auto !important;
  background: linear-gradient(180deg, rgba(8,20,16,.93), rgba(6,14,11,.96)) !important;
  border: 1px solid rgba(120,220,170,.20) !important; border-radius: 14px !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 14px 38px rgba(0,0,0,.45) !important;
  color: #B7C7CE !important; padding: 10px 14px !important;
  gap: 8px 16px !important; align-items: center !important;
}
.legend-chip .lbl { color: #E7B667 !important; font-size: 10px !important; letter-spacing: .14em !important; }
.legend-chip .lg { color: #C8DCD1; font-size: 12.5px; font-weight: 600; }
.legend-chip .lg .dot { border-color: rgba(255,255,255,.3) !important; }
.lg-sep { flex: 1 1 12px; min-width: 8px; height: 1px; background: rgba(120,220,170,.16); }
.lg-stats { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.lg-stats .st { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.lg-stats .st b {
  font: 800 19px/1 var(--font-display); color: #fff; font-variant-numeric: tabular-nums;
}
.lg-stats .st b.vio { color: #C4A6F5; }
.lg-stats .st i {
  font-style: normal; margin-top: 4px; font-size: 9.5px; color: #8CA79A; white-space: nowrap;
}
.lg-mix {
  font-size: 11.5px; color: #8CA79A; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.lg-min {
  margin-inline-start: auto; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; border: 1px solid rgba(120,220,170,.22); background: rgba(255,255,255,.05);
  color: #C8DCD1; font: 700 15px/1 var(--font-body);
}
.lg-min:hover { background: rgba(120,220,170,.16); color: #fff; }
.lg-min:focus-visible { outline: 2px solid #7FD3A8; outline-offset: 2px; }
/* the need-index ramp keeps its own row */
.legend-chip #chipInd { color: #C8DCD1; }
.legend-chip #chipIndName { color: #EAF6EF !important; }
.legend-chip #chipLo, .legend-chip #chipHi { color: #fff; }

/* minimised: the key alone, hugging the corner */
.legend-chip.leg-min {
  inset-inline-end: auto !important; right: auto !important; width: max-content !important;
  padding: 7px 9px 7px 12px !important;
}
.legend-chip.leg-min .lg,
.legend-chip.leg-min .lg-sep,
.legend-chip.leg-min .lg-stats,
.legend-chip.leg-min .lg-mix,
.legend-chip.leg-min #chipInd,
.legend-chip.leg-min #chipGn { display: none !important; }
.legend-chip.leg-min .lg-min { margin-inline-start: 10px; }

@media (max-width: 1180px) {
  .lg-stats { gap: 14px; }
  .lg-stats .st b { font-size: 17px; }
  .lg-mix { display: none; }
}
@media (max-width: 860px) {
  .legend-chip .lg { font-size: 11.5px; }
  .lg-stats .st:nth-child(n+4) { display: none; }
}

/* ---- the console stack: several panels in one scrolling column ---------- */
.hud-stack {
  position: absolute; top: 112px; right: 12px; z-index: 820;
  width: 272px; max-width: calc(100% - 24px);
  /* a floor rather than a bottom anchor: on a short map a top/bottom pair
     resolves to zero height, whereas this keeps a usable box that scrolls */
  max-height: max(200px, calc(100% - 208px));
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 9px;
  padding-right: 2px;
}
/* inside the stack a panel is a normal block, not a floating overlay */
.hud-stack .hud-console {
  position: static; width: auto; max-width: none; max-height: none;
  animation: none; flex: 0 0 auto;
}
.hud-stack .hud-console:not(:first-child) { animation: none; }
.hud-sub-panel .hud-bar { cursor: pointer; }
.hud-sub-panel .hud-lvl { text-transform: none; letter-spacing: .04em; font-weight: 700; }
.hud-sub-panel .hud-body { padding-top: 10px; }
/* the pie panel's own heading is gone, so the donuts need the top spacing back */
.hud-pies-mark + .hud-pies { margin-top: 0; }
.hud-sec2 { margin-top: 13px; }

/* ---- alignment ---------------------------------------------------------- */
/* keys on a grid: four columns, so the numbers stack into columns */
.hud-keys {
  display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 8px !important; align-items: baseline;
}
.hud-keys .k { justify-content: flex-start; min-width: 0; }
.hud-keys .k b { margin-inline-start: 4px; }
/* the class-stage row has five keys */
#hudCKeys { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#hudGKeys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* a long label must not strand its value on the first line */
.hud-row { align-items: flex-start; }
.hud-row > b { line-height: 1.35; }
.hud-row .k { padding-inline-end: 2px; }
/* the donut captions share a baseline with their values */
.hud-pie > span { min-height: 22px; display: flex; align-items: flex-start; justify-content: center; }

@media (max-width: 760px) {
  .hud-stack {
    top: 126px; left: 10px; right: 10px; width: auto; max-width: none;
    bottom: auto; max-height: min(52vh, calc(100% - 200px));
  }
}

/* ---- movable / expandable console panels -------------------------------- */
.hud-bar { touch-action: none; }            /* the header is a drag handle */
.hud-console .hud-bar { cursor: grab; }
.hud-console.hud-dragging .hud-bar { cursor: grabbing; }
.hud-grow {
  flex: 0 0 auto; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 6px; color: var(--hud-mute); font-size: 12px; line-height: 1;
  cursor: pointer; margin-inline-start: 6px;
}
.hud-grow:hover { background: rgba(127,211,168,.16); color: var(--hud-hi); }
.hud-grow:focus-visible { outline: 2px solid var(--hud-neon); outline-offset: 1px; }

/* dragged out of the column: a free card on the map */
.hud-console.hud-free {
  position: absolute; z-index: 826; width: 272px; max-width: calc(100% - 12px);
  max-height: calc(100% - 16px); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10), 0 20px 46px rgba(0,0,0,.55);
}
.hud-console.hud-free > .hud-body { overflow-y: auto; }
.hud-console.hud-dragging { z-index: 840; opacity: .96; }

/* expanded: fills the map */
.hud-console.hud-max {
  position: absolute; inset: 10px; z-index: 842;
  width: auto; max-width: none; max-height: none; left: 10px !important; top: 10px !important;
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 30px 70px rgba(0,0,0,.6);
}
.hud-console.hud-max > .hud-body { overflow-y: auto; flex: 1 1 auto; }
/* room to breathe once there is room */
.hud-console.hud-max .hud-heroes { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.hud-console.hud-max .hud-hero b { font-size: 30px; }
.hud-console.hud-max .hud-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 22px; }
.hud-console.hud-max .hud-pies { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.hud-console.hud-max .hud-pie svg { max-width: 190px; }
.hud-console.hud-max .hud-name { font-size: 22px; }
.hud-console.hud-max .hud-note { max-width: 70ch; }

@media (prefers-reduced-motion: reduce) { .hud-console.hud-dragging { opacity: 1; } }

/* ---- two pill groups at the top of the map ------------------------------ */
.bmp { left: 50%; transform: translateX(-50%); }
.bmp-2 {
  /* the layout group sits to the right of the basemap group */
  left: auto; right: 12px; transform: none;
}
.bmp-lbl {
  align-self: center; padding: 0 8px 0 4px; font: 800 9px/1 var(--font-display);
  text-transform: uppercase; letter-spacing: .13em; color: var(--ink-45);
}
body.map-dark .bmp-lbl { color: #8CA79A; }
/* the stack starts below both groups */
.hud-stack { top: 112px; }
@media (max-width: 1320px) {
  .bmp-2 .bmp-lbl { display: none; }
  .bmp-2 button span { display: none; }
  .bmp-2 button { padding: 8px 10px; }
}
@media (max-width: 900px) {
  .bmp { left: 12px; transform: none; }
  .bmp button span { display: none; }
}

/* ---- ranked districts, under the shading control ------------------------ */
.rnk { margin-top: 8px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden;
  background: var(--card); }
.rnk-h { -webkit-appearance: none; appearance: none; display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; border: 0; cursor: pointer; text-align: start;
  background: var(--mint); color: var(--ink); font: inherit; }
.rnk-h:hover { background: #DDEDE3; }
.rnk-h:focus-visible { outline: 2px solid var(--pri-2); outline-offset: -3px; }
.rnk-t { font: 800 9.5px/1 var(--font-display); text-transform: uppercase; letter-spacing: .11em;
  color: var(--pri); }
.rnk-n { font: 700 10px/1 var(--font-body); color: var(--ink-45);
  background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 3px 7px; }
.rnk-c { margin-inline-start: auto; color: var(--ink-45); font-size: 11px; }
.rnk-sub { padding: 7px 10px 6px; font-size: 10px; line-height: 1.45; color: var(--ink-45);
  border-bottom: 1px solid var(--line); }
.rnk-sub b { color: var(--ink-70); }
.rnk-list { max-height: 232px; overflow-y: auto; overscroll-behavior: contain; }
.rnk-r { display: flex; align-items: center; gap: 7px; width: 100%; padding: 5px 9px; border: 0;
  border-bottom: 1px solid #EEF3EF; cursor: pointer; background: transparent; text-align: start;
  font: inherit; font-size: 11.5px; color: var(--ink-70); }
.rnk-r:last-child { border-bottom: 0; }
.rnk-r:hover { background: var(--mint); color: var(--ink); }
.rnk-i { flex: 0 0 20px; font: 700 10px/1 var(--font-body); color: var(--ink-45);
  font-variant-numeric: tabular-nums; text-align: end; }
.rnk-d { flex: 0 0 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rnk-b { flex: 1 1 auto; min-width: 24px; height: 8px; border-radius: 99px; background: #EDF2EE;
  overflow: hidden; }
.rnk-b i { display: block; height: 100%; border-radius: 99px; }
.rnk-v { flex: 0 0 auto; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.rnk-csv { margin: 7px 8px 8px !important; width: calc(100% - 16px); }

/* ---- the map's top control row ------------------------------------------ */
.map-top {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 820;
  display: flex; gap: 10px; align-items: flex-start; justify-content: center; flex-wrap: wrap;
  /* shrink-to-fit around a wrapping child resolves too narrow and forces a
     wrap that the available width did not require */
  width: max-content; max-width: calc(100% - 220px);
}
.map-top .bmp { position: static; transform: none; left: auto; right: auto; }
@media (max-width: 1240px) {
  .map-top { max-width: calc(100% - 160px); }
}
@media (max-width: 900px) {
  .map-top { left: 12px; transform: none; max-width: calc(100% - 24px); justify-content: flex-start; }
}

/* ---- boundaries + basemap as a single bar -------------------------------- */
.bmp-one {
  flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 4px 10px; padding: 4px 8px;
}
/* a label and its buttons are one unbreakable unit, so the bar wraps between
   the two groups instead of stranding a heading on the line above */
.bmp-grp { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.bmp-set { display: inline-flex; align-items: center; gap: 3px; }
.bmp-one .bmp-lbl { padding: 0; white-space: nowrap; }
.bmp-div { width: 1px; align-self: stretch; margin: 3px 0; background: var(--line); }
body.map-dark .bmp-div { background: rgba(120,220,170,.22); }

/* Drop the words in stages. Eight labelled buttons need about 985px and the
   map has 978 with the dock open, so something has to give - but hiding every
   word left eight cryptic icons. The basemap glyphs read on their own; the
   boundary ones do not, so they keep their words the longest. */
@media (max-width: 1560px) {
  #bmPills button span { display: none; }
  #bmPills button { padding: 8px 10px; }
}
@media (max-width: 1180px) {
  #bdPills button span { display: none; }
  #bdPills button { padding: 8px 10px; }
}
@media (max-width: 1000px) { .bmp-one .bmp-lbl, .bmp-one .bmp-div { display: none; } }
/* a vertical rule between two stacked rows means nothing */
@container (max-width: 0px) { .bmp-div { display: none; } }
/* the card scrolls; give its last row room so it does not sit flush on the edge */
.vcard-body { padding-bottom: 12px; }
/* a control moved to the map: the input stays for the layer code to read,
   the row goes so there is only one control for the setting */
.chk.chk-off { display: none !important; }
/* a layer row and its explain button share a line, as the flags do */
.lyr-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.lyr-row .chk { flex: 1 1 auto; min-width: 0; }
/* wrap the name; truncating it would hide which layer this is */
.lyr-row .chk .lyn { overflow: visible; text-overflow: clip; white-space: normal;
  line-height: 1.35; }
.lyr-row .why { margin-top: 0; }

/* ---- master search, on the map ------------------------------------------ */
.mapsearch {
  /* its own line, under the zoom control: the centred boundary+basemap row
     reaches too far left at common widths to share the top line */
  position: absolute; top: 78px; left: 12px; z-index: 824;
  width: min(320px, calc(100% - 24px));
}
.ms-bar {
  display: flex; align-items: center; gap: 9px; padding: 0 12px;
  border-radius: 13px; border: 1px solid rgba(120,220,170,.20);
  background: linear-gradient(180deg, rgba(8,20,16,.93), rgba(6,14,11,.96));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 12px 32px rgba(0,0,0,.42);
}
.ms-ic { width: 16px; height: 16px; flex: 0 0 auto; color: #8CA79A; }
.mapsearch .ms-wrap { flex: 1 1 auto; min-width: 0; position: static; }
.mapsearch .ms-wrap svg { display: none; }        /* the bar carries its own icon */
.mapsearch input[type="search"] {
  width: 100%; border: 0; background: transparent; padding: 12px 0;
  color: #EAF6EF; font: inherit; font-size: 13px;
}
.mapsearch input[type="search"]::placeholder { color: #7E939C; }
.mapsearch input[type="search"]:focus { outline: none; }
.ms-bar:focus-within { border-color: rgba(120,220,170,.45); }

#mapSearch #plResults {
  margin-top: 6px; max-height: min(46vh, 340px) !important;
  border: 1px solid rgba(120,220,170,.28) !important; border-radius: 12px !important;
  background: #0C1714 !important;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
/* the result rows were written for a white dock */
#mapSearch #plResults * { color: #C8DCD1; }
#mapSearch #plResults b, #mapSearch #plResults strong { color: #EAF6EF; }
#mapSearch #plResults .muted, #mapSearch #plResults small { color: #8CA79A !important; }
#mapSearch #plResults a, #mapSearch #plResults button, #mapSearch #plResults .pl-row {
  border-color: rgba(120,220,170,.14) !important;
}
#mapSearch #plResults a:hover, #mapSearch #plResults button:hover,
#mapSearch #plResults .pl-row:hover { background: rgba(52,211,153,.12) !important; }

/* it must not collide with the boundary + basemap row */
@media (max-width: 760px) { .mapsearch { width: calc(100% - 24px); } }
@media (prefers-reduced-motion: reduce) { .ms-bar { transition: none; } }

/* ---- popups above the map overlays -------------------------------------- */
/* .leaflet-map-pane is a z-index 400 stacking context, so a popup at pane
   z-index 700 could never rise above our 820-band overlays. Removing that
   context lets each pane compete on its own number. */
#schoolMap .leaflet-map-pane { z-index: auto; }
#schoolMap .leaflet-popup-pane { z-index: 860; }
#schoolMap .leaflet-tooltip-pane { z-index: 855; }

/* the search bar's drag handle */
.ms-grip {
  flex: 0 0 auto; width: 26px; height: 30px; margin-inline-start: -4px; padding: 0;
  display: grid; place-items: center; border: 0; background: transparent;
  color: #6E8A7E; cursor: grab; border-radius: 8px; touch-action: none;
}
.ms-grip svg { width: 15px; height: 15px; }
.ms-grip:hover { background: rgba(120,220,170,.14); color: #EAF6EF; }
.ms-grip:focus-visible { outline: 2px solid #7FD3A8; outline-offset: -2px; }
.mapsearch.ms-dragging .ms-grip { cursor: grabbing; }
.mapsearch.ms-dragging { opacity: .95; }
@media (prefers-reduced-motion: reduce) { .mapsearch.ms-dragging { opacity: 1; } }
/* the whole bar drags; the field inside it still behaves like a field */
.ms-bar { cursor: grab; }
.mapsearch.ms-dragging .ms-bar { cursor: grabbing; }
.mapsearch input[type="search"] { cursor: text; }
#mapSearch #plResults { cursor: auto; }

/* =====================================================================
   DARK OPERATIONS CHROME - everything follows the basemap
   ===================================================================== */
body.map-dark {
  --d-bg:#070D0B; --d-panel:#0B1512; --d-card:#0F1B17; --d-line:rgba(120,220,170,.16);
  --d-line2:rgba(120,220,170,.32); --d-txt:#B7C7CE; --d-hi:#EAF4F2; --d-mute:#7E939C;
}
body.map-dark .gis-dock {
  background: var(--d-bg); border-inline-end-color: var(--d-line); color: var(--d-txt);
}
body.map-dark .dock-sec {
  background: var(--d-panel); border-color: var(--d-line);
}
body.map-dark .dock-sec > summary {
  background: linear-gradient(180deg, rgba(52,211,153,.10), transparent);
  color: var(--d-hi); border-color: var(--d-line);
}
body.map-dark .dock-sec > summary:hover { background: rgba(52,211,153,.16); }
body.map-dark .dcaret { color: var(--d-mute); }
body.map-dark .dock-body { color: var(--d-txt); }
body.map-dark .dock-body label.small,
body.map-dark .sub-grp { color: var(--d-mute); }
body.map-dark .chk { color: var(--d-txt); }
body.map-dark .chk:hover { background: rgba(52,211,153,.10); }
body.map-dark .lyn { color: var(--d-txt); }
body.map-dark .muted, body.map-dark .small2 { color: var(--d-mute) !important; }
body.map-dark .dock-body select,
body.map-dark .dock-body input[type="search"],
body.map-dark .dock-body input[type="text"] {
  background: var(--d-card); border-color: var(--d-line); color: var(--d-hi);
}
body.map-dark .dock-body select:focus,
body.map-dark .dock-body input:focus { border-color: var(--d-line2); }
body.map-dark .dock-body select:disabled { color: #566B62; }
body.map-dark .clearbtn {
  background: var(--d-card); border-color: var(--d-line); color: var(--d-txt);
}
body.map-dark .clearbtn:hover { background: rgba(52,211,153,.14); color: var(--d-hi); }
body.map-dark .sub-ctl { background: rgba(255,255,255,.02); border-color: var(--d-line); }
body.map-dark .sub-warn { background: rgba(251,113,133,.10); color: #FB9AA6; border-color: rgba(251,113,133,.3); }
body.map-dark .why { border-color: var(--d-mute); color: var(--d-mute); }
body.map-dark .why:hover { background: #15883B; border-color: #15883B; color: #fff; }
body.map-dark .mode-row button {
  background: var(--d-card); border-color: var(--d-line); color: var(--d-txt);
}
body.map-dark .mode-row button.on { background: linear-gradient(160deg,#15883B,#0A5230); color: #fff; }
body.map-dark .search-wrap svg { color: var(--d-mute); }
/* the ranked districts table */
body.map-dark .rnk { background: var(--d-card); border-color: var(--d-line); }
body.map-dark .rnk-h { background: rgba(52,211,153,.10); color: var(--d-hi); }
body.map-dark .rnk-h:hover { background: rgba(52,211,153,.18); }
body.map-dark .rnk-t { color: #34D399; }
body.map-dark .rnk-n { background: var(--d-panel); border-color: var(--d-line); color: var(--d-mute); }
body.map-dark .rnk-sub { color: var(--d-mute); border-color: var(--d-line); }
body.map-dark .rnk-r { color: var(--d-txt); border-color: rgba(255,255,255,.05); }
body.map-dark .rnk-r:hover { background: rgba(52,211,153,.12); color: var(--d-hi); }
body.map-dark .rnk-i { color: var(--d-mute); }
body.map-dark .rnk-v { color: var(--d-hi); }
body.map-dark .rnk-b { background: rgba(255,255,255,.06); }
body.map-dark .need-mini, body.map-dark .need-mini * { color: var(--d-txt); }
body.map-dark .dock-tab { background: rgba(11,21,18,.9); color: var(--d-txt); border-color: var(--d-line); }
body.map-dark .app-sub { background: var(--d-panel); color: var(--d-mute); border-color: var(--d-line); }

/* the level colours are load-bearing: same hue, with a glow so they read on black */
body.map-dark .marker-cluster,
body.map-dark .vil-cluster { filter: drop-shadow(0 0 6px rgba(0,0,0,.55)); }
body.map-dark .leaflet-marker-pane .marker-cluster span { text-shadow: 0 1px 2px rgba(0,0,0,.6); }
body.map-dark .sw.dot, body.map-dark .sw.sq { box-shadow: 0 0 7px currentColor; }

/* ---- the analysis sweep (dark basemap only) ----------------------------- */
.ai-sweep {
  position: absolute; inset: -10%; z-index: 415; pointer-events: none;
  display: none; opacity: .34;
  /* no blend mode: screen lightens whatever is beneath, which bleached the
     basemap. A decoration must not be able to alter the data under it. */
  background: conic-gradient(from 0deg,
    rgba(52,211,153,0) 0deg, rgba(52,211,153,0) 322deg,
    rgba(52,211,153,.05) 348deg, rgba(52,211,153,.14) 358deg,
    rgba(127,211,168,.22) 360deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0 62%, transparent 74%);
          mask-image: radial-gradient(circle at 50% 50%, #000 0 62%, transparent 74%);
  animation: aiSweep 12s linear infinite;
}
body.map-dark .ai-sweep { display: block; }
@keyframes aiSweep { to { transform: rotate(360deg); } }

/* a faint grid, so the sweep has something to cross */
.ai-grid {
  position: absolute; inset: 0; z-index: 414; pointer-events: none; display: none;
  background:
    repeating-linear-gradient(90deg, rgba(52,211,153,.055) 0 1px, transparent 1px 120px),
    repeating-linear-gradient(180deg, rgba(52,211,153,.055) 0 1px, transparent 1px 120px);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 0 45%, transparent 85%);
          mask-image: radial-gradient(ellipse at 50% 50%, #000 0 45%, transparent 85%);
}
body.map-dark .ai-grid { display: block; }

/* ---- the model's own sites pulse; survey layers do not ------------------- */
@keyframes aiPing {
  0%   { r: 3; opacity: .85; stroke-width: 2; }
  70%  { opacity: 0; }
  100% { r: 26; opacity: 0; stroke-width: .5; }
}
.ai-ping { pointer-events: none; }
.ai-ping circle { fill: none; animation: aiPing 3.4s cubic-bezier(.22,.7,.3,1) infinite; }

@media (prefers-reduced-motion: reduce) {
  .ai-sweep { display: none !important; }
  .ai-ping circle { animation: none !important; opacity: 0 !important; }
}

/* =====================================================================
   ANALYSIS STRIP - HUD treatment
   Cyan + gold chrome. The level colours stay exactly as they are.
   ===================================================================== */
.anl { --hud-cy:#22D3EE; --hud-cy2:#0E7490; --hud-gd:#E7B667; }
.anl-body { position: relative; }
/* the grid the panels sit on */
.anl-body::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    repeating-linear-gradient(90deg, rgba(34,211,238,.05) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(180deg, rgba(34,211,238,.05) 0 1px, transparent 1px 46px);
  -webkit-mask-image: linear-gradient(180deg, #000 0 70%, transparent);
          mask-image: linear-gradient(180deg, #000 0 70%, transparent);
}
.anl-kpis, .anl-cards { position: relative; z-index: 1; }

/* cards get corner brackets, as in a targeting frame */
.anl-card, .anl-kpi { position: relative; }
.anl-card::before, .anl-card::after,
.anl-kpi::before, .anl-kpi::after {
  content: ""; position: absolute; width: 11px; height: 11px; pointer-events: none;
  border: 0 solid rgba(34,211,238,.55);
}
.anl-card::before, .anl-kpi::before {
  top: 6px; left: 6px; border-width: 1.4px 0 0 1.4px;
}
.anl-card::after, .anl-kpi::after {
  bottom: 6px; right: 6px; border-width: 0 1.4px 1.4px 0;
}
.anl-card { border-color: rgba(34,211,238,.20); }
.anl-card > h3 { position: relative; letter-spacing: .12em; }
/* a tick scale along the card head */
.anl-card > h3::after {
  content: ""; flex: 1; height: 7px; margin-inline-start: 4px; align-self: center;
  background: repeating-linear-gradient(90deg,
    rgba(34,211,238,.42) 0 1px, transparent 1px 7px);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 88%);
          mask-image: linear-gradient(90deg, #000, transparent 88%);
}
.anl-card > h3 a::after, .anl-card > h3 em::after { content: none; }
.anl-card > h3 a { position: relative; z-index: 1; }

/* segmented block meters */
.anl-bar .seg { flex: 1 1 auto; display: flex; gap: 2px; min-width: 40px; }
.anl-bar .seg i {
  flex: 1 1 auto; height: 12px; border-radius: 1.5px;
  background: rgba(34,211,238,.10); transition: background .3s var(--a-ease);
}
.anl-bar .seg i.on { box-shadow: 0 0 5px currentColor; }
.anl-bar > b { color: var(--hud-gd); font-family: var(--font-display); }

/* the coverage dial */
.anl-dial { position: relative; display: grid; place-items: center; padding: 4px 0 2px; }
.anl-dial svg { width: 132px; height: 132px; }
.anl-dial .trk { stroke: rgba(34,211,238,.13); stroke-dasharray: 198 264; }
.anl-dial .arc {
  stroke: url(#anlGrad); stroke: var(--hud-cy);
  filter: drop-shadow(0 0 6px rgba(34,211,238,.6));
  transition: stroke-dasharray .7s var(--a-ease);
}
.anl-dial > b {
  position: absolute; top: 46%; transform: translateY(-50%);
  font: 800 27px/1 var(--font-display); color: #fff;
  font-variant-numeric: tabular-nums;
}
.anl-dial > span {
  position: absolute; top: 66%; font-size: 9.5px; color: var(--a-mute); text-align: center;
  max-width: 88%;
}

/* headings and accents pick up the HUD palette */
.anl-t { color: var(--hud-cy); }
.anl-card > h3 em { color: var(--hud-gd); }
.anl-kpi h3 { letter-spacing: .12em; }
.anl-leg .li b { color: var(--hud-gd); }

@media (prefers-reduced-motion: reduce) {
  .anl-bar .seg i, .anl-dial .arc { transition: none !important; }
}

/* =====================================================================
   CLUSTER MARKERS ON THE OPERATIONS BASEMAP
   ===================================================================== */
body.map-dark .marker-cluster {
  background: none !important;
  filter: drop-shadow(0 0 10px rgba(0,0,0,.7));
}
body.map-dark .marker-cluster > div {
  position: relative; width: 100%; height: 100%; margin: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(18,32,30,.94), rgba(6,14,12,.97));
  border: 1.6px solid var(--cl, #22D3EE);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 14px -2px var(--cl, #22D3EE),
              inset 0 0 12px -4px var(--cl, #22D3EE);
}
body.map-dark .marker-cluster span {
  font: 800 12.5px/1 var(--font-display); color: #EAF6EF;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  text-shadow: 0 0 8px var(--cl, #22D3EE);
}
/* the tracking ring */
body.map-dark .marker-cluster > div::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.2px dashed var(--cl, #22D3EE); opacity: .5;
  animation: clScan 9s linear infinite;
}
/* a soft breath, so a dense cluster reads as active */
body.map-dark .marker-cluster > div::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  box-shadow: 0 0 0 0 var(--cl, #22D3EE); opacity: .55;
  animation: clBreath 3.6s cubic-bezier(.32,.72,.28,1) infinite;
}
@keyframes clScan   { to { transform: rotate(360deg); } }
@keyframes clBreath { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* the ring colour still encodes cluster size, as Leaflet's own classes do */
body.map-dark .marker-cluster-small  { --cl: #22D3EE; }
body.map-dark .marker-cluster-medium { --cl: #E7B667; }
body.map-dark .marker-cluster-large  { --cl: #FB7185; }

body.map-dark .marker-cluster:hover > div {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 22px -2px var(--cl, #22D3EE),
              inset 0 0 14px -4px var(--cl, #22D3EE);
}

/* village clusters follow the same language, in their own hue */
body.map-dark .vil-cluster {
  --cl: #C084FC;
  background: radial-gradient(circle at 34% 30%, rgba(24,16,32,.94), rgba(10,6,16,.97));
  border: 1.6px solid var(--cl);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 14px -2px var(--cl);
  position: relative;
}
body.map-dark .vil-cluster span { color: #F3E8FF; text-shadow: 0 0 8px var(--cl); }
body.map-dark .vil-cluster::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.2px dashed var(--cl); opacity: .45;
  animation: clScan 11s linear infinite reverse;
}

@media (prefers-reduced-motion: reduce) {
  body.map-dark .marker-cluster > div::before,
  body.map-dark .marker-cluster > div::after,
  body.map-dark .vil-cluster::before { animation: none !important; }
  body.map-dark .marker-cluster > div::after { display: none; }
}

/* =====================================================================
   DARK: popups, cards, tooltips, modal
   ===================================================================== */
body.map-dark .leaflet-popup-content-wrapper,
body.map-dark .leaflet-popup-tip {
  background: #0B1512; color: #B7C7CE;
  box-shadow: 0 0 0 1px rgba(120,220,170,.18), 0 18px 44px rgba(0,0,0,.6);
}
body.map-dark .leaflet-popup-content { color: #B7C7CE; }
body.map-dark .leaflet-popup-content a { color: #34D399; }
body.map-dark .leaflet-popup-content b,
body.map-dark .leaflet-popup-content strong { color: #EAF4F2; }
body.map-dark .leaflet-popup-content hr { border-top-color: rgba(120,220,170,.16) !important; }

/* the village / area card */
body.map-dark .vcard { background: #0B1512; }
body.map-dark .vcard-body { background: #0B1512; color: #B7C7CE; }
body.map-dark .vsec { color: #6E8A7E; }
body.map-dark .vsec::after { background: rgba(120,220,170,.16); }
body.map-dark .vsrc { color: #6E8A7E; }
body.map-dark .vrow { border-bottom-color: rgba(120,220,170,.10); }
body.map-dark .vrow > span { color: #7E939C; }
body.map-dark .vrow > b { color: #EAF4F2; }
body.map-dark .vbig div { background: #0F1B17; border-color: rgba(120,220,170,.16); }
body.map-dark .vbig b { color: #6EE7B7; }
body.map-dark .vbig span { color: #7E939C; }
body.map-dark .vmeter { background: rgba(255,255,255,.07); }
body.map-dark .vgrid, body.map-dark .vcensus { color: #B7C7CE; }
body.map-dark .vcensus .vsec { color: #6EE7B7; }
body.map-dark .vcensus.ctx .vsec { color: #7E939C; }
body.map-dark .vnote { color: #7E939C; }
body.map-dark .vchip { background: #0F1B17; border-color: rgba(120,220,170,.18); color: #B7C7CE; }
body.map-dark .vchip.yes { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.45); color: #6EE7B7; }
body.map-dark .vchip.no  { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.4); color: #FB9AA6; }
body.map-dark .vsch {
  background: #0F1B17; border-color: rgba(120,220,170,.14); color: #C8DCD1;
}
body.map-dark .vsch:hover { background: rgba(52,211,153,.14); color: #EAF4F2; }
body.map-dark .vmore { color: #7E939C; }
body.map-dark .vcard-ft {
  background: #08120F; color: #6E8A7E; border-top-color: rgba(120,220,170,.14);
}
body.map-dark .vcard-acts { border-top-color: rgba(120,220,170,.14); }
body.map-dark .vcard::-webkit-scrollbar-thumb { background: rgba(120,220,170,.22); }

/* tooltips */
body.map-dark .route-tip,
body.map-dark .leaflet-tooltip {
  background: rgba(11,21,18,.95) !important; color: #C8DCD1 !important;
  border-color: rgba(120,220,170,.24) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.55);
}
body.map-dark .leaflet-tooltip-top:before { border-top-color: rgba(11,21,18,.95) !important; }
body.map-dark .leaflet-tooltip-bottom:before { border-bottom-color: rgba(11,21,18,.95) !important; }
body.map-dark .leaflet-tooltip-left:before { border-left-color: rgba(11,21,18,.95) !important; }
body.map-dark .leaflet-tooltip-right:before { border-right-color: rgba(11,21,18,.95) !important; }

/* the explain modal */
body.map-dark .why-panel { background: #0B1512; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
body.map-dark .why-head { border-bottom-color: rgba(120,220,170,.24); }
body.map-dark .why-head b { color: #EAF4F2; }
body.map-dark .why-body { color: #B7C7CE; }
body.map-dark .why-body > b { color: #EAF4F2; }
body.map-dark .why-body a { color: #34D399; }
body.map-dark .why-body .src { color: #6E8A7E; border-top-color: rgba(120,220,170,.16); }
body.map-dark .why-t th { color: #7E939C; border-bottom-color: rgba(120,220,170,.28); }
body.map-dark .why-t td { border-bottom-color: rgba(120,220,170,.10); }
body.map-dark .why-t tbody tr:hover { background: rgba(52,211,153,.10) !important; }
body.map-dark .why-t .tot td { color: #EAF4F2; border-top-color: rgba(120,220,170,.28); }
body.map-dark .ch-close { color: #B7C7CE; }
/* a layer's follow-on link sits under its row, not inside it */
.lyr-link { display: block; width: 100%; margin: 2px 0 6px !important;
  font-size: 11.5px; text-align: start; }

/* ---- target lock on click ------------------------------------------------ */
.lock {
  position: absolute; width: 0; height: 0; z-index: 858; pointer-events: none;
  --lk: #34D399;
}
.lock i {
  position: absolute; width: 15px; height: 15px; border: 0 solid var(--lk);
  filter: drop-shadow(0 0 5px var(--lk));
}
.lock i:nth-child(1) { border-width: 2px 0 0 2px; animation: lkTL .42s cubic-bezier(.2,.8,.25,1) both; }
.lock i:nth-child(2) { border-width: 2px 2px 0 0; animation: lkTR .42s cubic-bezier(.2,.8,.25,1) both; }
.lock i:nth-child(3) { border-width: 0 0 2px 2px; animation: lkBL .42s cubic-bezier(.2,.8,.25,1) both; }
.lock i:nth-child(4) { border-width: 0 2px 2px 0; animation: lkBR .42s cubic-bezier(.2,.8,.25,1) both; }
@keyframes lkTL { from { transform: translate(-52px,-52px); opacity: 0; } to { transform: translate(-26px,-26px); opacity: 1; } }
@keyframes lkTR { from { transform: translate(37px,-52px);  opacity: 0; } to { transform: translate(11px,-26px);  opacity: 1; } }
@keyframes lkBL { from { transform: translate(-52px,37px);  opacity: 0; } to { transform: translate(-26px,11px);  opacity: 1; } }
@keyframes lkBR { from { transform: translate(37px,37px);   opacity: 0; } to { transform: translate(11px,11px);   opacity: 1; } }

.lock u {
  position: absolute; inset: -6px; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border: 1.5px solid var(--lk); border-radius: 50%;
  animation: lkRing 1.1s cubic-bezier(.2,.7,.3,1) both;
}
.lock u:nth-of-type(2) { animation-delay: .16s; }
@keyframes lkRing {
  from { transform: scale(.4); opacity: .9; }
  to   { transform: scale(6.5); opacity: 0; }
}
.lock s {
  position: absolute; background: var(--lk); opacity: .8;
  filter: drop-shadow(0 0 4px var(--lk));
  animation: lkCross .5s cubic-bezier(.2,.8,.25,1) both;
}
.lock s:nth-of-type(1) { width: 1.5px; height: 13px; margin: -6.5px 0 0 -.75px; }
.lock s:nth-of-type(2) { width: 13px; height: 1.5px; margin: -.75px 0 0 -6.5px; }
@keyframes lkCross { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: .8; } }

.lock.go { animation: lkOut .35s ease .75s both; }
@keyframes lkOut { to { opacity: 0; } }

/* on a light basemap the mint disappears; use the department green */
body:not(.map-dark) .lock { --lk: #0A5230; }

@media (prefers-reduced-motion: reduce) { .lock { display: none !important; } }

/* settlement clusters - the same language as the school clusters, in the
   layer's own orange so the two are never confused */
.gap-cluster {
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(60,22,8,.92), rgba(28,10,4,.96));
  border: 1.6px solid #F97316;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #F97316;
}
.gap-cluster span {
  font: 800 12.5px/1 var(--font-display); color: #FFEDD5;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 8px #F97316;
}
body:not(.map-dark) .gap-cluster {
  background: radial-gradient(circle at 34% 30%, #F9A26C, #C2410C);
  border-color: rgba(255,255,255,.9);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
body:not(.map-dark) .gap-cluster span { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
body.map-dark .gap-cluster::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.2px dashed #F97316; opacity: .45;
  animation: clScan 10s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  body.map-dark .gap-cluster::before { animation: none !important; }
}

/* ---- cluster counts sit dead centre ------------------------------------- */
/* leaflet.css is linked after this file and resets .leaflet-marker-icon to
   display:block, so these need the compound selector to win. */
.leaflet-marker-icon.gap-cluster,
.leaflet-marker-icon.vil-cluster {
  display: flex !important; align-items: center; justify-content: center;
  line-height: 1; text-align: center;
}
.leaflet-marker-icon.gap-cluster span,
.leaflet-marker-icon.vil-cluster span {
  display: block; line-height: 1; margin: 0;
}
/* the school clusters are Leaflet's own markup: an inner div holds the span */
.leaflet-marker-icon.marker-cluster > div {
  display: flex !important; align-items: center; justify-content: center;
  line-height: 1;
}
.leaflet-marker-icon.marker-cluster > div > span { line-height: 1; }

/* ---- the census panel inside a recommendation popup ---------------------
   It used to carry its own inline colours, which dark mode could not reach:
   the values were restyled to near-white and the panel stayed near-white. */
.rec-local {
  margin-top: 6px; padding: 7px 9px; border-radius: 9px;
  background: #F1F7F2; border: 1px solid rgba(13,106,62,.12);
}
.rec-local-h {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #0A5230; margin-bottom: 2px;
}
body.map-dark .rec-local {
  background: rgba(52,211,153,.07); border-color: rgba(120,220,170,.20);
}
body.map-dark .rec-local-h { color: #6EE7B7; }
body.map-dark .rec-local span { color: #93A7B1 !important; }
body.map-dark .rec-local b { color: #EAF4F2; }


/* =====================================================================
   Shell geometry - identical on every page.
   Measured before this: 95 px on seven pages, 129 px on two, because the
   nav wrapped to a different number of rows depending on what else the
   header carried. Navigating shifted the content by 34 px.
   ===================================================================== */
.app-bar {
  /* 74 rather than 72: the header's figures are two pixels taller than the
     title block, so six pages measured 72 and four measured 74. Pinning to the
     taller of the two makes every page identical without clipping either. */
  min-height: 74px;
  flex-wrap: nowrap;
}
.nav-tabs {
  flex-wrap: nowrap;              /* one row, always */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;          /* a sideways scrollbar here reads as a bug */
  -ms-overflow-style: none;
  max-width: 100%;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs a {
  flex: 0 0 auto;                 /* never let a tab shrink into two lines */
  white-space: nowrap;
}
/* the header's own figures must not wrap either, or they push the nav down */
.hdr-stats { flex-wrap: nowrap; white-space: nowrap; }

/* below tablet the tabs scroll rather than stack, which keeps the bar the
   same height on a phone as on a wall display */
@media (max-width: 900px) {
  .nav-tabs a { padding-inline: 9px; font-size: 12.5px; }
}


/* ---- the per-layer readout: how many are in view, and the export -------- */
.lk-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin:2px 0 7px 20px;padding-inline-start:8px;
  border-inline-start:2px solid var(--line);font-size:11.5px}
.lk-n{color:var(--ink-45)}
.lk-n b{color:var(--ink-70);font-variant-numeric:tabular-nums}
.lk-csv{border:1px solid var(--line);background:transparent;color:var(--pri-3);
  border-radius:7px;padding:2px 9px;font:700 10.5px inherit;cursor:pointer}
.lk-csv:hover{background:var(--mint)}
html.hud .lk-n{color:#8CA79D}
html.hud .lk-n b{color:#EAF4F2}
html.hud .lk-csv{border-color:rgba(110,231,183,.32);color:#6EE7B7;
  background:rgba(110,231,183,.10)}
html.hud .lk-csv:hover{background:rgba(110,231,183,.22);color:#EAF4F2}


/* ---- the shared numbered badge -----------------------------------------
   Same shape and behaviour as the school and settlement clusters; the hue is
   the layer's own, taken from the legend. */
.leaflet-marker-icon.sed-cluster {
  display: flex !important; align-items: center; justify-content: center;
  border-radius: 50%; line-height: 1; text-align: center;
  background: radial-gradient(circle at 34% 30%, rgba(14,26,20,.92), rgba(6,14,10,.96));
  box-shadow: 0 0 0 1px rgba(0,0,0,.45);
  transition: transform .12s;
}
.leaflet-marker-icon.sed-cluster:hover { transform: scale(1.07); }
.leaflet-marker-icon.sed-cluster span {
  display: block; line-height: 1; margin: 0;
  font: 800 12.5px/1 var(--font-display), sans-serif;
  font-variant-numeric: tabular-nums;
}

.sed-cluster.cl-cell   { border: 1.6px solid #0EA5E9; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #0EA5E9; }
.sed-cluster.cl-cell span   { color: #BAE6FD; text-shadow: 0 0 8px #0EA5E9; }
.sed-cluster.cl-place  { border: 1.6px solid #F59E0B; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #F59E0B; }
.sed-cluster.cl-place span  { color: #FDE68A; text-shadow: 0 0 8px #F59E0B; }
.sed-cluster.cl-health { border: 1.6px solid #F472B6; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #F472B6; }
.sed-cluster.cl-health span { color: #FBCFE8; text-shadow: 0 0 8px #F472B6; }
.sed-cluster.cl-hot    { border: 1.6px solid #B91C1C; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #B91C1C; }
.sed-cluster.cl-hot span    { color: #FECACA; text-shadow: 0 0 8px #B91C1C; }
.sed-cluster.cl-girls  { border: 1.6px solid #E0559B; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #E0559B; }
.sed-cluster.cl-girls span  { color: #FBCFE8; text-shadow: 0 0 8px #E0559B; }
.sed-cluster.cl-up     { border: 1.6px solid #7B4FA8; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #7B4FA8; }
.sed-cluster.cl-up span     { color: #E9D5FF; text-shadow: 0 0 8px #7B4FA8; }
.sed-cluster.cl-gap    { border: 1.6px solid #DC2626; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 14px -2px #DC2626; }
.sed-cluster.cl-gap span    { color: #FECACA; text-shadow: 0 0 8px #DC2626; }


/* ---- the layers panel must stay reachable at every width ---------------
   Two mechanisms hide the same panel. On a wide window the vertical LAYERS
   tab toggles .dock-fold, which sets display:none and is remembered across
   visits. Below 760px that tab is not rendered and the panel becomes a
   slide-in drawer toggled by the hamburger, which adds .open.

   Fold it on a desktop, then narrow the window, and .dock-fold is still
   there: display:none beats any transform, so the hamburger adds .open to a
   panel that cannot be displayed and the layers become unreachable with no
   control on screen able to bring them back.

   This sits at the end of the file on purpose - the rule it has to beat has
   the same specificity, and a media query adds none, so source order is what
   decides. */
@media (max-width: 760px) {
  .gis-dock.dock-fold { display: flex; }
  .gis-dock.dock-fold:not(.open) { transform: translateX(-105%); }
  .gis-dock.dock-fold.open { transform: translateX(0); }
}

/* ---------- compare.html: the four reference points ---------------------- */
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cf-card {
  border: 1px solid var(--line); border-left: 4px solid var(--ec, #6B7280);
  border-radius: 12px; padding: 12px 14px; background: var(--card, #fff);
}
.cf-card h4 { margin: 0 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ec, #6B7280); }
.cf-card b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cf-card small { display: block; font-size: 11.5px; color: var(--ink-45); margin-bottom: 8px; }
.cf-card p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-70, #46586B); }
/* the per-stage block inside each source card. The unit line sits directly
   above the figures on purpose: four identical-looking cards holding villages,
   people and schools is exactly the confusion this page has to prevent. */
.cf-stage { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.cf-unit {
  display: block; font-size: 10.5px; line-height: 1.35; color: var(--ink-45);
  margin-bottom: 6px; font-style: italic;
}
.cf-srow { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 2px 0; }
.cf-srow span { font-size: 12px; color: var(--ink-70, #46586B); }
.cf-srow b { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cf-srow.cf-foot { margin-top: 5px; border-top: 1px dashed var(--line); padding-top: 5px; }
.cf-srow.cf-foot span, .cf-srow.cf-foot b { font-weight: 800; }
.cf-dim { font-size: 10.5px; font-weight: 400; color: var(--ink-45); cursor: help; border-bottom: 1px dotted currentColor; }
.cf-stage.cf-empty { font-size: 12px; line-height: 1.5; color: var(--ink-45); font-style: normal; }
#cfCards { margin-top: 12px; }

.cf-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.cf-matrix th, .cf-matrix td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.cf-matrix thead th { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-45); white-space: nowrap; }
.cf-matrix tbody th { font-weight: 700; white-space: nowrap; }
.cf-matrix td { font-variant-numeric: tabular-nums; }
.cf-matrix td i { font-style: normal; font-size: 11px; color: var(--ink-45); }
.cf-matrix tr.cf-grp td {
  background: rgba(10, 82, 48, .06); font-weight: 800; font-size: 11.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--pri, #0A5230);
}
/* A cell the source CANNOT fill carries a short reason, not a bare dash - but
   inline it stays SHORT. Spelling all forty reasons out in full turned the
   table into 1,375px of small print; the sentence lives in the title instead. */
.cf-matrix td.cf-na { color: var(--ink-45); white-space: nowrap; cursor: help; }
.cf-matrix td.cf-na span {
  font-size: 10.5px; opacity: .8; border-bottom: 1px dotted currentColor; padding-bottom: 1px;
}
.cf-matrix td.cf-u { font-size: 11px; color: var(--ink-45); line-height: 1.4; }
.cf-matrix th, .cf-matrix td { vertical-align: middle; }
.cf-matrix tbody th { font-size: 12.5px; }
/* the scope bar sits with the page's other toolbars */
.cf-tools { margin-bottom: 8px; }
.cf-tools select { max-width: 190px; }
#cfScope { margin: 0 0 4px; }

.cf-ladder { width: 100%; border-collapse: collapse; font-size: 13px; }
.cf-ladder th, .cf-ladder td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.cf-ladder thead th { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-45); }
.cf-ladder tbody th { font-weight: 700; }
.cf-ladder td b { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.cf-bar { display: inline-block; width: 96px; height: 8px; border-radius: 99px; background: rgba(0,0,0,.07); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.cf-bar i { display: block; height: 100%; border-radius: 99px; }

.cf-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cf-thread li { display: flex; gap: 12px; align-items: flex-start; }
.cf-thread .cf-y {
  flex: 0 0 auto; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 99px;
  background: rgba(10,82,48,.09); color: var(--pri, #0A5230);
}
/* ONLY the heading b is a block. Written as `.cf-thread li b` it also caught
   every bold figure inside the sentence, so each one broke onto its own line
   and the paragraph came apart into a column of fragments. */
.cf-thread li > div > b { display: block; font-size: 13px; margin-bottom: 3px; }
.cf-thread li span { font-size: 13px; line-height: 1.6; color: var(--ink-70, #46586B); }
.cf-thread li span b { display: inline; font-weight: 800; color: var(--ink); white-space: nowrap; }
.cf-thread li > div { min-width: 0; }
.cf-thread .cf-y { min-width: 46px; justify-content: center; display: inline-flex; }
/* a point that flags an inconsistency in the source data, not a note */
.why-list li.why-warn b { color: #B45309; }
.why-list li.why-warn { border-left: 3px solid #F59E0B; padding-left: 10px; margin-left: -13px; }
.why-list li.why-ok b { color: var(--pri, #0A5230); }
/* the standing badge for the selected area */
.cf-gradebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.cf-grade {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px; border-radius: 99px;
  background: color-mix(in srgb, var(--gc, #6E8478) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #6E8478) 42%, transparent);
}
.cf-grade b { font-size: 14px; color: var(--gc, #6E8478); letter-spacing: .01em; }
.cf-grade i { font-style: normal; font-size: 11.5px; color: var(--ink-45); }
.cf-grade-none { background: transparent; border-style: dashed; font-size: 12.5px; color: var(--ink-45); padding: 5px 12px; }
.cf-grade-tbl th, .cf-grade-tbl td { padding: 8px 10px; }
.cf-grade-tbl td b { font-size: 12px; }
/* the grading key in the help section */
#cfKey { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.cf-keyh { margin: 0 0 8px; font-size: 14px; }
#cfKey p { font-size: 13px; line-height: 1.55; margin: 0 0 8px; }
.cf-keytbl { margin-top: 10px; }
.cf-keytbl th[scope="row"] { padding-right: 6px; }
.cf-keytbl .cf-grade { padding: 3px 10px; }
.cf-keytbl .cf-grade b { font-size: 12.5px; }
.cf-keylist { margin: 4px 0 10px; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.cf-keywarn {
  border-left: 3px solid #F59E0B; padding: 8px 0 8px 12px; margin: 12px 0 8px !important;
  background: rgba(245,158,11,.05);
}
/* the mouza-to-SED table: two wide columns, so the cells carry their own unit */
/* both tables, not just the matrix - the ladder header ran together as
   "STANDINGSCHOOLS PER 10,000 PEOPLE" because this only named .cf-matrix */
.cf-matrix thead th .cf-u, .cf-ladder thead th .cf-u { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.cf-matrix tr.cf-grp i { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .75; }
.cf-per { display: block; font-size: 10.5px; color: var(--ink-45); font-weight: 400; margin-top: 1px; }
.cf-blank { color: var(--ink-45); opacity: .45; }
.cf-matrix td b { font-variant-numeric: tabular-nums; }
/* the per-row standing chip — small enough to scan a column of them at once */
.cf-chip {
  display: inline-block; padding: 2px 9px; border-radius: 99px; cursor: help;
  font-size: 11px; font-weight: 800; letter-spacing: .01em; white-space: nowrap;
  color: var(--gc, #6E8478);
  background: color-mix(in srgb, var(--gc, #6E8478) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #6E8478) 38%, transparent);
}
.cf-matrix th:last-child, .cf-matrix td:last-child { white-space: nowrap; }
/* the province marker: chip-shaped so the column still scans, but plainly not a grade */
.cf-chip.cf-chip-bench { color: var(--ink-45); background: transparent; border-style: dashed;
  border-color: var(--line); font-weight: 600; }

/* ---------- growth-vs-coverage plot -------------------------------------- */
.qd-wrap { position: relative; }
.qd-svg { display: block; overflow: visible; }
.qd-zone { fill: #B91C1C; opacity: .07; }
.qd-zonelab { font: 800 10.5px Archivo, sans-serif; fill: #B91C1C; opacity: .75; letter-spacing: .04em; }
.qd-grid { stroke: var(--line); }
.qd-tick { font: 400 10px sans-serif; fill: var(--ink-45); }
.qd-axis { font: 700 11.5px Archivo, sans-serif; fill: var(--ink-70, #4B5563); }
.qd-med { stroke: var(--pri, #0A5230); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .5; }
.qd-lab { font: 700 10px Archivo, sans-serif; fill: var(--ink); pointer-events: none; }

/* every bubble is a button: cursor, focus ring, and a halo that only shows
   on hover or selection so the resting chart stays quiet */
.qd-pt { cursor: pointer; outline: none; }
.qd-dot { stroke: #fff; stroke-width: 1.6; opacity: .55; transition: opacity .18s, r .18s; }
.qd-pt.is-crit .qd-dot { opacity: .88; }
.qd-halo { fill: none; stroke: var(--pri, #0A5230); stroke-width: 2; opacity: 0; transition: opacity .18s; }
.qd-pt:hover .qd-dot, .qd-pt:focus-visible .qd-dot, .qd-pt.is-sel .qd-dot { opacity: 1; }
.qd-pt:hover .qd-halo, .qd-pt:focus-visible .qd-halo, .qd-pt.is-sel .qd-halo { opacity: .85; }
.qd-pt.is-sel .qd-halo { stroke-width: 2.5; }
.qd-pt:hover .qd-lab, .qd-pt.is-sel .qd-lab { fill: var(--pri, #0A5230); }

/* staggered entry — purely decorative, and skipped for reduced motion */
@keyframes qd-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
.qd-pt { animation: qd-pop .42s cubic-bezier(.2,.9,.3,1.2) backwards;
  animation-delay: calc(var(--i, 0) * 22ms); transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: reduce) { .qd-pt { animation: none; } .qd-dot, .qd-halo { transition: none; } }

/* the detail card slides in under the plot */
.qd-detail { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.qd-detail.open { max-height: 640px; }
.qd-card { border: 1px solid var(--line); border-left: 4px solid var(--pri, #0A5230);
  border-radius: 12px; padding: 12px 14px; margin-top: 12px; background: var(--card, #fff); }
.qd-card.is-crit { border-left-color: #B91C1C; }
.qd-card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qd-card-h b { font-size: 15px; }
.qd-flag { font-size: 11px; font-weight: 800; color: #B91C1C; background: rgba(185,28,28,.09);
  border-radius: 99px; padding: 2px 9px; }
.qd-ok { font-size: 11px; font-weight: 700; color: var(--ink-45); }
.qd-close { margin-inline-start: auto; border: 0; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ink-45); padding: 0 4px; }
.qd-close:hover { color: var(--ink); }
/* Each label+value is ONE grid cell. As a flat run of dt/dd the grid laid them
   out independently and a label could end a row with its value starting the
   next one — "Projected 2026" above an unrelated number. */
.qd-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 18px; margin: 0; }
.qd-pair { min-width: 0; }
.qd-dl dt { font-size: 11.5px; color: var(--ink-45); margin-bottom: 1px; }
.qd-dl dd { margin: 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* the run of years across the top of the card */
.qd-past { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin: 4px 0 14px; padding: 10px 0; border-block: 1px solid var(--line); }
.qd-past-i { min-width: 0; }
.qd-past-y { display: block; font-size: 11px; font-weight: 800; color: var(--ink-45); letter-spacing: .03em; }
.qd-past-y i { font-style: normal; font-weight: 600; opacity: .8; }
.qd-past-i b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.qd-past-i small { display: block; font-size: 10.5px; color: var(--ink-45); line-height: 1.35; }
.qd-past-i.is-proj b { color: #1D4ED8; }
.qd-past-i.is-none b, .qd-past-i.is-none small { opacity: .55; }

/* the standing chip inside the card header */
.qd-grade { display: inline-flex; align-items: baseline; gap: 5px; cursor: help;
  padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 800;
  color: var(--gc, #6E8478);
  background: color-mix(in srgb, var(--gc, #6E8478) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #6E8478) 38%, transparent); }
.qd-grade i { font-style: normal; font-weight: 600; font-size: 10.5px; opacity: .85; }
.qd-rank { font-size: 11px; font-weight: 400; color: var(--ink-45); }
.qd-foot { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-70, #46586B); }
/* the maximiser gives it the room to breathe */
.ch-body .qd-detail.open { max-height: 800px; }
/* the large variant: this one sits alone under a chart rather than in a row
   of toolbar controls, so it can carry more weight */
.ts-why.ts-why-lg {
  font-size: 14px; padding: 11px 22px 11px 18px; gap: 9px; border-width: 1.5px;
  box-shadow: 0 2px 8px rgba(10,82,48,.10);
}
.ts-why.ts-why-lg::before { width: 20px; height: 20px; font-size: 13px; }
.ts-why.ts-why-lg:hover { box-shadow: 0 4px 14px rgba(10,82,48,.16); }
/* ---------- urbanisation slope ------------------------------------------- */
/* Two bars from a shared edge make the eye reconstruct a change; a dot at each
   end with a line between shows the distance travelled directly. */
.sl-scale { display: flex; justify-content: space-between; font-size: 10px;
  color: var(--ink-45); margin: 0 0 6px calc(96px + 10px); }
.sl-row { display: grid; grid-template-columns: 96px 1fr auto auto; align-items: center;
  gap: 10px; padding: 5px 0; }
.sl-nm { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-track { position: relative; height: 14px; }
.sl-track::before { content: ""; position: absolute; inset-inline: 0; top: 6px; height: 2px;
  background: var(--line); border-radius: 2px; }
.sl-line { position: absolute; top: 5.5px; height: 3px; border-radius: 3px;
  background: var(--pri-2, #16A34A); opacity: .5; }
.sl-line.is-down { background: #B45309; }
.sl-track i.sl-a, .sl-track i.sl-b { position: absolute; top: 2px; width: 10px; height: 10px;
  border-radius: 99px; transform: translateX(-5px); border: 2px solid var(--card, #fff); }
.sl-track i.sl-a { background: #9AA7A0; }
.sl-track i.sl-b { background: var(--pri, #0A5230); }
.sl-track i.sl-b.is-down { background: #B45309; }
.sl-vl { text-align: end; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl-d { display: block; font-size: 10.5px; font-weight: 700; color: var(--pri-2, #16A34A); }
.sl-d.is-down { color: #B45309; }
.sl-key { display: flex; gap: 14px; align-items: center; margin-top: 10px; font-size: 11px;
  color: var(--ink-45); flex-wrap: wrap; }
.sl-key span { display: inline-flex; align-items: center; gap: 5px; }
.sl-key i { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.sl-key i.sl-a { background: #9AA7A0; }
.sl-key i.sl-b { background: var(--pri, #0A5230); }
.sl-key-note { margin-inline-start: auto; font-style: italic; }

/* ---------- findings ----------------------------------------------------- */
/* Each one leads with the single number it is about, so the column can be
   scanned rather than read end to end. */
.fd { display: grid; grid-template-columns: 108px 1fr; gap: 14px; padding: 13px 0;
  border-top: 1px solid var(--line); }
.fd:first-child { border-top: 0; padding-top: 2px; }
.fd-stat { text-align: end; }
.fd-stat b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums;
  color: var(--pri, #0A5230); }
.fd.is-warn .fd-stat b { color: #B91C1C; }
.fd-stat span { display: block; font-size: 10.5px; line-height: 1.35; color: var(--ink-45); margin-top: 3px; }
.fd-body h4 { margin: 0 0 4px; font-size: 13.5px; }
.fd-body p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-70, #46586B); }
.fd-list { width: 100%; border-collapse: collapse; margin-top: 9px; font-size: 12px; }
.fd-list th, .fd-list td { padding: 4px 8px 4px 0; text-align: start; }
.fd-list thead th { font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-45); font-weight: 700; }
.fd-list tbody th { font-weight: 700; }
.fd-list td { font-variant-numeric: tabular-nums; }
.fd-more { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-45); }
@media (max-width: 560px) {
  .fd { grid-template-columns: 1fr; gap: 6px; }
  .fd-stat { text-align: start; }
  .sl-row { grid-template-columns: 78px 1fr auto; }
  .sl-scale { margin-inline-start: 88px; }
}
/* Full width earns two columns of findings rather than one very long one, and
   lets the slope chart give its labels real room. Both cards sit stacked with
   the quadrant plot above them, so the eye reads straight down. */
@media (min-width: 900px) {
  #findings { columns: 2; column-gap: 30px; }
  .fd { break-inside: avoid; -webkit-column-break-inside: avoid; }
  .fd:first-child { padding-top: 0; }
  /* a column start should not look like a continuation */
  .fd { border-top: 1px solid var(--line); padding-top: 13px; }
  #urban { columns: 2; column-gap: 34px; }
  .sl-row, .sl-key { break-inside: avoid; }
  .sl-scale { columns: 1; }
  .sl-key { margin-top: 12px; }
}
@media (min-width: 1200px) {
  .sl-row { grid-template-columns: 120px 1fr auto; }
  .sl-scale { margin-inline-start: 130px; }
}
/* the per-row standing and the reclassification flag */
.sl-st { display: inline-flex; justify-content: flex-end; min-width: 74px; }
.sl-chip { display: inline-block; padding: 2px 8px; border-radius: 99px; cursor: help;
  font-size: 10.5px; font-weight: 800; white-space: nowrap; color: var(--gc, #6E8478);
  background: color-mix(in srgb, var(--gc, #6E8478) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #6E8478) 36%, transparent); }
.sl-warn { display: inline-flex; align-items: center; justify-content: center; cursor: help;
  width: 14px; height: 14px; border-radius: 99px; background: #F59E0B; color: #3B2200;
  font-style: normal; font-size: 10px; font-weight: 900; vertical-align: middle; margin-inline-start: 4px; }
/* a scoped view can run long, so let it scroll rather than push the page */
#urban { max-height: 620px; overflow-y: auto; }
@media (min-width: 1200px) {
  .sl-row { grid-template-columns: 130px 1fr auto auto; }
}
.sl-chip.sl-chip-few { color: var(--ink-45); background: transparent;
  border-style: dashed; border-color: var(--line); font-weight: 600; }
/* a selected tehsil is marked, not isolated — its siblings stay for contrast */
.sl-row.is-sel { background: rgba(22,163,74,.07); border-radius: 8px;
  box-shadow: inset 3px 0 0 var(--pri-2, #16A34A); padding-inline-start: 8px; }
.sl-row.is-sel .sl-nm { font-weight: 800; }
/* ---------- full comparison table: fit it in the card -------------------- */
/* The headings were what forced the horizontal scroll, not the figures, so
   each one stacks its qualifier on a second line and the column narrows to
   what its numbers actually need. */
#tbl { font-size: 12px; }
#tbl th, #tbl td { padding: 6px 5px; }
#tbl thead th { vertical-align: bottom; line-height: 1.2; font-size: 10px; letter-spacing: .02em; }
#tbl thead th .ct { display: block; white-space: nowrap; }
#tbl thead th .ct2 { display: block; font-size: 9px; font-weight: 500; opacity: .7;
  white-space: nowrap; letter-spacing: 0; }
#tbl td.nm { font-size: 12px; }
#tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
#tbl td[title] { cursor: help; }
#tbl td.nm { white-space: nowrap; }
.nmw { display: block; max-width: 168px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
#tbl td.nm small { display: block; font-size: 10px; }
#tbl th, #tbl td { padding: 6px 4px; }
#tbl tbody td { font-size: 11.5px; }
@media (max-width: 780px) { #tbl { font-size: 11.5px; } #tbl th, #tbl td { padding: 5px 5px; } }
/* the geography switch sits beside the level switch but reads as secondary */
.seg-geo { margin-inline-start: 4px; }
.seg-geo button { font-size: 11.5px; }
.seg-geo.is-off { opacity: .45; }
.seg-geo.is-off button { cursor: not-allowed; }
#tbl thead th[title] { cursor: help; }
/* ---------- intelligence: need-index working ----------------------------- */
.in-band { display: inline-block; margin-inline-start: 8px; padding: 1px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 800; white-space: nowrap; cursor: help; color: var(--gc, #6E8478);
  background: color-mix(in srgb, var(--gc, #6E8478) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--gc, #6E8478) 36%, transparent); }
.in-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.in-tbl th, .in-tbl td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); }
.in-tbl thead th { font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-45); font-weight: 700; }
.in-tbl tbody th { font-weight: 700; cursor: help; }
.in-tbl td { font-variant-numeric: tabular-nums; }
.in-tbl .in-w { color: var(--ink-45); }
.in-bar { display: inline-block; width: 76px; height: 7px; border-radius: 99px;
  background: rgba(0,0,0,.07); margin-inline-end: 8px; vertical-align: middle; overflow: hidden; }
.in-bar i { display: block; height: 100%; border-radius: 99px; background: #B91C1C; }
/* the blind spot the whole page depends on */
.in-blind { display: grid; grid-template-columns: 190px 1fr; gap: 18px; margin-top: 18px;
  padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid #B45309;
  border-radius: 12px; background: rgba(245,158,11,.05); }
.in-blind-n { text-align: end; }
.in-blind-n b { display: block; font-size: 26px; line-height: 1.05; color: #B45309;
  font-variant-numeric: tabular-nums; }
.in-blind-n span { display: block; font-size: 11px; color: var(--ink-45); margin-top: 4px; }
.in-blind p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--ink-70, #46586B); }
.in-blind p:last-child { margin-bottom: 0; }
@media (max-width: 620px) { .in-blind { grid-template-columns: 1fr; } .in-blind-n { text-align: start; } }
/* ---------- need-index legend -------------------------------------------- */
.in-key { margin: 4px 0 16px; }
.in-key-ramp { position: relative; height: 14px; border-radius: 99px; display: flex;
  justify-content: space-between; align-items: center; padding: 0 10px; }
.in-key-ramp span { font-size: 9.5px; font-weight: 800; color: #fff; letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.35); white-space: nowrap; }
.in-key-bands { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; }
.in-key-b { display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--ink-70, #46586B); }
.in-key-b i { width: 11px; height: 11px; border-radius: 3px; background: var(--gc); flex: 0 0 auto; }
.in-key-b b { font-variant-numeric: tabular-nums; color: var(--ink-45); font-weight: 700; }
.in-key-note { margin: 9px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink-70, #46586B); }
/* ---------- a section that has moved elsewhere --------------------------- */
.handoff { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.handoff-t h3 { margin: 0 0 6px; font-size: 14px; }
.handoff-t p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--ink-70, #46586B); }
.handoff-t p.muted { font-size: 12px; margin-bottom: 0; }
.handoff-go { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 11px 20px; border-radius: 99px; font-weight: 800; font-size: 13.5px;
  text-decoration: none; color: #fff; background: var(--pri, #0A5230);
  box-shadow: 0 2px 8px rgba(10,82,48,.18); }
.handoff-go:hover { background: var(--pri-2, #16A34A); box-shadow: 0 4px 14px rgba(10,82,48,.24); }
@media (max-width: 700px) { .handoff { grid-template-columns: 1fr; } }
/* download sits with the pickers, because that is where the area is chosen */
.prof-pdf { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 16px; border-radius: 99px; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 800; color: #fff;
  background: var(--pri, #0A5230); box-shadow: 0 2px 6px rgba(10,82,48,.16); }
.prof-pdf:hover { background: var(--pri-2, #16A34A); box-shadow: 0 3px 10px rgba(10,82,48,.22); }
.prof-pdf:disabled { opacity: .55; cursor: wait; box-shadow: none; }
@media (max-width:700px){ .prof-pdf { width: 100%; justify-content: center; } }

/* ---- header space priority -------------------------------------------------
   The module bar is navigation and must never be clipped; the header figures
   are ambient. js/ux.js measures the bar and adds these classes only when the
   twelve tabs would not otherwise fit, so the figures stay on every screen wide
   enough to carry both rather than disappearing at a guessed breakpoint. */
/* The header figures are gone for good. They cost about 370px in a bar that was
   already 286px short of showing its own menu, and they were the reason the
   layout differed from page to page: pages carrying them clipped four tabs and
   pushed the live badge into the middle, while Comparison - which never had them
   - showed all twelve tabs, a full title and the badge at the end. Every page
   now looks like Comparison.

   The element is hidden rather than deleted because six pages write into it on
   load; removing it would turn each of those into a null dereference for a
   thing nobody can see. */
.app-bar .hdr-stats { display: none; }

/* The live badge is appended at parse time but the theme toggle and the account
   chip are built by later scripts, so DOM order alone put it in a different
   place depending on which script won. Flex order pins it last on every page. */
.app-bar .sys-live { order: 99; }

/* Only the tab padding gives way now, and only where twelve tabs still will not
   fit. The title keeps its size at every width - shrinking it was what made
   narrow screens look like a different product. */
.app-bar .nav-tabs { min-width: 0; }   /* it must always be able to give way */
.app-bar.tight .nav-tabs a { padding-inline: 8px; font-size: 12px; }

/* Last resort, for the signed-in header: a PDF button, a theme toggle and an
   account chip together add roughly 340px, and once the tabs are already tight
   there is nothing left to shrink - so the rightmost items were being cut off
   the edge instead. The two ceremonial title lines and the live badge stand
   down before anything functional does. */
.app-bar.tighter .sys-live { display: none; }
.app-bar.tighter .app-title .gov,
.app-bar.tighter .app-title small { display: none; }

/* On a phone the bar was giving 48px to the logo, 63 to the live badge and 66 to
   the account chip, leaving the twelve-tab module bar 98px to show 468px of tabs.
   The logo alone identifies the system at this size, so everything ambient stands
   down and the menu takes the width. It still scrolls - twelve tabs cannot fit on
   a 375px screen - but it scrolls with the current tab in view. */
@media (max-width: 760px) {
  .app-bar .sys-live { display: none; }
}


/* ---- module switching without a screen change ------------------------------
   Every module is its own document in this project - each one carries its own
   dataset, its own scripts and, on the map, a Leaflet instance. Rewriting the
   twelve into a single-page app would mean rebuilding all of them, so instead
   the browser is told to treat a navigation between them as one continuous
   view: the header and footer are declared as the SAME element on both sides,
   so they do not move, repaint or flash, and only the module body changes.

   Chrome runs this; anything that does not support it simply navigates the way
   it always did, so nothing is lost by it being unsupported. */
@view-transition { navigation: auto; }

.app-bar  { view-transition-name: sed-shell-top; }
.app-foot { view-transition-name: sed-shell-foot; }

/* Only the body of the page crossfades, and briefly - a slow transition reads
   as the page being slow, which is the opposite of the point. */
::view-transition-old(root) { animation: sedVtOut .12s ease both; }
::view-transition-new(root) { animation: sedVtIn .2s cubic-bezier(.2,.8,.3,1) both; }
@keyframes sedVtOut { to { opacity: 0; } }
@keyframes sedVtIn { from { opacity: 0; transform: translateY(7px); } }

/* The shell is declared shared purely so it stays still; it must not animate. */
::view-transition-group(sed-shell-top),
::view-transition-group(sed-shell-foot) { animation-duration: 0s; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}


/* ---- tab bar: one indicator that travels ------------------------------------
   The active tab used to paint its own background, so moving between modules
   made the highlight blink out in one place and appear in another. There is now
   a single indicator behind the row that slides to whichever tab you are on -
   and previews the move while you hover, so the bar answers before you commit.

   It borrows the active style from the theme rather than hard-coding white, so
   the HUD theme keeps its own treatment. If the script does not run, .on paints
   its own background exactly as before - the pill only takes over once it is
   actually there, which is what .has-pill marks. */
.nav-tabs {
  position: relative;
  --pill-bg: #fff;
  --pill-shadow: 0 2px 8px rgba(0,0,0,.25);
}
html.hud .nav-tabs {
  --pill-bg: linear-gradient(150deg, #10352A, #0A2A1F);
  --pill-shadow: inset 0 0 0 1px rgba(110, 231, 183, .38);
}

.nav-tabs .tab-pill {
  position: absolute;
  top: 0; left: 0;
  border-radius: 999px;
  background: var(--pill-bg);
  box-shadow: var(--pill-shadow);
  pointer-events: none;
  z-index: 0;
  /* a little overshoot on the way in - it is what makes it read as a physical
     thing being moved rather than a rectangle being redrawn */
  transition: transform .34s cubic-bezier(.34, 1.36, .5, 1),
              width     .34s cubic-bezier(.34, 1.36, .5, 1),
              height    .2s ease;
}
.nav-tabs a { position: relative; z-index: 1; }
.nav-tabs.has-pill a.on { background: transparent; box-shadow: none; }
.nav-tabs.has-pill a:hover { background: transparent; }
.nav-tabs.has-pill a { transition: color .18s ease; }

/* Pressing a tab dips it slightly, so the tap has a physical answer. */
.nav-tabs.has-pill a:active { transform: scale(.96); }

@media (prefers-reduced-motion: reduce) {
  .nav-tabs .tab-pill { transition: none; }
}


/* ---- the module rail, in the header ----------------------------------------
   Same items and same look as the side rail - icon over label, green pill on
   the active module - laid horizontally where the old tab row sat. The sidebar
   styling above still describes the rail's items; these rules only re-aim the
   container at the header's dark green ground. */
.app-bar .rail {
  position: static; width: auto; flex: 0 1 auto; min-width: 0;
  flex-direction: row; align-items: stretch; gap: 2px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  border-inline-end: 1px solid rgba(255,255,255,.16);
  border-radius: 16px; padding: 5px 4px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
}
.app-bar .rail::-webkit-scrollbar { display: none; }
.app-bar .rail .rail-item {
  flex: 0 0 auto; min-width: 56px; padding: 4px 9px 3px;
  gap: 2px; font-size: 9.5px; color: #CFE5D8; border-radius: 13px;
  position: relative;
  /* a little overshoot on the way up, none on the way back - it reads as the
     item answering the pointer rather than a box being resized */
  transition: transform .2s cubic-bezier(.2,.9,.3,1.35),
              background .18s ease, color .18s ease, box-shadow .2s ease;
}
.app-bar .rail .rail-item svg {
  width: 17px; height: 17px;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.35);
}
/* The label is the thing that is genuinely hard to read at 9.5px, so it grows
   the most. Scaling it (rather than changing font-size) keeps the row's layout
   perfectly still - nothing reflows, nothing shifts sideways. */
.app-bar .rail .rail-item .rl {
  display: block; white-space: nowrap; letter-spacing: .01em;
  transform-origin: center top;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.35), color .18s ease;
}
.app-bar .rail .rail-item:hover,
.app-bar .rail .rail-item:focus-visible {
  background: rgba(255,255,255,.14);
  color: #fff;
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  z-index: 3;
}
.app-bar .rail .rail-item:hover svg,
.app-bar .rail .rail-item:focus-visible svg { transform: scale(1.2); }
.app-bar .rail .rail-item:hover .rl,
.app-bar .rail .rail-item:focus-visible .rl { transform: scale(1.32); }
.app-bar .rail .rail-item:active { transform: translateY(0) scale(.99); }
.app-bar .rail .rail-item.on { background: #fff; color: var(--pri); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.app-bar .rail .rail-item.on:hover { background: #fff; color: var(--pri); box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.app-bar .rail .rail-deco { display: none; }

/* With the header tab row gone, the rail is the only menu there is - so on a
   phone it docks to the bottom as a horizontal tab bar instead of vanishing.
   env(safe-area-inset-bottom) keeps it above an iPhone home indicator. */
@media (max-width: 760px) {
  .rail, .app-bar .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; z-index: 1200;
    flex-direction: row; align-items: stretch;
    overflow-x: auto; overflow-y: hidden;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-inline-end: 0; border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px rgba(10, 44, 25, .12);
    scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail .rail-item, .app-bar .rail .rail-item { flex: 0 0 auto; min-width: 62px; font-size: 10px; padding: 7px 8px; color: var(--ink-70); border-radius: 12px; }
  .rail .rail-item.on, .app-bar .rail .rail-item.on { background: var(--pri-2); color: #fff; }
  .rail .rail-deco { display: none; }
  /* the content must not end underneath the bar */
  .content-row { padding-bottom: 64px; }
}


/* ---- card-grid two-column pin ----------------------------------------------
   .card-grid is repeat(auto-fit, minmax(300px, 1fr)). auto-fit only collapses
   tracks that hold nothing, and a full-width card spans every track - so a
   section mixing one wide card with two normal ones kept four 310px tracks
   alive and rendered the normal cards at 310px under a 1280px one. Two
   explicit columns above 900px make every row match; wide cards still span
   1 / -1, and grids that set their own columns by id keep theirs. */
@media (min-width: 900px) {
  main.dash .card-grid { grid-template-columns: 1fr 1fr; }
}
