/* ===========================================================
   IGBMD Landing — citizen-first refit of index.html
   Same DNA: gov-strip + 3-col body + choropleth + ranking
   =========================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:     #003893;
  --blue-lt:  #1a5abf;
  --blue-50:  #eef2fb;
  --red:      #DC143C;
  --red-50:   #fdecef;
  --white:    #ffffff;
  --gray-50:  #f8f9fb;
  --gray-100: #f0f2f5;
  --gray-200: #e2e6ec;
  --gray-300: #cdd2db;
  --gray-400: #9ba3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #0f1626;
  --green:    #16a34a;
  --green-50: #f0fdf4;
  --amber:    #d97706;
  --amber-50: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15,22,38,.05);
  --shadow:    0 1px 3px rgba(15,22,38,.08), 0 1px 2px rgba(15,22,38,.04);
  --shadow-md: 0 4px 14px rgba(15,22,38,.08), 0 2px 4px rgba(15,22,38,.04);
  --shadow-lg: 0 12px 40px rgba(15,22,38,.14);
  --panel-w:  264px;
  --right-w:  320px;
  --header-h: 78px;
  --radius:   8px;
  --radius-lg:12px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', 'Noto Sans Devanagari', system-ui, sans-serif;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ────────────────────────────────────────────── */
.gov-strip { height: 4px; background: var(--blue); }
.gov-red-stripe { height: 3px; background: var(--red); }

.gov-header {
  background: var(--white);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--gray-200);
}
.gov-emblem { height: 52px; width: auto; flex-shrink: 0; }

.gov-header-text { flex: 1; min-width: 0; }
.gov-header-text h1 {
  font-size: 14px; font-weight: 700;
  color: var(--gray-900); line-height: 1.25;
  letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.gov-header-text h1 .en-h {
  font-size: 11.5px; color: var(--gray-500); font-weight: 500;
}
.gov-header-text h2 {
  font-size: 11.5px; font-weight: 500;
  color: var(--gray-500); margin-top: 2px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}

.live-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--green-50); border: 1px solid #bbf7d0;
  color: var(--green); font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  letter-spacing: .04em;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Audience switch — segmented control */
.audience-switch {
  display: flex;
  background: var(--gray-100);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.aud-btn {
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--gray-500);
  background: transparent; border: none;
  padding: 6px 14px; border-radius: 999px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s ease;
}
.aud-btn:hover:not(.active) { color: var(--gray-700); }
.aud-btn.active {
  background: var(--white);
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.aud-glyph {
  font-size: 13px;
  filter: grayscale(.5);
}
.aud-btn.active .aud-glyph { filter: none; }

.hd-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lang-btn {
  font-family: inherit;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 4px;
  display: flex;
  cursor: pointer;
  font-size: 11px; font-weight: 700;
  position: relative;
  width: 64px;
}
.lang-btn span {
  flex: 1; padding: 4px 0; text-align: center;
  border-radius: 999px;
  color: var(--gray-500);
  transition: all .15s;
}
.lang-btn .lang-on { background: var(--blue); color: var(--white); }
.lang-btn.en .lang-on { background: transparent; color: var(--gray-500); }
.lang-btn.en .lang-off { background: var(--blue); color: var(--white); }

.btn-back {
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 7px 12px; border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  display: flex; align-items: center; gap: 4px;
  transition: all .15s;
}
.btn-back:hover { background: var(--gray-50); border-color: var(--gray-300); }

/* ── APP BODY ──────────────────────────────────────────── */
.app-body {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* ── LEFT PANEL ────────────────────────────────────────── */
.left-panel {
  width: var(--panel-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.lp-hd {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.lp-hd h3 {
  font-size: 13px; font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.005em;
}
.lp-close {
  display: none;
  background: none; border: none;
  font-size: 22px; color: var(--gray-500);
  cursor: pointer; line-height: 1;
  padding: 0 4px;
}

.lp-section { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); }
.lp-section:last-of-type { border-bottom: none; }
.lp-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--gray-400); margin-bottom: 10px;
}

/* Level segmented buttons */
.level-btns {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.level-btn {
  flex: 1; font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 6px 4px; border-radius: 6px;
  border: none;
  background: transparent; color: var(--gray-600);
  cursor: pointer; transition: all .15s;
}
.level-btn.active {
  background: var(--white); color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.level-btn:hover:not(.active) { color: var(--gray-800); }

/* Select */
.lp-select {
  width: 100%; font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 8px 10px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); background: var(--white);
  color: var(--gray-800); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.lp-select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

/* Layer options — citizen-language wrapper */
.layer-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background .12s;
  margin: 0 -6px;
}
.layer-opt + .layer-opt { margin-top: 2px; }
.layer-opt:hover { background: var(--gray-50); }
.layer-opt.active { background: var(--blue-50); }
.layer-radio {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--gray-300);
  flex-shrink: 0; margin-top: 2px;
  transition: all .12s;
}
.layer-opt.active .layer-radio {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: inset 0 0 0 3px var(--white);
}
.layer-text { flex: 1; min-width: 0; }
.layer-name {
  font-size: 12.5px; font-weight: 600; color: var(--gray-800);
  line-height: 1.3;
}
.layer-opt.active .layer-name { color: var(--blue); }
.layer-sub {
  font-size: 10.5px; color: var(--gray-400);
  margin-top: 2px;
}

/* Toggle row */
.toggle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 12.5px; color: var(--gray-700);
  user-select: none;
}
.toggle-row input { display: none; }
.tog-track {
  width: 30px; height: 17px;
  background: var(--gray-300);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background .15s;
}
.tog-dot {
  position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px;
  background: var(--white);
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: var(--shadow-sm);
}
.toggle-row input:checked + .tog-track { background: var(--blue); }
.toggle-row input:checked + .tog-track .tog-dot { transform: translateX(13px); }

/* Legend grid */
.legend-grid { display: flex; flex-direction: column; gap: 5px; }
.legend-item {
  display: grid;
  grid-template-columns: 14px 50px 1fr;
  align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--gray-600);
}
.legend-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.leg-tag {
  font-size: 10px; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .04em;
}

.lp-footer {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 10.5px; color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
  line-height: 1.6;
}
.lp-footer .ver { color: var(--gray-500); font-weight: 500; }

/* ── MAP AREA ──────────────────────────────────────────── */
.map-area {
  flex: 1;
  position: relative;
  background: #e8edf2;
  min-width: 0;
}

#map { width: 100%; height: 100%; }

/* HERO row over the map */
.hero-row {
  position: absolute; top: 14px; left: 14px; right: 14px;
  z-index: 500;
  display: flex; align-items: center; gap: 8px;
}
.hero-menu {
  display: none;
  width: 38px; height: 38px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 16px; color: var(--gray-700);
  cursor: pointer; box-shadow: var(--shadow);
}

.hero-search {
  flex: 1; max-width: 560px;
  display: flex; align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 0 8px 0 14px;
  height: 42px;
  box-shadow: var(--shadow-md);
  transition: all .15s;
}
.hero-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,56,147,.10), var(--shadow-md);
}
.hero-icon { font-size: 14px; opacity: .7; flex-shrink: 0; }
.hero-search input {
  flex: 1;
  font-family: inherit;
  font-size: 13px; color: var(--gray-800);
  padding: 0 12px;
  border: none; outline: none;
  background: transparent;
  height: 100%;
  min-width: 0;
}
.hero-search input::placeholder { color: var(--gray-400); }
.hero-kbd {
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.hero-cta {
  font-family: inherit;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0 18px;
  height: 42px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  box-shadow: var(--shadow-md);
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}
.hero-cta:hover { background: #b91030; transform: translateY(-1px); }
.cta-glyph { font-size: 14px; }

/* Audience-aware: officer + donor hide the report CTA */
body.aud-officer .hero-cta,
body.aud-donor .hero-cta { display: none; }

.hero-suggest {
  position: absolute;
  top: 60px; left: 14px;
  z-index: 600;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, calc(100% - 28px));
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.sg-group-hd {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--gray-400);
  padding: 8px 12px 4px;
}
.sg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12.5px;
}
.sg-item:hover { background: var(--gray-50); }
.sg-item-glyph {
  width: 26px; height: 26px;
  background: var(--blue-50); color: var(--blue);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.sg-item-name { font-weight: 600; color: var(--gray-800); }
.sg-item-meta { font-size: 11px; color: var(--gray-500); margin-top: 1px; }

/* KPI strip — top right of map */
.kpi-strip {
  position: absolute; top: 70px; right: 14px;
  z-index: 400;
  display: flex; gap: 8px;
}
.kpi {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  min-width: 96px;
  box-shadow: var(--shadow);
}
.kpi-val {
  font-size: 17px; font-weight: 700;
  color: var(--gray-900);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.kpi-unit {
  font-size: 11px; font-weight: 500;
  color: var(--gray-500);
}
.kpi-lbl {
  font-size: 10px; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .05em;
  margin-top: 4px;
  font-weight: 500;
}
.kpi-warn .kpi-val { color: var(--amber); }
.kpi-warn { border-color: #fde68a; background: var(--amber-50); }
.kpi-warn .kpi-lbl { color: #92400e; }

/* Loading */
.map-loading {
  position: absolute; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(248,249,251,.94);
  gap: 14px;
  pointer-events: none;
}
.map-loading.hidden { display: none; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.map-loading p { font-size: 12.5px; color: var(--gray-600); font-weight: 500; }

/* Breadcrumb pill */
.map-breadcrumb {
  position: absolute; bottom: 14px; left: 14px;
  z-index: 500;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 28px);
}
.bc-home {
  background: var(--gray-100);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.bc-text {
  font-weight: 600; color: var(--gray-800);
  white-space: nowrap;
}
.bc-stat {
  font-size: 11px; color: var(--gray-500);
  border-left: 1px solid var(--gray-200);
  padding-left: 8px;
}

/* Map tools (zoom + locate) */
.map-tools {
  position: absolute; right: 14px; bottom: 14px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.map-tool-stack {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.map-tool {
  width: 34px; height: 34px;
  background: var(--white);
  border: none;
  font-size: 15px; font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.map-tool-stack .map-tool + .map-tool { border-top: 1px solid var(--gray-100); }
.map-tool:hover { background: var(--gray-50); }
#btnLocate {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── PIN markers ── */
.pin-marker {
  width: 18px; height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--white);
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
}
.pin-marker.flag {
  background: var(--red);
  animation: pin-pulse 2s infinite;
}
.pin-marker.ok { background: var(--blue); }
.pin-marker.warn { background: var(--amber); }
@keyframes pin-pulse {
  0%, 100% { box-shadow: 0 2px 4px rgba(0,0,0,.25), 0 0 0 0 rgba(220,20,60,.6); }
  50%      { box-shadow: 0 2px 4px rgba(0,0,0,.25), 0 0 0 8px rgba(220,20,60,0); }
}

/* Province label */
.prov-label-div {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--gray-200);
  color: var(--gray-800);
  font-family: 'Inter', sans-serif;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  text-align: center;
  line-height: 1.2;
}
.prov-label-div .pl-pct {
  font-weight: 500; color: var(--gray-500);
  font-size: 9.5px;
  margin-left: 2px;
}

.leaflet-tooltip-custom {
  font-family: 'Inter', sans-serif !important;
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius) !important;
  padding: 8px 12px !important;
  box-shadow: var(--shadow-md) !important;
  font-size: 12px !important;
  z-index: 1500 !important;
}
.selected-map-scope {
  position: absolute;
  left: 18px;
  top: 172px;
  z-index: 720;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100% - 390px));
  background: #ffffff;
  border: 2px solid #0a7d36;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
  padding: 9px 12px;
  color: var(--gray-800);
}
.selected-map-scope[hidden] { display: none; }
.sms-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .16);
  flex: 0 0 auto;
}
.sms-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.sms-title {
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sms-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-palika-label {
  font-family: 'Inter', sans-serif !important;
  border: 2px solid #0a7d36 !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #14532d !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 22px rgba(10, 125, 54, .24) !important;
}

/* ── Right-rail context detail (province / district / palika / project) ── */
.here-pane { display: flex; flex-direction: column; gap: 18px; }

.ctx-hd {
  position: relative;
  padding-right: 32px;
}
.ctx-close {
  position: absolute;
  top: -2px; right: -2px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-700);
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.ctx-close:hover { background: var(--gray-200); color: var(--gray-900); }
.ctx-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue-700, #1a3b8c);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.ctx-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.ctx-bc-link {
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.ctx-bc-link:hover { text-decoration: underline; }
.ctx-bc-sep { color: #cbd5e1; }
.ctx-bc-cur { color: var(--gray-500); }
.ctx-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.ctx-meta { font-size: 12px; color: var(--gray-600); line-height: 1.5; }
.ctx-ledger-preview {
  padding-bottom: 2px;
}
.ctx-ledger-preview .ctx-title {
  font-size: 20px;
  font-weight: 850;
  line-height: 1.14;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.ctx-ledger-preview .ctx-meta {
  font-size: 12px;
  line-height: 1.25;
  color: var(--gray-600);
}
.ctx-ledger-preview .ctx-breadcrumb {
  font-size: 11px;
  margin-bottom: 5px;
}

/* KPI tiles */
.ctx-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.ctx-kpi {
  background: #f9fafb;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px 12px;
}
.ctx-kpi-val {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.ctx-kpi-val small {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  margin-left: 2px;
}
.ctx-kpi-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.ctx-kpi.err .ctx-kpi-val { color: var(--red); }
.ctx-ledger-kpis {
  gap: 8px;
  margin-top: 2px;
}
.ctx-ledger-kpis .ctx-kpi {
  border-radius: 10px;
  padding: 9px 10px 8px;
}
.ctx-ledger-kpis .ctx-kpi-val {
  font-size: 17px;
  white-space: nowrap;
}
.ctx-ledger-kpis .ctx-kpi-val small {
  font-size: 11px;
  margin-left: 3px;
}
.ctx-ledger-kpis .ctx-kpi-lbl {
  font-size: 10px;
  letter-spacing: .05em;
  margin-top: 6px;
}
.ctx-ledger-progress {
  gap: 5px;
}
.ctx-ledger-progress .ctx-section-hd {
  margin-bottom: 0;
}
.ctx-ledger-progress .ctx-section-hd h4 {
  font-size: 12px;
}

/* Status mix bar */
.ctx-section { display: flex; flex-direction: column; gap: 8px; }
.ctx-section-hd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.ctx-section-hd h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  letter-spacing: -0.01em;
}
.ctx-section-sub { font-size: 11px; color: var(--gray-500); }

.ctx-status-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gray-100);
}
.ctx-sb-seg {
  display: block;
  height: 100%;
  transition: width .4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ctx-sb-seg.ok { background: #16a34a; }
.ctx-sb-seg.warn { background: #d97706; }
.ctx-sb-seg.flag { background: var(--red); }
.ctx-status-legend {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  color: var(--gray-600);
  flex-wrap: wrap;
}
.ctx-status-legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.ctx-status-legend .dot.ok { background: #16a34a; }
.ctx-status-legend .dot.warn { background: #d97706; }
.ctx-status-legend .dot.flag { background: var(--red); }

/* Sector breakdown */
.ctx-sectors { display: flex; flex-direction: column; gap: 6px; }
.ctx-sector {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.ctx-sector-glyph { font-size: 16px; }
.ctx-sector-name { color: var(--gray-800); font-weight: 500; }
.ctx-sector-bar {
  position: relative;
  height: 4px;
  width: 56px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-left: auto;
}
.ctx-sector-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}
.ctx-sector-cnt {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-900);
  min-width: 18px;
  text-align: right;
}

/* Top projects list (re-uses .story-item from existing CSS) */
.ctx-top { display: flex; flex-direction: column; gap: 6px; }

/* Money flow strip */
.ctx-money { display: flex; flex-direction: column; gap: 6px; }
.ctx-money-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--gray-700);
  padding: 4px 0;
  border-bottom: 1px dashed var(--gray-100);
}
.ctx-money-row:last-of-type { border-bottom: none; }
.ctx-money-row b { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; color: var(--gray-900); font-weight: 600; }
.ctx-money-row.remain b { color: var(--blue); }
.ctx-money-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.ctx-money-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #4a8fd6);
  border-radius: 999px;
}

/* Inline progress bars (project context) */
.ctx-bars { display: flex; flex-direction: column; gap: 4px; }
.ctx-bar-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-700);
}
.ctx-bar-row b { color: var(--gray-900); font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-weight: 700; }
.ctx-bar-track {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.ctx-bar-fill { height: 100%; border-radius: 999px; }
.ctx-bar-foot { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* Inline flag/info notice */
.ctx-flag {
  padding: 9px 12px;
  background: rgba(220,20,60,0.07);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  font-size: 12px;
  color: var(--red-dark, #7f0d1e);
  font-weight: 500;
  line-height: 1.5;
}
.ctx-flag.info {
  background: rgba(0,56,147,0.06);
  border-left-color: var(--blue);
  color: #1a3b8c;
}

/* Action buttons */
.ctx-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.ctx-actions-large { gap: 12px; }
.ctx-ledger-actions { gap: 8px; }
.ctx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--gray-200);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-900);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.ctx-btn-lg {
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 10px;
}
.ctx-btn:hover { background: var(--gray-50); border-color: #cbd5e1; }
.ctx-btn.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.ctx-btn.primary:hover { background: #002970; }
.ctx-btn.warn {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.ctx-btn.warn:hover { background: #b91030; }

.ctx-empty-mini {
  font-size: 12px;
  color: var(--gray-500);
  padding: 6px 0;
}

/* ── Floating map legend (replaces the panel legend) ── */
.legend-section { display: none; }  /* old panel legend hidden — moved onto the map */

.map-legend {
  position: absolute;
  bottom: 60px;          /* sits just above the breadcrumb at bottom:14px */
  left: 14px;
  z-index: 500;
  width: 240px;
  padding: 11px 14px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 22px -10px rgba(15, 23, 42, 0.18);
  font-family: 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.map-legend:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.97);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 14px 28px -8px rgba(15, 23, 42, 0.22);
}
.map-legend:active { transform: translateY(0); }
.map-legend:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.ml-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.ml-cycle {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0, 56, 147, 0.08);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  transition: background .15s, transform .25s;
}
.map-legend:hover .ml-cycle {
  background: var(--blue);
  color: #fff;
  transform: rotate(180deg);
}

.ml-metric {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
  letter-spacing: -0.005em;
}

.ml-gradient { position: relative; }
.ml-bar {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #7f0d1e 0%,
    #DC143C 22%,
    #d97706 50%,
    #1a6bbf 78%,
    #003893 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  position: relative;
}
/* Subtle tick notches at bin boundaries */
.ml-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right,
      transparent calc(22% - 1px), rgba(255,255,255,0.45) 22%, transparent calc(22% + 1px),
      transparent calc(50% - 1px), rgba(255,255,255,0.45) 50%, transparent calc(50% + 1px),
      transparent calc(78% - 1px), rgba(255,255,255,0.45) 78%, transparent calc(78% + 1px));
  border-radius: 999px;
}
.ml-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-600);
  margin-top: 4px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0;
}
.ml-ticks span:nth-child(2) { color: var(--gray-500); }

/* Tighten on small viewports */
@media (max-width: 760px) {
  .map-legend {
    width: calc(100% - 28px);
    bottom: 60px;
  }
  .ml-ticks { font-size: 9.5px; }
}

/* ── Custom click info-card — sibling of #map, escapes leaflet's transform stacking trap ── */
.lf-info-card[hidden] { display: none !important; }
.lf-info-card {
  position: absolute;
  z-index: 1600;
  width: min(320px, calc(100% - 28px));
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 16px 40px -8px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  animation: lfic-in .18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lfic-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.lfic-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none;
  font-size: 16px; line-height: 1;
  color: var(--gray-700);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .12s, color .12s;
  font-family: inherit;
}
.lfic-close:hover { background: var(--gray-200); color: var(--gray-900); }
.lf-info-card .lf-popup { min-width: 0; }
.lf-info-card .lf-popup-name { padding-right: 24px; }  /* room for the × */
.lf-info-card .lf-cta {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.lf-info-card .lf-cta:hover { background: #002970; }
.lf-info-card .lf-cta.secondary {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--gray-200);
  margin-top: 6px;
}
.lf-info-card .lf-cta.secondary:hover { background: var(--gray-50); border-color: var(--blue); }

/* Triangle pointer — at bottom when card is above click, top when below */
.lf-info-card::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 14px; height: 14px;
  background: #fff;
}
.lf-info-card.lfic-above::after {
  bottom: -7px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.lf-info-card.lfic-below::after {
  top: -7px;
  transform: translateX(-50%) rotate(45deg);
  border-left: 1px solid var(--gray-200);
  border-top: 1px solid var(--gray-200);
}

/* Lift the entire map pane above sibling overlays so its tooltip & popup
   z-indexes (set inside the leaflet stacking context) actually win against
   our absolute-positioned UI overlays (.kpi-strip, .hero-row, .active-pills). */
.map-area > #map { z-index: auto; }
.leaflet-pane.leaflet-tooltip-pane,
.leaflet-pane.leaflet-popup-pane { z-index: 1500 !important; }
.leaflet-tooltip,
.leaflet-popup { z-index: 1500 !important; }
.map-tooltip-name { font-weight: 700; color: var(--gray-800); font-size: 13px; }
.map-tooltip-stat { color: var(--gray-500); font-size: 11px; margin-top: 2px; }

/* Leaflet popup citizen voice */
.lf-popup { font-family: 'Inter', sans-serif; min-width: 240px; }
.lf-popup-eyebrow {
  font-size: 10px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .07em;
}
.lf-popup-name {
  font-size: 16px; font-weight: 700; color: var(--gray-900);
  margin-top: 2px; line-height: 1.2;
}
.lf-popup-sub { font-size: 11.5px; color: var(--gray-500); margin-top: 3px; }
.lf-popup hr { border: none; border-top: 1px solid var(--gray-100); margin: 10px 0; }

.lf-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--gray-600);
  padding: 3px 0;
}
.lf-row b { font-weight: 700; color: var(--gray-900); }

.lf-prog {
  background: var(--gray-100); height: 6px;
  border-radius: 999px; overflow: hidden;
  margin: 6px 0 8px;
}
.lf-prog-fill { height: 100%; border-radius: 999px; }

.lf-cta {
  width: 100%; margin-top: 8px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: var(--radius);
  padding: 9px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.lf-cta:hover { background: var(--blue-lt); }
.lf-cta.secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  margin-top: 6px;
}
.lf-cta.secondary:hover { background: var(--gray-50); }

/* ── RIGHT PANEL ───────────────────────────────────────── */
.right-panel {
  width: var(--right-w);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  /* Lift off the edges so it reads as a card, not a wall */
  margin: 12px 14px 12px 0;
}

.rp-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
}
.rp-tab {
  flex: 1;
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--gray-500);
  background: transparent; border: none;
  padding: 12px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.rp-tab:hover { color: var(--gray-700); }
.rp-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--white);
}
.tab-cnt {
  font-size: 10px; font-weight: 700;
  background: var(--red);
  color: var(--white);
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.rp-pane {
  flex: 1;
  overflow-y: auto;
  display: none;
}
.rp-pane.active { display: flex; flex-direction: column; }

/* Selected-feature card */
.here-card {
  border-bottom: 1px solid var(--gray-100);
  padding: 16px;
}
.hc-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--gray-500);
}
.hc-empty-glyph {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: .8;
}
.hc-empty-title {
  font-size: 13px; font-weight: 600;
  color: var(--gray-700);
}
.hc-empty-sub {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 4px;
  line-height: 1.5;
}

.hc-eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .07em;
}
.hc-eyebrow .hc-code {
  background: var(--blue);
  color: var(--white);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .04em;
}
.hc-name {
  font-size: 18px; font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.hc-sub {
  font-size: 11.5px; color: var(--gray-500);
  margin-top: 3px;
}

.hc-prog {
  margin-top: 14px;
}
.hc-prog-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--gray-600);
  margin-bottom: 4px;
}
.hc-prog-row b {
  font-size: 13px; font-weight: 700;
  color: var(--gray-900);
}
.hc-prog-track {
  height: 7px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.hc-prog-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}
.hc-prog + .hc-prog { margin-top: 10px; }

.hc-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 14px;
}
.hc-metric {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.hc-metric-val {
  font-size: 14px; font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}
.hc-metric-lbl {
  font-size: 10px; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .05em;
  margin-top: 4px;
}

.hc-actions { display: flex; gap: 6px; margin-top: 14px; }
.hc-action {
  flex: 1;
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.hc-action:hover { background: var(--gray-50); }
.hc-action.primary {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.hc-action.primary:hover { background: var(--blue-lt); }

/* What's being built — story cards */
.rp-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
  position: sticky; top: 0;
  background: var(--white);
}
.rp-section-hd h4 {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-500);
}
.rp-link {
  font-size: 11.5px; font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}
.rp-link:hover { text-decoration: underline; }

.story-list {
  display: flex; flex-direction: column;
  padding: 0 12px 16px;
  gap: 6px;
}
.story-item {
  display: flex; gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--gray-100);
  transition: all .15s;
}
.story-item:hover {
  border-color: var(--gray-200);
  background: var(--gray-50);
}
.story-img {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.story-img.warn { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.story-img.err { background: linear-gradient(135deg, #fecaca, #fca5a5); }
.story-info { flex: 1; min-width: 0; }
.story-name {
  font-size: 12.5px; font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}
.story-meta {
  font-size: 10.5px; color: var(--gray-500);
  margin-top: 2px;
  display: flex; gap: 6px;
  align-items: center;
}
.story-tag {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .03em;
}
.story-tag.warn { background: var(--amber-50); color: var(--amber); }
.story-tag.err  { background: var(--red-50); color: var(--red); }
.story-tag.ok   { background: var(--green-50); color: var(--green); }

/* ── Ranking ── */
.rank-explain {
  margin: 12px;
  padding: 10px 12px;
  background: var(--blue-50);
  border-radius: var(--radius);
  font-size: 11.5px; color: var(--gray-700);
  display: flex; gap: 8px;
  line-height: 1.4;
}
.re-glyph { font-size: 16px; flex-shrink: 0; }

.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background .12s;
}
.rank-item:hover { background: var(--gray-50); }
.rank-item.active { background: var(--blue-50); }
.rank-num {
  font-size: 12px; font-weight: 700;
  color: var(--gray-400);
  width: 18px; text-align: center;
}
.rank-num.medal {
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  color: #92400e;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-size: 12.5px; font-weight: 600;
  color: var(--gray-800);
}
.rank-meta { font-size: 10.5px; color: var(--gray-500); margin-top: 1px; }
.rank-bar {
  height: 4px; background: var(--gray-100);
  border-radius: 999px; overflow: hidden;
  margin-top: 5px;
}
.rank-fill { height: 100%; border-radius: 999px; }
.rank-pct {
  font-size: 14px; font-weight: 700;
  width: 42px; text-align: right;
  letter-spacing: -.01em;
}

/* ── Alerts ── */
.alert-list {
  padding: 10px 12px;
  display: flex; flex-direction: column;
  gap: 8px;
}
.alert-item {
  display: flex; gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border-left: 3px solid;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.alert-item:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); }
.alert-item.err  { background: var(--red-50);   border-color: var(--red); }
.alert-item.warn { background: var(--amber-50); border-color: var(--amber); }
.alert-item.ok   { background: var(--green-50); border-color: var(--green); }
.alert-item.info { background: #eff6ff;          border-color: #3b82f6; }
.alert-glyph {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.alert-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}
.alert-sub {
  font-size: 10.5px;
  color: var(--gray-600);
  margin-top: 3px;
  line-height: 1.4;
}
.alert-when {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Mobile bottom-sheet ── */
.bottom-sheet {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 600;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(15,22,38,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.bs-handle {
  width: 36px; height: 4px;
  background: var(--gray-300);
  border-radius: 999px;
  margin: 8px auto 6px;
}
.bs-tabs {
  display: flex;
  padding: 4px 8px 8px;
}
.bs-tab {
  flex: 1; font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--gray-500);
  background: transparent; border: none;
  padding: 10px 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.bs-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ── Modal ── */
.modal-scrim[hidden] { display: none !important; }
.modal-scrim {
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(15,22,38,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--white);
  border-radius: 16px;
  width: min(540px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-hd {
  padding: 18px 22px 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-eyebrow {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--blue);
}
.modal-hd h3 {
  font-size: 18px; font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
  letter-spacing: -.01em;
}
.modal-close {
  font-size: 22px; line-height: 1;
  background: var(--gray-50);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--gray-600);
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--gray-100); }
.modal-body {
  padding: 16px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-lede {
  font-size: 12.5px; color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 14px;
}
.rep-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.rep-chip {
  font-family: inherit;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all .15s;
}
.rep-chip:hover {
  border-color: var(--blue);
  background: var(--blue-50);
  color: var(--blue);
}
.rep-chip span:first-child { font-size: 22px; }

.rep-attach {
  display: flex; gap: 8px;
  margin-bottom: 12px;
}
.rep-attach-tile {
  flex: 1;
  background: var(--white);
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  font-size: 11.5px; font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
}
.rep-attach-tile:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-50);
}
.rep-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 70px;
}
.rep-textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--gray-50);
}
.modal-meta {
  font-size: 11.5px; color: var(--gray-500);
}
.modal-meta strong { color: var(--gray-800); font-weight: 600; }
.btn-primary {
  font-family: inherit;
  background: var(--blue);
  color: var(--white);
  border: none; border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-lt); }

/* ── AUDIENCE-AWARE TWEAKS ── */
body.aud-officer .rp-tabs { background: var(--blue); }
body.aud-officer .rp-tab { color: rgba(255,255,255,.7); }
body.aud-officer .rp-tab:hover { color: var(--white); }
body.aud-officer .rp-tab.active {
  color: var(--white); border-bottom-color: var(--white);
  background: rgba(255,255,255,.1);
}
body.aud-officer .gov-strip { background: var(--gray-900); }
body.aud-donor .gov-strip { background: var(--green); }
body.aud-donor .rp-tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── RESPONSIVE ────────────────────────────────────────── */

/* Tablet — collapse right panel; left stays */
@media (max-width: 1180px) {
  .kpi-strip { display: none; }
  :root { --right-w: 280px; }
}

@media (max-width: 980px) {
  :root { --panel-w: 240px; --right-w: 260px; }
  .gov-header { padding: 8px 12px; gap: 12px; }
  .audience-switch .aud-btn span:not(.aud-glyph) { display: none; }
  .aud-btn { padding: 6px 10px; }
  .gov-header-text h1 .en-h { display: none; }
  .btn-back { display: none; }
}

/* Mobile — stack to map fullscreen + bottom-sheet */
@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .gov-emblem { height: 40px; }
  .gov-header-text h1 { font-size: 12px; }
  .gov-header-text h2 { font-size: 10.5px; }
  .gov-header-text h2 .live-pill { display: none; }

  .left-panel {
    position: fixed;
    top: var(--header-h); left: 0; bottom: 0;
    width: 280px;
    z-index: 700;
    transform: translateX(-110%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .left-panel.open { transform: translateX(0); }
  .lp-close { display: block; }
  .hero-menu { display: flex; align-items: center; justify-content: center; }

  .right-panel { display: none; }
  .bottom-sheet { display: block; }

  .hero-search input { font-size: 12px; }
  .hero-search input::placeholder { font-size: 11.5px; }
  .hero-cta .cta-label { display: none; }
  .hero-cta { padding: 0; width: 42px; justify-content: center; }
  .hero-kbd { display: none; }

  .map-breadcrumb { bottom: 78px; }
  .map-tools { bottom: 80px; }

  /* App body: map takes remaining space, bottom sheet floats */
  .app-body { display: block; }
  .map-area { height: 100%; }
}

/* ──────────────────────────────────────────────────────────
   FILTER TOOLBAR — two horizontal rows, between red-stripe and body
   Row 1 = Quick filter chips (status + topic) + Clear-all
   Row 2 = Refinements (Budget / Progress / Delay) + Color view
   ────────────────────────────────────────────────────────── */
:root { --toolbar-h: 100px; }

.filter-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 600;
  box-shadow: 0 1px 0 rgba(15,22,38,.02);
  min-height: var(--toolbar-h);
}

.ftb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  min-height: 46px;
  flex-wrap: wrap;
  position: relative;
}
.ftb-row + .ftb-row {
  border-top: 1px solid var(--gray-100);
  background:
    linear-gradient(180deg, var(--gray-50) 0%, rgba(248, 249, 251, 0.55) 100%);
}
/* Subtle Nepal-flag accent on the leading edge of row 1 — hairline only */
.ftb-row--filters::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue) 55%, var(--red) 55%, var(--red) 100%);
  opacity: .55;
}

.ftb-section {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ftb-section--ranges { gap: 6px; flex-wrap: wrap; }

.ftb-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-500);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  user-select: none;
}
.ftb-eyebrow small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
}

.ftb-divider {
  width: 1px;
  background: var(--gray-200);
  align-self: stretch;
  margin: 4px 0;
  flex-shrink: 0;
}

.ftb-spacer { flex: 1; min-width: 6px; }

.ftb-clear {
  font-family: inherit;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 11.5px; font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  align-self: center;
  flex-shrink: 0;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.ftb-clear:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-50); }
.ftb-clear-glyph { font-size: 13px; line-height: 1; }

/* Inline pip (active-count dot) sitting at the end of a chip group */
.ftb-section .fold-pip {
  background: var(--blue);
  color: var(--white);
  font-size: 9.5px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.ftb-section .fold-pip[hidden] { display: none; }

/* Status chips inline (override the 3-col grid from filters.css) */
.filter-toolbar .status-chips {
  display: flex; gap: 6px;
  grid-template-columns: none;
}
.filter-toolbar .st-chip {
  flex-direction: row;
  padding: 6px 10px 6px 8px;
  gap: 6px;
  min-height: 32px;
}
.filter-toolbar .st-chip .st-label { font-size: 11.5px; }

/* Topic chips already inline-flex — fine in toolbar */
.filter-toolbar .topic-chips { gap: 4px; }
.filter-toolbar .tp-chip {
  padding: 6px 10px 6px 8px;
  min-height: 32px;
  font-size: 11.5px;
}

/* Range fold — appears as a button in the toolbar, opens a popover below */
.ftb-fold {
  position: relative;
}
.ftb-fold > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  color: var(--gray-700);
  min-height: 32px;
  transition: all .15s;
}
.ftb-fold > summary::-webkit-details-marker { display: none; }
.ftb-fold > summary:hover { border-color: var(--gray-300); background: var(--gray-50); }
.ftb-fold[open] > summary {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-50);
}
.ftb-fold .ftb-glyph {
  font-size: 13px; line-height: 1; opacity: .85;
  flex-shrink: 0;
}
.ftb-fold .ftb-trigger-label { font-weight: 700; }
.ftb-fold .ftb-trigger-value {
  color: var(--gray-500); font-weight: 500;
  font-feature-settings: "tnum";
}
.ftb-fold[open] .ftb-trigger-value { color: var(--blue); }
.ftb-fold .ftb-trigger-pip {
  width: 6px; height: 6px;
  background: var(--blue);
  border-radius: 50%;
  margin-left: 2px;
}
.ftb-fold .ftb-caret {
  font-size: 10px; color: var(--gray-400);
  transition: transform .15s;
}
.ftb-fold[open] .ftb-caret { transform: rotate(180deg); color: var(--blue); }

.ftb-fold .ftb-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 14px 12px;
  z-index: 700;
}
.ftb-fold--right .ftb-pop { left: auto; right: 0; }
.ftb-pop-title {
  font-size: 11px; font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.005em;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.ftb-pop-title small {
  font-weight: 500;
  color: var(--gray-400);
  font-size: 10.5px;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
}

/* Color-by popover uses .layer-opt rows already styled in landing.css */
.ftb-fold--color .ftb-pop { min-width: 240px; }

/* Toolbar responsive — already two rows, just tighten gaps as we narrow */
@media (max-width: 1100px) {
  .ftb-row { gap: 10px; padding: 8px 12px; }
  .ftb-divider { display: none; }
}

@media (max-width: 760px) {
  .ftb-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 7px 12px;
    gap: 8px;
  }
  .ftb-row::-webkit-scrollbar { height: 4px; }
  .ftb-row::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }
  .filter-toolbar .ftb-eyebrow { display: none; }
  .ftb-row--filters::before { display: none; }
  :root { --toolbar-h: 88px; }
}

/* ──────────────────────────────────────────────────────────
   LOCATION CASCADE — new left panel content
   FY → Province → District → Palika
   ────────────────────────────────────────────────────────── */
.left-panel-loc {
  /* width inherited from .left-panel */
}

.locsel {
  padding: 0;
}

.locsel-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, var(--blue-50), var(--white));
  border-bottom: 1px solid var(--gray-100);
}
.lss-count {
  display: flex; align-items: baseline; gap: 4px;
  flex-shrink: 0;
}
.lss-num {
  font-size: 28px; font-weight: 800;
  color: var(--blue);
  letter-spacing: -.025em;
  line-height: 1;
  font-feature-settings: "tnum";
}
.lss-of { font-size: 11px; color: var(--gray-500); font-weight: 600; }
.lss-text { flex: 1; min-width: 0; }
.lss-title { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.lss-sub {
  font-size: 10.5px; color: var(--gray-500);
  margin-top: 2px;
  line-height: 1.35;
}

.locsel-rows {
  padding: 14px 14px 4px;
  display: flex; flex-direction: column;
  gap: 10px;
}

.locsel-row {
  display: flex; flex-direction: column;
  gap: 6px;
  position: relative;
  transition: opacity .15s;
}
.locsel-row[data-disabled="true"] {
  opacity: .55;
}

.locsel-eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gray-700);
  letter-spacing: -.005em;
  padding: 0 2px;
  cursor: pointer;
}
.locsel-row[data-disabled="true"] .locsel-eyebrow { cursor: default; }
.le-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 5px;
  font-size: 11px;
  flex-shrink: 0;
}
.locsel-row[data-state="active"] .le-icon {
  background: var(--blue);
  color: var(--white);
}
.le-en { font-size: 11.5px; color: var(--gray-900); }
.le-ne {
  font-size: 10.5px; color: var(--gray-500); font-weight: 600;
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  margin-left: 2px;
}

.locsel-pick-wrap {
  position: relative;
}
.locsel-pick {
  width: 100%;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 11px 38px 11px 14px;
  min-height: 44px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-900);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all .15s;
}
.locsel-pick:hover:not(:disabled) {
  border-color: var(--gray-300);
  background-color: var(--gray-50);
}
.locsel-pick:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,56,147,.15);
}
.locsel-pick:disabled {
  cursor: not-allowed;
  background-color: var(--gray-50);
  color: var(--gray-400);
}
.locsel-row[data-state="active"] .locsel-pick {
  border-color: var(--blue);
  background-color: var(--blue-50);
  color: var(--blue);
}

.locsel-actions {
  padding: 10px 14px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--gray-100);
  margin-top: 6px;
}
.locsel-reset {
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 11.5px; font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .15s;
}
.locsel-reset:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-50);
}
.locsel-reset[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

.locsel-help {
  font-size: 11px;
  color: var(--gray-500);
  text-decoration: none;
  font-weight: 500;
}
.locsel-help:hover { color: var(--blue); text-decoration: underline; }

/* App-body height accounts for new toolbar */
.app-body--with-toolbar {
  height: calc(100vh - var(--header-h) - var(--toolbar-h));
}

@media (max-width: 760px) {
  .locsel-rows { padding: 12px 12px 4px; gap: 8px; }
  .app-body--with-toolbar { height: calc(100vh - var(--header-h) - var(--toolbar-h)); }
}
