﻿:root { color-scheme: dark; --bg:#0b1018; --panel:#121c29; --panel-2:#1b293b; --line:#304057; --text:#edf3fc; --muted:#afbed0; --accent:#4a9cff; --ok:#4cdb99; }
* { box-sizing:border-box; }
html,body { margin:0; height:100%; background:var(--bg); color:var(--text); font:15px/1.45 system-ui,-apple-system,'Segoe UI',sans-serif; }
.hidden { display:none!important; }
.muted { color:var(--muted); font-weight:400; }
button,select { font:inherit; color:var(--text); background:var(--panel-2); border:1px solid var(--line); border-radius:7px; padding:9px 12px; cursor:pointer; }
button:hover,select:hover { background:#283c55; }
button:disabled,select:disabled { opacity:.45; cursor:default; }
button:focus-visible,select:focus-visible,.tile:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.ghost.active { border-color:var(--accent); background:#203d60; }
.screen { min-height:100%; }
#boot-screen { display:grid; place-items:center; padding:24px; }
.card { width:100%; max-width:390px; padding:32px; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:0 24px 70px #0006; }
.card h1 { font-size:24px; margin:18px 0 6px; }
.card .sub,#boot-status { color:var(--muted); }
#boot-retry { width:100%; margin-top:18px; }
.dot { display:inline-block; width:10px; height:10px; flex-shrink:0; border-radius:50%; background:var(--ok); box-shadow:0 0 0 4px #4cdb991a; }
#app-screen { height:100%; display:flex; flex-direction:column; }
.topbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:14px; padding:14px 20px; background:var(--panel); border-bottom:1px solid var(--line); }
.brand,.actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.brand strong { font-size:18px; }
.brand .muted { font-size:12px; }
.actions { gap:7px; }
.ghost { font-size:13px; }
.layout { display:flex; flex:1; min-height:0; }
.sidebar { width:225px; flex:0 0 225px; background:var(--panel); border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:0; }
.sidebar-head { display:flex; justify-content:space-between; align-items:center; padding:16px 14px; font-weight:600; border-bottom:1px solid var(--line); }
.link { padding:3px; border:0; background:transparent; color:#83bcff; font-size:12px; }
.channels { overflow:auto; padding:10px; flex:1; }
.channel { width:100%; display:flex; align-items:center; gap:9px; padding:12px 9px; margin-bottom:5px; background:transparent; border:1px solid transparent; text-align:left; font-size:14px; }
.channel.selected { background:#203d60; border-color:var(--accent); }
.channel.offline { color:var(--muted); }
.channel .status { width:7px; height:7px; border-radius:50%; flex:0 0 7px; background:var(--ok); }
.channel.offline .status { background:#768296; }
.channel .num { font-size:12px; color:var(--muted); }
.channel > span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.channel-count { color:var(--muted); font-size:12px; padding:14px; border-top:1px solid var(--line); }
.viewer { flex:1; min-width:0; min-height:0; display:flex; flex-direction:column; background:var(--bg); }
.viewer-toolbar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; padding:14px 18px; }
.viewer-toolbar h1 { font-size:18px; margin:0 0 3px; }
.viewer-toolbar p { color:var(--muted); font-size:12px; margin:0; }
.view-options { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.view-options label { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
select { max-width:200px; padding:7px 9px; font-size:13px; }
.pagination { display:flex; align-items:center; gap:8px; font-size:12px; }
.pagination button { padding:4px 11px; font-size:22px; }
.tiles { display:grid; flex:1; min-height:0; gap:10px; padding:0 16px 16px; grid-auto-rows:minmax(0,1fr); }
.tiles.single { grid-template-columns:minmax(0,1fr); }
.grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); }
.grid-9 { grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:repeat(3,minmax(0,1fr)); }
.grid-16 { grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-rows:repeat(4,minmax(0,1fr)); }
.tile { margin:0; position:relative; min-width:0; min-height:0; display:flex; flex-direction:column; overflow:hidden; background:#000; border:1px solid var(--line); border-radius:8px; cursor:pointer; }
.tile:hover { border-color:var(--accent); }
.media { flex:1; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; }
.media img,.media video,.media nvr-video { width:100%; height:100%; min-width:0; min-height:0; object-fit:contain; display:block; }
.tile figcaption { position:relative; z-index:2; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:2px 12px; padding:7px 10px; background:#162130; font-size:13px; flex-shrink:0; }
.tile figcaption > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stream-status { font-size:11px; color:#b4c6dc; white-space:nowrap; }
.offline-msg { position:absolute; inset:0 0 38px; display:grid; place-items:center; padding:18px; text-align:center; font-size:14px; color:var(--muted); background:#080e17; }
.tile:fullscreen { width:100%; height:100%; border:0; border-radius:0; }
.viewer:fullscreen { width:100%; height:100%; }
@media(max-width:1100px) { .sidebar { width:190px; flex-basis:190px; } .viewer-toolbar { padding:12px; } .view-options { gap:8px; } .tiles { padding:0 10px 10px; gap:7px; } }
@media(max-width:760px) { #app-screen { height:auto; min-height:100%; } .layout { flex-direction:column; } .sidebar { width:100%; flex:0 0 auto; max-height:170px; border-right:0; border-bottom:1px solid var(--line); } .sidebar-head,.channel-count { display:none; } .channels { display:flex; gap:5px; padding:8px; } .channel { flex:0 0 auto; width:auto; margin:0; } .topbar { padding:12px; } .brand .muted { display:none; } .actions { gap:5px; } .ghost { padding:7px 9px; font-size:12px; } .viewer { min-height:70vh; } .tiles { flex:none; grid-template-rows:none; grid-auto-rows:auto; } .grid-9,.grid-16 { grid-template-columns:repeat(2,minmax(0,1fr)); } .tile { min-height:170px; } .media { height:160px; flex:auto; } .single .media { height:55vh; } .viewer:fullscreen { overflow:auto; } }
@media(max-width:440px) { .tiles.grid { grid-template-columns:minmax(0,1fr); } }
#login-dialog, #admin-screen { max-width: 38rem; padding: 1.5rem; }
#admin-screen { margin: 1rem auto; }
#login-dialog { background: #1b2431; color: #f4f6fa; border: 1px solid #61748a; border-radius: 10px; }
#login-dialog::backdrop { background: #0a101acc; }
#login-form label, #admin-form label { display: block; margin: .75rem 0; }
#login-form input, #admin-form input:not([type=checkbox]), #admin-form select, #admin-form textarea { display: block; width: 100%; }
#logout { position: fixed; right: 1rem; bottom: 1rem; z-index: 10; }
