/* ═══════════════════════════════════════════════════════════════
   NetMap Dashboard — Modern Slate Design
   Palette: Slate #1E293B · Indigo #6366F1 · Amber #F59E0B
   ═══════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────── */
:root {
  /* Brand */
  --m-navy:      #1E293B;
  --m-navy-dk:   #0F172A;
  --m-yellow:    #F59E0B;
  --m-yellow-dk: #D97706;
  --m-blue:      #6366F1;
  --m-blue-dk:   #4F46E5;
  --m-blue-lt:   #EEF2FF;
  /* Surface — blue-tinted for depth over flat grey */
  --bg:          #E8EBF2;
  --bg2:         #F7F8FD;
  --bg3:         #ECEEF6;
  --bg4:         #D0D4E2;
  --sep:         #C4CAD9;
  /* Text */
  --fg:          #0F172A;
  --fg2:         #1E293B;
  --fg3:         #4B5563;
  /* Status */
  --ok:          #059669;
  --ok-bg:       #ECFDF5;
  --warn:        #D97706;   /* UI badge amber — against white/light surfaces */
  --warn-bg:     #FFFBEB;
  --danger:      #DC2626;   /* UI badge red   — against white/light surfaces */
  --danger-bg:   #FEF2F2;
  /* Note: --sc-ok/warn/danger are the vivid sensor/marker palette used over
     dark map tiles and coloured backgrounds; --ok/warn/danger are the muted
     palette used in alert pills and status text on light UI surfaces.      */
  /* Misc */
  --sidebar-w:   290px;
  --header-h:    56px;
  --r:           8px;
  --r-sm:        5px;
  --r-full:      9999px;
  /* Status indicator palette (sensor dots, map markers, TPMS badges) */
  --sc-ok:         #16a34a;
  --sc-ok-bg:      rgba(52,211,153,0.15);
  --sc-warn:       #fbbf24;
  --sc-warn-bg:    rgba(251,191,36,0.15);
  --sc-danger:     #f87171;
  --sc-danger-bg:  rgba(248,113,113,0.15);
  --sc-unknown:    #55556a;
  --sc-unknown-bg: rgba(85,85,106,0.15);
  /* Extended SC palette — vivid indicators, chart series, idle/neutral */
  --sc-ok-vivid: #059669;  /* emerald-600 — ok state indicators (WCAG AA on light bg) */
  --sc-blue:     #60a5fa;  /* info blue   — temperature, GPS, idle state    */
  --sc-neutral:  #94a3b8;  /* slate grey  — stopped, raw GPS, fallback       */
  --sc-stale:    #8A8D9E;  /* muted grey  — chart axes, stale badge label    */
  --sc-chart-bg: #1e293b;  /* chart tooltip background (navy)               */
  --sc-chart-fg: #e2e8f0;  /* chart tooltip body text (light slate)         */
  /* Event / series semantic colors */
  --sc-violet:   #a78bfa;  /* idle, boot, config events; unknown TPMS wheel */
  --sc-cyan:     #22d3ee;  /* ping events, product info label               */
  --sc-orange:   #fb923c;  /* stopped events, harsh braking series          */
  --sc-pink:     #f472b6;  /* over-rev events, RPM chart series             */
  /* Font scale */
  --fs-xxs:   9px;  /* micro: chip labels, chart ticks  */
  --fs-xs:   10px;  /* action labels, badge text        */
  --fs-sm:   11px;  /* secondary text, captions         */
  --fs-md:   12px;  /* standard UI text                 */
  --fs-body: 13px;  /* body / table text                */
  --fs-lg:   14px;  /* section headers, list items      */
  --fs-xl:   15px;  /* panel titles                     */
  --fs-2xl:  16px;  /* headings, stat values            */
  /* Font scale half-steps */
  --fs-xxs-mid:  9.5px;  /* micro label variant            */
  --fs-xs-mid:  10.5px;  /* period pill labels             */
  --fs-sm-mid:  11.5px;  /* dates, secondary captions      */
  --fs-md-mid:  12.5px;  /* vehicle picker, sensor badges  */
  /* Z-index layers (ordered low → high) */
  --z-float:          10;   /* floating widgets within sections      */
  --z-header:        100;   /* main app header bar                   */
  --z-dropdown:      200;   /* dropdowns, popovers, map ctrl buttons */
  --z-mobile-bkdrop: 350;   /* mobile sidebar backdrop               */
  --z-mobile-sidebar:400;   /* mobile sidebar slide-in drawer        */
  --z-modal-bkdrop:  900;   /* darkened full-screen modal backdrop   */
  --z-modal:        1000;   /* standard modals                       */
  --z-panel-bkdrop: 1050;   /* admin-panel backdrop                  */
  --z-panel:        1100;   /* admin drawer sheet                    */
  --z-modal-top:    1200;   /* priority modals (above panel)         */
  --z-kbd:          2500;   /* keyboard shortcuts dialog             */
  --z-logs:         3000;   /* server log viewer overlay             */
  --z-toast:        9999;   /* toasts, loading overlays              */
  --z-confirm:     10000;   /* delete confirmation (always on top)   */
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:        'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  --trans:       0.15s ease;
  --shadow:      0 1px 3px rgba(79,70,229,.07), 0 4px 12px rgba(79,70,229,.06);
  --shadow-md:   0 2px 8px rgba(79,70,229,.10), 0 8px 24px rgba(79,70,229,.09);
  /* Backward-compat aliases */
  --bg1:         #F7F8FD;
  --fg1:         #0F172A;
}

/* ── Dark theme ───────────────────────────────────────────── */
[data-theme="dark"] {
  /* Surface — richer navy-dark for better depth */
  --bg:          #0D0F1B;
  --bg2:         #161929;
  --bg3:         #1E2237;
  --bg4:         #272B42;
  --sep:         #303556;
  /* Text */
  --fg:          #E8EAF6;
  --fg2:         #A8ABBE;
  --fg3:         #636880;
  /* Aliases */
  --bg1:         #161929;
  --fg1:         #E8EAF6;
  /* Restore vivid teal for ok-state on dark backgrounds */
  --sc-ok-vivid: #34d399;
  /* Status – adjusted for dark bg */
  --ok-bg:       rgba(26,140,78,.18);
  --warn-bg:     rgba(184,98,0,.18);
  --danger-bg:   rgba(192,57,43,.18);
  --m-blue-lt:   rgba(99,102,241,.14);
  /* Shadows brighter on dark */
  --shadow:      0 2px 8px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:   0 4px 20px rgba(0,0,0,.50), 0 2px 6px rgba(0,0,0,.25);
}
/* stat-value in dark mode uses fg1 instead of navy so it stays visible */
[data-theme="dark"] .stat-value { color: var(--fg); }

/* ── Light-theme contrast overrides ─────────────────────────── */
/* Delay column: darken neon colours for legibility on white backgrounds */
:root .td-delay-rt  { color: #059669 !important; }   /* emerald-600  */
:root .td-delay-ok  { color: #4d7c0f !important; }   /* lime-700     */
:root .td-delay-mid { color: #b45309 !important; }   /* amber-700    */
:root .td-delay-hi  { color: #c2410c !important; }   /* orange-700   */
:root .td-delay-off { color: #4b5563 !important; }   /* gray-600     */
:root .td-delay-bad { color: #b91c1c !important; }   /* red-700      */
/* Active pill toggles: darker stroke+text so they read on light bg */
:root .ev-pill-toggle.active      { background: rgba(109,40,217,.1);  border-color: #7c3aed; color: #7c3aed; }
:root .ev-pill-errors.active      { background: rgba(185,28,28,.08);  border-color: #b91c1c; color: #b91c1c; }
:root .ev-pill-alerts.active      { background: rgba(180,83,9,.08);   border-color: #b45309; color: #b45309; }
/* Alert/error card header text */
:root .ev-alerts-card-header      { color: #b45309; }
:root .ev-alerts-card-empty       { color: #047857; }
:root .ev-errors-card-header      { color: #b91c1c; }
:root .ev-errors-card-ok          { color: #047857; }
/* ev-badge: boost saturation so colour text stays readable on light bg */
:root .ev-badge {
  background: color-mix(in srgb, var(--ev-color) 12%, transparent);
  color: color-mix(in srgb, var(--ev-color) 100%, #000 30%);
  border: 1px solid color-mix(in srgb, var(--ev-color) 40%, transparent);
}
/* Restore cleaner look in dark mode (no border needed there) */
[data-theme="dark"] .ev-badge {
  background: color-mix(in srgb, var(--ev-color) 15%, transparent);
  color: var(--ev-color);
  border: none;
}
/* Row-sysev detail button: visible in both themes */
:root .row-sysev-detail-btn    { color: var(--fg3); }
:root .row-sysev-detail-btn:hover { color: #7c3aed; background: rgba(109,40,217,.08); }
[data-theme="dark"] .row-sysev-detail-btn:hover { color: #a78bfa; background: rgba(139,92,246,.12); }

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: rgba(99,102,241,.28); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.50); }

/* ═══════════════════════════════════════════════════════════════
   Header — TPMS Navy
   ═══════════════════════════════════════════════════════════════ */
#header {
  background: var(--m-navy);
  display: flex;
  align-items: center;
  padding: 0 20px 0 0;
  gap: 12px;
  z-index: var(--z-header);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.30), 0 1px 3px rgba(0,0,0,.18);
}

.toolbar-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--sep);
}

.toolbar-select-wrap label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg3);
}

.toolbar-select-wrap select {
  min-width: 150px;
  height: 32px;
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  background: var(--bg2);
  color: var(--fg);
  padding: 0 10px;
  font: inherit;
}

.toolbar-select-wrap select:focus {
  outline: none;
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-blue) 18%, transparent);
}

/* ── POI custom pill-dropdown ───────────────────────────────────────── */
.poi-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-full);
  cursor: pointer; font: var(--fs-md)/1 var(--font); color: var(--fg2);
  transition: background var(--trans), border-color var(--trans), color var(--trans);
  white-space: nowrap;
}
.poi-filter-btn:hover  { border-color: var(--m-blue); color: var(--m-blue-dk); }
.poi-filter-btn.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue-dk); box-shadow: 0 1px 4px rgba(99,102,241,.35); }
.poi-filter-btn.active svg { stroke: #fff; }

.poi-filter-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 2000;
  width: 240px;
  background: var(--bg2); border: 1px solid var(--sep); border-radius: var(--r);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.poi-filter-search-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--sep);
}
.poi-filter-search-wrap svg { flex-shrink: 0; opacity: .5; }
.poi-filter-search {
  flex: 1; background: none; border: none; outline: none;
  font: var(--fs-md)/1 var(--font); color: var(--fg);
}
.poi-filter-search::placeholder { color: var(--fg3); }
.poi-filter-list { max-height: 260px; overflow-y: auto; padding: 4px 0; }
.poi-filter-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; cursor: pointer;
  font-size: var(--fs-md); color: var(--fg2);
  transition: background var(--trans);
}
.poi-filter-item:hover  { background: var(--bg3); }
.poi-filter-item.selected { color: var(--m-blue); font-weight: 600; }
.poi-filter-item .poi-item-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--m-blue);
}
.poi-filter-empty { padding: 12px 14px; font-size: var(--fs-sm); color: var(--fg3); text-align: center; }
.logo {
  display: flex; align-items: center; gap: 0;
  text-decoration: none; flex-shrink: 0; align-self: stretch;
  padding: 0 4px;
}
.logo-icon {
  width: var(--header-h); height: var(--header-h);
  flex-shrink: 0;
}
.logo-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-text-group {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; padding-left: 10px;
}
.logo-wordmark {
  padding: 0; font-size: var(--fs-2xl); font-weight: 700;
  color: #fff; letter-spacing: -0.2px; white-space: nowrap;
}
.logo-text-group .status-pill {
  background: none; border: none; padding: 0; gap: 4px;
  font-size: var(--fs-xs); color: rgba(255,255,255,0.65);
}
.logo-text-group .status-pill.live,
.logo-text-group .status-pill.ws-live { background: none; border: none; color: rgba(255,255,255,0.65); }
.logo-text-group .status-pill .dot { width: 6px; height: 6px; }
.logo-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.2); margin: 0 6px 0 4px; flex-shrink: 0; }
/* ── Header navigation tabs ─────────────────────────────────────────────── */
.header-nav { display: flex; align-items: center; gap: 2px; }
.header-nav-btn {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 6px;
  border: none; cursor: pointer; white-space: nowrap;
  font-size: var(--fs-body); font-weight: 500; font-family: var(--font);
  color: rgba(255,255,255,0.6); background: transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #d97706; color: #fff;
  border-radius: 8px; font-size: var(--fs-xs); font-weight: 700; line-height: 16px;
  text-align: center; pointer-events: none;
  box-shadow: 0 0 0 2px var(--header-bg, #1e1e2e);
}
.header-nav-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.header-nav-btn.active { background: rgba(99,102,241,0.3); color: #fff; }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-md); font-weight: 500; padding: 4px 12px;
  border-radius: var(--r-full); background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.75); border: 1px solid rgba(255,255,255,0.15);
  transition: all var(--trans);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); flex-shrink: 0; }
.status-pill.live { background: rgba(26,140,78,0.25); border-color: rgba(26,140,78,0.5); color: #7DE8A8; }
.status-pill.live .dot {
  background: #7DE8A8;
  box-shadow: 0 0 0 0 rgba(125,232,168,.7);
  animation: sonar 2s ease-out infinite;
}
@keyframes sonar {
  0%   { box-shadow: 0 0 0 0   rgba(125,232,168,.7); }
  70%  { box-shadow: 0 0 0 7px rgba(125,232,168,.0); }
  100% { box-shadow: 0 0 0 0   rgba(125,232,168,.0); }
}
/* Legacy pulse kept for non-live states that still reference it */
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

.spacer { flex: 1; }
.icon-btn {
  background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.15);
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); cursor: pointer;
  color: rgba(255,255,255,0.80); font-size: var(--fs-2xl); font-weight: 600; line-height: 1; transition: all var(--trans);
}

.icon-btn:hover  { background: rgba(255,255,255,0.18); color: #fff; }
.icon-btn.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: 440px;
  overflow: hidden;
  background: var(--bg1);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.34);
  z-index: var(--z-dropdown);
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sep);
  background: var(--bg2);
  color: var(--fg1);
  font-size: var(--fs-body);
  font-weight: 700;
}
.notif-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 380px;
}
.notif-item {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sep);
  cursor: pointer;
}
.notif-item:hover { background: var(--bg2); }
.notif-item.is-unread { background: color-mix(in srgb, var(--m-blue) 10%, var(--bg1)); }
.notif-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.notif-item-title { font-size: var(--fs-body); font-weight: 700; color: var(--fg1); }
.notif-item-time { font-size: var(--fs-xs); color: var(--fg3); white-space: nowrap; }
.notif-item-body { margin-top: 4px; font-size: var(--fs-sm-mid); color: var(--fg2); line-height: 1.45; }
.notif-item-meta { margin-top: 6px; font-size: var(--fs-xs); color: var(--fg3); }
.notif-empty { padding: 18px 14px; font-size: var(--fs-body); color: var(--fg3); }
.user-badge {
  display: flex; align-items: center; gap: 8px;
  padding-left: 14px; margin-left: 4px;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.user-name  { font-size: var(--fs-body); font-weight: 500; color: rgba(255,255,255,0.9); }
.role-badge { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: var(--r-full); }
.role-badge.admin { background: var(--m-blue); color: #fff; }
.role-badge.user  { background: rgba(99,102,241,0.2); color: #A5B4FC; }

/* ═══════════════════════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════════════════════ */
#main {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════════════════════════ */
#sidebar {
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg3) 100%);
  border-right: 1px solid var(--sep);
  display: flex; flex-direction: column; overflow: hidden;
  height: 100%;
}
.sidebar-vehicle-bar {
  padding: 10px 14px; flex-shrink: 0;
  border-bottom: 1px solid var(--sep);
  display: flex; gap: 6px; align-items: center;
  background: var(--bg);
}
/* ── Fleet nav button (top of sidebar, global) ───────────────────────── */
.fleet-nav-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 11px 16px; flex-shrink: 0;
  background: transparent; border: none; border-bottom: 1px solid var(--sep);
  cursor: pointer; text-align: left;
  font-size: var(--fs-body); font-weight: 600; color: var(--fg2);
  transition: background .15s, color .15s;
}
.fleet-nav-btn:hover { background: var(--bg2); color: var(--fg); }
.fleet-nav-btn.active { color: #6366F1; background: rgba(99,102,241,.10); }
.fleet-nav-btn .fn-icon { opacity: .65; flex-shrink: 0; transition: opacity .15s; }
.fleet-nav-btn:hover .fn-icon,
.fleet-nav-btn.active .fn-icon { opacity: 1; }
/* ── Vehicle picker (replaces native select) ─────────────────────────── */
.vehicle-picker { flex: 1; position: relative; min-width: 0; }
.vehicle-picker-btn {
  width: 100%; display: flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--sep);
  border-radius: var(--r-sm); color: var(--fg);
  font: 500 13px/1 var(--font); padding: 7px 10px;
  cursor: pointer; text-align: left;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.vehicle-picker-btn:hover { border-color: var(--fg3); }
.vehicle-picker-btn:focus { outline: none; border-color: var(--m-blue); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.vehicle-picker-btn.vp-open { border-color: var(--m-blue); }
.vp-btn-icon { flex-shrink: 0; width: 16px; height: 16px; color: var(--fg2); display: flex; align-items: center; }
.vp-btn-icon svg { width: 16px; height: 16px; }
.vp-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-chevron { flex-shrink: 0; color: var(--fg3); transition: transform .15s; }
.vehicle-picker-btn.vp-open .vp-chevron { transform: rotate(180deg); }
.vehicle-picker-panel {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--sep);
  border-radius: var(--r-sm); z-index: var(--z-dropdown);
  box-shadow: 0 8px 28px rgba(0,0,0,.3); overflow: hidden;
}
.vp-search-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; border-bottom: 1px solid var(--sep); color: var(--fg3);
}
.vp-search { flex: 1; background: none; border: none; outline: none; color: var(--fg); font: inherit; font-size: var(--fs-md-mid); }
.vp-list { max-height: 260px; overflow-y: auto; }
.vp-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: none; border: none;
  cursor: pointer; color: var(--fg); font: inherit; text-align: left;
  transition: background var(--trans);
}
.vp-item:hover { background: rgba(99,102,241,.08); }
.vp-item.vp-active { background: var(--m-blue-lt); }
.vp-item-icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--fg3); }
.vp-item-icon svg { width: 18px; height: 18px; }
.vp-item.vp-active .vp-item-icon { color: var(--m-blue); }
.vp-item-body { flex: 1; min-width: 0; }
.vp-item-name { font-size: var(--fs-md-mid); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-item-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.vp-item-vrn { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .5px; background: rgba(99,102,241,.15); color: var(--m-blue); border-radius: 3px; padding: 1px 4px; }
.vp-item-count { font-size: var(--fs-sm); color: var(--fg3); }
.vp-item-nosensor { font-size: var(--fs-sm); color: var(--fg3); font-style: italic; }
.vp-empty { padding: 14px 10px; font-size: var(--fs-md); color: var(--fg3); text-align: center; }
.sidebar-vehicle-bar .icon-btn { background: var(--bg3); border: 1px solid var(--sep); color: var(--fg2); }
.sidebar-vehicle-bar .icon-btn:hover { background: var(--bg4); color: var(--fg); }

/* ── Sidebar asset list (replaces vehicle picker) ────────────────────────── */
/* ── Compact unselected asset card ────────────────────────────────────────── */
.sidebar-asset-compact {
  display: flex; align-items: center;
  margin: 2px 8px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--sep);
  cursor: pointer; overflow: hidden; min-height: 54px;
  transition: background var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.sidebar-asset-compact:hover {
  background: var(--bg3);
  border-color: color-mix(in srgb, var(--sae-color, #6366F1) 35%, var(--sep));
  box-shadow: 0 3px 14px rgba(0,0,0,.13), 0 1px 3px rgba(0,0,0,.07);
}
.sac-accent {
  width: 4px; align-self: stretch; flex-shrink: 0;
  background: var(--sae-color, #6366F1);
  border-radius: 10px 0 0 10px;
}
.sac-icon {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin: 0 8px 0 10px;
  color: var(--sae-color, #6366F1);
}
.sac-icon svg { width: 22px; height: 22px; }
.sac-body { flex: 1; min-width: 0; padding: 9px 4px 9px 0; }
.sac-name {
  font-size: var(--fs-md-mid); font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sac-sub {
  font-size: var(--fs-sm); color: var(--fg3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sac-vrn {
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  font-family: monospace; color: var(--fg2);
}
.sac-sub-sep { opacity: .5; margin: 0 2px; }
.sac-right {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end;
  gap: 5px; padding: 9px 12px;
}
.sac-ts { font-size: var(--fs-xs); color: var(--fg3); white-space: nowrap; }
.sac-odo { font-size: var(--fs-xs); color: var(--fg3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sac-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sae-color, #6366F1); flex-shrink: 0;
}
@keyframes sacPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sae-color, #22c55e) 60%, transparent); }
  60%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.sac-dot--pulse {
  animation: sacPulse 1.6s ease-out infinite;
}
.sac-poi {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: var(--fg2); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sac-poi-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.sac-fuel-wrap {
  display: flex; align-items: center; gap: 5px; margin-top: 4px;
}
.sac-fuel-label {
  font-size: var(--fs-xs); color: var(--fg3); flex-shrink: 0; font-weight: 600;
}
.sac-fuel-bar {
  height: 3px; border-radius: 2px; flex: 1;
  background: var(--bg4); overflow: hidden; min-width: 36px; max-width: 64px;
}
.sac-fuel-fill {
  height: 100%; border-radius: 2px; transition: width .4s;
}
.sac-fuel-pct {
  font-size: var(--fs-xs); font-weight: 600; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.sac-admin {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  padding: 6px 8px;
  border-left: 1px solid var(--sep);
}
/* Dim compact cards when one asset is expanded/selected */
#sidebar-asset-list:has(.sidebar-asset-expanded) .sidebar-asset-compact {
  opacity: 0.62; transition: opacity var(--trans);
}
#sidebar-asset-list:has(.sidebar-asset-expanded) .sidebar-asset-compact:hover { opacity: 1; }
[data-theme="dark"] .sidebar-asset-compact { background: var(--bg3); }

/* ── Sidebar asset search bar ─────────────────────────────────────────────── */
.sidebar-asset-search-wrap {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 8px 4px; padding: 6px 10px;
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 9px;
  transition: border-color var(--trans);
}
.sidebar-asset-search-wrap:focus-within {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--m-blue) 18%, transparent);
}
.sidebar-asset-search-icon { flex-shrink: 0; color: var(--fg3); }
.sidebar-asset-search-wrap input[type="search"] {
  flex: 1; background: none; border: none; outline: none;
  font-size: var(--fs-md); color: var(--fg); min-width: 0;
}
.sidebar-asset-search-wrap input[type="search"]::placeholder { color: var(--fg3); }
.sidebar-asset-search-wrap input[type="search"]::-webkit-search-cancel-button { display: none; }
#asset-search-clear {
  flex-shrink: 0; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg4); border: none; border-radius: 50%;
  color: var(--fg3); font-size: 10px; cursor: pointer; line-height: 1;
  transition: background var(--trans), color var(--trans);
}
#asset-search-clear:hover { background: var(--sep); color: var(--fg); }
.sae-ts { font-size: var(--fs-sm); color: var(--fg3); margin-top: 3px; opacity: .75; }

/* ── Selected asset expanded card ─────────────────────────────────────────── */
.sidebar-asset-expanded {
  margin: 6px 8px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--sep);
  box-shadow: 0 4px 24px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.08);
  overflow: hidden;
}
.fleet-summary-card {
  margin: 6px 8px 8px;
  border-color: color-mix(in srgb, var(--sae-color, #6366F1) 36%, var(--sep));
  background: linear-gradient(180deg, color-mix(in srgb, var(--sae-color, #6366F1) 8%, var(--bg2)) 0%, var(--bg2) 100%);
  box-shadow: 0 8px 28px rgba(0,0,0,.16), 0 1px 4px rgba(0,0,0,.08);
}
.fleet-summary-card .sae-header {
  background: linear-gradient(180deg, color-mix(in srgb, var(--sae-color, #6366F1) 8%, var(--bg3)) 0%, var(--bg3) 100%);
  border-bottom-color: color-mix(in srgb, var(--sae-color, #6366F1) 24%, var(--sep));
}
.fleet-summary-card .sae-icon {
  border-color: color-mix(in srgb, var(--sae-color, #6366F1) 24%, var(--sep));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sae-color, #6366F1) 10%, transparent);
}
.fleet-summary-card .sae-name {
  letter-spacing: -.01em;
}
.sae-fleet-health {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 8px;
}
.sae-fleet-actions {
  padding: 10px 12px;
  border-top: 1px solid color-mix(in srgb, var(--sae-color, #6366F1) 18%, var(--sep));
}
.sae-fleet-detail-btn {
  width: 100%; padding: 7px 12px;
  background: color-mix(in srgb, var(--sae-color, #6366F1) 12%, var(--bg2));
  color: color-mix(in srgb, var(--sae-color, #6366F1) 85%, var(--fg1));
  border: 1px solid color-mix(in srgb, var(--sae-color, #6366F1) 28%, var(--sep));
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-align: center;
  transition: background .15s, border-color .15s;
}
.sae-fleet-detail-btn:hover {
  background: color-mix(in srgb, var(--sae-color, #6366F1) 20%, var(--bg2));
  border-color: color-mix(in srgb, var(--sae-color, #6366F1) 44%, var(--sep));
}

.sae-header {
  display: flex; flex-direction: column; align-items: stretch;
  padding: 12px 10px 12px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--sep);
  position: relative;
}
/* Close button: absolute top-right */
.sae-header > .sae-close {
  position: absolute; top: 8px; right: 8px;
}
/* Name row: icon + name side by side */
.sae-name-row {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.sae-icon {
  flex-shrink: 0; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border-radius: 10px; border: 1px solid var(--sep);
  color: var(--sae-color, #6366F1);
}
.sae-icon svg { width: 28px; height: 28px; }
.sae-info { min-width: 0; }
.sae-name { font-size: var(--fs-xl); font-weight: 700; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sae-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
/* Each info row sits on its own line */
.sae-row {
  display: block; margin-top: 3px;
  font-size: var(--fs-md); font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  font-family: monospace; width: fit-content;
  background: #fff; color: #111;
  border: 1.5px solid #bbb; border-left: 8px solid #003399;
  border-radius: 4px; padding: 2px 8px 2px 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.sae-row-vin {
  text-transform: none; letter-spacing: .06em;
  font-size: var(--fs-md-mid); font-weight: 600;
  background: var(--bg); color: var(--fg2);
  border: 1px solid var(--sep); border-left: 1px solid var(--sep);
  box-shadow: none; word-break: break-all;
}
.sae-row-meta {
  display: flex; align-items: baseline; gap: 6px; margin-top: 3px;
  font-size: var(--fs-md); color: var(--fg2);
}
.sae-meta-row {
  display: flex; align-items: baseline; gap: 6px; margin-top: 4px;
}
.sae-meta-label {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fg3); flex-shrink: 0;
}
.sae-meta-val {
  font-size: var(--fs-md); color: var(--fg2);
}
.sae-meta-mono {
  font-family: var(--mono, monospace); font-size: var(--fs-sm-mid);
  word-break: break-all;
}
.sae-vrn {
  font-size: var(--fs-md); font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  background: #fff; color: #111;
  border: 1.5px solid #bbb; border-left: 8px solid #003399;
  border-radius: 4px; padding: 2px 8px 2px 7px; font-family: monospace;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.sae-vin { font-size: var(--fs-body); color: var(--fg2); font-family: monospace; }
.sae-delete-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 8px;
  background: color-mix(in srgb, var(--sc-danger) 10%, transparent); color: var(--sc-danger);
  border: 1px solid color-mix(in srgb, var(--sc-danger) 30%, transparent); border-radius: 6px;
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
}
.sae-delete-btn:hover { background: color-mix(in srgb, var(--sc-danger) 20%, transparent); border-color: color-mix(in srgb, var(--sc-danger) 50%, transparent); }
.sae-register-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 8px;
  background: rgba(99,102,241,.1); color: #818cf8;
  border: 1px solid rgba(99,102,241,.3); border-radius: 6px;
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
}
.sae-register-btn:hover { background: rgba(99,102,241,.2); border-color: rgba(99,102,241,.5); }
.sae-count { font-size: var(--fs-sm); color: var(--fg3); }
.s-profile { margin-top: 4px; }
.sae-sub { font-size: var(--fs-md); color: var(--fg3); margin-top: 2px; }
.sae-tracker-stats { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin-top: 5px; font-size: var(--fs-md); }
.sae-ts-sep { color: var(--fg3); opacity: .6; }
.sae-close {
  flex-shrink: 0; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 7px;
  color: var(--fg3); font-size: var(--fs-sm); cursor: pointer; line-height: 1;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.sae-close:hover { background: var(--bg4); color: var(--fg); border-color: var(--fg3); }
.sae-admin-actions { padding: 4px 10px; border-bottom: 1px solid var(--sep); }
.sae-tracker-info {
  display: flex; flex-wrap: wrap; gap: 2px 12px;
  padding: 6px 12px; border-bottom: 1px solid var(--sep);
  font-size: var(--fs-md);
}
.sae-ti-row { display: flex; align-items: baseline; gap: 4px; }
.sae-ti-label { color: var(--fg3); }
.sae-ti-val { font-weight: 600; }
#sensor-list { padding-bottom: 4px; }
/* Compact cards: dim rule already defined above near .sidebar-asset-compact */

/* Dark mode: stronger header band + fix VRN */
[data-theme="dark"] .sidebar-asset-expanded {
  box-shadow: 0 6px 28px rgba(0,0,0,.45), 0 1px 4px rgba(0,0,0,.25);
}
[data-theme="dark"] .sae-header {
  background: var(--bg4);
}
[data-theme="dark"] .sae-icon {
  background: var(--bg3);
  border-color: var(--sep);
}[data-theme="dark"] .sae-vrn {
  background: #e8edf5; color: #111;
  border-color: #99a; border-left-color: #003399;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.sidebar-header {
  padding: 14px 14px 6px; font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--fg3); flex-shrink: 0;
}
#sensor-list { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.sidebar-hint { padding: 18px 14px; font-size: var(--fs-body); color: var(--fg3); }

.sensor-row {
  display: flex; align-items: center; padding: 11px 14px;
  cursor: pointer; gap: 10px; border-left: 3px solid transparent;
  transition: background var(--trans), border-color var(--trans);
}
.sensor-row:hover    { background: rgba(99,102,241,.06); }
.sensor-row.selected { background: var(--m-blue-lt); border-left-color: var(--m-blue); }

/* ── Brand-tinted selected/hover state via :has() ─────────────────────────
   Each brand keeps its own accent so the active row gives an instant
   visual cue about which sensor type is selected.                        */
.sensor-row.selected:has([data-brand="tracker"]) { border-left-color: #34C759; background: rgba(52,199,89,.07); }
.sensor-row.selected:has([data-brand="ela"])     { border-left-color: #32ADE6; background: rgba(50,173,230,.07); }
.sensor-row.selected:has([data-brand="airtag"])  { border-left-color: #007AFF; background: rgba(0,122,255,.07); }
.sensor-row.selected:has([data-brand="stihl"])   { border-left-color: #FFCC00; background: rgba(255,204,0,.07); }
/* Subtle hover tint matching the brand */
.sensor-row:hover:has([data-brand="tracker"]) { background: rgba(52,199,89,.04); }
.sensor-row:hover:has([data-brand="ela"])     { background: rgba(50,173,230,.04); }
.sensor-row:hover:has([data-brand="airtag"])  { background: rgba(0,122,255,.04); }
.sensor-row:hover:has([data-brand="stihl"])   { background: rgba(255,204,0,.04); }
[data-theme="dark"] .sensor-row.selected { background: rgba(99,102,241,.13); }
[data-theme="dark"] .sensor-row.selected:has([data-brand="tracker"]) { background: rgba(52,199,89,.10); }
[data-theme="dark"] .sensor-row.selected:has([data-brand="ela"])     { background: rgba(50,173,230,.10); }
[data-theme="dark"] .sensor-row.selected:has([data-brand="airtag"])  { background: rgba(0,122,255,.10); }
[data-theme="dark"] .sensor-row.selected:has([data-brand="stihl"])   { background: rgba(255,204,0,.10); }
.s-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.s-row-icon {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border-radius: 8px; border: 1px solid var(--sep);
}
.s-row-icon svg { width: 18px; height: 18px; }
.s-info { flex: 1; min-width: 0; }
/* Mini sparkline SVG — right-side value trend indicator */
.spark  { flex-shrink: 0; opacity: 0.72; display: block; overflow: visible; pointer-events: none; }
.s-name { font-size: var(--fs-lg); font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-sub  { font-size: var(--fs-md); color: var(--fg3); white-space: normal; overflow: visible; text-overflow: unset; margin-top: 2px; line-height: 1.6; }
/* ── Consistent card data rows — shared across all sensor types ─────────── */
.s-hero      { display: flex; align-items: center; gap: 5px; font-size: var(--fs-body); font-weight: 700; margin-top: 4px; line-height: 1; }
.s-kv        { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; }
.s-kv-key    { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: var(--fg3); white-space: nowrap; }
.s-kv-val    { font-size: var(--fs-sm); font-weight: 600; color: var(--fg); }
.s-kv-aside  { font-size: var(--fs-sm); font-weight: 500; }
.s-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.s-id        { font-size: var(--fs-xs); font-family: monospace; color: var(--fg3); opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
/* ── Tracker action buttons in sidebar rows ─────────────────────────────── */
.s-row-actions {
  display: flex; align-items: center; gap: 3px; flex-shrink: 0;
  opacity: 0; max-width: 0; min-width: 0; overflow: hidden;
  transition: opacity .15s, max-width .15s;
}
.sensor-row:hover .s-row-actions,
.sensor-row.selected .s-row-actions { opacity: 1; max-width: 100px; }
/* ── Unified icon action button base ─────────────────────────────────────── */
.icon-action-btn,
.s-row-action-btn,
.si-rename-action-btn,
.ev-alerts-delete-row-btn,
.row-delete-btn,
.jlp-delete-btn,
.admin-tracker-edit-btn,
.tpms-chip-action-btn {
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 4px; cursor: pointer; color: var(--fg3); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}
/* ── Neutral hover */
.icon-action-btn:hover,
.s-row-action-btn:hover,
.si-rename-action-btn:hover { border-color: var(--sep); color: var(--m-blue); background: var(--bg3); }
/* Alert bell button in sidebar card first line */
.s-alert-btn {
  margin-left: auto; background: var(--bg3); border: 1px solid var(--sep);
  border-radius: 6px; color: var(--fg2);
  cursor: pointer; padding: 3px 6px; flex-shrink: 0; line-height: 1;
  display: inline-flex; align-items: center;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.s-alert-btn:hover { color: var(--m-blue); border-color: var(--m-blue); background: rgba(99,102,241,.1); }
.s-alert-btn.active { color: var(--m-blue); border-color: var(--m-blue); background: rgba(99,102,241,.12); }
/* Danger variant */
.icon-action-btn.danger { color: var(--danger); }
.icon-action-btn.danger:hover,
.ev-alerts-delete-row-btn:hover,
.row-delete-btn:hover,
.jlp-delete-btn:hover { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.s-brand {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); font-weight: 600; padding: 1px 7px; border-radius: 4px;
  vertical-align: middle; margin-right: 3px;
  background: var(--bg3); color: var(--fg3); border: 1px solid var(--sep);
}
/* brand colour tints: border only — text colour set dynamically via JS (dotCol) */
.s-brand[data-brand="tracker"]     { border-color: rgba(52,199,89,.35); }
.s-brand[data-brand="ela"]         { border-color: rgba(50,173,230,.35); }
.s-brand[data-brand="airtag"]      { border-color: rgba(0,122,255,.35); }
.s-brand[data-brand="stihl"]       { border-color: rgba(255,204,0,.35); }
.s-brand[data-brand="tpms"]        { border-color: rgba(255,149,0,.35); }
.s-brand[data-brand="michelin"]    { border-color: rgba(255,149,0,.35); }
.s-brand[data-brand="continental"] { border-color: rgba(255,149,0,.35); }
.s-brand[data-brand="bridgestone"] { border-color: rgba(255,149,0,.35); }
.s-brand[data-brand="pirelli"]     { border-color: rgba(255,149,0,.35); }
.s-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.sidebar-footer { padding: 9px 14px; font-size: var(--fs-sm); color: var(--fg3); border-top: 1px solid var(--sep); flex-shrink: 0; background: var(--bg); }

/* ── Panel entrance animation ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-enter { animation: fadeUp .18s ease both; }
/* Sidebar sensor list: lighter / faster fade so it feels snappy */
@keyframes fadeIn-fast {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.sidebar-list-enter { animation: fadeIn-fast .14s ease both; }

/* ═══════════════════════════════════════════════════════════════
   Content area
   ═══════════════════════════════════════════════════════════════ */
#content { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); min-width: 0; min-height: 0; height: 100%; position: relative; }
/* respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .panel-enter, .sidebar-list-enter { animation: none; }
}
[data-theme="dark"] #sidebar { background: linear-gradient(180deg, var(--bg2) 0%, var(--bg3) 100%); }
#content.loading { opacity: .55; pointer-events: none; }

#breadcrumb {
  padding: 7px 20px 8px; font-size: var(--fs-body); color: var(--fg3);
  flex-shrink: 0; display: flex; align-items: center; gap: 5px;
  border-bottom: 1px solid var(--sep); background: var(--bg2);
}
#breadcrumb .bc-vehicle { color: var(--fg2); font-weight: 500; }
#breadcrumb .bc-sep     { color: var(--fg3); }
#breadcrumb .bc-sensor  { color: var(--m-navy); font-weight: 600; }
[data-theme="dark"] #breadcrumb .bc-sensor { color: var(--m-blue); }
#breadcrumb .bc-badge   { font-size: var(--fs-sm); font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); margin-left: 2px; }

#top-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; gap: 12px;
  flex-shrink: 0; border-bottom: 1px solid var(--sep); background: var(--bg2);
  flex-wrap: wrap;
}
#period-bar {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.period-btn {
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-full);
  padding: 5px 14px; font-size: var(--fs-md); font-weight: 500; cursor: pointer;
  color: var(--fg2); transition: all var(--trans); font-family: var(--font);
}
.period-btn:hover  { background: var(--m-blue-lt); border-color: var(--m-blue); color: var(--m-blue-dk); }
.period-btn.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue-dk); box-shadow: 0 1px 4px rgba(99,102,241,.35); font-weight: 700; }
#custom-range { display: flex; align-items: center; gap: 6px; }
#custom-range label { font-size: var(--fs-md); color: var(--fg3); font-weight: 500; }
#custom-range input[type="datetime-local"] {
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-sm);
  color: var(--fg); font-size: var(--fs-md); padding: 4px 9px; font-family: var(--font); outline: none;
}
#custom-range input[type="datetime-local"]:focus { border-color: var(--m-blue); box-shadow: 0 0 0 2px rgba(99,102,241,.2); }

#stats-bar { display: flex; align-items: stretch; flex-shrink: 0; background: var(--bg2); border-bottom: 2px solid var(--bg4); }
.stat-cell {
  flex: 1; padding: 14px 18px; border-right: 1px solid var(--sep);
  display: flex; flex-direction: column; gap: 4px;
  border-top: 4px solid var(--sep);
  position: relative; overflow: hidden;
  transition: border-top-color 0.25s ease;
}
/* Gradient wash — tinted from the top border colour */
.stat-cell::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(180,186,205,.09) 0%, transparent 55%);
  pointer-events: none;
  transition: background 0.25s ease;
}
.stat-cell:last-child { border-right: none; }
/* Label row: label + trend arrow on same line */
.stat-label-row { display: flex; align-items: center; gap: 5px; }
.stat-label { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--fg3); }
/* Trend arrow */
.stat-trend { font-size: var(--fs-md); font-weight: 700; line-height: 1; transition: color var(--trans); }
.stat-trend.up   { color: var(--ok); }
.stat-trend.down { color: var(--danger); }
.stat-trend.flat { color: var(--fg3); }
.stat-trend.tire-pos { font-size:9px; font-weight:700; letter-spacing:.06em; color:#6366F1; background:rgba(99,102,241,.13); border-radius:4px; padding:1px 5px; line-height: 1.6; }
.stat-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; color: var(--m-navy); }
.stat-value-sm { font-size: var(--fs-body); }
.stat-sub   { font-size: var(--fs-md); color: var(--fg3); }
/* Mini sparkline SVG */
.stat-spark {
  display: block; width: 100%; height: 14px; margin-top: 4px;
  color: var(--fg3); overflow: visible;
}
.stat-cell.ok   .stat-spark { color: var(--ok); }
.stat-cell.warn .stat-spark { color: var(--warn); }
.stat-cell.danger .stat-spark { color: var(--danger); }
/* Status accent — border colour + matching gradient wash */
.stat-cell.ok     { border-top-color: var(--ok); }
.stat-cell.ok::before     { background: linear-gradient(160deg, rgba(5,150,105,.10)  0%, transparent 55%); }
.stat-cell.warn   { border-top-color: var(--warn); }
.stat-cell.warn::before   { background: linear-gradient(160deg, rgba(217,119,6,.10)  0%, transparent 55%); }
.stat-cell.danger { border-top-color: var(--danger); }
.stat-cell.danger::before { background: linear-gradient(160deg, rgba(220,38,38,.10)  0%, transparent 55%); }

/* ── Mode bar: segmented-control with sliding pill indicator ──────── */
#mode-bar {
  display: flex; gap: 2px; flex-wrap: nowrap; flex-shrink: 0;
  position: relative;
  background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r-sm); padding: 2px;
}
.mode-btn {
  background: transparent; border: none; border-radius: calc(var(--r-sm) - 1px);
  padding: 5px 14px; font-size: var(--fs-body); font-weight: 500; cursor: pointer;
  color: var(--fg3); transition: color var(--trans); font-family: var(--font);
  display: flex; align-items: center; gap: 5px;
  position: relative; z-index: 1; white-space: nowrap;
}
.mode-btn:hover  { color: var(--fg); }
.mode-btn.active { color: var(--m-blue); font-weight: 600; }
/* Sliding pill that tracks the active button */
#mode-indicator {
  position: absolute; top: 2px; height: calc(100% - 4px);
  background: var(--bg2); border-radius: calc(var(--r-sm) - 1px);
  box-shadow: 0 1px 3px rgba(79,70,229,.12), 0 1px 2px rgba(0,0,0,.06);
  border: 1px solid rgba(99,102,241,.12);
  transition: left .2s cubic-bezier(.4,0,.2,1), width .2s cubic-bezier(.4,0,.2,1), opacity var(--trans);
  pointer-events: none; z-index: 0;
}
[data-theme="dark"] #mode-indicator {
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  border-color: rgba(99,102,241,.20);
}

/* ── Chart cards ── */
#chart-container { flex: 1; padding: 16px 20px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.chart-card {
  background: var(--bg2); border-radius: var(--r); padding: 16px 18px;
  border: 1px solid var(--sep); box-shadow: var(--shadow); position: relative; overflow: hidden;
  border-left: 3px solid var(--m-blue);
}
.chart-title { font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--fg2); margin-bottom: 14px; }
.chart-wrap    { position: relative; height: 210px; }
.chart-wrap-sm { position: relative; height: 150px; }

/* ── Map ── */
#map-container { flex: 1; padding: 0; min-height: 0; display: flex; flex-direction: column; }
#leaflet-map { flex: 1; overflow: hidden; min-height: 0; }
[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.6) invert(1) contrast(3) hue-rotate(200deg) saturate(.3) brightness(.7); }

/* ── Tracker toolbar ── */
#tracker-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 4px 8px; flex-shrink: 0;
}
.tracker-toolbar-label { font-size: var(--fs-md); color: var(--fg2); }
.tracker-toolbar-label b { color: var(--fg1); }

/* ── Per-tab delete-period toolbar (Events / Alerts / Device) ── */
.tab-action-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 4px 10px; flex-shrink: 0; font-size: var(--fs-md); color: var(--fg2);
  flex-wrap: wrap; position: relative; z-index: var(--z-float);
}
.tab-action-toolbar b { color: var(--fg1); }
#ev-toolbar-info {
  font-size: var(--fs-sm-mid); color: var(--fg3); white-space: nowrap;
  background: var(--bg3); border-radius: var(--r-full); padding: 2px 10px;
  border: 1px solid var(--sep);
}
#ev-toolbar-info b { color: var(--fg2); }
.ev-toolbar-sep { width: 1px; height: 16px; background: var(--sep); margin: 0 2px; flex-shrink: 0; }
.ev-type-filter-wrap { position: relative; }
.ev-type-pill { gap: 5px; }
.ev-type-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown);
  background: var(--bg2); border: 1px solid var(--sep); border-radius: var(--r);
  box-shadow: var(--shadow-md); padding: 0;
  min-width: 170px; max-height: 280px; overflow-y: auto;
  display: flex; flex-direction: column;
  animation: ev-dd-in .12s ease;
}
@keyframes ev-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ev-type-dd-header {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 10px 5px; border-bottom: 1px solid var(--sep);
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
.ev-type-dd-selall, .ev-type-dd-selnone {
  background: none; border: 1px solid var(--sep); border-radius: var(--r-full);
  font-size: var(--fs-xs-mid); padding: 1px 8px; cursor: pointer;
  color: var(--fg3); font-family: var(--font);
  transition: background .12s, color .12s, border-color .12s;
}
.ev-type-dd-selall:hover  { background: var(--bg3); color: var(--fg2); border-color: var(--fg3); }
.ev-type-dd-selnone:hover { background: var(--bg3); color: var(--fg2); border-color: var(--fg3); }
.ev-type-cb-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px;
  font-size: var(--fs-md); cursor: pointer; white-space: nowrap; transition: background .1s;
}
.ev-type-cb-row span { flex: 1; }
.ev-type-cb-row:hover { background: var(--bg3); }
/* Sub-tab pills within Events / Alerts containers */
.events-sub-tabs {
  display: flex; gap: 4px; padding: 6px 10px 4px; flex-shrink: 0;
  border-bottom: 1px solid var(--sep);
}
.events-sub-tab {
  background: none; border: none; padding: 3px 10px; border-radius: var(--r-full);
  cursor: pointer; font-size: var(--fs-md); color: var(--fg2); line-height: 1.4;
  transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font);
}
.events-sub-tab:hover { background: var(--bg3); color: var(--fg1); }
.events-sub-tab.active { background: var(--bg3); color: var(--fg); font-weight: 600; }
.ev-type-cb-row input { cursor: pointer; accent-color: var(--m-blue); width: 13px; height: 13px; flex-shrink: 0; }

/* ── Event filter pill toggles + icon action buttons ───────────────── */
.ev-toolbar-right { display: flex; align-items: center; gap: 5px; margin-left: auto; flex-shrink: 0; }
.ev-pill-toggles { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.ev-toolbar-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--sep); background: none; cursor: pointer;
  color: var(--fg3); transition: background .15s, color .15s, border-color .15s;
}
.ev-toolbar-icon-btn:hover { background: var(--bg3); color: var(--fg2); border-color: var(--fg3); }
.ev-toolbar-btn-danger { color: var(--danger); border-color: transparent; }
.ev-toolbar-btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.ev-pill-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full); font-size: var(--fs-sm-mid); font-weight: 500;
  border: 1px solid var(--sep); background: none; color: var(--fg3);
  cursor: pointer; font-family: var(--font); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.ev-pill-toggle:hover { border-color: var(--fg3); color: var(--fg2); background: var(--bg3); }
.ev-pill-toggle.active { background: rgba(139,92,246,.15); border-color: #a78bfa; color: #a78bfa; }
.ev-pill-errors.active { background: color-mix(in srgb, var(--sc-danger) 12%, transparent); border-color: var(--sc-danger); color: var(--sc-danger); }
.ev-pill-alerts.active { background: color-mix(in srgb, var(--sc-warn) 12%, transparent); border-color: var(--sc-warn); color: var(--sc-warn); }
/* Inline alerts card */
.ev-alerts-card { margin: 0 0 8px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--sc-warn) 30%, transparent); background: color-mix(in srgb, var(--sc-warn) 5%, transparent); overflow: hidden; font-size: var(--fs-md); }
.ev-alerts-card-loading { padding: 10px 12px; color: var(--fg3); }
.ev-alerts-card-empty  { display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: var(--sc-ok-vivid); }
.ev-alerts-card-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: color-mix(in srgb, var(--sc-warn) 10%, transparent); color: var(--sc-warn); font-weight: 600; gap: 8px; border-bottom: 1px solid color-mix(in srgb, var(--sc-warn) 15%, transparent); }
.ev-alerts-card-rows   { max-height: 260px; overflow-y: auto; }
.ev-alerts-card-row    { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--bg3); flex-wrap: wrap; }
.ev-alerts-ts          { color: var(--fg3); font-size: var(--fs-md); min-width: 130px; flex-shrink: 0; }
.ev-alerts-detail-row  { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.ev-alerts-detail-chip { background: var(--bg3); border: 1px solid var(--sep); border-radius: 10px; padding: 2px 8px; font-size: var(--fs-sm); color: var(--fg2); white-space: nowrap; }
.ev-alerts-detail-chip b { color: var(--fg3); font-weight: 600; }
.ev-alerts-delete-row-btn { padding: 2px 4px; flex-shrink: 0; }
.ev-alerts-card-more   { padding: 5px 10px; color: var(--fg3); font-style: italic; font-size: var(--fs-sm); }
/* Alert rows merged into events table */
.ev-alert-row { background: color-mix(in srgb, var(--sc-warn) 4%, transparent); }
.ev-alert-row td { border-bottom: 1px solid color-mix(in srgb, var(--sc-warn) 12%, transparent) !important; }
.row-alert-detail-btn { background: none; border: none; cursor: pointer; color: var(--fg3); padding: 5px 7px; border-radius: 4px; line-height: 1; }
.row-alert-detail-btn:hover, .row-alert-detail-btn.active { color: var(--sc-warn); background: color-mix(in srgb, var(--sc-warn) 10%, transparent); }
.ev-alert-detail-expanded td { padding: 0 !important; }
.ev-alert-detail-cell { padding: 0 !important; background: color-mix(in srgb, var(--sc-warn) 6%, transparent) !important; border-bottom: 1px solid color-mix(in srgb, var(--sc-warn) 18%, transparent) !important; }
.ev-alert-detail-content { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 14px; align-items: center; }
/* Inline timing-errors card */
.ev-errors-card { margin: 0 0 8px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--sc-danger) 30%, transparent); background: color-mix(in srgb, var(--sc-danger) 6%, transparent); overflow: hidden; font-size: var(--fs-md); }
.ev-errors-card-loading { padding: 10px 12px; color: var(--fg3); }
.ev-errors-card-ok { display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: var(--sc-ok-vivid); }
.ev-errors-card-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: color-mix(in srgb, var(--sc-danger) 10%, transparent); color: var(--sc-danger); font-weight: 600; gap: 8px; border-bottom: 1px solid color-mix(in srgb, var(--sc-danger) 15%, transparent); }
.ev-errors-card-rows { max-height: 180px; overflow-y: auto; }
.ev-errors-card-row { display: flex; align-items: center; gap: 10px; padding: 4px 10px; border-bottom: 1px solid var(--bg3); flex-wrap: wrap; }
.ev-errors-bad-ts { color: var(--sc-danger); font-size: var(--fs-sm); min-width: 130px; }
.ev-errors-received { color: var(--fg3); font-size: var(--fs-sm); min-width: 130px; }
.ev-errors-card-more { padding: 5px 10px; color: var(--fg3); font-style: italic; font-size: var(--fs-sm); }

/* ── Event delay column ─────────────────────────────────────────────── */
.td-delay        { font-size: var(--fs-md); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; padding-right: 10px; }
.td-delay-rt     { color: var(--sc-ok-vivid) !important; }   /* < 30s  — real-time   */
.td-delay-ok     { color: #a3e635 !important; }   /* < 5m   — near RT     */
.td-delay-mid    { color: var(--sc-warn) !important; }   /* < 1h   — delayed     */
.td-delay-hi     { color: #fb923c !important; }   /* < 24h  — highly delayed */
.td-delay-off    { color: #94a3b8 !important; }   /* > 24h  — offline batch  */
.td-delay-bad    { color: var(--sc-danger) !important; font-weight: 600; }  /* clock error */

/* ── Tracker journey panel ── */
#tracker-map-wrapper { flex: 1; display: flex; flex-direction: row; gap: 12px; min-height: 0; }
#map-col-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#map-col-wrap #leaflet-map { flex: 1; border-radius: var(--r) var(--r) 0 0; }
/* When no chart visible, restore full rounding on map */
#map-col-wrap #leaflet-map:last-child { border-radius: var(--r); }
#journey-list-panel {
  width: 250px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--sep); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.jlp-header {
  padding: 10px 14px; font-size: var(--fs-md); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fg3); border-bottom: 1px solid var(--sep);
  background: var(--bg3); flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
}
.jlp-header-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jlp-rename-btn {
  flex-shrink: 0; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  cursor: pointer; color: var(--fg2); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px;
  border-radius: var(--r-full); transition: background .12s, color .12s; line-height: 1.4;
  white-space: nowrap;
}
.jlp-rename-btn:hover { background: rgba(255,255,255,.15); color: var(--fg1); }
.jlp-rename-form {
  flex: 1; display: none; align-items: center; gap: 4px; min-width: 0;
}
.jlp-rename-input {
  flex: 1; min-width: 0; background: var(--bg1); border: 1px solid var(--sep);
  border-radius: 5px; color: var(--fg1); padding: 3px 7px; font-size: var(--fs-sm);
}
/* ── Config button (same pill style as rename) ──────────────────── */
.jlp-admin-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-bottom: 1px solid var(--sep);
  background: var(--bg3); flex-shrink: 0;
}
.jlp-config-btn {
  flex-shrink: 0; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  cursor: pointer; color: var(--fg2); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px;
  border-radius: var(--r-full); transition: background .12s, color .12s; line-height: 1.4;
  white-space: nowrap;
}
.jlp-config-btn:hover { background: rgba(255,255,255,.15); color: var(--fg1); }
/* ── Tracker config modal ────────────────────────────────────────── */
.tcm-section-title {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fg3); margin-bottom: 8px;
  padding-bottom: 4px; border-bottom: 1px solid var(--sep);
}
.tcm-input {
  background: var(--bg1); border: 1px solid var(--sep);
  border-radius: 5px; color: var(--fg1); padding: 5px 9px;
  font-size: var(--fs-md); width: 100%; box-sizing: border-box;
}
.tcm-input:focus { border-color: var(--m-blue); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
/* ── Config button in si-actions ─────────────────────────────────── */
.si-config-btn {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  cursor: pointer; color: var(--fg2); font-size: var(--fs-sm); font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-full);
  transition: background .12s, color .12s;
}
.si-config-btn:hover { background: rgba(255,255,255,.15); color: var(--fg1); }
/* ── Config overlay (absolute, covers jlp-body) ─────────────────── */
.jlp-config-overlay {
  position: absolute; inset: 0; background: var(--bg2); overflow-y: auto;
  z-index: 2; display: flex; flex-direction: column;
}
.jlp-config-form { padding: 10px 14px; font-size: var(--fs-sm); color: var(--fg2); flex: 1; }
.jlp-config-back {
  background: none; border: none; cursor: pointer; color: var(--m-blue);
  font-size: var(--fs-sm); padding: 0; font-weight: 600; display: inline-block;
  margin-bottom: 10px;
}
.jlp-config-back:hover { text-decoration: underline; }
.jlp-config-section { margin-bottom: 12px; }
.jlp-config-section-title {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fg3); margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--sep);
}
.jlp-config-field { margin-bottom: 6px; }
.jlp-config-label { display: block; font-size: var(--fs-xs); color: var(--fg3); margin-bottom: 2px; }
.jlp-config-input {
  background: var(--bg1); border: 1px solid var(--sep);
  border-radius: 5px; color: var(--fg1); padding: 3px 7px;
  font-size: var(--fs-sm); width: 100%; box-sizing: border-box;
}
.jlp-config-wake-sources { margin-top: 3px; display: flex; flex-direction: column; gap: 3px; }
.jlp-config-checkbox-row {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--fg2); cursor: pointer;
}
.jlp-config-actions { display: flex; gap: 6px; }
.jlp-config-error {
  color: var(--sc-danger); font-size: var(--fs-sm); margin-top: 6px;
  display: none; word-break: break-word;
}
.jlp-body { flex: 1; overflow-y: auto; }
.jlp-row {
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--sep);
  transition: background .12s;
}
.jlp-row:hover  { background: var(--bg3); }
.jlp-row.active { background: var(--m-blue-lt); border-left: 3px solid var(--m-blue); padding-left: 9px; }
.jlp-row-ongoing { border-left: 3px solid var(--sc-ok-vivid); padding-left: 9px; }
.jlp-row-ongoing.active { border-left-color: var(--sc-ok-vivid); }
.jlp-ongoing-badge {
  font-size: var(--fs-xs); font-weight: 700; color: var(--sc-ok-vivid);
  background: var(--sc-ok-bg); border-radius: var(--r-full);
  padding: 2px 7px; white-space: nowrap; letter-spacing: .3px;
  animation: jlp-pulse 3s ease-in-out infinite;
}
@keyframes jlp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
/* Load estimation badges */
.jlp-load-line { margin-top: 3px; }
.jlp-load {
  display: inline-block; font-size: var(--fs-xs); font-weight: 600;
  padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.jlp-load-low    { color: var(--sc-warn); background: color-mix(in srgb, var(--sc-warn) 13%, transparent); }
.jlp-load-medium { color: var(--sc-blue); background: color-mix(in srgb, var(--sc-blue) 13%, transparent); }
.jlp-load-high   { color: var(--sc-ok-vivid); background: color-mix(in srgb, var(--sc-ok-vivid) 13%, transparent); }

/* ── Telemetry chart panel (Speed / Fuel / Load tabs) ─────────────────── */
#jlp-telemetry-wrap {
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  padding: 8px 14px 10px;
  flex-shrink: 0;
}
.jlp-telemetry-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.jlp-tab-pills {
  display: flex; gap: 4px;
}
.jlp-tab-pill {
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-full);
  padding: 2px 10px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  color: var(--fg3); font-family: var(--font); transition: all var(--trans);
  letter-spacing: .03em; text-transform: uppercase;
}
.jlp-tab-pill:hover { background: rgba(255,255,255,.1); color: var(--fg1); }
.jlp-tab-pill.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue-dk); }
.jlp-telemetry-badge {
  font-size: var(--fs-xs); font-weight: 600;
  padding: 1px 8px; border-radius: 4px; white-space: nowrap;
}
.jlp-telemetry-body {
  height: 130px; position: relative;
}
.jlp-row-main { display: flex; flex-direction: column; gap: 2px; }
.jlp-row-info { display: contents; }
.jlp-row-date {
  font-size: var(--fs-md); font-weight: 600; color: var(--fg);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jlp-time-sep { color: var(--fg3); font-size: var(--fs-xs); flex-shrink: 0; }
.jlp-row-end { color: var(--fg2); font-weight: 500; font-size: var(--fs-sm-mid); }
.jlp-row-meta { font-size: var(--fs-sm); color: var(--fg3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jlp-row-foot {
  display: flex; align-items: center; gap: 5px; margin-top: 3px; min-height: 18px;
}
.jlp-alert-badge {
  font-size: var(--fs-sm); font-weight: 700; color: #f59e0b;
  background: rgba(245,158,11,.15); border-radius: var(--r-full);
  padding: 1px 7px; white-space: nowrap; flex-shrink: 0;
}

/* ── Behaviour alert table ─────────────────────────────────────── */
#alerts-container { flex: 1; padding: 16px 20px; overflow: auto; min-height: 0; }
#device-container { flex: 1; padding: 16px 20px; overflow: auto; min-height: 0; }

/* Lifecycle summary cards */
.lc-summary-box { margin-bottom: 12px; }
.lc-summary-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
}
.lc-summary-card {
  padding: 10px 14px; border-right: 1px solid var(--sep);
  display: flex; flex-direction: column; gap: 2px;
}
.lc-summary-card:last-child { border-right: none; }
.lc-summary-val { font-size: 18px; font-weight: 700; color: var(--fg1); line-height: 1.1; }
.lc-summary-label { font-size: var(--fs-md); color: var(--fg3); font-weight: 500; }
.lc-summary-sub { font-size: var(--fs-xs); color: var(--fg3); }
.ev-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-full); font-size: var(--fs-md); font-weight: 600;
  background: color-mix(in srgb, var(--ev-color) 15%, transparent);
  color: var(--ev-color);
  white-space: nowrap;
}
.bat-box {
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: var(--r);
  overflow: hidden;
  font-size: var(--fs-md);
  box-shadow: var(--shadow);
}
.bat-header {
  padding: 8px 14px;
  font-size: var(--fs-md); font-weight: 600; color: var(--fg2);
  border-bottom: 1px solid var(--sep);
  display: flex; align-items: center; gap: 8px;
}
.bat-count {
  background: rgba(245,158,11,.18); color: #f59e0b;
  border-radius: var(--r-full); padding: 1px 8px; font-size: var(--fs-sm); font-weight: 700;
}
.bat-table { width: 100%; border-collapse: collapse; }
.bat-table th {
  text-align: left; padding: 7px 14px;
  font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase;
  color: var(--fg3); background: var(--bg3); border-bottom: 1px solid var(--sep);
  white-space: nowrap;
}
.bat-table td {
  padding: 7px 14px; border-bottom: 1px solid var(--sep);
  font-size: var(--fs-body); font-variant-numeric: tabular-nums;
  color: var(--fg2); white-space: nowrap; vertical-align: middle;
}
.bat-table tr:last-child td { border-bottom: none; }
.bat-table tbody tr:nth-child(even) td { background: rgba(30,41,59,.025); }
.bat-table tr:hover td { background: var(--bg3); }
.bat-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle; flex-shrink: 0;
}
.bat-gps-yes { color: #30d158; font-size: var(--fs-sm); }
.bat-gps-no  { color: #f59e0b; font-size: var(--fs-sm); }

/* ── Driver behaviour alert badge ── */
.beh-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 6px; border-radius: 6px;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; vertical-align: middle;
  background: color-mix(in srgb, var(--beh-color) 10%, #fff);
  color: var(--beh-color);
  border: 1.5px solid color-mix(in srgb, var(--beh-color) 35%, transparent);
  box-shadow: 0 1px 2px rgba(0,0,0,.07);
}
.beh-badge svg { flex-shrink: 0; }
/* ── Shared empty / loading state base ─────────────────────────────── */
.empty-state,
.bat-loading-full,
.map-nodata,
.chart-gps-only {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; color: var(--fg3);
}
.empty-state { flex: 1; padding: 32px; }
.empty-state p     { font-size: var(--fs-xl); font-weight: 600; color: var(--fg2); margin: 0; }
.empty-state small { font-size: var(--fs-md); max-width: 280px; line-height: 1.5; }
.bat-loading-full {
  padding: 32px; font-size: var(--fs-body);
}
.jlp-delete-btn {
  margin-left: auto; flex-shrink: 0; font-size: var(--fs-lg); opacity: 0; padding: 1px 3px;
}
.jlp-row:hover .jlp-delete-btn { opacity: .55; }
.jlp-delete-btn:hover { opacity: 1 !important; }
.jlp-replay-btn {
  flex-shrink: 0; opacity: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: none; border: 1.5px solid var(--sep); cursor: pointer;
  color: var(--m-blue); transition: all .15s;
}
.jlp-row:hover .jlp-replay-btn { opacity: .75; }
.jlp-replay-btn:hover { opacity: 1 !important; background: color-mix(in srgb, var(--m-blue) 14%, transparent); border-color: var(--m-blue); }

/* ── Journey replay bar ─────────────────────────────────────────────── */
#journey-replay-bar {
  position: relative; z-index: 500;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--bg2); border-top: 1px solid var(--sep);
  flex-shrink: 0;
}
.rp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--sep);
  cursor: pointer; color: var(--fg2);
  flex-shrink: 0; transition: background .12s, color .12s;
}
.rp-btn:hover { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }
.rp-scrubber {
  flex: 1; min-width: 60px; height: 4px; border-radius: 2px;
  accent-color: var(--m-blue); cursor: pointer;
}
.rp-timecode {
  font-size: var(--fs-sm); color: var(--fg2); font-variant-numeric: tabular-nums;
  flex-shrink: 0; min-width: 110px; text-align: center;
}
.rp-speed-group { display: flex; gap: 2px; flex-shrink: 0; }
.rp-speed-btn {
  padding: 3px 7px; font-size: var(--fs-xs); font-weight: 700;
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-full);
  cursor: pointer; color: var(--fg3); font-family: var(--font); transition: all .1s;
}
.rp-speed-btn:hover  { border-color: var(--m-blue); color: var(--m-blue); }
.rp-speed-btn.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }
.row-delete-btn { font-size: var(--fs-body); opacity: 0.35; padding: 4px 6px; }
.row-delete-btn:hover { opacity: 1 !important; }
.jlp-driver {
  font-size: var(--fs-md); font-weight: 600; background: var(--ok-bg); color: var(--ok);
  border-radius: 4px; padding: 1px 5px;
}
.jlp-loading, .jlp-empty {
  padding: 24px 14px; font-size: var(--fs-md); color: var(--fg3); text-align: center;
}

/* ── Journey overview toggle bar ── */
.jlp-overview-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-bottom: 1px solid var(--sep);
  background: var(--bg3); flex-shrink: 0;
  cursor: pointer; user-select: none;
  font-size: var(--fs-sm); font-weight: 600; font-family: inherit;
  color: var(--fg2); transition: color .2s;
}
#jlp-all-wrap:has(#jlp-all-cb:checked) { color: var(--m-blue, #3b82f6); }
#jlp-all-wrap #jlp-all-cb { display: none; }
#jlp-all-wrap:has(#jlp-all-cb:checked) .mm-toggle-track { background: var(--m-blue, #3b82f6); }
#jlp-all-wrap:has(#jlp-all-cb:checked) .mm-toggle-thumb { left: 15px; }
.jlp-all-label { white-space: nowrap; }
/* Colored dot — hidden by default, shown in overview mode */
.jlp-row-color {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  display: none;
}
/* Loading overlay for overview mode fetch */
.jlp-all-loading {
  position: absolute; inset: 0; background: rgba(0,0,0,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: var(--z-float); gap: 9px; font-size: var(--fs-md); color: var(--fg2);
}
.jlp-all-loading-bar {
  width: 120px; height: 4px; background: var(--sep); border-radius: 2px; overflow: hidden;
}
.jlp-all-loading-fill {
  height: 100%; background: var(--m-blue, #3b82f6); border-radius: 2px; transition: width .15s;
}

/* ── Map-match toggle button (Leaflet control) ── */
#map-asset-name-overlay {
  position: absolute;
  bottom: 24px; left: 10px;
  z-index: var(--z-modal);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  background: var(--bg2, #1c1c1e);
  font-size: var(--fs-md); font-weight: 600; font-family: inherit;
  color: var(--fg, #f5f5f7);
  pointer-events: none;
  user-select: none;
}
.map-asset-name-icon { display: flex; align-items: center; color: var(--fg2); }
.map-asset-name-icon svg { width: 14px; height: 14px; }
.map-asset-name-text { white-space: nowrap; }

#mm-toggle-wrap {
  position: absolute;
  top: 10px; right: 10px;
  z-index: var(--z-modal);
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 7px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  background: var(--bg2, #1c1c1e);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm); font-weight: 600; font-family: inherit;
  color: var(--fg2, #aeaeb2);
  transition: color .2s;
}
#mm-toggle-wrap:has(#mm-checkbox:checked) { color: var(--m-blue, #3b82f6); }
#mm-toggle-wrap #mm-checkbox { display: none; }
#mm-toggle-btn {
  display: none;
}
.mm-toggle {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 6px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  border-radius: var(--r-full); border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 1px 5px rgba(0,0,0,.45); transition: background .2s, opacity .15s;
  white-space: nowrap; line-height: 1; font-family: inherit; user-select: none;
  background: var(--bg2, #1c1c1e);
}
.mm-toggle-track {
  flex-shrink: 0;
  width: 30px; height: 17px;
  border-radius: 9px;
  background: var(--fg3);
  position: relative;
  transition: background .2s;
  display: inline-block;
}
.mm-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: left .2s;
}
#mm-toggle-wrap:has(#mm-checkbox:checked) .mm-toggle-track { background: var(--m-blue, #3b82f6); }
#mm-toggle-wrap:has(#mm-checkbox:checked) .mm-toggle-thumb { left: 15px; }
.mm-toggle, .mm-toggle--on, .mm-toggle--off { display: none; }

@media (max-width: 700px) {
  #tracker-map-wrapper { flex-direction: column; }
  /* Journey list appears above the map so users can browse then see the route */
  #journey-list-panel { width: 100%; max-height: 220px; order: -1; }
  /* Replay bar: larger touch targets */
  .rp-btn { width: 36px; height: 36px; }
  .rp-scrubber { height: 6px; }
  .rp-speed-btn { padding: 5px 10px; font-size: var(--fs-sm); }
}

/* ── Admin tracker pairing ── */
.admin-trackers-list { display: flex; flex-direction: column; gap: 6px; padding: 6px 14px 10px; flex: 1; overflow-y: auto; min-height: 0; }

/* ── Config Profiles panel ─────────────────────────── */
.admin-profiles-list { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 10px; flex: 1; overflow-y: auto; min-height: 0; }
.admin-profile-row { background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.admin-profile-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.admin-profile-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-profile-name { font-size: var(--fs-body); font-weight: 700; color: var(--fg1); }
.admin-profile-desc { font-size: var(--fs-sm); color: var(--fg3); }
.admin-profile-actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-profile-fields { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-sm); color: var(--fg3); }
.profile-chip { background: rgba(99,102,241,.18); color: var(--m-blue); border-radius: 4px; padding: 1px 6px; font-size: var(--fs-xs); font-weight: 600; }
.admin-profile-apply { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--sep); }
.admin-profile-apply-label { font-size: var(--fs-sm); color: var(--fg3); white-space: nowrap; }
.profile-tracker-select { flex: 1; min-width: 120px; font-size: var(--fs-md); padding: 3px 6px; background: var(--bg1); border: 1px solid var(--sep); border-radius: 5px; color: var(--fg1); }
.profile-apply-status { font-size: var(--fs-sm); }
.profile-apply-status.ok  { color: var(--ok); }
.profile-apply-status.err { color: var(--sc-danger); }
/* Profile row in tracker config modal */
.tcm-profile-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--sep); flex-wrap: wrap; }
.pm-wake-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); cursor: pointer; margin-bottom: 4px; }
.pm-beep-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); cursor: pointer; margin-bottom: 12px; }
.admin-tracker-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: var(--bg3); border-radius: var(--r);
  border: 1px solid var(--sep);
}
.admin-tracker-top { display: flex; align-items: center; gap: 6px; }
.admin-tracker-edit-btn {
  font-size: var(--fs-body); padding: 0 2px; opacity: .6; border: none;
}
.admin-tracker-edit-btn:hover { opacity: 1; color: var(--fg); border-color: transparent; background: none; }
.admin-tracker-edit-form {
  display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap;
}
.tracker-name-input {
  flex: 1; min-width: 140px; padding: 4px 8px; font-size: var(--fs-md);
  background: var(--bg1); border: 1px solid var(--sep); border-radius: 5px;
  color: var(--fg1); outline: none;
}
.tracker-name-input:focus { border-color: var(--m-blue); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.admin-tracker-info {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.admin-tracker-imei {
  font-size: var(--fs-md); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--fg1); font-family: monospace;
}
.admin-tracker-sname { font-size: var(--fs-sm); color: var(--fg3); }
.admin-tracker-paired {
  font-size: var(--fs-sm); color: var(--ok); font-weight: 600;
}
.admin-tracker-unpaired {
  font-size: var(--fs-sm); color: var(--fg3); font-style: italic;
}
.admin-tracker-controls {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.tracker-vehicle-select {
  font-size: var(--fs-md); background: var(--bg2); color: var(--fg1);
  border: 1px solid var(--sep); border-radius: 6px; padding: 4px 8px;
  max-width: 160px;
}

/* New-tracker inline form */
.admin-new-tracker-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r); margin-bottom: 8px;
}
.admin-new-tracker-form input,
.admin-new-tracker-form select {
  font-size: var(--fs-md); background: var(--bg2); color: var(--fg1);
  border: 1px solid var(--sep); border-radius: 6px; padding: 5px 8px;
}
.admin-new-tracker-form input[type=text]:first-of-type { min-width: 180px; font-family: monospace; }
.admin-new-tracker-form .auth-error { width: 100%; font-size: var(--fs-sm); }
.map-nodata {
  flex: 1; background: var(--bg2); border-radius: var(--r); border: 1px solid var(--sep); padding: 32px;
}
.map-nodata .nodata-icon,
.chart-gps-only .nodata-icon { opacity: .45; color: var(--fg3); }
.map-nodata p, .chart-gps-only p { font-size: var(--fs-xl); font-weight: 600; color: var(--fg2); margin: 0; }
.map-nodata small, .chart-gps-only small { font-size: var(--fs-md); max-width: 280px; line-height: 1.5; }
.chart-gps-only {
  flex: 1; background: var(--bg2); border-radius: var(--r); border: 1px solid var(--sep); padding: 32px; min-height: 220px;
}

/* ── Table ── */
#table-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.table-toolbar { flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--sep); background: var(--bg2); }
.table-scroll { flex: 1; overflow: auto; padding: 16px 20px; }
#data-table {
  width: 100%; border-collapse: collapse; font-size: var(--fs-body);
  background: var(--bg2); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--sep);
}
#data-table thead { border-bottom: 2px solid var(--m-blue); }
#data-table th {
  position: sticky; top: 0; background: var(--m-navy); color: rgba(255,255,255,0.85);
  padding: 10px 14px; text-align: left; font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: 0.7px; text-transform: uppercase; z-index: 1;
}
#data-table td { padding: 10px 14px; border-bottom: 1px solid var(--sep); font-variant-numeric: tabular-nums; color: var(--fg); font-size: var(--fs-body); }
#data-table tr:last-child td { border-bottom: none; }
#data-table tbody tr:nth-child(even) td { background: rgba(30,41,59,.045); }
#data-table tbody tr:hover td { background: var(--bg3); }
.td-ts   { color: var(--fg3); font-size: var(--fs-md); font-family: var(--mono); }
.td-pres { font-weight: 600; color: var(--fg); }
.status-badge { display: inline-block; font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.4px; padding: 2px 8px; border-radius: var(--r-full); }

/* ── Empty state ── */
#empty-state { gap: 14px; padding: 40px; }
#empty-state p     { font-size: var(--fs-2xl); }
#empty-state small { font-size: var(--fs-body); max-width: 340px; }
.empty-icon { animation: float 3s ease-in-out infinite; color: var(--fg3); opacity: .5; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.empty-select-hint {
  margin-top: 4px; font-size: var(--fs-body); font-weight: 600;
  color: var(--m-blue); letter-spacing: .01em;
  animation: hint-pulse 2s ease-in-out infinite;
}
@keyframes hint-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
/* Pulsing border on vehicle-select when no asset is chosen */
.vehicle-picker-btn.select-pulse {
  border-color: var(--m-blue);
  animation: select-attention 2s ease-in-out infinite;
}
@keyframes select-attention {
  0%,100% { box-shadow: 0 0 0 0   rgba(99,102,241,.5); }
  50%      { box-shadow: 0 0 0 4px rgba(99,102,241,.0); }
}
/* Sidebar hint with directional arrow (no asset selected) */
.sidebar-hint-arrow { color: var(--m-blue) !important; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   Auth overlay
   ═══════════════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0,32,91,0.82); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.auth-card { background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow-md); width: 100%; max-width: 400px; overflow: hidden; }
.auth-card-header { background: var(--m-navy); padding: 24px 32px; border-bottom: 3px solid var(--m-blue); }
.auth-logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; color: #fff; }
.auth-logo-icon {
  width: 36px; height: 36px; border-radius: 6px;
  overflow: hidden; flex-shrink: 0;
}
.auth-card-body { padding: 26px 32px 30px; }
.auth-card h2  { font-size: 17px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.auth-sub      { font-size: var(--fs-body); color: var(--fg3); margin-bottom: 22px; line-height: 1.5; }
.auth-field    { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.auth-field label { font-size: var(--fs-sm); font-weight: 700; color: var(--fg2); text-transform: uppercase; letter-spacing: .06em; }
.auth-field input {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--sep);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: var(--fs-lg); outline: none;
  font-family: var(--font); transition: border-color var(--trans), box-shadow var(--trans);
}
.auth-field input:focus { border-color: var(--m-blue); background: var(--bg2); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.auth-error {
  background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(192,57,43,0.25);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: var(--fs-body); margin-bottom: 14px; font-weight: 500;
}
.auth-submit {
  width: 100%; padding: 12px; font-size: var(--fs-lg); font-weight: 700;
  background: var(--m-blue); color: #fff; border: none;
  border-radius: var(--r-sm); cursor: pointer; font-family: var(--font);
  transition: background var(--trans), box-shadow var(--trans), transform .1s; margin-top: 6px;
}
.auth-submit:hover    { background: var(--m-blue-dk); box-shadow: 0 2px 8px rgba(99,102,241,.4); }
.auth-submit:active   { background: var(--m-blue-dk); transform: scale(.98); box-shadow: none; }
.auth-submit:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* ═══════════════════════════════════════════════════════════════
   Vehicle modal
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal-bkdrop);
  background: rgba(0,32,91,0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; /* keeps modal-card off viewport edges on narrow screens */
}
/* Sub-admin modals sit above the hub; vehicle + new-user modals sit above sub-admin modals */
/* ─── Admin drawer ───────────────────────────────────────── */
.admin-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: var(--z-panel-bkdrop); backdrop-filter: blur(2px);
}
/* ── Admin drawer shell ─────────────────────────────────────────────────── */
.admin-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 580px; max-width: 100vw;
  background: var(--bg1); border-left: 1px solid var(--sep);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
  z-index: var(--z-panel); box-shadow: -8px 0 32px rgba(0,0,0,.4);
}
.admin-drawer.open { transform: translateX(0); }
.admin-drawer-header {
  display: flex; align-items: center; gap: 8px; padding: 13px 18px;
  background: var(--m-navy); border-bottom: 3px solid var(--m-blue); flex-shrink: 0;
}
.admin-drawer-title { flex: 1; font-size: var(--fs-body); font-weight: 700; color: #fff; letter-spacing: .04em; text-transform: uppercase; }
.admin-drawer-close {
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.20); cursor: pointer; color: rgba(255,255,255,.80);
  font-size: var(--fs-xl); padding: 4px 7px; border-radius: 6px; transition: background .12s; line-height: 1;
}
.admin-drawer-close:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ── Admin body (nav rail + content) ──────────────────────────────────── */
.admin-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* Vertical nav rail */
.admin-nav {
  width: 84px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg2); border-right: 1px solid var(--sep);
  padding: 6px 0; overflow-y: auto;
}
.admin-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 100%; padding: 12px 6px 10px; background: none; border: none; cursor: pointer;
  font-size: var(--fs-xxs-mid); font-weight: 700; color: var(--fg3);
  letter-spacing: .05em; text-transform: uppercase;
  border-left: 3px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
  font-family: var(--font); position: relative;
}
.admin-nav-btn span:first-of-type { line-height: 1.2; }
.admin-nav-btn:hover { background: var(--bg3); color: var(--fg1); }
.admin-nav-btn.active { background: var(--bg1); color: var(--m-blue); border-left-color: var(--m-blue); font-weight: 800; }
[data-theme="dark"] .admin-nav-btn.active { color: var(--m-yellow); }
.admin-nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 4px;
  background: var(--bg3); border-radius: 8px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--fg2); line-height: 1;
}
.admin-nav-btn.active .admin-nav-count { background: rgba(99,102,241,.15); color: var(--m-blue); }
[data-theme="dark"] .admin-nav-btn.active .admin-nav-count { color: var(--m-yellow); }
.admin-nav-count:empty { display: none; }
.admin-nav-divider { border: none; border-top: 1px solid var(--sep); margin: 4px 8px; width: calc(100% - 16px); }

/* Content column */
.admin-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; min-width: 0; }
.admin-tab-pane { display: none; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.admin-tab-pane.active { display: flex; }
.admin-tab-toolbar {
  padding: 10px 14px; border-bottom: 1px solid var(--sep); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.admin-pane-title {
  font-size: var(--fs-md); font-weight: 700; color: var(--fg2);
  text-transform: uppercase; letter-spacing: .06em; margin-right: auto;
}
#admin-ota-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 14px;
}
.admin-ota-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.admin-ota-hero,
.admin-ota-section {
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.admin-ota-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background:
    linear-gradient(180deg, rgba(99,102,241,.08), rgba(99,102,241,0)),
    var(--bg2);
}
.admin-ota-hero-copy { min-width: 0; flex: 1; }
.admin-ota-eyebrow {
  margin: 0 0 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg3);
}
.admin-ota-hero-copy h4 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--fg1);
}
.admin-ota-hero-copy p {
  margin: 6px 0 0;
  max-width: 58ch;
  color: var(--fg2);
  font-size: var(--fs-body);
  line-height: 1.45;
}
.admin-ota-hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex-shrink: 0;
  min-width: 240px;
}
.admin-ota-hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--sep);
}
.admin-ota-hero-stat span {
  font-size: var(--fs-xxs-mid);
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fg3);
  font-weight: 700;
}
.admin-ota-hero-stat strong {
  font-size: var(--fs-xl);
  color: var(--fg1);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.admin-ota-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.admin-ota-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-ota-section-copy { min-width: 0; }
.admin-ota-section-kicker {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg3);
  margin-bottom: 2px;
}
.admin-ota-section-title {
  font-size: var(--fs-body);
  font-weight: 800;
  color: var(--fg1);
}
.admin-ota-section-desc {
  margin-top: 4px;
  color: var(--fg3);
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.admin-ota-link {
  align-self: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--accent-hi);
  text-decoration: none;
}
.admin-ota-link:hover { text-decoration: underline; }
.admin-ota-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.admin-ota-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-ota-field label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--fg2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-ota-input,
.admin-ota-select {
  background: var(--bg3);
  color: var(--fg);
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: var(--fs-body);
  font-family: var(--font);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}
.admin-ota-input:focus,
.admin-ota-select:focus {
  border-color: var(--m-blue);
  background: var(--bg2);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.admin-ota-select { padding: 7px 10px; min-width: 170px; }
.admin-ota-version-list,
.admin-ota-tracker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-ota-version-row,
.admin-ota-tracker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--sep);
  background: var(--bg3);
}
.admin-ota-version-row.is-latest {
  border-color: rgba(99,102,241,.35);
  background: linear-gradient(180deg, rgba(99,102,241,.08), rgba(99,102,241,.02)), var(--bg3);
}
.admin-ota-version-main,
.admin-ota-tracker-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.admin-ota-version-head,
.admin-ota-tracker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-ota-version-name,
.admin-ota-tracker-imei {
  font-size: var(--fs-body);
  font-weight: 800;
  color: var(--fg1);
  font-family: var(--mono);
}
.admin-ota-version-meta,
.admin-ota-tracker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--fg3);
  font-size: var(--fs-sm);
}
.admin-ota-version-size {
  flex-shrink: 0;
  color: var(--fg2);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.admin-ota-tracker-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.admin-ota-tracker-actions .modal-btn-primary,
.admin-ota-tracker-actions .modal-btn-secondary {
  white-space: nowrap;
}
.admin-ota-empty {
  color: var(--fg3);
  font-size: var(--fs-body);
  padding: 6px 0 2px;
}
.admin-ota-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-ota-filter-row input,
.admin-ota-filter-row select {
  font-size: var(--fs-sm);
  padding: 7px 10px;
  background: var(--bg3);
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  color: var(--fg);
}
.admin-ota-history-wrap {
  border: 1px solid var(--sep);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg3);
}
.admin-ota-history-wrap .bat-table th {
  background: var(--bg4);
}
.admin-ota-history-wrap .bat-table td {
  background: transparent;
}
.admin-ota-history-wrap .bat-table tbody tr:hover td {
  background: color-mix(in srgb, var(--m-blue) 6%, transparent);
}
.admin-ota-history-wrap .ota-cancel-btn {
  color: #f87171;
  border-color: rgba(248,113,113,.28);
}
.admin-ota-history-wrap .ota-cancel-btn:hover {
  background: rgba(248,113,113,.12);
}
.ota-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ota-status-pending   { background: rgba(251,191,36,.18); color: #f59e0b; }
.ota-status-delivered { background: rgba(96,165,250,.18); color: #60a5fa; }
.ota-status-completed { background: rgba(52,211,153,.18); color: #34d399; }
.ota-status-failed    { background: rgba(239,68,68,.18); color: #f87171; }
.ota-status-cancelled { background: rgba(100,116,139,.18); color: var(--fg3); }

@media (max-width: 900px) {
  .admin-ota-hero {
    flex-direction: column;
  }
  .admin-ota-hero-actions {
    width: 100%;
    min-width: 0;
  }
  .admin-ota-settings-grid {
    grid-template-columns: 1fr;
  }
  .admin-ota-tracker-row,
  .admin-ota-version-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-ota-tracker-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .admin-ota-version-size {
    align-self: flex-end;
  }
  .admin-ota-filter-row {
    width: 100%;
  }
  .admin-ota-filter-row input,
  .admin-ota-filter-row select {
    flex: 1;
  }
}

#vehicle-modal   { z-index: var(--z-modal-top); }
#new-user-modal  { z-index: var(--z-modal-top); }
#poi-rule-modal  { z-index: var(--z-modal-top); }

/* ── Admin hub ──────────────────────────────────────────────────────────── */
.admin-hub-card  { max-width: 360px; }
.admin-hub-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px 22px 28px; }
.admin-hub-tile  {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r);
  padding: 22px 12px 18px; cursor: pointer; font-family: var(--font); color: var(--fg);
  transition: background var(--trans), border-color var(--trans), transform 120ms ease, box-shadow var(--trans);
}
.admin-hub-tile:hover  { background: var(--bg2); border-color: var(--m-blue); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(99,102,241,.15); }
.admin-hub-tile:active { transform: translateY(0); box-shadow: none; }
.hub-tile-icon  { font-size: 26px; line-height: 1; }
.hub-tile-label { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--fg3); }
.hub-tile-count { font-size: 22px; font-weight: 700; color: var(--m-blue); font-variant-numeric: tabular-nums; min-width: 1ch; text-align: center; }

/* ── Sub-modal back button ───────────────────────────────────────────────── */
.admin-sub-back {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--r-sm); padding: 4px 10px; cursor: pointer;
  color: rgba(255,255,255,0.85); font-size: var(--fs-md); font-family: var(--font);
  transition: background var(--trans); white-space: nowrap; flex-shrink: 0;
}
.admin-sub-back:hover { background: rgba(255,255,255,0.24); }
.modal-card { background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow-md); width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; border: 1px solid var(--sep); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; background: var(--m-navy); border-bottom: 3px solid var(--m-blue); }
.modal-header h3 { font-size: var(--fs-lg); font-weight: 600; color: #fff; }
.modal-close { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-radius: var(--r-sm); padding: 3px 9px; cursor: pointer; color: rgba(255,255,255,0.8); font-size: var(--fs-body); line-height: 1.7; transition: background var(--trans); }
.modal-close:hover { background: rgba(255,255,255,0.22); }
#vehicle-form { padding: 20px 22px 24px; }
.modal-field   { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.modal-field label { font-size: var(--fs-sm); font-weight: 700; color: var(--fg2); text-transform: uppercase; letter-spacing: .06em; }
.modal-field input {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--sep);
  border-radius: var(--r-sm); padding: 9px 11px; font-size: var(--fs-body); outline: none;
  font-family: var(--font); transition: border-color var(--trans), box-shadow var(--trans);
}
.modal-field input:focus { border-color: var(--m-blue); background: var(--bg2); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.modal-field input::placeholder { color: var(--fg3); }
.modal-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--sep); }
.modal-btn-primary   { margin-left: auto; padding: 8px 22px; font-size: var(--fs-body); font-weight: 700; background: var(--m-blue); color: #fff; border: none; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font); transition: background var(--trans), transform .1s; }
.modal-btn-primary:hover  { background: var(--m-blue-dk); }
.modal-btn-primary:active { background: var(--m-blue-dk); transform: scale(.97); }
.modal-btn-secondary { padding: 8px 16px; font-size: var(--fs-body); font-weight: 500; background: var(--bg3); color: var(--fg2); border: 1px solid var(--sep); border-radius: var(--r-sm); cursor: pointer; font-family: var(--font); transition: background var(--trans); }
.modal-btn-secondary:hover { background: var(--bg4); }
.modal-btn-danger    { padding: 8px 16px; font-size: var(--fs-body); font-weight: 500; background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(192,57,43,0.25); border-radius: var(--r-sm); cursor: pointer; font-family: var(--font); transition: background var(--trans); }
.modal-btn-danger:hover { background: rgba(192,57,43,0.12); }
.sem-actions { flex-wrap: wrap; }
.sem-danger-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(192,57,43,0.18);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, rgba(192,57,43,0.06), rgba(192,57,43,0.02));
}
.sem-danger-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--danger);
}
.sem-danger-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sem-primary-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#modal-error { margin-top: 12px; }

/* ═══════════════════════════════════════════════════════════════
   Status helpers
   ═══════════════════════════════════════════════════════════════ */
.col-ok     { color: var(--ok);     }
.col-warn   { color: var(--warn);   }
.col-danger { color: var(--danger); }
.badge-ok     { background: var(--ok-bg);     color: var(--ok);     }
.badge-warn   { background: var(--warn-bg);   color: var(--warn);   }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.vehicle-edit-btn { color: var(--fg3); padding: 2px 5px; border-radius: var(--r-sm); }
.vehicle-edit-btn:hover { color: var(--m-blue); }

/* ═══════════════════════════════════════════════════════════════
   Modal — select + wide variant
   ═══════════════════════════════════════════════════════════════ */
.modal-field select {
  background: var(--bg3); border: 1px solid var(--sep); border-radius: var(--r-sm);
  color: var(--fg1); font-family: var(--font); font-size: var(--fs-body); padding: 8px 10px;
  outline: none; cursor: pointer; transition: border-color var(--trans);
}
.modal-field select:focus { border-color: var(--m-blue); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

/* Pictogram picker */
#vf-picto-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.picto-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 6px 5px;
  width: 58px;
  border: 1.5px solid var(--sep); border-radius: 8px;
  background: var(--bg3); cursor: pointer;
  color: var(--fg2); font-size: var(--fs-xxs); font-weight: 600; font-family: var(--font);
  transition: background var(--trans), border-color var(--trans), color var(--trans);
}
.picto-btn svg { width: 28px; height: 28px; }
.picto-btn:hover { background: color-mix(in srgb, var(--m-blue) 12%, transparent); border-color: var(--m-blue); color: var(--m-blue); }
.picto-btn.picto-sel { background: var(--m-blue); border-color: var(--m-blue); color: #fff; }
.picto-btn.picto-sel svg { stroke: #fff; }
/* Checkmark badge on selected icon */
.picto-btn.picto-sel { position: relative; }
.picto-btn.picto-sel::after {
  content: '✓';
  position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px;
  background: #22c55e; color: #fff;
  font-size: var(--fs-xxs); font-weight: 700; line-height: 14px; text-align: center;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

/* ─── Modal step wizard ──────────────────────────────────────────────────────── */
.modal-stepper {
  padding: 14px 24px 0;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 0;
  position: relative;
}
.modal-stepper.stepper-hidden { display: none; }
.modal-step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--sep);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1;
  transition: background var(--trans), border-color var(--trans);
}
.modal-step-dot span { font-size: var(--fs-sm); font-weight: 700; color: var(--fg3); }
.modal-step-dot.active { background: var(--m-blue); border-color: var(--m-blue); }
.modal-step-dot.active span { color: #fff; }
.modal-step-dot.done { background: #22c55e; border-color: #22c55e; }
.modal-step-dot.done span { color: #fff; }
.modal-step-dot.done::before { content: '✓'; font-size: var(--fs-sm); font-weight: 700; color: #fff; }
.modal-step-dot.done span { display: none; }
.modal-step-line {
  flex: 1; height: 2px;
  background: var(--sep);
  transition: background .3s;
}
.modal-step-line.done { background: #22c55e; }
.modal-step-labels {
  position: absolute; bottom: -18px; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 0 11px;
}
.modal-step-labels span { font-size: var(--fs-xs); color: var(--fg3); font-weight: 500; }
/* Step sections — only active step shown */
.modal-step-section { display: none; }
.modal-step-section.active { display: block; }

.modal-card-wide { max-width: 680px !important; }

/* ═══════════════════════════════════════════════════════════════
   Admin panel
   ═══════════════════════════════════════════════════════════════ */
.admin-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 10px; border-bottom: 1px solid var(--sep);
}
.admin-section-header h4 { font-size: var(--fs-body); font-weight: 700; color: var(--fg1); margin: 0; }
.admin-small-btn { padding: 5px 12px !important; font-size: var(--fs-md) !important; }
.admin-users-list { padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; overflow-y: auto; min-height: 0; }
.admin-loading { color: var(--fg3); font-size: var(--fs-body); padding: 8px 0; }

.admin-user-row {
  background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r); overflow: hidden;
}
.admin-user-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg4); border-bottom: 1px solid var(--sep);
}
.admin-user-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-user-email { font-size: var(--fs-body); font-weight: 600; color: var(--fg1); }
.admin-user-dname { font-size: var(--fs-md); color: var(--fg3); }
.admin-user-assets {
  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 36px; align-items: center;
}
.admin-asset-check {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-md); color: var(--fg2); cursor: pointer;
  background: var(--bg2); border: 1px solid var(--sep);
  border-radius: var(--r-full); padding: 4px 10px;
  transition: background var(--trans), border-color var(--trans);
}
.admin-asset-check:hover { background: var(--bg3); }
.admin-asset-check input { cursor: pointer; accent-color: var(--m-blue); }
.admin-section-sep { border-top: 1px solid var(--sep); margin-top: 4px; }
.admin-assets-list { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; min-height: 0; }
.admin-asset-row {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r); padding: 9px 14px;
}
.admin-asset-picto { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--fg2); }
.admin-asset-picto svg { width: 22px; height: 22px; }
.admin-asset-info  { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.admin-asset-name  { font-size: var(--fs-body); font-weight: 600; color: var(--fg1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-asset-meta  { font-size: var(--fs-sm); color: var(--fg3); }
.admin-asset-controls { display: flex; gap: 6px; flex-shrink: 0; margin-left: 12px; }
.admin-vehicle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r); padding: 9px 14px;
}
.admin-vehicle-name { font-size: var(--fs-body); font-weight: 600; color: var(--fg1); }
.admin-security-toolbar input {
  font-size: var(--fs-md); background: var(--bg2); color: var(--fg1);
  border: 1px solid var(--sep); border-radius: 6px; padding: 5px 8px;
  flex: 1; min-width: 100px; max-width: 160px;
}
.admin-security-list {
  padding: 10px 16px; display: flex; flex-direction: column; gap: 8px;
  flex: 1; overflow-y: auto; min-height: 0;
}
.admin-sec-row {
  background: var(--bg3); border: 1px solid var(--sep);
  border-radius: var(--r); padding: 9px 11px;
  transition: border-color var(--trans), background var(--trans);
}
.admin-sec-row:hover { border-color: var(--m-blue); background: var(--bg4); }
.admin-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.admin-sec-action { font-size: var(--fs-md); font-weight: 700; color: var(--fg1); font-family: var(--mono); }
.admin-sec-when { font-size: var(--fs-sm); color: var(--fg3); font-family: var(--mono); }
.admin-sec-sub { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 5px; }
.admin-sec-actor, .admin-sec-target, .admin-sec-ip { font-size: var(--fs-sm); color: var(--fg2); }
.admin-sec-meta {
  margin: 7px 0 0; padding: 7px 8px;
  border: 1px solid var(--sep); border-radius: 6px; background: var(--bg2);
  color: var(--fg2); font-size: var(--fs-sm); white-space: pre-wrap; word-break: break-word; font-family: var(--mono);
}
.admin-security-pager {
  padding: 8px 16px 12px; border-top: 1px solid var(--sep);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
#sec-page-label { font-size: var(--fs-md); color: var(--fg2); }

/* ─── Sensor Info Card ──────────────────────────────────────────────────────── */
#sensor-info-card {
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--sep);
  background: var(--bg2);
}
#sensor-info-card.si-tracker { padding: 5px 18px 6px; }
#sensor-info-card.si-tracker .si-header { margin-bottom: 2px; }
#sensor-info-card.si-tracker .si-name { font-size: var(--fs-body); }
#sensor-info-card.si-tracker .si-rows { gap: 2px 14px; }
#sensor-info-card.si-tracker .si-label { font-size: var(--fs-xs); min-width: 56px; }
#sensor-info-card.si-tracker .si-val { font-size: var(--fs-sm); }
#sensor-info-card.si-tracker .si-actions { padding: 4px 12px 3px; }
.si-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: nowrap;
}
.si-brand {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-sm); font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 4px;
  background: var(--bg3); border: 1px solid var(--sep);
  /* color is set inline to match current status */
}
.si-name {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--fg1);
}
.si-rename-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 4px;
}
.si-rename-input {
  font-size: var(--fs-body);
  font-weight: 600;
  background: var(--bg2);
  color: var(--fg1);
  border: 1px solid var(--sep);
  border-radius: 5px;
  padding: 3px 8px;
  width: 180px;
  outline: none;
}
.si-rename-input:focus { border-color: var(--accent); }
.si-rename-save {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
}
.si-rename-save:hover { background: rgba(0,122,255,.1); }
.si-rename-cancel {
  font-size: var(--fs-sm);
  color: var(--fg3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
}
.si-pos-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 4px;
}
.si-pos-select {
  font-size: var(--fs-body);
  font-weight: 600;
  background: var(--bg2);
  color: var(--fg1);
  border: 1px solid var(--sep);
  border-radius: 5px;
  padding: 3px 8px;
  outline: none;
  cursor: pointer;
}
.si-pos-select:focus { border-color: var(--accent); }
.si-target-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 4px;
}
.si-target-label {
  font-size: var(--fs-sm);
  color: var(--fg3);
  white-space: nowrap;
}
.si-target-input {
  font-size: var(--fs-body);
  font-weight: 600;
  background: var(--bg2);
  color: var(--fg1);
  border: 1px solid var(--sep);
  border-radius: 5px;
  padding: 3px 8px;
  outline: none;
  width: 80px;
}
.si-target-input:focus { border-color: var(--accent); }
.si-live {
  font-size: var(--fs-xs);
  color: var(--ok);
  font-weight: 600;
  display: none; /* status now conveyed by the brand icon color */
}
.si-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.si-badges-sub {
  margin-bottom: 6px;
}
.si-lastseen {
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.si-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xxs);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.si-badges .bc-badge { font-size: var(--fs-xxs); padding: 1px 6px; }
.si-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.si-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.si-label {
  font-size: var(--fs-sm);
  color: var(--fg3);
  min-width: 64px;
}
.si-val {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--fg1);
  font-variant-numeric: tabular-nums;
}
.si-actions {
  display: none; /* kept for legacy, replaced by si-inline-actions */
}
.si-rename-action-btn { font-size: var(--fs-sm); font-weight: 600; padding: 2px 5px; }


/* inline action buttons in si-header */
.si-inline-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.si-inline-actions .si-rename-action-btn,
.si-inline-actions .si-config-btn { padding: 4px 8px; font-size: var(--fs-body); }
.si-inline-actions .si-rename-action-btn:hover,
.si-inline-actions .si-config-btn:hover { border-color: var(--sep); color: var(--m-blue); }
.si-unpair-inline {
  font-size: var(--fs-md) !important;
  padding: 4px 8px !important;
  border-radius: 5px !important;
}


#asset-card { flex-shrink: 0; }
.asset-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sep);
  background: var(--bg);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.ac-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  flex-shrink: 0;
  min-width: 0;
}
.ac-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  text-align: center;
  align-self: stretch;
}
.ac-icon {
  flex-shrink: 0;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--sep);
  border-radius: 16px;
  color: var(--fg2);
}
.ac-icon svg { width: 34px; height: 34px; display: block; }
.ac-name  {
  font-size: var(--fs-2xl); font-weight: 700; color: var(--fg);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  line-height: 1.3;
  max-width: 100%;
}
.ac-sub   { font-size: var(--fs-md); color: var(--fg3); line-height: 1.4; }
.ac-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; justify-content: center; }
.ac-badge {
  font-size: var(--fs-sm); font-weight: 700; padding: 3px 8px;
  border-radius: var(--r-full); border: 1px solid var(--sep);
  background: var(--bg3); color: var(--fg2);
  letter-spacing: .03em;
}
.ac-vrn   {
  background: #fff;
  color: #1E293B;
  border-color: #ccc;
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-xl);
  letter-spacing: .1em;
  border-radius: 4px;
  padding: 3px 10px 3px 22px;
  position: relative;
  overflow: hidden;
}
.ac-vrn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 16px;
  background: var(--m-blue);
}
.ac-vin   { background: rgba(150,150,150,.1); color: var(--fg2); font-family: var(--font-mono, monospace); font-size: var(--fs-md); letter-spacing: .06em; word-break: break-all; border-radius: 4px; }
.ac-count { background: color-mix(in srgb, var(--sc-blue) 10%, transparent);  color: var(--sc-blue);   border-color: color-mix(in srgb, var(--sc-blue) 20%, transparent); }
.ac-edit-btn {
  flex-shrink: 0;
  background: none; border: none; color: var(--fg3);
  cursor: pointer; font-size: var(--fs-body); padding: 0 2px;
  line-height: 1; opacity: .6; transition: opacity .15s, color .15s;
}
.ac-edit-btn:hover { opacity: 1; color: var(--m-blue); }
.ac-delete-btn:hover { opacity: 1; color: var(--danger) !important; }

/* ═══════════════════════════════════════════════════════════════
   Wheels overview (combined TPMS)
   ═══════════════════════════════════════════════════════════════ */
#wheels-container { overflow-y: auto; }
.wov-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  overflow-y: auto;
}

/* 4 wheel cards grid */
.wov-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}
@media (max-width: 700px) { .wov-cards { grid-template-columns: repeat(2, 1fr); } }
.wov-wheel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--sep);
  background: var(--bg2);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  position: relative;
}
.wov-wheel-card:hover  { border-color: var(--wov-col, var(--m-blue)); transform: translateY(-1px); }
.wov-wheel-card.wov-sel { border-color: var(--wov-col, var(--m-blue)); box-shadow: 0 0 0 2px var(--wov-col, var(--m-blue)); }
.wov-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  width: 100%;
  justify-content: flex-start;
}
.wov-card-namerow {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 4px;
  min-width: 0;
}
.wov-card-brand {
  font-size: var(--fs-xxs);
  color: var(--fg3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wov-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg3);
  flex-shrink: 0;
}
.wov-target-inline {
  color: var(--fg3);
  font-size: var(--fs-xxs);
}
.wov-pos {
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--fg2);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.wov-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.wov-status-shape { font-size: 7px; font-weight: 800; line-height: 1; flex-shrink: 0; }
.wov-stale {
  font-size: var(--fs-xxs);
  color: var(--fg3);
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 10px;
}
.wov-gauge  { display: flex; justify-content: center; }
.wov-target { display: none; }
.wov-subrow {
  display: flex;
  gap: 6px;
  font-size: var(--fs-md);
  font-weight: 600;
  flex-wrap: wrap;
  justify-content: center;
}

/* Balance strip */
.wov-balance {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-top: 1px solid var(--sep);
  border-bottom: 1px solid var(--sep);
  background: var(--bg2);
  flex-shrink: 0;
  font-size: var(--fs-md);
}
.wov-balance-label  { color: var(--fg3); flex-shrink: 0; }
.wov-balance-val    { font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.wov-balance-status { font-weight: 600; margin-left: auto; }

/* Chart area */
.wov-chart-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 16px 12px;
  min-height: 220px;
}
.wov-chart-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}
.wov-chart-wrap {
  flex: 1;
  position: relative;
  min-height: 180px;
}
.wov-chart-wrap canvas { position: absolute; inset: 0; }

/* ═══════════════════════════════════════════════════════════════
   TPMS grouped card in sidebar
   ═══════════════════════════════════════════════════════════════ */
.tpms-group-card {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  height: auto;
}
.tpms-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.tpms-weather-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0 2px;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid var(--sep);
}
.tpms-wx-emoji {
  font-size: 20px;
  line-height: 1.1;
  flex-shrink: 0;
}
.tpms-wx-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tpms-wx-toprow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.tpms-wx-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.tpms-wx-hpa {
  font-size: var(--fs-xs);
  color: var(--fg3);
  font-feature-settings: "tnum";
}
.tpms-wx-temp {
  color: var(--fg2);
}
.tpms-wx-desc {
  font-size: var(--fs-xs);
  color: var(--fg3);
  line-height: 1.45;
}
.tpms-asset-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 1px;
}
.tpms-chip-home .tpms-chip-pos {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
}
.tpms-car-grid.tpms-house-grid {
  grid-template-columns: auto 1fr auto;
}
.tpms-chip.tpms-chip-home {
  width: max-content;
  min-width: 72px;
  max-width: 110px;
  padding-left: 8px;
  padding-right: 8px;
}
.tpms-car-grid {
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  grid-template-rows: auto auto;
  gap: 8px 6px;
  margin-top: 10px;
  align-items: center;
}
.tpms-car-body {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}
.tpms-car-body svg { width: 100%; height: 100%; min-height: 70px; max-height: 100px; }
.tpms-house-grid .tpms-car-body svg { min-height: 68px; max-height: 78px; }
.tpms-generic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  justify-items: center;
}
.tpms-extra-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.tpms-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  padding: 8px 6px 7px;
  border-radius: 8px;
  border: 1.5px solid var(--chip-col, var(--sep));
  background: var(--chip-bg, var(--bg2));
  cursor: pointer;
  transition: filter .15s, transform .1s;
  flex-shrink: 0;
}
.tpms-chip:has(.tpms-chip-shape) { border-width: 2px; }
.tpms-chip:hover          { filter: brightness(1.15); transform: scale(1.04); }
.tpms-chip.tpms-chip-sel  { box-shadow: 0 0 0 2px var(--m-blue); border-color: var(--m-blue); }
.tpms-chip-empty          { opacity: .25; cursor: default; }
.tpms-chip-empty:hover    { filter: none; transform: none; }
.tpms-chip-pos  { font-size: var(--fs-xs); font-weight: 700; color: var(--fg3); letter-spacing: .05em; text-transform: uppercase; line-height: 1; margin-bottom: 4px; }
.tpms-car-grid .tpms-chip-pos { display: none; }
.tpms-car-grid .tpms-chip-pos { display: none; }
.tpms-car-grid .tpms-chip-home .tpms-chip-pos { display: block; }
.tpms-chip-pres { font-size: var(--fs-lg); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tpms-chip-shape { font-size: 8px; font-weight: 800; vertical-align: super; margin-left: 1px; }
.tpms-chip-unit { font-size: var(--fs-xxs); color: var(--fg3); opacity: .85; margin-left: 1px; vertical-align: 2px; }
.tpms-chip-tgt  { font-size: var(--fs-xs); font-weight: 500; color: var(--fg3); margin-top: 4px; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 2px; }
.tpms-chip-temp { font-size: var(--fs-xs); color: var(--sc-blue); margin-top: 3px; line-height: 1; font-variant-numeric: tabular-nums; }
/* For home chips, the pressure secondary line reuses .tpms-chip-temp but color is overridden inline */
.tpms-chip-home .tpms-chip-temp { color: var(--fg3); }
.tpms-chip-batt { font-size: var(--fs-xs); font-weight: 600; margin-top: 3px; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 2px; }
.tpms-chip-actions { display: flex; gap: 4px; margin-top: 5px; opacity: 0; transition: opacity .15s; }
.tpms-chip:hover .tpms-chip-actions,
.tpms-chip.tpms-chip-sel .tpms-chip-actions { opacity: 1; }
.tpms-chip-action-btn { color: var(--fg2); border: none; padding: 1px 2px; }
.tpms-chip-action-btn:hover { background: var(--bg3); color: var(--fg); border-color: transparent; }

/* ═══════════════════════════════════════════════════════════════
   Toast notifications
   ═══════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--sep);
  border-left: 4px solid var(--m-blue);
  color: var(--fg1);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: var(--fs-body);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateX(30px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 280px;
}
.toast.toast-visible     { opacity: 1; transform: none; }
.toast.toast-error       { border-left-color: var(--danger); }
.toast.toast-success     { border-left-color: var(--sc-ok-vivid); }
.toast.toast-warn        { border-left-color: var(--sc-warn); }
.toast.toast-action      { pointer-events: all; cursor: default; max-width: 300px; }

/* ═══════════════════════════════════════════════════════════════
   Skeleton loader
   ═══════════════════════════════════════════════════════════════ */
@keyframes skel-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skel-cell {
  display: inline-block;
  width: 80%;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--sep) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: skel-shimmer 1.4s infinite linear;
}
.skel-row td { padding: 8px 10px; }
.skel-row td:last-child .skel-cell { width: 30%; }
.chart-skel {
  position: absolute;
  inset: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg3) 25%, var(--sep) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: skel-shimmer 1.4s infinite linear;
}

/* ═══════════════════════════════════════════════════════════════
   Delete confirmation modal
   ═══════════════════════════════════════════════════════════════ */
#del-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-confirm);
  align-items: center;
  justify-content: center;
}
#del-modal.del-modal-open { display: flex; }
.del-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
}
.del-modal-box {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: 12px;
  padding: 28px 32px 24px;
  text-align: center;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.del-modal-icon  { margin-bottom: 10px; color: var(--danger); opacity: .8; }
.del-modal-title { font-size: var(--fs-2xl); font-weight: 700; color: var(--fg1); margin-bottom: 8px; }
.del-modal-body  { font-size: var(--fs-body); color: var(--fg2); line-height: 1.5; margin-bottom: 22px; }
.del-modal-actions { display: flex; gap: 10px; justify-content: center; }
.del-modal-actions button {
  padding: 8px 22px;
  border-radius: 7px;
  border: 1px solid var(--sep);
  cursor: pointer;
  font-size: var(--fs-body);
  font-weight: 600;
  transition: background .15s, color .15s;
}
#del-modal-cancel { background: var(--bg3); color: var(--fg1); }
#del-modal-cancel:hover { background: var(--sep); }
#del-modal-ok    { background: var(--danger); color: #fff; border-color: transparent; }
#del-modal-ok:hover { filter: brightness(1.15); }

/* ═══════════════════════════════════════════════════════════════
   Map behavior legend
   ═══════════════════════════════════════════════════════════════ */
.behavior-legend {
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  line-height: 1.7;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  min-width: 130px;
}
.behavior-legend-title {
  font-weight: 700;
  color: var(--fg1);
  margin-bottom: 4px;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.behavior-legend-row  { display: flex; align-items: center; gap: 6px; color: var(--fg2); }
.behavior-legend-icon { display: flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════════
   Compact density for tracker events table
   ═══════════════════════════════════════════════════════════════ */
#data-table.ev-compact td { padding: 4px 8px; font-size: var(--fs-md); }
#data-table.ev-compact th { padding: 5px 8px; }
#data-table.ev-compact .ev-badge { font-size: var(--fs-sm); padding: 2px 6px; }
#data-table.ev-compact td a[href] { font-size: 1.3em; line-height: 1; vertical-align: middle; }

/* ═══════════════════════════════════════════════════════════════
   Journey group separator & compact timestamp
   ═══════════════════════════════════════════════════════════════ */
tr.journey-sep-row td {
  padding: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--sep) 20%, var(--sep) 80%, transparent);
}
.td-ts-compact {
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
  color: var(--fg2);
  white-space: nowrap;
}

/* ─── Mobile hamburger button (desktop: hidden) ─────────────────────────────── */
.mobile-only { display: none; }
/* ─── Mobile sidebar backdrop ───────────────────────────────────────────────── */
#mobile-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: var(--z-mobile-bkdrop);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
#main.mobile-sidebar-open #mobile-sidebar-backdrop { display: block; }

/* ═══════════════════════════════════════════════════════════════
   Mobile
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  :root { --header-h: 50px; }
  .mobile-only { display: flex; }

  /* Layout: full-width single-column (sidebar removed from flow) */
  #main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* Sidebar: fixed slide-in drawer from the left */
  #sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    width: min(290px, 85vw);
    z-index: var(--z-mobile-sidebar);
    border-right: 1px solid var(--sep);
    border-bottom: none;
    overflow-y: auto;
    transition: left .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-md);
  }
  #main.mobile-sidebar-open #sidebar { left: 0; }

  /* Hide the desktop collapse toggle on mobile */
  .sidebar-toggle-btn { display: none; }

  #stats-bar .stat-cell { padding: 9px 10px; }
  .stat-value { font-size: var(--fs-2xl); }
  #chart-container, #map-container, #table-container { padding: 10px 12px; }
  #top-toolbar { padding: 8px 12px; gap: 8px; }
  #period-bar, #mode-bar { gap: 4px; }
  .auth-card-header, .auth-card-body { padding-left: 22px; padding-right: 22px; }

  /* ── Header: prevent overflow on 390 px phones ─────────── */
  #header { gap: 4px; padding: 0 6px; }
  .logo-text-group { display: none; }          /* hide wordmark + live pill */
  .logo-divider { display: none; }             /* hide separator bar */
  .header-nav-btn { font-size: 0; gap: 0; padding: 0 8px; height: 30px; } /* icon-only tabs */
  .header-nav-btn svg { width: 16px; height: 16px; }
  .user-name, .role-badge { display: none; }   /* hide name/role label */
  #kbd-help-btn { display: none; }             /* keyboard shortcuts not useful on touch */
  #header .icon-btn { width: 32px; height: 32px; }

  /* ── Mode bar: allow wrapping on narrow screens ─────────── */
  #mode-bar { flex-wrap: wrap; }
  .mode-btn { padding: 4px 9px; font-size: var(--fs-sm); }

  /* ── Period bar: compact ─────────────────────────────────── */
  .period-btn { padding: 4px 8px; font-size: var(--fs-sm); }

  /* ── Custom date range: allow input wrapping ──────────────── */
  #custom-range { flex-wrap: wrap; }
}

/* ─── Server logs viewer ────────────────────────────────────────────────────── */
.logs-overlay {
  position: fixed; inset: 0; z-index: var(--z-logs);
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
.logs-panel {
  width: min(1600px, 96vw);
  height: min(800px, 90vh);
  min-width: 420px;
  min-height: 280px;
  resize: both;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.65);
  overflow: hidden;
}
.logs-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.logs-title {
  font-size: var(--fs-md); font-weight: 600;
  color: #8b949e; letter-spacing: .03em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.logs-status {
  font-size: var(--fs-sm); color: #3fb950; font-family: 'SFMono-Regular',Consolas,monospace;
  flex: 1;
}
.logs-toolbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.logs-autoscroll-label {
  font-size: var(--fs-sm); color: #8b949e; display: flex; align-items: center; gap: 5px; cursor: pointer;
  user-select: none;
}
.logs-autoscroll-label input { accent-color: #3fb950; cursor: pointer; }
.logs-action-btn {
  font-size: var(--fs-sm); font-weight: 500;
  padding: 3px 10px; border-radius: 5px; border: 1px solid #30363d;
  background: #21262d; color: #8b949e; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.logs-action-btn:hover { border-color: #8b949e; color: #e6edf3; }
.logs-action-btn.logs-close { color: #f85149; }
.logs-action-btn.logs-close:hover { border-color: #f85149; background: rgba(248,81,73,.1); color: #f85149; }
.logs-filters {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.logs-filter-label {
  font-size: var(--fs-sm); color: #8b949e; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  margin-right: 2px;
}
.logs-filter-btn {
  font-size: var(--fs-sm); padding: 2px 9px; border-radius: 10px; border: 1px solid #30363d;
  background: transparent; color: #8b949e; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.logs-filter-btn:hover { border-color: #58a6ff; color: #58a6ff; }
.logs-filter-btn.active { background: #1f6feb33; border-color: #58a6ff; color: #58a6ff; }
.logs-filter-btn[data-cat="tracker"].active { border-color: #3fb950; color: #3fb950; background: #3fb95020; }
.logs-filter-btn[data-cat="tms"].active     { border-color: #e3b341; color: #e3b341; background: #e3b34120; }
.logs-filter-btn[data-cat="airtag"].active  { border-color: #79c0ff; color: #79c0ff; background: #79c0ff20; }
.logs-filter-btn[data-cat="internal"].active{ border-color: #8b949e; color: #8b949e; background: #8b949e15; }
.logs-filter-btn[data-cat="other"].active   { border-color: #b392f0; color: #b392f0; background: #b392f020; }

.logs-output {
  flex: 1; overflow-y: auto; overflow-x: auto;
  padding: 10px 14px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: var(--fs-md); line-height: 1.65;
  color: #e6edf3;
  scroll-behavior: smooth;
}
.logs-output::-webkit-scrollbar { width: 6px; height: 6px; }
.logs-output::-webkit-scrollbar-track { background: transparent; }
.logs-output::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.log-line { white-space: pre; display: block; }
.log-line.log-debug   { color: #8b949e; }
.log-line.log-info    { color: #e6edf3; }
.log-line.log-notice  { color: #79c0ff; }
.log-line.log-warning { color: #e3b341; }
.log-line.log-error   { color: #f85149; }
.log-line.log-critical { color: #ff7b72; font-weight: 700; }
.log-line.log-ts      { color: #6e7681; }
.logs-empty { color: #6e7681; font-style: italic; font-size: var(--fs-md); }

/* ── Admin Stats Panel ───────────────────────────────────────────────────────── */
.stats-kpi-row {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 12px;
}
.stats-kpi-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; min-width: 100px; flex: 1;
}
.stats-kpi-value { font-size: 22px; font-weight: 700; color: var(--fg1); }
.stats-kpi-label { font-size: var(--fs-sm); color: var(--fg3); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.stats-kpi-sub   { font-size: var(--fs-sm); color: var(--fg2); margin-top: 4px; }

.stats-charts-row {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px;
}
.stats-chart-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; flex: 1; min-width: 200px;
}
.stats-chart-title { font-size: var(--fs-md); font-weight: 600; color: var(--fg2); margin-bottom: 10px; }
.stats-chart-range { font-weight: 400; color: var(--fg3); }

.stats-bar-chart {
  display: flex; align-items: flex-end; gap: 3px; height: 60px;
}
.stats-bar-col {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1;
  cursor: default;
}
.stats-bar { width: 100%; border-radius: 2px 2px 0 0; min-width: 4px; transition: opacity .15s; }
.stats-bar-col:hover .stats-bar { opacity: .75; }
.stats-bar-label { font-size: var(--fs-xxs); color: var(--fg3); transform: rotate(-45deg); transform-origin: top right; white-space: nowrap; }
/* Show label only on every 7th bar and the last bar to avoid overlap at 30 days */
.stats-bar-chart .stats-bar-col:not(:nth-child(7n+1)):not(:last-child) .stats-bar-label { visibility: hidden; }

/* Table empty-state row */
.tbl-empty-cell {
  text-align: center; padding: 32px 20px;
  color: var(--fg3); font-size: var(--fs-body);
}
.tbl-empty-cell svg { display: block; margin: 0 auto 10px; opacity: .45; }

/* ─── Fleet summary bar (sidebar) ──────────────────────────────────────────── */
.fleet-summary-bar {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 6px 12px 0;
}
.fsb-pill {
  font-size: var(--fs-xs); font-weight: 600; padding: 2px 7px; border-radius: var(--r-full);
  white-space: nowrap;
}
.fsb-ok     { background: var(--sc-ok-bg); color: var(--sc-ok-vivid); }
.fsb-warn   { background: var(--sc-warn-bg);   color: var(--sc-warn); }
.fsb-danger { background: var(--sc-danger-bg); color: var(--sc-danger); }
.fsb-bat    { background: var(--sc-warn-bg);   color: var(--sc-warn); }
.fsb-stale  { background: var(--sc-unknown-bg);   color: var(--sc-stale); }

/* ─── Fleet view ────────────────────────────────────────────────────────────── */
#fleet-container { flex: 1; overflow: hidden; padding: 0; display: flex; flex-direction: column; gap: 0; min-height: 0; }
.fleet-card-asset-icon { display: flex; align-items: center; flex-shrink: 0; opacity: 0.85; }
.fleet-card-asset-icon svg { width: 15px; height: 15px; }

/* ── Fleet sidebar: asset list ── */
.fleet-sidebar {
  width: 260px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sep);
  overflow: hidden;
}
.fleet-sidebar-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 10px;
  font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--fg3);
  border-bottom: 1px solid var(--sep); flex-shrink: 0;
}
.fleet-sidebar-count {
  background: var(--bg3); border-radius: 8px; padding: 1px 6px;
  font-size: var(--fs-xs); color: var(--fg3); font-weight: 600;
}
.fleet-sidebar-list { flex: 1; overflow-y: auto; }
.fleet-asset-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid var(--sep);
  border-left: 2px solid transparent;
}
.fleet-asset-row:hover { background: var(--bg2); }
.fleet-asset-row.fas-selected { background: var(--bg2); border-left-color: #6366F1; }
.fas-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fas-name { flex: 1; font-size: var(--fs-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fas-count {
  font-size: var(--fs-xs); font-weight: 600; padding: 1px 6px;
  border-radius: 8px; background: var(--bg3); color: var(--fg3); flex-shrink: 0;
}
.fas-goto-btn {
  flex-shrink: 0; font-size: var(--fs-body); padding: 2px 7px; border-radius: 5px;
  background: var(--bg3); color: var(--fg2); border: 1px solid var(--sep); cursor: pointer;
}
.fas-goto-btn:hover { background: rgba(99,102,241,.15); color: #6366F1; border-color: #6366F1; }

/* ── Fleet main area: map + optional sensor detail ── */
.fleet-main-area { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#fleet-map-el { flex: 1; min-height: 0; overflow: hidden; width: 100%; }
.fleet-main-area.has-detail #fleet-map-el { flex: 1; }
.fleet-sensor-detail { display: none; }
.fleet-main-area.has-detail .fleet-sensor-detail {
  display: block; flex: none; overflow-y: auto;
  max-height: 200px; padding: 10px 14px; border-top: 1px solid var(--sep);
}
.fsd-grid { margin: 0; }
.fleet-vehicle-section { display: flex; flex-direction: column; gap: 4px; }
.fleet-vehicle-header {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--fg3);
  padding: 3px 0 3px 8px;
  border-left: 2px solid var(--sep);
  margin-bottom: 2px;
}
.fvh-count {
  font-size: var(--fs-xs); font-weight: 600; color: var(--fg3);
  background: var(--bg3); border-radius: 8px; padding: 0 5px;
  text-transform: none; letter-spacing: 0;
}
/* ── Fleet KPI strip ────────────────────────────────────────────────────────── */
.fleet-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fleet-kpi-card {
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 8px;
  padding: 10px 14px; text-align: center;
  transition: border-color .15s;
}
.fkc-kpi-value { font-size: 24px; font-weight: 800; line-height: 1; color: var(--fg); }
.fkc-kpi-label { font-size: var(--fs-xs); font-weight: 600; color: var(--fg3); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }
.fkc-live  .fkc-kpi-value { color: var(--sc-ok-vivid); }
.fkc-warn.fkc-nonzero  { border-color: color-mix(in srgb, var(--sc-warn) 40%, transparent); }
.fkc-warn.fkc-nonzero  .fkc-kpi-value { color: var(--sc-warn); }
.fkc-alert.fkc-nonzero { border-color: color-mix(in srgb, var(--sc-danger) 40%, transparent); }
.fkc-alert.fkc-nonzero .fkc-kpi-value { color: var(--sc-danger); }
.fkc-offline.fkc-nonzero { border-color: rgba(100,116,139,.4); }
.fkc-offline.fkc-nonzero .fkc-kpi-value { color: #94a3b8; }

/* ── Fleet overview map ─────────────────────────────────────────────────────── */
/* Custom cluster icon */
.fm-cluster {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-body); font-weight: 700;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* Asset pin: vehicle icon + live-sensor badge */
.fm-asset-pin {
  width: 50px; height: 50px; border-radius: 50%;
  border: 2.5px solid;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
}
.fm-asset-icon { display: flex; align-items: center; justify-content: center; }
.fm-asset-icon svg { width: 24px; height: 24px; }
.fm-asset-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 800; color: #fff; line-height: 1;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.fm-asset-badge-total { font-weight: 500; opacity: .8; }

/* Permanent asset name tooltip on fleet map */
.fm-asset-tooltip {
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  padding: 0 !important;
  white-space: nowrap;
  pointer-events: none;
}
.fm-asset-tooltip::before { display: none !important; }

/* Legacy single-marker pin (used in per-sensor map mode) */
.fm-pin {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.fm-pin-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ── Fleet sensor cards (compact tiles) ─────────────────────────────────────── */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.fleet-card {
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 9px;
  padding: 10px 12px; cursor: pointer; transition: background .15s, border-color .15s;
  display: flex; flex-direction: column; gap: 3px;
}
.fleet-card:hover { background: var(--bg3); }
.fleet-card.fc-selected { border-color: #6366F1; }
.fc-header { display: flex; align-items: center; gap: 6px; margin-bottom: 1px; }
.fc-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fc-name {
  font-size: var(--fs-md); font-weight: 600; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fc-brand { font-size: var(--fs-xs); color: var(--fg3); }
.fc-value { font-size: 20px; font-weight: 700; color: var(--fg); line-height: 1.1; margin-top: 2px; }
.fc-value.fc-no-data { color: var(--fg3); font-size: var(--fs-2xl); }
.fc-unit  { font-size: var(--fs-sm); font-weight: 400; color: var(--fg2); margin-left: 2px; }
.fc-sub   { font-size: var(--fs-sm); color: var(--fg2); }
.fc-badge {
  display: inline-block; align-self: flex-start;
  font-size: var(--fs-xs); font-weight: 600; padding: 2px 6px;
  border-radius: 4px; margin-top: 3px;
}
.fc-last  { font-size: var(--fs-xs); color: var(--fg3); margin-top: auto; padding-top: 4px; }

.stats-breakdown-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; flex: 1; min-width: 200px;
}
.stats-hbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--fs-md); }
.stats-hbar-label { width: 110px; flex-shrink: 0; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-hbar-track { flex: 1; background: var(--bg3); border-radius: 3px; height: 7px; overflow: hidden; }
.stats-hbar-fill  { height: 100%; background: var(--m-blue); border-radius: 3px; transition: width .3s; }
.stats-hbar-count { width: 44px; text-align: right; color: var(--fg3); font-size: var(--fs-sm); }

.stats-info-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--fs-md); padding: 5px 0; border-bottom: 1px solid var(--border);
  color: var(--fg2);
}
.stats-info-row:last-child { border-bottom: none; }
.stats-info-row span:first-child { color: var(--fg3); }

/* Stats tab scroll container */
.admin-stats-scroll {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 10px 14px 24px;
}

/* ═══════════════════════════════════════════════════════════════
   WebSocket live indicator
   ═══════════════════════════════════════════════════════════════ */
.status-pill.ws-live { border-color: color-mix(in srgb, var(--sc-blue) 40%, transparent); background: color-mix(in srgb, var(--m-blue-dk) 15%, transparent); }
.status-pill.ws-live .dot {
  background: var(--sc-blue);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--sc-blue) 70%, transparent);
  animation: sonar-blue 1.5s ease-out infinite;
}
@keyframes sonar-blue {
  0%   { box-shadow: 0 0 0 0   color-mix(in srgb, var(--sc-blue) 70%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0   transparent; }
}

/* ═══════════════════════════════════════════════════════════════
   Threshold alert editor
   ═══════════════════════════════════════════════════════════════ */
.thresh-editor { padding: 8px 18px 10px; border-top: 1px solid var(--sep); margin-top: 4px; }
/* Threshold drawer — always full-width below card content */
.s-thresh-drawer {
  flex: 0 0 100%; order: 99; width: 100%;
}
.sensor-row:has(.s-thresh-drawer) { flex-wrap: wrap; }
.s-thresh-drawer .thresh-editor { padding: 6px 10px 8px; margin-top: 2px; }
.thresh-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thresh-title  { font-size: var(--fs-xs); font-weight: 700; color: var(--fg3);
                 text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.thresh-field  { display: flex; align-items: center; gap: 3px; }
.thresh-lbl    { font-size: var(--fs-xs); font-weight: 600; color: var(--fg3); white-space: nowrap; }
.thresh-unit   { font-size: var(--fs-xs); color: var(--fg3); }
.thresh-input  { width: 50px; background: var(--bg3); border: 1px solid var(--sep);
                 border-radius: 5px; color: var(--fg); font-size: var(--fs-sm);
                 padding: 3px 5px; text-align: right; }
.thresh-input:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 2px rgba(99,102,241,.18); }
.thresh-input::placeholder { color: var(--fg3); }
/* Threshold drawer action buttons */
.thresh-btn { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px;
              font-size: var(--fs-sm); font-weight: 600; border-radius: 5px;
              border: 1px solid transparent; cursor: pointer; font-family: var(--font);
              line-height: 1.5; transition: background var(--trans), color var(--trans); flex-shrink: 0; }
.thresh-btn-primary { background: var(--m-blue); color: #fff; }
.thresh-btn-primary:hover { background: var(--m-blue-dk); }
.thresh-btn-ghost { background: transparent; color: var(--fg3); }
.thresh-btn-ghost:hover { color: var(--danger); }
.thresh-btn-icon { background: var(--bg3); color: var(--fg2); border-color: var(--sep); padding: 3px 6px; }
.thresh-btn-icon:hover { color: var(--m-blue); border-color: var(--m-blue); }

/* ═══════════════════════════════════════════════════════════════
   Sensor list toolbar: colored type pills (left) + search (right)
   ═══════════════════════════════════════════════════════════════ */
.sensor-list-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--sep);
  background: var(--bg);
  flex-shrink: 0;
  min-width: 0;
}
.sensor-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}
.sensor-type-pill {
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--bg4);
  background: var(--bg4);
  color: var(--fg);
  cursor: pointer;
  line-height: 1.5;
  white-space: nowrap;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.sensor-type-pill:hover { border-color: var(--fg3); }
.sensor-type-pill.active { background: var(--m-blue); border-color: var(--m-blue); color: #fff; }
/* Dim siblings when any pill is active */
.sensor-type-pills:has(.active) .sensor-type-pill:not(.active) { opacity: .5; }

/* ── Sensor type accordion groups ─────────────────────────────── */
.sensor-group { border-bottom: 1px solid var(--sep); }
.sensor-group:last-child { border-bottom: none; }

.sensor-group-header {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  padding: 7px 10px 7px 0;
  background: var(--bg3);
  border: none;
  border-left: 3px solid var(--sg-accent, var(--sep));
  cursor: pointer;
  text-align: left;
  color: var(--fg2);
  font-family: var(--font);
  user-select: none;
  transition: background var(--trans);
}
.sensor-group-header:hover { background: var(--bg4); }

.sg-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  color: var(--sg-accent, var(--fg3));
}
.sg-icon svg { width: 14px; height: 14px; }

.sg-label {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--fg2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-count {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg3);
  background: var(--bg4);
  border-radius: var(--r-full);
  padding: 1px 7px;
  white-space: nowrap;
}

.sg-chevron {
  flex-shrink: 0;
  color: var(--fg3);
  transition: transform .2s ease;
  margin-right: 4px;
}

/* Collapsed state */
.sensor-group-body {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  transition: grid-template-rows .2s ease;
}
.sensor-group-collapsed .sensor-group-body {
  grid-template-rows: 0fr;
}
.sensor-group-body-inner { min-height: 0; overflow: hidden; }
.sensor-group:not(.sensor-group-collapsed) .sensor-group-body-inner { overflow: visible; }

.sensor-group-collapsed .sg-chevron {
  transform: rotate(-90deg);
}

/* Sensor accordion groups inside the sensors overview panel */
.sv-sensor-group { border-radius: 10px; overflow: hidden; border: 1px solid var(--sep); }
.sv-sensor-group .sensor-group-header { border-radius: 0; }
.sv-cards-inner {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 8px 10px;
}

/* Inline search box — fills remaining space to the right */
.sensor-search-inline {
  flex: 1;
  min-width: 60px;
  display: flex; align-items: center; gap: 5px;
  background: var(--bg2); border: 1px solid var(--sep);
  border-radius: var(--r-sm); padding: 0 6px;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.sensor-search-inline:focus-within {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.sensor-search-icon { color: var(--fg3); flex-shrink: 0; }
#sensor-search-input {
  flex: 1; border: none; background: transparent; color: var(--fg);
  font-family: var(--font); font-size: var(--fs-md); padding: 5px 0; outline: none;
  min-width: 0;
}
#sensor-search-input::placeholder { color: var(--fg3); }
.sensor-search-clear {
  background: none; border: none; color: var(--fg3); cursor: pointer;
  padding: 0 2px; font-size: var(--fs-body); line-height: 1;
  transition: color var(--trans);
  flex-shrink: 0;
}
.sensor-search-clear:hover { color: var(--fg); }

/* Collapsed sidebar: hide toolbar entirely */


/* ═══════════════════════════════════════════════════════════════
   Keyboard shortcuts dialog (Step 2)
   ═══════════════════════════════════════════════════════════════ */
.kbd-dialog-overlay {
  position: fixed; inset: 0; z-index: var(--z-kbd);
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}
.kbd-dialog-card {
  background: var(--bg); border: 1px solid var(--sep);
  border-radius: 12px; box-shadow: var(--shadow-md);
  width: min(520px, 94vw); overflow: hidden;
  animation: fadeUp .18s ease;
}
.kbd-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--sep);
}
.kbd-dialog-header h3 { font-size: var(--fs-lg); font-weight: 700; color: var(--fg); margin: 0; }
.kbd-dialog-body {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  padding: 4px 0 12px;
}
.kbd-section { padding: 12px 20px; }
.kbd-section:not(:last-child) { border-right: 1px solid var(--sep); }
.kbd-section-title {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--fg3); margin-bottom: 10px;
}
.kbd-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px; font-size: var(--fs-md); color: var(--fg2);
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 20px; padding: 0 5px;
  background: var(--bg3); border: 1px solid var(--sep); border-bottom-width: 2px;
  border-radius: 4px; font-family: var(--mono, monospace);
  font-size: var(--fs-sm); font-weight: 600; color: var(--fg); flex-shrink: 0;
}
@media (max-width: 700px) {
  .kbd-dialog-body { grid-template-columns: 1fr; }
  .kbd-section:not(:last-child) { border-right: none; border-bottom: 1px solid var(--sep); }
}

/* ── Drivers panel ────────────────────────────────────────────────────────── */
#drivers-panel {
  position: absolute; inset: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0;
}

/* Sensors panel: title shrinks, pills fill left, search stays right */
#sensors-panel .drivers-toolbar-title { flex: 0; }
#sensors-panel .sensor-type-pills { flex: 1; }

/* ── Sensors overview panel ───────────────────────────────────────────────── */
#sensors-panel {
  position: absolute; inset: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0;
}
.sensors-view-search-input {
  font-size: var(--fs-md); padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--sep); background: var(--bg2); color: var(--fg);
  outline: none; width: 180px; transition: border-color var(--trans);
}
.sensors-view-search-input:focus { border-color: #6366F1; }
.sensor-card-brand {
  font-size: var(--fs-xs); font-weight: 600; color: var(--fg3);
  background: var(--bg3); border-radius: 4px; padding: 1px 5px;
  flex-shrink: 0; text-transform: uppercase; letter-spacing: .03em;
}
.sensor-card-vals {
  font-size: var(--fs-sm); color: var(--fg2);
}
.sensor-card-selected { border-color: #6366F1 !important; background: rgba(99,102,241,.08) !important; }
.fleet-asset-card-selected { border-color: #6366F1 !important; box-shadow: 0 0 0 2px rgba(99,102,241,.25); background: rgba(99,102,241,.05) !important; }
.sensor-card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.sensor-card-edit-btn {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--fg3); padding: 2px 4px; border-radius: 4px;
  display: flex; align-items: center; transition: color var(--trans), background var(--trans);
}
.sensor-card-edit-btn:hover { color: #6366F1; background: rgba(99,102,241,.10); }
.sensor-card-delete-btn {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--fg3); padding: 2px 4px; border-radius: 4px;
  display: flex; align-items: center; transition: color var(--trans), background var(--trans);
}
.sensor-card-delete-btn:hover { color: var(--danger); background: rgba(239,68,68,.10); }
.sensor-card-vehicle-label { color: var(--fg3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
#sensors-view-map-el { background: var(--bg2); }
.drivers-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 8px; flex-shrink: 0; border-bottom: 1px solid var(--sep);
}
.drivers-toolbar-title { font-size: var(--fs-xl); font-weight: 700; color: var(--fg); flex: 0; margin-right: 10px; white-space: nowrap; }
.drivers-tab-pills { display: flex; gap: 4px; }
.drivers-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.drivers-period-pills { display: flex; gap: 4px; }
.drivers-toolbar > .admin-small-btn { flex: 0; white-space: nowrap; }
.drivers-tab-pill {
  padding: 3px 12px; border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 600;
  border: 1.5px solid var(--bg4); background: var(--bg4); color: var(--fg3); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.drivers-tab-pill.active { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }

/* ── Score card (Alerts tab) ────────────────────────────────────────────────── */
.score-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg2); border-radius: var(--r-lg); border: 1px solid var(--sep);
  padding: 12px 16px; margin-bottom: 12px;
}
.score-gauge {
  display: flex; align-items: baseline; gap: 3px; flex-shrink: 0;
}
.score-num  { font-size: 2.4rem; font-weight: 800; color: var(--sc, var(--fg)); line-height: 1; }
.score-label { font-size: var(--fs-sm); color: var(--fg3); font-weight: 600; }
.score-detail { flex: 1; min-width: 0; }
.score-title  { font-size: var(--fs-body); font-weight: 700; color: var(--fg); margin-bottom: 6px; }
.score-meta   { font-size: var(--fs-sm); color: var(--fg3); font-weight: 400; margin-left: 6px; }
.score-pills  { display: flex; flex-wrap: wrap; gap: 5px; }
.score-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--pill-col) 12%, transparent);
  color: var(--pill-col); border: 1px solid color-mix(in srgb, var(--pill-col) 28%, transparent);
  white-space: nowrap;
}
.score-pill b { font-weight: 800; }

/* ── Driver scores leaderboard ──────────────────────────────────────────────── */
.lb-wrap { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.lb-period { font-size: var(--fs-sm); color: var(--fg3); font-weight: 600; }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg2); border-radius: var(--r-lg); border: 1px solid var(--sep);
  padding: 10px 14px;
}
.lb-rank  { font-size: var(--fs-xl); font-weight: 800; color: var(--fg3); min-width: 22px; text-align: right; padding-top: 2px; }
.lb-body  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-name  { font-size: var(--fs-body); font-weight: 700; color: var(--fg); }
.lb-meta  { font-size: var(--fs-sm); color: var(--fg3); }
.lb-score { font-size: 2rem; font-weight: 800; flex-shrink: 0; line-height: 1.1; }
.fleet-type-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; margin-left: 8px; }
.sidebar-type-chips { margin: 8px 10px 4px; flex-shrink: 0; }
.fleet-type-chip {
  padding: 3px 11px; border-radius: var(--r-full); font-size: var(--fs-md); font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--bg4); background: var(--bg4); color: var(--fg);
  transition: background .15s, color .15s, border-color .15s;
}
.fleet-type-chip:hover { border-color: var(--fg3); }
.fleet-type-chip-on { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }

/* ── Fleet detail panel ─────────────────────────────────────────────────────── */
.fleet-detail-pane { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.fleet-detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--sep); flex-shrink: 0;
}
.fleet-detail-back {
  display: flex; align-items: center; gap: 5px; cursor: pointer; flex-shrink: 0;
  font-size: var(--fs-md); font-weight: 600; color: var(--fg2); white-space: nowrap;
  background: none; border: none; padding: 4px 8px; border-radius: var(--r-sm);
  font-family: var(--font); transition: color .15s, background .15s;
}
.fleet-detail-back:hover { background: var(--bg3); color: var(--fg); }
.fleet-detail-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xl); font-weight: 700; flex: 1; min-width: 0; }
.fleet-detail-title > span { display: flex; align-items: center; flex-shrink: 0; width: 20px; height: 20px; }
.fleet-detail-open { margin-left: 0; padding: 5px 14px !important; font-size: var(--fs-md) !important; flex-shrink: 0; }
.fleet-detail-sensors { flex-shrink: 0; padding: 4px 0; border-bottom: 1px solid var(--sep); }
.fd-sensors-scroll { overflow-y: auto; max-height: 280px; }
.fleet-detail-sensor-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; font-size: var(--fs-body);
}
.fleet-detail-sensor-row:hover { background: var(--bg3); }
.fleet-detail-sensor-dot { display: none; }
.fleet-detail-sensor-name { flex: 1; color: var(--fg); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fleet-detail-sensor-val { color: var(--fg2); font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.fleet-detail-sensor-ago { color: var(--fg3); font-size: var(--fs-sm); min-width: 55px; text-align: right; white-space: nowrap; flex-shrink: 0; }
.fleet-detail-empty { padding: 12px 16px; color: var(--fg3); font-size: var(--fs-body); }
.fleet-detail-mini-map { flex: 1; min-height: 160px; }

/* ── Fleet detail: rich sensor rows ─────────────────────────────────────────── */
.fd-sensor-row-rich { align-items: flex-start !important; cursor: pointer; }
.fd-sensor-row-rich:hover { background: var(--bg3); }
.fd-sensor-icon { padding-top: 2px; flex-shrink: 0; }
.fd-sensor-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.fd-sensor-nameline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fd-sensor-details { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.fd-sub { color: var(--fg3); font-size: var(--fs-sm); }
.fd-kv { display: inline-flex; gap: 4px; align-items: baseline; }
.fd-k  { color: var(--fg3); font-size: var(--fs-xs); font-weight: 500; }
.fd-v  { color: var(--fg2); font-weight: 600; font-size: var(--fs-sm); }

/* Battery bar */
.fd-batt-bar {
  display: inline-block; width: 40px; height: 8px;
  border: 1.5px solid var(--fg3); border-radius: 2px; overflow: hidden; vertical-align: middle; flex-shrink: 0;
}
.fd-batt-fill { display: block; height: 100%; border-radius: 1px; transition: width .3s; }
.fd-batt-val { font-size: var(--fs-xs); font-weight: 700; vertical-align: middle; }

/* Pill badges */
.fd-pill {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
  border: 1px solid; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.fd-wheel-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 16px; border-radius: 3px; font-size: 10px; font-weight: 700;
  background: var(--bg3); color: var(--fg2); flex-shrink: 0;
}
.fd-stale-pill {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--sc-unknown); background: var(--sc-unknown-bg);
  color: var(--sc-unknown); font-size: var(--fs-xs); font-weight: 600;
}

/* Status summary bar */
.fd-status-bar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px;
  border-bottom: 1px solid var(--sep); flex-shrink: 0;
}
.fd-status-chip {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; border: 1px solid transparent;
}
.fd-status-ok     { background: var(--sc-ok-bg);      color: var(--sc-ok-vivid);  border-color: color-mix(in srgb, var(--sc-ok-vivid) 35%, transparent); }
.fd-status-warn   { background: var(--sc-warn-bg);     color: var(--sc-warn);      border-color: color-mix(in srgb, var(--sc-warn) 35%, transparent); }
.fd-status-danger { background: var(--sc-danger-bg);   color: var(--sc-danger);    border-color: color-mix(in srgb, var(--sc-danger) 35%, transparent); }
.fd-status-stale  { background: var(--sc-unknown-bg);  color: var(--sc-unknown);   border-color: color-mix(in srgb, var(--sc-unknown) 35%, transparent); }

/* TPMS wheel diagram */
.fd-tpms-block {
  padding: 10px 16px; border-bottom: 1px solid var(--sep); flex-shrink: 0;
}
.fd-tpms-label { font-size: var(--fs-xs); font-weight: 700; color: var(--fg3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.fd-wheel-grid { display: flex; flex-direction: column; gap: 6px; }
.fd-wheel-axle { display: flex; gap: 12px; }
.fd-wheel {
  flex: 1; min-width: 70px; border: 2px solid var(--sep); border-radius: 8px;
  padding: 6px 8px; display: flex; flex-direction: column; align-items: center;
  gap: 1px; transition: transform .1s;
}
.fd-wheel:hover { transform: scale(1.03); }
.fd-wheel-empty { opacity: .35; background: var(--bg2); border-color: var(--sep) !important; border-style: dashed !important; }
.fd-wheel-empty span { font-size: var(--fs-xs); color: var(--fg3); font-weight: 600; }
.fd-wheel-pos  { font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.fd-wheel-pres { font-size: var(--fs-md); font-weight: 700; line-height: 1.2; }
.fd-wheel-unit { font-size: 9px; font-weight: 600; opacity: .75; margin-left: 1px; }
.fd-wheel-temp { font-size: var(--fs-xs); color: var(--fg3); }

/* ── Unknown driver ID notification bar ─────────────────────────────────────── */
#drivers-unknown-bar {
  border-bottom: 1px solid color-mix(in srgb, var(--sc-warn) 30%, transparent);
  background: color-mix(in srgb, var(--sc-warn) 8%, transparent);
  flex-shrink: 0;
}
.dub-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  color: #d97706; font-size: var(--fs-md); font-weight: 600;
}
.dub-header span { flex: 1; }
.dub-dismiss {
  background: none; border: none; cursor: pointer; color: var(--fg3);
  font-size: var(--fs-body); padding: 2px 4px; line-height: 1;
  transition: color var(--trans);
}
.dub-dismiss:hover { color: var(--fg); }
.dub-list { padding: 0 16px 10px; display: flex; flex-direction: column; gap: 5px; }
.dub-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 7px;
  padding: 6px 10px;
}
.dub-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.dub-id { font-size: var(--fs-md); font-family: var(--mono, monospace); color: var(--fg); }
.dub-vehicle { font-size: var(--fs-sm); color: var(--fg3); }
.dub-ago { font-size: var(--fs-xs); color: var(--fg3); }
.dub-register-btn {
  flex-shrink: 0; font-size: var(--fs-sm); font-weight: 600;
  padding: 3px 10px; border-radius: 5px; cursor: pointer;
  background: rgba(99,102,241,.12); color: #6366F1;
  border: 1px solid rgba(99,102,241,.3);
  transition: background var(--trans);
}
.dub-register-btn:hover { background: rgba(99,102,241,.22); }
.dub-discard-btn {
  flex-shrink: 0; font-size: var(--fs-sm); padding: 3px 7px; border-radius: 5px; cursor: pointer;
  background: none; color: var(--fg3); border: 1px solid var(--sep);
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.dub-discard-btn:hover { background: rgba(239,68,68,.12); color: #EF4444; border-color: rgba(239,68,68,.3); }

.drivers-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 1fr;
  flex: 1; overflow: hidden;
  min-height: 0;
}
@media (max-width: 900px) {
  .drivers-split { grid-template-columns: 1fr; }
  #drivers-map-el { display: none; }
}
.drivers-list-pane {
  overflow-y: auto; border-right: 1px solid var(--sep);
  padding: 10px 10px 20px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; min-height: 0;
  scrollbar-gutter: stable;
}

#sensors-view-list-pane {
  overflow-x: hidden;
}

/* Sensors overview: let expanded groups contribute to the pane height so the
   parent column can scroll through long categories normally. */
.sv-sensor-group {
  overflow: visible;
}

.sv-sensor-group .sensor-group-header {
  padding-top: 9px;
  padding-bottom: 9px;
}

.sv-sensor-group .sensor-group-body {
  display: block;
  overflow: visible;
  transition: none;
}

.sv-sensor-group.sensor-group-collapsed .sensor-group-body {
  display: none;
}

.sv-sensor-group .sensor-group-body-inner,
.sv-sensor-group:not(.sensor-group-collapsed) .sensor-group-body-inner {
  overflow: visible;
}
/* Fleet assets view — wrap full-width cards in a column */
#fleet-asset-list-pane {
  flex-direction: column; gap: 6px; padding: 10px 8px 20px;
}
#fleet-asset-list-pane .sidebar-asset-expanded {
  margin: 0; width: auto !important; flex: 0 0 auto;
}
#fleet-asset-list-pane .sidebar-asset-compact,
#fleet-asset-list-pane .sidebar-asset-expanded { cursor: pointer; }
#fleet-asset-list-pane .sidebar-asset-expanded:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12);
}
#fleet-asset-list-pane .sae-header { border-bottom: none; }
.drivers-empty {
  text-align: center; color: var(--fg3); font-size: var(--fs-body); padding: 40px 20px;
}
.driver-card {
  background: var(--bg2); border: 1px solid var(--sep); border-radius: 9px;
  padding: 10px 13px; cursor: pointer; transition: background .15s, border-color .15s;
  display: flex; flex-direction: column; gap: 3px;
}
.driver-card:hover { background: var(--bg3); border-color: #6366F1; }
.driver-card-header { display: flex; align-items: center; gap: 7px; }
.driver-card-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sensor-card-icon {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border-radius: 8px; border: 1px solid var(--sep);
}
.sensor-card-icon svg { width: 18px; height: 18px; }
.driver-card-name { font-size: var(--fs-body); font-weight: 600; color: var(--fg); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver-card-id { font-size: var(--fs-sm); color: var(--fg3); font-family: var(--mono, monospace); }
.driver-card-vehicle { font-size: var(--fs-sm); color: var(--fg2); }
.driver-card-position { font-size: var(--fs-sm); color: var(--m-blue); font-weight: 600; }
.driver-card-ago { font-size: var(--fs-xs); color: var(--fg3); }
.driver-card-actions { display: flex; gap: 5px; margin-top: 5px; }
.driver-action-btn {
  font-size: var(--fs-sm); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--sep);
  background: transparent; color: var(--fg2); cursor: pointer; transition: background .12s;
}
.driver-action-btn:hover { background: var(--bg3); color: var(--fg); }
.driver-action-btn.danger:hover { background: rgba(239,68,68,.12); color: #EF4444; border-color: #EF4444; }
#drivers-map-el { background: var(--bg2); }
.dm-outer { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dm-pin {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: 2.5px solid currentColor;
  background: rgba(99,102,241,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,.35); backdrop-filter: blur(4px);
}
.dm-label-name {
  font-size: var(--fs-sm); font-weight: 700; color: #fff; white-space: nowrap;
  background: rgba(99,102,241,.85); border-radius: 4px; padding: 1px 5px;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.dm-label-asset {
  font-size: var(--fs-xs); color: rgba(255,255,255,.9); white-space: nowrap;
  background: rgba(0,0,0,.55); border-radius: 3px; padding: 1px 4px;
}
.dm-label-pos {
  font-size: var(--fs-xs); color: rgba(255,255,255,.95); white-space: nowrap;
  background: rgba(37,99,235,.78); border-radius: 3px; padding: 1px 4px;
}
.driver-card-selected { border-color: #6366F1 !important; background: rgba(99,102,241,.08) !important; }

/* Drivers edit modal */
#driver-modal .modal-card { max-width: 380px; }
#driver-modal-form { padding: 20px 22px 24px; }

/* Admin drivers panel rows */
.admin-drivers-list { overflow-y: auto; }
.admin-driver-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.admin-driver-row:last-child { border-bottom: none; }
.adr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.adr-info { flex: 1; min-width: 0; }
.adr-name { font-size: var(--fs-body); font-weight: 600; color: var(--fg); }
.adr-id { font-size: var(--fs-sm); color: var(--fg3); font-family: var(--mono, monospace); margin-top: 1px; }
.adr-ago { font-size: var(--fs-xs); color: var(--fg3); }
.adr-actions { display: flex; gap: 4px; flex-shrink: 0; }

.admin-pois-list {
  padding: 10px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.admin-poi-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--sep);
  border-radius: var(--r);
  background: var(--bg3);
}
.admin-poi-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--poi-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--poi-color) 14%, transparent);
}
.admin-poi-info { flex: 1; min-width: 0; }
.admin-poi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-poi-name { font-size: var(--fs-body); font-weight: 700; color: var(--fg1); }
.admin-poi-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.admin-poi-state.is-enabled { background: rgba(34,197,94,.14); color: #16a34a; }
.admin-poi-state.is-disabled { background: rgba(148,163,184,.16); color: var(--fg3); }
.admin-poi-meta { margin-top: 4px; font-size: var(--fs-sm); color: var(--fg3); }
.admin-poi-controls { display: flex; gap: 6px; flex-shrink: 0; }

.poi-modal-card { max-width: 760px !important; }
.poi-modal-form { padding: 18px 22px 24px; }
.poi-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.poi-inline-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.poi-form-row-split {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}
.poi-enabled-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--fg2);
}
.poi-enabled-check input { accent-color: var(--m-blue); }
.poi-color-field { min-width: 120px; }
.poi-color-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  background: var(--bg3);
  padding: 3px;
}
.poi-map-help { font-size: var(--fs-sm); color: var(--fg3); }
.poi-modal-map {
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--sep);
  background: var(--bg2);
}
.poi-modal-actions { margin-top: 16px; }
/* POI rule schedule fields */
.poi-schedule-field label { display: flex; align-items: baseline; gap: 6px; }
.poi-schedule-hint { font-size: var(--fs-sm); color: var(--fg3); font-weight: 400; }
.poi-schedule-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; }
.poi-schedule-row input[type="time"] {
  padding: 6px 10px; border-radius: var(--r-sm); border: 1px solid var(--sep);
  background: var(--bg3); color: var(--fg); font-size: var(--fs-body); flex: 0 0 auto;
}
.poi-schedule-sep { color: var(--fg3); font-size: var(--fs-sm); }
.poi-schedule-days { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.poi-day-chip {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-full); border: 1.5px solid var(--sep); background: var(--bg3); color: var(--fg2);
  user-select: none;
}
.poi-day-chip:has(input:checked) { background: var(--m-blue); color: #fff; border-color: var(--m-blue); }
.poi-day-chip input[type="checkbox"] { display: none; }
/* Fuel & CO2 + Idle summary panels */
.fuel-totals {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 8px;
}
.fuel-total-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 16px; border-radius: var(--r-lg); background: var(--bg2); border: 1px solid var(--sep);
  min-width: 90px;
}
.fuel-total-chip strong { font-size: var(--fs-xl); font-weight: 800; color: var(--fg); }
.fuel-total-chip span { font-size: var(--fs-sm); color: var(--fg3); }
.co2-chip { background: color-mix(in srgb, #22c55e 12%, var(--bg2)); }
.idle-chip { background: color-mix(in srgb, #f59e0b 12%, var(--bg2)); }
.fuel-table {
  width: 100%; border-collapse: collapse; font-size: var(--fs-body);
  background: var(--bg2); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--sep);
}
.fuel-table thead th {
  text-align: left; padding: 8px 12px; font-weight: 700;
  color: var(--fg3); font-size: var(--fs-sm); border-bottom: 1px solid var(--sep);
}
.fuel-table tbody tr:hover { background: var(--bg3); }
.fuel-table tbody td { padding: 8px 12px; color: var(--fg); border-bottom: 1px solid var(--sep); }
.fuel-table tbody tr:last-child td { border-bottom: none; }
.poi-map-tooltip {
  background: rgba(15,23,42,.92);
  color: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.18);
}
.poi-name-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}.poi-name-label__text {
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(15,23,42,1), 0 0 8px rgba(15,23,42,0.85);
  white-space: nowrap;
  transform: translateX(-50%);
  position: absolute;
  pointer-events: none;
  user-select: none;
}
.admin-poi-rules-list {
  padding: 10px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.admin-poi-rule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--sep);
  border-radius: var(--r);
  background: var(--bg3);
}
.admin-poi-rule-info { flex: 1; min-width: 0; }
.admin-poi-rule-scope { margin-top: 6px; font-size: var(--fs-xs); color: var(--fg3); font-family: var(--mono); }
.poi-rule-modal-card { max-width: 580px !important; }
.poi-rule-form { padding: 18px 22px 24px; }

@media (max-width: 900px) {
  .admin-poi-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-poi-rule-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-poi-controls {
    width: 100%;
  }
  .poi-form-row-split {
    align-items: stretch;
    flex-direction: column;
  }
}
