/* Mobile-first. Base styles target phones; the @media (min-width: 900px) block adapts for desktop. */
:root {
  --bg: #f5f3ec; --bg-2: #ebe8de; --card: #fff; --ink: #15201a; --ink-2: #4c5750; --line: #dbd7ca;
  --lane: #0f7b45; --lane-ink: #fff; --lane-soft: #dcefe3;
  --crew: #e8501a; --crew-ink: #fff; --crew-soft: #fde4d8;
  --cam: #3d6aa8; --pending: #8a8f8b;
  --top: 52px; --tabs: 60px; --r: 14px;
  --map-bg: #ece8dc; --map-water: #b5d3ec; --map-shore: #8fb7dc; --map-l: #ffffff; --map-c: #ffffff; --map-m: #fff3d1; --map-a: #f6d488; --map-x: #eca763; --map-rail: #aaa596; --map-river: #8fb7dc; --map-bike: #2f9c63; --map-trail: #5fb383; --map-threat: #08884a; --map-label: #3a433d; --map-halo: #ece8dc;
  --shadow: 0 2px 12px rgba(20,30,25,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1310; --bg-2: #151c18; --card: #1a231e; --ink: #e8eee9; --ink-2: #a6b1aa; --line: #2b3630;
    --lane: #34b872; --lane-ink: #04140b; --lane-soft: #163323; --crew: #ff7a45; --crew-ink: #1d0a02; --crew-soft: #3a1d10;
    --cam: #7ea6e0; --pending: #8e9691; --shadow: 0 2px 14px rgba(0,0,0,.45);
    --map-bg: #121815; --map-water: #0c2134; --map-shore: #1e4669; --map-l: #29322d; --map-c: #36413b; --map-m: #46524b; --map-a: #5f6c64; --map-x: #8b7650; --map-rail: #3b413d; --map-river: #1e4669; --map-bike: #2b9a5d; --map-trail: #23683f; --map-threat: #3fe28b; --map-label: #c4cec7; --map-halo: #121815;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1310; --bg-2: #151c18; --card: #1a231e; --ink: #e8eee9; --ink-2: #a6b1aa; --line: #2b3630;
  --lane: #34b872; --lane-ink: #04140b; --lane-soft: #163323; --crew: #ff7a45; --crew-ink: #1d0a02; --crew-soft: #3a1d10;
  --cam: #7ea6e0; --pending: #8e9691; --shadow: 0 2px 14px rgba(0,0,0,.45);
  --map-bg: #121815; --map-water: #0c2134; --map-shore: #1e4669; --map-l: #29322d; --map-c: #36413b; --map-m: #46524b; --map-a: #5f6c64; --map-x: #8b7650; --map-rail: #3b413d; --map-river: #1e4669; --map-bike: #2b9a5d; --map-trail: #23683f; --map-threat: #3fe28b; --map-label: #c4cec7; --map-halo: #121815;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: grid; grid-template-rows: var(--top) 1fr calc(var(--tabs) + env(safe-area-inset-bottom));
  height: 100dvh; overflow: hidden; -webkit-tap-highlight-color: transparent;
}
a { color: var(--lane); }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; margin: 0; }
p { margin: 0 0 .7em; }
.muted { color: var(--ink-2); }
.small { font-size: .87rem; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 4px; opacity: .75; }
:focus-visible { outline: 3px solid var(--crew); outline-offset: 2px; }
.top svg, .tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Demo mode warning */
.demo-banner { position: fixed; left: 0; right: 0; top: 0; z-index: 50; height: 28px; display: flex; align-items: center; justify-content: center; gap: 8px; background: repeating-linear-gradient(45deg, #ffd43b 0 14px, #fab005 14px 28px); color: #1a1a1a; font-weight: 800; font-size: .8rem; }
.demo-banner a { color: #1a1a1a; }
body.is-demo { padding-top: 28px; height: calc(100dvh - 28px); }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.02rem; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem; padding: 8px 10px; border-radius: 10px; cursor: pointer; min-height: 40px; }
.icon-btn:active { background: var(--bg-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* Panels */
main { position: relative; overflow: hidden; overflow: clip; }
.panel { position: absolute; inset: 0; }
.panel[hidden] { display: none; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Bottom tabs */
.tabs { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-2); font-size: .74rem; font-weight: 700; position: relative; }
.tabs a[aria-selected="true"] { color: var(--lane); }
.tabs a[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--lane); }

/* Buttons & chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .87rem; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-lane { background: var(--lane); color: var(--lane-ink); }
.btn-crew { background: var(--crew); color: var(--crew-ink); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .87rem; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-sm { min-height: 32px; box-shadow: none; }
.pill { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill-verified { background: var(--crew); color: var(--crew-ink); }
.pill-upcoming { background: var(--lane-soft); color: var(--lane); }
.pill-pending { border: 1.5px dashed var(--pending); color: var(--ink-2); }
.pill-cleared { background: var(--bg-2); color: var(--ink-2); }
.pill-works { background: #ffc61a; color: #1a1a1a; }
.tag { font-weight: 700; text-decoration: none; }

/* Map panel */
#map-view { position: absolute; inset: 0; z-index: 1; }
.map-chips { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; z-index: 5; pointer-events: none; }
.map-chips .chip { pointer-events: auto; }
#map-view .vm-ctrl { top: 56px; }
#map-view .vm-attr { bottom: 72px; left: 6px; right: auto; }
.map-key { position: absolute; right: 8px; top: 56px; z-index: 4; display: grid; gap: 3px; font-size: .72rem; font-weight: 700; color: var(--ink-2); background: color-mix(in srgb, var(--card) 88%, transparent); padding: 5px 8px; border-radius: 8px; pointer-events: none; }
.map-key i { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: 2px; }
.map-key .k-t { background: var(--map-threat); height: 5px; }
.map-key .k-b { background: var(--map-bike); height: 2px; }
.map-key .k-w, .legend i.works { height: 6px; border-radius: 0; background: repeating-linear-gradient(90deg, #ffc61a 0 5px, #1a1a1a 5px 9px); }
.fab { position: absolute; right: 14px; bottom: 82px; z-index: 6; min-height: 52px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--crew); color: var(--crew-ink); font: inherit; font-weight: 800; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; height: 72%; background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.18); display: flex; flex-direction: column; transform: translateY(calc(100% - 68px)); transition: transform .25s ease; }
.sheet.open { transform: translateY(0); }
.sheet.open ~ .fab, .panel-map:has(.sheet.open) .fab { opacity: 0; pointer-events: none; }
.sheet-handle { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 16px 12px; background: none; border: 0; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; min-height: 68px; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 12px 16px; display: grid; gap: 10px; align-content: start; overscroll-behavior: contain; }
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; }
.sheet-body .card { background: var(--bg); }
.item { border-left: 5px solid var(--crew); }
.item.pending { border-left: 5px dashed var(--pending); }
.item.cleared { border-left-color: var(--pending); opacity: .8; }
.item.focused { outline: 3px solid var(--crew); outline-offset: 1px; }
.item.works { border-left: 6px solid; border-image: repeating-linear-gradient(180deg, #ffc61a 0 8px, #1a1a1a 8px 14px) 1; }
.item.works p { margin: 0; color: var(--ink-2); }
ul.plain { padding-left: 1.15em; display: grid; gap: 6px; margin: 0; }
.i-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.i-title { font-size: 1.05rem; font-weight: 800; margin-top: 4px; overflow-wrap: anywhere; }
.i-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .87rem; color: var(--ink-2); }
.i-meta b { color: var(--ink); }
.i-media { display: flex; gap: 6px; overflow-x: auto; }
.i-media a { flex: none; position: relative; }
.i-media img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; display: block; background: var(--bg-2); }
.i-media .play::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-shadow: 0 1px 6px #000; font-size: 1.3rem; }
.i-note { font-size: .87rem; background: var(--crew-soft); border-radius: 8px; padding: 6px 10px; }
.i-by { font-size: .8rem; color: var(--ink-2); }
.i-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 22px 16px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: var(--r); font-size: .95rem; }

/* Cameras */
.cam-big { width: 100%; border-radius: 10px; background: var(--bg-2); aspect-ratio: 4/3; object-fit: contain; }

/* Info */
.nowrap { white-space: nowrap; }
.disclaimer { margin: 0 0 16px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--bg-2); color: var(--ink-2); }
.arm { background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 16px 18px; }
.arm-num { display: block; color: inherit; text-decoration: none; font-size: clamp(1.9rem, 9vw, 2.6rem); font-weight: 900; letter-spacing: .01em; white-space: nowrap; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.arm p:last-child { margin: 0; }
.say { margin-top: 10px; border: 2px solid var(--ink); border-radius: var(--r); padding: 14px 18px; }
.say p:not(.eyebrow) { font-weight: 700; margin: 0 0 6px; }
.acc { display: grid; gap: 8px; }
.acc details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.acc summary { cursor: pointer; font-weight: 800; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; min-height: 48px; align-items: center; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "+"; color: var(--lane); font-size: 1.4rem; line-height: 1; }
.acc details[open] summary::after { content: "–"; }
.acc ul { margin: 0 0 14px; padding-left: 1.15em; display: grid; gap: 7px; font-size: .95rem; }
.res { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.res li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.res li:first-child { border-top: 0; }
.res li div { min-width: 0; }
.res strong { display: block; font-size: .95rem; }
.res span { display: block; font-size: .82rem; color: var(--ink-2); }
.res a { flex: none; font-weight: 800; text-decoration: none; font-size: .9rem; }
.res-group { font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 8px; }
h2 + .res-group { margin-top: 0; }
.chat-warn { margin: 8px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--crew-soft); }
.help-link { flex: none; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: .9rem; font-weight: 700; text-decoration: none; }
.timeline { list-style: none; padding: 0; margin: 0 0 10px; border-left: 3px solid var(--lane); }
.timeline li { padding: 0 0 14px 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 3px solid var(--lane); }
.timeline b { font-size: .85rem; color: var(--lane); }
.timeline p { margin: 2px 0 0; font-size: .95rem; }
.mod-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mod { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: .87rem; font-weight: 600; }
.mod img, .mod i { width: 26px; height: 26px; border-radius: 50%; background: var(--lane-soft); object-fit: cover; }
.foot { margin-top: 28px; }

/* Dialogs — bottom sheets on mobile */
.sheet-dialog { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; background: var(--card); color: var(--ink); overflow-y: auto; }
.sheet-dialog::backdrop { background: rgba(8,12,10,.55); }
.form { display: grid; gap: 12px; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.form label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.d-head { display: flex; justify-content: space-between; align-items: center; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lane); }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; resize: none; }
#pin-map { height: 180px; border-radius: 10px; border: 1.5px solid var(--line); }
.pin { display: grid; gap: 6px; }
.pin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Vector map (basemap.js) */
.vmap { position: absolute; inset: 0; overflow: hidden; background: var(--map-bg); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; }
.vmap:focus-visible { box-shadow: inset 0 0 0 3px var(--crew); }
.vmap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; fill: none; stroke: none; }
.vmap svg.moving { cursor: grabbing; }
.vm-roads path, .vm-water path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.vm-water .lake { fill: var(--map-water); stroke: none; }
.vm-water .island { fill: var(--map-bg); stroke: var(--map-shore); stroke-width: .8; }
.vm-water .shore { stroke: var(--map-shore); stroke-width: .8; }
/* Line widths (screen px) per zoom band: z0 = whole city … z4 = street level */
.vmap svg { --wl: 0; --wc: 0; --wm: .7; --wa: 1; --wx: 1.6; --wr: .6; --wbt: .6; --wb: .9; --wt: 2.6; }
.vmap svg.z1 { --wc: .6; --wm: 1.1; --wa: 1.5; --wx: 2.2; --wbt: .9; --wb: 1.2; --wt: 3.2; }
.vmap svg.z2 { --wl: .7; --wc: 1.3; --wm: 2; --wa: 2.6; --wx: 3.4; --wr: 1; --wbt: 1.2; --wb: 1.6; --wt: 4.2; }
.vmap svg.z3 { --wl: 2; --wc: 3; --wm: 4; --wa: 5; --wx: 6; --wr: 1.4; --wbt: 1.8; --wb: 2.2; --wt: 5.5; }
.vmap svg.z4 { --wl: 4.5; --wc: 6; --wm: 7.5; --wa: 9; --wx: 10; --wr: 2; --wbt: 2.6; --wb: 3; --wt: 7; }
.vmap svg.z0 .g-l, .vmap svg.z1 .g-l, .vmap svg.z0 .g-c { display: none; }
.g-l path { stroke: var(--map-l); stroke-width: var(--wl); }
.g-c path { stroke: var(--map-c); stroke-width: var(--wc); }
.g-m path { stroke: var(--map-m); stroke-width: var(--wm); }
.g-a path { stroke: var(--map-a); stroke-width: var(--wa); }
.g-x path { stroke: var(--map-x); stroke-width: var(--wx); }
.g-r path { stroke: var(--map-river); stroke-width: var(--wr); }
.g-rail path { stroke: var(--map-rail); stroke-width: var(--wr); stroke-dasharray: 4 3; }
.g-bt path { stroke: var(--map-trail); stroke-width: var(--wbt); stroke-dasharray: 3 3; }
.g-b path { stroke: var(--map-bike); stroke-width: var(--wb); }
.g-tg path { stroke: var(--map-threat); stroke-width: calc(var(--wt) * 2.8); opacity: .22; }
.g-t path { stroke: var(--map-threat); stroke-width: var(--wt); }
.vm-labels text { fill: var(--map-label); stroke: var(--map-halo); paint-order: stroke; stroke-linejoin: round; text-anchor: middle; dominant-baseline: central; font-family: system-ui, -apple-system, sans-serif; font-weight: 600; pointer-events: none; }
.vm-mk { cursor: pointer; }
.vm-line path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.vm-line .hit { stroke: transparent; stroke-width: 22px; stroke-linecap: round; pointer-events: stroke; }
.vm-works .casing { stroke: #1a1a1a; stroke-width: calc(var(--wt) * 1px + 7px); stroke-linecap: round; }
.vm-works .main { stroke: #ffc61a; stroke-width: calc(var(--wt) * 1px + 3px); stroke-dasharray: 9 7; stroke-linecap: butt; }
.vm-pop, .vm-tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; }
.vm-pop-box { pointer-events: auto; position: relative; transform: translate(-50%, calc(-100% - 12px)); background: var(--card); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: 10px 32px 10px 12px; width: max-content; min-width: 150px; max-width: 260px; font-size: .9rem; cursor: auto; }
.vm-pop-box::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: var(--card); transform: translateX(-50%) rotate(45deg); box-shadow: 1px 1px 0 var(--line); }
.vm-pop-x { position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; border: 0; background: none; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px; }
.vm-tip-box { transform: translate(-50%, calc(-100% - 10px)); background: var(--ink); color: var(--bg); padding: 4px 9px; border-radius: 8px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.vm-ctrl { position: absolute; left: 10px; top: 10px; z-index: 4; display: grid; gap: 6px; }
.vm-ctrl button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 700 20px/1 system-ui, sans-serif; box-shadow: var(--shadow); cursor: pointer; }
.vm-attr { position: absolute; right: 6px; bottom: 4px; z-index: 4; font-size: 10.5px; color: var(--ink-2); background: color-mix(in srgb, var(--card) 80%, transparent); padding: 1px 6px; border-radius: 6px; text-decoration: none; }
.pop-t { font-weight: 800; }
.pop-img { width: 220px; max-width: 60vw; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; display: block; margin: 6px 0; background: var(--bg-2); }
#pin-map { position: relative; }
#pin-map .vm-ctrl button { width: 34px; height: 34px; font-size: 18px; }

/* Mobile defaults for elements that only matter on desktop */
.side-tools, .legend { display: none; }
.r-cols, .r-fields, .r-side { display: grid; gap: 12px; align-content: start; }

/* ── Tablet ── */
@media (min-width: 600px) {
  .sheet-dialog { margin: auto; width: min(520px, calc(100% - 32px)); border-radius: 20px; }
}

/* ══════════════════ Desktop ══════════════════ */
@media (min-width: 900px) {
  :root { --top: 60px; }
  body { grid-template-rows: var(--top) 1fr; }

  /* Header: brand · tabs · share */
  .top { padding: 0 20px 0 24px; }
  .brand { font-size: 1.1rem; }
  .tabs {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%); height: var(--top); z-index: 30;
    display: flex; gap: 4px; background: none; border: 0; padding: 0;
  }
  .tabs a { flex-direction: row; gap: 8px; padding: 0 18px; font-size: .95rem; color: var(--ink-2); border-radius: 10px; margin: 8px 0; }
  .tabs a:hover { background: var(--bg-2); color: var(--ink); }
  .tabs a[aria-selected="true"] { color: var(--lane); background: var(--lane-soft); }
  .tabs a[aria-selected="true"]::before { display: none; }
  .tabs svg { width: 20px; height: 20px; }

  /* Map: docked sidebar + map */
  .map-chips, .fab { display: none; }
  .sheet {
    left: 0; top: 0; bottom: 0; right: auto; width: 400px; height: auto; transform: none;
    border-radius: 0; box-shadow: none; border-right: 1px solid var(--line); background: var(--card);
  }
  #map-view { left: 400px; }
  #map-view .vm-ctrl { top: 12px; }
  #map-view .vm-attr { bottom: 4px; left: auto; right: 6px; }
  .map-key { display: none; }
  .legend i.line { width: 16px; height: 4px; border-radius: 2px; vertical-align: 2px; }
  .legend i.line.thin { height: 2px; }
  .sheet-handle { min-height: 0; padding: 18px 20px 4px; align-items: flex-start; cursor: default; font-size: 1.05rem; font-weight: 800; text-align: left; }
  .sheet-handle .grip { display: none; }
  .side-tools { display: grid; gap: 10px; padding: 8px 20px 14px; border-bottom: 1px solid var(--line); }
  .side-tools .btn-block { margin-top: 0; }
  .side-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
  .sheet-body { padding: 14px 16px 16px; }
  .sheet-body .card { cursor: pointer; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--ink-2); }
  .legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
  .legend i.dash { border: 2px dashed var(--pending); }
  .legend i.sm { width: 8px; height: 8px; vertical-align: 0; }

  /* Info: sticky emergency + legal column, content column */
  .info-wrap { max-width: 1180px; display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 40px; align-items: start; padding: 32px 32px 64px; }
  .info-wrap .disclaimer { grid-column: 1 / -1; margin: 0; }
  .info-side { position: sticky; top: 32px; display: grid; gap: 0; }
  .info-side h2 { margin-top: 24px; }
  .info-main > h2:first-child { margin-top: 0; }
  .info-main h2 { font-size: 1.35rem; margin-top: 36px; }
  .info-main .acc ul, .info-main .timeline p { font-size: 1rem; }

  /* Dialogs: centred, roomier */
  .sheet-dialog { margin: auto; width: min(520px, calc(100% - 48px)); border-radius: 20px; }
  #report-dialog { width: min(900px, calc(100% - 48px)); }
  #report-dialog .r-cols { grid-template-columns: 1fr 1fr; gap: 24px; }
  #report-dialog #pin-map { height: 260px; }
  #cam-dialog { width: min(980px, calc(100% - 48px)); }
  .form { padding: 22px 24px 24px; }

  .toast { bottom: 28px; }
}

@media (min-width: 1400px) {
  .sheet { width: 440px; }
  #map-view { left: 440px; }
}

/* Pointer devices: hover affordances */
@media (hover: hover) {
  .btn:hover { filter: brightness(1.07); }
  .btn-ghost:hover, .chip:hover { border-color: var(--ink-2); }
  .card.item:hover { border-color: var(--ink-2); }
  .res a:hover, .tag:hover { text-decoration: underline; }
}
