/* ============ Камеры — «консоль наблюдения» ============ */
:root {
  color-scheme: dark;
  --bg: #07090c; --bg-raise: #0b0e13; --surface: #10141a; --surface-2: #151a22; --surface-3: #1c222c;
  --line: rgba(150, 170, 200, .10); --line-strong: rgba(150, 170, 200, .20);
  --text: #e9edf3; --text-2: #a3adbc; --text-3: #6c768a;
  --accent: #5a9bff; --accent-ink: #06142e; --accent-soft: rgba(90, 155, 255, .14); --accent-line: rgba(90, 155, 255, .42);
  --ok: #3fd49a; --warn: #f6b73c; --bad: #ff6270;
  --glass: rgba(8, 10, 14, .58); --glass-line: rgba(255, 255, 255, .13);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.7);
  --glow: radial-gradient(1100px 520px at 50% -12%, rgba(90,155,255,.10), transparent 62%);
  --r: 18px; --r-sm: 12px; --r-xs: 8px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --topbar-h: 56px; --tabbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", Inter, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="light"] { color-scheme: light; --bg:#eef1f6; --bg-raise:#e6eaf1; --surface:#fff; --surface-2:#f4f6fa; --surface-3:#e8ecf3; --line:rgba(20,30,50,.09); --line-strong:rgba(20,30,50,.17); --text:#0e1420; --text-2:#475368; --text-3:#7b8699; --accent:#2c6be0; --accent-ink:#fff; --accent-soft:rgba(44,107,224,.10); --accent-line:rgba(44,107,224,.40); --ok:#0b9a69; --warn:#b97300; --bad:#d6283c; --shadow:0 1px 2px rgba(20,30,50,.06), 0 10px 28px -14px rgba(20,30,50,.22); --glow:radial-gradient(1100px 520px at 50% -12%, rgba(44,107,224,.09), transparent 62%); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { color-scheme: light; --bg:#eef1f6; --bg-raise:#e6eaf1; --surface:#fff; --surface-2:#f4f6fa; --surface-3:#e8ecf3; --line:rgba(20,30,50,.09); --line-strong:rgba(20,30,50,.17); --text:#0e1420; --text-2:#475368; --text-3:#7b8699; --accent:#2c6be0; --accent-ink:#fff; --accent-soft:rgba(44,107,224,.10); --accent-line:rgba(44,107,224,.40); --ok:#0b9a69; --warn:#b97300; --bad:#d6283c; --shadow:0 1px 2px rgba(20,30,50,.06), 0 10px 28px -14px rgba(20,30,50,.22); --glow:radial-gradient(1100px 520px at 50% -12%, rgba(44,107,224,.09), transparent 62%); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100dvh; font: 15px/1.45 var(--font); color: var(--text); background: var(--glow) no-repeat, var(--bg); background-attachment: fixed; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body.has-pseudo-fs { overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
ul, ol { margin: 0; padding: 0; }
.ic { flex: none; display: block; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.pad { padding: 14px 6px; }
.center { text-align: center; }
.warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* --- загрузка --- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; }
.boot-mark { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--accent); border-top-color: transparent; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.22); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.lg { width: 40px; height: 40px; border-color: var(--line-strong); border-top-color: var(--accent); }

/* --- каркас --- */
#app { min-height: 100dvh; }
.main { min-width: 0; }
.rail { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: calc(var(--topbar-h) + var(--sat)); padding: calc(var(--sat) + 6px) calc(14px + var(--sar)) 6px calc(14px + var(--sal)); background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid var(--line); }
.tb-back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border-radius: 12px; color: var(--text-2); }
.tb-back:hover { background: var(--surface-2); color: var(--text); }
.tb-title { min-width: 0; flex: 1; }
.tb-title h1 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--text-2); transition: background .15s, color .15s, transform .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.spin .ic { animation: spin .7s linear; }
#view { outline: none; }
.view { padding: 14px calc(16px + var(--sar)) calc(var(--tabbar-h) + var(--sab) + 28px) calc(16px + var(--sal)); max-width: 1800px; margin: 0 auto; }
.view-enter { animation: enter .32s var(--ease) backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal)); background: color-mix(in srgb, var(--bg-raise) 82%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px; border-radius: 14px; color: var(--text-3); font-size: 10.5px; font-weight: 550; letter-spacing: .01em; transition: color .15s; position: relative; }
.tab.on { color: var(--accent); }
.tab.on::before { content: ""; position: absolute; top: -7px; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.tab:active { transform: scale(.96); }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--sab) + 14px); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 440px; padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; color: var(--text); background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: 0 12px 30px -8px rgba(0,0,0,.55); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .22s, transform .25s var(--ease); display: flex; align-items: center; gap: 12px; }
.toast.in { opacity: 1; transform: none; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.toast button { color: var(--accent); font-weight: 650; }

/* --- примитивы --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 14.5px; color: var(--text); background: var(--surface-3); border: 1px solid var(--line-strong); transition: background .15s, transform .12s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: color-mix(in srgb, var(--surface-3) 80%, var(--text) 8%); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 22px -10px var(--accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 50px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 0; width: 42px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips.wrap { margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .005em; white-space: nowrap; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--line); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.chip.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.chip.lg { height: 30px; padding: 0 12px; font-size: 13px; }
.chip.glass { background: var(--glass); border-color: var(--glass-line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; }
.chip.glass.ok .dot { background: var(--ok); } .chip.glass.bad .dot { background: var(--bad); } .chip.glass.warn { color: var(--warn); }
.chip.glass.neutral { color: rgba(255,255,255,.85); }
.chip.live .dot, .chip.live-dot .dot { animation: pulse 1.8s ease-out infinite; }
.chip.live { color: #fff; } .chip.live .dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
.chip.glass.live-dot .dot { background: var(--ok); color: var(--ok); }
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.sdot.ok { background: var(--ok); color: var(--ok); } .sdot.warn { background: var(--warn); color: var(--warn); } .sdot.bad { background: var(--bad); color: var(--bad); }
.sdot.pulse { animation: pulse 2s ease-out infinite; } .sdot.lg { width: 14px; height: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 28px; }
.card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin-right: auto; }
.card-head .muted { font-size: 12.5px; }
.block { margin-top: 22px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-head h2 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.link:hover { text-decoration: underline; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-inline: -16px; padding-inline: 16px; scroll-snap-type: x proximity; }
.hscroll::-webkit-scrollbar { display: none; }
.hide-m { display: none; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background .15s, color .15s; }
.seg:hover { color: var(--text); }
.seg.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 8px -2px rgba(0,0,0,.4); }
.segmented.sm .seg { min-height: 30px; padding: 0 11px; font-size: 13px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; scroll-snap-align: start; transition: all .15s; flex: none; }
.fchip:hover { border-color: var(--line-strong); color: var(--text); }
.fchip.on { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.fchip.on .sdot { box-shadow: 0 0 0 2px rgba(0,0,0,.18); }

.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); cursor: pointer; transition: background .2s, border-color .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: transform .22s var(--ease); }
.switch:checked { background: var(--accent); border-color: transparent; }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .5; }
.row-switch, .row-select, .row-btn { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; min-height: 56px; border-top: 1px solid var(--line); cursor: pointer; }
.row-btn { cursor: default; }
.card > .row-switch:first-of-type, .card > .row-select:first-of-type, .card > .row-btn:first-of-type, .ctl-list > :first-child, .card-head + .row-switch { border-top: 0; }
.rs-text { display: flex; flex-direction: column; min-width: 0; }
.rs-text b { font-weight: 600; font-size: 14.5px; }
.rs-text small { color: var(--text-3); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.select-wrap { position: relative; display: inline-flex; align-items: center; color: var(--text-3); }
.select-wrap .ic { position: absolute; right: 10px; pointer-events: none; }
.select { appearance: none; -webkit-appearance: none; height: 38px; padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; }
.input { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.time { width: 118px; height: 42px; text-align: center; font-family: var(--mono); font-size: 16px; }
.input::placeholder { color: var(--text-3); }

.range { appearance: none; -webkit-appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; --p: 50%; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--p), var(--surface-3) var(--p)); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -8px; box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 4px var(--accent-soft); }
.range::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.range:disabled { opacity: .45; }
.slider-row { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.slider-row.dim { opacity: .55; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.slider-head b { color: var(--accent); font-size: 16px; }
.slider-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: -2px; }

.bar { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 8px; background: var(--ok); transition: width .6s var(--ease); }
.bar.warn i { background: var(--warn); } .bar.bad i { background: var(--bad); } .bar.accent i { background: var(--accent); }
.meter { margin-bottom: 14px; }
.meter-head { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--text-2); margin-bottom: 7px; }
.meter-head span { display: inline-flex; align-items: center; gap: 7px; }
.meter-head b { color: var(--text); font-weight: 600; } .meter-head small { color: var(--text-3); font-weight: 500; }
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; font-weight: 550; text-align: right; } .kv dd small { color: var(--text-3); font-weight: 500; }
.kv.grid2 { margin-top: 6px; }

.banner { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); margin-bottom: 14px; }
.banner.info { flex-direction: row; align-items: flex-start; justify-content: space-between; border-color: var(--accent-line); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--warn) 12%, transparent), transparent 70%), var(--surface); }
.banner-head { display: flex; gap: 12px; align-items: flex-start; }
.banner-head > .ic { margin-top: 2px; color: var(--accent); }
.banner.warn .banner-head > .ic { color: var(--warn); }
.banner h3 { font-size: 15.5px; font-weight: 650; margin-bottom: 3px; }
.banner p { font-size: 13.5px; color: var(--text-2); }
.banner p .ic { display: inline; vertical-align: -2px; }
.banner-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.captcha-img { height: 56px; min-width: 150px; border-radius: 10px; background: #fff; padding: 4px 8px; border: 1px solid var(--line-strong); }
.captcha-form { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.captcha-form .input { flex: 1; letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); height: 56px; }
.captcha-form .btn { height: 56px; }
.form-err { color: var(--bad); font-size: 13.5px; font-weight: 550; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 56px 20px; color: var(--text-2); }
.empty.small { padding: 28px 16px; }
.empty-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); margin-bottom: 6px; }
.empty h2 { font-size: 18px; font-weight: 650; color: var(--text); }
.empty p { max-width: 36ch; font-size: 14px; margin-bottom: 8px; }

.sk-block, .sk-line { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk-line { display: block; height: 12px; border-radius: 6px; margin: 6px 0; } .sk-line.w60 { width: 60%; } .sk-line.w40 { width: 40%; } .sk-line.w50 { width: 50%; } .sk-line.w30 { width: 30%; }
.skeleton-hero { height: 150px; border-radius: var(--r); margin-bottom: 16px; }
.sk-rows { display: grid; gap: 8px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--text-3); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 8px; border-radius: 3px; }
.sw.rec { background: color-mix(in srgb, var(--accent) 70%, transparent); } .sw.mot { width: 4px; height: 12px; background: var(--warn); } .sw.off { width: 4px; height: 12px; background: var(--bad); }
.sw.drv { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 65%, transparent) 0 3px, transparent 3px 6px); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.hud::after { content: ""; position: absolute; inset: 10px; pointer-events: none; --c: rgba(255,255,255,.5); background:
  linear-gradient(var(--c), var(--c)) top left / 14px 1.5px, linear-gradient(var(--c), var(--c)) top left / 1.5px 14px,
  linear-gradient(var(--c), var(--c)) top right / 14px 1.5px, linear-gradient(var(--c), var(--c)) top right / 1.5px 14px,
  linear-gradient(var(--c), var(--c)) bottom left / 14px 1.5px, linear-gradient(var(--c), var(--c)) bottom left / 1.5px 14px,
  linear-gradient(var(--c), var(--c)) bottom right / 14px 1.5px, linear-gradient(var(--c), var(--c)) bottom right / 1.5px 14px; background-repeat: no-repeat; opacity: .8; z-index: 3; }

/* --- вход --- */
#login-root { position: fixed; inset: 0; z-index: 150; overflow: auto; background: var(--bg); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--sat) + 24px) 20px calc(var(--sab) + 24px); position: relative; }
.login-glow { position: absolute; inset: 0; background: radial-gradient(600px 420px at 50% 28%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%); pointer-events: none; }
.login-card { position: relative; width: min(100%, 400px); display: flex; flex-direction: column; gap: 14px; padding: 32px 26px 24px; border-radius: 26px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), var(--shadow); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: enter .5s var(--ease) both; }
.login-mark { position: relative; align-self: flex-start; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px; color: var(--accent); background: linear-gradient(160deg, var(--surface-3), var(--bg-raise)); border: 1px solid var(--line-strong); margin-bottom: 4px; }
.login-rec { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); color: var(--ok); animation: pulse 2s ease-out infinite; }
.login h1 { font-size: 32px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
.login-sub { color: var(--text-2); font-size: 15px; margin-top: -6px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.field-box { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-3); transition: border-color .15s, box-shadow .15s; }
.field-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent); }
.input.bare { flex: 1; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; }
.input.bare:focus { box-shadow: none; }
.login-foot { display: flex; align-items: center; gap: 7px; justify-content: center; color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* --- главная --- */
.home-top { display: grid; gap: 12px; }
.hero { position: relative; display: grid; gap: 16px; padding: 18px; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9; }
.hero.ok::before { background: radial-gradient(520px 180px at 0 0, color-mix(in srgb, var(--ok) 14%, transparent), transparent 70%); }
.hero.warn::before { background: radial-gradient(520px 180px at 0 0, color-mix(in srgb, var(--warn) 18%, transparent), transparent 70%); }
.hero.bad::before { background: radial-gradient(520px 180px at 0 0, color-mix(in srgb, var(--bad) 20%, transparent), transparent 70%); }
.hero > * { position: relative; }
.hero-main { display: flex; gap: 14px; align-items: center; }
.hero-orb { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-strong); }
.hero-text { min-width: 0; flex: 1; }
.hero-text h2 { font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.hero-text p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.hero-problems { list-style: none; display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.hero-problems li { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 550; }
.hero-problems li.bad { color: var(--bad); } .hero-problems li.warn { color: var(--warn); }
.hero-link { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; align-self: start; font-size: 13.5px; font-weight: 600; color: var(--accent); padding: 7px 12px 7px 10px; border-radius: 10px; background: var(--accent-soft); width: fit-content; }
.hero-link:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.hero-stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 14px; }
.hero-stats > div { padding-inline: 12px; border-left: 1px solid var(--line); }
.hero-stats > div:first-child { padding-left: 0; border-left: 0; }
.hero-stats dt { font-size: 12px; color: var(--text-3); font-weight: 550; white-space: nowrap; }
.hero-stats dd { margin: 2px 0 0; font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.hero-stats dd small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.home-top .banner { margin-bottom: 0; }
[data-captcha-slot] { margin-top: 12px; }
[data-captcha-slot] .banner { margin-bottom: 0; }
.home-cols { display: grid; gap: 0; }
.grid-cams { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-cams.dense { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cam-card { display: block; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .2s; position: relative; }
.cam-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.cam-card:active { transform: scale(.985); }
.cam-media { position: relative; aspect-ratio: 16 / 9; background: #05070a; overflow: hidden; isolation: isolate; }
.cam-media::before { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent 32%, transparent 52%, rgba(0,0,0,.78)); pointer-events: none; }
.snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease; }
.snap.on { opacity: 1; }
.cam-media:not(.loaded) { background: linear-gradient(100deg, #0a0d12 30%, #12171f 50%, #0a0d12 70%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; }
.cam-card.is-off .snap { filter: grayscale(1) brightness(.55); }
.cam-live { position: absolute; inset: 0; z-index: 1; }
.cam-live:empty { display: none; }
.cam-top { position: absolute; z-index: 4; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cam-top .chips { gap: 5px; }
.frame-t { font-size: 11px; color: rgba(255,255,255,.75); text-shadow: 0 1px 4px rgba(0,0,0,.8); padding-top: 4px; }
.cam-bottom { position: absolute; z-index: 4; left: 14px; right: 14px; bottom: 11px; color: #fff; }
.cam-bottom h3 { font-size: 20px; font-weight: 680; letter-spacing: -.025em; text-shadow: 0 2px 10px rgba(0,0,0,.6); line-height: 1.15; }
.cam-bottom p { font-size: 12.5px; color: rgba(255,255,255,.82); text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.cam-offmsg { display: none; position: absolute; z-index: 3; inset: 0; align-items: center; justify-content: center; flex-direction: column; gap: 6px; color: rgba(255,255,255,.8); font-size: 13px; font-weight: 600; padding-bottom: 22px; }
.cam-card.is-off .cam-offmsg { display: flex; }
.cam-foot { padding: 12px 14px 12px; }
.cam-stats { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--text-2); }
.cam-stats b { color: var(--text); font-size: 15px; }
.cam-stats .meta { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.tape-wrap { margin-top: 9px; }
.mini-tape { position: relative; height: 14px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.mt-done { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.mt-ev { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--warn); }
.mt-ev.offline { background: var(--bad); } .mt-ev.online { background: var(--ok); }
.mt-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.tape-hours { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.grid-cams.dense .cam-bottom h3 { font-size: 15px; } .grid-cams.dense .cam-bottom p, .grid-cams.dense .tape-hours { display: none; }
.grid-cams.dense .cam-top .chips .chip:nth-child(n+2) { display: none; }
.strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; }
.strip::-webkit-scrollbar { display: none; }
.strip-item { flex: none; width: 150px; display: block; }
.si-thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-3); }
.si-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.si-thumb.offline { color: var(--bad); } .si-thumb.online { color: var(--ok); }
.si-cam { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 650; color: #fff; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.si-meta { margin-top: 6px; display: flex; flex-direction: column; font-size: 12.5px; }
.si-meta b { font-weight: 600; } .si-meta span { color: var(--text-3); font-size: 11.5px; }
a.strip-item:hover .si-thumb { border-color: var(--accent-line); }

/* --- плеер --- */
.player { position: relative; width: 100%; height: 100%; background: #05070a; overflow: hidden; }
.player-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .5s; }
.player-poster:not([src]) { visibility: hidden; }
.player-poster.off { opacity: 0; pointer-events: none; }
.player-stage { position: absolute; inset: 0; }
.player-stage video-stream { display: block; width: 100%; height: 100%; }
.player-stage video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player video::-webkit-media-controls, .player video::-webkit-media-controls-enclosure { display: none !important; }
.player-state { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: #fff; background: rgba(5,7,10,.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.ps-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.1); }
.ps-title { font-weight: 650; font-size: 15px; } .ps-sub { font-size: 12.5px; color: rgba(255,255,255,.7); max-width: 34ch; }
.player.bare .player-state { background: rgba(5,7,10,.32); } .player.bare .ps-sub, .player.bare .ps-ic { display: none; } .player.bare .ps-title { font-size: 13px; margin-top: 18px; }
.player.bare .spinner { width: 22px; height: 22px; }
.player-state .btn { margin-top: 6px; }

.cam-page { display: flex; flex-direction: column; gap: 14px; }
.cam-main, .cam-side { display: contents; }
.cam-main > * { order: 1; } .cam-switch { order: 0 !important; }
.hd-note { order: 2 !important; } .status-card { order: 3 !important; } .cam-side > .ptz-card { order: 4; } .today-card { order: 5 !important; }
.cam-side > #ctl-card { order: 6; } .cam-side > #notify-card { order: 7; } .cam-side > #recent-card { order: 8; } .cam-side > section:last-child { order: 9; }
.cam-switch { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 0 16px; }
.cam-switch::-webkit-scrollbar { display: none; }
.cam-switch .seg { flex: none; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.cam-switch .seg.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.cam-switch .seg.off { opacity: .8; }
.player-box { position: relative; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; background: #05070a; border: 1px solid var(--line); box-shadow: var(--shadow); isolation: isolate; width: 100%; }
.player-host { position: absolute; inset: 0; }
.player-box.pseudo-fs, .tile.pseudo-fs, .hbox.pseudo-fs, .wall.pseudo-fs { position: fixed; inset: 0; z-index: 120; border-radius: 0; width: 100%; height: 100dvh; max-height: none; aspect-ratio: auto; border: 0; background: #000; }
.player-box:fullscreen { border-radius: 0; border: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
.player-ui { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: space-between; padding: 12px; pointer-events: none; opacity: 0; transition: opacity .25s; background: linear-gradient(180deg, rgba(0,0,0,.5), transparent 24%, transparent 70%, rgba(0,0,0,.6)); }
.player-box.ui .player-ui, .player-box[data-live="failed"] .player-ui, .player-box[data-live="connecting"] .player-ui { opacity: 1; }
@media (hover: hover) { .player-box:hover .player-ui { opacity: 1; } }
.player-ui::after { inset: 8px; }
.pu-top, .pu-bottom { display: flex; align-items: center; gap: 8px; pointer-events: none; position: relative; z-index: 4; }
.pu-top > *, .pu-bottom > * { pointer-events: auto; }
.pu-name { font-weight: 650; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.pu-badge { padding: 3px 8px; border-radius: 7px; font-size: 11px; font-weight: 600; color: #fff; background: var(--glass); border: 1px solid var(--glass-line); }
.pu-time { margin-left: auto; font-size: 12px; color: rgba(255,255,255,.8); text-shadow: 0 1px 4px #000; }
.pu-spacer { flex: 1; }
.pu-btn { display: inline-grid; grid-auto-flow: column; place-items: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 14px; color: #fff; background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: background .15s, transform .12s; font-weight: 700; font-size: 13px; }
.pu-btn:hover { background: rgba(40,48,62,.8); } .pu-btn:active { transform: scale(.93); }
.pu-btn:disabled { opacity: .4; }
.pu-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pu-btn.txt { letter-spacing: .02em; }
.pu-btn.sm { min-width: 34px; height: 34px; border-radius: 10px; padding: 0 7px; }
.pu-btn i { display: contents; }
.hd-note { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; font-size: 13px; color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); }
.status-card .chips { margin-bottom: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.status-grid > div { display: flex; flex-direction: column; min-width: 0; }
.lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.status-grid b { font-size: 17px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; line-height: 1.2; }
.status-grid small { color: var(--text-3); font-size: 12px; }
.ptz { display: grid; grid-template-columns: repeat(3, 76px); grid-template-rows: repeat(3, 76px); grid-template-areas: ". u ." "l s r" ". d ."; gap: 8px; justify-content: center; user-select: none; -webkit-user-select: none; touch-action: none; padding: 6px 0; }
.ptz button { display: grid; place-items: center; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text); transition: background .1s, transform .1s; -webkit-touch-callout: none; touch-action: none; }
.ptz [data-dir=up] { grid-area: u; } .ptz [data-dir=down] { grid-area: d; } .ptz [data-dir=left] { grid-area: l; } .ptz [data-dir=right] { grid-area: r; } .ptz .stop { grid-area: s; border-radius: 50%; color: var(--text-3); }
.ptz button:hover { background: color-mix(in srgb, var(--surface-3) 75%, var(--text) 10%); }
.ptz button.down { background: var(--accent); color: var(--accent-ink); transform: scale(.94); border-color: transparent; box-shadow: 0 0 24px -4px var(--accent); }
.ctl-list { display: flex; flex-direction: column; }
.cn-item { padding: 14px 0; border-top: 1px solid var(--line); } .cn-item:first-child { border-top: 0; padding-top: 0; }
.cn-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; } .cn-head small { color: var(--text-3); margin-left: auto; font-size: 12px; }
.cn-item .row-switch { border-top: 0; padding-top: 4px; } .cn-item .slider-row { margin-top: 0; }
.notify-box .row-switch { border-top: 0; padding-top: 0; }

/* --- лента времени --- */
.tl { --ruler-h: 24px; --ev-h: 22px; --track-h: 46px; position: relative; user-select: none; -webkit-user-select: none; }
.tl.compact { --ruler-h: 20px; --ev-h: 16px; --track-h: 30px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-y; cursor: grab; border-radius: 12px; padding-top: 0; }
.tl-scroll::-webkit-scrollbar { display: none; }
.tl-scroll.dragging { cursor: grabbing; }
.tl.compact .tl-scroll { cursor: pointer; }
.tl-inner { position: relative; min-width: 100%; }
.tl-ruler { position: relative; height: var(--ruler-h); }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--line-strong); }
.tl-tick.major { height: 9px; background: var(--text-3); }
.tl-tick em { position: absolute; bottom: 11px; left: 0; transform: translateX(-50%); font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.tl-tick:first-child em { transform: translateX(0); } 
.tl-evrow { position: relative; height: var(--ev-h); }
.tl-ev { position: absolute; bottom: 0; width: 3px; margin-left: -1.5px; border-radius: 2px 2px 0 0; background: var(--warn); cursor: pointer; }
.tl-ev::before { content: ""; position: absolute; inset: -4px -8px 0; }
.tl-ev.offline { background: var(--bad); width: 4px; } .tl-ev.online { background: var(--ok); width: 4px; } .tl-ev.system { background: var(--text-3); }
.tl-ev:hover { filter: brightness(1.3); }
.tl-track { position: relative; height: var(--track-h); border-radius: 10px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px); border: 1px solid var(--line); overflow: visible; }
.tl-segs { position: absolute; inset: 0; border-radius: 9px; overflow: hidden; }
.tl-seg { position: absolute; top: 4px; bottom: 4px; border-radius: 4px; }
.tl-seg.local { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, transparent), color-mix(in srgb, var(--accent) 52%, transparent)); }
.tl-seg.drive { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 62%, transparent) 0 4px, color-mix(in srgb, var(--accent) 28%, transparent) 4px 8px); }
.tl-future { position: absolute; top: 0; bottom: 0; right: 0; border-radius: 0 9px 9px 0; background: color-mix(in srgb, var(--bg) 62%, transparent); border-left: 1px dashed var(--line-strong); }
.tl-head { position: absolute; top: calc(-1 * (var(--ruler-h) + var(--ev-h))); bottom: -3px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 0 14px var(--accent); border-radius: 2px; z-index: 5; pointer-events: none; }
:root[data-theme="light"] .tl-head { background: var(--text); }
.tl-head-label { position: absolute; top: 0; left: 50%; transform: translate(-50%, 0); padding: 2px 7px; border-radius: 7px; font-family: var(--mono); font-size: 11px; font-weight: 650; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.tl.compact .tl-head-label { display: none; }
.tl-card .card-head { flex-wrap: wrap; }
.tl-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-host.big { margin-top: 6px; }
.tl-host.big .tl-scroll { padding-top: 18px; }

/* --- история --- */
.hist { display: flex; flex-direction: column; gap: 14px; }
.hist-main, .hist-side { display: contents; }
.hist-main > * { order: 1; } .hist-pick { order: 0 !important; }
.hist-side { }
.hist-pick { display: flex; flex-direction: column; gap: 10px; }
.day-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; }
.day-chips::-webkit-scrollbar { display: none; }
.day { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 92px; padding: 8px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: all .15s; }
.day b { font-size: 14px; font-weight: 650; } .day span { font-size: 11.5px; color: var(--text-3); }
.day:hover { border-color: var(--line-strong); }
.day.on { background: var(--accent); border-color: transparent; } .day.on b { color: var(--accent-ink); } .day.on span { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); }
.ev-focus { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13.5px; }
.ev-focus img { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.ev-focus > div { display: flex; flex-direction: column; flex: 1; min-width: 0; } .ev-focus b { font-weight: 650; } .ev-focus span { color: var(--text-2); font-size: 12.5px; }
.ef-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); }
.hbox { position: relative; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hbox.sk-block { aspect-ratio: 16/9; }
.hvideo { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; flex: none; }
.hvideo video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.hv-readout { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; padding: 6px 10px; border-radius: 10px; color: #fff; background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none; z-index: 3; }
.hv-readout b { font-size: 17px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; } .hv-readout span { font-size: 11px; color: rgba(255,255,255,.7); }
.hv-state { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: #fff; background: rgba(0,0,0,.45); }
.hv-state[data-k=empty], .hv-state[data-k=err] { background: #05070a; }
.hv-big { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; color: #fff; background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .15s; padding-left: 4px; }
.hv-big:hover { transform: translate(-50%, -50%) scale(1.06); }
.hbar { padding: 8px 12px 10px; background: var(--surface); border-top: 1px solid var(--line); }
.seek { height: 20px; margin: 2px 0 4px; }
.seek::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -4px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.seek::-webkit-slider-runnable-track { height: 6px; }
.hbar-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hbar .pu-btn { background: var(--surface-3); color: var(--text); border-color: var(--line); height: 40px; min-width: 40px; border-radius: 12px; }
.hbar .pu-btn.on { background: var(--accent-soft); color: var(--accent); }
.hbar .pu-btn.main { background: var(--accent); color: var(--accent-ink); width: 48px; border-color: transparent; }
.hbar-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }
.speed { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.speed button { min-width: 36px; height: 32px; border-radius: 9px; font-size: 12.5px; font-weight: 700; color: var(--text-2); font-family: var(--mono); }
.speed button.on { background: var(--accent); color: var(--accent-ink); }
.hbox.is-fs, .hbox:fullscreen { border-radius: 0; border: 0; height: 100%; background: #000; }
.hbox.is-fs .hvideo, .hbox:fullscreen .hvideo { flex: 1; aspect-ratio: auto; min-height: 0; }
.hbox.is-fs .hbar { background: rgba(10,12,16,.92); }
.seg-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--text-2); padding: 0 4px; min-height: 26px; }
.hist-side .ev-list.scroll { max-height: 420px; overflow-y: auto; }

/* --- события --- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.filters .chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; }
.filters .chip-row::-webkit-scrollbar { display: none; }
.ev-feed, .ev-list, .sk-rows { display: flex; flex-direction: column; gap: 8px; }
.day-head { position: sticky; top: calc(var(--topbar-h) + var(--sat) - 1px); z-index: 5; display: flex; align-items: baseline; gap: 10px; margin: 10px -16px 0; padding: 10px 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.day-head span { font-size: 16px; font-weight: 700; letter-spacing: -.02em; } .day-head small { color: var(--text-3); font-size: 13px; } .day-head em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--text-3); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.ev-row { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 12px 8px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; transition: border-color .15s, background .15s, transform .12s; }
a.ev-row:hover, button.ev-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
a.ev-row:active, button.ev-row:active { transform: scale(.99); }
.ev-row.now { border-color: var(--accent-line); background: var(--accent-soft); }
.ev-thumb { width: 104px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--surface-3); flex: none; }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-ic { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 28px; border-radius: 14px; background: var(--surface-3); color: var(--text-2); }
.ev-row.offline { border-color: color-mix(in srgb, var(--bad) 30%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 9%, transparent), transparent 55%), var(--surface); }
.ev-row.offline .ev-ic { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.ev-row.online .ev-ic { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.ev-row.online { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 7%, transparent), transparent 55%), var(--surface); }
.ev-row.system .ev-ic, .ev-row.sys .ev-ic { background: var(--accent-soft); color: var(--accent); }
.ev-row.offline .ev-ic, .ev-row.online .ev-ic, .ev-row.system .ev-ic, .ev-row.sys .ev-ic { margin: 0 4px 0 8px; width: 42px; height: 42px; border-radius: 50%; }
.ev-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ev-title { display: flex; align-items: center; gap: 10px; font-weight: 620; font-size: 14.5px; }
.ev-sub { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; } .ev-sub .ev-cam { color: var(--text-2); font-weight: 550; } .ev-sub .sep { opacity: .6; }
.ev-time { font-size: 13px; color: var(--text-2); align-self: start; padding-top: 4px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.bars i { width: 3px; border-radius: 1px; background: var(--surface-3); } .bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 7px; } .bars i:nth-child(3) { height: 9px; } .bars i:nth-child(4) { height: 11px; } .bars i:nth-child(5) { height: 12px; }
.bars i.on { background: var(--warn); }
.ev-list.compact .ev-row { grid-template-columns: auto 1fr auto; padding: 6px 10px 6px 6px; border-radius: 13px; gap: 10px; }
.ev-list.compact .ev-thumb { width: 76px; border-radius: 8px; } .ev-list.compact .ev-ic { margin: 0 14px; width: 42px; height: 42px; }
.ev-list.compact .ev-row.offline .ev-ic, .ev-list.compact .ev-row.online .ev-ic { margin: 0 4px 0 6px; width: 38px; height: 38px; }
.ev-list.compact .ev-title { font-size: 13.5px; } .ev-list.compact .ev-time { font-size: 12px; }
.ev-row.sk { grid-template-columns: auto 1fr; } .ev-row.sk .ev-thumb { width: 104px; }
.feed-end { padding: 18px 0 4px; } .sentinel { height: 1px; }

/* --- стена --- */
.wall-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.wall-hint { font-size: 12.5px; margin-left: auto; display: none; }
.wall { display: grid; gap: 12px; grid-template-columns: 1fr; }
.tile { position: relative; aspect-ratio: 16/9; border-radius: 18px; overflow: hidden; background: #05070a; border: 1px solid var(--line); cursor: pointer; isolation: isolate; box-shadow: var(--shadow); transition: border-color .2s; min-height: 0; }
.tile:hover, .tile:focus-visible { border-color: var(--accent-line); }
.tile.hidden { display: none; }
.tile-video { position: absolute; inset: 0; }
.tile-ui { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent 28%, transparent 70%, rgba(0,0,0,.6)); }
.tile-ui > * { position: relative; z-index: 4; } .tile-ui.hud::after { z-index: 1; }
.tile-top, .tile-bottom { display: flex; align-items: center; gap: 8px; color: #fff; }
.tile-top b { font-size: 15px; font-weight: 650; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.tile-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--glass); border: 1px solid var(--glass-line); }
.tile-top .chips { margin-left: auto; }
.tile-bottom { pointer-events: none; } .tile-bottom > * { pointer-events: auto; }
.tile-motion { font-size: 11.5px; color: rgba(255,255,255,.8); text-shadow: 0 1px 4px #000; pointer-events: none !important; }
.tile.pseudo-fs .tile-video, .tile:fullscreen .tile-video { }
.tile:fullscreen { border-radius: 0; border: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.wall:fullscreen { background: #000; padding: 10px; height: 100%; }
.wall.pseudo-fs { padding: 10px; overflow: auto; }

/* --- настройки --- */
.settings-grid { display: grid; gap: 14px; align-items: start; }
.settings .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.settings .banner { margin-bottom: 14px; }
.hint-steps p { color: var(--text-2); font-size: 14px; }
.hint-steps ol { margin-top: 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.hint-steps li::marker { color: var(--accent); font-weight: 700; }
.hint-steps .ic { display: inline; vertical-align: -3px; color: var(--accent); }
.row-status { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; }
.row-status.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); }
.row-status div { display: flex; flex-direction: column; } .row-status b { color: var(--text); font-weight: 620; } .row-status small { color: var(--text-2); font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card > .muted + .btn-row { margin-top: 12px; }
.time-row { display: flex; align-items: center; gap: 10px; padding: 4px 0 16px; }
.time-row label { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13.5px; }
.time-row.dim { opacity: .5; } .time-dash { color: var(--text-3); }
.sys .kv { margin-top: 4px; }

/* --- модалка --- */
.modal-bg { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(100%, 480px); max-height: 86dvh; overflow: auto; padding: 20px 22px 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 30px 90px -20px rgba(0,0,0,.8); animation: enter .3s var(--ease) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; } .modal-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.keys { margin: 0; } .keys > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; } .keys > div:first-child { border-top: 0; }
.keys dt { display: flex; gap: 5px; align-items: center; flex: none; } .keys dd { margin: 0; color: var(--text-2); text-align: right; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; font: 600 12px var(--mono); color: var(--text); background: var(--surface-3); border: 1px solid var(--line-strong); border-bottom-width: 2px; }

/* ===== Планшет ===== */
@media (min-width: 720px) {
  .view { padding-inline: calc(24px + var(--sal)) calc(24px + var(--sar)); }
  .hscroll, .strip, .cam-switch, .day-chips, .filters .chip-row { margin-inline: -24px; padding-inline: 24px; }
  .day-head { margin-inline: -24px; padding-inline: 24px; }
  .grid-cams { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .grid-cams.dense { grid-template-columns: repeat(3, 1fr); }
  .grid-cams.n1 { grid-template-columns: minmax(0, 760px); }
  .hide-m { display: inline; }
  .wall-hint { display: inline; }
  .wall { grid-template-columns: repeat(var(--cols), 1fr); }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .ev-thumb { width: 128px; }
  .hero { grid-template-columns: 1fr auto; align-items: center; }
  .hero-link { grid-column: 1; } .hero-stats { grid-column: 2; grid-row: 1 / span 2; border-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: 8px; }
  .hero-stats > div { padding-inline: 20px; }
}

/* ===== Десктоп ===== */
@media (min-width: 1024px) {
  #app:not([hidden]) { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 22px 14px 16px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg-raise) 70%, transparent); }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; font-size: 20px; font-weight: 720; letter-spacing: -.03em; color: var(--text); }
  .brand .logo-mark { color: var(--accent); }
  .rail-nav { display: flex; flex-direction: column; gap: 4px; }
  .rail-link { position: relative; display: flex; align-items: center; gap: 13px; height: 44px; padding: 0 12px; border-radius: 12px; font-size: 14.5px; font-weight: 600; color: var(--text-2); transition: background .15s, color .15s; }
  .rail-link:hover { background: var(--surface-2); color: var(--text); }
  .rail-link.on { background: var(--accent-soft); color: var(--accent); }
  .rail-link.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
  .rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
  .rail-status { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 550; color: var(--text-2); }
  .rail-status:empty { display: none; }
  .rail-help { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 13px; color: var(--text-3); }
  .rail-help:hover { background: var(--surface-2); color: var(--text); } .rail-help kbd { margin-left: auto; }
  .tabbar { display: none; }
  .topbar { min-height: 64px; padding-inline: 32px; }
  .tb-title h1 { font-size: 22px; }
  .view { padding: 24px 32px 48px; }
  .hscroll, .strip, .cam-switch, .day-chips, .filters .chip-row { margin-inline: 0; padding-inline: 0; }
  .day-head { margin-inline: 0; padding-inline: 4px; top: 63px; }
  #toasts { bottom: 24px; }
  .home-cols { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
  .home-cols:has(.home-side:empty) { grid-template-columns: 1fr; }
  .home-side .block { margin-top: 22px; }
  .home-side .strip { flex-direction: column; margin: 0; padding: 0; overflow: visible; gap: 12px; }
  .home-side .strip-item { width: auto; display: grid; grid-template-columns: 124px 1fr; gap: 12px; align-items: center; }
  .home-side .si-meta { margin: 0; }
  .grid-cams { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  .grid-cams.n1 { grid-template-columns: minmax(0, 900px); }
  .grid-cams.dense { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .grid-cams.dense .cam-bottom h3 { font-size: 17px; }
  .settings-grid { gap: 20px; } .settings .col { gap: 20px; }
  .wall { height: calc(100dvh - 170px); grid-auto-rows: minmax(0, 1fr); }
  .tile { aspect-ratio: auto; }
  .wall[data-focus="1"]:not([data-layout="1"]) { grid-template-columns: minmax(0, 4fr) minmax(0, 1.2fr); grid-auto-rows: minmax(0, 1fr); grid-template-rows: repeat(var(--n), minmax(0, 1fr)); }
  .wall[data-focus="1"]:not([data-layout="1"]) .tile { grid-column: 2; }
  .wall[data-focus="1"]:not([data-layout="1"]) .tile.focused { grid-column: 1; grid-row: 1 / span var(--n); }
  .wall[data-layout="1"] { grid-template-columns: 1fr; }
  .wall .tile.focused { border-color: var(--accent-line); }
  .toast { font-size: 14px; }
  .player-box { max-height: calc(100dvh - 150px); margin-inline: auto; }
  .hvideo { max-height: calc(100dvh - 300px); }
  .hbar .pu-btn:hover { background: color-mix(in srgb, var(--surface-3) 70%, var(--text) 12%); }
}
@media (min-width: 1200px) {
  .cam-page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
  .cam-main, .cam-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .cam-main > *, .cam-side > * { order: 0 !important; }
  .cam-switch { order: 0 !important; }
  .player-box { max-height: calc(100dvh - 190px); margin-inline: auto; }
  .cam-side { position: sticky; top: 84px; max-height: calc(100dvh - 100px); overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
  .hist { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
  .hist-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .hist-main > * { order: 0 !important; }
  .hist-side { display: block; position: sticky; top: 84px; }
  .hist-side .ev-list.scroll { max-height: calc(100dvh - 220px); }
  .hvideo { max-height: calc(100dvh - 330px); aspect-ratio: 16/9; }
  .hbox .hvideo { margin-inline: auto; width: 100%; }
}
@media (min-width: 1600px) {
  .view { padding-inline: 48px; }
  .cam-page { grid-template-columns: minmax(0, 1fr) 420px; }
  .hist { grid-template-columns: minmax(0, 1fr) 420px; }
  .grid-cams { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
  .home-cols { grid-template-columns: minmax(0, 1fr) 380px; }
  .hero-text h2 { font-size: 26px; }
}

/* --- телефон в ландшафте: видео на весь экран --- */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .tabbar { display: none; }
  .view { padding-bottom: 20px; }
  body[data-route="camera"] .topbar, body[data-route="camera"] .cam-switch { display: none; }
  body[data-route="camera"] .player-box { height: calc(100dvh - 24px); aspect-ratio: auto; border-radius: 16px; }
  .ptz { grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); }
}
@media (max-width: 380px) {
  .view { padding-inline: 12px; } .hscroll, .strip, .cam-switch, .day-chips, .filters .chip-row, .day-head { margin-inline: -12px; padding-inline: 12px; }
  .hero-stats dd { font-size: 22px; } .status-grid b { font-size: 15px; }
  .ptz { grid-template-columns: repeat(3, 68px); grid-template-rows: repeat(3, 68px); }
  .ev-thumb { width: 88px; } .hbar-row { gap: 4px; } .hbar .pu-btn { min-width: 36px; height: 38px; padding: 0 6px; }
}
.events-page { max-width: 980px; margin-inline: auto; }
.filters .segmented { align-self: flex-start; }
.player.bare .player-state { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; text-shadow: 0 1px 8px #000; }
.player.bare .ps-title { padding: 5px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); margin-top: 0; text-shadow: none; }
.home-cols > *, .cam-page > *, .hist > *, .settings-grid > *, .events-page > * { min-width: 0; }
.home-side { min-width: 0; }
@media (max-width: 719px) {
  .player-box .ps-sub, .player-box .player-state .btn { display: none; }
  .player-box .ps-ic { width: 40px; height: 40px; border-radius: 12px; }
  .player-box .player-state { padding-top: 40px; padding-bottom: 50px; }
}
.hist-side > * { order: 2; }
@media (min-width: 1200px) { .hist-side > * { order: 0; } }
.captcha-form .input::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 14px; }
.captcha-form { flex-wrap: nowrap; }
.captcha-form .input { min-width: 0; }
.ev-sub { gap: 2px 10px; } .ev-ago { white-space: nowrap; }
.wall[data-focus="1"] .tile:not(.focused) .tile-top .chips .chip:nth-child(n+2), .wall[data-focus="1"] .tile:not(.focused) .tile-motion { display: none; }
.wall[data-focus="1"] .tile:not(.focused) .tile-top b { font-size: 13px; }
.tile-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
