:root {
  --bg: #121212; --panel: #1e1e1e; --panel2: #2a2a2a; --fg: #e6e6e6; --muted: #909090;
  --accent: #3b82f6; --ok: #32cd32; --bad: #ff4d4d; --warn: #ffb020;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
[hidden] { display: none !important; }
button, input, select, textarea {
  font: inherit; color: var(--fg); background: var(--panel2); border: 1px solid #3c3c3c; border-radius: 4px; padding: 5px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.active { background: var(--accent); border-color: var(--accent); }
label { display: block; margin: 8px 0; }
label input:not([type=checkbox]), label select, label textarea { display: block; width: 100%; margin-top: 4px; }
label.inline { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); }
.warning { color: var(--warn); }
.center { display: grid; place-items: center; min-height: 100vh; }
.card { background: var(--panel); border-radius: 8px; padding: 16px 20px; }
#login-form { width: 340px; }
#login-form button { width: 100%; margin-top: 8px; }
h1 { font-size: 18px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 12px; }

header { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); }
header nav { display: flex; gap: 4px; }
.spacer { flex: 1; }

.live { display: flex; height: calc(100vh - 48px); }
aside { width: 260px; background: var(--panel); padding: 10px; overflow-y: auto; }
.layout { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.area { color: #7fb2ff; font-weight: 600; margin: 10px 0 4px; }
.cam { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 4px; cursor: pointer; }
.cam:hover { background: var(--panel2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: gray; flex: none; }
.dot.Online { background: var(--ok); } .dot.Offline { background: var(--bad); }

.grid { flex: 1; display: grid; gap: 2px; background: #000; padding: 2px; }
.tile { position: relative; background: #000; border: 2px solid #202020; min-height: 0; overflow: hidden; }
.tile.selected { border-color: var(--accent); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; align-items: center;
  padding: 3px 8px; background: rgba(20, 20, 20, .8); font-size: 12px; }
.tile .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #c0c0c0; text-align: center; padding: 10px; pointer-events: none; }
.grid.max .tile:not(.maximized) { display: none; }

.admin { padding: 16px; display: grid; gap: 16px; max-width: 1100px; }
table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #333; }
td button { padding: 2px 8px; }
dialog { background: var(--panel); color: var(--fg); border: 1px solid #3c3c3c; border-radius: 8px; width: min(520px, 95vw); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 12px 0 0; }
fieldset { border: 1px solid #3c3c3c; border-radius: 4px; max-height: 220px; overflow-y: auto; }
fieldset label { margin: 2px 0; }
.row { display: flex; gap: 8px; } .row label { flex: 1; }
