/* Airport Sentinel — AI THINGS product family UI (Parking AI / Marine / Inform Vision look).
   Light slate surfaces, dark charcoal sidebar, Inter type, one signage-yellow accent (#ffc800) with navy ink.
   Status colours (ok / warn / crit) are reserved for status only. Light is the default theme; dark is optional. */
:root {
  --bg: #0b1120;
  --bg-2: #0f172a;
  --panel: #131b2e;
  --panel-2: #18213a;
  --panel-3: #222c46;
  --line: #1f2940;
  --line-2: #2c3854;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #ffc800;          /* signage yellow */
  --accent-ink: #0f172a;      /* navy text on yellow */
  --accent-soft: rgba(255, 200, 0, .12);
  --accent-line: rgba(255, 200, 0, .45);
  --accent-2: #ffd633;
  --accent-fg: #ffc800;       /* accent used as text / icon on page surfaces */
  --accent-edge: #ffc800;     /* accent used as a thin line or focus ring */
  --accent-glow: 0 6px 18px -6px rgba(255, 200, 0, .55);
  --danger-fg: #ff8a83;
  --hover-line: #3a4664;
  --scroll: #26304a;
  --scroll-hover: #34405e;
  --alarm-bg: #1d0f14;
  --warn-banner-bg: #1c1608;
  --warn-banner-fg: #e9d9a6;
  /* family shell: sidebar stays charcoal in both themes */
  --sb-bg: #1a1f2e;
  --sb-line: #0a0f1c;
  --sb-text: #cbd5e1;
  --sb-muted: #7b8597;
  --sb-hover: rgba(255, 255, 255, .06);
  --top-bg: #131b2e;
  --top-h: 72px;
  --sb-w: 260px;
  --ok: #4cc38a;
  --warn: #ff9a3c;
  --crit: #ff5b52;
  --info: #8ab4ff;
  --violet: #b9a3ff;
  --z-queue: #3ca0ff;
  --z-restricted: #eb3c3c;
  --z-danger: #ff5a00;
  --z-safe: #3cc85a;
  --z-loitering: #c85ac8;
  --z-crowd: #ffd200;
  --z-line: #ffffff;
  --z-door: #78dcff;
  --z-area: #3ad1ff;
  --radius: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 50px -12px rgba(0, 0, 0, .7);
  --sans: "Inter", "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

/* Light theme for daylight offices and printed screenshots. Video stays on black either way. */
:root[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-2: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef2f7;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent-ink: #0f172a;
  --accent-soft: #fff6d1;
  --accent-line: rgba(190, 145, 0, .55);
  --accent-2: #ffd633;
  --accent-fg: #8a6400;
  --accent-edge: #d9a700;
  --ok: #16a34a;
  --warn: #d97706;
  --crit: #dc2626;
  --info: #2563eb;
  --danger-fg: #dc2626;
  --hover-line: #94a3b8;
  --scroll: #cbd5e1;
  --scroll-hover: #94a3b8;
  --alarm-bg: #fef2f2;
  --warn-banner-bg: #fff8db;
  --warn-banner-fg: #5a4600;
  --top-bg: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px -14px rgba(15, 23, 42, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.5 var(--sans);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
svg { stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
code { font-family: var(--mono); font-size: 12px; background: var(--panel-3); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-edge); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--panel-3); border-color: var(--hover-line); }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn.danger-ghost { background: transparent; color: var(--danger-fg); border-color: rgba(255, 91, 82, .3); }
.btn.danger-ghost:hover { background: rgba(255, 91, 82, .1); border-color: rgba(255, 91, 82, .5); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.icon-btn.off .sound-wave { opacity: 0; }
.icon-btn.off { color: var(--faint); }

/* ---------- app shell: charcoal sidebar | white topbar / content / footer */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); height: 100%; transition: grid-template-columns .22s var(--ease); }
body.nav-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
body.nav-collapsed .nav { visibility: hidden; padding: 0; border: 0; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px 0 18px;
  border-bottom: 1px solid var(--line); background: var(--top-bg);
}
.nav-toggle { width: 40px; height: 40px; color: var(--muted); }
.nav-toggle svg { width: 20px; height: 20px; }
.org { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 0; }
.org svg { width: 16px; height: 16px; color: var(--accent-edge); flex: none; }
.org b { color: var(--text); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2; }
.brand-name { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub { color: var(--faint); font-size: 12px; }
.page-title { flex: 1; }
.kpis { display: flex; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 0; }
.kpi {
  display: flex; flex-direction: column-reverse; justify-content: center; gap: 1px; flex: 1; min-width: 120px; padding: 0 20px;
  border-left: 1px solid var(--line); position: relative;
}
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); white-space: nowrap; }
.kpi-val { font: 600 26px/1.2 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi.ok .kpi-val { color: var(--text); }
.kpi.warn .kpi-val { color: var(--warn); }
.kpi.crit .kpi-val { color: var(--crit); }
.kpi.crit .kpi-label::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--crit); margin-left: 6px; vertical-align: 1px; animation: blink 1.4s infinite; }
.top-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.chip { font: 500 11px var(--mono); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--faint); }
.live { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.clock { font: 500 13px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--crit); flex: none; }
.conn.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
/* user button: avatar initial + name + chevron */
.user-btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 4px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-weight: 500; font-size: 14px; max-width: 280px; }
.user-btn:hover { background: var(--panel-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; font-size: 14px; }
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.user-btn .chev { width: 16px; height: 16px; color: var(--muted); flex: none; }

@keyframes glow { 50% { box-shadow: 0 0 0 1px rgba(255, 91, 82, .7); } }

/* ---------- layout */
.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rail, .feed { background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.rail { border-right: 1px solid var(--line); }
.app-foot { flex: none; display: flex; justify-content: space-between; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--bg); }
.app-foot span:last-child { color: var(--faint); letter-spacing: .02em; }

/* left menu: charcoal sidebar */
.nav {
  background: var(--sb-bg); border-right: 1px solid var(--sb-line); color: var(--sb-text); display: flex; flex-direction: column;
  min-height: 0; min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 0 12px 14px; gap: 2px; scrollbar-color: #2b3246 transparent;
}
.nav::-webkit-scrollbar-thumb { background: #2b3246; }
.nav-brand {
  flex: none; height: var(--top-h); margin: 0 -12px 6px; padding: 0 22px; display: flex; align-items: center; border-bottom: 1px solid var(--sb-line);
  color: #fff; font-size: 18px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.4px; color: var(--sb-muted); padding: 18px 12px 8px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px;
  border: 0; background: transparent; color: var(--sb-text); font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
  position: relative; transition: background .15s, color .15s, box-shadow .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: var(--accent-glow); }
.nav-item.dim { color: var(--sb-muted); }
.nav-n { font: 600 11px/20px var(--mono); font-style: normal; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; text-align: center; background: rgba(255, 255, 255, .08); color: var(--sb-text); }
.nav-item.active .nav-n { background: rgba(15, 23, 42, .14); color: var(--accent-ink); }
.nav-n.alarm, .nav-item.active .nav-n.alarm { background: #dc2626; color: #fff; }
.nav-n.alarm.zero { display: none; }
.nav-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; }
.nav-foot .btn { justify-content: center; height: 42px; border-radius: 8px; }
:root:not([data-theme="light"]) { --accent-glow: 0 6px 18px -8px rgba(255, 200, 0, .45); }
.nav-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(15, 23, 42, .45); }

/* alarm bell + drawer */
.bell { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 0; background: var(--accent-soft); color: var(--accent-fg); flex: none; }
.bell svg { width: 20px; height: 20px; }
.bell:hover { background: var(--accent); color: var(--accent-ink); }
.bell .count-badge { position: absolute; top: -5px; right: -6px; border-radius: 999px; padding: 2px 6px; box-shadow: 0 0 0 2px var(--top-bg); }
.bell .count-badge.zero { display: none; }
.feed-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
.feed { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 41; border-left: 1px solid var(--line); box-shadow: var(--shadow); animation: slide-in .22s var(--ease); }
.feed[hidden] { display: none; }
.feed-head { gap: 10px; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

/* view header */
.view-title { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; align-self: center; height: 30px; padding: 0 10px 0 6px; margin-right: 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; }
.back-btn svg { width: 15px; height: 15px; }
.back-btn:hover { color: var(--text); border-color: var(--line-2); }
.menu-meta { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: 11.5px; color: var(--faint); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-meta b { font: 500 11.5px var(--mono); color: var(--muted); }
.menu-toggle { display: flex !important; justify-content: space-between; gap: 10px; }
.menu-toggle b { font: 500 11.5px var(--mono); color: var(--faint); }
.menu-toggle.on b { color: var(--accent-fg); }
.demo-pill { font: 600 10.5px var(--mono); letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); background: transparent; cursor: pointer; }
.demo-pill[hidden] { display: none; }
.rail-head, .feed-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 16px; min-height: 56px; }
h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.cam-list { flex: 1; overflow: auto; padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.cam {
  display: grid; grid-template-columns: 56px 1fr; gap: 11px; align-items: center; padding: 7px 8px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; text-align: left; width: 100%;
  transition: background .15s;
}
.cam:hover { background: var(--panel); }
.cam.active { background: var(--panel-2); border-color: var(--line-2); }
.cam.active .cam-name { color: var(--accent-fg); }
.cam-thumb { width: 56px; height: 36px; border-radius: 4px; background: #000 center/cover; position: relative; filter: saturate(.85); }
.cam-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--faint); font-family: var(--mono); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.running { background: var(--ok); }
.dot.loading, .dot.starting { background: var(--warn); }
.dot.error, .dot.no-signal { background: var(--crit); }
.cam-alert { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--crit); color: #fff; font: 600 10px/16px var(--mono); text-align: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--bg-2); }

.rail-foot { padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.legend-title { font-size: 11.5px; color: var(--faint); margin-bottom: 8px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* ---------- center */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; gap: 12px; min-height: 64px; margin-bottom: 16px; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; align-self: stretch; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; height: 100%; padding: 0 12px;
  color: var(--muted); position: relative; font-weight: 500; transition: color .15s;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent-edge); }
.crumb-cam { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.crumb-cam:not(:empty)::before { content: "/"; color: var(--faint); margin: 0 10px 0 6px; font-weight: 400; }
.view-actions { display: flex; gap: 6px; }

.grid { flex: 1; overflow: auto; padding: 0 24px 18px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); grid-auto-flow: dense; align-content: start; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color .2s; }
.tile:hover { border-color: var(--line-2); }
.tile.alarm { border-color: var(--crit); animation: glow 1.6s infinite; }
.tile-img { aspect-ratio: 16/9; background: #000; position: relative; overflow: hidden; }
.tile-img img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .7s var(--ease); }
.tile:hover .tile-img img { transform: scale(1.025); }
.tile-badge { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.badge { font: 500 10.5px var(--mono); padding: 3px 7px; border-radius: 4px; background: rgba(11, 12, 14, .78); color: #ecebe6; backdrop-filter: blur(6px); }
.badge.live { color: #ecebe6; }
.badge.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--crit); margin-right: 6px; vertical-align: 1px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.tile-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 10px; border-top: 1px solid var(--line); }
.tile-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-stats { display: flex; gap: 12px; font: 11.5px var(--mono); color: var(--faint); white-space: nowrap; }
.tile-stats b { color: var(--text); font-weight: 500; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 30px; }
.empty svg { color: var(--faint); }
.empty h3 { color: var(--text); font-size: 17px; }
.empty p { max-width: 400px; margin: 0 0 8px; }

/* ---------- focus */
.focus { flex: 1; overflow: auto; padding: 0 24px 18px; display: flex; flex-direction: column; gap: 12px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tool-label { font-size: 12px; color: var(--faint); padding-left: 4px; }
.tools { display: flex; gap: 4px; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; }
.tool:hover { border-color: var(--line-2); }
.tool.active { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 12%, var(--panel-2)); }
.tool-hint { font-size: 12px; color: var(--faint); margin-left: auto; }
.stage-wrap { display: flex; justify-content: center; }
.stage { position: relative; width: 100%; max-height: calc(100vh - 400px); aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.stage img, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage img { object-fit: fill; }
.stage canvas { cursor: default; }
.stage.drawing canvas { cursor: crosshair; }
.stage-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; pointer-events: none; }
.stage-status.err { color: var(--danger-fg); }

.zone-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.zchip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; }
.zchip:hover { border-color: var(--line-2); }
.zchip.sel { border-color: var(--accent-edge); color: var(--accent-fg); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-flow: dense; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--faint); }
.card-head .swatch { width: 8px; height: 8px; }
.card-head .name { color: var(--text); font-weight: 600; font-size: 13.5px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big { font: 500 30px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.big small { font: 400 12.5px var(--sans); color: var(--faint); margin-left: 5px; letter-spacing: 0; }
.rows { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 12.5px; color: var(--muted); }
.rows b { color: var(--text); font: 500 12.5px var(--mono); text-align: right; }
.bar { height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 2px; background: var(--ok); transition: width .5s var(--ease), background .4s; }
.spark { width: 100%; height: 48px; }
.spark path.area { fill: color-mix(in srgb, var(--text) 7%, transparent); stroke: none; }
.spark path.line { stroke: var(--muted); stroke-width: 1.4; }
.state-ok { color: var(--ok); }
.state-warn { color: var(--warn); }
.state-crit { color: var(--crit); }

/* ---------- feed */
.count-badge { font: 600 11px var(--mono); background: var(--crit); color: #fff; border-radius: 4px; padding: 2px 7px; }
.count-badge.zero { background: var(--panel-3); color: var(--muted); }
.filters { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.filter { height: 26px; padding: 0 9px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; font-size: 12px; color: var(--muted); }
.filter:hover { color: var(--text); }
.filter.active { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.events { flex: 1; overflow: auto; padding: 4px 0 16px; display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 80px 1fr; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); position: relative; animation: slidein .4s var(--ease); transition: background .15s; }
.ev:hover { background: var(--panel); }
.ev.acked { opacity: .5; }
.ev.critical:not(.acked) { background: rgba(255, 91, 82, .06); }
.ev.critical:not(.acked):hover { background: rgba(255, 91, 82, .1); }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
.ev-thumb { width: 80px; height: 52px; border-radius: 4px; background: #000 center/cover; cursor: zoom-in; }
.ev-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ev-top { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); }
.ev-type { font: 500 10.5px var(--mono); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ev-type::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.ev.critical .ev-type { color: var(--crit); } .ev.critical .ev-type::before { background: var(--crit); }
.ev.warning .ev-type { color: var(--warn); } .ev.warning .ev-type::before { background: var(--warn); }
.ev.info .ev-type::before { background: var(--info); }
.ev-time { margin-left: auto; font-family: var(--mono); }
.ev-msg { font-size: 13px; line-height: 1.38; }
.ev-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--faint); }
.ev-ack { margin-left: auto; height: 24px; padding: 0 9px; font-size: 11.5px; border-radius: 4px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); }
.ev-ack:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.feed-empty { color: var(--faint); text-align: center; padding: 40px 10px; font-size: 13px; }

/* ---------- alarm banner */
.alarm-banner {
  position: fixed; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 9px 10px 9px 16px; border-radius: var(--radius); background: var(--alarm-bg); border: 1px solid var(--crit);
  box-shadow: var(--shadow); max-width: min(820px, 90vw); animation: drop .3s var(--ease);
}
.alarm-banner strong { color: var(--crit); font: 600 12px var(--mono); }
.alarm-banner #alarm-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--crit); box-shadow: 0 0 0 0 rgba(255, 91, 82, .7); animation: pulse 1.2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 91, 82, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 91, 82, 0); } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- modal / drawer / popover */
.modal, .drawer, .lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(5, 5, 6, .72); backdrop-filter: blur(2px); }
.modal { display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; animation: rise .3s var(--ease); max-height: calc(100vh - 32px); overflow: auto; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.form-error { margin-right: auto; color: var(--danger-fg); font-size: 12.5px; }
.seg-tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.seg-tabs button { border: 0; background: transparent; height: 28px; border-radius: 4px; color: var(--muted); font-size: 12.5px; }
.seg-tabs button.active { background: var(--panel-3); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  height: 36px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); outline: none; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: 64px; padding: 8px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent-soft); }
.help { margin: 6px 0 0; font-size: 12px; color: var(--faint); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent-edge); color: var(--text); background: var(--accent-soft); }
.drop small { color: var(--faint); }
.progress { height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.drawer { display: flex; justify-content: flex-end; }
.drawer-card { width: min(460px, 100%); height: 100%; background: var(--panel); border-left: 1px solid var(--line-2); padding: 20px; display: flex; flex-direction: column; gap: 14px; animation: slide .3s var(--ease); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-body { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 22px; padding-right: 4px; }
.sect-title { font-size: 13px; color: var(--text); font-weight: 600; margin-bottom: 8px; }
.sect { display: flex; flex-direction: column; gap: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease), background .15s; }
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); background: var(--accent-ink); }
.toggle small { display: block; color: var(--faint); font-size: 11.5px; }

/* camera settings drawer: one card per analysis */
.drawer-card:has(#settings-form) { width: min(520px, 100%); }
#settings-form { gap: 26px; scroll-padding-top: 52px; }
#settings-form > .sguide { margin: 0; }
.set-nav { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.set-nav button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 500; }
.set-nav button:hover { color: var(--text); border-color: var(--accent-edge); }
.set-nav i { font: 500 10.5px var(--mono); font-style: normal; color: var(--faint); }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 2px 2px; }
.mcard { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: border-color .15s, background .15s; }
.mcard.on { border-color: var(--line-2); background: var(--panel-2); }
.mhead { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.mhead.static { cursor: default; }
.mico { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.mico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mcard.on .mico { background: var(--accent-soft); color: var(--text); }
.mtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mtxt b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mtxt small { font-size: 11.5px; color: var(--faint); line-height: 1.35; }
.mhead .toggle { padding: 0; border: 0; }
.mbody { padding: 2px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.mcard:not(.on) .mbody { display: none; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; }
.fgrid .full { grid-column: 1 / -1; }
.fgrid .toggle { padding: 6px 0; }
.fgrid .toggle:last-child { border-bottom: 0; }
.inp-u { position: relative; display: block; }
.inp-u input { width: 100%; padding-right: 64px; }
.inp-u em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 11.5px; color: var(--faint); pointer-events: none; white-space: nowrap; }
.rng > span { display: flex; justify-content: space-between; align-items: baseline; }
.rng output { font: 600 12px var(--mono); color: var(--text); }
.field.rng input[type=range] { height: 18px; padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); }
.rng small { color: var(--faint); font-size: 11.5px; }
.madv { border-top: 1px dashed var(--line-2); padding-top: 8px; }
.madv summary { cursor: pointer; font-size: 12px; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.madv summary::before { content: "+"; font: 600 12px var(--mono); width: 12px; }
.madv[open] summary::before { content: "−"; }
.madv[open] summary { margin-bottom: 10px; }
.chk-chips { display: flex; flex-direction: column; gap: 6px; }
.chk-chip { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--text); font-size: 12.5px; cursor: pointer; }
.field .chk-chip input { accent-color: var(--accent); width: 15px; height: 15px; padding: 0; flex: none; }
.chk-chip:has(input:checked) { border-color: var(--accent-edge); background: var(--accent-soft); }
@media (max-width: 520px) { .fgrid { grid-template-columns: 1fr; } }

.popover { position: fixed; z-index: 45; width: 290px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; animation: rise .2s var(--ease); }
.pop-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pop-foot { display: flex; gap: 6px; align-items: center; }
.spacer { flex: 1; }

.lightbox { display: grid; place-items: center; padding: 30px; cursor: zoom-out; }
.lightbox figure { margin: 0; max-width: 92vw; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: var(--radius); display: block; }
.lightbox figcaption { margin-top: 10px; color: #c9c8c2; text-align: center; font-size: 12.5px; }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; animation: drop .25s var(--ease); }
.toast.err { background: var(--crit); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hover); }

/* ---------- responsive */
@media (max-width: 1280px) {
  :root { --sb-w: 232px; }
  .kpi { min-width: 0; padding: 0 12px; }
  .brand-sub { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}
@media (max-width: 960px) {
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app { display: block; height: auto; min-height: 100vh; }
  .main { min-height: 100vh; }
  /* sidebar becomes an off-canvas drawer */
  .nav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 46; width: min(288px, 86vw); transform: translateX(-102%); transition: transform .24s var(--ease); visibility: hidden; }
  body.nav-open .nav { transform: none; visibility: visible; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
  body.nav-collapsed .nav { visibility: hidden; padding: 0; border: 0; }
  body.nav-open.nav-collapsed .nav { visibility: visible; }
  .topbar { position: sticky; top: 0; z-index: 35; height: 60px; padding: 0 12px 0 8px; gap: 8px; }
  :root { --top-h: 60px; }
  .nav-brand { height: 60px; }
  .page-title { display: none; }
  .live { display: none; }
  .top-right { gap: 6px; }
  .user-name, .user-btn .chev { display: none; }
  .user-btn { padding: 0 4px; }
  .layout { display: block; }
  .kpis { overflow-x: auto; }
  .events { max-height: 70vh; }
  .view-head { padding: 16px 16px 0; min-height: 52px; flex-wrap: wrap; }
  .view-title { font-size: 20px; }
  .view-actions { flex-wrap: wrap; }
  .grid { padding: 0 16px 16px; grid-template-columns: 1fr; }
  .focus { padding: 0 16px 16px; }
  .report, .usecase, .overview { padding-left: 16px; padding-right: 16px; }
  .stage { max-height: none; }
  .tool-hint { display: none; }
  .app-foot { padding: 12px 16px; flex-wrap: wrap; }
  .menu { position: fixed; top: 64px; right: 8px; left: auto; max-width: calc(100vw - 16px); }
}
@media (max-width: 520px) { .org { display: none; } }

/* ---------- overview */
.overview { flex: 1; overflow: auto; padding: 0 24px 28px; display: flex; flex-direction: column; gap: 28px; }
.sect-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.muted-sm { color: var(--faint); font-size: 12px; }
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); grid-auto-flow: dense; gap: 10px; }
.ins { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); position: relative; overflow: hidden; transition: border-color .2s; }
.ins:hover { border-color: var(--line-2); }
.ins.crit { border-color: rgba(255, 91, 82, .4); }
.ins-ico { width: 30px; height: 30px; flex: none; border-radius: 6px; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.ins.crit .ins-ico { color: var(--crit); background: rgba(255, 91, 82, .12); }
.ins.warn .ins-ico { color: var(--warn); background: rgba(255, 154, 60, .12); }
.ins.ok .ins-ico { color: var(--ok); background: rgba(76, 195, 138, .12); }
.ins-ico svg { width: 16px; height: 16px; }
.ins-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ins-title { font-weight: 600; font-size: 13.5px; }
.ins-text { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ins-actions { display: flex; gap: 6px; margin-top: 6px; }
.ins-empty { color: var(--faint); font-size: 13px; padding: 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.cat-sections { display: flex; flex-direction: column; gap: 28px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cat-head h3 { font-size: 14px; }
.cat-total { font: 500 12px var(--mono); color: var(--muted); }
.zones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); grid-auto-flow: dense; gap: 10px; }
.ztile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; cursor: pointer; transition: border-color .2s, background .2s; }
.ztile:hover { border-color: var(--line-2); background: var(--panel-2); }
.ztile.crit { border-color: rgba(255, 91, 82, .5); }
.ztile.warn { border-color: rgba(255, 154, 60, .4); }
.ztile.offline { opacity: .5; }
.zt-top { display: flex; align-items: center; gap: 8px; }
.zt-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-cam { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-status { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.zt-status.warn { background: var(--warn); } .zt-status.crit { background: var(--crit); animation: blink 1.4s infinite; }
.zt-status.offline, .zt-status.idle { background: var(--faint); }
.zt-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.trend { font: 500 12px var(--mono); }
.trend.up { color: var(--warn); } .trend.down { color: var(--ok); } .trend.flat { color: var(--faint); }
.zt-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--faint); font-family: var(--mono); padding-top: 8px; border-top: 1px solid var(--line); }
.zt-foot b { color: var(--text); font-weight: 500; }
.stage img.heat { mix-blend-mode: screen; pointer-events: none; opacity: .9; }
#heat-btn.on { border-color: var(--warn); color: var(--warn); }
.pop-hint { font-size: 11.5px; color: var(--faint); margin-top: -4px; }

/* ---------- reports */
.report { flex: 1; overflow: auto; padding: 0 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.report-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rep-range { width: 320px; grid-template-columns: repeat(4, 1fr); }
.report-bar #rep-shift { margin-left: auto; }
a.btn { text-decoration: none; }
.rep-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.rep-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rep-table th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; white-space: nowrap; }
.rep-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-table tr:last-child td { border-bottom: 0; }
.rep-table td.num { font-family: var(--mono); text-align: right; }
.rep-table th.num { text-align: right; }
.rep-table tr:hover td { background: var(--panel-2); }
.rep-zone { display: flex; align-items: center; gap: 8px; }
.rep-zone small { color: var(--faint); display: block; }
.minibars { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; vertical-align: middle; }
.minibars i { width: 6px; background: var(--muted); border-radius: 1px; min-height: 1px; }
.hourbars i { width: 3px; }
.pill { font: 500 11px var(--mono); padding: 2px 7px; border-radius: 4px; background: var(--panel-3); }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.crit { color: var(--crit); }
.hist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; align-items: end; height: 46px; }
.hist div { background: color-mix(in srgb, var(--text) 35%, transparent); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.hist-lbl { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 9.5px; color: var(--faint); text-align: center; margin-top: 2px; }

/* ---------- per-camera analyses */
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset { height: 26px; padding: 0 10px; border-radius: var(--r-sm); border: 1px dashed var(--line-2); background: transparent; color: var(--muted); font-size: 12px; }
.preset:hover { color: var(--text); border-color: var(--accent-edge); }
.mod-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.mod { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12.5px; transition: all .15s; }
.mod svg { width: 14px; height: 14px; }
.mod:hover { border-color: var(--line-2); color: var(--text); }
.mod.on { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.mod.on svg { color: var(--accent-fg); }
.modbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.modbar .tool-label { white-space: nowrap; }
.modbar .presets { margin-left: auto; }
.cam-mods { display: flex; gap: 3px; margin-top: 3px; }
.cam-mods i { width: 16px; height: 16px; border-radius: 3px; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.cam-mods i svg { width: 10px; height: 10px; }

.ev-thumbs { display: flex; flex-direction: column; gap: 4px; }
.ev-owner { width: 80px; height: 52px; border-radius: 4px; background: #000 center/contain no-repeat; box-shadow: inset 0 0 0 1px var(--warn); cursor: zoom-in; position: relative; }
.ev-owner::after { content: "vlasnik"; position: absolute; left: 3px; bottom: 2px; font: 500 9px var(--mono); color: var(--warn); background: rgba(0, 0, 0, .7); padding: 0 3px; border-radius: 2px; }

/* ---------- simplified editing & add wizard */
.editbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 10px 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.purpose-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1; }
.purpose-line .lbl { font-size: 12px; color: var(--faint); }
.ppill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12.5px; }
.ppill svg { width: 13px; height: 13px; color: var(--accent-fg); }
.link-btn { background: none; border: 0; color: var(--accent-fg); font-size: 12.5px; padding: 2px 4px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: var(--accent-fg); }
.draw-btns { display: flex; gap: 6px; align-items: center; }
.btn.draw { height: 34px; padding: 0 14px; font-weight: 500; }
.btn.draw svg { width: 17px; height: 17px; color: var(--accent-fg); }
.btn.draw.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.draw.active svg { color: var(--accent-ink); }
.guide { display: flex; flex-wrap: wrap; gap: 6px; }
.guide:empty { display: none; }
.gstep { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; color: var(--muted); }
.gstep .n { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font: 600 11px var(--mono); background: var(--accent); color: var(--accent-ink); flex: none; }
.gstep.done { opacity: .5; }
.gstep.done .n { background: var(--panel-3); color: var(--ok); }
.draw-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); color: #ecebe6; background: rgba(11, 12, 14, .88); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 7px 12px; font-size: 12.5px; pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.draw-hint b { color: #ffc800; font-weight: 600; }
.draw-done { position: absolute; right: 12px; top: 10px; box-shadow: var(--shadow); }
.stage:has(.draw-done:not([hidden])) .draw-hint { left: 12px; transform: none; max-width: calc(100% - 160px); }
.stage.drawing canvas.snap { cursor: pointer; }
.zpop { width: 360px; max-height: calc(100vh - 24px); overflow: auto; }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tcard { display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 8px 9px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); transition: border-color .15s; }
.tcard:hover { border-color: var(--line-2); }
.tcard.on { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 10%, var(--panel-2)); }
.tcard i.swatch { margin-top: 4px; }
.tcard b { display: block; font-size: 12.5px; font-weight: 600; }
.tcard small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.tcard.more { justify-content: center; align-items: center; color: var(--accent-fg); font-size: 12px; border-style: dashed; }
details.adv { border-top: 1px solid var(--line); padding-top: 8px; }
details.adv summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: flex; align-items: center; gap: 6px; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
details.adv[open] summary::before { transform: rotate(45deg); }
details.adv > div { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
details.adv .mod-chips { flex-direction: row; }
#zone-params { display: flex; flex-direction: column; gap: 8px; }

.wiz { width: min(640px, 100%); }
.steps { display: flex; gap: 14px; margin-top: 6px; }
.step { font-size: 12px; color: var(--faint); padding: 0 0 3px; border-bottom: 2px solid transparent; }
.step.on { color: var(--text); border-bottom-color: var(--accent-edge); }
.alt-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.alt-sources .drop { flex-direction: row; justify-content: flex-start; text-align: left; padding: 12px 14px; gap: 10px; background: transparent; font: inherit; color: var(--muted); }
.alt-sources .drop b { color: var(--text); font-weight: 500; }
.alt-sources .drop small { margin-left: auto; }
.rtsp-help .help { margin: 0; }
.rtsp-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.rtsp-table td { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
.rtsp-table td:first-child { width: 84px; color: var(--text); }
.rtsp-table code { background: none; padding: 0; color: var(--text); word-break: break-all; }
@media (max-width: 560px) { .alt-sources { grid-template-columns: 1fr; } }
.drop.big { padding: 36px 20px; gap: 8px; font: 13.5px/1.45 var(--sans); letter-spacing: -.003em; }
.drop.big b { font-size: 15px; color: var(--text); font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.quick { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.sample-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sample { height: 26px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--muted); }
.sample:hover { color: var(--text); border-color: var(--accent-edge); }
.picked { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; }
.picked svg { width: 18px; height: 18px; color: var(--ok); flex: none; }
.picked span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purposes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); grid-auto-flow: dense; gap: 8px; }
.pcard { position: relative; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); min-height: 104px; transition: border-color .15s, background .15s; }
.pcard:hover { border-color: var(--line-2); }
.pcard .ic { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); transition: background .15s, color .15s; }
.pcard .ic svg { width: 16px; height: 16px; }
.pcard b { font-size: 13.5px; font-weight: 600; }
.pcard small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.pcard.on { border-color: var(--accent-edge); background: var(--accent-soft); }
.pcard.on .ic { background: var(--accent); color: var(--accent-ink); }
.pcard.on::after { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 960px) { .type-cards { grid-template-columns: 1fr; } .zpop { width: calc(100vw - 24px); } }
.cam-purpose { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- licence plates */
.search { height: 32px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); min-width: 240px; font: 500 13px var(--mono); }
.search:focus { outline: none; border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent-soft); }
.plates-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.plate { display: inline-block; font: 600 14px var(--mono); letter-spacing: .06em; color: #111; background: #f4f5f2; border: 2px solid #1d1e22; border-left: 10px solid #1f4fbf; border-radius: 4px; padding: 2px 9px; white-space: nowrap; }
.plate.alarm { border-color: var(--crit); border-left-color: var(--crit); box-shadow: 0 0 0 2px rgba(255, 91, 82, .3); }
.plate.allow { border-color: var(--ok); border-left-color: var(--ok); }
.plate-img { height: 30px; max-width: 120px; border-radius: 3px; cursor: zoom-in; display: block; }
.watch { position: sticky; top: 0; gap: 10px; }
.watch-head { display: flex; align-items: center; gap: 4px; }
.watch-head .name { font-weight: 600; font-size: 14px; }
.watch-tabs { grid-template-columns: 1fr 1fr; }
.watch-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; font-weight: 500; }
.watch-tabs .n { font: 500 11px var(--mono); color: var(--faint); background: var(--panel-2); border-radius: 4px; padding: 1px 6px; }
.watch-tabs button.active .n { color: var(--text); background: var(--panel); }
.wk-dot { width: 7px; height: 7px; border-radius: 50%; }
.wk-dot.allow { background: var(--ok); } .wk-dot.alarm { background: var(--crit); }
.watch-desc { margin: 0; }
.watch-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; }
.watch-form input { height: 32px; padding: 0 9px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 12.5px; min-width: 0; }
.watch-form input:focus { outline: none; border-color: var(--accent-edge); }
.watch-form #w-plate { font-family: var(--mono); text-transform: uppercase; }
#w-add.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.watch-search { min-width: 0; width: 100%; height: 30px; font-size: 12.5px; }
.watch-list { display: flex; flex-direction: column; max-height: 52vh; overflow: auto; margin: 0 -14px; }
.wrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); }
.wrow:hover { background: var(--panel-2); }
.wrow .plate { font-size: 12.5px; }
.wmeta { min-width: 0; display: flex; flex-direction: column; }
.wmeta b { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wmeta b:empty { display: none; }
.wmeta small { color: var(--faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn.del.armed { color: #fff; background: var(--crit); border-color: var(--crit); }
td.wq { white-space: nowrap; text-align: right; }
td.wq .btn + .btn { margin-left: 4px; }
.wtag { font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.wtag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.wtag.allow { color: var(--ok); } .wtag.allow::before { background: var(--ok); }
.wtag.alarm { color: var(--crit); } .wtag.alarm::before { background: var(--crit); }
@media (max-width: 1100px) { .plates-layout { grid-template-columns: 1fr; } }

/* ---------- auth & stop */
.pw-banner { display: flex; align-items: center; gap: 12px; padding: 7px 18px; background: var(--warn-banner-bg); border-bottom: 1px solid rgba(255, 200, 0, .25); color: var(--warn-banner-fg); font-size: 12.5px; }
.pw-banner svg { color: var(--accent-fg); flex: none; }
.pw-banner span { flex: 1; }
.pw-banner b { color: var(--accent-fg); font-family: var(--mono); font-weight: 500; }
.usermenu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; min-width: 250px !important; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; min-width: 200px; animation: rise .18s var(--ease); }
.menu button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 6px; font-size: 13px; }
.menu .menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; font-size: 13px; }
.menu .menu-row .langs button { padding: 4px 8px; }
.menu .menu-ico { display: flex; align-items: center; gap: 9px; }
.menu .menu-ico svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu .menu-ico.off { color: var(--faint); }
.menu .menu-ico.off .sound-wave { opacity: 0; }
.menu .menu-out { color: var(--danger-fg); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 4px; }
.menu button:hover { background: var(--panel-3); }
#btn-toggle.paused { border-color: rgba(76, 195, 138, .5); color: var(--ok); }
.dot.stopped { background: var(--faint); box-shadow: none; }
.cam { position: relative; }
.cam-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--line-2); color: var(--muted); opacity: 0; transition: opacity .15s; }
.cam:hover .cam-toggle, .cam-toggle.paused { opacity: 1; }
.cam-toggle svg { width: 12px; height: 12px; }
.cam-toggle:hover { color: var(--text); border-color: var(--accent-edge); }
.cam-toggle.paused { color: var(--ok); border-color: rgba(76, 195, 138, .45); }
.cam.off .cam-thumb, .cam.off .cam-name { opacity: .45; }

/* ---------- onboarding tour */
.tour { position: fixed; inset: 0; z-index: 80; }
.tour-spot { position: fixed; border-radius: var(--radius); box-shadow: 0 0 0 9999px rgba(5, 5, 6, .74), 0 0 0 2px var(--accent); transition: all .35s var(--ease); pointer-events: none; }
.tour-spot.center { left: 50% !important; top: 42% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(5, 5, 6, .8); }
.tour-card { position: fixed; width: min(380px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); transition: top .35s var(--ease), left .35s var(--ease); }
.tour-card h3 { margin: 6px 0 6px; font-size: 17px; }
.tour-card p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.tour-card p b { color: var(--text); font-weight: 600; }
.tour-step { font: 500 11.5px var(--mono); color: var(--faint); }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.menu .menu-link { text-align: left; padding: 8px 10px; border-radius: 4px; font-size: 13px; color: var(--text); text-decoration: none; }
.menu .menu-link:hover { background: var(--panel-3); }

/* ---------- locations */
.locs-head { display: flex; align-items: center; gap: 10px; }
.locs-head .lbl { font-size: 12px; color: var(--muted); }
.loc-list { display: flex; flex-direction: column; gap: 10px; max-height: 220px; overflow: auto; }
.loc-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.loc-group .g { font-size: 11.5px; color: var(--faint); width: 100%; }
.loc-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; color: var(--text); transition: border-color .15s, background .15s; }
.loc-chip svg { width: 14px; height: 14px; color: var(--muted); }
.loc-chip:hover { border-color: var(--accent-edge); background: var(--accent-soft); }
.loc-chip:hover svg { color: var(--accent-fg); }
.loc-empty { color: var(--faint); font-size: 12.5px; }
.loc-table { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.loc-row { display: grid; grid-template-columns: 1.3fr .8fr 1.6fr auto; gap: 6px; align-items: center; }
.loc-row input, .loc-add input { height: 32px; padding: 0 9px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 12.5px; min-width: 0; }
.loc-row input:focus, .loc-add input:focus { outline: none; border-color: var(--accent-edge); }
.loc-row .del { background: none; border: 0; color: var(--faint); font-size: 18px; cursor: pointer; padding: 0 6px; }
.loc-row .del:hover { color: var(--crit); }
.loc-add { display: grid; grid-template-columns: 1.3fr .8fr 1.6fr; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.loc-add .file-btn { grid-column: 1 / 3; justify-content: center; cursor: pointer; }
.loc-add .file-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-add button[type=submit] { justify-content: center; }
@media (max-width: 700px) { .loc-row, .loc-add { grid-template-columns: 1fr; } .loc-add .file-btn { grid-column: auto; } }

/* ---------- language switch */
.langs { display: inline-flex; border-radius: var(--r-sm); padding: 2px; background: var(--panel); border: 1px solid var(--line); }
.langs button { border: 0; background: transparent; color: var(--faint); font: 500 11px var(--mono); padding: 4px 8px; border-radius: 4px; cursor: pointer; transition: color .15s, background .15s; }
.langs button:hover { color: var(--text); }
.langs button.active { background: var(--panel-3); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- theme switch */
#theme-btn .sun { display: none; }
:root[data-theme="light"] #theme-btn .sun { display: block; }
:root[data-theme="light"] #theme-btn .moon { display: none; }
:root[data-theme="light"] .swatch { box-shadow: inset 0 0 0 1px rgba(23, 24, 27, .18); }

/* ---------- seat count in the zone popover */
.seats-field { gap: 8px; }
.stepper { display: grid; grid-template-columns: 36px 1fr 36px; gap: 4px; }
.stepper .btn { height: 38px; justify-content: center; padding: 0; font-size: 17px; }
.stepper input { height: 38px; text-align: center; font: 500 18px var(--mono); padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); min-width: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .bench-calc input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper input:focus, .bench-calc input:focus { outline: none; border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent-soft); }
.bench-calc { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.bench-calc input { width: 52px; height: 28px; text-align: center; font: 500 13px var(--mono); border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); padding: 0 4px; }
.seats-field input:disabled { opacity: .45; }
.chk { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chk input { margin: 2px 0 0; accent-color: var(--accent); }
.field-err { color: var(--danger-fg); font-size: 12px; }

/* ---------- overview: use cases */
.all-zones > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.all-zones > summary::-webkit-details-marker { display: none; }
.all-zones > summary::before { content: "+"; font: 500 14px var(--mono); color: var(--faint); width: 14px; }
.all-zones[open] > summary::before { content: "−"; }
.all-zones .cat-sections { padding-top: 8px; }
.uses-grid { display: flex; flex-direction: column; gap: 18px; }
.uses-label { font-size: 11.5px; color: var(--faint); margin-bottom: 8px; }
.uses-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.use { display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); transition: border-color .2s, transform .2s var(--ease); }
.use:hover { border-color: var(--hover-line); }
.use.alarm { border-color: rgba(255, 91, 82, .6); }
.use.empty { opacity: .6; }
.use-img { position: relative; aspect-ratio: 16 / 7; background: #000 center/cover; filter: saturate(.85); }
.use-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .55)); }
.use-ico { position: absolute; left: 10px; bottom: 9px; z-index: 1; width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.use-ico svg { width: 15px; height: 15px; }
.use-alarm { position: absolute; top: 8px; right: 8px; z-index: 1; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; background: var(--crit); color: #fff; font: 600 11px/20px var(--mono); text-align: center; }
.use-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.use-name { font-weight: 600; font-size: 13.5px; }
.use-metric { font-size: 12px; color: var(--muted); }
.use-metric b { font: 500 15px var(--mono); color: var(--text); margin-right: 2px; }

/* ---------- use-case page */
.usecase { flex: 1; overflow: auto; padding: 0 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.uc-head { display: flex; align-items: center; gap: 14px; }
.uc-ico { width: 40px; height: 40px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.uc-ico svg { width: 21px; height: 21px; }
.uc-group { font-size: 11.5px; color: var(--faint); }
.uc-lead { margin: 2px 0 0; font-size: 15px; color: var(--text); }
.uc-explain { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.uc-card { padding: 14px 16px; border-left: 1px solid var(--line); }
.uc-card:first-child { border-left: 0; }
.uc-k { font-size: 11.5px; color: var(--accent-fg); font-weight: 600; margin-bottom: 5px; }
.uc-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.uc-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.uc-live { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.uc-cams { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.uc-stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.uc-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.uc-stage .badge { position: absolute; top: 10px; left: 10px; }
.uc-cap { display: flex; align-items: center; font-size: 12.5px; color: var(--muted); }
.uc-cap .mono { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.uc-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.uc-side .sect-head { margin: 4px 0 8px; }
.uc-zones { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.uc-events { display: flex; flex-direction: column; gap: 6px; }
.uc-events .ev { border: 1px solid var(--line); border-radius: var(--r-sm); }
.uc-empty { padding: 60px 20px; }
@media (max-width: 1280px) { .uc-main { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .uc-explain { grid-template-columns: 1fr; } .uc-card { border-left: 0; border-top: 1px solid var(--line); } .uc-card:first-child { border-top: 0; } .usecase, .overview { padding: 0 16px 20px; } .kpi { min-width: 130px; } }

/* ---------- per-section guide */
.sguide-host { padding: 0 24px; }
.sguide-host:empty { display: none; }
.sguide-host.in-panel { padding: 0 16px 10px; }
.sguide { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 16px; }
.sguide-host.in-panel .sguide { margin-bottom: 0; }
.sguide > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text); }
.sguide > summary::-webkit-details-marker { display: none; }
.sguide > summary svg { width: 16px; height: 16px; color: var(--accent-fg); flex: none; }
.sguide > summary::after { content: "+"; margin-left: auto; font: 500 14px var(--mono); color: var(--faint); }
.sguide[open] > summary::after { content: "−"; }
.sg-body { padding: 0 14px 14px 39px; }
.sg-purpose { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 900px; }
.sg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; }
.sg-k { font-size: 11.5px; color: var(--accent-fg); font-weight: 600; margin-bottom: 4px; }
.sg-cols ul { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.sg-cols li + li { margin-top: 3px; }
.sg-cols b, .sg-tip b { color: var(--text); font-weight: 600; }
.sg-tip { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
.in-panel .sg-cols { grid-template-columns: 1fr; }
@media (max-width: 960px) { .sguide-host { padding: 0 16px; } .sg-cols { grid-template-columns: 1fr; } .sg-body { padding-left: 14px; } }

/* plates use case: last plates read by the camera */
.uc-plates { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.uc-plates .feed-empty { padding: 16px 10px; }
.pl-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.pl-row.alarm { border-color: var(--crit, #e5484d); }
.pl-plate { font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 4px; background: #f4f4f0; color: #111; border: 1px solid #c9c9c2; }
.pl-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.pl-tag.alarm { background: color-mix(in srgb, var(--crit, #e5484d) 18%, transparent); color: var(--crit, #e5484d); }
.pl-tag.ok { background: color-mix(in srgb, var(--ok, #30a46c) 18%, transparent); color: var(--ok, #30a46c); }
.pl-time { color: var(--faint); font-size: 12px; }
