:root {
  --bg: #080e1a;
  --panel: #111a2e;
  --panel-2: #1a2540;
  --panel-3: #22304f;
  --line: #26324d;
  --text: #e8eef9;
  --muted: #8a9ab8;
  --accent: #10b981;
  --accent-2: #059669;
  --cyan: #06b6d4;
  --indigo: #6366f1;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --blue: #3b82f6;
  --grad: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --grad-hero: linear-gradient(135deg, #0b3b46 0%, #0b1f3a 45%, #1e1b4b 100%);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.6), 0 2px 6px -2px rgba(0,0,0,.35);
  --radius: 14px;
  --side: 360px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.bad { color: #fca5a5; }
.pad { padding: 12px; }
.pad-x { padding: 6px 16px; }
a { color: var(--blue); }
h2 { margin: 0; font-size: 18px; }
h3 { margin: 0; font-size: 16px; }
h4 { margin: 16px 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
body:not(.is-admin) .admin-only { display: none !important; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; font-size: 16px; }
.brand.plain { background: none; border: 0; color: var(--text); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; padding: 0; }
.brand.big { font-size: 24px; }
.logo { width: 26px; height: 26px; border-radius: 8px; flex: none; background:
  radial-gradient(circle at 50% 42%, #fff 0 3px, transparent 4px),
  conic-gradient(from 200deg, var(--accent), #0ea5e9, var(--accent)); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.brand.big .logo { width: 34px; height: 34px; }

/* Buttons & inputs */
.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px;
  padding: 9px 14px; font: inherit; cursor: pointer; text-decoration: none; text-align: center; display: inline-block; white-space: nowrap; }
.btn:hover { border-color: #3b4756; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent); }
.btn.danger { border-color: rgba(239,68,68,.5); color: #fca5a5; background: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.full { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.active { border-color: var(--accent-2); color: var(--accent); }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; font-size: 16px; flex: none; }
.icon-btn:disabled { opacity: .4; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 9px 10px; font: inherit; width: 100%; }
textarea { resize: vertical; }
select.auto { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(34,197,94,.4); border-color: var(--accent-2); }
input:disabled { opacity: .6; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; margin-top: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 8px; margin-top: 10px; align-items: end; }
.row.quick { flex-wrap: wrap; }
.row > label { flex: 1; min-width: 0; }
.row input[type=datetime-local] { font-size: 12px; padding: 8px 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form h4 { margin: 8px 0 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.checks label.check { margin-top: 4px; font-size: 12px; }
.hint { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #bfdbfe; border-radius: 8px; padding: 8px 10px; margin: 0; }
.seg { display: flex; gap: 6px; }
.seg-opt { flex: 1; flex-direction: row; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; cursor: pointer; color: var(--text); font-size: 13px; }
.seg-opt input { width: auto; margin: 0; }
.seg-opt:has(input:checked) { border-color: var(--blue); background: rgba(59,130,246,.12); }
.seg-opt.safe:has(input:checked) { border-color: var(--accent); background: rgba(34,197,94,.12); }
.seg-opt.red:has(input:checked) { border-color: var(--danger); background: rgba(239,68,68,.12); }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(800px 400px at 20% 10%, rgba(34,197,94,.12), transparent), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card p { margin: 0; }

/* Layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: 56px 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button { position: relative; background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.nav button:hover { color: var(--text); background: var(--panel-2); }
.nav button.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-sep { width: 1px; background: var(--line); margin: 6px 4px; flex: none; }
.nbadge { background: var(--danger); color: #fff; border-radius: 99px; font-size: 10px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center; }
.top-right { display: flex; gap: 8px; margin-left: auto; align-items: center; flex: none; }
.user-btn { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill b { color: var(--text); }
.pill.live { color: var(--accent); }
.pill.live.off { color: var(--danger); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; grid-row: 2; grid-column: 1; }
.map-wrap { position: relative; isolation: isolate; min-width: 0; grid-row: 2; grid-column: 2; }
#map { position: absolute; inset: 0; background: #0b0f13; }
#map.drawing { cursor: crosshair; }
.map-controls { position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.map-controls .btn { background: rgba(22,28,35,.92); backdrop-filter: blur(4px); }
.mobile-only { display: none; }
.panel-head { padding: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }

/* Pages (cover sidebar + map) */
.page { grid-row: 2; grid-column: 1 / -1; z-index: 1200; background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.page-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head input[type=search] { max-width: 420px; }
.page-body { flex: 1; overflow: auto; padding: 0 16px 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.filters label { min-width: 0; flex: 0 1 180px; }
.filters label.check { flex: none; margin: 0 0 8px; }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column;
  align-items: flex-start; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.stat:disabled { cursor: default; }
.stat:not(:disabled):hover { border-color: #3b4756; }
.stat .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat.on .v { color: var(--accent); }
.stat.off .v { color: var(--muted); }
.stat.warn .v { color: var(--warn); }

/* Device list */
.side-head { padding: 12px; position: sticky; top: 0; background: var(--panel); z-index: 2; border-bottom: 1px solid var(--line); }
.device-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dev { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; background: var(--panel-2);
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.dev:hover { border-color: #3b4756; }
.dev.selected { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.dev .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .plate { font-weight: 500; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.dev .speed { font-weight: 700; font-variant-numeric: tabular-nums; }
.dev .owner { grid-column: 2 / 4; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dev .alarm { grid-column: 1 / 4; color: #fca5a5; font-size: 12px; }
.badge { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.4); border-radius: 99px; padding: 0 7px; cursor: pointer; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4b5563; display: inline-block; flex: none; }
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.moving { background: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 8px; }
.empty code { display: block; margin-top: 10px; padding: 10px; background: var(--bg); border-radius: 8px; color: var(--accent); word-break: break-all; }

/* Detail */
.detail-head { display: flex; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.d-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 11px 2px; font: inherit; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab { padding: 14px; }
.subtabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.subtabs button { background: none; border: 0; color: var(--muted); padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; }
.subtabs button.active { color: var(--text); border-bottom-color: var(--blue); }
.subtab { padding-top: 6px; }
.status-banner { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 12px; }
.status-banner.alarm { border-color: rgba(239,68,68,.5); color: #fca5a5; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cell { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-width: 0; }
.cell .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.cell .v { font-weight: 600; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell.wide { grid-column: 1 / -1; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.event-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ev { padding: 9px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ev .t { color: var(--muted); font-size: 11px; }
.ev.alarm { border-color: rgba(239,68,68,.45); }
.ev.command { border-color: rgba(59,130,246,.4); }
.ev.command_reply { border-color: rgba(34,197,94,.4); }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.playback { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.playback input[type=range] { flex: 1; padding: 0; }
.playback select { width: auto; }
.list { display: flex; flex-direction: column; gap: 6px; }
.li { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; }
.li:hover { border-color: #3b4756; }
.li.active { border-color: var(--blue); }
.chart { width: 100%; height: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.chart .bar { fill: var(--blue); }
.chart .bar:hover { fill: #60a5fa; }
.chart .lbl { fill: var(--muted); font-size: 9px; text-anchor: middle; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; font-variant-numeric: tabular-nums; }
table.mini th, table.mini td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.mini th { color: var(--muted); font-weight: 600; }

/* Alerts */
.alert-list { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--blue); border-radius: 8px; cursor: pointer; }
.alert-row:hover { border-color: #3b4756; }
.alert-row.sev-critical { border-left-color: var(--danger); }
.alert-row.sev-warning { border-left-color: var(--warn); }
.alert-row.read { opacity: .65; }
.alert-row.unread .al-title b::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-left: 6px; vertical-align: middle; }
.sev-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--blue); }
.sev-critical .sev-dot { background: var(--danger); }
.sev-warning .sev-dot { background: var(--warn); }
.al-actions { display: flex; gap: 4px; }

/* Zones */
.zone-list { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 12px; }
.zone { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.zone:hover { border-color: #3b4756; }
.zone.inactive { opacity: .6; }
.zone .name { font-weight: 600; }
.swatch { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; flex: none; }
.zh { border-radius: 50%; border: 2px solid #fff; background: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.zh.center { background: #fff; border-color: #111; }

/* Admin tables */
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.admin { border-color: rgba(245,158,11,.5); color: #fcd34d; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; font-size: 12px; background: var(--panel-2); margin: 1px 2px; cursor: default; }
.chip[data-imei] { cursor: pointer; }
.chip .x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; font-size: 12px; }
.chip .x:hover { color: var(--danger); }
.dv-table td.actions { text-align: right; }
.dv-table td.actions .btn { margin-left: 4px; }
.dv-table tr.inactive td { opacity: .55; }

/* Data page */
.dv-head { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dv-tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; }
.dv-tabs button { background: none; border: 0; color: var(--muted); padding: 13px 14px; font: inherit; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.dv-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.dv-dev { flex: 1 1 200px !important; max-width: 280px; }
.dv-date { flex: 0 1 200px; }
.dv-date input { font-size: 12px; padding: 8px 6px; }
.dv-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.dv-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; }
.dv-bar input { max-width: 280px; padding: 7px 10px; }
.dv-bar .muted { flex: 1; min-width: 0; }
.dv-table-wrap { flex: 1; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 0; }
.dv-table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.dv-table th, .dv-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
.dv-table th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 600; z-index: 1;
  text-transform: uppercase; font-size: 11px; letter-spacing: .3px; }
.dv-table tbody tr:hover { background: var(--panel); }
.dv-table td.num { text-align: right; }
.dv-table td.hex { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: normal; word-break: break-all; min-width: 320px; max-width: 620px; }
.dv-table td.wrap { white-space: normal; min-width: 160px; max-width: 420px; }
.dv-table .yes { color: var(--accent); }
.dv-table .no { color: var(--muted); }
.dv-table tr.alarm td { background: rgba(239,68,68,.08); }
.dv-table .linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.dv-empty { padding: 30px; text-align: center; color: var(--muted); }
.dv-pager { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: var(--panel); }
.dv-pager span { flex: 1; text-align: center; }
.dv-pager select { width: auto; padding: 6px 8px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal.wide { width: min(620px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-body p { margin: 0 0 8px; }
.modal-error { padding: 0 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-actions .btn.danger { margin-right: auto; }
pre.cred { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-all; font-size: 13px; user-select: all; }
.share-out { display: flex; gap: 6px; margin-top: 10px; }

/* Map markers */
.veh { width: 34px; height: 34px; position: relative; }
.veh svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); transition: transform .4s; }
.veh-badge { position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 99px; padding: 0 5px; border: 2px solid #0b0f13; line-height: 14px; }
.veh-label { background: rgba(15,20,25,.9); color: #fff; border: 0; border-radius: 6px; padding: 2px 7px; font-size: 11px; box-shadow: none; }
.veh-label::before { display: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-tooltip { background: var(--panel); color: var(--text); border-color: var(--line); }

/* Share page */
.share-view { position: fixed; inset: 0; }
#shareMap { position: absolute; inset: 0; background: #0b0f13; }
.share-card { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 1000; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* Toasts */
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 14px; min-width: 240px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: in .2s ease-out; }
.toast.clickable { cursor: pointer; }
.toast.alarm { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

/* Mobile */
@media (max-width: 1100px) {
  .nav .lb { display: none; }
  .nav button { padding: 8px; font-size: 16px; }
  .nbadge { position: absolute; top: 0; right: -2px; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 100px 1fr; }
  .topbar { flex-wrap: wrap; align-content: center; row-gap: 4px; }
  .nav { order: 10; flex-basis: 100%; justify-content: space-between; }
  .map-wrap { grid-column: 1; }
  .page { grid-column: 1; }
  .mobile-only { display: inline-block; }
  .hide-sm, .brand-text { display: none; }
  .topbar { gap: 6px; padding: 0 8px; }
  .top-right { gap: 4px; }
  .user-btn { max-width: 40px; }
  #logoutBtn { display: none; }
  .sidebar { position: fixed; top: 100px; bottom: 0; left: 0; width: min(92vw, var(--side)); z-index: 1300;
    transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .filters label, .dv-dev, .dv-date { flex: 1 1 45% !important; max-width: none; }
  .dv-bar { flex-wrap: wrap; }
  .dv-bar input { flex: 1 1 60%; max-width: none; }
  .dv-bar .muted { order: 3; flex-basis: 100%; }
  .page-head input[type=search] { order: 5; flex-basis: 100%; max-width: none; }
  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
}

/* ---------- loading (animated) ---------- */
@keyframes ts-spin { to { transform: rotate(360deg); } }
@keyframes ts-bar { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes ts-fade { from { opacity: 0; } to { opacity: 1; } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: ts-spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
.busy-overlay { position: absolute; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 20, 25, .45); backdrop-filter: blur(1.5px); animation: ts-fade .2s ease; pointer-events: all; }
.busy-card { position: relative; overflow: hidden; min-width: 220px; padding: 18px 22px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); text-align: center; }
.busy-card .ring { width: 38px; height: 38px; margin: 0 auto 10px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-right-color: var(--accent); border-radius: 50%; animation: ts-spin .9s linear infinite; }
.busy-card .t { font-weight: 600; }
.busy-card .s { color: var(--muted); font-size: 12px; margin-top: 4px; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.busy-card .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--panel-2); overflow: hidden; }
.busy-card .bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--accent); animation: ts-bar 1.1s ease-in-out infinite; }
.dv-table-wrap, .map-wrap { position: relative; }
@media (prefers-reduced-motion: reduce) { .spin, .busy-card .ring, .busy-card .bar::after { animation-duration: 3s; } }


/* =====================================================================
   v2.1 theme — navy + emerald→cyan gradient (same design language as the mobile app)
   ===================================================================== */
body { background: radial-gradient(1200px 600px at 100% -10%, rgba(6,182,212,.07), transparent 60%), var(--bg); }
::selection { background: rgba(16,185,129,.35); }
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.logo { border-radius: 9px; background: radial-gradient(circle at 50% 42%, #fff 0 3px, transparent 4px), var(--grad);
  box-shadow: 0 4px 14px -4px rgba(16,185,129,.7); }

/* Buttons / inputs */
.btn { border-radius: 10px; transition: border-color .15s, background .15s, transform .1s, box-shadow .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 20px -10px rgba(6,182,212,.8); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.08); box-shadow: 0 10px 24px -10px rgba(6,182,212,1); }
.btn.active { border-color: var(--accent); color: var(--accent); background: rgba(16,185,129,.1); }
.icon-btn { border-radius: 10px; display: inline-grid; place-items: center; transition: background .15s, border-color .15s; }
.icon-btn:hover { background: var(--panel-2); border-color: #34446a; }
input, select, textarea { background: #0c1424; border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }

/* Top bar */
.topbar { background: linear-gradient(90deg, #0b1220 0%, #0f1d33 55%, #10243a 100%); border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 6px 20px -12px rgba(0,0,0,.8); position: relative; z-index: 1300; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--grad); opacity: .55; }
.nav { gap: 4px; }
.nav button { border-radius: 10px; padding: 8px 12px; transition: color .15s, background .15s; }
.nav button .i { width: 17px; height: 17px; }
.nav button:hover { background: rgba(255,255,255,.05); }
.nav button.active { color: #fff; background: linear-gradient(135deg, rgba(16,185,129,.22), rgba(6,182,212,.18)); box-shadow: inset 0 0 0 1px rgba(16,185,129,.35); }
.nav button.active .i { color: #34d399; }
.pill { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.user-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; max-width: 200px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--grad);
  color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sidebar + cards */
.sidebar { background: linear-gradient(180deg, #0f182b, #0d1526); border-right-color: rgba(255,255,255,.06); }
.side-head, .panel-head, .tabs { background: #0f182b; }
.stat { border-radius: 12px; background: linear-gradient(160deg, var(--panel-2), #151f36); transition: border-color .15s, transform .15s; }
.stat:not(:disabled):hover { transform: translateY(-1px); border-color: #34446a; }
.dev { border-radius: 14px; background: linear-gradient(160deg, #18233c, #131c31); transition: border-color .15s, transform .15s, box-shadow .15s; }
.dev:hover { border-color: #34446a; transform: translateY(-1px); box-shadow: var(--shadow); }
.dev.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 10px 24px -14px rgba(16,185,129,.7); }
.dot.on { background: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.dot.moving { background: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,.22); }
.cell, .ev, .li, .zone, .status-banner { border-radius: 12px; }
.tabs button.active, .dv-tabs button.active { border-bottom-color: var(--cyan); }
.page-head, .filters, .dv-head, .dv-pager { background: #0f182b; }
.alert-row { border-radius: 12px; }
.modal { border-radius: 18px; background: linear-gradient(180deg, #131d33, #0f182b); }
.map-controls .btn { background: rgba(17,26,46,.9); border-color: rgba(255,255,255,.1); }
.veh-label { background: rgba(11,18,32,.92); border-radius: 8px; }
.toast { border-radius: 12px; background: #131d33; }
.chart .bar { fill: var(--cyan); }

/* ---------- Login (split hero) ---------- */
.login { display: grid; grid-template-columns: 1.15fr 1fr; padding: 0; place-items: stretch; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.login-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: 48px clamp(28px, 6vw, 80px); background: var(--grad-hero); }
.login-hero h1 { margin: 0; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.12; letter-spacing: -.5px; position: relative; }
.login-hero p { margin: 0; max-width: 460px; font-size: 15px; position: relative; color: #b7c5de; }
.login-hero .brand { position: relative; }
.login-art { width: min(440px, 90%); height: auto; position: relative; filter: drop-shadow(0 24px 40px rgba(0,0,0,.45)); animation: ts-float 6s ease-in-out infinite; }
.feat { display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.feat span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; font-size: 13px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.feat .i { color: #5eead4; width: 16px; height: 16px; }
.login-side { display: grid; place-items: center; padding: 32px 20px;
  background: radial-gradient(500px 300px at 80% 0%, rgba(16,185,129,.1), transparent), var(--bg); }
.login-card { width: min(400px, 100%); border-radius: 22px; padding: 32px; gap: 16px; background: linear-gradient(180deg, rgba(26,37,64,.75), rgba(17,26,46,.85));
  border: 1px solid rgba(255,255,255,.08); box-shadow: 0 30px 60px -30px rgba(0,0,0,.8); backdrop-filter: blur(10px); animation: ts-rise .5s ease both; }
.login-card h2 { font-size: 26px; letter-spacing: -.3px; }
.login-card input { padding: 12px; }
.big-btn { padding: 13px; font-size: 15px; margin-top: 4px; }
.mobile-brand { display: none; }

@media (min-width: 801px) { .mobile-only { display: none !important; } }

/* ---------- Home dashboard ---------- */
#homePage { overflow: auto; }
.home { width: 100%; max-width: 1320px; margin: 0 auto; padding: 22px clamp(14px, 2.5vw, 28px) 40px; display: flex; flex-direction: column; gap: 18px; }
.home h3 { font-size: 16px; }
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 30px 34px; display: flex; align-items: center; gap: 24px;
  background: var(--grad-hero); border: 1px solid rgba(255,255,255,.08); box-shadow: var(--shadow); }
.hero-glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
.hero-glow.a { width: 320px; height: 320px; background: #10b981; left: -80px; top: -140px; opacity: .35; }
.hero-glow.b { width: 380px; height: 380px; background: #6366f1; right: 10%; bottom: -220px; opacity: .35; }
.hero-text { position: relative; flex: 1; min-width: 0; }
.hero-greet { color: #b7c5de; font-size: 14px; }
.hero-greet b { color: #fff; }
.hero h1 { margin: 6px 0 4px; font-size: clamp(24px, 2.6vw, 34px); letter-spacing: -.4px; line-height: 1.15; }
.hero h1 .gt { background: linear-gradient(90deg, #34d399, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-tag { margin: 0 0 16px; color: #9fb0cf; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hchip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px; font-size: 13px; color: #e8eef9;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.hchip .i { width: 15px; height: 15px; color: #5eead4; }
.btn-chip { font: inherit; font-size: 13px; cursor: pointer; background: var(--grad); border: 0; color: #fff; font-weight: 600; box-shadow: 0 8px 20px -10px rgba(6,182,212,.9); }
.btn-chip .i { color: #fff; }
.btn-chip:hover { filter: brightness(1.08); }
.hero-art { position: relative; width: min(340px, 34%); height: auto; flex: none; filter: drop-shadow(0 20px 30px rgba(0,0,0,.4)); animation: ts-float 6s ease-in-out infinite; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpis.six { grid-template-columns: repeat(6, 1fr); }
.kpi { position: relative; overflow: hidden; text-align: left; font: inherit; color: var(--text); cursor: default; display: flex; flex-direction: column; gap: 4px;
  padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(160deg, #18233c, #111a2e); box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s; }
.home.intro .hero, .home.intro .kpi, .home.intro .card, .home.intro .vcard { animation: ts-rise .45s ease both; }
.kpis .kpi:nth-child(2) { animation-delay: .05s; } .kpis .kpi:nth-child(3) { animation-delay: .1s; } .kpis .kpi:nth-child(4) { animation-delay: .15s; }
.kpis .kpi:nth-child(5) { animation-delay: .2s; } .kpis .kpi:nth-child(6) { animation-delay: .25s; }
.kpi.link { cursor: pointer; }
.kpi.link:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.kpi-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #0b1220)); box-shadow: 0 8px 18px -8px var(--c); }
.kpi-ic .i { width: 20px; height: 20px; }
.kpi-v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-k { color: var(--muted); font-size: 12.5px; }
.kpi-glow { position: absolute; width: 140px; height: 140px; right: -50px; top: -60px; border-radius: 50%; background: var(--c); opacity: .14; filter: blur(30px); pointer-events: none; }

.home-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 14px; }
.card { background: linear-gradient(180deg, #131d33, #111a2e); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent); font-weight: 600; }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ts-pulse 1.8s ease-out infinite; }
.donut-wrap { display: flex; align-items: center; gap: 22px; min-height: 180px; }
.donut { width: 170px; height: 170px; flex: none; }
.donut circle { transition: stroke-dasharray .8s ease, stroke-dashoffset .8s ease; }
.donut-v { fill: var(--text); font-size: 30px; font-weight: 800; text-anchor: middle; }
.donut-k { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lg { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.03); }
.lg b { font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pct { width: 38px; text-align: right; }

.week-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.week-top > div:first-child { flex: 1; }
.week-total { font-size: 28px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.week-total small { font-size: 14px; color: var(--muted); font-weight: 600; }
.mini { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.mini > .i { color: var(--c); }
.mini small { display: block; color: var(--muted); font-size: 11px; }
.mini b { font-size: 13px; }
.bars { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 170px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.bar-track { flex: 1; width: 100%; max-width: 38px; border-radius: 10px; background: rgba(255,255,255,.04); display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; border-radius: 10px; background: linear-gradient(180deg, #22d3ee, #10b981); transform-origin: bottom; animation: ts-grow .7s cubic-bezier(.2,.8,.2,1) both; }
.bar-col.today .bar-fill { background: linear-gradient(180deg, #a5b4fc, #6366f1); box-shadow: 0 0 18px -4px #6366f1; }
.bar-v { font-size: 11px; font-weight: 700; min-height: 14px; font-variant-numeric: tabular-nums; }
.bar-l { font-size: 11px; color: var(--muted); }
.bar-col.today .bar-l { color: #a5b4fc; font-weight: 700; }
.bars-empty { position: absolute; inset: 0 0 40px; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.vcard { position: relative; overflow: hidden; padding: 16px; border-radius: 18px; cursor: pointer; border: 1px solid var(--line);
  background: linear-gradient(160deg, #18233c, #111a2e); box-shadow: var(--shadow); transition: transform .18s, border-color .18s; }
.vcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: .9; }
.vcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.vc-top { display: flex; align-items: center; gap: 12px; }
.vc-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 50%, #0b1220)); box-shadow: 0 8px 18px -8px var(--c); }
.vc-ic .i { width: 23px; height: 23px; }
.vc-name { font-weight: 700; font-size: 15px; }
.plate { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--text); }
.spill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.spill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.spill i.pulse { animation: ts-pulse 1.6s ease-out infinite; }
.vc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.vc-metrics > div { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.035); min-width: 0; }
.vc-metrics .mi { grid-row: 1 / 3; display: grid; }
.vc-metrics b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vc-metrics small { color: var(--muted); font-size: 10.5px; }
.vc-warn { margin-top: 10px; color: #fda4af; font-size: 12px; font-weight: 600; }
.vcard .nbadge { flex: none; }
.empty-card { grid-column: 1 / -1; text-align: center; padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-card img { max-width: 200px; height: auto; }
.empty-card p { margin: 0; max-width: 420px; }

.alerts-card { padding: 6px; }
.al { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; cursor: pointer; transition: background .15s; }
.al + .al { border-top: 1px solid rgba(255,255,255,.04); }
.al:hover { background: rgba(255,255,255,.04); }
.al-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 17px; background: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.al-t { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.udot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.all-clear { display: flex; align-items: center; gap: 10px; padding: 18px; }
.all-clear .i { color: var(--accent); width: 26px; height: 26px; }

.skeleton { border-radius: 14px; background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: ts-shimmer 1.3s linear infinite; }

/* ---------- Admin owner dashboard ---------- */
.kpis.eight { grid-template-columns: repeat(4, 1fr); }
.kpi-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; opacity: .85; }
.btn-ghost { font: inherit; font-size: 13px; cursor: pointer; color: #e8eef9; }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.home-grid.even { grid-template-columns: 1fr 1fr; }
.top-list, .att-list { display: flex; flex-direction: column; gap: 4px; }
.top-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; cursor: pointer; transition: background .15s; }
.top-row:hover, .att:hover { background: rgba(255,255,255,.04); }
.rank { width: 22px; text-align: center; font-weight: 800; color: var(--muted); font-size: 13px; flex: none; }
.top-row:nth-child(1) .rank { color: #fbbf24; } .top-row:nth-child(2) .rank { color: #cbd5e1; } .top-row:nth-child(3) .rank { color: #d97706; }
.cav { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #0b1220)); box-shadow: 0 6px 14px -8px var(--c); }
.top-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top-name b { min-width: 0; }
.top-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.05); margin: 5px 0 4px; overflow: hidden; }
.top-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 40%, #22d3ee)); }
.top-stats { display: flex; gap: 6px; flex: none; }
.top-stats span { display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 5px 6px; border-radius: 10px; background: rgba(255,255,255,.035); }
.top-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.top-stats small { font-size: 10px; color: var(--muted); }
.top-stats .on b { color: var(--accent); }
.top-stats .al b { color: #fb7185; }
.att { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; cursor: pointer; transition: background .15s; min-width: 0; }
.att + .att { border-top: 1px solid rgba(255,255,255,.04); }
.att .grow { min-width: 0; }
.att b { display: block; }
.att-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--c);
  background: color-mix(in srgb, var(--c) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.chev { color: var(--muted); font-size: 20px; flex: none; }
.who { color: #a5b4fc; font-weight: 600; }
.empty-mini { display: flex; align-items: center; gap: 12px; padding: 18px 8px; }
.empty-mini > .i { width: 28px; height: 28px; color: var(--muted); }
.empty-mini b { display: block; }
@media (max-width: 1100px) { .home-grid.even { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .kpis.eight { grid-template-columns: repeat(2, 1fr); }
  .top-stats span { min-width: 42px; }
  .top-stats span:nth-child(3) { display: none; }
}

@keyframes ts-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ts-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes ts-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ts-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes ts-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, #10b981) 70%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

@media (max-width: 1100px) {
  .kpis.six { grid-template-columns: repeat(3, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .nav button { padding: 8px; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .mobile-brand { display: flex; margin-bottom: 4px; }
}
@media (max-width: 800px) {
  .kpis, .kpis.six { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 22px; }
  .hero-art { display: none; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
  .uname { display: none; }
  .user-btn { padding: 3px; }
  .veh-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hero, .kpi, .card, .vcard, .login-card, .bar-fill { animation: none; }
  .hero-art, .login-art, .live-dot i, .spill i.pulse, .skeleton { animation: none; }
}
