/* ============================================================================
   theme.css — NEMI "theme3" design system for the ATOM static demo.
   Sharp rectangles only (--radius: 0), Space Grotesk / Inter / IBM Plex Mono,
   blueprint grid ground, black sidebar on both themes.
   Tokens are HSL triplets used as hsl(var(--token)).
   ==========================================================================*/

/* ---------- tokens: LIGHT (Bone White ground, Brand Book v2.0) ----------
   Bone White #FEFEFE canvas · Soft Oat #ECE7DD cards · pale oat #F6F4E8
   callouts · Near Black #070707 ink · Signal Emerald #10A37E accent */
:root {
  --background: 0 0% 99.6%;           /* Bone White #FEFEFE */
  --foreground: 0 0% 3%;              /* Near Black #070707 ink */
  --card: 40 28% 90%;                 /* Soft Oat #ECE7DD panels */
  --card-foreground: 0 0% 3%;
  --primary: 165 82% 35%;             /* Signal Emerald #10A37E */
  --primary-foreground: 0 0% 100%;
  --secondary: 51 44% 94%;            /* pale-oat callout #F6F4E8 */
  --muted: 40 28% 90%;
  --muted-foreground: 60 2% 44%;      /* toward mono-label grey #8A8A85 */
  --accent: 40 24% 86%;
  --border: 40 14% 80%;
  --sidebar-background: 0 0% 3%;      /* BLACK sidebar, always */
  --sidebar-foreground: 40 28% 90%;
  --brand-gradient: linear-gradient(135deg, #0a4938, #0c7a5e, #10a37e);

  --radius: 0rem;                     /* SHARP. no rounded corners anywhere */

  --grid-line: rgba(7, 7, 7, .10);    /* blueprint grid on light */

  --online: #10b981;
  --idle: #eab308;
  --offline: #ef4444;

  --font-head: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;

  --header-h: 64px;
  --sidebar-w: 260px;
}

/* ---------- tokens: DARK (Black Ground, Brand Book v2.0) ----------
   Black Ground #070707 · panel #161615 · Warm Graphite #292926 ·
   Bone/Oat #ECE7DD headings, oat @78% body · Signal Emerald accent */
[data-theme="dark"] {
  --background: 0 0% 2.7%;            /* Black Ground #070707 */
  --foreground: 40 28% 90%;           /* Bone / Oat #ECE7DD */
  --card: 60 2% 8.4%;                 /* panel #161615 */
  --card-foreground: 40 28% 90%;
  --primary: 165 82% 40%;
  --primary-foreground: 0 0% 100%;
  --secondary: 60 4% 15%;
  --muted: 60 4% 13%;
  --muted-foreground: 40 16% 70%;
  --accent: 60 4% 13%;
  --border: 60 4% 16%;
  --sidebar-background: 0 0% 2%;
  --sidebar-foreground: 40 28% 90%;
  --brand-gradient: linear-gradient(135deg, #0a4938, #0c8a68, #10a37e);

  --grid-line: rgba(16, 163, 126, .14);   /* emerald blueprint grid on dark */
}

/* ---------- base ---------- */
* { box-sizing: border-box; border-radius: 0 !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -.02em; }
a { color: hsl(var(--primary)); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

.mono { font-family: var(--font-mono); }
.num  { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }

/* mono uppercase micro-label — the signature of this theme */
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: hsl(var(--muted-foreground));
}

/* blueprint ground — the NEMI LMM Brand Book v2.0 background assets.
   The technical grid materializes toward the RIGHT edge and dissolves into
   clean space on the left; keep primary content on the calmer left side.
   (Falls back to a CSS-drawn grid if the PNGs are missing.) */
.grid-bg {
  background-color: hsl(var(--background));
  background-image: url("../assets/nemi-lmm-white-bg.png");
  background-size: cover;
  background-position: right center;
  background-repeat: no-repeat;
}
[data-theme="dark"] .grid-bg {
  background-image: url("../assets/nemi-lmm-dark-bg.png");
}

/* NEMI LMM card motifs ---------------------------------------------------- */
/* signature single-corner-snipped rectangle (chamfer top-right) */
.snip {
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  position: relative;
}
/* bracketed index marker that sits by the snip: [001] */
.index-tag {
  position: absolute;
  top: 9px;
  right: 30px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: hsl(var(--primary));
  pointer-events: none;
}
/* slim emerald rule under kickers/headlines */
.rule {
  display: block;
  width: 34px;
  height: 2px;
  background: hsl(var(--primary));
  margin: 10px 0 14px;
}
/* crop-mark "+" registration ticks (dark hero layouts) */
.crop {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  color: rgba(236, 231, 221, .45);
  z-index: 3;
  pointer-events: none;
}
.crop.tl { top: 12px; left: 16px; }
.crop.tr { top: 12px; right: 16px; }
.crop.bl { bottom: 12px; left: 16px; }
.crop.br { bottom: 12px; right: 16px; }

/* opaque panel (oat on light, near-black on dark — never glass) */
.panel {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .12s, background .12s;
}
.btn:hover:not(:disabled) { filter: brightness(.96); }
[data-theme="dark"] .btn:hover:not(:disabled) { filter: brightness(1.25); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-excel { background: #10b981; border-color: #10b981; color: #fff; }
.btn-pdf   { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn-excel:hover, .btn-pdf:hover, .btn-primary:hover { filter: brightness(1.08) !important; }

/* ---------- inputs ---------- */
.field {
  padding: 9px 12px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  min-width: 0;
  font-size: 13px;
}
.field:focus {
  outline: 2px solid hsl(var(--primary));
  outline-offset: -1px;
  border-color: hsl(var(--primary));
}
.field::placeholder { color: hsl(var(--muted-foreground)); opacity: .8; }

/* ---------- pills / dots ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.pill-exact    { color: #0d9668; background: rgba(16, 185, 129, .12); }
.pill-estimate { color: #a16207; background: rgba(234, 179, 8, .14); }
.pill-covered  { color: #0d9668; background: rgba(16, 185, 129, .12); }
.pill-not-covered { color: #dc2626; background: rgba(239, 68, 68, .12); }
.pill-online   { color: #0d9668; background: rgba(16, 185, 129, .12); }
.pill-idle     { color: #a16207; background: rgba(234, 179, 8, .14); }
.pill-offline  { color: #dc2626; background: rgba(239, 68, 68, .12); }
[data-theme="dark"] .pill-exact,
[data-theme="dark"] .pill-covered,
[data-theme="dark"] .pill-online { color: #34d399; }
[data-theme="dark"] .pill-estimate,
[data-theme="dark"] .pill-idle { color: #facc15; }
[data-theme="dark"] .pill-not-covered,
[data-theme="dark"] .pill-offline { color: #f87171; }

.dot { width: 8px; height: 8px; display: inline-block; flex: none; }
.dot-online  { background: var(--online); }
.dot-idle    { background: var(--idle); }
.dot-offline { background: var(--offline); }

/* ════════════════════════════════════════════════════════════════════
   APP SHELL — fixed black sidebar + header + content
   ════════════════════════════════════════════════════════════════════ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: hsl(var(--sidebar-background));
  color: hsl(var(--sidebar-foreground));
  display: flex;
  flex-direction: column;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, .07);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sb-logo {
  width: 38px; height: 38px; flex: none;
  background: var(--brand-gradient);
  display: grid; place-items: center;
}
.sb-logo svg { display: block; }
.sb-word { line-height: 1.15; }
.sb-word b {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #fff;
}
.sb-word span {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
}

.sb-nav { padding: 14px 12px; display: grid; gap: 4px; }
.sb-nav .label { padding: 0 10px 8px; color: rgba(255,255,255,.35); }
.sb-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: rgba(255, 255, 255, .62);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sb-nav a svg { flex: none; opacity: .8; }
.sb-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-nav a.active {
  background: rgba(16, 163, 126, .16);
  border-left-color: #10a37e;
  color: #34d399;
}

.sb-spacer { flex: 1; }

.sb-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sb-avatar {
  width: 36px; height: 36px; flex: none;
  background: var(--brand-gradient);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
}
.sb-user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.sb-user-meta b { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-meta span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.sb-logout {
  background: none; border: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.6);
  width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; flex: none;
}
.sb-logout:hover { border-color: #ef4444; color: #ef4444; }

/* main column */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  position: sticky;
  top: 0;
  z-index: 900;
}
.tb-burger {
  display: none;
  background: none; border: 1px solid hsl(var(--border));
  width: 36px; height: 36px; cursor: pointer;
  color: hsl(var(--foreground));
  place-items: center;
}
.tb-title { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; }
.tb-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.tb-spacer { flex: 1; }
.tb-clock {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .06em;
  color: hsl(var(--primary));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tb-theme {
  width: 36px; height: 36px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  cursor: pointer;
  display: grid; place-items: center;
  color: hsl(var(--foreground));
}
.tb-theme:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.tb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 6px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
}
.tb-user .sb-avatar { width: 28px; height: 28px; font-size: 11px; }
.tb-user-meta { line-height: 1.2; }
.tb-user-meta b { display: block; font-size: 11.5px; }
.tb-user-meta span { font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }

.content { flex: 1; position: relative; min-height: 0; display: flex; flex-direction: column; }

/* Live Map is a fixed-viewport app screen: the shell must not grow with the
   300+ row Route Play tables. Pinning the height here (rather than on
   .lm-page, whose flex-basis would win) makes every descendant resolve
   against a real number, so the panes scroll internally. */
body[data-page="map"],
body[data-page="map"] .shell { height: 100vh; overflow: hidden; }
body[data-page="map"] .main { height: 100vh; min-height: 0; overflow: hidden; }
body[data-page="map"] .content {
  flex: 1 1 auto;
  height: calc(100vh - var(--header-h));
  max-height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.sb-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 990;
}

/* ════════════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════════════ */
.login-split { display: flex; min-height: 100vh; }

.login-hero {
  flex: 1;
  position: relative;
  /* NEMI LMM Black-Ground blueprint asset: black top-left deepening to a
     faint emerald wash bottom-right, grid fading in from the right */
  background: #000 url("../assets/nemi-lmm-dark-bg.png") right center / cover no-repeat;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 48px;
  overflow: hidden;
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-hero > * { position: relative; z-index: 2; }

.hero-brand { display: flex; align-items: center; gap: 14px; }
.hero-brand .sb-logo { width: 46px; height: 46px; }
.hero-tag {
  max-width: 420px;
}
.hero-tag h2 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 14px;
}
.hero-tag h2 em {
  font-style: normal;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-tag p { color: rgba(255,255,255,.55); margin: 0; font-size: 14px; }
.hero-foot {
  display: flex; gap: 26px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: rgba(236,231,221,.45);
}
.hero-foot b { color: #34d399; display: block; font-size: 15px; letter-spacing: .04em; }
.hero-foot .idx { display: block; font-style: normal; color: rgba(236,231,221,.35); margin-bottom: 4px; }

.login-side {
  width: 46%;
  min-width: 420px;
  display: grid;
  place-items: center;
  padding: 40px 28px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 34px;
}
.login-card h1 { font-size: 26px; margin: 0 0 4px; }
.login-card .sub { color: hsl(var(--muted-foreground)); font-size: 13px; margin: 0 0 26px; }

.form-row { margin-bottom: 18px; }
.form-row .label { display: block; margin-bottom: 7px; color: hsl(var(--foreground)); opacity: .75; }
.form-row .field { width: 100%; font-family: var(--font-mono); font-size: 13px; }

.remember {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
  margin: 4px 0 22px; cursor: pointer; user-select: none;
}
.remember input { width: 15px; height: 15px; accent-color: hsl(var(--primary)); margin: 0; }

.login-btn { width: 100%; padding: 12px; font-size: 12px; }

.auth-error {
  display: none;
  border: 1px solid #ef4444;
  border-left-width: 4px;
  background: rgba(239, 68, 68, .10);
  color: #dc2626;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-bottom: 18px;
}
[data-theme="dark"] .auth-error { color: #f87171; }
.auth-error.show { display: block; }

.login-hint {
  margin-top: 22px;
  padding: 10px 12px;
  border: 1px dashed hsl(var(--border));
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  letter-spacing: .03em;
}

/* ════════════════════════════════════════════════════════════════════
   LIVE TRACK
   ════════════════════════════════════════════════════════════════════ */
.map-stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: hsl(var(--muted)); z-index: 1; }

/* tile styling per theme */
.leaflet-tile-pane { filter: saturate(.75) contrast(.98); }
[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.75) saturate(.35) contrast(.95);
}
.leaflet-container { font: inherit; background: hsl(var(--background)); }
.leaflet-bar a, .leaflet-bar a:hover { background: hsl(var(--card)); color: hsl(var(--foreground)); border-bottom-color: hsl(var(--border)); }
.leaflet-control-attribution { background: hsl(var(--card)) !important; color: hsl(var(--muted-foreground)) !important; font-size: 10px; font-family: var(--font-mono); }
.leaflet-control-attribution a { color: hsl(var(--primary)) !important; }

.veh-plate {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* right-side vehicle list panel */
.fleet-panel {
  position: absolute;
  top: 14px; right: 14px; bottom: 14px;
  width: 300px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fleet-head { padding: 13px 14px 11px; border-bottom: 1px solid hsl(var(--border)); }
.fleet-head .label { display: block; margin-bottom: 9px; }
.fleet-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.fleet-search { width: 100%; font-family: var(--font-mono); font-size: 12px; }

.fleet-list { flex: 1; overflow-y: auto; min-height: 0; }
.fleet-list::-webkit-scrollbar { width: 8px; }
.fleet-list::-webkit-scrollbar-thumb { background: hsl(var(--border)); }

.veh-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid hsl(var(--border));
  border-left: 3px solid transparent;
  cursor: pointer;
  color: hsl(var(--card-foreground));
}
.veh-item:hover { background: hsl(var(--accent)); }
.veh-item.selected {
  border-left-color: hsl(var(--primary));
  background: rgba(16, 163, 126, .10);
}
.veh-item .vi-no { font-family: var(--font-head); font-weight: 700; font-size: 13.5px; display: block; }
.veh-item .vi-meta {
  font-family: var(--font-mono); font-size: 10px; color: hsl(var(--muted-foreground));
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.veh-item .vi-speed { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-align: right; }
.veh-item .vi-speed small {
  display: block; font-size: 8.5px; letter-spacing: .1em;
  color: hsl(var(--muted-foreground)); font-weight: 500;
}
.fleet-empty { padding: 26px 14px; text-align: center; font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); }

/* followed-vehicle info panel */
.info-panel {
  position: absolute;
  left: 14px; bottom: 22px;
  width: 280px;
  z-index: 500;
}
.info-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--accent));
}
/* keep the status pill clear of the [001] tag in the snipped corner */
.info-panel.snip .info-head { padding-right: 72px; }
.info-head b { font-family: var(--font-head); font-size: 15px; }
.info-head .spacer { flex: 1; }

.info-body { padding: 12px 13px; display: grid; gap: 9px; }
.info-speed { display: flex; align-items: baseline; gap: 8px; }
.info-speed b {
  font-family: var(--font-mono); font-size: 32px; font-weight: 600;
  line-height: 1; color: hsl(var(--primary)); font-variant-numeric: tabular-nums;
}
.info-speed span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: hsl(var(--muted-foreground)); }

.info-row { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: baseline; }
.info-row .k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.info-row .v { font-family: var(--font-mono); font-size: 12px; font-weight: 500; word-break: break-all; }

.info-progress { height: 3px; background: hsl(var(--accent)); border: 1px solid hsl(var(--border)); overflow: hidden; }
.info-progress i { display: block; height: 100%; background: hsl(var(--primary)); width: 0; }

.info-controls {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 11px 13px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--accent));
}
.info-controls .btn { padding: 8px 4px; font-size: 10px; }

/* ════════════════════════════════════════════════════════════════════
   BATTERY REPORT
   ════════════════════════════════════════════════════════════════════ */
.report-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 22px 22px;
}

.report-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.report-toolbar .field { font-family: var(--font-mono); font-size: 12px; }
#bat-search { width: 320px; }
#bat-scope { width: 190px; cursor: pointer; }
.toolbar-total {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: hsl(var(--muted-foreground)); white-space: nowrap;
}
.toolbar-total b { color: hsl(var(--primary)); }
.toolbar-found {
  font-family: var(--font-mono); font-size: 11px; color: hsl(var(--primary));
  letter-spacing: .06em; white-space: nowrap;
}
.toolbar-gap { flex: 1; }

.table-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.table-scroll { flex: 1; overflow: auto; min-height: 0; }
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: hsl(var(--border)); }
.table-scroll::-webkit-scrollbar-corner { background: transparent; }

table.report {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 12.5px;
}

table.report thead th {
  position: sticky;
  background: hsl(var(--accent));
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  text-align: left;
  z-index: 3;
}
table.report thead tr.group-row th {
  top: 0;
  height: 30px;
  text-align: center;
  color: hsl(var(--primary));
  border-bottom: 1px solid hsl(var(--border));
  z-index: 4;
}
table.report thead tr.col-row th { top: 30px; border-bottom: 2px solid hsl(var(--border)); }
table.report thead th.num { text-align: right; }

th.grp-edge, td.grp-edge { border-left: 1px solid hsl(var(--border)); }

table.report tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
  background: hsl(var(--card));       /* opaque — sticky columns depend on it */
}
table.report tbody tr:hover td { background: hsl(var(--accent)); }  /* re-applied on sticky cells too */

/* frozen columns: fixed widths + opaque background (gotcha #5) */
.stick-a, .stick-b { position: sticky; z-index: 2; }
.stick-a { left: 0; width: 48px; min-width: 48px; max-width: 48px; text-align: right; }
.stick-b {
  left: 48px; width: 150px; min-width: 150px; max-width: 150px;
  box-shadow: 6px 0 8px -4px rgba(0, 0, 0, .22);
  border-right: 1px solid hsl(var(--border));
}
[data-theme="dark"] .stick-b { box-shadow: 6px 0 10px -4px rgba(0, 0, 0, .65); }
thead .stick-a, thead .stick-b { z-index: 5; }
thead tr.group-row .stick-a { z-index: 6; width: auto; max-width: none; text-align: center; }

td.stick-a { font-family: var(--font-mono); color: hsl(var(--muted-foreground)); font-size: 11px; }
td.stick-b { font-family: var(--font-mono); font-weight: 600; color: hsl(var(--primary)); }

.cap-cell { display: inline-flex; align-items: center; gap: 8px; }
.blank { color: hsl(var(--muted-foreground)); opacity: .7; }

.report-empty {
  padding: 46px 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* ---------- print (the PDF button) ---------- */
@media print {
  .sidebar, .topbar, .report-toolbar, .sb-backdrop { display: none !important; }
  .main { margin-left: 0; }
  .report-wrap { padding: 0; }
  .table-scroll { overflow: visible; }
  table.report { font-size: 8.5px; width: 100%; }
  table.report thead th, .stick-a, .stick-b { position: static !important; box-shadow: none; }
  table.report tbody td, table.report thead th { padding: 3px 5px; white-space: normal; }
  body { background: #fff; }
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE — sidebar collapses behind a hamburger under 768px
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sb-backdrop { display: block; }
  .main { margin-left: 0; }
  .tb-burger { display: grid; }
  .tb-user-meta { display: none; }
  .tb-user { padding: 4px; border: none; background: none; }

  .fleet-panel { width: 250px; top: 10px; right: 10px; bottom: auto; max-height: 46%; }
  .info-panel { left: 10px; right: 10px; width: auto; bottom: 12px; }

  .login-split { flex-direction: column; }
  .login-hero { min-height: 300px; padding: 28px; }
  .login-side { width: 100%; min-width: 0; }

  #bat-search, #bat-scope { width: 100%; }
  .report-wrap { padding: 10px; }
}

/* ════════════════════════════════════════════════════════════════════
   LIVE MAP — map left, 380px control panel right, two tabs
   ════════════════════════════════════════════════════════════════════ */
.lm-page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.lm-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}
.lm-bar h2 { font-size: 16px; margin: 0; font-family: var(--font-head); }
.lm-bar .spacer { flex: 1; }

/* The grid row must be height-constrained, else the 300+ row tables stretch
   it and push the chart panel off-screen (and the map fits bounds against a
   giant viewport). minmax(0,1fr) + min-height:0 keeps panes scrolling inside. */
.lm-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.lm-map-wrap { position: relative; min-height: 0; background: hsl(var(--muted)); }
#lm-map { position: absolute; inset: 0; }

.lm-map-msg {
  position: absolute; inset: 0; z-index: 5;
  display: none; place-items: center; text-align: center;
  background: hsl(var(--background));
  padding: 30px;
}
.lm-map-msg.show { display: grid; }
.lm-map-msg .inner { max-width: 440px; }
.lm-map-msg h3 { font-size: 15px; margin: 0 0 10px; color: hsl(var(--foreground)); }
.lm-map-msg p { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin: 0 0 8px; line-height: 1.6; }
.lm-map-msg code {
  font-family: var(--font-mono); font-size: 11.5px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  padding: 2px 6px; display: inline-block;
}

/* ---------- right panel ---------- */
.lm-panel {
  border-left: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.lm-tabs { display: flex; border-bottom: 1px solid hsl(var(--border)); flex: none; }
.lm-tab {
  flex: 1; padding: 12px 8px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: hsl(var(--muted-foreground));
  border-bottom: 2px solid transparent;
}
.lm-tab:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.lm-tab.active { color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); }

.lm-tabpane { display: none; flex: 1 1 auto; min-height: 0; max-height: 100%; flex-direction: column; overflow: hidden; }
.lm-tabpane.active { display: flex; }

.lm-controls { padding: 12px 13px; display: grid; gap: 9px; flex: 0 0 auto; overflow-y: auto; max-height: 62%; }
.lm-controls .field { width: 100%; font-size: 12.5px; }
.lm-controls select.field { cursor: pointer; }
.lm-row { display: flex; gap: 7px; }
.lm-row > * { flex: 1; min-width: 0; }
.lm-row .btn { flex: none; }

.lm-lbl {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  display: block; margin-bottom: -3px;
}

.lm-countdown {
  font-family: var(--font-mono); font-size: 11px;
  color: hsl(var(--muted-foreground)); letter-spacing: .05em;
}
.lm-countdown b { color: hsl(var(--primary)); }

.lm-hint {
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.5;
  color: #a16207; background: rgba(234, 179, 8, .12);
  border-left: 3px solid #eab308; padding: 7px 9px;
}
[data-theme="dark"] .lm-hint { color: #facc15; }

.lm-found { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--primary)); letter-spacing: .05em; }

/* ---------- assets table ---------- */
.lm-tablewrap { flex: 1; overflow: auto; min-height: 0; border-top: 1px solid hsl(var(--border)); }
table.lm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.lm-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: hsl(var(--accent));
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  text-align: left; padding: 7px 9px; white-space: nowrap;
  border-bottom: 1px solid hsl(var(--border));
}
table.lm-table thead th.num { text-align: right; }
table.lm-table tbody td {
  padding: 7px 9px; border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap; background: hsl(var(--card));
}
table.lm-table tbody tr:nth-child(even) td { background: hsl(var(--accent) / .45); }
table.lm-table tbody tr { cursor: pointer; }
table.lm-table tbody tr:hover td { background: rgba(16, 163, 126, .12); }
table.lm-table tbody tr.sel td { background: rgba(16, 163, 126, .18); }
td.lm-imei { font-family: var(--font-mono); color: hsl(var(--primary)); font-weight: 600; }
td.lm-speed { text-align: right; font-family: var(--font-mono); font-weight: 700; }
td.lm-date, td.lm-chassis { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); }
td.lm-idx { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); text-align: right; width: 30px; }
.lm-empty { padding: 26px 12px; text-align: center; font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); }

/* ---------- searchable vehicle dropdown ---------- */
.lm-combo { position: relative; }
.lm-combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 210px; overflow-y: auto; z-index: 60;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--primary));
  display: none;
}
.lm-combo-list.show { display: block; }
.lm-combo-opt {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 11.5px;
  color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
}
.lm-combo-opt:hover, .lm-combo-opt.on { background: rgba(16, 163, 126, .14); color: hsl(var(--primary)); }
.lm-combo-opt small { display: block; font-size: 10px; color: hsl(var(--muted-foreground)); }

/* ---------- route play sub-tabs ---------- */
.lm-subtabs { display: flex; gap: 0; border-top: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); flex: none; }
.lm-subtab {
  flex: 1; padding: 9px 6px; background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); border-bottom: 2px solid transparent;
}
.lm-subtab:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.lm-subtab.active { color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); }

.lm-subpane { display: none; flex: 1 1 auto; overflow: auto; min-height: 0; }
.lm-subpane.active { display: block; }

/* summary rows */
.lm-sum { padding: 4px 0; }
.lm-sum-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 13px; border-bottom: 1px solid hsl(var(--border));
}
.lm-sum-row .k {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.lm-sum-row .v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; text-align: right; }
.lm-sum-row .v.em { color: hsl(var(--primary)); }

.lm-note { padding: 26px 16px; text-align: center; font-size: 12px; color: hsl(var(--muted-foreground)); line-height: 1.6; }

/* play controls */
.lm-play { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lm-play .btn { padding: 7px 11px; font-size: 10.5px; }
.lm-points { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--primary)); font-weight: 600; }

/* ---------- info window (google) ---------- */
.gm-style .gm-style-iw-c {
  border-radius: 0 !important;
  background: hsl(var(--card)) !important;
  border: 1px solid hsl(var(--border));
  box-shadow: 0 6px 20px rgba(0,0,0,.35) !important;
  padding: 0 !important;
}
.gm-style .gm-style-iw-d { overflow: hidden !important; background: hsl(var(--card)); }
.gm-style .gm-style-iw-tc::after { background: hsl(var(--card)) !important; }
.iw {
  font-family: var(--font-body); color: hsl(var(--card-foreground));
  padding: 11px 13px; min-width: 210px;
}
.iw h4 {
  margin: 0 0 8px; font-size: 13px; font-family: var(--font-mono);
  color: hsl(var(--primary)); letter-spacing: .04em;
}
.iw-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; padding: 2px 0; }
.iw-row .k {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.iw-row .v { font-family: var(--font-mono); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   CHART PANEL — Battery & Speed
   ════════════════════════════════════════════════════════════════════ */
.chart-panel {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  flex: 0 0 auto;
  max-height: 56vh;
  overflow-y: auto;
}
.chart-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid hsl(var(--border));
}
.chart-head .label { flex: none; }
.chart-head .spacer { flex: 1; }
.btn-amber { background: #eab308; border-color: #eab308; color: #1a1a12; }
.btn-amber:hover { filter: brightness(1.08) !important; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 9px 14px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .04em;
  color: hsl(var(--foreground));
}
.legend-item .sw { width: 11px; height: 3px; flex: none; }
.legend-item.off { opacity: .38; text-decoration: line-through; }
.legend-item:hover { background: hsl(var(--accent)); }

.chart-canvas-wrap { position: relative; padding: 4px 14px 8px; }
#chart-canvas { display: block; width: 100%; height: 300px; cursor: crosshair; }
/* the legend sits under the plot; keep it clear of the rotated x labels */
.chart-legend { padding-top: 2px; }
.chart-cap {
  font-family: var(--font-mono); font-size: 10px; color: hsl(var(--muted-foreground));
  padding: 0 14px 10px; letter-spacing: .04em;
}
.chart-empty { padding: 40px; text-align: center; font-family: var(--font-mono); font-size: 11.5px; color: hsl(var(--muted-foreground)); }

/* ════════════════════════════════════════════════════════════════════
   DATE FIELD — text input + calendar icon, popup portalled to <body>
   ════════════════════════════════════════════════════════════════════ */
.datefield { position: relative; display: flex; }
/* `display: flex` above would otherwise override the hidden attribute */
.datefield[hidden] { display: none; }
.datefield .df-input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; padding-right: 34px; }
.datefield .df-input.df-bad { border-color: #ef4444; outline: 2px solid #ef4444; outline-offset: -1px; }
.datefield .df-btn {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 32px;
  background: none; border: none; border-left: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground)); cursor: pointer;
  display: grid; place-items: center;
}
.datefield .df-btn:hover { color: hsl(var(--primary)); background: hsl(var(--accent)); }

.df-pop {
  position: fixed; z-index: 4000;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--primary));
  box-shadow: 0 14px 40px rgba(0,0,0,.42);
  width: max-content;
}
.df-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--accent));
}
.df-title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.df-nav {
  width: 24px; height: 24px; background: none; cursor: pointer;
  border: 1px solid hsl(var(--border)); color: hsl(var(--foreground));
  font-size: 15px; line-height: 1; display: grid; place-items: center;
}
.df-nav:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }

.df-body { display: flex; }
.df-cal { padding: 8px; }
.df-dow, .df-grid { display: grid; grid-template-columns: repeat(7, 28px); gap: 2px; }
.df-dow span {
  text-align: center; font-family: var(--font-mono); font-size: 9px;
  color: hsl(var(--muted-foreground)); letter-spacing: .06em; padding: 3px 0;
}
.df-day {
  height: 26px; background: none; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; color: hsl(var(--foreground));
}
.df-day:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.df-day.df-on { background: hsl(var(--primary)); color: #fff; font-weight: 700; }
.df-blank { cursor: default; }

.df-time { display: flex; border-left: 1px solid hsl(var(--border)); }
.df-col {
  width: 46px; max-height: 196px; overflow-y: auto;
  border-right: 1px solid hsl(var(--border));
}
.df-col:last-child { border-right: none; }
.df-col::-webkit-scrollbar { width: 5px; }
.df-col::-webkit-scrollbar-thumb { background: hsl(var(--border)); }
.df-t {
  display: block; width: 100%; padding: 5px 0; text-align: center;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; color: hsl(var(--foreground));
}
.df-t:hover { background: hsl(var(--accent)); color: hsl(var(--primary)); }
.df-t.df-on { background: hsl(var(--primary)); color: #fff; font-weight: 700; }

.df-foot {
  display: flex; gap: 6px; padding: 7px 8px;
  border-top: 1px solid hsl(var(--border)); background: hsl(var(--accent));
}
.df-act {
  flex: 1; padding: 6px; cursor: pointer;
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.df-act:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.df-act-em { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: #fff; }
.df-act-em:hover { filter: brightness(1.08); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .lm-body { grid-template-columns: 1fr 330px; }
}
@media (max-width: 860px) {
  .lm-body { grid-template-columns: 1fr; grid-template-rows: 52vh auto; }
  .lm-panel { border-left: none; border-top: 1px solid hsl(var(--border)); }
  .df-body { flex-direction: column; }
  .df-time { border-left: none; border-top: 1px solid hsl(var(--border)); }
  .df-col { max-height: 120px; width: 100%; display: flex; overflow-x: auto; }
  .df-col .df-t { min-width: 42px; }
}

/* ════════════════════════════════════════════════════════════════════
   SHELL v2 — matches the production ATOM console
   ════════════════════════════════════════════════════════════════════ */

/* emerald blueprint grid behind the whole app area */
.main {
  background-color: hsl(var(--background));
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
}

/* ---------- sidebar ---------- */
.sidebar { transition: width .22s ease; }

.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.sb-logo {
  width: 40px; height: 40px; flex: none;
  background: rgba(16,163,126,.10);
  border: 1px solid rgba(16,163,126,.32);
  display: grid; place-items: center;
}
.sb-word { line-height: 1.1; min-width: 0; }
.sb-word b {
  font-family: var(--font-head); font-size: 19px; font-weight: 700;
  letter-spacing: .16em; color: #fff; display: block;
}
.sb-badge {
  display: inline-block; margin-top: 3px;
  background: #dc2626; color: #fff;
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 700;
  letter-spacing: .12em; padding: 1px 6px;
}
.sb-collapse {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; flex: none;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.42);
  display: grid; place-items: center;
}
.sb-collapse:hover { color: #34d399; }

.sb-nav { padding: 12px 0; display: grid; gap: 2px; }
.sb-nav a {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 18px;
  color: rgba(255,255,255,.60);
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.sb-nav a svg { flex: none; opacity: .85; }
.sb-nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sb-nav a.active {
  background: rgba(16,163,126,.14);
  border-left-color: #10a37e;
  color: #34d399;
}
.sb-nav a.active svg { opacity: 1; }

.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.sb-avatar {
  width: 34px; height: 34px; flex: none;
  background: rgba(16,163,126,.10);
  border: 1px solid rgba(16,163,126,.30);
  display: grid; place-items: center;
  color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 12px;
}
.sb-user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.sb-user-meta b {
  display: block; font-size: 12.5px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-meta span {
  font-family: var(--font-mono); font-size: 9.5px;
  color: rgba(255,255,255,.42);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}

/* collapsed rail */
body.sb-collapsed { --sidebar-w: 68px; }
body.sb-collapsed .sb-word,
body.sb-collapsed .sb-user-meta,
body.sb-collapsed .sb-nav a span { display: none; }
body.sb-collapsed .sb-nav a { justify-content: center; padding: 12px 0; gap: 0; }
body.sb-collapsed .sb-brand { justify-content: center; padding: 16px 0 14px; }
body.sb-collapsed .sb-collapse { transform: translateY(-50%) rotate(180deg); right: 4px; }
body.sb-collapsed .sb-user { justify-content: center; padding: 14px 0; }
body.sb-collapsed .sb-logout { display: none; }

/* ---------- topbar ---------- */
.topbar {
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  gap: 12px;
}
.tb-clock {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--primary));
}
.tb-clock svg { opacity: .8; }
.tb-clock b {
  font-family: var(--font-mono); font-size: 14.5px; font-weight: 600;
  letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.tb-theme {
  width: 38px; height: 38px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--primary));
  cursor: pointer; display: grid; place-items: center;
}
.tb-theme:hover { border-color: hsl(var(--primary)); }
.tb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 11px 5px 6px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.tb-user:hover { border-color: hsl(var(--primary)); }
.tb-user-av {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: rgba(16,163,126,.10);
  border: 1px solid rgba(16,163,126,.30);
}
.tb-user .tb-user-meta { line-height: 1.2; }
.tb-user .tb-user-meta b { display: block; font-size: 12.5px; color: hsl(var(--foreground)); }
.tb-user .tb-user-meta span { font-size: 10.5px; color: hsl(var(--muted-foreground)); }

/* page heading block used by the data pages */
.page-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px 14px;
}
.page-head .ph-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: rgba(16,163,126,.12);
  border: 1px solid rgba(16,163,126,.34);
  color: hsl(var(--primary));
}
.page-head h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.4px; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.page-head .spacer { flex: 1; }

.btn-ghost {
  background: hsl(var(--card));
  border-color: hsl(var(--border));
  color: hsl(var(--primary));
}
.btn-ghost:hover { border-color: hsl(var(--primary)); }

@media (max-width: 768px) {
  body.sb-collapsed { --sidebar-w: 260px; }
  .sb-collapse { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   BATTERY STATUS
   ════════════════════════════════════════════════════════════════════ */
.bs-page { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0 22px 22px; }

.bs-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 13px 15px; margin-bottom: 14px;
}
.bs-toolbar .search-cell { flex: 1; min-width: 220px; position: relative; display: flex; }
.bs-toolbar .search-cell svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: hsl(var(--muted-foreground)); pointer-events: none;
}
.bs-toolbar .search-cell .field { width: 100%; padding-left: 36px; font-size: 13px; }
.bs-toolbar select.field { min-width: 170px; cursor: pointer; }

.bs-tablewrap {
  flex: 1; overflow: auto; min-height: 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
}
table.bs-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.bs-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: hsl(var(--accent));
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  text-align: left; white-space: nowrap;
  padding: 11px 14px;
  border-bottom: 1px solid hsl(var(--border));
}
table.bs-table thead th.num { text-align: right; }
table.bs-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
  background: hsl(var(--card));
  font-family: var(--font-mono); font-size: 12px;
}
table.bs-table tbody tr:hover td { background: rgba(16,163,126,.09); }
table.bs-table td.bs-sl { color: hsl(var(--muted-foreground)); }
table.bs-table td.bs-imei { color: hsl(var(--primary)); font-weight: 600; }
table.bs-table td.bs-batt { color: hsl(var(--primary)); }
table.bs-table td.num { text-align: right; }
.bs-dim { color: hsl(var(--muted-foreground)); }

/* Live Map — total-vehicles line + Live Track link button */
.lm-total {
  font-family: var(--font-mono); font-size: 11.5px;
  color: hsl(var(--muted-foreground)); letter-spacing: .04em;
}
.lm-total b { color: hsl(var(--foreground)); font-weight: 600; }
.lm-countdown { text-align: center; }
.lm-countdown b { font-size: 13px; }
.lm-row a.btn { display: inline-flex; text-decoration: none; }
.lm-row a.btn:hover { text-decoration: none; }

/* chart legend sits under the canvas, wraps across rows */
.chart-legend { justify-content: center; padding: 8px 14px 4px; }

/* ════════════════════════════════════════════════════════════════════
   DASHBOARD / ALL DEVICES / ARCHIVE
   ════════════════════════════════════════════════════════════════════ */
.dash-page, .dev-page, .ar-page {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  padding: 18px 22px 22px; gap: 14px; overflow-y: auto;
}

/* stat tiles */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px; flex: none;
}
.stat-tile { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.st-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.st-value {
  font-family: var(--font-head); font-size: 38px; font-weight: 700;
  letter-spacing: -1.5px; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-tile.em {
  background: var(--brand-gradient); border-color: transparent; color: #fff;
}
.stat-tile.em .st-label { color: rgba(255,255,255,.72); }
.stat-tile.em .st-value { color: #fff; }

/* dashboard map card */
.dash-map { flex: 1; display: flex; flex-direction: column; min-height: 360px; }
.dash-map-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-bottom: 1px solid hsl(var(--border));
}
.dash-map-head b { font-family: var(--font-head); font-size: 14px; }
.dash-map-head .spacer { flex: 1; }
.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border)); padding: 3px 9px;
}
.legend-chip i { width: 8px; height: 8px; display: inline-block; }
.dash-map-wrap { position: relative; flex: 1; min-height: 320px; }
#dash-map { position: absolute; inset: 0; }

/* all devices */
.dev-search { display: flex; gap: 10px; align-items: center; padding: 12px 14px; flex: none; }
.dev-search .search-cell { flex: 1; min-width: 200px; position: relative; display: flex; }
.dev-search .search-cell svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: hsl(var(--muted-foreground)); pointer-events: none;
}
.dev-search .search-cell .field { width: 100%; padding-left: 36px; }
.dev-search select.field { min-width: 180px; cursor: pointer; }
.dev-count { font-size: 13px; color: hsl(var(--muted-foreground)); flex: none; }
.dev-count b { color: hsl(var(--foreground)); font-weight: 700; }

.dev-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px; flex: none;
}
.dev-card { padding: 14px 15px 12px; display: flex; flex-direction: column; gap: 8px; }
.dc-head { display: flex; align-items: center; gap: 8px; }
.dc-head .spacer { flex: 1; }
.dc-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: rgba(16,163,126,.10); border: 1px solid rgba(16,163,126,.28);
  color: hsl(var(--primary));
}
.dc-label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.dc-reg { font-family: var(--font-head); font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.dc-rows { margin: 0; display: grid; gap: 5px; }
.dc-rows > div { display: flex; justify-content: space-between; gap: 10px; }
.dc-rows dt {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: hsl(var(--muted-foreground)); flex: none;
}
.dc-rows dd {
  margin: 0; font-family: var(--font-mono); font-size: 11.5px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dc-foot { display: flex; gap: 7px; margin-top: 4px; }
.dc-foot .btn { flex: 1; padding: 7px 6px; font-size: 10px; text-decoration: none; }
.dc-foot .btn:hover { text-decoration: none; }

/* archive */
.ar-bar {
  display: grid; grid-template-columns: 1.1fr 1.2fr 1.2fr 1fr .6fr auto;
  gap: 12px; padding: 14px 15px; align-items: end; flex: none;
}
.ar-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ar-field .field { width: 100%; }
.ar-actions { flex-direction: row; gap: 7px; align-items: stretch; }
.ar-hint { font-family: var(--font-mono); font-size: 11.5px; color: hsl(var(--muted-foreground)); flex: none; }
.ar-hint b { color: hsl(var(--primary)); }

.ar-panel { flex: 1; display: flex; flex-direction: column; min-height: 320px; overflow: hidden; }
.ar-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid hsl(var(--border)); flex: none;
}
.ar-panel-head .field { width: 220px; font-size: 12.5px; }
.ar-panel-head .spacer { flex: 1; }
.ar-rows { font-family: var(--font-mono); font-size: 11.5px; color: hsl(var(--muted-foreground)); }
.ar-rows b { color: hsl(var(--foreground)); }

.ar-tablewrap { flex: 1; overflow: auto; min-height: 0; }
table.ar-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; }
table.ar-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: hsl(var(--accent));
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: hsl(var(--muted-foreground));
  text-align: left; padding: 9px 12px; border-bottom: 1px solid hsl(var(--border));
}
table.ar-table thead th:nth-child(1) { width: 52px; }
table.ar-table thead th:nth-child(2) { width: 92px; }
table.ar-table thead th:nth-child(3) { width: 150px; }
table.ar-table thead th:nth-child(4) { width: 170px; }
table.ar-table thead th:nth-child(5) { width: 62px; }
table.ar-table thead th.num, table.ar-table td.num { text-align: right; }
table.ar-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid hsl(var(--border));
  vertical-align: top; font-family: var(--font-mono); font-size: 11px;
  background: hsl(var(--card));
}
table.ar-table tbody tr:hover td { background: rgba(16,163,126,.07); }
td.ar-sl, td.ar-db { color: hsl(var(--muted-foreground)); }
td.ar-type { color: hsl(var(--foreground)); font-weight: 600; }
td.ar-imei { color: hsl(var(--primary)); font-weight: 600; }
td.ar-raw {
  font-size: 10px; line-height: 1.55; color: hsl(var(--muted-foreground));
  word-break: break-all; white-space: pre-wrap;
}

@media (max-width: 1000px) {
  .ar-bar { grid-template-columns: 1fr 1fr; }
  .ar-actions { grid-column: 1 / -1; }
}

/* Battery Status — charge-state pills + ACTION icon buttons */
.pill-charging    { color: #0d9668; background: rgba(16,185,129,.12); }
.pill-discharging { color: #a16207; background: rgba(234,179,8,.14); }
[data-theme="dark"] .pill-charging    { color: #34d399; }
[data-theme="dark"] .pill-discharging { color: #facc15; }

td.bs-act { white-space: nowrap; }
.act-btn {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; margin-right: 4px;
  border: 1px solid transparent;
  color: hsl(var(--primary));
  text-decoration: none;
}
.act-btn:hover {
  border-color: hsl(var(--primary));
  background: rgba(16,163,126,.12);
  text-decoration: none;
}
.ar-actions-th { text-align: center; }

/* chart hover tooltip — lists every visible series at that 10s sample */
.chart-tip {
  /* appended to <body> and positioned from clientX/clientY, so it must be
     FIXED — absolute would offset it by the page scroll and land it far from
     the cursor on a long, scrolled chart page. */
  position: fixed; z-index: 4200; pointer-events: none;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
  padding: 9px 11px; min-width: 190px;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.7;
  display: none;
}
.chart-tip.show { display: block; }
.chart-tip .tip-t {
  font-weight: 700; color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
  padding-bottom: 5px; margin-bottom: 5px; font-size: 11px;
}
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .tip-row b { font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   DEVICE DETAIL — tabs, cards, charts, live test
   ════════════════════════════════════════════════════════════════════ */
.dd-page { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0 22px 26px; overflow-y: auto; gap: 14px; }

.dd-tabs { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }
.dd-tab {
  padding: 9px 20px; cursor: pointer;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
}
.dd-tab:hover { border-color: hsl(var(--primary)); color: hsl(var(--foreground)); }
.dd-tab.active { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: #fff; }

.dd-body { display: flex; flex-direction: column; gap: 14px; }

.dd-grid { display: grid; gap: 14px; }
.dd-grid.dd-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.dd-grid.dd-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dd-grid.dd-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.dd-card { padding: 0; overflow: hidden; }
.dd-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid hsl(var(--border));
}
.dd-card-head b { font-family: var(--font-head); font-size: 15px; }
.dd-ic {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  background: rgba(16,163,126,.12); border: 1px solid rgba(16,163,126,.3);
  color: hsl(var(--primary));
}
.dd-rows { margin: 0; padding: 8px 10px; display: grid; gap: 2px; }
.dd-rows > div {
  display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
  padding: 7px 10px;
}
.dd-rows > div:nth-child(odd) { background: hsl(var(--accent) / .5); }
.dd-rows dt { font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.dd-rows dd {
  margin: 0; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600;
  text-align: right; word-break: break-word;
}
.dd-on  { color: hsl(var(--primary)); }
.dd-off { color: #ef4444; }
.dd-est {
  padding: 11px 16px; border-top: 1px solid hsl(var(--border));
  color: hsl(var(--primary)); font-weight: 600; font-size: 13px;
}

.hval { display: flex; gap: 10px; padding: 8px 10px; align-items: flex-start; }
.hval .hk {
  font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground));
  flex: none; padding-top: 2px;
}
.hval code {
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.7;
  word-break: break-all; color: hsl(var(--foreground));
}

/* cell-voltage bar chart — 3D bars on a 0-5 V axis */
.cellbar { padding: 16px 18px 12px; }
.cb-plot { display: flex; gap: 10px; height: 210px; }
.cb-axis {
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9.5px; color: hsl(var(--muted-foreground));
  text-align: right; flex: none; padding-bottom: 1px;
}
.cb-area { position: relative; flex: 1; min-width: 0; }
.cb-grid {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
}
.cb-grid i { display: block; border-top: 1px dashed hsl(var(--border)); }
.cb-bars {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 7px; padding: 0 4px 0 2px;
}
.cb-col { flex: 1; display: flex; align-items: flex-end; height: 100%; max-width: 26px; }
.cb-bar {
  position: relative; width: 100%; min-height: 3px;
  background: linear-gradient(180deg, #fdba74, #f97316);
  border: 1px solid #ea580c; border-bottom: none;
}
/* the 3D faces */
.cb-bar .cb-top {
  position: absolute; left: -1px; right: -4px; top: -4px; height: 5px;
  background: #fdba74; border: 1px solid #ea580c;
  transform: skewX(-45deg); transform-origin: bottom left;
}
.cb-bar .cb-side {
  position: absolute; right: -4px; top: -1px; bottom: 0; width: 4px;
  background: #c2410c; border-right: 1px solid #9a3412;
  transform: skewY(-45deg); transform-origin: top left;
}
.cb-labels {
  display: flex; gap: 7px; padding: 6px 4px 0 2px;
  margin-left: 44px; justify-content: space-between;
}
.cb-labels span {
  flex: 1; max-width: 26px; text-align: center;
  font-family: var(--font-mono); font-size: 8.5px;
  color: hsl(var(--muted-foreground));
}

/* Battery 1 + Cell Voltage side by side, card in three columns */
.bat-split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; align-items: start; }
.bat-card { display: flex; flex-direction: column; }
.bat-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; padding: 10px 12px; }
.bat-cols .dd-rows { padding: 0; gap: 3px; align-content: start; }
/* stripe every row the same way, so the three columns line up visually
   (nth-child striping alone breaks when the columns hold different counts) */
.bat-cols .dd-rows > div { background: hsl(var(--accent) / .5); padding: 8px 11px; }
.bat-cols .dd-rows > div:nth-child(even) { background: hsl(var(--accent) / .5); }
.bat-cols .dd-rows dt { line-height: 1.35; }
@media (max-width: 1250px) {
  .bat-split { grid-template-columns: 1fr; }
  .bat-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) { .bat-cols { grid-template-columns: 1fr; } }

/* charts */
.dd-chart-bar {
  display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
  padding: 13px 15px; flex: none;
}
.dd-chart { padding: 0; }
.dd-canvas-wrap { padding: 10px 12px 4px; }
.dd-canvas { display: block; width: 100%; cursor: crosshair; }
.dd-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  justify-content: center; padding: 4px 14px 14px;
}

/* live test */
.dd-test-bar { display: flex; gap: 10px; align-items: center; padding: 13px 15px; flex: none; }
.dd-test-bar .field { width: 260px; }
.rawbox {
  margin: 10px; padding: 12px; min-height: 300px; max-height: 340px; overflow: auto;
  background: #000; color: #34d399;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}

/* chart page: day + quick-range controls */
.ch-quick { display: inline-flex; gap: 6px; }
.ch-quick .btn { padding: 8px 12px; font-size: 10px; }
.dd-chart-bar .ar-field { min-width: 150px; }

/* Route Play day navigation */
.lm-daynav .btn { padding: 7px 6px; font-size: 9.5px; }

/* chart zoom-window readout */
.ch-zoom {
  font-family: var(--font-mono); font-size: 10.5px;
  color: hsl(var(--muted-foreground)); white-space: nowrap;
}
.ch-zoom a { color: hsl(var(--primary)); }
.ch-hint { opacity: .8; }

/* tooltip rows for series that are toggled off — shown but dimmed */
.chart-tip .tip-row.tip-off { opacity: .45; }

/* ════════════════════════════════════════════════════════════════════
   LOGIN v2 — space hero with a rotating globe
   ════════════════════════════════════════════════════════════════════ */
.login-hero { background: #050b16; padding: 30px 34px; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.login-hero > *:not(#hero-canvas) { position: relative; z-index: 2; }

.hero-word { line-height: 1.25; }
.hero-word b {
  display: block; font-family: var(--font-head); font-size: 21px;
  font-weight: 700; letter-spacing: .14em; color: #fff;
}
.hero-word span { font-size: 12.5px; color: rgba(255,255,255,.58); }

/* network status chip, lower left */
.net-status {
  position: absolute; left: 34px; bottom: 96px;
  width: max-content;                 /* a chip, not a full-width band */
  background: rgba(12,20,30,.78);
  border: 1px solid rgba(255,255,255,.12);
  padding: 9px 15px; display: grid; gap: 4px;
  backdrop-filter: blur(3px);
}
.net-status .label { color: rgba(255,255,255,.42); font-size: 9px; }
.net-on {
  display: flex; align-items: center; gap: 7px;
  color: #fff; font-size: 13px; font-weight: 600;
}
.net-on i {
  width: 7px; height: 7px; background: #10b981; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16,185,129,.22);
}

/* stat strip along the bottom */
.hero-stats {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 16px 34px;
  border-top: 1px solid rgba(255,255,255,.09);
  background: rgba(4,9,16,.62);
  backdrop-filter: blur(4px);
}
.hero-stats span {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.42);
}
.hero-stats b {
  display: block; font-family: var(--font-head); font-size: 15px;
  letter-spacing: 0; color: #fff; text-transform: none; margin-bottom: 2px;
}

/* ---------- right pane ---------- */
.login-side { position: relative; }
.login-theme { position: absolute; top: 26px; right: 30px; border-radius: 999px !important; }

.login-card { max-width: 430px; padding: 38px 36px 34px; }
.login-card h1 { font-size: 27px; margin: 0 0 6px; }
.login-card .sub b { color: hsl(var(--primary)); font-weight: 600; }

/* boxed input with a leading icon and floating label */
.in-field {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  padding: 9px 14px; margin-bottom: 14px;
  cursor: text;
}
.in-field:focus-within { border-color: hsl(var(--primary)); box-shadow: 0 0 0 3px rgba(16,163,126,.12); }
.in-icon { color: hsl(var(--muted-foreground)); display: grid; place-items: center; flex: none; }
.in-field:focus-within .in-icon { color: hsl(var(--primary)); }
.in-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.in-label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--primary));
}
.in-body input {
  border: none; background: none; outline: none; padding: 0;
  font-family: var(--font-mono); font-size: 13.5px; color: hsl(var(--foreground));
  width: 100%;
}
.in-eye {
  background: none; border: none; cursor: pointer; flex: none;
  color: hsl(var(--muted-foreground)); display: grid; place-items: center;
}
.in-eye:hover { color: hsl(var(--primary)); }

.login-btn { gap: 9px; font-size: 12.5px; padding: 13px; }
.login-foot {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center;
  font-family: var(--font-mono); font-size: 10px;
  color: hsl(var(--muted-foreground)); opacity: .7; margin: 0;
}

@media (max-width: 900px) {
  .hero-stats { padding: 12px 20px; }
  .net-status { left: 20px; bottom: 88px; }
  .login-hero { padding: 24px 20px; min-height: 420px; }
}

/* topbar user dropdown */
.tb-userwrap { position: relative; }
.tb-user { cursor: pointer; font: inherit; }
.tb-user[aria-expanded="true"] { border-color: hsl(var(--primary)); }

.tb-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 232px; z-index: 1200;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 12px 34px rgba(0,0,0,.4);
  display: none;
}
.tb-menu.open { display: block; }

.tb-menu-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px; border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--accent));
}
.tb-menu-head > span:last-child { line-height: 1.3; min-width: 0; }
.tb-menu-head b {
  display: block; font-size: 12.5px; color: hsl(var(--foreground));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-menu-head span span {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}

.tb-menu-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 12px 15px;
  background: none; border: none; cursor: pointer;
  color: hsl(var(--foreground)); font: inherit; font-size: 13px;
  text-align: left;
}
.tb-menu-item:hover { background: rgba(239,68,68,.10); color: #dc2626; }
[data-theme="dark"] .tb-menu-item:hover { color: #f87171; }
.tb-menu-item svg { flex: none; }
