:root {
  color-scheme: dark;
  --background: #171c20 !important;
  --foreground: #f4f7f1 !important;
  --card: #22292e !important;
  --card-foreground: #f4f7f1 !important;
  --popover: #252d32 !important;
  --popover-foreground: #f4f7f1 !important;
  --primary: #b7f34a !important;
  --primary-foreground: #17210d !important;
  --secondary: #293138 !important;
  --secondary-foreground: #f4f7f1 !important;
  --muted: #303940 !important;
  --muted-foreground: #aeb9b1 !important;
  --accent: #33421d !important;
  --accent-foreground: #d8ff8f !important;
  --border: #3d474e !important;
  --input: #111619 !important;
  --ring: #b7f34a !important;
  --viz-accent: #b7f34a !important;
  --viz-accent-text: #17210d !important;
  --viz-accent-bg: #33421d !important;
  --viz-text: #f4f7f1 !important;
  --viz-muted: #aeb9b1 !important;
  --viz-border: #3d474e !important;
}

html,
body,
.app,
#osm-planning-app,
#ni-collision-map-app {
  background: #171c20 !important;
  color: #f4f7f1 !important;
}

body {
  accent-color: #b7f34a;
}

a {
  color: #c8fa6b;
}

.toolbar,
.collision-meta,
#osm-planning-meta {
  background: #1b2125 !important;
  color: #f4f7f1 !important;
  border-color: #3d474e !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .3) !important;
}

.toolbar,
.collision-meta,
#osm-planning-meta,
.control-panel,
.details,
.map-details,
.results-panel,
.demographics-panel,
.panel,
.hint,
.card,
fieldset,
.viewport-summary,
.study-group,
.study-heading,
.study-actions,
.summary-card,
.status,
.data-date {
  border-color: #3d474e !important;
}

.control-panel,
.details,
.map-details,
.results-panel,
.demographics-panel,
.panel,
.hint,
.card,
.collision-controls fieldset,
.collision-report-area-controls fieldset,
.planning-controls fieldset,
#osm-proposal-search,
.viewport-summary {
  background: rgba(31, 38, 43, .96) !important;
  color: #f4f7f1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .34) !important;
}

.details-head,
.map-details-head,
.results-head,
.study-actions,
.study-heading,
.study-group,
.summary-card,
.status,
.data-date {
  background: #252d32 !important;
  color: #f4f7f1 !important;
}

.study-heading.active {
  background: #33421d !important;
}

.travel-isochrones-page .title,
.travel-isochrones-page .results-title,
.travel-isochrones-page .demographics-panel h2,
.travel-isochrones-page .panel h2,
.travel-isochrones-page .controls label,
.travel-isochrones-page .demographics-panel label,
.travel-isochrones-page .townlands-option label,
.travel-isochrones-page .hd-boundary-menu summary,
.travel-isochrones-page .hd-boundary-option label,
.travel-isochrones-page .study-heading,
.travel-isochrones-page .study-name {
  color: #fff !important;
  font-weight: 700 !important;
}

.sub,
.control-panel > p,
.details-empty,
.details-head p,
.map-details-head p,
.results-sub,
.empty-result,
.demographics-panel p,
.source-note,
.legend small,
.layer-option small,
.townlands-option small,
.hd-boundary-option small,
.small,
.field-label,
.detail-table th,
.study-place,
.legend-labels,
#osm-proposal-match-count,
#osm-planning-detail .field-label {
  color: #aeb9b1 !important;
}

.hd-boundary-menu {
  margin: 10px 0 0;
  padding: 0;
  border: 1px solid #465159 !important;
  border-radius: 8px;
  background: #20272c !important;
  overflow: hidden;
}

.hd-boundary-menu > summary {
  position: relative;
  cursor: pointer;
  list-style: none;
  padding: 10px 36px 10px 11px;
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}

.hd-boundary-menu > summary::-webkit-details-marker { display: none; }
.hd-boundary-menu > summary::after {
  content: "⌄";
  position: absolute;
  top: 8px;
  right: 12px;
  color: #b7f34a;
  font-size: 16px;
  line-height: 1;
  transition: transform .16s ease;
}
.hd-boundary-menu[open] > summary::after { transform: rotate(180deg); }
.hd-boundary-menu > summary:hover,
.hd-boundary-menu > summary:focus-visible { background: #33421d !important; outline: 0; }
.hd-boundary-options { border-top: 1px solid #3d474e; padding: 2px 10px 8px; }
.hd-boundary-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  padding: 8px 0;
  border-bottom: 1px solid #343e44;
}
.hd-boundary-option:last-child { border-bottom: 0; }
.hd-boundary-option input { grid-row: 1 / 3; width: 17px; height: 17px; min-height: 0; margin: 1px 0 0; }
.hd-boundary-option label { color: #fff !important; font-size: 12px; font-weight: 700; }
.hd-boundary-option small { font-size: 9px; line-height: 1.35; }
.hd-boundary-tooltip {
  border: 1px solid #465159 !important;
  background: rgba(24, 30, 34, .96) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.hd-county-tooltip { border-color: #b7f34a !important; }
.hd-council-tooltip { border-color: #38bdf8 !important; }

input,
select,
textarea,
button,
.btn,
#osm-proposal-search input,
#osm-proposal-search button {
  border-color: #465159 !important;
  background: #151a1e !important;
  color: #f4f7f1 !important;
}

input::placeholder,
textarea::placeholder {
  color: #8f9b94 !important;
  opacity: 1;
}

button:hover,
button:focus-visible,
.btn:hover,
.btn:focus-visible,
#osm-proposal-search button:hover {
  border-color: #b7f34a !important;
  background: #33421d !important;
  color: #e5ffb4 !important;
}

.primary,
.add-study,
.focus-result,
#collision-generate-report,
.btn-primary,
button[aria-pressed="true"],
.btn[aria-pressed="true"],
.btn[aria-selected="true"],
.btn.is-selected {
  border-color: #b7f34a !important;
  background: #b7f34a !important;
  color: #17210d !important;
}

.primary:hover,
.add-study:hover,
.focus-result:hover,
#collision-generate-report:hover,
.btn-primary:hover {
  background: #a3e635 !important;
  color: #17210d !important;
}

.asset-type {
  background: #33421d !important;
  color: #d8ff8f !important;
}

.detail-table th,
.detail-table td,
.stats-table th,
.stats-table td,
.collision-report-table th,
.collision-report-table td,
.comparison-table th,
.comparison-table td,
.layer-option,
.result-row,
.landing-footer {
  border-color: #3d474e !important;
}

.comparison-table thead th,
.comparison-table tbody th,
.stats-table thead th,
.collision-report-table thead th {
  background: #252d32 !important;
  color: #f4f7f1 !important;
}

.stats-note {
  background: #3a331d !important;
  color: #f7dda0 !important;
}

.modal {
  background: rgba(7, 10, 12, .82) !important;
}

.brand,
.landing-logo,
.results-logo,
.hd-map-brand img {
  filter: invert(1) brightness(1.45);
}

.leaflet-bar a,
.leaflet-control-layers,
.leaflet-control-geocoder,
.leaflet-control-geocoder-form input,
.leaflet-control-geocoder-alternatives,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #20272c !important;
  color: #f4f7f1 !important;
  border-color: #465159 !important;
}

.leaflet-bar a {
  border-bottom-color: #465159 !important;
}

.leaflet-bar a:hover {
  background: #33421d !important;
  color: #d8ff8f !important;
}

.leaflet-control-attribution {
  background: rgba(23, 28, 32, .88) !important;
  color: #b8c2bc !important;
}

.leaflet-control-attribution a {
  color: #c8fa6b !important;
}

.leaflet-control-scale-line,
.hd-measure-button,
.hd-measure-readout {
  border-color: #59656d !important;
  background: rgba(31, 38, 43, .96) !important;
  color: #f4f7f1 !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35) !important;
}

.hd-measure-button:hover,
.hd-measure-button[aria-pressed="true"] {
  border-color: #b7f34a !important;
  background: #b7f34a !important;
  color: #17210d !important;
}

.hd-measure-readout small {
  color: #aeb9b1 !important;
}

.hd-measure-pin {
  border-color: #e5ffb4 !important;
  background: #7aa719 !important;
  color: #fff !important;
}

.hd-townland-tooltip,
.study-marker-label,
.catchment-map-label span {
  border-color: #8dbb2d !important;
  background: rgba(31, 38, 43, .94) !important;
  color: #e5ffb4 !important;
}

@media print {
  #collision-report,
  #collision-report * {
    color-scheme: light;
  }
}
