:root {
  --ink: #12160f;
  --green: #5e7f14;
  --lime: #c8f135;
  --bg: #eef3ee;
  --card: #fff;
  --muted: #4a5e50;
  --line: #d5e0d4;
  --danger: #9b2c2c;
  --sidebar: #0f1412;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
.login, .gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.login .card { width: min(420px, 100%); }
.login img { width: 72px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin: 10px 0; }
input, select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.btn { border: 0; border-radius: 8px; padding: 8px 14px; background: var(--green); color: #fff; }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: var(--danger); min-height: 1.2em; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--sidebar); color: #eef3ee; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.side img { width: 48px; margin: 4px 8px 12px; }
.side button { text-align: left; background: transparent; color: inherit; border: 0; border-radius: 8px; padding: 10px 12px; }
.side button.on { background: var(--lime); color: var(--ink); font-weight: 650; }
.main { padding: 20px 24px 40px; }
.top { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.top select { min-width: 220px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat strong { display: block; font-size: 28px; color: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cam { display: grid; gap: 8px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border-radius: 999px; padding: 2px 8px; background: #f2f7e6; color: var(--green); font-size: 12px; }
.pill.off { background: #f4e8e8; color: var(--danger); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); }
.thumb { width: 96px; height: 64px; object-fit: cover; background: #ddd; border-radius: 6px; }
.modal { position: fixed; inset: 0; background: rgba(15, 20, 18, .55); display: grid; place-items: center; padding: 16px; }
.modal .card { width: min(760px, 100%); max-height: 90vh; overflow: auto; }
.stage { position: relative; width: min(640px, 100%); background: #111; }
.stage video, .stage canvas { width: 100%; display: block; }
.stage canvas { position: absolute; inset: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 140px 1fr 32px; gap: 8px; align-items: center; }
.bar span { height: 10px; background: var(--lime); border-radius: 99px; }
.note { color: var(--muted); font-size: 13px; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow: auto; }
  .stats { grid-template-columns: 1fr; }
}
