:root {
  --bg-app:        #F3ECDD;
  --bg-panel:      #FCF7EC;
  --bg-panel-alt:  #F3ECDD;
  --bg-well:       #EAE0CB;
  --border:        #D0BD96;
  --border-soft:   #E4D6B8;
  --text:          #211C12;
  --text-soft:     #4A4232;
  --text-faint:    #786B52;
  --brand:         #211C12;
  --brand-soft:    #4A4232;
  --accent:        #9F4517;
  --accent-deep:   #7F340F;
  --ochre:         #E8A53A;
  --shadow-card:   0 1px 2px rgba(33, 28, 18, 0.08), 0 8px 20px rgba(33, 28, 18, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body {
  font-family: 'Hanken Grotesk', Arial, sans-serif;
  display: flex;
  background: var(--bg-app);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.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;
}

#sidebar {
  width: 368px;
  flex-shrink: 0;
  padding: 16px 18px 20px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
#sidebar > * { flex-shrink: 0; }

.hero {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.brand-mark {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.brand {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}
.crs-tag {
  margin-left: auto;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10px;
  color: var(--text-faint);
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  border-radius: 2px;
}
.hero h1 {
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.tagline {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.42;
}

.search-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-search-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

#search-input {
  min-width: 0;
  flex: 1;
  width: 0;
  font: 500 12.5px 'Hanken Grotesk', sans-serif;
  color: var(--text);
  background: #FFFDF9;
  border: 1.5px solid var(--brand);
  border-radius: 3px;
  padding: 9px 10px 9px 30px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(159, 69, 23, 0.15);
}

#search-input::placeholder { color: var(--text-faint); }

#explore-request {
  flex: 0 0 auto;
  border: 1.5px solid var(--brand);
  background: var(--brand);
  color: #FCF7EC;
  border-radius: 3px;
  font: 700 12.5px 'Hanken Grotesk', sans-serif;
  padding: 8px 13px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

#explore-request:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.category-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.cat-pill {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
  color: var(--text-soft);
  font: 600 11px 'Hanken Grotesk', sans-serif;
  padding: 5px 7.5px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.cat-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.cat-pill[aria-pressed="true"] {
  background: var(--brand);
  color: #FCF7EC;
  border-color: var(--brand);
}

#search-results {
  border: 1px solid var(--brand);
  border-radius: 3px;
  background: #FFFDF9;
  box-shadow: var(--shadow-card);
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
}

.search-hit {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 11px;
  font-family: inherit;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover, .search-hit:focus { background: var(--bg-panel-alt); }
.search-hit strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
}
.search-hit small {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}
#search-results .empty-search { padding: 11px; font-size: 12px; color: var(--text-soft); }

#request-status {
  font-size: 11.5px;
  color: var(--accent-deep);
  font-weight: 600;
  overflow-wrap: anywhere;
}
#request-status:empty { display: none; }

#location-info {
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
  background: #FFFDF8;
  padding: 11px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.section-title h2 {
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
}
.section-title button {
  border: 0;
  background: none;
  color: var(--accent);
  font: 700 11.5px 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  padding: 3px 5px;
}
.section-title button:hover { text-decoration: underline; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.kpi-cell {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  padding: 6px 8px;
}
.kpi-cell strong {
  display: block;
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-cell span {
  display: block;
  font-size: 10.5px;
  color: var(--text-soft);
  margin-top: 2px;
}

.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  gap: 5px;
}
.quick-actions-bar button {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-panel);
  color: var(--brand);
  font: 700 11px 'Hanken Grotesk', sans-serif;
  padding: 6px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.quick-actions-bar button:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--bg-panel-alt);
}
.quick-actions-bar .send-surveyor-inline {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFF6E8;
  text-align: center;
}
.quick-actions-bar .send-surveyor-inline:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

#feature-info .popup-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  overflow: hidden;
}
#feature-info .popup-card .pill { margin: 8px 10px 0; }
#feature-info .popup-card h3 { margin: 4px 10px 2px; font-size: 13.5px; }
#feature-info .popup-card .subtitle { margin: 0 10px 8px; }
#feature-info .popup-card dl { padding: 7px 10px; gap: 3px 10px; }

#location-summary > p {
  font-size: 11.5px;
  margin: 4px 0;
  color: var(--text-soft);
}
#location-summary .coords-meta {
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10.5px;
  color: var(--text-faint);
}
#location-summary h3 {
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  margin-top: 9px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-soft);
}
.nearby-hit {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  padding: 6px 2px;
  font: 600 12px 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  color: var(--text);
}
.nearby-hit:hover { background: var(--bg-panel-alt); }
.nearby-hit small {
  display: block;
  font-weight: 400;
  font-size: 10.5px;
  color: var(--text-soft);
}
.nearby-hit[aria-pressed="true"] {
  background: var(--bg-panel-alt);
  padding-left: 6px;
  border-left: 2px solid var(--accent);
}

.notes-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-panel);
  color: var(--text-soft);
  padding: 6px 9px;
  cursor: pointer;
  font: 600 11.5px 'Hanken Grotesk', sans-serif;
}
.notes-btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.map-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.4;
}

#analysis-panel {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-panel-alt);
  padding: 10px 12px;
}
#analysis-panel h2 { font: 800 14px 'Archivo', sans-serif; }
#analysis-panel p { margin: 6px 0; font-size: 12px; }
#analysis-panel .analysis-answer { font-weight: 700; font-size: 13px; color: var(--brand); }
.analysis-controls { display: grid; gap: 8px; margin: 8px 0; }
.analysis-controls label { display: grid; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.analysis-controls input, .analysis-controls select {
  min-height: 34px;
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #FFFDF9;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
}
.analysis-controls select[multiple] { min-height: 96px; }
#analysis-panel button, #analysis-panel .analysis-export {
  min-height: 34px;
  padding: 6px 10px;
  cursor: pointer;
  font: 700 11.5px 'Hanken Grotesk', sans-serif;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #FFFDF9;
}
#analysis-panel .analysis-run {
  background: var(--brand);
  color: #FCF7EC;
  border-color: var(--brand);
}
#analysis-panel .analysis-run:hover { background: var(--accent); border-color: var(--accent); }
#analysis-panel .section-title button { min-height: 0; border: 0; background: none; color: var(--accent); padding: 2px 4px; }
#analysis-panel .analysis-record { border: 0; border-bottom: 1px solid var(--border-soft); width: 100%; text-align: left; border-radius: 0; padding: 7px 0; font-weight: 600; background: none; }
#analysis-panel .analysis-record small { display: block; font-weight: 400; color: var(--text-soft); font-size: 10.5px; }
#analysis-panel .analysis-record[aria-pressed=true] { background: #FFFDF9; border-left: 2px solid var(--accent); padding-left: 6px; }
.analysis-exports { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.analysis-method { font-size: 12px; margin: 6px 0; overflow-wrap: anywhere; }
.analysis-method summary { cursor: pointer; color: var(--accent); font-weight: 700; padding: 4px 0; }
.analysis-method dl { display: grid; grid-template-columns: auto 1fr; gap: 5px; margin: 6px 0; font-size: 11px; }
.analysis-method dd { min-width: 0; overflow-wrap: anywhere; }
.analysis-results-table { width: 100%; border-collapse: collapse; font-size: 11.5px; text-align: left; margin: 8px 0; background: #FFFDF9; }
.analysis-results-table caption { font-weight: 700; text-align: left; margin-bottom: 4px; font-size: 11px; color: var(--text-soft); }
.analysis-results-table th, .analysis-results-table td { padding: 6px 5px; border-bottom: 1px solid var(--border-soft); }
.analysis-results-table th { font-weight: 700; }
#analysis-panel .analysis-choice { display: block; width: 100%; text-align: left; margin: 5px 0; }
#analysis-panel .analysis-count { font-variant-numeric: tabular-nums; color: var(--text-soft); }
.analysis-extra-filter { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: end; margin: 6px 0; }

.layers-panel, .legend-panel, .sources-panel {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-panel);
  overflow: hidden;
}
.layers-panel summary, .legend-panel > summary, .sources-panel > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  font: 700 12.5px 'Hanken Grotesk', sans-serif;
  color: var(--brand);
  background: var(--bg-panel-alt);
}
.layers-panel summary::-webkit-details-marker,
.legend-panel > summary::-webkit-details-marker,
.sources-panel > summary::-webkit-details-marker { display: none; }
.layers-panel summary::after,
.legend-panel > summary::after,
.sources-panel > summary::after {
  content: '+';
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}
.layers-panel[open] summary::after,
.legend-panel[open] > summary::after,
.sources-panel[open] > summary::after { content: '−'; }
.layers-panel[open] summary,
.legend-panel[open] > summary,
.sources-panel[open] > summary { border-bottom: 1px solid var(--border-soft); }

#active-layer-count {
  font-family: 'Space Mono', 'Courier New', monospace;
  font-weight: 400;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-left: auto;
  margin-right: 8px;
}

.layers-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.layer-evidence-card {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-soft);
}
.layer-evidence-card strong {
  display: block;
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 11.5px;
  color: var(--brand);
  margin-bottom: 4px;
}
.layer-evidence-item + .layer-evidence-item {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--border-soft);
}
.layer-evidence-item p {
  margin: 2px 0;
}
.export-status-note {
  font-size: 11px;
  line-height: 1.38;
  color: var(--accent-deep);
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  padding: 6px 8px;
  margin: 0;
}
.group h2 {
  font: 700 11.5px 'Archivo', sans-serif;
  color: var(--brand);
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border-soft);
}
.group label {
  display: flex;
  align-items: center;
  font-size: 12px;
  padding: 4px 4px;
  margin: 0 -4px;
  cursor: pointer;
  color: var(--text);
  border-radius: 2px;
}
.group label:hover { background: var(--bg-panel-alt); }
.group input {
  margin-right: 8px;
  accent-color: var(--accent);
  cursor: pointer;
}
.group label .count {
  margin-left: auto;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.basemap-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.basemap-switch .chip {
  flex: 1;
  justify-content: center;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 4px;
  cursor: pointer;
  background: #FFFDF9;
  color: var(--text-soft);
}
.basemap-switch .chip:has(input:checked) {
  background: var(--brand);
  color: #FCF7EC;
  border-color: var(--brand);
}
.basemap-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.legend { padding: 10px 12px; }
.legend h3 {
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand);
  margin: 9px 0 4px;
}
.legend h3:first-of-type { margin-top: 0; }
.legend ul { list-style: none; }
.legend li {
  display: flex;
  align-items: center;
  font-size: 11px;
  padding: 2.5px 0;
  color: var(--text-soft);
}
.legend .swatch, .analysis-map-key .swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(33, 28, 18, 0.18);
}
.legend .swatch.point, .analysis-map-key .swatch.point {
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(33, 28, 18, 0.22);
}
.legend .health-public { background: #1B6CA8; }
.legend .swatch.point.health-private { background: #FFFDF9; border: 2px solid #6A3D9A; }
.legend .health-unknown { background: #6C757D; }
.legend .school { background: #0E6B60; }
.legend .power { background: #9F4517; }
.line-swatch {
  width: 22px;
  height: 0;
  margin-right: 8px;
  flex-shrink: 0;
  border-top: 5px solid #FFFDF9;
  box-shadow: 0 0 0 1px rgba(33, 28, 18, 0.14);
  position: relative;
}
.line-swatch::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -4px;
  border-top: 2.5px solid currentColor;
}
.line-road-trunk { color: #C65D21; }
.line-road-local { color: #8C7253; }
.line-33kv { color: #E07A00; }
.line-132kv { color: #B81D24; }
.pop-not-stated { background: #CFC7B4; }

.sources-panel p { font-size: 11.5px; color: var(--text-soft); margin: 8px 10px; }
.sources-panel h3 { font-size: 11.5px; font-weight: 700; margin: 10px 10px 6px; color: var(--brand); }
.source-entry { margin: 7px 10px; padding: 8px; border: 1px solid var(--border-soft); border-radius: 2px; background: #FFFDF9; font-size: 11px; line-height: 1.45; }
.source-entry strong { display: block; font-size: 11.5px; color: var(--brand); margin-bottom: 2px; }
.source-entry.withheld { border-color: var(--accent-deep); background: #FDF3EB; }

.commercial-card {
  margin-top: auto;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: var(--bg-well);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.commercial-eyebrow {
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
}
.commercial-card p {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-soft);
}
.commerce-cta-btn {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: #FCF7EC;
  font: 700 12px 'Hanken Grotesk', sans-serif;
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.commerce-cta-btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}
.commerce-inline-btn {
  border-color: var(--accent) !important;
  background: #FFF6EB !important;
  color: var(--accent-deep) !important;
  font-weight: 700 !important;
}
.commerce-inline-btn:hover {
  background: var(--accent) !important;
  color: #FCF7EC !important;
}
.surveyor-cta-btn {
  width: 100%;
  border: 1px solid var(--brand);
  border-radius: 2px;
  background: var(--brand);
  color: #FCF7EC;
  font: 700 12px 'Hanken Grotesk', sans-serif;
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.surveyor-cta-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

#map {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  background: #C4DCE8;
}

.map-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 60px);
}
.map-actions button {
  font: 700 11.5px 'Hanken Grotesk', sans-serif;
  color: var(--brand);
  background: rgba(252, 247, 236, 0.96);
  border: 1px solid var(--border);
  border-radius: 2px;
  min-height: 34px;
  padding: 6px 11px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.map-actions button:hover:not(:disabled) {
  background: #FFFDF9;
  border-color: var(--accent);
  color: var(--accent-deep);
}

.map-coords-bar {
  position: absolute;
  top: 12px;
  right: 52px;
  z-index: 18;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10.5px;
  color: var(--brand);
  background: rgba(252, 247, 236, 0.94);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 5px 8px;
  pointer-events: none;
  box-shadow: var(--shadow-card);
}

.wl-place-label {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-family: 'Archivo', Arial, sans-serif;
  font-weight: 800;
  color: #211C12;
  text-shadow:
    -1.5px -1.5px 0 #FCF7EC,
     1.5px -1.5px 0 #FCF7EC,
    -1.5px  1.5px 0 #FCF7EC,
     1.5px  1.5px 0 #FCF7EC,
     0      0     5px rgba(252, 247, 236, 0.95);
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.wl-place-label[data-tier="major"] {
  font-size: 13.5px;
  letter-spacing: 0.03em;
}
.wl-place-label[data-tier="corridor"] {
  font-size: 11.5px;
  color: #4A3820;
}
.wl-place-label[data-tier="water"] {
  font-family: 'Hanken Grotesk', Arial, sans-serif;
  font-style: italic;
  font-weight: 700;
  font-size: 11.5px;
  color: #1D5E86;
  text-shadow:
    -1.5px -1.5px 0 #E8F2F7,
     1.5px -1.5px 0 #E8F2F7,
    -1.5px  1.5px 0 #E8F2F7,
     1.5px  1.5px 0 #E8F2F7;
}
.wl-place-label[data-tier="highway"] {
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  background: #C65D21;
  color: #FFFDF8;
  text-shadow: none;
  padding: 2px 5px;
  border-radius: 2px;
  border: 1px solid #FFFDF8;
  box-shadow: 0 1px 3px rgba(33, 28, 18, 0.22);
}

.wl-origin-pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9F4517;
  border: 2.5px solid #FFFDF9;
  box-shadow: 0 0 0 2px #9F4517, 0 3px 10px rgba(33, 28, 18, 0.35);
}

.maplibregl-popup { z-index: 50; }
.maplibregl-popup-content {
  font-family: 'Hanken Grotesk', Arial, sans-serif;
  padding: 0;
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  background: #FFFDF9;
  max-width: 290px;
  overflow: hidden;
}
.popup-card { font-size: 12px; line-height: 1.48; color: var(--text); }
.popup-card .pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: rgba(159, 69, 23, 0.12);
  padding: 2px 7px;
  border-radius: 2px;
  margin: 10px 12px 0;
}
.popup-card h3 {
  margin: 5px 12px 2px;
  font-family: 'Archivo', Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.25;
}
.popup-card .subtitle {
  margin: 0 12px 9px;
  font-size: 11px;
  color: var(--text-faint);
}
.popup-card dl {
  margin: 0;
  padding: 9px 12px 11px;
  background: var(--bg-panel-alt);
  border-top: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr;
  gap: 4px 12px;
  font-size: 11.5px;
}
.popup-card dt { color: var(--text-faint); font-weight: 500; font-size: 11px; }
.popup-card dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.popup-card .status { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 2px; }
.popup-card .yes { color: #195437; background: #E4F2EA; }
.popup-card .no { color: #7F340F; background: #F7E9CC; }
.maplibregl-popup-close-button { font-size: 17px; padding: 3px 7px; color: var(--text-faint); }
.maplibregl-popup-close-button:hover { background: transparent; color: var(--brand); }

.maplibregl-ctrl-group {
  border-radius: 3px !important;
  box-shadow: var(--shadow-card) !important;
  border: 1px solid var(--border) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button {
  background: var(--bg-panel) !important;
  border-bottom: 1px solid var(--border-soft) !important;
}
.maplibregl-ctrl-scale {
  background: rgba(252, 247, 236, 0.92) !important;
  border-color: var(--brand) !important;
  font-family: 'Space Mono', 'Courier New', monospace !important;
  font-size: 10px !important;
  color: var(--brand) !important;
}

#map-status {
  position: absolute;
  bottom: 40px;
  left: 12px;
  z-index: 25;
  max-width: calc(100% - 24px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 7px 11px;
  border-radius: 3px;
  font-size: 12px;
  box-shadow: var(--shadow-card);
}

#map-status[hidden], [hidden] { display: none !important; }

button:disabled, input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible, summary:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible, .chip:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body.panel-hidden #sidebar { display: none; }

.muted { color: var(--text-faint); font-size: 10.5px; }
.origin-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg-panel-alt);
  color: var(--text-soft);
  margin-left: 6px;
}
.centre-rule-note {
  font-size: 11px;
  color: var(--text-soft);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel);
}
.request-interpretation { color: var(--brand); font-weight: 700; font-size: 13px; }
.request-alternative, .request-choice {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  color: var(--accent);
  background: #FFFDF9;
  padding: 8px;
  margin-top: 6px;
  text-align: left;
  font: 700 12px 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  border-radius: 2px;
}

#request-legend { margin-bottom: 8px; }
#request-legend p { font-size: 11px; line-height: 1.45; margin: 4px 0; }
#request-legend .area-key { display: inline-block; width: 18px; border-top: 2px dashed #9F4517; vertical-align: middle; margin-right: 7px; }
#request-legend .origin-key { display: inline-block; width: 10px; height: 10px; border: 2px solid #9F4517; border-radius: 50%; background: #FFFDF9; margin-right: 7px; }

.banner-notice, .banner-alert, .missing-source-alert, .stale-gen-banner {
  padding: 9px 11px;
  border-radius: 3px;
  font-size: 11.5px;
  line-height: 1.45;
  border: 1px solid var(--border);
  background: #FFFDF9;
  color: var(--text);
}
.banner-alert, .missing-source-alert { border-color: var(--accent-deep); background: #FDF3EB; }
.banner-alert button, .missing-source-alert button, .stale-gen-banner button {
  margin-top: 7px;
  padding: 5px 10px;
  border: 1px solid var(--brand);
  border-radius: 2px;
  background: var(--brand);
  color: #FCF7EC;
  font: 700 11.5px 'Hanken Grotesk', sans-serif;
  cursor: pointer;
}

.analysis-map-key {
  position: absolute;
  right: 12px;
  bottom: 42px;
  z-index: 19;
  width: 215px;
  max-width: calc(100% - 74px);
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(252, 247, 236, 0.96);
  font-size: 11px;
  line-height: 1.42;
  pointer-events: none;
  box-shadow: var(--shadow-card);
}
.analysis-map-key h3 { font: 800 11.5px 'Archivo', sans-serif; margin: 0 0 4px; }
.analysis-map-key ul { list-style: none; margin: 0; padding: 0; }
.analysis-map-key li { margin: 3px 0; display: flex; align-items: center; }

.map-image-download {
  color: var(--accent-deep);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: underline;
}

#map-export-preview, .atlas-dialog {
  margin: auto;
  position: fixed;
  inset: 0;
  width: min(94vw, 540px);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
#map-export-preview { width: min(92vw, 960px); }
#map-export-preview::backdrop, .atlas-dialog::backdrop { background: rgba(26, 22, 14, 0.6); }
#map-export-preview h2, .atlas-dialog h2 { font: 800 16px 'Archivo', sans-serif; margin-bottom: 8px; }
#map-export-preview p, .atlas-dialog p { font-size: 12px; color: var(--text-soft); margin-bottom: 10px; line-height: 1.48; }
#map-export-preview img { display: block; max-width: 100%; max-height: 64vh; object-fit: contain; margin: 0 auto 12px; border: 1px solid var(--border); }
#map-export-preview button { display: inline-block; margin-left: 10px; background: var(--brand); color: #FCF7EC; border: 0; border-radius: 2px; padding: 9px 14px; font-weight: 700; cursor: pointer; }
#map-export-preview .map-image-download { display: inline-block; }

.dialog-summary { background: var(--bg-panel-alt); border: 1px solid var(--border-soft); border-radius: 2px; padding: 8px 10px; font-size: 11.5px; margin-bottom: 10px; overflow-wrap: anywhere; }
.dialog-url { background: #FFFDF9; border: 1px solid var(--border); border-radius: 2px; padding: 8px; font: 400 11px 'Space Mono', monospace; white-space: pre-wrap; word-break: break-all; margin-bottom: 12px; max-height: 110px; overflow-y: auto; }
.handoff-field { display: grid; gap: 4px; margin-bottom: 10px; }
.handoff-check { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; }
.handoff-field input[type="text"], .handoff-field textarea, .handoff-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #FFFDF9;
  color: var(--text);
  font: 500 12px 'Hanken Grotesk', sans-serif;
}
.handoff-privacy { font-size: 11px; color: var(--text-soft); border-top: 1px solid var(--border-soft); padding-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dialog-actions button { min-height: 36px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 2px; background: #FFFDF9; color: var(--text); font: 700 12px 'Hanken Grotesk', sans-serif; cursor: pointer; }
.dialog-actions .primary-btn { background: var(--brand); color: #FCF7EC; border-color: var(--brand); }

body.text-map-mode { overflow-y: auto; height: auto; min-height: 100vh; }
body.text-map-mode #map { display: none; }
body.text-map-mode #sidebar { width: min(100%, 720px); max-height: 100%; margin: auto; border-right: 0; }
body.text-map-mode .map-hint, body.text-map-mode .layers-panel, body.text-map-mode .legend-panel { display: none; }
body.text-map-mode .analysis-map-key { position: static; max-width: 100%; }

@media (max-width: 760px) {
  body {
    flex-direction: column;
    height: 100%;
  }
  #map {
    order: 1;
    flex: 1 1 52%;
    width: 100%;
    min-height: 240px;
  }
  #sidebar {
    order: 2;
    width: 100%;
    flex: 0 0 48%;
    max-height: 48%;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
    gap: 10px;
  }
  .hero .brand-row { margin-bottom: 2px; }
  .hero h1 { font-size: 19px; }
  .tagline { font-size: 11.5px; }
  .map-actions { top: 8px; left: 8px; gap: 4px; max-width: calc(100% - 50px); }
  .map-actions button { min-height: 30px; font-size: 10.5px; padding: 4px 7px; }
  #panel-toggle { display: none; }
  .map-coords-bar { display: none; }
  .maplibregl-ctrl-attrib { font-size: 9.5px !important; background: rgba(252, 247, 236, 0.88) !important; }
  .quick-actions-bar { grid-template-columns: repeat(2, 1fr); }
  .maplibregl-popup-content { max-width: min(280px, calc(100vw - 24px)); max-height: 240px; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
