:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #62707a;
  --line: #d9ded7;
  --accent: #1f7a5b;
  --accent-2: #c45131;
  --shadow: 0 1px 3px rgba(23, 32, 38, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}
.app-name { flex: 1; color: var(--ink); font-size: 18px; font-weight: 800; text-decoration: none; padding: 14px 0; }

.language-selector { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 13px; }
.language-selector select { font: inherit; padding: 7px; border: 1px solid var(--line); border-radius: 4px; background: white; }

.coverage-status { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.coverage-status summary { cursor: pointer; }
.coverage-status p { max-width: 1000px; margin: 8px 0; line-height: 1.5; }
main { padding: 18px 24px 28px; }
.search-sidebar, .results-workspace { min-width: 0; }
.search-submit-actions { display: flex; gap: 8px; margin: 12px 0; }
.search-submit-actions button { min-height: 44px; }
.filters {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.search-location { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(200px, 1fr); gap: 12px; }
.category-help { margin: 8px 0 12px; font-size: 12px; color: var(--muted); }
.category-help summary { cursor: pointer; width: fit-content; }
.category-help p { line-height: 1.5; margin: 8px 0; max-width: 75ch; }
.quick-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; min-width: 0; }
.quick-filters > label { min-width: 0; }
.quick-filters > .field-address, .quick-filters > .field-year { grid-column: 1 / -1; }
.quick-filters label { grid-template-columns: minmax(0, 1fr); }
.quick-filters input { min-width: 0; }
.pending-filters { margin: 10px 0 0; color: #795014; font-size: 13px; }
.pending-filters[hidden] { display: none; }
.extra-search-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.extra-search-fields p { grid-column: 1 / -1; margin: 0; }
.extra-search-fields > label[hidden] { display: none; }
.location-filters { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.applied-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.applied-filters[hidden] { display: none; }
.applied-filters-label { flex: 1; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  min-height: 28px; padding: 3px 7px; border: 1px solid #c9dfd3;
  border-radius: 14px; background: #edf5ef; color: #15583f; font-size: 12px;
  text-align: left; overflow-wrap: anywhere;
}
.filter-chip:hover { background: #ddeee3; }
.filter-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-chip .chip-remove { flex: none; font-size: 15px; line-height: 1; }
.advanced-toggle { display: inline-flex; align-items: center; gap: 7px; }
.toggle-chevron {
  width: 7px; height: 7px; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px);
  transition: transform 150ms ease;
}
.advanced-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(225deg) translateY(-2px); }
.advanced-count {
  min-width: 19px; padding: 2px 5px; border-radius: 999px;
  background: #e5f1e9; color: #15583f; font-size: 11px;
}
.advanced-filters {
  position: fixed;
  margin: 0;
  padding: 0;
  left: 24px;
  height: auto;
  max-height: none;
  top: 24px;
  right: auto;
  bottom: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: min(480px, calc(100vw - 48px));
  max-width: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(23, 32, 38, 0.22);
  overflow: hidden;
}
.advanced-filters[hidden], .advanced-count[hidden] { display: none; }
.advanced-heading, .advanced-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 16px 20px;
}
.advanced-heading { border-bottom: 1px solid var(--line); }
.advanced-heading h2 { margin: 0; font-size: 18px; color: var(--ink); }
.advanced-body {
  display: grid;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
}
.advanced-footer { border-top: 1px solid var(--line); }
.advanced-footer button { min-height: 44px; }
.advanced-body .muted { font-size: 12px; line-height: 1.5; }
.advanced-body .state-filters { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.advanced-body .insight-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.advanced-body .system-filter-options { position: static; }
@media (max-width: 1023px) {
  .advanced-filters {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 82dvh;
    border-radius: 16px 16px 0 0;
  }
  .advanced-heading, .advanced-footer { padding: 14px 16px; }
  .advanced-body { padding: 16px; }
  .advanced-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
.advanced-filters fieldset { min-width: 0; margin: 0; }
.advanced-filters .districts { padding: 0; }
.advanced-filters .districts:empty { display: none; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
input, select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
}
.tabs {
  display: flex;
  gap: 0;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.tab {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 7px 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}
.tab:last-child { border-right: 0; }
.tab.active {
  background: var(--accent);
  color: #ffffff;
}
.districts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 2px;
}
.insight-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
.insight-filters legend { font-weight: 750; }
.insight-filters .muted { grid-column: 1 / -1; margin: 0; }
.system-filter { position: relative; min-width: 0; }
.system-filter-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.system-filter details[open] { position: relative; z-index: 2; }
.system-filter summary {
  display: flex; align-items: center; min-height: 36px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--ink); font-size: 14px; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.system-filter-options {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 2;
  max-height: 260px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--line); border-radius: 0 0 6px 6px;
  background: #fff; box-shadow: var(--shadow);
}
.system-filter-options label {
  display: flex; align-items: flex-start; gap: 7px; padding: 6px;
  border-radius: 4px; color: var(--ink); font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.system-filter-options label:hover { background: #eef2ec; }
.system-filter-options input { flex: none; width: 16px; min-height: 16px; margin: 1px 0 0; accent-color: var(--accent); }
.districts label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
}
.districts input { width: 14px; min-height: 14px; padding: 0; accent-color: var(--accent); }
.actions { display: flex; gap: 8px; }
button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}
button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
button.small {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}
.summary {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.summary strong { color: var(--ink); }
.summary-main { color: var(--ink); font-weight: 700; }
.summary-limit {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.results-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
}
.search-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#copy-search-status:empty { display: none; }
#copy-search-status { color: var(--muted); margin: 0 0 12px; }
#search-link-fallback { width: 100%; margin-bottom: 12px; }
.view-tabs { box-shadow: none; flex-shrink: 0; }
.view-tabs .tab { min-width: 74px; }
.result-view[hidden] { display: none; }
.table-wrap {
  container-type: inline-size;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.list-pagination {
  position: sticky;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  z-index: 2;
  font-size: 13px;
  font-weight: 700;
}
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
  vertical-align: middle;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  background: #eef2ec;
  color: #334047;
  font-size: 12px;
  font-weight: 800;
  z-index: 1;
}
th button.sort-button {
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
}
th button.sort-button:hover { color: var(--accent); }
tr:hover td { background: #faf4ef; }
.search-results, .unit-results { min-width: 0; table-layout: fixed; }
.search-results th:first-child, .unit-results th:first-child { width: 38%; }
.search-results td, .search-results th, .unit-results td, .unit-results th { white-space: normal; overflow-wrap: anywhere; padding: 12px; }
.result-address { min-width: 0; }
.result-link { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 750; text-align: left; overflow-wrap: anywhere; }
.result-link:hover { text-decoration: underline; }
.result-kind, .result-notice { display: block; font-size: 12px; line-height: 1.5; margin-top: 4px; }
.result-kind { color: var(--muted); }
.result-notice { color: #795014; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.selected-unit { border: 1px solid #a8cdb9; background: #f1f8f3; border-radius: 8px; padding: 14px; }
.selected-unit-address, .building-address { margin: 8px 0 12px; font-weight: 700; overflow-wrap: anywhere; }
.selected-unit .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.match-summary { margin: 0 0 8px; font-weight: 600; }
.match-checks, .field-meanings { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.match-checks summary, .field-meanings summary { cursor: pointer; font-weight: 600; min-height: 24px; }
.match-check-list { list-style: none; padding: 0; margin: 10px 0 0; }
.match-check { padding: 10px 0; border-top: 1px solid var(--line); }
.match-check p { margin: 5px 0 0; font-size: 13px; }
.match-check-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.match-check-heading strong { font-size: 13px; }
.match-status { flex-shrink: 0; font-size: 12px; color: var(--accent); }
.match-unchecked .match-status { color: #805300; }
.match-unmatched .match-status { color: #a02424; }
.match-source { color: var(--muted); }
.field-meanings dl, .mapped-fields dl { margin: 12px 0; }
.field-meanings dt { margin-top: 10px; font-weight: 600; font-size: 13px; }
.field-meanings dd { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.field-meanings code, .search-explanation { overflow-wrap: anywhere; }
.buyer-summary { border-top: 1px solid var(--line); padding-top: 12px; overflow-wrap: anywhere; }
.buyer-summary > h3 { font-size: 18px; margin: 0 0 8px; }
.buyer-group { margin: 18px 0; }
.buyer-group > h4 { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.buyer-summary article { border-left: 3px solid var(--line); padding-left: 12px; margin: 12px 0; }
.buyer-summary h5 { font-size: 14px; margin: 0 0 6px; }
.buyer-summary p, .buyer-summary li { font-size: 13px; line-height: 1.5; margin: 6px 0; }
.buyer-summary details > summary { cursor: pointer; padding: 8px 0; min-height: 32px; font-size: 13px; }
.buyer-summary ul { padding-left: 18px; }
@media (max-width: 600px) {
  .match-check-heading { flex-direction: column; gap: 4px; }
}
.detail-body > details > summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.detail-body > details { border-top: 1px solid var(--line); }
.unit-actions .button-link { margin-top: 6px; }
.unit-actions button { min-height: 40px; }
.result-sorting { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.result-sorting select { width: auto; }
@media (max-width: 600px) {
  .search-location { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
  .quick-filters { gap: 8px; }
  .unit-results thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .unit-results tbody { display: block; }
  .unit-results tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; border-bottom: 1px solid var(--line); }
  .unit-results td { display: block; padding: 6px; border: 0; text-align: left; }
  .unit-results td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
  .unit-results .result-address { grid-column: 1 / -1; }
  .unit-results .result-address::before { display: none; }
  .unit-actions { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 8px; }
  .unit-actions .button-link { margin: 0; }
  .selected-unit .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .selected-unit .detail-field { min-height: 0; }
}

@container (max-width: 760px) {
  .search-results thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .search-results tbody { display: block; }
  .search-results tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; border-bottom: 1px solid var(--line); }
  .search-results td { display: block; padding: 6px; border: 0; text-align: left; }
  .search-results td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
  .search-results .result-address { grid-column: 1 / -1; }
  .search-results .result-address::before { display: none; }
  .search-results .state-badge { white-space: normal; }
}

td button.small {
  min-height: 20px;
  padding: 1px 6px;
  line-height: 16px;
  vertical-align: middle;
}
.num { text-align: right; font-variant-numeric: tabular-nums; }
.address { white-space: normal; min-width: 280px; }
.muted { color: var(--muted); }
#map {
  width: 100%;
  height: max(420px, 65dvh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e5ebe2;
  box-shadow: var(--shadow);
}
.map-workspace { position: relative; }
#building-panel { position: absolute; right: 12px; top: 12px; bottom: 12px;
  width: min(380px, calc(100% - 70px)); z-index: 800; background: white;
  border: 1px solid var(--line); border-radius: 6px; overflow: auto; padding: 16px; }
#building-panel h2 { font-size: 16px; overflow-wrap: anywhere; }
#building-panel li { padding: 8px 0; border-bottom: 1px solid var(--line); }
#building-panel ul { list-style: none; padding: 0; }
#building-panel-close { float: right; }
.building-insights { font-size: 13px; overflow-wrap: anywhere; }
.building-insights section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.building-insights h3 { font-size: 14px; margin: 12px 0 8px; }
.building-insights p { margin: 8px 0; }
.building-insights details { margin: 8px 0; }
.building-insights summary { cursor: pointer; font-weight: 600; }
.insight-source { font-size: 11px; color: var(--muted); }
.insight-notice { color: #8a4b12; }
.energy-certificate { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin: 8px 0; }
.certificate-heading { display: flex; align-items: center; gap: 10px; }
.energy-grade { min-width: 36px; padding: 6px; text-align: center; border-radius: 4px;
  background: #edf2ee; font-size: 22px; font-weight: 800; }
.insight-systems { display: grid; grid-template-columns: minmax(85px, 1fr) 2fr; gap: 8px 12px; }
.insight-systems dt { color: var(--muted); }
.insight-systems dd { margin: 0; }
.unit-systems > details { margin-left: 10px; }
.document-activity { list-style: none; margin: 0; padding: 0; }
.document-activity li { border-bottom: 1px solid var(--line); padding: 8px 0; }
@media (max-width: 600px) {
  #building-panel { top: auto; left: 8px; right: 8px; bottom: 8px;
    width: auto; max-height: 48%; padding: 12px; }
}
.error {
  color: #9b2617;
  font-weight: 700;
}
.marker-badge {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--accent-2);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(23, 32, 38, 0.25);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.cluster-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #263746;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(38, 55, 70, 0.18), 0 2px 6px rgba(23, 32, 38, 0.25);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
.cluster-badge strong { font-size: inherit; }
.leaflet-marker-icon:hover .cluster-badge,
.leaflet-marker-icon:focus-visible .cluster-badge {
  background: #3b5265;
  box-shadow: 0 0 0 3px rgba(38, 55, 70, 0.3), 0 2px 6px rgba(23, 32, 38, 0.25);
}
.summary-actions { display: inline-flex; gap: 6px; align-items: center; }
.summary-actions button { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.apt-popup {
  min-width: 0;
  max-width: 360px;
  overflow-wrap: anywhere;
}
.apt-popup h2 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.25;
}
.apt-popup .meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}
.apt-popup ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.apt-popup li {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.35;
}
.apt-popup strong {
  font-size: 13px;
}
.popup-more {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.parcel-info {
  margin: 8px 0;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.4;
}
.parcel-info p { margin: 0 0 4px; }
.parcel-info p:last-child { margin-bottom: 0; }
.parcel-info a { color: var(--accent); font-weight: 700; }
.parcel-source { color: var(--muted); font-size: 11px; }
.popup-actions, .detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(23, 32, 38, 0.22);
}
dialog::backdrop { background: rgba(23, 32, 38, 0.34); }
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #eef2ec;
}
.detail-head h2 {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}
.detail-body {
  display: grid;
  gap: 14px;
  padding: 16px;
  overflow: auto;
  max-height: calc(100vh - 104px);
}
.detail-body > section { min-width: 0; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}
.detail-field {
  overflow-wrap: anywhere;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fbfcfa;
}
.detail-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.detail-body h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.aerial-photo {
  width: 100%;
  height: min(560px, 62vh);
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2ec;
}
.source-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 900px) {
  header { padding: 0 14px; }
  main { padding: 14px; }
  .results-toolbar { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.state-filters { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.state-filters legend { font-weight: 600; }
.state-filters p { font-size: 12px; margin: 6px 0; }
.state-option { display: inline-flex; align-items: center; gap: 6px; margin: 6px 18px 0 0; }
.state-option input { width: 14px; min-height: 14px; }
.state-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--state-color); flex-shrink: 0; }
.state-badge { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.marker-badge { background: var(--state-color, var(--accent-2)); }
.marker-building { border-radius: 5px; }
.map-legend {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 401;
  max-width: min(580px, calc(100% - 80px));
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  pointer-events: none;
}
#map-refresh-status {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 401;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 600px) {
  header { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .language-selector > span { display: none; }
}

.scope-selector { display: grid; margin-top: 12px; }
.result-sorting { padding: 10px 12px 0; }

.list-load-status { margin: 10px 12px; }
.list-load-status:empty { display: none; }
.coverage-status { margin-top: 14px; }

/* Desktop search has two independently scrolling columns below the app header. */
@media (min-width: 1024px) {
  .search-page { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .search-workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; min-height: 0; padding: 16px 24px; }
  .search-sidebar {
    display: flex; flex-direction: column; min-height: 0;
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--panel); box-shadow: var(--shadow);
  }
  .search-sidebar-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; scroll-padding-block: 12px; }
  .search-sidebar .filters { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .search-location { grid-template-columns: minmax(0, 1fr); }
  .quick-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-filters > :has([name="min_rooms"]) { grid-column: 1 / -1; }
  .search-submit-actions { flex: none; margin: 0; padding: 12px 14px; border-top: 1px solid var(--line); }
  .search-submit-actions .search-button { flex: 1; }
  .advanced-toggle { justify-content: center; }
  .applied-filters { margin: 16px 0 0; }
  .coverage-status { margin-bottom: 16px; overflow-wrap: anywhere; }
  .results-workspace { display: flex; flex-direction: column; min-height: 0; }
  .results-heading { flex: none; position: relative; }
  .copy-search-feedback:has(#copy-search-status:not(:empty)) {
    position: absolute; top: 44px; right: 0; z-index: 900;
    width: min(480px, 100%); padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--panel); box-shadow: var(--shadow);
  }
  .copy-search-feedback #copy-search-status { margin: 0; }
  .copy-search-feedback #search-link-fallback { margin: 8px 0 0; }
  .results-toolbar { align-items: start; }
  .summary { min-height: 60px; overflow-wrap: anywhere; }
  .search-actions { justify-content: end; gap: 8px; }
  #map-view { flex: 1; min-height: 0; }
  .map-workspace, #map { height: 100%; }
  #building-panel { width: min(380px, 45%); padding: 12px; }
  #list-view { flex: 1; min-height: 0; margin: 0; overscroll-behavior: contain; scroll-padding-block: 48px 70px; }
}
@media (min-width: 1200px) {
  .search-workspace { grid-template-columns: 320px minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .coverage-status, .search-submit-actions { margin-block: 8px; }
  .search-actions { gap: 8px; }
  #copy-search-link { order: 3; flex-basis: 100%; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-align: left; font-size: 12px; }
}
