/* ============================================================================
   Digital Cops & Robbers — Hamerz Holding brand theme
   Tokens per Design/tokens.css + Design/CLAUDE.md. Brand colours are declared
   once as --hz-* and everything else references them; the legacy variable names
   (--cyan, --magenta, …) are kept as aliases so existing markup keeps working.
   ========================================================================== */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Hamerz tokens ---------- */
:root,
:root[data-theme="dark"] {
  --hz-bg:        #071312;
  --hz-bg-2:      #0A1918;
  --hz-surface:   #0F2422;
  --hz-raised:    #143230;
  --hz-border:    #22403D;
  --hz-text:      #E8F0EE;
  --hz-muted:     #8FA8A3;

  --hz-teal:      #006366;
  --hz-green:     #2DFF1E;
  --hz-lime:      #DFFF6C;
  --hz-slate:     #53595D;

  --hz-active:    #2DFF1E;
  --hz-pending:   #DFFF6C;
  --hz-inactive:  #8FA8A3;
  --hz-danger:    #FF8B7B;

  --hz-focus-ring: 0 0 0 3px rgba(45, 255, 30, .18);

  /* radius / spacing per spec */
  --hz-r-sm: 8px;  --hz-r-md: 12px;  --hz-r-lg: 16px;  --hz-r-pill: 999px;
  --hz-s-1: 4px; --hz-s-2: 8px; --hz-s-3: 16px; --hz-s-4: 24px; --hz-s-5: 32px;

  --hz-font-fa: "Vazirmatn", system-ui, "Segoe UI", Tahoma, sans-serif;
  /* production brand font is kalamehFaNum; Roboto Mono is not vendored offline,
     so numerals fall back to the platform mono stack. */
  --hz-font-mono: "Roboto Mono", ui-monospace, "Cascadia Mono", "Segoe UI Mono",
                  Consolas, monospace;

  /* Siren red. Deliberately NOT --hz-danger: the coral status colour is correct
     for panel states but too soft for a full-screen alarm read across a booth. */
  --hz-siren:     #FF2532;
}

:root[data-theme="light"] {
  --hz-bg:      #EEF3F1;
  --hz-bg-2:    #FFFFFF;
  --hz-surface: #FFFFFF;
  --hz-raised:  #F4F8F6;
  --hz-border:  #E1E9E6;
  --hz-text:    #0A1918;
  --hz-muted:   #5C6B67;
}

/* ---------- legacy aliases (do not use in new markup) ---------- */
:root {
  --bg: var(--hz-bg);
  --bg2: var(--hz-bg-2);
  --panel: var(--hz-surface);
  --panel-solid: var(--hz-surface);
  --panel2: var(--hz-raised);
  --line: var(--hz-border);
  --text: var(--hz-text);
  --muted: var(--hz-muted);
  --cyan: var(--hz-lime);        /* informational highlight */
  --magenta: var(--hz-danger);
  --purple: var(--hz-teal);
  --green: var(--hz-green);
  --amber: var(--hz-lime);
  --red: var(--hz-danger);
  --radius: var(--hz-r-lg);
  --font: var(--hz-font-fa);
  --glow-cyan: 0 0 0 3px rgba(45, 255, 30, .12);
  --grad: linear-gradient(120deg, var(--hz-green), var(--hz-lime));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  /* flat surfaces only — the token set has no gradients */
  background: var(--hz-bg);
  color: var(--hz-text);
  font-family: var(--hz-font-fa);
  font-size: 15px;               /* body step */
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--hz-lime); text-decoration: none; }
a:hover { color: var(--hz-green); }
button { font-family: inherit; }

/* numerals, IDs, codes — always LTR mono per spec */
.hz-mono, .num, .fpschip, .clock, td.n, .tbl td .n {
  font-family: var(--hz-font-mono);
  font-variant-numeric: tabular-nums;
}
.hz-mono { direction: ltr; unicode-bidi: isolate; }

/* mono kicker: 12px uppercase, .2em tracking, green */
.kicker {
  font-family: var(--hz-font-mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: .2em; color: var(--hz-green); direction: ltr; unicode-bidi: isolate;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hz-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--hz-teal); }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(45, 255, 30, .22); color: var(--hz-text); }

:focus-visible {
  outline: none;
  border-color: var(--hz-green) !important;
  box-shadow: var(--hz-focus-ring);
}

/* ============================ layout ============================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 196px; flex-shrink: 0;
  background: var(--hz-bg-2);
  border-inline-end: 1px solid var(--hz-border);
  display: flex; flex-direction: column;
  padding: var(--hz-s-4) var(--hz-s-2) var(--hz-s-3);
  gap: var(--hz-s-2);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.logo {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 0 var(--hz-s-2) var(--hz-s-2);
}
.logo img.wordmark { width: 108px; height: auto; display: block; }
.logo img.mark { width: 26px; height: 26px; display: none; }
/* caption sits under the wordmark and must not out-measure it */
.logo .sub {
  display: block; color: var(--hz-muted); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; margin-top: 7px; font-family: var(--hz-font-mono);
  direction: ltr;
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--hz-s-3); flex: 1; }
.nav a {
  padding: 10px 12px; border-radius: var(--hz-r-md); color: var(--hz-muted);
  font-weight: 600; transition: background .16s, color .16s;
  display: flex; align-items: center; gap: 10px;
}
.nav a .ic {
  width: 20px; height: 20px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; color: currentColor;
}
.nav a .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { color: var(--hz-text); background: var(--hz-raised); }
.nav a.active {
  color: var(--hz-green); background: rgba(45, 255, 30, .12); font-weight: 700;
}
:root[data-theme="light"] .nav a.active { background: var(--hz-teal); color: var(--hz-lime); }

.sidebar .foot {
  display: flex; flex-direction: column; gap: var(--hz-s-2);
  padding-top: var(--hz-s-3); border-top: 1px solid var(--hz-border);
}

.main { flex: 1; padding: var(--hz-s-5) var(--hz-s-5); min-width: 0; }
.pagehead {
  display: flex; align-items: center; gap: var(--hz-s-3);
  margin-bottom: var(--hz-s-4); flex-wrap: wrap;
}
.pagehead h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; color: var(--hz-text); }
.spacer { flex: 1; }

/* type scale: 44 / 34 / 24 / 18 / 15 body / 13 caption */
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; color: var(--hz-text); letter-spacing: 0; }
h3 { font-size: 15px; font-weight: 600; color: var(--hz-text); }

/* ============================ surfaces ============================ */
.card {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-radius: var(--hz-r-lg); padding: var(--hz-s-3);
}

.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--hz-s-3); margin-bottom: var(--hz-s-4);
}
/* stat card: surface + big mono number + caption. No rails, no per-card tinting —
   lime is the "highlight number" colour for all of them so the row reads as one unit. */
.stat { padding: var(--hz-s-3); }
.stat .num { font-size: 34px; font-weight: 700; color: var(--hz-lime); line-height: 1.15; }
.stat .lbl { color: var(--hz-muted); font-size: 13px; margin-top: var(--hz-s-1); }

/* ============================ buttons (pills) ============================ */
.btn {
  background: transparent; border: 1px solid var(--hz-border); color: var(--hz-text);
  padding: 10px 20px; border-radius: var(--hz-r-pill); cursor: pointer;
  font-weight: 600; font-size: 14px; transition: border-color .16s, color .16s, background .16s;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--hz-s-2);
}
.btn:hover { border-color: var(--hz-green); color: var(--hz-green); }
.btn:focus-visible { box-shadow: var(--hz-focus-ring); border-color: var(--hz-green); }

.btn.primary {
  background: var(--hz-green); border-color: var(--hz-green); color: #071312; font-weight: 700;
}
.btn.primary:hover { background: #4BFF3E; border-color: #4BFF3E; color: #071312; }

.btn.secondary { background: transparent; border-color: var(--hz-green); color: var(--hz-green); }

.btn.danger { border-color: var(--hz-danger); color: var(--hz-danger); }
.btn.danger:hover { background: rgba(255, 139, 123, .12); border-color: var(--hz-danger); color: var(--hz-danger); }

.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.big { padding: 13px 28px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ============================ form controls ============================ */
input, select, textarea {
  background: var(--hz-bg-2); border: 1px solid var(--hz-border); color: var(--hz-text);
  padding: 11px 13px; border-radius: var(--hz-r-md); font-family: inherit; font-size: 14px;
  outline: none; width: 100%; transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--hz-green); box-shadow: var(--hz-focus-ring);
}
input::placeholder, textarea::placeholder { color: var(--hz-muted); }

/* checkboxes / radios pick up the action colour */
input[type="checkbox"], input[type="radio"] {
  width: auto; accent-color: var(--hz-green); cursor: pointer;
}

/* range slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none; background: transparent;
  padding: 0; border: none; height: 22px; cursor: pointer;
}
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--hz-r-pill); background: var(--hz-raised);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -7px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--hz-green); border: none;
}
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--hz-focus-ring); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: var(--hz-r-pill); background: var(--hz-raised); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--hz-green); }

/* file picker — style the native button so it stops rendering as a white chip */
input[type="file"] { padding: 8px; cursor: pointer; }
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font-family: inherit; font-weight: 600; font-size: 13px;
  background: var(--hz-raised); color: var(--hz-text);
  border: 1px solid var(--hz-border); border-radius: var(--hz-r-pill);
  padding: 7px 16px; margin-inline-end: 12px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  border-color: var(--hz-green); color: var(--hz-green);
}
label.f { display: block; margin-bottom: var(--hz-s-3); }
label.f span {
  display: block; color: var(--hz-muted); font-size: 13px; margin-bottom: 6px;
  letter-spacing: 0; text-transform: none;
}
.row { display: flex; gap: var(--hz-s-2); align-items: center; flex-wrap: wrap; }

/* ============================ status chips ============================ */
/* pill, 14% tinted bg + 7px dot + coloured text */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: var(--hz-r-pill); font-size: 13px; font-weight: 600; border: none;
}
.badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge.wanted   { background: rgba(255, 139, 123, .14); color: var(--hz-danger); }
.badge.review   { background: rgba(223, 255, 108, .14); color: var(--hz-pending); }
.badge.ok       { background: rgba(45, 255, 30, .14);   color: var(--hz-green); }
.badge.off      { background: rgba(143, 168, 163, .14); color: var(--hz-inactive); }
.badge.stolen, .badge.wanted-v { background: rgba(255, 139, 123, .14); color: var(--hz-danger); }
.badge.violated { background: rgba(223, 255, 108, .14); color: var(--hz-pending); }
.badge.normal   { background: rgba(45, 255, 30, .14);   color: var(--hz-green); }
.badge.purple   { background: rgba(0, 99, 102, .35);    color: #7FD8DA; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: var(--hz-r-pill); font-size: 13px; font-weight: 600;
  background: var(--hz-raised); border: 1px solid var(--hz-border); color: var(--hz-text);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--hz-muted); }
.chip.ok  { color: var(--hz-green);  border-color: transparent; background: rgba(45, 255, 30, .14); }
.chip.ok::before  { background: var(--hz-green); }
.chip.bad { color: var(--hz-danger); border-color: transparent; background: rgba(255, 139, 123, .14); }
.chip.bad::before { background: var(--hz-danger); }

/* ============================ camera grid ============================ */
.camgrid { display: grid; gap: var(--hz-s-3); grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.camtile {
  position: relative; border: 1px solid var(--hz-border); border-radius: var(--hz-r-lg);
  overflow: hidden; background: #000; cursor: pointer; transition: border-color .16s;
}
.camtile:hover { border-color: var(--hz-teal); }
.camtile img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: contain; background: #000; }
.camtile .caption {
  position: absolute; inset-inline-start: 0; top: 0; display: flex; gap: var(--hz-s-2);
  align-items: center; background: rgba(7, 19, 18, .82); padding: 6px 12px;
  border-end-end-radius: var(--hz-r-md); font-weight: 600; font-size: 13px;
  backdrop-filter: blur(6px);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hz-danger); flex-shrink: 0; }
.dot.on { background: var(--hz-green); }
.fpschip {
  position: absolute; inset-inline-end: 10px; top: 8px; background: rgba(7, 19, 18, .8);
  color: var(--hz-lime); font-size: 12px; padding: 3px 10px; border-radius: var(--hz-r-pill);
  backdrop-filter: blur(6px); direction: ltr;
}

/* ============================ people cards ============================ */
.peoplegrid { display: grid; gap: var(--hz-s-3); grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.person {
  background: var(--hz-surface); border: 1px solid var(--hz-border); border-radius: var(--hz-r-lg);
  overflow: hidden; cursor: pointer; transition: transform .14s, border-color .14s;
}
.person:hover { transform: translateY(-2px); border-color: var(--hz-teal); }
.person.wanted { border-color: var(--hz-danger); }
.person img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--hz-bg-2); display: block; }
.noimg {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  color: var(--hz-muted); background: var(--hz-bg-2); border-radius: var(--hz-r-md);
}
.noimg svg { width: 40px; height: 40px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.person .info { padding: 10px 12px; }
.person .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .sub { color: var(--hz-muted); font-size: 13px; min-height: 18px; }

/* ============================ tables ============================ */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: start; color: var(--hz-muted); font-size: 13px; font-weight: 600;
  padding: 12px; background: var(--hz-bg-2); letter-spacing: 0; text-transform: none;
}
.tbl thead th:first-child { border-start-start-radius: var(--hz-r-md); }
.tbl thead th:last-child  { border-start-end-radius: var(--hz-r-md); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--hz-raised); vertical-align: middle; }
.tbl tr:hover td { background: var(--hz-raised); }
.thumb { width: 42px; height: 42px; border-radius: var(--hz-r-sm); object-fit: cover; background: var(--hz-bg-2); }

/* ============================ modal ============================ */
.modal-back {
  position: fixed; inset: 0; background: rgba(7, 19, 18, .82); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 5vh var(--hz-s-3);
  overflow: auto; backdrop-filter: blur(4px);
}
.modal-back.open { display: flex; }
.modal {
  background: var(--hz-surface); border: 1px solid var(--hz-border); border-radius: var(--hz-r-lg);
  width: 100%; max-width: 640px; padding: var(--hz-s-4); position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.modal h2 {
  font-size: 18px; font-weight: 700; margin-bottom: var(--hz-s-3); color: var(--hz-text);
  letter-spacing: 0; text-transform: none;
}
.modal .close {
  position: absolute; inset-inline-end: 14px; top: 12px; background: none; border: none;
  color: var(--hz-muted); font-size: 20px; cursor: pointer; line-height: 1;
  width: 30px; height: 30px; border-radius: var(--hz-r-pill);
}
.modal .close:hover { color: var(--hz-text); background: var(--hz-raised); }
.facegal { display: flex; gap: var(--hz-s-2); flex-wrap: wrap; }
.facegal .fitem { position: relative; }
.facegal img {
  width: 74px; height: 74px; border-radius: var(--hz-r-md); object-fit: cover;
  border: 2px solid var(--hz-border); cursor: pointer;
}
.facegal img.primary { border-color: var(--hz-green); }
.facegal .del {
  position: absolute; top: -6px; inset-inline-end: -6px; background: var(--hz-danger);
  color: #071312; border: none; width: 20px; height: 20px; border-radius: 50%;
  font-size: 12px; cursor: pointer; line-height: 1; font-weight: 700;
}

/* ============================ toasts ============================ */
#toasts {
  position: fixed; bottom: var(--hz-s-4); inset-inline-end: var(--hz-s-4); z-index: 300;
  display: flex; flex-direction: column; gap: var(--hz-s-2);
}
.toast {
  background: var(--hz-surface); border: 1px solid var(--hz-border);
  border-inline-start: 3px solid var(--hz-green);
  border-radius: var(--hz-r-md); padding: 12px 18px; animation: slidein .18s ease-out;
  max-width: 340px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font-size: 14px;
}
.toast.alarm { border-inline-start-color: var(--hz-danger); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ============================ tabs / misc ============================ */
.filterbar { display: flex; gap: var(--hz-s-2); margin-bottom: var(--hz-s-3); flex-wrap: wrap; align-items: center; }
.tab {
  padding: 7px 16px; border-radius: var(--hz-r-pill); border: 1px solid var(--hz-border);
  color: var(--hz-muted); cursor: pointer; background: none; font-weight: 600; font-size: 13px;
}
.tab:hover { color: var(--hz-text); }
.tab.active { color: var(--hz-green); border-color: var(--hz-green); background: rgba(45, 255, 30, .12); }

.empty { color: var(--hz-muted); text-align: center; padding: 48px var(--hz-s-3); }

.focuswrap { position: relative; display: inline-block; max-width: 100%; }
.focuswrap img { max-width: 100%; display: block; border-radius: var(--hz-r-md); }
.detbox { position: absolute; border: 2px solid var(--hz-green); border-radius: var(--hz-r-sm); cursor: pointer; }
.detbox:hover { background: rgba(45, 255, 30, .15); }
.detbox.wanted { border-color: var(--hz-danger); }
.detbox span {
  position: absolute; top: -22px; left: 0; background: rgba(7, 19, 18, .9);
  font-size: 12px; padding: 2px 8px; border-radius: var(--hz-r-sm); white-space: nowrap;
}

/* ============================ v2 modules ============================ */
.draw-btn {
  background: var(--hz-green); border: none; color: #071312; font-weight: 700; font-size: 15px;
  padding: 12px 26px; border-radius: var(--hz-r-pill); cursor: pointer; transition: background .16s;
}
.draw-btn:hover { background: #4BFF3E; }
.draw-btn:active { transform: scale(.98); }

.draw-spinner {
  width: 54px; height: 54px; margin: 28px auto; border-radius: 50%;
  border: 3px solid var(--hz-border); border-top-color: var(--hz-green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.zone-canvas-wrap {
  position: relative; display: inline-block; max-width: 100%;
  border: 1px solid var(--hz-border); border-radius: var(--hz-r-md); overflow: hidden;
}
.zone-canvas-wrap canvas { display: block; max-width: 100%; cursor: crosshair; }
.color-swatch {
  width: 26px; height: 26px; border-radius: var(--hz-r-sm); border: 2px solid var(--hz-border);
  cursor: pointer; display: inline-block;
}
.color-swatch.sel { border-color: var(--hz-green); box-shadow: var(--hz-focus-ring); }

/* Iranian plate — intentionally keeps real-world plate colours, not brand */
.plate {
  display: inline-flex; align-items: center; gap: 6px; direction: rtl;
  background: #f2f4f7; color: #111; font-weight: 700; border-radius: var(--hz-r-sm);
  padding: 5px 12px; border: 2px solid #111; font-size: 16px;
  box-shadow: inset 3px 0 0 #1560d0;
}
.plate.big { font-size: 34px; padding: 10px 20px; }
.plate-inputs { display: flex; gap: 6px; align-items: center; direction: rtl; }
.plate-inputs input, .plate-inputs select { width: 62px; text-align: center; font-size: 16px; font-weight: 700; }
.plate-inputs input.d3 { width: 78px; }
.plate-inputs .sep { color: var(--hz-muted); }

.subtabs { display: flex; gap: var(--hz-s-1); margin-bottom: var(--hz-s-4); border-bottom: 1px solid var(--hz-border); }
.subtab {
  padding: 10px 18px; color: var(--hz-muted); cursor: pointer; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--hz-text); }
.subtab.active { color: var(--hz-green); border-bottom-color: var(--hz-green); }

.bar-chart { display: flex; align-items: flex-end; gap: var(--hz-s-1); height: 200px; padding: var(--hz-s-3) var(--hz-s-2); }
.bar-chart .bar {
  flex: 1; background: var(--hz-teal); border-radius: var(--hz-r-sm) var(--hz-r-sm) 0 0;
  min-height: 2px; position: relative; transition: height .4s;
}
.bar-chart .bar:hover { background: var(--hz-green); }
.bar-chart .bar span {
  position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 12px;
  color: var(--hz-lime); font-family: var(--hz-font-mono);
}
.bar-chart .bar small {
  position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 12px;
  color: var(--hz-muted); font-family: var(--hz-font-mono);
}
.heatmap-view img { max-width: 100%; border-radius: var(--hz-r-md); border: 1px solid var(--hz-border); }

tr.inside td { background: rgba(45, 255, 30, .07); }

/* ============================ public display ============================ */
body.display { background: var(--hz-bg); overflow: hidden; cursor: none; }
.disp-grid { display: grid; gap: var(--hz-s-2); padding: var(--hz-s-2); height: calc(100vh - 60px); }
.disp-grid .camtile { cursor: default; }
.disp-grid .camtile img { height: 100%; width: 100%; object-fit: contain; aspect-ratio: auto; }
.disp-bar {
  height: 60px; display: flex; align-items: center; padding: 0 var(--hz-s-4); gap: var(--hz-s-4);
  border-top: 1px solid var(--hz-border); background: var(--hz-bg-2); font-size: 15px;
}
.disp-bar .brand { display: flex; align-items: center; gap: var(--hz-s-2); }
.disp-bar .brand img { height: 26px; width: auto; display: block; }
.disp-bar .ticker { flex: 1; overflow: hidden; white-space: nowrap; color: var(--hz-muted); }
.disp-bar .clock { color: var(--hz-lime); font-weight: 600; }

#alarm-overlay {
  position: fixed; inset: 0; z-index: 500; display: none;
  align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(ellipse at center, rgba(120, 10, 18, .58), rgba(24, 3, 6, .94));
}
#alarm-overlay.open { display: flex; animation: alarmflash .55s infinite, shake .35s infinite; }
@keyframes alarmflash {
  0%, 100% { box-shadow: inset 0 0 150px 45px rgba(255, 37, 50, .85); }
  50%      { box-shadow: inset 0 0 60px 10px rgba(255, 37, 50, .28); }
}
@keyframes shake {
  0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-6px, 4px); }
  40% { transform: translate(6px, -4px); } 60% { transform: translate(-5px, -3px); }
  80% { transform: translate(5px, 3px); }
}
.alarm-card {
  background: #140306; border: 3px solid var(--hz-siren); border-radius: 22px;
  padding: 34px 50px; text-align: center; max-width: 82vw;
  box-shadow: 0 0 80px rgba(255, 37, 50, .6);
  animation: cardpop .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes cardpop { from { transform: scale(.6); opacity: 0; } }
.alarm-card .wtitle {
  color: var(--hz-siren); font-size: clamp(34px, 6vw, 72px); font-weight: 800;
  letter-spacing: .08em; animation: pulse .7s infinite;
}
.alarm-card img {
  width: clamp(140px, 22vw, 260px); height: clamp(140px, 22vw, 260px);
  object-fit: cover; border-radius: var(--hz-r-lg); border: 3px solid var(--hz-siren); margin: 18px 0;
}
.alarm-card .aname { font-size: clamp(26px, 4vw, 48px); font-weight: 700; color: #fff; }
.alarm-card .amsg { font-size: clamp(16px, 2.2vw, 26px); color: var(--hz-danger); margin-top: 10px; }
.alarm-card .awhere { color: var(--hz-lime); margin-top: 14px; font-size: clamp(14px, 2vw, 22px); }

#sound-gate {
  position: fixed; inset: 0; z-index: 600; background: rgba(7, 19, 18, .93);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: var(--hz-s-3); color: var(--hz-green); font-size: 22px; cursor: pointer;
}

.scan::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .10) 2px 4px);
}

/* lottery celebration — lime/green, brand-consistent */
#lottery-overlay {
  position: fixed; inset: 0; z-index: 520; display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 99, 102, .72), rgba(7, 19, 18, .96));
}
#lottery-overlay.open { display: flex; }
.lottery-card {
  background: var(--hz-surface); border: 3px solid var(--hz-green);
  border-radius: 24px; padding: 40px 60px; text-align: center;
  box-shadow: 0 0 80px rgba(45, 255, 30, .35); animation: cardpop .4s cubic-bezier(.2, 1.6, .4, 1);
}
.lottery-card .ltitle {
  font-size: clamp(28px, 5vw, 58px); font-weight: 800; letter-spacing: .06em; color: var(--hz-green);
}
.lottery-card img {
  width: clamp(150px, 24vw, 280px); height: clamp(150px, 24vw, 280px); object-fit: cover;
  border-radius: 20px; border: 4px solid var(--hz-lime); margin: 20px 0;
  box-shadow: 0 0 50px rgba(223, 255, 108, .35);
}
.lottery-card .lname { font-size: clamp(30px, 5vw, 60px); font-weight: 800; color: var(--hz-text); }
#confetti { position: fixed; inset: 0; z-index: 515; pointer-events: none; display: none; }
#confetti.on { display: block; }

.veh-alarm-card { border-color: var(--hz-lime) !important; }
.veh-alarm-card .plate.big { margin: 18px auto; }

body.display .disp-grid { position: relative; }
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(0, 99, 102, .10) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0, 99, 102, .10) 1px, transparent 1px);
  background-size: 44px 44px; animation: griddrift 18s linear infinite;
}
@keyframes griddrift { from { background-position: 0 0; } to { background-position: 44px 44px; } }

/* ============================ responsive ============================ */
@media (max-width: 900px) {
  .sidebar { width: 72px; padding: var(--hz-s-4) var(--hz-s-2); }
  .sidebar .logo { justify-content: center; }
  .sidebar .logo img.wordmark, .sidebar .logo .sub { display: none; }
  .sidebar .logo img.mark { display: block; }
  .nav a { justify-content: center; padding: 11px 0; }
  .nav a > span:not(.ic) { display: none; }
  .sidebar .foot .btn span { display: none; }
  .main { padding: var(--hz-s-4) var(--hz-s-3); }
}

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