:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface2: #eef1f6; --text: #111827; --muted: #5b6475;
  --line: #dfe4ec; --accent: #0b5cd6; --shadow: 0 10px 30px rgba(15, 23, 42, .16);
  --accident: #e11d48; --closure: #a21caf; --incident: #f97316; --lanes: #ca8a04; --roadworks: #0284c7;
  --queue: #ef4444; --weather: #0891b2; --led: #ffb000; --mway: #0067b1; --aroad: #00703c; --ayellow: #ffd200;
  --panelw: 420px;
}
:root[data-theme="dark"] {
  --bg: #070b14; --surface: #0f1624; --surface2: #172033; --text: #e8edf6; --muted: #93a0b8;
  --line: #24304a; --accent: #5b9dff; --shadow: 0 10px 34px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b14; --surface: #0f1624; --surface2: #172033; --text: #e8edf6; --muted: #93a0b8;
    --line: #24304a; --accent: #5b9dff; --shadow: 0 10px 34px rgba(0, 0, 0, .55);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; background: var(--bg); }

/* ---------- top bar ---------- */
.topbar { position: fixed; z-index: 1000; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 700; letter-spacing: -.01em; }
.brand img { border-radius: 8px; }
.pill { display: flex; align-items: center; gap: 7px; border: 0; padding: 8px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13px; color: var(--muted); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.pill.ok .dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.pill.warn .dot { background: #f59e0b; }
.pill.bad .dot { background: #ef4444; }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; }
.icon-btn svg, .mini svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg circle:first-child { fill: currentColor; }
.icon-btn.on { color: var(--accent); }

/* ---------- panel ---------- */
.panel { position: fixed; z-index: 1001; left: env(safe-area-inset-left); right: env(safe-area-inset-right); bottom: 0; height: calc(var(--vh, 1vh) * 52); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow); transition: height .25s ease;
  padding-bottom: env(safe-area-inset-bottom); }
.panel[data-snap="low"] { height: 132px; }
.panel[data-snap="high"] { height: calc(var(--vh, 1vh) * 100 - 70px - env(safe-area-inset-top)); }
.handle { padding: 9px 0 3px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.handle span { width: 42px; height: 5px; border-radius: 3px; background: var(--line); }
.tabs { display: flex; gap: 4px; padding: 4px 12px 8px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs button b { font-weight: 600; font-size: 11px; background: var(--surface2); padding: 1px 6px; border-radius: 999px; margin-left: 3px; }
.tabs button.on { background: var(--surface2); color: var(--text); }
.tabbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px 24px; overscroll-behavior: contain; }
@media (min-width: 900px) {
  .panel, .panel[data-snap] { top: 70px; left: 12px; right: auto; bottom: 12px; width: var(--panelw); height: auto; border-radius: 18px; }
  .handle { display: none; }
  .topbar { left: 12px; }
}

.toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.toolbar input, .toolbar select, .planner input, .planner select {
  border: 1px solid var(--line); background: var(--surface2); border-radius: 11px; padding: 9px 11px; min-width: 0; outline: none; }
.toolbar input { flex: 1; }
.toolbar input:focus, .planner input:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px 5px 8px;
  font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chip.on { color: var(--text); background: var(--surface2); border-color: transparent; font-weight: 600; }
.chip:not(.on) i { opacity: .35; }
.chip small { font-size: 11px; opacity: .8; }

/* ---------- cards ---------- */
.card { position: relative; display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: 14px; padding: 10px 12px 10px 16px; margin-bottom: 8px; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--muted)); }
.card:hover { border-color: var(--c); }
.card .row1 { display: flex; align-items: center; gap: 8px; }
.card .ttl { font-weight: 650; flex: 1; min-width: 0; }
.card .loc { color: var(--text); font-size: 14px; margin-top: 3px; }
.card .det { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.card.future { opacity: .78; }
.badge-new { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: #fff; background: var(--accident); padding: 2px 6px; border-radius: 5px; }
.road { display: inline-block; font-weight: 700; font-size: 12.5px; line-height: 1; padding: 4px 6px 3px; border-radius: 4px; white-space: nowrap;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.road.m { background: var(--mway); color: #fff; }
.road.a { background: var(--aroad); color: var(--ayellow); }
.road.x { background: #fff; color: #111; border-color: #111; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.more { width: 100%; border: 1px dashed var(--line); background: transparent; border-radius: 12px; padding: 10px; color: var(--accent); font-weight: 600; }
.sect { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 2px 6px; font-weight: 600; }

/* ---------- matrix sign ---------- */
.vms { background: #050505; border-radius: 6px; padding: 8px 10px; border: 3px solid #2b2b2b;
  box-shadow: inset 0 0 0 1px #000, 0 2px 6px rgba(0, 0, 0, .35); font-family: "DotGothic16", ui-monospace, monospace;
  color: var(--led); text-align: center; letter-spacing: .08em; text-shadow: 0 0 6px rgba(255, 176, 0, .55);
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1.2px); background-size: 4px 4px; }
.vms .l { font-size: 17px; line-height: 1.25; white-space: pre-wrap; word-break: break-word; }
.vms.sm .l { font-size: 14px; }
.vms .picts { display: flex; justify-content: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.roundel { width: 40px; height: 40px; border-radius: 50%; border: 5px solid #e11d1d; background: #050505; color: #fff;
  display: grid; place-items: center; font: 700 15px Inter, sans-serif; text-shadow: 0 0 5px rgba(255, 255, 255, .6); letter-spacing: 0; }
.pict { font: 600 11px Inter, sans-serif; color: #ffd27a; border: 1px solid #5a4200; padding: 3px 6px; border-radius: 4px; letter-spacing: 0; text-shadow: none; }
.signcard { padding: 10px 12px; }
.signcard .vms { margin-top: 8px; }

/* ---------- planner ---------- */
.planner { display: grid; gap: 8px; margin-bottom: 10px; }
.pfield { position: relative; display: flex; align-items: center; gap: 8px; }
.pfield input { flex: 1; }
.pin { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }
.pin.a { background: #16a34a; } .pin.b { background: #dc2626; }
.mini { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface2); display: grid; place-items: center; flex: none; }
.mini svg circle { fill: currentColor; }
.prow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prow label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.prow input[type=datetime-local] { flex: 1; min-width: 180px; }
.go { margin-left: auto; border: 0; background: var(--accent); color: #fff; font-weight: 650; padding: 10px 16px; border-radius: 11px; }
.go:disabled { opacity: .6; }
.sugg { position: absolute; z-index: 5; left: 32px; right: 46px; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.sugg:empty { display: none; }
.sugg button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.sugg button:last-child { border-bottom: 0; }
.sugg button:hover, .sugg button.hi { background: var(--surface2); }
.sugg small { display: block; color: var(--muted); font-size: 12px; }
.routes { display: grid; gap: 8px; margin-bottom: 8px; }
.rt { border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; text-align: left; }
.rt.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rt .top { display: flex; align-items: baseline; gap: 10px; }
.rt .dur { font-size: 20px; font-weight: 700; }
.rt .dist { color: var(--muted); }
.rt .tag { margin-left: auto; font-size: 11px; font-weight: 700; color: #16a34a; text-transform: uppercase; letter-spacing: .05em; }
.rt .via { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.rt .sum { margin-top: 6px; font-size: 13px; color: var(--muted); }
.rt .sum b { color: var(--text); }
.km { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.ok-route { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: color-mix(in srgb, #16a34a 12%, var(--surface)); color: var(--text); }

/* ---------- help ---------- */
.help h3 { margin: 16px 0 6px; font-size: 15px; }
.help p, .help li { color: var(--muted); font-size: 14px; }
.help ul { padding-left: 18px; margin: 6px 0; }
.help .legend { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 14px; }
.help .legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.feeds { display: grid; gap: 6px; font-size: 13px; }
.feeds div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface2); }
.feeds .err { color: #ef4444; }
.notice { padding: 12px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--line)); font-size: 14px; margin-bottom: 10px; }
.notice a { color: var(--accent); }

/* ---------- map bits ---------- */
.leaflet-container { font: inherit; background: var(--bg); }
.leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; max-width: 290px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop h4 { margin: 6px 0 2px; font-size: 15px; }
.pop .loc { font-size: 13.5px; margin-top: 4px; }
.pop .det { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pop .meta { color: var(--muted); font-size: 12px; margin-top: 8px; display: grid; gap: 2px; }
.pop .vms { margin-top: 8px; }
.mk { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); font-family: Inter, sans-serif; }
.mk svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mk.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .55); } 70% { box-shadow: 0 0 0 12px rgba(225, 29, 72, 0); } 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); } }
.signmk { background: #050505; color: var(--led); font: 10px/1 "DotGothic16", monospace; padding: 3px 4px; border: 2px solid #333; border-radius: 3px;
  white-space: nowrap; text-shadow: 0 0 4px rgba(255, 176, 0, .7); box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transform: translate(-50%, -50%); display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }
.toast { position: fixed; z-index: 2000; left: 50%; top: calc(env(safe-area-inset-top) + 64px); transform: translateX(-50%);
  background: var(--text); color: var(--surface); padding: 9px 14px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
@media (max-width: 420px) { .brand span { display: none; } .brand { padding: 6px; } }
.chips.regions { width: 100%; margin-bottom: 2px; }
.pop a { color: var(--accent); }
.help .sect { margin-top: 10px; }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }

/* near me */
.nearbar { margin-bottom: 10px; }
.nearbar:empty { display: none; }
.nearbtn { width: 100%; border: 0; border-radius: 12px; padding: 11px 12px; background: #2563eb; color: #fff; font-weight: 650; }
.nearbar .hint { display: block; text-align: center; color: var(--muted); font-size: 12px; margin-top: 5px; }
.nb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, #2563eb 12%, var(--surface)); border: 1px solid color-mix(in srgb, #2563eb 35%, var(--line)); font-size: 14px; }
.nb-top .sev { color: var(--accident); }
.nb-dot { width: 10px; height: 10px; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .25); flex: none; }
.nb-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.nb-ctl select { border: 1px solid var(--line); background: var(--surface2); border-radius: 9px; padding: 5px 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 13px; color: var(--muted); }
.seg button.on { background: #2563eb; color: #fff; font-weight: 600; }
.card.near { border-color: color-mix(in srgb, #2563eb 45%, var(--line)); background: color-mix(in srgb, #2563eb 5%, var(--surface)); }
.dpill { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface2); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.dpill.in { color: #fff; background: #2563eb; }
.sect.near-h { color: #2563eb; }
.empty.small { padding: 10px; font-size: 14px; }
.mk.near { width: 32px; height: 32px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .55), 0 2px 6px rgba(0, 0, 0, .4); }
.mk.near svg { width: 18px; height: 18px; }

/* filter dropdown */
.fdrop { position: relative; width: 100%; }
.fbtn { width: 100%; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface2); border-radius: 11px; padding: 9px 11px; text-align: left; }
.fbtn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; flex: none; }
.fbtn span { font-weight: 600; }
.fbtn em { font-style: normal; color: var(--muted); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbtn .caret { color: var(--muted); font-weight: 400; transition: transform .15s; }
.fdrop.open .caret { transform: rotate(180deg); }
.fmenu { display: none; position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px 8px 8px; max-height: 60vh; overflow-y: auto; }
.fdrop.open .fmenu { display: block; }
.fgroup { padding: 4px 0; border-bottom: 1px solid var(--line); }
.fgh { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 6px 2px; }
.fitem { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.fitem:hover { background: var(--surface2); }
.fitem input { width: 18px; height: 18px; accent-color: #2563eb; margin: 0; }
.fitem i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.fitem span { flex: 1; }
.fitem small { color: var(--muted); font-variant-numeric: tabular-nums; }
.factions { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; }
.factions button { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.factions button[data-close] { background: var(--accent); color: #fff; padding: 6px 16px; }

/* delays */
.drow { margin-top: 6px; }
.delay { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, #f59e0b 18%, var(--surface)); color: color-mix(in srgb, #b45309 85%, var(--text)); }
.delay.big { background: color-mix(in srgb, #e11d48 16%, var(--surface)); color: color-mix(in srgb, #be123c 85%, var(--text)); }
.delay.estimate { font-weight: 600; opacity: .9; }
.dnote { font-size: 12px; color: var(--muted); margin-top: 3px; }
.rdelay { font-weight: 700; font-size: 14px; color: #b45309; }
.rdelay.big { color: #e11d48; }
.delaysum { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--line)); font-size: 14px; margin-bottom: 8px; }
.delaysum small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.rt .dur, .rt .rdelay { white-space: nowrap; }

/* check an area */
.areabox { position: relative; display: flex; align-items: center; margin-bottom: 8px; }
.areabox > svg { position: absolute; left: 11px; width: 18px; height: 18px; stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; pointer-events: none; }
.areabox input { flex: 1; border: 1px solid var(--line); background: var(--surface2); border-radius: 11px; padding: 10px 11px 10px 36px; min-width: 0; outline: none; }
.areabox input:focus { border-color: #7c3aed; }
.areabox .sugg { left: 0; right: 0; }
.sugg-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 12px 2px; }
.nb-top.area { background: color-mix(in srgb, #7c3aed 11%, var(--surface)); border-color: color-mix(in srgb, #7c3aed 35%, var(--line)); }
.nb-top.area .nb-dot { background: #7c3aed; box-shadow: 0 0 0 4px rgba(124, 58, 237, .25); }
.nb-txt { flex: 1; min-width: 0; }
.nb-txt small { color: var(--muted); font-size: 12px; }
.nb-x { border: 0; background: transparent; color: var(--muted); font-size: 16px; padding: 0 4px; line-height: 1; }
.area-pin { transform: translate(-50%, -100%); display: inline-block; }
.area-pin span { display: inline-block; background: #7c3aed; color: #fff; font-weight: 700; font-size: 12px; padding: 4px 8px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); white-space: nowrap; position: relative; }
.area-pin span::after { content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #7c3aed; border-bottom: 0; }

/* my route + google maps */
.routebtn { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-weight: 650; margin-bottom: 8px; text-align: left; }
.routebtn:hover { border-color: var(--accent); }
.gbox { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--surface2); margin-bottom: 10px; }
.gh { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 8px; }
.gpin { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); flex: none;
  background: conic-gradient(#ea4335 0 25%, #fbbc04 0 50%, #34a853 0 75%, #4285f4 0); }
.grow { display: flex; gap: 6px; align-items: center; }
.grow input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 9px 11px; outline: none; }
.grow input:focus { border-color: #4285f4; }
.grow .go { margin-left: 0; padding: 9px 14px; }
.mini svg rect, .mini svg path { fill: none; }
.gsub { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.gsub a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 4px 0 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.navrow { display: flex; gap: 8px; }
.navnote { font-size: 12px; color: var(--muted); margin: -2px 2px 10px; }
.gnav.waze { border-color: #33ccff; background: color-mix(in srgb, #33ccff 10%, var(--surface)); }
.gnav.waze .arr { color: #0aa6d6; }
.wz { width: 18px; height: 18px; border-radius: 50%; background: #33ccff; color: #fff; font-weight: 800; font-size: 11px; display: grid; place-items: center; flex: none; }
.gnav { flex: 1; width: 100%; display: flex; align-items: center; gap: 10px; border: 1.5px solid #4285f4; background: color-mix(in srgb, #4285f4 8%, var(--surface));
  color: var(--text); border-radius: 12px; padding: 10px 12px; font-weight: 650; margin-bottom: 8px; }
.gnav .arr { margin-left: auto; color: #4285f4; }

.camlink { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface2);
  color: var(--text) !important; text-decoration: none; font-weight: 600; font-size: 13px; }
.camlink small { margin-left: auto; color: var(--accent); font-weight: 600; }
.camlink:hover { outline: 1px solid var(--accent); }

/* roadworks cones */
.cone { width: 100%; height: 100%; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .45)); }
.cone svg { width: 100%; height: 100%; display: block; }
.cone.long { opacity: .6; }
.cone.future { opacity: .45; filter: grayscale(.4) drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.cone.near { filter: drop-shadow(0 0 3px rgba(37, 99, 235, .95)) drop-shadow(0 1px 1.5px rgba(0, 0, 0, .45)); }
.pop .where { color: var(--muted); font-weight: 600; font-size: 12px; }
/* keep Leaflet zoom buttons clear of the top-right buttons */
.leaflet-top.leaflet-right { top: calc(env(safe-area-inset-top) + 60px); }
.leaflet-top.leaflet-right .leaflet-control-zoom { margin-right: 12px; border: 0; box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; width: 40px !important; height: 40px !important; line-height: 40px !important; font-size: 20px !important; }
@media (max-width: 899px) { .leaflet-top.leaflet-right .leaflet-control-zoom { display: none; } }

/* ---------- iPhone / iPad fit ---------- */
html, body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
body { -webkit-tap-highlight-color: transparent; }
/* iOS zooms the whole page when a text box under 16px is tapped - which pushes the app off the screen */
input, select, textarea { font-size: 16px !important; }
.topbar { left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); min-width: 0; }
.brand, .pill { min-width: 0; }
.pill { overflow: hidden; }
.pill #statusText { overflow: hidden; text-overflow: ellipsis; }
.top-actions { flex: none; }
.tabbody { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.card, .rt, .gbox, .nb-top, .fbtn, .vms { max-width: 100%; }
.card .ttl, .card .loc, .card .det { overflow-wrap: anywhere; }
.toolbar select { max-width: 45%; }
.leaflet-popup-content { max-width: min(290px, calc(100vw - 60px)) !important; }
.leaflet-popup-content .vms .l { font-size: 15px; }
.sugg { max-width: calc(100vw - 30px); }
.fmenu { max-height: calc(var(--vh, 1vh) * 55); }
@media (min-width: 900px) {
  .panel, .panel[data-snap] { left: calc(12px + env(safe-area-inset-left)); top: calc(70px + env(safe-area-inset-top)); bottom: calc(12px + env(safe-area-inset-bottom)); height: auto; max-height: calc(var(--vh, 1vh) * 100 - 82px); }
}
@media (max-width: 899px) {
  .panel { padding-bottom: env(safe-area-inset-bottom); }
  .panel[data-snap="low"] { height: calc(132px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .icon-btn { width: 36px; height: 36px; }
  .pill { padding: 8px 10px; font-size: 12px; }
  .tabs button { font-size: 13px; padding: 8px 2px; }
}

/* ---------- alerts ---------- */
#bellBtn { position: relative; }
.bell-n { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accident); color: #fff;
  font: 700 10px/16px Inter, sans-serif; padding: 0 4px; text-align: center; }
.alerts-stack { position: fixed; z-index: 1500; top: calc(env(safe-area-inset-top) + 60px); left: 50%; transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px)); display: grid; gap: 8px; pointer-events: none; }
.alert-card { pointer-events: auto; position: relative; text-align: left; border: 0; border-left: 6px solid var(--c); border-radius: 14px; background: var(--surface);
  color: var(--text); box-shadow: var(--shadow); padding: 10px 34px 10px 12px; display: grid; gap: 2px; animation: drop .25s ease-out; }
.alert-card b { font-size: 14px; }
.alert-card span { font-size: 13px; color: var(--muted); }
.alert-card .x { position: absolute; top: 8px; right: 10px; font-style: normal; color: var(--muted); }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal { position: fixed; inset: 0; z-index: 2500; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 12px; }
.sheet { width: min(460px, 100%); max-height: calc(var(--vh, 1vh) * 100 - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); background: var(--surface);
  border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); font-size: 16px; }
.sheet-b { overflow-y: auto; padding: 4px 12px 16px; -webkit-overflow-scrolling: touch; }
.sheet-b .fitem { align-items: flex-start; }
.sheet-b .fitem input { margin-top: 2px; }
small.sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 400; }
small.sub a, .sheet-b a { color: var(--accent); }
.al-btn { border: 0; background: var(--accent); color: #fff; font-weight: 600; padding: 8px 12px; border-radius: 10px; margin: 6px 6px 4px 0; }
.al-btn.ghost { background: var(--surface2); color: var(--text); }
.al-row { display: flex; flex-wrap: wrap; }
.ok-line { font-size: 13.5px; padding: 6px 0 2px; }
.al-item { display: grid; gap: 2px; width: 100%; text-align: left; border: 0; border-left: 4px solid var(--c); background: var(--surface2); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.al-item b { font-size: 13.5px; } .al-item span { font-size: 12px; color: var(--muted); }
.watchbtn { width: 100%; border: 1.5px dashed var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-weight: 600; margin: 0 0 8px; text-align: left; }
.watchbtn.on { border-style: solid; border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }
.help code { font-size: 12px; background: var(--surface2); padding: 1px 5px; border-radius: 5px; }

.toast { z-index: 3000; }
.al-status { font-size: 13px; margin-top: 6px; }
.al-status:empty { display: none; }
.al-status.ok { color: #15803d; } .al-status.bad { color: #dc2626; }
.al-btn:disabled { opacity: .6; }
