/* Right of Way — UI styles (crisp: solid surfaces, hard edges, high contrast) */
:root {
  --bg: #0a0d0c;
  --s1: #111614;           /* floating panels, sheets */
  --s2: #181e1b;           /* cards, list groups */
  --s3: #222a26;           /* secondary buttons, selected segment */
  --s4: #2c3531;           /* pressed / hover */
  --line: #29312d; --line-2: #3b4641;
  --tx: #ffffff; --tx-2: #c6cfca; --tx-3: #8e9a94;
  --acc: #ffb800; --acc-ink: #1a1300; --acc-line: #ffb800;
  --ok: #1fdc85; --warn: #ffab00; --no: #ff3d57; --info: #3aa3ff;
  --r: 14px; --r-sm: 10px; --r-btn: 10px;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --dockH: 64px; --dockGap: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 4px 14px rgba(0, 0, 0, .55);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); font: 15px/1.4 var(--font); overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { display: block; flex: none; shape-rendering: geometricPrecision; }
.glass { background: var(--s1); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.num { font-variant-numeric: tabular-nums; }
button:active { background-color: var(--s4); }
.btn.primary:active, .dock-add:active i, .fab.on:active { filter: brightness(.9); }

#map { position: fixed; inset: 0; background: #1a201d; }
.leaflet-container { font: 12px var(--font); background: #1a201d; }
.leaflet-control-attribution { background: rgba(0, 0, 0, .7) !important; color: rgba(255, 255, 255, .75) !important; font-size: 9px; padding: 1px 6px !important; border-radius: 4px 0 0 0; }
.leaflet-control-attribution a { color: #fff !important; }
.leaflet-bottom.leaflet-right { bottom: calc(var(--dockH) + var(--dockGap) + var(--sb) + 2px); transition: bottom .2s; }
body.mode .leaflet-bottom.leaflet-right { bottom: calc(var(--dockH) + var(--dockGap) + var(--sb) + 22px); }
.gmu-label { background: #000; color: #fff; border: 1.5px solid #fff; border-radius: 6px; font: 800 12.5px var(--font); padding: 2px 7px; box-shadow: none; letter-spacing: .4px; }
.gmu-label::before { display: none; }

/* ---------- top: where you are ---------- */
#top { position: fixed; z-index: 800; top: calc(var(--st) + 10px); left: calc(var(--sl) + 10px); right: calc(var(--sr) + 10px); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
#top > * { pointer-events: auto; }
#here { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; min-height: 56px; padding: 8px 12px 8px 8px; border-radius: var(--r); text-align: left; }
#here .badge { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--s3); color: var(--tx); }
#here .badge img { width: 40px; height: 40px; border-radius: 9px; }
#here .badge.ok { background: var(--ok); color: #00210f; } #here .badge.no { background: var(--no); color: #2a0007; }
#here .badge.warn { background: var(--warn); color: #241800; } #here .badge.info { background: var(--info); color: #001a33; }
#here .badge .ic { stroke-width: 2.6; }
#here .txt { min-width: 0; flex: 1; }
#here b { display: block; font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#here small { display: block; color: var(--tx-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#here .chev { color: var(--tx-3); }
#pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 5px 0 12px; border-radius: 10px; font-size: 14px; font-weight: 650; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--no); animation: pulse 1.4s steps(2, jump-none) infinite; }
.pill .act { height: 32px; padding: 0 10px; border-radius: 7px; background: var(--s3); border: 1px solid var(--line-2); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pill .arrow { width: 26px; height: 26px; border-radius: 6px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; transition: transform .4s; }
.pill .arrow .ic { stroke-width: 2.8; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- floating buttons ---------- */
#fabs { position: fixed; z-index: 700; right: calc(var(--sr) + 10px); bottom: calc(var(--dockH) + var(--dockGap) + var(--sb) + 22px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; transition: bottom .2s, opacity .15s; }
body.mode #fabs { bottom: calc(var(--dockH) + var(--dockGap) + var(--sb) + 44px); }
body.sheet-open #fabs { opacity: 0; pointer-events: none; }
.fab-zoom { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; }
.fab-zoom button { width: 50px; height: 46px; display: grid; place-items: center; color: var(--tx); }
.fab-zoom button + button { border-top: 1px solid var(--line-2); }
.fab, .fab-sm { display: grid; place-items: center; color: var(--tx); }
.fab { width: 58px; height: 58px; border-radius: 14px; }
.fab-sm { width: 50px; height: 50px; border-radius: 12px; }
.fab.on, .fab-sm.on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.fab.live { color: var(--info); }
.range-tag { background: #000; color: #fff; font: 800 12px var(--font); padding: 2px 7px; border-radius: 5px; border: 1.5px solid #fff; white-space: nowrap; transform: translate(-50%, -50%); position: absolute; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.presets { display: flex; gap: 8px; margin: 2px 0 12px; } .presets button { flex: 1; min-height: 42px; border-radius: var(--r-btn); background: var(--s3); border: 1px solid var(--line-2); font-weight: 700; font-size: 14.5px; }
.presets button.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }

/* ---------- dock ---------- */
#dock { position: fixed; z-index: 750; left: calc(var(--sl) + 10px); right: calc(var(--sr) + 10px); bottom: calc(var(--sb) + var(--dockGap)); height: var(--dockH); border-radius: 16px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 0 4px; transition: transform .25s cubic-bezier(.2, .9, .3, 1), opacity .15s; }
#dock button { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--tx-2); font-size: 11.5px; font-weight: 650; letter-spacing: .1px; border-radius: 12px; }
#dock button.on { color: var(--acc); }
#dock button:active { background: transparent; color: var(--tx); }
#dock .dock-add i { width: 54px; height: 48px; border-radius: 12px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; }
#dock .dock-add .ic { stroke-width: 2.6; }
body.mode #dock, body.sheet-open #dock { transform: translateY(140%); opacity: 0; }

/* ---------- mode bar (draw / measure / place) ---------- */
#modebar { position: fixed; z-index: 760; left: calc(var(--sl) + 10px); right: calc(var(--sr) + 10px); bottom: calc(var(--sb) + var(--dockGap)); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; transform: translateY(150%); transition: transform .25s cubic-bezier(.2, .9, .3, 1); }
body.mode #modebar { transform: none; }
.mb-text { padding: 0 4px; } .mb-text b { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; } .mb-text small { color: var(--tx-2); font-size: 13px; }
.mb-actions { display: flex; gap: 8px; }
.mb-actions .btn { flex: 1; }
#crosshair { position: fixed; z-index: 690; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; pointer-events: none; display: none; }
body.center-pick #crosshair { display: block; }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 0 1px #000; }
#crosshair::before { left: 31px; top: 0; width: 2px; height: 64px; } #crosshair::after { top: 31px; left: 0; height: 2px; width: 64px; }
#crosshair span { position: absolute; left: 23px; top: 23px; width: 18px; height: 18px; border: 2px solid var(--acc); border-radius: 50%; z-index: 1; box-shadow: 0 0 0 1px #000; }

/* ---------- bottom sheet ---------- */
#sheet { position: fixed; z-index: 900; left: 0; right: 0; bottom: 0; max-height: min(88vh, calc(100% - var(--st) - 28px)); border-radius: 16px 16px 0 0; border: 1px solid var(--line-2); border-bottom: 0; background: var(--s1); box-shadow: 0 -6px 20px rgba(0, 0, 0, .5); display: flex; flex-direction: column; transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .9, .3, 1); padding-bottom: var(--sb); }
#sheet.open { transform: none; }
#sheet.dragging { transition: none; }
#sheet.peek { max-height: min(52vh, 460px); }
#sheet.peek .body::after { content: 'Drag up for more'; display: block; text-align: center; color: var(--tx-3); font-size: 11.5px; font-weight: 600; margin-top: 10px; }
.grab { height: 20px; display: grid; place-items: center; touch-action: none; cursor: grab; flex: none; }
.grab span { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); }
#sheet header { display: flex; align-items: center; gap: 6px; padding: 0 10px 10px 14px; touch-action: none; flex: none; border-bottom: 1px solid var(--line); }
#sheet .titles { flex: 1; min-width: 0; }
#sheet h2 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.4px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
#sheet header p { margin: 2px 0 0; color: var(--tx-2); font-size: 13px; font-weight: 500; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--tx); background: var(--s3); border: 1px solid var(--line-2); flex: none; }
#sheetBack { margin-right: 4px; }
#sheet .body { overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px 16px; -webkit-overflow-scrolling: touch; }
#sheet footer { padding: 10px 14px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex: none; background: var(--s1); }
#sheet footer .btn { flex: 1; white-space: nowrap; }
#sheet footer .btn.danger { flex: 0 0 52px; padding: 0; }
#sheet footer:empty { display: none; }

/* ---------- content building blocks ---------- */
.sec { margin: 20px 0 8px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--tx-3); display: flex; align-items: center; justify-content: space-between; }
.sec:first-child { margin-top: 2px; }
.sec button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 700; color: var(--acc); }
.note { color: var(--tx-2); font-size: 13.5px; margin: 8px 0; }
.fine { color: var(--tx-3); font-size: 12px; margin: 12px 0 2px; line-height: 1.45; }
.fine a, .note a, .prose a { color: var(--acc); }
.card { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 8px 0; }

.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 12px; border-radius: var(--r-sm); margin: 0 0 10px; background: var(--s2); border: 1px solid var(--line); border-left: 4px solid; }
.verdict .vi { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.verdict .vi .ic { stroke-width: 3; }
.verdict b { display: block; font-size: 16px; font-weight: 750; line-height: 1.25; letter-spacing: -.1px; } .verdict span { display: block; font-size: 13.5px; color: var(--tx-2); margin-top: 2px; }
.verdict.ok { border-left-color: var(--ok); } .verdict.ok .vi { background: var(--ok); color: #00210f; } .verdict.ok b { color: var(--ok); }
.verdict.no { border-left-color: var(--no); } .verdict.no .vi { background: var(--no); color: #2a0007; } .verdict.no b { color: #ff6378; }
.verdict.warn { border-left-color: var(--warn); } .verdict.warn .vi { background: var(--warn); color: #241800; } .verdict.warn b { color: var(--warn); }
.verdict.info { border-left-color: var(--info); } .verdict.info .vi { background: var(--info); color: #001a33; } .verdict.info b { color: #66b8ff; }
.verdict.small { padding: 10px 12px; } .verdict.small b { font-size: 14.5px; } .verdict.small .vi { width: 24px; height: 24px; border-radius: 6px; }

.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv td { padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { color: var(--tx-3); width: 40%; padding-right: 12px; font-weight: 500; }
.kv td:last-child { font-weight: 550; }
.coord { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-radius: var(--r-sm); background: var(--s2); border: 1px solid var(--line-2); margin: 10px 0; text-align: left; }
.coord span { flex: 1; font-variant-numeric: tabular-nums; font-size: 15.5px; font-weight: 700; letter-spacing: -.1px; } .coord small { display: block; color: var(--tx-3); font-weight: 500; font-size: 11.5px; letter-spacing: 0; }
.coord .ic { color: var(--tx-2); }

.btn { min-height: 48px; padding: 0 16px; border-radius: var(--r-btn); background: var(--s3); color: var(--tx); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn.primary .ic { stroke-width: 2.5; }
.btn.danger { background: var(--s3); color: var(--no); border-color: var(--line-2); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btnrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; }
.btnrow.three { grid-template-columns: repeat(3, 1fr); }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--r-sm); background: var(--s2); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 700; color: var(--tx); min-height: 70px; justify-content: center; }
.qa .ic { color: var(--acc); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--s2); border: 1px solid var(--line-2); text-align: left; min-height: 108px; }
.tile .ti { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); }
.tile .ti .ic { stroke-width: 2.4; }
.tile b { font-size: 14.5px; font-weight: 700; line-height: 1.2; } .tile small { color: var(--tx-2); font-size: 12px; line-height: 1.3; display: block; margin-top: 3px; }
.tile.rec { border-color: var(--no); } .tile.rec .ti { background: var(--no); color: #2a0007; }

.list { border-radius: var(--r-sm); overflow: hidden; background: var(--s2); border: 1px solid var(--line-2); }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .li { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--s3); color: var(--tx); border: 1px solid var(--line-2); }
.item .lt { flex: 1; min-width: 0; } .item .lt b { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .item .lt small { display: block; color: var(--tx-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .tr { color: var(--tx-3); flex: none; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.item.danger .lt b { color: var(--no); } .item.danger .li { color: var(--no); }
.empty { text-align: center; padding: 26px 16px; color: var(--tx-2); }
.empty .ic { margin: 0 auto 10px; color: var(--tx-3); }
.empty b { display: block; color: var(--tx); font-size: 16px; margin-bottom: 4px; }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-btn); padding: 3px; gap: 3px; margin: 2px 0 12px; }
.seg button { flex: 1; min-height: 38px; border-radius: 7px; font-size: 13.5px; font-weight: 650; color: var(--tx-2); display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; }
.seg button.on { background: var(--s3); color: var(--tx); border-color: var(--line-2); }
.seg button em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--tx-3); background: var(--s2); padding: 0 5px; border-radius: 4px; }
.seg button.on em { color: var(--acc); }

.tg { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.tg:last-child { border-bottom: 0; }
.tg .li { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--s3); color: var(--tx); border: 1px solid var(--line-2); }
.tg .lt { flex: 1; min-width: 0; } .tg .lt b { display: block; font-weight: 650; font-size: 14.5px; } .tg .lt small { display: block; color: var(--tx-2); font-size: 12px; line-height: 1.3; }
.switch { width: 44px; height: 26px; border-radius: 13px; background: var(--s4); border: 1px solid var(--line-2); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.on > .switch, .switch.on { background: var(--ok); border-color: var(--ok); } .on > .switch::after, .switch.on::after { transform: translateX(18px); }
.rsw { width: 40px; height: 18px; position: relative; flex: none; }
.rsw i { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); border-radius: 1px; }
.lsw { width: 24px; height: 24px; border-radius: 5px; flex: none; border: 2px solid; }

.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: 12px; color: var(--tx-3); font-weight: 750; text-transform: uppercase; letter-spacing: .6px; margin: 0 0 6px 1px; }
.input, .field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 12px 13px; border-radius: var(--r-btn); border: 1px solid var(--line-2); background: var(--bg); color: var(--tx); font-size: 16px; font-weight: 500; outline: none; }
.field textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #5f6b66; }
.field input[type=date], .field input[type=datetime-local] { color-scheme: dark; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { position: relative; } .search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--tx-3); } .search input { padding-left: 42px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { height: 34px; padding: 0 8px 0 12px; border-radius: 8px; background: var(--acc); color: var(--acc-ink); border: 1px solid var(--acc); font-size: 13.5px; font-weight: 750; display: inline-flex; align-items: center; gap: 4px; }
.chip .ic { stroke-width: 2.6; }
.chip.plain { background: var(--s3); color: var(--tx); border-color: var(--line-2); padding: 0 12px; }

.unit { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.unit:last-child { border-bottom: 0; }
.unit .ck, .check .ck, .agree .ck { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; color: transparent; background: var(--bg); }
.unit .ck .ic, .check .ck .ic, .agree .ck .ic { stroke-width: 3.2; }
.unit.on .ck { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.unit .lt { flex: 1; min-width: 0; } .unit b { font-size: 15px; font-weight: 700; } .unit small { display: block; color: var(--tx-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit em { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--ok); border: 1px solid var(--ok); padding: 2px 6px; border-radius: 5px; flex: none; }

.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.type { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r-sm); background: var(--s2); border: 1.5px solid var(--line-2); font-size: 12px; font-weight: 650; color: var(--tx-2); min-height: 74px; justify-content: center; text-align: center; line-height: 1.15; }
.type .tdot { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--c); color: #0b0f0d; }
.type .tdot .ic { stroke-width: 2.4; }
.type.on { border-color: var(--acc); color: var(--tx); box-shadow: 0 0 0 1px var(--acc) inset; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.opt:last-child { border-bottom: 0; }
.opt .rd { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.opt.on .rd { border-color: var(--acc); } .opt.on .rd::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
.opt span { flex: 1; font-size: 14.5px; font-weight: 600; }

.check { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.check:last-child { border-bottom: 0; }
.check.on .ck { background: var(--ok); border-color: var(--ok); color: #00210f; }
.check.on span { color: var(--tx-3); text-decoration: line-through; }
.check span { flex: 1; font-size: 14.5px; font-weight: 550; }
.check .x { color: var(--tx-3); padding: 6px; }

.sun { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.sun div { padding: 9px 2px; border-radius: var(--r-sm); background: var(--s2); border: 1px solid var(--line-2); }
.sun small { display: block; color: var(--tx-3); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.sun b { display: block; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }
.sun .legal { border-color: var(--acc); } .sun .legal b { color: var(--acc); }

.bar { height: 6px; border-radius: 3px; background: var(--s3); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--acc); width: 0; transition: width .3s; }

.prose { font-size: 14px; color: var(--tx-2); line-height: 1.55; }
.prose h3 { color: var(--tx); font-size: 15px; font-weight: 750; margin: 18px 0 6px; } .prose p { margin: 6px 0; } .prose ul { margin: 6px 0; padding-left: 20px; } .prose li { margin: 4px 0; }
.prose b { color: var(--tx); }

.lg { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.lg:last-child { border-bottom: 0; } .lg .lt b { display: block; font-size: 14px; font-weight: 650; } .lg .lt small { color: var(--tx-2); font-size: 12px; }

/* ---------- dialog ---------- */
#modal { position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, .7); display: none; align-items: flex-end; justify-content: center; padding: 16px 10px calc(var(--sb) + 12px); }
#modal.show { display: flex; animation: fade .15s; }
.dlg { width: 100%; max-width: 440px; border-radius: 16px; padding: 18px; background: var(--s1); animation: rise .22s cubic-bezier(.2, .9, .3, 1); }
.dlg h3 { margin: 0 0 6px; font-size: 19px; font-weight: 750; letter-spacing: -.3px; } .dlg p { margin: 0 0 10px; color: var(--tx-2); font-size: 14.5px; }
.dlg .btnrow { margin-top: 16px; }
.dlg .dicon { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); margin-bottom: 12px; }
.dlg .dicon.no { background: var(--no); color: #2a0007; } .dlg .dicon.warn { background: var(--warn); color: #241800; }
.agree { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-sm); background: var(--s2); border: 1px solid var(--line-2); margin-top: 10px; text-align: left; width: 100%; font-size: 14px; font-weight: 550; color: var(--tx); }
.agree .ck { margin-top: 1px; }
.agree.on { border-color: var(--acc); } .agree.on .ck { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(30px); opacity: 0; } }

/* ---------- toast ---------- */
#toast { position: fixed; z-index: 1300; left: 50%; top: calc(var(--st) + 76px); transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100% - 28px); width: max-content; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast .t { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: #fff; color: #0a0d0c; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); font-size: 14px; font-weight: 650; }
#toast .t .ic { color: #0a9e5c; stroke-width: 2.8; } #toast .t.no .ic { color: #d6002a; } #toast .t.warn .ic { color: #b86e00; } #toast .t.info .ic { color: #006ad4; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 1100; background: rgba(0, 0, 0, .72); display: none; align-items: center; justify-content: center; padding: 20px; }
#loading.show { display: flex; animation: fade .15s; }
.load-card { width: 100%; max-width: 380px; border-radius: 16px; padding: 20px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.load-ring { width: 64px; height: 64px; position: relative; } .load-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.load-ring circle { fill: none; stroke-width: 6; } .load-ring .trk { stroke: var(--s3); } .load-ring .val { stroke: var(--acc); stroke-linecap: butt; stroke-dasharray: 176; stroke-dashoffset: 176; transition: stroke-dashoffset .4s; }
.load-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.load-text b { display: block; font-size: 16px; font-weight: 750; } .load-text small { display: block; color: var(--tx-2); font-size: 13px; margin-top: 2px; }
.load-note { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--tx-3); border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- welcome tour ---------- */
#tour { position: fixed; inset: 0; z-index: 1150; background: var(--bg); display: none; flex-direction: column; padding: calc(var(--st) + 14px) 20px calc(var(--sb) + 16px); }
#tour.show { display: flex; animation: fade .2s; }
.tour-top { display: flex; justify-content: space-between; align-items: center; height: 40px; }
.tour-top .skip { color: var(--tx-2); font-weight: 700; font-size: 14.5px; padding: 8px 4px; }
.dots { display: flex; gap: 5px; } .dots i { width: 18px; height: 4px; border-radius: 2px; background: var(--s4); transition: background .2s; } .dots i.on { background: var(--acc); }
.slide { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: safe center; max-width: 460px; width: 100%; margin: 0 auto; overflow-y: auto; animation: slidein .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }
.slide .art { display: flex; justify-content: center; margin-bottom: 26px; }
.slide h1 { font-size: 29px; font-weight: 800; line-height: 1.12; letter-spacing: -.8px; margin: 0 0 10px; }
.slide p.lead { font-size: 16px; color: var(--tx-2); margin: 0 0 14px; line-height: 1.5; }
.slide ul.pts { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--line); }
.slide ul.pts li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; font-size: 14.5px; color: var(--tx-2); border-bottom: 1px solid var(--line); }
.slide ul.pts li .ic { color: var(--acc); margin-top: 1px; } .slide ul.pts li b { color: var(--tx); }
.tour-nav { display: flex; gap: 8px; max-width: 460px; width: 100%; margin: 14px auto 0; }
.tour-nav .btn { flex: 1; min-height: 52px; font-size: 16px; }
.tour-nav #tBack { flex: 0 0 60px; }
.keyart { width: 100%; background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 14px; }
.phone-art { width: 220px; height: 220px; border-radius: 22px; background: #2b3a2f; border: 1px solid var(--line-2); position: relative; overflow: hidden; }

/* ---------- waypoints ---------- */
.wpt { background: none; border: 0; }
.wpt-pin { position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 2px 4px rgba(0, 0, 0, .5); display: grid; place-items: center; }
.wpt-pin .ic { transform: rotate(45deg); color: #0b0f0d; stroke-width: 2.5; }
.wpt-name { position: absolute; top: 45px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 750 11.5px var(--font); color: #fff; background: rgba(0, 0, 0, .78); padding: 1px 5px; border-radius: 4px; pointer-events: none; display: none; }
.zoom-names .wpt-name { display: block; }
.wpt.sel .wpt-pin { box-shadow: 0 0 0 3px var(--acc), 0 2px 4px rgba(0, 0, 0, .5); }
.tap-ring { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #000; background: var(--acc); }

/* ---------- larger screens: sheet becomes a side panel ---------- */
@media (min-width: 760px) {
  #sheet { left: 12px; right: auto; width: 420px; bottom: 12px; top: auto; max-height: calc(100% - 100px); border-radius: 16px; border-bottom: 1px solid var(--line-2); transform: translateX(-110%); }
  #sheet.open { transform: none; }
  #sheet.peek { max-height: calc(100% - 100px); } #sheet.peek .body::after { display: none; }
  body.sheet-open #fabs { opacity: 1; pointer-events: auto; }
  #dock { left: 50%; right: auto; width: 440px; transform: translateX(-50%); }
  body.mode #dock { transform: translateX(-50%) translateY(140%); }
  body.sheet-open #dock { transform: translateX(-50%); opacity: 1; }
  #modebar { left: 50%; right: auto; width: 480px; transform: translate(-50%, 150%); } body.mode #modebar { transform: translateX(-50%); }
  #modal { align-items: center; }
  #here { max-width: 420px; }
}
/* ---------- drive mode ---------- */
#driveHud, #driveBar, #driveEdge { display: none; }
body.drive #here, body.drive #fabs, body.drive #dock { display: none; }
body.drive #driveHud { display: block; width: 100%; max-width: 520px; border-radius: var(--r); padding: 12px 14px; }
.dtop { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dhead { display: flex; align-items: center; gap: 12px; }
.darrow { width: 50px; height: 50px; border-radius: 10px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; transition: transform .6s; }
.darrow .ic { stroke-width: 2.6; fill: currentColor; }
.dhead b { display: block; font-size: 32px; font-weight: 850; line-height: 1; letter-spacing: -.5px; } .dhead small { display: block; color: var(--tx-2); font-size: 13px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.dhead.dim .darrow { background: var(--s3); color: var(--tx-3); } .dhead.dim b { color: var(--tx-2); }
.dspeed { text-align: right; } .dspeed b { display: block; font-size: 48px; font-weight: 850; line-height: .95; letter-spacing: -1.5px; } .dspeed small { color: var(--tx-2); font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; }
.drow { display: flex; align-items: center; gap: 12px; padding-top: 10px; }
.drow .badge { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--s3); }
.drow .badge .ic { stroke-width: 2.8; }
.drow .badge.ok { background: var(--ok); color: #00210f; } .drow .badge.no { background: var(--no); color: #2a0007; } .drow .badge.warn { background: var(--warn); color: #241800; } .drow .badge.info { background: var(--info); color: #001a33; }
.drow .rsw { width: 40px !important; }
.dl { flex: 1; min-width: 0; } .dl b { display: block; font-size: 19px; font-weight: 750; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dl small { display: block; font-size: 13.5px; font-weight: 600; color: var(--tx-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl b.dim { color: var(--tx-3); }
.t-ok { color: var(--ok) !important; } .t-no { color: #ff6378 !important; } .t-warn { color: var(--warn) !important; } .t-info { color: #66b8ff !important; }
body.drive #driveBar { display: grid; }
#driveBar { position: fixed; z-index: 760; left: calc(var(--sl) + 10px); right: calc(var(--sr) + 10px); bottom: calc(var(--sb) + 10px); grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px; border-radius: 16px; transform: translateY(160%); transition: transform .22s cubic-bezier(.2, .9, .3, 1); }
body.drive-bar #driveBar { transform: none; }
.db { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 66px; border-radius: 11px; font-size: 11.5px; font-weight: 700; color: var(--tx); background: var(--s2); border: 1px solid var(--line-2); }
.db.on { color: var(--acc); border-color: var(--acc); } .db.rec { color: var(--no); border-color: var(--no); }
body.drive #driveEdge { display: block; position: fixed; z-index: 740; left: 0; right: 0; bottom: 0; height: calc(var(--sb) + 64px); touch-action: none; }
body.drive-bar #driveEdge { display: none; }
body.drive .leaflet-top.leaflet-right { top: auto; bottom: calc(var(--sb) + 2px); }
body.drive-bar .leaflet-top.leaflet-right { bottom: calc(var(--sb) + 96px); }

/* ---------- phone on its side (landscape): compact bars, side panel, more map ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --dockH: 54px; --dockGap: 8px; }
  #top { top: calc(var(--st) + 8px); left: calc(var(--sl) + 8px); }
  #here { min-height: 46px; padding: 5px 10px 5px 5px; max-width: 360px; gap: 10px; }
  #here .badge, #here .badge img { width: 34px; height: 34px; }
  #here b { font-size: 15px; } #here small { font-size: 12px; }
  .pill { height: 36px; } .pill .act { height: 28px; }
  #fabs { right: calc(var(--sr) + 8px); bottom: calc(var(--sb) + 8px); gap: 6px; }
  body.mode #fabs { bottom: calc(var(--sb) + 8px); }
  .fab { width: 52px; height: 52px; } .fab-sm { width: 46px; height: 46px; } .fab-zoom button { width: 46px; height: 40px; }
  #dock { left: 50%; right: auto; width: min(460px, 60vw); transform: translateX(-50%); }
  #dock button span { display: none; }
  #dock .dock-add i { width: 50px; height: 42px; }
  body.mode #dock { transform: translateX(-50%) translateY(140%); }
  body.sheet-open #dock { transform: translateX(-50%); opacity: 1; left: calc((100% + min(400px, 52vw) + 16px - 70px) / 2); width: min(340px, calc(100% - min(400px, 52vw) - 100px)); }
  #modebar { left: 50%; right: auto; width: min(520px, 64vw); transform: translate(-50%, 150%); flex-direction: row; align-items: center; padding: 8px 8px 8px 12px; }
  body.mode #modebar { transform: translateX(-50%); }
  .mb-text { flex: 1; min-width: 0; } .mb-text b { font-size: 15px; } .mb-text small { font-size: 12px; } .mb-actions .btn { min-height: 42px; padding: 0 12px; }
  #sheet { left: calc(var(--sl) + 8px); right: auto; top: calc(var(--st) + 8px); bottom: calc(var(--sb) + 8px); width: min(400px, 52vw); max-height: none; border-radius: 14px; border-bottom: 1px solid var(--line-2); transform: translateX(-112%); padding-bottom: 0; }
  #sheet.open { transform: none; } #sheet.peek { max-height: none; } #sheet.peek .body::after { display: none; }
  .grab { display: none; } #sheet header { padding-top: 10px; }
  body.sheet-open #fabs { opacity: 1; pointer-events: auto; }
  body.sheet-open #top { left: calc(var(--sl) + min(400px, 52vw) + 16px); }
  #modal { align-items: center; padding: 8px; } .dlg { max-height: calc(100vh - 16px); overflow-y: auto; padding: 14px 16px; }
  #toast { top: calc(var(--st) + 60px); }
  #tour { padding: calc(var(--st) + 6px) 24px calc(var(--sb) + 8px); }
  .slide { justify-content: flex-start; padding-top: 4px; } .slide .art { display: none; } .slide h1 { font-size: 23px; }
  .slide ul.pts li { padding: 7px 0; } .tour-nav { margin-top: 8px; } .tour-nav .btn { min-height: 44px; }
  .load-card { max-width: 460px; }
  /* drive readout: one narrow bar across the top */
  body.drive #top { right: calc(var(--sr) + 8px); }
  body.drive #driveHud { max-width: none; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 0; padding: 6px 8px; border-radius: 12px; }
  #driveHud .dtop { display: contents; }
  #driveHud .dhead { order: 1; gap: 8px; padding-right: 12px; }
  #driveHud .drow { order: 2; padding: 0 12px; gap: 10px; border-left: 1px solid var(--line-2); min-width: 0; }
  #driveHud .drow + .drow { order: 3; }
  #driveHud .dspeed { order: 4; padding-left: 12px; border-left: 1px solid var(--line-2); display: flex; align-items: baseline; gap: 4px; }
  .darrow { width: 36px; height: 36px; border-radius: 8px; } .darrow .ic { width: 20px; height: 20px; }
  .dhead b { font-size: 21px; } .dhead small { font-size: 11.5px; margin-top: 1px; }
  .dspeed b { font-size: 30px; letter-spacing: -1px; } .dspeed small { font-size: 11px; }
  .drow .badge { width: 32px; height: 32px; border-radius: 7px; } .drow .badge .ic { width: 18px; height: 18px; }
  .drow .rsw { width: 28px !important; }
  .dl b { font-size: 15px; } .dl small { font-size: 12px; }
  #driveBar { left: 50%; right: auto; width: min(560px, 70vw); transform: translate(-50%, 160%); } body.drive-bar #driveBar { transform: translateX(-50%); }
  .db { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
