:root {
  --ink: #142b2f;
  --muted: #617174;
  --paper: #f7f4ed;
  --panel: #fffdf8;
  --line: #dce1dc;
  --teal: #176a70;
  --teal-dark: #123f45;
  --teal-pale: #e0efed;
  --coral: #e5684c;
  --gold: #e1ad42;
  --shadow: 0 18px 48px rgba(20, 43, 47, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
#map:focus-visible {
  outline: 3px solid rgba(23, 106, 112, 0.34);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 3000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--teal-dark);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: relative;
  z-index: 1100;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  color: white;
  background: var(--teal-dark);
  box-shadow: 0 2px 12px rgba(6, 31, 34, 0.2);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.brand p {
  margin: 5px 0 0;
  overflow: hidden;
  color: #bad1d1;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px 10px 10px 3px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  display: block;
  background: #9fd0c8;
  border-radius: 2px 2px 0 0;
}

.brand-mark span:nth-child(1) { height: 10px; }
.brand-mark span:nth-child(2) { height: 18px; background: #f0c36a; }
.brand-mark span:nth-child(3) { height: 14px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.read-only-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: #d9e7e5;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.read-only-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72d6ac;
  box-shadow: 0 0 0 3px rgba(114, 214, 172, 0.12);
}

.icon-button {
  padding: 8px 12px;
  color: white;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: transparent;
}

.filter-button {
  display: none;
}

.mobile-sidebar-header,
.sidebar-backdrop {
  display: none;
}

.workspace {
  height: calc(100% - 70px);
  min-height: 0;
  display: grid;
  grid-template-columns: 356px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.sidebar {
  position: relative;
  z-index: 1000;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 5px 0 22px rgba(24, 54, 58, 0.07);
}

.search-section {
  position: relative;
  z-index: 10;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.search-section label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.015em;
}

.search-box {
  height: 43px;
  display: flex;
  align-items: center;
  border: 1px solid #c6cfca;
  border-radius: 10px;
  background: white;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 106, 112, 0.11);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-left: 12px;
  fill: none;
  stroke: #6f807d;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 8px;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder {
  color: #929e9b;
}

.search-box button {
  height: 31px;
  margin-right: 5px;
  padding: 0 11px;
  color: white;
  font-size: 11px;
  font-weight: 750;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
}

.search-results {
  position: absolute;
  top: calc(100% - 10px);
  left: 18px;
  right: 18px;
  max-height: min(440px, calc(100vh - 190px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px;
  text-align: left;
  color: var(--ink);
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.search-result:hover,
.search-result:focus-visible {
  background: #eef5f3;
}

.result-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 8px;
  background: var(--teal-pale);
}

.result-copy {
  min-width: 0;
}

.result-copy strong,
.result-copy small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result-copy strong {
  font-size: 12px;
}

.result-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.search-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.filter-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.filter-section h2,
.detail-header h2 {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.2;
}

.section-heading h2 {
  margin-bottom: 14px;
}

.text-button {
  padding: 3px 0;
  color: var(--teal);
  font-size: 10px;
  font-weight: 750;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
}

.text-button:hover {
  border-color: currentColor;
}

.dependent-filters .field:last-of-type {
  margin-bottom: 6px;
}

.field-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.zone-legend {
  margin: 0 0 12px;
  border: 1px solid #d8e0dc;
  border-radius: 9px;
  background: #f8faf7;
}

.zone-legend[hidden] {
  display: none;
}

.zone-legend summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  color: #405457;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

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

.zone-legend summary::after {
  content: "+";
  color: var(--teal);
  font-size: 14px;
  line-height: 1;
}

.zone-legend[open] summary::after {
  content: "−";
}

.zone-legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
}

.zone-legend-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.zone-legend-item.is-selected {
  border-color: #80aaa6;
  background: #e7f1ef;
}

.zone-legend-swatch {
  width: 15px;
  height: 15px;
  border: 2px solid;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.zone-legend-item span,
.zone-legend-item strong,
.zone-legend-item small {
  min-width: 0;
  display: block;
}

.zone-legend-item strong {
  font-size: 9px;
  line-height: 1.2;
}

.zone-legend-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field > span,
.pipeline-control legend {
  display: block;
  margin-bottom: 6px;
  color: #405457;
  font-size: 10px;
  font-weight: 720;
}

.field select,
.field input {
  width: 100%;
  height: 37px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 11px;
  border: 1px solid #cbd3cf;
  border-radius: 8px;
  outline: 0;
  background: white;
}

.field select:focus,
.field input:focus {
  border-color: var(--teal);
}

.field select:disabled,
.field input:disabled {
  color: #788683;
  border-color: #d9dfdc;
  background: #f0f2ef;
  cursor: not-allowed;
}

.application-filter-block {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcf8;
}

.application-filter-block.is-enabled {
  border-color: rgba(229, 104, 76, 0.5);
  background: #fffaf7;
}

.application-filter-toggle {
  padding: 8px;
  border-radius: 0;
}

.application-filter-toggle:hover {
  background: rgba(229, 104, 76, 0.07);
}

.application-filter-options {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: white;
}

.application-filter-options[hidden] {
  display: none;
}

.application-filter-options .field {
  margin-bottom: 12px;
}

.pipeline-control {
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 9px;
  background: #e9ece8;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 7px 3px;
  overflow: hidden;
  color: #667674;
  font-size: 9px;
  font-weight: 750;
  text-align: center;
  white-space: nowrap;
  border-radius: 7px;
}

.segmented input:checked + span {
  color: var(--teal-dark);
  background: white;
  box-shadow: 0 1px 4px rgba(20, 43, 47, 0.13);
}

.segmented input:focus-visible + span {
  outline: 3px solid rgba(23, 106, 112, 0.28);
}

.layer-list {
  display: grid;
  gap: 5px;
}

.layer-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 15px 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 8px;
}

.layer-row:hover {
  background: #f3f5f1;
}

.layer-row input,
.map-mode-grid input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--teal);
}

.layer-symbol {
  width: 21px;
  height: 21px;
  justify-self: center;
}

.zoning-symbol {
  border: 2px solid #2f7fb5;
  background: rgba(88, 168, 219, 0.35);
  transform: rotate(7deg);
}

.lot-symbol {
  border: 2px solid #26383a;
  background: transparent;
}

.application-symbol {
  width: 14px;
  height: 14px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}

.amenity-symbol {
  width: 17px;
  height: 17px;
  border-radius: 50% 50% 50% 3px;
  background: #3b956d;
  transform: rotate(-45deg);
}

.layer-label {
  min-width: 0;
}

.layer-label strong,
.layer-label small {
  display: block;
}

.layer-label strong {
  font-size: 11px;
  font-weight: 720;
}

.layer-label small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.layer-count {
  min-width: 22px;
  padding: 3px 5px;
  color: #61716e;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-radius: 999px;
  background: #e9ede9;
}

.section-help {
  margin: -7px 0 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.map-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.map-mode-option {
  display: grid;
  grid-template-columns: 14px 8px 1fr;
  align-items: center;
  gap: 7px;
  padding: 8px;
  color: #3e5153;
  font-size: 10px;
  font-weight: 650;
  border: 1px solid #dce2dd;
  border-radius: 8px;
  background: #fbfcf9;
}

.map-mode-option:hover {
  border-color: #b9cbc6;
  background: #f4f8f5;
}

.map-mode-option:has(input:checked) {
  color: var(--teal-dark);
  border-color: #80aaa6;
  background: #e7f1ef;
  box-shadow: inset 0 0 0 1px rgba(23, 106, 112, 0.08);
}

.map-mode-option-wide {
  grid-column: 1 / -1;
}

.map-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.map-mode-dot.zoning { background: #278da3; }
.map-mode-dot.heritage { background: #9a4a7a; }
.map-mode-dot.hazard { background: #e06c42; }
.map-mode-dot.biodiversity { background: #33885d; }
.map-mode-dot.environment { background: #8b7a35; }
.map-mode-dot.schools { background: #2e79a7; }

.map-mode-help {
  min-height: 31px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.school-controls {
  display: grid;
  gap: 9px;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid #cbdedc;
  border-radius: 9px;
  background: #f4f9f8;
}

.school-controls[hidden],
.selected-school[hidden] {
  display: none;
}

.school-level-control {
  margin: 0;
  padding: 0;
  border: 0;
}

.school-level-control legend {
  margin-bottom: 6px;
  color: #405457;
  font-size: 9px;
  font-weight: 720;
}

.school-colour-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 8px;
}

.school-colour-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.school-colour-key i {
  width: 15px;
  height: 0;
  border-top: 3px solid;
}

.school-colour-key i.primary { border-color: #0c4f78; }
.school-colour-key i.secondary { border-color: #4e347d; }
.school-colour-key i.future {
  border-color: #8b5708;
  border-top-style: dashed;
}

.selected-school {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  background: white;
}

.selected-school span,
.selected-school small,
.selected-school strong {
  min-width: 0;
  display: block;
}

.selected-school small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-school strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.selected-school button {
  flex: 0 0 auto;
  padding: 5px 7px;
  color: var(--teal-dark);
  font-size: 8px;
  font-weight: 750;
  border: 1px solid #b9cfca;
  border-radius: 6px;
  background: #edf5f2;
}

.school-controls > p {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.45;
}

body[data-map-mode]:not([data-map-mode="zoning"]) .zone-legend {
  display: none;
}

/* Leaflet's canvas renderer can retain its last painted frame after a
   GeoJSON layer is cleared. Hide the inactive thematic pane as well as
   clearing its data so two map views can never appear simultaneously. */
body[data-map-mode="zoning"] #map .leaflet-constraint-pane,
body[data-map-mode="schools"] #map .leaflet-constraint-pane,
body[data-map-mode]:not([data-map-mode="schools"]) #map .leaflet-school-pane,
body[data-map-mode]:not([data-map-mode="zoning"]) #map .leaflet-zoning-pane {
  visibility: hidden;
  pointer-events: none;
}

body[data-map-mode]:not([data-map-mode="zoning"]) #map .leaflet-tile-pane {
  filter: grayscale(0.78) saturate(0.35) brightness(1.06);
}

body[data-map-mode]:not([data-map-mode="zoning"]) #map .leaflet-application-pane {
  filter: grayscale(1);
  opacity: 0.36;
}

.layer-feedback {
  min-height: 32px;
  margin-top: 12px;
  padding: 8px 10px;
  color: #526562;
  font-size: 9px;
  line-height: 1.45;
  border-left: 3px solid #adc9c4;
  background: #edf4f1;
}

.screening-note {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  margin: 14px;
  padding: 12px;
  color: #5e5233;
  border: 1px solid #e6d9af;
  border-radius: 9px;
  background: #fff8df;
}

.screening-note svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #9d7a26;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screening-note p {
  margin: 0;
  font-size: 9px;
  line-height: 1.5;
}

.map-region {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: #dfe8e4;
}

.map-readout,
.zoom-hint {
  position: absolute;
  z-index: 800;
  pointer-events: none;
  border: 1px solid rgba(23, 64, 69, 0.12);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 3px 14px rgba(20, 43, 47, 0.12);
  backdrop-filter: blur(8px);
}

.map-readout {
  left: 14px;
  bottom: 25px;
  max-width: min(620px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: #405356;
  font-size: 10px;
  border-radius: 8px;
}

.map-readout.is-error {
  color: #8a3528;
  border-color: #e4b3aa;
  background: rgba(255, 241, 237, 0.96);
}

.spinner {
  width: 11px;
  height: 11px;
  display: none;
  flex: 0 0 auto;
  border: 2px solid #aac1bd;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.map-readout.is-loading .spinner {
  display: block;
}

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

.zoom-hint {
  top: 14px;
  left: 50%;
  padding: 7px 11px;
  color: #516461;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  transform: translateX(-50%);
  transition: opacity 150ms ease;
}

.zoom-hint[hidden] {
  display: none;
}

.detail-panel {
  position: absolute;
  z-index: 900;
  top: 14px;
  right: 14px;
  bottom: 46px;
  width: min(390px, calc(100% - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(30, 62, 66, 0.13);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 30px));
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 180ms ease;
}

.detail-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 0;
  font-size: 19px;
}

.close-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  color: #50615f;
  font-size: 23px;
  font-weight: 300;
  line-height: 1;
  border: 1px solid #d5ddda;
  border-radius: 50%;
  background: white;
}

.detail-content {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 24px;
}

.detail-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.detail-loading .spinner {
  display: block;
}

.site-address {
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid #d6e1dc;
  border-radius: 9px;
  background: #f8fbf8;
}

.site-address small,
.site-address strong,
.site-address span {
  display: block;
}

.site-address small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-address strong {
  font-size: 13px;
  line-height: 1.35;
}

.site-address span {
  margin-top: 4px;
  color: #536764;
  font-size: 10px;
  line-height: 1.35;
}

.site-zone {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 13px;
  border-radius: 10px;
  background: #eaf3f6;
}

.zone-code {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 7px;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  background: #2477a7;
}

.site-zone strong,
.site-zone small {
  display: block;
}

.site-zone strong {
  font-size: 12px;
}

.site-zone small {
  margin-top: 4px;
  color: #596d70;
  font-size: 10px;
  line-height: 1.4;
}

.site-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}

.fact {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.fact small,
.fact strong {
  display: block;
}

.fact small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fact strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.zone-coverage-note {
  margin: 0 0 14px;
  padding: 9px 10px;
  color: #4e6260;
  font-size: 9px;
  line-height: 1.5;
  border-left: 3px solid #7aaea8;
  background: #edf4f1;
}

.control-warning {
  margin: 10px 0 0;
  padding: 10px;
  color: #744029;
  font-size: 9px;
  font-weight: 620;
  line-height: 1.5;
  border: 1px solid #edc29f;
  border-radius: 8px;
  background: #fff1e5;
}

.detail-section {
  margin-top: 19px;
}

.detail-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.detail-section h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.detail-section-heading span {
  color: var(--muted);
  font-size: 9px;
}

.detail-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-item {
  padding: 9px 10px;
  border: 1px solid #dfe4df;
  border-radius: 8px;
  background: #fff;
}

.detail-item strong,
.detail-item span,
.detail-item small {
  display: block;
}

.detail-item strong {
  font-size: 10px;
  line-height: 1.35;
}

.detail-item span {
  margin-top: 3px;
  color: #536663;
  font-size: 9px;
  line-height: 1.4;
}

.detail-item small {
  margin-top: 5px;
  color: #7a8986;
  font-size: 8px;
}

.detail-item .mapped-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  padding: 8px 9px;
  border-radius: 7px;
  background: #e8f2f1;
}

.detail-item .mapped-value-label {
  margin: 0;
  color: #46605e;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mapped-value b {
  color: var(--teal-dark);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
}

.detail-item .control-instrument {
  margin-top: 7px;
  color: #3c5153;
  font-weight: 620;
}

.detail-item .control-reference {
  color: #697b78;
  line-height: 1.4;
}

.detail-item .control-note {
  margin: 7px 0 0;
  padding: 7px 8px;
  color: #635638;
  font-size: 8px;
  line-height: 1.45;
  border-radius: 6px;
  background: #fff8df;
}

.detail-item .control-source {
  margin-top: 8px;
  padding-top: 6px;
  color: #81908e;
  border-top: 1px solid #edf0ec;
}

.school-catchment-item {
  border-left: 3px solid #2e79a7;
}

.school-catchment-item.is-future {
  border-left-color: #d28a24;
  background: #fffaf1;
}

.school-catchment-note {
  margin: 8px 0 0;
  padding: 8px 9px;
  color: #665936;
  font-size: 8px;
  line-height: 1.45;
  border-radius: 7px;
  background: #fff8df;
}

.history-source-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.history-coverage {
  margin-bottom: 8px;
  padding: 10px;
  color: #405755;
  border: 1px solid #cfded9;
  border-radius: 8px;
  background: #edf5f2;
}

.history-coverage > strong,
.history-coverage > p,
.history-coverage > small {
  display: block;
}

.history-coverage > strong {
  font-size: 10px;
}

.history-coverage > strong.is-error {
  color: #8a3528;
}

.history-coverage > p {
  margin: 5px 0 0;
  font-size: 9px;
  line-height: 1.45;
}

.history-coverage > small {
  margin-top: 5px;
  color: #6e807d;
  font-size: 8px;
  line-height: 1.4;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.history-actions .history-source-link {
  margin-top: 0;
  font-size: 9px;
}

.history-check-button {
  min-height: 30px;
  padding: 6px 9px;
  color: white;
  font-size: 9px;
  font-weight: 750;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
}

.history-check-button:hover {
  background: var(--teal-dark);
}

.history-check-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.history-note {
  margin: -4px 0 16px;
  padding: 10px 12px;
  color: #63533b;
  font-size: 11px;
  line-height: 1.45;
  border-left: 3px solid var(--gold);
  background: #fbf4df;
}

.empty-detail {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  border-radius: 8px;
  background: #f1f3f0;
}

.detail-disclaimer {
  margin-top: 18px;
  padding: 11px;
  color: #5e5233;
  font-size: 9px;
  line-height: 1.5;
  border-left: 3px solid var(--gold);
  background: #fff8df;
}

.fatal-message {
  position: fixed;
  z-index: 4000;
  inset: 50% auto auto 50%;
  width: min(500px, calc(100% - 32px));
  padding: 20px;
  color: #7f2f25;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid #e2aaa0;
  border-radius: 12px;
  background: #fff5f2;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

/* Leaflet refinements */
.leaflet-control-zoom a {
  color: var(--teal-dark) !important;
}

.leaflet-bar {
  border: 0 !important;
  box-shadow: 0 3px 12px rgba(20, 43, 47, 0.16) !important;
}

.leaflet-control-attribution {
  color: #596966;
  font-size: 8px !important;
  background: rgba(255, 255, 255, 0.84) !important;
}

.leaflet-popup-content-wrapper {
  color: var(--ink);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 43, 47, 0.2);
}

.leaflet-popup-content {
  min-width: 180px;
  margin: 13px 15px;
}

.map-popup h3 {
  margin: 0 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.map-popup p {
  margin: 4px 0;
  color: #596967;
  font-size: 10px;
  line-height: 1.4;
}

.map-popup strong {
  color: var(--ink);
}

.map-popup button {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  color: white;
  font-size: 10px;
  font-weight: 750;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
}

.cluster-label {
  display: grid;
  place-items: center;
  color: white;
  font-size: 9px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.leaflet-tooltip.cluster-label {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.leaflet-tooltip.cluster-label::before {
  display: none;
}

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

}

@media (max-width: 720px) {
  .topbar {
    height: 60px;
    padding: 0 13px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p,
  .read-only-badge {
    display: none;
  }

  .filter-button {
    display: inline-flex;
  }

  .workspace {
    height: calc(100% - 60px);
    display: block;
  }

  .sidebar {
    position: absolute;
    z-index: 1200;
    top: 60px;
    bottom: 0;
    left: 0;
    width: min(320px, calc(100% - 44px));
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 16px 0 40px rgba(12, 39, 43, 0.24);
  }

  .mobile-sidebar-header {
    min-height: 45px;
    flex: 0 0 45px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 8px;
    color: var(--ink);
    background: #f4f7f3;
    border-bottom: 1px solid var(--line);
  }

  .mobile-sidebar-header strong {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .sidebar-collapse {
    min-width: 72px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 0 10px 0 7px;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 800;
    border: 1px solid #cbd8d4;
    border-radius: 9px;
    background: white;
  }

  .sidebar-collapse svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 1150;
    inset: 60px 0 0;
    display: block;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    background: rgba(7, 34, 38, 0.2);
    transition: opacity 220ms ease;
  }

  .sidebar.is-open + .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .map-region {
    width: 100%;
    height: 100%;
  }

  .detail-panel {
    top: auto;
    right: 7px;
    bottom: 37px;
    left: 7px;
    width: auto;
    max-height: 62%;
    transform: translateY(calc(100% + 50px));
  }

  .detail-panel.is-open {
    transform: translateY(0);
  }

  .map-readout {
    left: 7px;
    bottom: 24px;
    max-width: calc(100% - 14px);
  }

  .zoom-hint {
    top: 9px;
    max-width: calc(100% - 130px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .leaflet-control-zoom {
    margin-top: 48px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
