/* ─── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Layout */
  --topbar-h:      82px;   /* fixed topbar height: topbar-inner (~58px) + progress-wrap (~24px) */

  /* Brand */
  --orange:        #1A73E8;
  --orange-dark:   #1254c8;
  --orange-light:  rgba(26,115,232,.10);
  --orange-glow:   rgba(26,115,232,.25);

  /* Light palette — pure white cards, clean blue-gray shell */
  --bg:            #edf2f9;
  --bg-alt:        #e2eaf5;
  --surface:       #ffffff;
  --surface-2:     #f4f7fd;
  --surface-3:     #edf2f9;
  --bg-card:       var(--surface-3);

  /* Text — blue-dark undertone */
  --text:          #0d1b2e;
  --text-2:        #1e3552;
  --text-muted:    #4a6a8a;
  --text-faint:    #8aaccc;

  /* Borders — subtle blue-gray */
  --border:        #d5e1ee;
  --border-2:      #b5cade;

  /* Status */
  --green:         #10b981;
  --green-bg:      rgba(16,185,129,.1);
  --red:           #ef4444;
  --red-bg:        rgba(239,68,68,.1);
  --blue:          #1A73E8;

  /* Shadows — slightly stronger for white-surface cards */
  --shadow-xs:  0 1px 3px rgba(30,60,100,.08);
  --shadow-sm:  0 1px 4px rgba(30,60,100,.10), 0 1px 2px rgba(30,60,100,.06);
  --shadow-md:  0 4px 16px rgba(30,60,100,.12), 0 2px 4px rgba(30,60,100,.07);
  --shadow-lg:  0 10px 32px rgba(30,60,100,.15), 0 4px 10px rgba(30,60,100,.09);
  --shadow-xl:  0 20px 52px rgba(30,60,100,.18), 0 8px 18px rgba(30,60,100,.1);
  --shadow-orange: 0 4px 16px rgba(26,115,232,.38), 0 2px 6px rgba(26,115,232,.22);

  /* Radii */
  --radius-xs:   6px;
  --radius-sm:   10px;
  --radius-md:   14px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.dark {
  /* Blue-slate dark — not flat GitHub-black */
  --bg:          #0c1220;
  --bg-alt:      #091020;
  --surface:     #141d2e;
  --surface-2:   #1a2640;
  --surface-3:   #1f2e4a;
  --bg-card:     var(--surface-3);
  --text:        #dce8f8;
  --text-2:      #aec4de;
  --text-muted:  #6888a8;
  --text-faint:  #364e68;
  --border:      #1e3252;
  --border-2:    #2c4470;
  --shadow-xs:  0 1px 3px rgba(0,0,0,.45);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.35);
  --shadow-lg:  0 10px 32px rgba(0,0,0,.65), 0 4px 10px rgba(0,0,0,.35);
  --shadow-orange: 0 4px 18px rgba(26,115,232,.5), 0 2px 6px rgba(26,115,232,.3);
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
  overflow-x: hidden; /* prevent horizontal scroll from any overflowing child */
  transition: background-color .25s ease, color .25s ease; /* smooth theme switch */
}

/* Consistent keyboard-focus rings across every interactive element */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible), input:focus:not(:focus-visible) { outline: none; }

/* Themed thin scrollbars — very visible on the desktop list column */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ─── App shell ─────────────────────────────────────────────────────────────── */

.app-shell {
  max-width: 540px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Sticky header ─────────────────────────────────────────────────────────── */

.sticky-head {
  position: sticky;
  top: 0;
  z-index: 90;
  padding-top: max(0px, env(safe-area-inset-top));
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

/* ─── Update banner ─────────────────────────────────────────────────────────── */

.update-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: rgba(26,115,232,.08); border-bottom: 1px solid rgba(26,115,232,.2);
}
.update-banner-copy { display: grid; gap: 1px; }
.update-banner-copy strong { color: var(--text); font-size: .88rem; }
.update-banner-copy span   { color: var(--text-muted); font-size: .8rem; }

/* ─── TopBar ────────────────────────────────────────────────────────────────── */

.topbar {
  background: linear-gradient(135deg, #2a7fe8 0%, #1564d8 50%, #0f4ec8 100%);
  display: grid;
  box-shadow: 0 2px 10px rgba(15,78,200,.4), 0 1px 3px rgba(15,78,200,.3);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  min-width: 0;
  overflow: hidden;
}

.app-logo {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.app-logo-svg {
  width: 40px; height: 40px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.25));
}

/* ─── Topbar brand (logo + title) — hidden on desktop, replaced by sidebar brand ── */
.topbar-brand  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-title  { font-size: 1.1rem; font-weight: 800; color: #fff; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; }

/* Context line (stop count / ETA) — sits between brand and right actions on mobile,
   fills full topbar width on desktop */
.topbar-context { flex: 1; min-width: 0; }
.topbar-subtitle { display: block; font-size: .74rem; color: rgba(255,255,255,.80); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Sidebar brand header (desktop only) ──────────────────────────────────── */
.sidebar-brand { display: none; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* GPS pill — white on orange */
.gps-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: .72rem; font-weight: 600;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.9); white-space: nowrap;
}
.gps-pill.gps-active { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.5); color: #fff; }
.gps-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); flex-shrink: 0; }
.gps-pill.gps-active .gps-dot { background: #fff; animation: gps-pulse 2s ease-in-out infinite; }
@keyframes gps-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255,255,255,.2); }
  50%       { box-shadow: 0 0 0 6px rgba(255,255,255,.05); }
}

/* TopBar "+" button */
.topbar-add-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.4);
  color: #fff; cursor: pointer; font-size: 1.1rem; font-weight: 700;
  transition: background .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.topbar-add-btn:hover  { background: rgba(255,255,255,.3); }
.topbar-add-btn:active { transform: scale(.92); }

/* ─── Progress bar (in topbar) ──────────────────────────────────────────────── */

.progress-wrap { display: flex; align-items: center; gap: 8px; padding: 0 16px 10px; }
.progress-track { flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,.22); overflow: hidden; }
.progress-fill  {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.85), #fff);
  box-shadow: 0 0 8px rgba(255,255,255,.45);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-label { font-size: .7rem; font-weight: 700; color: rgba(255,255,255,.8); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─── Tab nav — defined at bottom of file as fixed bottom bar ───────────────── */

/* ─── Tab content ───────────────────────────────────────────────────────────── */

.tab-content-wrapper { min-height: 420px; /* bottom padding added below */ }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .18s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Mobile combined: map on top, routes list as bottom sheet ───────────────── */

@media (max-width: 1279px) {
  .mobile-combined {
    display: flex;
    flex-direction: column;
    padding-bottom: calc(64px + max(0px, env(safe-area-inset-bottom)));
    min-height: 0;
  }
  .mobile-combined .tab-pane--map {
    display: block !important;
    order: -1;
    height: 42vh;
    flex-shrink: 0;
    animation: none;
  }
  .mobile-combined .tab-pane--map .map-wrapper {
    height: 42vh !important;
    min-height: 0 !important;
  }
  .mobile-combined .tab-pane--routes.active {
    order: 0;
    flex: 1;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -6px 24px rgba(30,60,100,.18);
    margin-top: -14px;
    position: relative;
    z-index: 10;
    background: var(--surface);
    animation: none;
    overflow: visible;
  }
}

/* ─── Layout grid ───────────────────────────────────────────────────────────── */

.layout-grid { display: flex; flex-direction: column; }
.panel-primary, .panel-secondary, .summary-panel { width: 100%; }

/* ─── Panel (used for forms, modals, non-list areas) ────────────────────────── */

.panel {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.panel-header h2 { margin: 0; color: var(--text-muted); }
.panel-header-right { display: flex; align-items: center; gap: 8px; }

h2 {
  font-size: .72rem; font-weight: 800; color: var(--text-muted);
  margin: 0 0 10px; letter-spacing: .07em; text-transform: uppercase;
}

/* ─── Route section (FSM flat list container) ───────────────────────────────── */

.route-section { background: var(--surface); }

.route-section-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px 8px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.rsh-left { display: flex; align-items: center; gap: 8px; }
.rsh-right { display: flex; align-items: center; gap: 6px; }
.rsh-title {
  font-size: .72rem; font-weight: 800; letter-spacing: .08em;
  color: var(--text-muted); text-transform: uppercase;
}
.rsh-title-failed { color: var(--red); }

.optimize-banner {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 12px 4px;
  padding: 9px 13px;
  background: var(--orange-light);
  border: 1px solid rgba(26,115,232,.3);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius-sm);
  color: var(--orange-dark);
  font-size: .82rem; font-weight: 700;
}
.optimize-banner svg { animation: spin .7s linear infinite; flex-shrink: 0; }
.rsh-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--orange); color: #fff;
  font-size: .68rem; font-weight: 800;
}
.rsh-count-done   { background: var(--green); }
.rsh-count-failed { background: var(--red); }

/* ─── Count badge ───────────────────────────────────────────────────────────── */

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--orange-light);
  color: var(--orange-dark);
  font-size: .72rem;
  font-weight: 800;
  border: 1px solid rgba(26,115,232,.2);
}
.count-badge.count-done   { background: rgba(16,185,129,.1);  color: #059669; border-color: rgba(16,185,129,.2); }
.count-badge.count-failed { background: rgba(239,68,68,.1);   color: var(--red); border-color: rgba(239,68,68,.2); }

/* ─── Form fields ───────────────────────────────────────────────────────────── */

.field-label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}
.opt-tag {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-faint);
  font-size: .7rem;
}

.field-input {
  display: block;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-top: 6px;
  font-size: .93rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.field-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.field-input::placeholder { color: var(--text-faint); }

.controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}
.flex-grow { flex: 1; min-width: 160px; }

.hint-row { margin-top: 4px; }
.hint { margin: 5px 0 0; font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* ─── Add stop scan tiles ────────────────────────────────────────────────────── */

.add-scan-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 2px;
}
.add-scan-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 8px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border); background: var(--surface-3);
  color: var(--text-muted); font-size: .72rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.add-scan-tile:hover { background: var(--orange-light); border-color: rgba(26,115,232,.35); color: var(--orange); }
.add-scan-tile:active { transform: scale(.95); }
.add-scan-tile--primary {
  background: var(--orange-light); border-color: rgba(26,115,232,.35); color: var(--orange);
}
.add-scan-tile--primary:hover { background: rgba(26,115,232,.2); }

.field-input--dupe { border-color: var(--red) !important; }
.add-dupe-warn {
  font-size: .74rem; color: var(--red); font-weight: 600; margin: 2px 0 0; padding: 0 2px;
}
.add-toast {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25);
  color: #059669; font-size: .78rem; font-weight: 600;
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.shift-extras-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px;
}
.shift-extras-toggle { flex-shrink: 0; }

.controls-row-secondary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.auto-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16,185,129,.08);
  color: #059669;
  border: 1px solid rgba(16,185,129,.18);
  font-size: .72rem;
  font-weight: 700;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: .88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .12s, filter .12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: scale(.97) translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2a7fe8 0%, #1457d4 100%);
  box-shadow: var(--shadow-orange);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 28px rgba(26,115,232,.52), 0 3px 8px rgba(26,115,232,.3); }

.btn-secondary {
  color: var(--text);
  background: var(--surface-3);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--border-2); color: var(--text); background: var(--surface-3); }

.btn-danger {
  color: #fff;
  background: var(--red);
  box-shadow: 0 4px 14px rgba(239,68,68,.28);
}
.btn-sm { padding: 7px 14px; font-size: .78rem; }
.btn-xs { padding: 4px 10px; font-size: .72rem; }

.add-btn { align-self: flex-end; margin-bottom: 0; }

/* ─── Stop list ─────────────────────────────────────────────────────────────── */

.stop-list { display: grid; gap: 0; min-height: 60px; }

/* ─── Google Maps-style bottom sheet header ──────────────────────────────────── */

.gm-header {
  background: var(--surface);
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.gm-handle {
  display: none;
  width: 36px; height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 8px auto 8px;
}
.mobile-combined .gm-handle { display: block; }
.gm-summary {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 0 2px;
  font-size: .84rem; font-weight: 600; color: var(--text);
  flex-wrap: wrap;
}
.gm-summary-action { font-weight: 800; color: var(--text); }
.gm-summary-time { font-weight: 800; color: var(--orange); }
.gm-summary-sep { color: var(--text-faint); font-weight: 400; }
.gm-summary-meta { color: var(--text-muted); }

/* ─── Timeline stop card (Google Maps style) ─────────────────────────────────── */

.stop-card.tl-mode {
  padding: 0;
  border-left: none;
}
.stop-card.tl-mode.active { padding-left: 0; border-left: none; background: rgba(26,115,232,.04); }
.stop-card.tl-mode.priority,
.stop-card.tl-mode:has(.star-btn-active) { border-left: none; padding-left: 0; }

.tl-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  position: relative;
}

.tl-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 38px;
  position: relative;
}
.tl-left::after {
  content: '';
  position: absolute;
  top: 32px;
  bottom: -10px;
  width: 2px;
  background: var(--orange);
  opacity: .28;
  border-radius: 1px;
}
.stop-list > .stop-swipe-wrap:last-child .tl-left::after,
.stop-card.tl-mode.done .tl-left::after { display: none; }

.tl-num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--border);
  color: var(--text-muted);
  font-size: .74rem; font-weight: 800;
}
.tl-num-active { background: var(--orange); border-color: var(--orange); color: #fff; }
.tl-num-done   { background: var(--green-bg); border-color: rgba(16,185,129,.25); color: #059669; }

.tl-eta {
  font-size: .63rem; color: var(--text-muted); font-weight: 600;
  margin-top: 4px; text-align: center; line-height: 1.2;
  white-space: nowrap;
}
.tl-eta-done { color: #059669; }

.tl-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding-top: 4px;
}
.tl-street {
  font-size: .88rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.tl-city {
  font-size: .75rem; color: var(--text-muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tl-right {
  display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0;
  padding-top: 2px;
}

.tl-expanded { padding-left: 50px; }

/* ─── Stop card (FSM flat row style) ───────────────────────────────────────── */

.stop-card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 13px 16px;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
  border-left: 3px solid transparent;
}
.stop-card:hover     { background: var(--surface-2); }
.stop-card.active    { border-left-color: var(--orange); padding-left: 13px; background: rgba(26,115,232,.03); }
.stop-card.done      { opacity: .48; }
.stop-card.drag-over { background: rgba(26,115,232,.05); border-left-color: var(--orange); padding-left: 13px; }
.stop-card.priority,
.stop-card:has(.star-btn-active) { border-left-color: var(--orange); padding-left: 13px; }

.stop-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-handle { display: flex; align-items: center; color: var(--text-faint); cursor: grab; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }

.stop-num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: .74rem; font-weight: 800;
  transition: background .15s, color .15s, border-color .15s;
}
.stop-num-active { background: var(--orange); border-color: var(--orange); color: #fff; }
.stop-num-done   { background: var(--green-bg); border-color: rgba(16,185,129,.25); color: #059669; }

/* Editable position number — tap to type a new position */
.tl-num-editable { cursor: pointer; }
.tl-num-editable:hover,
.tl-num-editable:active { border-color: var(--orange); color: var(--orange); }

.pos-edit-input {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  background: var(--surface-3);
  color: var(--text);
  font-size: .74rem; font-weight: 800;
  text-align: center;
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pos-edit-input::-webkit-inner-spin-button,
.pos-edit-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.stop-card-body { flex: 1; min-width: 0; }

/* FSM address layout */
.stop-addr-line1 {
  font-size: .9rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stop-addr-line2 {
  font-size: .76rem; color: var(--text-muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stop-meta-row {
  display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap;
}
.stop-pkg-count {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
}

/* Legacy address aliases (thin redirect — do not add new rules here) */
.stop-place-title { font-size: .9rem; font-weight: 700; color: var(--text); }
.stop-address     { font-size: .88rem; font-weight: 700; color: var(--text); }
.stop-address-row { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.stop-address-sub { font-size: .76rem; color: var(--text-muted); }

.apt-badge {
  display: inline-block; padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--text-muted);
  font-size: .68rem; font-weight: 700; border: 1px solid var(--border);
}
.pkg-badge {
  display: inline-block; padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--orange-light); color: var(--orange-dark);
  font-size: .68rem; font-weight: 800; border: 1px solid rgba(26,115,232,.2);
}
.fail-badge {
  display: inline-block; padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--red-bg); color: var(--red);
  font-size: .68rem; font-weight: 700; border: 1px solid rgba(239,68,68,.2);
}

.stop-badges-row {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 3px;
}

.stop-note-inline {
  display: flex; align-items: flex-start; gap: 4px; margin-top: 4px;
  font-size: .76rem; color: var(--orange-dark); line-height: 1.4;
  background: var(--orange-light); border-radius: var(--radius-xs);
  padding: 4px 8px; border: 1px solid rgba(26,115,232,.3);
}
.stop-note-inline svg { flex-shrink: 0; margin-top: 1px; }

.perm-note-inline {
  display: flex; align-items: flex-start; gap: 4px; margin-top: 4px;
  font-size: .76rem; color: #92400e; line-height: 1.4;
  background: #fef3c7; border-radius: var(--radius-xs);
  padding: 4px 8px; border: 1px solid #fcd34d; font-weight: 600;
}
.perm-note-inline svg { flex-shrink: 0; margin-top: 1px; }

.perm-note-editor {
  margin: 6px 0; display: flex; flex-direction: column; gap: 4px;
}
.perm-note-editor-label {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; color: #d97706;
}
.perm-note-input { border-color: #fcd34d !important; }
.perm-note-btn { color: #d97706 !important; border-color: rgba(217,119,6,.3) !important; }
.perm-note-btn:hover { background: rgba(217,119,6,.07) !important; }

/* ─── Address correction banner ─────────────────────────────────────────────── */
.addr-correction-banner {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 5px; padding: 6px 8px;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: var(--radius-xs); font-size: .73rem;
}
.acb-label { font-weight: 700; color: #c2410c; }
.acb-text  { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; line-height: 1.4; }
.acb-from  { color: #9a3412; text-decoration: line-through; opacity: .75; word-break: break-all; }
.acb-arrow { color: #c2410c; font-weight: 700; }
.acb-to    { color: #166534; font-weight: 600; word-break: break-all; }
.acb-actions { display: flex; gap: 5px; margin-top: 3px; }
.acb-btn {
  padding: 3px 9px; border-radius: 4px; font-size: .71rem; font-weight: 600;
  cursor: pointer; border: 1px solid; line-height: 1.4;
  transition: background .15s;
}
.acb-accept { background: #dcfce7; border-color: #86efac; color: #15803d; }
.acb-accept:hover { background: #bbf7d0; }
.acb-edit   { background: #fff; border-color: #fdba74; color: #c2410c; }
.acb-edit:hover { background: #fff7ed; }
.dark .addr-correction-banner { background: rgba(194,65,12,.12); border-color: rgba(253,186,116,.3); }
.dark .acb-label { color: #fb923c; }
.dark .acb-from  { color: #fca5a5; }
.dark .acb-arrow { color: #fb923c; }
.dark .acb-to    { color: #86efac; }
.dark .acb-accept { background: rgba(134,239,172,.1); border-color: rgba(134,239,172,.3); color: #86efac; }
.dark .acb-accept:hover { background: rgba(134,239,172,.2); }
.dark .acb-edit   { background: transparent; border-color: rgba(253,186,116,.35); color: #fb923c; }
.dark .acb-edit:hover { background: rgba(194,65,12,.12); }

/* ─── Route intelligence badges ─────────────────────────────────────────────── */
.approach-badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700; padding: 1px 5px;
  border-radius: 3px; letter-spacing: .02em;
}
.approach-badge--links  { background: #dbeafe; color: #1d4ed8; }
.approach-badge--rechts { background: #fce7f3; color: #be185d; }

.back-entrance-badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 600; padding: 1px 5px;
  border-radius: 3px; background: var(--orange-light); color: var(--orange-dark); border: 1px solid rgba(26,115,232,.3);
}

.walk-cluster-park {
  display: flex; flex-direction: column; gap: 4px; margin-top: 4px;
  font-size: .74rem; font-weight: 700; color: #065f46;
  background: #d1fae5; border-radius: 6px; padding: 5px 8px;
  border: 1px solid #6ee7b7;
}
.walk-cluster-park-header {
  display: flex; align-items: center; gap: 5px;
}
.walk-cluster-items {
  display: flex; flex-direction: column; gap: 2px; margin-top: 1px;
}
.walk-cluster-item {
  font-size: .72rem; font-weight: 600; color: #047857;
  padding-left: 17px; line-height: 1.3;
}
.walk-cluster-item::before { content: '↳ '; }
.walk-cluster-hint {
  display: flex; align-items: center; gap: 5px; margin-top: 3px;
  font-size: .71rem; color: #4b5563;
}

/* ─── Lunch break divider ────────────────────────────────────────────────────── */
.lunch-break-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0; padding: 6px 14px;
  background: var(--surface-2); border: 1px dashed var(--border-2);
  border-radius: 6px; font-size: .76rem; font-weight: 600;
  color: var(--text-muted);
}

/* ─── Stop card right column ────────────────────────────────────────────────── */

.stop-card-right {
  display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0;
}

/* Priority star */
.star-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%; background: transparent; border: none;
  color: var(--border-2); cursor: pointer; transition: color .15s, transform .1s; padding: 0;
}
.star-btn:hover { color: var(--orange); transform: scale(1.15); }
.star-btn:active { transform: scale(.88); }
.star-btn-active { color: var(--orange); }

/* Compact check/undo button */
.compact-check-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface); color: var(--text-faint);
  cursor: pointer; transition: all .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.compact-check-btn:hover { border-color: #10b981; color: #10b981; background: rgba(16,185,129,.06); }
.compact-check-btn:active { transform: scale(.9); }
.compact-undo { border-color: #10b981; color: #10b981; background: rgba(16,185,129,.08); }
.compact-undo:hover { border-color: var(--border-2); color: var(--text-muted); background: var(--surface-3); }

/* Expand chevron */
.expand-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: transparent; border: none;
  color: var(--text-faint); cursor: pointer; font-size: .6rem;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.expand-btn:hover { color: var(--text-muted); background: var(--surface-3); }
.expand-btn-open { color: var(--orange); }

/* ─── Stop card expanded section ────────────────────────────────────────────── */

.stop-card-expanded {
  display: grid; gap: 8px;
  padding-top: 10px; padding-left: 38px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Stop actions ──────────────────────────────────────────────────────────── */

.stop-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 11px; font-size: .75rem; font-weight: 700; font-family: inherit;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: background .12s, border-color .12s, color .12s, transform .1s;
  -webkit-tap-highlight-color: transparent; min-height: 32px;
}
.action-btn:hover  { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.action-btn:active { transform: scale(.95); }

.delete-btn { color: var(--text-faint); }
.delete-btn:hover { background: var(--red-bg); border-color: rgba(239,68,68,.25); color: var(--red); }
.zone-btn   { color: #3b82f6; border-color: rgba(59,130,246,.25); }
.zone-btn:hover { background: rgba(59,130,246,.06); }
.note-btn   { color: var(--text-muted); }
.sig-btn    { color: #7c3aed; border-color: rgba(124,58,237,.25); }
.sig-btn:hover { background: rgba(124,58,237,.06); }

/* ─── Stop note textarea ────────────────────────────────────────────────────── */

.stop-note-input {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid rgba(26,115,232,.4); border-radius: var(--radius-sm);
  background: var(--orange-light); color: var(--orange-dark);
  font-size: .82rem; font-family: inherit; resize: vertical; outline: none; line-height: 1.5;
}
.stop-note-input:focus { border-color: var(--orange); }

/* ─── Start route button ────────────────────────────────────────────────────── */

.btn-start-route {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 13px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2a7fe8 0%, #1457d4 100%); color: #fff;
  border: none; cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-orange);
  transition: filter .15s, transform .12s;
  position: relative; overflow: hidden;
}
.btn-start-route:hover  { filter: brightness(1.06); transform: translateY(-1px); }
.btn-start-route:active { transform: scale(.98); }
.btn-start-route svg { flex-shrink: 0; transform: rotate(45deg); }
.btn-start-route span { flex: 1; font-size: .94rem; font-weight: 700; text-align: left; }
.btn-start-route small { display: block; font-size: .71rem; font-weight: 500; opacity: .8; }

@keyframes btn-shimmer {
  0%        { transform: translateX(-110%) skewX(-18deg); opacity: 0; }
  15%, 35%  { opacity: 1; }
  55%, 100% { transform: translateX(260%) skewX(-18deg); opacity: 0; }
}
.btn-start-route::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 0; width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  animation: btn-shimmer 4.5s ease-in-out infinite 2s;
  pointer-events: none;
}

/* ─── Empty state ───────────────────────────────────────────────────────────── */

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; padding: 32px 20px;
  color: var(--text-faint); text-align: center;
}
.empty-icon { font-size: 1.8rem; opacity: .5; }
.empty-state p { margin: 0; font-size: .84rem; line-height: 1.5; }

/* ─── Route complete screen ─────────────────────────────────────────────────── */

.route-complete {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 48px 24px 40px;
  text-align: center;
}
.rc-check {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(26,115,232,.10); display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.rc-title {
  margin: 0; font-size: 1.4rem; font-weight: 800;
  color: var(--text); letter-spacing: -.02em;
}
.rc-count { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-2); }
.rc-avg   { margin: 0; font-size: .84rem; color: var(--text-muted); }

/* ─── Route summary panel ───────────────────────────────────────────────────── */

.summary-rows { margin-bottom: 14px; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: .88rem; color: var(--text-muted);
}
.summary-row:last-child { border-bottom: none; }
.summary-row strong { font-weight: 700; color: var(--text); }
.summary-row-failed strong { color: var(--red); }

/* ─── Route output / preview ────────────────────────────────────────────────── */

.route-output {
  margin-top: 4px; padding: 14px; border-radius: var(--radius-md);
  background: var(--surface-3); border: 1px solid var(--border); min-height: 80px;
}
.route-summary-item {
  display: grid; gap: 3px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px;
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.route-summary-item:last-child { margin-bottom: 0; }
.rsi-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.rsi-value { font-size: .88rem; font-weight: 600; color: var(--text); word-break: break-word; }
.rsi-sub   { font-size: .78rem; color: var(--text-muted); }
.rsi-extra { font-size: .75rem; color: var(--text-faint); }
.rsi-business { display: flex; align-items: center; gap: 4px; }
.route-loading { display: inline-flex; align-items: center; gap: 5px; color: var(--text-faint); font-size: .82rem; }
.route-summary-total { font-size: .78rem; color: var(--text-muted); padding: 6px 0 0; border-top: 1px solid var(--border); margin-top: 6px; }
.route-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.route-summary-cell { display: grid; gap: 2px; }
.rsc-label { font-size: .68rem; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; color: var(--text-faint); }
.rsc-value { font-size: 1rem; font-weight: 700; color: var(--text); }

/* ─── Route total banner ────────────────────────────────────────────────────── */

.route-total-banner {
  display: flex; align-items: center; gap: 0;
  padding: 12px 16px; margin-top: 10px;
  background: rgba(26,115,232,.06); border: 1px solid rgba(26,115,232,.15);
  border-radius: var(--radius-md);
}
.rtb-item { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.rtb-val  { font-size: 1rem; font-weight: 700; color: var(--text); }
.rtb-lbl  { font-size: .66rem; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.rtb-sep  { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }
.rtb-eta  { color: var(--orange); }

/* ─── Pagination ────────────────────────────────────────────────────────────── */

.pagination-controls {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 0 4px;
}
.pagination-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
}
.pagination-btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.pagination-btn:disabled { opacity: .35; cursor: not-allowed; }
.pagination-info { font-size: .78rem; color: var(--text-muted); font-weight: 600; }

/* ─── Day actions (pause / stop) ────────────────────────────────────────────── */

.dag-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--border); margin-top: 12px;
}
/* ─── Mandatory break reminder ────────────────────────────────────────────── */

.break-reminder-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 2px;
  padding: 12px 16px;
  background: rgba(239,68,68,.08);
  border-left: 4px solid var(--red);
  border-bottom: 1px solid rgba(239,68,68,.2);
  animation: break-pulse 2.5s ease-in-out infinite;
}
@keyframes break-pulse {
  0%,100% { background: rgba(239,68,68,.08); }
  50%      { background: rgba(239,68,68,.13); }
}
.break-reminder-icon { font-size: 1.4rem; flex-shrink: 0; }
.break-reminder-body { flex: 1; min-width: 0; }
.break-reminder-body strong { display: block; font-size: .88rem; font-weight: 800; color: var(--red); }
.break-reminder-body span   { font-size: .78rem; color: var(--text-muted); }
.break-reminder-btn {
  flex-shrink: 0; padding: 7px 13px;
  background: var(--red); color: #fff; border: none; border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: filter .15s;
}
.break-reminder-btn:hover { filter: brightness(1.08); }

.pauze-banner {
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--orange-light); border: 1px solid rgba(26,115,232,.3);
}
.pauze-label { font-size: .84rem; font-weight: 700; color: var(--orange-dark); }
.btn-hervat {
  background: var(--orange); color: #fff; border: none;
  border-radius: var(--radius-pill); padding: 6px 14px;
  font-size: .78rem; font-weight: 700; cursor: pointer;
}
.pauze-row { display: flex; gap: 6px; align-items: center; }
.btn-pauze {
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-pill);
  padding: 7px 14px; font-size: .78rem; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: background .12s;
}
.btn-pauze:hover { background: var(--border); }
.btn-reset-pauze {
  background: none; border: none; color: var(--text-faint);
  font-size: .72rem; font-weight: 600; cursor: pointer; font-family: inherit;
  padding: 4px 8px; border-radius: var(--radius-pill);
}
.btn-dag-stoppen {
  margin-left: auto; background: var(--red-bg);
  border: 1.5px solid rgba(239,68,68,.2); color: var(--red);
  border-radius: var(--radius-pill); padding: 7px 14px;
  font-size: .78rem; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: background .12s;
}
.btn-dag-stoppen:hover { background: rgba(239,68,68,.15); }

/* ─── Compact toggle button ──────────────────────────────────────────────────── */

.btn-compact-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-compact-toggle:hover  { background: var(--orange-light); border-color: rgba(26,115,232,.3); color: var(--orange); }
.btn-compact-toggle--on    { background: var(--orange-light); border-color: rgba(26,115,232,.3); color: var(--orange); }

/* ─── Compact stop row ───────────────────────────────────────────────────────── */

.compact-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  min-height: 40px;
}
.compact-row--active { background: rgba(26,115,232,.05); }
.compact-row--done   { opacity: .45; }
.compact-row-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 800; color: var(--text-muted);
}
.compact-row-num--active { background: var(--orange); border-color: var(--orange); color: #fff; }
.compact-row-addr {
  flex: 1; font-size: .8rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.compact-row-eta  { flex-shrink: 0; font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.compact-row-nav  {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--orange-light); border: none; color: var(--orange);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.compact-row-nav:active { transform: scale(.92); }
.compact-row-check {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.compact-row-check:hover  { background: rgba(16,185,129,.12); border-color: #10b981; color: #10b981; }
.compact-row-check:active { transform: scale(.92); }
.compact-row-check--done  { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #10b981; }

/* ─── Optimize / lock buttons ───────────────────────────────────────────────── */

.btn-optimize-manual {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: background .12s, color .12s, transform .12s;
}
.btn-optimize-manual:hover { background: var(--orange-light); border-color: rgba(26,115,232,.3); color: var(--orange); }
.btn-optimize-manual.spinning svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-lock-route {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px;
  font-size: .74rem; font-weight: 700; font-family: inherit;
  background: var(--orange-light); border: 1.5px solid rgba(26,115,232,.3);
  color: var(--orange-dark); border-radius: var(--radius-pill);
  cursor: pointer; transition: background .12s;
}
.btn-lock-route:hover { background: rgba(26,115,232,.18); }
.route-locked-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px;
  font-size: .74rem; font-weight: 700; font-family: inherit;
  background: var(--orange); border: none; color: #fff;
  border-radius: var(--radius-pill); cursor: pointer;
  box-shadow: var(--shadow-orange);
}

/* ─── Stop list inline progress bar ─────────────────────────────────────────── */

.stop-list-progress {
  height: 3px; background: var(--border); border-radius: var(--radius-pill);
  margin: 0; overflow: hidden; width: 60px; flex-shrink: 0;
}
.stop-list-progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--orange), #60a5fa);
  transition: width .9s cubic-bezier(.4,0,.2,1);
}

/* ─── Route tijdschema ───────────────────────────────────────────────────────── */

.route-tijdschema {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; margin: 0 0 8px;
  box-shadow: var(--shadow-xs);
}
.rts-field { display: flex; flex-direction: column; gap: 2px; }
.rts-label { font-size: .64rem; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.rts-input {
  background: var(--surface-3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: .88rem; font-weight: 700; padding: 5px 8px; width: 88px;
  outline: none; -webkit-appearance: none; font-family: inherit;
}
.rts-input:focus { border-color: var(--orange); }
.rts-arrow { color: var(--text-faint); font-size: .9rem; flex-shrink: 0; }
.rts-eta { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.rts-eta-label { font-size: .62rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.rts-eta-time  { font-size: .95rem; font-weight: 800; color: #059669; }
.rts-eta.rts-eta-tight .rts-eta-time { color: var(--orange); }
.rts-eta.rts-eta-late  .rts-eta-time { color: var(--red); }

/* ─── Late / tight banners ───────────────────────────────────────────────────── */

.route-late-banner {
  background: var(--red-bg); border: 1px solid rgba(239,68,68,.2);
  border-left: 3px solid var(--red); color: var(--red);
  border-radius: var(--radius-sm); padding: 9px 13px;
  font-size: .8rem; font-weight: 700; margin-bottom: 8px;
}
.route-tight-banner {
  background: var(--orange-light); border: 1px solid rgba(26,115,232,.3);
  border-left: 3px solid var(--orange); color: var(--orange-dark);
  border-radius: var(--radius-sm); padding: 9px 13px;
  font-size: .8rem; font-weight: 700; margin-bottom: 8px;
}

/* ─── Stop ETA badges ────────────────────────────────────────────────────────── */

.stop-eta-badge {
  display: inline-block; padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--text-faint);
  font-size: .68rem; font-weight: 700; border: 1px solid var(--border);
}
.stop-eta-badge.stop-eta-tight { background: var(--orange-light); color: var(--orange); border-color: rgba(26,115,232,.3); }
.stop-eta-badge.stop-eta-late  { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,.2); }

/* ─── Route violation banner ─────────────────────────────────────────────────── */

.route-violations-banner {
  background: var(--orange-light); border: 1px solid rgba(26,115,232,.3);
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin-bottom: 8px;
}
.rvb-title { font-size: .8rem; font-weight: 700; color: var(--orange-dark); margin: 0 0 6px; }
.rvb-list  { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rvb-item  { font-size: .75rem; color: var(--orange-dark); display: flex; gap: 5px; align-items: flex-start; }

/* ─── Priority star (failed panel) ─────────────────────────────────────────── */

.failed-panel-title { color: var(--red); }

/* ─── Signature thumb ───────────────────────────────────────────────────────── */

.sig-thumb-row { padding: 4px 0 0; }
.sig-thumb {
  max-width: 110px; max-height: 42px; display: block;
  border-radius: 6px; border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAP TAB — full-screen delivery map
   All map overlays remain dark regardless of light/dark mode for readability.
   ═══════════════════════════════════════════════════════════════════════════════ */

.tab-pane.fullscreen-map .map-wrapper {
  position: relative; width: 100%;
  height: calc(100vh - 148px); height: calc(100dvh - 148px);
  min-height: 500px; overflow: hidden;
}
.map-view { width: 100%; height: 100%; }

/* ── Shared glass surface ── */
.map-glass {
  background: rgba(8,12,28,.9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.09); box-shadow: 0 8px 28px rgba(0,0,0,.36);
}

/* ── Progress pill — top-centre, slim ── */
.map-progress-pill {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 10; pointer-events: none;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 11px; border-radius: var(--radius-pill);
  background: rgba(8,12,28,.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 12px rgba(0,0,0,.28);
  white-space: nowrap;
}
.map-route-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0;
  animation: map-pulse 1.8s ease-out infinite;
}
@keyframes map-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(26,115,232,.7); }
  70%  { box-shadow: 0 0 0 7px rgba(26,115,232,0); }
  100% { box-shadow: 0 0 0 0 rgba(26,115,232,0); }
}
.map-pp-text { font-size: .74rem; font-weight: 800; color: #f1f5f9; letter-spacing: -.01em; }
.map-pp-of   { font-weight: 400; color: rgba(255,255,255,.45); }
.map-pp-track {
  width: 52px; height: 4px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.12); overflow: hidden;
}
.map-pp-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--orange) 0%, #60a5fa 100%);
  transition: width .7s cubic-bezier(.4,0,.2,1);
}

/* ── FAB controls — bottom-right, Spoke-style ── */
.map-fabs {
  position: absolute; bottom: 210px; right: 14px; z-index: 10;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.map-fab {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); color: #374151;
  transition: background .15s, color .15s, box-shadow .15s;
}
.map-fab:hover { background: #ffffff; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.map-fab:disabled { opacity: .35; cursor: not-allowed; }
.map-fab-active { background: var(--orange) !important; color: #ffffff !important; box-shadow: 0 2px 10px rgba(26,115,232,.4) !important; }
.map-fab-gps    { background: #1A73E8 !important; color: #ffffff !important; box-shadow: 0 2px 10px rgba(26,115,232,.4) !important; }

/* ── Status pill (loading / error) ── */
.map-status-pill {
  /* Anchored at the top — the center is where Google renders its own error UI */
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: var(--radius-pill);
  background: rgba(8,12,28,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: #f1f5f9; font-size: .86rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 10px 32px rgba(0,0,0,.42);
  white-space: nowrap;
}
.map-status-loading { color: #94a3b8; }

/* ── Stop mini-list panel ── */
.map-stoplist-panel {
  position: absolute; bottom: 220px; left: 12px; right: 12px; z-index: 15;
  background: rgba(8,12,28,.95); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius-lg);
  overflow: hidden; max-height: 300px; box-shadow: 0 12px 36px rgba(0,0,0,.45);
}
.map-sl-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .76rem; font-weight: 800; color: #94a3b8; letter-spacing: .04em; text-transform: uppercase;
}
.map-sl-close { background: none; border: none; color: #475569; cursor: pointer; padding: 2px 8px; font-size: 1rem; }
.map-sl-list  { overflow-y: auto; max-height: 240px; }
.map-sl-item  {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 16px; text-align: left; background: none; border: none;
  border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer;
  transition: background .12s;
}
.map-sl-item:hover  { background: rgba(255,255,255,.05); }
.map-sl-active      { background: rgba(26,115,232,.12) !important; }
.map-sl-rank {
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.07);
  color: #94a3b8; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.map-sl-rank-active { background: var(--orange); color: #fff; }
.map-sl-info  { display: grid; gap: 2px; min-width: 0; }
.map-sl-addr  { font-size: .82rem; font-weight: 700; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-sl-eta   { font-size: .7rem; color: #475569; }


/* ── Bottom route panel ── */
@keyframes bp-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.map-bottom-panel {
  position: absolute; bottom: 12px; left: 12px; right: 12px; z-index: 10;
  background: rgba(8,12,28,.94); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
  padding: 16px 16px 14px; box-shadow: 0 16px 44px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.05);
  display: flex; flex-direction: column; gap: 12px;
}
.map-bottom-panel--fresh { animation: bp-enter .24s cubic-bezier(.2,.8,.2,1); }

/* Header row */
.map-bp-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.map-bp-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #475569;
}
.map-bp-label-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--orange); flex-shrink: 0;
  animation: map-pulse 1.8s ease-out infinite;
}
.map-bp-badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.map-bp-side {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: var(--radius-pill);
  letter-spacing: .02em; white-space: nowrap;
}
.map-bp-side--links  { background: rgba(59,130,246,.2);  color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
.map-bp-side--rechts { background: rgba(236,72,153,.15); color: #f9a8d4; border: 1px solid rgba(236,72,153,.25); }
.map-bp-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.map-bp-badge--walk   { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.map-bp-badge--street { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }
.map-bp-badge--back   { background: rgba(26,115,232,.15); color: #60a5fa; border: 1px solid rgba(26,115,232,.25); }

/* Address block */
.map-bp-addr-block { display: flex; flex-direction: column; gap: 3px; }
.map-bp-addr {
  font-size: 1.06rem; font-weight: 800; color: #f1f5f9;
  word-break: break-word; line-height: 1.25; letter-spacing: -.01em;
}
.map-bp-business { display: flex; align-items: center; gap: 6px; }
.map-bp-sub    { font-size: .8rem; color: #94a3b8; font-weight: 500; }
.map-bp-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.map-bp-apt    { font-size: .74rem; color: #475569; background: rgba(255,255,255,.07); padding: 1px 7px; border-radius: var(--radius-pill); }
.map-bp-notes  { display: flex; align-items: flex-start; gap: 5px; font-size: .76rem; color: #94a3b8; font-style: italic; }
.map-bp-notes svg { flex-shrink: 0; margin-top: 1px; opacity: .6; }
.map-bp-street-group { display: flex; align-items: center; gap: 7px; font-size: .73rem; color: #818cf8; }
.map-bp-sg-dot { width: 7px; height: 7px; border-radius: 50%; background: #818cf8; flex-shrink: 0; }

/* Stats row */
.map-bp-stats {
  display: flex; align-items: center;
  background: rgba(255,255,255,.04); border-radius: 10px;
  padding: 10px 14px; gap: 0;
}
.map-bp-stat {
  display: flex; align-items: center; gap: 8px; flex: 1;
}
.map-bp-stat-ico { color: #475569; flex-shrink: 0; }
.map-bp-stat-info { display: flex; flex-direction: column; gap: 1px; }
.map-bp-val  { font-size: .94rem; font-weight: 800; color: #f1f5f9; line-height: 1; }
.map-bp-key  { font-size: .62rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #475569; }
.map-bp-stat-sep {
  width: 1px; height: 30px; background: rgba(255,255,255,.07); flex-shrink: 0; margin: 0 8px;
}

/* Navigate button */
.map-bp-nav-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--orange); color: #fff;
  font-size: .9rem; font-weight: 800; font-family: inherit;
  cursor: pointer; transition: filter .15s, transform .1s;
  box-shadow: 0 4px 18px rgba(26,115,232,.45), inset 0 1px 0 rgba(255,255,255,.2);
  letter-spacing: -.01em;
}
.map-bp-nav-btn:hover  { filter: brightness(1.08); }
.map-bp-nav-btn:active { transform: scale(.98); }

/* ─── Google Places Autocomplete dropdown (injected into <body> by Google) ───── */

.pac-container {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-family: inherit; z-index: 1300; margin-top: 4px; overflow: hidden;
}
.pac-item { padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .82rem; cursor: pointer; }
.pac-item:first-child { border-top: none; }
.pac-item:hover, .pac-item-selected { background: var(--surface-2); }
.pac-item-query { color: var(--text); font-size: .86rem; font-weight: 600; }
.pac-icon { filter: grayscale(1); }

/* ─── Map marker InfoWindow content ──────────────────────────────────────────── */

.map-iw { display: grid; gap: 6px; font-family: 'Inter', system-ui, sans-serif; padding: 2px; min-width: 180px; }
.map-iw-header { display: flex; align-items: center; gap: 8px; }
.map-iw-rank {
  min-width: 22px; height: 22px; border-radius: 50%; background: var(--orange);
  color: #fff; font-size: .72rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.map-iw-addr { font-weight: 700; font-size: .84rem; color: #0d1b2e; }
.map-iw-place, .map-iw-apt { font-size: .74rem; color: #4a6a8a; }
.map-iw-meta { display: flex; gap: 10px; font-size: .74rem; color: #4a6a8a; }
.map-iw-actions { display: flex; gap: 6px; margin-top: 4px; }
.map-iw-btn { flex: 1; border: none; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
.map-iw-nav { background: var(--orange); color: #fff; }
.map-iw-done-btn { background: rgba(16,185,129,.12); color: #059669; }
.map-iw-undo { background: #edf2f9; color: #4a6a8a; }
.map-iw-done .map-iw-addr { text-decoration: line-through; opacity: .6; }

/* ─── Small missing component styles ─────────────────────────────────────────── */

.spinner-svg { animation: spin .7s linear infinite; }

.stop-note-row { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; }
.stop-note-text { flex: 1; font-size: .78rem; color: var(--text-muted); line-height: 1.45; }
.stop-note-edit-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.stop-note-edit-btn:hover { color: var(--orange); background: var(--orange-light); }

.done-tag, .stop-completed-time { font-size: .72rem; color: #059669; font-weight: 600; }

.laad-los-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill); font-size: .7rem; font-weight: 700; }
.laad-los-badge--green  { background: rgba(16,185,129,.1); color: #059669; }
.laad-los-badge--orange { background: rgba(245,158,11,.12); color: #b45309; }
.laad-los-badge--red    { background: var(--red-bg); color: var(--red); }
.laad-los-label { opacity: .85; font-weight: 600; }

/* Restriction form (Nieuwe restrictie modal) */
.restriction-form-body { padding: 16px 20px; display: grid; gap: 12px; }
.rf-label { display: grid; gap: 5px; font-size: .76rem; font-weight: 700; color: var(--text-muted); }
.rf-input {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; font-size: .86rem;
}
.rf-input:focus { border-color: var(--orange); outline: none; }
.rf-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rf-days-grid { display: flex; gap: 5px; flex-wrap: wrap; }
.rf-day-btn { padding: 6px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .74rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.rf-day-btn--on { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.rf-toggle-row { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--text); }
.rf-toggle-track { width: 40px; height: 22px; border-radius: 999px; background: var(--border-2); position: relative; transition: background .15s; cursor: pointer; flex-shrink: 0; }
.rf-toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: var(--shadow-xs); }
.rf-toggle-track--on { background: #10b981; }
.rf-toggle-track--on::after { left: 20px; }
.rf-hint { font-size: .74rem; color: var(--text-faint); line-height: 1.45; }

/* Scanner partials that were unstyled */
.addr-scan-capture-row { display: flex; gap: 8px; margin: 0 20px 10px; }
.addr-scan-hint { font-size: .78rem; color: var(--text-muted); margin: 8px 20px; line-height: 1.5; }
.addr-scan-note { font-size: .72rem; color: var(--text-faint); margin: 0 20px 10px; }
.addr-scan-processing { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 20px; }
.addr-scan-progress-bar { width: 100%; height: 5px; background: var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.addr-scan-progress-fill { height: 100%; background: var(--orange); border-radius: var(--radius-pill); transition: width .3s; }
.addr-scan-status { font-size: .8rem; color: var(--text-muted); }
.paper-scan-checkbox { width: 17px; height: 17px; accent-color: var(--orange); cursor: pointer; flex-shrink: 0; }
.paper-scan-delete-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: .9rem; }
.paper-scan-delete-btn:hover { color: var(--red); background: var(--red-bg); }
.paper-scan-edit-input { width: 100%; font-size: .82rem; font-family: inherit; padding: 4px 8px; border: 1.5px solid var(--orange); border-radius: 6px; outline: none; background: var(--surface); color: var(--text); }
.paper-scan-add-manual { background: none; border: 1.5px dashed var(--border); color: var(--text-muted); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .78rem; font-family: inherit; cursor: pointer; width: calc(100% - 40px); margin: 0 20px 10px; }
.paper-scan-add-manual:hover { border-color: var(--orange); color: var(--orange); }

/* ─── Toast notifications ────────────────────────────────────────────────────── */

.toast-container {
  position: fixed; bottom: calc(72px + max(0px, env(safe-area-inset-bottom)));
  left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: min(420px, 94vw);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--text); color: #fff;
  box-shadow: var(--shadow-lg); pointer-events: all;
  animation: toast-in .22s cubic-bezier(.2,.8,.2,1);
  border-left: 3px solid var(--border-2);
  font-size: .84rem; font-weight: 600;
}
.toast-success { border-left-color: #10b981; }
.toast-info    { border-left-color: #3b82f6; }
.toast-error   { border-left-color: #ef4444; }
.toast-msg  { flex: 1; }
.toast-action {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  border-radius: var(--radius-sm); padding: 4px 10px; font-size: .74rem;
  font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.toast-action:hover { background: rgba(255,255,255,.25); }
.toast-close {
  background: none; border: none; color: rgba(255,255,255,.5);
  cursor: pointer; font-size: .9rem; padding: 0 2px; flex-shrink: 0;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Modal ─────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,.48); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,.06);
  width: min(520px, 96vw); max-height: 88vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 0;
  animation: modal-in .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(-6px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: .88rem;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-hint { margin: 14px 20px 4px; font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ─── EditStop modal (bottom-sheet variant) ─────────────────────────────────── */

.modal-card { width:100%;max-width:540px;background:var(--surface);border-radius:20px 20px 0 0;padding:0 0 max(16px,env(safe-area-inset-bottom));box-shadow:var(--shadow-xl); }
.modal-title { font-size:1rem;font-weight:800;color:var(--text);margin:0; }
.modal-body { padding:16px 18px;display:flex;flex-direction:column;gap:8px; }
.modal-footer .btn { flex:1; }

/* ─── Confirm dialog ────────────────────────────────────────────────────────── */

.confirm-overlay { position: fixed; inset: 0; z-index: 1500; background: rgba(0,0,0,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.confirm-box {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 24px 24px 20px; width: min(360px, 92vw);
  box-shadow: var(--shadow-xl); animation: modal-in .2s cubic-bezier(.2,.8,.2,1);
}
.confirm-box p { margin: 0 0 20px; font-size: .9rem; color: var(--text); line-height: 1.5; font-weight: 500; }
.confirm-box footer { display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Lightbox ──────────────────────────────────────────────────────────────── */

.lightbox-backdrop { position: fixed; inset: 0; z-index: 1800; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox-content { position: relative; max-width: min(920px, 96vw); width: 100%; }
.lightbox-content img { width: 100%; max-height: 80vh; object-fit: contain; border-radius: var(--radius-md); display: block; }
.lightbox-pano { width: 100%; height: min(70vh, 560px); border-radius: var(--radius-md); overflow: hidden; }
.lightbox-caption { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px 0; color: #fff; }
.lightbox-caption span { font-size: .78rem; color: rgba(255,255,255,.65); }
.lightbox-close { position: fixed; top: 18px; right: 18px; z-index: 1810; background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; }

/* ─── Bulk import ────────────────────────────────────────────────────────────── */

.bulk-textarea {
  width: 100%; min-height: 180px; padding: 12px 14px;
  margin: 0 0 4px; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); background: var(--surface-3);
  color: var(--text); font-size: .84rem; font-family: inherit;
  resize: vertical; outline: none; line-height: 1.6;
}
.bulk-textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.bulk-progress { display: flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--text-muted); margin: 6px 20px; }
.bulk-progress svg { animation: spin .7s linear infinite; }

.bulk-file-row { margin: 2px 20px 8px; }

.bulk-preview {
  margin: 4px 20px 10px; padding: 10px 12px;
  background: rgba(16,185,129,.06); border: 1px solid rgba(16,185,129,.25);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 4px;
  max-height: 180px; overflow-y: auto;
}
.bulk-preview-count { font-size: .8rem; font-weight: 800; color: #059669; margin-bottom: 2px; }
.bulk-preview-item {
  font-size: .78rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bulk-preview-more { font-size: .74rem; color: var(--text-muted); text-align: center; padding: 2px 0; }
.bulk-fallback-hint { font-size: .76rem; color: var(--text-muted); margin: 4px 20px 8px; }

/* ─── Camera / scanner ──────────────────────────────────────────────────────── */

.qr-video-wrap { position: relative; border-radius: var(--radius-md); overflow: hidden; background: #000; margin: 0 20px 12px; }
.qr-video { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.qr-error { margin: 14px 20px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--red-bg); border: 1px solid rgba(239,68,68,.2); color: var(--red); font-size: .82rem; }
.qr-starting { margin: 0 20px 12px; font-size: .8rem; color: var(--text-muted); text-align: center; }

/* ─── Full-screen address scanner (Spoke-style) ─────────────────────────────── */

.addr-fs-overlay { position: fixed; inset: 0; z-index: 1200; background: #000; overflow: hidden; }
.addr-fs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .3s; }
.addr-fs-video--dim { opacity: .4; }

.addr-fs-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 48px 16px 16px; background: linear-gradient(to bottom, rgba(0,0,0,.65) 0%, transparent 100%); }
.addr-fs-title { color: #fff; font-size: .92rem; font-weight: 600; letter-spacing: .01em; }
.addr-fs-icon-btn { background: none; border: none; padding: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; }

.addr-fs-vf { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -58%); width: 76%; max-width: 320px; aspect-ratio: 1.55; pointer-events: none; }
.addr-fs-vf-tl, .addr-fs-vf-tr, .addr-fs-vf-bl, .addr-fs-vf-br { position: absolute; width: 26px; height: 26px; }
.addr-fs-vf-tl { top: 0; left: 0;  border-top: 3px solid #fff; border-left:  3px solid #fff; border-radius: 5px 0 0 0; }
.addr-fs-vf-tr { top: 0; right: 0; border-top: 3px solid #fff; border-right: 3px solid #fff; border-radius: 0 5px 0 0; }
.addr-fs-vf-bl { bottom: 0; left: 0;  border-bottom: 3px solid #fff; border-left:  3px solid #fff; border-radius: 0 0 0 5px; }
.addr-fs-vf-br { bottom: 0; right: 0; border-bottom: 3px solid #fff; border-right: 3px solid #fff; border-radius: 0 0 5px 0; }

.addr-fs-hint { position: absolute; bottom: 148px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.88); font-size: .78rem; white-space: nowrap; background: rgba(0,0,0,.45); padding: 5px 14px; border-radius: var(--radius-pill); pointer-events: none; }
.addr-fs-bottom-bar { position: absolute; bottom: 32px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 0; }
.addr-fs-shutter { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2); border: 3px solid #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.addr-fs-shutter-inner { width: 52px; height: 52px; border-radius: 50%; background: #fff; }
.addr-fs-gallery-btn { width: 56px; font-size: .7rem; color: rgba(255,255,255,.8); background: none; border: none; cursor: pointer; text-align: center; padding: 4px; }

.addr-fs-processing { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 20; color: #fff; }
.addr-fs-processing svg { width: 36px; height: 36px; animation: spin .8s linear infinite; }
.addr-fs-proc-msg { color: #fff; font-size: .9rem; font-weight: 600; }
.addr-fs-prog-bar { width: 220px; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; overflow: hidden; }
.addr-fs-prog-fill { height: 100%; background: #fff; transition: width .3s; }
.addr-fs-proc-note { font-size: .7rem; color: rgba(255,255,255,.6); }

.addr-fs-added-flash { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 30; background: rgba(26,115,232,.75); }
.addr-fs-added-flash span { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; }

.addr-fs-sheet { position: absolute; bottom: 0; left: 0; right: 0; z-index: 25; background: #fff; border-radius: 20px 20px 0 0; padding: 8px 20px 40px; box-shadow: 0 -6px 32px rgba(0,0,0,.22); max-height: 70vh; overflow-y: auto; }
.addr-fs-sheet-handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; margin: 0 auto 18px; }
.addr-fs-street { margin: 0 0 3px; font-size: 1.28rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.2; }
.addr-fs-city { margin: 0 0 18px; font-size: .9rem; color: var(--text-muted); }
.addr-fs-noaddr { margin: 0 0 16px; font-size: 1rem; font-weight: 600; color: var(--text-2); }
.addr-fs-candidates { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.addr-fs-cand { text-align: left; padding: 8px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--bg-card); font-size: .83rem; color: var(--text); cursor: pointer; }
.addr-fs-cand--active { border-color: var(--orange); background: var(--orange-light); color: var(--orange); }
.addr-fs-btn-add { width: 100%; padding: 15px; border-radius: var(--radius-md); background: var(--orange); color: #fff; font-size: 1rem; font-weight: 700; border: none; cursor: pointer; margin-bottom: 10px; letter-spacing: .01em; }
.addr-fs-btn-add:disabled { opacity: .35; cursor: not-allowed; }
.addr-fs-btn-photo { width: 100%; padding: 13px; border-radius: var(--radius-md); background: var(--orange-light); color: var(--orange); font-size: .92rem; font-weight: 600; border: 1.5px solid rgba(26,115,232,.2); cursor: pointer; margin-bottom: 12px; }
.addr-fs-btn-photo:disabled { opacity: .35; cursor: not-allowed; }
.addr-fs-wrong-toggle { background: none; border: none; color: var(--text-muted); font-size: .82rem; cursor: pointer; padding: 4px 0; display: block; width: 100%; text-align: center; }
.addr-fs-wrong-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ─── Depot empty state ─────────────────────────────────────────────────────── */

.depot-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 24px 32px; text-align: center; }
.depot-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(26,115,232,.10); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.depot-empty-title { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.depot-empty-sub { margin: 0; font-size: .85rem; color: var(--text-muted); max-width: 260px; line-height: 1.45; }
.depot-empty-btn { display: flex; align-items: center; gap: 7px; margin-top: 8px; padding: 13px 28px; border-radius: var(--radius-md); background: var(--orange); color: #fff; font-size: .97rem; font-weight: 700; border: none; cursor: pointer; letter-spacing: .01em; box-shadow: var(--shadow-orange); }
.depot-empty-btn svg { width: 16px; height: 16px; }
.depot-empty-or { margin: 0; font-size: .75rem; color: var(--text-faint); }

/* ─── Paper scan modal ───────────────────────────────────────────────────────── */

.paper-scan-modal-box { max-width: 540px; width: 96vw; }
.paper-scan-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.paper-scan-frame { width: 88%; aspect-ratio: 3/4; border: 2px solid rgba(26,115,232,.7); border-radius: 10px; box-shadow: 0 0 0 3000px rgba(0,0,0,.35); }
.paper-scan-review { padding: 0 20px 16px; }
/* Multi-page result screen */
.paper-page-badge { margin-left: 8px; font-size: .7rem; font-weight: 700; background: var(--orange); color: #fff; padding: 2px 7px; border-radius: var(--radius-pill); vertical-align: middle; }
.paper-page-result { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px 20px; text-align: center; }
.paper-page-result-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(26,115,232,.10); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.paper-page-result-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--text); }
.paper-page-result-sub { margin: 0 0 6px; font-size: .87rem; color: var(--text-muted); }
.paper-page-preview { display: flex; flex-direction: column; gap: 4px; width: 100%; margin-bottom: 6px; }
.paper-page-preview-item { font-size: .78rem; color: var(--text-2); background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.paper-page-preview-more { font-size: .75rem; color: var(--text-muted); text-align: center; padding: 2px 0; }
.paper-page-btn { width: 100%; margin-bottom: 8px; }

.paper-scan-review-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: .84rem; font-weight: 600; color: var(--text); }
.paper-scan-dupe-count { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.paper-scan-review-actions { display: flex; gap: 6px; }
.paper-scan-list { display: grid; gap: 5px; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.paper-scan-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface); transition: border-color .12s;
}
.paper-scan-row--checked { border-color: rgba(16,185,129,.25); background: rgba(16,185,129,.04); }
.paper-scan-row--dupe    { border-color: rgba(26,115,232,.25); background: rgba(26,115,232,.04); }
.paper-scan-check { display: flex; align-items: center; }
.paper-scan-check input { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; }
.paper-scan-addr-edit { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.paper-scan-addr { font-size: .82rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-scan-addr-input { width: 100%; font-size: .82rem; font-family: inherit; padding: 3px 7px; border: 1.5px solid var(--orange); border-radius: 6px; outline: none; background: var(--surface); color: var(--text); }
.paper-scan-dupe-tag { font-size: .65rem; font-weight: 700; color: var(--orange-dark); background: var(--orange-light); padding: 1px 7px; border-radius: var(--radius-pill); white-space: nowrap; }
.paper-scan-pdok-ok      { font-size: .8rem; font-weight: 700; color: #10b981; flex-shrink: 0; }
.paper-scan-pdok-warn    { font-size: .8rem; font-weight: 700; color: var(--orange); flex-shrink: 0; }
.paper-scan-pdok-pending { font-size: .75rem; color: var(--text-faint); flex-shrink: 0; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.paper-scan-move-col { display: flex; flex-direction: column; gap: 2px; }
.paper-scan-move-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: .6rem; padding: 1px 3px; line-height: 1; }
.paper-scan-move-btn:disabled { opacity: .25; cursor: not-allowed; }
.paper-scan-edit-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.paper-scan-edit-btn:hover { background: var(--surface-3); color: var(--text); }
.paper-scan-del-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 4px; border-radius: 4px; flex-shrink: 0; }
.paper-scan-del-btn:hover { color: var(--red); background: var(--red-bg); }
.paper-scan-add-row { padding: 6px 0; }
.btn-ghost { background: none; border: none; color: var(--text-muted); font-size: .74rem; font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: var(--radius-sm); font-family: inherit; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

/* ─── Zones / restrictions tab ───────────────────────────────────────────────── */

.zones-tab { background: var(--surface); }

.zones-hero {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.zones-hero-text { flex: 1; min-width: 0; }
.zones-hero-text h2 { font-size: .92rem; font-weight: 800; color: var(--text); letter-spacing: 0; text-transform: none; margin: 0 0 4px; }
.zones-hero-text p  { margin: 0; font-size: .78rem; color: var(--text-muted); line-height: 1.5; }

.zones-start-time-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.zones-stc-left { display: flex; align-items: center; gap: 10px; color: var(--text-muted); flex: 1; min-width: 0; }
.zones-stc-left div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.zones-stc-left strong { font-size: .84rem; font-weight: 700; color: var(--text); }
.zones-stc-left small  { font-size: .72rem; color: var(--text-muted); }
.zones-time-input {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: .88rem; font-family: inherit;
  outline: none; -webkit-appearance: none; flex-shrink: 0;
}
.zones-time-input:focus { border-color: var(--orange); }

.zones-active-badge {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  font-size: .76rem; font-weight: 700; color: var(--orange-dark);
  background: var(--orange-light); border-bottom: 1px solid rgba(26,115,232,.2);
}

.zones-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 40px 20px; text-align: center;
}
.zones-empty-state svg  { color: var(--text-faint); opacity: .5; }
.zones-empty-state p    { margin: 0; font-size: .88rem; font-weight: 600; color: var(--text-muted); }
.zones-empty-state small { font-size: .78rem; color: var(--text-faint); line-height: 1.5; max-width: 280px; }

/* Flat row zone list */
.zones-list { display: flex; flex-direction: column; }
.zone-list  { display: flex; flex-direction: column; } /* legacy alias */

.zone-card {
  background: var(--surface); border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  transition: background .1s;
}
.zone-card:hover { background: var(--surface-2); }
.zone-card--inactive { opacity: .45; }

.zone-card-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.zone-type-pill {
  flex-shrink: 0; display: inline-block; padding: 2px 8px;
  border-radius: var(--radius-pill); font-size: .65rem; font-weight: 800;
  color: #fff; letter-spacing: .03em;
}
.zone-card-name {
  flex: 1; font-size: .9rem; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.zone-card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

/* Small icon buttons */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn--danger:hover { background: var(--red-bg); color: var(--red); }

.zone-card-body { display: grid; gap: 4px; }

.zone-time-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-muted); }
.zone-time-text { font-size: .82rem; font-weight: 700; color: var(--text); }
.zone-days-row  { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.day-chip {
  padding: 1px 5px; border-radius: 4px; font-size: .64rem; font-weight: 700;
  background: var(--surface-3); color: var(--text-faint); border: 1px solid var(--border);
}
.day-chip--on { background: var(--orange); color: #fff; border-color: var(--orange); }

.zone-inactive-label { font-size: .72rem; color: var(--text-faint); font-style: italic; }
.zone-addr-line, .zone-match-line, .zone-notes-line { display: flex; align-items: flex-start; gap: 5px; font-size: .74rem; color: var(--text-muted); margin-top: 2px; }
.zone-match-label { color: var(--text-faint); }
.zone-match-val   { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .72rem; color: var(--text-2); }

/* ─── Restriction form modal ─────────────────────────────────────────────────── */

.restriction-form-grid { display: grid; gap: 14px; padding: 16px 20px; }
.restriction-form-section h4 { margin: 0 0 8px; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.restriction-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--text); cursor: pointer; }
.restriction-checkbox-row input { width: 17px; height: 17px; accent-color: var(--orange); }
.time-window-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.time-input { padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .88rem; font-family: inherit; outline: none; width: 96px; -webkit-appearance: none; }
.time-input:focus { border-color: var(--orange); }
.add-time-window-btn { background: none; border: 1.5px dashed var(--border); color: var(--text-faint); border-radius: var(--radius-sm); padding: 7px 12px; font-size: .76rem; font-family: inherit; cursor: pointer; }
.add-time-window-btn:hover { border-color: var(--orange); color: var(--orange); }
.remove-time-window-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 6px; font-size: .84rem; border-radius: 4px; }
.remove-time-window-btn:hover { color: var(--red); background: var(--red-bg); }
.match-type-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.match-type-btn { padding: 5px 12px; border-radius: var(--radius-pill); border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .74rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s; }
.match-type-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.restriction-input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .86rem; font-family: inherit; outline: none; }
.restriction-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.restriction-label { font-size: .8rem; font-weight: 700; color: var(--text-2); margin-bottom: 4px; display: block; }
.restriction-hint  { font-size: .72rem; color: var(--text-faint); margin-top: 4px; display: block; }

/* ─── Laad-los badge ─────────────────────────────────────────────────────────── */

.laadlos-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: .7rem; font-weight: 700; border: 1px solid; }
.laadlos-ok     { background: rgba(16,185,129,.08); color: #059669; border-color: rgba(16,185,129,.2); }
.laadlos-warn   { background: var(--orange-light); color: var(--orange); border-color: rgba(26,115,232,.3); }
.laadlos-closed { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,.2); }

/* ─── Route violations banner ────────────────────────────────────────────────── */

.route-violations-banner { background: var(--orange-light); border: 1px solid rgba(26,115,232,.3); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; }
.rvb-title { font-size: .78rem; font-weight: 800; color: var(--orange-dark); margin: 0 0 5px; }
.rvb-list  { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.rvb-item  { font-size: .72rem; color: var(--orange-dark); }

/* ─── History tab ────────────────────────────────────────────────────────────── */

.history-card { opacity: 1; }
.history-signature { margin: 6px 0 0; }
.history-signature img { max-width: 100px; max-height: 36px; border-radius: 5px; border: 1px solid var(--border); }

/* ─── Alerts tab ─────────────────────────────────────────────────────────────── */

.no-alerts-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: rgba(16,185,129,.04);
  border-bottom: 1px solid rgba(16,185,129,.15);
  border-left: 3px solid var(--green);
}
.no-alerts-icon { font-size: 1.3rem; color: #10b981; flex-shrink: 0; }
.no-alerts-card div { display: grid; gap: 2px; }
.no-alerts-card strong { font-size: .86rem; color: var(--text); font-weight: 700; }
.no-alerts-card small  { font-size: .74rem; color: var(--text-muted); }
.alert-card {
  padding: 12px 16px; border: none; border-radius: 0; margin-bottom: 0;
  border-bottom: 1px solid var(--border); border-left: 3px solid transparent;
  display: grid; gap: 3px;
}
.alert-card strong { font-size: .84rem; color: var(--text); display: block; }
.alert-card small  { font-size: .74rem; color: var(--text-muted); display: block; }
.alert-until { color: var(--text-faint) !important; }
.alert-critical { border-left-color: var(--red); background: rgba(239,68,68,.03); }
.alert-major    { border-left-color: var(--orange); background: rgba(26,115,232,.03); }
.alert-info     { border-left-color: var(--blue); background: rgba(59,130,246,.03); }
.show-more-btn  { margin: 12px 16px; }

/* ─── Voice button ──────────────────────────────────────────────────────────── */

.btn-voice {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn-voice:hover { background: var(--orange-light); border-color: rgba(26,115,232,.3); color: var(--orange); }
.btn-voice:active { transform: scale(.9); }
.btn-voice-active {
  background: var(--orange); border-color: var(--orange); color: #fff;
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26,115,232,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(26,115,232,0); }
}

/* ─── DeliveryConfirmModal ──────────────────────────────────────────────────── */

.delivery-confirm-overlay { background: rgba(0,0,0,.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.delivery-confirm-modal {
  background: var(--surface); border-radius: var(--radius-xl); padding: 20px;
  width: min(340px, 92vw); display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-xl); animation: modal-in .2s cubic-bezier(.2,.8,.2,1);
}
.dc-addr { font-size: .86rem; color: var(--text-muted); text-align: center; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--radius-md); font-size: .95rem; font-weight: 800;
  cursor: pointer; border: none; font-family: inherit; transition: filter .12s, transform .1s;
}
.dc-btn:active { transform: scale(.96); }
.dc-deliver { background: #10b981; color: #fff; box-shadow: 0 6px 18px rgba(16,185,129,.3); }
.dc-fail    { background: var(--red-bg); border: 1.5px solid rgba(239,68,68,.25); color: var(--red); }
.dc-reason-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 0; text-align: center; }
.dc-reason-btn {
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text); font-size: .88rem; font-weight: 600; text-align: left;
  cursor: pointer; transition: background .12s, border-color .12s; font-family: inherit;
}
.dc-reason-btn:hover { background: var(--border); border-color: var(--border-2); }
.dc-back { font-size: .78rem; color: var(--text-faint); background: none; border: none; cursor: pointer; text-align: center; padding: 4px; font-family: inherit; }
.dc-back:hover { color: var(--text-muted); }

/* ─── LoginScreen ───────────────────────────────────────────────────────────── */

.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12); padding: 32px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.login-title { font-size: 1.25rem; font-weight: 800; color: var(--text); margin: 4px 0 0; text-align: center; }
.login-sub   { font-size: .82rem; color: var(--text-muted); margin: 0 0 20px; text-align: center; }
.login-form  { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-label { font-size: .75rem; font-weight: 700; color: var(--text-muted); }
.login-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 0 12px; transition: border-color .15s;
}
.login-input-wrap:focus-within { border-color: var(--orange); }
.login-input-wrap svg { color: var(--text-faint); flex-shrink: 0; }
.login-input {
  flex: 1; background: none; border: none; outline: none;
  padding: 11px 0; font-size: .9rem; color: var(--text); font-family: inherit;
}
.login-pw-toggle { background: none; border: none; cursor: pointer; color: var(--text-faint); padding: 4px; display: flex; }
.login-pw-toggle:hover { color: var(--text-muted); }
.login-error { font-size: .78rem; color: #e53e3e; margin: 0; text-align: center; }
.login-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--orange); color: #fff; font-size: .95rem; font-weight: 700;
  font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .15s;
}
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-btn:not(:disabled):hover { opacity: .9; }

/* ─── StatsTab ──────────────────────────────────────────────────────────────── */

.stats-toggle-row {
  display: flex; gap: 8px; padding: 12px 12px 0;
}
.stats-toggle-btn {
  flex: 1; padding: 9px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: .82rem; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.stats-toggle-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.stats-driver-chip {
  display: flex; align-items: center; gap: 4px;
  font-size: .76rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg); padding: 4px 9px; border-radius: 20px;
}
.stats-kpi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px;
}
.stats-kpi {
  background: var(--bg); border-radius: 12px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.stats-kpi--wide { grid-column: span 1; }
.stats-kpi-val { font-size: 1.45rem; font-weight: 900; color: var(--text); line-height: 1; }
.stats-kpi-lbl { font-size: .68rem; font-weight: 600; color: var(--text-muted); }
.stats-empty   { text-align: center; color: var(--text-faint); font-size: .85rem; padding: 24px 0; }

/* Date navigation */
.stats-date-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 10px; gap: 8px;
}
.stats-date-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.stats-date-btn:disabled { opacity: .3; cursor: not-allowed; }
.stats-date-label { flex: 1; text-align: center; font-size: .82rem; font-weight: 700; color: var(--text); }
.stats-date-dots { display: flex; gap: 5px; justify-content: center; padding: 10px 12px 4px; flex-wrap: wrap; }
.stats-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border);
  border: none; cursor: pointer; padding: 0; transition: background .15s;
}
.stats-dot--active { background: var(--orange); }

/* Shift card */
.shift-list    { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; }
.shift-card    { background: var(--bg); border-radius: 12px; overflow: hidden; }
.shift-card-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  cursor: pointer; user-select: none;
}
.shift-card--open .shift-card-header { border-bottom: 1px solid var(--border); }
.shift-card-date { flex: 1; min-width: 0; }
.shift-card-day  { display: block; font-size: .82rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-card-driver { display: block; font-size: .7rem; color: var(--text-muted); }
.shift-card-kpi  { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.shift-kpi-val   { font-size: .95rem; font-weight: 800; color: var(--text); }
.shift-kpi-of    { font-weight: 500; color: var(--text-muted); font-size: .8rem; }
.shift-kpi-lbl   { font-size: .62rem; font-weight: 600; color: var(--text-faint); }
.shift-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.shift-stat-row  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shift-stat      { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.shift-stat-val  { font-size: .95rem; font-weight: 800; color: var(--text); }
.shift-stat-lbl  { font-size: .62rem; color: var(--text-muted); text-align: center; }
.shift-times     { display: flex; gap: 16px; font-size: .74rem; color: var(--text-muted); }
.shift-stop-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.shift-stop-row  { display: flex; align-items: center; gap: 8px; font-size: .74rem; padding: 3px 0; border-bottom: 1px solid var(--border); }
.shift-stop-row--fail { opacity: .55; }
.shift-stop-num  { width: 18px; font-weight: 700; color: var(--text-faint); text-align: right; flex-shrink: 0; }
.shift-stop-addr { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-stop-dur  { color: var(--text-muted); flex-shrink: 0; }
.shift-stop-fail-badge { background: #fecaca; color: #991b1b; font-size: .62rem; font-weight: 800; padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.shift-interrupted-badge { margin-left: 6px; background: #fef3c7; color: #92400e; font-size: .6rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: middle; }

/* ─── NavPickerModal ────────────────────────────────────────────────────────── */

.nav-picker-modal { max-width: 340px; width: 92vw; }
.nav-picker-addr { font-size: .82rem; color: var(--text-muted); margin: 10px 20px 14px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 20px 14px; }
.nav-picker-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: var(--radius-md);
  background: var(--surface-3); border: 1.5px solid var(--border);
  color: var(--text); font-size: .8rem; font-weight: 700; cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s; font-family: inherit;
}
.nav-picker-btn:hover  { background: var(--border); border-color: var(--border-2); }
.nav-picker-btn:active { transform: scale(.95); }
.nav-picker-icon { font-size: 1.5rem; }
.nav-pk-waze:hover   { background: rgba(0,210,91,.08); border-color: rgba(0,210,91,.3); }
.nav-pk-google:hover { background: rgba(66,133,244,.08); border-color: rgba(66,133,244,.3); }
.nav-picker-remember { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--text-muted); cursor: pointer; user-select: none; padding: 0 20px 16px; }
.nav-picker-remember input { accent-color: var(--orange); width: 15px; height: 15px; }

/* ─── SignatureModal ────────────────────────────────────────────────────────── */

.sig-modal { max-width: 380px; width: 94vw; }
.sig-hint  { font-size: .8rem; color: var(--text-muted); margin: 10px 20px 8px; text-align: center; }
.sig-canvas {
  display: block; margin: 0 20px; width: calc(100% - 40px); height: 160px;
  border-radius: var(--radius-sm); background: var(--surface-3);
  border: 1.5px solid var(--border); cursor: crosshair; touch-action: none;
}
.sig-canvas:active { border-color: var(--orange); }
.sig-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; }

/* ─── ExternalNavOverlay ────────────────────────────────────────────────────── */

.ext-nav-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: max(env(safe-area-inset-bottom), 0px);
  background: rgba(0,0,0,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ext-nav-card {
  background: var(--surface); width: 100%; max-width: 480px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px max(env(safe-area-inset-bottom), 24px);
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.15); position: relative;
}
.ext-nav-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 50%; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: .84rem;
}
.ext-nav-label { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.ext-nav-addr  { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.ext-nav-tw    { font-size: .78rem; font-weight: 700; color: var(--blue); }
.ext-nav-done {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--radius-md); background: #10b981; color: #fff;
  font-size: .95rem; font-weight: 800; border: none; cursor: pointer; font-family: inherit;
  box-shadow: 0 5px 16px rgba(16,185,129,.28); margin-top: 2px;
  transition: filter .12s, transform .1s;
}
.ext-nav-done:active { transform: scale(.97); }

/* ─── Stop photo ─────────────────────────────────────────────────────────────── */

.stop-photo { margin-bottom: 8px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.stop-photo img { width: 100%; max-height: 140px; object-fit: cover; display: block; cursor: pointer; }
.stop-photo-placeholder { display: flex; align-items: center; justify-content: center; height: 80px; color: var(--text-faint); font-size: .78rem; }

/* ─── NavigationView (keep dark — driving mode) ──────────────────────────────── */

.nav-view {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  background: #0d1117;
  padding-top: max(0px, env(safe-area-inset-top));
}

.nav-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(13,17,23,.96);
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 10; flex-shrink: 0;
}
.nav-topbar-dest { flex: 1; display: grid; gap: 1px; min-width: 0; }
.nav-topbar-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #4e6280; }
.nav-topbar-name  { font-size: .9rem; font-weight: 700; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.08); color: #94a3b8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.nav-icon-btn:hover  { background: rgba(255,255,255,.14); color: #f1f5f9; }
.nav-icon-muted { background: rgba(239,68,68,.15); color: #f87171; }
.nav-icon-btn-sm { width: 28px; height: 28px; }

.nav-map-zone { position: relative; flex: 1; overflow: hidden; }
.nav-map-bg   { width: 100%; height: 100%; }

.nav-progress-track { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.08); z-index: 5; }
.nav-progress-fill  { height: 100%; background: linear-gradient(90deg, #1a73e8, #34d399); transition: width .6s; }

.nav-instr-card {
  position: absolute; top: 10px; left: 10px; right: 60px; z-index: 10;
  background: rgba(13,17,23,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.nav-instr-icon { color: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-instr-body { display: grid; gap: 1px; min-width: 0; }
.nav-instr-dist { font-size: .8rem; font-weight: 800; color: #60a5fa; }
.nav-instr-text { font-size: .86rem; font-weight: 600; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes arrive-ring {
  0%,100% { box-shadow: 0 12px 36px rgba(5,150,105,.48),0 3px 10px rgba(0,0,0,.3); }
  50%      { box-shadow: 0 12px 40px rgba(5,150,105,.72),0 0 0 12px rgba(5,150,105,.09),0 3px 10px rgba(0,0,0,.3); }
}
.nav-instr-arrived { background: rgba(5,80,50,.9); border-color: rgba(52,211,153,.3); animation: arrive-ring 2.4s ease-in-out infinite; }

.nav-speed-cluster { position: absolute; right: 10px; top: 10px; z-index: 10; display: flex; flex-direction: column; gap: 6px; }
.nav-speed-badge {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(13,17,23,.88); border: 2px solid rgba(255,255,255,.12);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.nav-speed-num  { font-size: 1.05rem; font-weight: 900; color: #f1f5f9; line-height: 1; }
.nav-speed-unit { font-size: .52rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.nav-speed-active { border-color: rgba(255,255,255,.2); }
.nav-speed-over   { border-color: #ef4444; background: rgba(127,0,0,.6); }
.nav-speed-limit  { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 3px solid #e53e3e; }
.nav-limit-label  { font-size: .44rem; font-weight: 900; color: #e53e3e; text-transform: uppercase; letter-spacing: .04em; line-height: 1.1; }
.nav-limit-num    { font-size: .9rem; font-weight: 900; color: #1a202c; line-height: 1; }
.nav-limit-over   { border-color: #c53030; background: #fff5f5; }

.nav-same-street {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(129,140,248,.15); border-top: 1px solid rgba(129,140,248,.3);
  padding: 8px 14px; display: flex; align-items: center; gap: 10px;
}
.nav-ss-badge { width: 22px; height: 22px; border-radius: 50%; background: #818cf8; color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-ss-body  { display: grid; gap: 1px; min-width: 0; }
.nav-ss-title { font-size: .76rem; font-weight: 700; color: #a5b4fc; }
.nav-ss-list  { font-size: .7rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Street sweep card */
.nav-sweep-card {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(15,23,42,.88); border-top: 1px solid rgba(99,102,241,.25);
  padding: 6px 12px; backdrop-filter: blur(8px); cursor: pointer;
}
.nav-sweep-card--open { padding-bottom: 10px; }
.nav-sweep-header {
  display: flex; align-items: center; gap: 6px; color: #818cf8;
}
.nav-sweep-card--open .nav-sweep-header { margin-bottom: 8px; }
.nav-sweep-title {
  flex: 1; font-size: .75rem; font-weight: 700; color: #a5b4fc;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-sweep-remain { font-size: .7rem; font-weight: 600; color: #64748b; }
.nav-sweep-chevron { color: #475569; flex-shrink: 0; }
.nav-sweep-cols { display: flex; gap: 12px; }
.nav-sweep-col { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.nav-sweep-side-lbl {
  font-size: .63rem; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: .04em;
}
.nav-sweep-nums { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-sweep-num {
  padding: 3px 7px; border-radius: 6px; font-size: .72rem; font-weight: 700;
  background: rgba(99,102,241,.18); color: #c7d2fe; border: 1px solid rgba(99,102,241,.25);
  line-height: 1;
}
.nav-sweep-num--cur {
  background: #1A73E8; color: #fff; border-color: #1A73E8;
  box-shadow: 0 0 0 2px rgba(26,115,232,.4);
}
.nav-sweep-num--done {
  background: transparent; color: #334155; border-color: #1e293b; text-decoration: line-through;
}

.nav-side-btns { position: absolute; right: 10px; bottom: 50%; transform: translateY(50%); z-index: 10; display: flex; flex-direction: column; gap: 6px; }
.nav-float-btn {
  width: 42px; height: 42px; border-radius: 12px; border: none;
  background: rgba(13,17,23,.88); border: 1px solid rgba(255,255,255,.1);
  color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); transition: background .15s, color .15s;
}
.nav-float-btn:hover  { background: rgba(30,40,70,.92); color: #f1f5f9; }
.nav-float-alert { color: #60a5fa; border-color: rgba(96,165,250,.3); }
.nav-float-sv-on { color: #818cf8; border-color: rgba(129,140,248,.3); }

.nav-sv-drawer {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  height: 45%; background: rgba(10,15,30,.98);
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column;
}
.nav-sv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-shrink: 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.nav-sv-icon  { color: #818cf8; }
.nav-sv-title { flex: 1; font-size: .78rem; font-weight: 600; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sv-pano  { flex: 1; }
.nav-sv-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: .8rem; }

.nav-bottom-panel {
  background: rgba(13,17,23,.98); border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 14px max(env(safe-area-inset-bottom), 14px); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
}
/* ── Apartment card ── */
.nav-apt-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(26,115,232,.12); border: 1px solid rgba(26,115,232,.3);
}
.nav-apt-icon { color: #60a5fa; flex-shrink: 0; }
.nav-apt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nav-apt-unit {
  font-size: 1.05rem; font-weight: 800; color: #f1f5f9; line-height: 1;
}
.nav-apt-floor {
  display: flex; align-items: center; gap: 4px;
  font-size: .78rem; font-weight: 600; color: #93c5fd; line-height: 1;
}
.nav-apt-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-apt-side {
  font-size: .74rem; font-weight: 700; color: #60a5fa;
}
.nav-apt-back {
  font-size: .72rem; font-weight: 600; color: #94a3b8;
}
.nav-apt-sv-btn {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 6px 10px; border-radius: 8px;
  background: rgba(26,115,232,.2); border: 1px solid rgba(26,115,232,.4);
  color: #60a5fa; font-size: .72rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: background .12s;
}
.nav-apt-sv-btn:hover { background: rgba(26,115,232,.35); }

/* ── Delivery info strip (packages, approach side, notes) ── */
.nav-delivery-info {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 11px; border-radius: 9px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
}
.nav-di-pkg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; font-weight: 700; color: #94a3b8;
}
.nav-di-side {
  display: inline-flex; align-items: center;
  font-size: .72rem; font-weight: 800;
  padding: 2px 7px; border-radius: 4px; letter-spacing: .02em;
}
.nav-di-side--links  { background: rgba(59,130,246,.25);  color: #93c5fd; }
.nav-di-side--rechts { background: rgba(236,72,153,.2);   color: #f9a8d4; }
.nav-di-sub {
  font-size: .72rem; font-weight: 700; color: #60a5fa;
  padding: 2px 7px; border-radius: 4px; background: rgba(96,165,250,.15);
}
.nav-di-perm-note {
  display: flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,.12); border-radius: 4px;
  padding: 2px 7px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-walk-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 700; color: #34d399;
  background: rgba(52,211,153,.12); border-radius: 4px;
  padding: 2px 7px; border: 1px solid rgba(52,211,153,.25);
  white-space: nowrap;
}
.nav-di-note {
  flex: 1; min-width: 0;
  font-size: .72rem; color: #64748b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-nextstop-card {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(255,255,255,.05); border-radius: 10px;
}
.nav-nextstop-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #4e6280; white-space: nowrap; }
.nav-nextstop-addr  { flex: 1; font-size: .8rem; font-weight: 600; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-nextstop-dist  { font-size: .72rem; color: #64748b; white-space: nowrap; }

.nav-eta-row { display: flex; align-items: center; gap: 0; background: rgba(255,255,255,.04); border-radius: 10px; overflow: hidden; }
.nav-eta-chip { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0; }
.nav-eta-val  { font-size: .96rem; font-weight: 800; color: #f1f5f9; }
.nav-eta-lbl  { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #4e6280; }
.nav-eta-sep  { width: 1px; height: 32px; background: rgba(255,255,255,.06); flex-shrink: 0; }

.nav-next-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255,255,255,.04); border-radius: 8px; }
.nav-next-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #4e6280; white-space: nowrap; }
.nav-next-icon  { color: #f1f5f9; display: flex; align-items: center; flex-shrink: 0; }
.nav-next-text  { flex: 1; font-size: .78rem; font-weight: 600; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-next-final { color: #818cf8; justify-content: center; gap: 6px; }

.nav-arrive-btn {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff; border: none; border-radius: 13px; padding: 15px;
  font-size: 1rem; font-weight: 800; font-family: inherit; cursor: pointer;
  box-shadow: 0 8px 24px rgba(5,150,105,.44); display: flex; align-items: center; justify-content: center; gap: 8px;
  animation: arrive-pulse 2.5s ease-in-out infinite;
}
@keyframes arrive-pulse {
  0%,100% { box-shadow: 0 8px 24px rgba(5,150,105,.44); }
  50%      { box-shadow: 0 12px 36px rgba(5,150,105,.70),0 0 0 7px rgba(5,150,105,.11); transform: translateY(-1px); }
}
.nav-arrive-btn:active { animation: none; transform: scale(.97); }

/* One-tap delivery buttons shown when arrived */
.nav-arrive-actions { display: flex; gap: 8px; }
.nav-arrive-done-btn {
  flex: 1; background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff; border: none; border-radius: 13px; padding: 15px;
  font-size: 1rem; font-weight: 800; font-family: inherit; cursor: pointer;
  box-shadow: 0 8px 24px rgba(5,150,105,.44);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  animation: arrive-pulse 2.5s ease-in-out infinite;
}
.nav-arrive-done-btn:active { animation: none; transform: scale(.97); }
.nav-arrive-fail-btn {
  background: rgba(239,68,68,.12); color: var(--red);
  border: 1.5px solid rgba(239,68,68,.3); border-radius: 13px; padding: 13px 16px;
  font-size: .84rem; font-weight: 700; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s;
}
.nav-arrive-fail-btn:active { transform: scale(.97); }

.nav-bottom-actions {
  display: flex; gap: 8px;
}
.nav-arrived-btn {
  flex: 1; background: rgba(16,185,129,.12); color: #10b981;
  border: 1.5px solid rgba(16,185,129,.35); border-radius: 13px; padding: 13px;
  font-size: .9rem; font-weight: 700; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s;
}
.nav-arrived-btn:hover { background: rgba(16,185,129,.22); border-color: rgba(16,185,129,.6); }
.nav-arrived-btn:active { transform: scale(.97); }

.nav-mark-done-btn {
  flex: 1; background: rgba(255,255,255,.07); color: #94a3b8;
  border: 1.5px solid rgba(255,255,255,.12); border-radius: 13px; padding: 13px;
  font-size: .9rem; font-weight: 700; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-mark-done-btn:hover { background: rgba(255,255,255,.12); color: #f1f5f9; }

.nav-center-pill {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 20; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-pill);
  background: rgba(13,17,23,.92); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); color: #94a3b8;
  font-size: .84rem; font-weight: 600; border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 28px rgba(0,0,0,.4); white-space: nowrap;
}
.nav-pill-error   { color: #f87171; border-color: rgba(248,113,113,.2); }
.nav-pill-rerouting { color: #60a5fa; border-color: rgba(96,165,250,.2); }

/* ─── Responsive tweaks ──────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .app-shell { padding: 0 0 80px; }
  .panel { padding: 14px; }
  .stop-card { padding: 10px 14px; }
  .route-section-header { padding: 8px 14px; }
  h1 { font-size: 1.1rem; }
  .controls-row-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .controls-row-secondary .btn { width: 100%; justify-content: center; font-size: .72rem; padding: 7px 8px; }
  .btn-sm { padding: 6px 11px; font-size: .74rem; }
  .modal-box { padding: 0; }
  .gps-label { display: none; }
  .gps-pill { padding: 4px 6px; font-size: .68rem; max-width: 80px; overflow: hidden; }
  .btn-text { display: none; }
  .topbar-right { gap: 4px; flex-shrink: 0; }
  .topbar-add-btn { width: 30px; height: 30px; }
  .topbar-icon-btn { width: 30px; height: 30px; }
  .zones-hero { flex-direction: column; }
  .rsh-right { flex-wrap: wrap; gap: 4px; }
  .stop-meta-row { gap: 4px; }
  .dag-actions-extra { flex-wrap: wrap; gap: 6px; }
  /* Ensure stop card action rows wrap instead of overflowing */
  .stop-actions { flex-wrap: wrap; gap: 4px; }
  .stop-addr-main { word-break: break-word; overflow-wrap: anywhere; }
  /* Action buttons: icon-only on small screens — hide text, keep icons */
  .stop-actions .action-btn { font-size: 0; padding: 7px 9px; min-width: 34px; justify-content: center; gap: 0; }
  .stop-actions .action-btn svg { flex-shrink: 0; }

  /* Map: compact bottom panel on small screens */
  .map-bottom-panel { padding: 12px 13px 12px; gap: 10px; border-radius: 16px; }
  .map-bp-addr { font-size: .96rem; }
  .map-bp-nav-btn { padding: 11px; font-size: .84rem; }
  .map-stoplist-panel { bottom: 208px; }
  .map-bp-stats { padding: 8px 11px; }
}

@media (min-width: 721px) {
  .modal-box { animation: modal-in .2s cubic-bezier(.2,.8,.2,1); }
}

/* ─── Spinner ────────────────────────────────────────────────────────────────── */

@keyframes spin { to { transform: rotate(360deg); } }
.spinning svg { animation: spin .7s linear infinite; }

/* ─── Bottom tab navigation ─────────────────────────────────────────────────── */

.tab-nav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 540px; z-index: 90;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 var(--border), 0 -6px 20px rgba(0,0,0,.07);
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px 6px; border: none; border-top: 2.5px solid transparent;
  background: transparent; color: var(--text-faint);
  font-weight: 700; font-size: .6rem; cursor: pointer; height: 56px;
  transition: color .15s, border-color .15s;
  white-space: nowrap; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: .04em; text-transform: uppercase; position: relative;
}
.tab-btn:hover  { color: var(--text-muted); }
.tab-btn.active { color: var(--orange); border-top-color: var(--orange); }
.tab-btn-icon   { display: flex; align-items: center; justify-content: center; }
.tab-label      { line-height: 1; }
.tab-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill);
  background: var(--orange); color: #fff; font-size: .58rem; font-weight: 800;
}
.tab-btn:not(.active) .tab-badge { background: var(--red); }

/* content area must clear the bottom nav */
.tab-content-wrapper { padding-bottom: calc(64px + max(0px, env(safe-area-inset-bottom))); }

/* sticky-head no longer contains tab nav */
.sticky-head { box-shadow: 0 1px 0 var(--border); }

/* ─── TopBar secondary icon button ─────────────────────────────────────────── */

.topbar-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.9); cursor: pointer;
  transition: background .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,.25); }

@media (min-width: 900px) {
  /* Theme toggle and logout move to sidebar on desktop */
  .topbar-theme-btn  { display: none; }
  .topbar-logout-btn { display: none; }
}

/* ─── Swipe hints ───────────────────────────────────────────────────────────── */

.stop-swipe-wrap {
  position: relative;
  overflow: hidden;
}
.stop-swipe-wrap::before,
.stop-swipe-wrap::after {
  content: '';
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center;
  width: 80px; opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.stop-swipe-wrap::before {
  left: 0; background: linear-gradient(90deg, rgba(16,185,129,.18), transparent);
}
.stop-swipe-wrap::after {
  right: 0; background: linear-gradient(270deg, rgba(239,68,68,.18), transparent);
}
.stop-swipe-wrap.swipe-right::before { opacity: 1; }
.stop-swipe-wrap.swipe-left::after  { opacity: 1; }

/* ─── Day stats modal ───────────────────────────────────────────────────────── */

.stats-modal { max-width: 360px; width: 94vw; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--border);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 0;
}
.stat-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 18px 12px; background: var(--surface);
}
.stat-cell--green  { background: rgba(16,185,129,.06); }
.stat-cell--orange { background: var(--orange-light); }
.stat-cell--red    { background: var(--red-bg); }
.stat-val { font-size: 1.6rem; font-weight: 900; color: var(--text); line-height: 1; }
.stat-lbl { font-size: .68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-cell--green  .stat-val { color: #059669; }
.stat-cell--orange .stat-val { color: var(--orange); }
.stat-cell--red    .stat-val { color: var(--red); }

.stats-rows { padding: 4px 0; }
.stats-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  font-size: .86rem; color: var(--text-muted);
}
.stats-row:last-child { border-bottom: none; }
.stats-row-val { font-weight: 700; color: var(--text); }

/* ─── Dark mode ─────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  /* Gated on body:not(.light) so the in-app "Licht" toggle wins over the OS preference */
  body:not(.light) {
    --bg:          #0c1220;
    --bg-alt:      #091020;
    --surface:     #141d2e;
    --surface-2:   #1a2640;
    --surface-3:   #1f2e4a;

    --text:        #dce8f8;
    --text-2:      #aec4de;
    --text-muted:  #6888a8;
    --text-faint:  #364e68;

    --border:      #1e3252;
    --border-2:    #2c4470;

    --green-bg:    rgba(16,185,129,.15);
    --red-bg:      rgba(239,68,68,.15);
    --orange-light: rgba(26,115,232,.18);
    --shadow-xs:  0 1px 3px rgba(0,0,0,.45);
    --shadow-sm:  0 1px 4px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.35);
    --shadow-md:  0 4px 16px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.35);
    --shadow-lg:  0 10px 32px rgba(0,0,0,.65), 0 4px 10px rgba(0,0,0,.35);
    --shadow-orange: 0 4px 18px rgba(26,115,232,.5), 0 2px 6px rgba(26,115,232,.3);
  }

  body { background: var(--bg); }

  .modal-box, .confirm-box { background: var(--surface-2); }
  .modal-header { background: var(--surface-2); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }

  .field-input, .bulk-textarea, .restriction-input, .time-input, .rts-input {
    background: var(--surface-3); color: var(--text); border-color: var(--border-2);
  }

  .stop-card:hover { background: var(--surface-2); }

  .tab-nav { background: var(--surface); border-top-color: var(--border-2); }

  .route-section-header { background: var(--surface-2); }

  .ext-nav-card { background: var(--surface-2); }

  .delivery-confirm-modal { background: var(--surface-2); }

  .zones-start-time-card { background: var(--surface-2); }

  .panel { background: var(--surface); }

  .tpl-row { border-bottom-color: var(--border); }
  .tpl-row:hover { background: var(--surface-2); }
  .hist-row { border-bottom-color: var(--border); }
  .hist-row:hover { background: var(--surface-2); }
  .hist-chip { background: var(--surface-3); color: var(--text-muted); border-color: var(--border-2); }
  .dag-actions-extra { border-top-color: var(--border-2); }
  /* Start location */
  body:not(.light) .startloc-banner { background: rgba(26,115,232,.08); border-color: rgba(26,115,232,.2); }
  .startloc-chip { background: var(--surface-2); border-color: var(--border); }
  .startloc-chip-edit { background: var(--surface-3); border-color: var(--border-2); }
  /* Badges — hardcoded dark palettes, gated so forced-light wins */
  body:not(.light) .approach-badge--links  { background: rgba(59,130,246,.2); color: #93c5fd; }
  body:not(.light) .approach-badge--rechts { background: rgba(236,72,153,.15); color: #f9a8d4; }
  body:not(.light) .back-entrance-badge    { background: rgba(26,115,232,.15); color: #60a5fa; border-color: rgba(26,115,232,.3); }
  body:not(.light) .walk-cluster-park      { background: rgba(16,185,129,.15); color: #6ee7b7; border-color: rgba(16,185,129,.25); }
  body:not(.light) .walk-cluster-park-header { color: #6ee7b7; }
  body:not(.light) .walk-cluster-item      { color: #34d399; }
  .walk-cluster-hint      { color: var(--text-muted); }
  body:not(.light) .retry-badge            { background: rgba(139,92,246,.15); color: #c4b5fd; border-color: rgba(139,92,246,.25); }
  /* Stop card */
  body:not(.light) .stop-note-inline { background: rgba(120,80,0,.12); border-color: rgba(251,191,36,.2); color: #fcd34d; }
  body:not(.light) .perm-note-inline { background: rgba(120,80,0,.18); border-color: rgba(251,191,36,.35); color: #fcd34d; }
  .lunch-break-divider { background: var(--surface-3); border-color: var(--border-2); }
}

/* ─── Start location banner & chip ──────────────────────────────────────────── */

.startloc-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(26,115,232,.07);
  border-bottom: 1px solid rgba(26,115,232,.15); flex-wrap: wrap;
}
.startloc-banner svg { color: var(--orange); flex-shrink: 0; }
.startloc-banner-text { flex: 1; font-size: .8rem; color: var(--text-muted); min-width: 140px; }

.startloc-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.startloc-chip svg { color: var(--orange); flex-shrink: 0; }
.startloc-chip-addr {
  flex: 1; font-size: .78rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.startloc-chip-edit {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer; flex-shrink: 0;
  transition: background .12s, color .12s;
}
.startloc-chip-edit:hover { background: var(--surface-3); color: var(--text); }

/* ─── Start location modal ───────────────────────────────────────────────────── */

.startloc-modal .modal-header {
  background: linear-gradient(135deg, rgba(26,115,232,.08), transparent);
}
.startloc-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.startloc-hint { margin: 0; font-size: .84rem; color: var(--text-muted); line-height: 1.5; }
.startloc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.startloc-input-row .field-input { margin-top: 0; }
.startloc-input-row .btn { flex-shrink: 0; height: 44px; }
.startloc-feedback {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600;
}
.startloc-feedback--error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.startloc-found {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--green-bg); border: 1px solid rgba(16,185,129,.2);
  font-size: .84rem; font-weight: 600; color: #059669;
}
.startloc-found svg { flex-shrink: 0; }
.startloc-found span { flex: 1; line-height: 1.4; }

/* ─── Route template rows ───────────────────────────────────────────────────── */

.tpl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 20px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.tpl-row:hover { background: var(--surface-2); }
.tpl-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tpl-name { font-size: .88rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-meta { font-size: .72rem; color: var(--text-muted); }

/* ─── Day history rows ──────────────────────────────────────────────────────── */

.hist-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.hist-row:hover { background: var(--surface-2); }
.hist-date { font-size: .84rem; font-weight: 700; color: var(--text); flex-shrink: 0; }
.hist-stats { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.hist-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: var(--radius-pill);
  font-size: .7rem; font-weight: 700;
  background: var(--surface-3); color: var(--text-muted);
  border: 1px solid var(--border);
}
.hist-chip--green { background: var(--green-bg); color: #059669; border-color: rgba(16,185,129,.2); }
.hist-chip--red   { background: var(--red-bg);   color: var(--red); border-color: rgba(239,68,68,.2); }

/* ─── Extra size button (xs) ────────────────────────────────────────────────── */

.btn-xs { padding: 4px 9px; font-size: .72rem; border-radius: 6px; }

/* ─── Dag-actions extra row (voice / large-text / depot) ─────────────────────  */

.dag-actions-extra {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px; border-top: 1px solid var(--border);
}
.dag-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1.5px solid var(--border);
  color: var(--text-muted); font-size: .76rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.dag-action-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.dag-action-btn--active { background: var(--orange-light); border-color: rgba(26,115,232,.3); color: var(--orange); }


/* ─── Map bottom panel: collapse handle ─────────────────────────────────────── */

.map-bp-handle {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 4px 2px 6px; cursor: pointer;
  background: transparent; border: none; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.map-bp-handle-bar {
  width: 32px; height: 3px; border-radius: 2px; flex-shrink: 0;
  background: rgba(255,255,255,.22);
}
.map-bp-collapsed-addr {
  flex: 1; font-size: .88rem; font-weight: 700; color: #e2e8f0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: left;
}
.map-bp-handle-chevron {
  font-size: .62rem; color: rgba(255,255,255,.3); flex-shrink: 0;
}
.map-bp-collapsed {
  gap: 6px;
}

/* ─── Smart-paste address picker ────────────────────────────────────────────── */

.paste-picker {
  display: flex; flex-direction: column; gap: 5px;
  margin: 6px 0 4px;
  padding: 10px 12px;
  background: var(--orange-light);
  border: 1.5px solid rgba(26,115,232,.3);
  border-radius: var(--radius-sm);
}
.paste-picker-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: .76rem; font-weight: 700; color: var(--orange-dark);
  margin-bottom: 2px;
}
.paste-picker-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 7px;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); font-size: .84rem; font-family: inherit;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.paste-picker-item:hover { background: var(--surface-2); border-color: var(--orange); }
.paste-picker-cancel {
  align-self: flex-end; margin-top: 2px;
  padding: 4px 10px; border-radius: 6px; font-size: .74rem; font-weight: 600;
  background: transparent; border: 1px solid var(--border-2);
  color: var(--text-muted); cursor: pointer; font-family: inherit;
}
.paste-picker-cancel:hover { background: var(--surface-3); }

/* ─── Large-text body modifier ──────────────────────────────────────────────── */

body.large-text { font-size: 106%; }
body.large-text .stop-addr-line1 { font-size: 1rem; }
body.large-text .stop-addr-line2 { font-size: .84rem; }
body.large-text .tab-btn { font-size: .68rem; }
body.large-text .topbar-title { font-size: 1.15rem; }

/* ─── Desktop / PC layout (≥ 900 px) ────────────────────────────────────────── */
/*
 * Layout:  [full-width topbar]
 *          [220px sidebar | content fills remaining width]
 *
 * The bottom tab-nav becomes a fixed left sidebar; the sticky-head becomes
 * a fixed full-width top bar; the app-shell is offset accordingly.
 */

/* ─── Desktop layout (900px+) ──────────────────────────────────────────────── */

@media (min-width: 900px) {

  body { background: var(--bg-alt); overflow-x: hidden; }

  /* App shell: pushed right of 220px sidebar, below topbar */
  .app-shell {
    max-width: 100%;
    margin: 0;
    padding-left: 220px;
    padding-top: var(--topbar-h);
    min-height: 100vh;
    background: var(--bg-alt);
    overflow-x: hidden;
  }

  /* Topbar: fixed, full viewport width */
  .sticky-head {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 110;
    box-shadow: 0 1px 0 rgba(0,0,0,.1), 0 2px 16px rgba(0,0,0,.09);
  }

  /* Topbar on desktop: hide logo+title (they live in the sidebar brand now).
     Indent the topbar inner so content aligns with the 220px sidebar. */
  .topbar-brand { display: none; }
  .topbar-inner  { padding-left: calc(220px + 20px); }
  /* Progress bar must align with the indented topbar, not stretch under the sidebar */
  .progress-wrap { padding: 0 20px 10px calc(220px + 20px); }

  /* Topbar context: stop count / ETA fills remaining space */
  .topbar-subtitle {
    font-size: .88rem;
    font-weight: 600;
    color: rgba(255,255,255,.9);
  }

  /* Sidebar brand: visible on desktop at the top of the sidebar */
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 13px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  /* The AppLogo in the sidebar brand uses a darker background to show on white sidebar */
  .sidebar-brand .app-logo-svg {
    filter: none;
  }
  /* Recolour the pin white → brand-blue so it shows on the white sidebar */
  .sidebar-brand .app-logo-svg path:first-child { fill: var(--orange); }
  .sidebar-brand .app-logo-svg path:last-child  { stroke: #fff; }
  .sidebar-brand-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.025em;
  }

  /* Sidebar: left panel converted from bottom tab-nav */
  .tab-nav {
    position: fixed;
    left: 0; top: var(--topbar-h); bottom: 0;
    width: 220px; max-width: 220px;
    height: calc(100vh - var(--topbar-h));
    transform: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-top: none;
    border-right: 1px solid var(--border);
    padding-bottom: 0;
    overflow-y: auto; overflow-x: hidden;
    background: var(--surface);
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,.04);
    /* push sidebar-footer to bottom */
    display: flex;
    flex-direction: column;
  }

  /* Sidebar nav items */
  .tab-btn {
    flex: none;
    flex-direction: row;
    height: 46px; width: 100%;
    padding: 0 18px 0 16px;
    gap: 11px;
    justify-content: flex-start; align-items: center;
    font-size: .84rem; font-weight: 600;
    letter-spacing: .01em; text-transform: none;
    color: var(--text-muted);
    border-top: none !important;
    border-left: 3px solid transparent;
    border-radius: 0;
    transition: background .12s, color .12s;
  }
  .tab-btn:hover { color: var(--text); background: var(--surface-2); }
  .tab-btn.active {
    border-top-color: transparent !important;
    border-left-color: var(--orange);
    background: var(--orange-light);
    color: var(--orange-dark);
    font-weight: 700;
  }
  .tab-btn-icon { width: 20px; flex-shrink: 0; justify-content: center; }
  .tab-label    { font-size: .84rem; font-weight: inherit; text-transform: none; letter-spacing: .01em; line-height: 1; }
  .tab-badge    { position: static; margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; font-size: .6rem; }

  /* Content column: fills full width after the 220px sidebar */
  .tab-content-wrapper {
    width: 100%;
    min-height: calc(100vh - var(--topbar-h));
    padding-bottom: 40px;
    background: var(--bg);
  }

  /* Inner route/panel content: max-width so text stays readable on wide monitors */
  .route-section,
  .panel,
  .panel-header,
  .dag-header {
    max-width: 900px;
  }

  /* Panels/forms: explicit white so they stand out from --bg column */
  .panel { background: var(--surface); }

  /* Stop cards: proper card style — white on blue-gray column */
  .stop-card {
    margin: 4px 20px;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    box-shadow: var(--shadow-xs);
    max-width: 860px;
  }
  .stop-card:hover     { background: var(--surface-2); }
  .stop-card.active    { border-left-color: var(--orange); background: rgba(26,115,232,.04); }
  .stop-card.done      { opacity: .45; }
  .stop-card.priority,
  .stop-card:has(.star-btn-active) { border-left-color: var(--orange); }

  /* Route section background: match column so cards pop as white on blue-gray */
  .route-section { background: var(--bg); }

  /* Stop list: card spacing */
  .stop-list { gap: 0; padding: 8px 0; }

  /* Section headers: more breathing room, constrained */
  .route-section-header { padding: 16px 24px 10px; max-width: 900px; }

  /* Panels: wider padding, constrained */
  .panel        { padding: 20px 24px; max-width: 860px; }
  .panel-header { padding: 14px 24px; max-width: 860px; }

  /* Day-actions row: constrain so it doesn't stretch across a 2000px screen */
  .dag-actions, .dag-actions-extra { max-width: 860px; }

  /* Map tab full height */
  .tab-pane.fullscreen-map .map-wrapper,
  .tab-pane--map .map-wrapper { height: calc(100vh - var(--topbar-h)) !important; min-height: 0; }

  /* Map overlay elements */
  .map-bottom-panel  { left: 20px; right: 20px; bottom: 16px; }
  .map-stoplist-panel { left: 20px; right: 20px; }
  .map-fabs          { bottom: 224px; right: 20px; }
  .map-progress-pill { top: 16px; }

  /* Modals */
  .modal-box              { max-width: 680px; }
  .modal-box.stats-modal  { max-width: 420px; }
  .paper-scan-modal-box   { max-width: 680px; }

  .update-banner { margin-left: 0; }
}

/* ─── Desktop split view (1280px+): routes left, map always right ───────────── */

@media (min-width: 1280px) {
  .tab-content-wrapper.desktop-split {
    display: grid;
    grid-template-columns: 660px 1fr;
    max-width: none;
    height: calc(100vh - var(--topbar-h));
    padding-bottom: 0;
    overflow: hidden;
    box-shadow: none;
    background: var(--bg-alt);
  }

  /* Routes: always shown in left column, scrollable */
  .desktop-split .tab-pane--routes {
    grid-column: 1; grid-row: 1;
    display: block !important;
    overflow-y: auto;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 8px rgba(0,0,0,.05);
  }

  /* Map: always shown in right column */
  .desktop-split .tab-pane--map {
    grid-column: 2; grid-row: 1;
    display: block !important;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg-alt);
  }
  .desktop-split .tab-pane--map .map-wrapper {
    height: calc(100vh - var(--topbar-h)) !important;
    min-height: 0;
  }

  /* Other tabs (history, alerts, zones, stats): overlay on routes column */
  .desktop-split .tab-pane--overlay {
    grid-column: 1; grid-row: 1;
    display: none;
    overflow-y: auto;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    z-index: 5;
    border-right: 1px solid var(--border);
  }
  .desktop-split .tab-pane--overlay.active { display: block; }

  /* Stop cards: slightly tighter in the constrained left column */
  .desktop-split .stop-card { margin: 4px 12px; }

  /* Map overlays within the right column */
  .desktop-split .map-bottom-panel   { left: 12px; right: 12px; }
  .desktop-split .map-stoplist-panel { left: 12px; right: 12px; }
  .desktop-split .map-fabs           { right: 12px; }
}

/* ─── Sidebar footer (desktop only) ────────────────────────────────────────── */

.sidebar-footer { display: none; }

@media (min-width: 900px) {
  .sidebar-footer {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 8px 0;
  }

  .sidebar-theme-btn {
    display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 18px 0 16px;
    background: none; border: none; cursor: pointer;
    font-size: .82rem; font-weight: 500; color: var(--text-muted);
    text-align: left; width: 100%;
    transition: background .12s, color .12s;
  }
  .sidebar-theme-btn:hover { background: var(--surface-2); color: var(--text); }

  .sidebar-user {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 12px 8px 14px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
  }

  .sidebar-user-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #2a7fe8 0%, #0f4ec8 100%);
    color: #fff; font-size: .8rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }

  .sidebar-user-name {
    flex: 1; font-size: .82rem; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .sidebar-logout-btn {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: var(--radius-xs);
    background: none; border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; flex-shrink: 0;
    transition: background .12s, color .12s, border-color .12s;
  }
  .sidebar-logout-btn:hover { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,.3); }
}
