/* Dispatch — mobile-first UI. Layout: sticky top bar, content, bottom tab bar on phones / side nav on desktop. */
:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #eaf0ee;
  --ink: #132423;
  --muted: #5b6e6b;
  --line: #d9e2df;
  --brand: #0f3d3e;
  --brand-fg: #ffffff;
  --accent: #e8962e;
  --accent-soft: #fdf1df;
  --good: #1d8656;
  --good-soft: #e1f3ea;
  --warn: #b56f06;
  --warn-soft: #fbefd9;
  --bad: #be3a2b;
  --bad-soft: #fbe5e2;
  --info: #2b6cb0;
  --info-soft: #e3eefa;
  --shadow: 0 1px 2px rgba(15, 40, 38, .06), 0 4px 14px rgba(15, 40, 38, .06);
  --radius: 12px;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1716; --surface: #142120; --surface-2: #1b2b29; --ink: #e5eeec; --muted: #9ab0ac; --line: #2a3b39;
    --brand: #1f6b6c; --brand-fg: #ffffff; --accent: #f0a646; --accent-soft: #3a2c16;
    --good: #43c08a; --good-soft: #143326; --warn: #e6a23c; --warn-soft: #3a2d14; --bad: #f0786a; --bad-soft: #3d1d19;
    --info: #74a9e6; --info-soft: #172a40; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1716; --surface: #142120; --surface-2: #1b2b29; --ink: #e5eeec; --muted: #9ab0ac; --line: #2a3b39;
  --brand: #1f6b6c; --brand-fg: #ffffff; --accent: #f0a646; --accent-soft: #3a2c16;
  --good: #43c08a; --good-soft: #143326; --warn: #e6a23c; --warn-soft: #3a2d14; --bad: #f0786a; --bad-soft: #3d1d19;
  --info: #74a9e6; --info-soft: #172a40; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--info); }
img { max-width: 100%; }
.boot { margin: auto; color: var(--muted); padding: 40px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; touch-action: manipulation; user-select: none;
}
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #241603; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.icon-btn { min-width: 40px; padding: 6px; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming into fields */
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%; min-height: 46px;
}
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: 1 / -1; } }
gmp-place-autocomplete { width: 100%; color-scheme: light dark; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--warn); }
.pill.pulse .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
@media (prefers-reduced-motion: reduce) { .pill.pulse .dot { animation: none; } }

/* ---------- App chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 500; background: var(--brand); color: var(--brand-fg);
  padding: calc(10px + var(--safe-top)) var(--gutter-r) 10px var(--gutter-l);
  display: flex; align-items: center; gap: 10px; min-height: 56px;
}
.topbar .brand { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.topbar .brand svg { width: 22px; height: 22px; }
.topbar button { white-space: nowrap; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; min-height: 36px; padding: 6px 12px; }
.topbar input[type="date"] { font-size: 15px; max-width: 170px; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; min-height: 36px; padding: 5px 8px; width: auto; color-scheme: dark; }
.topbar .hide-narrow { }
@media (max-width: 420px) { .topbar .hide-narrow { display: none; } }
.demo-banner { background: var(--accent-soft); color: var(--warn); font-size: .8rem; font-weight: 600; text-align: center; padding: 6px var(--gutter-r) 6px var(--gutter-l); }
.demo-banner button { min-height: 0; padding: 2px 8px; font-size: .78rem; margin-left: 6px; }

.shell { flex: 1; display: flex; min-height: 0; }
.sidenav { display: none; }
.content { flex: 1; min-width: 0; padding: 16px var(--gutter-r) calc(88px + var(--safe-bottom)) var(--gutter-l); }
.content.flush { padding: 0 0 calc(72px + var(--safe-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 600; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(6, 1fr); padding: 4px var(--gutter-r) calc(4px + var(--safe-bottom)) var(--gutter-l);
}
.tabbar button { border: 0; background: none; flex-direction: column; gap: 2px; font-size: .72rem; color: var(--muted); min-height: 54px; padding: 4px; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button[aria-current="page"] { color: var(--brand); }
:root:not([data-theme="light"]) .tabbar button[aria-current="page"] { color: var(--accent); }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidenav { display: flex; flex-direction: column; gap: 4px; width: 200px; flex: none; padding: 16px 10px; border-right: 1px solid var(--line); background: var(--surface); }
  .sidenav button { justify-content: flex-start; border: 0; background: none; color: var(--muted); }
  .sidenav button svg { width: 20px; height: 20px; }
  .sidenav button[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
  .content { padding: 20px 24px 32px; }
  .content.flush { padding: 0; }
}

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card-list { display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .4s; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.totals .t { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.totals .t b { display: block; font-family: var(--font-head); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---------- Map ---------- */
.map { width: 100%; height: 100%; min-height: 240px; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; position: relative; z-index: 0; }
.map.demo-offline { background: #cfe3ea; }
:root:not([data-theme="light"]) .map.demo-offline { background: #cfe3ea; }
.map-note { position: absolute; z-index: 450; left: 8px; bottom: 8px; background: rgba(255,255,255,.9); color: #333; font-size: .7rem; padding: 2px 6px; border-radius: 6px; pointer-events: none; }
.leaflet-container { font: inherit; }
.drv-marker { display: flex; flex-direction: column; align-items: center; transform: translateY(-4px); }
.drv-marker .b { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center; color: #fff; font: 700 12px/1 var(--font-body); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.drv-marker .n { margin-top: 3px; background: #fff; color: #142322; font: 600 11px/1 var(--font-body); padding: 3px 6px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.25); white-space: nowrap; }
.drv-marker.stale .b { filter: grayscale(.8); opacity: .7; }

/* ---------- Admin live ---------- */
.live { display: grid; grid-template-rows: minmax(260px, 46vh) auto; gap: 0; }
.live .map { border-radius: 0; height: 100%; }
.live .panel { padding: 14px var(--gutter-r) 14px var(--gutter-l); display: grid; gap: 10px; align-content: start; }
@media (min-width: 900px) {
  .live { grid-template-rows: none; grid-template-columns: 1fr 380px; height: calc(100vh - 56px - var(--safe-top) - var(--banner-h, 0px)); }
  .live .panel { overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); }
}
.drv-card { cursor: pointer; display: grid; gap: 8px; }
.drv-card.selected { outline: 2px solid var(--accent); }
.drv-card .head { display: flex; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; flex: none; }
.stop-line { display: grid; grid-template-columns: 64px 1fr; gap: 6px; font-size: .88rem; }
.stop-line .k { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }

/* ---------- Route editor / stops ---------- */
.stop-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stop-row:last-child { border-bottom: 0; }
.stop-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--surface-2); color: var(--ink); font-variant-numeric: tabular-nums; }
.stop-num.delivered { background: var(--good); color: #fff; }
.stop-num.failed { background: var(--bad); color: #fff; }
.stop-num.arrived { background: var(--accent); color: #241603; }
.stop-num.next { background: var(--brand); color: #fff; }
.stop-actions { display: flex; gap: 4px; flex-wrap: nowrap; }
.editor { display: grid; gap: 14px; }
@media (min-width: 1100px) { .editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .editor .map { height: 520px; position: sticky; top: 72px; } }
.editor .map { height: 300px; }
.notes-box { background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-box .label { color: var(--warn); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.thumb { width: 54px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; display: block; }

/* ---------- Driver ---------- */
.drv-wrap { max-width: 640px; margin: 0 auto; width: 100%; display: grid; gap: 12px; }
.shift-bar { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.next-card { border: 2px solid var(--brand); }
:root:not([data-theme="light"]) .next-card { border-color: var(--accent); }
.next-card .facility { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.next-card .addr { font-size: 1rem; color: var(--ink); text-decoration: none; display: block; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.big-actions .full { grid-column: 1 / -1; }
.drv-map { height: 240px; }
details.stop { border-bottom: 1px solid var(--line); }
details.stop:last-child { border-bottom: 0; }
.drv-stops details.stop:has(+ .back-item) { border-bottom: 1px solid var(--line); }
.back-item .summary-like { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; }
.next-card button.addr { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-size: 1rem; color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; width: auto; justify-self: start; box-shadow: none; display: block; font-weight: 400; }
.nav-choice .btn { justify-content: center; }
.pill.btn-pill { cursor: pointer; border: 0; padding: 3px 9px; min-height: 0; font-size: .75rem; }
.back-row .stop-num, .back-item .stop-num { font-size: 1rem; }
details.stop > summary { list-style: none; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; cursor: pointer; }
details.stop > summary::-webkit-details-marker { display: none; }
details.stop .body { padding: 0 0 12px 40px; display: grid; gap: 8px; }

/* ---------- Sheet / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(8, 20, 19, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 100%; height: auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
}
.sheet.full { height: 100%; border-radius: 0; }
@media (min-width: 700px) { .overlay { align-items: center; padding: 24px; } .sheet, .sheet.full { border-radius: 16px; height: auto; max-height: calc(100vh - 48px); } }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(12px + var(--safe-top)) var(--gutter-r) 12px var(--gutter-l); display: flex; align-items: center; gap: 10px; }
@media (min-width: 700px) { .sheet-head { padding-top: 12px; } }
.sheet-body { padding: 16px var(--gutter-r) 16px var(--gutter-l); display: grid; gap: 14px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px var(--gutter-r) calc(12px + var(--safe-bottom)) var(--gutter-l); display: flex; gap: 8px; }
.sheet-foot > * { flex: 1; }

/* Signature pad */
.sig-wrap { position: relative; background: #fff; border: 1.5px dashed #9fb3af; border-radius: 12px; height: 190px; touch-action: none; }
.sig-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; border-radius: 12px; }
.sig-wrap .hint { position: absolute; left: 14px; bottom: 34px; right: 14px; border-top: 1px solid #c9d6d3; color: #8aa09c; font-size: .75rem; padding-top: 4px; pointer-events: none; }
.sig-wrap .clear { position: absolute; top: 6px; right: 6px; z-index: 2; background: #fff; color: #333; border-color: #ccd; }
.photo-box { border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; place-items: center; text-align: center; }
.photo-box img { max-height: 260px; border-radius: 8px; object-fit: contain; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.req { color: var(--bad); }
.error-text { color: var(--bad); font-size: .85rem; font-weight: 600; }

/* Toast */
.toasts { position: fixed; z-index: 2000; left: 0; right: 0; bottom: calc(84px + var(--safe-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); max-width: 480px; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }

/* Login */
.login { flex: 1; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) var(--gutter-r) 24px var(--gutter-l); background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent), var(--bg); }
.login .card { width: 100%; max-width: 400px; padding: 22px; display: grid; gap: 14px; }
.login .logo { display: flex; align-items: center; gap: 10px; }
.login .logo svg { width: 36px; height: 36px; }
.demo-pick { display: grid; gap: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .78rem; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* Yes/No and pick-one buttons (proof of delivery pickup question) */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.seg button { min-height: 50px; font-size: 1rem; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }

[hidden] { display: none !important; }
#pl-search { margin: 4px 0 12px; }
.tabbar button span { white-space: nowrap; }

/* Deliveries search */
.log-search { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 8px; }
.log-search .field { margin: 0; min-width: 130px; }
.log-search .field.grow { flex: 1 1 240px; }
.log-search > button { height: 44px; }
@media (max-width: 560px) { .log-search .field { flex: 1 1 45%; } .log-search > button { flex: 1 1 100%; } }
.eta { color: var(--info); }
.eta b { font-weight: 700; }
/* Room for the host's badge in the bottom-right corner (see hostBadgeSpace in app.js). */
:root.host-badge { --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + 60px); }
/* Phone numbers in notes and contacts: tap to call. */
a.tel { color: var(--info); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
/* Extra bag photos on the delivery confirmation. */
.extra-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.extra-photos:empty { display: none; }
.extra-photo { display: grid; gap: 4px; }
.extra-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* Stats */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chips .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.kpi b { font-family: var(--font-head); font-size: 1.7rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
th.r, td.r { text-align: right; }
#st-body h2 { font-size: 1.05rem; margin: 6px 0 0; }
#st-body details ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; white-space: normal; }
#st-body details summary { cursor: pointer; font-weight: 600; }
#st-places td .ellipsis { max-width: 260px; }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi b { font-size: 1.4rem; } #st-body th, #st-body td { padding: 8px 7px; } #st-places td .ellipsis { max-width: 150px; } }

/* STAT and Split routes */
.pill.stat { background: #dc2626; color: #fff; letter-spacing: .04em; font-weight: 800; }
.stat-check { color: var(--bad); }
.stat-toggle { font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.stat-toggle.on { background: #dc2626; border-color: #dc2626; color: #fff; }
.sp-results { display: grid; gap: 2px; max-height: 300px; overflow: auto; }
.sp-place { padding: 6px 4px; border-radius: 8px; align-items: flex-start; }
.sp-place.on { background: var(--surface-2); }
.sp-place .grow { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-picked { display: grid; gap: 6px; }
.sp-pick { gap: 8px; }
.sp-drivers { display: grid; gap: 6px; }
.dot-c { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: middle; }
.move-target { display: flex; align-items: center; gap: 8px; text-align: left; }
.sp-stop .stop-num { color: #fff; }
.sp-route { padding-left: 14px; }
@media (max-width: 520px) { .sp-ref { width: 84px !important; } .stop-actions .move-stop { padding: 6px 8px; } }
.editor > .stack { min-width: 0; }
.sp-place { min-width: 0; }
.stop-row > .stack { min-width: 0; }
@media (max-width: 640px) {
  .editor .stop-row { grid-template-columns: 30px minmax(0, 1fr); }
  .editor .stop-row > .stop-actions { grid-column: 2; flex-wrap: wrap; }
}

/* Route order toggle: By time / A to Z */
.sort-group { display: inline-flex; border: 1px solid var(--line, #d6dde0); border-radius: 10px; overflow: hidden; }
.sort-group .sort-seg { border: 0; border-radius: 0; min-height: 38px; padding: 0 12px; font-weight: 600; background: transparent; }
.sort-group .sort-seg + .sort-seg { border-left: 1px solid var(--line, #d6dde0); }
.sort-group .sort-seg.on { background: var(--brand); color: var(--brand-fg); }
