@font-face { font-family: "InterV"; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JBM"; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #060b10;
  --bg2: #0a121a;
  --panel: rgba(17, 28, 38, 0.72);
  --panel-solid: #0f1a24;
  --line: rgba(120, 170, 200, 0.14);
  --line-strong: rgba(120, 190, 220, 0.28);
  --text: #e8f1f7;
  --muted: #8aa1b1;
  --dim: #5d7384;
  --teal: #19d3c5;
  --teal-2: #12554c;
  --green: #4ade80;
  --lime: #a3e635;
  --amber: #ffb020;
  --red: #ff4d5e;
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --orange: #fb923c;
  --yellow: #facc15;
  --brand-green: #668f45;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --mono: "JBM", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(25, 211, 197, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(167, 139, 250, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(102, 143, 69, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "InterV", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before { /* subtle grid */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(120,170,200,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(120,170,200,0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 40%, transparent 85%);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 10px 22px; height: 68px;
  background: linear-gradient(180deg, rgba(8, 14, 20, 0.96), rgba(8, 14, 20, 0.86));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand .kaj { height: 30px; filter: drop-shadow(0 0 12px rgba(255,255,255,0.15)); }
.brand .sep { width: 1px; height: 34px; background: var(--line-strong); }
.brand .prod { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand .prod b { font-size: 17px; letter-spacing: 0.2px; white-space: nowrap; }
.brand .prod b span { background: linear-gradient(90deg, var(--teal), var(--lime)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .prod small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; gap: 4px; justify-content: center; }
.nav button {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: all .2s;
}
.nav button:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav button.active { color: #001b18; background: linear-gradient(135deg, var(--teal), #7cf0c8); box-shadow: 0 6px 22px rgba(25,211,197,0.35); }
.nav button .badge { background: var(--red); color: #fff; border-radius: 99px; font-size: 10.5px; padding: 1px 6px; font-weight: 700; }
.nav button.active .badge { background: #001b18; color: var(--teal); }

.status { display: flex; align-items: center; gap: 14px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px;
  background: rgba(255, 77, 94, 0.12); border: 1px solid rgba(255, 77, 94, 0.35); color: #ffb3bb;
  font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(255,77,94,.7); animation: pulse 1.6s infinite; }
.live-pill.off { background: rgba(255,176,32,.1); border-color: rgba(255,176,32,.35); color: #ffd58a; }
.live-pill.off i { background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,94,.6); } 70% { box-shadow: 0 0 0 9px rgba(255,77,94,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,94,0); } }
.clock { text-align: right; line-height: 1.1; }
.clock b { font-family: var(--mono); font-size: 18px; letter-spacing: .5px; }
.clock small { display: block; color: var(--muted); font-size: 11px; }
.shift { padding: 6px 10px; border-radius: 10px; background: rgba(167,139,250,.12); border: 1px solid rgba(167,139,250,.35); color: #d9ccff; font-weight: 700; font-size: 12px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); font-size: 10.5px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.te-logo { height: 26px; opacity: .95; }
.powered { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.powered small { color: var(--dim); font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase; }

/* ------------------------------------------------------------------ layout */
main { position: relative; z-index: 1; padding: 16px 22px 28px; max-width: 2200px; margin: 0 auto; }
.page { display: none; animation: fade .35s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(8px); position: relative; overflow: hidden;
}
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; }
.panel-h h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #cfe2ee; display: flex; align-items: center; gap: 8px; }
.panel-h h3 .ic { color: var(--teal); }
.panel-h .sub { color: var(--muted); font-size: 12px; }
.panel-b { padding: 4px 14px 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; border: 1px solid var(--line-strong); color: var(--muted); }
.chip.ok { color: #9ff5c0; border-color: rgba(74,222,128,.4); background: rgba(74,222,128,.08); }
.chip.warn { color: #ffd58a; border-color: rgba(255,176,32,.45); background: rgba(255,176,32,.08); }
.chip.bad { color: #ffb3bb; border-color: rgba(255,77,94,.45); background: rgba(255,77,94,.1); }

/* ------------------------------------------------------------------ KPIs */
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 12px 14px 12px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.kpi .val { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi .val small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi .foot { margin-top: 7px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.kpi .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--teal)); box-shadow: 0 0 18px var(--accent, var(--teal)); }
.kpi .spark { position: absolute; right: 8px; bottom: 8px; width: 80px; height: 28px; opacity: .8; }
.up { color: var(--green); } .down { color: var(--red); }
.flash-num { animation: flashnum .6s ease; }
@keyframes flashnum { 0% { color: #fff; text-shadow: 0 0 18px var(--teal); } 100% { text-shadow: none; } }

/* ------------------------------------------------------------------ flow ribbon */
.flow { padding: 14px 16px 16px; margin-bottom: 14px; }
.flow-track { display: grid; grid-template-columns: repeat(11, auto); grid-auto-flow: column; align-items: center; gap: 0; }
.flow-row { display: flex; align-items: stretch; gap: 0; }
.fnode {
  flex: 1 1 0; min-width: 0; position: relative; border-radius: 12px; padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--line); transition: transform .25s, box-shadow .25s, border-color .25s;
}
.fnode .top { display: flex; align-items: center; gap: 8px; }
.fnode .zn { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #04121a; background: var(--zc); box-shadow: 0 0 16px color-mix(in srgb, var(--zc) 55%, transparent); }
.fnode .nm { font-weight: 700; font-size: 12.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnode .st { color: var(--muted); font-size: 10.5px; }
.fnode .cnt { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fnode .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.fnode.pulse { border-color: var(--zc); box-shadow: 0 0 0 1px var(--zc), 0 0 28px color-mix(in srgb, var(--zc) 45%, transparent); transform: translateY(-2px); }
.fconn { flex: 0 0 46px; position: relative; display: flex; align-items: center; }
.fconn .rail { position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, rgba(120,190,220,0.35) 0 6px, transparent 6px 12px); animation: belt 0.9s linear infinite; }
@keyframes belt { from { background-position: 0 0; } to { background-position: 12px 0; } }
.fconn .arrow { position: absolute; right: -2px; width: 0; height: 0; border-left: 8px solid rgba(120,190,220,.6); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.ftile { position: absolute; top: 50%; left: 0; width: 12px; height: 9px; margin-top: -4.5px; border-radius: 2px; background: #fff; box-shadow: 0 0 10px var(--zc), 0 0 2px #fff; animation: travel 1.1s cubic-bezier(.4,.1,.6,.9) forwards; }
@keyframes travel { from { left: -6px; opacity: 1; } to { left: calc(100% - 6px); opacity: 0.2; } }
.flow-legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ live grid */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; }
.cctv-wall { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cam {
  position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--line);
  aspect-ratio: 16 / 9; box-shadow: var(--shadow); transition: border-color .3s, box-shadow .3s;
}
.cam.portrait { aspect-ratio: 9 / 16; }
.cam video, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.cam canvas { pointer-events: none; }
.cam.hit { border-color: var(--zc); box-shadow: 0 0 0 1px var(--zc), 0 0 30px color-mix(in srgb, var(--zc) 40%, transparent); }
.cam.alarm { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 0 40px rgba(255,77,94,.5); animation: alarm 0.5s ease 4 alternate; }
@keyframes alarm { from { box-shadow: 0 0 0 2px var(--red), 0 0 10px rgba(255,77,94,.2);} to { box-shadow: 0 0 0 2px var(--red), 0 0 46px rgba(255,77,94,.7);} }
.cam .hud-top { position: absolute; left: 0; right: 0; top: 0; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(180deg, rgba(0,0,0,.65), transparent); pointer-events: none; }
.cam .camtag { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12px; text-shadow: 0 1px 2px #000; }
.cam .camtag .zn { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; color: #04121a; background: var(--zc); font-weight: 800; }
.cam .rec { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; color: #ffd0d5; }
.cam .rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.cam .ts { font-family: var(--mono); font-size: 11.5px; color: #fff; text-shadow: 0 1px 3px #000; }
.cam .hud-bot { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; display: flex; justify-content: space-between; align-items: flex-end; background: linear-gradient(0deg, rgba(0,0,0,.7), transparent); pointer-events: none; }
.cam .ai { font-family: var(--mono); font-size: 10.5px; color: #9ff5e9; display: flex; align-items: center; gap: 6px; }
.cam .ai i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.cam .count { text-align: right; }
.cam .count .lab { font-size: 9.5px; letter-spacing: 1px; color: #cfe2ee; font-weight: 700; }
.cam .count .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 0 14px color-mix(in srgb, var(--zc) 70%, transparent); }
.cam .count .r { font-size: 10.5px; color: var(--muted); }
.cam .plus { position: absolute; font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 0 12px var(--zc); pointer-events: none; animation: plus 1s ease-out forwards; }
@keyframes plus { from { transform: translate(-50%, 0) scale(.8); opacity: 1; } to { transform: translate(-50%, -40px) scale(1.25); opacity: 0; } }
.cam .expand { position: absolute; right: 8px; top: 34px; pointer-events: auto; opacity: 0; transition: opacity .2s; }
.cam:hover .expand { opacity: 1; }
.cam .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: radial-gradient(circle, #0c1720, #04080c); }

.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.alerts-feed { max-height: 420px; overflow: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.alerts-feed::-webkit-scrollbar, .tbl-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.alerts-feed::-webkit-scrollbar-thumb, .tbl-wrap::-webkit-scrollbar-thumb { background: rgba(120,170,200,.2); border-radius: 4px; }
.alert-item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); cursor: pointer; transition: background .2s; }
.alert-item:hover { background: rgba(255,255,255,0.06); }
.alert-item.new { animation: newalert 1.6s ease; }
@keyframes newalert { 0% { background: rgba(255,77,94,.35); transform: translateX(10px); } 100% { background: rgba(255,255,255,0.03); transform: none; } }
.alert-item img, .alert-item .noimg { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #111; }
.alert-item .t { font-weight: 700; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.alert-item .m { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.alert-item .n { color: var(--dim); font-size: 10.5px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.sev { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sev.critical { background: var(--red); box-shadow: 0 0 8px var(--red); }
.sev.high { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

.recon { padding: 6px 14px 14px; }
.recon-top { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.gauge { position: relative; width: 130px; height: 130px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .c b { font-size: 24px; font-weight: 800; }
.gauge .c small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .8px; text-transform: uppercase; }
.recon-rows { display: grid; gap: 7px; }
.recon-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.recon-row span { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.recon-row b { font-variant-numeric: tabular-nums; }
.recon-row.total { border-top: 1px dashed var(--line-strong); padding-top: 7px; }
.sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.stages { display: flex; gap: 4px; margin-top: 10px; }
.stage { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.stage .b { height: 6px; border-radius: 3px; background: rgba(120,190,220,.18); margin-bottom: 4px; position: relative; overflow: hidden; }
.stage .b i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--teal), var(--lime)); }

.bottom-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 14px; margin-top: 14px; }
.chart-box { position: relative; height: 230px; padding: 0 10px 10px; }
.chart-box.tall { height: 300px; }

/* ------------------------------------------------------------------ defect page */
.def-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 300px)) minmax(0, 1fr); gap: 14px; align-items: start; }
.def-side { display: flex; flex-direction: column; gap: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 14px 14px; max-height: 520px; overflow: auto; }
.gcard { border-radius: 10px; overflow: hidden; background: rgba(255,255,255,0.03); border: 1px solid var(--line); cursor: pointer; }
.gcard img { width: 100%; height: 120px; object-fit: cover; display: block; background: #111; }
.gcard .gi { padding: 7px 9px; font-size: 11.5px; }
.gcard .gi b { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.gcard .gi small { color: var(--muted); }
.big-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 14px 14px; }
.big-stat div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.big-stat b { display: block; font-size: 26px; font-weight: 800; }
.big-stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.channels { display: grid; gap: 8px; padding: 0 14px 14px; }
.channel { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); font-size: 12.5px; }

/* ------------------------------------------------------------------ grading page */
.grade-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.grade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.tiles-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 0 14px 14px; max-height: 560px; overflow: auto; }
.tcard { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0b141c; }
.tcard img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.tcard .g { position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #04121a; }
.tcard .s { padding: 6px 8px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.tcard.new { animation: newalert 1.4s ease; }
.gA { background: var(--green); } .gB { background: var(--cyan); } .gC { background: var(--amber); } .gR { background: var(--red); color: #fff !important; }
.grade-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 14px 14px; }
.grade-legend div { padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.grade-legend b { font-size: 22px; display: block; }
.grade-legend span { color: var(--muted); font-size: 11px; }

/* ------------------------------------------------------------------ analytics */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg button { appearance: none; background: transparent; border: 0; color: var(--muted); padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.active { background: rgba(25,211,197,.15); color: var(--teal); }
.btn { appearance: none; border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary { background: linear-gradient(135deg, var(--teal), #7cf0c8); color: #00201c; border: 0; }
.an-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.an-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.tbl-wrap { overflow: auto; max-height: 520px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; background: var(--panel-solid); text-align: left; color: var(--muted); font-weight: 700; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: rgba(255,255,255,0.025); }
.tbl td img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }

/* ------------------------------------------------------------------ toast + modal */
.toasts { position: fixed; right: 20px; top: 80px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: 380px; max-width: calc(100vw - 32px); }
.toast { display: grid; grid-template-columns: 86px 1fr; gap: 12px; padding: 10px; border-radius: 14px; background: rgba(20, 10, 14, 0.92); border: 1px solid rgba(255,77,94,.55); box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 30px rgba(255,77,94,.25); animation: toastin .4s cubic-bezier(.2,.9,.3,1.2); backdrop-filter: blur(10px); }
.toast.overlap { border-color: rgba(255,176,32,.6); box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 30px rgba(255,176,32,.2); background: rgba(22, 16, 6, 0.92); }
.toast img { width: 86px; height: 86px; object-fit: cover; border-radius: 10px; }
.toast .tt { font-weight: 800; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.toast .tm { color: #d6c5c8; font-size: 12px; margin-top: 3px; }
.toast .tn { color: #9fb4c3; font-size: 11px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.toast.out { animation: toastout .4s ease forwards; }
@keyframes toastin { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateX(120%); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; display: none; place-items: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-bg.show { display: grid; }
.modal { width: min(1100px, 100%); max-height: 92vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal .mh { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal .mb { padding: 16px; }
.modal .mb img { max-width: 100%; border-radius: 10px; display: block; margin: 0 auto; }
.modal .cam { aspect-ratio: auto; }

.footer { margin-top: 18px; color: var(--dim); font-size: 11.5px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.footer img { height: 14px; vertical-align: middle; opacity: .8; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1700px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .def-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .def-grid .def-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1400px) {
  .live-grid { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: 1fr 1fr; }
  .bottom-grid { grid-template-columns: 1fr 1fr; }
  .bottom-grid > :first-child { grid-column: 1 / -1; }
  .nav button span.t { display: none; }
  .brand .prod small { display: none; }
}
@media (max-width: 1100px) {
  .cctv-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-grid, .an-grid, .an-grid2, .grade-cols { grid-template-columns: 1fr; }
  .flow-row { overflow-x: auto; padding-bottom: 6px; }
  .fnode { min-width: 150px; }
  .powered, .shift { display: none; }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; padding: 10px 16px; row-gap: 8px; }
  .nav { grid-column: 1 / -1; order: 3; overflow-x: auto; justify-content: flex-start; }
  .clock { display: none; }
  main { padding: 12px 16px 24px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cctv-wall { grid-template-columns: 1fr; }
  .side, .bottom-grid, .def-grid, .def-grid .def-side { grid-template-columns: 1fr; }
  .brand .kaj { height: 22px; }
  .brand .sep, .brand .prod { display: none; }
}

/* portrait inspection cameras: compact HUD */
.cam.portrait .hud-top { flex-direction: column; align-items: flex-start; gap: 4px; }
.cam.portrait .hud-top > div:last-child { align-self: stretch; justify-content: space-between; }
.cam.portrait .camtag { font-size: 11px; }
.cam.portrait .ai .aitxt { display: none; }
.cam.portrait .count .v { font-size: 18px; }
