/* ANPR dashboard — minimal, self-contained (no CDN, works offline on a Pi) */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eef0f3;
  --border: #e6e8ec; --border-2: #d6d9df;
  --text: #0f1729; --text-2: #4b5567; --text-3: #8a93a3;
  --accent: #2563eb; --accent-soft: rgba(37,99,235,.08);
  --ok: #0e9f6e; --ok-soft: rgba(14,159,110,.1); --warn: #b7791f; --warn-soft: rgba(217,145,30,.12);
  --bad: #dc3d36; --bad-soft: rgba(220,61,54,.09);
  --shadow: 0 1px 2px rgba(16,24,40,.04);
  --r: 12px; --r-sm: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
  --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #256abf; --q6: #184f95; --bar: #2a78d6;
  --side: 236px; --top: 64px; --gap: 16px; --pad: 20px; --fs: 13.5px; --ctl: 36px; --row: 60px; --thumb-w: 76px; --thumb-h: 52px;
}
:root[data-theme="dark"] {
  --bg: #0b0d11; --surface: #13161b; --surface-2: #181b21; --surface-3: #20242b;
  --border: #23272e; --border-2: #30353d;
  --text: #ecedf0; --text-2: #a4a8b1; --text-3: #6f7480;
  --accent: #5b8def; --accent-soft: rgba(91,141,239,.13);
  --ok: #3ecf8e; --ok-soft: rgba(62,207,142,.12); --warn: #f5b74e; --warn-soft: rgba(245,183,78,.12);
  --bad: #f2716b; --bad-soft: rgba(242,113,107,.12);
  --shadow: none;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --q1: #184f95; --q2: #1c5cab; --q3: #256abf; --q4: #3987e5; --q5: #6da7ec; --q6: #9ec5f4; --bar: #3987e5;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fs)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.spacer { flex: 1; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.link { color: var(--accent); cursor: pointer; font-weight: 550; } .link:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }

/* ---- layout: sidebar + top bar ------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; white-space: nowrap; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-t b { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.brand-t small { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 550; white-space: nowrap; transition: background .12s, color .12s; }
.nav a .ic { width: 18px; height: 18px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--text-2); padding: 0 7px; border-radius: 99px; line-height: 19px; }
.nav a.active .nav-badge { background: var(--accent); color: #fff; }
.nav-badge:empty { display: none; }
.side-foot { margin-top: auto; padding-top: 14px; }
.health { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12px; display: grid; gap: 5px; }
.health .row { display: flex; justify-content: space-between; color: var(--text-2); } .health b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: var(--top); padding: 0 28px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.titles h1 { font-size: 18px; font-weight: 650; letter-spacing: -.3px; margin: 0; white-space: nowrap; }
.titles .sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills { display: flex; gap: 6px; flex-wrap: nowrap; flex: none; }
.view { padding: 24px 28px 64px; max-width: 1560px; width: 100%; margin: 0 auto; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.menu-btn { display: inline-grid; }
/* collapsed sidebar on a wide screen = icon rail (labels hidden, hover shows the name) */
.app.side-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.app.side-collapsed .side { padding: 18px 10px; align-items: center; }
.app.side-collapsed .brand { padding: 0 0 18px; justify-content: center; }
.app.side-collapsed .brand-t, .app.side-collapsed .nav a span, .app.side-collapsed .side-foot { display: none; }
.app.side-collapsed .nav { width: 100%; align-items: center; }
.app.side-collapsed .nav a { position: relative; justify-content: center; width: 44px; padding: 0; }
.app.side-collapsed .nav a .ic { width: 20px; height: 20px; }
.app.side-collapsed .nav-badge { position: absolute; top: 3px; right: 1px; font-size: 9.5px; line-height: 15px; padding: 0 4px; margin: 0; }
.scrim { display: none; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 28px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); font-weight: 550; font-size: 12.5px; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--gap); }
.page-tools .dates { display: flex; align-items: center; gap: 6px; }
.page-tools input[type=date] { width: 150px; }

/* ---- primitives ---------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px var(--pad); min-height: 50px; }
.card-h h2 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-h .sub { color: var(--text-3); font-size: 12px; }
.card-b { padding: 4px var(--pad) var(--pad); }
.btn { display: inline-flex; align-items: center; gap: 7px; height: var(--ctl); padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 550; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: all .12s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 99px; font-size: 12px; font-weight: 550; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); } .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); } .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip .ic { width: 12px; height: 12px; }
.swatch { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128,128,128,.45); flex: none; display: inline-block; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], input[type=tel], input[type=email], input[type=url], select, textarea {
  width: 100%; height: var(--ctl); padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238d8d96' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.empty { text-align: center; padding: 44px 16px; color: var(--text-3); }
.empty .ic { width: 28px; height: 28px; margin-bottom: 8px; opacity: .5; }

/* indian number plate */
.plate { display: inline-flex; align-items: stretch; border: 1.5px solid #222; border-radius: 5px; background: #fafaf7; color: #111; font-family: var(--mono); font-weight: 750; letter-spacing: .6px; overflow: hidden; line-height: 1; }
.plate .in { background: #1d4fc4; color: #fff; font-size: 6px; letter-spacing: .3px; padding: 2px 3px; display: flex; align-items: flex-end; font-family: var(--font); font-weight: 700; }
.plate .no { padding: 5px 8px; font-size: 13px; white-space: nowrap; }
.plate.lg .no { font-size: 22px; padding: 8px 14px; } .plate.lg .in { font-size: 8px; padding: 4px 5px; }
.plate.unread { background: transparent; border: 1.5px dashed var(--border-2); color: var(--text-3); font-weight: 650; }
.plate.unread .in { display: none; }
.plate.c-yellow { background: #f6c915; }
.plate.c-green { background: #2f9e5b; color: #fff; border-color: #14532d; }
.plate.c-black { background: #141414; color: #f6c915; border-color: #555; }
.plate.c-blue { background: #2455c3; color: #fff; border-color: #14306e; }
.plate.c-red { background: #c0392b; color: #fff; border-color: #7a1d12; }

/* ---- KPI strip ----------------------------------------------------------------------------- */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); background: none; border: 0; }
.strip .stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px var(--pad); min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.strip .d { font-size: 12px; color: var(--text-3); }
.strip .d.up { color: var(--ok); } .strip .d.down { color: var(--bad); }
.strip .stat .ic { display: none; }
.strip .l { order: -1; font-size: 12px; color: var(--text-3); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .v { font-size: 28px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }

/* ---- live ---------------------------------------------------------------------------------- */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--gap); align-items: start; }
.live-side { display: grid; gap: var(--gap); }
.video-card { overflow: hidden; }
.video-wrap { position: relative; background: #000; aspect-ratio: 4 / 3; max-height: calc(100vh - 230px); width: 100%; display: grid; place-items: center; }
.video-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-wrap .badge { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge .b { background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(8px); padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.badge .b .ic { width: 13px; height: 13px; }
.video-wrap .tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.video-wrap .tools .icon-btn { background: rgba(0,0,0,.55); color: #fff; width: 30px; height: 30px; backdrop-filter: blur(8px); }
.video-msg { color: var(--text-3); text-align: center; padding: 20px; }
.perfline { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px var(--pad); border-top: 1px solid var(--border); font: 12px var(--mono); color: var(--text-2); }
.perfline b { color: var(--text); font-weight: 600; } .perfline i { font-style: normal; color: var(--text-3); }

.latest { overflow: hidden; cursor: pointer; }
.latest .ph { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #000; display: grid; place-items: center; color: var(--text-3); }
.latest .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.latest .body { padding: 14px var(--pad) var(--pad); display: grid; gap: 14px; }
.latest .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.latest .kicker, .kicker { font-size: 11px; font-weight: 600; letter-spacing: .5px; color: var(--text-3); text-transform: uppercase; }
.latest.new { animation: pop .6s ease; }
@keyframes pop { from { box-shadow: 0 0 0 3px var(--accent-soft); } to { box-shadow: none; } }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 550; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts dd small { color: var(--text-3); font-weight: 500; }

.feed { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.feed-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px var(--pad); border-top: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.feed-item:hover { background: var(--surface-2); }
.feed-item.new { animation: rowin 1.4s ease; }
.feed-item .thumb { width: 64px; height: 44px; }
.feed-item .meta { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.feed-item .sub2 { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item .time { font-size: 12px; color: var(--text-3); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: var(--thumb-w); height: var(--thumb-h); border-radius: 6px; object-fit: cover; background: var(--surface-3); display: block; }
.thumb.ph { display: grid; place-items: center; color: var(--text-3); }

/* ---- activity ------------------------------------------------------------------------------ */
.bar { display: flex; align-items: center; gap: 8px; padding: 14px var(--pad); flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.bar .search { flex: 1 1 200px; max-width: 280px; }
.bar select { width: auto; min-width: 120px; }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 15px; height: 15px; }
.search input { padding-left: 32px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .4px; }
.search input.free { font-family: var(--font); text-transform: none; letter-spacing: 0; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; height: var(--ctl); align-items: center; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 0 11px; height: calc(var(--ctl) - 6px); border-radius: 6px; cursor: pointer; font-weight: 550; font-size: 12.5px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-2); }
.table-wrap { overflow: auto; }
table.t { width: 100%; border-collapse: collapse; min-width: 960px; }
.t th { position: sticky; top: 0; text-align: left; padding: 10px 12px; font-size: 11.5px; font-weight: 550; color: var(--text-3); background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 2; }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; height: var(--row); }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; transition: background .1s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.new { animation: rowin 1.4s ease; }
@keyframes rowin { from { background: var(--accent-soft); } to { background: transparent; } }
.t .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
small.d, .t .num small, .t td small.d { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1.3; white-space: nowrap; }
.t td { white-space: nowrap; }
.t input[type=checkbox], .check { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.cell-flex { display: inline-flex; align-items: center; gap: 7px; }
.stack1 { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--pad); color: var(--text-2); gap: 10px; flex-wrap: wrap; font-size: 12.5px; border-top: 1px solid var(--border); }
.pager .pages { display: flex; gap: 6px; align-items: center; }
.conf { display: inline-flex; align-items: center; gap: 8px; min-width: 90px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.conf .bar-i { flex: 1; height: 4px; background: var(--surface-3); border-radius: 9px; overflow: hidden; min-width: 36px; max-width: 60px; }
.conf .bar-i i { display: block; height: 100%; background: var(--ok); border-radius: 9px; }
.conf.mid .bar-i i { background: var(--warn); } .conf.low .bar-i i { background: var(--bad); }
.orient { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.orient .ic { width: 15px; height: 15px; color: var(--text-3); }

/* drawer */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: fadeo .2s; }
@keyframes fadeo { from { opacity: 0; } }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); border-left: 1px solid var(--border); overflow: auto; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--pad); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.drawer-b { padding: var(--pad); display: grid; gap: 18px; }
.drawer img.big { width: 100%; border-radius: var(--r-sm); background: var(--surface-3); display: block; cursor: zoom-in; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 0; font-size: 13px; margin: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.kv dt, .kv dd { padding: 9px 12px; border-bottom: 1px solid var(--border); margin: 0; }
.kv dt { color: var(--text-3); background: var(--surface-2); }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.imgs2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox button { position: absolute; top: 14px; right: 14px; color: #fff; }

/* ---- analytics ----------------------------------------------------------------------------- */
.an-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.an-grid .span-8 { grid-column: span 8; } .an-grid .span-4 { grid-column: span 4; } .an-grid .span-6 { grid-column: span 6; } .an-grid .span-12 { grid-column: span 12; }
.chart-b { padding: 4px var(--pad) var(--pad); }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 160px; padding-top: 18px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .col .b { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; transition: height .4s; opacity: .85; }
.bars .col:hover .b { opacity: 1; }
.bars .col .b::after { content: attr(data-v); position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-2); opacity: 0; font-weight: 600; }
.bars .col:hover .b::after { opacity: 1; }
.bars .col span { font-size: 10.5px; color: var(--text-3); }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 32px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar .track { height: 8px; background: var(--surface-3); border-radius: 9px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 9px; background: var(--accent); box-shadow: inset 0 0 0 1px rgba(128,128,128,.55); }
.hbar .lab { display: flex; align-items: center; gap: 7px; min-width: 0; } .hbar .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 120px; height: 120px; flex: none; }
.legend { display: grid; gap: 8px; font-size: 12.5px; flex: 1; min-width: 120px; }
.legend div { display: flex; align-items: center; gap: 8px; } .legend b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.toplist { display: grid; gap: 10px; } .toplist .row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }

/* ---- settings ------------------------------------------------------------------------------ */
.set-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 6px 0 12px; position: sticky; top: var(--top); z-index: 5; background: var(--bg); margin: -6px 0 4px; }
.set-tabs a { height: 30px; padding: 0 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 550; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.set-tabs a:hover { color: var(--text); background: var(--surface-2); }
.set-tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-2); }
.set-tabs a i { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.set-group { margin-bottom: var(--gap); scroll-margin-top: calc(var(--top) + 56px); }
.set-group .card-h { border-bottom: 1px solid var(--border); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.1fr); gap: 4px 16px; padding: 14px var(--pad); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); align-items: center; }
.field:nth-child(2n) { border-right: 0; }
.field.wide { grid-column: 1 / -1; grid-template-columns: 1fr; border-right: 0; }
.field .lbl { font-weight: 550; font-size: 13px; line-height: 1.3; } .field .help { color: var(--text-3); font-size: 11.5px; margin-top: 3px; line-height: 1.4; }
.field .apply { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 550; margin-top: 2px; }
.field.dirty .lbl::after { content: " •"; color: var(--warn); }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 99px; cursor: pointer; transition: all .18s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.row-inline { display: flex; gap: 6px; align-items: center; }
.multi { display: flex; gap: 6px; flex-wrap: wrap; }
.multi label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid var(--border-2); border-radius: var(--r-sm); cursor: pointer; font-weight: 550; font-size: 12.5px; transition: all .12s; user-select: none; }
.multi label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.multi input { display: none; }
.savebar { position: sticky; bottom: 14px; margin-top: var(--gap); display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 16px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: 0 12px 32px rgba(0,0,0,.25); z-index: 6; }
.savebar.idle { box-shadow: none; border-color: var(--border); }
.testres { font-size: 12px; margin-top: 6px; } .testres.ok { color: var(--ok); } .testres.bad { color: var(--bad); }
.roi-wrap { display: flex; gap: 20px; align-items: flex-start; }
.roi-box { position: relative; flex: none; max-width: calc(100% - 280px); background: #000; border-radius: var(--r-sm); overflow: hidden; user-select: none; touch-action: none; line-height: 0; }
.roi-box img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(55vh, 520px); }
.roi-box.empty { width: 480px; height: 300px; }
.roi-side { flex: 1; min-width: 220px; display: grid; gap: 14px; font-size: 13px; }
.roi-steps ol { margin: 6px 0 8px; padding-left: 18px; line-height: 1.7; color: var(--text-2); }
.roi-side .roi-tools { margin-top: 0; }
.roi-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.roi-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.profiles { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px var(--pad); align-items: center; }

/* ---- system -------------------------------------------------------------------------------- */
.sys-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.gauge { padding: 14px var(--pad); display: grid; gap: 8px; }
.gauge .top { display: flex; justify-content: space-between; align-items: baseline; }
.gauge .top b { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.5px; } .gauge .top span { color: var(--text-3); font-weight: 550; font-size: 12px; }
.meter { height: 6px; border-radius: 9px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 9px; background: var(--ok); transition: width .5s; }
.meter i.hot { background: var(--bad); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.logbox { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); font: 12px/1.6 var(--mono); height: 280px; overflow: auto; padding: 10px 12px; }
.logbox .ln { white-space: pre-wrap; word-break: break-word; }
.logbox .WARNING { color: var(--warn); } .logbox .ERROR, .logbox .CRITICAL { color: var(--bad); } .logbox .DEBUG { color: var(--text-3); }
.logbox .t { color: var(--text-3); margin-right: 8px; } .logbox .s { color: var(--accent); margin-right: 8px; }
.cpubars { display: grid; gap: 6px; margin-top: 10px; }
.cpubars .r { display: grid; grid-template-columns: 110px 1fr 48px; gap: 10px; align-items: center; font-size: 12px; color: var(--text-2); }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1.5px dashed var(--border-2); border-radius: var(--r); padding: 22px; color: var(--text-3); cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.an-result { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, 1fr); gap: var(--gap); margin-top: var(--gap); }
.an-result img { width: 100%; border-radius: var(--r-sm); }
.veh { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); margin-bottom: 10px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.card { min-width: 0; }
.perm-note { color: var(--text-3); font-size: 12px; padding: 12px var(--pad); border-top: 1px solid var(--border); }
.tbl-actions { display: flex; gap: 6px; justify-content: flex-end; }
.chip.role-superadmin { background: rgba(167,139,250,.14); color: #a78bfa; } .chip.role-admin { background: var(--accent-soft); color: var(--accent); } .chip.role-user { background: var(--surface-3); color: var(--text-2); }

/* toasts / modal / user menu / auth */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm); box-shadow: 0 12px 30px rgba(0,0,0,.3); animation: tin .22s ease; max-width: 360px; font-weight: 550; font-size: 13px; }
.toast .ic { color: var(--accent); } .toast.ok .ic { color: var(--ok); } .toast.bad .ic { color: var(--bad); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s; }
.user-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); background: transparent; border-radius: 99px; cursor: pointer; color: var(--text); height: 34px; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 11.5px; color: #fff; background: var(--accent); flex: none; }
.uname { display: flex; flex-direction: column; line-height: 1.15; text-align: left; font-weight: 550; font-size: 12.5px; white-space: nowrap; }
.uname em { font-style: normal; font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: 0 18px 40px rgba(0,0,0,.35); padding: 6px; z-index: 50; animation: fade .12s ease; }
.user-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; } .user-menu .who b { display: block; } .user-menu .who span { color: var(--text-3); font-size: 12px; }
.user-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--text-2); font-weight: 550; }
.user-menu button:hover { background: var(--surface-2); color: var(--text); }
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fadeo .2s; }
.modal { position: relative; width: min(460px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: 0 26px 60px rgba(0,0,0,.4); animation: fade .18s ease; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; } .modal-h h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-b { padding: 4px 20px 6px; } .modal-b label { display: block; font-size: 12px; font-weight: 550; color: var(--text-2); margin: 12px 0 6px; }
.modal-f { padding: 16px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px 24px; animation: fade .3s ease; }
.auth-card .logo svg { width: 40px; height: 40px; margin-bottom: 14px; }
.auth-card h1 { font-size: 20px; font-weight: 650; letter-spacing: -.3px; margin: 0 0 4px; } .auth-card p.sub { margin: 0 0 18px; color: var(--text-3); font-size: 13px; }
.auth-card label { display: block; font-size: 12px; font-weight: 550; color: var(--text-2); margin: 12px 0 6px; }
.auth-card input { height: 38px; }
.auth-card .btn.primary { width: 100%; justify-content: center; margin-top: 18px; height: 40px; font-size: 14px; }
.auth-err { color: var(--bad); font-size: 12.5px; margin-top: 10px; min-height: 16px; } .auth-foot { margin-top: 14px; color: var(--text-3); font-size: 11.5px; text-align: center; }
.remember { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text-2); font-size: 12.5px; cursor: pointer; }

/* ---- overview --------------------------------------------------------------------------------  */
.ov-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.ov-grid .c8 { grid-column: span 8; } .ov-grid .c4 { grid-column: span 4; } .ov-grid .c6 { grid-column: span 6; } .ov-grid .c12 { grid-column: span 12; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th { text-align: left; font-weight: 550; color: var(--text-3); font-size: 12px; padding: 8px var(--pad); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mini td { padding: 9px var(--pad); border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.mini tr:last-child td { border-bottom: 0; }
.mini td.r, .mini th.r { text-align: right; }
.mini tbody tr.click { cursor: pointer; } .mini tbody tr.click:hover { background: var(--surface-2); }
.share { display: inline-block; width: 80px; height: 6px; background: var(--surface-3); border-radius: 9px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.share i { display: block; height: 100%; background: var(--accent); }
.vh-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: var(--pad); }
.vh-head .facts { display: flex; gap: 28px; flex-wrap: wrap; }
.vh-head .facts dd { font-size: 15px; }
.print-only { display: none; }
.edit-note { font-size: 12px; color: var(--text-3); }

/* ---- dashboard components (Overview / Reports) ------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis .stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px var(--pad) 16px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.kpis .l { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.kpis .v { font-size: 30px; font-weight: 650; letter-spacing: -.8px; line-height: 1.15; }
.kpis .v small { font-size: 17px; font-weight: 600; color: var(--text-2); margin-left: 1px; letter-spacing: 0; }
.kpis .d { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { font-weight: 650; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--ok); } .delta.bad { color: var(--bad); } .delta.flat { color: var(--text-2); }
.ov-grid .c7 { grid-column: span 7; } .ov-grid .c5 { grid-column: span 5; }
.col-stack { display: grid; gap: var(--gap); align-content: start; }
.ov-grid > .card { display: flex; flex-direction: column; }
.ov-grid > .card > .card-b:has(> .cc) { flex: 1; display: flex; flex-direction: column; }
.card-b > .cc { flex: 1; grid-template-rows: minmax(var(--cc-h), 1fr) auto; }
.card-b { padding: 4px var(--pad) var(--pad); }
.empty.sm { padding: 18px 8px; font-size: 12.5px; }

/* tooltip for chart marks: hit target = the whole slot, bigger than the mark */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--text); color: var(--surface); font: 550 12px/1.3 var(--font); padding: 5px 9px; border-radius: 6px; white-space: nowrap; z-index: 20; pointer-events: none; box-shadow: 0 6px 16px rgba(0,0,0,.18); }

/* column chart */
.cc { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: var(--cc-h) auto; column-gap: 8px; }
.cc-y { position: relative; grid-row: 1; }
.cc-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cc-plot { position: relative; grid-row: 1; grid-column: 2; }
.cc-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); }
.cc-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.cc-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.cc-col b { position: relative; width: min(24px, 70%); min-height: 0; background: var(--bar); border-radius: 4px 4px 0 0; transition: height .35s ease; }
.cc-col:hover b { filter: brightness(1.12); }
.cc-col:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 4px; }
.cc-col em { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); font: normal 650 11.5px var(--font); color: var(--text); white-space: nowrap; }
.cc-x { grid-column: 2; display: flex; gap: 2px; margin-top: 6px; }
.cc-x span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: visible; min-width: 0; }

/* 100 % stacked bar + legend */
.sb { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 6px 0 14px; }
.sb i { min-width: 3px; }
.sb-legend { display: grid; gap: 8px; }
.sb-legend div, .rb-row { display: grid; align-items: center; column-gap: 10px; font-size: 13px; }
.sb-legend div { grid-template-columns: 10px 1fr auto 40px; }
.sb-legend b, .rb-row b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sb-legend small, .rb-row small { text-align: right; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(128,128,128,.4); flex: none; }

/* ranked bars */
.rb { display: grid; gap: 10px; }
.rb-row { grid-template-columns: minmax(90px, 34%) 1fr 44px 40px; }
.rb-l { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-t { display: block; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.rb-t i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }


/* lists + tables inside dashboard cards */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px var(--pad); border-top: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.list-row:hover { background: var(--surface-2); }
table.t.compact { min-width: 640px; }
.t.compact td { height: 54px; padding: 6px 14px; } .t.compact th { padding: 9px 14px; }
.t.compact .thumb { width: 64px; height: 42px; }
.t th.r, .t td.r { text-align: right; }
.t td.r .conf { justify-content: flex-end; }

/* ---- vehicles: tabs, photo grid, registered form ----------------------------------------------- */
.seg.vtabs a { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; height: calc(var(--ctl) - 6px); border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.seg.vtabs a.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-2); }
.seg.vtabs a .ic { width: 15px; height: 15px; }
.seg button .ic { width: 15px; height: 15px; vertical-align: -3px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; padding: var(--pad); border-top: 1px solid var(--border); }
.vgrid > .empty { grid-column: 1 / -1; }
.vcard { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); cursor: pointer; transition: box-shadow .15s, border-color .15s; min-width: 0; }
.vcard:hover { border-color: var(--border-2); box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.vcard.new { animation: pop 1.6s ease; }
.vc-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-3); }
.vc-img > img:first-child, .vc-img > .thumb { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; border-radius: 0; }
.vc-plate { position: absolute; right: 8px; bottom: 8px; max-width: 58%; max-height: 34%; border: 2px solid #fff; border-radius: 5px; box-shadow: 0 2px 8px rgba(0,0,0,.35); background: #fff; }
.vc-tags { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.vc-tags .chip { background: rgba(255,255,255,.92); color: #1d2433; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.vc-tags .chip.ok { background: #0e9f6e; color: #fff; } .vc-tags .chip.warn { background: #b7791f; color: #fff; }
.vc-b { padding: 10px 12px 12px; display: grid; gap: 6px; }
.vc-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.vc-time { font-size: 12px; color: var(--text-3); } .vc-time small { margin-left: 4px; }
.vc-b small.d { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form2 > div { min-width: 0; }
@media (max-width: 640px) {
  .form2 { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px; }
  .vc-b { padding: 8px 9px 10px; } .vc-b .plate { font-size: 12px; }
  .t.vt.rt tbody tr { padding-left: 14px; min-height: 0; }
  .t.vt.rt td[data-l]::before { content: attr(data-l) ": "; color: var(--text-3); }
  .t.vt.rt td.c-in { flex-basis: calc(50% - 6px); }
  .seg.vtabs { width: 100%; } .seg.vtabs a { flex: 1; justify-content: center; }
}

/* ---- responsive ---------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .kpis, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid .c7, .ov-grid .c5 { grid-column: span 12; }
  .live-grid { grid-template-columns: 1fr; } .video-wrap { max-height: none; }
  .live-side { grid-template-columns: 1fr 1fr; align-items: start; }
  .sys-grid { grid-template-columns: repeat(2, 1fr); }
  .an-grid .span-8, .an-grid .span-4, .an-grid .span-6, .ov-grid .c8, .ov-grid .c4, .ov-grid .c6 { grid-column: span 12; }
  .fields { grid-template-columns: 1fr; } .field { border-right: 0 !important; }
  .pills .opt { display: none; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .side.open { transform: none; }
  .app.side-collapsed { grid-template-columns: 1fr; }
  .app.side-collapsed .side { padding: 18px 14px; align-items: stretch; }
  .app.side-collapsed .brand { padding: 0 8px 18px; justify-content: flex-start; }
  .app.side-collapsed .brand-t, .app.side-collapsed .side-foot { display: flex; }
  .app.side-collapsed .side-foot { display: block; }
  .app.side-collapsed .nav a span { display: inline; }
  .app.side-collapsed .nav { align-items: stretch; }
  .app.side-collapsed .nav a { justify-content: flex-start; width: auto; padding: 0 10px; }
  .app.side-collapsed .nav-badge { position: static; font-size: 11px; line-height: 19px; padding: 0 7px; margin-left: auto; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; backdrop-filter: none; background: var(--bg); }
  .view { padding: 16px 14px 40px; } .banner { padding: 9px 14px; }
  .uname, .pills, .titles .sub { display: none; }
  .strip { grid-template-columns: 1fr 1fr; gap: 10px; } .strip .v { font-size: 22px; }
  .live-side, .two, .an-result { grid-template-columns: 1fr; } .field { grid-template-columns: 1fr; }
  .bar .search { max-width: none; flex-basis: 100%; }
  .kv { grid-template-columns: 120px 1fr; }
  .roi-wrap { flex-direction: column; } .roi-box { max-width: 100%; } .roi-box.empty { width: 100%; }
}

/* vehicle lists become cards on a phone: photo left, plate on top, details wrap underneath */
@media (max-width: 640px) {
  table.t.vt { min-width: 0 !important; }
  .t.vt thead { display: none; }
  .t.vt, .t.vt tbody { display: block; }
  .t.vt tbody tr { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px 12px 98px; min-height: 82px; border-bottom: 1px solid var(--border); }
  .t.vt td { display: block; height: auto !important; padding: 0 !important; border: 0; font-size: 12.5px; color: var(--text-2); }
  .t.vt td.c-ph { position: absolute; left: 14px; top: 12px; }
  .t.vt td.c-ph .thumb { width: 72px; height: 54px; }
  .t.vt td.c-pl { flex-basis: 100%; color: var(--text); font-weight: 550; margin-bottom: 2px; }
  .t.vt td.c-chk { position: absolute; right: 14px; top: 14px; }
  .t.vt td.c-br { flex-basis: auto; }
  .t.vt td.c-hide, .t.vt td small.d, .t.vt td .ago { display: none; }
  .t.vt td .conf { min-width: 0; } .t.vt td .conf .bar-i { display: none; }
  .t.vt td.r { text-align: left; }
}

/* ---- print (Reports) ----------------------------------------------------------------------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --border: #ddd; --text: #000; --text-2: #333; --text-3: #666; --shadow: none; }
  .side, .topbar, .banner, .no-print, .toasts { display: none !important; }
  .app { display: block; } .view { padding: 0; max-width: none; }
  .kpis.five { grid-template-columns: repeat(5, 1fr); } .kpis .v { font-size: 22px; }
  .ov-grid .c7 { grid-column: span 7; } .ov-grid .c5 { grid-column: span 5; }
  [data-tip]:hover::after { display: none; }
  .print-only { display: block; }
  .card { break-inside: avoid; }
  .ov-grid .c8, .ov-grid .c4, .ov-grid .c6 { grid-column: span 12; }
}

/* ---- ANPR Cloud additions ---------------------------------------------------------------- */
.site-sel { width: auto; max-width: 220px; height: 34px; }
.site-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.site-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.site-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.site-card .sc-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px var(--pad) 10px; }
.site-card .sc-h h3 { margin: 0; font-size: 15px; }
.site-card .sc-h small { color: var(--text-3); }
.site-card .sc-n { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px var(--pad) 14px; }
.site-card .sc-n div { display: grid; gap: 2px; } .site-card .sc-n b { font-size: 17px; } .site-card .sc-n span { font-size: 11.5px; color: var(--text-3); }
.gate-list { display: grid; gap: 6px; padding: 10px var(--pad) 16px; border-top: 1px solid var(--border); }
.gate-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.gate-row .gn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-box { font: 700 30px/1.2 var(--mono, ui-monospace, monospace); letter-spacing: 4px; text-align: center; padding: 18px; border: 2px dashed var(--accent); border-radius: var(--r); color: var(--accent); margin: 8px 0 14px; user-select: all; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; }
.roles-pick { display: grid; gap: 6px; margin-top: 4px; }
.roles-pick .rp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.roles-pick .rp span { flex: 1; }
.roles-pick select { width: 150px; }
.ph-off { display: grid; place-items: center; gap: 6px; text-align: center; color: var(--text-3); font-size: 12px; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 8px; min-height: 140px; padding: 12px; }
.ph-off .ic { width: 22px; height: 22px; opacity: .6; }
.chip.dir-IN { background: var(--ok-soft); color: var(--ok); } .chip.dir-OUT { background: var(--warn-soft); color: var(--warn); }
.dot.off { background: var(--text-3); }
.gs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; font-size: 12.5px; }
.gs-grid span { color: var(--text-3); }
@media (max-width: 760px) { .site-sel { max-width: 130px; } .site-card .sc-n { grid-template-columns: repeat(2, 1fr); } }
.ov-grid .c5 { grid-column: span 5; } .ov-grid .c7 { grid-column: span 7; }
@media (max-width: 920px) { .ov-grid .c5, .ov-grid .c7 { grid-column: span 12; } }
.nav-sep { height: 1px; background: var(--border); margin: 8px 10px; }
