
:root {
  --page-bg: #f2f4f6;
  --card-bg: #ffffff;
  --text: #1f2933;
  --muted: #526173;
  --border: #cfd7e2;
  --soft-border: #e2e7ee;
  --accent: #087f7b;
  --surface: #f7f8fa;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--text);
  background: var(--page-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.page-shell { width: min(1440px, calc(100vw - 36px)); margin: 0 auto; padding: 6px 0 8px; }
.page-header { position: sticky; top: 0; z-index: 50; width: 100%; max-width: none; min-height: 64px; margin: 0 0 8px; padding: 0 0 4px; background: var(--page-bg); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-header h1 { flex: 1 1 auto; }
.site-logo { display: block; flex: 0 0 auto; width: 62px; max-width: 62px; height: auto; object-fit: contain; margin-top: 0; }
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--accent); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.55rem, 2.5vw, 2.05rem); line-height: 1.12; letter-spacing: -0.02em; }
h2 { margin-bottom: 9px; font-size: clamp(1.2rem, 1.8vw, 1.5rem); line-height: 1.15; letter-spacing: -0.015em; }
.page-intro, .option-summary { color: var(--muted); line-height: 1.5; }
.content-grid { display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(620px, 1.4fr); gap: 16px; align-items: start; }
.info-card, .map-card { border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); box-shadow: var(--shadow); }
.info-card {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  min-height: 0;
  overflow: hidden;
  padding: 18px 20px;
}
.map-card {
  position: sticky;
  top: 76px;
  align-self: start;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  min-height: 0;
}
.option-buttons-wrap {
  flex: 0 0 auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--soft-border);
}
.option-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
  margin-bottom: 14px;
  border-bottom: 0;
}
.option-summary { flex: 0 0 auto; margin-bottom: 16px; font-size: 0.98rem; }
.control-heading { margin: 0 0 10px; color: #253044; font-size: 0.86rem; font-weight: 700; }
.option-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.option-button { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; color: #263244; background: #ffffff; text-align: left; transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease; }
.option-button:hover { border-color: #aeb9c8; background: #fbfcfd; }
.option-button[aria-pressed="true"] { border-color: #7bbfbd; background: #eef8f7; box-shadow: none; }
.option-button-title { display: block; margin-bottom: 2px; font-weight: 700; }
.option-button-subtitle { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.stat-card { min-height: 0; padding: 8px 10px; border: 1px solid var(--soft-border); border-radius: 6px; background: var(--surface); }
.stat-value { display: block; margin-bottom: 2px; color: #0f172a; font-size: 1.2rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.stat-label { display: block; color: var(--muted); font-size: 0.77rem; font-weight: 700; line-height: 1.18; }
.note-box { flex: 0 0 auto; padding: 14px 15px; border: 1px solid #dbe7e6; border-radius: 6px; background: #f8fafc; color: #25413f; }
.note-box strong { display: block; margin-bottom: 4px; font-size: 0.9rem; }
.note-box p { margin: 0; color: #4c6562; font-size: 0.9rem; line-height: 1.45; }
.map-wrap { position: relative; flex: 1 1 auto; min-height: 0; background: #d8edf2; }
#map { width: 100%; height: 100%; background: #d8edf2; }
.map-layer-panel {
  position: absolute; right: 10px; bottom: 10px; z-index: 900; width: 235px; max-width: calc(100% - 20px);
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}
.map-control-heading { margin-bottom: 10px; }
.layer-toggles { display: grid; gap: 8px; }
.layer-toggle { display: flex; align-items: center; gap: 9px; min-height: 30px; color: #24313f; font-weight: 600; cursor: pointer; user-select: none; }
.layer-toggle input { position: absolute; opacity: 0; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; border-radius: 999px; background: #d0d7e1; transition: background 160ms ease; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; content: ""; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 160ms ease; }
.layer-toggle input:checked + .switch { background: var(--layer-colour, var(--accent)); }
.layer-toggle input:checked + .switch::after { transform: translateX(18px); }
.layer-toggle input:focus-visible + .switch { outline: 3px solid rgba(8, 127, 123, 0.2); outline-offset: 2px; }
.layer-name { line-height: 1.2; }
.source-note { padding: 4px 10px 5px; color: var(--muted); font-size: 0.76rem; text-align: right; flex: 0 0 auto; }
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
}
.leaflet-popup-content {
  margin: 16px 16px 14px;
  min-width: 250px;
}
.leaflet-popup-tip-container {
  display: none !important;
}

.leaflet-popup-tip {
  display: none !important;
}
.leaflet-popup-close-button {
  display: none !important;
}
.popup-card {
  color: #172033;
  padding-top: 4px;
}

.popup-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.popup-title {
  margin: 0 0 13px;
  color: #111827;
  font-size: 0.9rem;
  line-height: 1.25;
}
.popup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.popup-table th,
.popup-table td {
  padding: 5px 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid #edf0f2;
}
.popup-table th {
  width: 48%;
  padding-right: 10px;
  color: #5d6875;
  font-weight: 700;
  white-space: nowrap;
}
.popup-allocation {
  margin-top: 6px;
  padding-top: 0;
  border-top: 0;
}

.popup-allocation-title {
  display: none;
}

.popup-allocation .popup-table tr:first-child th,
.popup-allocation .popup-table tr:first-child td {
  border-top: 0;
}
.home-control { display: grid; width: 34px; height: 34px; place-items: center; border: 0; color: #111827; background: #ffffff; cursor: pointer; font-size: 19px; line-height: 1; }
.home-control:hover { background: #f3f4f6; }
.leaflet-control-attribution { display: none !important; }
.allocation-tables {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.allocation-tables[hidden] { display: none; }
.allocation-heading { margin: 2px 0 6px; color: #253044; font-size: 0.95rem; font-weight: 700; }
.allocation-intro, .allocation-table-note { margin: 0 0 10px; color: var(--muted); font-size: 0.82rem; line-height: 1.38; }
.allocation-table-card { margin: 0 0 10px; padding: 0; border: 1px solid var(--soft-border); border-radius: 6px; background: #fbfcfd; overflow: hidden; }
.allocation-summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; cursor: pointer; font-weight: 700; color: #172033; }
.allocation-summary::-webkit-details-marker { display: none; }
.allocation-summary-icon { width: 10px; height: 10px; border-right: 2px solid #4b5563; border-bottom: 2px solid #4b5563; transform: rotate(45deg); transition: transform 150ms ease; }
details[open] > .allocation-summary .allocation-summary-icon { transform: rotate(225deg); }
.allocation-table-note { padding: 0 14px; }
.allocation-table-scroll { overflow-x: visible; border-top: 1px solid #dfe5ee; background: #fff; }
.allocation-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 0.74rem; line-height: 1.22; }
.allocation-table th, .allocation-table td { padding: 7px 7px; border-bottom: 1px solid #edf1f6; vertical-align: top; text-align: right; overflow-wrap: anywhere; }
.allocation-table thead th { color: #41506a; background: #f3f6fa; font-weight: 700; white-space: nowrap; overflow-wrap: normal; word-break: normal; font-size: 0.72rem; }
.allocation-table th:first-child, .allocation-table td:first-child { text-align: left; }
.allocation-table th:nth-child(1), .allocation-table td:nth-child(1) { width: 31%; }
.allocation-table th:nth-child(2), .allocation-table td:nth-child(2) { width: 16%; }
.allocation-table th:nth-child(3), .allocation-table td:nth-child(3) { width: 12%; }
.allocation-table th:nth-child(4), .allocation-table td:nth-child(4) { width: 17%; }
.allocation-table th:nth-child(5), .allocation-table td:nth-child(5) { width: 24%; }
.allocation-table tbody th { color: #263244; font-weight: 600; }
.allocation-table tfoot th, .allocation-table tfoot td { border-top: 1px solid #d8e0eb; border-bottom: 0; background: #f8fafc; font-weight: 700; }
.allocation-table tr.is-highlighted th, .allocation-table tr.is-highlighted td { background: #fff7dc; }
.deviation-percent { color: var(--muted); white-space: nowrap; }
.deviation-outside { color: #b42318; }

.allocation-table[data-cols="3"] th:nth-child(1), .allocation-table[data-cols="3"] td:nth-child(1) { width: 54%; }
.allocation-table[data-cols="3"] th:nth-child(2), .allocation-table[data-cols="3"] td:nth-child(2) { width: 26%; }
.allocation-table[data-cols="3"] th:nth-child(3), .allocation-table[data-cols="3"] td:nth-child(3) { width: 20%; }
.allocation-table[data-cols="4"] th:nth-child(1), .allocation-table[data-cols="4"] td:nth-child(1) { width: 42%; }
.allocation-table[data-cols="4"] th:nth-child(2), .allocation-table[data-cols="4"] td:nth-child(2) { width: 20%; }
.allocation-table[data-cols="4"] th:nth-child(3), .allocation-table[data-cols="4"] td:nth-child(3) { width: 16%; }
.allocation-table[data-cols="4"] th:nth-child(4), .allocation-table[data-cols="4"] td:nth-child(4) { width: 22%; }

@media (max-width: 1120px) { .content-grid { grid-template-columns: 1fr; } .info-card, .map-card { position: static; height: auto; min-height: 0; } .allocation-tables { overflow-y: visible; padding-right: 0; } .map-wrap { min-height: 520px; } }
