/* ---------- tokens ---------- */
:root {
  --bg: #0b1220; --bg-2: #0f172a; --card: #131d33; --card-2: #0d1526; --line: #1f2b45; --line-2: #2a3a5c;
  --text: #e6eaf2; --muted: #93a0b8; --faint: #5f6d88;
  --primary: #22c55e; --primary-ink: #04240f; --primary-soft: rgba(34,197,94,.14);
  --warn: #f5b50a; --warn-soft: rgba(245,181,10,.14); --err: #ef4444; --err-soft: rgba(239,68,68,.14);
  --blue: #38bdf8; --blue-soft: rgba(56,189,248,.14);
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.5);
  --sidebar: 232px; --tab-h: 60px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f9; --bg-2: #ffffff; --card: #ffffff; --card-2: #f6f8fc; --line: #e3e8f0; --line-2: #cfd7e3;
    --text: #0f172a; --muted: #5b6678; --faint: #94a0b4;
    --primary-ink: #ffffff; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text);
  font: 15px/1.5 "Digits", "Hind Siliguri", "Noto Sans Bengali", "Nirmala UI", "Segoe UI", system-ui, sans-serif; }
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
a { color: var(--blue); text-decoration: none; }
code { font-family: Consolas, "Courier New", monospace; font-size: 13px; color: var(--blue); word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1 1 200px; min-width: 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 14px; }
.brand img { border-radius: 9px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--faint); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.ic { width: 20px; text-align: center; font-size: 16px; }
.side-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; }
.dot-line { display: flex; gap: 8px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dot.mid { background: var(--warn); }
.dot.bad { background: var(--err); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.band { padding: 9px 24px; font-weight: 600; font-size: 14px; }
.band.warn { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid rgba(245,181,10,.3); }
.band.err { background: var(--err-soft); color: var(--err); border-bottom: 1px solid rgba(239,68,68,.3); }
.content { padding: 20px 24px 40px; max-width: 920px; width: 100%; margin: 0 auto; display: grid; gap: 16px; align-content: start; }
.content > section[data-view] { display: grid; gap: 16px; }

/* ---------- cards & tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card-head { margin-bottom: 10px; }
.card-head.between, .between { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-bottom: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 22px; font-weight: 700; margin-top: 4px; line-height: 1.2; }
.tile-value.ok { color: var(--primary); } .tile-value.bad { color: var(--err); } .tile-value.mid { color: var(--warn); }
.tile-sub { font-size: 12px; color: var(--faint); margin-top: 2px; min-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-zone { border-color: rgba(239,68,68,.35); }

/* ---------- forms ---------- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.row.end { justify-content: flex-end; }
.row.nomargin { margin: 0; }
.row > input, .row > select { flex: 1 1 220px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 14px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 0; }
label.lbl { color: var(--text); font-weight: 600; margin-top: 14px; }
label input:not([type=checkbox]) { margin-top: 5px; }
input, select, textarea { width: 100%; background: var(--card-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 9px 11px; font: inherit; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.chk { display: flex; gap: 9px; align-items: center; color: var(--text); font-size: 14px; margin: 10px 0 0; cursor: pointer; }
.chk input { width: 17px; height: 17px; accent-color: var(--primary); margin: 0; }
.btn { background: var(--card-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn.danger.solid { background: var(--err); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.pause { min-width: 100px; }
.btn.pause.on { background: var(--warn); color: #1f1300; border-color: var(--warn); }
.pill { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line-2); }
.pill.ok { background: var(--primary-soft); color: var(--primary); border-color: rgba(34,197,94,.4); }
.pill.bad { background: var(--err-soft); color: var(--err); border-color: rgba(239,68,68,.4); }
.pill.mid { background: var(--warn-soft); color: var(--warn); border-color: rgba(245,181,10,.4); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-head { margin-top: 12px; margin-bottom: 6px; }
.chip { display: inline-flex; gap: 4px; align-items: center; background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 4px 6px 4px 12px; max-width: 100%; font-size: 14px; }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.chip.click > span { cursor: pointer; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 99px; }
.chip button:hover { background: var(--err-soft); color: var(--err); }
.chip.req { background: var(--blue-soft); border-color: rgba(56,189,248,.4); }
.chipinput { background: var(--card-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px; margin-top: 6px; }
.chipinput .chips { margin-bottom: 6px; }
.chipinput .chips:empty { display: none; }
.chipinput .ci-row { display: flex; gap: 6px; }
.chipinput .ci-row input { background: transparent; border: 0; padding: 6px 4px; }
.chipinput .ci-row input:focus { outline: none; }
.chipinput .empty { color: var(--faint); font-size: 13px; padding: 2px 4px 6px; }
.chipinput.req .chip { background: var(--blue-soft); border-color: rgba(56,189,248,.4); }

/* ---------- group picker ---------- */
.picker { position: relative; }
.picker-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; background: var(--card-2);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; color: var(--text); font: inherit; cursor: pointer; }
.picker-btn .ph { color: var(--faint); }
.picker-btn .sz { color: var(--muted); font-size: 12.5px; }
.picker-panel { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: 0 12px 32px -8px rgba(0,0,0,.6); overflow: hidden; }
.picker-panel input { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); background: var(--card); }
.picker-panel input:focus { outline: none; }
.picker-list { max-height: 260px; overflow: auto; }
.picker-item { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; cursor: pointer; }
.picker-item:hover, .picker-item.hl { background: var(--primary-soft); }
.picker-item.sel { color: var(--primary); font-weight: 600; }
.picker-item .sz { color: var(--muted); font-size: 12.5px; flex: none; }
.picker-none { padding: 12px; color: var(--faint); font-size: 13px; }

/* ---------- misc ---------- */
.qrbox { display: grid; place-items: center; padding: 8px; }
.qrbox img { background: #fff; padding: 8px; border-radius: 10px; max-width: 280px; width: 100%; }
.result { margin-top: 8px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card-2); }
.result.ok { border-color: var(--primary); } .result.no { border-color: var(--err); }
.pin-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--primary-soft); color: var(--primary); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.fchip { background: var(--card-2); border: 1px solid var(--line-2); color: var(--muted); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.fchip.active { background: var(--primary-soft); color: var(--primary); border-color: rgba(34,197,94,.4); font-weight: 600; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.log.tall { max-height: calc(100vh - 300px); overflow: auto; }
.log:empty::after { content: "এখনো কিছু নেই"; color: var(--faint); font-size: 13px; }
.log li { background: var(--card-2); border: 1px solid var(--line); border-left: 4px solid var(--faint); border-radius: 9px; padding: 8px 12px; font-size: 13.5px; }
.log li.reply { border-left-color: var(--primary); }
.log li.failed { border-left-color: var(--err); }
.log li .meta { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.log li .pv { white-space: pre-wrap; word-break: break-word; color: var(--muted); margin-top: 4px; font-size: 12.5px; max-height: 60px; overflow: hidden; }
.log li .pv.open { max-height: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 10px 0 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.kv a { font-size: 16px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--card); color: var(--text); border: 1px solid var(--line-2);
  padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-weight: 600; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 20px; width: min(420px, 100%); box-shadow: var(--shadow); }
.modal-msg { margin-bottom: 16px; font-size: 15px; }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .band { padding: 8px 16px; }
  .content { padding: 14px 16px calc(var(--tab-h) + 20px); }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 18px; }
  .card { padding: 14px 14px; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--bg-2); border-top: 1px solid var(--line); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; min-width: 0; }
  .tabbar a .ic { font-size: 18px; }
  .tabbar a.active { color: var(--primary); }
  .toast { bottom: calc(var(--tab-h) + 14px); }
  .log.tall { max-height: none; }
}

/* ---------- overflow guards (no horizontal scroll on phones) ---------- */
html, body { overflow-x: hidden; }
.main, .content, .card { min-width: 0; max-width: 100%; }
code, .log li .pv, .tile-sub { overflow-wrap: anywhere; }

/* ================= v1.1: lock, kill switch, dashboard, trips ================= */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.overlay.lock { background: radial-gradient(1200px 600px at 50% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.overlay.disabled { background: radial-gradient(1200px 600px at 50% -10%, var(--err-soft), transparent 60%), var(--bg); z-index: 90; }
.lock-box { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line-2); border-radius: 18px; padding: 28px 24px;
  box-shadow: var(--shadow); text-align: center; display: grid; gap: 10px; justify-items: center; }
.lock-box img { border-radius: 14px; }
.lock-box h2 { font-size: 20px; }
.lock-box p { margin: 0; }
.lock-box input { text-align: center; font-size: 18px; letter-spacing: .12em; }
.lock-box .btn.block, .btn.block { width: 100%; }
.lock-msg { min-height: 20px; color: var(--err); font-size: 13.5px; font-weight: 600; }
.big-ic { font-size: 44px; line-height: 1; }
.support-num { font-family: "Noto Sans Bengali", "Digits", sans-serif; }
#offMsg { font-weight: 600; white-space: pre-wrap; }
.sys-state { margin-bottom: 10px; }
.row.wrap { flex-wrap: wrap; }
.support-line { font-weight: 700; font-size: 16px; }
.row.center { justify-content: center; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.nav a { position: relative; }
.nbadge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #1f1300;
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.tabbar .ic { position: relative; }
.tabbar .nbadge { position: absolute; top: -6px; right: -14px; margin: 0; height: 17px; min-width: 17px; font-size: 10.5px; }

.tiles.inner { margin-top: 4px; }
.tile.flat { box-shadow: none; background: var(--card-2); }
.tile.link { color: inherit; display: block; }
.tile.link:hover { border-color: var(--warn); }
.divider { height: 1px; background: var(--line); margin: 16px 0 6px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 6px; flex-wrap: wrap; gap: 6px; }
.legend { font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.sw-a { background: var(--blue); } .sw-b { background: var(--primary); }
.chart svg { width: 100%; height: 190px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--faint); font-size: 11px; font-family: "Digits", "Hind Siliguri", sans-serif; }
.chart .a { fill: var(--blue); opacity: .75; }
.chart .b { fill: var(--primary); }
.chart .hit { fill: transparent; }
.chart .bar:hover .a { opacity: 1; }
.chart .bar:hover .hit { fill: var(--line); opacity: .35; }

.daterange { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.daterange .dr-preset { width: auto; min-width: 140px; }
.daterange .dr-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); margin: 0; }
.daterange .dr-field input { width: auto; min-width: 140px; }
@media (max-width: 520px) { .daterange .dr-preset, .daterange .dr-field { flex: 1 1 100%; } .daterange .dr-field input { width: 100%; } }
.trip-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.trip-sum > div { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; }
.trip-sum b { font-size: 18px; } .trip-sum span { font-size: 12px; color: var(--muted); }
.trip-sum .ok b { color: var(--primary); } .trip-sum .bad b { color: var(--err); } .trip-sum .mid b { color: var(--warn); }
.trips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.trips .empty { color: var(--faint); font-size: 13.5px; padding: 12px 4px; }
.trip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card-2);
  border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 10px; padding: 10px 12px; }
.trip.won { border-left-color: var(--primary); } .trip.lost { border-left-color: var(--err); }
.trip-main { min-width: 0; flex: 1 1 260px; }
.trip-title { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.trip-act { display: flex; gap: 6px; flex-wrap: wrap; }
.badge.bad { background: var(--err-soft); color: var(--err); }
.badge.mid { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.txt-bad { color: var(--err); font-weight: 700; }
.lic-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 6px; }
details.card summary .eyebrow { display: block; }
@media (max-width: 720px) {
  .tabbar { grid-template-columns: repeat(5, 1fr); }
  .tabbar a { font-size: 11px; }
  .trip-act { width: 100%; }
  .trip-act .btn { flex: 1; }
  .chart svg { height: 160px; }
  .top-actions .btn { padding: 8px 10px; }
}
details.card > summary { display: block; cursor: pointer; }
details.card > summary::marker { content: ""; }

/* ================= v1.3: vehicle queue, registry, multi-group ================= */
.next-box { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--primary-soft); border: 1px solid rgba(34,197,94,.35);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.next-box.empty { background: var(--err-soft); border-color: rgba(239,68,68,.35); }
.next-box.stale { background: var(--warn-soft); border-color: rgba(245,181,10,.35); }
.next-box .lbl { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0; }
.next-box .num { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.next-box .own { color: var(--muted); }
.next-box .more { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.banner.warn { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.queue { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.queue li { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.queue li.first { border-color: var(--primary); }
.queue .idx { width: 24px; height: 24px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.queue li.first .idx { background: var(--primary); color: var(--primary-ink); }
.queue .qnum { font-weight: 700; }
.queue .qown { color: var(--muted); font-size: 13px; }
.queue .qact { margin-left: auto; display: flex; gap: 4px; }
.queue .qact button { background: none; border: 1px solid var(--line-2); color: var(--muted); border-radius: 7px; padding: 3px 8px; cursor: pointer; font: inherit; }
.queue .qact button:hover { color: var(--text); border-color: var(--text); }
.queue .qact button[data-act="remove"]:hover { color: var(--err); border-color: var(--err); }
.queue .empty { color: var(--faint); font-size: 13.5px; padding: 4px 2px; border: 0; background: none; }
.queue.stale li { opacity: .55; }
.chip.vchip { cursor: pointer; padding: 5px 12px; }
.chip.vchip:hover { border-color: var(--primary); }
.chip.vchip b { font-weight: 700; }
.chip.vchip .own { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; }
.vform { margin-top: 10px; padding-top: 6px; border-top: 1px dashed var(--line); }
.vlist { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.vlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.vlist .vn { font-weight: 700; min-width: 120px; }
.vlist .vs { color: var(--muted); font-size: 12.5px; flex: 1 1 160px; }
.vlist li.off { opacity: .6; }
.vlist .va .offbtn { font-size: 12px; width: auto; padding: 0 8px; }
.chip.vchip.off { opacity: .45; text-decoration: line-through; }
.queue li.off { opacity: .5; }
.queue li.off .qnum::after { content: attr(data-offtxt); font-weight: 400; color: var(--warn); font-size: 12px; }
.race { font-size: 12.5px; }
.race.first { color: var(--primary); }
.race.behind { color: var(--warn); }
.race-list { list-style: none; padding: 6px 0 0; margin: 0; display: none; font-size: 12.5px; color: var(--muted); }
.trip.open .race-list { display: block; }
.rivals { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rivals li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.rivals li b { min-width: 140px; }
.vlist .vo { color: var(--muted); font-size: 13px; flex: 1; }
.vlist .va { display: flex; gap: 4px; }
.vlist .va button { background: none; border: 1px solid var(--line-2); color: var(--muted); border-radius: 7px; padding: 3px 8px; cursor: pointer; font: inherit; }
.vlist .va button:hover { color: var(--text); }
.vlist .empty { color: var(--faint); font-size: 13.5px; border: 0; background: none; }
.picker-item .cb { width: 16px; height: 16px; border: 2px solid var(--line-2); border-radius: 4px; flex: none; display: grid; place-items: center; font-size: 11px; }
.picker-item.sel .cb { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.picker-item .nm { flex: 1; }
#orderTimeLine.soon { color: var(--warn); font-weight: 700; }
.queue .qact button.front { color: var(--primary); border-color: rgba(34,197,94,.45); font-weight: 700; }
.queue .qact button.front:hover { background: var(--primary-soft); color: var(--primary); }
.modal-msg { white-space: pre-line; }

/* ================= v1.5: users, roles, login ================= */
.noperm { display: none !important; }
.lock-box input { text-align: left; letter-spacing: normal; font-size: 16px; }
.lock-box #lockPass, .lock-box #mcOld, .lock-box #mcNew, .lock-box #mcNew2, .lock-box #suPass, .lock-box #suPass2 { letter-spacing: .06em; }
.userchip { position: relative; }
.userchip .btn.ghost { display: inline-flex; align-items: center; gap: 8px; color: var(--text); padding: 6px 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-weight: 800; flex: none; }
.uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.usermenu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.45); padding: 6px; z-index: 30; display: grid; }
.usermenu .um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; gap: 4px; }
.usermenu a, .usermenu button { text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.usermenu a:hover, .usermenu button:hover { background: var(--card-2); }
.usermenu #umLogout { color: var(--err); }
#statusPill { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; }
.wamenu { min-width: 260px; }
.wamenu #wmUnlink { color: var(--err); }
.wm-qr { display: block; width: 220px; height: 220px; margin: 4px auto 8px; background: #fff; padding: 6px; border-radius: 10px; }
/* v1.16: two numbers in the status menu and the home QR card */
.wm-acct { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0; display: grid; gap: 4px; }
.wm-acct.on { border-color: var(--primary); background: var(--primary-soft); }
.wm-acct-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wm-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.wm-acts:empty { display: none; }
.wamenu { min-width: 300px; }
.qrslots { display: flex; flex-wrap: wrap; gap: 16px; }
.qrslot { flex: 1 1 240px; max-width: 320px; }
.qrslot-title { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
#sideStatusBtn { background: none; border: 0; color: inherit; font: inherit; padding: 0; cursor: pointer; text-align: left; }
.me-line { margin: 2px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ulist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.ulist li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ulist li.off { opacity: .6; }
.ulist .ui { flex: 1 1 220px; min-width: 0; }
.ulist .ua { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ulist .ua select { width: auto; padding: 5px 8px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.roles { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.roles th, table.roles td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: center; }
table.roles td:first-child, table.roles th:first-child { text-align: left; }
table.roles td:not(:first-child) { color: var(--primary); font-weight: 800; }
table.perms td.grp { text-align: left; background: var(--card-2); color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 10px; }
table.perms input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); cursor: pointer; }
table.perms input[type=checkbox]:disabled { cursor: not-allowed; opacity: .55; }
table.perms td.lbl { font-weight: 400; color: inherit; }
.log li.audit { border-left-color: var(--blue); }
.log li.audit.failed { border-left-color: var(--err); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
@media (max-width: 720px) {
  .uname { display: none; }
  .top-actions { gap: 6px; }
}
@media (max-width: 520px) {
  /* phones: a WhatsApp-link icon button (like the lock button) with a coloured status dot; tapping opens the WhatsApp menu */
  #statusPill { position: relative; font-size: 0; padding: 8px 10px; border-radius: 9px; line-height: 1; }
  #statusPill::before { content: "📶"; font-size: 16px; }
  #statusPill::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--bg-2); }
  #statusPill.bad::before { content: "📵"; }
  .wamenu { position: fixed; left: 12px; right: 12px; top: 60px; min-width: 0; }
  #lockBtn { font-size: 0; padding: 8px 10px; }
  #lockBtn::before { content: "🔒"; font-size: 16px; }
}

/* ================= v1.9.7: phone layout fixes ================= */
/* Grid items default to min-width:auto, so one long vehicle number widened the whole home page
   past the screen edge. Columns may shrink; long words wrap instead. */
.content, .content > section[data-view] { grid-template-columns: minmax(0, 1fr); }
.content > section[data-view] > *, .card, .tile { min-width: 0; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.tile-value, .next-box .num, .vlist .vn, .trip-title, .rivals li b { overflow-wrap: anywhere; }
.next-box > * { min-width: 0; }

/* queue row: number on the first line, owner + buttons on the second */
.queue li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "i n n" "i o a"; column-gap: 10px; row-gap: 4px; align-items: center; }
.queue li > .idx { grid-area: i; }
.queue li > .qnum { grid-area: n; overflow-wrap: anywhere; }
.queue li > .qown { grid-area: o; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue li > .qact { grid-area: a; margin-left: 0; }
.queue li.empty { display: block; }

@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 12px; }
  .tile-label { font-size: 11.5px; }
  .next-box { padding: 10px 12px; gap: 4px 10px; }
  .next-box .num { font-size: 21px; line-height: 1.25; }
  .next-box .more { margin-left: 0; width: 100%; }
  .queue .qact button { padding: 5px 9px; }
  .vlist .vn { min-width: 0; flex: 1 1 100%; }
  .vlist .vo, .vlist .vs { flex: 1 1 100%; }
  .vlist .va { margin-left: auto; }
  .rivals li b { min-width: 0; }
  .kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
  .topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a { font-size: 10.5px; padding: 0 1px; }
  .tabbar a .ic { font-size: 17px; }
}
@media (max-width: 380px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .card { padding: 12px; }
  .tiles { gap: 8px; }
  .tile-value { font-size: 17px; }
}
/* phones: wrap secondary text instead of cutting it with "…" */
@media (max-width: 720px) {
  .tile-sub { white-space: normal; overflow: visible; text-overflow: clip; }
  .queue li > .qown { white-space: normal; overflow: visible; }
  .chip.vchip { max-width: 100%; }
  .chip.vchip .own { white-space: normal; }
  .chip > span { white-space: normal; max-width: none; overflow-wrap: anywhere; }
  .picker-btn .txt { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
  .topbar h1 { font-size: 16px; }
}
@media (max-width: 380px) { .topbar h1 { font-size: 15px; } .top-actions .btn.pause { min-width: 0; } }
@media (max-width: 380px) {
  .queue li { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "i n" "i o" "i a"; }
  .queue li > .qact { justify-self: end; }
}

/* sticky header: solid background first. color-mix() is unknown to older phone browsers and
   in-app browsers, which then dropped the whole background and the text behind showed through. */
.topbar { background: var(--bg); box-shadow: 0 1px 0 var(--line), 0 6px 16px -10px rgba(0,0,0,.45); }
@supports (background: color-mix(in srgb, red 50%, transparent)) and ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (min-width: 721px) {
    .topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  }
}
@media (max-width: 720px) {
  .topbar { background: var(--bg-2); -webkit-backdrop-filter: none; backdrop-filter: none; z-index: 30; }
}

/* v1.11: target group WhatsApp cannot find */
.chip.broken { background: var(--err-soft); border-color: rgba(239,68,68,.45); color: var(--err); }

/* v1.14: order time page (daily / one date) */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; margin-bottom: 10px; max-width: 100%; }
.seg label { margin: 0; cursor: pointer; position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--muted); background: var(--card-2); }
.seg label + label span { border-left: 1px solid var(--line-2); }
.seg input:checked + span { background: var(--primary-soft); color: var(--primary); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.tlist .vn { min-width: 110px; }
.tlist li.ann { border-left: 3px solid var(--blue); }
.tlist li.empty { color: var(--muted); }
#timesNext.soon, #orderTimeLine.soon { color: var(--warn); font-weight: 700; }
@media (max-width: 420px) { .seg { display: flex; } .seg label { flex: 1; } .seg span { text-align: center; padding: 8px 6px; } }

/* v1.14.1: queue row buttons with words, bigger tap targets, red remove (home + vehicles, phone too) */
.queue .qact { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.queue .qact button { padding: 7px 12px; min-height: 36px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.queue .qact button:disabled { opacity: .35; cursor: not-allowed; }
.queue .qact button[data-act="remove"] { background: var(--err); border-color: var(--err); color: #fff; }
.queue .qact button[data-act="remove"]:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.queue li { padding: 10px 12px; row-gap: 8px; }
.queue { gap: 8px; }
@media (max-width: 720px) {
  /* phones: buttons get their own full-width row, equal widths, one line */
  .queue li { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "i n" "i o" "a a"; }
  .queue li > .qact { display: flex; flex-wrap: nowrap; gap: 6px; width: 100%; }
  .queue .qact button { flex: 1 1 auto; min-height: 42px; padding: 8px 6px; font-size: 14px; }
}

/* v1.15: today / tomorrow queue tabs, "out until" chooser, market report, time suggestions */
.seg.qday { margin: 4px 0 10px; }
.next-box.tomorrow { border-color: var(--blue); background: var(--blue-soft); }
.next-box.tomorrow .lbl { color: var(--blue); }
.vlist li .offpick { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px; margin-top: 4px; border: 1px dashed var(--line-2); border-radius: 9px; background: var(--card); }
.vlist li .offpick > span { flex: 1 1 100%; }
.vlist li .offpick .dr-field { margin: 0; }
.vlist li .offpick input[type=date] { padding: 6px 8px; }
.mk-reasons { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.mk-reasons li { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 6px 10px; background: var(--card-2); border-radius: 8px; }
table.mk { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.mk th, table.mk td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: right; white-space: nowrap; }
table.mk th:first-child, table.mk td:first-child { text-align: left; white-space: normal; }
table.mk th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.sugg { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.sugg li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card-2); }
.sugg li b { font-size: 16px; }
.seg b { font-weight: 700; margin-left: 2px; }
@media (max-width: 360px) {
  .queue li > .qact { gap: 4px; }
  .queue .qact button { padding: 8px 3px; font-size: 13.5px; }
}
.wamenu { max-height: calc(100vh - 90px); overflow-y: auto; }

/* v1.17 manual mode: one picked vehicle goes (once) instead of the list */
.qmode-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 6px; }
.seg.qmode { margin: 0; }
.seg.qmode.manual input:checked + span { background: var(--warn-soft); color: #b45309; }
.seg input:disabled + span { cursor: default; }
.next-box.manual { background: var(--warn-soft); border-color: rgba(245,181,10,.5); }
.next-box.manual .lbl { color: #b45309; }
.next-box.manual.empty { background: var(--err-soft); border-color: rgba(239,68,68,.35); }
.next-box.manual.empty .lbl { color: var(--muted); }
.next-box .btn.small.ghost { margin-left: auto; }
.queue.paused li { opacity: .6; }
.queue.paused li.picked { opacity: 1; border-color: #f59e0b; }
.queue li.note { display: block; opacity: 1; background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-size: 12.5px; }
.queue .qact button.pick { color: #b45309; border-color: rgba(245,181,10,.6); font-weight: 700; }
.queue .qact button.pick:hover { background: var(--warn-soft); color: #b45309; }
.queue .qact button.pick:disabled { opacity: 1; background: var(--warn-soft); }

/* which WhatsApp number: badge + A/B filter (v1.17) */
.badge.via { font-weight: 600; font-size: 11px; padding: 2px 8px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap; }
.badge.via.slot-b { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.filters.slotf { margin-top: 6px; }
.filters.slotf .fchip { font-size: 12px; padding: 4px 10px; }

/* simple screen: one vehicle number (v1.18) */
.simple-form { display: flex; gap: 8px; margin: 12px 0 6px; }
.simple-form input { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.next-plate { font-size: 20px; margin: 2px 0; }

/* page load: blank screen until the session is known, so a logged-in reload never flashes the login form */
.overlay.lock .boot-msg { display: none; }
.overlay.lock.booting .boot-msg { display: grid; justify-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.overlay.lock.booting .boot-msg img { border-radius: 14px; opacity: .85; }
.overlay.lock.booting .lock-box { display: none; }
.next-box #simpleClear { margin-left: auto; flex-shrink: 0; }
