/* ============================================================
   css/map-viewer.css -- the eDash map viewer (sprint/map-viewer).
   Layout ported from wtp.systems' dashboard/static/map-page.css:
   the map fills the page, every control floats over it as a
   translucent glass card (chrome only), and the inspector, whose
   job is charts and tables, is a flat readable paper with the
   charts on the plate (DESIGN.md; check-no-glass-under-content).
   Under 900px the toolbar is a bottom dock and the panels are
   bottom sheets, one at a time. The Feedback and edash-bot FABs
   are moved clear of the dock and hidden while a sheet is open.
   ============================================================ */

:root {
  --mv-glass: rgba(255, 255, 255, .74);
  --mv-glass-hi: rgba(255, 255, 255, .92);
  --mv-ground: #DDE6E7;
  --mv-row-hover: rgba(15, 106, 113, .08);
  --mv-row-active: rgba(15, 106, 113, .14);
  --mv-halo: rgba(8, 20, 24, .78);
  --mv-label-ink: #FFFFFF;
  --mv-pin-core: #FFFFFF;
  --mv-pin-core-ink: #25343F;
  --mv-select: #FFC247;
  --mv-badge-alert: #D64545;
  --mv-badge-task: #46545C;
  --mv-badge-ink: #FFFFFF;
  --mv-forecast: #B25E00;
  --mv-warn-bg: #FBF1DE;
}
html[data-theme="dark"] {
  --mv-glass: rgba(24, 39, 44, .72);
  --mv-glass-hi: rgba(24, 39, 44, .92);
  --mv-ground: #0E1A1D;
  --mv-row-hover: rgba(109, 195, 187, .10);
  --mv-row-active: rgba(109, 195, 187, .18);
  --mv-halo: rgba(0, 0, 0, .85);
  --mv-label-ink: #FFFFFF;
  --mv-pin-core: #18272C;
  --mv-pin-core-ink: #E7EFF0;
  --mv-select: #FFC247;
  --mv-badge-alert: #E05A5A;
  --mv-badge-task: #6B7A83;
  --mv-badge-ink: #FFFFFF;
  --mv-forecast: #FFB866;
  --mv-warn-bg: rgba(227, 162, 26, .18);
}

/* ---------- Frame ---------- */
.mv { font-family: 'Montserrat', sans-serif; color: var(--ink); overflow: hidden; }
/* .edash-content (the containing block) is positioned, so its padding box
   is already edge to edge: the legacy negative inset overshot by one
   padding on every side and hid the corners under the sidebar. */
.mv.ps-page { inset: 0; }
.mv .mv-map { position: absolute; inset: 0; background: var(--mv-ground); z-index: 0; }
.mv .leaflet-container { font-family: 'Montserrat', sans-serif; background: var(--mv-ground); }
.mv.is-drawing .mv-map { cursor: crosshair; }
.mv .mv-fatal { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); z-index: 1200; }

/* ---------- Glass chrome (bar, search, time, legend, left panel, menus) ---------- */
.mv .mv-panel,
.mv .mv-bar,
.mv .mv-search,
.mv .mv-iconbtn,
.mv .mv-time {
  background: var(--mv-glass);
  -webkit-backdrop-filter: var(--mat-filter-regular);
  backdrop-filter: var(--mat-filter-regular);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--liquid-rim-hi), var(--mat-shadow-2);
}
html.glass-lite .mv .mv-panel,
html.glass-lite .mv .mv-bar,
html.glass-lite .mv .mv-search,
html.glass-lite .mv .mv-iconbtn,
html.glass-lite .mv .mv-time { background: var(--glass-paper); }

.mv .mv-panel {
  position: absolute;
  z-index: 1100;
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.mv .mv-panel.open { opacity: 1; visibility: visible; transform: none; transition: opacity .18s ease, transform .18s ease; }

.mv .mv-left { top: 64px; left: 12px; bottom: 12px; width: 340px; }
/* The inspector holds charts and tables: flat paper, no blur under them. */
.mv .mv-right {
  top: 64px; right: 12px; bottom: 136px; width: 420px;
  background: var(--glass-paper);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.mv .mv-legend { bottom: 12px; left: 12px; width: 300px; max-height: 44%; z-index: 1090; }
.mv .mv-menu { top: 60px; left: 12px; width: 340px; max-height: 70%; overflow: auto; padding: 12px; z-index: 1150; opacity: 1; visibility: visible; transform: none; }
.mv .mv-menu[hidden] { display: none; }

.mv .mv-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; border-bottom: 1px solid var(--glass-edge); }
.mv .mv-head-slim { padding: 6px 8px 6px 12px; }
.mv .mv-head h4, .mv .mv-group h4, .mv .mv-menu h4, .mv #mvNeedsLocation h4 {
  margin: 0; flex: 1;
  font-size: var(--type-section-head-size); font-weight: var(--type-section-head-weight); color: var(--ink);
  text-transform: none; letter-spacing: 0;
}
.mv .mv-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 14px; min-height: 0; flex: 1; }
.mv .mv-scroll[hidden] { display: none; }

/* ---------- Segmented tabs, chips, buttons ---------- */
.mv .mv-seg { display: inline-flex; flex: 1; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--mv-row-hover); }
.mv .mv-seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: var(--r-ctl);
  font: inherit; font-size: var(--type-button-size); font-weight: var(--type-button-weight);
}
.mv .mv-seg button[aria-selected="true"], .mv .mv-seg button[aria-pressed="true"] { background: var(--mv-glass-hi); color: var(--primary); box-shadow: var(--mat-shadow-1); }
.mv .mv-seg-sm { display: flex; margin: 8px 0; }
.mv .mv-close {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  min-width: 32px; height: 32px; border-radius: var(--r-ctl); font-size: var(--type-body-size);
}
.mv .mv-close:hover { background: var(--mv-row-hover); color: var(--ink); }
.mv .mv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mv .mv-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--glass-edge); background: var(--mv-glass-hi); color: var(--ink);
  padding: 5px 10px; border-radius: var(--r-chip);
  font: inherit; font-size: var(--type-chip-size); font-weight: var(--type-chip-weight);
}
.mv .mv-chip[aria-pressed="true"] { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.mv .mv-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--glass-edge); background: var(--surface); color: var(--ink);
  padding: 7px 12px; border-radius: var(--r-ctl);
  font: inherit; font-size: var(--type-button-size); font-weight: var(--type-button-weight);
}
.mv .mv-btn:hover { border-color: var(--primary); color: var(--primary); }
.mv .mv-btn[disabled] { opacity: .5; cursor: not-allowed; }
.mv .mv-btn-primary { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.mv .mv-btn-primary:hover { background: var(--primary-dark); color: var(--surface); }
.mv .mv-btn[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
.mv .mv-link { border: 0; background: none; padding: 2px 0; cursor: pointer; color: var(--primary); font: inherit; font-size: var(--type-caption-size); text-decoration: underline; }
.mv .mv-link[aria-pressed="true"] { font-weight: var(--type-label-weight); }
.mv .mv-note { margin: 6px 0; color: var(--muted); font-size: var(--type-caption-size); line-height: 1.45; }
.mv .mv-empty { text-align: center; color: var(--muted); padding: 32px 12px; font-size: var(--type-body-size); }
.mv .mv-empty i { font-size: var(--type-kpi-number-size); color: var(--primary); opacity: .6; }
.mv button:focus-visible, .mv input:focus-visible, .mv select:focus-visible, .mv [tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Toolbar ---------- */
.mv .mv-bar { position: absolute; top: 12px; left: 12px; z-index: 1120; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-card); }
.mv .mv-bar button {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; cursor: pointer;
  border: 0; background: transparent; color: var(--ink); border-radius: var(--r-ctl);
  font: inherit; font-size: var(--type-button-size); font-weight: var(--type-button-weight);
}
.mv .mv-bar button:hover { background: var(--mv-row-hover); }
.mv .mv-bar button[aria-expanded="true"], .mv .mv-bar button[aria-pressed="true"] { background: var(--primary); color: var(--surface); }
.mv .mv-bar-sep { width: 1px; height: 22px; background: var(--glass-edge); margin: 0 4px; }
@media (max-width: 1379px) and (min-width: 900px) { .mv .mv-bar button span { display: none; } }

/* ---------- Search + Home + locate ---------- */
.mv .mv-top { position: absolute; top: 12px; right: 12px; z-index: 1120; display: flex; gap: 6px; align-items: flex-start; }
.mv .mv-search { position: relative; display: flex; align-items: center; gap: 8px; width: 320px; height: 44px; padding: 0 12px; border-radius: var(--r-card); color: var(--muted); }
.mv .mv-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--type-body-size); outline: none; }
.mv .mv-iconbtn { width: 44px; height: 44px; border-radius: var(--r-card); color: var(--ink); cursor: pointer; font-size: var(--type-body-size); }
.mv .mv-iconbtn:hover { color: var(--primary); }
.mv .mv-results {
  position: absolute; top: 48px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--glass-paper); border: 1px solid var(--glass-edge); border-radius: var(--r-ctl); box-shadow: var(--mat-shadow-3);
  max-height: 320px; overflow: auto;
}
.mv .mv-results li { padding: 8px 10px; cursor: pointer; border-radius: var(--r-ctl); color: var(--ink); font-size: var(--type-body-size); }
.mv .mv-results li:hover { background: var(--mv-row-hover); }
.mv .mv-rk { display: inline-block; min-width: 72px; color: var(--muted); font-size: var(--type-label-size); font-weight: var(--type-label-weight); text-transform: capitalize; }

/* ---------- Time bar ---------- */
.mv .mv-time { position: absolute; top: 64px; z-index: 1080; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: var(--r-card); }
.mv .mv-time input[type="range"] { flex: 1; min-width: 80px; accent-color: var(--primary); }
.mv .mv-time output { min-width: 150px; text-align: right; font-size: var(--type-label-size); font-weight: var(--type-label-weight); color: var(--ink); white-space: nowrap; }
.mv .mv-time output.is-forecast { color: var(--mv-forecast); }
.mv .mv-time .mv-iconbtn { width: 34px; height: 34px; background: var(--mv-glass-hi); box-shadow: none; }
.mv .mv-time.is-docked { position: static; margin-top: 12px; box-shadow: none; }
.mv .mv-toaststrip { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); z-index: 1200; padding: 8px 14px; border-radius: var(--r-chip); background: var(--ink); color: var(--surface); font-size: var(--type-caption-size); box-shadow: var(--mat-shadow-2); }
.mv .mv-toaststrip[hidden] { display: none; }

/* ---------- Sites tab ---------- */
.mv .mv-counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 8px; }
.mv .mv-count { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 6px; border-radius: var(--r-ctl); background: var(--mv-glass-hi); }
.mv .mv-count-v { font-size: var(--type-card-title-size); font-weight: var(--type-kpi-number-weight); color: var(--ink); }
.mv .mv-count-v small { font-size: var(--type-kpi-unit-size); color: var(--muted); }
.mv .mv-count-l { font-size: var(--type-label-size); color: var(--muted); }
.mv .mv-filter { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; border-radius: var(--r-ctl); background: var(--mv-glass-hi); border: 1px solid var(--glass-edge); color: var(--muted); }
.mv .mv-filter input { flex: 1; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--type-body-size); outline: none; min-width: 0; }
.mv .mv-list { display: flex; flex-direction: column; gap: 2px; }
.mv .mv-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: var(--r-ctl); cursor: pointer; }
.mv .mv-row:hover { background: var(--mv-row-hover); }
.mv .mv-row.is-active { background: var(--mv-row-active); }
.mv .mv-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv .mv-row-name { font-size: var(--type-body-size); font-weight: var(--type-label-weight); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv .mv-row-sub { font-size: var(--type-caption-size); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv .mv-row-kpi { font-size: var(--type-table-cell-size); color: var(--ink); white-space: nowrap; }
.mv .mv-row-kpi small { color: var(--muted); font-size: var(--type-kpi-unit-size); }
.mv .mv-cmp input { accent-color: var(--primary); width: 16px; height: 16px; }
.mv .mv-star { border: 0; background: none; cursor: pointer; color: var(--border); font-size: var(--type-body-size); padding: 4px; }
.mv .mv-star.is-on { color: var(--warning); }
.mv .mv-list-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mv .mv-dot {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: var(--r-chip); background: var(--dot, #7C8B8D); color: var(--mv-badge-ink);
  font-size: var(--type-label-size); font-weight: var(--type-kpi-number-weight); line-height: 1;
}

/* ---------- Layers tab ---------- */
.mv .mv-group { padding: 8px 0 10px; border-bottom: 1px solid var(--glass-edge); }
.mv .mv-group:last-child { border-bottom: 0; }
.mv .mv-group h4 { margin-bottom: 6px; }
.mv .mv-basegrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mv .mv-basegrid button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; cursor: pointer;
  border: 1px solid var(--glass-edge); background: var(--mv-glass-hi); color: var(--ink); border-radius: var(--r-ctl);
  font: inherit; font-size: var(--type-label-size);
}
.mv .mv-basegrid button.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }
.mv .mv-basesw { width: 100%; height: 30px; border-radius: var(--r-ctl); background: var(--border); }
.mv .mv-basesw-sat { background: linear-gradient(135deg, #2E4A2B, #6B7F4A 50%, #3A5F7A); }
.mv .mv-basesw-osm { background: linear-gradient(135deg, #F2EFE9, #AAD3DF 60%, #F8D29B); }
.mv .mv-basesw-topo { background: repeating-linear-gradient(160deg, #E6E4C9 0 5px, #CFC9A0 5px 6px); }
.mv .mv-basesw-gibs { background: linear-gradient(135deg, #F4F7F9, #8FA7B8 45%, #2B4C3F); }
.mv .mv-basesw-s2 { background: linear-gradient(135deg, #3F5A36, #8C8F63 50%, #1F4E6B); }
.mv .mv-gibs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: var(--type-caption-size); color: var(--muted); }
.mv .mv-gibs[hidden] { display: none; }
.mv .mv-gibs input, .mv .mv-field input, .mv .mv-field select, .mv select {
  border: 1px solid var(--glass-edge); background: var(--surface); color: var(--ink);
  border-radius: var(--r-ctl); padding: 6px 8px; font: inherit; font-size: var(--type-body-size);
}
.mv .mv-sliders { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; font-size: var(--type-label-size); color: var(--muted); }
.mv .mv-sliders label { display: flex; flex-direction: column; gap: 2px; }
.mv input[type="range"] { accent-color: var(--primary); }
.mv .mv-lrow { display: grid; grid-template-columns: 1fr auto 72px auto; align-items: center; gap: 6px; padding: 4px 0; }
.mv .mv-lname { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--type-body-size); color: var(--ink); min-width: 0; }
.mv .mv-lname input { accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.mv .mv-lrow input[type="range"] { width: 72px; opacity: .45; }
.mv .mv-lrow.is-on input[type="range"] { opacity: 1; }
.mv .mv-lstate { font-size: var(--type-label-size); color: var(--muted); }
.mv .mv-lrm { min-width: 28px; height: 28px; }
.mv .mv-sw { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: var(--r-chip); background: var(--sw, #7C93A2); box-shadow: 0 0 0 1px var(--glass-edge); }
.mv .mv-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mv .mv-form[hidden] { display: none; }
.mv .mv-field { display: flex; flex-direction: column; gap: 3px; font-size: var(--type-label-size); font-weight: var(--type-label-weight); color: var(--muted); margin: 4px 0; }

/* ---------- Visualise ---------- */
.mv .mv-readout { margin-top: 8px; }

/* ---------- Legend ---------- */
.mv .mv-lg-base { margin: 0 0 8px; font-size: var(--type-caption-size); color: var(--muted); }
.mv .mv-lg-item { padding: 6px 0; border-top: 1px solid var(--glass-edge); }
.mv .mv-lg-title { font-size: var(--type-legend-size); font-weight: var(--type-legend-weight); color: var(--ink); margin-bottom: 4px; }
.mv .mv-lg-list { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--type-caption-size); color: var(--ink); }
.mv .mv-lg-list > span { display: inline-flex; align-items: center; gap: 6px; }
.mv .mv-lg-list .mv-dot { width: 16px; height: 16px; }
.mv .mv-lg-bar { display: block; height: 10px; border-radius: var(--r-chip); box-shadow: 0 0 0 1px var(--glass-edge); }
.mv .mv-lg-ends { display: flex; justify-content: space-between; font-size: var(--type-axis-tick-size); color: var(--muted); margin-top: 2px; }
.mv .mv-line { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--ln, #7C8B8D); }
.mv .mv-line-dash { border-top-style: dashed; filter: drop-shadow(0 0 1px var(--ink)); }
.mv .mv-notes { margin-top: 8px; font-size: var(--type-caption-size); }
.mv .mv-notes summary { cursor: pointer; color: var(--primary); font-weight: var(--type-label-weight); }
.mv .mv-dl { margin: 6px 0 0; }
.mv .mv-dl dt { font-weight: var(--type-label-weight); color: var(--ink); margin-top: 8px; font-size: var(--type-caption-size); }
.mv .mv-dl dd { margin: 2px 0 0; color: var(--muted); font-size: var(--type-caption-size); line-height: 1.45; }
.mv .mv-dl a { color: var(--primary); }

/* ---------- Inspector (flat paper) ---------- */
.mv .mv-flat { background: var(--glass-paper); }
.mv .mv-insp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mv .mv-insp-head h3, .mv .mv-h3 { margin: 0; font-size: var(--type-card-title-size); font-weight: var(--type-card-title-weight); color: var(--ink); }
.mv .mv-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 10px 4px 4px; border-radius: var(--r-chip); background: var(--mv-row-hover); font-size: var(--type-chip-size); font-weight: var(--type-chip-weight); color: var(--ink); }
.mv .mv-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.mv .mv-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.mv .mv-kpi { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: var(--r-ctl); background: var(--chart-plate); border: 1px solid var(--chart-plate-edge); }
.mv .mv-kpi-l { font-size: var(--type-label-size); color: var(--muted); }
.mv .mv-kpi-v { font-size: var(--type-card-title-size); font-weight: var(--type-kpi-number-weight); color: var(--ink); }
.mv .mv-kpi-v small { font-size: var(--type-kpi-unit-size); font-weight: var(--type-kpi-unit-weight); color: var(--muted); }
.mv .mv-place i { color: var(--primary); }
.mv .mv-warn { color: var(--ink); background: var(--mv-warn-bg); border-radius: var(--r-ctl); padding: 6px 8px; }
.mv .mv-warn i { color: var(--warning); }
.mv .mv-chart { margin: 12px 0 0; padding: 10px; border-radius: var(--r-ctl); background: var(--chart-plate); border: 1px solid var(--chart-plate-edge); }
.mv .mv-chart figcaption { font-size: var(--type-caption-size); color: var(--ink); margin-bottom: 6px; }
.mv .mv-chart-plot { position: relative; height: 180px; }
.mv .mv-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: var(--type-table-cell-size); }
.mv .mv-table th { text-align: left; color: var(--muted); font-weight: var(--type-label-weight); font-size: var(--type-label-size); padding: 6px 4px; border-bottom: 1px solid var(--border); }
.mv .mv-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); color: var(--ink); }
.mv .mv-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mv .mv-table tbody tr { cursor: pointer; }
.mv .mv-table tbody tr:hover { background: var(--mv-row-hover); }
.mv .mv-setup { display: flex; align-items: center; gap: 4px; padding: 4px 0; border-bottom: 1px solid var(--glass-edge); }
.mv .mv-setup .mv-link { flex: 1; text-align: left; font-size: var(--type-body-size); text-decoration: none; }

/* ---------- Marks on the map ---------- */
.mv .mv-pinwrap { background: none; border: 0; }
.mv .mv-pin { position: relative; width: 44px; height: 44px; display: grid; place-items: center; }
.mv .mv-pin-core {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-chip);
  background: var(--mv-pin-core); color: var(--mv-pin-core-ink); font-size: var(--type-label-size);
  box-shadow: 0 0 0 4px var(--pin, #7C8B8D), 0 2px 8px rgba(0, 0, 0, .45);
}
.mv .mv-pin.is-offline .mv-pin-core, .mv .mv-pin.is-nodev .mv-pin-core { box-shadow: 0 0 0 4px var(--pin, #7C8B8D), 0 2px 8px rgba(0, 0, 0, .45); opacity: .9; }
.mv .mv-pin.is-nodev .mv-pin-core { background: transparent; border: 2px dashed var(--pin, #7C8B8D); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.mv .mv-pin.is-selected .mv-pin-core { box-shadow: 0 0 0 4px var(--pin, #7C8B8D), 0 0 0 7px var(--mv-select), 0 2px 10px rgba(0, 0, 0, .5); }
.mv .mv-pin-glyph {
  position: absolute; right: 0; bottom: 2px; width: 17px; height: 17px; display: grid; place-items: center;
  border-radius: var(--r-chip); background: var(--pin, #7C8B8D); color: var(--mv-badge-ink); border: 1.5px solid var(--mv-badge-ink);
  font-size: var(--type-label-size); font-weight: var(--type-kpi-number-weight); line-height: 1;
}
.mv .mv-pin-label {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  color: var(--mv-label-ink); font-size: var(--type-label-size); font-weight: var(--type-label-weight);
  text-shadow: 0 0 3px var(--mv-halo), 0 0 6px var(--mv-halo);
}
.mv.is-light-base .mv-pin-label { color: var(--ink); text-shadow: 0 0 3px var(--surface), 0 0 6px var(--surface); }
.mv .mv-badge {
  position: absolute; top: -2px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center;
  border-radius: var(--r-chip); color: var(--mv-badge-ink); border: 1.5px solid var(--mv-badge-ink);
  font-size: var(--type-label-size); font-weight: var(--type-kpi-number-weight); line-height: 1;
}
.mv .mv-badge-alert { right: -6px; background: var(--mv-badge-alert); }
.mv .mv-badge-task { left: -6px; background: var(--mv-badge-task); }
.mv .mv-lg-list .mv-badge { position: static; }
.mv .mv-fresh {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  padding: 1px 6px; border-radius: var(--r-chip); background: var(--mv-halo); color: var(--mv-label-ink);
  font-size: var(--type-label-size);
}
.mv .mv-fresh.is-amber { background: var(--warning); color: var(--ink); }
.mv .mv-fresh.is-red { background: var(--danger); }
.mv .mv-cluster { position: relative; width: 48px; height: 48px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
.mv .mv-cluster svg { display: block; }
.mv .mv-cluster-bg { fill: var(--mv-pin-core); }
.mv .mv-cluster span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mv-pin-core-ink); font-size: var(--type-body-size); font-weight: var(--type-kpi-number-weight); }
.mv .mv-vlabel-wrap { background: none; border: 0; }
.mv .mv-vlabel {
  position: absolute; left: 16px; top: -9px; white-space: nowrap; pointer-events: none;
  padding: 1px 6px; border-radius: var(--r-chip); background: var(--mv-halo); color: var(--mv-label-ink);
  font-size: var(--type-label-size); font-weight: var(--type-label-weight);
}
.mv .mv-tip { font-family: 'Montserrat', sans-serif; font-size: var(--type-caption-size); }
.mv .leaflet-popup-content { font-family: 'Montserrat', sans-serif; font-size: var(--type-caption-size); }

/* Leaflet's own controls: clear of the FAB column (the Feedback pill is
   about 124px wide) and of the inspector when it is open. */
.mv .leaflet-bottom.leaflet-right { right: 148px; transition: right .18s ease; }
.mv.right-open .leaflet-bottom.leaflet-right { right: 444px; }
.mv .leaflet-control-attribution { font-size: var(--type-axis-tick-size); background: var(--mv-glass); color: var(--muted); }
.mv .leaflet-control-attribution a { color: var(--primary); }
.mv .leaflet-bar a { background: var(--mv-glass-hi); color: var(--ink); border-color: var(--glass-edge); }

/* The Feedback and edash-bot FABs keep the bottom-right column; the
   inspector ends above it (bottom: 128px) so neither covers the other. */

/* ---------- Phone: dock + bottom sheets, one at a time ---------- */
@media (max-width: 899px) {
  .mv .mv-bar {
    top: auto; left: 0; right: 0; bottom: 0; border-radius: var(--r-card) var(--r-card) 0 0;
    justify-content: space-around; gap: 0; padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
  }
  .mv .mv-bar button { flex-direction: column; gap: 2px; height: 52px; padding: 0 4px; font-size: var(--type-label-size); min-width: 44px; }
  .mv .mv-bar-sep { display: none; }
  .mv .mv-top { left: 8px; right: 8px; top: 8px; }
  .mv .mv-search { flex: 1; width: auto; }
  .mv .mv-panel { left: 0; right: 0; top: auto; width: auto; bottom: calc(61px + env(safe-area-inset-bottom, 0px)); border-radius: var(--r-card) var(--r-card) 0 0; transform: translateY(24px); }
  .mv .mv-panel.open { transform: none; }
  .mv .mv-left { max-height: 64%; }
  .mv .mv-right { max-height: 80%; }
  .mv .mv-legend { max-height: 50%; }
  .mv .mv-menu { top: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; width: auto; max-height: 60%; }
  .mv .mv-time:not(.is-docked) { display: none; }
  .mv .mv-counts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mv .mv-kpis { grid-template-columns: repeat(2, 1fr); }
  .mv .leaflet-control-zoom { display: none; }
  .mv .leaflet-bottom.leaflet-right, .mv.right-open .leaflet-bottom.leaflet-right { right: 0; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .mv .mv-toaststrip { top: 60px; }
  body.mv-active .fbfab { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  body.mv-active .eb-fab { bottom: calc(72px + 56px + env(safe-area-inset-bottom, 0px)); }
  body.mv-active.mv-sheet-open .fbfab,
  body.mv-active.mv-sheet-open .eb-fab { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .mv .mv-panel, .mv .mv-panel.open, .mv .leaflet-bottom.leaflet-right { transition: none; }
}

/* Map v2 (feat/map-v2): raster fields are a few dozen pixels scaled up by
   the browser, so bilinear smoothing turns the lattice into a field. */
.mv .leaflet-image-layer.mv-raster { image-rendering: auto; }
.mv-feas-row {
  display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 2px 10px;
  padding: 8px 0; border-top: 1px solid var(--line, rgba(37, 52, 63, .12));
}
.mv-feas-row .mv-feas-src { grid-column: 1 / -1; }
.mv-indicative { font-weight: 700; letter-spacing: .04em; }

/* Inspector width: a drag handle on its left edge (desktop), persisted. */
.mv .mv-resize {
  position: absolute; left: -6px; top: 16px; bottom: 16px; width: 12px; cursor: ew-resize; z-index: 2;
  border-radius: var(--r-chip); touch-action: none;
}
.mv .mv-resize::after {
  content: ""; position: absolute; left: 4px; top: 50%; width: 4px; height: 44px; margin-top: -22px;
  border-radius: var(--r-chip); background: var(--muted); opacity: .45;
}
.mv .mv-resize:hover::after, .mv .mv-resize:focus-visible::after, .mv .mv-resize.is-drag::after { opacity: .9; background: var(--primary); }
/* Collapsible legend (all widths): the header toggles the body. */
.mv .mv-legend.is-collapsed .mv-scroll { display: none; }
.mv .mv-legend .mv-lg-toggle { border: 0; background: none; color: var(--ink); cursor: pointer; padding: 4px; font: inherit; font-size: var(--type-body-size); }
.mv .mv-grip { display: none; }

@media (max-width: 899px) {
  /* Portrait phone: a sheet leaves at least half the map visible; the grip
     toggles a tall sheet for reading the inspector. */
  .mv .mv-left, .mv .mv-right { max-height: 52%; }
  .mv .mv-legend { max-height: 42%; }
  .mv .mv-panel.is-tall { max-height: calc(100% - 72px); }
  .mv .mv-right { bottom: calc(61px + env(safe-area-inset-bottom, 0px)); top: auto; width: auto !important; }
  .mv .mv-resize { display: none; }
  .mv .mv-grip {
    display: block; align-self: center; width: 44px; height: 20px; margin: 0; border: 0; background: none; cursor: pointer; position: relative; flex: none;
  }
  .mv .mv-grip::after { content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 4px; border-radius: var(--r-chip); background: var(--muted); opacity: .6; }
  .mv .mv-panel .mv-note, .mv .mv-lg-list, .mv .mv-lg-title, .mv .mv-kpi-l, .mv .mv-lname { font-size: var(--type-body-size); }
  .mv .mv-scroll { -webkit-overflow-scrolling: touch; }
  .mv .mv-seg button { min-height: 40px; }
}
@media (max-width: 899px) {
  /* Eight dock buttons with Indonesian labels: equal shares, labels clipped. */
  .mv .mv-bar button { flex: 1 1 0; min-width: 0; }
  .mv .mv-bar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--type-caption-size); }
  body.mv-sheet-open .mv .leaflet-bottom { display: none; }
}
@media (max-width: 899px) {
  /* Four inspector tabs + grip + close on a 375 px phone: tabs scroll, close stays. */
  .mv .mv-head .mv-seg { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .mv .mv-head .mv-seg::-webkit-scrollbar { display: none; }
  .mv .mv-head .mv-seg button { flex: none; padding-left: 10px; padding-right: 10px; }
  .mv .mv-head .mv-close { flex: none; }
}
@media (max-width: 899px) {
  .mv .mv-search { min-width: 0; }
  .mv .mv-top .mv-iconbtn { flex: none; }
}
@media (max-width: 430px) {
  /* Portrait phones: icons only in the dock (each button keeps its title). */
  .mv .mv-bar button span { display: none; }
  .mv .mv-bar button { height: 48px; }
  .mv .mv-bar button i { font-size: var(--type-card-title-size); }
}
@media (max-width: 899px) {
  /* Sheets over busy rasters: the flat paper, not glass, so text stays legible. */
  .mv .mv-panel { background: var(--glass-paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
