/* MiehlavWX: calm, professional dashboard chrome around a full-bleed map.
   Desktop: top bar + docked side panel. Phone: compact top bar with a live alert strip, bottom tab bar and a slide-up sheet. */
:root {
  --bg: #f5f4f0; --surface: #ffffff; --surface-2: #f4f3ef; --surface-3: #e8e6e0; --border: rgba(40, 38, 30, .12); --border-2: rgba(40, 38, 30, .22);
  --text: #1c1e21; --muted: #666a70; --accent: #0e8a78; --accent-hi: #27b39d; --accent-2: rgba(14, 138, 120, .11); --on-accent: #fff; --warn: #d63a2f; --ok: #15803d;
  --bar-bg: rgba(255, 255, 255, .88);
  --shadow-s: 0 1px 2px rgba(30, 28, 20, .08);
  --shadow: 0 1px 2px rgba(30, 28, 20, .06), 0 10px 30px rgba(30, 28, 20, .15);
  --r: 14px; --panel-w: 392px; --ease: cubic-bezier(.2, .8, .2, 1);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --bar-h: calc(60px + var(--sat)); --nav-h: 0px;
  --inset: 0px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121417; --surface: #1b1e22; --surface-2: #23272c; --surface-3: #2f343b; --border: rgba(255, 255, 255, .08); --border-2: rgba(255, 255, 255, .18);
  --text: #eceae6; --muted: #9b9ea5; --accent: #35c2ab; --accent-hi: #6ad8c5; --accent-2: rgba(53, 194, 171, .15); --on-accent: #06231e; --warn: #ff6f61; --ok: #4ade80;
  --bar-bg: rgba(24, 27, 31, .9);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 12px 36px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.42 Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
[hidden] { display: none !important; }
.i { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i.muted { color: var(--muted); }

.app { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; left: 0; right: 0; top: var(--bar-h); bottom: var(--nav-h); }
.app[data-panel="open"] { --inset: calc(var(--panel-w) + 24px); }

.sweep { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; }

/* ---------- surfaces ---------- */
.glass {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow);
}
.app > .glass, .app > .loop-wrap, .app > .fabs { position: absolute; z-index: 5; }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; border: 0; background: transparent; color: var(--text); transition: background .15s, color .15s, transform .1s; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.primary { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .25); }
.icon-btn.primary:hover { filter: brightness(1.08); }
.icon-btn.small { width: 26px; height: 26px; border-radius: 8px; }
.icon-btn.small .i { width: 14px; height: 14px; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute; z-index: 8; top: 0; left: 0; right: 0; height: var(--bar-h); padding: var(--sat) 14px 0 10px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 14px;
  background: var(--bar-bg); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow-s);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.brand-name { font-size: 18px; font-weight: 500; letter-spacing: .1px; white-space: nowrap; }
.brand-name b { font-weight: 800; color: var(--accent); }
.pill { font-size: 11.5px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.pill.bad { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface-2)); }

/* live alert strip */
.strip { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; cursor: pointer; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.strip::-webkit-scrollbar { display: none; }
.strip-note { color: var(--muted); font-size: 12.5px; }
.sc { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 6px 0 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: transform .12s, border-color .12s; }
.sc:hover { border-color: var(--c, var(--border-2)); }
.sc .dot { width: 8px; height: 8px; box-shadow: none; }
.sc-c { min-width: 20px; padding: 1px 6px; border-radius: 99px; text-align: center; font-size: 11.5px; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--c, var(--muted)) 22%, var(--surface)); color: var(--text); }
.sc.warn { background: color-mix(in srgb, var(--c) 13%, var(--surface)); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.sc.hot { animation: soft-pulse 2.4s ease-in-out infinite; }
.sc.clear { padding-right: 12px; color: var(--muted); font-weight: 500; }
.sc.clear .dot { --c: var(--ok); }
@keyframes soft-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 0%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 26%, transparent); } }

.badge { height: 36px; padding: 0 12px 0 10px; display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 600; transition: background .2s, border-color .2s, color .2s; }
.badge b { font-variant-numeric: tabular-nums; font-size: 14.5px; }
.badge .i { color: #e8a200; width: 18px; height: 18px; }
.badge-l { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.badge:hover { border-color: var(--accent); }
.badge.hot { background: linear-gradient(180deg, #ea3b3b, #c92020); color: #fff; border-color: transparent; box-shadow: 0 2px 10px rgba(201, 32, 32, .4); }
.badge.hot .i, .badge.hot .badge-l { color: #fff; }

/* ---------- what is on screen ---------- */
.chip { top: calc(var(--bar-h) + 12px); left: calc(50% + var(--inset) / 2); transform: translateX(-50%); padding: 7px 18px; text-align: center; font-size: 13px; font-weight: 650; max-width: calc(100% - var(--inset) - 160px); min-width: 230px; transition: left .24s var(--ease); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 12px; }
.chip small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.toast { top: calc(var(--bar-h) + 66px); left: 50%; transform: translateX(-50%); padding: 8px 16px; font-size: 13px; border-radius: 99px; max-width: calc(100% - 24px); text-align: center; }

/* ---------- quick product switch ---------- */
.quick { display: flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.quick button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); transition: background .15s, color .15s; }
.quick button:hover { color: var(--text); }
.quick button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.pq .quick { padding: 4px; } .pq .quick button { padding: 10px 0; font-size: 13.5px; }
.chip .quick { margin-top: 6px; }
kbd { font: 600 10.5px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; background: var(--surface-2); color: var(--muted); }
.group li button { display: flex; align-items: center; justify-content: space-between; }
.group li button kbd { opacity: .7; }

/* ---------- side panel (desktop) / sheet (phone) ---------- */
.panel {
  top: calc(var(--bar-h) + 12px); left: 12px; bottom: 12px; width: var(--panel-w); max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; min-height: 0; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  opacity: 0; visibility: hidden; transform: translateX(-14px) scale(.985); transform-origin: top left; pointer-events: none;
  transition: opacity .2s var(--ease), transform .26s var(--ease), visibility 0s .26s;
}
.app[data-panel="open"] .panel { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
.grab { display: none; }
.panel-head { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 12px; border-bottom: 1px solid var(--border); }
.tabs { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.tabs button { white-space: nowrap; font-size: 13px; background: none; border: 0; border-radius: 9px; padding: 7px 2px; color: var(--muted); font-weight: 650; transition: color .15s, background .15s, box-shadow .15s; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-s), 0 0 0 1px var(--border); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; text-align: center; margin-left: 2px; }
.count:empty { display: none; }
.pane { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.pane[hidden] { display: none; }
.pane > * { flex: none; }

.field { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px; transition: border-color .15s, box-shadow .15s; }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.field > label { font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; min-width: 34px; }
.field input[list] { flex: 1; min-width: 0; background: transparent; border: 0; padding: 7px 0; font-weight: 600; outline: 0; }
.tilts { display: flex; gap: 6px; flex: 1; }
.tilts button { flex: 1; padding: 7px 0; font-size: 12.5px; font-weight: 600; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); transition: background .15s, border-color .15s; }
.tilts button:hover:not(:disabled) { border-color: var(--accent); }
.tilts button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tilts button:disabled { opacity: .35; cursor: default; }
.hint { color: var(--muted); font-size: 12px; margin: 2px 2px; }

.group { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.group > button { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; padding: 11px 12px; font-weight: 700; }
.group > button::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .18s var(--ease); margin: 0 3px 0 1px; }
.group.open > button::before { transform: rotate(45deg); }
.group ul { list-style: none; margin: 0; padding: 0 6px 6px; display: none; }
.group.open ul { display: block; }
.group li button { width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; color: var(--muted); transition: background .12s, color .12s; }
.group li button:hover { color: var(--text); background: var(--surface-3); }
.group li button[aria-checked="true"] { color: var(--text); font-weight: 650; background: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---------- settings ---------- */
.pane-settings { gap: 12px; }
.chips { display: flex; gap: 6px; }
.chips { padding: 3px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.chips button { flex: 1; text-transform: uppercase; letter-spacing: .6px; font-size: 11.5px; border: 0; background: none; border-radius: 99px; padding: 7px 0; font-weight: 700; color: var(--muted); transition: background .15s, color .15s; }
.chips button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.set-body { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 6px; }
.card h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.card h4::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.set-body .card { padding: 12px 14px 4px; box-shadow: var(--shadow-s); }
.row-label { font-weight: 500; }
.pane .row select { -webkit-appearance: none; appearance: none; font-weight: 600; min-width: 104px; padding: 7px 30px 7px 12px; text-align: left; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b9ea5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E") no-repeat right 10px center; }
.row select:hover { border-color: var(--border-2); }
.row select:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; min-height: 42px; }
.row + .row { border-top: 1px solid var(--border); }
.row.dim { opacity: .4; }
.row-label { font-size: 13.5px; }
.row select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 55%; }
.row select option { background: var(--surface); }
.row.slider { flex-direction: column; align-items: stretch; gap: 4px; }
.slider-top { display: flex; justify-content: space-between; }
.slider-val { color: var(--accent); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--surface-3); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent), var(--shadow-s); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.switch { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; flex: none; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease), background .15s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: var(--on-accent); }
.btn-block { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.btn-block:hover { border-color: var(--warn); color: var(--warn); }

/* ---------- outlooks ---------- */
.ol-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ol-title { font-weight: 800; font-size: 15px; }
.ol-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ol-show { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ol-days { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ol-days button { border: 0; background: none; border-radius: 9px; padding: 9px 0; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.ol-days button:hover { color: var(--text); }
.ol-days button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }
.ol-types { flex-wrap: wrap; }
.ol-types button { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.ol-card { padding-bottom: 12px; }
.ol-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.ol-row + .ol-row { border-top: 1px solid var(--border); }
.ol-sw { width: 28px; height: 18px; border-radius: 5px; border: 2px solid; flex: none; }
.ol-name { font-weight: 600; }
.ol-valid { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.ol-link { display: inline-block; margin-top: 8px; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: none; }
.ol-link:hover { text-decoration: underline; }
.nav-dot { display: none; }
.app .maplibregl-ctrl-bottom-left { margin-bottom: 104px; }
.app .maplibregl-ctrl-scale { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); border-color: var(--muted); font: 600 10.5px/1.4 inherit; border-radius: 0 0 6px 6px; }
.ol-stamp { top: calc(var(--bar-h) + 12px); left: calc(var(--inset) + 12px); padding: 7px 14px; font-size: 13px; font-weight: 650; border-radius: 10px; transition: left .24s var(--ease); }
.ol-scale { position: absolute; z-index: 5; right: 12px; top: calc(var(--bar-h) + 24px); bottom: 170px; width: 14px; display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .35); }
.ol-scale i { flex: 1; }

/* ---------- alerts ---------- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 24%, transparent); }
.ov, .lg { padding: 0; overflow: hidden; }
.ov-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; padding: 12px 14px; font-weight: 700; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.ov-head::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s var(--ease); margin-left: auto; order: 3; }
.ov.closed .ov-head::after { transform: rotate(-45deg); }
.ov-sub { font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--accent); margin-left: auto; }
.ov-body { padding: 0 14px 8px; display: flex; flex-direction: column; gap: 2px; }
.ov.closed .ov-body { display: none; }
.ov-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-bottom: 8px; }
.ov-cat { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 0; font-size: 12px; font-weight: 600; color: var(--muted); transition: background .12s, color .12s; }
.ov-cat[aria-pressed="true"] { background: var(--accent-2); color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.lg-head { width: 100%; background: none; border: 0; text-align: left; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 14px 6px; font-weight: 700; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.lg-total { font-size: 11px; background: var(--accent); color: var(--on-accent); border-radius: 9px; padding: 0 8px; letter-spacing: 0; }
.lg-empty { padding: 4px 14px 14px; color: var(--muted); font-size: 12.5px; }
.lg.closed .lg-body { display: none; }
.lg-head::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s var(--ease); }
.lg.closed .lg-head::after { transform: rotate(-45deg); }
.lg-head .lg-total { margin-left: auto; }
.lg-row { width: 100%; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 7px 14px; text-align: left; font-size: 13px; transition: opacity .15s, background .12s; }
.lg-row:hover { background: var(--surface-3); }
.lg-row:last-child { margin-bottom: 6px; }
.lg-name { flex: 1; min-width: 0; }
.lg-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-row.off .lg-name, .lg-row.off .lg-n { opacity: .5; }
.lg-group + .lg-group { border-top: 1px solid var(--border); }
.lg-ghead { display: flex; align-items: center; gap: 10px; padding: 10px 14px 4px; cursor: pointer; }
.lg-gname { flex: 1; font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--text); }
.lg-ghead .switch { width: 36px; height: 21px; }
.lg-ghead .switch::after { width: 15px; height: 15px; }
.lg-ghead .switch:checked::after { transform: translateX(15px); }
.switch:indeterminate { background: color-mix(in srgb, var(--accent) 40%, var(--surface-3)); }
.switch:indeterminate::after { transform: translateX(8px); background: var(--text); }
.lg-row { padding-left: 22px; }
.lg-row .switch { width: 36px; height: 21px; }
.lg-row .switch::after { width: 15px; height: 15px; }
.lg-row .switch:checked::after { transform: translateX(15px); }
.alert-list { display: flex; flex-direction: column; gap: 9px; }
.a-sec { margin: 10px 2px 0; display: flex; align-items: center; justify-content: space-between; font-size: 11px; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.a-sec-n { background: var(--surface-3); border-radius: 9px; padding: 0 8px; letter-spacing: 0; }
.alert { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px 11px 16px; background: var(--surface-2); text-align: left; width: 100%; display: flex; flex-direction: column; gap: 2px; content-visibility: auto; contain-intrinsic-size: auto 96px; overflow: hidden; transition: border-color .15s, background .15s, box-shadow .15s; }
.alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.alert:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); box-shadow: var(--shadow-s); }
.alert[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 13%, var(--surface-2)); border-color: var(--c); }
.a-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.a-title { font-size: 14px; font-weight: 700; color: var(--c); }
:root:not([data-theme="dark"]) .a-title { color: color-mix(in srgb, var(--c) 70%, #000); }
.a-time { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-3); padding: 1px 8px; border-radius: 99px; }
.a-state { font-size: 13px; font-weight: 500; }
.a-area { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.a-threat { font-size: 12.5px; }
.a-threat b { font-weight: 700; }
.tag { align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--c); color: #111; margin: 3px 0; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.skel { height: 84px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* selection popup */
.app .sel-popup .maplibregl-popup-content { padding: 11px 13px; min-width: 210px; }
.app .sel-popup .maplibregl-popup-close-button { display: none; }
.sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sp-head b { flex: 1; font-size: 14px; color: var(--c); }
:root:not([data-theme="dark"]) .sp-head b { color: color-mix(in srgb, var(--c) 70%, #000); }
.sp-row { font-size: 12.5px; color: var(--muted); }
.sp-row b { color: var(--text); }
.sp-back { background: none; border: 0; padding: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 600; }
.app .sel-popup .stack { min-width: 260px; }
.sp-count { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.sp-rows { display: flex; flex-direction: column; gap: 6px; max-height: min(52vh, 380px); overflow-y: auto; overscroll-behavior: contain; margin-right: -4px; padding-right: 4px; }
.sp-item { border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 9px; padding: 7px 10px; background: var(--surface-2); cursor: pointer; transition: border-color .12s; }
.sp-item:hover, .sp-item:focus-visible { border-color: var(--c); }
.sp-item .sp-head { margin-bottom: 1px; }
.sp-item .a-time { font-size: 11px; }

/* ---------- right edge: legend + fabs ---------- */
.scale { flex: 0 0 100%; order: 10; display: flex; align-items: flex-start; gap: 10px; padding: 2px 6px 14px 8px; font-size: 10.5px; }
.scale .bar { position: relative; flex: 1; height: 10px; margin-top: 2px; border-radius: 5px; border: 1px solid var(--border); }
.scale .tick { position: absolute; top: 14px; transform: translateX(-50%); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scale .tick:first-child { transform: none; } .scale .tick:last-child { transform: translateX(-100%); }
.fabs { right: 12px; bottom: 150px; display: flex; flex-direction: column; gap: 10px; }
.fab { position: static; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--text); transition: transform .15s, border-color .15s; }
.fab:hover { border-color: var(--accent); transform: translateY(-1px); }
.fab:active { transform: scale(.96); }

/* ---------- bottom: playback ---------- */
.loop-wrap { left: var(--inset); right: 68px; bottom: 22px; display: flex; justify-content: center; pointer-events: none; transition: left .24s var(--ease); z-index: 5; }
.loop { position: static; pointer-events: auto; width: min(720px, 100%); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 16px; margin: 0 16px; }
.loop input[type=range] { flex: 1; min-width: 60px; }
.loop:has(.scale:not([hidden])) { padding-bottom: 2px; }
.frame-info { font-size: 12px; color: var(--muted); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- dialog + popups ---------- */
.detail { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; width: min(820px, 94vw); max-height: 88vh; box-shadow: var(--shadow); overflow: hidden; }
.detail[open] { display: flex; flex-direction: column; }
.detail::backdrop { background: rgba(8, 14, 28, .55); backdrop-filter: blur(3px); }
.detail form { position: absolute; top: 10px; right: 10px; z-index: 1; }
#detailBody { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.detail h2 { margin: 0; padding: 16px 56px 14px 20px; font-size: 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); border-left: 6px solid var(--c); }
.detail .meta { padding: 12px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2px 20px; }
.detail .meta b { color: var(--text); }
.detail .area { margin: 0; padding: 12px 20px 0; font-size: 13px; color: var(--muted); }
.detail pre { white-space: pre-wrap; font: 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; margin: 12px 20px 20px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
.app .maplibregl-popup-content { background: var(--surface); color: var(--text); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); font: inherit; }
.app .maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-bottom-right { z-index: 4; }
.app .maplibregl-ctrl-group { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.app .maplibregl-ctrl-group button { width: 40px; height: 38px; }
.app .maplibregl-ctrl-group button + button { border-top: 1px solid var(--border); }
:root[data-theme="dark"] .app .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.2); }
.app .maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--muted); border-radius: 8px; }
.app .maplibregl-ctrl-attrib a { color: var(--muted); }

/* ---------- mobile tab bar ---------- */
.nav { display: none; }

/* ---------- splash ---------- */
.splash { position: absolute; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .35s ease, visibility 0s .35s; }
.splash.done { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-name { font-size: 23px; font-weight: 500; letter-spacing: .2px; }
.splash-name b { font-weight: 800; color: var(--accent); }
.splash-bar { width: 120px; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: slide 1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- mid widths: hide the wordy bits ---------- */
@media (max-width: 1180px) { .badge-l { display: none; } .pill { display: none; } }

/* ---------- phones and small tablets: two-row top bar, bottom tab bar, slide-up sheet ---------- */
@media (max-width: 860px) {
  :root { --bar-h: calc(96px + var(--sat)); --nav-h: calc(60px + var(--sab)); }
  .app[data-panel="open"] { --inset: 0px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "strip strip"; row-gap: 0; padding: var(--sat) 12px 0 12px; align-content: center; }
  .tb-left { grid-area: left; }
  .tb-right { grid-area: right; gap: 6px; }
  .strip { grid-area: strip; padding: 4px 0 8px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
  .pill { display: inline-block; }
  .pill:not(.bad) { font-size: 11px; padding: 2px 8px; }
  .badge-l { display: none; }
  #menuBtn { display: none; }
  .brand-name { display: inline; font-size: 17px; }

  .ol-stamp { top: auto; bottom: calc(var(--nav-h) + 124px); left: 12px; font-size: 12px; padding: 5px 10px; }
  .ol-scale { bottom: calc(var(--nav-h) + 200px); top: calc(var(--bar-h) + 70px); }
  .chip { top: calc(var(--bar-h) + 10px); max-width: calc(100% - 92px); left: 12px; transform: none; min-width: 0; text-align: left; padding: 6px 14px; }
  .toast { top: calc(var(--bar-h) + 64px); }

  /* sheet above the tab bar */
  .panel { top: auto; left: 0; right: 0; bottom: var(--nav-h); width: auto; max-width: none; height: min(68vh, 600px); border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(32px); transform-origin: bottom center; z-index: 7; }
  .grab { display: flex; justify-content: center; padding: 10px 0 4px; touch-action: none; cursor: grab; flex: none; }
  .grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--border-2); }
  .panel-head { display: none; }
  .pane { padding: 6px 14px 18px; }
  .row { min-height: 46px; }
  .tilts button, .ov-cat, .chips button { min-height: 40px; }
  .group > button { padding: 14px 12px; }
  .group li button { padding: 11px 10px; }
  .lg-row { padding: 10px 14px; }
  .lg-body { max-height: 40vh; overflow-y: auto; }
  #themeBtn { display: none; } /* also in Settings > General */
  .chip { padding: 6px 10px; } .chip .quick button { padding: 6px 4px; }
  .group li button kbd, .kbhint { display: none; }

  .fabs { bottom: calc(var(--nav-h) + 112px); }
  .loop-wrap { left: 0; right: 0; bottom: calc(var(--nav-h) + 12px); }
  .loop { margin: 0 12px; padding: 6px 10px; }
  .app[data-panel="open"] .fabs, .app[data-panel="open"] .loop-wrap { visibility: hidden; }
  .frame-info { display: none; }
  .app .maplibregl-ctrl-group { display: none; } /* pinch to zoom; the attribution stays */
  .app .maplibregl-ctrl-bottom-right { margin-bottom: 4px; }

  .nav { display: grid; grid-template-columns: repeat(5, 1fr); position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; height: var(--nav-h); padding: 6px 6px var(--sab);
    background: var(--bar-bg); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5); border-top: 1px solid var(--border); }
  .nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 600; transition: color .15s, background .15s; }
  .nav button .i { width: 22px; height: 22px; }
  .nav button[aria-current="page"] { color: var(--accent); background: var(--accent-2); }
  .nav button.on .nav-dot { display: block; position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
  .nav-count { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
  .nav-count:empty { display: none; }
  .nav button.hot .i { color: var(--warn); animation: soft-pulse 2.4s ease-in-out infinite; border-radius: 50%; --c: var(--warn); }
  .detail { width: 100vw; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
}
@media (max-width: 440px) { .pill:not(.bad) { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
