:root {
  --navy-950: #081126;
  --navy-900: #0d1838;
  --navy-800: #16264f;
  --ink: #17213b;
  --muted: #6e7890;
  --muted-light: #9aa3b5;
  --canvas: #f3f4ef;
  --card: #ffffff;
  --line: #e4e8ea;
  --soft: #f7f8f5;
  --lime: #dfff65;
  --lime-deep: #b6d94e;
  --coral: #ff725b;
  --coral-deep: #dc5b48;
  --sky: #5abbd5;
  --shadow: 0 22px 60px rgba(17, 30, 62, 0.08);
  --shadow-soft: 0 8px 24px rgba(17, 30, 62, 0.06);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.topbar {
  min-height: 76px;
  padding: 0 44px;
  color: #fff;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--lime);
  background: rgba(223, 255, 101, 0.12);
  border: 1px solid rgba(223, 255, 101, 0.28);
  border-radius: 11px;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font: 700 19px/1 "Space Grotesk", sans-serif; letter-spacing: -0.02em; }
.brand-kicker { color: rgba(255,255,255,0.54); font-size: 8px; font-weight: 700; letter-spacing: 0.17em; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.sync-pill { color: rgba(255,255,255,0.66); display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.sync-dot { width: 7px; height: 7px; display: inline-block; background: var(--lime); border-radius: 999px; box-shadow: 0 0 0 4px rgba(223,255,101,0.12); }
.icon-button {
  width: 35px;
  height: 35px;
  border: 1px solid rgba(255,255,255,0.17);
  color: rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.icon-button:hover { color: var(--lime); background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.icon-button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; }

.workspace {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 38px 0 60px;
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.control-column, .route-column { min-width: 0; }
.intro-block { padding: 1px 4px 25px; }
.eyebrow { color: var(--coral-deep); display: flex; align-items: center; gap: 8px; text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.eyebrow-line { width: 22px; height: 2px; display: inline-block; background: currentColor; border-radius: 999px; }
.intro-heading-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 13px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: "Space Grotesk", ui-sans-serif, sans-serif; letter-spacing: -0.045em; }
h1 { max-width: 310px; color: var(--navy-900); font-size: clamp(30px, 3vw, 39px); line-height: .99; }
.intro-block p { max-width: 322px; margin-top: 13px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.shift-badge { flex: 0 0 auto; min-width: 72px; padding: 10px 11px 9px; color: var(--navy-900); background: var(--lime); border-radius: 13px; font-size: 9px; font-weight: 700; line-height: 1.25; text-transform: uppercase; letter-spacing: .06em; }
.shift-badge span { display: block; font: 700 22px/1 "Space Grotesk", sans-serif; letter-spacing: -.05em; }

.panel, .route-card, .metric-card { background: var(--card); border: 1px solid rgba(19, 31, 61, 0.07); box-shadow: var(--shadow-soft); }
.panel { padding: 22px; border-radius: var(--radius-xl); }
.panel + .panel { margin-top: 16px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.heading-with-step { display: flex; align-items: flex-start; gap: 11px; }
.step-index { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; color: var(--navy-900); background: var(--lime); border-radius: 9px; font: 700 10px/1 "Space Grotesk", sans-serif; letter-spacing: .03em; }
.pale-step { color: #66722f; background: #edf4cb; }
h2 { color: var(--navy-900); font-size: 19px; line-height: 1.1; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.text-button { padding: 2px 0; color: var(--muted); border: 0; background: transparent; font-size: 11px; font-weight: 600; }
.text-button:hover { color: var(--coral-deep); }

.textarea-wrap { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); border-radius: 14px; transition: border-color .2s ease, box-shadow .2s ease; }
.textarea-wrap:focus-within { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(90,187,213,.12); }
textarea { width: 100%; min-height: 179px; padding: 14px 14px 8px; resize: vertical; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: 12px; line-height: 1.78; }
textarea::selection { background: rgba(223,255,101,.7); }
.textarea-footer { padding: 7px 12px 10px; color: var(--muted-light); display: flex; align-items: center; justify-content: space-between; font-size: 10px; }
.textarea-footer span:first-child { color: var(--navy-800); font-weight: 700; }
.import-row { display: flex; align-items: center; gap: 13px; padding-top: 11px; }
.secondary-button, .quiet-button, .map-tool-button { border: 0; background: transparent; }
.secondary-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; color: var(--navy-800); font-size: 11px; font-weight: 700; }
.secondary-button:hover { color: var(--coral-deep); }
.secondary-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quiet-button { padding: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.quiet-button:hover { color: var(--navy-800); }
.form-divider { height: 1px; margin: 19px 0; background: var(--line); }
.field-stack { display: grid; gap: 7px; }
.field-label { color: var(--navy-800); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.input-with-action { position: relative; display: flex; align-items: center; }
.input-with-action input { width: 100%; min-width: 0; height: 42px; padding: 0 78px 0 12px; color: var(--ink); border: 1px solid var(--line); outline: 0; background: #fff; border-radius: 10px; font-size: 12px; transition: border-color .2s ease, box-shadow .2s ease; }
.input-with-action input:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(90,187,213,.12); }
.input-action { position: absolute; right: 6px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); border: 0; background: var(--soft); border-radius: 7px; font-size: 10px; font-weight: 700; }
.input-action:hover { color: var(--navy-800); background: #eaf3f4; }
.input-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; cursor: pointer; }
.toggle-copy { display: grid; gap: 3px; }
.toggle-copy strong { color: var(--navy-800); font-size: 12px; font-weight: 700; }
.toggle-copy small { color: var(--muted); font-size: 10px; }
.switch { position: relative; display: inline-block; width: 36px; height: 21px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: absolute; inset: 0; background: #dfe3e4; border-radius: 999px; transition: background .2s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .2s ease; }
.switch input:checked + .switch-track { background: var(--navy-800); }
.switch input:checked + .switch-track::after { transform: translateX(15px); }
.primary-button { width: 100%; height: 50px; margin-top: 20px; padding: 0 13px; display: flex; align-items: center; gap: 10px; color: var(--navy-900); border: 0; background: var(--lime); border-radius: 12px; font: 700 13px/1 "Space Grotesk", sans-serif; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.primary-button:hover { background: #e5ff8a; box-shadow: 0 9px 22px rgba(183,217,79,.26); transform: translateY(-2px); }
.primary-button:disabled { cursor: wait; opacity: .75; transform: none; }
.primary-icon { width: 26px; height: 26px; display: grid; place-items: center; color: var(--navy-900); border-radius: 8px; background: rgba(13,24,56,.08); }
.primary-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-shortcut { margin-left: auto; padding: 4px 6px; color: rgba(13,24,56,.52); border: 1px solid rgba(13,24,56,.15); border-radius: 5px; font: 600 9px/1 "DM Sans", sans-serif; }
.status-message { min-height: 15px; margin-top: 11px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.status-message.is-error { color: var(--coral-deep); }
.status-message.is-success { color: #5a7c19; }
.status-message.is-loading { color: var(--navy-800); }

.compact-heading { align-items: center; }
.count-pill, .route-chip { min-width: 29px; height: 23px; padding: 0 8px; display: inline-grid; place-items: center; color: var(--navy-800); background: #edf4cb; border-radius: 999px; font-size: 10px; font-weight: 700; }
.input-stop-list { margin-top: 17px; display: grid; gap: 3px; }
.input-stop { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f0; }
.input-stop:last-child { border-bottom: 0; }
.mini-stop-number { width: 21px; height: 21px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); background: #f0f2ef; border-radius: 7px; font: 700 9px/1 "Space Grotesk", sans-serif; }
.input-stop-copy { min-width: 0; display: grid; gap: 3px; }
.input-stop-name { overflow: hidden; color: var(--navy-800); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.input-stop-address { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.add-stop-button { width: 100%; margin-top: 12px; padding: 10px; color: var(--muted); border: 1px dashed #cbd3d3; background: transparent; border-radius: 10px; font-size: 11px; font-weight: 700; transition: color .2s ease, border-color .2s ease, background .2s ease; }
.add-stop-button span { margin-right: 4px; font-size: 16px; font-weight: 400; vertical-align: -1px; }
.add-stop-button:hover { color: var(--navy-800); border-color: var(--sky); background: #f5faf9; }
.empty-list { padding: 21px 10px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.5; }
.privacy-note { padding: 18px 4px 0; display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.privacy-note svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--lime-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note strong { color: var(--navy-800); }

.route-column { display: grid; gap: 15px; }
.route-toolbar { min-height: 31px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.route-state { display: inline-flex; align-items: center; gap: 9px; color: var(--navy-800); font-size: 11px; font-weight: 700; }
.live-dot { width: 7px; height: 7px; display: inline-block; background: var(--coral); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,114,91,.14); }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.map-tool-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0 6px 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.map-tool-button:hover { color: var(--navy-800); }
.map-tool-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.map-card { overflow: hidden; background: #dce8e3; border: 1px solid rgba(19,31,61,.08); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
#map { position: relative; height: 408px; background: #dfe9e4; }
.maplibregl-map { font-family: "DM Sans", sans-serif; }
.maplibregl-ctrl-group { overflow: hidden; border: 1px solid rgba(13,24,56,.1); border-radius: 10px !important; box-shadow: 0 8px 24px rgba(13,24,56,.16) !important; }
.maplibregl-ctrl-group button { width: 34px; height: 34px; }
.maplibregl-ctrl-attrib { font-size: 9px; }
.map-loading { position: absolute; z-index: 450; inset: 0; display: grid; place-items: center; color: var(--muted); background: linear-gradient(135deg, rgba(236,244,236,.92), rgba(209,229,224,.8)); font-size: 12px; pointer-events: none; }
.map-loading.is-hidden { display: none; }
.map-overlay-badge { position: absolute; z-index: 500; top: 17px; left: 18px; padding: 8px 10px; display: inline-flex; align-items: center; gap: 7px; color: var(--navy-800); background: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.8); border-radius: 8px; box-shadow: 0 5px 17px rgba(17,30,62,.1); font-size: 10px; font-weight: 700; pointer-events: none; }
.map-badge-dot { width: 6px; height: 6px; background: var(--coral); border-radius: 50%; }
.map-mode-button { position: absolute; z-index: 500; top: 17px; right: 18px; min-width: 43px; height: 34px; color: #fff; border: 1px solid rgba(255,255,255,.2); background: rgba(13,24,56,.88); border-radius: 9px; box-shadow: 0 7px 20px rgba(13,24,56,.2); font-size: 10px; font-weight: 800; letter-spacing: .08em; backdrop-filter: blur(10px); }
.map-mode-button:hover { color: var(--lime); }
.map-card-footer { min-height: 47px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; gap: 15px; background: #fff; }
.map-legend { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 9px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-line { width: 18px; height: 3px; display: inline-block; background: var(--coral); border-radius: 999px; }
.legend-pin { width: 8px; height: 8px; display: inline-block; background: var(--navy-800); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--navy-800); }
.legend-me { width: 8px; height: 8px; display: inline-block; background: var(--sky); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--sky); }
.map-source { color: var(--muted-light); font-size: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric-card { min-height: 101px; padding: 16px 17px 14px; display: grid; align-content: space-between; border-radius: var(--radius-lg); }
.metric-card.metric-accent { background: var(--navy-900); border-color: var(--navy-900); }
.metric-label { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.metric-accent .metric-label { color: rgba(255,255,255,.56); }
.metric-card strong { margin-top: 6px; color: var(--navy-900); font: 700 26px/1 "Space Grotesk", sans-serif; letter-spacing: -.06em; }
.metric-accent strong { color: var(--lime); }
.metric-caption { margin-top: 4px; color: var(--muted); font-size: 10px; }
.metric-accent .metric-caption { color: rgba(255,255,255,.56); }

.route-card { padding: 24px; border-radius: var(--radius-xl); }
.route-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.route-eyebrow { color: var(--coral-deep); font-size: 9px; }
.route-heading-row { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.route-heading-row h2 { font-size: 27px; }
.route-chip { color: var(--navy-800); background: #eef3ce; }
.route-card-heading > div > p { margin-top: 6px; color: var(--muted); font-size: 11px; }
.optimized-stamp { margin-top: 7px; padding: 6px 8px; color: #6b7b32; background: #f1f6d9; border-radius: 6px; font-size: 8px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.route-list { position: relative; margin-top: 22px; }
.route-list::before { content: ""; position: absolute; top: 27px; bottom: 27px; left: 14px; width: 1px; background: #dfe5e3; }
.route-stop { position: relative; min-width: 0; padding: 10px 0; display: grid; grid-template-columns: 29px minmax(0,1fr) 31px; align-items: center; gap: 11px; border-bottom: 1px solid #eff1f0; transition: opacity .2s ease; }
.route-stop:last-child { border-bottom: 0; }
.route-stop.is-complete { opacity: .49; }
.route-stop.is-next .stop-node { color: var(--navy-900); background: var(--lime); box-shadow: 0 0 0 4px rgba(223,255,101,.25); }
.stop-node { position: relative; z-index: 1; width: 29px; height: 29px; display: grid; place-items: center; color: #fff; background: var(--navy-800); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--navy-800); font: 700 10px/1 "Space Grotesk", sans-serif; }
.stop-content { min-width: 0; }
.stop-top { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stop-label { overflow: hidden; color: var(--navy-800); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.stop-eta { flex: 0 0 auto; color: var(--navy-800); font: 700 10px/1 "Space Grotesk", sans-serif; }
.stop-address { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.stop-meta { margin-top: 5px; display: flex; align-items: center; gap: 10px; color: var(--muted-light); font-size: 9px; }
.complete-button { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted-light); border: 1px solid #dce3e1; background: #fff; border-radius: 8px; font-size: 13px; transition: color .2s ease, background .2s ease, border-color .2s ease; }
.complete-button:hover { color: var(--navy-800); border-color: var(--sky); background: #f2f9f9; }
.route-stop.is-complete .complete-button { color: var(--navy-900); border-color: var(--navy-900); background: var(--lime); }
.complete-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.route-placeholder { padding: 32px 18px; color: var(--muted); background: var(--soft); border-radius: 13px; text-align: center; font-size: 11px; line-height: 1.6; }

.driver-mode { margin-top: 14px; padding: 17px; color: #fff; background: #086761; border-radius: 15px; box-shadow: 0 16px 36px rgba(13,24,56,.2); }
.driver-mode-header { display: flex; justify-content: space-between; align-items: center; }
.driver-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--lime); font-size: 9px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.driver-live { width: 6px; height: 6px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 0 4px rgba(223,255,101,.14); }
.driver-instruction { min-width: 0; margin-top: 10px; display: grid; grid-template-columns: 54px minmax(0,1fr); align-items: center; gap: 12px; }
.instruction-icon { width: 54px; height: 54px; display: grid; place-items: center; color: #fff; font: 700 42px/1 "Space Grotesk", sans-serif; }
.instruction-copy { min-width: 0; display: grid; gap: 3px; }
.instruction-copy small { color: rgba(255,255,255,.65); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.instruction-copy strong { overflow: hidden; color: #fff; font: 600 23px/1.12 "Space Grotesk", sans-serif; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.instruction-distance { color: #fff; font: 700 12px/1 "Space Grotesk", sans-serif; white-space: nowrap; }
.driver-then { width: max-content; max-width: 85%; margin: 10px -17px -17px; padding: 9px 18px; display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.75); background: rgba(0,0,0,.2); border-radius: 0 12px 0 15px; font-size: 10px; }
.driver-then strong { overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; }
.driver-progress { position: absolute; right: 16px; bottom: 8px; left: 16px; height: 3px; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 99px; }
.driver-progress span { display: block; height: 100%; background: var(--lime); border-radius: inherit; transition: width .3s ease; }
.driver-hint { position: absolute; right: 138px; bottom: 10px; left: 18px; overflow: hidden; color: rgba(255,255,255,.42); font-size: 8px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.nav-side-controls, .speed-limit-badge, .trip-bar { display: none; }

.nav-active { width: 100%; overflow: hidden; background: #071025; }
.nav-active .topbar { display: none; }
.nav-active .workspace { position: fixed; z-index: 1000; inset: 0; width: 100%; padding: 0; display: block; }
.nav-active .control-column,
.nav-active .route-toolbar,
.nav-active .metric-grid,
.nav-active .route-card { display: none; }
.nav-active .route-column { width: 100%; height: 100%; }
.nav-active .map-card { position: fixed; inset: 0; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; }
.nav-active #map { position: absolute; inset: 0; width: auto; height: auto; min-height: 0; }
.nav-active .map-overlay-badge { display: none; }
.nav-active .map-badge-dot { background: var(--lime); box-shadow: 0 0 0 4px rgba(223,255,101,.16); }
.nav-active .map-card-footer { display: none; }
.nav-active .map-legend { color: rgba(255,255,255,.65); }
.nav-active .map-source { color: rgba(255,255,255,.48); }
.nav-active .driver-mode { position: fixed; z-index: 1100; top: max(12px, env(safe-area-inset-top)); left: 12px; width: min(600px, calc(100% - 100px)); margin: 0; padding: 12px 18px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: rgba(4,97,92,.96); box-shadow: 0 16px 44px rgba(0,0,0,.34); backdrop-filter: blur(16px); }
.nav-active .nav-side-controls { position: fixed; z-index: 1110; right: 14px; bottom: 138px; display: grid; gap: 10px; }
.nav-active .nav-side-controls button { width: 50px; height: 50px; display: grid; place-items: center; color: #fff; border: 1px solid rgba(255,255,255,.12); background: rgba(8,17,38,.92); border-radius: 50%; box-shadow: 0 9px 28px rgba(0,0,0,.3); font-size: 22px; backdrop-filter: blur(12px); }
.nav-active .nav-side-controls button[aria-pressed="false"] { color: rgba(255,255,255,.62); }
.nav-active .speed-limit-badge { position: fixed; z-index: 1110; right: 15px; bottom: 320px; width: 48px; height: 58px; display: grid; place-items: center; align-content: center; color: #111; border: 3px solid #171717; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.nav-active .speed-limit-badge span { font-size: 7px; font-weight: 800; line-height: .9; text-align: center; }
.nav-active .speed-limit-badge strong { margin-top: 2px; font: 800 21px/1 "Space Grotesk", sans-serif; }
.nav-active .trip-bar { position: fixed; z-index: 1100; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; min-height: 112px; padding: 14px 142px 18px 18px; display: grid; align-items: center; color: #fff; border: 1px solid rgba(255,255,255,.1); background: rgba(8,10,15,.95); border-radius: 22px; box-shadow: 0 18px 60px rgba(0,0,0,.42); backdrop-filter: blur(18px); }
.trip-copy { min-width: 0; display: grid; gap: 2px; }
.trip-destination { overflow: hidden; color: rgba(255,255,255,.56); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.trip-destination strong { color: #fff; }
.trip-time { color: #77eba6; font: 600 27px/1 "Space Grotesk", sans-serif; letter-spacing: -.04em; }
.trip-meta { color: rgba(255,255,255,.68); font-size: 13px; }
.trip-address { overflow: hidden; color: rgba(255,255,255,.38); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.trip-action, .trip-exit { position: absolute; top: 50%; width: 56px; height: 56px; border: 0; border-radius: 50%; transform: translateY(-50%); }
.trip-action { right: 76px; display: grid; place-items: center; align-content: center; gap: 1px; color: #fff; background: #303138; }
.trip-action span { font-size: 18px; }
.trip-action small { font-size: 7px; }
.trip-exit { right: 14px; color: #fff; background: #e4433b; font-size: 12px; font-weight: 700; }
.nav-active .map-mode-button { top: max(16px, env(safe-area-inset-top)); }
.nav-active .toast { right: 72px; bottom: 132px; max-width: min(300px, calc(100vw - 92px)); }
.route-card-footer { margin-top: 22px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); }
.drive-button { min-height: 45px; padding: 0 15px 0 10px; display: inline-flex; align-items: center; gap: 8px; color: #fff; border: 0; background: var(--coral); border-radius: 11px; font: 700 11px/1 "Space Grotesk", sans-serif; transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.drive-button:hover { background: var(--coral-deep); box-shadow: 0 8px 20px rgba(255,114,91,.24); transform: translateY(-1px); }
.drive-button-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.2); }
.drive-button-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.custom-marker { width: 28px; height: 28px; display: grid; place-items: center; color: #fff; background: var(--navy-800); border: 3px solid #fff; border-radius: 50% 50% 50% 4px; box-shadow: 0 4px 12px rgba(13,24,56,.25); transform: rotate(-45deg); }
.custom-marker span { display: block; transform: rotate(45deg); font: 700 9px/1 "Space Grotesk", sans-serif; }
.custom-marker.is-base { width: 32px; height: 32px; color: var(--navy-900); background: var(--lime); border-radius: 50%; }
.custom-marker.is-base span { font-size: 13px; }
.custom-marker.is-complete { color: var(--navy-900); background: #d4dbd7; }

.toast { position: fixed; z-index: 1100; right: 24px; bottom: 24px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; color: #fff; background: var(--navy-900); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; box-shadow: 0 14px 32px rgba(13,24,56,.22); font-size: 11px; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .25s ease, transform .25s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: var(--coral-deep); }
.help-dialog { width: min(480px, calc(100% - 30px)); padding: 0; color: var(--ink); border: 0; border-radius: 22px; box-shadow: 0 28px 80px rgba(13,24,56,.26); }
.help-dialog::backdrop { background: rgba(8,17,38,.54); backdrop-filter: blur(3px); }
.dialog-inner { position: relative; padding: 30px; }
.dialog-close { position: absolute; top: 15px; right: 17px; width: 28px; height: 28px; color: var(--muted); border: 0; background: var(--soft); border-radius: 8px; font-size: 20px; line-height: 1; }
.dialog-kicker { color: var(--coral-deep); font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.dialog-inner h2 { max-width: 350px; margin-top: 10px; font-size: 28px; line-height: 1.05; }
.dialog-inner > p { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.help-steps { margin-top: 22px; display: grid; gap: 8px; }
.help-steps > div { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--soft); border-radius: 10px; }
.help-steps span { width: 24px; height: 24px; display: grid; place-items: center; color: var(--navy-900); background: var(--lime); border-radius: 7px; font: 700 11px/1 "Space Grotesk", sans-serif; }
.help-steps p { color: var(--muted); font-size: 11px; }
.help-steps strong { color: var(--navy-800); }

@media (max-width: 1050px) {
  .workspace { width: min(100% - 40px, 720px); grid-template-columns: 1fr; }
  .intro-block { padding-bottom: 20px; }
  .control-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .intro-block, .privacy-note { grid-column: 1 / -1; }
  .panel + .panel { margin-top: 0; }
  .route-column { grid-column: 1; }
}

@media (max-width: 700px) {
  .topbar { min-height: 66px; padding: 0 18px; }
  .sync-pill { display: none; }
  .workspace { width: min(100% - 24px, 560px); padding-top: 24px; padding-bottom: 40px; gap: 20px; }
  .control-column { display: block; }
  .intro-block { padding: 0 3px 18px; }
  .intro-heading-row { margin-top: 12px; }
  h1 { font-size: 32px; }
  .intro-block p { max-width: 280px; font-size: 12px; }
  .panel { padding: 18px; border-radius: 20px; }
  .panel + .panel { margin-top: 12px; }
  .route-toolbar { align-items: flex-start; }
  .map-tool-button span { display: none; }
  #map { height: 315px; }
  .map-card-footer { min-height: 43px; padding: 0 12px; }
  .map-legend { gap: 9px; font-size: 8px; }
  .map-source { display: none; }
  .metric-grid { gap: 8px; }
  .metric-card { min-height: 91px; padding: 13px 12px; }
  .metric-card strong { font-size: 22px; }
  .metric-caption { font-size: 9px; }
  .route-card { padding: 18px; border-radius: 20px; }
  .route-card-heading { display: block; }
  .optimized-stamp { display: inline-block; margin-top: 13px; }
  .route-card-footer { align-items: stretch; flex-direction: column; }
  .drive-button { justify-content: center; }
  .toast { right: 16px; bottom: 16px; }
  .nav-active .workspace { width: 100%; padding: 0; }
  .nav-active .map-card { border: 0; border-radius: 0; }
  .nav-active #map { position: absolute; inset: 0; height: auto; min-height: 0; }
  .nav-active .map-card-footer { display: none; }
  .nav-active .driver-mode { top: max(8px, env(safe-area-inset-top)); left: 8px; width: calc(100% - 76px); padding: 10px 12px 13px; border-radius: 16px; }
  .nav-active .driver-instruction { grid-template-columns: 42px minmax(0,1fr); gap: 8px; }
  .nav-active .instruction-icon { width: 42px; height: 42px; font-size: 34px; }
  .nav-active .instruction-copy strong { font-size: 17px; }
  .nav-active .driver-then { margin: 8px -12px -13px; padding: 7px 13px; }
  .nav-active .nav-side-controls { right: 10px; bottom: 126px; gap: 8px; }
  .nav-active .nav-side-controls button { width: 46px; height: 46px; font-size: 20px; }
  .nav-active .speed-limit-badge { right: 10px; bottom: 285px; width: 44px; height: 54px; }
  .nav-active .trip-bar { right: 7px; bottom: max(7px, env(safe-area-inset-bottom)); left: 7px; min-height: 104px; padding: 12px 126px 15px 15px; border-radius: 19px; }
  .trip-time { font-size: 24px; }
  .trip-action, .trip-exit { width: 50px; height: 50px; }
  .trip-action { right: 66px; }
  .trip-exit { right: 10px; }
  .nav-active .driver-hint { display: none; }
}

.user-marker-wrap { width: 58px; height: 58px; display: grid; place-items: center; }
.navigation-triangle { position: relative; width: 0; height: 0; border-right: 19px solid transparent; border-bottom: 46px solid #fff; border-left: 19px solid transparent; filter: drop-shadow(0 6px 6px rgba(0,0,0,.55)); }
.navigation-triangle::before { content: ""; position: absolute; top: 9px; left: -12px; width: 0; height: 0; border-right: 12px solid transparent; border-bottom: 30px solid #4fa7ff; border-left: 12px solid transparent; }
.navigation-triangle::after { content: ""; position: absolute; top: 17px; left: -5px; width: 10px; height: 10px; background: #d9ecff; border-radius: 50%; }
@keyframes gps-pulse { 0% { opacity: .9; transform: scale(.45); } 75%, 100% { opacity: 0; transform: scale(1.35); } }

.wizard-progress { grid-column: 1 / -1; width: min(520px, 100%); margin: 0 auto 4px; display: flex; align-items: center; justify-content: center; }
.wizard-step { padding: 0; display: inline-flex; align-items: center; gap: 8px; color: var(--muted-light); border: 0; background: transparent; font-size: 11px; }
.wizard-step span { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); background: #e2e6e4; border-radius: 50%; font: 700 10px/1 "Space Grotesk", sans-serif; }
.wizard-step.is-active { color: var(--navy-900); }
.wizard-step.is-active span { color: var(--navy-900); background: var(--lime); box-shadow: 0 0 0 4px rgba(223,255,101,.24); }
.wizard-step:disabled { cursor: default; }
.wizard-line { width: clamp(42px, 10vw, 100px); height: 1px; margin: 0 14px; background: #d6dcda; }

body.stage-plan .workspace { width: min(760px, calc(100% - 32px)); grid-template-columns: minmax(0, 1fr); }
body.stage-plan .control-column { display: block; }
body.stage-plan .route-column, body.stage-plan .stops-panel { display: none; }
body.stage-plan .intro-block { padding-inline: 12px; }
body.stage-plan h1 { max-width: 470px; }
body.stage-plan .intro-block p { max-width: 560px; }
body.stage-plan .plan-panel { padding: clamp(20px, 4vw, 32px); }
body.stage-plan textarea { min-height: 220px; }

body.stage-route .workspace { width: min(980px, calc(100% - 40px)); grid-template-columns: minmax(0, 1fr); }
body.stage-route .control-column { display: none; }
body.stage-route .route-column { grid-column: 1; }
body.stage-route .wizard-step:last-child { color: var(--navy-900); }
body.stage-route .wizard-step:last-child span { color: var(--navy-900); background: var(--lime); box-shadow: 0 0 0 4px rgba(223,255,101,.24); }
body.stage-route .wizard-step:first-child { color: var(--muted); }
body.stage-route .wizard-step:first-child span { color: #fff; background: var(--navy-800); box-shadow: none; }

.review-actions { min-height: 70px; padding: 11px 13px 11px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #fff; background: var(--navy-900); border-radius: 18px; box-shadow: var(--shadow-soft); }
.review-actions > div { min-width: 0; display: grid; gap: 3px; }
.review-actions strong { font: 600 15px/1.1 "Space Grotesk", sans-serif; }
.review-actions span { color: rgba(255,255,255,.58); font-size: 10px; }
.review-drive-button { flex: 0 0 auto; min-height: 48px; padding-right: 18px; background: var(--lime); color: var(--navy-900); }
.review-drive-button:hover { color: #fff; }
.review-drive-button .drive-button-icon { background: rgba(13,24,56,.1); }
.back-to-plan { color: var(--navy-800); }
.nav-active .wizard-progress, .nav-active .review-actions { display: none; }

@media (max-width: 700px) {
  .wizard-progress { margin-bottom: -2px; }
  .wizard-step strong { font-size: 10px; }
  body.stage-plan .workspace, body.stage-route .workspace { width: min(100% - 20px, 560px); padding-top: 18px; }
  body.stage-plan .intro-block { padding-inline: 4px; }
  body.stage-plan textarea { min-height: 190px; }
  .review-actions { position: sticky; z-index: 30; bottom: 8px; min-height: 66px; padding-left: 14px; border-radius: 17px; }
  .review-actions > div span { display: none; }
  .review-drive-button { min-height: 46px; }
}

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