:root {
  color-scheme: light;
  --dblue: #0b162c;
  --white: #ffffff;
  --red: #bf0426;
  --blue: #1e3559;
  --lblue: #9cc4f2;
  --grey: #f1f2f2;
  --surface: #ffffff;
  --border: #d9d6ce;
  --text: var(--dblue);
  --muted: #5c6470;
  --state-fill: var(--blue);
  --district-fill: #355c8f;
  --shadow: 0 18px 40px rgba(11, 22, 44, 0.16);
  --panel-bg: #f7f8fa;
  --rail-icon-bg: #eef1f5;
  --rail-icon-active: #16253f;
}

* {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-size: 1em;
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: linear-gradient(180deg, #fafbfc 0%, #eef1f4 100%);
}

body {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  padding: 10px 12px 12px;
  background:
    linear-gradient(180deg, rgba(11, 22, 44, 0.96) 0, rgba(11, 22, 44, 0.96) 82px, transparent 82px),
    linear-gradient(180deg, #fafbfc 0%, #eef1f4 100%);
}

.workspace-shell {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 0 0 0;
}

.side-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(98vh + 76px);
  padding: 10px 0 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(246, 247, 249, 0.97));
  border: 1px solid rgba(13, 22, 44, 0.08);
  box-shadow: var(--shadow);
}

.side-rail-top,
.side-rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rail-mark {
  width: 28px;
  height: 2px;
  background: var(--red);
  margin-top: 8px;
}

.rail-brand {
  display: flex;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.rail-brand .eyebrow {
  margin: 0;
  color: #7d8795;
}

.side-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.rail-toggle,
.rail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0 4px;
  text-decoration: none;
}

.rail-toggle-icon,
.rail-help {
  display: grid;
  place-items: center;
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  background: var(--rail-icon-bg);
  color: #6c7684;
}

.rail-toggle-icon::before,
.rail-toggle-icon::after {
  content: "";
  position: absolute;
}

.rail-toggle-icon-districts::before {
  inset: 8px;
  border: 2px solid currentColor;
  box-shadow:
    7px 0 0 -5px currentColor,
    -7px 0 0 -5px currentColor,
    0 7px 0 -5px currentColor,
    0 -7px 0 -5px currentColor;
}

.rail-toggle-icon-states::before {
  width: 18px;
  height: 14px;
  top: 9px;
  left: 7px;
  border: 2px solid currentColor;
  border-radius: 3px 8px 3px 6px;
  transform: skewX(-12deg);
}

.rail-toggle-icon-home::before {
  width: 16px;
  height: 10px;
  left: 8px;
  bottom: 7px;
  border: 2px solid currentColor;
  border-top: 0;
}

.rail-toggle-icon-home::after {
  width: 14px;
  height: 14px;
  left: 9px;
  top: 7px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.rail-toggle-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #7d8795;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.rail-toggle.layer-toggle {
  border: 0;
  background: transparent;
  padding-top: 0;
  padding-bottom: 0;
}

.rail-toggle.layer-toggle:hover,
.rail-toggle.layer-toggle.is-active {
  background: transparent;
}

.rail-toggle.layer-toggle:hover .rail-toggle-icon,
.rail-link:hover .rail-toggle-icon,
.rail-link:focus .rail-toggle-icon {
  background: rgba(191, 4, 38, 0.12);
  color: var(--red);
}

.rail-toggle.layer-toggle:hover .rail-toggle-label,
.rail-link:hover .rail-toggle-label,
.rail-link:focus .rail-toggle-label {
  color: var(--red);
}

.rail-toggle.layer-toggle.is-active .rail-toggle-icon {
  background: var(--rail-icon-active);
  color: var(--white);
  box-shadow: 0 10px 18px rgba(22, 37, 63, 0.18);
}

.rail-toggle.layer-toggle.is-active .rail-toggle-label {
  color: var(--dblue);
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  margin: 0 0 10px;
  padding: 4px 0 0;
  color: var(--white);
}

.brand-lockup {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  max-width: none;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 10.5px;
  line-height: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--lblue);
}

.hero-title,
.section-title {
  margin: 0;
  text-transform: uppercase;
}

.hero-title {
  font-family: "Playfair Display SC", serif;
  font-size: clamp(1.2rem, 1.9vw, 1.9rem);
  line-height: 0.98;
  font-weight: 700;
  max-width: none;
  overflow-wrap: anywhere;
  word-break: normal;
  text-wrap: balance;
}

.section-title {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: clamp(1.9rem, 2.4vw, 2.5rem);
  line-height: 1;
  color: var(--dblue);
}

.topbar-copy,
.map-meta p,
.detail-placeholder,
.detail-note {
  font-size: 1rem;
  line-height: 1.5rem;
  letter-spacing: 0.04em;
}

.topbar-copy {
  margin: 0;
  max-width: 86ch;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.74rem;
  line-height: 1.05rem;
  overflow-wrap: anywhere;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #9b1c20;
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  align-items: stretch;
}

@media (min-width: 1101px) {
  .app-shell {
    height: 100vh;
  }

  .workspace-shell,
  .main-shell {
    height: 100%;
  }

  .main-shell {
    display: flex;
    flex-direction: column;
  }

  .map-column {
    min-height: 0;
    display: flex;
  }

  .layout {
    flex: 1;
    min-height: 0;
  }

  .map-card,
  .detail-panel {
    flex: 1;
  }

  .map-card,
  .detail-panel {
    min-height: 0;
  }

  #map {
    height: auto;
    min-height: 0;
    flex: 1;
  }
}

.view-loader {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 22, 44, 0.32);
  backdrop-filter: blur(2px);
}

.view-loader.is-visible {
  display: flex;
}

.view-loader-panel {
  display: grid;
  place-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(11, 22, 44, 0.94);
  box-shadow: 0 18px 40px rgba(11, 22, 44, 0.24);
}

.view-loader-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--red);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.view-loader-label {
  margin: 0;
  color: var(--white);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.map-card,
.detail-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-card {
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.map-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(11, 22, 44, 0.06);
  overflow: hidden;
}

.map-tab {
  min-height: 44px;
  padding: 12px 14px;
}

.map-tab + .map-tab {
  border-left: 1px solid var(--border);
}

.map-meta,
.detail-header,
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.map-meta {
  margin-bottom: 10px;
  align-items: start;
}

.map-meta-copy {
  min-width: 0;
}

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

.district-search {
  display: flex;
  align-items: stretch;
  width: min(320px, 100%);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(11, 22, 44, 0.06);
}

.district-search[hidden] {
  display: none;
}

.district-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--dblue);
  background: rgba(255, 255, 255, 0.96);
}

.district-search input::placeholder {
  color: #7b8593;
}

.district-search input:focus {
  outline: none;
}

.district-search button {
  border: 0;
  border-left: 1px solid var(--border);
  padding: 0 14px;
  font: inherit;
  font-size: 0.76rem;
  line-height: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--dblue);
  cursor: pointer;
}

.district-search button:hover,
.district-search button:focus {
  background: var(--red);
}

.map-meta p,
.detail-placeholder,
.detail-note {
  color: var(--muted);
}

.map-column,
.detail-panel,
.detail-header,
.detail-header > div,
.detail-body,
.modal-header {
  min-width: 0;
}

#map {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: auto;
  border: 1px solid #cbd3dd;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.layer-controls {
  display: none;
}

.layer-toggle,
.action-button,
.action-link {
  border: 0;
  font: inherit;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.layer-toggle,
.action-button {
  cursor: pointer;
}

.layer-toggle {
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  line-height: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--dblue);
  background-color: #a4a9b3;
  padding: 8px 12px;
}

.layer-toggle:hover {
  background-color: var(--white);
}

.layer-toggle.is-active {
  color: var(--white);
  background-color: var(--red);
}

.status-chip {
  flex-shrink: 0;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  border-left: 4px solid var(--red);
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-chip.is-busy {
  color: var(--dblue);
}

.detail-panel {
  display: flex;
  flex-direction: column;
}

.detail-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f4f5f7, #eceff3);
}

.detail-header,
.detail-body,
.modal-header {
  padding: 12px;
}

.detail-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.action-link,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 10px 12px;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  font-size: 0.76rem;
  line-height: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.action-link {
  background-color: var(--red);
  color: var(--white);
}

.action-link:hover,
.action-link:focus {
  background-color: var(--dblue);
  color: var(--white);
}

.action-button {
  background-color: var(--dblue);
  color: var(--white);
}

.action-button:hover,
.action-button:focus {
  background-color: var(--red);
  color: var(--white);
}

.action-link.is-disabled,
.action-button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.detail-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: linear-gradient(180deg, #f7f8fa, #f3f4f6);
}

.detail-body::before {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, rgba(11, 22, 44, 0.08), rgba(11, 22, 44, 0));
}

.detail-placeholder {
  padding: 12px;
  border-left: 4px solid var(--dblue);
  background: rgba(233, 237, 243, 0.92);
  line-height: 1.5;
}

.detail-empty-state {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #e4e8ee;
  background: rgba(255, 255, 255, 0.88);
  color: #c0c4cc;
  text-align: center;
  padding: 24px;
}

.detail-empty-browser {
  display: flex;
  gap: 6px;
  align-self: stretch;
  margin-bottom: auto;
}

.detail-empty-browser span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e0e3e8;
}

.detail-empty-icon {
  font-size: 42px;
  line-height: 1;
  opacity: 0.5;
}

.detail-empty-state h3 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.8rem;
  color: #c7c9ce;
}

.detail-empty-state p {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d0d3d8;
}

#detail-frame,
#modal-frame {
  display: none;
  width: 100%;
  min-height: 520px;
  border: 1px solid #dde3eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(11, 22, 44, 0.08);
}

#detail-frame {
  flex: 1;
  min-height: 0;
}

.detail-note {
  margin: 0;
}

#active-layer-label {
  max-width: 12ch;
}

#detail-title,
#modal-title {
  max-width: none;
  font-size: clamp(1.2rem, 1.45vw, 1.7rem);
  line-height: 1.02;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

#detail-title.is-code-title,
#modal-title.is-code-title {
  font-family: "Roboto Condensed", sans-serif;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

#map-instructions {
  max-width: 54ch;
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.3rem;
}

.action-link,
.action-button,
.layer-toggle,
.status-chip {
  overflow-wrap: anywhere;
}

.detail-header .eyebrow,
.map-meta .eyebrow {
  margin-bottom: 4px;
}

.detail-note {
  font-size: 9px;
  line-height: 1.1;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 99999;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(11, 22, 44, 0.75);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: min(1320px, calc(100vw - 32px));
  height: min(88vh, 960px);
  margin: 16px auto;
  padding: 12px;
  background-color: var(--dblue);
  box-shadow: var(--shadow);
}

.modal-header {
  background: var(--surface);
}

#modal-frame {
  display: block;
  flex: 1;
  min-height: 0;
  border-top: 0;
  background: var(--surface);
}

.leaflet-container {
  background: #d3d9df;
  filter: saturate(0.14) contrast(1.04) brightness(0.98);
}

.leaflet-interactive:focus,
.leaflet-container a:focus,
.leaflet-container button:focus {
  outline: none !important;
  box-shadow: none !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--dblue);
  color: var(--white);
}

.region-tooltip {
  font-weight: 700;
  border: 1px solid rgba(11, 22, 44, 0.12);
  color: var(--dblue);
}

.leaflet-tooltip.region-tooltip {
  background: var(--white);
  padding: 7px 9px;
  border-radius: 10px;
  max-width: min(240px, calc(100vw - 48px));
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  white-space: normal;
  box-shadow: 0 10px 20px rgba(11, 22, 44, 0.14);
}

.leaflet-tooltip.region-tooltip::before {
  border-top-color: var(--white);
}

@media (hover: hover) {
  .layer-toggle:hover,
  .action-button:hover,
  .action-link:hover {
    transform: translateY(-1px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .side-rail {
    min-height: auto;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(11, 22, 44, 0.98), rgba(22, 37, 63, 0.98));
    border-color: rgba(255, 255, 255, 0.08);
  }

  .side-rail-top,
  .side-rail-bottom {
    display: none;
  }

  .side-rail-nav {
    flex-direction: row;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  .rail-toggle,
  .rail-link {
    flex: 0 0 auto;
    width: 110px;
    min-width: 110px;
    min-height: 64px;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
  }

  .rail-toggle-label {
    overflow: visible;
    font-size: 11px;
    letter-spacing: 0.1em;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
    white-space: nowrap;
    text-wrap: nowrap;
  }

  .rail-toggle-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
  }

  .rail-toggle.layer-toggle.is-active {
    background: rgba(191, 4, 38, 0.12);
    border-color: rgba(191, 4, 38, 0.3);
  }

  .rail-toggle.layer-toggle.is-active .rail-toggle-icon {
    background: var(--red);
    color: var(--white);
    box-shadow: none;
  }

  .rail-toggle.layer-toggle.is-active .rail-toggle-label {
    color: var(--white);
  }

  .rail-toggle.layer-toggle:hover .rail-toggle-icon,
  .rail-link:hover .rail-toggle-icon,
  .rail-link:focus .rail-toggle-icon {
    background: rgba(191, 4, 38, 0.16);
    color: var(--white);
  }

  .rail-toggle.layer-toggle:hover .rail-toggle-label,
  .rail-link:hover .rail-toggle-label,
  .rail-link:focus .rail-toggle-label {
    color: var(--white);
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: 0;
  }

  #active-layer-label,
  #detail-title,
  #modal-title {
    max-width: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 2px 0 0;
  }

  .map-tools {
    align-items: flex-start;
    min-width: 0;
  }

  .map-card,
  .detail-panel {
    height: auto;
    min-height: 0;
  }

  #map {
    height: 62vh;
    min-height: 62vh;
    flex: none;
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding: 8px;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .side-rail {
    min-height: auto;
    padding: 6px 8px;
    background: linear-gradient(180deg, rgba(11, 22, 44, 0.98), rgba(22, 37, 63, 0.98));
    border-color: rgba(255, 255, 255, 0.08);
  }

  .side-rail-top,
  .side-rail-bottom {
    display: none;
  }

  .side-rail-nav {
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    padding: 0;
  }

  .rail-toggle,
  .rail-link {
    flex: 1 1 0;
    min-width: 78px;
    min-height: 44px;
    width: auto;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
  }

  .rail-toggle-icon {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
  }

  .rail-toggle-icon-districts::before {
    inset: 5px;
    box-shadow:
      4px 0 0 -3px currentColor,
      -4px 0 0 -3px currentColor,
      0 4px 0 -3px currentColor,
      0 -4px 0 -3px currentColor;
  }

  .rail-toggle-icon-states::before {
    width: 13px;
    height: 9px;
    top: 6px;
    left: 4px;
  }

  .rail-toggle-icon-home::before {
    width: 11px;
    height: 7px;
    left: 5px;
    bottom: 4px;
  }

  .rail-toggle-icon-home::after {
    width: 9px;
    height: 9px;
    left: 6px;
    top: 4px;
  }

  .rail-toggle-label {
    overflow: visible;
    font-size: 7px;
    letter-spacing: 0.07em;
    line-height: 1;
    white-space: nowrap;
    text-wrap: nowrap;
    color: rgba(255, 255, 255, 0.82);
  }

  .rail-toggle.layer-toggle.is-active {
    background: rgba(191, 4, 38, 0.12);
    border-color: rgba(191, 4, 38, 0.32);
  }

  .rail-toggle.layer-toggle.is-active .rail-toggle-icon {
    background: var(--red);
    color: var(--white);
    box-shadow: none;
  }

  .rail-toggle.layer-toggle.is-active .rail-toggle-label {
    color: var(--white);
  }

  .rail-toggle.layer-toggle:hover .rail-toggle-icon,
  .rail-link:hover .rail-toggle-icon,
  .rail-link:focus .rail-toggle-icon {
    background: rgba(191, 4, 38, 0.16);
    color: var(--white);
  }

  .rail-toggle.layer-toggle:hover .rail-toggle-label,
  .rail-link:hover .rail-toggle-label,
  .rail-link:focus .rail-toggle-label {
    color: var(--white);
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 8px;
  }

  .topbar,
  .map-meta,
  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .map-tabs {
    margin-bottom: 10px;
  }

  .topbar {
    padding: 0;
    margin: 0 auto 6px;
  }

  .hero-title {
    font-size: clamp(1.2rem, 5vw, 1.7rem);
    line-height: 0.92;
    max-width: none;
  }

  .eyebrow {
    margin: 0 0 4px;
    font-size: 8px;
    line-height: 8px;
    letter-spacing: 0.18em;
  }

  .topbar-copy {
    font-size: 0.62rem;
    line-height: 0.84rem;
    max-width: 100%;
  }

  .detail-actions {
    justify-content: stretch;
  }

  .map-tools {
    width: 100%;
  }

  .district-search {
    width: 100%;
  }

  .layer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-button,
  .action-link {
    flex: 1 1 0;
  }

  .detail-panel {
    height: 100vh;
    height: 100svh;
    min-height: 100vh;
    min-height: 100svh;
  }

  .detail-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    gap: 0;
  }

  .detail-body::before {
    display: none;
  }

  #map {
    height: 54vh;
    min-height: 54vh;
  }

  #detail-frame {
    min-height: 0;
    height: 100%;
  }

  .detail-note {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .map-card,
  .modal-header,
  .modal-panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .detail-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .detail-body {
    padding-left: 0;
    padding-right: 0;
  }

  .hero-title {
    font-size: clamp(1.05rem, 4.8vw, 1.45rem);
    line-height: 0.9;
    max-width: none;
  }

  .topbar-copy {
    font-size: 0.58rem;
    line-height: 0.78rem;
  }

  .section-title {
    font-size: clamp(1.2rem, 6vw, 1.5rem);
  }

  #map {
    height: 48vh;
    min-height: 48vh;
  }

  #detail-frame {
    min-height: 0;
  }

  .layer-controls {
    grid-template-columns: 1fr;
  }

  .layer-toggle,
  .action-button,
  .action-link {
    width: 100%;
  }

  #detail-title,
  #modal-title {
    font-size: 1.15rem;
    line-height: 1.05;
  }
}
