/* Directions: mobile-first route sheet, stops and turn guidance. Loaded last so route layout wins.
   Phone (base + sheet query): bottom sheet with the map above; guidance is a top next-turn card
   plus a bottom trip footer. Side layout (>=760px, or landscape phones): a card on the left.
   routing.js sets .is-collapsed (trip overview), .is-picking, .is-navigating, .is-reporting-guide,
   .has-previous-route (outdated route shown), .is-options (route
   options sheet) on #route-panel, --route-keyboard on the panel and --route-bottom-inset on <main>. */
.route-pin-stop,.route-marker-stop{background:#2f6f8f}

/* ---- Planning structure (all sizes): head, capped scroll body, then result/Start and status ---- */
.route-panel{display:flex;flex-direction:column;overflow:hidden}
.route-panel>*{flex:none}
.route-body{flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;margin:0 -4px;padding:0 4px 2px;scroll-padding-block:8px}
.route-panel.is-collapsed .route-body{display:none}

.route-head{gap:6px;min-height:44px}
.route-head h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.route-modes{flex:none;border-radius:11px}
.route-mode{height:44px;min-width:60px;padding:0 10px;font-size:14px}
.route-icon-button{flex:none;width:44px;height:44px}
/* Edit trip is secondary to Start: a quiet tinted button, not a second outlined primary. */
.route-view-toggle{flex:none;min-height:44px;padding:0 12px;border:0;border-radius:11px;background:#eef4ef;color:var(--green);font:inherit;font-size:14px;font-weight:700;white-space:nowrap}
.route-view-toggle:hover{background:#e2ede5}

.route-row{min-height:48px}
.route-row input{font-size:16px;min-height:44px}
.route-pick{width:44px;height:44px}
/* Swap sits between the A and B pins, overlapping only the non-interactive pin column. */
.route-swap{position:relative;z-index:1;justify-self:start;width:44px;height:44px;margin:-10px 0 -10px -6px}

.nav-stops{display:grid;gap:6px;margin-top:6px}
.nav-stops:empty{display:none}
.nav-stop-actions{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 0 40px}
.nav-stop-actions button{min-height:44px;padding:0 12px;border:1px solid #dfe5e1;border-radius:10px;background:#fff;color:var(--green);font:inherit;font-size:13px}
.nav-stop-actions button:hover:not(:disabled){background:#eef4ef}
.nav-stop-actions button:disabled{opacity:.4}
.nav-tools{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.nav-tool,.nav-start,.nav-end,.nav-recenter{min-height:44px;padding:0 14px;border:1px solid var(--green);border-radius:11px;background:#fff;color:var(--green);font:inherit;font-size:14px;font-weight:600}
.nav-tool{flex:1 1 auto}
.nav-tool:disabled,.nav-start:disabled{opacity:.5}
.nav-start{margin-top:6px;min-height:48px;background:var(--green);color:#fff;font-size:16px;font-weight:700}
.nav-recenter{background:var(--orange);border-color:var(--orange);color:#fff}
.route-pick-bar button,.route-retry{min-height:44px;height:auto;padding:0 14px;font-size:14px}
.route-pick-bar{margin-top:8px}
.route-result{margin-top:8px}
/* Collapsed overview: the sheet itself is the card, so no tinted box-in-a-box. */
.route-panel.is-collapsed .route-result{margin-top:2px;padding:0 2px;gap:0;background:none}

/* Trip overview text: only in the collapsed view (the fields show it otherwise).
   Line 1: To (destination). Line 2: From · via ordered stops. DOM order is To, via, From. */
.route-trip{display:flex;flex-wrap:wrap;column-gap:6px;margin:0 0 2px;font-size:13px;line-height:1.4;color:#4e6f61}
.route-trip>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.route-trip-to{flex:0 0 100%;font-size:17px;line-height:1.3;font-weight:700;color:var(--green)}
.route-trip-from{order:1;flex:0 1 auto}
.route-trip-via{order:2;flex:1 1 0}
.route-trip-via:empty{display:none}
.route-trip-via::before{content:'·';margin-right:6px}
.route-trip:has(.route-trip-via:not(:empty)) .route-trip-from{max-width:55%}
.route-panel:not(.is-collapsed) .route-trip{display:none}
.route-overview-heading{display:flex;align-items:center;gap:8px;min-width:0}
.route-overview-heading .route-trip{flex:1;min-width:0;margin:0}
.route-overview-heading .route-view-toggle{flex:none;min-height:44px;margin:0}
.route-panel:not(.is-collapsed) .route-overview-heading{display:none}

/* Previous route (outdated while a change is pending or failed): labelled and dimmed; the map
   line is dashed grey and Start stays disabled until a valid replacement arrives. */
.route-previous-label{margin:0 0 2px;font-size:12px;font-weight:700;line-height:1.35;color:#8a3a0c}
.route-previous-label[hidden]{display:none}
.route-panel.has-previous-route #route-summary,.route-panel.has-previous-route .route-trip{opacity:.55}

/* Estimate row: time leads, distance follows; All turns is a quiet link-button beside it.
   The mode word is already shown by the Drive/Walk switch, so it is not repeated on screen. */
.route-summary-row{display:flex;align-items:center;gap:8px;min-height:44px}
.route-result #route-summary{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:6px;font-size:15px;color:var(--green)}
.route-sum-mode{display:none}
.route-sum-time{font-size:22px;font-weight:800;line-height:1.15}
.route-sum-rest,.route-sum-stops{font-size:15px;font-weight:600;color:#33463e}
.route-panel.is-collapsed .route-sum-stops{display:none}   /* the overview names them as "via" */
button.route-summary-main{flex:none;min-height:44px;padding:0 6px 0 10px;border:0;border-radius:10px;background:none;color:var(--green);font:inherit;font-size:14px;font-weight:700;white-space:nowrap;cursor:pointer}
button.route-summary-main::after{content:'›';margin-left:4px;font-size:16px}
button.route-summary-main:hover{background:#eef4ef}
button.route-summary-main:disabled{visibility:hidden}
button.route-summary-main:focus-visible{outline:2px solid var(--green);outline-offset:-2px}

/* Facts line: estimate qualifier and toll status (honest "Toll unknown" included), with the toll
   breakdown one tap away. Small text; only the Details button needs the 44px height. */
.route-facts{display:flex;flex-wrap:wrap;align-items:center;column-gap:6px;min-width:0;font-size:12px;line-height:1.35;color:#4e6f61}
.route-result .route-facts small{font-size:12px;line-height:1.35;color:#4e6f61}
.route-toll{margin:0;font-size:12px;line-height:1.35;font-weight:700;color:#33463e;overflow-wrap:anywhere}
.route-facts small+.route-toll::before{content:'·';margin-right:6px;font-weight:400;color:#4e6f61}
.route-toll[hidden],.route-toll-toggle[hidden]{display:none}
.route-toll-toggle,.nav-info,.report-info{display:inline-flex;align-items:center;justify-content:center;flex:none;margin-left:0;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:none;color:var(--green)}
.route-toll-toggle:hover,.nav-info:hover,.report-info:hover{background:#eef4ef}
.route-toll-toggle:focus-visible,.nav-info:focus-visible,.report-info:focus-visible,.toll-dialog a:focus-visible,.toll-dialog-close:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.nav-details-toggle::after{content:'';display:inline-block;width:6px;height:6px;margin-left:7px;border-right:2px solid;border-bottom:2px solid;transform:translateY(-2px) rotate(45deg)}
.nav-details-toggle[aria-expanded="true"]::after{transform:translateY(1px) rotate(-135deg)}
/* Toll estimate dialog: a native modal on <body>, capped to the viewport and scrolling inside. */
.toll-dialog{box-sizing:border-box;width:min(420px,calc(100vw - 24px));max-height:calc(100dvh - 24px);margin:auto;padding:0;border:0;border-radius:14px;background:#fff;color:#33463e;box-shadow:0 12px 40px rgba(0,0,0,.28);overflow:hidden}
.toll-dialog[open]{display:flex;flex-direction:column}
.toll-dialog::backdrop{background:rgba(0,0,0,.4)}
.toll-dialog-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px 4px 16px;border-bottom:1px solid #dfe5e1}
.toll-dialog-head h2{margin:0;font-size:16px;line-height:1.3}
.toll-dialog-close{flex:none;min-width:44px;min-height:44px;padding:0 12px;border:0;border-radius:10px;background:#eef4ef;color:var(--green);font:inherit;font-size:14px;font-weight:700}
.toll-dialog-content{display:grid;gap:6px;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:12px 16px 16px;font-size:14px;line-height:1.45;color:#4e6f61}
.toll-dialog-content p,.toll-dialog-content ul{margin:0;overflow-wrap:anywhere}
.toll-dialog-content ul{padding-left:20px}
.toll-dialog-content .toll-baseline,.toll-dialog-content .toll-heading,.toll-dialog-content .toll-development{font-weight:700;color:var(--green)}
.toll-dialog-content a{color:var(--green);text-decoration:underline;display:inline-flex;align-items:center;min-height:44px}
.route-choice{flex-wrap:wrap}
.route-choice .route-choice-toll{flex:1 1 100%;order:3;font-size:12px;line-height:1.3;font-weight:600;white-space:normal}
.route-choice .route-choice-toll[hidden]{display:none}
.route-panel.has-previous-route .route-summary-row{opacity:.55}
.nav-details .nav-details-toll{font-size:12px}

/* Clear trip: the only action that discards the plan; a quiet text button, 44px tall. */
.route-clear-row{display:flex;justify-content:flex-end;margin-top:4px}
.route-clear-row[hidden]{display:none}
.route-clear{min-height:44px;padding:0 10px;border:0;border-radius:10px;background:none;color:#8a3a0c;font:inherit;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:3px}
.route-clear:hover{background:#fff3e6}

/* Optional saved-trip suggestion inside the scrollable location editor. */
.route-restore{display:grid;gap:6px;margin-top:6px;padding:10px 12px;border:1px solid #dfe5e1;border-radius:12px;background:#f6faf7}
.route-restore[hidden]{display:none}
.route-restore-title{margin:0;font-size:15px;font-weight:700;color:var(--green)}
.route-restore-detail{margin:0;font-size:13px;line-height:1.4;color:#4e6f61;overflow-wrap:anywhere}
.route-restore-actions{display:flex;flex-wrap:wrap;gap:8px}
.route-restore-actions button{flex:1 1 120px;margin:0}
.route-panel:focus{outline:none}
.directions-open.has-saved-trip{position:relative}
.directions-open.has-saved-trip::after{content:"";position:absolute;top:4px;right:4px;width:9px;height:9px;border-radius:50%;background:var(--orange);box-shadow:0 0 0 2px #fff}

/* Start row: Start plus compact Routes and Options buttons in one 48px row, so the 320x568
   overview stays under 45% of the screen. Options in the editor is the "Route options" tool. */
.route-go{display:flex;align-items:stretch;gap:6px;margin-top:6px}
.route-panel.is-collapsed .route-go{margin-top:4px}
.route-go .nav-start{flex:1 1 auto;min-width:0;margin-top:0;padding:0 10px;line-height:1.2}
.route-go .nav-start[hidden]{display:none}
/* Routes and Options are secondary: light outline so Start is the one obvious action. */
.route-icon-action{position:relative;flex:none;display:grid;place-items:center;width:48px;min-height:48px;padding:0;border:1px solid #dfe5e1;border-radius:11px;background:#fff;color:var(--green)}
.route-icon-action[hidden]{display:none}
.route-icon-action:has(.route-action-label){width:54px;gap:0;padding:4px 2px;align-content:center}
.route-action-label{font-size:11px;line-height:14px;font-weight:650}
.route-icon-action:hover,.route-icon-action[aria-expanded="true"]{background:#eef4ef}
.route-icon-action svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.route-icon-badge{position:absolute;top:3px;right:3px;min-width:16px;height:16px;padding:0 3px;border-radius:8px;background:var(--green);color:#fff;font-size:11px;font-weight:700;line-height:16px}
.route-icon-badge:empty{display:none}
.route-options-open.is-active::after{content:"";position:absolute;top:4px;right:4px;width:9px;height:9px;border-radius:50%;background:var(--orange);box-shadow:0 0 0 2px #fff}
.route-panel:not(.is-collapsed) .route-options-open{display:none}

/* Active preferences: one quiet line; the full text is its title and the options sheet. */
.route-options-summary{margin:2px 0 0;font-size:12px;line-height:1.35;color:#4e6f61;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.route-options-summary[hidden]{display:none}

/* Routes chooser: hidden until Routes is tapped; capped and scrollable so the sheet stays short. */
.route-choices{display:grid;gap:4px;margin-top:6px;max-height:min(148px,26dvh);overflow-y:auto;overscroll-behavior:contain}
.route-choices[hidden]{display:none}
.route-choice{display:flex;align-items:center;gap:10px;min-height:44px;padding:2px 12px;border:1px solid #dfe5e1;border-radius:10px;background:#fff;color:var(--green);font:inherit;font-size:14px;text-align:left}
.route-choice:hover{background:#f6faf7}
.route-choice[aria-pressed="true"]{border-color:var(--green);background:#eef4ef;box-shadow:inset 4px 0 0 var(--green)}
.route-choice strong{flex:none}
.route-choice span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#4e6f61}
.route-choice[aria-pressed="true"] span{color:var(--green);font-weight:600}

/* Route options sheet: replaces the fields and overview while open; fields scroll, actions stay. */
.route-options{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;margin-top:6px}
.route-options[hidden]{display:none}
.route-options-fields{display:grid;gap:6px;flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:2px}
.route-options-title{margin:0;font-size:15px;font-weight:700;color:var(--green)}
.route-option{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 12px;border:1px solid #dfe5e1;border-radius:10px;font-size:14px;color:var(--green);cursor:pointer}
.route-option[hidden],.route-roads[hidden]{display:none}
.route-option input{flex:none;width:20px;height:20px;margin:0;accent-color:var(--green)}
.route-roads{min-width:0;margin:0;padding:0;border:0}
.route-roads legend{padding:0;margin-bottom:4px;font-size:12px;font-weight:700;color:#4e6f61}
.route-roads-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.route-roads label{position:relative;display:flex;align-items:center;justify-content:center;min-height:44px;padding:2px 6px;border:1px solid #dfe5e1;border-radius:10px;background:#fff;font-size:13px;line-height:1.2;text-align:center;color:var(--green);cursor:pointer}
.route-roads input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.route-roads label:has(input:checked){border-color:var(--green);background:#eef4ef;font-weight:700;box-shadow:inset 0 -3px 0 var(--green)}
.route-roads label:has(input:focus-visible),.route-option:has(input:focus-visible){outline:2px solid var(--green);outline-offset:2px}
.route-options-note{margin:0;font-size:12px;line-height:1.4;color:#4e6f61}
.route-options-actions{display:flex;gap:6px;margin-top:8px}
.route-options-actions button{flex:1 1 0;min-width:0;margin:0;min-height:44px;padding:0 8px}
.route-panel.is-options .route-body,
.route-panel.is-options .route-result,
.route-panel.is-options .route-pick-bar,
.route-panel.is-options .route-retry,
.route-panel.is-navigating .route-options{display:none}

.route-clear:focus-visible,.route-view-toggle:focus-visible,.nav-tool:focus-visible,.nav-start:focus-visible,.nav-end:focus-visible,.nav-recenter:focus-visible,.nav-stop-actions button:focus-visible,
.route-icon-action:focus-visible,.route-choice:focus-visible,.nav-details-toggle:focus-visible{outline:2px solid var(--green);outline-offset:2px}

/* ---- Guidance (shared). Planning controls stay in the DOM but are hidden. ---- */
.route-panel.is-navigating .route-head{display:none}
.route-panel.is-navigating .route-modes,
.route-panel.is-navigating .route-body,
.route-panel.is-navigating .route-pick-bar,
.route-panel.is-navigating .route-result,
.route-panel.is-navigating .route-retry{display:none}
.route-panel.is-navigating .route-status:not(:empty){margin:0 0 6px}
.nav-guide{display:grid;gap:8px;outline:none}
.nav-guide[hidden]{display:none}

/* One top card (routing.js .nav-card): turn OR start choice, then at most one GPS status line and
   one notice line, all sharing one surface. Sections are separated by hairlines, not by stacking
   separate shadowed boxes. */
.nav-card{position:relative;display:grid;overflow:hidden;border-radius:16px;background:#fff;box-shadow:inset 0 0 0 1px #dfe5e1}
.nav-location-options{display:flex;gap:8px;padding:0 12px 12px}
.nav-location-options[hidden]{display:none}
.nav-location-options button{min-height:44px;flex:1;padding:0 10px;border:1px solid #dfe5e1;border-radius:10px;background:#fff;color:var(--green);font:inherit;font-size:14px;font-weight:650}
.nav-location-options .nav-location-review{background:var(--green);border-color:var(--green);color:#fff}
.nav-location-options button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.route-panel.is-reporting-guide .nav-location-options{display:none}
.nav-guide.is-origin-review .nav-end{display:none}
.nav-maneuver{display:flex;align-items:center;gap:12px;padding:10px 12px;background:var(--green);color:#fff}
.nav-maneuver .nav-turn{padding-right:0}
.nav-arrow{display:grid;place-items:center;flex:none;width:48px;height:48px;border-radius:12px;background:#ffffff1f;font-size:32px;line-height:1}
.nav-turn{display:grid;min-width:0;gap:1px}
.nav-distance{font-size:24px;line-height:1.1}
.nav-instruction{font-size:15px;line-height:1.3;overflow-wrap:anywhere}
.nav-street{font-size:13px;opacity:.85;overflow-wrap:anywhere}
.nav-street:empty{display:none}
.nav-notice{margin:0;padding:8px 14px;background:#fff3e6;color:#8a3a0c;font-size:13px;line-height:1.4;overflow-wrap:anywhere}
.nav-notice[hidden]{display:none}
/* The live turn is a button opening All turns (routing.js openTurnList): same box as the old row.
   The GPS status button is its absolutely placed sibling, never nested inside it. */
button.nav-maneuver{width:100%;margin:0;border:0;border-radius:0;font:inherit;text-align:left;cursor:pointer;-webkit-appearance:none;appearance:none}
button.nav-maneuver[aria-disabled="true"]{cursor:default}
button.nav-maneuver:focus-visible{outline:3px solid var(--orange);outline-offset:-3px}
/* "Then …" (routing.js .nav-then): the following maneuver as a small light card under the turn
   card, in the white location-status card language. One clamped line on phones (full text stays
   in the DOM for assistive tech). No distance: only the live turn has a measured one. */
.nav-then{justify-self:start;display:flex;align-items:center;gap:8px;box-sizing:border-box;max-width:100%;min-width:0;min-height:36px;margin:0;padding:4px 12px 4px 8px;border-radius:12px;background:#fff;color:var(--green);box-shadow:inset 0 0 0 1px #dfe5e1;font-size:14px;line-height:1.3}
.nav-then[hidden]{display:none}
.nav-then-label{flex:none;font-size:12px;font-weight:700;color:#4e6f61}
.nav-then-arrow{display:grid;place-items:center;flex:none;width:28px;height:28px;border-radius:8px;background:#eef4ef;font-size:18px;line-height:1}
.nav-then-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
/* Frozen last accepted turn (weak GPS): quieter, like the dimmed main turn, but still readable. */
.nav-guide.is-gps-paused .nav-then-arrow{opacity:.6}
.nav-guide.is-gps-paused .nav-then-text{color:#4e6f61;font-weight:500}
@media (min-width:760px){
  .nav-then-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal;overflow-wrap:anywhere}
}

/* Without a trusted start (or before the first progress) the turn area is a calm white status,
   never a green live instruction. The instruction already says guidance waits for location, so
   the plain 'Finding GPS…' line is not repeated; the icon pulses instead (not with reduced motion).
   Degraded states (approximate, lost, off, denied) keep their line and Help/Enable. */
.nav-guide.is-gps-pending .nav-maneuver{background:#fff;color:var(--green)}
.nav-guide.is-gps-pending .nav-arrow{width:44px;height:44px;background:#eef4ef;font-size:24px}
.nav-guide.is-gps-pending .nav-distance{font-size:19px}
.nav-guide.is-gps-pending .nav-instruction{font-size:14px;color:#4e6f61}
@media (prefers-reduced-motion:no-preference){
  :root:not([data-loka-motion="off"]) .nav-guide.is-gps-pending:not(.is-origin-review) .nav-card:has(.nav-signal[data-state="finding"]:not([hidden])) .nav-arrow{animation:nav-signal-pulse 1.6s ease-in-out infinite}
}
/* After trust is lost the last instruction stays but is dimmed so it never reads as live. */
.nav-guide.is-gps-paused:not(.is-gps-pending) .nav-turn,.nav-guide.is-gps-paused:not(.is-gps-pending) .nav-arrow{opacity:.6}

/* Stable location status slot. Healthy, checking and uncertain states keep the same height. */
/* Keep tracker presentation/announcement state internal. The shared GPS information
   control below the camera is the only visible location action in every mode. */
.nav-signal{display:none}
.nav-signal[hidden],.nav-signal-action[hidden]{display:none}
.nav-signal-text{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.nav-signal-label::before{content:'';display:inline-block;width:8px;height:8px;margin-right:6px;border-radius:50%;background:#8a8a8a;vertical-align:1px}
.nav-signal[data-state="trusted"] .nav-signal-label::before{background:var(--green)}
.nav-signal[data-state="finding"] .nav-signal-label::before{background:var(--green);animation:nav-signal-pulse 1.2s ease-in-out infinite}
.nav-signal[data-state="approximate"] .nav-signal-label::before{background:#d08a1c}
.nav-signal[data-state="lost"] .nav-signal-label::before,.nav-signal[data-state="denied"] .nav-signal-label::before,.nav-signal[data-state="off"] .nav-signal-label::before{background:#b4472b}
.nav-signal-help{color:#5d7068}
.nav-signal-action{width:44px;height:44px;padding:0;border:0;border-radius:10px;background:#ffffff14;color:inherit;font:inherit;font-size:23px}
.nav-signal::after{content:'';position:absolute;right:6px;bottom:6px;width:7px;height:7px;border:2px solid var(--green);border-radius:50%;background:#d08a1c;pointer-events:none}
.nav-signal[data-state="trusted"]::after,.nav-signal[data-state="finding"]::after{display:none}
.nav-guide.is-origin-review .nav-origin-title{padding-right:44px}
.nav-guide.is-origin-review .nav-signal{color:var(--green)}
.nav-guide.is-origin-review .nav-signal-action{background:#eef4ef}
.nav-guide.is-gps-pending .nav-signal{color:var(--green)}
.nav-guide.is-gps-pending .nav-signal-action{background:#eef4ef}
.nav-signal-action:focus-visible{outline:2px solid var(--orange);outline-offset:-2px}
@keyframes nav-signal-pulse{50%{opacity:.35}}

/* In-session start choice (routing.js renderOrigin): while away | updating | failed it replaces
   the 'Route ready' turn area, so the card is one decision with one primary action. */
.nav-guide.is-origin-review .nav-maneuver{display:none}
.nav-origin{display:grid;gap:10px;padding:14px;color:#33463e;font-size:14px;line-height:1.4}
.nav-origin[hidden],.nav-origin [hidden]{display:none}
.nav-origin-text{margin:0;overflow-wrap:anywhere}
.nav-origin-title{display:block;margin-bottom:2px;font-size:17px;line-height:1.3;color:var(--green)}
.nav-origin-detail{color:#4e6f61}
.nav-origin-context{margin:-4px 0 0;font-size:13px;color:#4e6f61;overflow-wrap:anywhere}
.nav-origin-actions{display:flex;flex-wrap:wrap;gap:8px}
.nav-origin-actions button{flex:1 1 130px;min-height:48px;padding:0 12px;border:1px solid #dfe5e1;border-radius:12px;background:#fff;color:var(--green);font:inherit;font-size:15px;font-weight:700}
.nav-origin-actions .nav-origin-update{border-color:var(--green);background:var(--green);color:#fff}
.nav-origin-actions .nav-origin-update:disabled{border-color:#dfe5e1;background:#eef1ef;color:#6f8179}
.nav-origin-actions button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.nav-origin[data-state="updating"] .nav-origin-title::after{content:'';display:inline-block;width:8px;height:8px;margin-left:8px;border-radius:50%;background:var(--green);vertical-align:1px;animation:nav-signal-pulse 1.2s ease-in-out infinite}
@media (prefers-reduced-motion:reduce){
  .nav-signal[data-state="finding"] .nav-signal-label::before,.nav-origin[data-state="updating"] .nav-origin-title::after{animation:none}
}
:root[data-loka-motion="off"] .nav-signal[data-state="finding"] .nav-signal-label::before,
:root[data-loka-motion="off"] .nav-origin[data-state="updating"] .nav-origin-title::after{animation:none}

/* Trip bar: dominant estimate (time first; distance and ETA after), one next stop or destination
   line, then Trip details and End. The estimate keeps its text; .nav-sep is screen-only spacing. */
.nav-trip{display:grid;gap:8px}
.nav-meta{display:grid;gap:2px;min-width:0;font-size:13px;line-height:1.4;color:#4e6f61}
button.nav-meta{width:100%;min-height:44px;padding:0;border:0;border-radius:8px;background:none;font:inherit;text-align:left;cursor:pointer}
button.nav-meta:focus-visible{outline:2px solid var(--green);outline-offset:2px}
button.nav-meta:disabled{cursor:default}
.nav-remaining{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;font-size:17px;line-height:1.2;color:var(--green)}
.nav-sep{display:none}
.nav-time{font-size:22px;font-weight:800;font-variant-numeric:tabular-nums}
.nav-rest{font-size:15px;font-weight:600;color:#33463e;font-variant-numeric:tabular-nums}
.nav-qualifier{align-self:center;padding:2px 8px;border-radius:999px;background:#eef4ef;font-size:11px;line-height:16px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:#4e6f61}
.nav-next-stop{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav-next-stop:empty{display:none}
/* Open details list the destination and every stop; the summary line would only repeat it. */
.nav-trip.is-details-open .nav-trip-context{display:none}
.nav-trip-context{display:flex;align-items:center;gap:8px;min-width:0;font-size:13px;color:#4e6f61}
.nav-trip-context .nav-next-stop{flex:1;min-width:0}
.nav-trip-context:has(.nav-next-stop:empty):has(.nav-toll-summary[hidden]){display:none}
.nav-actions{display:flex;gap:8px}
.nav-actions [hidden]{display:none}
.nav-actions>button{flex:1 1 0;min-width:0;margin:0;min-height:44px;padding:2px 10px;border-radius:12px;font-size:15px;line-height:1.15;font-weight:700}
.nav-actions>.nav-recenter{flex:0 0 auto}
.nav-details-toggle{border:0;background:#eef4ef;color:var(--green);font:inherit}
.nav-details-toggle:hover,.nav-details-toggle[aria-expanded="true"]{background:#e2ede5}
.nav-actions>.nav-end{border-color:#ecd3c7;background:#fff;color:#8a3a0c}
.nav-actions>.nav-end:hover{background:#fff3e6}
/* Arrived: Done is the only action left, so it becomes the primary. */
.nav-actions>.nav-details-toggle[hidden]+.nav-end{border-color:var(--green);background:var(--green);color:#fff}

/* Trip details: All turns / Other routes, destination, ordered remaining stops, toll estimate and
   the estimate qualifier. Capped and scrollable inside the trip bar (never over the turn card). */
.nav-details{display:grid;gap:6px;max-height:min(38dvh,300px);overflow-y:auto;overscroll-behavior:contain;padding:10px 12px;border-radius:12px;background:#f6faf7;font-size:13px;line-height:1.4;color:#4e6f61}
.nav-details[hidden],.nav-details-stops[hidden],.nav-details-toll[hidden]{display:none}
.nav-details p{margin:0;overflow-wrap:anywhere}
.nav-details-destination{font-size:14px;font-weight:700;color:var(--green)}
.nav-details-heading{display:flex;align-items:center;gap:8px;min-width:0}
.nav-details-heading .nav-details-destination{flex:1;min-width:0}
.nav-details-label[hidden]{display:none}
.nav-details-stops{margin:0;padding-left:22px}
.nav-details-stops li{overflow-wrap:anywhere}
.nav-details .nav-details-toll{font-size:12px}
.nav-fine{font-size:12px;line-height:1.4;color:#698177}
.nav-browse{display:flex;gap:8px;margin-bottom:2px}
.nav-browse[hidden],.nav-browse [hidden]{display:none}
.nav-browse button{flex:1 1 0;min-width:0;min-height:44px;padding:0 10px;border:1px solid #dfe5e1;border-radius:10px;background:#fff;color:var(--green);font:inherit;font-size:14px;font-weight:700}
.nav-browse button:hover{background:#eef4ef}
.nav-browse button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.nav-live{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* While a report is being placed, guidance shrinks to the live top card only (no trip bar or
   actions). Reports reads .is-reporting-guide to keep its pin clear of it. */
.route-panel.is-reporting-guide{max-height:none;padding:6px}
.route-panel.is-reporting-guide .route-head,
.route-panel.is-reporting-guide .route-status,
.route-panel.is-reporting-guide .nav-trip,
.route-panel.is-reporting-guide .nav-meta,
.route-panel.is-reporting-guide .nav-actions,
.route-panel.is-reporting-guide .nav-details,
.route-panel.is-reporting-guide .nav-fine{display:none}
.route-panel.is-reporting-guide .route-summary-row,.route-panel.is-reporting-guide .route-facts,.route-panel.is-reporting-guide .route-toll-detail{display:none}
.route-panel.is-reporting-guide .nav-guide{gap:4px}
.route-panel.is-reporting-guide .nav-card{border-radius:14px}
.route-panel.is-reporting-guide .nav-maneuver{padding:6px 10px;gap:10px}
.route-panel.is-reporting-guide .nav-arrow{width:36px;height:36px;font-size:24px}
.route-panel.is-reporting-guide .nav-distance{font-size:18px}
.route-panel.is-reporting-guide .nav-instruction{font-size:13px}
.route-panel.is-reporting-guide .nav-street{display:none}
.route-panel.is-reporting-guide .nav-notice{padding:5px 10px}
.route-panel.is-reporting-guide .nav-signal{top:3px;right:4px;padding:0}
.route-panel.is-reporting-guide .nav-signal-help{display:none}
/* The start choice waits (state kept, any update request continues) until reporting ends. */
.route-panel.is-reporting-guide .nav-origin-detail,.route-panel.is-reporting-guide .nav-origin-context,.route-panel.is-reporting-guide .nav-origin-actions{display:none}
.route-panel.is-reporting-guide .nav-origin{padding:6px 10px}
.route-panel.is-reporting-guide .nav-origin-title{margin:0;font-size:13px}
/* The reporting strip keeps its height: no Then card, and the turn does not open All turns. */
.route-panel.is-reporting-guide .nav-then{display:none}
.route-panel.is-reporting-guide button.nav-maneuver{cursor:default}

/* Keep the attribution readable above the panel on every viewport. */
.maplibregl-ctrl-bottom-right{z-index:4}

/* ---- Phone geometry (portrait, and anything narrower than 480px) ---- */
.route-panel{top:auto;left:0;right:0;bottom:var(--route-keyboard,0px);width:auto;max-width:none;
  max-height:min(60dvh,calc(100dvh - var(--route-keyboard,0px) - var(--stack-top) - 8px));
  padding:8px max(14px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
  border-width:1px 0 0;border-radius:20px 20px 0 0;box-shadow:0 -8px 28px #163d3322}
.route-head h2{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.route-view-toggle{margin-left:auto}
.route-view-toggle[hidden]+.route-icon-button{margin-left:auto}
.route-fields{margin-top:6px}
.route-dropdown{max-height:min(200px,30dvh)}

@media (max-width:759px) and (min-height:481px),(max-width:479px){
  /* Editing needs room for both endpoints and stops even with a valid preview below.
     The compact 60dvh sheet is for the route overview, not a tiny scrolling form. */
  .route-panel:not(.is-collapsed):not(.is-navigating):not(.is-picking):not(.is-options){
    max-height:min(85dvh,calc(100dvh - var(--route-keyboard,0px) - var(--stack-top) - 8px),calc(100dvh - 228px));
  }
  /* The expanded editor leaves too little map for floating controls; its origin
     button and the top Settings control remain available. Guidance keeps Actions. */
  main:has(.route-panel:not([hidden]):not(.is-collapsed):not(.is-navigating):not(.is-picking):not(.is-options)) > #map-actions,
  main:has(.route-panel:not([hidden]):not(.is-collapsed):not(.is-navigating):not(.is-picking):not(.is-options)) > .bottom-tools{display:none}
  .route-panel:not(.is-collapsed):not(.is-navigating):not(.is-picking):not(.is-options) .route-result{display:none}
  /* Pin picking: the sheet shrinks to the pick bar (and any status) so the map is free. */
  .route-panel.is-picking>:not(.route-pick-bar):not(.route-status){display:none}
  .route-panel.is-picking .route-pick-bar{margin-top:0}
  .route-pick-bar button{flex:1 1 auto}

  /* Floating map buttons stay above the sheet / trip footer. */
  main:has(.route-panel:not([hidden])) .gesture-hint{display:none}
  main:has(.route-panel:not([hidden])) .bottom-tools{bottom:calc(var(--route-bottom-inset,0px) + 40px)}
  main:has(.route-panel:not([hidden])) .report-fab{bottom:calc(var(--route-bottom-inset,0px) + 36px)}
  main:has(.route-panel:not([hidden])) #map-controls{top:auto;bottom:calc(var(--route-bottom-inset,0px) + 100px)}
  main:has(.route-panel:not([hidden]):not(.is-collapsed):not(.is-navigating)) #map-controls .maplibregl-ctrl-group{display:block}
  main:has(.route-panel:not([hidden]):not(.is-collapsed):not(.is-navigating)) .bottom-tools #home{display:none}
  main:has(.route-panel:not([hidden])) .notice{bottom:calc(var(--route-bottom-inset,0px) + 110px)}
  main:has(.route-panel:not([hidden])) .maplibregl-ctrl-bottom-left{bottom:calc(var(--route-bottom-inset,0px) + 4px)}
  main:not(.is-reporting):has(.route-panel:not([hidden])) .maplibregl-ctrl-bottom-right{bottom:calc(var(--route-bottom-inset,0px) + 4px)}

  /* Guidance: one top card, a compact trip bar at the bottom, map in between.
     The panel box is the top card only, so its bounds stay accurate for reports. */
  .route-panel.is-navigating{top:var(--stack-top);bottom:auto;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));
    display:block;max-height:none;overflow:visible;padding:0;background:none;border:0;border-radius:0;box-shadow:none}
  .route-panel.is-navigating .route-head{display:none}
  .route-panel.is-navigating .route-status:not(:empty){padding:6px 10px;border-radius:10px;background:#fff;box-shadow:var(--shadow)}
  .route-panel.is-navigating .nav-guide{gap:6px}
  .route-panel.is-navigating .nav-card{box-shadow:0 6px 18px #063c2e33,0 0 0 1px #063c2e14}
  /* Then floats over the map just below the card, content-width, so the map stays visible beside it. */
  .route-panel.is-navigating .nav-then{box-shadow:0 3px 10px #063c2e26,0 0 0 1px #063c2e14}
  /* Default height: estimate + one line + one 44px action row. Details grow it upward, capped. */
  .route-panel.is-navigating .nav-trip{position:fixed;z-index:3;left:0;right:0;bottom:0;gap:8px;
    padding:12px max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    background:#fff;border-radius:18px 18px 0 0;box-shadow:0 -6px 24px #163d3326}
  .route-panel.is-reporting-guide{padding:0}
  .route-panel.is-reporting-guide .nav-trip{display:none}
  main:has(.route-panel.is-navigating) .bottom-tools #home{display:none}
  /* Shared location and view controls remain available beside Trip details. */
}
@media (max-width:600px) and (min-height:481px){
  /* Reporting during guidance: attribution sits just below the next-turn card. */
  main.is-reporting:has(.route-panel.is-reporting-guide) .maplibregl-ctrl-bottom-right{top:calc(var(--report-guidance-bottom,72px) + 6px);bottom:auto}
}

/* ---- Side layout: tablets/desktops and landscape phones. Same states, full available height. ---- */
@media (min-width:760px),(max-height:480px) and (min-width:480px){
  main{--route-side-w:360px}
  .route-panel{top:var(--stack-top);bottom:auto;left:max(24px,env(safe-area-inset-left));right:auto;width:var(--route-side-w);max-width:calc(100% - 120px);
    max-height:calc(100dvh - var(--stack-top) - 16px);padding:12px;border:1px solid #dfe5e1;border-radius:16px;box-shadow:var(--shadow)}
  .route-panel.is-navigating{overflow:auto}
  .route-panel.is-reporting-guide{overflow:visible}
  main:has(.route-panel:not([hidden])) .bottom-tools{left:calc(max(24px,env(safe-area-inset-left)) + var(--route-side-w) + 16px)}
}
@media (min-width:1100px){
  main{--route-side-w:380px}
  .route-head h2{position:static;flex:1;width:auto;height:auto;margin:0;clip:auto}
  .route-view-toggle{margin-left:0}
  .route-view-toggle[hidden]+.route-icon-button{margin-left:0}
  .route-mode{min-width:56px}
}

@media (max-height:560px){
  .nav-maneuver{padding:6px 10px;gap:10px}
  .nav-arrow{width:40px;height:40px;font-size:26px}
  .nav-distance{font-size:20px}
  .nav-guide{gap:6px}
  .nav-then{min-height:32px;padding:2px 10px 2px 6px}
  .nav-then-arrow{width:24px;height:24px;font-size:16px}
  .nav-origin{gap:8px;padding:10px 12px}
  .nav-origin-actions button{min-height:44px}
  .nav-details{max-height:min(34dvh,300px)}
}
/* Landscape phone: compact side card; while reporting, the next-turn card shares the
   screen with the 264px reports card on the right. */
@media (max-height:480px) and (min-width:480px){
  main{--route-side-w:min(340px,48vw)}
  .route-panel{left:max(8px,env(safe-area-inset-left));max-height:calc(100dvh - var(--stack-top) - 8px);padding:10px}
  .route-panel.is-navigating .route-head{display:none}
  .route-panel.is-reporting-guide{top:8px;left:max(8px,env(safe-area-inset-left));width:calc(100% - 296px);max-width:none}
}
@media (prefers-reduced-motion:reduce){
  .nav-guide *{transition:none!important;animation:none!important}
}

/* Location actions live with their field; Add stop owns its row. */
.route-current,.route-undo{display:grid;place-items:center;flex:none;width:44px;height:44px;padding:10px;border:0;border-radius:9px;background:transparent;color:var(--green)}
.route-current svg,.route-undo svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.route-current:disabled,.route-undo:disabled{opacity:.3;cursor:default}
.route-current:focus-visible,.route-undo:focus-visible{outline:2px solid var(--green);outline-offset:-2px}
.nav-tools .route-add-stop{flex:0 0 100%;width:100%}

/* Full directions keep long instruction lists out of the compact route card. */
.route-directions-sheet{box-sizing:border-box;width:100%;max-width:560px;max-height:85dvh;margin:auto auto 0;padding:16px;border:0;border-radius:20px 20px 0 0;color:#063f31;background:#fff;box-shadow:0 0 30px #0003;overflow:hidden}
.route-directions-sheet[open]{display:flex;flex-direction:column}
.route-directions-sheet::backdrop{background:#0005}
.route-directions-sheet header{display:flex;align-items:center;justify-content:space-between;flex:none}
.route-directions-sheet h2{margin:0;font-size:20px}
.directions-dismiss{width:44px;height:44px;border:0;border-radius:10px;background:#edf4ef;color:inherit;font-size:26px}
.directions-summary{margin:4px 0 12px;font-size:14px;flex:none}
.directions-tabs{display:flex;gap:8px;margin-bottom:12px;flex:none}
.directions-tabs[hidden]{display:none}
.directions-tabs button{flex:1;min-height:44px;border:1px solid #dfe5e1;border-radius:10px;background:white;color:inherit;font:inherit;font-weight:650}
.directions-tabs button[aria-pressed=true]{background:#063f31;color:#fff}
.directions-tabs button[hidden]{display:none}
.directions-content{min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 2px 8px}
.directions-turns{margin:0;padding:0;list-style:none}
.directions-turns li{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid #edf0ed}
.directions-turn-icon{width:30px;flex:none;font-size:25px;text-align:center}
.directions-turns li div{min-width:0;display:grid;gap:4px;overflow-wrap:anywhere}
.directions-turns strong{font-size:15px;font-weight:600}
.directions-turns li[aria-current="step"]{background:#edf4ef;border-radius:10px;box-shadow:inset 3px 0 #064e3b;padding-left:10px;padding-right:8px}
.directions-turns .directions-current-label{font-size:12px;font-weight:700;color:#064e3b}
.directions-current-label[hidden]{display:none}
.directions-turns span,.directions-turns small{color:#4e6f61}
.directions-route{display:grid;gap:6px;width:100%;min-height:80px;margin:0 0 10px;padding:12px;border:1px solid #dfe5e1;border-radius:12px;background:#fff;color:inherit;font:inherit;text-align:left}
.directions-route[aria-pressed=true]{border:2px solid #063f31;background:#edf4ef}
.directions-single{font-size:14px;line-height:1.45}
@media(min-width:760px){.route-directions-sheet{margin:auto;border-radius:20px;width:min(560px,90vw)}}

.directions-live{flex:none;margin:4px 0 8px;padding:10px;border-radius:10px;background:#edf4ef;font-weight:600;font-size:14px}.directions-live[hidden]{display:none}
.directions-keep,.directions-refresh{min-height:44px;margin:0 6px 10px 0;padding:0 10px;border:1px solid #dfe5e1;border-radius:10px;background:white;color:inherit;font:inherit;font-size:14px}

@media(max-height:480px){
  .route-directions-sheet{max-height:calc(100dvh - 8px);margin:4px auto;padding:8px 12px}
  .route-directions-sheet .directions-live{margin:2px 0;padding:4px 8px;font-size:13px;line-height:1.3}
  .directions-summary{margin:2px 0 6px;font-size:13px}
  .directions-tabs{margin-bottom:4px}
  .directions-turns li{padding-top:10px;padding-bottom:10px}
}


.report-info{vertical-align:middle;margin-left:4px}

/* Whole-route toll summary remains available without opening Trip details. */
.nav-toll-summary { min-height:44px; width:100%; padding:6px 10px; border:1px solid #dce7e1; border-radius:10px; background:#f3f7f4; color:var(--green); font:inherit; font-size:13px; text-align:left; overflow-wrap:anywhere; }
.nav-toll-summary[hidden] { display:none; }
.nav-toll-summary:focus-visible { outline:2px solid var(--green); outline-offset:2px; }
.nav-trip-context .nav-toll-summary{flex:0 1 auto;width:auto;max-width:65%;padding:0 4px;border:0;background:none;font-size:12px;text-align:right;line-height:1.35}
.toll-dialog-content .toll-overview { font-weight:700; margin:0 0 .35rem; }

/* Trip details owns the phone footer; do not lift floating actions over the turn/report cards. */
@media(max-width:759px) and (min-height:481px){
  main:has(.nav-trip.is-details-open) #map-actions{display:none}
}

/* Three primary modes keep Close reachable even in a 320px editor. */
.route-head { display:grid; grid-template-columns:minmax(0,1fr) 44px; align-items:center; gap:6px; }
.route-head h2 { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.route-head .route-modes { grid-column:1; grid-row:1; width:100%; min-width:0; }
.route-head #route-close { grid-column:2; grid-row:1; margin-left:0; justify-self:end; }
.route-head .route-view-toggle { grid-column:1 / -1; grid-row:2; margin-left:0; justify-self:end; }

/* Local Hugeicons: one shared decorative mode family across journey surfaces. */
.mode-icon { display:inline-block; width:18px; height:18px; flex-shrink:0; vertical-align:-3px; color:currentColor; stroke-width:1.5; }
.route-mode .mode-icon { width:20px; height:20px; stroke-width:1.5; }
.route-submode .mode-icon { width:18px; height:18px; stroke-width:1.5; }
.route-sum-mode,.route-choice strong,.directions-summary,.directions-route strong,.nav-details-destination,.route-restore-detail { display:inline-flex; align-items:center; gap:6px; }
/* The mode picker already names the mode; retain it in the estimate for screen readers. */
#route-summary .route-sum-mode{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.nav-details-toggle .mode-icon,.nav-remaining > .mode-icon { margin-right:6px; }
.route-restore-detail .mode-label { min-width:0; }

/* Responsive journey layout. Portrait tablets use a bottom planner; landscape
   tablets/desktop keep a side planner. Guidance and trip progress are separated. */
main[data-map-layout="tablet-portrait"] .route-panel:not(.is-navigating) {
  top:auto; bottom:var(--route-keyboard,0px); left:0; right:0; width:auto; max-width:none;
  max-height:min(65dvh,calc(100dvh - var(--stack-top) - 8px));
  border-width:1px 0 0; border-radius:20px 20px 0 0;
  padding:12px max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
}
main[data-map-layout="tablet-portrait"]:has(.route-panel:not([hidden]):not(.is-navigating)) > #map-actions {
  bottom:calc(var(--route-bottom-inset,0px) + 12px);
}
main[data-map-layout="tablet-portrait"] .place-card {
  left:12px; right:12px; width:auto; max-width:none;
}
main[data-map-layout="tablet-portrait"] > #map-controls {
  top:auto; bottom:calc(var(--map-control-floor,100px));
}
main:is([data-map-layout="wide"],[data-map-layout="tablet-portrait"]) .route-panel.is-navigating {
  top:max(12px,env(safe-area-inset-top)); left:max(12px,env(safe-area-inset-left)); right:auto;
  width:min(420px,calc(100vw - 90px)); max-width:none; max-height:none;
  overflow:visible; padding:0; border:0; background:none; box-shadow:none;
}
main:is([data-map-layout="wide"],[data-map-layout="tablet-portrait"]) .route-panel.is-navigating .nav-trip {
  position:fixed; z-index:4; left:50%; right:auto; transform:translateX(-50%);
  bottom:max(16px,env(safe-area-inset-bottom)); width:min(560px,calc(100vw - 160px));
  max-height:min(50dvh,400px); overflow:auto; padding:12px 16px;
  border-radius:18px; background:#fff; box-shadow:0 3px 20px #163d3333;
}
main:is([data-map-layout="wide"],[data-map-layout="tablet-portrait"]) .route-panel.is-navigating .nav-then { margin-top:8px; }
main:is([data-map-layout="wide"],[data-map-layout="tablet-portrait"]) .route-panel.is-reporting-guide .nav-trip { display:none; }
main[data-map-layout="phone-landscape"] .route-panel {
  left:max(12px,env(safe-area-inset-left)); width:min(340px,44vw); max-width:none;
}
main[data-map-layout="phone-landscape"] .route-panel.is-navigating {
  top:max(8px,env(safe-area-inset-top)); bottom:max(8px,env(safe-area-inset-bottom));
  max-height:none; padding:0; border:0; background:transparent; box-shadow:none; overflow:auto;
}
main[data-map-layout="phone-landscape"] .nav-card { flex:none; }
main[data-map-layout="phone-landscape"] .nav-trip { padding:8px; background:#fff; border-radius:14px; }
main[data-map-layout="phone-landscape"] .nav-actions { gap:6px; }
main[data-map-layout="phone-landscape"] .nav-actions > button:not(.voice-control) { padding:2px 6px; font-size:13px; }
/* Expanded details are scrollable on short phones rather than removing Report
   or pushing the remaining core controls behind the maneuver card. */
main[data-map-layout="phone-portrait"] .nav-trip.is-details-open {
  max-height:max(200px,calc(100dvh - 368px)); overflow:auto;
}
main[data-map-layout="phone-portrait"] .nav-trip.is-details-open .nav-actions {
  position:sticky; top:0; z-index:1; background:#fff;
}
main[data-map-layout="phone-portrait"]:not(.is-reporting):has(.nav-trip.is-details-open) > #map-actions:not([hidden]) {
  display:block; bottom:calc(var(--route-bottom-inset,0px) + 12px);
}
