:root {
    color-scheme: dark;
    --bg: #001743;
    --brand: #012060;
    --brand-deep: #001030;
    --brand-soft: #0d2760;
    --tile: #001535;
    --panel: #011a4a;
    --panel-2: #0d2455;
    --text: #f7f3f6;
    --text-on-dark: #ffffff;
    --muted: #9da9bb;
    --accent: #2563eb;
    --accent-2: #38bdf8;
    --danger: #ff6678;
    --line: #1a3060;
    --geo-blue-1: #0078c8;
    --geo-blue-2: #004b9d;
    --geo-primary: #1988c8;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22); }
.panel h2 { margin: 0 0 18px; }

.login-page {
    min-height: 100vh; display: flex; flex-wrap: wrap; background-color: var(--bg);
    background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1.5px);
    background-size: 24px 24px;
}
.login-hero {
    flex: 1 1 340px; position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px;
    padding: 40px 40px 96px; text-align: center; color: #ffffff;
}
.hero-cards { display: block; width: min(520px, 88%); height: auto; margin: 0 auto -8px; }
.hero-monitor { display: block; width: min(560px, 90%); height: auto; margin: 6px auto 0; }
.login-hero-brand { display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-hero-logo { width: 179px; height: auto; flex-shrink: 0; }
.login-hero-wordmark { font-size: 48px; font-weight: 800; letter-spacing: -0.01em; }
.login-hero-tagline { margin: 0; max-width: 380px; font-size: 17px; line-height: 1.5; color: rgba(255, 255, 255, 0.75); }
.login-hero-tagline .accent { color: #4db9d2; font-weight: 700; }
.login-hero-footer {
    position: absolute; bottom: 32px; left: 0; right: 0; display: flex; flex-direction: column;
    align-items: center; gap: 10px; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
    font-weight: 700; color: rgba(255, 255, 255, 0.6);
}
.login-hero-footer img { width: 120px; height: auto; }
.login-panel {
    flex: 1 1 300px; max-width: 600px; display: flex; align-items: center; justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
.login-box {
    width: min(420px, 100%); padding: 36px 32px; border-radius: 24px;
    background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.login-box .login-logo-mark { display: block; width: 140px; height: auto; margin: 0 auto 24px; }
.login-box h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; color: #ffffff; text-align: center; }
.login-box .subtitle { margin: 0 0 24px; font-size: 14px; color: rgba(255, 255, 255, 0.6); text-align: center; }
.login-box label { color: rgba(255, 255, 255, 0.6); }
.login-box .field-wrap { position: relative; }
.login-box .field-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: rgba(255, 255, 255, 0.4); pointer-events: none;
}
.login-box input { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: #ffffff; padding-left: 42px; }
.login-box input::placeholder { color: rgba(255, 255, 255, 0.35); }
.login-box input:focus { border-color: var(--geo-primary); box-shadow: 0 0 0 3px rgba(25, 136, 200, 0.28); }
.login-box .error { border-color: rgba(220, 38, 38, 0.3); background: rgba(220, 38, 38, 0.08); color: #ffb4bc; }
.login-box .toggle-password {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-height: auto;
    border: none; background: none; padding: 6px; color: rgba(255, 255, 255, 0.5); cursor: pointer;
}
.login-box .toggle-password:hover { color: #ffffff; }
.login-box .toggle-password svg { width: 18px; height: 18px; display: block; }
.login-box .remember-row {
    display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: 13px;
    color: rgba(255, 255, 255, 0.75); text-transform: none; font-weight: 400; cursor: pointer;
}
.login-box .remember-row input[type="checkbox"] { width: 16px; height: 16px; min-height: auto; accent-color: var(--geo-primary); }
.login-box button.primary {
    width: 100%; margin-top: 22px; min-height: 48px; border: none; border-radius: 10px;
    background: var(--geo-primary); color: #ffffff; font-weight: 700; font-size: 15px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: background-color .2s;
}
.login-box button.primary svg { width: 18px; height: 18px; }
.login-box button.primary:hover { background: #4db9d2; }
.login-box .secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 24px 0 0; font-size: 12px; color: rgba(255, 255, 255, 0.45); }
.login-box .secure-note svg { width: 14px; height: 14px; }

@media (max-width: 860px) {
    .login-hero { padding: 32px 24px 88px; }
    .login-hero-brand { gap: 6px; }
    .login-hero-logo { width: 134px; height: auto; }
    .login-hero-wordmark { font-size: 34px; }
    .login-box .login-logo-mark { width: 110px; }
    .login-box { padding: 28px 22px; }
}
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
input, select, textarea {
    width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 6px;
    background: #001030; color: var(--text); font-size: 15px; padding: 8px 10px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
button, .nav-link {
    display: inline-flex; align-items: center; justify-content: center; min-height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 6px; background: var(--brand-soft);
    color: var(--text-on-dark); cursor: pointer; font-size: 13px; text-decoration: none; padding: 0 10px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #06110d; font-weight: 700; }
button.danger { background: rgba(255, 102, 120, 0.1); border-color: rgba(255, 102, 120, 0.45); color: #ffc0c8; }
button:hover, .nav-link:hover { border-color: var(--accent); }
.error, .flash {
    margin: 0 0 14px; border-radius: 6px; padding: 10px 12px; font-size: 14px;
    border: 1px solid rgba(255, 102, 120, 0.45); background: rgba(255, 102, 120, 0.1); color: #ffc0c8;
}
.flash { border-color: rgba(56, 189, 248, 0.42); background: rgba(56, 189, 248, 0.12); color: #bfe9ff; }

.tv-page { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); color: var(--text-on-dark); }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 42px; padding: 7px 12px; background: var(--brand); border-bottom: 1px solid #0d2a5c;
}
.brand { min-width: 0; display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { height: 26px; width: 26px; object-fit: contain; border-radius: 50%; display: block; flex-shrink: 0; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 8px;
    padding: 8px;
    overflow: auto;
    align-content: stretch;
    align-items: stretch;
}
.camera-tile { position: relative; overflow: hidden; border-radius: 4px; background: var(--tile); aspect-ratio: 16 / 9; }
.camera-tile video, .tile-overlay { position: absolute; inset: 0; }
.camera-tile video { width: 100%; height: 100%; object-fit: cover; background: #050607; }
.tile-overlay {
    display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; z-index: 2;
    background: linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, transparent 28%, transparent 62%, rgba(0,0,0,0.48) 100%);
    padding: 8px;
}
.camera-label {
    align-self: flex-start; max-width: 100%; border-radius: 4px;
    color: #fff; font-size: clamp(10px, 0.72vw, 13px); font-weight: 700; line-height: 1.25;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
.camera-dvr {
    font-size: clamp(9px, 0.6vw, 11px); font-weight: 400; opacity: 0.72; margin-bottom: 1px;
}
.camera-status {
    align-self: flex-start; max-width: 100%; border-radius: 4px; background: rgba(0,0,0,0.58);
    color: var(--muted); font-size: clamp(10px, 0.66vw, 11px); font-weight: 700; line-height: 1.25;
    padding: 3px 6px; text-shadow: 0 1px 3px #000;
}
.camera-status.ok { display: none; color: #8dffc7; }
.camera-status.error { color: #ffb1b1; }
.camera-status.offline { color: #ffd39b; }
.fhd-toggle {
    position: absolute; top: 6px; right: 6px; z-index: 6; min-height: 0;
    font: 700 11px/1 system-ui, sans-serif; letter-spacing: 0.5px;
    padding: 4px 8px; border-radius: 4px; cursor: pointer;
    background: rgba(0, 0, 0, 0.55); color: #cfd6e4; border: 1px solid rgba(255, 255, 255, 0.28);
}
.fhd-toggle:hover { border-color: var(--accent); }
.fhd-toggle.on { background: #29d17a; color: #04130b; border-color: #29d17a; }
.fhd-toggle:disabled { opacity: 0.5; cursor: wait; }
.fhd-toggle[hidden] { display: none; }
.cam-modal-header .fhd-toggle { position: static; margin-left: auto; }
/* Skeleton shimmer enquanto o stream nao entrega o primeiro frame. */
.camera-tile::before {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(100deg, transparent 32%, rgba(255,255,255,0.06) 50%, transparent 68%) no-repeat, var(--tile);
    background-size: 220% 100%;
    animation: tile-shimmer 1.6s linear infinite;
}
@keyframes tile-shimmer { from { background-position: 140% 0; } to { background-position: -60% 0; } }
.camera-tile:has(video.is-live)::before,
.camera-tile.is-error::before,
.camera-tile.is-offline::before { display: none; }
.camera-tile video { opacity: 0; transition: opacity 0.45s ease; }
.camera-tile video.is-live { opacity: 1; }
.camera-tile.is-error video, .camera-tile.is-offline video { opacity: 0.16; }
.camera-tile.is-offline::after {
    content: "FORA DO AR"; position: absolute; inset: 0; display: grid; place-items: center;
    color: rgba(255,255,255,0.84); font-size: clamp(14px, 1.2vw, 22px); font-weight: 800;
    letter-spacing: 0.08em; pointer-events: none; text-shadow: 0 2px 8px #000;
}

.admin-page { padding: 18px; display: grid; gap: 18px; background: var(--bg); color: var(--text); }
.sync-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.panel { padding: 16px; }
.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.list-panel, .editor-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 16px; }
.editor-panel { position: sticky; top: 16px; }
.editor-panel.is-editing { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(37,99,235,0.2); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-title { margin: 0 0 14px; font-size: 24px; }
.section-subtitle { margin: 0 0 14px; font-size: 16px; }
.section-eyebrow { margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.panel .nav-link { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.panel button:not(.primary):not(.danger) { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; }
.table-wrap { overflow: auto; max-height: min(58vh, 680px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.td-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.permission-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.permission-search { max-width: 280px; }
.permission-groups { display: grid; gap: 6px; max-height: min(42vh, 420px); overflow: auto; padding-right: 4px; }
.permission-group { border: 1px solid var(--line); border-radius: 8px; background: #001030; overflow: hidden; }
.permission-group.is-collapsed .checks { display: none; }
.permission-group-header {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; background: #011540; cursor: pointer; user-select: none;
}
.permission-group-header:hover { background: #0d2255; }
.permission-group-toggle { flex-shrink: 0; color: var(--muted); font-size: 11px; transition: transform 0.15s; }
.permission-group.is-collapsed .permission-group-toggle { transform: rotate(-90deg); }
.permission-group-check { flex-shrink: 0; width: auto; min-height: auto; }
.permission-group-title { flex: 1; font-size: 13px; font-weight: 700; }
.permission-group-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.permission-group-selected { font-size: 11px; font-weight: 700; color: var(--accent-2); white-space: nowrap; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.checks label {
    display: flex; align-items: center; gap: 8px; margin: 0; text-transform: none;
    font-size: 13px; font-weight: 400; color: var(--text);
    padding: 5px 7px; border-radius: 5px; border: 1px solid transparent; cursor: pointer;
}
.checks label:hover { background: rgba(255,255,255,0.04); border-color: var(--line); }
.checks label:has(input:checked) { background: rgba(37,99,235,0.10); border-color: rgba(37,99,235,0.3); color: #c7d8ff; }
.checks input, .row-check input { width: auto; min-height: auto; }
.row-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text); text-transform: none; }
.empty { padding: 32px; color: var(--muted); text-align: center; }
.badge { display: inline-block; border-radius: 3px; font-size: 11px; font-weight: 700; padding: 2px 6px; text-transform: uppercase; white-space: nowrap; }
.badge-on { background: rgba(141, 255, 199, 0.1); color: #8dffc7; border: 1px solid rgba(141, 255, 199, 0.25); }
.badge-off { background: rgba(255, 102, 120, 0.1); color: #ffc0c8; border: 1px solid rgba(255, 102, 120, 0.3); }
.badge-admin { background: rgba(56, 189, 248, 0.12); color: #bfe9ff; border: 1px solid rgba(56, 189, 248, 0.32); }
.badge-user { background: rgba(157, 169, 187, 0.12); color: #d6dde8; border: 1px solid rgba(157, 169, 187, 0.26); }
.user-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.user-card {
    border: 1px solid var(--line); border-radius: 8px; background: #001030;
    padding: 13px; display: grid; gap: 12px;
}
.user-card:hover { border-color: rgba(56, 189, 248, 0.35); background: #011540; }
.user-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8); color: #06111f;
    font-weight: 800; font-size: 14px;
}
.user-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-name { display: block; color: var(--text); font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.user-card-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.user-cameras { color: var(--muted); font-size: 13px; line-height: 1.35; }
.user-cameras strong { color: var(--text); font-weight: 700; }
.modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0.72); padding: 18px;
    align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.user-modal {
    width: min(980px, 100%); max-height: min(92vh, 860px); overflow: hidden;
    border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
    box-shadow: 0 24px 70px rgba(0,0,0,0.55); display: grid; grid-template-rows: auto 1fr;
}
.user-modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--line); background: #011540;
}
.user-modal-title { margin: 0; font-size: 18px; }
.user-modal-body { overflow: auto; padding: 16px; }
.icon-button {
    width: 34px; min-height: 34px; padding: 0; font-size: 20px; line-height: 1;
    background: var(--panel-2); border-color: var(--line);
}
.monitor-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.metric-card {
    border: 1px solid var(--line); border-radius: 8px; background: #001030;
    padding: 14px; display: grid; gap: 6px;
}
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.metric-value { color: var(--text); font-size: 28px; font-weight: 800; line-height: 1; }
.session-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.current-session { color: #8dffc7; font-weight: 700; }
.admin-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-tab {
    min-height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line);
    background: var(--panel); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.admin-tab:hover { border-color: var(--accent); }
.badge-unknown { background: rgba(255, 211, 155, 0.1); color: #ffd39b; border: 1px solid rgba(255, 211, 155, 0.3); }
.cam-group-row td {
    background: #011540; border-top: 1px solid var(--line);
    padding: 9px 12px; font-size: 13px;
}
.cam-group-row td .badge { margin: 0 8px; }
.cam-enabled-toggle, .cam-transcode-toggle { width: auto; min-height: auto; cursor: pointer; }
tr.cam-disabled td { opacity: 0.45; }
tr.cam-disabled td:last-child { opacity: 1; }
.image-issues { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
@media (max-width: 1500px) { .mosaic { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
@media (max-width: 1100px) { .mosaic { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
@media (max-width: 1100px) { .split-layout { grid-template-columns: 1fr; } .editor-panel { position: static; } }
@media (max-width: 720px) {
    .mosaic { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .checks { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .panel-head { flex-direction: column; }
    .user-card-top { flex-direction: column; }
    .user-card-actions { justify-content: flex-start; }
}
@media (display-mode: fullscreen) { .topbar { display: none; } }
body.is-fullscreen .topbar { display: none; }
.grid-select { width: auto; min-width: 64px; min-height: 32px; padding: 0 6px; font-size: 12px; border: 1px solid rgba(255,255,255,0.22); border-radius: 6px; background: var(--brand-soft); color: var(--text-on-dark); cursor: pointer; }
.mosaic-pager { display: inline-flex; align-items: center; gap: 6px; color: var(--text-on-dark); font-size: 12px; }
.mosaic-pager[hidden] { display: none; }
.mosaic-pager button { min-width: 28px; min-height: 28px; padding: 0; font-size: 16px; line-height: 1; border: 1px solid rgba(255,255,255,0.22); border-radius: 6px; background: var(--brand-soft); color: var(--text-on-dark); cursor: pointer; }
.mosaic-pager button:disabled { opacity: 0.4; cursor: default; }
.mosaic-pager #pagerLabel { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.nvr-filter { position: relative; }
.nvr-filter-button { min-width: 132px; justify-content: space-between; gap: 8px; }
.nvr-filter-button::after { content: "▾"; color: var(--muted); font-size: 10px; }
.nvr-filter-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 950;
    width: min(280px, calc(100vw - 24px)); max-height: min(58vh, 380px); overflow: auto;
    padding: 8px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
    background: #012060; box-shadow: 0 18px 42px rgba(0,0,0,0.45);
}
.nvr-filter.open .nvr-filter-menu { display: grid; gap: 4px; }
.nvr-filter-menu label {
    display: flex; align-items: center; gap: 8px; min-height: 30px; margin: 0; padding: 5px 7px;
    border-radius: 5px; color: var(--text-on-dark); font-size: 12px; font-weight: 600; text-transform: none;
    cursor: pointer;
}
.nvr-filter-menu label:hover { background: rgba(255,255,255,0.06); }
.nvr-filter-menu input { width: auto; min-height: auto; }
.nvr-filter-empty {
    display: none; padding: 32px; color: var(--muted); text-align: center;
}
.nvr-filter-empty.is-visible { display: block; }
.refresh-form {
    display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
    color: var(--muted); font-size: 12px;
}
.refresh-form label {
    display: inline-flex; align-items: center; gap: 5px; margin: 0;
    color: var(--muted); font-size: 12px; font-weight: 700; text-transform: none; white-space: nowrap;
}
.refresh-form input[type="checkbox"] { width: auto; min-height: auto; }
.refresh-form input[type="number"] {
    width: 58px; min-height: 32px; padding: 0 6px; font-size: 12px;
    border-color: rgba(255,255,255,0.22); background: var(--brand-soft); color: var(--text-on-dark);
}
.refresh-countdown { min-width: 98px; color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.fullscreen-refresh-panel {
    display: none; position: fixed; top: 10px; right: 10px; z-index: 900;
    padding: 6px 8px; border: 1px solid rgba(255,255,255,0.18); border-radius: 6px;
    background: rgba(17, 24, 39, 0.72); backdrop-filter: blur(6px);
}
.fullscreen-clock-panel {
    display: none; position: fixed; top: 10px; left: 10px; z-index: 900;
    min-width: 158px; padding: 7px 9px; border: 1px solid rgba(255,255,255,0.18); border-radius: 6px;
    background: rgba(17, 24, 39, 0.72); backdrop-filter: blur(6px);
    color: var(--text-on-dark); font-size: 13px; font-weight: 700; text-align: center;
    font-variant-numeric: tabular-nums;
}
body.is-fullscreen .fullscreen-refresh-panel { display: block; }
body.is-fullscreen .fullscreen-clock-panel { display: block; }

.camera-tile { cursor: pointer; }
.camera-tile:hover .tile-overlay { background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 28%, transparent 62%, rgba(0,0,0,0.6) 100%); }

.cam-modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.88);
    align-items: center; justify-content: center;
}
.cam-modal-backdrop.open { display: flex; }
.cam-modal {
    position: relative; width: min(92vw, 1280px);
    background: #050607; border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    overflow: hidden;
}
.cam-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--brand); border-bottom: 1px solid var(--line);
    gap: 10px;
}
.cam-modal-title { font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-modal-close {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
    color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.cam-modal-close:hover { background: rgba(255,102,120,0.2); border-color: rgba(255,102,120,0.5); }
.cam-modal-video-wrap { position: relative; aspect-ratio: 16/9; }
.cam-modal-video-wrap video { width: 100%; height: 100%; display: block; background: #050607; }
.cam-modal-status {
    position: absolute; bottom: 10px; left: 12px;
    background: rgba(0,0,0,0.65); border-radius: 4px;
    padding: 3px 8px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.cam-modal-status.ok { color: #8dffc7; }
.cam-modal-status.error { color: #ffb1b1; }
