/* LA County 311 — liquid glass + cream / light brown / white */

:root {
  --cream-0: #fdfbf7;
  --cream-1: #f5efe6;
  --cream-2: #ebe3d6;
  --brown-0: #c4a574;
  --brown-1: #8b7355;
  --brown-2: #5c4d3c;
  --white-glass: rgba(255, 252, 248, 0.42);
  --white-glass-strong: rgba(255, 252, 248, 0.62);
  --stroke: rgba(139, 115, 85, 0.22);
  --stroke-light: rgba(255, 255, 255, 0.65);
  --text: #3d3429;
  --text-muted: #6b5d4d;
  --accent: #a67c52;
  --accent-soft: rgba(166, 124, 82, 0.18);
  /* Nearly flat glass: inset highlight only — avoids huge shadows clipping at viewport edges */
  --shadow-glass:
    0 1px 0 0 rgba(255, 255, 255, 0.65) inset,
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 1px 2px rgba(22, 18, 14, 0.04);
  --shadow-glass-float:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 1px 3px rgba(22, 18, 14, 0.05);
  --glass-blur: 44px;
  --glass-blur-strong: 56px;
  --glass-sat: 1.82;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --map-inset: 12px;
  --panel-width: min(372px, 92vw);
  --header-h: 64px;
  /* Header anchor: must match .app-header { top } */
  --app-header-y: calc(var(--map-inset) + 10px);
  /* Space below header start (title + tabs row + padding) */
  --app-header-band-h: 54px;
  /* Compact bottom legend (single strip, minimal copy) */
  --map-legend-bar-h: 64px;
  --map-legend-gap-bottom: 10px;
  /* Vertical gap between map hint and top of legend strip */
  --map-hint-legend-gap: 8px;
  /* Leaflet zoom: lift above bottom-right tool stack + compact legend */
  --map-zoom-lift: 108px;
}

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

html {
  /* Reduces layout jump when scrollbars show/hide (helps width: % stay stable). */
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--cream-1);
}

/* Ambient background behind map (shows at edges on wide screens) */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(
      ellipse 120% 80% at 10% 0%,
      rgba(196, 165, 116, 0.35),
      transparent 55%
    ),
    radial-gradient(
      ellipse 90% 70% at 100% 100%,
      rgba(235, 227, 214, 0.9),
      var(--cream-1)
    );
  pointer-events: none;
}

#map {
  position: fixed;
  inset: var(--map-inset);
  z-index: 1;
  border-radius: calc(var(--radius-lg) + 4px);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 0 0 1px rgba(92, 77, 60, 0.08),
    0 1px 4px rgba(22, 18, 14, 0.04);
}

/* Leaflet tweaks for glass UI */
.leaflet-container {
  font-family: var(--font-sans);
  background: var(--cream-2);
}

/*
 * Zoom + attribution: bottom-right (clear of left rail panels).
 * Extra lift matches .map-corner-stack height so +/- doesn’t sit under the glass tool buttons.
 */
.leaflet-bottom.leaflet-right {
  bottom: calc(
    var(--map-legend-bar-h) + var(--map-legend-gap-bottom) + 8px + var(--map-zoom-lift)
  ) !important;
  right: 12px !important;
}

.leaflet-control-zoom a {
  border-radius: var(--radius-sm);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 1px 3px rgba(22, 18, 14, 0.08);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: linear-gradient(
    165deg,
    rgba(255, 253, 250, 0.9) 0%,
    rgba(255, 252, 248, 0.72) 100%
  );
  box-shadow: var(--shadow-glass-float);
  border: 1px solid rgba(255, 255, 255, 0.58);
}

.leaflet-popup-tip {
  background: linear-gradient(135deg, rgba(255, 252, 248, 0.92), rgba(248, 242, 234, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 12px rgba(28, 22, 18, 0.12);
}

.leaflet-tooltip.tract-leaflet-tooltip {
  z-index: 10000;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 253, 250, 0.96);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-glass-float);
}

/* Compact tract hover: no pointer capture; avoids stuck tooltips overlapping the map. */
.leaflet-tooltip.tract-leaflet-tooltip.tract-hover-tip {
  pointer-events: none !important;
  padding: 0;
  max-width: min(252px, calc(100vw - 24px));
  border-radius: var(--radius-sm);
  font-weight: 500;
  background: rgba(255, 253, 250, 0.96);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-glass-float);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
}

/* Liquid glass (iOS-style frost): blur + saturation + specular wash + depth */
.glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    168deg,
    rgba(255, 254, 252, 0.62) 0%,
    rgba(255, 252, 248, 0.38) 38%,
    rgba(248, 242, 234, 0.3) 72%,
    rgba(242, 234, 224, 0.26) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-glass);
  /* visible so box-shadow is not clipped (overflow:hidden cuts soft shadows) */
  overflow: visible;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  /* clip gloss to card radius only; parent .glass stays overflow:visible for shadows */
  overflow: hidden;
  background: radial-gradient(
    120% 80% at 18% 0%,
    rgba(255, 255, 255, 0.55) 0%,
    transparent 52%
  );
  opacity: 0.85;
}

.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.38) 0%,
    rgba(255, 255, 255, 0.04) 42%,
    transparent 55%,
    rgba(139, 115, 85, 0.07) 100%
  );
  mix-blend-mode: soft-light;
}

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

.glass-strong {
  background: linear-gradient(
    168deg,
    rgba(255, 254, 252, 0.72) 0%,
    rgba(255, 252, 248, 0.48) 40%,
    rgba(250, 245, 238, 0.4) 100%
  );
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.95);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.95);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-glass);
}

/* Header */
.app-header {
  position: fixed;
  top: var(--app-header-y);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem 0.55rem 1.15rem;
  min-height: 52px;
  max-width: min(1080px, calc(100vw - 2 * var(--map-inset) - 24px));
}

.app-header__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  margin-left: auto;
  justify-content: flex-end;
}

.app-header__brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.app-header__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
}

.app-header__tagline {
  display: none;
  margin: 0;
  max-width: 72vw;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(107, 93, 77, 0.88);
}

.app-header__tabs {
  position: relative;
  z-index: 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-header__tabs .tab-glider {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow:
    0 0 0 1px rgba(166, 124, 82, 0.38),
    0 1px 0 rgba(255, 255, 255, 0.72) inset,
    0 10px 24px -8px rgba(22, 18, 14, 0.14),
    0 2px 8px rgba(22, 18, 14, 0.06);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition:
    left 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    top 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    width 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.2s ease;
}

.app-header__tabs .tab-glider.tab-glider--ready {
  opacity: 1;
}

.app-header__tabs .tab {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.32s cubic-bezier(0.32, 0.72, 0, 1), background 0.22s ease;
}

.app-header__tabs .tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.38);
}

.app-header__tabs .tab[aria-selected="true"] {
  color: var(--brown-2);
  background: transparent;
  border-color: transparent;
}

.app-header__tabs .tab[aria-selected="true"]:hover {
  background: rgba(255, 255, 255, 0.2);
}

/*
 * Rails: outer .rail is overflow:visible so nothing clips card box-shadows.
 * Inner .rail__track scrolls vertically; generous horizontal padding + negative
 * margin keeps shadows inside the scroll box while visually aligning with the map.
 */
.rail {
  position: fixed;
  z-index: 15;
  width: var(--panel-width);
  overflow: visible;
  pointer-events: none;
}

.rail__track {
  box-sizing: border-box;
  max-height: calc(100vh - var(--header-h) - var(--map-inset) * 2 - 100px);
  overflow-y: auto;
  overflow-x: visible;
  padding: 36px 36px 56px;
  margin: 0 -24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.rail__track > .panel.glass,
.rail__track > .snapshot-dock.glass-strong {
  box-shadow: var(--shadow-glass);
}

.rail--left {
  left: max(10px, calc(var(--map-inset) + 10px));
  top: calc(var(--map-inset) + 56px);
  bottom: calc(var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 6px);
  display: flex;
  flex-direction: column;
  height: auto;
}

.rail--left .rail__track {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-x: visible;
  overflow-y: visible;
  padding: 8px 12px 10px;
  margin: 0 -8px;
  gap: 8px;
  scrollbar-width: none;
}

.rail--left .rail__track::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.rail--left .panel {
  padding: 10px 12px;
}

.rail--left .panel__title {
  margin-bottom: 6px;
}

.rail--left .filter-group {
  margin-bottom: 8px;
}

.rail--left .filter-label {
  margin-bottom: 4px;
  font-size: 0.68rem;
}

.rail--left .filter-hint {
  margin-bottom: 8px;
  font-size: 0.65rem;
  line-height: 1.3;
}

.rail--left .filter-hint--tight {
  margin: 0 0 10px;
}

.rail--left .panel-insight {
  margin: 0 0 6px;
  font-size: 0.65rem;
  line-height: 1.25;
  max-height: 12em;
  overflow-y: auto;
}

/* Demographics panel — simple cards, readable labels */
.rail--left .demo-panel {
  padding: 12px 11px 14px;
}

.demo-panel__intro {
  margin-bottom: 8px;
}

.rail--left .demo-panel .panel__title {
  margin-bottom: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brown-2);
}

.demo-panel__lede {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: rgba(92, 77, 60, 0.82);
}

.demo-panel__lede strong {
  color: var(--brown-2);
  font-weight: 600;
}

.demo-panel__card {
  margin-bottom: 10px;
  padding: 10px 10px 11px;
  border-radius: 12px;
  background: rgba(255, 252, 248, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.11);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.demo-panel__card:last-of-type {
  margin-bottom: 0;
}

.demo-panel__card--muted {
  background: rgba(248, 244, 238, 0.45);
  border-color: rgba(139, 115, 85, 0.08);
}

.demo-panel__field-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--brown-2);
  margin-bottom: 2px;
}

.demo-panel__field-label--muted {
  color: rgba(92, 77, 60, 0.65);
  margin-bottom: 0;
}

.demo-panel__hint {
  margin: 0 0 8px;
  font-size: 0.62rem;
  line-height: 1.35;
  color: rgba(107, 90, 72, 0.78);
}

.demo-panel__hint strong {
  font-weight: 600;
  color: rgba(72, 58, 46, 0.92);
}

.demo-panel__hint--muted {
  margin-bottom: 6px;
  color: rgba(107, 90, 72, 0.62);
}

.demo-panel__cutoff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin: 0 0 6px;
}

.demo-panel__pill {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 7px;
  border-radius: 999px;
  line-height: 1.2;
}

.demo-panel__pill--stat {
  color: rgba(55, 48, 40, 0.78);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(166, 124, 82, 0.22);
}

.demo-panel__pill--soon {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(92, 77, 60, 0.65);
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed rgba(139, 115, 85, 0.28);
}

.demo-panel__inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.demo-panel__details {
  margin: 0 0 8px;
  font-size: 0.62rem;
  color: rgba(107, 90, 72, 0.85);
}

.demo-panel__details summary {
  cursor: pointer;
  font-weight: 600;
  color: rgba(122, 99, 74, 0.95);
  list-style-position: outside;
}

.demo-panel__details summary:hover {
  color: var(--brown-2);
}

.demo-panel__details-body {
  margin: 6px 0 0;
  padding: 6px 8px;
  line-height: 1.4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(139, 115, 85, 0.1);
}

.demo-panel__chips {
  margin-top: 2px;
}

.rail--left .demo-panel__chips .chip {
  min-height: 30px;
  padding: 0.38rem 0.7rem;
  font-size: 0.68rem;
}

.rail--left .panel-insight--demo {
  margin: 0 0 10px;
  max-height: 4.5em;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 0.63rem;
  line-height: 1.35;
}

.rail--left select.glass-input--demo {
  font-size: 0.76rem;
  padding: 0.48rem 0.58rem;
  border-radius: 10px;
}

.chip--placeholder {
  opacity: 0.55;
  cursor: default;
  border-style: dashed;
}

.chip--placeholder:hover {
  transform: none;
  border-color: var(--stroke);
  background: rgba(255, 255, 255, 0.25);
}

.rail--left .range-wrap output {
  font-size: 0.65rem;
}

.rail--right {
  right: max(10px, calc(var(--map-inset) + 10px));
  top: calc(var(--map-inset) + 72px);
}

/* Top-right snapshot (first item in right rail) */
.snapshot-dock {
  padding: 12px 14px 14px;
  border-radius: var(--radius-md);
  width: 100%;
  transition: box-shadow 0.25s ease;
}

.snapshot-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.snapshot-dock.is-collapsed .snapshot-dock__head {
  margin-bottom: 0;
}

.snapshot-dock__title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.snapshot-dock__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.45);
  color: var(--brown-2);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.snapshot-dock__toggle:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(166, 124, 82, 0.35);
}

.snapshot-dock__chevron {
  display: inline-block;
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.snapshot-dock.is-collapsed .snapshot-dock__chevron {
  transform: rotate(-90deg);
}

.snapshot-dock__body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  max-height: 480px;
  opacity: 1;
}

.snapshot-dock.is-collapsed .snapshot-dock__body {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.snapshot-dock__lede {
  margin: 0 0 8px;
  padding: 7px 10px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: rgba(92, 77, 60, 0.88);
  background: rgba(255, 252, 248, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.12);
  border-radius: var(--radius-sm);
}

.snapshot-dock__lede:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.snapshot-hero-stat {
  margin: 0 0 10px;
  padding: 11px 12px 10px;
  border-radius: var(--radius-md);
  background: linear-gradient(168deg, rgba(255, 252, 248, 0.72) 0%, rgba(240, 232, 220, 0.42) 100%);
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 10px 28px -14px rgba(22, 18, 14, 0.14);
}

.snapshot-hero-stat__label {
  margin: 0 0 5px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(90, 74, 58, 0.72);
}

.snapshot-hero-stat__row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.snapshot-hero-stat__value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--brown-2);
  line-height: 1;
}

.snapshot-hero-stat__unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.snapshot-hero-stat__hint {
  margin: 6px 0 0;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-muted);
}

.snapshot-hero-stat__hint:empty {
  display: none;
  margin: 0;
}

.snapshot-hero-stat__sub {
  margin: 5px 0 0;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(92, 77, 60, 0.9);
}

.snapshot-hero-stat__sub:empty,
.snapshot-hero-stat__sub[hidden] {
  display: none;
  margin: 0;
}

.panel {
  padding: 14px 16px;
  border-radius: var(--radius-md);
}

.panel__title {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* KPI strip */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kpi {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(165deg, rgba(255, 252, 248, 0.72) 0%, rgba(245, 239, 230, 0.5) 100%);
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 10px 22px -10px rgba(22, 18, 14, 0.12);
  border-top-width: 3px;
  border-top-color: rgba(166, 124, 82, 0.55);
}

.kpi:nth-child(1) {
  border-top-color: #1d9e75;
}

.kpi:nth-child(2) {
  border-top-color: #ba7517;
}

.kpi:nth-child(3) {
  border-top-color: #d85a30;
}

.kpi:nth-child(4) {
  border-top-color: #4292c6;
}

.kpi__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--brown-2);
  line-height: 1.1;
}


/* Filters */
.filter-group {
  margin-bottom: 12px;
}

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

.filter-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.filter-hint {
  margin: 0 0 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.filter-hint code {
  font-size: 0.68rem;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--stroke);
}

select.glass-input,
input[type="range"] {
  width: 100%;
}

select.glass-input {
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-wrap output {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--brown-1);
  min-width: 2.5rem;
  text-align: right;
  font-weight: 600;
}

input[type="range"] {
  accent-color: var(--accent);
  height: 6px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 0.7rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: rgba(166, 124, 82, 0.4);
  color: var(--brown-2);
}

.chips--dense {
  gap: 5px;
}

.chips--dense .chip {
  font-size: 0.65rem;
  padding: 0.3rem 0.5rem;
}

/* Overlay mode — segmented radios */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented__opt {
  position: relative;
  cursor: pointer;
  margin: 0;
}

.segmented__opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.segmented__opt span {
  display: block;
  padding: 0.38rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.segmented__opt:hover span {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.segmented__opt input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented__opt input:checked + span {
  background: var(--accent-soft);
  border-color: rgba(166, 124, 82, 0.45);
  color: var(--brown-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.check-glass {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.check-glass input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Collapsible */
details.glass-details {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
}

details.glass-details summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.glass-details summary::-webkit-details-marker {
  display: none;
}

details.glass-details summary::after {
  content: "▾";
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

details.glass-details[open] summary::after {
  transform: rotate(-180deg);
}

details.glass-details .details-body {
  padding: 0 12px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.layer-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Chart placeholder */
.chart-placeholder {
  height: 140px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(235, 227, 214, 0.45) 100%
  );
  border: 1px dashed rgba(139, 115, 85, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

/* Right rail: data views + insights */
.dv-rail-panel__intro {
  margin-top: -2px;
  line-height: 1.5;
}

.dv-intro-scope {
  font-weight: 600;
  color: rgba(92, 77, 60, 0.9);
}

.dv-rail-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.dv-rail-panel__head .panel__title {
  margin-bottom: 0;
}

.dv-studio-pill {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fffaf5;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #2d8a6e, #1a5c48);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 6px 16px -4px rgba(26, 92, 72, 0.45);
  flex-shrink: 0;
}

.dv-stats-deck {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.dv-stat-chip {
  flex: 1 1 auto;
  min-width: calc(50% - 6px);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(150deg, rgba(255, 252, 248, 0.88) 0%, rgba(235, 227, 214, 0.45) 100%);
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.dv-stat-chip__k {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.dv-stat-chip__v {
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brown-2);
  line-height: 1.25;
}

.dv-studio-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

/* 311_acs_eda.ipynb — four regplot panels only */
.dv-rail-panel--acs-eda .dv-rail-panel__intro code {
  font-size: 0.62rem;
  padding: 0.08em 0.28em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--stroke);
}

.dv-rail-panel--acs-eda .dv-rail-panel__intro--tight {
  line-height: 1.38;
  font-size: 0.66rem;
}

.dv-acs-eda-grid {
  margin-top: 6px;
}

.dv-acs-eda-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dv-acs-eda-cell {
  margin: 0;
  padding: 14px 13px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    148deg,
    rgba(255, 255, 255, 0.58) 0%,
    rgba(248, 242, 234, 0.42) 48%,
    rgba(255, 252, 248, 0.58) 100%
  );
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 8px 24px -12px rgba(45, 38, 32, 0.08);
}

.dv-acs-eda-cell__headline {
  margin: 0 0 4px;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--brown-2);
  letter-spacing: -0.02em;
}

.dv-acs-eda-cell__meta {
  margin: 0 0 10px;
  font-size: 0.6rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color: rgba(92, 77, 60, 0.78);
}

.dv-acs-eda-cell__chart {
  width: 100%;
  overflow: hidden;
}

.dv-acs-eda-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 300px;
}

.dv-acs-eda-plot-bg {
  fill: rgba(255, 253, 250, 0.92);
}

.dv-acs-eda-plot-frame {
  stroke: rgba(139, 115, 85, 0.22);
  stroke-width: 1;
}

.dv-acs-eda-gridline {
  stroke: rgba(139, 115, 85, 0.12);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.dv-acs-eda-tick {
  fill: rgba(72, 58, 46, 0.72);
  font-family: var(--font-sans, "DM Sans", sans-serif);
  font-size: 9px;
  font-weight: 500;
}

.dv-acs-eda-axis-title {
  fill: rgba(55, 48, 40, 0.78);
  font-family: var(--font-sans, "DM Sans", sans-serif);
  font-size: 9.5px;
  font-weight: 600;
}

.dv-acs-eda-axis-title--y {
  font-size: 9px;
}

.dv-acs-eda-regline {
  stroke: #3a6fd8;
  stroke-width: 2.25;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.95;
}

.dv-acs-eda-dot {
  fill: rgba(38, 72, 108, 0.42);
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}

.dv-acs-eda-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(139, 115, 85, 0.12);
  font-size: 0.62rem;
  font-weight: 500;
  color: rgba(92, 77, 60, 0.8);
}

.dv-acs-eda-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dv-acs-eda-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(38, 72, 108, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(38, 72, 108, 0.15);
}

.dv-acs-eda-legend__line {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #3a6fd8, #5b8def);
}

.dv-empty--acs {
  font-size: 0.72rem;
  line-height: 1.4;
  margin: 0;
}

.dash-loading-data .kpi__value {
  opacity: 0.35;
  animation: dash-kpi-pulse 1.1s ease-in-out infinite;
}

@keyframes dash-kpi-pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-loading-data .kpi__value {
    animation: none;
  }
}

.dv-card--311 {
  border-color: rgba(99, 153, 34, 0.22);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 0 0 1px rgba(99, 153, 34, 0.06);
}

.dv-311-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-top: 6px;
}

@media (max-width: 720px) {
  .dv-311-split {
    grid-template-columns: 1fr;
  }
}

.dv-subhead {
  margin: 0 0 8px;
  font-family: var(--font-sans, "DM Sans", sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(92, 77, 60, 0.72);
}

.dv-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.dv-card {
  padding: 14px 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    148deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(248, 242, 234, 0.4) 48%,
    rgba(235, 227, 214, 0.32) 100%
  );
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 14px 36px -14px rgba(22, 18, 14, 0.14);
  position: relative;
  overflow: hidden;
}

.dv-card--viz::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(166, 124, 82, 0.2), var(--accent), rgba(45, 138, 110, 0.65));
  opacity: 0.9;
  pointer-events: none;
}

.dv-card--metrics::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #4292c6, #a67c52);
  opacity: 0.75;
  pointer-events: none;
}

.dv-card__title {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dv-card__sub {
  margin: 0 0 10px;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.dv-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dv-chart--bars {
  gap: 7px;
}

.dv-bar-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 30%) 1fr minmax(3.2rem, 22%);
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
}

.dv-bar-label {
  color: var(--text-muted);
  line-height: 1.2;
}

.dv-bar-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(139, 115, 85, 0.1);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(92, 77, 60, 0.08);
}

.dv-bar-track--deep {
  height: 10px;
  background: rgba(28, 22, 18, 0.06);
}

.dv-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(166, 124, 82, 0.55), rgba(99, 153, 34, 0.75));
  min-width: 2px;
  transition: width 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.dv-bar-fill--neon {
  background: linear-gradient(90deg, var(--dv-g1, #a67c52), var(--dv-g2, #639922));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 2px 8px rgba(22, 18, 14, 0.12);
}

.dv-bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
  font-size: 0.65rem;
}

.dv-empty,
.dv-empty-inline {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 12px 8px;
}

.dv-empty-inline {
  display: block;
  padding: 8px;
}

.dv-scatter-frame {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dv-scatter-svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 220px;
  max-height: 320px;
  filter: drop-shadow(0 10px 20px rgba(22, 18, 14, 0.08));
}

.dv-scatter-plot-bg {
  fill: rgba(255, 252, 248, 0.92);
}

.dv-scatter-plot-frame {
  stroke: rgba(139, 115, 85, 0.22);
  stroke-width: 1.1px;
}

.dv-scatter-grid {
  stroke: rgba(139, 115, 85, 0.1);
  stroke-width: 0.85px;
  vector-effect: non-scaling-stroke;
}

.dv-scatter-tick {
  font-size: 10px;
  fill: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
}

.dv-scatter-axis-title {
  font-size: 10.5px;
  fill: var(--brown-2, #5c4d3e);
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dv-scatter-axis-title--y {
  font-size: 10px;
}

.dv-scatter-dot--obs {
  fill: #0d7a6f;
  stroke: rgba(255, 253, 249, 0.65);
  stroke-width: 0.45px;
  vector-effect: non-scaling-stroke;
}

.dv-scatter-dot--mod {
  fill: rgba(110, 95, 78, 0.38);
  stroke: none;
}

.dv-scatter-meta {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 248, 0.65);
  border: 1px solid rgba(139, 115, 85, 0.12);
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.dv-scatter-meta__why {
  margin: 0 0 10px;
}

.dv-scatter-meta__stats {
  margin: 10px 0 0;
  font-size: 0.64rem;
  color: var(--text-muted);
}

.dv-scatter-meta__stats strong {
  color: var(--brown-2);
  font-weight: 700;
}

.dv-scatter-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.dv-scatter-leg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
}

.dv-scatter-leg__swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.dv-scatter-leg--obs .dv-scatter-leg__swatch {
  background: #0d7a6f;
}

.dv-scatter-leg--mod .dv-scatter-leg__swatch {
  background: rgba(110, 95, 78, 0.45);
}

.dv-heat-row {
  display: flex;
  gap: 4px;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.dv-heat-cell {
  flex: 1;
  min-width: 0;
  border-radius: 4px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.dv-heat-cell:hover {
  transform: scaleY(1.08);
  filter: brightness(1.06);
  z-index: 1;
}

.dv-heat-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.58rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dv-heat-legend__grad {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eaf3de, #97c459, #ef9f27, #d85a30, #993c1d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.dv-comp-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dv-comp-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 52%) 2.5rem;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
}

.dv-comp-row__l {
  color: var(--text-muted);
  line-height: 1.25;
}

.dv-comp-row__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(139, 115, 85, 0.1);
  overflow: hidden;
}

.dv-comp-row__fill {
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  transition: width 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.dv-comp-row__v {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brown-2);
  font-size: 0.68rem;
}

.dv-res-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dv-res-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.2fr) 3.2rem;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
}

.dv-res-label {
  color: var(--text-muted);
  line-height: 1.2;
}

.dv-res-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(139, 115, 85, 0.1);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(22, 18, 14, 0.06);
}

.dv-res-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 3px;
  transition: width 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
}

.dv-res-fill--first {
  background: linear-gradient(90deg, #c0dd97, #639922);
}

.dv-res-fill--res {
  background: linear-gradient(90deg, #f0997b, #d85a30);
}

.dv-res-v {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brown-2);
  text-align: right;
}

.dv-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.dv-metric {
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 248, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.12);
}

.dv-metric__v {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dv-metric__l {
  display: block;
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.25;
}

.dv-metrics-row--rich .dv-metric {
  background: linear-gradient(160deg, rgba(255, 252, 248, 0.75) 0%, rgba(235, 227, 214, 0.35) 100%);
  border-color: rgba(139, 115, 85, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.dv-spark-block {
  margin-top: 4px;
}

.dv-spark-block--rich {
  margin-top: 2px;
}

.dv-spark-title {
  margin: 0 0 8px;
  font-size: 0.64rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 600;
}

.dv-spark-svg {
  width: 100%;
  height: 56px;
  display: block;
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 248, 0.4);
  border: 1px solid rgba(139, 115, 85, 0.1);
}

.dv-spark-svg--area {
  height: 120px;
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.75) 0%, rgba(235, 227, 214, 0.35) 100%);
  border: 1px solid rgba(139, 115, 85, 0.12);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 12px 28px -12px rgba(22, 18, 14, 0.12);
}

.dv-spark-grid {
  stroke: rgba(139, 115, 85, 0.12);
  stroke-width: 0.45px;
  vector-effect: non-scaling-stroke;
}

.dv-spark-area {
  fill: rgba(166, 124, 82, 0.22);
}

.dv-spark-path {
  stroke: var(--accent);
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dv-spark-path--glow {
  stroke: #8b5a2b;
  stroke-width: 2.2px;
  filter: drop-shadow(0 1px 2px rgba(139, 90, 43, 0.35));
}

.dv-spark-dot {
  fill: #fffdf9;
  stroke: var(--accent);
  stroke-width: 0.85px;
  filter: drop-shadow(0 1px 1px rgba(22, 18, 14, 0.15));
}

.insight-callout {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  border-radius: var(--radius-md);
  background: rgba(166, 124, 82, 0.1);
  border: 1px solid rgba(166, 124, 82, 0.2);
}

.insight-callout strong {
  font-weight: 700;
  color: var(--brown-2);
}

.panel-insight {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(255, 252, 248, 0.45);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(139, 115, 85, 0.12);
}

/* Overlays panel — compact layer picker + opacity + toggles */
.overlay-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overlay-panel__block {
  margin: 0;
}

.overlay-panel__block--modes {
  padding: 12px 11px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 252, 248, 0.38) 100%
  );
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 6px 20px -10px rgba(22, 18, 14, 0.12);
}

.overlay-panel__eyebrow {
  display: block;
  margin: 0 0 9px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(90, 74, 58, 0.72);
}

label.overlay-panel__eyebrow {
  cursor: default;
}

.segmented--overlay {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.segmented--overlay .segmented__opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.35rem;
  padding: 0.4rem 0.28rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  hyphens: auto;
  border-radius: 10px;
}

.segmented--overlay .segmented__opt input:checked + span {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 2px 8px rgba(166, 124, 82, 0.15);
}

.range-wrap--overlay {
  margin-top: 2px;
}

.overlay-panel__block--toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.check-glass--overlay {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(139, 115, 85, 0.1);
  font-size: 0.74rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.check-glass--overlay:hover {
  background: rgba(255, 255, 255, 0.42);
  border-color: rgba(139, 115, 85, 0.16);
}

.overlay-panel__hint--wait-reason {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.overlay-panel__wait-reason-chips {
  max-width: 100%;
}

/* Bottom center: compact legend (minimal vertical footprint) */
.map-legend-bar {
  position: fixed;
  left: var(--map-inset);
  right: var(--map-inset);
  bottom: calc(var(--map-inset) + var(--map-legend-gap-bottom));
  z-index: 17;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  overflow: visible;
  padding-bottom: 6px;
  margin-bottom: 0;
}

.map-legend-bar::before {
  display: none;
}

.map-legend-bar .map-legend-dock {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.map-legend-dock {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  width: 100%;
  max-width: min(820px, 100%);
  margin: 0 auto;
  padding: 8px 16px 9px;
  border-radius: 20px;
  box-shadow: var(--shadow-glass);
}

.map-legend-dock__title {
  margin: 0;
}

.map-legend-dock__scale {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(520px, 72vw);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-legend-dock__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  width: 100%;
}

.map-legend-dock__headline {
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: -0.02em;
  color: var(--brown-2);
  line-height: 1.25;
  width: 100%;
}

.map-legend-gradient-wrap {
  position: relative;
  width: 100%;
}

.map-legend-gradient {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(139, 115, 85, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.map-legend-axis-ticks {
  position: relative;
  height: 8px;
  width: 100%;
  margin-top: 1px;
}

.map-legend-axis-ticks__mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(55, 42, 32, 0.4);
  transform: translateX(-50%);
  border-radius: 1px;
}

.map-legend-axis-labels {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 3px;
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--text-muted);
}

.map-legend-axis-labels__t {
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-legend-axis-labels__t--solo {
  flex: 1 1 100%;
  white-space: normal;
}

.map-legend-bar-seg {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
}

.map-legend-dock__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.map-legend-dock__row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
}

.map-legend-dock__swatch--high {
  background: linear-gradient(135deg, #d4b896, #a67c52);
  box-shadow: none;
}

.map-legend-dock__swatch--low {
  background: linear-gradient(135deg, #f5efe6, #ebe3d6);
  box-shadow: none;
}

.map-legend-dock__note {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
  font-size: 0.6rem;
  color: #8b4513;
  line-height: 1.35;
  flex: 1 1 100%;
  max-width: min(100%, 520px);
  text-align: center;
}

.map-legend-dock__note.map-legend-dock__note--visible {
  display: block;
}

.map-legend-dock__note--idle {
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.52rem;
}

.map-legend-dock__note--alert {
  color: #8b3a1f;
  font-weight: 600;
}

.tract-hover-tip .leaflet-tooltip-content {
  margin: 0;
  padding: 0;
  width: max-content;
  max-width: min(288px, calc(100vw - 24px));
}

.tract-tip--compact {
  padding: 8px 10px 7px;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text);
}

.tract-tip--compact .tract-tip__title {
  font-family: var(--font-display, inherit);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: -0.015em;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tract-tip--compact .tract-tip__geoid {
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tract-tip--compact .tract-tip__geoid code {
  font-size: 1em;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(139, 115, 85, 0.1);
  color: var(--text);
}

.tract-tip--compact .tract-tip__note {
  margin: 5px 0 6px;
  font-size: 0.58rem;
  line-height: 1.3;
  color: var(--text-muted);
  font-weight: 600;
}

.tract-tip--compact .tract-tip__stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tract-tip--compact .tract-tip__stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(139, 115, 85, 0.1);
  font-size: 0.68rem;
}

.tract-tip--compact .tract-tip__stats .tract-tip__stat:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.tract-tip--compact .tract-tip__demo {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(139, 115, 85, 0.14);
}

.tract-tip--compact .tract-tip__demo-h {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(90, 74, 58, 0.78);
  margin-bottom: 4px;
}

.tract-tip--compact .tract-tip__demo .tract-tip__stat {
  padding: 2px 0;
  font-size: 0.64rem;
}

.tract-tip--compact .tract-tip__demo .tract-tip__stat:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.tract-tip--compact .tract-tip__lab {
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.62rem;
}

.tract-tip--compact .tract-tip__num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tract-tip--compact .tract-tip__hint-sm {
  margin: 6px 0 0;
  padding-top: 5px;
  border-top: 1px dashed rgba(139, 115, 85, 0.18);
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(90, 74, 58, 0.72);
}

/* Bottom-right: map tools (stacked above legend strip) */
.map-corner-stack {
  position: fixed;
  right: calc(var(--map-inset) + 14px);
  bottom: calc(var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 10px);
  z-index: 18;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.map-corner-stack > * {
  pointer-events: auto;
}

.map-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.tool-stack {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 1px 4px rgba(22, 18, 14, 0.06);
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.75);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.75);
  background: linear-gradient(
    180deg,
    rgba(255, 253, 250, 0.55) 0%,
    rgba(248, 242, 234, 0.38) 100%
  );
}

.tool-stack button {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 252, 248, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--brown-2);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  border-bottom: 1px solid rgba(139, 115, 85, 0.12);
  transition: background 0.2s, box-shadow 0.2s;
}

.tool-stack button:last-child {
  border-bottom: none;
}

.tool-stack button:hover {
  background: rgba(255, 252, 248, 0.62);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.tool-stack button:active {
  background: rgba(255, 252, 248, 0.45);
}

/* Tract detail: centered modal card (tract click); no map-anchored positioning */
.tract-detail-shell {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

.tract-detail-shell.is-open {
  pointer-events: auto;
}

.tract-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 18, 0.22);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tract-detail-shell.is-open .tract-detail-backdrop {
  opacity: 1;
}

.tract-detail-card {
  position: relative;
  z-index: 2;
  width: min(300px, calc(100vw - 32px));
  max-height: min(78vh, 640px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 14px;
  background: linear-gradient(
    165deg,
    rgba(255, 254, 252, 0.94) 0%,
    rgba(252, 248, 242, 0.9) 45%,
    rgba(248, 242, 234, 0.88) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.65) inset,
    0 14px 40px -6px rgba(18, 14, 11, 0.28),
    0 4px 16px rgba(18, 14, 11, 0.12);
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.75);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.75);
  transform: scale(0.96);
  transform-origin: center center;
  opacity: 0;
  pointer-events: auto;
  transition:
    width 0.48s cubic-bezier(0.32, 0.72, 0, 1),
    max-height 0.52s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.32s ease,
    box-shadow 0.4s ease;
}

.tract-detail-shell.is-open .tract-detail-card {
  opacity: 1;
  transform: scale(1);
}

.tract-detail-card.tract-detail-card--expanded {
  width: min(380px, calc(100vw - 32px));
  max-height: min(82vh, 680px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.72) inset,
    0 22px 56px -8px rgba(18, 14, 11, 0.32),
    0 8px 24px rgba(18, 14, 11, 0.14);
}

.tract-detail-card__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.tract-detail-card__close:hover {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
}

.tract-detail-card__inner {
  padding: 12px 36px 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.tract-detail-card__title {
  margin: 0 0 2px;
  padding-right: 8px;
  font-family: var(--font-display, inherit);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.tract-detail-card__geoid {
  margin: 0 0 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.tract-detail-card__geoid code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(139, 115, 85, 0.1);
  color: var(--text);
}

.tract-detail-card__note {
  margin: 0 0 8px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(90, 74, 58, 0.78);
}

.tract-detail-card__stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.tract-detail-card__stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(139, 115, 85, 0.1);
  font-size: 0.72rem;
}

.tract-detail-card__stat:last-child {
  border-bottom: none;
}

.tract-detail-card__lab {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.64rem;
  color: rgba(90, 74, 58, 0.82);
}

.tract-detail-card__num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.tract-detail-card__demo-h {
  margin: 6px 0 4px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(90, 74, 58, 0.75);
}

.tract-detail-card__expand-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.52s cubic-bezier(0.32, 0.72, 0, 1);
}

.tract-detail-card--expanded .tract-detail-card__expand-wrap {
  grid-template-rows: 1fr;
}

.tract-detail-card__expand-inner {
  overflow: hidden;
  min-height: 0;
}

.tract-detail-card__expand-body {
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px dashed rgba(139, 115, 85, 0.22);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.42s ease 0.08s,
    transform 0.48s cubic-bezier(0.32, 0.72, 0, 1) 0.06s;
}

.tract-detail-card--expanded .tract-detail-card__expand-body {
  opacity: 1;
  transform: translateY(0);
}

.tract-detail-card__prose {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
}

.tract-detail-card__prose strong {
  color: var(--text);
  font-weight: 700;
}

.tract-detail-card__section-label {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(90, 74, 58, 0.72);
}

.tract-detail-card__expand-body > .tract-detail-card__section-label:first-of-type {
  margin-top: 0;
}

.tract-detail-card__ba-footnote {
  margin: 6px 0 0;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(90, 74, 58, 0.68);
}

.tract-detail-chart-wrap {
  margin-top: 6px;
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(139, 115, 85, 0.12);
}

.tract-detail-chart-wrap--secondary {
  background: rgba(255, 252, 248, 0.55);
  border-color: rgba(139, 115, 85, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.tract-detail-chart {
  display: block;
  max-width: 100%;
  height: auto;
}

.tract-detail-chart__label {
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  font-size: 10px;
  font-weight: 600;
  fill: rgba(58, 48, 38, 0.88);
}

.tract-detail-chart__value {
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  fill: rgba(42, 34, 28, 0.92);
}

.tract-detail-chart__value--money {
  font-size: 10px;
}

.tract-detail-chart__footnote {
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  font-size: 7.5px;
  font-weight: 600;
  fill: rgba(90, 74, 58, 0.62);
}

@media (prefers-reduced-motion: reduce) {
  .tract-detail-backdrop,
  .tract-detail-card,
  .tract-detail-card__expand-wrap,
  .tract-detail-card__expand-body {
    transition: none !important;
  }

  .tract-detail-shell.is-open .tract-detail-card {
    transform: none;
    opacity: 1;
  }

  .tract-detail-card__expand-body {
    opacity: 1;
    transform: none;
  }

  .tract-detail-card--expanded .tract-detail-card__expand-wrap {
    grid-template-rows: 1fr;
  }
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(35, 28, 22, 0.32);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 101;
  width: min(420px, 100vw);
  height: 100%;
  isolation: isolate;
  background: linear-gradient(
    195deg,
    rgba(255, 254, 252, 0.82) 0%,
    rgba(252, 248, 242, 0.58) 55%,
    rgba(248, 242, 234, 0.48) 100%
  );
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.88);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.88);
  border-left: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    4px 0 0 rgba(255, 255, 255, 0.25) inset,
    -28px 0 64px -12px rgba(18, 14, 11, 0.35),
    -12px 0 32px rgba(18, 14, 11, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__head {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.drawer__close {
  border: none;
  background: rgba(255, 255, 255, 0.5);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
}

.drawer__body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.drawer__section {
  margin-bottom: 1.25rem;
}

.drawer__section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brown-1);
}

/* --- Typical wait explorer (demographic → stub estimate) --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wait-preview {
  padding: 14px 14px 16px;
  border-radius: var(--radius-md);
  width: 100%;
}

.wait-preview__header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.wait-preview__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--brown-2);
}

.wait-preview__lede {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.wait-preview__lede code {
  font-size: 0.68rem;
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--stroke);
}

.wait-preview__badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--brown-1);
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(166, 124, 82, 0.35);
}

.wait-preview__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wp-preset {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.38rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

.wp-preset:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-color: rgba(166, 124, 82, 0.35);
}

.wp-preset:active {
  transform: scale(0.97);
}

.wait-preview__metric-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.wait-preview__mtab {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.wait-preview__mtab:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.wait-preview__mtab.is-active {
  background: var(--accent-soft);
  border-color: rgba(166, 124, 82, 0.42);
  color: var(--brown-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.wait-preview__metric-label {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wait-preview__hero {
  padding: 12px 12px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.55);
  margin-bottom: 10px;
}

.wait-preview__hero-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.wait-preview__hero-value {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--brown-2);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.wait-preview__hero-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wait-preview__hero-band {
  margin: 8px 0 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.wait-preview__vs {
  margin: 0;
  font-size: 0.74rem;
  color: var(--brown-1);
  font-weight: 600;
}

.wait-preview--simple {
  padding: 8px 4px 12px;
  max-width: 100%;
}

.wait-preview__simple-lede {
  margin: 0 0 14px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.wait-preview__hero--simple {
  position: relative;
  padding: 16px 14px 12px;
  margin-bottom: 12px;
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.wait-preview__hero--simple.is-thinking {
  border-color: rgba(166, 124, 82, 0.45);
  box-shadow: 0 0 0 1px rgba(166, 124, 82, 0.12), 0 8px 28px rgba(92, 77, 60, 0.08);
}

.wait-preview__result-kicker {
  margin: 0 0 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wait-preview__thinking {
  margin: 6px 0 0;
  min-height: 1.1em;
  font-size: 0.72rem;
  font-weight: 600;
  font-style: italic;
  color: var(--brown-1);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.wait-preview__hero--simple.is-thinking .wait-preview__thinking {
  opacity: 1;
  transform: translateY(0);
  animation: wp-thinking-dots 1.1s ease-in-out infinite;
}

.wait-preview__hero--simple.is-thinking .wait-preview__hero-value {
  color: rgba(92, 77, 60, 0.55);
  animation: wp-value-pulse 0.9s ease-in-out infinite;
}

@keyframes wp-thinking-dots {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

@keyframes wp-value-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

.wait-preview__meter-wrap--simple {
  margin-bottom: 18px;
}

.wait-preview__form--simple {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 4px;
}

.wp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wp-field__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brown-2);
  letter-spacing: -0.01em;
}

.wp-field__hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.wp-field__control.glass-input {
  width: 100%;
  margin-top: 2px;
}

.wp-slider-row--spacious {
  margin-top: 4px;
  gap: 10px;
}

.wp-tick-labels--words {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 0;
  margin-top: 6px;
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
}

.wp-tick-labels--words span:nth-child(2),
.wp-tick-labels--words span:nth-child(4) {
  visibility: hidden;
}

.wp-segmented--simple {
  flex-wrap: wrap;
  margin-top: 4px;
  gap: 6px;
}

.wp-segmented--simple .wp-seg span {
  font-size: 0.68rem;
  padding: 0.4rem 0.55rem;
}

.wait-preview__reset-wrap {
  margin: 16px 0 0;
  text-align: center;
}

.wait-preview__btn-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brown-1);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.wait-preview__btn-link:hover {
  color: var(--brown-2);
}

/* --- Wait wizard (one question per step) --- */
.wait-preview--wizard {
  padding-top: 4px;
}

.wp-wizard-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(139, 115, 85, 0.12);
  margin: 0 0 12px;
  overflow: hidden;
}

.wp-wizard-progress__bar {
  height: 100%;
  width: 25%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(166, 124, 82, 0.72));
  transition: width 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.wp-wizard-step-label {
  margin: 0 0 14px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wp-wizard-viewport {
  overflow: hidden;
  width: 100%;
  margin: 0 0 4px;
  border-radius: var(--radius-md);
}

.wp-wizard-track {
  display: flex;
  width: calc(100% * var(--wp-slides, 6));
  transform: translate3d(calc(-100% * var(--wp-step, 0) / var(--wp-slides, 6)), 0, 0);
  transition: transform 0.48s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.wp-wizard-slide {
  flex: 0 0 calc(100% / var(--wp-slides, 6));
  min-width: 0;
  box-sizing: border-box;
  padding: 2px 2px 14px;
}

.wp-wizard-slide--thinking {
  padding-top: 8px;
}

.wp-thinking-panel {
  text-align: center;
  padding: 20px 12px 28px;
}

.wp-thinking-panel__orb {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), rgba(166, 124, 82, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 14px 32px -8px rgba(92, 77, 60, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.75) inset;
  animation: wp-orb-pulse 1.35s ease-in-out infinite;
}

.wp-thinking-panel__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brown-2);
}

.wp-thinking-panel__text {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

@keyframes wp-orb-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.88;
  }
  50% {
    transform: scale(1.07);
    opacity: 1;
  }
}

.wait-preview__results-intro {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--brown-2);
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s cubic-bezier(0.33, 1, 0.68, 1),
    transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
}

.wait-preview__results-intro.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wait-preview__analysis {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 252, 248, 0.97);
  border: 1px solid rgba(139, 115, 85, 0.16);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 14px 36px -12px rgba(22, 18, 14, 0.14);
}

.wait-preview__analysis-title {
  margin: 0 0 10px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wait-preview__analysis-body {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.58;
  color: var(--text);
}

.wait-preview__analysis-body strong {
  color: var(--brown-2);
  font-weight: 700;
}

.wp-wizard-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 14px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(139, 115, 85, 0.1);
}

.wp-wizard-nav__btn {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.wp-wizard-nav__btn--ghost {
  border: 1px solid rgba(139, 115, 85, 0.28);
  background: rgba(255, 252, 248, 0.65);
  color: var(--brown-1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.wp-wizard-nav__btn--ghost:hover {
  background: rgba(255, 252, 248, 0.92);
  color: var(--brown-2);
}

.wp-wizard-nav__btn--primary {
  border: 1px solid rgba(166, 124, 82, 0.45);
  background: linear-gradient(160deg, rgba(166, 124, 82, 0.95), rgba(139, 105, 72, 0.88));
  color: #fffaf5;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 10px 26px -8px rgba(92, 77, 60, 0.35);
  margin-left: auto;
}

.wp-wizard-nav__btn--primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 14px 32px -8px rgba(92, 77, 60, 0.4);
}

.wp-wizard-nav__btn:active {
  transform: translateY(0);
}

.wait-preview--wizard .wait-preview__reset-wrap {
  margin-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .wp-wizard-track {
    transition-duration: 0.01ms;
  }

  .wp-wizard-progress__bar {
    transition-duration: 0.01ms;
  }

  .wp-thinking-panel__orb {
    animation: none;
  }

  .wait-preview__results-intro,
  .wait-preview__results-intro.is-visible {
    transition-duration: 0.01ms;
  }
}

.wait-preview__meter-wrap {
  margin-bottom: 14px;
}

.wait-preview__meter-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.wait-preview__meter {
  --wp-p25: 15;
  --wp-p75: 65;
  --wp-med: 42;
  --wp-base: 48;
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(253, 251, 247, 0.95) 0%,
    rgba(235, 227, 214, 0.95) 45%,
    rgba(196, 165, 116, 0.65) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 2px rgba(92, 77, 60, 0.06);
}

.wait-preview__meter-iqr {
  position: absolute;
  top: 4px;
  left: calc(var(--wp-p25) * 1%);
  width: calc((var(--wp-p75) - var(--wp-p25)) * 1%);
  height: 10px;
  border-radius: 999px;
  background: rgba(166, 124, 82, 0.36);
  transition: left 0.38s cubic-bezier(0.22, 1, 0.36, 1), width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.wait-preview__meter-baseline {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: calc(var(--wp-base) * 1%);
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: rgba(92, 77, 60, 0.5);
  transition: left 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.wait-preview__meter-median {
  position: absolute;
  top: -4px;
  left: calc(var(--wp-med) * 1%);
  width: 14px;
  height: 26px;
  margin-left: -7px;
  border-radius: 7px;
  background: linear-gradient(180deg, #5c4d3c, #3d3429);
  border: 2px solid rgba(255, 252, 248, 0.92);
  box-shadow: 0 4px 14px rgba(61, 52, 41, 0.28);
  transition: left 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.wait-preview__meter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-size: 0.62rem;
  color: var(--text-muted);
}

.wait-preview__meter-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wait-preview__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.wait-preview__swatch--iqr {
  background: rgba(166, 124, 82, 0.45);
}

.wait-preview__swatch--base {
  background: rgba(92, 77, 60, 0.55);
  width: 3px;
  border-radius: 1px;
}

.wait-preview__swatch--med {
  background: #5c4d3c;
}

.wait-preview__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wait-preview__fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.wait-preview__fieldset legend {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 8px;
}

.wait-preview__field-hint {
  margin: 0 0 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.wp-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.wp-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.wp-slider-row output {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--brown-1);
  font-weight: 600;
  min-width: 7.5rem;
  text-align: right;
}

.wp-tick-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.58rem;
  color: var(--text-muted);
  padding: 0 2px;
  margin-top: 2px;
}

.wp-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.wp-chip {
  font-size: 0.64rem;
  padding: 0.32rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}

.wp-chip:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
}

.wp-chip:active {
  transform: scale(0.97);
}

.wp-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: rgba(166, 124, 82, 0.42);
  color: var(--brown-2);
}

.wp-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.wp-seg {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.wp-seg input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.wp-seg span {
  display: block;
  padding: 0.32rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.32);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.wp-seg:hover span {
  background: rgba(255, 255, 255, 0.52);
}

.wp-seg input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wp-seg input:checked + span {
  background: var(--accent-soft);
  border-color: rgba(166, 124, 82, 0.42);
  color: var(--brown-2);
}

.wait-preview__two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.wait-preview__select-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wait-preview__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(139, 115, 85, 0.15);
}

.wait-preview__btn {
  flex: 1;
  min-width: 120px;
  border: 1px solid rgba(166, 124, 82, 0.45);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.9), rgba(235, 227, 214, 0.55));
  color: var(--brown-2);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.wait-preview__btn:hover {
  box-shadow: 0 4px 14px rgba(92, 77, 60, 0.12);
}

.wait-preview__btn:active {
  transform: scale(0.98);
}

.wait-preview__btn--ghost {
  background: rgba(255, 255, 255, 0.35);
  border-color: var(--stroke);
  color: var(--text-muted);
}

.wait-preview__btn--ghost:hover {
  color: var(--text);
}

.wait-preview--overlay {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 8px;
}

.wait-preview__header--overlay {
  margin-bottom: 10px;
}

.wait-preview__header--overlay .wait-preview__presets {
  margin-top: 0;
}

@media (prefers-reduced-motion: reduce) {
  .app-header__tabs .tab-glider {
    transition-duration: 0.01ms;
  }
}

/* Tooltip hint */
.map-hint {
  position: fixed;
  left: 50%;
  bottom: calc(
    var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + var(--map-hint-legend-gap)
  );
  transform: translateX(-50%);
  z-index: 12;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 999px;
  pointer-events: none;
  max-width: min(92vw, 420px);
  text-align: center;
  line-height: 1.3;
  background: rgba(255, 253, 250, 0.82);
  border: 1px solid rgba(139, 115, 85, 0.14);
  box-shadow: var(--shadow-glass);
}

.map-hint.map-hint--dismissed {
  display: none !important;
}

@media (max-width: 1100px) {
  .rail--right .rail__track {
    max-height: 38vh;
  }

  .rail--right {
    top: auto;
    bottom: calc(var(--map-inset) + 18px);
  }

  .rail--right .rail__track {
    max-height: 42vh;
  }

  /* Keep corner stack clear of bottom-anchored right rail + legend strip */
  .map-corner-stack {
    bottom: calc(
      var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 10px + min(42vh, 300px) + 14px
    );
  }

  /* Match the extra lift applied to .map-corner-stack so zoom stays above tools */
  .leaflet-bottom.leaflet-right {
    bottom: calc(
      var(--map-legend-bar-h) + var(--map-legend-gap-bottom) + 8px + var(--map-zoom-lift) + min(42vh, 300px) + 14px
    ) !important;
  }
}

@media (max-width: 640px) {
  :root {
    --map-inset: 8px;
    --panel-width: min(100vw - 32px, 320px);
    --map-legend-bar-h: 78px;
    --map-legend-gap-bottom: 8px;
    --map-hint-legend-gap: 6px;
    /* Wrapped header (tabs only) */
    --app-header-band-h: 96px;
  }

  .dv-metrics-row {
    grid-template-columns: 1fr;
  }

  .dv-bar-row {
    grid-template-columns: minmax(4rem, 32%) 1fr minmax(2.8rem, 24%);
    font-size: 0.62rem;
  }

  .app-header__toolbar {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    gap: 0.45rem 0.6rem;
  }

  .app-header {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem 0.75rem;
  }

  .app-header__tabs {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }

  .rail--left {
    top: calc(var(--map-inset) + 100px);
    bottom: calc(var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 4px);
  }

  .rail--left .rail__track {
    max-height: none !important;
    padding: 6px 10px 8px;
    margin: 0 -6px;
  }

  .rail--right .rail__track {
    padding: 20px 22px 24px;
    margin: 0 -16px;
  }

  .map-hint {
    display: none;
  }

  .map-corner-stack {
    right: calc(var(--map-inset) + 10px);
  }

  .map-legend-dock {
    padding: 7px 12px 8px;
    border-radius: 16px;
    gap: 6px 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
  }

  .map-legend-axis-labels__t {
    white-space: normal;
    font-size: 0.54rem;
    line-height: 1.15;
    hyphens: auto;
  }

  .map-legend-dock__list {
    justify-content: center;
    gap: 4px 12px;
  }

  .map-legend-dock__row {
    white-space: nowrap;
    font-size: 0.6rem;
  }

  .map-legend-dock__note.map-legend-dock__note--visible {
    max-width: 100%;
    text-align: center;
  }
}

/* -------------------------------------------------------------------------- */
/* Mobile simple mode — matchMedia (max-width: 768px) toggles body class in JS */
/* Full dashboard (filters, overlay tabs, analytics) hidden; map + snapshot only */
/* -------------------------------------------------------------------------- */

.snapshot-dock__mobile-note {
  display: none;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(92, 77, 60, 0.82);
  background: rgba(255, 252, 248, 0.55);
  border: 1px solid rgba(139, 115, 85, 0.12);
}

body.is-mobile-simple .snapshot-dock__mobile-note {
  display: block;
}

body.is-mobile-simple .app-header__tagline {
  display: block;
}

body.is-mobile-simple {
  --app-header-band-h: 52px;
}

body.is-mobile-simple .app-header__toolbar {
  display: none !important;
}

body.is-mobile-simple .app-header {
  justify-content: center;
  flex-wrap: nowrap;
  padding: 0.42rem 0.85rem;
  min-height: auto;
  max-width: min(100vw - 2 * var(--map-inset), 420px);
}

body.is-mobile-simple .app-header__brand {
  align-items: center;
  text-align: center;
}

body.is-mobile-simple .rail--left {
  display: none !important;
}

body.is-mobile-simple .rail--right .dv-rail-panel--acs-eda {
  display: none !important;
}

body.is-mobile-simple .kpi--mobile-extra {
  display: none !important;
}

body.is-mobile-simple .kpi-grid--four {
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

body.is-mobile-simple .snapshot-dock__title {
  font-size: 0.68rem;
}

body.is-mobile-simple .snapshot-dock {
  padding: 8px 10px 10px;
}

body.is-mobile-simple .snapshot-dock__head {
  margin-bottom: 6px;
}

body.is-mobile-simple .snapshot-dock__lede {
  font-size: 0.62rem;
  margin-bottom: 4px;
}

body.is-mobile-simple .snapshot-hero-stat {
  margin-top: 4px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.12);
}

body.is-mobile-simple .snapshot-hero-stat__label {
  font-size: 0.58rem;
}

body.is-mobile-simple .snapshot-hero-stat__value {
  font-size: 1.35rem;
}

body.is-mobile-simple .snapshot-hero-stat__hint {
  font-size: 0.52rem;
  margin-top: 4px;
}

body.is-mobile-simple #kpi-quartile-gap-filtered {
  display: none !important;
}

body.is-mobile-simple .kpi__label {
  font-size: 0.52rem;
}

body.is-mobile-simple .kpi__value {
  font-size: 0.95rem;
}

body.is-mobile-simple .insight-callout {
  font-size: 0.62rem;
  line-height: 1.38;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(139, 115, 85, 0.08);
}

body.is-mobile-simple .rail--right {
  left: var(--map-inset);
  right: var(--map-inset);
  width: auto;
  top: auto;
  bottom: calc(var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 6px);
  max-width: none;
}

body.is-mobile-simple .rail--right .rail__track {
  max-height: min(40vh, 300px) !important;
  padding: 8px 10px 12px !important;
  margin: 0 !important;
  gap: 10px !important;
}

body.is-mobile-simple .map-corner-stack {
  bottom: calc(
    var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + 8px + min(40vh, 300px) + 8px
  ) !important;
  right: calc(var(--map-inset) + 8px) !important;
}

body.is-mobile-simple .leaflet-bottom.leaflet-right {
  bottom: calc(
    var(--map-legend-bar-h) + var(--map-legend-gap-bottom) + 8px + var(--map-zoom-lift) + min(40vh, 300px) + 8px
  ) !important;
}

body.is-mobile-simple .map-hint {
  display: block !important;
  max-width: min(90vw, 360px);
  font-size: 0.58rem;
  padding: 4px 10px;
  bottom: calc(
    var(--map-inset) + var(--map-legend-gap-bottom) + var(--map-legend-bar-h) + min(40vh, 300px) + 14px
  );
}

body.is-mobile-simple .map-hint.map-hint--dismissed {
  display: none !important;
}
