/* shell.css — full-page layout shell: tokens, topbar, pages, Find workspace, overlays (owner: SHELL).
   Contract: docs/UI_PAGES_SPEC.md §1, §3, §4, §7. Loaded after app.css / card.css / phase1.css. */

:root {
  /* spacing, radius, type scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-8: 8px; --r-12: 12px; --r-16: 16px;
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
  /* surfaces */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-hover: #f1f3f7;
  --line: #e4e7ec;
  --line-strong: #cfd5de;
  --text-2: #475467;
  --accent: #2f54d8;
  --accent-weak: #e9eefc;
  --accent-ring: color-mix(in srgb, var(--accent) 35%, transparent);
  --elev-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --elev-2: 0 4px 12px -2px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .06);
  --elev-3: 0 24px 48px -12px rgba(16, 24, 40, .28), 0 8px 16px -8px rgba(16, 24, 40, .12);
  --backdrop: rgba(15, 20, 30, .42);
  --topbar-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --page-max: 1600px;
  --rail-w: 360px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1015;
    --panel: #151920;
    --surface: #151920;
    --surface-2: #1a1f27;
    --surface-hover: #1f2530;
    --line: #262d38;
    --line-strong: #35404e;
    --text-2: #aab4c3;
    --accent: #7b9cff;
    --accent-weak: #1c2744;
    --elev-1: 0 1px 2px rgba(0, 0, 0, .5);
    --elev-2: 0 6px 16px -4px rgba(0, 0, 0, .6);
    --elev-3: 0 28px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
    --backdrop: rgba(0, 0, 0, .6);
  }
}

body { font-size: var(--fs-14); background: var(--bg); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.btn { border-radius: var(--r-8); border-color: var(--line); background: var(--surface); min-height: 32px; padding: 5px 12px; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-subtle { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-subtle:hover { background: var(--surface-hover); border-color: transparent; color: var(--fg); }
.btn-subtle[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); }
.icon-btn { border-radius: var(--r-8); }
select, input[type="text"], input[type="search"], input[type="number"], input[type="date"] { border-radius: var(--r-8); border-color: var(--line); background: var(--surface); }
select:focus-visible, input:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 0; border-color: var(--accent); }

/* ------------------------------------------------------------------ topbar */
#topbar {
  height: var(--topbar-h); padding: 0 var(--sp-4); gap: var(--sp-3);
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 30;
}
.nav-toggle { display: none; }
.brand { text-decoration: none; color: var(--fg); font-size: var(--fs-14); letter-spacing: -.01em; margin-right: var(--sp-2); }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #14a3c7); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.search-wrap { flex: 0 1 340px; max-width: 380px; display: flex; align-items: center; }
.search-ico { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
#search { padding-left: 32px; padding-right: 28px; height: 36px; border-radius: 10px; background: var(--surface-2); border-color: transparent; }
#search:hover { border-color: var(--line); }
#search:focus { background: var(--surface); border-color: var(--accent); outline: 3px solid var(--accent-ring); outline-offset: 0; }
.search-kbd { position: absolute; right: 8px; font: 600 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 16px; pointer-events: none; }
#search:focus + .search-kbd, #search:not(:placeholder-shown) + .search-kbd { display: none; }
#search-results { border-radius: var(--r-12); box-shadow: var(--elev-3); border-color: var(--line); padding: 6px; }
#search-results li { padding: 8px 10px; border-radius: var(--r-8); }

.primary-nav { display: flex; gap: 2px; align-items: center; height: 100%; }
.primary-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px;
  border-radius: var(--r-8); color: var(--text-2); font-weight: 550; text-decoration: none; white-space: nowrap;
  transition: background .12s, color .12s;
}
.primary-nav a:hover { background: var(--surface-hover); color: var(--fg); }
.primary-nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.primary-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -10px; height: 2px; border-radius: 2px; background: var(--accent);
}
.primary-nav .tab-badge { margin-left: 2px; }
.top-right { gap: var(--sp-2); }
.fresh { border-color: var(--line); border-radius: 999px; padding: 5px 12px; background: var(--surface); color: var(--text-2); }
.fresh:hover { background: var(--surface-hover); }

/* ------------------------------------------------------------------ pages */
#pages { position: relative; height: calc(100% - var(--topbar-h)); overflow: hidden; }
.page { position: absolute; inset: 0; background: var(--bg); }
.page-doc { overflow: auto; overscroll-behavior: contain; padding: var(--sp-5) var(--sp-5) var(--sp-6); scroll-padding-top: 16px; }
.page-doc > :not(.page-wrap) { max-width: var(--page-max); margin-left: auto; margin-right: auto; }
.page.is-parked { visibility: hidden; pointer-events: none; }
.page.page-enter { opacity: 0; transform: translateY(6px); }
.page.page-in { transition: opacity .15s var(--ease), transform .15s var(--ease); }
.page.page-leave { opacity: 0; transition: opacity .15s var(--ease); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .page.page-enter { opacity: 1; transform: none; }
  .page.page-in, .page.page-leave { transition: none; }
}
.page-wrap { max-width: var(--page-max); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-title { font-size: var(--fs-24); font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-summary { color: var(--text-2); margin-top: 4px; font-size: var(--fs-14); }
.page-counts { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.count-pill { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-13); }
.count-pill b { color: var(--fg); font-size: var(--fs-14); }
.count-pill.tone-bad b { color: var(--fail); }
.count-pill.tone-warn b { color: var(--warn); }
.count-pill.tone-ok b { color: var(--ok); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.page-body { min-width: 0; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-16); box-shadow: var(--elev-1); }

/* states + skeleton */
.state-box { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--r-12); color: var(--text-2); background: var(--surface); }
.state-box .state-ico { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.state-failed { border-style: solid; border-color: color-mix(in srgb, var(--fail) 40%, var(--line)); }
.state-failed .state-ico { background: var(--fail); }
.state-not-covered .state-ico { background: var(--warn); }
.state-loading .state-ico { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.state-box .state-txt { flex: 1; }
@keyframes pulse { 50% { opacity: .3; } }
.skeleton-rows { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-3) 0; }
.skeleton-row { display: grid; grid-template-columns: 48px 1fr 120px; gap: 12px; }
.sk { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, .state-loading .state-ico { animation: none; } }

/* shared table look (§7) */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 600; font-size: var(--fs-12); color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table .num, .data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.is-compact .data-table td { padding-top: 5px; padding-bottom: 5px; }

/* ------------------------------------------------------------------ Find workspace */
.page-find { --find-inset-l: 12px; --find-inset-b: 12px; background: var(--map-bg); }
.page-find #map { position: absolute; inset: 0; }
.find-rail {
  position: absolute; z-index: 6; top: 12px; left: 12px; bottom: 12px; width: var(--rail-w);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-16); box-shadow: var(--elev-2);
  display: flex; flex-direction: column; overflow: hidden; transition: transform .18s var(--ease), opacity .18s var(--ease);
}
.rail-collapsed .find-rail { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; visibility: hidden; transition: transform .18s var(--ease), opacity .18s var(--ease), visibility 0s .18s; }
.rail-head { display: flex; align-items: center; gap: var(--sp-2); padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.rail-title { font-size: var(--fs-16); font-weight: 700; letter-spacing: -.01em; margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.rail-title .badge-count:not(:empty) { font-size: 11px; }
.rail-tools { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.rail-tools .preset-select { flex: 1 1 150px; min-width: 0; }
.find-rail .filter-body { flex: 1; max-height: none; border-bottom: 0; overflow: auto; overscroll-behavior: contain; }
.find-rail .fgroup > summary { padding: 12px 16px; font-size: var(--fs-13); }
.find-rail .frow { padding: 5px 16px; grid-template-columns: 104px minmax(0, 1fr); }
.find-rail .flag-group, .find-rail .flag-legend { padding-left: 16px; padding-right: 16px; }
.rail-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--surface-2); font-size: var(--fs-13); color: var(--text-2); }
.rail-foot strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.rail-fab {
  position: absolute; z-index: 6; top: 12px; left: 12px; display: none; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; box-shadow: var(--elev-2); cursor: pointer; font-weight: 600;
}
.rail-collapsed .rail-fab { display: inline-flex; }
.rail-fab:hover { background: var(--surface-hover); }
.drawer-full .rail-fab { display: none !important; }
.drawer-filters { display: none; }
.rail-collapsed .drawer-full .drawer-filters, .rail-collapsed.drawer-full .drawer-filters { display: inline-flex; }

/* results drawer */
.find-drawer {
  position: absolute; z-index: 5; left: var(--drawer-l, calc(var(--rail-w) + 24px)); right: 12px; bottom: 12px; height: var(--drawer-h, 45%);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-16); box-shadow: var(--elev-2);
  display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; container-name: drawer;
  transition: height .2s var(--ease), left .18s var(--ease), top .2s var(--ease);
}
.rail-collapsed .find-drawer { --drawer-l: 12px; }
.find-drawer[data-size="peek"] { --drawer-h: 196px; }
.find-drawer[data-size="half"] { --drawer-h: min(48%, 520px); }
.find-drawer[data-size="full"] { --drawer-h: calc(100% - 24px); }
@media (prefers-reduced-motion: reduce) { .find-drawer, .find-rail { transition: none; } }
.drawer-grip { display: block; width: 100%; height: 14px; border: 0; background: transparent; cursor: ns-resize; padding: 0; flex: none; }
.drawer-grip::before { content: ""; display: block; margin: 5px auto 0; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); }
.drawer-grip:hover::before { background: var(--muted); }
.drawer-head { display: flex; align-items: center; gap: var(--sp-3); padding: 0 12px 10px 16px; flex-wrap: wrap; }
.drawer-head .result-count { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.drawer-head .result-count strong { font-size: var(--fs-20); letter-spacing: -.02em; }
.drawer-head .results-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.drawer-head #sort-select { max-width: 170px; }
.seg-size { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg-size button { border: 0; background: transparent; padding: 4px 10px; border-radius: 8px; font-size: var(--fs-12); font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg-size button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--elev-1); }

/* results table (virtual) */
.rtable { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.rt-head, .rrow { display: grid; grid-template-columns: var(--rt-cols); column-gap: 12px; align-items: center; padding: 0 16px; }
.rtable { --rt-cols: 44px 44px minmax(200px, 2.2fr) minmax(140px, 1.3fr) 44px 92px 118px minmax(120px, 1fr); }
.no-fd .rtable { --rt-cols: 44px 0 minmax(200px, 2.2fr) minmax(140px, 1.3fr) 44px 92px 118px minmax(120px, 1fr); }
.find-drawer.no-fd .c-fd { visibility: hidden; }
.rt-head { height: 34px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-2); font-weight: 600; flex: none; }
.rt-head button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border-radius: 4px; }
.rt-head button:hover { color: var(--fg); }
.rt-head button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rt-head [aria-sort="ascending"] button::after { content: "↑"; color: var(--accent); }
.rt-head [aria-sort="descending"] button::after { content: "↓"; color: var(--accent); }
.rt-head .c-num, .rrow .c-num { justify-self: end; text-align: right; }
.results { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.results:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 0 0 var(--r-16) var(--r-16); }
.rrow { position: absolute; left: 0; right: 0; height: 44px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: var(--fs-13); }
.rrow:hover, .rrow.hov { background: var(--surface-hover); }
.rrow.sel { background: var(--accent-weak); }
.rrow.focus { background: var(--accent-weak); box-shadow: inset 3px 0 0 var(--accent); }
.rrow > span { min-width: 0; }
.rrow .c-addr, .rrow .c-area, .rrow .c-sale { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rrow .raddr { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .rsub, .rrow .c-area small, .rrow .c-sale small { font-size: var(--fs-12); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .c-area span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .c-num { font-variant-numeric: tabular-nums; }
.rrow .c-type { color: var(--text-2); font-weight: 600; font-size: var(--fs-12); }
.rrow .rflags { display: flex; gap: 3px; flex-wrap: nowrap; overflow: hidden; margin: 0; }
.rrow .score { min-width: 32px; }
.fd-score { display: inline-grid; place-items: center; min-width: 32px; height: 22px; border-radius: 6px; font-size: var(--fs-12); font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid var(--line-strong); color: var(--text-2); }
.rsub-narrow { display: none; }
.results .empty { padding: 32px 16px; }
.is-compact .rrow .rsub, .is-compact .rrow small { display: none; }

@container drawer (max-width: 1000px) {
  .rt-head .c-flags, .rrow .c-flags { display: none; }
  .rtable { --rt-cols: 44px 44px minmax(160px, 2fr) minmax(120px, 1.2fr) 40px 88px 110px; }
  .no-fd .rtable { --rt-cols: 44px 0 minmax(160px, 2fr) minmax(120px, 1.2fr) 40px 88px 110px; }
}
@container drawer (max-width: 720px) {
  .rt-head .c-area, .rrow .c-area, .rt-head .c-type, .rrow .c-type, .rt-head .c-sale, .rrow .c-sale, .rt-head .c-fd, .rrow .c-fd { display: none; }
  .rtable, .no-fd .rtable { --rt-cols: 56px minmax(0, 1fr) auto; }
  .rrow .rsub-wide { display: none; }
  .rrow .rsub-narrow { display: block; }
  .rrow .c-value { display: flex; flex-direction: column; align-items: flex-end; }
  .rrow .c-value .rflags-narrow { display: flex; gap: 3px; margin-top: 2px; }
}
.rrow .rflags-narrow { display: none; }

/* map chrome on the Find page */
.map-tools { pointer-events: auto; position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.layers-btn {
  display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-12);
  padding: 8px 12px; box-shadow: var(--elev-2); cursor: pointer; font-weight: 600; font-size: var(--fs-13);
}
.layers-btn:hover { background: var(--surface-hover); }
.layers-btn .mini-ramp { display: inline-flex; width: 56px; height: 6px; border-radius: 3px; overflow: hidden; }
.layers-btn .mini-ramp span { flex: 1; }
.page-find .maplibregl-ctrl-top-right { top: 56px; }
.page-find .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 12px 0 0; border-radius: 10px; box-shadow: var(--elev-2); overflow: hidden; }
.page-find .maplibregl-ctrl-bottom-left { left: var(--find-inset-l); bottom: var(--find-inset-b); transition: left .18s var(--ease), bottom .2s var(--ease); }
.page-find .maplibregl-ctrl-bottom-right { bottom: var(--find-inset-b); transition: bottom .2s var(--ease); }
.page-find .data-stamp { left: calc(var(--find-inset-l) + 10px); bottom: calc(var(--find-inset-b) + 30px); transition: left .18s var(--ease), bottom .2s var(--ease); }
.page-find .map-chip { top: 12px; left: calc(var(--find-inset-l) + (100% - var(--find-inset-l)) / 2); border-radius: 999px; box-shadow: var(--elev-2); border-color: var(--line); }
.page-find .map-note { bottom: calc(var(--find-inset-b) + 8px); left: calc(var(--find-inset-l) + (100% - var(--find-inset-l)) / 2); border-radius: 999px; padding: 5px 12px; box-shadow: var(--elev-2); border-color: var(--line); }
.page-find .map-note.warn { bottom: calc(var(--find-inset-b) + 44px); }
.map-panel { display: none; }

/* Layers menu (inside an overlay) */
.layers-panel { display: flex; flex-direction: column; gap: var(--sp-4); font-size: var(--fs-13); }
.layers-panel .lp-sec { display: flex; flex-direction: column; gap: 8px; }
.layers-panel .lp-h { font-size: var(--fs-12); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.layers-panel select { width: 100%; }
.layers-panel .seg { align-self: flex-start; border-radius: var(--r-8); }
.layers-panel .seg button { padding: 6px 12px; font-size: var(--fs-13); }
.layers-panel .legend { padding-left: 0; }
.layers-panel .lg-ramp { height: 10px; border-radius: 5px; }
.basemap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.basemap-grid button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-12); padding: 10px 12px; text-align: left; cursor: pointer; font-weight: 600; font-size: var(--fs-13); }
.basemap-grid button small { display: block; color: var(--muted); font-weight: 400; font-size: var(--fs-12); }
.basemap-grid button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-weak); }

/* presets menu */
.preset-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.preset-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-12); background: var(--surface); }
.preset-item.is-current { border-color: var(--accent); background: var(--accent-weak); }
.preset-item .pi-main { flex: 1; min-width: 0; }
.preset-item .pi-name { font-weight: 600; }
.preset-item .pi-sum { font-size: var(--fs-12); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-save { display: flex; gap: 8px; padding: 0; border: 0; background: transparent; flex-wrap: wrap; }
.preset-save input { flex: 1 1 200px; }
.ov-sec-h { font-size: var(--fs-12); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: var(--sp-4) 0 var(--sp-2); }
.ov-sec-h:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ overlays */
#overlay-root { position: relative; z-index: 60; }
.ov-layer { position: fixed; inset: 0; display: grid; place-items: center; padding: 3vh 2vw; }
.ov-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); transition: opacity .18s var(--ease); }
.ov-layer.ov-under .ov-backdrop, .ov-layer[data-depth]:not([data-depth="0"]) .ov-backdrop { background: rgba(15, 20, 30, .18); backdrop-filter: none; }
.ov-panel {
  position: relative; display: flex; flex-direction: column; background: var(--surface); color: var(--fg);
  border-radius: var(--r-16); box-shadow: var(--elev-3); max-height: 94vh; width: min(560px, 96vw); overflow: hidden;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.ov-panel:focus { outline: none; }
.ov-xl .ov-panel { width: min(1400px, 96vw); height: 94vh; }
.ov-lg .ov-panel { width: min(960px, 94vw); max-height: 88vh; }
.ov-md .ov-panel { width: min(560px, 94vw); max-height: 84vh; }
.ov-enter .ov-backdrop { opacity: 0; }
.ov-enter .ov-panel { opacity: 0; transform: translateY(8px) scale(.985); }
.ov-leave .ov-backdrop { opacity: 0; }
.ov-leave .ov-panel { opacity: 0; transform: translateY(4px) scale(.99); }
.ov-leave { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .ov-panel, .ov-backdrop { transition: none; }
  .ov-enter .ov-panel, .ov-leave .ov-panel { transform: none; }
}
.ov-head { display: flex; align-items: center; gap: var(--sp-3); padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); flex: none; }
.ov-titles { flex: 1; min-width: 0; }
.ov-title { margin: 0; font-size: var(--fs-16); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-xl .ov-title { font-size: var(--fs-20); }
.ov-sub { color: var(--text-2); font-size: var(--fs-13); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-sub:empty { display: none; }
.ov-actions { display: flex; gap: 6px; align-items: center; }
.ov-actions:empty { display: none; }
.ov-close { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.ov-close:hover { background: var(--surface-hover); color: var(--fg); }
.ov-close-float { position: absolute; top: 10px; right: 10px; z-index: 5; background: var(--surface); box-shadow: var(--elev-1); border-color: var(--line); }
/* ← Back to <label> (router in-app history; UNDERWRITING_SPEC §4) */
.ov-back { display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: min(320px, 34%); height: 32px; padding: 0 10px 0 6px; margin-left: -8px;
  border: 1px solid var(--line); border-radius: var(--r-8); background: var(--surface); color: var(--text-2); font: inherit; font-size: var(--fs-13); font-weight: 550; cursor: pointer; }
.ov-back[hidden] { display: none; }
.ov-back:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--fg); }
.ov-back svg { flex: none; }
.ov-back-txt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px 24px; }
.ov-xl .ov-body { padding: 0; }
.ov-error { padding: 24px; color: var(--fail); }
.ov-kv { width: 100%; }
.ov-kv th { width: 30%; }
.health-body h3 { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: var(--sp-5) 0 var(--sp-2); }
.health-body .tbl th, .health-body .tbl td { padding: 8px 10px; }
.health-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-12); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.health-status strong { text-transform: capitalize; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: var(--sp-3); }
.health-tile { border: 1px solid var(--line); border-radius: var(--r-12); padding: 10px 12px; background: var(--surface); }
.health-tile .ht-k { font-size: var(--fs-12); color: var(--muted); }
.health-tile .ht-v { font-size: var(--fs-16); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* fallback property overlay (property-page.js missing) */
.pp-fallback { padding: 24px 28px; display: grid; gap: 16px; }
.pp-fallback .pp-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pp-fallback .kv th { width: 180px; }

/* mobile nav sheet */
.nav-sheet { display: flex; flex-direction: column; gap: 4px; }
.nav-sheet a { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: var(--r-12); text-decoration: none; color: var(--fg); font-weight: 600; font-size: var(--fs-16); }
.nav-sheet a:hover { background: var(--surface-hover); }
.nav-sheet a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); }

/* toasts sit above overlays */
#toasts { z-index: 90; }
.toast { border-radius: var(--r-12); padding: 10px 16px; box-shadow: var(--elev-3); }
.boot { inset: var(--topbar-h) 0 0 0; z-index: 50; }
.boot-box { border-radius: var(--r-12); box-shadow: var(--elev-2); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1500px) {
  .primary-nav a { padding: 0 9px; }
  .primary-nav a[aria-current="page"]::after { left: 9px; right: 9px; }
}
@media (max-width: 1360px) {
  .brand-txt { display: none; }
  .search-wrap { flex-basis: 260px; }
}
@media (max-width: 1400px) {
  .fresh { padding: 6px 9px; }
  .fresh .fresh-txt { display: none; }
  .primary-nav a { padding: 0 7px; }
  .primary-nav a[aria-current="page"]::after { left: 7px; right: 7px; }
}
@media (max-width: 1180px) {
  .fresh .f-item:not(:first-child) { display: none; }
  .primary-nav a { padding: 0 9px; }
}
@media (max-width: 1110px) {
  .nav-toggle { display: inline-grid; }
  .primary-nav { display: none; }
  .search-wrap { flex: 1 1 auto; max-width: none; }
  .brand-txt { display: inline; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  #topbar { flex-wrap: nowrap; height: var(--topbar-h); padding: 0 8px; gap: 6px; }
  .brand { display: flex; margin-right: 0; }
  .brand-txt { display: none; }
  .search-wrap { order: 0; min-width: 0; }
  .search-kbd { display: none; }
  .top-right { order: 0; margin-left: 0; gap: 4px; }
  .fresh { padding: 6px 9px; }
  .fresh .fresh-txt { display: none; }
  .userbox .mode-pill { display: none; }
  .page-doc { padding: var(--sp-4) var(--sp-3) var(--sp-5); }
  .page-title { font-size: var(--fs-20); }
  .find-rail { top: 0; left: 0; right: 0; bottom: 0; width: auto; border-radius: 0; border: 0; z-index: 8; }
  .rail-collapsed .find-rail { transform: translateY(16px); }
  .find-drawer, .rail-collapsed .find-drawer { left: 8px; right: 8px; bottom: 8px; --drawer-l: 8px; }
  .find-drawer[data-size="full"] { --drawer-h: calc(100% - 16px); }
  .find-drawer[data-size="half"] { --drawer-h: 52%; }
  .drawer-head { padding: 0 10px 8px 12px; gap: 8px; }
  .drawer-head .results-actions { margin-left: 0; width: 100%; }
  .drawer-head #sort-select { flex: 1 1 auto; max-width: none; min-width: 0; }
  .find-drawer[data-size="peek"] { --drawer-h: 176px; }
  .find-drawer[data-size="peek"] .results-actions { display: none; }
  .rail-fab { top: 8px; left: 8px; }
  .map-tools { top: 8px; right: 8px; }
  .page-find .maplibregl-ctrl-top-right { top: 52px; }
  .page-find .map-chip { top: 56px; left: 50%; right: auto; max-width: calc(100% - 120px); transform: translateX(-50%); }
  .ov-layer { padding: 0; place-items: end center; }
  .ov-xl .ov-panel, .ov-lg .ov-panel { width: 100vw; height: calc(100% - 8px); max-height: none; border-radius: var(--r-16) var(--r-16) 0 0; }
  .ov-md .ov-panel { width: 100vw; max-height: 88vh; border-radius: var(--r-16) var(--r-16) 0 0; }
  .ov-enter .ov-panel { transform: translateY(24px); }
  .ov-head { padding: 12px 10px 12px 16px; }
  .ov-body { padding: 16px; }
  /* with a Back button the header wraps: [← Back … ×], then the title, then the actions */
  .ov-head:has(> .ov-back:not([hidden])) { flex-wrap: wrap; row-gap: 8px; }
  .ov-head:has(> .ov-back:not([hidden])) > .ov-back { order: 1; flex: 0 1 auto; max-width: calc(100% - 52px); margin-right: auto; }
  .ov-head:has(> .ov-back:not([hidden])) > .ov-close { order: 2; }
  .ov-head:has(> .ov-back:not([hidden])) > .ov-titles { order: 3; flex-basis: 100%; }
  .ov-head:has(> .ov-back:not([hidden])) > .ov-actions { order: 4; }
  .ov-back { margin-left: -6px; }
}
@media (min-width: 1361px) { .brand-txt { display: inline; } }

/* area details overlay (map.js) */
.ov-layer .area-pop > h3 { display: none; }
.ov-layer .area-pop .kv { max-width: 560px; }
.ov-layer .area-pop .kv th { width: 60%; padding: 6px 12px 6px 0; }
.ov-layer .area-pop .kv td { padding: 6px 0; }
.ov-layer .area-pop h4 { margin: 24px 0 8px; }
.ov-layer .area-pop .bb th, .ov-layer .area-pop .bb td { padding: 8px 10px; }
.ov-layer .area-pop .btn { margin-top: 20px; }
