/* KurvenKlar canonical mobile design system — 2026-07-16 */
:root {
  color-scheme: dark;
  --bg: #04070B;
  --graphite: #07090E;
  --surface: #0A1018;
  --surface-strong: #0D131D;
  --orange: #FF6B13;
  --orange-hi: #FF8A1D;
  --text: #F8FAFC;
  --muted: #A5AFBD;
  --success: #47C76B;
  --info: #2F8CFF;
  --danger: #EF4444;
  --warning: #F59E0B;
  --line: rgba(255, 255, 255, .12);
  --line-soft: rgba(255, 255, 255, .075);
  --glass: rgba(10, 16, 24, .92);
  --shadow: 0 22px 64px rgba(0, 0, 0, .52);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 28px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, a { -webkit-user-select: none; user-select: none; }
h1, h2, h3, h4, p { margin: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(255, 138, 29, .72); outline-offset: 2px;
}
.is-hidden, [hidden] { display: none; }

/* Shared controls */
label { display: grid; gap: 7px; min-width: 0; }
label > span, .range-field > label, .range-block span {
  color: #D7DEE8; font-size: .8rem; font-weight: 750; line-height: 1.2;
}
input, select, textarea {
  width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; color: var(--text); background: #080D15; outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7F8998; }
input:focus, select:focus, textarea:focus { border-color: var(--orange-hi); box-shadow: 0 0 0 4px rgba(255, 107, 19, .13); }
button { min-height: 44px; cursor: pointer; }
button:disabled { opacity: .42; cursor: not-allowed; }
.primary, .nav-start, .secondary, .ghost-mini, .map-btn, .social-login {
  border-radius: 16px; padding: 12px 14px; border: 1px solid var(--line); color: var(--text); font-weight: 800;
}
.primary, .nav-start {
  border-color: transparent; background: linear-gradient(135deg, var(--orange-hi), var(--orange));
  box-shadow: 0 14px 30px rgba(255, 107, 19, .24);
}
.secondary, .ghost-mini, .map-btn { background: rgba(255, 255, 255, .055); }
.big-submit { min-height: 54px; font-size: 1rem; }
.ghost-mini { min-height: 38px; padding: 8px 10px; border-radius: 999px; }
.button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.eyebrow { color: var(--orange-hi); font-size: .68rem; line-height: 1; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.menu-note, .subtitle, .field-note, .route-mode-note { color: var(--muted); line-height: 1.45; }
.sub-divider { height: 1px; background: var(--line-soft); }

/* Map base */
.app-shell { width: 100%; height: 100dvh; }
.map-wrap { position: relative; width: 100%; height: 100dvh; overflow: hidden; background: #243039; isolation: isolate; }
#map { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; background: #243039; }
.map-wrap::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 7, 11, .32), transparent 30%, transparent 58%, rgba(4, 7, 11, .45));
}
.leaflet-container { width: 100%; height: 100%; background: #243039; font: inherit; }
.leaflet-tile { filter: saturate(.95) contrast(1.02) brightness(.9); }
.leaflet-container .leaflet-control-attribution { max-width: 250px; padding: 4px 7px; border-radius: 0 0 0 8px; background: rgba(4, 7, 11, .78); color: rgba(248, 250, 252, .78); font-size: 10px; line-height: 1.25; text-align: right; white-space: normal; }
.leaflet-control-attribution a { color: #E5EDF7; }
.leaflet-control-zoom { border: 0; box-shadow: var(--shadow); }
.leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; color: var(--text); background: rgba(10, 16, 24, .9); border-color: var(--line); }
.leaflet-popup-content { min-width: 220px; color: #0B1118; line-height: 1.4; }
.leaflet-popup-content a { color: #1268FF; font-weight: 800; }
.stop-marker span, .traffic-marker span {
  display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid #FFF; border-radius: 50%;
  color: #111827; background: #FFF; box-shadow: 0 9px 24px rgba(0, 0, 0, .38);
}
.traffic-marker span { color: #FFF; background: var(--danger); }
.photo-marker span { position: relative; display: block; width: 42px; height: 42px; overflow: hidden; border: 2px solid #FFF; border-radius: 50%; background: var(--surface-strong); }
.photo-marker img { width: 100%; height: 100%; object-fit: cover; }
.photo-marker i { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: #FFF; background: var(--orange); font-size: 11px; font-style: normal; }
.user-dot { width: 20px; height: 20px; border: 3px solid #FFF; border-radius: 50%; background: var(--info); box-shadow: 0 0 0 8px rgba(47, 140, 255, .23); }
.user-arrow { display: grid; place-items: center; width: 34px; height: 34px; transform: rotate(var(--heading)); filter: drop-shadow(0 6px 9px rgba(0, 0, 0, .38)); }
.user-arrow span { width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 29px solid var(--info); }
.user-arrow span::after { content: ""; position: absolute; width: 8px; height: 8px; margin: 13px 0 0 -4px; border-radius: 50%; background: #FFF; }
body.light-map .leaflet-tile { filter: saturate(.8) contrast(1.08) brightness(1.08); }
body.is-offline .map-status { color: #FFE1E1; border-color: rgba(239, 68, 68, .48); background: rgba(83, 18, 18, .9); }
.home-card { position: absolute; z-index: 640; left: 50%; bottom: calc(var(--safe-bottom) + 22px); transform: translateX(-50%); width: min(520px, calc(100% - 28px)); padding: 15px; border: 1px solid rgba(255,107,26,.38); border-radius: var(--radius-xl); background: rgba(7,9,14,.94); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.route-ready .home-card, .is-navigation .home-card { display: none; }
.home-weather { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.weather-symbol { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 44px; border-radius: 14px; background: var(--orange-soft); color: var(--orange); font-size: 24px; }
.home-weather small, .home-weather strong, .home-weather div > span { display: block; }
.home-weather small { color: var(--orange); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.home-weather strong { margin: 2px 0; font-size: 17px; }
.home-weather div > span { color: var(--muted); font-size: 12px; }
.home-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; }
.home-actions button { margin: 0; min-height: 50px; }
.map-wrap:not(.route-ready) .map-status { bottom: calc(184px + var(--safe-bottom)); }
@media (max-width: 880px) {
  .leaflet-control-zoom { display: none; }
  .leaflet-top.leaflet-right { top: 68px; }
}

/* Top bar */
.mobile-topbar {
  position: fixed; z-index: 80; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  height: calc(58px + var(--safe-top)); padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  border-bottom: 1px solid var(--line-soft); background: rgba(4, 7, 11, .9); backdrop-filter: blur(18px);
}
.top-icon, .close-mobile {
  display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line);
  border-radius: 15px; color: var(--orange-hi); background: rgba(255, 255, 255, .06); font-weight: 900;
}
.top-icon.plan-icon { font-size: 1.25rem; }
.top-brand, .brand-lockup, .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-brand > div { min-width: 0; }
.top-brand strong { display: block; letter-spacing: -.035em; }
.top-brand strong span { color: var(--orange-hi); }
.top-brand small { display: block; max-width: 48vw; overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 22px rgba(0, 0, 0, .38); }
.brand-logo.large, .brand-logo.planner-logo { width: 50px; height: 50px; border-radius: 17px; }

/* Overlay foundations */
.side-menu, .route-planner {
  position: fixed; z-index: 95; color: var(--text); background: linear-gradient(180deg, #090E16, var(--bg)); box-shadow: var(--shadow);
}
.scrim { display: none; position: fixed; z-index: 88; inset: 0; background: rgba(0, 0, 0, .48); backdrop-filter: blur(2px); }
.scrim.show { display: block; }

/* Menu / domain screens */
.side-menu {
  top: 0; bottom: 0; left: 0; width: min(390px, 92vw); padding: calc(16px + var(--safe-top)) 15px calc(18px + var(--safe-bottom));
  overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); transform: translateX(-105%); transition: transform .22s ease;
}
body.menu-open .side-menu { transform: translateX(0); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.side-head h2 { margin-top: 3px; font-size: 1.38rem; letter-spacing: -.035em; }
.side-head small { color: var(--muted); }
.drawer-hub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.drawer-tile {
  display: grid; grid-template-columns: 38px 1fr; grid-template-areas: "icon title" "icon sub"; align-items: center; column-gap: 10px;
  min-height: 72px; padding: 11px; text-align: left; color: var(--text); border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .045);
}
.drawer-tile > span { grid-area: icon; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; background: rgba(255, 107, 19, .13); }
.drawer-tile strong { grid-area: title; }
.drawer-tile small { grid-area: sub; color: var(--muted); font-size: .75rem; }
.drawer-tile.active { border-color: rgba(255, 107, 19, .62); background: rgba(255, 107, 19, .12); }
.side-menu.panel-open .drawer-hub { position: sticky; z-index: 4; top: calc(-16px - var(--safe-top)); grid-template-columns: repeat(6, 48px); gap: 6px; overflow-x: auto; padding: calc(8px + var(--safe-top)) 0 8px; background: linear-gradient(180deg, #090E16 78%, transparent); scrollbar-width: none; }
.side-menu.panel-open .drawer-hub::-webkit-scrollbar { display: none; }
.side-menu.panel-open .drawer-tile { grid-template-columns: 1fr; grid-template-areas: "icon"; place-items: center; min-width: 48px; min-height: 48px; padding: 5px; }
.side-menu.panel-open .drawer-tile strong, .side-menu.panel-open .drawer-tile small { display: none; }
.side-menu.panel-open .drawer-tile > span { width: 36px; height: 36px; }
.drawer-panel { display: none; }
.drawer-panel.active { display: grid; }
.menu-card {
  gap: 11px; margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong);
}
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-title h3 { margin-top: 4px; font-size: 1.2rem; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 16px; background: rgba(255, 255, 255, .03); }
.toggle-row > div { min-width: 0; }
.toggle-row strong { display: block; }
.toggle-row small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.3; }
.switch { position: relative; display: block; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #384252; transition: background .18s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFF; transition: transform .18s; }
.switch input:checked + span { background: var(--orange); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid rgba(255, 138, 29, .7); outline-offset: 2px; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .045); }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label { display: grid; place-items: center; min-height: 42px; padding: 8px; border-radius: 12px; color: var(--muted); font-weight: 800; text-align: center; }
.segmented input:checked + label { color: #FFF; background: linear-gradient(135deg, var(--orange-hi), var(--orange)); }
.segmented input:focus-visible + label { outline: 3px solid rgba(255, 138, 29, .7); }
.profile-impact, .utility-result, .analysis-box, .auth-user { padding: 12px; border: 1px solid rgba(47, 140, 255, .28); border-radius: 16px; background: rgba(47, 140, 255, .09); }
.profile-impact strong, .profile-impact small { display: block; }
.profile-impact small { margin-top: 4px; color: #BED6FF; }
.auth-form, .auth-user { display: grid; gap: 10px; }
#authStatus, #profileStatus, #rideStatus, #groupStatus, #packlistStatus { min-height: 18px; color: #BED6FF; }
.ride-grid, .metrics, .dashboard-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ride-grid > div, .metrics > div, .dashboard-metrics > div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 15px; background: rgba(255, 255, 255, .04); }
.ride-grid span, .metrics span, .dashboard-metrics span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.ride-grid strong, .metrics strong, .dashboard-metrics strong { display: block; margin-top: 4px; }
.compact-list, .saved-routes-list { display: grid; gap: 8px; }
.compact-list article, .saved-routes-list article { padding: 9px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255, 255, 255, .035); }
.compact-list button, .saved-routes-list button { width: 100%; text-align: left; color: var(--text); border: 0; background: transparent; }
.compact-list small, .saved-routes-list small { display: block; margin-top: 4px; color: var(--muted); }
.profile-avatar-row, .profile-search-result { display: flex; align-items: center; gap: 12px; }
.profile-avatar { width: 72px; height: 72px; flex: 0 0 72px; border: 2px solid var(--accent); border-radius: 50%; object-fit: cover; background: var(--surface-strong); }
.profile-avatar.small { width: 46px; height: 46px; flex-basis: 46px; border-width: 1px; }
.profile-search-result > span { min-width: 0; flex: 1; }
.profile-search-result .ghost-mini { width: auto; min-width: 88px; text-align: center; }
.support-attachment { width: 100%; max-height: 220px; margin-bottom: 9px; border-radius: 12px; object-fit: contain; background: #05070b; }
.public-profile-editor { display: grid; gap: 10px; }
.public-profile-editor.is-hidden { display: none; }

/* Tour tools */
.utility-center { gap: 12px; }
.utility-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.utility-tabs button { display: grid; place-items: center; gap: 3px; min-height: 60px; padding: 7px 3px; color: var(--text); border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, .04); }
.utility-tabs button small { color: var(--muted); font-size: .61rem; }
.utility-tabs button.active { color: #FFC08C; border-color: rgba(255, 107, 19, .62); background: rgba(255, 107, 19, .13); }
.utility-view { display: none; gap: 10px; }
.utility-view.active { display: grid; }
.utility-view h4 { font-size: 1.05rem; }
.utility-result { display: grid; gap: 3px; border-color: rgba(255, 107, 19, .3); background: rgba(255, 107, 19, .09); }
.utility-result > strong { color: #FFD0AC; font-size: 1.35rem; }
.utility-result small { color: var(--muted); }
.check-list { display: grid; gap: 7px; max-height: 36dvh; overflow-y: auto; }
.check-list label { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 9px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(255, 255, 255, .03); }
.check-list input { width: 21px; min-height: 21px; height: 21px; accent-color: var(--orange); }
.check-list label.done { opacity: .55; text-decoration: line-through; }
.pack-category { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 15px; background: rgba(255,255,255,.018); }
.pack-category-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 3px; }
.pack-category-head small { color: var(--muted); }
.sub-divider { height: 1px; margin: 7px 0; background: var(--line-soft); }
.mini-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.mini-actions button { min-height: 40px; border: 1px solid var(--line); border-radius: 11px; }
.participant-legend { display: grid; gap: 7px; }
.participant-legend > div { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 12px; }
.participant-legend i { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid #fff; border-radius: 50%; background: var(--participant-color); }
.participant-legend span, .participant-legend small { display: block; }
.spot-list-image { width: 100%; max-height: 150px; margin-bottom: 8px; border-radius: 10px; object-fit: cover; }
.spot-gallery figure { margin: 0; }
.spot-gallery figcaption { max-width: 150px; color: var(--muted); font-size: .58rem; line-height: 1.25; }
.safety-banner { padding: 12px; border: 1px solid rgba(239, 68, 68, .38); border-radius: 15px; background: rgba(127, 29, 29, .28); }
.safety-banner a { color: #FFD0D0; }

/* Planner screens */
.route-planner {
  top: 0; bottom: 0; left: 0; width: min(440px, 92vw); overflow-y: auto; overscroll-behavior: contain;
  padding: calc(18px + var(--safe-top)) 18px calc(22px + var(--safe-bottom)); border-right: 1px solid var(--line);
  transform: translateX(-108%); transition: transform .22s ease;
}
.route-planner.open { transform: translateX(0); }
.panel-handle { display: none; }
.brand { position: sticky; z-index: 3; top: calc(-18px - var(--safe-top)); padding: calc(12px + var(--safe-top)) 0 10px; background: linear-gradient(180deg, #090E16 78%, transparent); }
.brand > div { flex: 1; }
.brand h1 { font-size: 1.55rem; letter-spacing: -.04em; }
.subtitle { margin: 5px 0 14px; font-size: .9rem; }
.controls { display: grid; gap: 10px; }
.planner-progress { position: sticky; top: -1px; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7, 9, 14, .96); backdrop-filter: blur(14px); }
.planner-progress button { min-width: 0; min-height: 48px; padding: 5px 2px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; }
.planner-progress button span { display: grid; place-items: center; width: 24px; height: 24px; margin: 0 auto 2px; border-radius: 8px; color: var(--text); background: var(--surface-2); font-weight: 900; }
.planner-progress button small { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
.planner-progress button[aria-current="step"] { color: var(--text); background: var(--orange-soft); }
.planner-progress button[aria-current="step"] span { color: #FFF; background: var(--orange); }
.form-section { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); }
.planner-step { min-width: 0; max-width: 100%; }
.planner-step:not(.active) { display: none; }
.planner-step-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 3px; }
.planner-step-actions > :only-child { grid-column: 1 / -1; }
#routeForm:not([data-step="4"]) > .big-submit,
#routeForm:not([data-step="4"]) > .action-grid { display: none; }
.hero-section { border-color: rgba(255, 107, 19, .28); }
.section-head { display: flex; align-items: flex-start; gap: 10px; }
.section-head h2 { font-size: 1rem; }
.section-head small { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; line-height: 1.3; }
.step-badge { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 10px; color: #FFF; background: linear-gradient(135deg, var(--orange-hi), var(--orange)); font-weight: 900; }
.inline-location { width: 100%; border-style: dashed; color: #CFE1FF; background: rgba(47, 140, 255, .08); }
.round-card, .lodging-options, .profile-options, .advanced-options, .priority-picker, .range-block { display: grid; gap: 10px; padding: 11px; border: 1px solid var(--line-soft); border-radius: 17px; background: rgba(255, 255, 255, .03); }
.advanced-options summary { min-height: 44px; display: flex; align-items: center; color: #FFD0AC; font-weight: 800; cursor: pointer; }
.priority-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.picker-head { grid-column: 1 / -1; }
.picker-head small { display: block; margin-top: 3px; color: var(--muted); }
.priority-picker label { position: relative; display: flex; align-items: center; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 14px; color: var(--muted); background: rgba(255, 255, 255, .025); }
.priority-picker label.active { color: var(--text); border-color: rgba(255, 107, 19, .5); background: rgba(255, 107, 19, .1); }
.priority-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.priority-picker label.active::after { content: var(--order-label); margin-left: auto; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #FFF; background: var(--orange); font-size: .72rem; font-weight: 900; }
.stop-fieldset { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 0; padding: 10px; border: 1px solid var(--line-soft); border-radius: 15px; }
.stop-fieldset legend { color: #D7DEE8; font-size: .8rem; font-weight: 800; }
.stop-fieldset label { display: flex; align-items: center; min-height: 42px; color: var(--text); font-size: .84rem; }
.stop-fieldset input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--orange); }
.range-block { margin: 0; }
.range-block > div { display: flex; justify-content: space-between; }
.range-block input[type="range"] { min-height: 28px; padding: 0; accent-color: var(--orange); }
.result-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); }
.status-pill { justify-self: start; padding: 6px 9px; border-radius: 999px; color: #A9F0BB; background: rgba(71, 199, 107, .13); font-size: .72rem; font-weight: 900; }
.result-card p { color: var(--muted); line-height: 1.4; }
.engine-note { padding: 9px; border: 1px solid rgba(47, 140, 255, .24); border-radius: 12px; background: rgba(47, 140, 255, .08); }
.safety-note { color: #FFE0A6; }
.action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Map status and bottom navigation */
.map-status, .map-action-bar, .nav-card, .dashboard-sheet, .calculation-sheet, .candidate-dock, .trip-sheet, .reroute-banner { position: absolute; z-index: 35; }
.map-status { left: 50%; bottom: calc(18px + var(--safe-bottom)); max-width: calc(100vw - 24px); padding: 9px 12px; transform: translateX(-50%); overflow: hidden; border: 1px solid var(--line); border-radius: 999px; color: #DCE7F5; background: rgba(4, 7, 11, .82); box-shadow: var(--shadow); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.map-action-bar { display: none; left: 12px; right: 12px; bottom: calc(9px + var(--safe-bottom)); grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; height: 66px; padding: 6px; border: 1px solid var(--line); border-radius: 24px; background: rgba(4, 7, 11, .88); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.route-ready .map-action-bar, .is-navigating .map-action-bar { display: grid; }
.map-btn { display: grid; place-items: center; gap: 2px; min-width: 0; height: 52px; padding: 5px 3px; border: 0; border-radius: 17px; background: transparent; }
.map-btn span { font-size: 1.12rem; }
.map-btn small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.map-btn.active { color: #FFBC8B; background: rgba(255, 107, 19, .15); }
.map-btn.active small { color: #FFBC8B; }
.route-ready .map-status { bottom: calc(84px + var(--safe-bottom)); }

/* Calculation */
.calculation-sheet { z-index: 96; display: none; left: 50%; top: calc(78px + var(--safe-top)); width: min(420px, calc(100% - 24px)); transform: translateX(-50%); grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.is-calculating .calculation-sheet { display: grid; }
.calculation-sheet strong, .calculation-sheet small { display: block; }
.calculation-sheet small { margin-top: 3px; color: var(--muted); }
.calculation-sheet button { min-width: 88px; min-height: 44px; }
.calculation-spinner { width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--orange); border-radius: 50%; animation: calculation-spin .9s linear infinite; }
@keyframes calculation-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .calculation-spinner { animation: none; border-top-color: var(--orange); } }

/* Dashboard */
.dashboard-sheet { display: none; left: 12px; right: 12px; bottom: calc(82px + var(--safe-bottom)); max-height: calc(100dvh - 156px - var(--safe-top)); overflow-y: auto; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.route-ready.is-dashboard:not(.show-candidates):not(.show-trip) .dashboard-sheet { display: block; }
.sheet-grabber { width: 46px; height: 4px; margin: 0 auto 10px; border-radius: 999px; background: rgba(255, 255, 255, .28); }
.sheet-drag-handle { touch-action: none; cursor: ns-resize; user-select: none; -webkit-user-select: none; }
.is-sheet-dragging { transition: none !important; will-change: transform; }
.poi-map-toggle { position: absolute; z-index: 850; top: max(74px, calc(env(safe-area-inset-top) + 58px)); right: 12px; padding: 9px 13px; color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(14,20,28,.94); box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.is-calculating .poi-map-toggle, .show-trip .poi-map-toggle, .show-candidates .poi-map-toggle { display: none; }
.poi-layer-panel { position: absolute; z-index: 900; top: max(118px, calc(env(safe-area-inset-top) + 102px)); right: 12px; width: min(330px, calc(100vw - 24px)); padding: 14px; color: #fff; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; background: rgba(14,20,28,.97); box-shadow: 0 18px 44px rgba(0,0,0,.42); }
.poi-layer-panel[aria-hidden="true"] { display: none; }
.poi-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.poi-panel-head button { padding: 2px 8px; color: #fff; border: 0; background: transparent; font-size: 24px; }
.poi-category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.poi-category-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.poi-layer-panel > .primary { width: 100%; margin-bottom: 8px; }
.poi-layer-panel small { display: block; color: var(--muted); }
.stop-popup-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.stop-popup-actions button { padding: 8px 10px; color: #fff; border: 0; border-radius: 10px; background: var(--orange); font-weight: 700; }
.stop-popup-actions button.secondary-stop-action { background: #273342; }
.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.dashboard-hero > div { min-width: 0; }
.dashboard-hero strong { display: block; overflow: hidden; font-size: 1.05rem; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-hero small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-hero button { min-height: 44px; padding: 9px 11px; border: 0; border-radius: 15px; color: #FFF; background: linear-gradient(135deg, var(--orange-hi), var(--orange)); font-weight: 900; }
.dashboard-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.dashboard-actions button { min-height: 44px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: rgba(255, 255, 255, .05); font-weight: 800; }
.dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 9px; }
.insight-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.insight-card { min-height: 74px; padding: 9px; border: 1px solid var(--line-soft); border-radius: 16px; background: rgba(255, 255, 255, .035); }
.insight-card.full { grid-column: 1 / -1; }
.insight-card span { display: block; color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.insight-card strong { display: block; margin-top: 3px; }
.insight-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.3; }
.weather-card.risk-green strong { color: #91E7A7; }
.weather-card.risk-yellow strong { color: #FDE047; }
.weather-card.risk-orange strong { color: #FFAA61; }
.weather-card.risk-red strong { color: #FF8B8B; }
.traffic-bar { display: flex; height: 7px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.traffic-bar i { display: block; }
.traffic-bar .high { background: var(--danger); }
.traffic-bar .med { background: var(--warning); }
.traffic-bar .low { background: var(--success); }

/* Variants and trip plan — mutually exclusive */
.candidate-dock { display: none; left: 10px; right: 10px; top: calc(66px + var(--safe-top)); bottom: calc(80px + var(--safe-bottom)); gap: 9px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 24px; background: rgba(4, 7, 11, .94); box-shadow: var(--shadow); }
.map-wrap.show-candidates .candidate-dock { display: grid; }
.candidate { width: 100%; min-height: 112px; padding: 13px; text-align: left; color: var(--text); border: 1px solid var(--line); border-radius: 18px; background: var(--surface-strong); }
.candidate.active { border-color: rgba(255, 107, 19, .7); background: linear-gradient(180deg, rgba(255, 107, 19, .18), var(--surface-strong)); }
.candidate strong, .candidate small, .candidate em { display: block; }
.candidate small { margin-top: 5px; color: var(--muted); line-height: 1.35; }
.candidate em { margin-top: 5px; color: #D5DCE7; font-size: .75rem; line-height: 1.35; }
.candidate.risk-green { border-color: rgba(71, 199, 107, .42); }
.candidate.risk-yellow { border-color: rgba(253, 224, 71, .42); }
.candidate.risk-orange { border-color: rgba(255, 138, 29, .5); }
.candidate.risk-red { border-color: rgba(239, 68, 68, .58); }
.trip-sheet { display: none; left: 10px; right: 10px; top: calc(66px + var(--safe-top)); bottom: calc(80px + var(--safe-bottom)); overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 24px; background: rgba(4, 7, 11, .94); box-shadow: var(--shadow); }
.map-wrap.show-trip .trip-sheet { display: block; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sheet-head span { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.sheet-head button { min-width: 72px; min-height: 44px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: rgba(255, 255, 255, .05); font-weight: 800; }
.itinerary-list { display: grid; gap: 9px; margin-top: 11px; }
.itinerary-list article { padding: 11px; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface-strong); }
.itinerary-list ul { margin: 8px 0 0; padding-left: 20px; }
.itinerary-list li { margin: 5px 0; }
.itinerary-list small { color: var(--muted); }

/* Navigation and rerouting */
.nav-card { display: none; left: 10px; right: 10px; top: calc(10px + var(--safe-top)); max-height: min(38dvh, 300px); overflow-y: auto; padding: 13px; border: 1px solid var(--line); border-radius: 25px; background: rgba(4, 7, 11, .94); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.is-navigating .nav-card { display: block; }
body.nav-active .mobile-topbar { display: none; }
.nav-maneuver { display: grid; grid-template-columns: 56px minmax(0, 1fr) 48px; gap: 11px; align-items: start; }
.maneuver-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 17px; color: #08111F; background: #FFF; font-size: 2.5rem; font-weight: 900; }
.nav-maneuver > div:nth-child(2) { min-width: 0; }
.nav-maneuver span, .nav-maneuver small { display: block; color: var(--muted); }
.nav-maneuver strong { display: -webkit-box; margin-top: 2px; overflow: hidden; font-size: 1.1rem; line-height: 1.2; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.nav-maneuver small { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speed-chip { display: grid; place-items: center; width: 48px; height: 48px; border: 4px solid var(--danger); border-radius: 50%; background: var(--surface-strong); font-weight: 900; }
.nav-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.nav-stats > div { padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(255, 255, 255, .04); }
.nav-stats span { display: block; color: var(--muted); font-size: .67rem; text-transform: uppercase; }
.nav-progress { height: 8px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.nav-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--success), var(--orange)); }
#navProgressText { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; }
.nav-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.nav-actions button { min-height: 44px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: rgba(255, 255, 255, .05); font-weight: 800; }
#stopNavigation { color: #FFBABA; border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .12); }
.step-list { display: none; max-height: 180px; overflow-y: auto; margin: 10px 0 0; padding-left: 22px; }
.step-list.open { display: block; }
.reroute-banner { left: 12px; right: 12px; bottom: calc(82px + var(--safe-bottom)); display: grid; gap: 8px; padding: 14px; border: 1px solid rgba(239, 68, 68, .42); border-radius: 23px; background: linear-gradient(145deg, rgba(127, 29, 29, .97), rgba(157, 48, 12, .95)); box-shadow: var(--shadow); }
.reroute-banner[hidden] { display: none; }
.reroute-banner small { color: #FFE1E1; }
.reroute-banner > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.reroute-banner button { min-height: 44px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 14px; color: #FFF; background: rgba(0, 0, 0, .24); font-weight: 800; }
.reroute-banner #acceptReroute { border: 0; background: linear-gradient(135deg, var(--orange-hi), var(--orange)); }
.reroute-close { position: absolute; top: 7px; right: 8px; width: 36px; min-height: 36px; padding: 0; border: 0; background: transparent; }

/* Dialogs */
.install-dialog { width: min(440px, 92vw); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 24px; background: var(--surface-strong); }
.install-dialog form { padding: 20px; }
.install-dialog p { margin: 12px 0; color: var(--muted); line-height: 1.45; }
.install-dialog::backdrop { background: rgba(0, 0, 0, .62); }

/* Phone layouts */
@media (max-width: 880px) {
  .side-menu { width: 100vw; max-width: 100vw; border-right: 0; }
  .route-planner { top: auto; right: 0; width: 100%; max-height: calc(100dvh - var(--safe-top) - 8px); padding: 10px 14px calc(20px + var(--safe-bottom)); border: 0; border-radius: 30px 30px 0 0; transform: translateY(110%); }
  .route-planner.open { transform: translateY(0); }
  .panel-handle { display: block; width: 46px; height: 5px; margin: 0 auto 8px; border-radius: 999px; background: rgba(255, 255, 255, .25); }
  .brand { top: -10px; padding: 10px 0; }
  .two-col { grid-template-columns: 1fr; }
  .round-target-inputs, .break-options, .profile-options .two-col, .side-menu .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-wrap.show-candidates .mobile-topbar, .map-wrap.show-trip .mobile-topbar { display: flex; }
  .leaflet-control-zoom { display: none; }
}

@media (min-width: 881px) {
  .mobile-topbar { left: auto; width: min(460px, 42vw); border-left: 1px solid var(--line-soft); }
  .dashboard-sheet, .nav-card { left: auto; right: 22px; width: min(430px, calc(100% - 44px)); }
  .candidate-dock, .trip-sheet { left: auto; right: 22px; width: min(440px, calc(100% - 44px)); }
  .map-action-bar { left: 50%; right: auto; width: min(480px, calc(100% - 44px)); transform: translateX(-50%); }
  .map-status { bottom: 92px; }
}

@media (max-width: 420px) {
  .top-brand small { max-width: 40vw; }
  .brand-logo { width: 32px; height: 32px; }
  .priority-picker, .stop-fieldset { grid-template-columns: 1fr; }
  .round-target-inputs, .break-options, .profile-options .two-col, .side-menu .two-col { grid-template-columns: 1fr; }
  .dashboard-sheet { max-height: calc(100dvh - 148px - var(--safe-top)); }
  .dashboard-hero { grid-template-columns: minmax(0, 1fr) 96px; }
  .dashboard-hero button { padding: 7px; font-size: .75rem; }
  .dashboard-metrics span { font-size: .58rem; }
  .dashboard-metrics strong { font-size: .9rem; }
  .insight-card small { font-size: .68rem; }
  .utility-tabs button small { font-size: .56rem; }
}

@media (max-height: 700px) {
  .nav-card { max-height: 34dvh; }
  .nav-stats, .nav-progress, #navProgressText { display: none; }
  .dashboard-sheet { max-height: 47dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; transition-duration: .01ms; animation-duration: .01ms; animation-iteration-count: 1; }
}

/* State utilities stay last so conditional sections cannot override them. */
.is-hidden, [hidden] { display: none; }
