/* Colors, type and spacing follow the "Monitoring CCTV" design canvas. */
:root {
  --bg: #0D1117; --panel: #151B23; --line: #262E38; --active: #1F2A37;
  --text: #E6EDF3; --muted: #9BA7B4; --accent: #58A6FF; --accent-hover: #8CC2FF;
  --ok: #3FB950; --warn: #F0A23B; --bad: #FF7B72; --video: #07090C;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); } a:hover { color: var(--accent-hover); }
h1 { margin: 0; font-size: 24px; font-weight: 700; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 232px; max-width: 100%; background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand b { font-size: 16px; letter-spacing: .04em; display: block; }
.brand small { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { min-height: 44px; padding: 0 12px; border-radius: 6px; display: flex; align-items: center; gap: 12px;
  text-decoration: none; font-weight: 500; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--active); color: var(--text); }
.nav a:hover { color: var(--text); }
.who { border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; flex-direction: column; gap: 2px; }
.who form { margin-top: 8px; }
main { flex: 999 1 560px; min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.head > div { display: flex; flex-direction: column; gap: 4px; }

.btn { min-height: 44px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center;
  text-decoration: none; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.small { min-height: 36px; padding: 0 12px; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 0; min-height: 0; }

.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.card { flex: 1 1 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.card .big { font-size: 30px; font-weight: 700; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px;
  display: flex; flex-direction: column; gap: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; }
label, .label { font-size: 12px; color: var(--muted); }
input[type=text], input[type=search], input[type=password], input:not([type]), select {
  min-height: 44px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; width: 100%; }
input:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.table-box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; text-align: left; }
th { padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
td { padding: 10px 16px; border-top: 1px solid var(--line); }
td.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 16px; }
td.actions form { margin: 0; }
.ok { color: var(--ok); font-weight: 600; } .warn { color: var(--warn); font-weight: 600; }
.bad { color: var(--bad); }

.form { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.error { background: #3A1D1D; border: 1px solid var(--bad); color: var(--text); border-radius: 6px; padding: 10px 14px; }
.note { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; color: var(--muted); }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .panel { width: 100%; max-width: 380px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { position: relative; aspect-ratio: 16 / 9; background: var(--video); border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tile .name { position: absolute; top: 8px; left: 10px; font-family: var(--mono); font-size: 12px; color: var(--text); }
.qr svg, .qr img { background: #fff; padding: 12px; border-radius: 8px; width: 220px; height: 220px; }

@media (max-width: 720px) {
  .sidebar { flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); gap: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { flex: 1 1 auto; justify-content: center; }
  main { padding: 16px; }
}
.strong { font-weight: 600; }
.small-text { font-size: 12px; }
.brand.flush { padding: 0; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 10px 0; border-top: 1px solid var(--line); }
.field.narrow { flex: 0 1 200px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.scroll-x { overflow-x: auto; }
.unit { font-size: 16px; font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.segmented { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.seg { min-height: 44px; min-width: 52px; border: 0; border-radius: 4px; font: inherit; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--text); }
.seg[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.grid { display: grid; gap: 8px; }
.grid-1 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-16 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: none; }
.tile.has-camera video { display: block; }
.tile .tile-empty { display: block; }
.tile.has-camera .tile-empty { display: none; }
.tile .badge { position: absolute; top: 8px; right: 10px; font-family: var(--mono); font-size: 12px; color: var(--warn); }
.grid.offline .tile.has-camera .badge::before { content: "OFFLINE "; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px;
  background: rgba(13, 17, 23, .78); opacity: 0; transition: opacity .15s; }
.tile:hover .tile-bar, .tile:focus-within .tile-bar, .tile:not(.has-camera) .tile-bar { opacity: 1; }
.tile-bar select { min-height: 36px; width: auto; flex: 1 1 140px; }
.tile:fullscreen { aspect-ratio: auto; }
.playback { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.player-panel { flex: 2 1 480px; min-width: 0; }
.player-panel video { width: 100%; aspect-ratio: 16 / 9; background: var(--video); border-radius: 6px; }
.clip-list { flex: 1 1 280px; min-width: 0; max-height: 640px; overflow-y: auto; }
.clip-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.play[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.speed { width: auto; }
.kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--active); color: var(--muted); }
.kind-datang { color: var(--accent); } .kind-penting { color: var(--warn); }
@media (max-width: 720px) {
  .grid-9, .grid-16 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-bar { opacity: 1; position: static; background: none; }
}
