:root {
  --bg: #ffffff; --fg: #0f1b2a; --mut: #5b6b7d; --line: #e2e8ef; --card: #f5f8fb; --acc: #0b63ce; --acc-fg: #ffffff;
  --deep: #8b1010; --blocked: #f25f5c; --risky: #f77f00; --caution: #e9b10a; --cleared: #2fa84f; --top: #0c1a2b; --topfg: #eef3f8; --topmut: #9fb1c4;
  --series-total: #2a78d6; --grid: #e6ebf1; --mapbg: #e8edf2;
  --font: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #0f1722; --fg: #e6edf5; --mut: #97a7b8; --line: #223043; --card: #152131; --acc: #4c9bff; --series-total: #3987e5; --grid: #223043; --mapbg: #0d1520; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #0f1722; --fg: #e6edf5; --mut: #97a7b8; --line: #223043; --card: #152131; --acc: #4c9bff; --series-total: #3987e5; --grid: #223043; --mapbg: #0d1520; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
a { color: var(--acc); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--mut); } .small { font-size: 12px; }
h1 { font-size: 22px; margin: 0; text-wrap: balance; } h2 { font-size: 14px; margin: 0 0 10px; text-wrap: balance; }

/* ---------- top bar ---------- */
header#top { position: fixed; inset: 0 0 auto 0; height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0; z-index: 1000; display: flex; align-items: center; gap: 12px; background: var(--top); color: var(--topfg); }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand .logo { width: 28px; height: 28px; flex: none; }
.brand div { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand b { font-size: 15px; white-space: nowrap; }
.brand .muted { font-size: 11px; color: var(--topmut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.views { display: flex; gap: 2px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 3px; }
.views button { background: none; border: 0; color: var(--topmut); padding: 6px 12px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.views button.on { background: #fff; color: #0c1a2b; font-weight: 600; }
.vehicles { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.vehicles button { border: 1px solid #2b3d52; background: transparent; color: #cfd9e4; border-radius: 999px; padding: 5px 10px; white-space: nowrap; font-size: 12px; }
.vehicles button.on { background: #eef3f8; color: #0c1a2b; border-color: #eef3f8; font-weight: 600; }
button.ghost { border: 1px solid #2b3d52; background: transparent; color: var(--topfg); border-radius: 8px; padding: 5px 9px; }
.alertbar { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 1001; background: #7a1d10; color: #fff; font-size: 12px; padding: 5px 12px; display: flex; gap: 8px; align-items: center; }
.alertbar b { white-space: nowrap; }
.alertbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 1001; background: #6b2a06; color: #fff; text-align: center; font-weight: 600; font-size: 12px; padding: 4px; }

/* ---------- views ---------- */
.view { position: fixed; inset: calc(56px + env(safe-area-inset-top, 0px)) 0 0 0; }
body.has-banner .view { top: calc(80px + env(safe-area-inset-top, 0px)); }
.view[hidden] { display: none; }
#map { position: absolute; inset: 0 400px 0 0; background: var(--mapbg); }
.leaflet-container { background: var(--mapbg); font: inherit; }
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: 400px; background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; z-index: 900; }
.grab { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 11px 4px; color: var(--mut); border-bottom: 2px solid transparent; font-size: 13px; }
.tabs button.on { color: var(--fg); border-color: var(--acc); font-weight: 600; }
.tab { padding: 12px 14px; overflow-y: auto; flex: 1; }
.foot { border-top: 1px solid var(--line); padding: 8px 14px 10px; font-size: 12px; background: var(--card); display: flex; flex-direction: column; gap: 5px; }
.foot p { margin: 0; }
.warn { color: var(--blocked); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.ln { display: inline-block; width: 22px; height: 5px; border-radius: 3px; }
.ln.deep { background: var(--deep); } .ln.blocked { background: var(--blocked); } .ln.risky { background: var(--risky); } .ln.caution { background: var(--caution); }
.ln.cleared { background: repeating-linear-gradient(90deg, var(--cleared) 0 5px, transparent 5px 8px); }
.mk { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--fg); background: var(--card); }
.mk.ci { border-radius: 50%; } .mk.di { transform: rotate(45deg) scale(.85); }

/* ---------- map controls ---------- */
.mapctl { position: absolute; left: 12px; top: 12px; z-index: 800; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.basemaps { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.basemaps button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 12px; color: var(--mut); }
.basemaps button.on { background: var(--acc); color: var(--acc-fg); font-weight: 600; }
.layers { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.layers summary { cursor: pointer; font-weight: 600; }
.layers label { display: flex; gap: 6px; align-items: center; padding: 2px 0; }


/* ---------- route / forms ---------- */
.field { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot { flex: none; width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.dot.a { background: #0c1a2b; border: 2px solid #fff; } .dot.b { background: var(--acc); border: 2px solid #fff; }
.pick { flex: 1; text-align: left; border: 1px dashed var(--line); background: var(--card); border-radius: 8px; padding: 9px 10px; min-height: 40px; width: 100%; }
.pick.armed { border-color: var(--acc); border-style: solid; box-shadow: 0 0 0 2px rgba(11,99,206,.25); }
.pick.set { border-style: solid; }
button.small { font-size: 12px; padding: 7px 9px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; }
button.small.danger { background: var(--blocked); color: #fff; border-color: var(--blocked); }
.primary { width: 100%; background: var(--acc); color: var(--acc-fg); border: 0; border-radius: 8px; padding: 11px; font-weight: 600; margin-top: 8px; }
.primary:disabled { opacity: .45; cursor: default; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.card.bad { border-color: var(--blocked); }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.stats { display: flex; gap: 14px; margin: 4px 0; flex-wrap: wrap; } .stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.list .row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list .row:hover { background: var(--card); }
.bar { flex: none; width: 5px; align-self: stretch; border-radius: 3px; }
.bar.blocked { background: var(--blocked); } .bar.risky { background: var(--risky); } .bar.caution { background: var(--caution); } .bar.cleared, .bar.ok { background: var(--cleared); }
.row .t { flex: 1; min-width: 0; } .row .s { color: var(--mut); font-size: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.kpis div { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; }
.kpis b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; } .kpis span { font-size: 11px; color: var(--mut); }
.feed { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.st { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
.st.ok { background: #16a34a; } .st.stale { background: #f59e0b; } .st.down, .st.pending { background: #9ca3af; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.seg.inline { display: flex; flex-wrap: wrap; margin: 0; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.seg button.on { border-color: var(--acc); background: var(--acc); color: var(--acc-fg); }
.row2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
input[type=number], textarea { font: inherit; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
input[type=number] { width: 90px; } textarea { width: 100%; resize: vertical; }

/* ---------- popups / markers ---------- */
.pp { max-width: 290px; font-size: 13px; }
.pp h4 { margin: 4px 0; font-size: 14px; }
.pp .m { color: #5b6b7d; font-size: 12px; }
/* Whole photo, never cropped: portrait shots are letterboxed on a dark background. */
.pp img, .pp video { width: 100%; height: auto; max-height: min(300px, 42vh); object-fit: contain; border-radius: 6px; margin-top: 6px; background: #0b1220; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.lightbox img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; display: block; }
.lightbox button { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 22px; cursor: pointer; }
.pp img { cursor: zoom-in; }
.leaflet-popup-content { max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.tag { display: inline-block; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.tag.blocked { background: var(--blocked); } .tag.risky { background: var(--risky); } .tag.caution { background: var(--caution); color: #111; } .tag.ok, .tag.cleared { background: var(--cleared); }
.tag.official { background: #0c1a2b; } .tag.crowd { background: #5b6b7d; } .tag.social { background: #7a4cc2; }
/* Map thumbnails show the whole photo (aspect kept, portrait or landscape) inside a 56 px box, pinned at the bottom-centre.
   Leaflet forces width:auto / max-*:none on marker images, so the limits here need the higher specificity + !important. */
.thumbwrap { display: flex; align-items: flex-end; justify-content: center; }
.leaflet-container .leaflet-marker-pane img.thumb { width: auto; height: auto; max-width: 56px !important; max-height: 56px !important; min-width: 20px; min-height: 20px; object-fit: contain; border-radius: 6px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); background: #223; display: block; }
.thumb.old { opacity: .7; filter: saturate(.6); }
.ln.solid { background: var(--risky); }
.ln.dash { background: repeating-linear-gradient(90deg, var(--risky) 0 3px, transparent 3px 7px); opacity: .75; }
.pp .est { color: #b45309; font-weight: 600; }
.sharerow { display: flex; gap: 8px; margin-top: 8px; }
.sharebtn { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 999px; padding: 5px 12px; font-size: 13px; text-decoration: none; cursor: pointer; }
.sharebtn.line { background: #06c755; border-color: #06c755; color: #fff; font-weight: 700; }
.tag.old { background: #64748b; color: #fff; }
.camicon { width: 20px; height: 20px; border-radius: 6px; background: #0c1a2b; color: #fff; display: grid; place-items: center; font-size: 10px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.locbtn { position: absolute; right: 412px; bottom: 28px; z-index: 890; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: #1a73e8; box-shadow: 0 2px 10px rgba(0,0,0,.3); display: grid; place-items: center; padding: 0; cursor: pointer; transition: bottom .28s cubic-bezier(.2,.8,.2,1); }
.locbtn.busy svg { animation: locpulse 1s ease-in-out infinite; }
.locbtn.on { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.locbtn.watching { color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,.35), 0 2px 10px rgba(0,0,0,.3); }
.live { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.live.on { background: #dc2626; color: #fff; }
.live.on::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 4px; vertical-align: 1px; animation: livedot 1.4s ease-in-out infinite; }
.mapctl .live { font-size: 11px; padding: 4px 9px; margin: 0; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
/* In the header the badge sits in a flex column: keep it as wide as its text, not the whole column. */
.brand div > .live, .mapctl > .live { align-self: flex-start; width: max-content; }
.brand div > .live { margin: 2px 0 1px; }
.live.off { background: #475569; color: #e2e8f0; font-weight: 600; letter-spacing: 0; }
@keyframes livedot { 50% { opacity: .25; } }
.pulse { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #dc2626; animation: pulse 1.6s ease-out infinite; box-sizing: border-box; }
@keyframes pulse { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse, .live.on::before { animation: none; } }
@keyframes locpulse { 50% { opacity: .3; } }
@media (max-width: 820px) { .locbtn { right: 12px; bottom: calc(var(--loc-bottom, 110px)); } body.sheet-dragging .locbtn { transition: none; } }
body.nav-on .locbtn, .locbtn[hidden] { display: none; }
/* Desktop: a map control right under the zoom buttons, where people look for it. */
.locbtn.ctl { position: static; width: 44px; height: 44px; border-radius: 10px; border: 2px solid rgba(0,0,0,.2); background-clip: padding-box; box-shadow: none; }
.locbtn.ctl:hover { background: #f1f5f9; }
.meacc { fill: #1a73e8; fill-opacity: .12; stroke: #1a73e8; stroke-opacity: .4; }
.me { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25); }

/* ---------- navigation HUD ---------- */
.navhud { position: absolute; left: 12px; right: 412px; bottom: 16px; z-index: 950; background: #0c1a2b; color: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 8px; }
.navnext { display: flex; gap: 12px; align-items: center; }
.navnext b { font-size: 24px; font-variant-numeric: tabular-nums; }
.arrow { width: 48px; height: 48px; border-radius: 12px; background: #1f3350; display: grid; place-items: center; font-size: 28px; }
.navhazard { background: var(--blocked); border-radius: 10px; padding: 8px 10px; font-weight: 600; }
.navhazard.caution { background: var(--caution); color: #111; } .navhazard.risky { background: var(--risky); }
.navrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.navrow span { color: #c9d6e4; }
.navrow button.small { margin-left: auto; background: #1f3350; border-color: #2b4466; color: #fff; }
.navrow button.small ~ button.small { margin-left: 0; }
.navrow button.small.danger { background: var(--blocked); border-color: var(--blocked); }

/* ---------- dashboard / feed ---------- */
.dash, .feedv { overflow-y: auto; background: var(--bg); }
.dwrap { max-width: 1240px; margin: 0 auto; padding-block: 18px 40px; padding-inline: 16px; display: flex; flex-direction: column; gap: 16px; }
.dhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--line); }
.tile.blocked { border-top-color: var(--blocked); } .tile.risky { border-top-color: var(--risky); } .tile.caution { border-top-color: var(--caution); } .tile.ok { border-top-color: var(--cleared); } .tile.info { border-top-color: var(--series-total); }
.tile .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { color: var(--mut); font-size: 12px; }
.tile .d { font-size: 12px; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panelx { border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.chart { position: relative; width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .ax { fill: var(--mut); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .tip { position: absolute; pointer-events: none; background: var(--top); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); font-variant-numeric: tabular-nums; }
.chart .lg { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; font-size: 12px; color: var(--mut); position: absolute; top: -4px; right: 0; left: 40px; }
.chart .lg i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.tablewrap { overflow-x: auto; max-height: 380px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--mut); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--bg); }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
td .mini { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--blocked); vertical-align: middle; margin-left: 6px; }
td .mini.tot { background: var(--series-total); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--card); }
.bars { display: flex; flex-direction: column; gap: 6px; }
.brow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 13px; }
.brow .track { grid-column: 1 / -1; height: 8px; background: var(--card); border-radius: 0 4px 4px 0; }
.brow .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-total); }
.brow .n { font-variant-numeric: tabular-nums; color: var(--mut); }
.brow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedlist { display: flex; flex-direction: column; }
.fitem { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.fitem .when { color: var(--mut); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 48px; }
.fitem .body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fitem .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--mut); }
.fitem img { max-width: 260px; border-radius: 8px; }

@media (max-width: 980px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  header#top { gap: 8px; padding-inline: 8px; }
  .brand div { display: none; }
  .views button { padding: 6px 8px; }
  .vehicles button { padding: 5px 7px; }
  #map { inset: 0; }
  .panel { top: auto; left: 0; width: 100%; height: 52vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,.18); transition: height .2s; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .panel.collapsed { height: 92px; }
  .panel.collapsed .tab, .panel.collapsed .foot { display: none; }
  .panel { transition: height .28s cubic-bezier(.2,.8,.2,1); will-change: height; }
  .panel.dragging { transition: none; }
  .sheethead { touch-action: none; flex: none; cursor: grab; user-select: none; -webkit-user-select: none; }
  .grab { display: block; width: 100%; height: 30px; background: none; border: 0; position: relative; cursor: grab; }
  .grab::after { content: ""; position: absolute; left: 50%; top: 12px; width: 48px; height: 5px; margin-left: -24px; border-radius: 3px; background: var(--mut); opacity: .7; transition: opacity .15s; }
  .grab:active::after, .panel.dragging .grab::after { opacity: 1; }
  .panel[data-snap="peek"] .tabs button.on { border-color: transparent; }
  .tab { overscroll-behavior: contain; }
  .layers:not([open]) { padding: 6px 10px; }
  .navhud { right: 12px; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }

.inwrap { position: relative; flex: 1; min-width: 0; }
input.loc { width: 100%; font: inherit; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 40px; }
input.loc.set { border-color: var(--acc); }
input.loc.bad { border-color: var(--blocked); }
.pick.armed, button.small.armed { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(11,99,206,.25); }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-height: 260px; overflow-y: auto; }
.sugg button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.sugg button:hover, .sugg button:focus-visible { background: var(--card); }
.sugg .s { color: var(--mut); font-size: 12px; }

.minirow { display: flex; gap: 8px; margin: -2px 0 10px 32px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 13px; min-height: 38px; }
.chip.armed { border-color: var(--acc); background: var(--acc); color: var(--acc-fg); }
.okmark { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #16a34a; font-weight: 700; pointer-events: none; }
input.loc { padding-right: 28px; font-size: 16px; } /* 16px stops iOS zoom-on-focus */
.primary { min-height: 48px; font-size: 16px; }
/* ---- navigation mode: full-screen map, big HUD ---- */
body.nav-on .panel, body.nav-on .mapctl, body.nav-on .alertbar { display: none !important; }
body.nav-on #map { right: 0; }
body.nav-on .navhud { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.navhud .navnext b { font-size: 30px; }
.navhud #navStreet { font-size: 16px; }
.navhazard { font-size: 16px; }
.navrow button.small { min-height: 44px; min-width: 44px; font-size: 14px; }
@media (max-width: 820px) {
  .minirow { margin-left: 0; }
  .chip { flex: 1; text-align: center; }
  .navhud { padding: 14px; }
}

.vehsel { display: none; }
.mobonly { display: none; }
.routebar { position: absolute; left: 12px; right: 12px; bottom: calc(104px + env(safe-area-inset-bottom, 0px)); z-index: 940; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.routebar > div { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.routebar b { font-size: 18px; }
.routebar .primary { width: auto; margin: 0; padding: 10px 16px; }
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
.navstat { display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.navbtns { display: flex; gap: 6px; }
.navrow button.small, .navrow button.small ~ button.small { margin-left: 0; }
body.nav-on .navhud { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
body.nav-on .routebar { display: none !important; }
@media (min-width: 821px) { .routebar { display: none !important; } }
@media (max-width: 820px) {
  .vehicles { display: none; }
  .vehsel { display: block; margin-left: auto; background: #13253a; color: #eef3f8; border: 1px solid #2b3d52; border-radius: 8px; padding: 6px 4px; font: inherit; font-size: 14px; max-width: 165px; }
  .foot { display: none; }
  .mobonly { display: block; margin: 8px 0 0; }
}
.routebar .chip { flex: none; width: 44px; padding: 8px 0; }
@media (max-width: 820px) {
  .brand .logo { display: none; }
  header#top { gap: 6px; }
  .views button { padding: 6px 7px; font-size: 12px; }
  .vehsel { max-width: 100px; font-size: 13px; }
  button#lang { padding: 5px 7px; font-size: 12px; flex: none; }
  .leaflet-control-attribution { font-size: 9px; }
}

.gmaps { display: flex; gap: 8px; margin-top: 8px; }
.gmaps a { flex: 1; text-align: center; text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 8px; padding: 10px; font-weight: 600; font-size: 14px; }
.routebar .gm { flex: none; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 13px; color: var(--fg); background: var(--card); }

.reportbtn { flex: none; border: 0; background: #d62828; color: #fff; font-weight: 700; border-radius: 10px; padding: 7px 12px; font-size: 13px; white-space: nowrap; }
.reportbtn:hover { background: #b51f1f; }
.rephead { margin: 0 0 4px; font-size: 16px; }
.repphoto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.repphoto label.chip { cursor: pointer; display: inline-flex; align-items: center; }
.repphoto img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.repstep { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; font-weight: 600; }
.repstep b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--acc); color: var(--acc-fg); font-size: 12px; }
.depths { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.depths button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 9px 2px; font-size: 13px; }
.depths button.on { background: var(--acc); color: var(--acc-fg); border-color: var(--acc); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2000; background: #0c1a2b; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.35); font-weight: 600; max-width: calc(100vw - 32px); }
@media (max-width: 820px) {
  .reportbtn { padding: 6px 8px; font-size: 12px; }
  .reportbtn span { display: none; }
  .depths { grid-template-columns: repeat(5, 1fr); }
}
.leaflet-bottom, .leaflet-top { z-index: 850; } /* below the bottom sheet / HUD */
@media (max-width: 820px) {
  .vehsel { max-width: 86px; padding: 6px 2px; }
  .views button { padding: 6px 6px; }
  header#top { padding-inline: 6px; gap: 5px; }
}
@media (max-width: 380px) { .views button { font-size: 11px; padding: 6px 4px; } }

a.primary { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }
a.gnav { background: #1a73e8; }
.secondary { width: 100%; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 11px; font-weight: 600; margin-top: 8px; min-height: 44px; }
.routebar a.gm { flex: none; width: auto; margin: 0; padding: 10px 14px; background: #1a73e8; color: #fff; font-weight: 700; border: 0; }
.routebar #rbGo { flex: none; width: auto; padding: 8px 12px; }

/* BMA sensors */
.sensw { text-align: center; }
.sens { display: inline-block; white-space: nowrap; font: 700 11px/18px system-ui, sans-serif; color: #fff; text-align: center; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); min-width: 30px; padding: 0 3px; }
.sens small { font-size: 9px; font-weight: 600; opacity: .9; }
.sens.deep { background: var(--deep); } .sens.blocked { background: var(--blocked); } .sens.risky { background: var(--risky); } .sens.caution { background: var(--caution); color: #111; }
.minimap { height: 340px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.dsec { font-size: 17px; margin: 22px 0 10px; }
.lg .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; border: 1px solid #fff; }
.lg .dot.road { background: var(--risky); border-radius: 3px; } .lg .dot.canal { background: #3b82f6; } .lg .dot.rain { background: #0ea5e9; }
.lg > span { margin-right: 12px; }
/* Live summary at the bottom of the route panel (server-rendered, also what search engines read). */
.seo-summary { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(127,127,127,.25); font-size: 13px; }
.seo-summary h1 { font-size: 15px; margin: 0 0 4px; }
.seo-summary h2 { font-size: 13px; margin: 10px 0 4px; }
.seo-summary p { margin: 4px 0; opacity: .85; }
.seo-summary ul { margin: 0; padding-left: 18px; }
.seo-summary li { margin: 2px 0; }
.dhead h2.vt { font-size: 22px; margin: 0; }
/* Marker boxes are bigger than what they show (a 60x20 box around a narrow depth badge, a 60x60 box around a
   landscape photo). Only the visible part may take taps, so dots right next to them stay clickable. */
.leaflet-marker-icon.sensw, .leaflet-marker-icon.thumbwrap { pointer-events: none !important; }
.sensw .sens, .thumbwrap img.thumb { pointer-events: auto; cursor: pointer; }
.repphoto .repnote { flex-basis: 100%; }
