/* ============================================================================
   NoJack Track — client-grade UI theme
   Premium dark "security operations" look. Every class hook used by the
   markup/JS is preserved; this file restyles them.
   ============================================================================ */
:root {
  --bg: #0a0d13;
  --surface: #121723;
  --surface-2: #181f2e;
  --surface-3: #202a3c;
  --border: #263049;
  --border-soft: #1d2536;
  --text: #eef2f8;
  --muted: #98a4b8;
  --faint: #6b7688;
  --brand: #e6122a;
  --brand-2: #ff3344;
  --ok: #2ecc71;
  --warn: #f5a524;
  --off: #5b6677;
  --ring: rgba(230, 18, 42, 0.35);
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sh-3: 0 20px 60px rgba(0, 0, 0, 0.55);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 700px at 88% -10%, rgba(230, 18, 42, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(40, 80, 160, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.1px;
}

.view { height: 100vh; width: 100vw; }
.view.center { display: grid; place-items: center; padding: 20px; }
.view.col { display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- brand lockup (logo mark injected via CSS, no extra markup) ---------- */
.logo { display: inline-flex; align-items: center; gap: 11px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.4px; }
.logo::before {
  content: "";
  width: 1.55em; height: 1.55em; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='11' fill='%23e6122a'/%3E%3Cpath fill='%23fff' d='M20 9.2c-4.3 0-7.8 3.4-7.8 7.7 0 5.8 7.8 13.9 7.8 13.9s7.8-8.1 7.8-13.9c0-4.3-3.5-7.7-7.8-7.7zm0 10.6a2.85 2.85 0 1 1 0-5.7 2.85 2.85 0 0 1 0 5.7z'/%3E%3C/svg%3E") no-repeat center / contain;
  box-shadow: 0 6px 18px rgba(230, 18, 42, 0.4);
  border-radius: 12px;
}
.logo span { color: var(--brand); }
.logo.sm { font-size: 1.12rem; }

/* brand logo image (the NoJack Track wordmark banner) */
.brand-logo { display: block; width: 100%; max-width: 320px; height: auto; margin: 2px auto 4px; border-radius: 8px; }
.brand-logo.sm { width: auto; height: 30px; max-width: none; margin: 0; border-radius: 5px; }
.admin-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; color: var(--brand); text-transform: uppercase; align-self: center; }

/* ---------- login ---------- */
.card {
  width: min(380px, 94vw);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)) , var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 34px 30px 30px;
  box-shadow: var(--sh-3);
}
.card .logo { width: 100%; justify-content: center; margin-bottom: 6px; }
.card .sub { color: var(--muted); margin: 6px 0 24px; text-align: center; font-size: 0.92rem; }

label, #pw-form label, .card label {
  display: block; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
input {
  width: 100%; margin-top: 7px; padding: 12px 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); font-size: 0.95rem; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

button {
  cursor: pointer; border: none; border-radius: var(--r-sm);
  padding: 11px 18px; font-weight: 650; font-size: 0.9rem; font-family: inherit;
  color: #fff; background: linear-gradient(180deg, var(--brand-2), var(--brand));
  box-shadow: var(--sh-1); transition: filter 0.15s, transform 0.05s, background 0.15s;
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
button.ghost:hover { background: var(--surface-3); filter: none; }
button.danger { background: transparent; color: #ff8a8a; border: 1px solid #5a2b32; box-shadow: none; }
button.danger:hover { background: rgba(120, 30, 40, 0.25); filter: none; }
.card button { width: 100%; margin-top: 10px; padding: 13px; font-size: 0.95rem; }

.error { color: #ff7a7a; font-size: 0.85rem; margin: 14px 0 0; text-align: center; }
.muted { color: var(--muted); font-size: 0.88rem; }

/* ============================================================================
   Client app (mobile 3-tab)
   ============================================================================ */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; flex: none;
  background: linear-gradient(180deg, var(--surface), rgba(18, 23, 35, 0.92));
  border-bottom: 1px solid var(--border);
  box-shadow: var(--sh-1);
}
.chip {
  font-size: 0.72rem; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface-2);
}
.chip.all {
  color: #ffd9dc; border-color: rgba(230, 18, 42, 0.5);
  background: linear-gradient(180deg, rgba(230, 18, 42, 0.22), rgba(230, 18, 42, 0.10));
}

#app-view .tabpanel { flex: 1; min-height: 0; position: relative; overflow-y: auto; }
#panel-live { overflow: hidden; }
#map { height: 100%; width: 100%; background: #0a0d12; }

/* vehicle-list status dot — colour set inline from the ignition/motion/comms state */
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.5); }

/* ---------- vehicle map markers (heading arrow / stopped dot) ---------- */
/* divIcon wrapper has no chrome of its own; the glyph inside carries the colour. */
.veh-icon { background: none; border: none; }
.veh-arrow { width: 30px; height: 30px; display: block; transform-origin: 50% 50%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.veh-arrow path { fill: var(--c, var(--off)); stroke: #0a0d13; stroke-width: 1.3; stroke-linejoin: round; }
.veh-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--off)); border: 2px solid #0a0d13; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
/* the followed vehicle gets a soft ring so it stands out from the fleet */
.veh-icon.followed .veh-arrow { filter: drop-shadow(0 0 0 2px rgba(230, 18, 42, 0.9)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.veh-icon.followed .veh-dot { box-shadow: 0 0 0 3px rgba(230, 18, 42, 0.5), 0 1px 2px rgba(0, 0, 0, 0.6); }

/* ---------- "last known GPS" pin (shown when GPS is denied) ---------- */
.lastknown-icon { background: none; border: none; }
.lastknown {
  width: 14px; height: 14px; border-radius: 50%; position: relative;
  background: #e6edf6; border: 2px solid #0a0d13;
  box-shadow: 0 0 0 2px rgba(230, 237, 246, 0.55), 0 1px 3px rgba(0, 0, 0, 0.6);
}
.lastknown::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(230, 237, 246, 0.7); animation: lk-pulse 1.8s ease-out infinite;
}
@keyframes lk-pulse { 0% { transform: scale(0.55); opacity: 0.9; } 100% { transform: scale(1.9); opacity: 0; } }

/* ---------- live-LBS tower-hop labels ---------- */
.lbs-hop-label {
  background: var(--warn); color: #1a1205; font-weight: 800; font-size: 0.66rem;
  width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%;
  border: 1.5px solid #1a1205; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.lbs-hop-label.dim { background: #7a5a1a; color: #ffe6b0; opacity: 0.85; }
.track-note.live { color: #b9f0c8; background: rgba(46, 204, 113, 0.10); border-color: rgba(46, 204, 113, 0.30); }
.track-note.live .lbs-maps { color: #c8f0d4; }

/* live-track "following" card */
.track-card {
  position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 500;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 13px 15px; box-shadow: var(--sh-2);
}
.track-row { display: flex; align-items: center; gap: 13px; }
#track-history, #report-card-csv { margin: 0; }
.track-back { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); padding: 7px 11px; font-size: 0.8rem; border-radius: var(--r-sm); white-space: nowrap; }
.track-main { flex: 1; min-width: 0; }
.track-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.track-speed { font-weight: 800; font-size: 1.35rem; white-space: nowrap; text-align: right; line-height: 1; color: #fff; }
/* report: "towers used" chips (the LBS layer of a movement report) */
.report-towers { display: flex; flex-wrap: wrap; gap: 6px; max-height: 82px; overflow-y: auto; }
.report-towers .tower-chip {
  font-size: 0.72rem; line-height: 1; padding: 4px 9px; border-radius: 999px;
  background: rgba(245, 165, 36, 0.14); color: #f5a524;
  border: 1px solid rgba(245, 165, 36, 0.34); white-space: nowrap; cursor: default;
}
.report-towers .tower-chip.unresolved { opacity: 0.55; }
#report-lbs-toggle.active { background: rgba(245, 165, 36, 0.18); color: #f5a524; border-color: rgba(245, 165, 36, 0.5); }
/* Follow — live recovery navigation */
.follow-btn {
  width: 100%; margin-top: 8px; padding: 11px 14px; border: none; border-radius: var(--r-sm);
  background: #16a34a; color: #fff; font-weight: 750; font-size: 0.9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.follow-btn:hover { filter: brightness(1.06); }
.follow-btn.active { background: #dc2626; }
.follow-btn svg { fill: currentColor; }
.nav-bar {
  margin-top: 8px; padding: 9px 12px; border-radius: var(--r-sm); font-weight: 650; font-size: 0.85rem;
  background: rgba(22, 163, 74, 0.12); border: 1px solid rgba(22, 163, 74, 0.4); color: #bbf7d0;
}
.nav-bar.warn { background: rgba(245, 165, 36, 0.12); border-color: rgba(245, 165, 36, 0.4); color: #ffd9a8; }
.me-dot {
  width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 2px #2563eb, 0 1px 4px rgba(0, 0, 0, 0.5);
}
.track-speed small { display: block; font-weight: 600; color: var(--faint); font-size: 0.58rem; letter-spacing: 0.5px; margin-top: 3px; }
.overlay-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 400; pointer-events: none; padding: 24px; text-align: center; }

/* live-track actions (Maps / LBS / Details) */
.track-actions { display: flex; gap: 8px; }
.btn-mini {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 8px; font-size: 0.78rem; font-weight: 600;
  box-shadow: none; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-mini svg { width: 16px; height: 16px; fill: currentColor; flex: none; transition: transform 0.15s; }
.btn-mini:hover { background: var(--border); filter: none; }
.btn-mini:active { transform: translateY(1px); }
.btn-mini.active { border-color: var(--brand); color: #fff; background: rgba(230, 18, 42, 0.16); }
.btn-mini[aria-expanded="true"] svg { transform: rotate(180deg); }
.btn-mini.disabled, .btn-mini[aria-disabled="true"] { opacity: 0.42; pointer-events: none; }
.btn-mini:disabled { opacity: 0.6; cursor: default; }

/* LBS result note */
.track-note {
  font-size: 0.78rem; color: #ffe0a8; line-height: 1.55;
  background: rgba(245, 165, 36, 0.10); border: 1px solid rgba(245, 165, 36, 0.30);
  border-radius: var(--r-sm); padding: 8px 11px;
}
.track-note .lbs-maps { color: #ffd9a8; font-weight: 700; text-decoration: underline; }
.track-note .lbs-demo { color: var(--faint); font-style: italic; }

/* telemetry (GPS + Network parameter panels) */
.telemetry { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 40vh; overflow-y: auto; }
.tele-group { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 9px 11px; }
.tele-title { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.7px; color: var(--brand); font-weight: 700; margin-bottom: 7px; }
.tele-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 0.76rem; border-bottom: 1px solid var(--border-soft); }
.tele-row:last-child { border-bottom: none; }
.tele-row .tk { color: var(--muted); white-space: nowrap; }
.tele-row .tv { color: var(--text); font-weight: 600; text-align: right; word-break: break-all; }
.tele-empty { color: var(--muted); font-size: 0.8rem; padding: 6px 2px; }
@media (max-width: 380px) { .telemetry { grid-template-columns: 1fr; } }

/* vehicles tab */
.search-row { padding: 10px 14px 6px; display: flex; align-items: center; gap: 10px; }
.search-row input { margin: 0; flex: 1; }
.veh-count { font-size: 0.74rem; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* ---------- fleet object panel (Trakzee-style redesign) ---------- */
.fleet-status { display: flex; align-items: center; gap: 14px; padding: 12px 14px 2px; }
.fleet-donut { width: 88px; height: 88px; flex: none; }
.donut-svg { width: 100%; height: 100%; }
.donut-num { font-size: 8px; font-weight: 800; fill: var(--text); text-anchor: middle; }
.donut-lbl { font-size: 2.6px; fill: var(--muted); text-anchor: middle; text-transform: uppercase; letter-spacing: 0.4px; }
.fleet-pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.pill {
  display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--pc, var(--border));
  border-radius: var(--r-sm); padding: 5px 9px; min-width: 54px;
}
.pill:hover { background: var(--surface-3); }
.pill.active { background: color-mix(in srgb, var(--pc) 18%, var(--surface-2)); border-color: var(--pc); }
.pill .pill-n { font-weight: 800; font-size: 0.95rem; color: var(--pc, var(--text)); line-height: 1; }
.pill .pill-l { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.pill.total { border-left-color: var(--border); }
.pill.total .pill-n { color: var(--text); }

.object-list { list-style: none; margin: 0; padding: 6px 12px 18px; }
.obj-row {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 8px 10px 12px; margin-bottom: 7px; transition: border-color 0.15s, background 0.15s;
}
.obj-row:hover { border-color: rgba(230, 18, 42, 0.4); }
.obj-row.sel { border-color: var(--brand); background: var(--surface-2); }
.obj-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); margin-top: 4px; flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }
.obj-text { flex: 1; min-width: 0; }
.obj-l1 { display: flex; align-items: center; gap: 8px; }
.obj-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-plate { flex: none; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: var(--surface-2); }
.obj-l2 { color: var(--muted); font-size: 0.78rem; margin-top: 3px; }
.obj-tele { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip3 { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px 1px 5px; }
.chip3 svg { width: 12px; height: 12px; fill: var(--faint); }
.chip3 i { font-style: normal; }
.chip3.on { color: #bff0cf; background: rgba(54, 194, 91, 0.14); border-color: rgba(54, 194, 91, 0.35); }
.chip3.on svg { fill: #36c25b; }
.chip3.off { opacity: 0.7; }
.obj-addr { color: var(--faint); font-size: 0.72rem; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-menu-btn { flex: none; align-self: center; background: none; border: none; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 4px 7px; cursor: pointer; border-radius: var(--r-sm); }
.obj-menu-btn:hover { background: var(--surface-3); color: var(--text); }
.obj-menu { position: fixed; z-index: 1200; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--sh-3); padding: 5px; min-width: 184px; }
.obj-menu-item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); font-size: 0.85rem; padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; }
.obj-menu-item:hover { background: var(--surface-2); }
/* activity reports dialog */
.wide-dialog { width: min(680px, 94vw); }
.activity-results { max-height: 48vh; overflow: auto; margin: 12px 0 4px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.act-grid { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.act-grid th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 8px 10px; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.act-grid td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.act-grid tbody tr:hover { background: var(--surface-2); }
#activity-types { gap: 6px; }
#activity-types .preset { font-weight: 600; }
/* fleet records (admin) — module tabs + form select */
.rec-modtabs { display: flex; flex-wrap: wrap; gap: 8px; }
.rec-modtab { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 14px; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.rec-modtab:hover { background: var(--surface-3); }
.rec-modtab.active { border-color: var(--brand); color: #fff; background: rgba(230, 18, 42, 0.18); }
#rec-form select { flex: 1 1 180px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font-size: 0.95rem; }
.edit-profile { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-profile input { margin: 0; width: 100%; }
.place-pin { width: 12px; height: 12px; border-radius: 50% 50% 50% 0; background: #7c3aed; border: 2px solid #fff; transform: rotate(-45deg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input { flex: 1; margin: 0; font-size: 0.82rem; }
#share-dialog select { width: 100%; margin-top: 7px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); }
.vehicle-list { list-style: none; margin: 0; padding: 8px 14px 18px; }
.vehicle-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 13px 15px; margin-bottom: 11px; cursor: pointer;
  box-shadow: var(--sh-1); transition: border-color 0.15s, transform 0.08s, background 0.15s;
}
.vehicle-card:hover { border-color: rgba(230, 18, 42, 0.45); }
.vehicle-card:active { transform: scale(0.995); background: var(--surface-2); }
.vehicle-card .top { display: flex; align-items: center; gap: 10px; }
.vehicle-card .vname { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-card .vplate {
  margin-left: auto; flex: none; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.5px;
  color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; background: var(--surface-2);
}
.vehicle-card .vmeta { color: var(--muted); font-size: 0.82rem; margin-top: 7px; padding-left: 19px; }
.vehicle-card .vowner {
  display: inline-block; margin-top: 9px; margin-left: 19px; font-size: 0.7rem; font-weight: 600;
  color: #ffd0d4; background: rgba(230, 18, 42, 0.14); border: 1px solid rgba(230, 18, 42, 0.3);
  padding: 2px 9px; border-radius: 999px;
}
.pad { padding: 18px; }

/* trips tab */
.trips-controls { padding: 14px 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.trip-select { width: 100%; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font-size: 0.95rem; }
.trip-select:focus { outline: none; border-color: var(--brand); }
#trip-presets { margin-bottom: 0; }
.trip-list { list-style: none; margin: 0; padding: 8px 14px 18px; }
.trip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; box-shadow: var(--sh-1); transition: border-color 0.15s, background 0.15s; }
.trip-card:hover { border-color: rgba(230, 18, 42, 0.45); }
.trip-card:active { background: var(--surface-2); }
.trip-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.trip-day { font-weight: 700; }
.trip-time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.trip-stats { color: var(--text); font-size: 0.85rem; margin-top: 6px; }
.trip-addr { color: var(--muted); font-size: 0.78rem; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* settings tab */
.settings { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.set-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px 17px; box-shadow: var(--sh-1); }
.set-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); font-weight: 600; }
.set-value { font-weight: 700; margin-top: 5px; font-size: 1.05rem; }
.set-sub { color: var(--muted); font-size: 0.85rem; margin-top: 5px; line-height: 1.5; }
button.wide, a.wide { width: 100%; text-align: center; padding: 14px; font-size: 0.92rem; }
a.wide { text-decoration: none; display: block; }

/* bottom nav */
.bottomnav { flex: none; display: flex; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0); }
.navbtn {
  flex: 1; background: transparent; color: var(--faint); border: none; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 11px; font-size: 0.68rem; font-weight: 650; letter-spacing: 0.2px;
  position: relative; box-shadow: none;
}
.navbtn svg { width: 23px; height: 23px; fill: currentColor; }
.navbtn:hover { background: transparent; filter: none; color: var(--muted); }
.navbtn:active { transform: none; }
.navbtn.active { color: var(--brand); }
.navbtn.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

/* ---------- desktop / control-room split view (panel + map side by side) ---------- */
@media (min-width: 980px) {
  #app-view.col {
    display: grid;
    grid-template-columns: 384px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "bar bar" "side main" "side nav";
  }
  .appbar { grid-area: bar; }
  /* the fleet object panel is ALWAYS visible on the left, regardless of the active tab */
  #panel-vehicles { grid-area: side; display: block !important; border-right: 1px solid var(--border); }
  #panel-live, #panel-trips, #panel-settings { grid-area: main; min-width: 0; }
  .bottomnav { grid-area: nav; justify-content: flex-start; }
  .bottomnav .navbtn { flex: none; min-width: 120px; flex-direction: row; gap: 8px; padding: 12px 18px; }
  .bottomnav .navbtn span { font-size: 0.82rem; }
  .navbtn[data-tab="vehicles"] { display: none; } /* redundant — panel is always shown */
  .navbtn.active::before { left: 0; right: 0; }
  /* the track/report cards float over the right-hand map, capped to a sensible width */
  #panel-live .track-card { max-width: 420px; }
}

/* ---------- dialog ---------- */
dialog {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; width: min(380px, 92vw);
  box-shadow: var(--sh-3);
}
dialog::backdrop { background: rgba(5, 7, 12, 0.7); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 18px; font-size: 1.1rem; }
dialog menu { display: flex; gap: 10px; justify-content: flex-end; padding: 0; margin: 10px 0 0; flex-wrap: wrap; }
dialog menu button { width: auto; }
.report-hint { color: var(--muted); font-size: 0.85rem; margin: -6px 0 16px; }
.presets { display: flex; gap: 8px; margin-bottom: 16px; }
.preset { flex: 1; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 9px 4px; font-size: 0.82rem; box-shadow: none; }
.preset:hover { background: var(--surface-3); filter: none; }
.preset.active { border-color: var(--brand); color: #fff; background: rgba(230, 18, 42, 0.18); }

.leaflet-popup-content { font-size: 0.85rem; }
.leaflet-control-attribution { font-size: 0.62rem; opacity: 0.6; }

/* ============================================================================
   Admin / control-room back-office console
   ============================================================================ */
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: linear-gradient(180deg, var(--surface), rgba(18, 23, 35, 0.92)); border-bottom: 1px solid var(--border); box-shadow: var(--sh-1); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 0.86rem; }
a.ghost { text-decoration: none; line-height: 1; padding: 9px 14px; display: inline-block; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-size: 0.85rem; }
a.ghost:hover { background: var(--surface-3); }

.badge { font-size: 0.7rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface-2); }
.badge.ok { color: #9af0c0; border-color: rgba(46, 204, 113, 0.4); background: rgba(46, 204, 113, 0.12); }
.badge.warn { color: #ffe0a8; border-color: rgba(245, 165, 36, 0.4); background: rgba(245, 165, 36, 0.12); }
.badge.bad { color: #ffb0b0; border-color: rgba(230, 18, 42, 0.4); background: rgba(230, 18, 42, 0.12); }

.tabs { display: flex; gap: 6px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: var(--r-sm); padding: 9px 16px; box-shadow: none; font-weight: 600; }
.tab:hover { color: var(--text); background: var(--surface-2); filter: none; }
.tab.active { color: #fff; background: var(--surface-3); border-color: var(--border); }

.admin-main { flex: 1; overflow-y: auto; padding: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--sh-1); }
.panel h3 { margin: 0 0 16px; font-size: 1rem; display: flex; align-items: center; gap: 12px; }
.panel h3 button { font-size: 0.78rem; padding: 6px 13px; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.form-row input { width: auto; flex: 1 1 160px; margin-top: 0; }
.form-row button { flex: none; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.grid th { text-align: left; color: var(--faint); font-weight: 600; padding: 10px 11px; border-bottom: 1px solid var(--border); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
table.grid td { padding: 11px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.grid tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
table.grid input { margin: 0; padding: 7px 9px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { font-size: 0.76rem; padding: 6px 11px; }

.pill { font-size: 0.7rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); }
.pill.ok { color: #9af0c0; border-color: rgba(46, 204, 113, 0.4); background: rgba(46, 204, 113, 0.1); }
.pill.bad { color: #ffb0b0; border-color: rgba(230, 18, 42, 0.4); background: rgba(230, 18, 42, 0.1); }

.assign-list { max-height: 52vh; overflow-y: auto; margin-bottom: 14px; }
.assign-row { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); color: var(--text); font-size: 0.92rem; }
.assign-row input { width: auto; margin: 0; }
