:root {
  --bg: #eee9df;
  --panel: #fbfaf7;
  --panel-strong: rgba(255, 255, 255, 0.76);
  --text: #172033;
  --muted: #566274;
  --line: #ded8cf;
  --line-soft: #e9e3da;
  --accent: #274e13;
  --accent-soft: #e7efdf;
  --radius: 7px;
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(100deg, #07192f 0%, #0a2038 58%, #0c2a46 100%);
  color: #fffdf8;
}

.eyebrow,
.section-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #fffdf8;
  font-size: clamp(1.85rem, 2.5vw, 2.55rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.topbar-title {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-logo {
  display: block;
  width: auto;
  max-width: 118px;
  max-height: 58px;
  object-fit: contain;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}


.control-group {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

select,
input,
button {
  font: inherit;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--text);
  outline: none;
}

select {
  min-height: 42px;
  padding: 10px 34px 10px 11px;
  cursor: pointer;
}

input {
  padding: 10px 11px;
}

select:focus,
input:focus {
  border-color: #6e8065;
  box-shadow: 0 0 0 2px rgba(39, 78, 19, 0.12);
}

button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e8e3d9;
  color: var(--text);
  padding: 9px 13px;
  font-weight: 650;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #ddd7cc;
}

.layout {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(380px, 25vw) minmax(0, 1fr);
}

.panel {
  position: relative;
  z-index: 20;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.92);
}

.summary-card,
.search-card,
.detail-card,
.rank-card {
  background: var(--panel-strong);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 1px 12px rgba(23, 32, 51, 0.06);
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(3px);
}

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

.kpi {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px;
  background: #f4f0e8;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.kpi strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

#clearButton {
  background: #e8e3d9;
  color: var(--text);
}

.detail-card h2 {
  margin: 0 0 12px;
  font-size: 1.12rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.turnout-hero {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.turnout-hero span {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.turnout-hero small {
  color: var(--muted);
  font-weight: 600;
}

.detail-list {
  margin: 0;
}

.detail-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.detail-list div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.84rem;
}

dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}

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

.record-count {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.data-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(255,255,255,0.44);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: #f8f5ee;
  text-align: left;
}

.data-table thead th:last-child {
  width: 34%;
  text-align: right;
}

.table-sort-button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  box-shadow: none;
}

.data-table thead th:last-child .table-sort-button {
  text-align: right;
}

.table-sort-button.is-active {
  color: var(--text);
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(106, 168, 79, 0.10);
}

.data-table tbody tr.is-selected {
  background: rgba(23, 32, 51, 0.08);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  line-height: 1.2;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td:first-child {
  font-weight: 650;
}

.data-table td:last-child {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

.source-note {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
  margin: 12px 3px 0;
}

.map-wrap {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #eeeded;
}

.atlas-map-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 760;
  display: grid;
  gap: 8px;
}

.map-tool-group {
  display: grid;
  width: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf8;
  overflow: hidden;
}

.map-tool-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: #fffdf8;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
}

.map-tool-button:last-child {
  border-bottom: 0;
}

.map-tool-button:hover,
.map-tool-button:focus-visible {
  background: #f1ede5;
}

.map-tool-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.map-hover-label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 720;
  max-width: min(320px, calc(100% - 20px));
  padding: 5px 7px;
  border: 1px solid #1e2a3a;
  border-radius: 3px;
  background: #fffdf8;
  color: var(--text);
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
  pointer-events: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.map-hover-label[hidden] {
  display: none;
}

.map-loading {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 700;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--muted);
  font-weight: 650;
}

.legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 700;
  min-width: 218px;
  padding: 12px;
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: none;
  border: 1px solid var(--line);
}

.legend-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legend-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 0.81rem;
  color: var(--text);
}

.legend-swatch {
  width: 22px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.16);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: none;
  border: 1px solid var(--line);
}

.leaflet-popup-tip {
  box-shadow: none;
}

.popup-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.popup-stat {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 5px 0;
}

.popup-stat span:first-child {
  color: var(--muted);
}

.popup-stat strong {
  font-weight: 650;
}

.ta-tooltip {
  padding: 4px 7px;
  border: 1px solid #1e2a3a;
  border-radius: 3px;
  background: #fffdf8;
  color: var(--text);
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 650;
}

.ta-tooltip::before {
  display: none;
}

.no-data {
  fill: #d8d3cb;
}

.leaflet-ta-pane {
  z-index: 430 !important;
}

.leaflet-outline-pane {
  z-index: 650 !important;
}
/* Keep Leaflet clipped to the map column without resizing its internal SVG/canvas.
   Do not set max-width on Leaflet panes or SVGs: that breaks Leaflet's
   coordinate maths and makes hover/click hit-testing drift away from polygons. */
.leaflet-container {
  overflow: hidden !important;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-pane > svg,
.leaflet-pane > canvas {
  max-width: none !important;
}

.leaflet-zoom-box {
  display: none !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}

.leaflet-control-zoom a {
  background: #fffdf8 !important;
  color: var(--text) !important;
}

.leaflet-control-attribution {
  border: 1px solid var(--line) !important;
  background: rgba(255, 253, 248, 0.92) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

.leaflet-interactive {
  cursor: pointer;
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; height: auto; }
  .topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(100deg, #07192f 0%, #0a2038 58%, #0c2a46 100%);
  color: #fffdf8;
}
    .layout { grid-template-columns: 1fr; }
  .panel {
  position: relative;
  z-index: 20;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.92);
}
  .map-wrap { min-height: 62vh; }
  .legend { left: 14px; right: auto; bottom: 14px; }
}

/* Popups are disabled in app.js; keep Leaflet popup pane from showing stale/broken click cards if a cached layer tries to open one. */
.leaflet-popup-pane { display: none; }


/* Floating map filters */
.map-floating-filters {
  position: absolute;
  right: 18px;
  bottom: 178px;
  z-index: 710;
  display: grid;
  gap: 8px;
  width: 218px;
  max-width: calc(100% - 36px);
}

.floating-control {
  position: relative;
}

.floating-toggle-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--text);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
}

.floating-toggle-button::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
}

.floating-toggle-button[aria-expanded="true"]::after {
  content: "▴";
}

.floating-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  bottom: auto;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: 0 2px 12px rgba(23, 32, 51, 0.12);
  z-index: 760;
}

.floating-panel[hidden] {
  display: none;
}

.floating-panel-title {
  margin: 2px 4px 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.floating-option-list {
  display: grid;
  gap: 4px;
}

.floating-option {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.83rem;
  font-weight: 600;
}

.floating-option:hover,
.floating-option:focus-visible {
  background: #f1ede5;
}

.floating-option.is-active {
  background: #ece8dd;
  border-color: var(--line);
}

@media (max-width: 800px) {
  .map-floating-filters,
  .legend {
    right: 12px;
  }

  .map-floating-filters {
    width: 206px;
    bottom: 168px;
  }

  .legend {
    min-width: 206px;
  }
}

.floating-option:disabled {
  color: #8d887e;
  cursor: not-allowed;
  opacity: 0.68;
}

.floating-option:disabled:hover,
.floating-option:disabled:focus-visible {
  background: transparent;
}


/* Right-side map controls and flexible legend */
.map-right-stack {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 710;
  width: 218px;
  max-width: calc(100% - 36px);
  max-height: calc(100% - 36px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.map-right-stack .map-floating-filters,
.map-right-stack .legend {
  pointer-events: auto;
}

.map-right-stack .map-floating-filters {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
}

.map-right-stack .legend {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  min-width: 0;
  max-height: min(48vh, 360px);
  overflow-y: auto;
  flex: 0 1 auto;
}

.map-right-stack .legend-title {
  line-height: 1.15;
}

.map-right-stack .legend-row {
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  line-height: 1.18;
}

.map-right-stack .legend-swatch {
  width: 20px;
  margin-top: 1px;
}

.map-right-stack .floating-panel {
  position: static;
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: 0 2px 12px rgba(23, 32, 51, 0.12);
}

@media (max-width: 800px) {
  .map-right-stack {
    right: 12px;
    bottom: 12px;
    width: 206px;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
  }

  .map-right-stack .legend {
    min-width: 0;
    max-height: min(45vh, 320px);
  }
}


@media (max-width: 1200px) {
  .layout {
    grid-template-columns: minmax(430px, 520px) minmax(0, 1fr);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(520px, 36vw) minmax(0, 1fr);
  }
}


@media (max-width: 700px) {
  .topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(100deg, #07192f 0%, #0a2038 58%, #0c2a46 100%);
  color: #fffdf8;
}

  .topbar-logo {
  display: block;
  width: auto;
  max-width: 118px;
  max-height: 58px;
  object-fit: contain;
}
}


/* Artist-impression layout tweaks */
.summary-card {
  display: none;
}

.map-right-stack {
  position: absolute;
  inset: 18px 20px 18px auto;
  z-index: 710;
  width: 230px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
}

.map-floating-filters {
  position: static;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: none;
  pointer-events: auto;
}

.legend {
  position: static;
  right: auto;
  bottom: auto;
  width: 100%;
  min-width: 0;
  margin-top: auto;
  pointer-events: auto;
  max-height: min(42vh, 360px);
  overflow: auto;
}

.floating-toggle-button {
  min-height: 46px;
  padding: 11px 13px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 2px 10px rgba(23, 32, 51, 0.10);
}

.floating-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  bottom: auto;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: 0 2px 12px rgba(23, 32, 51, 0.12);
  z-index: 760;
}

.search-card {
  margin-top: 0;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: minmax(430px, 42vw) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 370px minmax(0, 1fr);
  }

  .map-right-stack {
    width: 210px;
    right: 12px;
    top: 12px;
    bottom: 12px;
  }
}


/* Top-right dropdown behaviour */
.floating-control {
  position: relative;
  z-index: 1;
}

.floating-control:has(.floating-toggle-button[aria-expanded="true"]) {
  z-index: 20;
}

.map-floating-filters {
  overflow: visible;
}

.map-right-stack {
  overflow: visible;
}


/* Controlled authority dropdown: avoids stale native-select state after reload. */
.authority-picker {
  position: relative;
  min-width: 0;
}

.authority-picker-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--text);
  text-align: left;
  font-weight: 400;
}

.authority-picker-button::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
}

.authority-picker-button[aria-expanded="true"]::after {
  content: "▴";
}

.authority-picker-button.is-placeholder {
  color: var(--muted);
}

.authority-picker-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 900;
  max-height: min(340px, 52vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: 0 4px 18px rgba(23, 32, 51, 0.15);
}

.authority-picker-panel[hidden] {
  display: none;
}

.authority-picker-option {
  width: 100%;
  display: block;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 500;
}

.authority-picker-option:hover,
.authority-picker-option:focus-visible {
  background: #f1ede5;
}

.authority-picker-option.is-active {
  background: #ece8dd;
  border-color: var(--line);
}


/* Authority picker should float above the selected-area card */
.search-card {
  position: relative;
  z-index: 80;
}

.search-card:has(.authority-picker-button[aria-expanded="true"]) {
  z-index: 220;
}

.detail-card,
.rank-card {
  position: relative;
  z-index: 1;
}

.authority-picker-panel {
  z-index: 5000;
  max-height: min(420px, 62vh);
}

/* More compact selected-area detail table */
.detail-card {
  padding-top: 12px;
  padding-bottom: 12px;
}

.detail-card h2 {
  margin-bottom: 8px;
}

.turnout-hero {
  margin-bottom: 8px;
  padding-bottom: 9px;
}

.turnout-hero span {
  font-size: 1.75rem;
}

.turnout-hero small {
  font-size: 0.78rem;
}

.detail-list div {
  padding: 5px 0;
  gap: 12px;
}

dt {
  font-size: 0.78rem;
}

dd {
  font-size: 0.82rem;
}



/* About modal */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.about-button {
  border: 1px solid rgba(255,255,255,0.32);
  background: rgba(255,255,255,0.09);
  color: #fffdf8;
  box-shadow: none;
}

.about-button:hover {
  background: rgba(255,255,255,0.16);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(7, 20, 38, 0.44);
}

.modal-backdrop[hidden] {
  display: none;
}

.about-modal {
  width: min(780px, calc(100vw - 42px));
  max-height: min(820px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  background: #fbfaf7;
  box-shadow: 0 18px 48px rgba(7, 20, 38, 0.28);
  color: var(--text);
}

.about-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8f5ee;
}

.about-modal-header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.modal-close-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 5px;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: none;
}

.about-modal-body {
  max-height: calc(min(820px, 100vh - 56px) - 82px);
  overflow: auto;
  padding: 18px 22px 22px;
}

.about-modal-body p {
  margin: 0 0 13px;
  color: var(--muted);
  line-height: 1.48;
}

.about-modal-body h3 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 0.86rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.about-modal-body ul {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--muted);
  line-height: 1.45;
}

.about-modal-body li + li {
  margin-top: 5px;
}

.about-glossary {
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.about-glossary div {
  display: grid;
  grid-template-columns: minmax(150px, 0.44fr) minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.about-glossary dt {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 750;
}

.about-glossary dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.38;
  text-align: left;
}

@media (max-width: 720px) {
  .topbar-actions {
    gap: 10px;
  }

  .about-button {
    padding: 8px 10px;
  }

  .about-glossary div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}



/* Election Services website-style branding refresh.
   Layout and functionality are intentionally unchanged. */
:root {
  --bg: #eef4f3;
  --panel: #ffffff;
  --panel-strong: rgba(255, 255, 255, 0.88);
  --text: #173f47;
  --muted: #6d9188;
  --line: #cfded9;
  --line-soft: #e5eeeb;
  --accent: #156570;
  --accent-soft: #edf7f6;
  --brand-moss: #7CA295;
  --brand-lime: #D6E342;
  --brand-mint: #9CDCD9;
  --brand-aqua: #156570;
}

html,
body {
  background: var(--bg);
}

.topbar {
  min-height: 82px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.96), rgba(255,255,255,0.90)),
    url("brand_background.png") center 42% / cover no-repeat,
    #ffffff;
  color: var(--text);
  box-shadow: 0 1px 10px rgba(21, 101, 112, 0.08);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: url("brand_pattern.png") center center / cover no-repeat;
  pointer-events: none;
}

h1 {
  color: var(--brand-aqua);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.topbar-logo {
  max-width: 126px;
  max-height: 58px;
  filter: none;
}

.about-button {
  border-color: rgba(124, 162, 149, 0.58);
  background: rgba(255,255,255,0.72);
  color: var(--brand-aqua);
}

.about-button:hover,
.about-button:focus-visible {
  background: var(--accent-soft);
  border-color: var(--brand-aqua);
}

.panel {
  background:
    linear-gradient(rgba(246,250,249,0.92), rgba(246,250,249,0.92)),
    url("brand_background.png") left bottom / 760px auto no-repeat;
  border-right-color: var(--line);
}

.summary-card,
.search-card,
.detail-card,
.rank-card,
.legend,
.floating-toggle-button,
.floating-panel,
.authority-picker-panel,
.about-modal {
  border-color: var(--line);
  background-color: rgba(255, 255, 255, 0.90);
  box-shadow: 0 2px 13px rgba(21, 101, 112, 0.08);
}

.summary-card,
.search-card,
.detail-card,
.rank-card {
  background:
    linear-gradient(rgba(255,255,255,0.91), rgba(255,255,255,0.91)),
    url("brand_background.png") right bottom / 520px auto no-repeat;
}

.eyebrow,
.section-label,
label,
.legend-title,
.floating-panel-title,
.record-count,
.table-sort-button {
  color: var(--brand-moss);
}

.detail-card h2,
.kpi strong,
.data-table td:first-child,
.floating-toggle-button,
.authority-picker-button,
.about-modal-header h2 {
  color: var(--text);
}

button {
  border-color: var(--line);
}

button:hover,
button:focus-visible {
  border-color: rgba(21, 101, 112, 0.45);
  box-shadow: 0 0 0 2px rgba(156, 220, 217, 0.28);
}

#clearButton {
  border-color: var(--brand-moss);
  background: var(--brand-moss);
  color: #ffffff;
}

#clearButton:hover,
#clearButton:focus-visible {
  background: var(--brand-aqua);
  border-color: var(--brand-aqua);
}

select,
input,
.authority-picker-button {
  border-color: var(--line);
  background: rgba(255,255,255,0.94);
}

select:focus,
input:focus,
.authority-picker-button:focus-visible {
  border-color: var(--brand-aqua);
  box-shadow: 0 0 0 2px rgba(156, 220, 217, 0.35);
}

.turnout-hero {
  border-bottom-color: var(--line);
}

.turnout-hero span {
  color: var(--brand-aqua);
}

.turnout-hero small::before {
  background: var(--brand-aqua);
}

.detail-list div,
.data-table td,
.data-table thead th {
  border-color: var(--line-soft);
}

.data-table thead th,
.about-modal-header {
  background: #f4f8f7;
}

.table-sort-button.is-active,
.data-table td:last-child {
  color: var(--brand-aqua);
}

.data-table tbody tr:hover {
  background: rgba(156, 220, 217, 0.13);
}

.data-table tbody tr.is-selected,
.floating-option.is-active,
.authority-picker-option.is-active,
.authority-picker-option[aria-selected="true"] {
  background: rgba(214, 227, 66, 0.18);
  border-color: rgba(124, 162, 149, 0.34);
}

.floating-option:hover,
.floating-option:focus-visible,
.authority-picker-option:hover,
.authority-picker-option:focus-visible {
  background: rgba(156, 220, 217, 0.16);
}

#map {
  background:
    linear-gradient(rgba(246,250,249,0.86), rgba(246,250,249,0.86)),
    url("brand_background.png") right bottom / min(900px, 64vw) auto no-repeat,
    #eef4f3;
}

.leaflet-control-zoom a,
.leaflet-bar a,
.leaflet-control-home {
  color: var(--brand-aqua) !important;
  background: rgba(255,255,255,0.94) !important;
  border-color: var(--line) !important;
}

.leaflet-control-zoom a:hover,
.leaflet-bar a:hover,
.leaflet-control-home:hover {
  background: var(--accent-soft) !important;
}

.ta-tooltip {
  border-color: var(--brand-aqua);
  color: var(--text);
}

.modal-backdrop {
  background: rgba(21, 101, 112, 0.34);
}

.modal-close-button {
  color: var(--brand-aqua);
  background: #ffffff;
}

.about-modal-body h3 {
  color: var(--brand-aqua);
}

.about-glossary dt {
  color: var(--brand-aqua);
}

.source-note {
  color: rgba(23, 63, 71, 0.66);
}



/* Minor brand-refresh fixes */
.topbar {
  padding-top: 25px;
}

.topbar::before {
  height: 14px;
}

/* Keep the About overlay neutral so the app does not turn teal when opened */
.modal-backdrop {
  background: rgba(10, 24, 28, 0.14);
}

/* Make picker panels fully opaque so underlying data does not show through */
.authority-picker-panel {
  background: #ffffff !important;
  backdrop-filter: none !important;
}

.authority-picker-option {
  background: #ffffff;
}

.authority-picker-option.is-active,
.authority-picker-option[aria-selected="true"] {
  background: rgba(214, 227, 66, 0.22);
}

.authority-picker-option:hover,
.authority-picker-option:focus-visible {
  background: rgba(156, 220, 217, 0.22);
}



/* Make About dialog fully opaque */
.about-modal,
.about-modal-body,
.about-modal-header {
  background-image: none !important;
  background-color: #ffffff !important;
  backdrop-filter: none !important;
}

.about-modal-body {
  background: #ffffff !important;
}

.about-glossary,
.about-glossary div {
  background: #ffffff;
}

