/* Video CCTV Pro — ops console theme
   Palette: near-black blue-grey base, steel panels, signal green = recording,
   amber = warning, red = error/hotlist. Monospace for timestamps/plates
   (they're data, not prose). */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2129;
  --border: #2d333b;
  --text: #d5dbe1;
  --muted: #7d8590;
  --rec: #3fb950;        /* recording / online */
  --warn: #d29922;
  --err: #f85149;
  --accent: #58a6ff;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 4px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 12px; height: 48px; position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; margin-right: 16px; letter-spacing: .3px; }
.topbar .brand .dot { color: var(--rec); }
.topbar button.nav {
  background: none; border: none; color: var(--muted); padding: 6px 12px;
  cursor: pointer; font-size: 14px; border-radius: 6px;
}
.topbar button.nav:hover { color: var(--text); background: var(--panel2); }
.topbar button.nav.active { color: var(--text); background: var(--panel2); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 12px; margin-right: 8px; }

.page { padding: 16px; max-width: 1280px; margin: 0 auto; }
h2 { font-size: 18px; margin-bottom: 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* cards + tables */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--panel2); }
.mono { font-family: var(--mono); font-size: 13px; }

/* status pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.recording { background: rgba(63,185,80,.15); color: var(--rec); }
.pill.offline   { background: rgba(125,133,144,.15); color: var(--muted); }
.pill.error     { background: rgba(248,81,73,.15); color: var(--err); }
.pill.disabled  { background: rgba(125,133,144,.15); color: var(--muted); }
.pill.hot       { background: rgba(248,81,73,.2); color: var(--err); }

/* forms */
input, select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 7px 10px; font-size: 14px; width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
button.btn {
  background: var(--accent); color: #0d1117; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
button.btn.danger { background: var(--err); color: #fff; }
button.btn:disabled { opacity: .5; cursor: default; }

/* login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 340px; }
.login-box .brand { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 18px; }

/* playback */
.player video { width: 100%; border-radius: 8px; background: #000; }
.seglist { max-height: 420px; overflow-y: auto; }
.seg { padding: 6px 10px; border-radius: 6px; cursor: pointer; font-family: var(--mono); font-size: 13px; display: flex; justify-content: space-between; }
.seg:hover { background: var(--panel2); }
.seg.active { background: var(--panel2); color: var(--accent); }

/* alpr */
.alpr-thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 4px; cursor: pointer; background: #000; }
.plate { font-family: var(--mono); font-weight: 700; letter-spacing: 1px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 140px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; width: min(680px, 92vw); max-height: 88vh; overflow-y: auto; }
.modal img { max-width: 100%; border-radius: 6px; }

/* toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 8px; display: none; z-index: 100; }

/* usage meter */
.meter { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.meter > div { height: 100%; background: var(--rec); }
.meter.warn > div { background: var(--warn); }
.meter.full > div { background: var(--err); }

/* live multiview */
.live-grid { display: grid; gap: 8px; }
.live-tile { position: relative; background: #000; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 16/9; }
.live-tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px 8px; font-size: 12px; background: rgba(13,17,23,.72); }
.tile-status { color: var(--rec); }
.live-tile.enlarged { position: fixed; inset: 4vh 4vw; z-index: 60; aspect-ratio: auto; box-shadow: 0 0 0 100vmax rgba(0,0,0,.75); }
body.has-enlarged .live-grid .live-tile:not(.enlarged) { filter: brightness(.5); }
