/* ─────────────────────────────────────────────────────────────
   TOKENS  (liquid-glass dark mode on satellite)
───────────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --fill-primary: rgba(255, 255, 255, .10);
  --fill-secondary: rgba(255, 255, 255, .06);
  --fill-tertiary: rgba(255, 255, 255, .04);
  --label-primary: rgba(255, 255, 255, .96);
  --label-secondary: rgba(255, 255, 255, .72);
  --label-tertiary: rgba(255, 255, 255, .47);
  --label-quaternary: rgba(255, 255, 255, .29);
  --sep: rgba(255, 255, 255, .12);
  --accent: #FFFFFF;
  --accent-dim: rgba(255, 255, 255, .15);
  --accent-border: rgba(255, 255, 255, .40);
  --accent-active: #FFFFFF;

  /* Spacing — 4pt grid (Apple HIG–style: 4 / 8 / 12 / 16) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --sp: var(--space-3);
  /* Safe-area insets (iOS notch). */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --stack-gap: var(--space-1);
  /* Rail layout — normalized to a 4pt rhythm */
  --panel-pad-x: var(--space-3);
  --panel-pad-y: var(--space-2);
  --stack-bubble-pad-y: var(--panel-pad-y);
  --stack-bubble-pad-x: var(--panel-pad-x);
  --inset: var(--sp);
  /* 1px border all sides → 2px vertical on .bubble (border-box min-height must include this) */
  --bubble-border-y: 2px;
  /* Pill / chip / slider track — inner row; matches KPI content band inside padded bubble */
  --module-min-h: 24px;
  --module-compact-h: calc(var(--module-min-h) - var(--space-1));
  --module-micro-h: calc(var(--module-compact-h) - var(--space-1));
  /* Pills: one height + one type size (capsule controls) */
  --pill-font-size: 8.5px;
  --pill-font-weight: 600;
  /* Min cell width: 2 columns on ~272px inner panel; lone last row stretches (1fr) */
  --pill-cell-min: 108px;
  /* Motion — slower, more physical */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-fluid: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0.2, 1);
  --dur-fast: .30s;
  --dur-med: .60s;
  --dur-slow: .90s;
  /* KPI stat tiles: fixed row height */
  --tile-row-h: calc(var(--module-min-h) + 2 * var(--stack-bubble-pad-y) + var(--bubble-border-y));
  --pill-pad-x: var(--stack-gap);
  --panel-w: 296px;
  /* Radius system: one glass corner family plus capsules */
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  /* Inner corner when nesting content (radius − content inset) */
  --radius-inner: max(4px, calc(var(--radius-lg) - var(--panel-pad-x)));
  --acc-pad-x: var(--panel-pad-x);
  --acc-pad-y: var(--panel-pad-y);
  --acc-compact-pad-x: var(--space-2);
  --acc-compact-pad-y: var(--space-1);
  --acc-micro-pad-x: var(--space-2);
  --acc-micro-pad-y: var(--space-1);
  /* Range: thin track + thumb (not full pill height) */
  --slider-track-h: 5px;
  --slider-thumb-w: 15px;
  --slider-thumb-h: 17px;
  --slider-hit-h: 24px;
  --dock-card-w: 112px;
}

/* ─────────────────────────────────────────────────────────────
   MODE (Explore vs Plan vs Aggregate)
───────────────────────────────────────────────────────────── */
body[data-mode="explore"] #block-dock { display: none !important; }
body[data-mode="explore"] #kpi-strip .stat-bubble:nth-child(3),
body[data-mode="explore"] #kpi-strip .stat-bubble:nth-child(4) { display: none !important; }
body[data-mode="explore"] .acc-section[data-acc-id="cluster"] { display: none !important; }
body[data-mode="explore"] .acc-section[data-acc-id="plan"] { display: none !important; }
body[data-mode="explore"] #plan-sidebar { display: none !important; }

/* Aggregate mode KPIs: show only block-level metrics */
body[data-mode="aggregate"] #kpi-strip .stat-bubble:nth-child(1),
body[data-mode="aggregate"] #kpi-strip .stat-bubble:nth-child(2) { display: none !important; }
body[data-mode="aggregate"] .acc-section[data-acc-id="plan"] { display: none !important; }
body[data-mode="aggregate"] #plan-sidebar { display: none !important; }

/* Plan mode: right rail; KPI strip shows total area + cluster count */
body[data-mode="plan"] #plan-sidebar { display: block; }
body[data-mode="plan"] #kpi-strip .stat-bubble:nth-child(2),
body[data-mode="plan"] #kpi-strip .stat-bubble:nth-child(4) { display: none !important; }

.mode-pill {
  position: fixed;
  left: 50%;
  top: calc(var(--sp) + var(--safe-top));
  transform: translateX(-50%);
  z-index: 5000;
  pointer-events: auto;
}

.mode-pill .mode-seg {
  width: min(280px, calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
  min-width: 220px;
  height: calc(var(--module-min-h) + 2px);
  min-height: calc(var(--module-min-h) + 2px);
  border-radius: 999px;
  padding: 2px;
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .16) 0%,
      rgba(255, 255, 255, .06) 40%,
      rgba(120, 160, 255, .035) 70%,
      rgba(255, 255, 255, .10) 100%);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  box-shadow:
    0 18px 110px rgba(0, 0, 0, .30),
    0 2px 36px rgba(0, 0, 0, .12),
    inset 0 1.2px 0 rgba(255, 255, 255, .45),
    inset 0 -1px 0 rgba(0, 0, 0, .06);
}

/* 3-state segmented control overrides (Explore/Plan/Aggregate). */
.mode-seg.glass-seg {
  width: min(280px, calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
  min-width: 220px;
  padding: 2px;
}

.mode-seg.glass-seg .glass-opt {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 0 12px;
}

/* Match padding: 2px so thirds line up; base .glass-slider used left/top 1px for 1px pad. */
.mode-seg.glass-seg .glass-slider {
  left: 2px;
  top: 2px;
  width: calc((100% - 4px) / 3);
  height: calc(100% - 4px);
}

.mode-seg.glass-seg[data-mode="explore"] .glass-slider { transform: translateX(0) scale(var(--slider-scale)); }
.mode-seg.glass-seg[data-mode="aggregate"] .glass-slider { transform: translateX(100%) scale(var(--slider-scale)); }
.mode-seg.glass-seg[data-mode="plan"] .glass-slider { transform: translateX(200%) scale(var(--slider-scale)); }

/* ─────────────────────────────────────────────────────────────
   PLAN SIDEBAR (right)
───────────────────────────────────────────────────────────── */
#plan-sidebar {
  position: absolute;
  /* Align panel to safe-area inset; horizontal padding is plain --sp (no double safe-right). */
  top: 0;
  right: var(--safe-right);
  bottom: 0;
  width: calc(var(--panel-w) + var(--sp) + var(--sp));
  padding: calc(var(--sp) + var(--safe-top)) var(--sp) calc(var(--sp) + var(--safe-bottom)) var(--sp);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 10;
  display: none; /* enabled in Plan mode */
}

.plan-sidebar-inner {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
}

/* Same scroll contract as #control-stack — no outer “tray” bubble */
#plan-sidebar #plan-program-dock.plan-control-stack {
  flex: 1;
  height: 0;
  min-height: 0;
  align-items: stretch;
}

.plan-control-stack {
  flex: 1;
  height: 0;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  scroll-snap-type: y proximity;
  padding-bottom: 2px;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}

.plan-control-stack::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#plan-program-dock > * {
  width: 100%;
  min-width: 100%;
  align-self: stretch;
}

#plan-sidebar .bubble.control-tile.plan-prog-bubble {
  padding: var(--panel-pad-y) var(--panel-pad-x);
  border-radius: var(--radius-lg);
}

.plan-prog-bubble {
  scroll-snap-align: start;
  flex-shrink: 0;
  pointer-events: auto;
  position: relative;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard);
}

.plan-prog-bubble.is-not-selected {
  opacity: 1;
  border-color: rgba(255, 255, 255, .18);
}

/* Selected grant: neutral “spotlight” — stronger separation, still no chroma */
.plan-prog-bubble.is-selected {
  z-index: 1;
  border-color: rgba(255, 255, 255, .62);
  background:
    linear-gradient(145deg,
      rgba(255, 255, 255, .24) 0%,
      rgba(255, 255, 255, .1) 45%,
      rgba(255, 255, 255, .05) 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .35),
    0 20px 56px rgba(0, 0, 0, .34),
    0 6px 22px rgba(0, 0, 0, .18),
    inset 0 2px 0 rgba(255, 255, 255, .58),
    inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.plan-prog-bubble--deadline-open:not(.is-selected) {
  border-color: rgba(100, 210, 140, .28);
}

.plan-prog-bubble--deadline-pressing:not(.is-selected) {
  border-color: rgba(255, 190, 95, .42);
  box-shadow:
    0 0 0 1px rgba(255, 200, 110, .14),
    0 10px 48px rgba(255, 160, 60, .08),
    0 14px 80px rgba(0, 0, 0, .2),
    inset 0 1.2px 0 rgba(255, 255, 255, .4);
}

/* Grant “pre-selection”: no contiguous eligible area under current filters */
.plan-prog-bubble--no-fit.is-not-selected {
  opacity: 1;
  border-color: rgba(255, 255, 255, .12);
  box-shadow:
    0 12px 54px rgba(0, 0, 0, .2),
    0 3px 18px rgba(0, 0, 0, .1),
    inset 0 1.2px 0 rgba(255, 255, 255, .32),
    inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.plan-prog-bubble--no-fit.is-not-selected .plan-prog-title,
.plan-prog-bubble--no-fit.is-not-selected .plan-prog-kicker,
.plan-prog-bubble--no-fit.is-not-selected .plan-prog-fit,
.plan-prog-bubble--no-fit.is-not-selected .plan-prog-deadline-line,
.plan-prog-bubble--no-fit.is-not-selected .plan-prog-source {
  opacity: 0.72;
}

.plan-prog-acc-select {
  text-align: left;
  padding: 0;
  border: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  pointer-events: auto;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  justify-content: center;
}

.plan-prog-acc-select:active {
  opacity: 0.92;
}

.plan-prog-headline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  width: 100%;
}

.plan-prog-head-main {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.plan-prog-head-text {
  flex: 1;
  min-width: 0;
}

.plan-prog-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.plan-prog-title {
  flex: 1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.25;
  color: var(--label-primary);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.plan-prog-info-hotspot {
  width: 14px;
  height: 14px;
  min-width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .05);
  color: var(--label-tertiary);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  transition: color var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}

.plan-prog-info-hotspot:hover {
  color: var(--label-secondary);
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .28);
}

.plan-prog-kicker {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--label-secondary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-prog-kicker-sep {
  opacity: 0.45;
  margin: 0 2px;
  font-weight: 600;
}

.plan-prog-kicker-money {
  color: var(--label-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.plan-prog-deadline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  min-width: 0;
  width: 100%;
}

.plan-prog-deadline-line {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  color: var(--label-secondary);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-prog-deadline-live {
  font-weight: 900;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}

.plan-prog-deadline-sep {
  opacity: 0.4;
  font-weight: 600;
}

.plan-prog-deadline-tail {
  font-weight: 700;
}

@keyframes plan-deadline-pulse {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.88; filter: brightness(1.08); }
}

.plan-prog-deadline-row.is-pressing .plan-prog-deadline-live {
  animation: plan-deadline-pulse 1.65s ease-in-out infinite;
}

.plan-prog-deadline-row.is-pressing .plan-prog-urgency {
  animation: plan-deadline-pulse 1.65s ease-in-out infinite;
}

.plan-prog-deadline-row.is-open .plan-prog-deadline-line {
  color: rgba(185, 245, 205, .95);
}

.plan-prog-deadline-row.is-closing .plan-prog-deadline-line {
  color: rgba(255, 220, 160, .95);
}

.plan-prog-deadline-row.is-closed .plan-prog-deadline-line {
  color: rgba(255, 190, 185, .95);
}

.plan-prog-deadline-row.is-unknown .plan-prog-deadline-line {
  color: var(--label-quaternary);
}

.plan-prog-urgency {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .06);
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, .14);
  color: var(--label-secondary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.plan-prog-urgency svg {
  width: 11px;
  height: 11px;
  display: block;
}

.plan-prog-urgency.is-open {
  background: rgba(46, 160, 67, .20);
  border-color: rgba(100, 220, 130, .32);
  color: rgba(180, 255, 200, .98);
}

.plan-prog-urgency.is-closing {
  background: rgba(210, 140, 30, .24);
  border-color: rgba(255, 200, 90, .36);
  color: rgba(255, 235, 190, .98);
}

.plan-prog-urgency.is-closed {
  background: rgba(200, 55, 55, .20);
  border-color: rgba(255, 120, 110, .32);
  color: rgba(255, 190, 185, .98);
}

.plan-prog-urgency.is-unknown {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .12);
  color: var(--label-quaternary);
}

/* ── Eligibility ring ── */
.plan-prog-ring {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 0.5px solid rgba(255,255,255,.20);
  box-shadow:
    0 0 0 0.5px rgba(0,0,0,.30),
    inset 0 0 0 0.5px rgba(255,255,255,.12);
  background: transparent;
  position: relative;
}

.plan-prog-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    conic-gradient(from -90deg,
      rgba(255,255,255,.78) 0turn var(--ring-fill, 0turn),
      rgba(255,255,255,.02) var(--ring-fill, 0turn) 1turn);
  opacity: 0.92;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  pointer-events: none;
}

.plan-prog-ring--b0 { --ring-fill: 0turn; opacity: 0.45; }
.plan-prog-ring--b1 { --ring-fill: 0.28turn; }
.plan-prog-ring--b2 { --ring-fill: 0.58turn; }
.plan-prog-ring--b3 { --ring-fill: 0.9turn; }

/* ── Fit stats row ── */
.plan-prog-fit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .02em;
  color: var(--label-tertiary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.plan-prog-fit-val {
  font-weight: 850;
  color: var(--label-secondary);
}

.plan-prog-fit-sep {
  opacity: 0.35;
}

/* ── Source link (visible on selected card) ── */
.plan-prog-source {
  display: none;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  text-decoration: none;
  margin-top: 2px;
  pointer-events: auto;
}

.plan-prog-source:hover {
  color: var(--label-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.plan-prog-bubble.is-selected .plan-prog-source {
  display: inline-block;
}

/* ── Expired toggle ── */
.plan-expired-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 10px !important;
  border: 0;
  cursor: pointer;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  background: transparent;
  transition: color var(--dur-fast) var(--ease-standard);
}

.plan-expired-toggle:hover {
  color: var(--label-secondary);
}

.plan-expired-toggle[aria-pressed="true"] {
  color: var(--label-secondary);
}

.plan-expired-toggle::before {
  content: '▸ ';
  transition: transform var(--dur-fast) ease;
  display: inline-block;
}

.plan-expired-toggle[aria-pressed="true"]::before {
  transform: rotate(90deg);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1f2e;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  color: var(--label-primary);
}

/* ─────────────────────────────────────────────────────────────
   MAP
───────────────────────────────────────────────────────────── */
#map {
  position: absolute;
  inset: 0;
}

/* MapLibre overrides */
.maplibregl-ctrl-bottom-right {
  right: var(--inset);
  bottom: var(--inset);
}

.maplibregl-ctrl-top-right {
  right: var(--sp);
  top: var(--sp);
}

.maplibregl-ctrl-attrib {
  background: rgba(0, 0, 0, .5) !important;
  color: rgba(255, 255, 255, .4) !important;
  font-size: 10px !important;
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm) !important;
}

.maplibregl-ctrl-attrib a {
  color: rgba(255, 255, 255, .5) !important;
}

.maplibregl-ctrl-group {
  background: rgba(28, 28, 30, .85) !important;
  backdrop-filter: blur(20px) !important;
  border-radius: var(--radius-md) !important;
  border: 0.5px solid rgba(255, 255, 255, .12) !important;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4) !important;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, .1) !important;
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none !important;
}

.maplibregl-ctrl-icon {
  filter: invert(1) opacity(.7);
}

.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
  filter: none;
}

/* ─────────────────────────────────────────────────────────────
   LIQUID GLASS BUBBLE — true see-through with specular highlights
───────────────────────────────────────────────────────────── */
.bubble {
  position: relative;
  width: 100%;
  overflow: visible;
  /* Ultra-thin tinted glass — satellite visible below */
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .13) 0%,
      rgba(255, 255, 255, .04) 40%,
      rgba(120, 160, 255, .03) 70%,
      rgba(255, 255, 255, .07) 100%);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, .20);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .45),
    inset 1.5px 0 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035);
  z-index: 10;
  padding: var(--panel-pad-y) var(--panel-pad-x);
  /* Avoid animating box-shadow (expensive repaint); keep motion on transform/opacity elsewhere. */
  transition: border-color var(--dur-med) ease;
  contain: paint;
}
.bubble:hover {
  border-color: rgba(255, 255, 255, .24);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .48),
    inset 1.5px 0 0 rgba(255, 255, 255, .2),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035),
    inset 0 0 80px rgba(255, 255, 255, .06);
}

/* Definitive map control removal */
.maplibregl-ctrl {
  display: none !important;
}

/* Soft diffuse glaze on the whole glass (no streak / spotlight) */
.bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 125% 110% at 50% 38%,
      rgba(255, 255, 255, .14) 0%,
      rgba(255, 255, 255, .05) 45%,
      transparent 72%);
  pointer-events: none;
  z-index: 0;
  transition: background var(--dur-med) ease, opacity var(--dur-med) ease;
}
.bubble:hover::before {
  background: radial-gradient(ellipse 135% 118% at 50% 42%,
      rgba(255, 255, 255, .17) 0%,
      rgba(255, 255, 255, .06) 48%,
      transparent 74%);
}

.bubble>* {
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────
   LEFT STACK — absolute column holding results + panel
───────────────────────────────────────────────────────────── */
#left-stack {
  position: absolute;
  top: calc(var(--sp) + var(--safe-top));
  left: calc(var(--sp) + var(--safe-left));
  bottom: calc(var(--sp) + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
  pointer-events: none; /* Let clicks pass through gaps */
  z-index: 10;
}

/* ─────────────────────────────────────────────────────────────
   BLOCK DOCK (bottom-center carousel)
───────────────────────────────────────────────────────────── */
.block-dock {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sp) + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 1002;
  width: min(460px, calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
  max-width: calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right));
  /* Frosted tray */
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .11) 0%,
      rgba(255, 255, 255, .03) 44%,
      rgba(120, 160, 255, .025) 70%,
      rgba(255, 255, 255, .055) 100%);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  box-shadow:
    0 22px 120px rgba(0,0,0,.26),
    0 2px 40px rgba(0,0,0,.12),
    inset 0 1.2px 0 rgba(255,255,255,.42),
    inset 0 -1px 0 rgba(0,0,0,.06);
  /* Make cards feel "behind" the glass */
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  filter: blur(8px);
  transition: opacity var(--dur-med) ease, filter var(--dur-med) ease, transform var(--dur-med) var(--ease-spring);
}

.block-dock::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  /* Edge glaze + subtle vignette to sell the "looking glass" */
  background:
    radial-gradient(ellipse 120% 120% at 50% 35%,
      rgba(255,255,255,.10) 0%,
      rgba(255,255,255,.04) 42%,
      transparent 72%),
    linear-gradient(to right,
      rgba(0,0,0,.18) 0%,
      transparent 14%,
      transparent 86%,
      rgba(0,0,0,.18) 100%);
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: normal;
}

.block-dock[data-visible="true"] {
  opacity: 1;
  filter: blur(0);
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.block-dock-track {
  display: flex;
  gap: var(--stack-gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px max(var(--stack-gap), calc(50% - (var(--dock-card-w) / 2)));
  scroll-padding-inline: calc(50% - (var(--dock-card-w) / 2));
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right,
    transparent 0px,
    rgba(0,0,0,1) calc(var(--stack-gap) * 2.4),
    rgba(0,0,0,1) calc(100% - (var(--stack-gap) * 2.4)),
    transparent 100%);
  mask-image: linear-gradient(to right,
    transparent 0px,
    rgba(0,0,0,1) calc(var(--stack-gap) * 2.4),
    rgba(0,0,0,1) calc(100% - (var(--stack-gap) * 2.4)),
    transparent 100%);
  position: relative;
  z-index: 2;
}
.block-dock-track::-webkit-scrollbar { width: 0; height: 0; }

.block-card {
  flex: 0 0 var(--dock-card-w);
  scroll-snap-align: center;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  gap: 2px;
  width: var(--dock-card-w);
  min-width: var(--dock-card-w);
  max-width: var(--dock-card-w);
  height: 72px;
  border-radius: 28px;
  padding: 10px 10px 9px;
  position: relative;
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast) var(--ease-standard);
}

/* Wrapper that positions the download orb outside the frosted glass container,
   so its own backdrop-filter sees the raw map background, not the parent's composed surface. */
.tt-popup-wrap {
  position: relative;
}

.tt-popup-wrap .tt-dl-bubble {
  position: absolute;
  top: 2px;
  right: -44px;
}

.tt-dl-bubble {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  color: var(--label-primary);
  cursor: pointer;
  /* Slightly stronger than panel (small bubble needs more to read as frosted) */
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .22) 0%,
      rgba(255, 255, 255, .09) 40%,
      rgba(120, 160, 255, .06) 70%,
      rgba(255, 255, 255, .14) 100%);
  backdrop-filter: blur(18px) saturate(185%);
  -webkit-backdrop-filter: blur(18px) saturate(185%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow:
    0 26px 140px rgba(0, 0, 0, .22),
    0 3px 55px rgba(0, 0, 0, .09),
    inset 0 1.4px 0 rgba(255, 255, 255, .42),
    inset 1.2px 0 0 rgba(255, 255, 255, .16),
    inset 0 -1px 0 rgba(0, 0, 0, .06),
    inset -1px 0 0 rgba(0, 0, 0, .02);
  transition: border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.tt-dl-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 35% 28%,
    rgba(255,255,255,.18) 0%,
    rgba(255,255,255,.08) 32%,
    transparent 62%);
  opacity: 0.9;
}

.tt-dl-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* inner haze to sell thicker frost */
  background: radial-gradient(circle at 50% 55%,
    rgba(255,255,255,.22) 0%,
    rgba(255,255,255,.12) 40%,
    rgba(255,255,255,.02) 70%,
    transparent 100%);
  opacity: 0.75;
}

.tt-dl-bubble svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-dl-bubble:hover {
  border-color: rgba(255, 255, 255, .20);
  transform: translateY(-0.5px);
}

.tt-dl-bubble:focus,
.tt-dl-bubble:focus-visible {
  outline: none;
}

/* Ensure bubble glaze matches the circular shape */
.tt-dl-bubble.bubble,
.tt-dl-bubble.bubble::before {
  border-radius: 999px !important;
}

.block-card .thumb {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  border: 0.5px solid rgba(255, 255, 255, .14);
  display: grid;
  place-items: center;
  overflow: visible;
  flex-shrink: 0;
}

.block-card .thumb svg {
  width: 24px;
  height: 24px;
  opacity: 0.9;
  transform: translateY(-6px);
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.22));
}

.block-card .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.14;
  min-width: 0;
  width: 100%;
  align-items: center;
  text-align: center;
}

.block-card .bid {
  font-size: 7.4px;
  font-weight: 950;
  letter-spacing: .11em;
  color: rgba(255,255,255,.72);
  text-transform: uppercase;
}

.block-card .ratio {
  font-size: 8.4px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--label-primary);
}

.block-card .sub {
  display: block;
  width: 100%;
  font-size: 7.2px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--label-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.block-card .sub.sub--muted {
  font-size: 7.0px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--label-quaternary);
  margin-top: 1px;
}

.block-card.is-active {
  border-color: rgba(255, 255, 255, .26) !important;
}

.block-card.is-selected,
.block-card.is-center {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .30) !important;
  box-shadow:
    0 14px 90px rgba(0, 0, 0, .26),
    0 2px 34px rgba(0, 0, 0, .12),
    inset 0 1.6px 0 rgba(255, 255, 255, .52),
    inset 1.6px 0 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035),
    inset 0 0 90px rgba(255, 255, 255, .06);
}

.block-card.is-selected .ratio,
.block-card.is-center .ratio { color: rgba(255,255,255,.98); }

.block-card.is-secondary:not(.is-selected) {
  opacity: .86;
}


/* ─────────────────────────────────────────────────────────────
   RESULTS BUBBLE — top of left stack
───────────────────────────────────────────────────────────── */
#kpi-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--stack-gap);
  flex-shrink: 0;
  align-items: stretch;
}

.stat-bubble {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tile-row-h);
  box-sizing: border-box;
}
.stat-bubble > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}
.stat-bubble .stat-lbl { margin-top: 2px; text-align: center; }

.stat-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -.02em;
  text-shadow:            0 0 18px rgba(255, 255, 255, .28);
  font-variant-numeric: tabular-nums;
}

.stat-unit {
  font-size: 8px;
  font-weight: 700;
  color: var(--accent);
  opacity: .8;
  margin-left: 2px;
}

.stat-lbl {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--label-quaternary);
  margin-top: 0;
}

/* ─────────────────────────────────────────────────────────────
   CONTROLS PANEL — fills remaining height in left stack
───────────────────────────────────────────────────────────── */
#control-stack {
  flex: 1;
  height: 0;
  min-height: 0;
  max-height: 100%;
  width: min(var(--panel-w), calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  align-content: start;
  gap: var(--stack-gap);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  /* Compensate for the KPI row's 1px stroke so this band reads like the same gap as the rows below. */
  margin-top: calc(var(--bubble-border-y) * -0.5);
  /* Needs to accept wheel/touch scroll when accordions grow. */
  pointer-events: auto;
}

#control-stack::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.control-tile { 
  flex-shrink: 0; 
  width: var(--panel-w);
  max-width: 100%;
  pointer-events: auto;
}

#control-stack > .control-tile {
  width: auto;
  max-width: none;
  min-width: 0;
}

#kpi-strip {
  width: var(--panel-w);
  max-width: 100%;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────
   BASEMAP TOGGLE (top-right) — liquid glass style
───────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────
   SECTION LABELS & SEPARATORS
───────────────────────────────────────────────────────────── */
.sec-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--label-quaternary);
  margin-bottom: var(--stack-gap);
  flex-shrink: 0;
}

.sec-sep {
  height: 0.5px;
  background: var(--sep);
  margin: var(--stack-gap) 0;
  flex-shrink: 0;
}

.flex-align {
  display: flex;
  align-items: center;
  gap: var(--stack-gap);
}

.vis-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--label-quaternary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--dur-fast) ease;
  width: var(--module-min-h);
  height: var(--module-min-h);
  box-sizing: border-box;
}
.vis-toggle svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.vis-toggle:hover {
  color: var(--label-quaternary);
  background: rgba(255, 255, 255, .05);
  border-radius: 100px;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .06);
}
.vis-toggle.active { color: var(--accent); }
.vis-toggle .slash { display: none; }
.vis-toggle.off .slash { display: block; }
.vis-toggle.off .eye-ball { opacity: 0.3; }

/* ─────────────────────────────────────────────────────────────
   TOP MENU + AUTH OVERLAY (v1)
───────────────────────────────────────────────────────────── */
#app-menu.app-menu {
  pointer-events: auto; /* left-stack itself has pointer-events: none */
  align-self: flex-start;
  /* override `.control-tile` width + bubble padding so we can morph into a pill */
  width: 52px;
  min-width: 52px;
  max-width: none;
  padding: 0 !important;
  border-radius: 999px;
  overflow: hidden;
  /* Remove sharp bubble border/shadow wrapper during morph */
  border: none !important;
  box-shadow: none !important;
  background: rgba(255, 255, 255, .04) !important;
  transition: width .38s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius .38s ease, box-shadow .25s ease, border-color .25s ease;
}

#app-menu.app-menu #menu-trigger {
  display: none; /* row mode: no collapse/expand trigger */
}

#app-menu.app-menu:hover {
  border-color: transparent !important;
  box-shadow: none !important;
}

#app-menu.app-menu.collapsed {
  height: 52px;
}

#app-menu.app-menu.open {
  width: var(--panel-w);
  height: 52px;
}

#app-menu.app-menu.open #menu-trigger {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .26);
  box-shadow: 0 22px 90px rgba(0,0,0,.32);
}

#app-menu.app-menu.open #menu-trigger::before {
  transform: translate(-50%, -50%) rotate(90deg);
}

#menu-trigger {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 2;
  transition: transform var(--dur-fast) ease, background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

#menu-trigger:hover {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .26);
  box-shadow: 0 14px 60px rgba(0,0,0,.25);
  transform: translateY(-1px);
}

#menu-trigger::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .78);
  transform: translate(-50%, -50%);
  box-shadow:
    0 -6px 0 rgba(255, 255, 255, .58),
    0 6px 0 rgba(255, 255, 255, .58);
}

#menu-panel {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--stack-gap);
  padding: 0 var(--stack-gap) 0 0;
  margin-left: calc(-1 * var(--stack-gap));
  opacity: 0;
  transform: translateX(-10px) scale(0.985);
  pointer-events: none;
  transition: opacity var(--dur-fast) ease, transform var(--dur-slow) var(--ease-spring);
  position: relative;
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

#app-menu.app-menu.open #menu-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

#menu-panel .menu-item {
  opacity: 0;
  transform: translateX(-10px) scale(0.98);
  filter: blur(5px);
  transition:
    opacity .26s ease,
    transform .36s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter .36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#app-menu.app-menu.open #menu-panel .menu-item {
  opacity: 1;
  transform: translateX(0) scale(1);
  filter: blur(0);
}

#app-menu.app-menu.open #menu-panel [data-menu-action="territory"] { transition-delay: .02s; }
#app-menu.app-menu.open #menu-panel [data-menu-action="login"]     { transition-delay: .06s; }
#app-menu.app-menu.open #menu-panel [data-menu-action="export"]    { transition-delay: .10s; }
#app-menu.app-menu.open #menu-panel [data-menu-action="logout"]    { transition-delay: .14s; }

.menu-item {
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: var(--label-secondary);
  border-radius: 999px;
  /* Match existing capsule/pill padding language */
  padding: 5px var(--stack-gap);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) ease;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  user-select: none;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Territory dropdown inside the menu panel
   (Use control-chip styling when present; keep legacy styles only for non-control-chip cases.) */
.territory-dropdown {
  position: absolute;
  top: 60px;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Use same inset rhythm as bubbles */
  padding: var(--panel-pad-y) var(--panel-pad-x);
  border-radius: var(--radius-inner);
  background: rgba(20, 20, 24, .88);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 22px 90px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  filter: blur(6px);
  pointer-events: none;
  transition: opacity var(--dur-fast) ease, transform var(--dur-slow) var(--ease-spring), filter var(--dur-med) ease;
}

.territory-dropdown[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  pointer-events: auto;
}

.territory-option:not(.control-chip) {
  text-align: left;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: var(--label-secondary);
  padding: 5px var(--stack-gap);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) ease;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.territory-option:not(.control-chip):hover {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .22);
  transform: translateY(-1px);
}

.territory-option:not(.control-chip)[disabled] {
  cursor: not-allowed;
  opacity: .55;
}

.menu-item:hover {
  color: var(--accent);
  border-color: rgba(255, 255, 255, .26);
  background: rgba(255, 255, 255, .10);
  box-shadow: 0 14px 60px rgba(0,0,0,.25), inset 0 0 32px rgba(255, 255, 255, .06);
  transform: translateY(-1px);
}

@keyframes liquid-pop-in {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
    filter: blur(6px);
  }
  65% {
    opacity: 1;
    transform: translateY(-0.5px) scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Accordion reveal must preserve borders (no blur). */
@keyframes liquid-acc-pop-in {
  0% {
    opacity: 0;
    transform: translateY(4px) scale(0.995);
  }
  65% {
    opacity: 1;
    transform: translateY(-0.5px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─────────────────────────────────────────────────────────────
   UTILITY ROW (v4) — same `control-chip` language
───────────────────────────────────────────────────────────── */
#menu-grid.menu-grid {
  display: grid;
  grid-template-columns: 1fr max-content max-content max-content max-content;
  gap: var(--stack-gap);
  width: var(--panel-w);
  max-width: 100%;
  pointer-events: auto;
}

.menu-tile {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.menu-tile.bubble {
  /* Make `.bubble` behave like a compact pill (same height rhythm as chips). */
  min-height: var(--module-min-h);
  height: var(--module-min-h);
  padding: 0 var(--stack-gap);
  border-radius: var(--radius-pill);
  color: var(--label-secondary);
}

.menu-tile.bubble::before {
  border-radius: var(--radius-pill);
}

/* Utility bubbles: boost frosting (same recipe, denser in small area). */
#menu-grid .menu-tile.bubble {
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .18) 0%,
      rgba(255, 255, 255, .06) 40%,
      rgba(120, 160, 255, .04) 70%,
      rgba(255, 255, 255, .10) 100%);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-color: rgba(255, 255, 255, .24);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .52),
    inset 1.5px 0 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035);
}

#menu-grid .menu-tile.bubble:hover {
  border-color: rgba(255, 255, 255, .28);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .55),
    inset 1.5px 0 0 rgba(255, 255, 255, .24),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035),
    inset 0 0 80px rgba(255, 255, 255, .07);
}

.menu-tile--wide {
  justify-content: flex-start;
}

.menu-tile--mini {
  width: auto;
  min-width: var(--module-min-h);
  padding-left: 0;
  padding-right: 0;
}

.menu-tile:focus,
.menu-tile:focus-visible {
  outline: none;
}

.menu-tile:active {
  transform: translateY(-0.5px);
}

.menu-tile[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(255, 255, 255, .3);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .56),
    inset 1.5px 0 0 rgba(255, 255, 255, .26),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035),
    inset 0 0 90px rgba(255, 255, 255, .08);
}

.menu-tile[disabled],
.menu-tile[aria-disabled="true"] {
  opacity: 0.62;
  cursor: not-allowed;
}

/* Territory is static, but should retain full frosting/opacity. */
.menu-territory.menu-tile[aria-disabled="true"] {
  opacity: 1;
  cursor: default;
  pointer-events: none;
}

.menu-tile .menu-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.menu-tile .menu-label {
  font-size: var(--pill-font-size);
  font-weight: var(--pill-font-weight);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: inherit;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icon-only mini actions (download/out) */
.menu-tile--mini .menu-icon { margin: 0 auto; }

/* Muni boundary icon semantics: show slash only when OFF. */
/* Muni boundary icon uses the same `vis-toggle` semantics (active/off). */

/* Full screen blocker */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50000;
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  pointer-events: none;
  transition: opacity var(--dur-fast) ease, transform var(--dur-slow) var(--ease-spring);
  background:
    radial-gradient(circle at 18% 16%, rgba(120, 160, 255, .20) 0%, transparent 46%),
    radial-gradient(circle at 78% 28%, rgba(255, 255, 255, .10) 0%, transparent 50%),
    rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp);
  pointer-events: none;
}

.auth-overlay[data-visible="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.auth-modal {
  width: min(390px, calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
}

.auth-head {
  margin-bottom: var(--stack-gap);
}

.auth-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .82);
  margin-bottom: 8px;
}

.auth-note {
  margin-top: var(--stack-gap);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--label-quaternary);
}

.auth-subtitle {
  margin-top: 6px;
  font-size: 9px;
  color: var(--label-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
}

.auth-form {
  /* Keep the form compact and aligned with the existing bubble rhythm */
  width: min(var(--panel-w), calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
}

/* Auth orb — “magical” 3D glass object */
.auth-orb-wrap {
  width: 100%;
  display: grid;
  place-items: center;
  margin-bottom: calc(var(--stack-gap) * 2.5);
  pointer-events: none;
}

/* (No WebGL orb; lens-only CSS) */

.auth-orb {
  width: 124px;
  height: 124px;
  position: relative;
  perspective: 900px;
  transform-style: preserve-3d;
  animation: auth-orb-float 4.2s ease-in-out infinite;
  filter: drop-shadow(0 24px 70px rgba(0, 0, 0, .38));
}

.auth-orb-rot {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  /* True micro 3D wobble (very low limits) */
  transform:
    translateZ(0)
    rotateX(var(--wx, 0deg))
    rotateY(var(--wy, 0deg))
    rotateZ(calc(var(--wy, 0deg) * 0.06));
}

.auth-orb-core {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  /* Convex lens: specular hotspot follows cursor; no lines, no globe cues. */
  background:
    radial-gradient(circle at var(--lx, 50%) var(--ly, 35%),
      rgba(255,255,255,.26) 0%,
      rgba(255,255,255,.12) 18%,
      rgba(255,255,255,.05) 34%,
      transparent 62%),
    radial-gradient(circle at calc(100% - var(--lx, 50%)) calc(100% - var(--ly, 35%)),
      rgba(120,160,255,.08) 0%,
      rgba(120,160,255,.035) 30%,
      transparent 66%),
    radial-gradient(circle at 50% 60%,
      rgba(255,255,255,.10) 0%,
      rgba(255,255,255,.04) 44%,
      transparent 70%),
    linear-gradient(135deg,
      rgba(255,255,255,.13) 0%,
      rgba(255,255,255,.04) 42%,
      rgba(120,160,255,.03) 72%,
      rgba(255,255,255,.075) 100%);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow:
    0 18px 92px rgba(0,0,0,.32),
    inset 0 1.5px 0 rgba(255,255,255,.55),
    inset 0 0 70px rgba(255,255,255,.08);
  transform: translateZ(18px);
  backface-visibility: hidden;
}

.auth-orb-core {
  /* Thick-glass edge response: rim brightens when light is off-center */
  border-color: rgba(255, 255, 255, calc(0.18 + var(--ld, 0) * 0.14));
  box-shadow:
    0 18px 92px rgba(0,0,0,.32),
    inset 0 1.5px 0 rgba(255,255,255,.50),
    inset 0 0 70px rgba(255,255,255,.07),
    inset 0 0 0 1px rgba(255,255,255, calc(0.04 + var(--ld, 0) * 0.06)),
    inset 0 0 34px rgba(255,255,255, calc(0.04 + var(--ld, 0) * 0.06));
}

/* (Removed back/rim layers for lens-only look) */

.auth-orb-vignette {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  transform: translateZ(22px);
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 55%,
      transparent 52%,
      rgba(0, 0, 0, .10) 76%,
      rgba(0, 0, 0, .20) 100%),
    radial-gradient(circle at var(--lx, 50%) var(--ly, 35%),
      rgba(255,255,255,.10) 0%,
      transparent 44%);
  mix-blend-mode: multiply;
  opacity: .9;
}

.auth-orb-vignette {
  /* Rim glint follows light direction (thick glass) */
  background:
    radial-gradient(circle at 50% 55%,
      transparent 52%,
      rgba(0, 0, 0, .10) 76%,
      rgba(0, 0, 0, .20) 100%),
    radial-gradient(circle at var(--lx, 50%) var(--ly, 35%),
      rgba(255,255,255, calc(0.08 + var(--ld, 0) * 0.10)) 0%,
      transparent 44%);
}

.auth-orb-core::marker { content: ''; }

/* Cursor-driven specular highlight + reflection band (liquid-glass feel) */
.auth-orb-core .auth-orb-light,
.auth-orb-core::before,
.auth-orb-core::after {
  /* keep existing pseudo elements; additional layers below */
}

.auth-orb-core::before {
  background: radial-gradient(ellipse 120% 90% at 35% 20%,
      rgba(255,255,255,.22) 0%,
      rgba(255,255,255,.06) 42%,
      transparent 70%);
}

.auth-orb-core::after {
  background: radial-gradient(circle at 50% 60%,
      rgba(255,255,255,.10) 0%,
      rgba(255,255,255,.04) 38%,
      transparent 62%);
}

.auth-orb-core::before,
.auth-orb-core::after {
  /* add a subtle cursor-driven shift via a nested overlay using background-position vars */
}

.auth-orb-core::after {
  opacity: .75;
}

.auth-orb-core::before {
  opacity: .9;
}

.auth-orb-core::before {
  /* specular hotspot follows cursor */
  background:
    radial-gradient(circle at var(--lx, 50%) var(--ly, 35%),
      rgba(255,255,255,.22) 0%,
      rgba(255,255,255,.10) 18%,
      rgba(255,255,255,.04) 34%,
      transparent 58%),
    radial-gradient(ellipse 120% 90% at 35% 20%,
      rgba(255,255,255,.18) 0%,
      rgba(255,255,255,.05) 42%,
      transparent 70%);
}

.auth-orb-core::after {
  /* reflection band slides horizontally with cursor */
  background:
    linear-gradient(120deg,
      transparent 0%,
      rgba(255,255,255,.00) 34%,
      rgba(255,255,255,.10) 46%,
      rgba(255,255,255,.015) 58%,
      transparent 66%),
    radial-gradient(circle at 50% 60%,
      rgba(255,255,255,.08) 0%,
      rgba(255,255,255,.03) 40%,
      transparent 64%);
  background-size: 220% 220%, 100% 100%;
  background-position: calc(var(--lx, 50%) * 1) 50%, 50% 50%;
}

/* No mesh lines for lens. */

.auth-orb-core::before {
  content: '';
  position: absolute;
  inset: 10px 12px 18px 12px;
  border-radius: 999px;
  background: radial-gradient(ellipse 120% 90% at 35% 20%, rgba(255,255,255,.22) 0%, rgba(255,255,255,.06) 42%, transparent 70%);
  filter: blur(0.3px);
  opacity: .95;
}

.auth-orb-core::after {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 60%, rgba(255,255,255,.10) 0%, rgba(255,255,255,.04) 38%, transparent 62%);
  filter: blur(0.6px);
  opacity: .8;
}

/* No rings for lens. */

.auth-orb-spark {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: radial-gradient(circle at var(--lx, 65%) var(--ly, 22%), rgba(255,255,255,.42) 0%, rgba(255,255,255,.12) 14%, transparent 34%);
  transform: translateZ(24px);
  opacity: .78;
  animation: auth-orb-spark 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes auth-orb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes auth-lens-wobble {
  0%, 100% { transform: translateZ(0) rotateX(0deg) rotateY(0deg); }
  30% { transform: translateZ(0) rotateX(-0.35deg) rotateY(0.55deg); }
  70% { transform: translateZ(0) rotateX(0.4deg) rotateY(-0.5deg); }
}

.auth-orb-rot {
  /* Keep a very subtle idle wobble; mouse movement adds the real "physical" wobble */
  animation: auth-lens-wobble 7.2s ease-in-out infinite;
}

/* (No ring spin keyframes) */

@keyframes auth-orb-spark {
  0%, 100% { opacity: .72; filter: blur(0px); }
  55% { opacity: .95; filter: blur(0.4px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-orb,
  .auth-orb-spark,
  .auth-orb-rot {
    animation: none !important;
  }
}

.auth-field-bubble {
  /* Each input is a frosted capsule bubble (same language as panel pills). */
  width: 100%;
  min-height: 40px;
  height: 40px;
  border-radius: 100px;
  padding: 0 12px;
  display: flex;
  align-items: center;
}

.auth-row {
  display: flex;
  align-items: stretch;
  gap: 0; /* gap would steal width even when proceed pill is hidden */
  width: 100%;
}

.auth-field-bubble--pass {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--label-quaternary);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--label-primary);
  padding: 0;
  outline: none;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.auth-field-bubble {
  width: 100%;
}

.auth-signin-bubble {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.985);
  filter: blur(8px);
  pointer-events: none;
  /* Proceed bubble: hidden = takes no space; visible = round 40×40 */
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;

  /* Hidden state geometry (password stays full width) */
  width: 0;
  min-width: 0;
  padding: 0 !important;
  margin-left: 0;
  overflow: hidden;
  border-radius: 999px;

  transition:
    width var(--dur-slow) var(--ease-spring),
    margin-left var(--dur-slow) var(--ease-spring),
    opacity var(--dur-fast) ease,
    transform var(--dur-slow) var(--ease-spring),
    filter var(--dur-slow) var(--ease-spring),
    border-color var(--dur-fast) ease,
    background-color var(--dur-fast) ease;
}

.auth-signin-bubble[data-visible="false"] {
  /* Important: even at width:0, `.bubble` border would still reserve ~2px */
  border-width: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-input::placeholder {
  color: var(--label-quaternary);
  opacity: 1;
}

/* Unified coming-forth for auth UI */
#auth-overlay .auth-field-bubble.is-moving,
#auth-overlay .auth-signin-bubble.is-moving {
  transform: translateY(-0.5px);
  border-color: rgba(255, 255, 255, .24) !important;
  box-shadow:
    inset 0 0 38px rgba(255, 255, 255, .12),
    0 18px 80px rgba(0, 0, 0, .25) !important;
}

#auth-overlay .auth-input.is-moving { transform: none; }

/* Prevent `.bubble:hover` from creating a sharp halo in the auth overlay.
   Auth uses the diffused `bubble::before` spotlight only. */
#auth-overlay .bubble:hover {
  border-color: rgba(255, 255, 255, .20);
  box-shadow:
    0 14px 80px rgba(0, 0, 0, .26),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .45),
    inset 1.5px 0 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035);
}

.auth-primary {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .10);
  color: var(--accent);
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: transform var(--dur-fast) ease, background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.auth-primary:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .34);
  box-shadow: 0 18px 70px rgba(0,0,0,.30), inset 0 0 32px rgba(255, 255, 255, .08);
  transform: translateY(-1px);
}

.auth-error {
  min-height: 14px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 220, 220, .92);
}

.auth-signin-bubble[data-visible="true"] {
  width: 40px;
  min-width: 40px;
  padding: 0 !important;
  margin-left: var(--stack-gap);
  border-width: 1px !important;
  /* Ensure it reads as the same frosted glass as other bubbles */
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .13) 0%,
      rgba(255, 255, 255, .04) 40%,
      rgba(120, 160, 255, .03) 70%,
      rgba(255, 255, 255, .07) 100%);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);

  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  filter: blur(0);
  pointer-events: auto;
  animation:
    liquid-pop-in .62s var(--ease-spring) both,
    auth-proceed-breathe 2.8s ease-in-out infinite;
  animation-delay: 40ms;
}

/* The proceed pill is rounder than default bubbles; keep frosting geometry consistent. */
.auth-signin-bubble::before {
  border-radius: inherit;
}

.auth-signin-bubble svg {
  display: block;
  margin: 0 auto;
  stroke: var(--label-primary);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, .22));
}

.auth-signin-bubble[data-visible="true"] {
  border-style: solid;
  border-color: rgba(255, 255, 255, .22);
  box-shadow:
    0 20px 90px rgba(0,0,0,.30),
    0 2px 30px rgba(0, 0, 0, .12),
    inset 0 1.5px 0 rgba(255, 255, 255, .45),
    inset 1.5px 0 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(0, 0, 0, .08),
    inset -1px 0 0 rgba(0, 0, 0, .035),
    inset 0 0 56px rgba(255, 255, 255, .10);
}

@keyframes auth-proceed-breathe {
  0%, 100% {
    transform: translateY(0);
  }
  55% {
    transform: translateY(-0.5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-signin-bubble[data-visible="true"] {
    animation: none;
  }
}

.auth-modal {
  position: relative;
  overflow: hidden;
}

.auth-modal::before {
  content: '';
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: radial-gradient(ellipse 110% 70% at 30% 20%,
      rgba(255, 255, 255, .18) 0%,
      rgba(255, 255, 255, .06) 35%,
      transparent 70%);
  opacity: 0;
  animation: auth-glimmer 3.4s ease-in-out infinite;
  z-index: 0;
}

.auth-modal > * {
  position: relative;
  z-index: 1;
}

@keyframes auth-glimmer {
  0% { opacity: 0; transform: translateY(2px); }
  12% { opacity: 1; transform: translateY(0); }
  55% { opacity: 0.55; transform: translateY(-2px); }
  100% { opacity: 0; transform: translateY(2px); }
}

/* Regulatory tri-state — same capsule height as pills / sliders (visionOS segmented control) */
.glass-seg {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 78px;
  min-width: 78px;
  height: var(--module-min-h);
  min-height: var(--module-min-h);
  box-sizing: border-box;
  --slider-scale: 1;
  background-color: rgba(255, 255, 255, .05);
  border: 0.5px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-pill);
  padding: 1px;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
}
.glass-seg:hover {
  background-color: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 32px rgba(255, 255, 255, .08);
}

/* “Glass coming forth” while interacting */
.glass-seg.is-moving {
  --slider-scale: 1.02;
  transform: translateY(-0.5px);
  background-color: rgba(255, 255, 255, .085);
  border-color: rgba(255, 255, 255, .16);
  box-shadow:
    inset 0 0 28px rgba(255, 255, 255, .10),
    0 12px 60px rgba(0, 0, 0, .20);
}

/* Unified "coming forth" physical language for other pills/toggles/buttons */
.control-chip.is-moving,
.muni-chip.is-moving,
.soil-pill.is-moving,
.status-pill.is-moving,
.vis-toggle.is-moving,
.reg-row .info-btn.is-moving,
.official-chip-info.is-moving,
#menu-grid .menu-tile.is-moving {
  transform: translateY(-0.5px) !important;
  border-color: rgba(255, 255, 255, .16) !important;
  box-shadow:
    inset 0 0 28px rgba(255, 255, 255, .10),
    0 12px 60px rgba(0, 0, 0, .20) !important;
}

.glass-seg.is-moving .glass-slider {
  border-color: rgba(255, 255, 255, .34);
  box-shadow: 0 14px 60px rgba(0,0,0,.22), inset 0 0 28px rgba(255, 255, 255, .09);
}

.glass-opt {
  flex: 1;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  color: var(--label-tertiary);
  letter-spacing: 0.02em;
}
.glass-opt.active { color: var(--accent); }
.glass-slider {
  position: absolute;
  top: 1px;
  left: 1px;
  width: calc(33.33% - 1.67px);
  height: calc(100% - 2px);
  background: var(--accent-dim);
  border: 0.5px solid var(--accent-border);
  border-radius: var(--radius-pill);
  z-index: 1;
  transition:
    transform .2s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color .22s ease,
    box-shadow .22s ease,
    background-color .22s ease;
}
[data-mode="neutral"] .glass-slider { transform: translateX(0) scale(var(--slider-scale)); }
[data-mode="exclude"] .glass-slider { transform: translateX(100%) scale(var(--slider-scale)); }
[data-mode="only"]    .glass-slider { transform: translateX(200%) scale(var(--slider-scale)); }

/* ─────────────────────────────────────────────────────────────
   SLIDERS
───────────────────────────────────────────────────────────── */
.slider-group {
  margin-bottom: var(--stack-gap);
  flex-shrink: 0;
}

.slider-group:last-child {
  margin-bottom: 0;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
  gap: var(--space-1);
  min-width: 0;
}

.slider-header--dual .slider-value-row {
  gap: 6px;
}

.slider-dash {
  font-size: 10px;
  font-weight: 700;
  color: var(--label-quaternary);
  transform: translateY(-0.5px);
}

.slider-label {
  font-size: 10px;
  color: var(--label-secondary);
  line-height: 1.2;
}

.slider-value-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* Thin track + pill thumb — wrapper keeps tall hit band; dual sliders use custom rail/thumb visuals to avoid native rendering glitches. */
.slider-range-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--slider-hit-h);
  flex-shrink: 0;
  overflow: visible;
}

.slider-range-wrap--dual {
  position: relative;
  height: var(--slider-hit-h);
  --dual-rail-inset-px: 0px;
  --range-fill-left: 0px;
  --range-fill-width: 0px;
  --dual-thumb-min-x: 0px;
  --dual-thumb-max-x: 0px;
}

.slider-range-wrap--dual::before {
  content: "";
  position: absolute;
  left: var(--dual-rail-inset-px);
  right: var(--dual-rail-inset-px);
  top: calc((var(--slider-hit-h) - var(--slider-track-h)) / 2);
  height: var(--slider-track-h);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 0.5px solid rgba(255, 255, 255, .12);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 0;
}

.slider-range-fill {
  position: absolute;
  left: var(--range-fill-left);
  width: var(--range-fill-width);
  top: calc((var(--slider-hit-h) - var(--slider-track-h)) / 2);
  height: var(--slider-track-h);
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, .12);
  pointer-events: none;
  z-index: 1;
}

.slider-range-wrap--dual input[type=range] {
  position: absolute;
  left: calc(var(--slider-thumb-w) / 2);
  right: calc(var(--slider-thumb-w) / 2);
  top: 0;
  height: 100%;
  z-index: 3;
}

.slider-range-wrap--dual input[type=range]::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
  border: none;
}

.slider-range-wrap--dual input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--slider-thumb-w);
  height: 100%;
  margin-top: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.slider-range-wrap--dual input[type=range]::-moz-range-track {
  height: 100%;
  background: transparent;
  border: none;
}

.slider-range-wrap--dual input[type=range]::-moz-range-thumb {
  width: var(--slider-thumb-w);
  height: 100%;
  border: none;
  background: transparent;
  box-shadow: none;
}

.slider-range-wrap--dual .slider-dual-thumb {
  position: absolute;
  top: 50%;
  width: var(--slider-thumb-w);
  height: var(--slider-thumb-h);
  border-radius: 100px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .1));
  border: 0.5px solid var(--accent-border);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .38);
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  pointer-events: none;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
}

.slider-range-wrap--dual .slider-dual-thumb--min {
  left: var(--dual-thumb-min-x);
  z-index: var(--dual-thumb-min-z, 3);
}

.slider-range-wrap--dual .slider-dual-thumb--max {
  left: var(--dual-thumb-max-x);
  z-index: var(--dual-thumb-max-z, 4);
}

.slider-range-wrap--dual.is-moving-min .slider-dual-thumb--min,
.slider-range-wrap--dual.is-moving-max .slider-dual-thumb--max {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, .30),
    inset 0 1px 0 rgba(255, 255, 255, .40);
}

.slider-range-wrap input[type=range] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--slider-track-h);
  min-height: var(--slider-track-h);
  margin: 0;
  padding: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
  display: block;
  vertical-align: middle;
  box-sizing: border-box;
}

.slider-range-wrap input[type=range]::-webkit-slider-runnable-track {
  height: var(--slider-track-h);
  border-radius: 100px;
  background: rgba(255, 255, 255, .08);
  border: 0.5px solid rgba(255, 255, 255, .12);
  box-sizing: border-box;
}

/* Center thumb on the track (input box height === track height) */
.slider-range-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--slider-thumb-w);
  height: var(--slider-thumb-h);
  border-radius: 100px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .1));
  border: 0.5px solid var(--accent-border);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .38);
  cursor: pointer;
  margin-top: calc((var(--slider-track-h) - var(--slider-thumb-h)) / 2);
  box-sizing: border-box;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
}

/* Thumb-only “coming forth” while dragging (best-effort). */
.slider-range-wrap input[type=range].is-moving::-webkit-slider-thumb {
  transform: scale(1.05);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, .30),
    inset 0 1px 0 rgba(255, 255, 255, .40);
}

.slider-range-wrap input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .14));
  border-color: var(--accent-active);
}

.slider-range-wrap input[type=range]::-moz-range-track {
  height: var(--slider-track-h);
  border-radius: 100px;
  background: rgba(255, 255, 255, .08);
  border: 0.5px solid rgba(255, 255, 255, .12);
  box-sizing: border-box;
}

.slider-range-wrap input[type=range]::-moz-range-thumb {
  width: var(--slider-thumb-w);
  height: var(--slider-thumb-h);
  border-radius: 100px;
  border: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .1));
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .38),
    0 0 0 0.5px var(--accent-border);
  cursor: pointer;
  box-sizing: border-box;
}

.slider-range-wrap input[type=range].is-moving::-moz-range-thumb {
  transform: scale(1.05);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, .30),
    inset 0 1px 0 rgba(255, 255, 255, .40),
    0 0 0 0.5px var(--accent-border);
}

/* Dual slider keeps the native inputs only as drag hit targets.
   These overrides must come after the generic range skin so the browser
   does not paint duplicate rails/thumbs on top of the custom visuals. */
.slider-range-wrap.slider-range-wrap--dual input[type=range] {
  left: calc(var(--slider-thumb-w) / 2) !important;
  right: calc(var(--slider-thumb-w) / 2) !important;
  top: 0 !important;
  width: auto !important;
  height: 100% !important;
  min-height: 100% !important;
}

.slider-range-wrap.slider-range-wrap--dual input[type=range]::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.slider-range-wrap.slider-range-wrap--dual input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--slider-thumb-w);
  height: 100%;
  margin-top: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.slider-range-wrap.slider-range-wrap--dual input[type=range]::-moz-range-track {
  height: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.slider-range-wrap.slider-range-wrap--dual input[type=range]::-moz-range-thumb {
  width: var(--slider-thumb-w);
  height: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.slider-num {
  width: 44px;
  height: var(--module-min-h);
  box-sizing: border-box;
  background: rgba(255, 255, 255, .08);
  border: 0.5px solid rgba(255, 255, 255, .18);
  border-radius: 100px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0 8px;
  line-height: calc(var(--module-min-h) - 2px);
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.slider-num::-webkit-inner-spin-button,
.slider-num::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.slider-num:focus {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.slider-unit {
  font-size: 9px;
  font-weight: 500;
  color: var(--label-quaternary);
  width: 15px; /* Fixed width for alignment */
  text-align: left;
}

/* ─────────────────────────────────────────────────────────────
   SOIL PILLS — equal-width grid (same cell size per row)
───────────────────────────────────────────────────────────── */
.soil-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1);
  align-items: stretch;
  flex-shrink: 0;
}

.soil-pill.all-btn {
  grid-column: 1 / -1;
  border-radius: var(--radius-pill);
}

.soil-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  width: 100%;
  min-width: 0;
  min-height: calc(var(--module-micro-h) + (2 * var(--space-1)));
  box-sizing: border-box;
  border-radius: var(--radius-md);
  font-size: 7.75px;
  font-weight: 700;
  letter-spacing: .02em;
  background-color: rgba(255, 255, 255, .07);
  border: 0.5px solid rgba(255, 255, 255, .12);
  color: var(--label-secondary);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.1;
  text-align: left;
  padding: 0 var(--space-2);
  appearance: none;
  -webkit-appearance: none;
}

.soil-pill.on {
  background-color: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.soil-pill:focus,
.soil-pill:focus-visible {
  outline: none;
  box-shadow: inset 0 0 32px rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
}

.soil-pill.on:focus-visible {
  box-shadow: inset 0 0 28px rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .42);
}

.soil-pill:disabled {
  opacity: 0.42;
  pointer-events: none;
}

.soil-pill-main {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.soil-pill-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Accordion — one gap between title and body (no stacked pad + pad) */
.acc-section {
  overflow: visible;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  order: var(--tool-order, 0);
  min-width: 0;
  grid-column: 1 / -1;
  padding: var(--acc-pad-y) var(--acc-pad-x);
  border-radius: var(--radius-lg);
  transition:
    border-color .2s var(--ease-standard),
    box-shadow .2s var(--ease-standard);
}
.acc-section.acc-priority {
  grid-column: 1 / -1;
  padding: var(--acc-pad-y) var(--acc-pad-x);
  border-radius: var(--radius-lg);
}
.acc-section.acc-compact {
  grid-column: span 1;
  padding: var(--acc-compact-pad-y) var(--acc-compact-pad-x);
  border-radius: var(--radius-pill);
}
.acc-section.acc-micro {
  padding: var(--acc-micro-pad-y) var(--acc-micro-pad-x);
  border-radius: var(--radius-pill);
}
.acc-section.acc-tail-full {
  grid-column: 1 / -1;
}
.acc-section.expanded {
  grid-column: 1 / -1;
  gap: var(--stack-gap);
  padding: var(--acc-pad-y) var(--acc-pad-x);
  border-radius: var(--radius-lg);
}
.acc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--stack-gap);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  border-bottom: 0.5px solid transparent;
  min-width: 0;
  min-height: var(--module-min-h);
  transition: none;
}

.acc-head-actions {
  display: flex;
  align-items: center;
  gap: calc(var(--stack-gap) * 0.65);
  flex-shrink: 0;
}

.acc-reset {
  width: var(--module-min-h);
  height: var(--module-min-h);
  min-width: var(--module-min-h);
  padding: 0;
  border: none;
  background: transparent;
  margin: 0;
  display: none; /* critical: don't steal header width when collapsed */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: pointer;
  color: var(--label-secondary);
  align-items: center;
  justify-content: center;
  transition: opacity var(--dur-fast) ease, color var(--dur-fast) ease;
}

.acc-section.expanded .acc-reset {
  display: flex;
  opacity: 0.28;
  visibility: visible;
  pointer-events: auto;
}

.acc-reset:hover {
  opacity: 0.55;
  color: var(--label-primary);
}

.acc-reset:focus,
.acc-reset:focus-visible {
  outline: none;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .06);
  border-radius: 999px;
}

.acc-reset svg {
  width: 13px;
  height: 13px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* No accordion container deformation: motion belongs to the control being moved. */
.acc-section.expanded .acc-head {
  border-bottom-color: rgba(255, 255, 255, .1);
  padding-bottom: 0;
  margin-bottom: 0;
}
.acc-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--label-quaternary);
  flex: 1;
  min-width: 0;
  transition: opacity .18s ease;
}
.acc-chev {
  font-size: 10px;
  color: var(--label-tertiary);
  transition: transform .22s var(--ease-fluid), opacity .18s ease;
  flex-shrink: 0;
}
.acc-section.expanded .acc-chev { transform: rotate(180deg); }
.acc-body {
  /* Collapsible tray animation: keep element in flow but clamp height. */
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-2px);
  transition:
    max-height .28s var(--ease-fluid),
    opacity .16s ease,
    transform .28s var(--ease-fluid);
  contain: layout paint;
}

.acc-section.acc-animating .acc-body {
  will-change: max-height;
}
.acc-section.expanded .acc-body {
  padding-top: 0;
  padding-bottom: var(--space-1);
  max-height: var(--acc-max-h, 9999px);
  border-radius: var(--radius-inner);
  overflow: visible;
  opacity: 1;
  transform: translateY(0);
}
.acc-section:not(.expanded) .acc-head {
  padding-bottom: 0;
}

.acc-section:not(.expanded) .acc-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-section.acc-compact .acc-head {
  min-height: var(--module-compact-h);
}

.acc-section.acc-compact .acc-title {
  font-size: 7.5px;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-section.acc-micro .acc-head {
  min-height: var(--module-micro-h);
  gap: var(--space-1);
}

.acc-section.acc-micro .acc-title {
  font-size: 7px;
  letter-spacing: .09em;
}

.acc-section:not(.expanded) .acc-chev {
  opacity: 0.68;
}

.acc-section.acc-compact .acc-head-actions {
  gap: 3px;
}

.acc-section.acc-micro .acc-head-actions {
  gap: 2px;
}

.acc-section.acc-micro .acc-chev {
  font-size: 9px;
  opacity: 0.56;
}

.acc-section.acc-compact .acc-reset {
  display: none !important;
  pointer-events: none !important;
}

.reg-hint {
  font-size: 8.5px;
  line-height: 1.35;
  color: var(--label-quaternary);
  margin: 0 0 var(--stack-gap);
  flex-shrink: 0;
}

.regulatory-flat-cloud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}

.regulatory-flat-chip {
  min-width: 0;
  flex: initial;
  border-color: rgba(255, 255, 255, .2);
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .13) 0%,
      rgba(255, 255, 255, .07) 48%,
      rgba(255, 255, 255, .1) 100%);
}

.regulatory-flat-chip.expanded {
  grid-column: 1 / -1;
}

.regulatory-flat-chip .official-chip-top {
  padding: 3px 5px;
  gap: 4px;
}

.regulatory-flat-chip .official-chip-summary {
  min-height: calc(var(--module-micro-h) + 1px);
  gap: 4px;
}

.regulatory-flat-chip .official-chip-main {
  gap: 5px;
}

.regulatory-flat-chip .official-chip-swatch {
  width: 7px;
  height: 7px;
  min-width: 7px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .24);
}

.regulatory-flat-chip .official-chip-label {
  font-size: 7px;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  color: rgba(255, 255, 255, .94);
}

.regulatory-flat-chip .official-chip-count {
  min-width: 16px;
  height: calc(var(--module-micro-h) - 3px);
  padding: 0 3px;
  font-size: 6.2px;
  line-height: calc(var(--module-micro-h) - 4px);
  color: rgba(255, 255, 255, .84);
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
}

.regulatory-flat-chip:not(.expanded) .official-chip-count {
  display: none;
}

.regulatory-flat-chip .official-chip-inline-actions {
  gap: 2px;
}

.regulatory-flat-chip:not(.expanded) .official-chip-top .vis-toggle {
  width: calc(var(--module-micro-h) - 1px);
  height: calc(var(--module-micro-h) - 1px);
  min-width: calc(var(--module-micro-h) - 1px);
}

.regulatory-flat-chip:not(.expanded) .official-chip-top .vis-toggle svg {
  width: 12px;
  height: 12px;
}

.regulatory-flat-chip.expanded .official-chip-top {
  padding: 4px 6px;
}

.regulatory-flat-chip.expanded .official-chip-label {
  font-size: 7.6px;
  line-height: 1.12;
  color: rgba(255, 255, 255, .96);
}

.regulatory-flat-chip .official-chip-controls {
  min-width: 74px;
}

.regulatory-flat-chip .glass-seg {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}

.regulatory-flat-chip .glass-opt {
  font-size: 7px;
}

/* (Block stats UI removed: on-click only) */

/* Modular pill — same capsule height + weight as data pills; equal share in muni row */
.control-chip {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--module-min-h);
  height: var(--module-min-h);
  box-sizing: border-box;
  padding: 0 var(--stack-gap);
  border: 0.5px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, .06);
  color: var(--label-tertiary);
  font-size: var(--pill-font-size);
  font-weight: var(--pill-font-weight);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.control-chip.on {
  background-color: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}
.control-chip:not(.on):hover {
  background-color: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .17);
  box-shadow: inset 0 0 32px rgba(255, 255, 255, .08);
}
.control-chip.on:hover {
  background-color: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .45);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, .1);
}

/* Remove default "sharp white" focus ring; keep only diffused inset glow */
.control-chip:focus,
.control-chip:focus-visible {
  outline: none;
  box-shadow: inset 0 0 32px rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .17);
}

.control-chip.on:focus-visible {
  box-shadow: inset 0 0 28px rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .45);
}

/* Soil / status pills: uniform diffuse lift on hover — no text color change */
.soil-pill:hover,
.status-pill:hover {
  box-shadow: inset 0 0 32px rgba(255, 255, 255, .09);
}
.soil-pill:not(.on):hover,
.status-pill:not(.on):hover {
  background-color: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .16);
}
.soil-pill.on:hover,
.status-pill.on:hover {
  box-shadow: inset 0 0 28px rgba(255, 255, 255, .12);
}

.reg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--stack-gap);
  min-width: 0;
  margin-bottom: var(--stack-gap);
  min-height: var(--module-min-h);
}
.reg-row:last-child { margin-bottom: 0; }
.reg-row-label-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.reg-row .reg-label {
  flex: 1;
  min-width: 0;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--label-secondary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reg-actions {
  display: flex;
  align-items: center;
  gap: var(--stack-gap);
  flex-shrink: 0;
}

.reg-row .info-btn,
.official-chip-info {
  width: var(--module-min-h);
  height: var(--module-min-h);
  min-width: var(--module-min-h);
  padding: 0;
  border: none;
  background: transparent;
  margin: 0;
  opacity: 0.45;
  cursor: help;
  color: var(--label-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
  border-radius: var(--radius-sm);
}
.reg-row .info-btn:hover,
.official-chip-info:hover {
  opacity: 1;
  color: var(--label-secondary);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .06);
}
.reg-row .info-btn:focus-visible,
.official-chip-info:focus-visible {
  outline: none;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .06);
}

.official-overlay-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-1) * 0.75);
  align-items: flex-start;
  overflow: visible;
}

.official-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 calc(50% - (var(--space-1) * 0.375));
  min-width: 0;
  max-width: 100%;
  padding: 0;
  overflow: visible;
  border-radius: var(--radius-sm);
  border: 0.5px solid rgba(255, 255, 255, .14);
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .08) 0%,
      rgba(255, 255, 255, .04) 45%,
      rgba(255, 255, 255, .06) 100%);
  transition:
    border-color .2s var(--ease-standard),
    background-color .2s var(--ease-standard),
    box-shadow .2s var(--ease-standard),
    transform .18s var(--ease-standard);
}

.official-chip:hover {
  border-color: rgba(255, 255, 255, .18);
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .11) 0%,
      rgba(255, 255, 255, .05) 46%,
      rgba(255, 255, 255, .07) 100%);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, .06);
}

.official-chip.expanded {
  flex-basis: 100%;
  border-radius: var(--radius-md);
  border-color: rgba(255, 255, 255, .28);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, .14),
    inset 0 0 22px rgba(255, 255, 255, .08);
}

.official-chip.is-active {
  border-color: rgba(255, 255, 255, .34);
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .14) 0%,
      rgba(255, 255, 255, .09) 55%,
      rgba(255, 255, 255, .08) 100%);
}

.official-chip.is-visible:not(.is-active) {
  border-color: rgba(255, 255, 255, .24);
}

.official-chip.is-locked {
  opacity: 0.82;
}

.official-chip-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
  min-height: calc(var(--module-micro-h) + var(--space-1));
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.official-chip-summary:focus,
.official-chip-summary:focus-visible {
  outline: none;
}

.official-chip.expanded .official-chip-summary {
  min-height: var(--module-min-h);
}

.official-chip-main {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  flex: 1;
}

.official-chip-swatch {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 999px;
  background: var(--overlay-chip-accent, rgba(255, 255, 255, .4));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16);
}

.official-chip-copy {
  display: block;
  min-width: 0;
  flex: 1;
}

.official-chip-label {
  display: block;
  font-size: 7.2px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--label-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.official-chip-summary-line {
  font-size: 7px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--label-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.official-chip-count,
.soil-pill-count {
  flex-shrink: 0;
  padding: 0 5px;
  min-width: 20px;
  height: calc(var(--module-micro-h) - 1px);
  border-radius: var(--radius-pill);
  border: 0.5px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: var(--label-tertiary);
  font-size: 6.5px;
  font-weight: 800;
  line-height: calc(var(--module-micro-h) - 2px);
  text-align: center;
}

.official-chip-top {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 6px;
  min-width: 0;
}

.official-chip-top .vis-toggle {
  margin-left: auto;
  width: var(--module-micro-h);
  height: var(--module-micro-h);
  min-width: var(--module-micro-h);
}

.official-chip-top .vis-toggle svg {
  width: 13px;
  height: 13px;
}

.official-chip-inline-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 0;
}

.official-chip:not(.expanded) .official-chip-info,
.official-chip:not(.expanded) .official-chip-controls {
  display: none;
}

.official-chip.expanded .official-chip-top {
  padding: 4px 6px;
}

.official-chip-controls {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  min-width: 78px;
}

.official-chip .glass-seg {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  height: var(--module-min-h);
  min-height: var(--module-min-h);
}

.official-chip .glass-opt {
  font-size: 7.5px;
  letter-spacing: .02em;
}

.official-chip .glass-slider {
  height: calc(100% - 2px);
}

.official-chip.expanded .official-chip-top .vis-toggle,
.official-chip.expanded .official-chip-info {
  width: var(--module-min-h);
  height: var(--module-min-h);
  min-width: var(--module-min-h);
}

.official-chip.expanded .official-chip-top .vis-toggle svg,
.official-chip.expanded .official-chip-info svg {
  width: 15px;
  height: 15px;
}

.official-chip.is-locked .glass-seg {
  opacity: 0.7;
}

/* Muni chips + optional full-width boundary toggle */
/* Municipality accordion list: uses the same `reg-row` spacing rhythm. */
.muni-list {
  display: flex;
  flex-direction: column;
  gap: 0; /* reg-row already owns vertical rhythm */
}
.muni-chip {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────────────────────────────────────────────────────
   STATUS CHECKS
───────────────────────────────────────────────────────────── */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 0px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   STATUS PILLS — same grid as soils (identical cell geometry)
───────────────────────────────────────────────────────────── */
.status-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--pill-cell-min)), 1fr));
  gap: var(--stack-gap);
  align-items: stretch;
  margin-bottom: 0;
}

.status-pill.all-btn {
  grid-column: 1 / -1;
}

.status-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: var(--module-min-h);
  box-sizing: border-box;
  border-radius: 100px;
  font-size: var(--pill-font-size);
  font-weight: var(--pill-font-weight);
  background-color: rgba(255, 255, 255, .06);
  border: 0.5px solid rgba(255, 255, 255, .12);
  color: var(--label-tertiary);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  hyphens: auto;
  padding: 5px var(--stack-gap);
}

.status-pill.on {
  background-color: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Status-specific overrides for coloring — SEMANTIC, LIGHT & DISTINCT palette */
.status-pill.on[data-status="Abandoned"] { color: #EF9A9A; background-color: rgba(239, 154, 154, .15); border-color: rgba(239, 154, 154, .5); }
.status-pill.on[data-status="Arable"] { color: #FFF59D; background-color: rgba(255, 245, 157, .15); border-color: rgba(255, 245, 157, .5); }
.status-pill.on[data-status="Forest"] { color: #C5E1A5; background-color: rgba(197, 225, 165, .15); border-color: rgba(197, 225, 165, .5); }
.status-pill.on[data-status="Encroached"] { color: #FFCC80; background-color: rgba(255, 204, 128, .15); border-color: rgba(255, 204, 128, .5); }
.status-pill.on[data-status="Managed"] { color: #80CBC4; background-color: rgba(128, 203, 196, .15); border-color: rgba(128, 203, 196, .5); }
.status-pill.on[data-status="Water"] { color: #90CAF9; background-color: rgba(144, 202, 249, .15); border-color: rgba(144, 202, 249, .5); }
.status-pill.on[data-status="Planted Groves & Net Semi Natural"] { color: #CE93D8; background-color: rgba(206, 147, 216, .15); border-color: rgba(206, 147, 216, .5); }
.status-pill.on[data-status="Uncertain"] { color: #CFD8DC; background-color: rgba(207, 216, 220, .15); border-color: rgba(207, 216, 220, .5); }

/* Neutral style for "All Parcels" button when active — now matching map accent */
.status-pill.on.all-btn {
  color: var(--accent);
  background-color: var(--accent-dim);
  border-color: var(--accent-border);
}

/* Standard transparent style used for all-btn */

/* Reset Button Removed */

/* ─────────────────────────────────────────────────────────────
   KPI
───────────────────────────────────────────────────────────── */
/* KPI grid & card removed in favor of top-level stat-bubbles */

/* ─────────────────────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────────────────────── */
.empty {
  background: rgba(255, 255, 255, .06);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  text-align: center;
  color: var(--label-quaternary);
  font-size: 11px;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   LOADING
───────────────────────────────────────────────────────────── */
#loading {
  position: absolute;
  inset: 0;
  background: #101520;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity .4s;
}

#loading.gone {
  opacity: 0;
  pointer-events: none;
}

.ld-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}

.ld-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .2;
  animation: pulse 1.4s ease-in-out infinite;
}

.ld-dot:nth-child(2) {
  animation-delay: .2s;
}

.ld-dot:nth-child(3) {
  animation-delay: .4s;
}

@keyframes pulse {

  0%,
  80%,
  100% {
    opacity: .15;
    transform: scale(.9);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.ld-text {
  font-size: 12px;
  color: rgba(255, 255, 255, .4);
  letter-spacing: .04em;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────
   MAP POPUP — same liquid-glass module as .bubble
───────────────────────────────────────────────────────────── */
.maplibregl-popup {
  max-width: 268px !important;
  overflow: visible !important;
}

.maplibregl-popup-content {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  color: var(--label-primary) !important;
  overflow: visible !important;
}

.maplibregl-popup-tip {
  display: none !important;
}

.map-popup-glass {
  position: relative;
  overflow: visible;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, .13) 0%,
      rgba(255, 255, 255, .04) 40%,
      rgba(120, 160, 255, .03) 70%,
      rgba(255, 255, 255, .07) 100%);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  /* Softer edge + more diffuse shadow on the map popup */
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow:
    0 26px 140px rgba(0, 0, 0, .22),
    0 3px 55px rgba(0, 0, 0, .09),
    inset 0 1.2px 0 rgba(255, 255, 255, .36),
    inset 1.1px 0 0 rgba(255, 255, 255, .14),
    inset 0 -1px 0 rgba(0, 0, 0, .06),
    inset -1px 0 0 rgba(0, 0, 0, .02);
  padding: var(--panel-pad-y) var(--panel-pad-x);
  /* Keep popups responsive: avoid animating box-shadow (paint heavy). */
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.map-popup-glass:hover {
  border-color: rgba(255, 255, 255, .20);
  box-shadow:
    0 26px 140px rgba(0, 0, 0, .22),
    0 3px 55px rgba(0, 0, 0, .09),
    inset 0 1.2px 0 rgba(255, 255, 255, .42),
    inset 1.1px 0 0 rgba(255, 255, 255, .16),
    inset 0 -1px 0 rgba(0, 0, 0, .07),
    inset -1px 0 0 rgba(0, 0, 0, .02),
    inset 0 0 100px rgba(255, 255, 255, .05);
}

.map-popup-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 140% 125% at 50% 38%,
      rgba(255, 255, 255, .11) 0%,
      rgba(255, 255, 255, .035) 45%,
      transparent 72%);
  pointer-events: none;
  z-index: 0;
  transition: background var(--dur-fast) var(--ease-standard);
}
.map-popup-glass:hover::before {
  background: radial-gradient(ellipse 150% 135% at 50% 42%,
      rgba(255, 255, 255, .14) 0%,
      rgba(255, 255, 255, .045) 48%,
      transparent 74%);
}

.map-popup-glass > * {
  position: relative;
  z-index: 1;
}

/* Regulatory (i) hover — same skin as .map-popup-glass; rules after base so position:fixed wins */
#reg-info-tip.map-popup-glass,
#grant-info-tip.map-popup-glass {
  position: fixed;
  z-index: 50000;
  width: min(288px, calc(100vw - 2 * var(--sp) - var(--safe-left) - var(--safe-right)));
  max-height: min(320px, calc(100vh - 2 * var(--sp) - var(--safe-top) - var(--safe-bottom)));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
  font-size: 10.5px;
  line-height: 1.42;
  color: var(--label-secondary);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s;
}
#reg-info-tip.map-popup-glass.visible,
#grant-info-tip.map-popup-glass.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
#reg-info-tip.map-popup-glass .info-title,
#grant-info-tip.map-popup-glass .info-title {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.05em;
  margin-bottom: var(--stack-gap);
  color: var(--accent);
}

.reg-tip-desc {
  white-space: pre-line;
  margin: 0;
}
.reg-tip-sources {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.14);
}
.reg-tip-sources-title {
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-secondary);
  margin-bottom: 6px;
  opacity: 0.92;
}
.reg-tip-sources-list {
  margin: 0;
  padding-left: 1.15em;
  list-style: disc;
}
.reg-tip-sources-list li {
  margin-bottom: 5px;
}
.reg-tip-sources-list li:last-child {
  margin-bottom: 0;
}
.reg-tip-sources-list a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}
.reg-tip-sources-list a:hover {
  text-decoration: underline;
}
.reg-tip-sources-list a:focus-visible {
  outline: 1px solid var(--accent-border);
  outline-offset: 2px;
  border-radius: 3px;
}

.tt-status {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: var(--stack-gap);
  letter-spacing: -.01em;
  line-height: 1.25;
}

.tt-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
}

.tt-lbl {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--label-quaternary);
  line-height: 1.55;
  font-weight: 600;
}

.tt-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--label-secondary);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.tt-val--muted {
  font-size: 10px;
  font-weight: 500;
  opacity: .85;
}

.tt-soil {
  font-size: 9px;
  color: var(--label-tertiary);
  margin-top: var(--stack-gap);
  border-top: 0.5px solid rgba(255, 255, 255, .12);
  padding-top: var(--stack-gap);
  line-height: 1.45;
}

.tt-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--stack-gap);
}

.tt-action {
  border: 0.5px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  color: var(--label-secondary);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.tt-action:hover {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .20);
  transform: translateY(-0.5px);
}

.tt-action.tt-action--icon {
  width: var(--module-min-h);
  height: var(--module-min-h);
  min-width: var(--module-min-h);
  padding: 0;
  display: grid;
  place-items: center;
}

.tt-action.tt-action--icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-refs {
  margin-top: var(--stack-gap);
  padding-top: var(--stack-gap);
  border-top: 0.5px solid rgba(255, 255, 255, .12);
}

.tt-refs-title {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--label-quaternary);
  margin-bottom: calc(var(--stack-gap) * 0.75);
}

.tt-refs-list {
  margin: 0;
  padding: 0 0 0 var(--sp);
  font-size: 8.5px;
  line-height: 1.45;
  color: var(--label-tertiary);
}

.tt-refs-list li {
  margin-bottom: calc(var(--stack-gap) * 0.5);
}

.tt-refs-list a {
  color: var(--label-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.tt-refs-list a:hover {
  color: var(--label-secondary);
}

/* ─────────────────────────────────────────────────────────────
EXPORT PILL (Top right — aligned with left stack / map insets)
───────────────────────────────────────────────────────────── */
#export-pill {
  position: absolute;
  top: var(--sp);
  right: var(--sp);
  width: auto;
  border-radius: 100px;
  padding: var(--panel-pad-y) var(--panel-pad-x);
  gap: var(--stack-gap);
  display: flex;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all var(--dur-fast) var(--ease-standard);
  z-index: 1001; /* Ensure it's on top */
}

#export-pill:hover {
  transform: none;
  border-color: rgba(255, 255, 255, .26) !important;
  box-shadow:
    0 6px 32px rgba(0, 0, 0, .30),
    0 1px 8px rgba(0, 0, 0, .15),
    inset 0 1.5px 0 rgba(255, 255, 255, .48),
    inset 1.5px 0 0 rgba(255, 255, 255, .2),
    inset 0 -1px 0 rgba(0, 0, 0, .12),
    inset -1px 0 0 rgba(0, 0, 0, .06),
    inset 0 0 72px rgba(255, 255, 255, .07) !important;
}

#export-pill:active {
  transform: translateY(0) scale(0.96);
  background: rgba(255, 255, 255, .10) !important;
}

#export-pill span {
  font-size: 11px;
  font-weight: 700;
  color: var(--label-primary);
  letter-spacing: 0.02em;
}

#export-pill svg {
  width: 14px;
  height: 14px;
  stroke: var(--label-primary);
  stroke-width: 2.5;
  fill: none;
}

/* ─────────────────────────────────────────────────────────────
/*  VISION-OS SWITCH
/* ───────────────────────────────────────────────────────────── */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  flex-shrink: 0;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  transition: var(--dur-fast) var(--ease-standard);
  border-radius: 16px;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}
.ios-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 1.5px;
  bottom: 1.5px;
  background-color: #FFF;
  transition: var(--dur-fast) var(--ease-standard);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
input:checked + .ios-slider { background-color: #FFF; }
input:checked + .ios-slider:before {
  transform: translateX(12px);
  background-color: #000;
}

/* Landscape Panel specific */
#landscape-panel { 
  padding: 0; 
  max-height: 480px;
  display: flex;
  flex-direction: column;
}
.panel-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.panel-header:hover {
  background: rgba(255, 255, 255, 0.03);
}
.panel-header .sec-lbl { margin: 0; }
#landscape-chevron {
  font-size: 14px;
  transition: transform 0.3s;
  color: var(--label-tertiary);
}
.panel-collapsed #landscape-chevron { transform: rotate(-90deg); }
.panel-collapsed { max-height: 52px !important; }

.landscape-list {
  overflow-y: auto;
  padding: 0 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: none;
}
.landscape-list::-webkit-scrollbar { display: none; }

.panel-collapsed .landscape-list { display: none; }

.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.05);
}
.layer-row:last-child { border: none; }
.layer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-right: 12px;
}
.layer-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--label-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-meta {
  font-size: 8px;
  color: var(--label-quaternary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.official-chip.is-promoted {
  flex-basis: 100%;
}
