:root {
  color-scheme: light;
  --ink: #171918;
  --muted: #68706b;
  --line: #dfe4e0;
  --line-strong: #cbd2cd;
  --surface: #fff;
  --surface-2: #f5f7f5;
  --surface-3: #ecefeb;
  --green: #198754;
  --green-dark: #116b41;
  --completion-recent: #7c3aed;
  --completion-earlier: #2563eb;
  --completion-not-verified: #d97706;
  --blue: #3974d6;
  --orange: #c87128;
  --control-height: 34px;
  --control-radius: 8px;
  --control-surface: rgb(255 255 255 / 96%);
  --control-shadow: 0 2px 10px rgb(20 30 24 / 12%);
  --control-focus: 0 0 0 3px rgb(57 116 214 / 20%);
  --shadow: 0 14px 40px rgb(24 32 27 / 15%);
  --wash: #fafcfb;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: var(--surface-2); font-size: 14px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 0; box-shadow: var(--control-focus); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.topbar {
  height: 68px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: minmax(310px, 1fr) minmax(300px, 600px) minmax(150px, 1fr);
  align-items: center;
  gap: 20px;
  background: #111312;
  color: #fff;
  border-bottom: 1px solid #252825;
}
.brand-block { display: flex; align-items: center; gap: 11px; min-width: 0; color: inherit; text-decoration: none; }
.brand-logo, .loading-mark {
  width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 9px; background: var(--green); color: white; font-weight: 750; font-size: 17px;
}
.brand-logo { object-fit: cover; }
.brand-block h1 { margin: 0; font-size: 15px; line-height: 1.2; letter-spacing: -.01em; }
.brand-block p { margin: 3px 0 0; color: #9fa7a2; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid #3b403c; border-radius: 9px; background: #202320; }
.global-search:focus-within { border-color: #76b993; box-shadow: 0 0 0 3px rgb(34 139 83 / 18%); }
.global-search svg { width: 17px; fill: none; stroke: #9fa7a2; stroke-width: 1.8; }
.global-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: #fff; background: transparent; }
.global-search input::placeholder { color: #929994; }
kbd { color: #8f9691; border: 1px solid #474c48; border-radius: 5px; padding: 1px 6px; font-size: 11px; }
.topbar-actions { display: flex; align-items: center; justify-self: end; gap: 8px; }
.theme-toggle { gap: 6px; white-space: nowrap; }
.theme-toggle-icon { font-size: 14px; line-height: 1; }
.ghost-button { min-height: var(--control-height); justify-self: end; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--ink); padding: 0 11px; text-decoration: none; box-shadow: var(--control-shadow); font-size: 11px; font-weight: 700; }
.ghost-button:hover { border-color: var(--green); background: #f4f8f4; color: var(--green-dark); }
.topbar .ghost-button, .viewer .ghost-button { border-color: #444945; background: transparent; color: inherit; box-shadow: none; }
.topbar .ghost-button:hover, .viewer .ghost-button:hover { border-color: #76b993; background: rgb(255 255 255 / 7%); color: inherit; }
.leaflet-container { font-family: inherit; }
.mobile-menu-toggle, .mobile-panel-header, .mobile-panel-actions, .mobile-scrim, .mobile-map-menu { display: none; }
.mobile-brand { display: none; color: inherit; text-decoration: none; }
.mobile-scrim[hidden] { display: none !important; }

.workspace { height: calc(100% - 68px); display: block; position: relative; }
.map-workspace { position: absolute; inset: 0; display: flex; }
.map-workspace[hidden] { display: none !important; }
.view-tabs { position: absolute; z-index: 760; top: 12px; left: 50%; display: inline-flex; transform: translateX(-50%); padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); box-shadow: var(--control-shadow); }
.view-tab { min-height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 0 14px; font-size: 11px; font-weight: 750; }
.view-tab:hover { color: var(--ink); }
.view-tab.is-active { background: var(--green); color: #fff; }
.table-panel { position: absolute; inset: 0; z-index: 700; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--surface); }
.table-panel[hidden] { display: none !important; }
.table-panel-header { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 20px 24px 15px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table-panel-header .eyebrow { margin-bottom: 4px; }
.table-panel-header h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.table-panel-count { color: var(--muted); font-size: 12px; }
.table-panel-count strong { color: var(--ink); }
.table-filters { flex: 0 0 auto; max-height: none; overflow: visible; padding: 13px 24px 14px; border-bottom: 1px solid var(--line); }
.table-filters .filter-grid { grid-template-columns: repeat(5, minmax(120px, 1fr)); margin-top: 9px; }
.table-filters .filter-grid label:first-child { grid-column: span 2; }
.table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; background: #fff; }
#projectTable { width: 100%; border-collapse: collapse; font-size: 12px; }
#projectTable th, #projectTable td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
#projectTable th { position: sticky; top: 0; z-index: 2; background: #f2f5f2; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .045em; }
#projectTable th.numeric, #projectTable td.numeric { text-align: right; }
#projectTable th button { border: 0; background: none; color: inherit; padding: 0; font: inherit; text-align: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
#projectTable th button::after { content: "↕"; margin-left: 4px; color: #a0aaa3; font-size: 10px; }
#projectTable th button[aria-sort="ascending"]::after { content: "↑"; color: var(--green-dark); }
#projectTable th button[aria-sort="descending"]::after { content: "↓"; color: var(--green-dark); }
#projectTable td:first-child { min-width: 220px; white-space: normal; }
#projectTable td small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.table-row { cursor: pointer; }
.table-row:hover { background: #fafcfb; }
.table-row.selected { background: #eef7f1; }
.table-row td:first-child { box-shadow: inset 3px 0 var(--completion-color, transparent); }
.table-project-link { max-width: 310px; overflow-wrap: anywhere; border: 0; background: none; padding: 0; color: var(--green-dark); font: inherit; font-weight: 700; text-align: left; }
.table-project-link:hover { text-decoration: underline; }
.table-document.ready { color: var(--green-dark); font-weight: 700; }
.table-empty { padding: 40px 18px !important; color: var(--muted); text-align: center !important; white-space: normal !important; }
.table-load-more { align-self: center; flex: 0 0 auto; width: min(260px, calc(100% - 32px)); margin: 10px 16px 14px; }
.sidebar { width: 374px; flex: 0 0 374px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); z-index: 500; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.metrics div { min-width: 0; padding: 0 10px; border-left: 1px solid var(--line); }
.metrics div:first-child { border-left: 0; padding-left: 0; }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 15px; letter-spacing: -.02em; }
.metrics span { margin-top: 2px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.filters { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px 15px; border-bottom: 1px solid var(--line); }
.section-heading, .results-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 14px; }
.text-button { min-height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--green-dark); font-size: 14px; font-weight: 700; }
.text-button:hover { background: var(--surface-3); }
.filter-section-label { margin-top: 11px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.filter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 11px; }
.filter-grid-normal { margin-top: 8px; }
.filter-grid label { display: grid; min-width: 0; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.filter-help { color: var(--muted); font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.advanced-filter-toggle { width: 100%; position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin-top: 12px; padding: 9px 8px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface-2); color: var(--green-dark); font-size: 11px; font-weight: 750; text-align: left; }
.advanced-filter-toggle:hover { border-color: var(--green); background: #f4f8f4; }
.filter-chevron { position: absolute; top: 50%; right: 9px; color: var(--muted); font-size: 17px; line-height: 1; transform: translateY(-50%) rotate(0deg); transform-origin: center; transition: transform .22s ease; }
.advanced-filter-toggle[aria-expanded="true"] .filter-chevron { transform: translateY(-50%) rotate(180deg); }
.advanced-filters { margin-top: 11px; padding-top: 1px; border-top: 1px solid var(--line); }
.advanced-filters .filter-section-label { margin-top: 10px; }
.advanced-filters .filter-grid { margin-top: 8px; }
.overlay-heading { margin-top: 12px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
.overlay-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.overlay-toggle { width: 100%; min-height: var(--control-height); padding-inline: 7px; text-align: left; white-space: normal; line-height: 1.15; }
.density-legend { margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.2; }
.density-legend-title { font-weight: 700; }
.density-gradient { height: 9px; margin-top: 5px; border: 1px solid rgb(60 70 75 / 24%); border-radius: 3px; background: linear-gradient(to right, #f7fcf0 0%, #e0f3db 4%, #ccebc5 8%, #a8ddb5 17%, #7bccc4 25%, #4eb3d3 33%, #2b8cbe 50%, #0868ac 67%, #084081 100%); }
.density-legend-labels { display: flex; justify-content: space-between; margin-top: 2px; color: var(--muted); font-size: 8px; }
.density-legend-growth { display: flex; align-items: center; gap: 4px; margin-top: 5px; }
.density-swatch { width: 10px; height: 10px; flex: 0 0 10px; border: 1px solid rgb(60 70 75 / 28%); border-radius: 2px; }
.density-growth { border: 2px solid #a95d21; background: #f4c88d; }
.coverage-note { margin: 11px 0 0; padding: 8px 9px; border: 1px solid #dce8df; border-radius: 7px; background: #f4f8f4; color: var(--muted); font-size: 10px; line-height: 1.4; text-transform: none; letter-spacing: 0; font-weight: 450; }
.coverage-note strong { color: var(--ink); font-weight: 700; }
select { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); padding: 7px 28px 7px 8px; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 450; text-align: left; text-align-last: left; }
.homes-filter { min-width: 0; }
.range-line { display: flex; align-items: center; gap: 7px; }
.range-line input[type="range"] { width: 100%; accent-color: var(--green); }
.range-label { width: 35px; flex: 0 0 35px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.range-line output { min-width: 27px; color: var(--ink); font-size: 11px; font-weight: 700; text-align: right; text-transform: none; letter-spacing: 0; }
.range-text { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); padding: 5px 7px; font-size: 11px; text-transform: none; letter-spacing: 0; text-align: left; }
.range-boxes { display: flex; min-width: 0; align-items: center; gap: 5px; }
.range-boxes > .range-text { min-width: 0; flex: 1 1 0; }
.range-boxes > span { color: var(--muted); font-size: 10px; text-align: left; }
.zone-filter { min-width: 0; }
.zone-picker { position: relative; display: block; }
.zone-filter-button { width: 100%; min-height: var(--control-height); border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--ink); padding: 0 28px 0 8px; text-align: left; font-size: 12px; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--control-shadow); }
.zone-filter-button::after { content: "▾"; position: absolute; right: 9px; color: var(--muted); }
.zone-filter-menu { position: absolute; z-index: 900; top: calc(100% + 4px); left: 0; min-width: 190px; max-height: 280px; overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; box-shadow: 0 8px 22px rgb(20 30 24 / 16%); }
.zone-check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 7px !important; padding: 5px 4px; color: var(--ink) !important; font-size: 11px !important; font-weight: 500 !important; text-transform: none !important; letter-spacing: 0 !important; white-space: nowrap; }
.zone-check:hover { background: var(--wash); }
.zone-check input { margin: 0; accent-color: var(--green); }
.zone-check small { color: var(--muted); font-size: 10px; }
.zone-all { margin-bottom: 4px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-weight: 450 !important; }
.results-heading { padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.results-heading strong { color: var(--ink); }
.results-heading label { display: flex; align-items: center; gap: 6px; }
.results-heading select { width: auto; padding-block: 5px; }
.result-list { flex: 1; min-height: 0; overflow-y: auto; }
.project-card { width: 100%; display: block; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; color: inherit; box-shadow: inset 3px 0 var(--completion-color, transparent); }
.project-card:hover { background: #fafbfa; }
.project-card.completed-recent, .table-row.completed-recent { --completion-color: var(--completion-recent); }
.project-card.completed-earlier, .table-row.completed-earlier { --completion-color: var(--completion-earlier); }
.project-card.not-completed, .table-row.not-completed { --completion-color: var(--completion-not-verified); }
.project-card.selected { background: #eef7f1; box-shadow: inset 3px 0 var(--completion-color, var(--completion-not-verified)); }
.card-top { display: flex; min-width: 0; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-address { min-width: 0; display: inline-flex; align-items: flex-start; gap: 6px; overflow-wrap: anywhere; font-size: 13px; font-weight: 680; line-height: 1.3; }
.card-date { flex: 0 0 auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.completion-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 4px; border-radius: 50%; background: var(--completion-not-verified); box-shadow: 0 0 0 1px rgb(255 255 255 / 80%); }
.completion-dot.completed-recent { background: var(--completion-recent); }
.completion-dot.completed-earlier { background: var(--completion-earlier); }
.completion-dot.not-completed { background: var(--completion-not-verified); }
.card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 9px; color: #535a56; line-height: 1.4; font-size: 11px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { padding: 3px 6px; border-radius: 5px; background: var(--surface-3); color: #515753; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.badge.units { background: #e5f2e9; color: #11663c; }
.badge.lot { background: #eee9f7; color: #654b94; }
.badge.design { background: #e7edfa; color: #2b59a7; }
.badge.design-metric { background: #f0eafe; color: #5b21b6; }
.badge.site { background: #f4eadf; color: #86511d; }
.badge.ready { box-shadow: inset 0 0 0 1px rgb(25 135 84 / 28%); }
.load-more { min-height: var(--control-height); margin: 10px 16px 14px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--muted); box-shadow: var(--control-shadow); font-size: 11px; font-weight: 700; }
.load-more:hover { border-color: var(--green); background: #f4f8f4; color: var(--green-dark); }
.empty { padding: 30px 18px; color: var(--muted); text-align: center; line-height: 1.5; }

.map-region { flex: 1; min-width: 0; position: relative; }
#map { position: absolute; inset: 0; background: #e7ebe7; }
.map-fallback { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 32px; background: linear-gradient(145deg, #eef2ed, #dfe7df); color: var(--ink); text-align: center; }
.map-fallback strong { font-size: 15px; }
.map-fallback span { max-width: 310px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-control-stack { position: absolute; z-index: 450; left: 12px; bottom: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100% - 24px); pointer-events: none; }
.map-control-stack > * { pointer-events: auto; }
.map-tools { display: flex; align-items: center; gap: 6px; }
.map-tool { min-height: var(--control-height); border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--ink); padding: 0 10px; box-shadow: var(--control-shadow); font-size: 11px; font-weight: 700; }
.map-tool:hover { border-color: var(--green); background: #f4f8f4; color: var(--green-dark); }
.map-tool:disabled { opacity: .6; cursor: wait; }
.completion-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; color: var(--muted); font-size: 10px; line-height: 1.2; }
.completion-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-swatch { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: var(--completion-not-verified); }
.legend-swatch.completed-recent { background: var(--completion-recent); }
.legend-swatch.completed-earlier { background: var(--completion-earlier); }
.legend-swatch.not-completed { background: var(--completion-not-verified); }
.map-legend { max-width: min(420px, 100%); padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); box-shadow: var(--control-shadow); }
.map-legend.completion-legend { flex-direction: column; align-items: flex-start; gap: 7px; }
.leaflet-control-zoom, .leaflet-control-layers { border: 1px solid var(--line-strong); border-radius: var(--control-radius); box-shadow: var(--control-shadow); overflow: hidden; }
.leaflet-control-zoom a { width: 32px; height: 32px; border: 0; background: var(--control-surface); color: var(--ink); font-size: 18px; line-height: 32px; }
.leaflet-control-zoom.leaflet-bar a { width: 32px; height: 32px; border-radius: 0; line-height: 32px; }
.leaflet-control-zoom a + a { border-top: 1px solid var(--line); }
.leaflet-control-zoom a:hover { background: #f4f8f4; color: var(--green-dark); }
.map-attribution-control { position: relative; display: inline-flex; align-items: center; gap: 4px; max-width: min(190px, calc(100vw - 24px)); padding: 3px 5px 3px 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--control-surface); box-shadow: var(--control-shadow); color: var(--muted); font-size: 9px; line-height: 1.2; }
.map-attribution-button { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--green); color: #fff; padding: 0; font-family: Georgia, serif; font-size: 12px; font-weight: 700; line-height: 1; }
.map-attribution-button:hover { background: var(--green-dark); }
.map-attribution-compact { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-attribution-details { position: absolute; right: 0; bottom: calc(100% + 6px); width: min(300px, calc(100vw - 28px)); padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); box-shadow: var(--control-shadow); color: var(--ink); font-size: 11px; line-height: 1.35; }
.map-attribution-details[hidden] { display: none; }
.leaflet-control-layers-expanded { padding: 5px 7px; background: var(--control-surface); }
.leaflet-control-layers-base label { display: flex; align-items: center; gap: 5px; margin: 3px 0; color: var(--ink); font-size: 11px; }
.leaflet-control-layers-overlays label { display: flex; align-items: center; gap: 5px; margin: 3px 0; color: var(--ink); font-size: 11px; }
.leaflet-control-layers-overlays label.parcel-overlay-disabled { opacity: .5; cursor: not-allowed; }
.leaflet-control-layers-overlays label.parcel-overlay-disabled input { cursor: not-allowed; }
.parcel-boundary-satellite { filter: drop-shadow(0 0 1.75px rgb(0 0 0 / 92%)); }
.parcel-boundary-image { pointer-events: none; }
.detail-open .leaflet-control-zoom { display: none; }
.project-pin { width: var(--pin-size, 18px); height: var(--pin-size, 18px); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2.5px solid #fff; background: var(--completion-not-verified); box-shadow: 0 2px 6px rgb(0 0 0 / 35%); }
.project-pin.completed-recent { background: var(--completion-recent); }
.project-pin.completed-earlier { background: var(--completion-earlier); }
.project-pin.not-completed { background: var(--completion-not-verified); }
.single-cluster-icon { background: transparent; }
.single-cluster-bubble { width: 42px; height: 42px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 50%; background: #23332a; box-shadow: 0 2px 8px rgb(0 0 0 / 28%); color: #fff; font-size: 12px; font-weight: 800; }

.detail-panel { width: 430px; flex: 0 0 430px; position: relative; overflow-y: auto; background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgb(21 29 24 / 9%); z-index: 600; }
.detail-close { position: absolute; right: 14px; top: 12px; z-index: 2; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--muted); padding: 0; box-shadow: var(--control-shadow); font-family: Arial, sans-serif; font-size: 22px; font-weight: 500; line-height: .9; }
.icon-button:hover { border-color: var(--green); color: var(--green-dark); }
.detail-header { padding: 24px 52px 18px 22px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--green-dark); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.detail-header h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.025em; }
.detail-header .project-name { margin: 6px 0 0; color: var(--muted); }
.detail-completion-status { margin-top: 11px; }
.completion-status-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid; border-radius: 999px; font-size: 10px; font-weight: 750; line-height: 1.2; }
.completion-status-chip.completed-recent { border-color: #c4b5fd; background: #ede9fe; color: #5b21b6; }
.completion-status-chip.completed-earlier { border-color: #93c5fd; background: #dbeafe; color: #1d4ed8; }
.completion-status-chip.not-completed { border-color: #fdba74; background: #ffedd5; color: #9a3412; }
.detail-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 10px; font-size: 12px; }
.detail-description { margin: 0; line-height: 1.55; color: #434945; }
.fact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.fact-grid div { min-width: 0; }
.fact-grid span, .document-meta span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .055em; font-weight: 700; }
.fact-grid strong { display: block; margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.fact-source { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.fact-source a { color: var(--green-dark); }
.completion-fact { padding-left: 9px; border-left: 3px solid var(--completion-not-verified); }
.completion-fact.completed-recent { border-left-color: var(--completion-recent); }
.completion-fact.completed-earlier { border-left-color: var(--completion-earlier); }
.document-card { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.document-preview { position: relative; width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; cursor: pointer; background: #dfe3df; border: 0; padding: 0; color: inherit; }
.document-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .2s ease; }
.document-preview:hover img { transform: scale(1.015); }
.document-preview::after { content: ""; position: absolute; inset: auto 0 0; height: 46%; background: linear-gradient(transparent, rgb(12 20 15 / 72%)); pointer-events: none; }
.document-preview-hint { position: absolute; right: 10px; bottom: 9px; z-index: 1; display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid rgb(255 255 255 / 52%); border-radius: 999px; background: rgb(14 25 18 / 78%); color: #fff; font-size: 10px; font-weight: 750; letter-spacing: .01em; text-shadow: 0 1px 2px rgb(0 0 0 / 30%); }
.document-preview-hint-icon { font-size: 13px; line-height: 1; }
.document-preview:hover .document-preview-hint, .document-preview:focus-visible .document-preview-hint { background: var(--green); border-color: var(--green); }
.document-preview:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }
.document-preview-fallback { color: var(--green-dark); font-size: 12px; font-weight: 700; }
.document-placeholder { padding: 28px; text-align: center; color: var(--muted); line-height: 1.45; }
.document-placeholder strong { display: block; color: var(--ink); margin-bottom: 4px; }
.document-meta { padding: 12px 13px; }
.document-meta strong { display: block; margin-top: 3px; }
.document-actions { display: flex; gap: 8px; margin-top: 11px; }
.document-file-list { display: grid; gap: 5px; margin-top: 10px; }
.file-open { min-height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--muted); text-align: left; font-size: 10px; box-shadow: var(--control-shadow); }
.file-open:hover { border-color: var(--green); background: #f4f8f4; color: var(--green-dark); }
.primary-button, .secondary-button { min-height: var(--control-height); display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: var(--control-radius); text-decoration: none; font-size: 11px; font-weight: 700; box-shadow: var(--control-shadow); }
.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.secondary-button { border: 1px solid var(--line-strong); background: #fff; color: var(--ink); }
.primary-button:hover, .secondary-button:hover { border-color: var(--green); background: #f4f8f4; color: var(--green-dark); }
.primary-button:hover { background: var(--green-dark); color: white; }
.record-list { margin: 9px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; }
.record-list li + li { margin-top: 4px; }

.viewer { position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff; }
.viewer-bar { height: 62px; display: grid; grid-template-columns: 1fr minmax(240px, auto) 1fr; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid #353a36; background: #111312; }
.viewer-back { min-height: var(--control-height); justify-self: start; border: 1px solid transparent; border-radius: var(--control-radius); background: transparent; color: #d6dad7; padding: 0 10px; }
.viewer-back:hover { border-color: #515752; background: rgb(255 255 255 / 7%); color: #fff; }
.viewer-title { min-width: 0; text-align: center; }
.viewer-title strong, .viewer-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title span { margin-top: 2px; color: #939a95; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.viewer-actions { justify-self: end; display: flex; align-items: center; gap: 12px; color: #b4bbb6; font-size: 11px; }
.viewer-stage { position: absolute; inset: 62px 0 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 20px 70px 30px; background: #000; }
.viewer-stage img { display: block; width: auto; max-width: min(1400px, 100%); max-height: calc(100vh - 104px); height: auto; object-fit: contain; background: white; box-shadow: 0 12px 40px rgb(0 0 0 / 35%); }
.page-arrow { position: fixed; z-index: 2; top: 50%; width: 40px; height: 52px; border: 1px solid #515752; border-radius: var(--control-radius); background: rgb(17 19 18 / 84%); color: white; box-shadow: 0 2px 10px rgb(0 0 0 / 22%); font-size: 30px; }
.page-arrow:disabled { opacity: .25; cursor: default; }
.page-arrow.prev { left: 14px; }
.page-arrow.next { right: 14px; }

dialog { width: min(620px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); color: var(--ink); }
dialog::backdrop { background: rgb(9 12 10 / 55%); }
dialog h2 { margin: 0 0 16px; font-size: 25px; letter-spacing: -.03em; }
dialog p { line-height: 1.55; color: #4f5652; }
.dialog-close { position: absolute; right: 14px; top: 14px; }
.fine-print { padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; }
.map-loading { position: absolute; inset: 0; z-index: 500; display: grid; place-items: start center; padding-top: 14px; pointer-events: none; background: linear-gradient(180deg, rgb(246 248 246 / 56%), rgb(246 248 246 / 0%) 150px); transition: opacity .25s ease; }
.map-loading-card { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgb(203 210 205 / 80%); border-radius: 8px; background: rgb(255 255 255 / 88%); box-shadow: 0 3px 12px rgb(20 30 24 / 10%); color: var(--muted); font-size: 11px; }
.map-loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgb(25 135 84 / 35%); animation: map-loading-pulse 1.35s infinite; }
.map-loading.done { opacity: 0; }
@keyframes map-loading-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(25 135 84 / 35%); } 50% { box-shadow: 0 0 0 7px rgb(25 135 84 / 0%); } }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.2fr); }
  .topbar-actions { display: none; }
  .sidebar { width: 335px; flex-basis: 335px; }
  .detail-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, calc(100% - 80px)); }
}

@media (max-width: 720px) {
  html, body { overflow: hidden; }
  .topbar { position: fixed; inset: 0; z-index: 700; height: 0; min-height: 0; display: block; padding: 0; border: 0; background: transparent; pointer-events: none; }
  .brand-block, .topbar-actions { display: none; }
  .mobile-brand { position: fixed; top: 10px; left: 10px; z-index: 702; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgb(255 255 255 / 70%); border-radius: 9px; background: rgb(17 19 18 / 88%); box-shadow: var(--control-shadow); pointer-events: auto; }
  .mobile-brand img { width: 100%; height: 100%; object-fit: cover; }
  .mobile-menu-toggle { position: fixed; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / 70%); border-radius: var(--control-radius); background: rgb(17 19 18 / 88%); box-shadow: var(--control-shadow); color: #fff; font-size: 20px; line-height: 1; pointer-events: auto; }
  .mobile-menu-open .mobile-menu-toggle { opacity: 0; pointer-events: none; }
  .global-search { position: fixed; z-index: 701; top: 10px; left: 58px; right: 58px; height: 40px; background: rgb(32 35 32 / 92%); box-shadow: 0 2px 10px rgb(0 0 0 / 22%); opacity: .96; pointer-events: auto; }
  .mobile-menu-open .global-search { opacity: 0; pointer-events: none; }
  /* Keep Leaflet's +/- control below the floating hamburger on phones. */
  .leaflet-top.leaflet-right .leaflet-control-zoom { margin-top: 58px; }
  /*
   * 100vh can describe Safari's larger layout viewport, not the visible
   * viewport between its address and bottom browser bars. Prefer the small
   * and dynamic viewport units; app.js measures any remaining occlusion for
   * browsers that do not fully apply those units.
   */
  .workspace { height: 100vh; height: 100svh; height: 100dvh; display: block; }
  .view-tabs { top: 58px; }
  .table-panel { overflow-y: auto; overflow-x: hidden; }
  .table-panel-header { padding: 14px 14px 11px; }
  .table-panel-header h2 { font-size: 17px; }
  .table-panel-count { font-size: 10px; white-space: nowrap; }
  .table-filters { max-height: none; overflow: visible; padding: 10px 14px 12px; }
  .table-filters .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .table-filters .filter-grid label:first-child { grid-column: 1 / -1; }
  #projectTable th, #projectTable td { padding: 8px 9px; }
  #projectTable td:first-child { min-width: 190px; }
  .table-wrap { flex: 0 0 55vh; min-height: 300px; }
  #projectTable { font-size: 11px; }
  .map-region { position: absolute; inset: 0; z-index: 0; height: auto; min-height: 0; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 800; width: min(92vw, 390px); transform: translateX(-102%); transition: transform .22s ease; border-right: 1px solid var(--line); border-top: 0; box-shadow: 12px 0 28px rgb(16 24 18 / 18%); overflow-y: auto; }
  .mobile-menu-open .sidebar { transform: translateX(0); }
  .mobile-panel-header { position: static; min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); }
  .mobile-panel-actions { display: flex; gap: 7px; padding: 10px 14px 0; }
  .mobile-panel-actions .map-tool { width: 100%; }
  .mobile-panel-actions .theme-toggle { flex: 1; }
.mobile-chevron { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--control-surface); color: var(--ink); padding: 0; box-shadow: var(--control-shadow); font-family: Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: .9; }
.mobile-panel-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mobile-panel-brand { width: 40px; height: 40px; display: block; flex: 0 0 40px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-3); }
.mobile-panel-brand img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mobile-scrim { position: fixed; inset: 0; z-index: 790; display: block; border: 0; background: rgb(7 12 9 / 38%); }
  .metrics { display: none; }
  .filters { flex: none; overflow: visible; padding: 12px 14px 15px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; overflow: visible; padding-right: 2px; }
  .filter-grid label { display: grid; }
  /* Keep iOS Safari from zooming the page when a form control receives focus. */
  input:not([type="range"]), select, textarea { font-size: 16px; }
  .zone-filter { position: relative; z-index: 10; }
  .zone-filter-menu { z-index: 1000; }
  .results-heading { padding-inline: 14px; }
  .project-card { padding-inline: 14px; }
  .load-more { margin-inline: 14px; }
  .detail-panel { position: fixed; inset: 0; width: 100%; z-index: 1200; }
  /*
   * Mobile browser navigation can overlay the layout viewport without
   * contributing to safe-area-inset-bottom. app.js raises this shared
   * 16px baseline only when VisualViewport reports additional occlusion.
   * Keep the value shared by the custom legend and Leaflet's layer picker;
   * do not replace the measured inset with a larger fixed guess.
   */
  .workspace { --mobile-bottom-control-clearance: 16px; }
  .map-control-stack { top: auto; right: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mobile-bottom-control-clearance)); left: 10px; width: max-content; max-width: calc(100% - 20px); align-items: flex-start; }
  .map-tools { display: none; }
  .map-legend { width: max-content; max-width: calc(100vw - 20px); padding: 7px 8px; }
  /*
   * Leaflet puts the attribution and layer picker in one bottom-right
   * container, while the custom legend uses the same visible-viewport
   * baseline on the left. Keep attribution above the picker and remove
   * Leaflet's per-control margins so the picker shares that baseline.
   */
  .leaflet-bottom.leaflet-right { right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mobile-bottom-control-clearance)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
  .leaflet-bottom.leaflet-right > .leaflet-control { float: none; margin: 0; }
  .leaflet-bottom.leaflet-right .map-attribution-control { order: 1; }
  .leaflet-bottom.leaflet-right .leaflet-control-layers { order: 2; }
  .leaflet-control-layers-expanded { padding: 5px 7px; }
  .leaflet-control-layers-base label { font-size: 11px; }
  .mobile-menu-open .map-region { pointer-events: none; }
  .viewer-bar { height: 64px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding: 6px 8px; }
  .viewer-back { padding: 7px 5px; font-size: 11px; white-space: nowrap; }
  .viewer-title { grid-row: auto; grid-column: auto; min-width: 0; text-align: center; padding: 0 3px; }
  .viewer-title strong { font-size: 12px; }
  .viewer-title span { font-size: 9px; }
  .viewer-actions { min-width: 0; gap: 4px; font-size: 9px; }
  .viewer-stage { inset-block-start: 64px; overflow: hidden; padding: 8px 44px 24px; background: #000; }
  .viewer-stage img { width: auto; max-width: 100%; max-height: calc(100vh - 88px); height: auto; object-fit: contain; box-shadow: none; }
  .viewer-actions .ghost-button { display: none; }
  .page-arrow { width: 36px; height: 50px; }
  .page-arrow.prev { left: 4px; }
  .page-arrow.next { right: 4px; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf1f4;
  --muted: #a5afb8;
  --line: #394149;
  --line-strong: #56616a;
  --surface: #20252a;
  --surface-2: #282e34;
  --surface-3: #323941;
  --green: #8fa7b7;
  --green-dark: #c0ced7;
  --control-surface: rgb(38 44 50 / 96%);
  --control-shadow: 0 2px 10px rgb(0 0 0 / 27%);
  --control-focus: 0 0 0 3px rgb(143 167 183 / 30%);
  --shadow: 0 14px 40px rgb(0 0 0 / 38%);
  --wash: #2c333a;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] #projectTable,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .detail-panel,
html[data-theme="dark"] dialog { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .table-panel-header,
html[data-theme="dark"] .metrics { background: var(--surface-2); }
html[data-theme="dark"] #projectTable th { background: var(--surface-3); }
html[data-theme="dark"] #projectTable th button::after { color: #87968c; }
html[data-theme="dark"] .table-row:hover,
html[data-theme="dark"] .project-card:hover { background: #2c3339; }
html[data-theme="dark"] .table-row.selected,
html[data-theme="dark"] .project-card.selected { background: #303b44; }
html[data-theme="dark"] .table-project-link,
html[data-theme="dark"] .table-document.ready,
html[data-theme="dark"] .fact-source a { color: var(--green-dark); }
html[data-theme="dark"] .card-description,
html[data-theme="dark"] .detail-description,
html[data-theme="dark"] dialog p { color: var(--muted); }
html[data-theme="dark"] .badge { background: var(--surface-3); color: #d3ddd6; }
html[data-theme="dark"] .badge.units { background: #19462f; color: #9be5b6; }
html[data-theme="dark"] .badge.lot { background: #40345a; color: #d6c5ff; }
html[data-theme="dark"] .badge.design { background: #273b63; color: #b9ceff; }
html[data-theme="dark"] .badge.design-metric { background: #45317a; color: #dfd0ff; }
html[data-theme="dark"] .badge.site { background: #523c25; color: #ffd49b; }
html[data-theme="dark"] select,
html[data-theme="dark"] .range-text,
html[data-theme="dark"] .zone-filter-menu,
html[data-theme="dark"] .secondary-button { background: var(--control-surface); color: var(--ink); }
html[data-theme="dark"] .zone-check:hover,
html[data-theme="dark"] .advanced-filter-toggle:hover,
html[data-theme="dark"] .map-tool:hover,
html[data-theme="dark"] .load-more:hover,
html[data-theme="dark"] .file-open:hover,
html[data-theme="dark"] .ghost-button:hover,
html[data-theme="dark"] .leaflet-control-zoom a:hover { background: #3b454d; color: var(--ink); }
html[data-theme="dark"] .map-attribution-control { border-color: #46545e; background: rgb(39 45 51 / 94%); color: #c4cdc7; }
html[data-theme="dark"] .map-attribution-button { background: #6a8498; }
html[data-theme="dark"] .map-attribution-button:hover { background: #82a0b5; color: #172027; }
html[data-theme="dark"] .map-attribution-details { border-color: #46545e; background: rgb(39 45 51 / 98%); color: #d8e0db; }
html[data-theme="dark"] .coverage-note { border-color: #46545e; background: #2b343b; }
html[data-theme="dark"] .coverage-note strong { color: var(--ink); }
html[data-theme="dark"] #map { background: #171b20; }
html[data-theme="dark"] .map-fallback { background: linear-gradient(145deg, #252c33, #171b20); }
html[data-theme="dark"] .detail-panel { box-shadow: -10px 0 30px rgb(0 0 0 / 28%); }
html[data-theme="dark"] .document-preview { background: #30363d; }
html[data-theme="dark"] .document-placeholder strong { color: var(--ink); }
html[data-theme="dark"] .map-loading { background: linear-gradient(180deg, rgb(23 27 32 / 72%), rgb(23 27 32 / 0%) 150px); }
html[data-theme="dark"] .map-loading-card { border-color: rgb(94 106 117 / 88%); background: rgb(39 45 51 / 94%); }
html[data-theme="dark"] .mobile-panel-header { background: rgb(39 45 51 / 96%); }
html[data-theme="dark"] dialog::backdrop { background: rgb(0 0 0 / 68%); }
