/* Scanner */
.scanning-dialog { box-sizing: border-box; width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--border-strong); border-radius: 16px; background: #101d18; color: var(--text); padding: clamp(16px, 3vw, 28px); }
.scanning-dialog::backdrop { background: rgba(0,0,0,.7); }
.scanning-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scanning-head h2 { margin: 0; }
.scanning-dialog form, .scanning-settings form { display: grid; gap: 12px; }
.scanning-dialog label, .scanning-settings label { display: grid; gap: 5px; min-width: 0; }
.scanning-dialog select, .scanning-settings select, .scanning-settings input:not([type=checkbox]) { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); padding: 8px; }
.scanning-dialog button, .scanning-settings button, .scanning-dialog a { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); color: var(--text); cursor: pointer; }
.scanning-dialog button:disabled, .scanning-settings button:disabled { opacity: .5; cursor: default; }
.scanning-dialog :focus-visible, .scanning-settings :focus-visible { outline: 2px solid #a2dfb4; outline-offset: 2px; }
.scanning-dialog p, .scanning-settings p, #scanning-history { overflow-wrap: anywhere; }
.scanning-settings { border-top: 1px solid var(--border-strong); margin-top: 20px; padding-top: 12px; }
.scanning-settings label:has(input[type=checkbox]) { display: flex; align-items: center; }
#scanning-open[hidden], #scanning-retry[hidden] { display: none; }
#scanning-history { list-style: none; padding: 0; }
#scanning-history li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; }
.scanning-job-summary { min-width: 0; }
#scanning-history li > button { grid-column: 1 / -1; }
.scanning-dialog .scanning-download { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; grid-column: 2; grid-row: 1; width: 44px; height: 44px; padding: 0; text-decoration: none; }
.scanning-download svg { flex: none; }
.scanning-loading { position: relative; display: grid; place-items: center; height: 88px; overflow: hidden; border: 1px solid rgba(162,223,180,.18); border-radius: 12px; background: radial-gradient(ellipse at center, rgba(111,216,160,.12), transparent 75%); }
.scanning-loading > span, .scanning-connecting > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#scanning-form[hidden], #scanning-progress[hidden], #scanning-busy[hidden] { display: none; }
.scanning-body { position: relative; }
.scanning-hint-inactive { visibility: hidden; }
#scanning-busy { position: absolute; inset: 0; margin: 0; }
#scanning-status { display: flex; align-items: center; min-height: 44px; }
#scanning-status[aria-busy="true"]::before { content: ''; box-sizing: border-box; flex: 0 0 18px; width: 18px; height: 18px; margin-right: 10px; border: 2px solid rgba(162,223,180,.16); border-top-color: #a2dfb4; border-right-color: rgba(162,223,180,.55); border-radius: 50%; animation: scanning-connect-spin .9s linear infinite; }
#scanning-controls { display: grid; height: 128px; }
#scanning-controls > * { grid-area: 1 / 1; }
#scanning-progress { box-sizing: border-box; height: 128px; }
#scanning-progress::after { top: calc(50% - 22px); }
#scanning-message { min-height: 22px; }
#scanning-history { box-sizing: border-box; height: 128px; overflow-y: auto; scrollbar-gutter: stable; }
.scanning-connecting { position: relative; display: grid; place-items: center; min-height: 44px; }
.scanning-connecting::after { content: ''; box-sizing: border-box; width: 26px; height: 26px; border: 2px solid rgba(162,223,180,.16); border-top-color: #a2dfb4; border-right-color: rgba(162,223,180,.55); border-radius: 50%; box-shadow: 0 0 14px rgba(111,216,160,.08); animation: scanning-connect-spin .9s linear infinite; }
@keyframes scanning-connect-spin { to { transform: rotate(360deg); } }
.scanning-loading::before { content: ''; box-sizing: border-box; width: 36px; height: 48px; border: 1px solid rgba(162,223,180,.6); border-radius: 5px; background: repeating-linear-gradient(to bottom, rgba(162,223,180,.25) 0 1px, transparent 1px 7px) center / 22px 23px no-repeat, rgba(162,223,180,.06); box-shadow: 0 4px 18px rgba(0,0,0,.15); }
.scanning-loading::after { content: ''; position: absolute; top: 21px; width: 60px; height: 2px; border-radius: 100%; background: linear-gradient(90deg, transparent, #a2dfb4 25%, #e1ffeb 50%, #a2dfb4 75%, transparent); box-shadow: 0 0 12px 3px rgba(111,216,160,.3); animation: scanning-sweep 1.65s ease-in-out infinite alternate; }
@keyframes scanning-sweep { from { transform: translateY(0); opacity: .55; } to { transform: translateY(44px); opacity: 1; } }
.scanning-dialog:not([open]) .scanning-loading::after, .scanning-dialog:not([open]) .scanning-connecting::after, #scanning-progress[hidden]::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .scanning-loading::after { animation: none; transform: translateY(22px); } .scanning-connecting::after, #scanning-status[aria-busy="true"]::before { animation: none; } }

#mfu-open { display: none; }
.mfu-dialog { width: min(360px, calc(100vw - 24px)); }
.mfu-dialog .scanning-head > button { width: 44px; flex: none; }
.mfu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.mfu-actions button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-width: 0; min-height: 104px; padding: 12px 8px; font-size: 14px; }
.mfu-actions button[hidden] { display: none; }
.mfu-actions svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 820px), (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .mfu-ready #printing-open, .mfu-ready #scanning-open { display: none; }
  .mfu-ready #mfu-open:not([hidden]) { display: grid; }
}

/* Printing */
.printing-dialog { box-sizing: border-box; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--border-strong); border-radius: 16px; background: #101d18; color: var(--text); padding: 16px; font-size: 14px; line-height: 1.4; }
.printing-dialog::backdrop { background: rgba(0,0,0,.7); }
.printing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.printing-head h2 { margin: 0; }
.printing-body, .printing-controls { position: relative; display: flow-root; }
.printing-body.is-loading #printing-content { visibility: hidden; }
.printing-body.is-sending #printing-form, .printing-body.is-sending #printing-hint { display: none; }
.printing-body.is-sending .printing-controls { height: 200px; }
#printing-content { display: grid; gap: 10px; margin-top: 12px; }
.printing-dialog p { margin: 0; }
#printing-status { display: flex; align-items: center; min-height: 22px; }
.printing-body.is-loading #printing-status { height: 22px; overflow: hidden; }
#printing-hint, #printing-file-info, #printing-updated { font-size: 12px; color: var(--text-secondary); }
#printing-history li { padding: 6px 0; overflow-wrap: anywhere; }
#printing-history li + li { border-top: 1px solid var(--border-strong); }
#printing-file-info:empty, #printing-message:empty { display: none; }
#printing-content > section { border-top: 1px solid var(--border-strong); padding-top: 10px; }
#printing-history-title { margin: 0 0 6px; font-size: 15px; }
#printing-history-title + p { margin-bottom: 8px; font-size: 12px; }
#printing-history { box-sizing: border-box; min-height: 22px; max-height: 128px; margin: 8px 0 0; padding: 0; list-style: none; overflow-y: auto; scrollbar-gutter: stable; }
#printing-loading { position: absolute; inset: 0; margin: 0; max-height: calc(100dvh - 160px); }
#printing-loading[hidden], #printing-progress[hidden] { display: none; }
.printing-working { position: absolute; inset: 0; overflow: hidden; border: 1px solid rgba(162,223,180,.18); border-radius: 12px; background: radial-gradient(ellipse at center, rgba(111,216,160,.12), transparent 75%); }
.printing-working > span { position: absolute; top: 112px; left: 12px; right: 12px; font-size: 12px; text-align: center; }
.printing-working::before { margin-top: -60px; }
.printing-working::after { margin-top: -60px; }
.printing-working::before { content: ''; position: absolute; box-sizing: border-box; top: calc(50% - 28px); left: calc(50% - 36px); width: 72px; height: 48px; border: 1px solid rgba(162,223,180,.6); border-radius: 9px; background: radial-gradient(circle, #a2dfb4 0 2px, transparent 3px) 56px 9px / 6px 6px no-repeat, linear-gradient(#0d1914, #0d1914) center 27px / 48px 5px no-repeat, rgba(162,223,180,.08); box-shadow: 0 4px 18px rgba(0,0,0,.15); }
.printing-working::after { content: ''; position: absolute; box-sizing: border-box; top: 50%; left: calc(50% - 20px); width: 40px; height: 46px; transform-origin: center top; border: 1px solid rgba(162,223,180,.65); border-radius: 2px 2px 5px 5px; background: repeating-linear-gradient(to bottom, rgba(162,223,180,.3) 0 1px, transparent 1px 7px) center / 24px 25px no-repeat, #203b2e; animation: printing-paper-feed 2.2s ease-in-out infinite; }
@keyframes printing-paper-feed { 0%, 100% { transform: scaleY(.12); opacity: 0; } 12% { opacity: 1; } 65%, 80% { transform: scaleY(1); opacity: 1; } 95% { transform: translateY(12px) scaleY(1); opacity: 0; } }
.printing-dialog:not([open]) .printing-working::after, .printing-dialog:not([open]) .scanning-connecting::after, #printing-progress[hidden]::after, #printing-loading[hidden]::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .printing-working::after { animation: none; transform: none; opacity: 1; } }
.printing-dialog form, .printing-settings form { display: grid; gap: 12px; }
.printing-dialog form { gap: 10px; }
.printing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.printing-grid label { grid-template-rows: 1fr auto; }
.printing-dialog label, .printing-settings label { display: grid; gap: 5px; min-width: 0; }
.printing-dialog input, .printing-dialog select, .printing-settings input:not([type=checkbox]), .printing-settings select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); padding: 8px; }
.printing-dialog button, .printing-settings button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); color: var(--text); cursor: pointer; }
#printing-file { padding: 6px; font: 14px/1.4 var(--font); overflow: hidden; }
#printing-file::file-selector-button { min-height: 44px; margin-right: 12px; padding: 8px 14px; border: 1px solid rgba(162,223,180,.3); border-radius: 6px; background: rgba(125,211,164,.12); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: background var(--duration), border-color var(--duration); }
#printing-file:not(:disabled)::file-selector-button:hover { background: rgba(125,211,164,.22); border-color: #a2dfb4; }
#printing-file:focus-visible::file-selector-button { border-color: #a2dfb4; }
#printing-file:disabled { opacity: .5; }
#printing-file:disabled::file-selector-button { cursor: default; }
.printing-dialog button:disabled, .printing-settings button:disabled { opacity: .5; cursor: default; }
.printing-dialog :focus-visible, .printing-settings :focus-visible { outline: 2px solid #a2dfb4; outline-offset: 2px; }
.printing-dialog p, .printing-settings p, #printing-history { overflow-wrap: anywhere; }
.printing-settings { border-top: 1px solid var(--border-strong); margin-top: 20px; padding-top: 12px; }
.printing-settings label:has(input[type=checkbox]) { display: flex; align-items: center; }
#printing-open[hidden] { display: none; }

/* Residents */
.residents-dialog { width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface-raised); color: var(--text); padding: 18px; }
.residents-dialog::backdrop { background: rgba(0,0,0,.7); }
.residents-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.residents-head h2, .residents-map-root h3 { margin: 0 0 12px; }
.residents-dialog button, .residents-dialog a, .residents-map-root button, .residents-map-root a { min-height: 44px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.residents-picker, .residents-form label { display: grid; gap: 5px; }
.residents-picker select, .residents-form input, .residents-form select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 8px; }
.residents-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-strong); overflow-wrap: anywhere; }
.residents-row > div { flex: 1 1 130px; min-width: 0; }
.residents-form { display: grid; gap: 8px; margin-top: 12px; }
.residents-phone { display: flex; align-items: center; gap: 8px; }
.residents-status { color: var(--text-secondary); }
.residents-status:empty { display: none; }
.residents-map-root { margin-top: 14px; }
.residents-dialog { width: min(680px, calc(100vw - 24px)); box-sizing: border-box; padding: clamp(16px, 3vw, 28px); border-radius: 22px; background: #101d18; }
.residents-head { align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid #30473c; margin-bottom: 20px; }
.residents-head h2 { margin: 5px 0; font-size: 26px; letter-spacing: -.03em; }
.residents-head p { margin: 0; color: #a3b8aa; font-size: 13px; }
.residents-eyebrow { color: #92c7a4; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.residents-head svg, .residents-icon { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.residents-dialog button, .residents-map-root button, .residents-dialog a, .residents-map-root a { gap: 7px; cursor: pointer; }
.residents-dialog button:focus-visible, .residents-dialog a:focus-visible, .residents-dialog input:focus-visible, .residents-dialog select:focus-visible, .residents-map-root :focus-visible { outline: 2px solid #a2dfb4; outline-offset: 2px; }
.residents-picker { gap: 10px; }
.residents-search-label, .residents-picker-title, .residents-form label { color: #b3c8ba; font-size: 12px; font-weight: 700; }
.residents-search { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding-left: 12px; border: 1px solid #3a5546; border-radius: 12px; background: #0b1712; color: #9ac9aa; }
.residents-search input { flex: 1; width: 0; min-width: 0; min-height: 44px; border: 0; background: transparent; color: #f0f8f2; }
.residents-search button { border: 0; background: transparent; font-size: 12px; }
.residents-search button[hidden] { display: none; }
.residents-results { display: grid; gap: 6px; align-content: start; min-height: 0; max-height: min(300px, 40dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 4px; margin: -4px; }
.residents-results:empty { display: none; }
.residents-results p { color: #b3c8ba; font-size: 13px; }
.residents-dialog .residents-result { justify-content: flex-start; text-align: left; background: #1a3024; }
.residents-result span { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.residents-result small { color: #b3c8ba; }
.residents-picker select, .residents-form input, .residents-form select { color: #eff8f1; border-color: #3a5546; background: #0b1712; border-radius: 10px; }
.residents-row { margin: 8px 0; padding: 12px; border: 1px solid #30473c; border-radius: 12px; background: #162820; }
.residents-row strong { display: block; margin-bottom: 5px; }
.residents-row { flex-wrap: nowrap; gap: 6px; }
.residents-row > div { flex: 1 1 0; }
.residents-gender { flex: 0 0 18px; padding: 3px 0; border-radius: 5px; background: #203c2d; color: #acc5b4; font-size: 11px; line-height: 16px; text-align: center; }
.residents-row .residents-call, .residents-row .residents-delete { min-width: 44px; }
.residents-detail-title:focus-visible { outline: 2px solid #a2dfb4; outline-offset: 3px; border-radius: 3px; }
.residents-row > div > div { color: #acc5b4; font-size: 13px; }
.residents-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.residents-meta span { padding: 2px 6px; border-radius: 5px; background: #203c2d; font-size: 11px; }
.residents-form { margin-top: 18px; padding: 14px; border: 1px solid #30473c; border-radius: 12px; background: #14241c; }
.residents-form button { background: #315c40; }
.residents-map-root { border-top: 1px solid #30473c; padding-top: 16px; }
.residents-map-root h3 { font-size: 15px; }
.residents-status { font-size: 13px; }
.residents-search:focus-within { outline: 2px solid #a2dfb4; outline-offset: 2px; }
.residents-dialog .residents-search input:focus-visible { outline: none; box-shadow: none; }
.residents-dialog .residents-result[aria-pressed="true"] { border-color: #83c99b; background: #254433; }
.residents-preview { color: #e0f3e5 !important; font-weight: 400; }
.residents-detail-title { margin: 0 0 8px; font-size: 17px; }
.residents-back { display: none !important; }
.residents-add { width: 100%; margin-top: 12px; }
.residents-form[hidden], .residents-add[hidden] { display: none; }
.residents-form button:last-child { background: transparent; }
.residents-map-root h3 { display: flex; align-items: center; gap: 8px; color: #c8ead2; }
.residents-map-root ~ .object-meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid #30473c; opacity: .8; }
.residents-map-root ~ .detail-action { opacity: .8; }
@media (min-width: 600px) {
  #residents-dialog-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: auto auto auto auto auto; column-gap: 20px; align-items: start; }
  #residents-dialog-content > .residents-picker { grid-column: 1; grid-row: 1 / span 5; }
  #residents-dialog-content > .residents-detail-title { grid-column: 2; grid-row: 1; }
  #residents-dialog-content > .residents-status { grid-column: 2; grid-row: 2; }
  #residents-dialog-content > .residents-list { grid-column: 2; grid-row: 3; }
  #residents-dialog-content > .residents-form, #residents-dialog-content > .residents-add { grid-column: 2; grid-row: 4; }
}
@media (max-width: 599px) {
  #residents-dialog-content:not(.detail-open) > :not(.residents-picker):not(.residents-status) { display: none; }
  #residents-dialog-content.has-error:not(.detail-open) > .residents-list { display: block; }
  #residents-dialog-content.detail-open > .residents-picker { display: none; }
  #residents-dialog-content.detail-open { display: flex; flex-direction: column; }
  #residents-dialog-content.detail-open > .residents-back { display: inline-flex !important; align-self: flex-start; order: -2; margin-bottom: 14px; }
  #residents-dialog-content.detail-open > .residents-detail-title { order: -1; }
}
@media (prefers-reduced-motion: reduce) { .residents-dialog, .residents-map-root { scroll-behavior: auto; } }

/* ═════════════════════════════════════════════════
   Serovo · Premium Forest Residence
   Glass-morphism dashboard — plain CSS, no build
   ═════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────── */
:root {
  color-scheme: dark;
  font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  --surface: #080f0d;
  --surface-raised: #0f1916;
  --surface-elevated: #162420;
  --surface-glass: rgba(13, 24, 21, 0.82);
  --surface-hover: #15241e;
  --surface-active: #0c1a15;

  --text: #e6efe8;
  --text-primary: #e6efe8;
  --text-secondary: #a1b8ab;
  --text-muted: #6b8277;

  --accent: #7dd3a4;
  --accent-bright: #a8f0cc;
  --accent-dim: #4a946e;

  --gold: #dfc778;
  --gold-bright: #f5e2a0;
  --red: #ff7d68;
  --red-bright: #ffaa9a;
  --amber: #dfb860;
  --blue: #7ec8d8;

  --border: rgba(160, 195, 175, 0.07);
  --border-strong: rgba(160, 195, 175, 0.14);
  --app-pattern: rgba(255, 255, 255, 0.04);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px rgba(220, 248, 231, 0.015);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --font: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --duration: 240ms;

  --night-light: 1;
  --daylight: 0;
  --map-ground: #0d1512;
  --map-land: #13221b;
  --map-clearing: #4b583e;
  --map-glade: #334b3a;
  --map-label: #efeada;
  --map-label-outline: #122019;
  --map-road: #8f8673;
  --map-tree-shadow: #1a2a20;
  --map-tree-crown: #29402e;
  --map-tree-highlight: #304733;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box }
html, body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background-color: #0d1512;
}
button, input, select { font: inherit; color: inherit }
button, a, summary {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.legend-item:focus-visible,
.event-item:focus-visible,
.rail-button:focus-visible,
.object-popover-close:focus-visible,
.icon-button:focus-visible,
.map-corner-button:focus-visible,
.lighting-bulb:focus-visible,
.stat-chip:focus-visible,
.more-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── App installation ──────────────────────── */
.install-app-button {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface-elevated);
}
.install-app-button:hover { background: var(--surface-hover) }
.install-app-button:disabled { opacity: .6; cursor: wait }
.install-app-button[hidden] { display: none }
.install-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
}
.install-dialog::backdrop { background: rgba(0, 0, 0, .65) }
.install-dialog img { border-radius: 14px }
.install-dialog h2 { margin: 16px 0 12px; font-size: 22px }
.install-dialog p { line-height: 1.6 }
.install-note { color: var(--text-secondary); font-size: 13px }

/* ── App Shell ─────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding: 0 12px 12px;
  gap: 12px;
  overflow: hidden;
}

/* ── Topbar ────────────────────────────────── */
.topbar {
  z-index: 4;
  display: flex;
  flex: 0 0 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.brand {
  display: flex;
  flex: 0 0 222px;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #245c48, #10261d);
  box-shadow: 0 0 22px rgba(125, 211, 164, 0.18), 0 4px 16px rgba(2, 16, 12, 0.4), inset 0 1px rgba(232, 248, 236, 0.16);
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.brand:hover .brand-mark {
  transform: scale(1.04);
  box-shadow: 0 0 28px rgba(125, 211, 164, 0.28), 0 6px 20px rgba(2, 16, 12, 0.45), inset 0 1px rgba(232, 248, 236, 0.22);
}
.brand-mark img { width: 42px; height: 42px }
.brand-copy { display: flex; flex-direction: column; gap: 2px }
.brand-copy strong {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.055em;
}
.brand-copy small {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.topbar-center {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 11px;
}
.topbar-center > strong { font-weight: 600; white-space: nowrap }
.crumb-muted, .crumb-divider { color: var(--text-muted); display: none }
.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 14px;
  padding-left: 17px;
  border-left: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 10px;
  white-space: nowrap;
}
.location-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 9px rgba(168, 240, 204, 0.4);
}

.topbar-actions { display: flex; align-items: center; gap: 10px }
.mobile-menu {
  display: none !important;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: none;
  cursor: pointer;
  transition: background var(--duration), border-color var(--duration), transform var(--duration) var(--ease);
}
.mobile-menu:hover {
  border-color: var(--accent-dim);
  background: var(--surface-hover);
  transform: scale(1.03);
}
/* Show mobile-menu on desktop when inspector is collapsed so user can reopen */
body.monitoring-collapsed .mobile-menu { display: grid !important }
.mobile-menu svg {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* ── Workspace Layout ──────────────────────── */
.workspace {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: 60px minmax(0, 1fr) 326px;
  gap: 0;
}

/* ── Rail ──────────────────────────────────── */
.rail {
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.rail-spacer { flex: 1 }
.rail-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color var(--duration), background var(--duration), transform var(--duration) var(--ease), box-shadow var(--duration);
}
.rail-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  transform: scale(1.04);
}
.rail-button:active { transform: scale(0.97) }
.rail-button.active {
  color: var(--accent-bright);
  background: rgba(125, 211, 164, 0.12);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 164, 0.18), 0 0 16px rgba(125, 211, 164, 0.12);
}
.rail-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}
.rail-editor-button[aria-pressed="true"] {
  color: var(--accent-bright);
  background: rgba(125, 211, 164, 0.16);
}
.rail-editor-button { display: none }
.lighting-toggle[aria-expanded="true"] {
  color: var(--gold-bright);
  background: rgba(223, 199, 120, 0.12);
  box-shadow: inset 0 0 0 1px rgba(223, 199, 120, 0.22), 0 0 16px rgba(223, 199, 120, 0.12);
}

/* ── Map Area ──────────────────────────────── */
.map-area {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  isolation: isolate;
}

/* ── Map Stage ─────────────────────────────── */
.map-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.map-stage.dragging { cursor: grabbing }
#weather-effects { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
#weather-effects[hidden], body.map-loading #weather-effects, body.map-failed #weather-effects { display: none; }
#weather-effects .weather-particle { position: absolute; left: var(--x); top: -5%; width: 1px; height: 16px; background: rgba(190, 220, 230, .28); animation: weather-fall var(--duration) linear var(--delay) infinite; }
#weather-effects.snow .weather-particle { width: 3px; height: 3px; border-radius: 50%; background: rgba(240, 250, 255, .6); }
#weather-effects.thunder::after { content: ''; position: absolute; left: 12%; top: 5%; width: 35%; height: 25%; background: radial-gradient(ellipse, rgba(210, 225, 255, .09), transparent 70%); opacity: 0; animation: weather-glow 18s ease-in-out infinite; }
@keyframes weather-fall { from { transform: translate3d(0, -5vh, 0); } to { transform: translate3d(-30px, 110vh, 0); } }
@keyframes weather-glow { 0%, 90%, 100% { opacity: 0; } 94% { opacity: 1; } }
#weather-effects-toggle:disabled { color: var(--text-secondary); cursor: default; }
#weather-effects-status { margin: 0; }
#weather-effects-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { #weather-effects { display: none !important; } }
#site-map {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#site-map, #site-map * { -webkit-user-select: none; user-select: none }
body.map-loading #site-map,
body.map-failed #site-map { visibility: hidden }
#world {
  transform-origin: 0 0;
  transition: transform 0.24s var(--ease);
}

/* ── Loading Overlay ───────────────────────── */
.map-loading-overlay {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
  color: var(--text);
  background: transparent;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
body.map-ready .map-loading-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.map-failed .map-loading-overlay {
  background: #1d1811;
  color: #e8c9b4;
}
.map-loader-mark { width: 62px; height: 62px; margin-bottom: 12px }
.map-loader-mark svg { display: block; width: 100%; height: 100% }
.map-loader-mark .loader-track {
  fill: none;
  stroke: #4d6b57;
  stroke-width: 3.5;
  opacity: 0.5;
}
.map-loader-mark .loader-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 41 123;
  transform-origin: 32px 32px;
  animation: map-loader-spin 1.15s cubic-bezier(.55, .2, .45, .8) infinite;
}
body.map-ready .map-loader-mark .loader-arc { animation: none }
body.map-failed .map-loader-mark .loader-arc {
  stroke: #e0936c;
  animation: none;
  stroke-dasharray: 164 0;
}
.map-loader-mark .loader-error {
  fill: none;
  stroke: #e0936c;
  stroke-width: 4;
  stroke-linecap: round;
}
@keyframes map-loader-spin { to { transform: rotate(360deg) } }
.map-loading-title {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}
.map-loading-hint {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
}
body.map-failed .map-loading-title { color: #f0d3c1 }
body.map-failed .map-loading-hint { color: #bf9c86 }
.map-loading-retry {
  margin-top: 14px;
  padding: 9px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-elevated);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--duration), background var(--duration), transform 0.15s var(--ease);
}
.map-loading-retry:hover {
  border-color: rgba(125, 211, 164, 0.4);
  background: #1c3329;
}
.map-loading-retry:active { transform: scale(0.97) }
body.map-loading .map-settings-corner,
body.map-loading .map-zoom,
body.map-failed .map-settings-corner,
body.map-failed .map-zoom {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Map Toolbar ───────────────────────────── */
.map-toolbar {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  left: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  pointer-events: none;
}
.map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 380px;
  pointer-events: auto;
}

.search-box {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 9px 0 11px;
  width: 190px;
  order: -1;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition: border-color var(--duration), box-shadow var(--duration);
}
.search-box:focus-within {
  border-color: rgba(125, 211, 164, 0.5);
  box-shadow: 0 0 0 3px rgba(125, 211, 164, 0.08), var(--shadow-card);
}
.search-box svg {
  width: 15px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-linecap: round;
  stroke-width: 1.7;
}
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-size: 11px;
}
.search-box input::placeholder { color: var(--text-muted) }
.search-box input:focus-visible { outline: none }
.search-box kbd {
  display: grid;
  width: 17px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
}
.kbd-hint {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-size: 9px;
  color: var(--text-muted);
  background: var(--surface-raised);
  margin-left: 4px;
}
.topbar-actions .topbar-search {
  order: 0;
  flex: 0 0 180px;
  width: 180px;
  background: var(--surface-raised);
  border-color: var(--border-strong);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.topbar-actions .topbar-search:focus-within {
  border-color: rgba(125, 211, 164, 0.5);
  box-shadow: 0 0 0 3px rgba(125, 211, 164, 0.08);
}

.tool-button {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--duration), background var(--duration), transform 0.15s var(--ease);
}
.tool-button:hover {
  border-color: rgba(125, 211, 164, 0.42);
  background: rgba(22, 42, 36, 0.92);
  transform: scale(1.02);
}
.tool-button:active { transform: scale(0.97) }
.tool-button > svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}
.tool-button .external-icon { width: 11px; height: 11px; margin-left: 1px; opacity: 0.7 }
.road-editing .tool-button[aria-pressed="true"] {
  color: var(--accent-bright);
  border-color: var(--accent);
}

/* Always hide satellite button */
.satellite-button { display: none }

/* ── Systems Panel ─────────────────────────── */
.systems-panel {
  position: absolute;
  z-index: 3;
  top: 140px;
  left: 24px;
  padding: 0;
  width: 280px;
  max-width: calc(100% - 48px);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  font-size: 11px;
}
.systems-panel:not([open]) { width: auto }
.systems-panel summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 14px;
  list-style: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}
.systems-panel summary::-webkit-details-marker { display: none }
.systems-panel summary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.systems-chevron { margin-left: auto; color: var(--text-muted); transition: transform var(--duration) }
.systems-panel[open] summary { border-bottom: 1px solid var(--border) }
.systems-panel[open] .systems-chevron { transform: rotate(180deg) }
.systems-panel > label,
.systems-panel > p,
.systems-panel > .lighting-lines { margin: 14px }
.systems-panel > button { margin: 0 14px 14px }
.systems-panel select {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  font-size: 11px;
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
}
.systems-panel p { font-size: 10px; color: var(--text-secondary); line-height: 1.5 }
.systems-panel label { display: flex; align-items: center; gap: 8px; margin-top: 12px }
.lighting-lines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px }
.systems-panel .lighting-lines button {
  min-height: 45px;
  border-radius: 9px;
  padding: 5px;
  font-size: 10px;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.systems-panel button[aria-pressed="true"] {
  background: #294635;
  color: #d5efb1;
  border-color: var(--accent);
}
.systems-panel > button {
  font-size: 9px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 0;
  min-height: 30px;
}
.systems-panel button:disabled { cursor: default; opacity: 0.7 }

/* ── Legend ────────────────────────────────── */
.map-legend {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 7px;
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}
.legend-item {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, opacity 0.18s;
}
.legend-item:hover { background: rgba(255, 255, 255, 0.04) }
.legend-item.disabled { opacity: 0.55; background: transparent; border-color: transparent }
.legend-item:not(.disabled) { background: rgba(125, 211, 164, 0.05) }
.legend-item b {
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 18px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 4px;
  background: rgba(182, 212, 188, 0.04);
}
.legend-gear {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-elevated);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.legend-gear svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.legend-gear:hover { background: #1e332c }
.legend-gear.active {
  color: var(--accent-bright);
  background: #2c5141;
  border-color: rgba(125, 211, 164, 0.4);
}
.legend-gear.active svg { stroke: var(--accent-bright) }
.legend-symbol { position: relative; display: inline-block; width: 11px; height: 11px }
.home-symbol {
  width: 10px;
  height: 7px;
  margin-top: 4px;
  border: 1px solid #e0b294;
  background: #ae6d54;
}
.home-symbol::before {
  position: absolute;
  top: -6px;
  left: -2px;
  width: 8px;
  height: 8px;
  border-top: 1px solid #e0b294;
  border-left: 1px solid #e0b294;
  content: '';
  transform: rotate(45deg);
}
.camera-symbol {
  width: 8px;
  height: 8px;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: #275b5c;
  box-shadow: 0 0 5px rgba(126, 200, 216, 0.35);
}
.wire-symbol { width: 13px; height: 1px; border-top: 1px dashed var(--gold) }
.editor-symbol {
  width: 11px;
  height: 11px;
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  background: rgba(125, 211, 164, 0.14);
}

/* ── Map Corner Buttons ────────────────────── */
.map-corner-button,
.map-zoom {
  position: absolute;
  z-index: 4;
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  box-sizing: border-box;
}
.map-corner-button {
  display: grid;
  place-items: center;
  color: #cfe0d4;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  transition: color 0.18s, transform 0.15s var(--ease);
}
.map-corner-button:hover { color: #fff; transform: scale(1.08) }
.map-corner-button:active { transform: scale(0.94) }
.map-corner-button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-settings-corner { left: 12px }
.map-settings-corner[hidden] { display: none }
.map-settings-corner[aria-expanded="true"] { color: var(--accent-bright) }
.map-zoom {
  right: 12px;
  display: grid;
  align-items: center;
  justify-content: center;
  grid-template-columns: 44px;
}
.map-zoom button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  font-size: 24px;
  color: #cfe0d4;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  transition: color 0.18s, transform 0.15s var(--ease);
}
.map-zoom button:hover { color: #fff; transform: scale(1.08) }
.map-zoom button:active { transform: scale(0.94) }
.map-zoom button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.map-layer { transition: opacity 0.25s }
.map-layer.hidden { opacity: 0; pointer-events: none }

/* Pulse glow on matched map objects */
.map-house.search-match,
.map-camera.search-match,
.utility-pole.search-match,
.map-custom-object.search-match {
  filter: drop-shadow(0 0 8px var(--accent-bright));
  animation: search-pulse 1.2s ease-in-out infinite;
}
@keyframes search-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px var(--accent-bright)); }
  50% { filter: drop-shadow(0 0 14px var(--accent-bright)) brightness(1.3); }
}
body.search-active .map-house:not(.search-match),
body.search-active .map-camera:not(.search-match),
body.search-active .utility-pole:not(.search-match),
body.search-active .map-custom-object:not(.search-match),
body.search-active .facility:not(.search-match) {
  opacity: 0.3;
  transition: opacity 0.3s;
}

/* ── Map Settings Popover ──────────────────── */
.map-settings-panel {
  position: fixed;
  z-index: 8;
  left: 0;
  top: 0;
  display: grid;
  gap: 6px;
  height: auto;
  min-height: 0;
  width: min(280px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}
.map-settings-panel[hidden] { display: none }
.map-settings-panel .legend-item {
  min-height: 44px;
  padding: 0 12px;
  justify-content: flex-start;
  gap: 8px;
  font-size: 11px;
}
.map-settings-panel .settings-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 12px;
}
.map-settings-panel .settings-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 36px;
}
.map-settings-panel .settings-label select {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-primary);
  font: inherit;
  font-size: 11px;
  padding: 2px 6px;
}
.map-settings-panel .settings-status {
  padding: 0 12px 8px;
  font-size: 9px;
  color: var(--text-muted);
}

/* ── Map Fade ──────────────────────────────── */
.map-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Dragging uses direct vector transforms without easing. */
.map-stage.dragging #world { transition: none }

/* ── SVG Map Canvas ────────────────────────── */
#site-map > rect { transition: fill 2s linear }
.map-ground { transition: fill 2s linear }
.site-land {
  fill: var(--map-land);
  stroke: #9fc4a3;
  stroke-opacity: 0.15;
  stroke-width: 2;
  transition: fill 2s linear;
}
#forest-texture path { transition: fill 2s linear }
.site-canopy { fill: url(#forest-texture); opacity: 0.48 }
.clearing {
  fill: var(--map-clearing);
  fill-opacity: 0.24;
  stroke: #718268;
  stroke-opacity: 0.1;
  stroke-width: 1.5;
  transition: fill 2s linear;
}
.terrain-line { display: none }
.site-road-outline {
  fill: none;
  stroke: #192b22;
  stroke-opacity: 0.65;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-road {
  fill: none;
  stroke: var(--map-road);
  stroke-opacity: 0.83;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 2s linear;
}
.site-trail {
  fill: none;
  stroke: #ccd9ad;
  stroke-opacity: 0.68;
  stroke-width: 2;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.property-boundary {
  fill: none;
  stroke: #4f9871;
  stroke-width: 4;
  stroke-opacity: 0.85;
  stroke-linejoin: round;
  pointer-events: none;
}
.fence-posts {
  fill: none;
  stroke: #add1a7;
  stroke-opacity: 0.6;
  stroke-width: 6;
  stroke-dasharray: 1 22;
  stroke-linejoin: round;
  pointer-events: none;
}
.pond {
  fill: url(#surface-water);
  fill-opacity: 0.92;
  stroke: #96d1cc;
  stroke-opacity: 0.65;
  stroke-width: 2.5;
  filter: drop-shadow(1px 3px 2px rgba(6, 28, 37, 0.34));
}
.facility rect { fill: url(#surface-wood); stroke: #dbc393; stroke-opacity: 0.6; fill-opacity: 0.85 }
.facility.bathhouse rect { fill: #987b5a; fill-opacity: 0.78 }
.facility.bathhouse text { fill: #e0cfac; font-size: 14px }
.water-tower { fill: #8b7654; fill-opacity: 0.6; stroke: #e2ca95; stroke-opacity: 0.68; stroke-width: 2 }
.facility-label, .facility text {
  fill: var(--map-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.09em;
  paint-order: stroke;
  stroke: var(--map-label-outline);
  stroke-width: 4;
  transition: fill 2s linear, stroke 2s linear;
}
.map-label {
  fill: var(--map-label);
  opacity: 0.3;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.18em;
  transition: fill 2s linear, stroke 2s linear;
}
.map-label-retired { display: none }
.object-label {
  fill: var(--map-label);
  stroke: var(--map-label-outline);
  stroke-width: 5.5;
  paint-order: stroke;
  font-family: var(--font);
  font-size: 19px;
  font-weight: 800;
  text-anchor: middle;
  letter-spacing: -0.03em;
  transition: fill 2s linear, stroke 2s linear;
}
.entry-label, .map-pin .entry-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: var(--map-label);
  stroke: var(--map-label-outline);
  paint-order: stroke;
  transition: fill 2s linear, stroke 2s linear;
}
.map-pin circle { fill: var(--gold); fill-opacity: 0.1; stroke: var(--gold); stroke-opacity: 0.6; stroke-width: 1.2 }
.map-pin path { fill: var(--gold) }
.map-pin text { fill: #f0d7a8; font-size: 9px; font-weight: 700; letter-spacing: 0.13em }
.north-arrow circle { fill: #1a281e; fill-opacity: 0.72; stroke: #dce8d6; stroke-opacity: 0.16 }
.north-arrow path { fill: #c8d6be }
.north-arrow text { fill: #b5c3ae; font-size: 11px; font-weight: 700 }

/* ── Houses ────────────────────────────────── */
.map-house { cursor: pointer; outline: none }
.map-house.selected { filter: drop-shadow(0 0 6px rgba(168, 240, 204, 0.35)) }
.house-glow { fill: #d5efad; opacity: 0; transition: opacity 0.22s }
.house-shadow { fill: rgba(12, 28, 20, 0.38) }
.map-icon .house-base { fill: none; stroke: none; pointer-events: none }
.map-icon .house-wall-front { fill: url(#surface-wall); stroke: #dddbc0; stroke-width: 0.65 }
.map-icon .house-wall-side, .map-icon .house-gable { fill: #988b72; stroke: #c8b596; stroke-width: 0.55 }
.icon-commander .house-wall-front { fill: #bd946b; stroke: #e0be93 }
.icon-commander .house-wall-side, .icon-commander .house-gable { fill: #956e4e; stroke: #d0aa7d }
.slate-house .map-icon .house-wall-front { fill: #578faa; stroke: #a4cbdc }
.slate-house .map-icon .house-wall-side, .slate-house .map-icon .house-gable { fill: #36667f; stroke: #83afc1 }
.yellow-siding-house .map-icon .house-wall-front { fill: #f5df88; stroke: #fff0b8 }
.yellow-siding-house .map-icon .house-wall-side, .yellow-siding-house .map-icon .house-gable { fill: #e1c66d; stroke: #f5e095 }
.house-siding-front, .house-siding-side { display: none }
.yellow-siding-house .house-siding-front,
.yellow-siding-house .house-siding-side {
  display: block;
  fill: none;
  stroke: #a98830;
  stroke-width: 0.6;
  opacity: 0.85;
  pointer-events: none;
}
.dark-wood-house .map-icon .house-wall-front { fill: #705039; stroke: #ae8760 }
.dark-wood-house .map-icon .house-wall-side, .dark-wood-house .map-icon .house-gable { fill: #4e3527; stroke: #896346 }
.dark-wood-house .house-siding-front,
.dark-wood-house .house-siding-side {
  display: block;
  fill: none;
  stroke: #352319;
  stroke-width: 0.55;
  opacity: 0.8;
  pointer-events: none;
}
.map-icon .house-roof.house-roof-far { fill: #843a32; stroke: #d88b70 }
.map-icon .house-roof { fill: url(#surface-roof); stroke: #f5b08b; stroke-width: 0.65 }
.map-icon .house-roof-ribs { fill: none; stroke: #f3b099; stroke-width: 0.45; opacity: 0.48 }
.map-icon .house-roof-line { fill: none; stroke: #fbc4a2; opacity: 0.75; stroke-width: 0.7 }
.map-icon .house-roof-shade { fill: #722c29; opacity: 0.5; stroke: none }
.map-icon .house-eave { fill: none; stroke: #532b25; stroke-width: 1.4; stroke-linecap: round }
.map-icon .house-side-window { fill: #3a6470; stroke: #b0c7bc; stroke-width: 0.5 }
.map-icon .house-chimney-side { fill: #697c75; stroke: #b2bbab; stroke-width: 0.5 }
.map-icon .house-chimney-cap { fill: #cad0bd; stroke: #edf0d6; stroke-width: 0.4 }
.map-icon .house-door { fill: #5c4a34; stroke: #e9d3a6; stroke-width: 0.6 }
.map-icon .house-window { fill: #588e9d; opacity: 1; stroke: #c2e0e0; stroke-width: 0.65 }
.map-icon .house-window-lines { fill: none; stroke: #c2e0e0; stroke-width: 0.45 }
.map-icon .winter-skylight { fill: #427285; stroke: #e3c4a5; stroke-width: 0.6 }
.map-house:hover .house-base, .map-house.selected .house-base { stroke: none }
.map-house:hover .house-wall-front, .map-house.selected .house-wall-front { stroke: #c5f9ce; stroke-width: 1.5 }
.map-house.selected .house-roof { fill: #c15a48 }
.map-house.selected .house-roof.house-roof-far { fill: #934333 }
.map-house.alarm .house-roof, .commander-house.alarm .house-roof { fill: #ff725b; stroke: #ffcfb3 }
.map-house.alarm .house-roof.house-roof-far { fill: #cc4c3d; stroke: #ffcfb3 }
.map-house.alarm .house-glow {
  fill: #e80000;
  stroke: #fff3a0;
  stroke-width: 3;
  opacity: 0.95;
  animation: none;
}
.map-house.alarm .object-label { fill: #fff; stroke: #a00000; stroke-width: 3px; paint-order: stroke; font-weight: 800 }
body.search-active .map-house.alarm:not(.search-match) { opacity: 1 }
.house-alarm-banner { position: fixed; z-index: 100; top: max(4px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(700px, calc(100% - 16px)); max-height: 40dvh; overflow: auto; padding: 12px; border: 3px solid #fff; border-radius: 12px; background: #a40000; color: #fff; box-shadow: 0 4px 24px #000b; font-weight: 800; font-size: clamp(18px, 3vw, 26px) }
.house-alarm-banner[hidden] { display: none }
.house-alarm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px }
.house-alarm-actions button { min-height: 44px; padding: 8px 12px; border: 2px solid white; border-radius: 6px; background: #fff; color: #780000; font: inherit; font-size: 15px; cursor: pointer }
.house-alarm-actions button:focus-visible { outline: 3px solid #ffeb66; outline-offset: 2px }
.slate-house:not(.alarm) .map-icon .house-roof-near { fill: #a6aea9; stroke: #d8ded3 }
.slate-house:not(.alarm) .map-icon .house-roof-far { fill: #737f7b; stroke: #b6c1b8 }
.slate-house .map-icon .house-roof-ribs { fill: none; stroke: #d7ded6; stroke-width: 0.8; opacity: 0.75 }
.slate-house .map-icon .house-roof-line { fill: none; stroke: #e3e7df }
.slate-house .map-icon .house-eave { stroke: #535f5c }
.map-icon .winter-chimney { fill: #a6b4aa; stroke: #e9e3ce; stroke-width: 0.7 }
.map-icon .commander-crest { fill: #edc46a; stroke: #fce7b5; stroke-width: 0.6 }
.map-icon .commander-crest-line { fill: none; stroke: #33564b; stroke-width: 1 }
.map-icon .commander-porch { fill: url(#surface-wood); stroke: #efce92; stroke-width: 0.75 }
.commander-label { font-size: 9px; fill: #e7c897 }

/* ── Gates & Guard ─────────────────────────── */
.map-icon .guard-body, .map-icon .gate-leaf { fill: url(#surface-metal); stroke: #bdd4a8; stroke-width: 0.85 }
.map-icon .guard-roof { fill: #649674; stroke: #bcdbba; stroke-width: 0.65 }
.map-icon .guard-ribs, .map-icon .gate-bars { fill: none; stroke: #163d2b; stroke-opacity: 0.55; stroke-width: 0.6 }
.map-icon .guard-window { fill: #356878; stroke: #b7d7d4; stroke-width: 0.7 }
.map-icon .guard-door { fill: #2e5c44; stroke: #94bca0; stroke-width: 0.7 }
.map-icon .guard-underbody { fill: #172d28; stroke: #748d7d; stroke-width: 0.5 }
.map-icon .guard-badge { fill: #d4b84c; stroke: #c0a840; stroke-width: 0.6 }
.map-icon .guard-trim { fill: none; stroke: #b9d2b5; stroke-width: 0.6 }
.map-icon .gate-post { fill: #45644e; stroke: var(--gate-color); stroke-width: 0.65 }
.map-icon .gate-post-cap { fill: var(--gate-color); stroke: none }
.map-icon .gate-direction { fill: none; stroke: var(--gate-color); stroke-width: 1.1; opacity: 0.9 }
.map-icon .gate-swing { fill: none; stroke: var(--gate-color); stroke-width: 0.8; opacity: 0.7; stroke-dasharray: 3 2 }
.map-icon .gate-hinges { fill: none; stroke: #bdd4a8; stroke-width: 0.9 }
.map-icon .gate-handle { fill: #c9dbb8; stroke: #5a7a4a; stroke-width: 0.5 }
.map-icon .gate-wheel { fill: #a8c4a0; stroke: #5a7a4a; stroke-width: 0.6 }
.map-icon .gate-track { fill: none; stroke: #8aab8a; stroke-opacity: 0.6; stroke-width: 0.6 }
.map-icon .gate-highlight { fill: none; stroke: #cfddbb; stroke-width: 0.7; stroke-opacity: 0.6 }
.map-icon .gate-shadow { fill: rgba(10, 24, 16, 0.42) }
.map-icon .icon-shadow { fill: rgba(10, 24, 16, 0.39) }

/* ── Tower ─────────────────────────────────── */
.map-icon .tower-shaft, .map-icon .tower-tank { fill: url(#surface-brick); stroke: #edc09a; stroke-width: 0.5 }
.map-icon .tower-roof { fill: #617c73; stroke: #c3cead; stroke-width: 0.7 }
.tower-shadow { fill: rgba(10, 24, 16, 0.35) }
.map-icon .tower-shade, .map-icon .tower-tank-shade { fill: #3a2018; opacity: 0.28 }
.map-icon .tower-bands { fill: none; stroke: #6e4b37; stroke-opacity: 0.55; stroke-width: 0.5 }
.map-icon .tower-bricks { fill: none; stroke: #6e4b37; stroke-opacity: 0.35; stroke-width: 0.4 }
.map-icon .tower-window, .map-icon .tower-door { fill: #264c53; stroke: #f0bd8f; stroke-width: 0.5 }
.map-icon .tower-antenna { fill: none; stroke: #8a9e91; stroke-width: 0.7 }

/* ── Playground & Football ─────────────────── */
.gazebo-shadow { fill: rgba(10, 24, 16, 0.35) }
.gazebo-floor { fill: #a68252; stroke: #dfc08b; stroke-width: 0.8 }
.gazebo-deck { fill: none; stroke: #6f5235; stroke-width: 0.6 }
.gazebo-posts { fill: none; stroke: #d1ad75; stroke-width: 2; stroke-linecap: round }
.gazebo-rails { fill: none; stroke: #ae8754; stroke-width: 1 }
.map-icon .gazebo-roof { fill: #866340; stroke: #dcba82; stroke-width: 0.9 }
.gazebo-roof-lines { fill: none; stroke: #bd9765; stroke-width: 0.7 }
.gazebo-table { fill: none; stroke: #e4c18b; stroke-width: 1.4; stroke-linecap: round }
.map-icon .playground-shadow { fill: rgba(10, 24, 16, 0.35) }
.carousel-shadow { fill: rgba(10, 24, 16, 0.35) }
.map-icon .playground-frame { fill: none; stroke: #97c6cc; stroke-width: 1.15 }
.map-icon .playground-frame-back { fill: none; stroke: #527f8e }
.playground-chain { fill: none; stroke: #e0d8ab; stroke-width: 0.5 }
.playground-slide-side { fill: #ac823c; stroke: #e6b760; stroke-width: 0.6 }
.carousel-edge { fill: #81533c; stroke: #b89064; stroke-width: 0.5 }
.carousel-deck { fill: #b87d4e; stroke: #efd0a0; stroke-width: 0.6 }
.carousel-rails { fill: none; stroke: #a5d1d1; stroke-width: 0.85; stroke-linejoin: round }
.carousel-seat { fill: #d9ba73; stroke: #856337; stroke-width: 0.5 }
.playground-slide { fill: #d4894a; stroke: #f0c080; stroke-width: 0.5 }
.playground-seat { fill: #7ab89e; stroke: #c0e0d0; stroke-width: 0.4 }
.map-icon .playground-roof { fill: url(#surface-roof) }
.map-icon .playground-platform { fill: #5c9c8c; stroke: #badbc0 }
.map-icon .football-ground { fill: #507650; fill-opacity: 0.3; stroke: none }
.football-grass { fill: none; stroke: #a1b87c; stroke-width: 0.35; opacity: 0.6 }
.football-goal-shadow { fill: rgba(10, 24, 16, 0.3) }
.football-goal-back { fill: none; stroke: #8da395; stroke-width: 0.11; stroke-linejoin: round }
.football-net { fill: none; stroke: #d1dec7; stroke-width: 0.035; opacity: 0.6 }
.map-icon .football-goal { fill: none; stroke: #edeee1; stroke-width: 0.16; stroke-linejoin: round; stroke-linecap: round }

/* ── Outbuildings ──────────────────────────── */
.map-icon .facility-body { fill: url(#surface-wood); stroke: #e0c798; stroke-width: 0.75 }
.map-icon .facility-seams { fill: none; stroke: #785c41; stroke-width: 0.5; opacity: 0.45 }
.outbuilding-artwork { overflow: hidden }
.outbuilding-artwork .outbuilding-base, .map-icon .outbuilding-base {
  fill: url(#surface-wood);
  stroke: #d4b68c;
  stroke-width: 0.65;
  fill-opacity: 1;
}
.outbuilding-shed .outbuilding-base { fill: #39734c; stroke: #a2c29a }
.outbuilding-shed .outbuilding-door { fill: #2f5d40; stroke: #98b18c }
.outbuilding-shed .outbuilding-planks { stroke: #24452d; stroke-width: 0.6; opacity: 0.8 }
.outbuilding-shed .shed-door-brace { stroke: #8fac85 }
.outbuilding-bathhouse .outbuilding-base { fill: #bd946b; stroke: #e0be93 }
.outbuilding-roof { fill: url(#surface-roof); stroke: none }
.outbuilding-roof-shade { fill: #742e2b; opacity: 0.42 }
.outbuilding-roof-ribs { fill: none; stroke: #f4b391; stroke-width: 0.45; opacity: 0.65 }
.outbuilding-eave { fill: none; stroke: #542b26; stroke-width: 1 }
.outbuilding-planks { fill: none; stroke: #725136; stroke-width: 0.4; opacity: 0.55 }
.outbuilding-door { fill: #72553b; stroke: #d7ba88; stroke-width: 0.5 }
.shed-door-brace { fill: none; stroke: #d7ba88; stroke-width: 0.5 }
.outbuilding-artwork .outbuilding-window, .map-icon .outbuilding-window {
  fill: #467d8e;
  stroke: #c6ded2;
  stroke-width: 0.5;
  fill-opacity: 1;
}
.bathhouse-chimney { fill: #83988e; stroke: #d9dbbd; stroke-width: 0.5 }
.bathhouse-chimney-cap { fill: #c0c9b6 }
.bathhouse-steam { fill: none; stroke: #ebdebd; stroke-width: 0.8; stroke-linecap: round; opacity: 0.8 }
.toilet-shadow { fill: rgba(10, 24, 16, 0.35) }
.portable-toilet-body { fill: #4c9ea3; stroke: #a6d6ce; stroke-width: 0.65 }
.portable-toilet-side { fill: #2c6875; stroke: #6ca6ae; stroke-width: 0.55 }
.portable-toilet-roof { fill: #dce5d4; stroke: #f1f3dd; stroke-width: 0.6 }
.portable-toilet-door { fill: #438b94; stroke: #b4d9d0; stroke-width: 0.6 }
.portable-toilet-ribs { fill: none; stroke: #286a73; stroke-width: 0.7 }
.toilet-vent { fill: none; stroke: #1c3839; stroke-width: 0.85; stroke-linecap: round }
.toilet-handle { fill: none; stroke: #e8dfb7; stroke-width: 0.9; stroke-linecap: round }
.toilet-base { fill: #365153; stroke: #8baba0; stroke-width: 0.5 }
.wooden-toilet-body { fill: url(#surface-wood); stroke: #d8b68a; stroke-width: 0.65 }
.wooden-toilet-side { fill: #795436; stroke: #b18d60; stroke-width: 0.55 }
.wooden-toilet-roof { fill: url(#surface-roof); stroke: #d89071; stroke-width: 0.65 }
.wooden-toilet-roof-far { fill: #823d31; stroke: #b66e54; stroke-width: 0.5 }
.wooden-toilet-door { fill: #997040; stroke: #dfbc86; stroke-width: 0.6 }
.wooden-toilet-planks { fill: none; stroke: #69492d; stroke-width: 0.5 }
.wooden-toilet-trim { fill: none; stroke: #d9b47e; stroke-width: 0.8 }

/* ── Utility Poles & Wiring ────────────────── */
.utility-pole-body { fill: #84968b; stroke: #d0dbbc; stroke-width: 0.8 }
.utility-pole-highlight { fill: none; stroke: #e1e0c2; stroke-width: 0.7 }
.utility-pole-crossbar { fill: none; stroke: #74907e; stroke-width: 2.5 }
.utility-pole-insulator { fill: #bdd0c0; stroke: #537568; stroke-width: 0.8 }
.utility-pole-shadow { fill: rgba(10, 24, 16, 0.35) }
.utility-pole > text { display: none }
.pole-lamp-arm { fill: none; stroke: #97a996; stroke-width: 2 }
.map-custom-object .pole-lamp-head { fill: #697b74; stroke: #c6cbb0; stroke-width: 0.8 }
.pole-lamp-core { fill: #c1c3a6 }
.pole-lamp.on .pole-lamp-core { fill: #ffe7aa }
.pole-lamp.on { filter: drop-shadow(0 0 5px rgba(255, 219, 124, 0.9)); transition: filter 0.3s ease }
.pole-light-pool { fill: url(#lamp-pool); opacity: 0.78; filter: blur(1.5px); transition: opacity 0.3s ease }
.pole-camera-cone {
  fill: #70bfcb;
  fill-opacity: 0.045;
  stroke: #8ccdd4;
  stroke-opacity: 0.25;
  stroke-width: 0.7;
  stroke-dasharray: 3 4;
  pointer-events: none !important;
}
.map-custom-object .pole-camera-body { fill: #284e58; stroke: #b5dde2; stroke-width: 1 }
.pole-camera-lens { fill: #90c4cc; stroke: #d1e9e4; stroke-width: 0.7 }
.pole-camera { cursor: pointer; outline: none }
.pole-camera:focus-visible .pole-camera-body { stroke: #ffe19b; stroke-width: 2 }
.pole-camera.selected .pole-camera-body { stroke: #ffe19b; stroke-width: 2 }
.pole-lamp.selected .pole-lamp-head { stroke: #ffe19b; stroke-width: 2 }
.utility-pole:focus-visible .utility-pole-body,
.utility-pole.selected .utility-pole-body { stroke: #ffe19b; stroke-width: 2 }
.utility-wire { --wire-color: #e6bf72 }
.utility-wire.line-2 { --wire-color: #82c7d4 }
.utility-wire.line-3 { --wire-color: #c59bdb }
.utility-wire-visible {
  fill: none;
  stroke: var(--wire-color);
  stroke-width: 1.25;
  stroke-dasharray: none;
  opacity: 0.8;
  pointer-events: none;
}
.utility-wire-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: none }
.utility-wire.selected .utility-wire-visible { stroke: #e9f7c6; stroke-width: 3; opacity: 1 }

/* ── Standalone cameras & lights ───────────── */
.map-camera, .map-light { cursor: pointer; outline: none }
.camera-cone { fill: var(--blue); fill-opacity: 0.11; stroke: var(--blue); stroke-opacity: 0.25; stroke-width: 1 }
.camera-ring { fill: #173a3b; stroke: #a0e2e4; stroke-width: 1.5 }
.camera-lens { fill: #c0f1eb }
.camera-body { fill: #a4dcda; stroke: #173a3b; stroke-width: 1 }
.camera-label { fill: #c6eeea }
.map-camera:hover .camera-ring,
.map-camera.selected .camera-ring { stroke: white; stroke-width: 2.4 }
.light-glow { fill: #f5d992; opacity: 0; transition: opacity 2s linear }
.light-pole { stroke: #e4d7b6; stroke-width: 1.8; stroke-linecap: round }
.light-head { fill: #ffe7a7; stroke: #806b43; stroke-width: 0.75 }
.light-core { fill: #ffe8aa }
.map-light.lit .light-glow { opacity: calc(0.53 * var(--night-light)); filter: url(#glow) }
.map-light.lit .light-core { fill: white }
.map-light:hover .light-head, .map-light.selected .light-head { stroke: white; stroke-width: 1.5 }

/* ── Territories ───────────────────────────── */
.territory-field { fill: url(#clearing); stroke: #769665; fill-opacity: 0.75; stroke-opacity: 0.4 }
.territory-sand { fill: #bdab7f; stroke: #e2cfa1; fill-opacity: 0.6; stroke-opacity: 0.55 }
.territory { stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke }
.territory-draft { stroke: #c5f9ce; stroke-dasharray: 5 4; fill-opacity: 0.35; pointer-events: none }
.territory-draft-point { fill: #c5f9ce; pointer-events: none }
.territory-vertex, .territory-midpoint {
  fill: #17352b;
  stroke: #c5f9ce;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: move;
  touch-action: none;
}
.territory-midpoint { fill: #87b39c; cursor: copy; stroke-width: 1 }
.territory-vertex.selected { fill: #f0d465 }
.map-custom-object rect { fill: #786b53; stroke: #d4c09a; stroke-width: 2 }
.map-custom-object text {
  fill: var(--map-label);
  font-size: 14px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--map-label-outline);
  stroke-width: 4px;
  letter-spacing: 0.01em;
  transition: fill 2s linear, stroke 2s linear;
}

/* ── Editor Panel ──────────────────────────── */
.road-editor-panel {
  position: absolute;
  z-index: 3;
  top: 118px;
  right: 18px;
  width: 318px;
  max-height: calc(100% - 220px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: var(--shadow-card);
  font-size: 11px;
  scrollbar-color: #3b594d transparent;
}
.road-editor-panel[hidden] { display: none }
.road-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.road-editor-head strong { flex: 1; font-size: 13px }
.road-editor-panel.collapsed > :not(.road-editor-head) { display: none }
.road-editor-panel button {
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-elevated);
  cursor: pointer;
  font-size: 11px;
  color: var(--text);
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.15s var(--ease);
}
.road-editor-panel button:hover { background: #1e332c; transform: scale(1.02) }
.road-editor-panel button[aria-pressed="true"] {
  background: #345646;
  border-color: rgba(125, 211, 164, 0.45);
  color: var(--accent-bright);
}
.road-editor-panel button:disabled { opacity: 0.35; cursor: default }
.road-editor-panel p { color: var(--text-secondary); line-height: 1.5 }
.road-editor-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px }
.road-editor-actions button { flex-grow: 1; font-size: 10px }
#road-save { color: var(--accent-bright); border-color: rgba(125, 211, 164, 0.4) }
.road-reference-control { display: flex; align-items: center; gap: 8px; margin-top: 12px }
.road-reference-control input[type="range"] { min-width: 0; width: 90px }
.map-object-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border) }
.map-object-form[hidden] { display: none }
.map-object-form label { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px }
.map-object-form label[hidden] { display: none }
.map-object-form input, .map-object-form select {
  min-width: 0;
  width: 100%;
  padding: 10px;
  color: var(--text);
  background: #12201c;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 11px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.map-object-form label input { flex: 1 }
.map-object-form input:focus, .map-object-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(125, 211, 164, 0.12);
}
.map-object-form strong { font-size: 13px }
.map-object-deleted { display: none !important }
#pole-equipment-fields { border: 1px solid var(--border-strong); padding: 8px; margin: 12px 0; border-radius: 6px }
#pole-equipment-fields legend { font-size: 10px; color: var(--text-secondary) }
[hidden]#wire-line-control, [hidden]#wire-delete, [hidden]#pole-equipment-fields { display: none }
.road-editor-reference { display: none; pointer-events: none }
.road-editor-reference.visible { display: block }
.road-reference-active .site-canopy, .road-reference-active .clearing { opacity: 0.08 }
.road-editor-handles { pointer-events: none }
.road-editor-selection, .road-editor-draft {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.road-editor-draft { stroke: var(--accent-bright); stroke-dasharray: 5 4 }
.road-editor-node {
  fill: #18251c;
  stroke: var(--blue);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: move;
}
.road-editor-node.selected { fill: var(--accent-bright); stroke: #fff }
.object-transform-frame {
  fill: none;
  stroke: #9ce2c2;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.object-transform-handle {
  fill: #17352b;
  stroke: #c5f9ce;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: nwse-resize;
  touch-action: none;
}
.object-rotation-handle { fill: #397865; cursor: grab }

/* ── Editor Mode ───────────────────────────── */
.road-editing #world { transition: none }
.road-editing .workspace { grid-template-columns: 60px minmax(0, 1fr) }
.road-editing .systems-panel { top: 132px }
.road-editing .inspector { display: none }
.road-editing .object-popover { display: none }
.road-editing .rail-editor-button { display: none }
.road-editing #site-map [data-id] { pointer-events: none }
.road-editing #site-map .utility-pole { pointer-events: visiblePainted }
.road-editing #site-map .utility-pole .pole-camera-cone { pointer-events: none }
.road-editing #site-map .map-custom-object .pole-equipment * { pointer-events: visiblePainted }
.road-editing #site-map .map-custom-object .pole-equipment .pole-camera-cone { pointer-events: none }
body:not(.road-editing).hide-utility-cameras .pole-camera,
body:not(.road-editing).hide-utility-lights .pole-lamp,
body:not(.road-editing).hide-utility-lights #pole-light-layer,
body:not(.road-editing).hide-utility-wires #utility-wire-layer { display: none }
.road-editing .map-stage[data-road-tool="draw"] { cursor: crosshair }
.road-editing .map-stage[data-road-tool="trail"] { cursor: crosshair }
.road-editing .map-stage[data-road-tool="insert"] { cursor: crosshair }
.road-editing .map-stage[data-road-tool="rectangle"] { cursor: crosshair }
.road-editing .map-stage[data-road-tool="objects"] [data-map-object],
.road-editing .map-stage[data-road-tool="objects"] [data-map-object] * {
  pointer-events: visiblePainted;
  cursor: move;
}
.road-editing .map-stage:not([data-road-tool="objects"]) [data-map-object] { pointer-events: none }
.road-editing .map-layer.hidden { visibility: hidden }
.road-editing [data-map-object].editor-selected { filter: drop-shadow(0 0 5px var(--accent)) }
.road-editing .map-stage[data-road-tool="labels"] [data-label-object] {
  pointer-events: all;
  cursor: move;
  touch-action: none;
}
.road-editing .map-stage[data-road-tool="labels"] .editor-label-selected { fill: #c5f9ce }
.road-editing .map-stage[data-road-tool="wire"] .utility-pole,
.road-editing .map-stage[data-road-tool="wire"] .utility-pole * {
  pointer-events: visiblePainted;
  cursor: crosshair;
}
.road-editing .map-stage[data-road-tool="wire"] .utility-wire-hit { pointer-events: stroke; cursor: pointer }
.road-editing .utility-pole.wire-start { filter: drop-shadow(0 0 6px var(--accent-bright)) }

/* ── Lighting Menu ─────────────────────────── */
.lighting-menu {
  position: absolute;
  z-index: 7;
  top: 14px;
  left: 72px;
  display: flex;
  width: min(360px, calc(100vw - 120px));
  max-height: calc(100% - 28px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
}
.lighting-menu[hidden] { display: none }
.lighting-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 6px;
}
.lighting-menu-head h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}
.lighting-heading { display: flex; align-items: center; gap: 7px; flex-wrap: wrap }
.lighting-all-toggle {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--duration), color var(--duration);
}
.lighting-all-toggle:hover { border-color: var(--accent-dim); color: var(--accent-bright) }
.lighting-status {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.lighting-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 125, 104, 0.38);
  transition: background 0.3s, box-shadow 0.3s;
}
.lighting-status.is-connected .lighting-status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(125, 211, 164, 0.45);
}
.lighting-last-updated {
  flex: 0 0 100%;
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.4;
}
.lighting-view {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 15px 20px;
  scrollbar-color: #3b594d transparent;
}
.lighting-menu .lighting-view { flex: 1 }
.lighting-menu button, .lighting-menu input {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.quick-lighting-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
}
.quick-lighting-actions button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
.quick-lighting-actions button:active { transform: scale(0.97) }
.quick-all-on {
  background: var(--gold);
  color: #1a1a0a;
  border: 1px solid var(--gold-bright);
}
.quick-all-off {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

/* ── Inspector ─────────────────────────────── */
.inspector {
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  box-shadow: var(--shadow-card);
  scrollbar-width: thin;
  scrollbar-color: #3b594d transparent;
}
.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px;
}
.inspector-head .eyebrow { font-size: 8px; color: var(--text-muted) }
.inspector-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.more-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  background: transparent;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.15s var(--ease);
}
.more-button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); transform: scale(1.03) }
.inspector-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.monitoring-collapsed .inspector-content { content-visibility: auto }

/* ── Lighting Cards ────────────────────────── */
.lighting-cards { display: grid; gap: 9px }
.lighting-card {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(145deg, #1a2c2b, #14211e);
}
.lighting-card-head { display: flex; align-items: center; gap: 11px }
.lighting-card-head .lighting-bulb { flex: 0 0 48px; min-height: 48px }
.lighting-card-head > div { display: flex; min-width: 0; flex-direction: column; gap: 4px }
.lighting-card-head strong { color: var(--text); font-size: 11px }
.lighting-card-head [data-line-state] { color: var(--text-secondary); font-size: 9px }
.lighting-bulb {
  display: flex;
  min-width: 0;
  min-height: 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text-muted);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: color 0.22s, border-color 0.22s, background 0.22s, box-shadow 0.22s, transform 0.15s var(--ease);
}
.lighting-bulb:hover { transform: scale(1.03) }
.lighting-bulb svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.lighting-bulb .bulb-glass { fill: transparent; transition: fill 0.22s }
.lighting-bulb span { font-size: 9px; font-weight: 700 }
.lighting-bulb.is-on {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(223, 199, 120, 0.1);
  box-shadow: inset 0 0 0 1px rgba(223, 199, 120, 0.15), 0 0 16px rgba(220, 174, 77, 0.16);
}
.lighting-bulb.is-on .bulb-glass { fill: currentColor; fill-opacity: 0.38 }
.lighting-bulb.is-unavailable { border-color: rgba(210, 151, 115, 0.35); color: #d9a18b }
.lighting-bulb.is-pending { border-color: rgba(157, 201, 188, 0.6); color: #b6e3d1 }
.lighting-bulb:disabled { cursor: default; opacity: 0.6 }
.schedule-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.22s, color 0.22s, background 0.22s;
}
.schedule-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.schedule-toggle:hover, .schedule-toggle[aria-expanded="true"] {
  border-color: rgba(125, 211, 164, 0.42);
  color: var(--accent-bright);
  background: rgba(125, 211, 164, 0.06);
}
.schedule-toggle.is-scheduled { color: var(--gold-bright) }
.lighting-card form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}
.lighting-card form[hidden] { display: none }
.lighting-card form label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
}
.schedule-fixed, .schedule-solar { display: grid; gap: 10px; min-width: 0 }
.schedule-fixed[hidden], .schedule-solar[hidden] { display: none }
.lighting-card form .schedule-field { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; width: 100%; gap: 6px }
.schedule-mode { min-width: 0; margin: 0; padding: 0; border: 0; color: var(--text-secondary); font-size: 12px }
.schedule-mode legend { padding: 0; margin-bottom: 6px }
.schedule-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px }
.lighting-card form .schedule-mode-options label { position: relative; display: block; min-width: 0 }
.schedule-mode-options input { position: absolute; opacity: 0; width: 1px; height: 1px }
.schedule-mode-options span { display: grid; place-items: center; min-height: 44px; padding: 4px; border: 1px solid var(--border-strong); border-radius: 7px; text-align: center; cursor: pointer }
.schedule-mode-options input:checked + span { color: var(--accent-bright); background: rgba(125, 211, 164, 0.12); border-color: var(--accent) }
.schedule-mode-options input:focus-visible + span { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.schedule-mode-options input:disabled + span { opacity: .5; cursor: not-allowed }
.schedule-details { min-width: 0 }
.schedule-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent-bright); font-size: 12px }
.schedule-details summary::before { content: '▸'; margin-right: 6px }
.schedule-details[open] summary::before { content: '▾' }
.schedule-details > :not(summary) { margin-bottom: 10px }
.schedule-repeat { margin: 0; color: var(--accent); font-size: 12px }
.schedule-help, .schedule-preview, .schedule-feedback {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
}
.schedule-preview { padding: 8px; border-radius: 7px; background: rgba(125, 211, 164, 0.06) }
.schedule-feedback { color: var(--accent-bright) }
.schedule-feedback:empty { display: none }
.lighting-card form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 6px;
  color: var(--text);
  background: #10201f;
  font-size: 12px;
  color-scheme: dark;
}
.lighting-card form input[type="time"], .lighting-card form input[type="number"] {
  width: 106px;
  flex: 0 0 106px;
  min-height: 44px;
  padding: 4px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  background: #10201f;
  color-scheme: dark;
  font-size: 14px;
}
.lighting-card form button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(125, 211, 164, 0.24);
  border-radius: 8px;
  color: #c9efda;
  background: rgba(125, 211, 164, 0.06);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.lighting-card form button:hover {
  border-color: rgba(125, 211, 164, 0.48);
  background: rgba(125, 211, 164, 0.11);
}
.lighting-card form button:disabled { opacity: 0.55; cursor: wait }
.schedule-actions { display: flex; gap: 8px }
.schedule-disable {
  border-color: rgba(255, 125, 104, 0.22) !important;
  color: #ffa89a !important;
  background: rgba(255, 125, 104, 0.06) !important;
}
.schedule-disable:hover {
  border-color: rgba(255, 125, 104, 0.42) !important;
  background: rgba(255, 125, 104, 0.12) !important;
}

/* ── Events ──────────────────────────────── */
.panel-section { padding: 17px 19px 0 }
.event-section { padding-top: 16px }
.stats-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.stats-bar {
  display: flex;
  gap: 10px;
}
.stat-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  transition: background var(--duration), box-shadow var(--duration);
}
.stat-chip:hover {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 164, 0.12);
}
.stat-chip:active { background: var(--surface-active) }
.stat-chip svg {
  flex: 0 0 auto;
}
.stat-chip-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.stat-chip-label {
  font-size: 10px;
  color: var(--text-muted);
}
.stat-cameras { color: var(--accent-bright); cursor: pointer; user-select: none }
.stat-cameras svg { color: var(--accent-bright) }
.stat-lights { color: var(--gold); cursor: pointer; user-select: none }
.stat-lights svg { color: var(--gold) }
.panel-bottom { padding: 16px; margin-top: 22px }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.selection-index { color: var(--text-muted); font-size: 8px; font-weight: 500 }
.sync-state { color: var(--text-muted); font-size: 8px; font-weight: 400 }
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  position: relative;
  padding-left: 20px;
}
.event-list::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border-strong);
}
.event-item {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 9px;
  position: relative;
  padding: 8px 12px 8px 20px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: background 0.18s;
}
.event-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--surface-glass);
}
.event-item.alert::before { background: var(--red); }
.event-item.lighting::before { background: var(--gold); }
.event-item.problem::before { background: #efa36c; }
.event-item.system::before { background: var(--blue); }
.event-item:hover { background: rgba(211, 239, 220, 0.03) }
.event-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin: 5px 1px 0;
  border-radius: 50%;
  background: #7da981;
  box-shadow: 0 0 7px rgba(125, 169, 129, 0.2);
}
.event-indicator.warn { background: var(--amber); box-shadow: 0 0 8px rgba(223, 184, 96, 0.28) }
.event-indicator.alarm { background: var(--red); box-shadow: 0 0 8px rgba(255, 125, 104, 0.38) }
.event-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0 }
.event-copy strong { font-size: 11px; color: var(--text) }
.event-copy small { font-size: 9px; margin-top: 3px; color: var(--text-secondary) }
.event-time { flex: 0 0 auto; font-size: 8px; color: var(--text-muted); white-space: nowrap }
.empty-events { padding: 14px 0; color: var(--text-muted); font-size: 9px }

/* ── Object Details ────────────────────────── */
.object-popover {
  position: absolute;
  z-index: 20;
  left: 0;
  top: 0;
  width: min(320px, calc(100% - 24px));
  padding: 14px 14px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  pointer-events: auto;
  transform-origin: center top;
}
.object-popover[data-object-type="house"] { display: flex; flex-direction: column; height: min(520px, calc(100% - 16px)); }
.object-popover[data-object-type="house"] .object-popover-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; padding-inline: 8px; }
.object-popover[data-object-type="house"] .object-card { padding-right: 0; }
.object-popover[data-object-type="house"] .object-card-top { padding-right: 36px; }
.object-popover[hidden] { display: none }
.object-popover:not([hidden]) {
  animation: object-popover-in 0.22s var(--ease);
}
.object-popover .status-pill { margin-right: 28px }
.object-popover-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--surface-glass);
  border: 1px solid var(--border-strong);
  pointer-events: none;
}
.object-popover[data-placement="top"] .object-popover-arrow {
  bottom: -6px;
  left: var(--arrow-offset, 50%);
  margin-left: -6px;
  transform: rotate(45deg);
  border-top: 0;
  border-left: 0;
}
.object-popover[data-placement="bottom"] .object-popover-arrow {
  top: -6px;
  left: var(--arrow-offset, 50%);
  margin-left: -6px;
  transform: rotate(45deg);
  border-bottom: 0;
  border-right: 0;
}
.object-popover[data-placement="left"] .object-popover-arrow {
  right: -6px;
  top: var(--arrow-offset, 50%);
  margin-top: -6px;
  transform: rotate(45deg);
  border-top: 0;
  border-right: 0;
}
.object-popover[data-placement="right"] .object-popover-arrow {
  left: -6px;
  top: var(--arrow-offset, 50%);
  margin-top: -6px;
  transform: rotate(45deg);
  border-bottom: 0;
  border-left: 0;
}
.object-popover-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  background: transparent;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.object-popover-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06) }
.object-popover-body { min-width: 0 }
.object-popover .object-card {
  margin: 0;
  padding: 4px 32px 0 0;
  border: 0;
  background: transparent;
}
.object-popover .object-card-top { padding-right: 4px }
@keyframes object-popover-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes object-sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}
.object-card {
  margin-top: 12px;
  padding: 15px 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-elevated);
}
.object-card-top { display: flex; align-items: center; gap: 11px }
.object-type-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(187, 120, 81, 0.1);
  border-radius: 12px;
  color: #e6b28b;
  background: rgba(187, 120, 81, 0.1);
}
.object-type-icon.camera {
  border-color: rgba(126, 200, 216, 0.12);
  color: var(--blue);
  background: rgba(126, 200, 216, 0.06);
}
.object-type-icon.light {
  border-color: rgba(223, 199, 120, 0.12);
  color: var(--gold);
  background: rgba(223, 199, 120, 0.06);
}
.object-type-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}
.object-title { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0 }
.object-title strong { font-size: 14px; font-weight: 700; letter-spacing: -0.025em }
.object-title small { font-size: 9px; overflow-wrap: anywhere; line-height: 1.6; color: var(--text-secondary) }
.status-pill {
  flex: 0 0 auto;
  padding: 6px 7px;
  border: 1px solid rgba(125, 211, 164, 0.08);
  border-radius: 20px;
  color: #b5eac4;
  background: rgba(125, 211, 164, 0.04);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.status-pill.warning {
  border-color: rgba(223, 184, 96, 0.14);
  color: #e7c583;
  background: rgba(223, 184, 96, 0.06);
}
.status-pill.alert {
  border-color: rgba(255, 125, 104, 0.14);
  color: var(--red-bright);
  background: rgba(255, 125, 104, 0.06);
}
.object-description { margin: 15px 0; color: var(--text-secondary); font-size: 11px; line-height: 1.7 }
.object-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}
.object-meta span { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 10px }
.object-meta b { color: var(--text); font-size: 11px; font-weight: 500; line-height: 1.5 }
.detail-action {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  border: 1px solid rgba(125, 211, 164, 0.06);
  border-radius: 9px;
  color: #bdebd2;
  background: rgba(125, 211, 164, 0.04);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s var(--ease);
}
.detail-action:hover { background: rgba(125, 211, 164, 0.1); transform: scale(1.02) }
.detail-action svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.stream-placeholder {
  position: relative;
  display: grid;
  height: 125px;
  margin-top: 11px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(126, 200, 216, 0.1);
  border-radius: 10px;
  background: linear-gradient(130deg, #1a3334, #102327);
}
.stream-placeholder::before {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(205, 226, 204, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 226, 204, 0.03) 1px, transparent 1px);
  background-size: 14px 14px;
  content: '';
}
.stream-copy {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 9px;
}
.stream-copy strong { color: var(--text); font-size: 10px; font-weight: 600 }
.stream-copy svg { width: 18px; fill: none; stroke: #82a9a0; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5 }
.stream-badge {
  position: absolute;
  z-index: 1;
  top: 7px;
  left: 7px;
  padding: 4px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-muted);
  background: rgba(10, 17, 12, 0.5);
  font-size: 7px;
  letter-spacing: 0.08em;
}
.text-button { min-height: 32px; padding: 0 4px; font-size: 9px }

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  z-index: 8;
  right: 354px;
  bottom: 88px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid rgba(157, 225, 183, 0.2);
  border-radius: var(--radius);
  color: #dcf6e3;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0) }

/* ── Login Dialog ──────────────────────────── */
.login-dialog, .settings-dialog {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: none;
  max-height: none;
}
.login-dialog:not([open]), .settings-dialog:not([open]) { display: none }
.settings-dialog { overflow: visible }
.login-dialog::backdrop {
  background: rgba(5, 12, 11, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.settings-dialog::backdrop {
  background: rgba(5, 12, 11, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.login-card, .settings-card {
  display: grid;
  gap: 14px;
  width: min(420px, calc(100% - 32px));
  padding: 26px 24px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}
.settings-card {
  width: min(460px, calc(100% - 32px));
  max-width: 100%;
  max-height: calc(100dvh - 32px);
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  min-width: 0;
  gap: 12px;
  padding: 22px 20px;
}
.settings-card > * { min-width: 0 }
.login-mark { width: 46px; height: 46px; margin: 0 auto }
.login-card h1, .settings-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}
.settings-head { display: flex; align-items: center; justify-content: space-between }
.settings-head h2 { text-align: left }
.settings-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-elevated);
  cursor: pointer;
  transition: background 0.18s;
}
.settings-close:hover { background: #243838 }
.settings-close svg { width: 16px; height: 16px; fill: none; stroke: var(--text-secondary); stroke-width: 1.6 }
.login-hint, .login-target {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.login-target strong { color: var(--text) }
.login-countdown {
  margin: 0;
  color: var(--accent-bright);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.login-countdown.expired { color: var(--red-bright) }
.login-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}
.login-field input, .login-field select {
  padding: 11px 13px;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.04em;
  background: #0e1918;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.login-field input:focus, .login-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 164, 0.14);
}
.phone-input {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #0e1918;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.phone-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 164, 0.14);
}
.phone-input .phone-prefix {
  display: grid;
  place-items: center;
  padding: 0 11px;
  color: var(--text-secondary);
  font-size: 15px;
  background: #16241f;
  border-right: 1px solid var(--border-strong);
}
.phone-input input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  border-radius: 0;
}
.phone-input input:focus { outline: none; box-shadow: none }
.login-submit {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  color: #062015;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
}
.login-submit:hover { background: var(--accent-bright) }
.login-submit:active { transform: scale(0.98) }
.login-submit:disabled { opacity: 0.55; cursor: default }
.login-secondary { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px }
.login-secondary button, .settings-account button {
  padding: 6px 8px;
  color: var(--accent-bright);
  font-size: 11px;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}
.login-secondary button:hover { color: #fff }
.login-secondary button:disabled { color: var(--text-muted); cursor: default }
.login-message { min-height: 15px; margin: 6px 0 0; font-size: 12px; line-height: 1.45; text-align: center }
#settings-message { margin: 0 }
#settings-message:empty { min-height: 0 }
.login-message.error { color: var(--red-bright) }
.login-message.ok { color: var(--accent-bright) }

/* ── Settings ──────────────────────────────── */
.settings-section-title { margin: 0; font-size: 14px; font-weight: 700 }
.tuya-settings { display: grid; gap: 10px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--border-strong) }
.tuya-settings p { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere }
.tuya-settings #tuya-status { color: var(--text) }
.tuya-settings button:not(.login-submit) { justify-self: start; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 9px; color: var(--text); background: var(--surface-raised); font: inherit; font-size: 12px; cursor: pointer }
.tuya-settings button:disabled { opacity: .55; cursor: default }
.tuya-settings button:focus-visible, .tuya-settings input:focus-visible, .tuya-settings select:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.tuya-settings fieldset { display: grid; gap: 10px; min-width: 0; border: 0; margin: 0; padding: 0 }
.tuya-field { display: grid; gap: 5px; min-width: 0; font-size: 12px; color: var(--text-secondary) }
.tuya-field > label:first-child { color: var(--text) }
.tuya-field > label span { color: var(--text-secondary); font-weight: 400 }
.tuya-field > input, .tuya-field > select { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 9px 11px; color: var(--text); background: #0e1918; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; font-size: 16px }
.tuya-mode, .tuya-clear { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 12px; line-height: 1.4 }
.tuya-mode[hidden] { display: none }
.tuya-mode input, .tuya-clear input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent) }
.settings-phones { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; min-width: 0 }
.settings-phones:empty { display: none }
.settings-phones li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #0e1918;
  min-width: 0;
}
.settings-phones li div { display: grid; gap: 2px; min-width: 0 }
.settings-phones strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere }
.settings-phones span { color: var(--text-secondary); font-size: 10px }
.settings-phones button {
  padding: 5px 8px;
  color: var(--red-bright);
  font-size: 11px;
  background: none;
  border: 1px solid rgba(255, 125, 104, 0.28);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.settings-phones button:hover { background: rgba(255, 125, 104, 0.08) }
#settings-add-phone { display: grid; gap: 12px }
#settings-add-phone .login-field { margin-bottom: 0 }
.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 130px); gap: 10px }
.settings-row > * { min-width: 0 }
.settings-row .login-field { margin-bottom: 0 }
.settings-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-strong);
  font-size: 11px;
}
.settings-account small { color: var(--text-secondary) }
.settings-account button { margin-left: auto }
.icon-button.settings-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform var(--duration) var(--ease);
}
.icon-button.settings-button:hover {
  border-color: var(--accent-dim);
  background: var(--surface-hover);
  transform: scale(1.04);
}
.icon-button.settings-button[hidden] { display: none }
.icon-button.settings-button svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
/* ── Camera Dialog ─────────────────────────── */
.camera-dialog {
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: min(1200px, 94vw);
  max-width: 100%;
  max-height: 92dvh;
  padding: 18px;
  overflow: auto;
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}
.camera-dialog.camera-dialog-fullscreen { width: min(1800px, 96vw); max-width: 100% }
.camera-dialog::backdrop {
  background: rgba(3, 16, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.camera-dialog header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}
.camera-stage > header { margin-bottom: 18px }
.camera-dialog header h2 { flex: 1 1 auto; margin: 0; white-space: nowrap; font-size: 16px }
.camera-dialog button {
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.camera-dialog button:hover { background: #1e332c; border-color: var(--accent-dim) }
.camera-dialog header > [data-camera-close] {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
.camera-dialog #camera-controls,
#camera-controls,
#camera-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  margin: 0;
}
.camera-dialog #camera-controls[hidden],
#camera-controls[hidden],
#camera-pair[hidden] { display: none }
.camera-dialog .camera-control-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 11px;
}
.camera-dialog .camera-control-button[hidden] { display: none }
.camera-dialog .camera-control-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.camera-dialog .camera-control-button span { white-space: nowrap }
.camera-dialog .camera-retry-button { width: 38px; min-width: 38px; padding: 8px }
.camera-dialog #camera-message {
  margin: 0;
  color: var(--red-bright);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.camera-dialog #camera-message:empty { display: none }
.camera-dialog #camera-videos {
  overflow: auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* ── Camera Grid & Cards ───────────────────── */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 12px;
  width: 100%;
  min-width: 0;
  align-content: start;
}
.camera-video-card {
  background: #0c1714;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.camera-grid .camera-video-card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.camera-grid .camera-video-card:hover,
.camera-grid .camera-video-card:focus-visible {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent-dim);
  outline: none;
}
.camera-video-viewport {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}
.camera-grid .camera-video-viewport { aspect-ratio: 16 / 9 }
.camera-video-card video,
.camera-video-viewport video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  background: #000;
  transform-origin: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.camera-grid .camera-video-card video { object-fit: fill }

/* ── Single Camera (fullscreen in dialog) ──── */
.camera-fullscreen .camera-video-viewport {
  width: min(100%, calc(76dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 76dvh;
  margin-inline: auto;
  touch-action: none;
}
.camera-fullscreen .camera-video-card video { object-fit: fill }

/* ── Fullscreen Button ─────────────────────── */
.camera-dialog button.camera-video-fullscreen {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  line-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.33);
  border-radius: 8px;
  background: rgba(8, 15, 13, 0.78);
  color: var(--text);
}
.camera-dialog button.camera-video-fullscreen svg {
  display: block;
  width: 19px;
  height: 19px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

/* Keep the native fullscreen host untransformed; rotate its contents only if the phone stays in portrait. */
.camera-screen-host { display: contents }
body.camera-preview-open { overflow: hidden }
body.camera-preview-open .map-area { z-index: 10000 }
.camera-screen-host.camera-screen-open { display: block; position: fixed; inset: 0; z-index: 10000; overflow: hidden; background: #000 }
.camera-screen-host.camera-screen-open > .camera-screen-surface { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; margin: 0; max-width: none; max-height: none }
@media (orientation: portrait) {
  .camera-screen-host.camera-screen-open.camera-screen-phone > .camera-screen-surface {
    --camera-quarter-turn: 1; width: 100dvh; height: 100vw; transform-origin: top left; transform: translateX(100vw) rotate(90deg);
  }
}
.camera-screen-surface .camera-preview-viewport, .bath-video-stage.camera-screen-surface { touch-action: none; user-select: none }

/* ── Card Text ─────────────────────────────── */
.camera-video-card p {
  margin: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.camera-video-card .camera-video-caption-overlay {
  position: absolute;
  z-index: 1;
  bottom: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--text);
  background: rgba(8, 15, 13, 0.78);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.camera-video-card.is-loading .camera-video-caption-overlay { display: none }
.camera-dialog-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 12px;
  color: var(--text-secondary);
  font-size: 13px;
}
.camera-dialog-loader[hidden] { display: none }
.camera-spinner {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 2px solid rgba(125, 211, 164, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: map-loader-spin 0.9s linear infinite;
}
.camera-tile-loader {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 11px;
  background: rgba(8, 15, 13, 0.72);
  opacity: 1;
  transition: opacity 0.28s ease;
}
.camera-tile-loader[hidden] { display: none }
.camera-tile-loader.is-done { opacity: 0 }
.camera-dialog:not([open]) .camera-spinner,
.camera-dialog-loader[hidden] .camera-spinner,
.camera-map-preview[hidden] .camera-spinner,
.camera-tile-loader[hidden] .camera-spinner,
.camera-tile-loader.is-done .camera-spinner { animation: none }
.camera-tile-loader-text { line-height: 1.35; overflow-wrap: anywhere }
.camera-map-preview {
  position: absolute;
  z-index: 6;
  display: grid;
  grid-template-rows: auto auto auto;
  width: min(360px, calc(100% - 16px));
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-glass);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.camera-map-preview[hidden] { display: none }
.camera-map-preview header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-bottom: 8px;
  background: transparent;
  border: 0;
}
.camera-map-preview header strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-map-preview header div { display: flex; flex: 0 0 auto; gap: 6px }
.camera-map-preview button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
}
.camera-map-preview button:hover { background: #1e332c }
.camera-map-preview button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.camera-map-preview canvas { width: 100%; border-radius: 8px; display: block }
.camera-preview-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}
.camera-map-preview:not(.is-loading) .camera-tile-loader {
  opacity: 0;
  pointer-events: none;
}
.camera-preview-viewport video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: #000;
}
.camera-map-preview > p,
.camera-map-preview #camera-preview-status {
  min-height: 16px;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.camera-map-preview.camera-screen-surface {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  padding: 16px;
  border: 0;
  border-radius: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #071512;
}
.camera-map-preview.camera-screen-surface .camera-preview-viewport {
  min-height: 0;
  aspect-ratio: auto;
  container-type: size;
}
.camera-map-preview.camera-screen-surface video {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
}
.camera-gate-status { height: 54px; box-sizing: border-box; padding-top: 5px; color: var(--text-secondary); font-size: 11px; overflow: hidden }
.camera-gate-status[hidden] { display: none }
.camera-gate-status strong { color: var(--text); font-size: 12px }
.camera-gate-status progress { display: block; width: 100%; height: 5px; margin: 3px 0; accent-color: #9bd6aa }
.camera-gate-status progress[hidden] { visibility: hidden }
.camera-gate-status small { font-size: 10px }
.camera-map-preview.camera-screen-surface:has(.camera-gate-status:not([hidden])) { grid-template-rows: auto minmax(0, 1fr) auto auto }
.gate-sliding-panel { transition: transform .8s linear }
.gate-sliding-panel.gate-unknown { opacity: .45; stroke-dasharray: 3 2 }
.gate-event { position: fixed; z-index: 9000; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(300px, calc(100vw - 32px)); box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #50735b; border-radius: 12px; background: #14251b; color: #e8f5eb; box-shadow: 0 4px 18px #0008; font-size: 12px }
.gate-event[hidden] { display: none }
.gate-event-icon { width: 84px; height: 38px; flex: none; overflow: visible }
.gate-event strong { flex: 1 }
.gate-event button { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 22px; cursor: pointer }
.gate-event button:focus-visible { outline: 2px solid #a2dfb4 }
@media (prefers-reduced-motion: reduce) { .gate-sliding-panel { transition: none !important } }
.map-attribution { display: none }
.attribution-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-dim);
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Big Screen ────────────────────────────── */
@media (min-width: 1600px) {
  .workspace { grid-template-columns: 64px minmax(0, 1fr) 360px }
  .map-toolbar { top: 27px }
  .map-heading h1 { font-size: 26px }
  .inspector-head { padding-top: 27px }
  .panel-section { padding-right: 21px; padding-left: 21px }
  .brand-copy strong { font-size: 22px }
}

/* ── Medium Desktop ────────────────────────── */
@media (max-width: 1400px) {
  .workspace { grid-template-columns: 60px minmax(0, 1fr) 300px }
  .location-chip { display: none }
  .map-toolbar { gap: 10px }
  .map-tools { max-width: 245px }
  .search-box { width: 100% }
  .systems-panel { top: 146px }
  .toast { right: 328px }
}

/* ── Tablet Landscape ──────────────────────── */
@media (max-width: 1050px) and (min-width: 821px) {
  .workspace { grid-template-columns: 52px minmax(0, 1fr) 298px; gap: 8px }
  .rail-button { width: 36px }
  .topbar-center { display: none }
  .map-toolbar { left: 18px; right: 18px }
  .map-tools { max-width: 180px }
  .map-heading h1 { font-size: 27px }
  .systems-panel { left: 18px; top: 175px }
  .legend-item { padding: 0 7px; font-size: 9px }
  .satellite-button { display: none }
}

@media (max-width: 1050px) and (min-width: 821px) and (orientation: portrait) {
  .workspace,
  .road-editing .workspace,
  body.monitoring-collapsed:not(.road-editing) .workspace {
    display: block;
    position: relative;
  }
  .rail {
    position: absolute;
    z-index: 4;
    left: 50%;
    right: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    top: auto;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 999px;
    gap: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }
  .rail-spacer { display: none }
  .rail-button { width: 48px; height: 48px }
  .map-area { position: absolute; inset: 0 }
  .inspector { max-height: 62% }
  .lighting-menu { left: 16px; top: 16px }
}

@media (max-width: 1050px) and (min-width: 821px) and (orientation: landscape) {
  .workspace,
  .road-editing .workspace,
  body.monitoring-collapsed:not(.road-editing) .workspace {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .inspector {
    position: absolute;
    z-index: 6;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 42vw);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  }
  .mobile-menu { display: grid !important }
  .road-editing .inspector { display: none }
  .lighting-menu { left: 78px }
}

/* Short, wide phone screens also open lighting from the bottom. */
@media (min-width: 821px) and (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .lighting-menu {
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: min(420px, calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))));
    margin-inline: auto;
    max-height: calc(100% - 24px - env(safe-area-inset-bottom));
  }
}

/* ── Phone / Small Tablet ──────────────────── */
@media (max-width: 820px) {
  .app-shell { padding: 0; gap: 0; height: 100dvh; min-height: 0 }
  .topbar {
    height: 64px;
    padding: 0 16px;
    gap: 10px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0;
  }
  .brand { flex-basis: auto; gap: 9px }
  .brand-mark, .brand-mark img { width: 34px; height: 34px }
  .brand-copy strong { font-size: 19px }
  .brand-copy small { font-size: 6px; letter-spacing: 0.14em }
  .topbar-actions { gap: 6px }
  .mobile-menu {
    display: grid !important;
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .icon-button.settings-button { width: 44px; height: 44px }
  .workspace,
  .road-editing .workspace,
  body.monitoring-collapsed:not(.road-editing) .workspace {
    display: block;
    position: relative;
  }
  .rail {
    position: absolute;
    z-index: 4;
    left: 50%;
    right: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    top: auto;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 999px;
    gap: 4px;
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
  .rail-spacer { display: none }
  .rail-button { width: 46px; height: 46px }
  .map-area {
    position: absolute;
    inset: 0;
  }
  .map-toolbar {
    top: 17px;
    left: 18px;
    right: 18px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .map-heading { display: flex; align-items: center; gap: 10px; text-shadow: 0 2px 12px rgba(6, 28, 22, 0.85) }
  .map-heading .eyebrow { display: none }
  .map-heading h1 { font-size: 25px; margin: 0; gap: 9px }
  .map-heading h1 .heading-tag { font-size: 9px }
  .map-heading p { margin-left: auto; max-width: 130px; font-size: 8px; line-height: 1.6; text-align: right }
  .map-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; max-width: none; width: 100% }
  .search-box { width: 100% !important; height: 44px }
  .search-box input { font-size: 12px }
  .search-box kbd { display: none }
  .tool-button { height: 44px; padding: 0 10px; font-size: 9px }
  .satellite-button { display: none }
  .systems-panel, .road-editing .systems-panel {
    top: 131px;
    left: 18px;
    max-width: calc(100% - 36px);
    z-index: 3;
  }
  .systems-panel summary { min-height: 44px; padding: 11px 13px; font-size: 10px }
  .systems-panel[open] { z-index: 5 }
  .legend-item { flex: 1 0 auto; min-height: 44px; padding: 0 9px; gap: 6px; font-size: 9px; justify-content: center }
  .legend-item b { font-size: 8px }
  .legend-gear { width: 44px; height: 44px }
  .inspector,
  body.monitoring-collapsed:not(.road-editing) .inspector {
    display: flex;
    position: absolute;
    z-index: 6;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 72%;
    height: auto;
    border-radius: 24px 24px 0 0;
    transform: translateY(110%);
    transition: transform 0.3s var(--ease);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.25);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
  }
  .inspector.open { transform: translateY(0) }
  .object-popover {
    position: fixed;
    z-index: 7;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100%;
    max-width: none;
    max-height: min(62dvh, 480px);
    padding: 8px 16px calc(78px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    overflow-y: auto;
    transform: none;
    animation: object-sheet-in 0.3s var(--ease);
  }
  .object-popover[data-object-type="house"] { height: min(62dvh, 480px); overflow: hidden; }
  .object-popover-arrow { display: none }
  .object-popover::before {
    content: '';
    display: block;
    width: 34px;
    height: 4px;
    margin: 4px auto 10px;
    border-radius: 5px;
    background: rgba(120, 152, 139, 0.34);
  }
  .object-popover .object-card { padding-right: 36px }
  .object-popover[data-object-type="house"] .object-card { padding-right: 0 }
  .object-popover-close { width: 44px; height: 44px; min-height: 44px; top: 10px; right: 8px }
  .inspector::before {
    content: '';
    display: block;
    flex: 0 0 4px;
    width: 34px;
    margin: 10px auto 0;
    border-radius: 5px;
    background: rgba(120, 152, 139, 0.34);
  }
  .inspector-head {
    padding-top: 15px;
    position: sticky;
    top: 0;
    background: var(--surface-glass);
    z-index: 1;
  }
  .inspector-head h2 { font-size: 18px }
  .road-editing .inspector { display: none }
  .road-editing .road-editor-panel {
    top: auto;
    bottom: calc(87px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100% - 210px);
    border-radius: var(--radius-lg);
    padding: 14px;
    z-index: 4;
  }
  .road-editor-panel.collapsed { left: auto; width: min(300px, calc(100% - 24px)) }
  .road-editor-head { gap: 6px }
  .road-editor-head strong { font-size: 11px }
  .road-editor-panel button { font-size: 10px; min-height: 44px }
  .lighting-menu {
    top: auto;
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100% - 98px - env(safe-area-inset-bottom));
  }
  .toast { bottom: calc(91px + env(safe-area-inset-bottom)); right: 12px }
  .camera-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    padding: 12px;
  }
  .camera-dialog.camera-dialog-fullscreen { width: 100vw; max-width: 100vw }
  .camera-dialog header { gap: 6px }
  .camera-dialog header h2 { font-size: 18px }
  .camera-dialog header > [data-camera-close] {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    padding: 0;
  }
  .camera-dialog #camera-controls { gap: 4px }
  .camera-dialog .camera-control-button { min-height: 32px; gap: 5px; padding: 6px 8px; font-size: 12px }
  .camera-dialog .camera-control-button svg { width: 16px; height: 16px }
  .camera-dialog .camera-retry-button { width: 32px; min-width: 32px; padding: 6px }
  #camera-videos.camera-grid,
  .camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .camera-fullscreen .camera-video-viewport {
    width: 100%;
    max-height: 76dvh;
  }
  .topbar-actions .topbar-search { display: flex; flex: 0 0 150px; width: 150px; min-width: 150px; order: -1 }
  .login-submit, .more-button, .object-popover-close, .map-corner-button, .map-zoom, .map-zoom button { min-height: 44px }
}

/* ── Small Phone ───────────────────────────── */
@media (max-width: 480px) {
  .topbar-actions .topbar-search { flex: 0 0 120px; width: 120px; min-width: 120px; min-height: 44px }
  .topbar-actions .topbar-search input { font-size: 10px }
  .rail-button { width: 44px; height: 44px }
  .brand-copy strong { font-size: 17px }
  .map-heading h1 { font-size: 22px }
  .map-heading p { max-width: 120px; font-size: 7px }
  .tool-button { height: 40px; padding: 0 8px }
  .legend-item { gap: 4px; padding: 0 6px; font-size: 8px; min-height: 36px }
  .road-editing .road-editor-panel { bottom: calc(78px + env(safe-area-inset-bottom)) }
  #camera-videos.camera-grid,
  .camera-grid { grid-template-columns: minmax(0, 1fr) }
}

@media (max-width: 380px) {
  .topbar { gap: 6px; padding: 0 20px }
  .topbar-actions .topbar-search { width: 110px }
  .brand-copy strong { font-size: 15px }
  .brand-copy small { display: none }
}

/* ── Phone Settings ────────────────────────── */
@media (max-width: 520px) {
  .settings-dialog {
    place-items: stretch;
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    margin: 0;
  }
  .settings-card {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    border-radius: 0;
    border: none;
    align-content: start;
    box-sizing: border-box;
  }
  .settings-head h2 { font-size: 16px }
  .settings-row { grid-template-columns: 1fr }
  .login-field input, .login-field select, .phone-input input, .phone-input .phone-prefix { font-size: 16px }
  .settings-account { flex-wrap: wrap }
  .settings-account button { margin-left: 0 }
  .login-submit { padding: 14px; font-size: 15px }
  .login-secondary { flex-direction: column; gap: 4px }
}

/* ── Collapsed Monitoring ──────────────────── */
body.monitoring-collapsed:not(.road-editing) .workspace { grid-template-columns: 60px minmax(0, 1fr) }
body.monitoring-collapsed:not(.road-editing) .inspector { display: none }

/* ── Landscape and compact floating controls ── */
:root { --text-muted: #91aa9c }
.brand-copy small { font-size: 12px; letter-spacing: .08em; line-height: 1.15 }
.map-ground { fill: var(--map-ground) }
.site-canopy { opacity: .72 }
/* The editor annotates registered legacy wrappers only after measuring them. */
[data-legacy-clearing="true"] { display: none !important }
.landscape { pointer-events: none }
.landscape, .landscape-approach-exterior { filter: blur(10px) }
.landscape-glade { fill: var(--map-glade); transition: fill 2s linear }
.landscape-approach { fill: none; stroke: var(--map-glade); stroke-width: 38; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: stroke 2s linear }
.road-reference-active .landscape, .road-reference-active .landscape-approach-exterior { opacity: .08 }

.workspace, body.monitoring-collapsed:not(.road-editing) .workspace {
  grid-template-columns: 60px minmax(0, 1fr);
}
.mobile-menu, body.monitoring-collapsed .mobile-menu {
  display: inline-flex !important;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.mobile-menu[aria-expanded="true"] { border-color: var(--accent-dim); color: var(--accent-bright) }
.topbar-actions { min-width: 0 }
.search-box input, .tool-button, .map-settings-panel .settings-label,
.map-settings-panel .settings-label select, .map-settings-panel .settings-status,
.legend-item, .road-editor-panel, .road-editor-panel button { font-size: 13px }
.search-box, .tool-button, .rail-button, .legend-item,
.road-editor-panel button, .lighting-all-toggle, .lighting-status { min-height: 44px }
.rail-button, .lighting-status { min-width: 44px }
.inspector, .lighting-menu, .object-popover, .map-settings-panel,
.road-editor-panel, .rail, .tool-button {
  background: var(--surface-raised);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.map-corner-button, .map-zoom button {
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  filter: none;
}
.inspector {
  position: absolute;
  z-index: 6;
  top: 0;
  right: 0;
  bottom: auto;
  left: auto;
  width: min(360px, calc(100% - 80px));
  max-height: min(70dvh, calc(100% - 16px));
  height: auto;
  border-radius: var(--radius-lg);
  transform: none;
}
body.monitoring-collapsed:not(.road-editing) .inspector { display: none !important }
.inspector-head { padding: 6px 12px 4px }
.inspector-head h2 { font-size: 15px; letter-spacing: -.02em }
.inspector-head .more-button { width: 36px; height: 36px; min-width: 36px; min-height: 36px }
.inspector-content { flex: 0 1 auto }
.stats-section { padding: 2px 12px }
.stats-section .stat-chip { min-height: 32px; padding: 4px 6px; box-sizing: border-box }
.stat-chip-value { font-size: 16px }
.stat-chip-label, .sync-state { font-size: 12px }
.event-section { padding: 6px 12px 12px }
.section-heading { gap: 8px; font-size: 11px; letter-spacing: .05em }
.event-copy strong, .event-copy small, .event-time, .empty-events { font-size: 12px; line-height: 1.45 }
.event-item { min-height: 44px }
.event-list:has(.empty-events) { padding-left: 0 }
.event-list:has(.empty-events)::before { display: none }
.empty-events { padding: 12px; border-radius: 10px; background: var(--surface-elevated); color: var(--text-secondary) }
.object-title small, .object-description, .object-meta span, .object-meta b,
.lighting-card-head strong, .lighting-card-head [data-line-state],
.lighting-last-updated, .lighting-all-toggle { font-size: 12px }
.camera-dialog header > [data-camera-close], .camera-dialog .camera-control-button,
.camera-dialog .camera-retry-button { min-width: 44px; min-height: 44px }

@media (max-width: 1050px) and (min-width: 821px) and (orientation: portrait) {
  .inspector { top: 0; right: 0; bottom: auto; left: auto; width: min(360px, calc(100% - 32px)); max-height: 65% }
}
@media (max-width: 820px) {
  .brand-copy small { display: none }
  /* Keep rail actions available without covering the open object sheet. */
  .workspace:has(.object-popover:not([hidden])) .rail {
    top: 8px; bottom: auto; left: max(8px, env(safe-area-inset-left)); transform: none;
  }
  /* Reset must remain reachable above the object sheet. */
  .workspace:has(.object-popover:not([hidden])) .map-zoom {
    top: 12px; bottom: auto;
  }
  .workspace, .road-editing .workspace,
  body.monitoring-collapsed:not(.road-editing) .workspace { display: block }
  .mobile-menu, body.monitoring-collapsed .mobile-menu { display: inline-flex !important; padding: 0 12px }
  .topbar-actions .topbar-search { flex: 1 1 140px; width: auto; min-width: 80px }
  .topbar-actions .topbar-search input { font-size: 16px }
  .inspector, body.monitoring-collapsed:not(.road-editing) .inspector {
    top: auto; right: 0; bottom: 0; left: 0; width: 100%;
    max-height: min(72%, 480px); border-radius: 20px 20px 0 0;
    transform: none; padding-bottom: env(safe-area-inset-bottom);
  }
  .inspector-head { background: var(--surface-raised) }
}
@media (max-width: 520px) {
  .mobile-menu, body.monitoring-collapsed .mobile-menu { width: 44px; padding: 0 }
  .mobile-menu span { display: none }
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)) }
}
@media (max-width: 380px) {
  .topbar-actions .topbar-search { min-width: 75px }
}
@media (max-height: 480px) {
  .topbar { flex-basis: 56px }
  .inspector { max-height: calc(100% - 8px) }
}

/* ── Reduced Motion ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .map-loader-mark .loader-arc,
  .camera-spinner { animation: none !important }
  .map-house.search-match,
  .map-camera.search-match,
  .utility-pole.search-match,
  .map-custom-object.search-match {
    animation: none;
    filter: drop-shadow(0 0 8px var(--accent-bright));
  }
  .object-popover:not([hidden]),
  .object-popover { animation: none }
  .brand:hover .brand-mark,
  .rail-button:hover,
  .tool-button:hover,
  .lighting-bulb:hover,
  .detail-action:hover,
  .quick-lighting-actions button:active { transform: none }
}

.watch-summary { margin: 8px 0 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.45 }
.watch-summary p { margin: 0 0 4px }
.watch-summary button { min-height: 44px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface-raised); font: inherit }
.watch-summary button:focus-visible, .camera-tile-open:focus-visible, .camera-watch-select input:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.camera-dialog .camera-tile-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; text-align: left; background: transparent }
.camera-video-card .camera-watch-badge { display: flex; justify-content: flex-end; margin: 0; padding: 2px 8px; color: #a7b8b3; line-height: 0 }
.camera-watch-badge svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7 }
.camera-watch-badge[data-state="requested"] { color: #7fe5bd }
.camera-watch-badge[data-state="unknown"] { color: #ffc36a }
.camera-dialog #camera-videos.camera-wall { gap: 0; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)) }
.camera-wall .camera-video-card { position: relative; border-radius: 0; border: 1px solid #36433f; box-shadow: none }
.camera-wall .camera-video-card video { object-fit: fill }
.camera-wall .camera-tile-open { position: relative }
.camera-wall .camera-video-card .camera-tile-open > p { position: absolute; z-index: 2; top: 3px; left: 3px; max-width: calc(100% - 6px); margin: 0; padding: 2px 4px; background: #000b; color: #fff; font-size: 11px; line-height: 1.2; pointer-events: none }
.camera-wall .camera-video-card .camera-watch-badge { position: absolute; z-index: 2; right: 3px; bottom: 3px; padding: 2px; background: #000b; pointer-events: auto; width: 28px; height: 28px; align-items: center; justify-content: center; border: 0; border-radius: 4px; cursor: pointer }
.camera-wall .camera-watch-select:not([hidden]) { position: absolute; z-index: 3; left: 3px; bottom: 3px; max-width: calc(100% - 36px); min-height: 32px; padding: 2px 5px; background: #000d; color: #fff; line-height: 1.2 }
.camera-wall .camera-watch-select input { flex: none }
.camera-stage.camera-wall-screen { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; width: 100%; height: 100dvh; padding: 4px; box-sizing: border-box; background: #080e0c; overflow: hidden }
.camera-stage.camera-wall-screen > header { flex: none; margin: 0 0 4px }
.camera-stage.camera-wall-screen #camera-watch-slot { display: none }
.camera-stage.camera-wall-screen #camera-message { flex: none }
.camera-stage.camera-wall-screen #camera-videos { display: grid; flex: 1; height: 0; overflow: auto; grid-template-columns: repeat(var(--wall-columns, 1), var(--wall-cell-width, 0px)); grid-template-rows: repeat(var(--wall-rows, 1), var(--wall-cell-height, 0px)); justify-content: center; align-content: center }
.camera-stage.camera-wall-screen #camera-videos.camera-fullscreen .camera-video-viewport { width: 100%; height: auto; min-height: 0; max-height: none; aspect-ratio: 16 / 9 }
.camera-wall-screen .camera-video-card { min-height: 0 }
.camera-wall-screen .camera-video-viewport { aspect-ratio: 16 / 9 }
.camera-stage.camera-video-only { padding: 0; background: #000 }
.camera-stage.camera-video-only > header,
.camera-stage.camera-video-only > #camera-message { display: none }
.camera-screen-open .camera-stage.camera-video-only #camera-videos { display: block; overflow: hidden }
.camera-video-only .camera-video-card { height: 100%; padding: 0; border: 0; background: #000 }
.camera-screen-open .camera-stage.camera-video-only #camera-videos .camera-video-viewport { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; container-type: size; touch-action: none }
.camera-video-only .camera-video-viewport video { margin: auto; width: min(100cqw, calc(100cqh * 16 / 9)); height: min(100cqh, calc(100cqw * 9 / 16)) }
.camera-video-only .camera-video-fullscreen { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)) }
.camera-caption-autohide { transition: opacity 180ms ease; pointer-events: none }
.camera-caption-autohide.camera-caption-hidden { opacity: 0 }
@media (hover: hover) {
  .camera-caption-surface:hover .camera-caption-autohide { opacity: 1 }
}
.camera-caption-surface:focus-visible .camera-caption-autohide,
.camera-caption-surface:has(:focus-visible) .camera-caption-autohide { opacity: 1 }
@media (prefers-reduced-motion: reduce) {
  .camera-caption-autohide { transition: none }
}
.camera-watch-select { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; font-size: 12px }
.camera-watch-select[hidden] { display: none }
.camera-watch-select input { width: 18px; height: 18px; accent-color: var(--accent-bright) }
.bath-dialog { box-sizing: border-box; width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface-raised); color: var(--text); font: inherit; box-shadow: 0 24px 80px #0008 }
.bath-dialog::backdrop { background: #000a }
.bath-dialog * { box-sizing: border-box }
.bath-dialog [hidden] { display: none !important }
.bath-header, .bath-footer { position: sticky; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-raised) }
.bath-header { top: 0; padding: 16px 20px; border-bottom: 1px solid var(--border-strong) }
.bath-footer { bottom: 0; padding: 12px 20px; border-top: 1px solid var(--border-strong) }
.bath-heading { display: flex; align-items: center; gap: 12px; min-width: 0 }
.bath-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 13px; color: var(--accent-bright); background: #729a7430 }
.bath-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round }
.bath-eyebrow, .bath-section-label, .bath-card-number { color: var(--text-secondary); font-size: 10px; font-weight: 700; letter-spacing: .1em }
.bath-dialog h2 { margin: 2px 0 0; font-size: 21px }
.bath-dialog button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--text); background: var(--surface-raised); font: inherit; cursor: pointer }
.bath-dialog button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.bath-dialog button:disabled { opacity: .6; cursor: wait }
.bath-dialog #bath-close { width: 44px; padding: 0; font-size: 26px; line-height: 1 }
.bath-content { padding: 20px }
.bath-connection { padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: #7897870d }
.bath-dialog p { overflow-wrap: anywhere; line-height: 1.45 }
.bath-status { margin: 8px 0 0; font-size: 13px }
.bath-status::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #d6ad69 }
.bath-status-connected::before { background: #80c99a }
.bath-status-error::before { background: #e38a7d }
.bath-checked { margin: 10px 0 20px; color: var(--text-secondary); font-size: 12px }
.bath-cards-title { margin: 0 0 10px; font-size: 15px }
.bath-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
.bath-card { min-width: 0; padding: 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: #78978712 }
.bath-card-title { margin: 8px 0 4px; font-size: 17px }
.bath-device-state { margin: 0 0 14px; color: var(--text-secondary); font-size: 12px }
.bath-telemetry { margin: 0; border-top: 1px solid var(--border-strong) }
.bath-telemetry-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; font-size: 12px }
.bath-telemetry dt { color: var(--text-secondary) }
.bath-telemetry dd { margin: 0; text-align: right; font-weight: 700 }
.bath-device-error { margin: 12px 0 0; color: #e8a899; font-size: 12px }
.bath-safety { margin-top: 18px; padding: 15px 16px; border: 1px solid #b6905266; border-radius: 12px; background: #b6905214 }
.bath-safety strong { color: #e1bf84; font-size: 14px }
.bath-safety p { margin: 6px 0 0; color: var(--text-secondary); font-size: 12px }
.bath-footer span { color: var(--text-secondary); font-size: 12px; line-height: 1.35 }
@media (max-width: 480px) { .bath-header, .bath-footer { padding: 12px 14px } .bath-content { padding: 14px } .bath-cards { grid-template-columns: 1fr } .bath-footer span { max-width: 130px } }
@media (max-height: 480px) { .bath-header { padding-top: 6px; padding-bottom: 6px } .bath-footer { padding-top: 5px; padding-bottom: 5px } }
.bath-dialog { width: min(1040px, calc(100vw - 24px)) }
.bath-boilers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.bath-boiler { min-width: 0; padding: 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: #78978712 }
.bath-boiler > header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 12px }
.bath-boiler h3 { margin: 0; font-size: 20px }
.bath-boiler > header span, .bath-video-status, .bath-camera-note { font-size: 12px; color: var(--text-secondary) }
.bath-video-stage { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; border-radius: 10px; background: #040908 }
.bath-video-stage video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; opacity: 0; pointer-events: none }
.bath-video-stage video.is-visible { opacity: 1 }
.bath-video-stage.camera-screen-surface { aspect-ratio: auto; border-radius: 0; background: #000 }
.bath-dialog:has(.camera-screen-open), .camera-dialog:has(.camera-screen-open) { position: fixed; inset: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; overflow: hidden; border: 0; border-radius: 0 }
.bath-dialog .bath-video-stage.camera-screen-surface button { top: max(8px, env(safe-area-inset-top)) }
.bath-video-stage.camera-screen-surface .bath-video-retry { left: max(8px, env(safe-area-inset-left)) }
.bath-video-stage.camera-screen-surface .bath-video-fullscreen { right: max(8px, env(safe-area-inset-right)) }
.bath-dialog .bath-video-stage button { position: absolute; top: 8px; z-index: 2; width: 44px; min-width: 44px; height: 44px; padding: 10px; background: #101c19d9; color: #fff }
@media (min-width: 721px) and (hover: hover) and (pointer: fine) { .bath-dialog .bath-video-stage button { width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 6px } }
.bath-video-retry { left: 8px }
.bath-video-fullscreen { right: 8px }
.bath-video-stage button svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.bath-valve-state { min-height: 40px; font-weight: 600; font-size: 14px }
.bath-manual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.bath-dialog .bath-switch { grid-column: 1 / -1; border-color: #81b99580; background: #467a5d40 }
.bath-camera-confirm, .bath-operation label { display: flex; align-items: flex-start; gap: 10px; padding: 14px 0; font-size: 14px; line-height: 1.5; cursor: pointer }
.bath-dialog input[type=checkbox] { flex: 0 0 20px; width: 20px; height: 20px; margin: 1px 0; accent-color: var(--accent-bright) }
.bath-operation { margin-top: 14px; padding: 16px; border: 1px solid #b6905280; border-radius: 12px; background: #b6905214 }
.bath-operation h3 { margin: 0; font-size: 18px }
.bath-operation > div { display: flex; flex-wrap: wrap; gap: 8px }
.bath-dialog button:disabled { cursor: not-allowed; opacity: .5 }
.bath-dialog input:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px }
#bath-command-message { font-size: 14px; line-height: 1.5 }
@media (max-width: 720px) { .bath-boilers { grid-template-columns: 1fr } }
.tuya-settings #tuya-check { min-height: 44px; max-width: 100%; }
.tuya-settings #tuya-check:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.tuya-settings #tuya-connection-details p { overflow-wrap: anywhere; line-height: 1.45; }

/* Unified notifications: the visual segment is thin, its hit targets are not. */
.event-filter { display: flex; flex-wrap: wrap; max-width: 100%; margin: 6px 0 4px; padding: 0; border: 1px solid var(--border-strong); border-radius: 10px; min-width: 0 }
.event-filter label { flex: 1 1 auto; min-width: 0; cursor: pointer }
.event-filter label span { min-width: 24px }
.event-filter input, .event-problems input { position: absolute; width: 1px; height: 1px; opacity: 0 }
.event-filter label span { display: grid; min-height: 36px; box-sizing: border-box; place-items: center; padding: 4px 8px; color: var(--text-secondary); font-size: 12px; font-weight: 700; border-radius: 8px }
.event-filter input:checked + span { color: var(--text); background: var(--surface-active); box-shadow: inset 0 0 0 1px var(--accent-dim) }
.event-filter input:focus-visible + span { outline: 2px solid var(--accent-bright); outline-offset: -3px }
.watch-settings { margin: 8px 0 12px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; color: var(--text-secondary); font-size: 12px }
.watch-settings summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--text); font-weight: 700 }
.watch-settings summary::after { content: '+'; margin-left: auto; font-size: 18px }
.watch-settings[open] summary::after { content: '−' }
.watch-settings p { margin: 0 0 8px; line-height: 1.45; overflow-wrap: anywhere }
.watch-settings fieldset { border: 0; padding: 0; margin: 8px 0; min-width: 0 }
.watch-settings legend { padding: 0; color: var(--text); font-weight: 700 }
.watch-cameras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px }
.watch-cameras label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px; color: var(--text) }
.watch-cameras input { width: 18px; height: 18px; accent-color: var(--accent-bright) }
.watch-actions, .event-pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px }
.watch-settings button, .event-pagination button, #event-reset, .event-photo button { min-height: 44px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface-raised); font: inherit; cursor: pointer }
.watch-settings button:disabled, .event-pagination button:disabled { opacity: .55; cursor: default }
.watch-settings button:focus-visible, .event-pagination button:focus-visible, #event-reset:focus-visible, .event-photo button:focus-visible, .watch-settings summary:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.event-message { margin: 8px 0; color: var(--text-secondary); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere }
.event-message:empty { display: none }
.inspector-content, .event-list { overflow-anchor: none }
.event-list { margin-top: 8px }
#event-reset, .event-pagination { display: none !important }
#events-button { position: relative; overflow: visible }
#event-unread:not([hidden]) { position: absolute; top: -7px; right: -7px; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid var(--surface-raised); border-radius: 12px; background: var(--accent-bright); color: #10231f; font: 700 10px/1 var(--font-body, sans-serif) }
.event-date-nav { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0 12px 4px; border-bottom: 1px solid var(--border); background: var(--surface-raised) }
.event-date-nav small { flex: 1 1 140px; color: var(--text-secondary); font-size: 11px }
.event-date-nav button { min-height: 40px; max-width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-raised); color: var(--text); font: inherit; font-size: 12px; cursor: pointer }
.inspector-head { gap: 8px }
.inspector-head h2 { flex: 1 1 auto; min-width: 0 }
.inspector-head .event-calendar-toggle, .inspector-head .event-clear-toggle { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px }
.event-filter label { position: relative }
.event-problems { position: relative; flex: 0 0 32px; width: 32px; height: 32px; cursor: pointer }
.event-problems > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-secondary) }
.event-problems:hover > span, .event-problems input:checked + span { color: var(--text); background: var(--surface-active) }
.event-problems input:checked + span { box-shadow: inset 0 0 0 1px var(--border-strong) }
.event-problems input:focus-visible + span { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.event-problems .event-category-unread:not([hidden]) { top: -4px; right: -5px; min-width: 16px; height: 16px; padding: 0 3px; color: var(--text-secondary); background: var(--surface-active); font-size: 9px }
.event-category-unread:not([hidden]) { position: absolute; z-index: 1; top: -10px; right: 4px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border: 2px solid var(--surface-raised); border-radius: 12px; background: var(--accent-bright); color: #10231f; font: 700 10px/1 var(--font-body, sans-serif); pointer-events: none }
.event-clear-dialog { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-raised); color: var(--text) }
.event-clear-dialog::backdrop { background: #0009 }
.event-clear-dialog h2 { margin: 0 0 12px; font-size: 18px }
.event-clear-dialog p { font-size: 13px; line-height: 1.5 }
.event-clear-dialog p:empty { display: none }
.event-clear-actions { display: flex; flex-wrap: wrap; gap: 8px }
.event-clear-actions button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface-active); font: inherit; cursor: pointer }
.event-clear-actions button:disabled { opacity: .5; cursor: wait }
.event-clear-actions button:focus-visible, .event-clear-toggle:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.event-camera-popup { position: fixed; box-sizing: border-box; top: calc(max(12px, env(safe-area-inset-top)) + var(--gate-notice-offset, 0px)); right: max(12px, env(safe-area-inset-right)); z-index: 110; width: min(320px, calc(100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)))); max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)) - var(--gate-notice-offset, 0px)); overflow: auto; padding: 10px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); background: var(--surface-raised); box-shadow: 0 8px 28px #0006 }
.event-camera-popup header { padding-right: 42px; line-height: 1.3 }
.event-camera-popup header strong { font-size: 13px }
.event-camera-popup header button { position: absolute; top: 2px; right: 2px; border-color: transparent }
.event-camera-popup p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.35 }
.event-camera-popup p:empty { display: none }
.event-camera-popup .event-popup-time { margin: 2px 0 0; padding-right: 42px; font-size: 11px }
.event-camera-popup .event-copy { margin: 6px 0 0; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere }
.event-camera-popup img { display: block; width: 100%; margin-top: 6px; max-height: min(28dvh, 144px); aspect-ratio: 16 / 9; object-fit: contain; border-radius: 6px; background: #0c1716 }
.event-camera-popup button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.event-calendar { position: absolute; z-index: 5; top: 64px; right: 8px; left: 8px; max-height: calc(100% - 80px); overflow-y: auto; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-raised); box-shadow: 0 12px 32px #0006 }
.event-calendar[hidden] { display: none }
.event-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.event-calendar-head strong { font-size: 13px; text-transform: capitalize }
.event-calendar button { min-width: 0; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer }
.event-calendar-head button { width: 44px; font-size: 24px }
.event-calendar-week, .event-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center }
.event-calendar-week { padding: 6px 0; color: var(--text-secondary); font-size: 11px }
.event-calendar-days button { font-size: 12px; font-variant-numeric: tabular-nums }
.event-calendar button:hover { background: var(--surface-active) }
.event-calendar button[aria-pressed="true"] { background: var(--accent-bright); color: #10231f }
.event-calendar button[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--accent-bright) }
.event-calendar button:focus-visible, .event-calendar-toggle:focus-visible, .event-timeline-rail:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.inspector { overflow: hidden }
.inspector > .inspector-head, .inspector > .stats-section { flex: 0 0 auto }
.inspector > .event-section { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden }
.event-section > .section-heading, .event-section > .event-filter { flex: 0 0 auto }
.event-timeline { display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); flex: 1 1 auto; min-height: 0; overflow: hidden; align-items: stretch; gap: 4px; padding-top: 4px }
.event-timeline > .inspector-content { min-width: 0; scrollbar-width: thin }
.event-timeline .event-list { min-width: 0; padding-left: 0; margin-top: 0 }
.event-timeline .event-list::before { display: none }
.event-timeline .event-item::before { left: 0 }
.event-timeline-rail { align-self: start; writing-mode: vertical-lr; direction: ltr; appearance: none; width: 32px; height: 100%; max-height: 280px; min-height: 0; margin: 0; padding: 0; background: transparent; touch-action: none; cursor: ns-resize }
.event-timeline-rail::-webkit-slider-runnable-track { width: 3px; height: 100%; background: var(--border-strong); border-radius: 3px }
.event-timeline-rail::-webkit-slider-thumb { appearance: none; width: 15px; height: 26px; margin-left: -6px; border: 2px solid var(--surface-raised); border-radius: 10px; background: var(--accent-bright) }
.event-timeline-rail::-moz-range-track { width: 3px; height: 100%; background: var(--border-strong); border-radius: 3px }
.event-timeline-rail::-moz-range-thumb { width: 11px; height: 22px; border: 2px solid var(--surface-raised); border-radius: 10px; background: var(--accent-bright) }
.event-date-nav :focus-visible, .event-photo-close:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
#event-sentinel { height: 1px }
.event-item[data-unread="true"]::before { background: var(--accent-bright) }
.event-item[data-unread="false"]::before { background: transparent; box-shadow: none }
.event-item { display: block; min-height: 44px; cursor: default; padding: 10px 8px 10px 14px }
.event-item .event-copy strong, .event-item .event-copy small { overflow-wrap: anywhere; font-size: 12px; line-height: 1.45 }
.event-item { display: flex; flex-direction: column; align-items: stretch; gap: 6px }
.event-item::before { top: 15px }
.event-item .event-time { display: flex; order: -1; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; white-space: normal; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums }
.event-clock { font-weight: 700; color: var(--text) }
.event-date { font-size: 11px; font-weight: 400; color: var(--text-muted) }
.event-photo { position: relative; aspect-ratio: 16 / 9; margin: 2px 0 0; color: var(--text-secondary); font-size: 12px; background: #0c1716; border-radius: 8px }
.event-photo img { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 8px }
.event-photo figcaption { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 12px; overflow-wrap: anywhere; text-align: center; pointer-events: none }
.event-photo .event-photo-open { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in }
.event-photo .event-photo-open img { margin: 0 }
.event-photo figcaption:empty { display: none }
.event-photo-viewer { position: fixed; width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 60px 12px 12px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); background: var(--surface-raised) }
.event-photo-viewer::backdrop { background: rgba(0, 0, 0, .8) }
.event-photo-viewer img { display: block; width: 100%; max-height: calc(100dvh - 110px); object-fit: contain }
.event-photo-viewer .event-photo-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-raised); color: var(--text-secondary); font: 28px/1 sans-serif; cursor: pointer }
.event-photo-close:hover { color: var(--text); border-color: var(--accent-dim) }
.pole-camera.notification-active .pole-camera-body { animation: notification-camera-pulse 1.4s ease-in-out 1; stroke: #ffde8a; stroke-width: 2 }
@keyframes notification-camera-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@media (prefers-reduced-motion: reduce) {
  .pole-camera.notification-active .pole-camera-body { animation: none; opacity: 1; stroke: #ffde8a; stroke-width: 2 }
}
/* Compact bath control: the diagram is reported state, not a flow sensor. */
.bath-dialog { width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 16px) }
.bath-header { position: static; padding: 6px 12px }
.bath-icon { width: 36px; height: 36px }
.bath-eyebrow, .bath-section-label { display: none }
.bath-content { padding: 8px 12px }
.bath-connection { padding: 0; border: 0; background: none }
.bath-connection p { margin: 0 0 4px; color: var(--text-secondary); font-size: 12px }
/* Pipe spans follow the columns; the assemblies keep their own proportions. */
.bath-schematic { position: relative; height: 96px; width: 100%; margin: 0 auto; overflow: hidden }
.bath-branch, .bath-pipe-layer, .bath-outlet-layer { position: absolute; inset: 0; width: 100%; height: 100% }
.bath-assembly { position: absolute; top: 0; left: 25%; height: 100%; width: auto; transform: translateX(-50%); overflow: visible }
#bath-branch-2 .bath-assembly { left: 75% }
.bath-outlet-layer { left: 50%; right: auto; width: 56.89px; transform: translateX(-50%); pointer-events: none }
.bath-outlet-layer .bath-pipe-shadow, .bath-outlet { stroke-linecap: round }
.bath-pipe-shadow { fill: none; stroke: #71847e; stroke-width: 13; stroke-linejoin: round }
.bath-pipe, .bath-outlet { fill: none; stroke: #e4ebe7; stroke-width: 9; stroke-linejoin: round }
.bath-water, .bath-outlet-water { fill: none; stroke: #ef5350; stroke-width: 2.5; stroke-dasharray: 5 7; opacity: 0; stroke-linecap: round }
.bath-branch[data-state=open] .bath-water, .bath-outlet[data-state=open] ~ .bath-outlet-water { opacity: 1; animation: bath-flow 1s linear infinite }
.bath-coupling { fill: #f4f7f5; stroke: #aabbb3; stroke-width: 1.5 }
.bath-body { fill: #e8eeea; stroke: #aabbb3; stroke-width: 1.5 }
.bath-bracket { fill: none; stroke: #aebdb8; stroke-width: 3; stroke-linejoin: round }
.bath-valve circle { fill: #aeb9b4; stroke: #667973; stroke-width: 1.5 }
.bath-handle { fill: none; stroke: #d23c37; stroke-width: 4; stroke-linecap: round; transform-box: fill-box; transform-origin: center; transition: transform .25s }

.bath-actuator { fill: #202a2b; stroke: #526360; stroke-width: 1.5; stroke-linejoin: round }
.bath-actuator-detail { fill: none; stroke: #667572; stroke-width: 1; opacity: .8 }
.bath-actuator-light { r: 3px; fill: #26332f; stroke: #697b72; stroke-width: .7; filter: none }
.bath-branch[data-state=open] .bath-actuator-light { fill: #4ade80; stroke: #a7f3c0; filter: drop-shadow(0 0 3px #4ade80) }
.bath-branch[data-state=closed] .bath-actuator-light { fill: #ef5350; stroke: #ffb4ae; filter: drop-shadow(0 0 3px #ef5350) }
.bath-unknown { display: none }
.bath-branch[data-state=unknown] .bath-unknown { display: inline }
.bath-branch[data-state=unknown] .bath-pipe { stroke-dasharray: 3 3 }
.bath-branch[data-state=unknown] .bath-handle { display: none }
.bath-unknown circle { fill: #26382f; stroke: #d7bb83; stroke-width: 1.5 }
.bath-unknown text { fill: #f2d7a1; text-anchor: middle; font: 700 12px sans-serif }
.bath-header-actions { display: flex; align-items: center; gap: 6px }
.bath-help { position: relative }
.bath-help summary { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; color: var(--text-secondary); list-style: none }
.bath-help summary::-webkit-details-marker { display: none }
.bath-help summary:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.bath-help summary svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round }
.bath-help p { position: absolute; z-index: 5; right: -50px; top: 42px; width: min(280px, calc(100vw - 48px)); margin: 0; padding: 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-raised); box-shadow: 0 12px 30px #0008; font-size: 12px }
@keyframes bath-flow { to { stroke-dashoffset: -12 } }
@media (prefers-reduced-motion: reduce) { .bath-water, .bath-outlet-water { animation: none !important } .bath-handle { transition: none } }
.bath-warning { color: #f0be83; font-size: 13px; margin: 4px 0 }
.bath-boilers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 6px }
.bath-boiler { margin: 0 4px; padding: 6px; border-radius: 12px }
.bath-boiler > header { gap: 0 5px; margin-bottom: 4px }
.bath-boiler h3 { font-size: 14px }
.bath-boiler > header span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
.bath-connection p::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #d6ad69 }
.bath-connection p[data-state=connected]::before { background: #8ccaa4 }
.bath-valve-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
.bath-video-status { position: absolute; z-index: 1; left: 10px; bottom: 10px; max-width: calc(100% - 20px); margin: 0; padding: 5px 8px; border-radius: 6px; background: #07110dde; color: #e4eee9; font-size: 11px; line-height: 1.3 !important; pointer-events: none }
.bath-valve-state { min-height: 0; margin: 4px 0; font-size: 11px; line-height: 1.2 !important }
.bath-manual { gap: 4px }
.bath-dialog .bath-manual button { padding: 4px 2px; font-size: 11px; line-height: 1.15 }
.bath-camera-confirm { min-height: 44px; align-items: center; padding: 4px 0; font-size: 12px; line-height: 1.25 }
.bath-operation { margin-top: 6px; padding: 10px }
.bath-operation label { padding: 6px 0 }
.bath-operation p { font-size: 13px }
#bath-command-message { margin: 4px 0; font-size: 12px }
#bath-command-message:empty { display: none }
.bath-footer { position: static; padding: 4px 12px 8px; border: 0 }
.bath-footer button { font-size: 12px }
@media (max-height: 640px) { .bath-header { padding: 2px 10px } .bath-content { padding: 4px 10px } }


/* Direct bath controls: one unframed surface, with generous video on phones. */
.bath-boilers { gap: 16px }
.bath-boiler { margin: 0; padding: 0; border: 0; background: transparent }
.bath-boiler > header { margin-bottom: 5px }
.bath-valve-state { margin: 4px 0; font-size: 12px }
.bath-diagram-labels { display: grid; grid-template-columns: 1fr 1fr; text-align: center; color: var(--text-secondary); font-size: 11px }
.bath-branch { pointer-events: none }
.bath-dialog #bath-switch { position: absolute; z-index: 2; left: 50%; top: 4px; transform: translateX(-50%); width: 44px; min-width: 44px; height: 44px; padding: 10px; border-radius: 50%; touch-action: manipulation }
#bath-switch svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
#bath-switch[data-pending=true] svg { animation: bath-switch-spin 1s linear infinite }
@keyframes bath-switch-spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { #bath-switch[data-pending=true] svg { animation: none } }
.bath-dialog #bath-switch:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px }
.bath-dialog .bath-valve-target { position: absolute; top: 0; left: 25%; transform: translateX(-50%); width: 70px; height: 96px; padding: 0; border: 0; background: transparent; pointer-events: auto; touch-action: manipulation }
.bath-dialog #bath-branch-2 .bath-valve-target { left: 75% }
.bath-dialog .bath-valve-target:disabled { opacity: 1 }
.bath-valve-target .bath-assembly, #bath-branch-2 .bath-valve-target .bath-assembly { left: 50%; height: 100% }
.bath-branch[data-pose=open] .bath-handle { transform: rotate(90deg) }
.bath-handle { transform-box: view-box; transform-origin: 0 0; transition: transform .5s ease-in-out; stroke-width: 7 }
.bath-fastener { fill: #dce5e1; stroke: #65756e; stroke-width: .7 }
.bath-actuator { fill: #202828; stroke: #71817a; filter: drop-shadow(0 2px 2px #0008) }
.bath-body { fill: #f4f7f5; stroke: #9aaea5 }
.bath-pipe { stroke: #f4f7f5 }
#bath-command-message:empty { display: none }
@media (max-width: 720px) { .bath-boilers { grid-template-columns: 1fr; gap: 8px } }
@media (prefers-reduced-motion: reduce) { .bath-handle { transition: none } }

/* Brushed fittings and a cast actuator, kept independent of the pipe's responsive span. */
.bath-pipe-layer path { vector-effect: non-scaling-stroke }
.bath-pipe-shadow { stroke: #667a73; stroke-width: 15 }
.bath-pipe { stroke: #d2ded8; stroke-width: 11 }
.bath-pipe-highlight { fill: none; stroke: #f7faf8; stroke-width: 4; stroke-linejoin: round; opacity: .85 }
.bath-branch[data-state=unknown] .bath-pipe-highlight { stroke-dasharray: 3 3 }
.bath-coupling, .bath-body, .bath-mount { fill: url(#bath-metal); stroke: #71857b; stroke-width: 1 }
.bath-bracket { stroke: #899c93; stroke-width: 2.5 }
.bath-actuator { fill: url(#bath-housing); stroke: #6b7d76; stroke-width: 1 }
.bath-actuator-detail { stroke: #899a92; stroke-width: .8; opacity: .6 }
.bath-actuator-light { stroke: #111d1a; stroke-width: .8 }
.bath-valve circle { fill: #a8b8af; stroke: #52675e }
.bath-handle { stroke: #c73532; stroke-width: 7; filter: drop-shadow(0 1px 1px #30100e99) }
.bath-valve .bath-stem-cap { fill: #e0e9e2; stroke: #6a7c72; stroke-width: .8; pointer-events: none }
.bath-screw-slot { fill: none; stroke: #53675d; stroke-width: .6 }
/* Full-size mechanical assemblies retain their proportions as the pipe span changes. */
.bath-schematic { height: 140px; margin-top: 14px }
.bath-outlet-layer path { vector-effect: non-scaling-stroke }
.bath-outlet-layer .bath-pipe-shadow, .bath-outlet { stroke-linecap: butt }
.bath-outlet { stroke: #d2ded8; stroke-width: 11 }
.bath-junction-water { fill: none; stroke: #ef5350; stroke-width: 2.5; stroke-dasharray: 5 7; stroke-linecap: round; opacity: 0 }
.bath-schematic:has(#bath-branch-1[data-state=open]) .bath-junction-water-left, .bath-schematic:has(#bath-branch-2[data-state=open]) .bath-junction-water-right { opacity: 1; animation: bath-flow 1s linear infinite }
@media (prefers-reduced-motion: reduce) { .bath-junction-water { animation: none !important } }
.bath-junction-collars { fill: none; stroke: #71857b; stroke-width: 1.5; stroke-linecap: round }
.bath-dialog .bath-valve-target { width: 90px; height: 140px }
.bath-outlet-layer { width: 82.96px }
.bath-dialog #bath-switch { top: 12px }
.bath-body { stroke: #73887d; stroke-width: 1.1 }
.bath-boss { fill: #aabcb2; stroke: #6b8075; stroke-width: 1 }
.bath-boss-inner { fill: #e9efea; stroke: #81958a; stroke-width: 1 }
.bath-bracket { stroke: #a1b4aa; stroke-width: 3; stroke-linecap: round }
.bath-actuator-side { fill: #121c1a; stroke: #62756c; stroke-width: 1 }
.bath-actuator-panel { fill: #1b2825; stroke: #586b62; stroke-width: .7 }

.bath-progress { display: none; }
.bath-branch[data-state=pending] .bath-progress { display: inline; }
.bath-progress circle { fill: #26382f; stroke: #ef5350; stroke-width: 2; stroke-dasharray: 28 16; transform-box: fill-box; transform-origin: center; animation: bath-switch-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .bath-progress circle { animation: none; } }

.camera-watch-badge:focus-visible { outline: 2px solid #fff; outline-offset: 2px }
.camera-watch-badge[aria-disabled="true"] { cursor: default }
.camera-detection-confirm { color: #eef7f4; background: #182925; border: 1px solid #6b9184; border-radius: 12px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-sizing: border-box; max-height: 90dvh; overflow: auto }
.camera-detection-confirm::backdrop { background: #0009 }
.camera-detection-confirm p { line-height: 1.5 }
.camera-detection-confirm div { display: flex; justify-content: flex-end; gap: 12px }
.camera-detection-confirm button { padding: 10px 14px; cursor: pointer }

/* The notification sheet owns the usable mobile viewport, not half the map. */
@media (max-width: 820px), (max-height: 480px) and (pointer: coarse) {
  .inspector.open {
    position: fixed; inset: 0; z-index: 100; width: 100%; height: 100dvh;
    max-height: 100dvh; border-radius: 0; box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .inspector.open .inspector-content { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain }
}
/* Compact regional weather lives outside the header, never over the map. */
.weather-strip { position: relative; z-index: 3; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; min-height: 30px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); color: var(--text-secondary); font-size: 11px; }
.weather-strip[hidden] { display: none }
@media (min-width: 768px) {
  .topbar > .weather-strip { flex: 1 1 auto; min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
}
@media (min-width: 768px) and (max-width: 1050px) {
  .topbar { gap: 12px; padding-inline: 16px; }
  .topbar .brand { flex-basis: auto; }
  .topbar .brand-copy small { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .topbar-search { flex: 0 1 140px; width: 140px; min-width: 80px; }
}
#weather-values { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px }
.weather-item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-primary); white-space: nowrap; font-size: 13px; font-weight: 700 }
.weather-item svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round }
.weather-delay { color: var(--amber) }
.weather-strip a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap }
.map-settings-panel .weather-credits { margin: 0; padding: 0 12px 4px; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.weather-credits a { display: inline-flex; align-items: center; min-height: 24px; }
@media (max-width: 820px) { .weather-strip { border-radius: 0; min-height: 28px; padding: 3px 8px; gap: 3px 8px } }
