: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;
  --blue: #3974d6;
  --orange: #c87128;
  --shadow: 0 14px 40px rgb(24 32 27 / 15%);
  --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; }
.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; }
.brand-mark, .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-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; }
.ghost-button { justify-self: end; border: 1px solid #444945; border-radius: 8px; background: transparent; color: inherit; padding: 8px 11px; text-decoration: none; }
.ghost-button:hover { background: rgb(255 255 255 / 7%); }
.mobile-menu-toggle, .mobile-panel-header, .mobile-panel-actions, .mobile-scrim, .mobile-map-menu { display: none; }
.mobile-scrim[hidden] { display: none !important; }

.workspace { height: calc(100% - 68px); display: flex; position: relative; }
.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 { 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 { padding: 0; border: 0; background: none; color: var(--green-dark); font-size: 12px; }
.filter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 11px; }
.filter-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
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; }
.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; }
.range-boxes { display: flex; align-items: center; gap: 5px; }
.range-boxes > span { color: var(--muted); font-size: 10px; }
.zone-filter { min-width: 0; }
.zone-picker { position: relative; display: block; }
.zone-filter-button { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); padding: 7px 28px 7px 8px; text-align: left; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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: 700 !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; }
.project-card:hover { background: #fafbfa; }
.project-card.selected { background: #eef7f1; box-shadow: inset 3px 0 var(--green); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-address { font-size: 13px; font-weight: 680; line-height: 1.3; }
.card-date { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.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.design { background: #e7edfa; color: #2b59a7; }
.badge.site { background: #f4eadf; color: #86511d; }
.badge.ready { box-shadow: inset 0 0 0 1px rgb(25 135 84 / 28%); }
.load-more { margin: 10px 16px 14px; padding: 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--muted); }
.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-notice { position: absolute; z-index: 450; top: 12px; left: 50%; transform: translateX(-50%); padding: 7px 10px; border-radius: 7px; background: rgb(17 19 18 / 86%); color: white; font-size: 11px; }
.map-tools { position: absolute; z-index: 450; left: 12px; bottom: 22px; display: flex; align-items: center; gap: 9px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: rgb(255 255 255 / 94%); box-shadow: 0 2px 9px rgb(20 30 24 / 10%); }
.map-tool { border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); padding: 6px 9px; font-size: 11px; font-weight: 700; }
.map-tool:hover { border-color: var(--green); color: var(--green-dark); }
.map-tool:disabled { opacity: .6; cursor: wait; }
.map-tool-note { color: var(--muted); font-size: 10px; }
.detail-open .leaflet-control-zoom { display: none; }
.project-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2.5px solid #fff; background: var(--green); box-shadow: 0 2px 6px rgb(0 0 0 / 35%); }
.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: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: rgb(255 255 255 / 92%); color: var(--muted); font-size: 20px; }
.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-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; }
.document-card { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.document-preview { width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; background: #dfe3df; border: 0; padding: 0; }
.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-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 { padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--muted); text-align: left; font-size: 10px; }
.file-open:hover { border-color: var(--green); color: var(--green-dark); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px; border-radius: 7px; text-decoration: none; font-size: 11px; font-weight: 650; }
.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); }
.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: #1a1d1b; 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 { justify-self: start; border: 0; background: none; color: #d6dad7; padding: 8px; }
.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: auto; display: flex; align-items: flex-start; justify-content: center; padding: 22px 70px 60px; }
.viewer-stage img { display: block; max-width: min(1400px, 100%); height: auto; background: white; box-shadow: 0 12px 40px rgb(0 0 0 / 35%); }
.page-arrow { position: fixed; z-index: 2; top: 50%; width: 44px; height: 58px; border: 1px solid #515752; border-radius: 10px; background: rgb(17 19 18 / 78%); color: white; font-size: 34px; }
.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; }
.loading-screen { position: fixed; inset: 0; z-index: 3000; display: grid; place-content: center; justify-items: center; gap: 8px; background: #f6f8f6; transition: opacity .25s ease; }
.loading-screen .loading-mark { margin-bottom: 8px; }
.loading-screen span { color: var(--muted); font-size: 12px; }
.loading-screen.done { opacity: 0; pointer-events: none; }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.2fr); }
  .topbar > .ghost-button { 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 > .ghost-button { display: none; }
  .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: 10px; background: rgb(17 19 18 / 88%); box-shadow: 0 2px 10px rgb(0 0 0 / 22%); 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: 10px; 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; }
  .workspace { height: 100vh; display: block; }
  .map-region { position: absolute; inset: 0; height: auto; min-height: 0; }
  .sidebar { position: fixed; inset: 0 auto 0 0; 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: sticky; top: 0; z-index: 4; 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%); backdrop-filter: blur(8px); }
  .mobile-panel-actions { display: flex; padding: 10px 14px 0; }
  .mobile-panel-actions .map-tool { width: 100%; }
  .mobile-chevron { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); font-size: 28px; line-height: 1; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 490; display: block; border: 0; background: rgb(7 12 9 / 38%); }
  .metrics { display: none; }
  .filters { padding: 12px 14px 15px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 190px; overflow-y: auto; padding-right: 2px; }
  .filter-grid label { display: grid; }
  .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; }
  .map-tools { display: 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; padding: 0 0 34px; }
  .viewer-stage img { width: 100%; max-width: none; 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; }
}
