:root {
    --bg: #020617;
    --panel: #0f172a;
    --panel-soft: rgba(30, 41, 59, 0.5);
    --ink: #f8fafc;
    --muted: #94a3b8;
    --line: rgba(255, 255, 255, 0.08);
    --brand: #38bdf8;
    --brand-strong: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0b0f19;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    overscroll-behavior-x: none;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overscroll-behavior-x: none;
}

a {
    color: var(--brand);
    text-decoration: none;
}

/* --- New Sidebar Layout (Bootstrap based) --- */
.sidebar {
    height: 100vh;
    background-color: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}
.sidebar-title {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.sidebar a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: #f8fafc;
    padding-left: 20px;
}
.sidebar a:hover i, .sidebar a:hover svg { color: #38bdf8; transform: scale(1.05); }
.sidebar a.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.08) 0%, rgba(56, 189, 248, 0.02) 100%);
    color: #38bdf8;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #38bdf8;
    border-radius: 0 8px 8px 0;
}
.sidebar a.active i, .sidebar a.active svg { color: #38bdf8; }
.sidebar a i, .sidebar a svg { width: 18px !important; height: 18px !important; color: #94a3b8; transition: all 0.2s ease; flex-shrink: 0; }
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-name { font-size: 0.85rem; font-weight: 600; color: #f1f5f9; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin: 0; }
.user-role { font-size: 0.7rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }

.sidebar svg,
button svg,
.btn svg,
.empty-state svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.1;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

.icon-button:hover {
    border-color: var(--brand);
    background: var(--panel-soft);
}

.icon-button.subtle {
    background: var(--panel-soft);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-tile,
.panel-block,
.camera-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 28px rgba(17, 24, 39, .05);
}

.metric-tile {
    padding: 16px;
}

.metric-tile span {
    display: block;
    color: var(--muted);
    font-size: .86rem;
}

.metric-tile strong {
    display: block;
    margin-top: 8px;
    font-size: 1.65rem;
    line-height: 1.1;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading {
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.btn-sm {
    min-height: 32px;
    padding: 5px 10px;
    font-size: .86rem;
}

.btn-primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

.btn-primary:hover {
    border-color: var(--brand-strong);
    background: var(--brand-strong);
    color: #ffffff;
}

.btn-dark {
    border-color: var(--dark);
    background: var(--dark);
    color: #ffffff;
}

.btn-outline-dark,
.btn-outline-secondary {
    border-color: var(--line);
    background: var(--panel);
    color: var(--ink);
}

.btn-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.w-100 {
    width: 100%;
}

.mb-3 {
    margin-bottom: 1rem;
}

.form-label {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

.form-control:focus,
.form-select:focus {
    outline: 2px solid rgba(23, 105, 224, .22);
    border-color: var(--brand);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -8px;
    margin-left: -8px;
}

.g-3 {
    row-gap: 1rem;
}

.row > * {
    padding-right: 8px;
    padding-left: 8px;
}

.col-12 {
    flex: 0 0 auto;
    width: 100%;
}

.col-md-2,
.col-md-3,
.col-md-4,
.col-md-6 {
    flex: 0 0 auto;
    width: 100%;
}

.d-grid {
    display: grid;
}

.align-items-end {
    align-items: end;
}

.align-middle {
    vertical-align: middle;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.alert-danger {
    border: 1px solid #f5b7b1;
    background: #fde2e0;
    color: var(--danger);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: none;
    overflow-y: auto;
    padding: 18px;
    background: rgba(17, 24, 39, .62);
}

.modal.show {
    display: grid;
    place-items: center;
}

.modal-dialog {
    width: min(100%, 760px);
}

.modal-content {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
}

.modal-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.modal-footer {
    border-top: 1px solid var(--line);
}

.modal-body {
    padding: 18px;
}

.modal-title {
    margin: 0;
}

.fs-5 {
    font-size: 1.1rem;
}

.btn-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: var(--panel-soft);
    cursor: pointer;
}

.btn-close::before {
    content: "x";
    font-weight: 800;
}

.me-auto {
    margin-right: auto;
}

.live-console {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.live-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 6px;
    background: #0d1422;
}

.live-summary,
.live-layout-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-summary span,
.live-summary time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9ca9bc;
    font-size: .78rem;
    white-space: nowrap;
}

.live-summary strong,
.live-summary time {
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.live-summary time {
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, .1);
}

.live-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.live-dot.is-online {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}

.live-dot.is-recording {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

.live-dot.is-offline {
    background: #64748b;
}

.live-wall {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: min(68vh, 760px);
}

.live-wall[data-layout="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.live-wall[data-layout="6"],
.live-wall[data-layout="9"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #030712;
}

.live-no-signal {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    color: #64748b;
    background: #090e18;
}

.live-no-signal svg {
    width: 30px;
    height: 30px;
}

.live-camera-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 36px;
    max-width: 190px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 5px;
    background: #0d1422;
    color: #9ca9bc;
    cursor: pointer;
}

.live-camera-option.is-selected {
    border-color: rgba(59, 130, 246, .7);
    color: #ffffff;
}

.live-camera-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .live-wall[data-layout="6"],
    .live-wall[data-layout="9"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .live-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .live-summary {
        justify-content: space-between;
    }

    .live-layout-controls {
        justify-content: center;
    }

    .live-wall,
    .live-wall[data-layout="6"],
    .live-wall[data-layout="9"] {
        grid-template-columns: minmax(0, 1fr);
        min-height: auto;
    }

    .live-camera-option {
        max-width: 150px;
    }
}

.camera-card {
    overflow: hidden;
}

.camera-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0d121c;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-online,
.status-ativo,
.status-gravando {
    background: #ddfbea;
    color: var(--success);
}

.status-offline,
.status-inativo,
.status-bloqueado {
    background: #fde2e0;
    color: var(--danger);
}

.status-pendente {
    background: #fff4ce;
    color: var(--warning);
}

.panel-block {
    min-width: 0;
    padding: 18px;
}

.table {
    margin-bottom: 0;
}

.table th {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.table td {
    color: var(--ink);
    font-size: .92rem;
}

code {
    color: #0b4aa2;
    white-space: nowrap;
}

.discovery-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.discovery-item strong,
.discovery-item span,
.discovery-item small {
    display: block;
}

.discovery-item span,
.discovery-item small {
    color: var(--muted);
}

.dot {
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: 999px;
}

.dot.red {
    background: var(--danger);
}

.discovery-list {
    display: grid;
    gap: 12px;
}

.discovery-item {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.discovery-item.is-empty {
    background: var(--panel-soft);
}

.playback-filter {
    margin: 0;
}

.timeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0;
    padding: 16px 18px 42px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--muted);
    font-size: .76rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.timeline-track {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 14px;
    height: 12px;
    border-radius: 999px;
    background: var(--panel-soft);
    overflow: hidden;
}

.timeline-track span {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--brand);
}

.json-view {
    max-height: 520px;
    margin: 0;
    padding: 14px;
    overflow: auto;
    border-radius: 8px;
    background: #0d121c;
    color: #e5edf7;
}

.permission-grid {
    display: grid;
    gap: 10px;
}

.permission-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 360px;
    text-align: center;
}

.recording-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(48px, 1fr));
    gap: 6px;
}

.recording-weekdays label {
    display: grid;
    place-items: center;
    min-height: 40px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
}

.recording-weekdays input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.recording-weekdays label:has(input:checked) {
    border-color: var(--brand);
    background: rgba(23, 105, 224, .12);
    color: var(--brand);
}

@media (max-width: 576px) {
    .recording-weekdays {
        grid-template-columns: repeat(4, 1fr);
    }
}

.login-panel {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #030712 !important; /* Deepest dark */
    background-image: 
        radial-gradient(at 50% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
    margin: 0;
    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));
    box-sizing: border-box;
    overflow-y: auto;
}

.login-box {
    width: min(100%, 440px);
    padding: 48px 40px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px;
    background: linear-gradient(180deg, #0f1524 0%, #090d16 100%) !important;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 20px 40px -10px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: none !important;
}

.login-brand {
    margin-bottom: 32px;
}

.logo-hexagon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0;
    letter-spacing: 0;
}

.login-title span {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-box .form-label {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0 !important;
    margin-bottom: 8px !important;
    display: block;
}

.login-box .form-control {
    background: #111726 !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
    padding: 14px 16px !important;
    font-size: 16px !important;
    min-height: 48px;
    border-radius: 6px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.login-box .form-control:focus {
    border-color: #3b82f6 !important;
    background: #151d30 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

.login-password-field {
    position: relative;
}

.login-password-field .form-control {
    padding-right: 52px !important;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    transform: translateY(-50%);
    cursor: pointer;
}

.login-password-toggle:hover,
.login-password-toggle:focus-visible {
    background: rgba(255, 255, 255, .06);
    color: #ffffff;
}

.login-password-toggle:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

.login-password-toggle svg {
    width: 19px;
    height: 19px;
}

.login-box .form-check {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding-left: 0;
    gap: 8px;
    margin-bottom: 24px;
}

.login-box .form-check-label {
    font-size: 0.85rem !important;
    color: #94a3b8 !important;
    cursor: pointer;
    user-select: none;
}

.login-box .form-check-input {
    flex: 0 0 18px;
    float: none;
    background-color: #111726 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.login-box .form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.login-box .btn-primary {
    border-radius: 6px !important;
    padding: 14px 20px !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    letter-spacing: 0 !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border: none !important;
    box-shadow: 
        0 4px 12px rgba(37, 99, 235, 0.2),
        0 1px 2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 12px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: #ffffff !important;
    width: 100%;
}

.auth-main {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 !important;
}

@media (max-width: 576px) {
    .login-panel {
        place-items: center;
        padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    }

    .login-box {
        padding: 28px 20px;
    }

    .login-brand {
        margin-bottom: 24px;
    }

    .logo-hexagon {
        width: 64px;
        height: 64px;
        margin-bottom: 12px;
    }

    .login-title {
        font-size: 1.5rem;
    }
}

/* Fixed live-view composition slots */
.live-wall[data-layout="1"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.live-wall[data-layout="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="8"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="12"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.live-wall[data-layout="9"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.live-wall[data-layout="16"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
}

.live-slot {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 2px;
    background: #000000;
    cursor: pointer;
}

.live-slot:hover {
    border-color: rgba(148, 163, 184, .45);
}

.live-slot.is-selected {
    border-color: #38bdf8;
    box-shadow: inset 0 0 0 1px #38bdf8;
}

.live-slot:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: -2px;
}

.live-slot-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    color: #334155;
    user-select: none;
}

.live-slot-empty span {
    font-size: .66rem;
    font-variant-numeric: tabular-nums;
}

.live-slot-empty svg {
    width: 18px;
    height: 18px;
}

.live-slot.is-selected .live-slot-empty {
    color: #64748b;
}

.live-slot.is-assigned .live-slot-empty {
    display: none;
}

.live-camera-option.is-assigned {
    border-color: rgba(34, 197, 94, .22);
}

.live-camera-option.is-assigned .live-camera-icon {
    color: #86efac;
}

@media (max-width: 760px) {

    .live-stage .live-wall[data-layout="1"] {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
    }

    .live-stage .live-wall[data-layout="4"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, auto);
    }

    .live-slot {
        aspect-ratio: 16 / 9;
    }

    .live-stage .live-toolbar {
        flex-direction: row;
        align-items: center;
    }

    .live-stage .live-layout-controls {
        justify-content: flex-end;
    }
}

.app-main.is-camera-page .page-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
}

.app-main.is-camera-page .page-header h1 {
    max-width: min(58vw, 520px);
    overflow: hidden;
    font-size: 1rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main.is-camera-page .camera-view-container {
    max-width: 1280px;
}

.access-denied-shell { display: grid; place-items: center; min-height: min(62vh, 620px); padding: 24px 12px; }
.access-denied-modal { width: min(100%, 430px); padding: 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 20px 60px rgba(0,0,0,.22); text-align: center; }
.access-denied-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border: 1px solid rgba(239,68,68,.3); border-radius: 50%; background: rgba(239,68,68,.1); color: var(--danger); }
.access-denied-icon svg { width: 25px; height: 25px; }
.access-denied-kicker { color: var(--danger); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.access-denied-modal h2 { margin: 7px 0 8px; color: var(--ink); font-size: 1.15rem; }
.access-denied-modal p { margin: 0; color: var(--muted); font-size: .8rem; }
.access-denied-actions { display: flex; justify-content: center; gap: 8px; margin-top: 22px; }
.recording-settings-intro { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); }
.recording-settings-intro svg { width: 20px; height: 20px; color: var(--brand); }
.recording-settings-intro div { display: grid; gap: 2px; }
.recording-settings-intro strong { color: var(--ink); font-size: .78rem; }
.recording-settings-intro span { color: var(--muted); font-size: .7rem; }
.storage-workspace { display: grid; gap: 14px; }
.storage-overview { display: grid; grid-template-columns: 1.35fr repeat(2, 1fr); gap: 10px; }
.storage-card { position: relative; display: grid; gap: 5px; min-height: 104px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.storage-card span { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.storage-card strong { color: var(--ink); font-size: 1.35rem; }
.storage-card small { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.storage-card-primary { grid-template-columns: 1fr auto; border-color: rgba(56,189,248,.35); }
.storage-card-primary svg { width: 22px; height: 22px; color: var(--brand); }
.storage-progress { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 4px; background: var(--line); }
.storage-progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.storage-maintenance-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 14px; }
.storage-disk-panel, .storage-maintenance-panel { min-width: 0; padding: 0; overflow: hidden; }
.storage-disk-panel .section-heading, .storage-maintenance-panel .section-heading { align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--line); }
.storage-disk-panel .section-heading > svg, .storage-maintenance-panel .section-heading > svg { flex: 0 0 auto; width: 22px; color: var(--brand); }
.storage-section-kicker { display: block; margin-bottom: 4px; color: var(--brand); font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.storage-disk-panel h2, .storage-maintenance-panel h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.storage-disk-progress { padding: 16px 16px 10px; }
.storage-disk-progress-label { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: .73rem; }
.storage-disk-progress-label strong { color: var(--ink); }
.storage-disk-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0 16px 16px; }
.storage-disk-details div { display: grid; gap: 4px; padding: 10px 12px 0 0; }
.storage-disk-details dt { color: var(--muted); font-size: .67rem; }
.storage-disk-details dd { margin: 0; overflow: hidden; color: var(--ink); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.storage-disk-details code { color: var(--muted); font-size: .68rem; }
.storage-retention-form { display: grid; gap: 7px; padding: 16px; }
.storage-retention-form .input-group-text { border-color: var(--line); background: var(--panel-soft); color: var(--muted); }
.storage-action-list { display: grid; gap: 8px; margin: 0 16px 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.storage-action-list .btn { display: flex; align-items: center; justify-content: flex-start; gap: 9px; text-align: left; }
.storage-action-list svg { width: 16px; height: 16px; }
.storage-recordings-panel { padding: 0; overflow: hidden; }
.storage-recordings-panel .section-heading { align-items: flex-start; padding: 14px; border-bottom: 1px solid var(--line); }
.storage-recordings-panel h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.storage-recordings-panel table { margin: 0; }
.storage-recordings-panel th, .storage-recordings-panel td { padding: 11px 14px; }
.storage-workspace .modal-content { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.storage-workspace .modal-header, .storage-workspace .modal-footer { border-color: var(--line); }
.storage-workspace .modal-title { color: var(--ink); }
.storage-workspace .modal-title svg { width: 18px; color: var(--danger); vertical-align: -3px; }
.ptz-control-wrap { position: relative; display: inline-flex; }
.ptz-panel { position: fixed; z-index: 1100; right: 18px; bottom: 82px; width: 244px; max-width: calc(100vw - 20px); padding: 13px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: 0 20px 55px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.05); color: var(--ink); backdrop-filter: blur(18px); animation: ptz-panel-enter .16s ease-out; transform-origin: bottom right; }
.ptz-panel.is-dragging { animation: none; box-shadow: 0 24px 64px rgba(0,0,0,.5), 0 0 0 1px color-mix(in srgb, var(--brand) 26%, transparent); }
.ptz-panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; cursor: grab; touch-action: none; user-select: none; }
.ptz-panel.is-dragging .ptz-panel-header { cursor: grabbing; }
.ptz-panel-header > span:last-child { display: grid; min-width: 0; }
.ptz-panel-header strong { color: var(--ink); font-size: .78rem; font-weight: 750; line-height: 1.2; }
.ptz-panel-header small { margin-top: 2px; color: var(--muted); font-size: .62rem; line-height: 1.2; }
.ptz-panel-icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, var(--panel-soft)); color: var(--brand); }
.ptz-panel-icon svg { width: 17px; height: 17px; }
.ptz-pad { position: relative; display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); justify-content: center; gap: 3px; width: 160px; height: 160px; margin: 0 auto 13px; padding: 8px; border: 1px solid color-mix(in srgb, var(--line) 76%, transparent); border-radius: 50%; background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--brand) 8%, var(--panel-soft)), color-mix(in srgb, var(--panel-soft) 92%, transparent)); box-shadow: inset 0 0 24px rgba(0,0,0,.12); }
.ptz-pad .ptz-button:nth-child(1) { grid-column: 2; grid-row: 1; }
.ptz-pad .ptz-button:nth-child(2) { grid-column: 1; grid-row: 2; }
.ptz-pad .ptz-button:nth-child(3) { grid-column: 2; grid-row: 2; }
.ptz-pad .ptz-button:nth-child(4) { grid-column: 3; grid-row: 2; }
.ptz-pad .ptz-button:nth-child(6) { grid-column: 2; grid-row: 3; }
.ptz-pad > span { display: none; }
.ptz-button { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--panel) 82%, var(--panel-soft)); color: var(--muted); box-shadow: 0 3px 9px rgba(0,0,0,.12); cursor: pointer; transition: border-color .14s ease, background .14s ease, color .14s ease, transform .1s ease, box-shadow .14s ease; }
.ptz-button:hover, .ptz-button:focus-visible { border-color: color-mix(in srgb, var(--brand) 70%, var(--line)); background: color-mix(in srgb, var(--brand) 14%, var(--panel)); color: var(--brand); box-shadow: 0 5px 16px color-mix(in srgb, var(--brand) 18%, transparent); outline: none; }
.ptz-button:active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 24%, var(--panel)); color: var(--brand); transform: scale(.9); }
.ptz-button svg { width: 21px; height: 21px; stroke-width: 2.4; }
.ptz-stop { width: 42px; height: 42px; align-self: center; justify-self: center; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 9%, var(--panel)); color: var(--danger); }
.ptz-stop svg { width: 13px; height: 13px; fill: currentColor; }
.ptz-zoom-label { display: flex; align-items: center; justify-content: space-between; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: .64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ptz-zoom-label svg { width: 14px; height: 14px; }
.ptz-zoom-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 7px; }
.ptz-zoom-controls .btn { display: flex; min-height: 36px; align-items: center; justify-content: center; gap: 5px; border-radius: 9px; font-size: .67rem; font-weight: 650; }
.ptz-zoom-controls .btn:active { transform: scale(.97); }
.ptz-zoom-controls svg { width: 14px; height: 14px; }
.ptz-panel [data-ptz-status] { display: block; min-height: 0; margin-top: 8px; color: var(--muted); font-size: .62rem; text-align: center; }
.ptz-panel [data-ptz-status]:empty { display: none; }
@keyframes ptz-panel-enter { from { opacity: 0; transform: translateY(7px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 640px) {
    .player-control-bar { position: relative; z-index: 20; }
    .ptz-control-wrap { z-index: 31; }
    .ptz-panel { top: auto; right: 10px; bottom: 72px; width: 236px; transform-origin: bottom right; }
}
.storage-policy-panel { padding: 0; overflow: hidden; }
.storage-policy-panel .section-heading { align-items: flex-start; padding: 14px; border-bottom: 1px solid var(--line); }
.storage-policy-panel h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.storage-policy-table { margin: 0; }
.storage-policy-table th, .storage-policy-table td { padding: 12px 14px; }
.storage-policy-table td:first-child { display: grid; gap: 3px; }
.storage-policy-table td:first-child small { color: var(--muted); font-size: .68rem; }
.storage-mode-badge { display: inline-flex; width: fit-content; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: .7rem; }
.storage-mode-badge.mode-continua { border-color: rgba(34,197,94,.3); color: #22c55e; }
.storage-mode-badge.mode-desativada { color: var(--muted); }
.camera-mode-badge { display: inline-flex; max-width: 150px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.camera-mode-badge.mode-continua { border-color: rgba(34,197,94,.3); color: #22c55e; }
.camera-mode-badge.mode-movimento, .camera-mode-badge.mode-movimento_agendado { border-color: rgba(251,191,36,.3); color: #fbbf24; }
.recording-workspace { display: grid; gap: 16px; }
.recording-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px; min-height: 142px; padding: 24px 26px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(135deg, var(--panel) 0%, var(--panel) 56%, rgba(56,189,248,.075) 100%); }
.recording-hero::after { position: absolute; top: -78px; right: -38px; width: 220px; height: 220px; border: 1px solid rgba(56,189,248,.08); border-radius: 50%; content: ""; pointer-events: none; }
.recording-hero-copy { position: relative; z-index: 1; display: grid; gap: 7px; }
.recording-eyebrow { display: inline-flex; align-items: center; gap: 7px; width: fit-content; color: var(--brand); font-size: .67rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.recording-eyebrow svg { width: 13px; height: 13px; }
.recording-hero h1 { margin: 0; color: var(--ink); font-size: clamp(1.28rem, 2vw, 1.65rem); letter-spacing: -.025em; }
.recording-hero p { max-width: 570px; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.recording-overview { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); gap: 8px; }
.recording-overview article { display: grid; min-width: 105px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: rgba(15,23,42,.22); }
.recording-overview article.is-accent { border-color: rgba(56,189,248,.24); background: rgba(56,189,248,.06); }
.recording-overview span { color: var(--muted); font-size: .62rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.recording-overview strong { margin: 3px 0 1px; color: var(--ink); font-size: 1.38rem; line-height: 1; }
.recording-overview .is-accent strong { color: var(--brand); }
.recording-overview small { color: var(--muted); font-size: .61rem; }
.recording-editor-layout { display: grid; grid-template-columns: minmax(230px, .48fr) minmax(0, 1.52fr); gap: 14px; align-items: start; }
.recording-camera-picker, .recording-editor-panel { padding: 0; overflow: hidden; }
.recording-camera-picker { position: sticky; top: 14px; }
.recording-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); }
.recording-panel-heading div { display: grid; gap: 3px; }
.recording-panel-heading div > span { color: var(--brand); font-size: .61rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.recording-panel-heading h2 { margin: 0; color: var(--ink); font-size: .9rem; }
.recording-heading-actions { display: flex; align-items: center; gap: 7px; }
.recording-count { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: .68rem; font-weight: 800; }
.recording-picker-close { display: none; width: 30px; height: 30px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--muted); }
.recording-picker-close svg { width: 15px; }
.recording-camera-tools { display: grid; gap: 9px; padding: 11px 10px; border-bottom: 1px solid var(--line); }
.recording-camera-search { display: grid; grid-template-columns: 17px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--muted); transition: border-color .16s ease, box-shadow .16s ease; }
.recording-camera-search:focus-within { border-color: rgba(56,189,248,.42); box-shadow: 0 0 0 3px rgba(56,189,248,.06); }
.recording-camera-search svg { width: 15px; height: 15px; }
.recording-camera-search input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .68rem; }
.recording-camera-search input::placeholder { color: var(--muted); }
.recording-camera-search kbd, .recording-picker-footer kbd { display: inline-grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.025); color: var(--muted); font: 600 .57rem/1 system-ui, sans-serif; box-shadow: none; }
.recording-camera-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: rgba(2,6,23,.14); }
.recording-camera-filters button { min-height: 27px; padding: 3px 5px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .59rem; font-weight: 700; }
.recording-camera-filters button:hover { color: var(--ink); }
.recording-camera-filters button.is-active { background: var(--panel); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.recording-results-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; color: var(--muted); font-size: .57rem; }
.recording-results-meta strong { color: var(--ink); font-size: .61rem; }
.recording-results-meta button { padding: 0; border: 0; background: transparent; color: var(--brand); font-size: .57rem; font-weight: 700; }
.recording-camera-picker .section-heading { padding: 14px; border-bottom: 1px solid var(--line); }
.recording-camera-picker h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.recording-camera-list { display: grid; grid-auto-rows: min-content; align-content: start; gap: 4px; max-height: min(58vh, 560px); padding: 8px; overflow-y: auto; }
.recording-camera-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) 15px; align-items: center; gap: 9px; width: 100%; min-height: 54px; padding: 8px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.recording-camera-row:hover { border-color: var(--line); background: var(--panel-soft); }
.recording-camera-row.is-selected { border-color: rgba(56,189,248,.24); background: rgba(56,189,248,.07); }
.recording-camera-state { width: 7px; height: 7px; border-radius: 50%; background: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.1); }
.recording-camera-state.status-online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.1); }
.recording-camera-copy { display: grid; gap: 3px; min-width: 0; }
.recording-camera-row strong { overflow: hidden; font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.recording-camera-row small { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.recording-camera-row > svg { width: 14px; height: 14px; color: var(--muted); }
.recording-camera-row.is-selected > svg { color: var(--brand); }
.recording-filter-empty { display: grid; min-height: 150px; padding: 20px; place-items: center; align-content: center; gap: 6px; color: var(--muted); text-align: center; }
.recording-filter-empty svg { width: 24px; height: 24px; margin-bottom: 3px; color: var(--brand); opacity: .7; }
.recording-filter-empty strong { color: var(--ink); font-size: .7rem; }
.recording-filter-empty span { font-size: .6rem; }
.recording-load-more { min-height: 34px; margin: 5px; border: 1px dashed var(--line); border-radius: 5px; background: transparent; color: var(--brand); font-size: .62rem; font-weight: 700; }
.recording-load-more:hover { background: rgba(56,189,248,.04); }
.recording-picker-footer { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .56rem; line-height: 1.45; }
.recording-picker-footer span { display: inline-flex; align-items: center; gap: 4px; }
.recording-picker-backdrop { display: none; }
.recording-editor-panel form { display: grid; }
.recording-editor-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 280px); align-items: end; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(56,189,248,.035), transparent 45%); }
.recording-title-group { display: grid; gap: 5px; }
.recording-title-group > span { color: var(--brand); font-size: .63rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.recording-title-line { display: flex; align-items: center; gap: 9px; }
.recording-editor-header h2 { margin: 0; color: var(--ink); font-size: 1.12rem; }
.recording-forecast { --forecast-color: var(--muted); display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--forecast-color) 30%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--forecast-color) 8%, transparent); }
.recording-forecast[hidden] { display: none; }
.recording-forecast[data-forecast-state="ok"] { --forecast-color: var(--success); }
.recording-forecast[data-forecast-state="tight"] { --forecast-color: var(--warning); }
.recording-forecast[data-forecast-state="over"] { --forecast-color: var(--danger); }
.recording-forecast-icon { display: grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: color-mix(in srgb, var(--forecast-color) 16%, transparent); color: var(--forecast-color); }
.recording-forecast-icon svg { width: 15px; height: 15px; }
.recording-forecast-copy { display: grid; gap: 3px; min-width: 0; }
.recording-forecast strong { color: var(--ink); font-size: .72rem; }
.recording-forecast small { color: var(--muted); font-size: .61rem; line-height: 1.45; }
.recording-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.recording-fieldset:disabled { opacity: .72; }
.recording-live-state { --live-color: #64748b; display: flex; align-items: center; gap: 8px; padding: 9px 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--live-color) 7%, transparent); color: var(--muted); font-size: .64rem; }
.recording-live-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--live-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live-color) 16%, transparent); }
.recording-live-label { color: var(--ink); font-weight: 700; }
.recording-live-time { margin-left: auto; font-size: .58rem; font-variant-numeric: tabular-nums; }
.recording-live-state[data-live-status="recording"] { --live-color: var(--success); }
.recording-live-state[data-live-status="waiting-motion"] { --live-color: var(--brand); }
.recording-live-state[data-live-status="starting"], .recording-live-state[data-live-status="config-changed"], .recording-live-state[data-live-status="backoff"] { --live-color: var(--warning); }
.recording-live-state[data-live-status="storage-low"], .recording-live-state[data-live-status="frozen"], .recording-live-state[data-live-status="start-failed"], .recording-live-state[data-live-status="camera-offline"] { --live-color: var(--danger); }
.recording-live-state[data-live-status="recording"] .recording-live-dot { animation: recording-live-pulse 2.2s ease-in-out infinite; }
@keyframes recording-live-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--live-color) 0%, transparent); } }
.recording-row-live { color: var(--muted); }
.recording-row-live::before { content: "·"; margin: 0 3px; }
.recording-camera-row[data-live-status="recording"] .recording-row-live { color: var(--success); }
.recording-camera-row[data-live-status="waiting-motion"] .recording-row-live { color: var(--brand); }
.recording-camera-row[data-live-status="storage-low"] .recording-row-live, .recording-camera-row[data-live-status="frozen"] .recording-row-live, .recording-camera-row[data-live-status="start-failed"] .recording-row-live, .recording-camera-row[data-live-status="camera-offline"] .recording-row-live { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .recording-live-state[data-live-status="recording"] .recording-live-dot { animation: none; } }
.recording-camera-navigation { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.recording-open-picker { display: none; align-items: center; gap: 7px; min-height: 37px; padding: 0 11px; border: 1px solid rgba(56,189,248,.24); border-radius: 6px; background: rgba(56,189,248,.055); color: var(--brand); font-size: .65rem; font-weight: 750; }
.recording-open-picker svg { width: 15px; height: 15px; }
.recording-sequence-controls { display: grid; grid-template-columns: 34px auto 34px; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.recording-sequence-controls button { display: grid; width: 34px; height: 35px; padding: 0; place-items: center; border: 0; background: var(--panel-soft); color: var(--muted); }
.recording-sequence-controls button:hover { background: rgba(56,189,248,.07); color: var(--brand); }
.recording-sequence-controls button:first-child { border-right: 1px solid var(--line); }
.recording-sequence-controls button:last-child { border-left: 1px solid var(--line); }
.recording-sequence-controls button svg { width: 15px; }
.recording-sequence-controls span { min-width: 58px; color: var(--muted); font-size: .62rem; text-align: center; }
.recording-sequence-controls strong { color: var(--ink); }
.recording-form-section { display: grid; gap: 15px; padding: 20px; border-bottom: 1px solid var(--line); }
.recording-section-title { display: flex; align-items: center; gap: 10px; }
.recording-section-icon { display: inline-grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(56,189,248,.18); border-radius: 7px; background: rgba(56,189,248,.055); color: var(--brand); }
.recording-section-icon svg { width: 17px; height: 17px; }
.recording-section-title div { display: grid; gap: 2px; }
.recording-section-title h3 { margin: 0; color: var(--ink); font-size: .83rem; }
.recording-section-title p { margin: 0; color: var(--muted); font-size: .65rem; }
.recording-fields-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.recording-fields-capture { grid-template-columns: minmax(240px, 1.5fr) minmax(120px, .55fr); }
.recording-field { display: grid; gap: 6px; min-width: 0; }
.recording-field-wide { grid-column: span 1; }
.recording-field .form-label { margin: 0; color: var(--muted); font-size: .66rem; font-weight: 750; }
.recording-field .field-hint { margin-top: 1px; font-size: .6rem; line-height: 1.4; }
.recording-toggle-card { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); cursor: pointer; }
.recording-toggle-card > span:nth-child(2) { display: grid; gap: 2px; }
.recording-toggle-card strong { color: var(--ink); font-size: .69rem; }
.recording-toggle-card small { color: var(--muted); font-size: .59rem; line-height: 1.3; }
.recording-toggle-icon { display: inline-grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: rgba(56,189,248,.06); color: var(--brand); }
.recording-toggle-icon svg { width: 15px; height: 15px; }
.recording-toggle-card .form-check { margin: 0; padding: 0; }
.recording-toggle-card .form-check-input { float: none; margin: 0; }
.recording-toggle-wide { grid-column: 1 / -1; max-width: 410px; }
.recording-editor-panel .row { margin-top: 0 !important; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); }
.recording-editor-panel .form-label { color: var(--muted); font-size: .7rem; font-weight: 700; }
.recording-editor-panel .form-control, .recording-editor-panel .form-select { min-height: 40px; }
.recording-editor-panel .recording-schedule { padding: 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: rgba(56,189,248,.025); }
.recording-editor-panel .recording-schedule > .form-label { color: var(--brand); }
.recording-time-grid { display: grid; grid-template-columns: minmax(120px, 180px) 28px minmax(120px, 180px); align-items: end; gap: 8px; }
.recording-time-separator { display: grid; height: 40px; place-items: center; color: var(--muted); }
.recording-time-separator svg { width: 15px; }
.recording-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; background: var(--panel-soft); }
.recording-save-state { display: grid; gap: 4px; }
.recording-save-state .field-hint { display: inline-flex; align-items: center; gap: 5px; font-size: .61rem; }
.recording-save-state .field-hint svg { width: 13px; height: 13px; color: var(--brand); }
.recording-editor-footer .btn { min-width: 148px; justify-content: center; }
.storage-info-strip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); }
.storage-info-strip svg { flex: 0 0 auto; width: 18px; color: var(--brand); }
.storage-info-strip div { display: grid; gap: 3px; }
.storage-info-strip strong { color: var(--ink); font-size: .76rem; }
.storage-info-strip span { color: var(--muted); font-size: .7rem; }

/* User management */
.users-workspace {
    display: grid;
    gap: 14px;
}

.users-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.users-summary article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
}

.users-summary span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 650;
    text-transform: uppercase;
}

.users-summary strong {
    color: var(--ink);
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}

.users-panel {
    padding: 0;
    overflow: hidden;
}

.users-management-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr);
    gap: 14px;
    align-items: start;
}

.users-management-grid .users-panel { order: 1; }
.users-management-grid .profile-panel { order: 2; }

.profile-panel { padding: 0; overflow: hidden; }
.profile-toolbar { align-items: flex-start; }
.section-title { color: var(--ink); font-size: 1rem; font-weight: 750; }
.profile-list { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px; }
.profile-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); }
.profile-item div { display: grid; gap: 2px; min-width: 0; }
.profile-item strong { overflow: hidden; color: var(--ink); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-item small { color: var(--muted); font-size: .68rem; }
.profile-tabs { display: flex; gap: 4px; margin: 0 -1px 16px; border-bottom: 1px solid var(--line); }
.profile-tab { padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: .76rem; font-weight: 700; cursor: pointer; }
.profile-tab.is-active { border-bottom-color: var(--brand); color: var(--brand); }
.profile-tab-panel { display: none; min-height: 160px; }
.profile-tab-panel.is-active { display: block; }
.permission-grid, .camera-access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.permission-option { display: flex; align-items: flex-start; gap: 9px; min-height: 58px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); cursor: pointer; }
.permission-option:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--panel-soft)); }
.permission-option input { margin-top: 3px; accent-color: var(--brand); }
.permission-option span { display: grid; gap: 3px; }
.permission-option strong { color: var(--ink); font-size: .75rem; }
.permission-option small { color: var(--muted); font-size: .67rem; line-height: 1.35; }

.users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
}

.users-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 520px;
}

.users-search svg {
    position: absolute;
    top: 50%;
    left: 11px;
    width: 16px;
    height: 16px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.users-search input,
.users-filter {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel-soft);
    color: var(--ink);
    font-size: .82rem;
}

.users-search input {
    padding: 8px 12px 8px 36px;
}

.users-filter {
    width: 180px;
    padding: 8px 10px;
}

.users-table-wrap {
    overflow-x: auto;
}

.users-table th,
.users-table td {
    padding: 12px 14px;
    vertical-align: middle;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-initials {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(56, 189, 248, .22);
    border-radius: 5px;
    background: rgba(56, 189, 248, .1);
    color: #38bdf8;
    font-size: .68rem;
    font-weight: 800;
}

.user-identity > span:last-child {
    display: grid;
    min-width: 0;
}

.user-identity strong,
.user-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-identity strong {
    color: var(--ink);
    font-size: .82rem;
}

.user-identity small,
.user-last-login {
    color: var(--muted);
    font-size: .7rem;
}

.user-role-badge {
    display: inline-flex;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--muted);
    font-size: .7rem;
}

.users-actions-heading {
    width: 92px;
    text-align: right;
}

.user-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.user-action {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel-soft);
    color: var(--muted);
    cursor: pointer;
}

.user-action:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.user-action.is-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.user-action svg {
    width: 15px;
    height: 15px;
}

.users-mobile-list {
    display: none;
}

.users-empty-filter {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.user-role-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.user-role-guide article {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
}

.user-role-guide svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--brand);
}

.user-role-guide div {
    display: grid;
    gap: 3px;
}

.user-role-guide strong {
    color: var(--ink);
    font-size: .78rem;
}

.user-role-guide span,
.field-hint {
    color: var(--muted);
    font-size: .7rem;
}

@media (max-width: 760px) {
    .recording-hero { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
    .recording-overview { width: 100%; }
    .recording-overview article { min-width: 0; padding: 10px; }
    .recording-overview strong { font-size: 1.15rem; }
    .recording-overview small { display: none; }
    .recording-editor-layout { grid-template-columns: 1fr; }
    .recording-camera-picker { position: fixed; z-index: 1062; top: 56px; bottom: 0; left: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(88vw, 360px); max-height: none; visibility: hidden; border: 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; background: var(--panel); transform: translateX(-105%); transition: transform .2s ease, visibility 0s linear .2s; }
    .recording-picker-open .recording-camera-picker { visibility: visible; transform: translateX(0); transition-delay: 0s; }
    .recording-picker-open { overflow: hidden; }
    .recording-picker-close { display: grid; }
    .recording-picker-backdrop { position: fixed; z-index: 1061; inset: 0; display: block; visibility: hidden; border: 0; background: rgba(1,5,14,.7); opacity: 0; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
    .recording-picker-open .recording-picker-backdrop { visibility: visible; opacity: 1; pointer-events: auto; transition-delay: 0s; }
    .recording-camera-list { display: grid; max-height: none; }
    .recording-picker-footer { display: none; }
    .recording-editor-header { grid-template-columns: 1fr; align-items: stretch; }
    .recording-editor-header > .status-pill { width: fit-content; }
    .recording-camera-navigation { justify-content: space-between; }
    .recording-open-picker { display: inline-flex; }
    .recording-form-section { padding: 16px 14px; }
    .recording-fields-grid, .recording-fields-capture { grid-template-columns: 1fr; }
    .recording-toggle-wide { max-width: none; }
    .recording-time-grid { grid-template-columns: 1fr 22px 1fr; }
    .recording-editor-panel .row { padding: 10px; }
    .recording-editor-footer { align-items: stretch; flex-direction: column; }
    .recording-editor-footer .btn { width: 100%; }
    .storage-overview { grid-template-columns: 1fr 1fr; }
    .storage-card-primary { grid-column: 1 / -1; }
    .storage-maintenance-grid { grid-template-columns: 1fr; }
    .storage-policy-panel .section-heading { flex-direction: column; }
    .storage-policy-panel .section-heading .btn { width: 100%; }
    .storage-recordings-panel .section-heading { flex-direction: column; }
    .storage-recordings-panel .section-heading .btn { width: 100%; }
    .users-management-grid { grid-template-columns: 1fr; }
    .users-management-grid .profile-panel { order: 1; }
    .users-management-grid .users-panel { order: 2; }
    .users-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }
    .profile-toolbar { flex-direction: column; }
    .profile-toolbar .btn { width: 100%; }
    .profile-tabs { overflow-x: auto; }
    .profile-tab { flex: 0 0 auto; }

    .users-summary article {
        align-items: flex-start;
        flex-direction: column;
        min-height: 66px;
        padding: 9px;
    }

    .users-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .users-search,
    .users-filter {
        width: 100%;
        max-width: none;
    }

    .users-table-wrap {
        display: none;
    }

    .users-mobile-list {
        display: grid;
        gap: 0;
    }

    .user-mobile-card {
        display: grid;
        gap: 10px;
        padding: 12px;
        border-bottom: 1px solid var(--line);
    }

    .user-mobile-card:last-child {
        border-bottom: 0;
    }

    .user-mobile-top,
    .user-mobile-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .user-mobile-bottom > span {
        color: var(--muted);
        font-size: .72rem;
    }

    .user-role-guide {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Top navigation and operator workspace */
.app-body {
    min-height: 100vh;
    min-height: 100svh;
    background: #050b14;
    overflow-x: clip;
    overscroll-behavior-y: none;
}

.global-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
    align-items: center;
    min-height: 64px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #08111f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.global-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    color: #f8fafc;
    font-size: .95rem;
    font-weight: 700;
}

.global-brand img {
    width: 34px;
    height: 34px;
}

.global-brand strong {
    color: #38bdf8;
}

.global-nav {
    grid-column: 2;
    display: flex;
    align-self: stretch;
    justify-self: center;
    justify-content: center;
    gap: 2px;
}

.global-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 104px;
    padding: 0 14px;
    color: #8d9bb0;
    font-size: .8rem;
    font-weight: 600;
}

.global-nav a::after {
    content: "";
    position: absolute;
    right: 14px;
    bottom: 0;
    left: 14px;
    height: 2px;
    background: transparent;
}

.global-nav a:hover,
.global-nav a.active {
    color: #f8fafc;
    background: #0c192b;
}

.global-nav a.active::after {
    background: #38bdf8;
}

.global-nav-group { position: relative; display: flex; align-items: stretch; }
.global-nav-parent { display: inline-flex; align-items: center; gap: 7px; min-width: 104px; padding: 0 14px; border: 0; background: transparent; color: #8d9bb0; font-size: .8rem; font-weight: 600; cursor: pointer; }
.global-nav-parent:hover, .global-nav-group.is-active .global-nav-parent { background: #0c192b; color: #f8fafc; }
.global-nav-parent svg { width: 17px; height: 17px; }
.global-nav-parent .global-nav-chevron { width: 13px; height: 13px; margin-left: auto; transition: transform .18s ease; }
.global-nav-parent[aria-expanded="true"] .global-nav-chevron { transform: rotate(180deg); }
.global-submenu { position: absolute; top: calc(100% - 1px); left: 0; z-index: 30; display: none; min-width: 190px; padding: 6px; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; background: #08111f; box-shadow: 0 18px 40px rgba(0,0,0,.4); }
.global-submenu.is-open { display: grid; }
.global-submenu a { min-width: 0; min-height: 38px; padding: 0 10px; border-radius: 4px; }
.global-submenu a::after { display: none; }

@media (hover: hover) and (pointer: fine) {
    .global-nav-group::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        height: 8px;
    }

    .global-nav-parent {
        position: relative;
    }

    .global-nav-parent::after {
        content: "";
        position: absolute;
        right: 14px;
        bottom: 0;
        left: 14px;
        height: 2px;
        border-radius: 999px 999px 0 0;
        background: #38bdf8;
        opacity: 0;
        transform: scaleX(.45);
        transition: opacity .18s ease, transform .18s ease;
    }

    .global-submenu {
        display: grid;
        padding: 8px;
        border-color: rgba(56, 189, 248, .16);
        border-radius: 8px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, .46), 0 0 0 1px rgba(56, 189, 248, .04);
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        pointer-events: none;
        transition: opacity .16s ease .2s, transform .16s ease .2s, visibility 0s linear .36s;
    }

    .global-nav-group:hover .global-submenu,
    .global-submenu.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
        transition-delay: 0s;
    }

    .global-nav-group:hover .global-nav-parent::after,
    .global-nav-parent[aria-expanded="true"]::after,
    .global-nav-group.is-active .global-nav-parent::after {
        opacity: 1;
        transform: scaleX(1);
    }

    .global-nav-group:hover .global-nav-chevron { transform: rotate(180deg); }

    .global-submenu a {
        gap: 10px;
        min-height: 40px;
        border-radius: 6px;
        transition: color .15s ease, background-color .15s ease, transform .15s ease;
    }

    .global-submenu a svg {
        flex: 0 0 17px;
    }

    .global-submenu a:hover {
        background: rgba(56, 189, 248, .1);
        transform: translateX(2px);
    }

    .global-submenu a.active {
        background: rgba(56, 189, 248, .14);
        color: #e0f2fe;
        box-shadow: inset 2px 0 0 #38bdf8;
    }
}

.global-nav svg,
.global-menu-toggle svg {
    width: 17px;
    height: 17px;
}

.global-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 5px;
    background: #0d1929;
    color: #dce6f3;
}

.global-menu-toggle {
    cursor: pointer;
}

.global-menu-toggle {
    grid-column: 3;
    justify-self: end;
    display: none;
}

.app-main {
    min-height: calc(100dvh - 64px);
    padding: 18px;
}

.app-main.is-live-page {
    height: calc(100dvh - 64px);
    min-height: 620px;
    padding: 12px;
    overflow: hidden;
}

.app-content {
    min-width: 0;
}

.is-live-page .app-content {
    height: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.page-header h1 {
    margin: 0;
    color: #f8fafc;
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: 0;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-workspace {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.live-camera-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 6px;
    background: #08111f;
}

.live-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 64px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.live-sidebar-header .live-sidebar-title {
    display: grid;
    gap: 2px;
}

.live-sidebar-header .live-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-sidebar-header span {
    color: #64748b !important;
    font-size: .65rem !important;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.live-sidebar-header strong,
.live-summary strong {
    color: #f8fafc;
    font-size: .9rem;
}

.live-sidebar-header > a,
.live-sidebar-action {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 4px;
    color: #94a3b8;
}

.live-sidebar-action {
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.live-sidebar-action:hover,
.live-sidebar-action:focus-visible,
.live-sidebar-action.is-active {
    border-color: #38bdf8;
    color: #38bdf8;
}

.live-sidebar-header svg {
    width: 16px;
    height: 16px;
}

.live-camera-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding: 8px;
    overflow-y: auto;
}

.live-camera-filters {
    display: grid;
    gap: 5px;
    padding: 7px 7px 2px;
}

.live-camera-filters label {
    position: relative;
    display: block;
}

.live-camera-filters label svg {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 13px;
    height: 13px;
    color: #64748b;
    pointer-events: none;
}

.live-camera-filters input,
.live-camera-filters select {
    width: 100%;
    min-height: 30px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 4px;
    background: #0b1727;
    color: #aebdd0;
    font-size: .66rem;
}

.live-camera-filters input { padding: 5px 7px 5px 27px; }
.live-camera-filters select { padding: 5px 7px; }
.live-camera-option[hidden] { display: none; }

.live-camera-option {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 8px;
    align-items: center;
    gap: 9px;
    width: 100%;
    max-width: none;
    min-height: 52px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    text-align: left;
}

.live-camera-option:hover {
    background: #0c192a;
}

.live-camera-option.is-selected {
    border-color: rgba(56, 189, 248, .32);
    background: #0d1d31;
}

.live-camera-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #111e30;
    color: #7dd3fc;
}

.live-camera-icon svg {
    width: 17px;
    height: 17px;
}

.live-camera-copy {
    display: grid;
    min-width: 0;
}

.live-camera-copy strong,
.live-camera-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-camera-copy strong {
    color: #dce6f3;
    font-size: .78rem;
    font-weight: 650;
}

.live-camera-copy small {
    color: #64748b;
    font-size: .66rem;
}

.live-sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 9px 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.live-sidebar-footer span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #7f8da1;
    font-size: .66rem;
}

.live-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 6px;
    background: #03070d;
}

.live-stage .live-toolbar {
    flex: 0 0 auto;
    min-height: 52px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    border-radius: 0;
    background: #08111f;
}

.live-stage .live-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-stage .live-summary > div {
    display: grid;
    gap: 1px;
}

.live-stage .live-summary time {
    margin-left: 4px;
}

.live-profile-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.live-stage .live-summary > .live-profile-controls {
    display: inline-flex;
    gap: 4px;
}

.live-profile-controls button[hidden] {
    display: none;
}

.live-profile-controls select,
.live-layout-controls > select {
    min-height: 30px;
    padding: 4px 26px 4px 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px;
    background: #0b1727;
    color: #aebdd0;
    font-size: .66rem;
}

.live-profile-controls select {
    width: 132px;
}

.live-layout-controls > select {
    width: 116px;
}

.live-profile-controls button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px;
    background: transparent;
    color: #8292a7;
    cursor: pointer;
}

.live-profile-controls button:hover,
.live-profile-controls button:focus-visible {
    border-color: #38bdf8;
    color: #7dd3fc;
}

.live-profile-controls svg {
    width: 14px;
    height: 14px;
}

.live-offline-alert {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(248, 113, 113, .28);
    background: rgba(127, 29, 29, .26);
    color: #fca5a5;
    font-size: .68rem;
    font-weight: 650;
}

.live-offline-alert[hidden] {
    display: none;
}

.live-tour-bar {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, 220px) auto;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(56, 189, 248, .22);
    background: #081525;
}

.live-tour-bar[hidden] { display: none; }
.live-tour-bar > div:first-child { display: grid; min-width: 0; }
.live-tour-bar strong { overflow: hidden; color: #e2e8f0; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.live-tour-bar span { color: #7f8da1; font-size: .61rem; }

.live-tour-progress {
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, .16);
}

.live-tour-progress i {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: #38bdf8;
    transform: scaleX(0);
    transform-origin: left center;
}

.live-tour-actions { display: inline-flex; gap: 4px; }
.live-tour-actions button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px;
    background: transparent;
    color: #94a3b8;
}
.live-tour-actions button:hover { border-color: #38bdf8; color: #7dd3fc; }
.live-tour-actions button.is-active { border-color: rgba(56, 189, 248, .55); color: #7dd3fc; }
.live-tour-actions svg { width: 13px; height: 13px; }

.live-stage:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
    background: #000;
}

.live-stage:fullscreen .live-toolbar,
.live-stage:fullscreen .live-tour-bar,
.live-stage:fullscreen .live-offline-alert,
.live-stage:fullscreen .live-slot-fullscreen {
    display: none !important;
}

.live-stage:fullscreen .live-wall {
    gap: 1px;
    padding: 0;
    background: #000;
}

.live-stage:fullscreen .live-slot {
    border-color: #000;
    border-radius: 0;
}

.live-manager-dialog {
    width: min(92vw, 760px);
    max-height: min(88vh, 820px);
    padding: 0;
    overflow: hidden;
    border: 1px solid #26354a;
    border-radius: 8px;
    background: #08111f;
    color: #dce6f3;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
}

.live-manager-dialog::backdrop { background: rgba(1, 5, 12, .78); backdrop-filter: blur(3px); }
.live-manager-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.live-manager-dialog > header span { color: #64748b; font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.live-manager-dialog > header h2 { margin: 2px 0 0; color: #f8fafc; font-size: 1rem; }
.live-manager-dialog > header button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: transparent; color: #94a3b8; }
.live-manager-dialog > header svg { width: 15px; height: 15px; }

.live-manager-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.08); background: #07101c; }
.live-manager-tabs button { padding: 7px 12px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #7f8da1; font-size: .7rem; font-weight: 650; }
.live-manager-tabs button.is-active { border-color: rgba(56,189,248,.3); background: rgba(14,116,144,.12); color: #7dd3fc; }

.live-manager-panel { max-height: calc(88vh - 116px); padding: 14px; overflow-y: auto; }
.live-manager-panel[hidden] { display: none; }
.live-manager-panel form { display: grid; gap: 12px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; background: #0a1524; }
.live-manager-panel form > div:not(.live-manager-options),
.live-manager-form-grid > div { display: grid; gap: 5px; }
.live-manager-panel label,
.live-manager-panel legend { color: #93a4b8; font-size: .66rem; font-weight: 650; }
.live-manager-panel input[type="text"],
.live-manager-panel input:not([type]),
.live-manager-panel select,
.live-manager-panel input[type="number"] { min-height: 34px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: #07101c; color: #dce6f3; font-size: .72rem; }
.live-manager-panel form > button { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 11px; border: 1px solid #0ea5e9; border-radius: 4px; background: #0369a1; color: #fff; font-size: .7rem; font-weight: 700; }
.live-manager-panel form > button svg { width: 14px; height: 14px; }
.live-manager-panel fieldset { min-width: 0; margin: 0; padding: 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 5px; }
.live-manager-panel legend { width: auto; margin: 0; padding: 0 5px; }
.live-manager-form-grid { display: grid !important; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px !important; }
.live-manager-options { display: flex; flex-wrap: wrap; gap: 16px; }
.live-manager-options label { display: inline-flex; align-items: center; gap: 6px; }
.live-manager-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.live-manager-checks label { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 4px; background: rgba(255,255,255,.025); }

.live-tour-view-list { display: grid; gap: 5px; }
.live-tour-view-list label { display: grid; grid-template-columns: auto minmax(0, 1fr) 54px 64px auto; align-items: center; gap: 7px; padding: 6px; border-radius: 4px; background: rgba(255,255,255,.025); }
.live-tour-view-list input[type="number"] { width: 100%; min-height: 30px; }
.live-tour-view-list em { color: #64748b; font-size: .62rem; font-style: normal; }

.live-manager-list { display: grid; gap: 6px; margin-top: 10px; }
.live-manager-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.07); border-radius: 5px; background: #0a1524; }
.live-manager-list article > div:first-child { display: grid; min-width: 0; }
.live-manager-list strong { color: #dce6f3; font-size: .72rem; }
.live-manager-list small { color: #64748b; font-size: .62rem; }
.live-manager-list article > div:last-child { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.live-manager-list button { padding: 5px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: transparent; color: #94a3b8; font-size: .62rem; }
.live-manager-list button:hover { border-color: #38bdf8; color: #7dd3fc; }
.live-manager-list select { max-width: 150px; min-height: 28px; padding: 4px 6px; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: #07101c; color: #aebdd0; font-size: .62rem; }

.display-body { overflow: hidden; background: #02050a; }
.display-main { width: 100vw; height: 100vh; overflow: hidden; }
.display-player { display: flex; flex-direction: column; width: 100%; height: 100%; background: #02050a; }
.display-toolbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(130px, 220px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 54px;
    padding: 7px 12px 9px;
    border-bottom: 1px solid rgba(255,255,255,.09);
    background: #07111e;
}
.display-toolbar > div:first-child,
.display-current { display: grid; min-width: 0; }
.display-toolbar > div:first-child span,
.display-current span { color: #64748b; font-size: .6rem; }
.display-toolbar strong { overflow: hidden; color: #e2e8f0; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.display-actions { display: inline-flex; align-items: center; gap: 5px; }
.display-actions time { margin-right: 6px; color: #8292a7; font-size: .7rem; font-variant-numeric: tabular-nums; }
.display-actions button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: transparent; color: #94a3b8; }
.display-actions button:hover { border-color: #38bdf8; color: #7dd3fc; }
.display-actions svg { width: 14px; height: 14px; }
.display-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: #38bdf8; transform: scaleX(0); transform-origin: left center; }
.display-message { display: grid; place-items: center; flex: 1; color: #8292a7; font-size: .82rem; }
.display-message[hidden] { display: none; }
.display-wall { flex: 1; min-height: 0; gap: 4px; padding: 4px; }
.display-wall .live-slot { border-color: rgba(255,255,255,.1); }
.display-player:fullscreen { width: 100vw; height: 100vh; }

@media (max-width: 760px) {
    .live-manager-dialog { width: 96vw; max-height: 94vh; }
    .live-manager-tabs { overflow-x: auto; }
    .live-manager-panel { max-height: calc(94vh - 116px); }
    .live-manager-form-grid,
    .live-manager-checks { grid-template-columns: minmax(0, 1fr); }
    .live-tour-view-list label { grid-template-columns: auto minmax(0, 1fr) 48px 56px auto; }
    .display-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .display-current { display: none; }
    .display-actions time { display: none; }
}

.live-stage .live-wall {
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px;
    background: #02050a;
}

.live-wall[data-layout="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="8"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.live-wall[data-layout="12"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.live-wall[data-layout="9"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.live-wall[data-layout="1"] {
    grid-template-rows: minmax(0, 1fr);
}

nvr-live-player {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000000;
    opacity: 0;
    transition: opacity 180ms ease;
}

nvr-live-player.is-ready {
    opacity: 1;
}

.live-slot-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #000000;
    color: #94a3b8;
    font-size: .75rem;
    font-weight: 600;
}

.live-slot-loading[hidden] {
    display: none;
}

.live-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(148, 163, 184, .28);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: live-loading-spin .8s linear infinite;
}

@keyframes live-loading-spin {
    to { transform: rotate(360deg); }
}

nvr-live-player video {
    width: 100%;
    height: 100%;
    object-fit: var(--live-object-fit, contain);
}

.live-wall[data-fit="contain"] { --live-object-fit: contain; }
.live-wall[data-fit="cover"] { --live-object-fit: cover; }

.live-slot-overlay {
    position: absolute;
    z-index: 4;
    top: 7px;
    right: 7px;
    left: 7px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.live-slot-identity {
    display: grid;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px;
    background: rgba(2, 6, 12, .78);
    box-shadow: 0 3px 14px rgba(0, 0, 0, .25);
    backdrop-filter: blur(5px);
}

.live-slot-identity[hidden] {
    display: none;
}

.live-slot-identity span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #86efac;
    font-size: .58rem;
    font-weight: 650;
    line-height: 1.35;
}

.live-slot-identity span::before {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}

.live-slot-identity span[data-tone="recording"] { color: #f87171; }
.live-slot-identity span[data-tone="warning"] { color: #fbbf24; }
.live-slot-identity span[data-tone="armed"] { color: #7dd3fc; }
.live-slot-identity span[data-tone="offline"] { color: #94a3b8; }

.live-slot-fullscreen {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 4px;
    background: rgba(2, 6, 12, .78);
    color: #cbd5e1;
    cursor: pointer;
    opacity: .72;
    pointer-events: auto;
    transition: border-color .16s ease, color .16s ease, opacity .16s ease;
}

.live-slot:hover .live-slot-fullscreen,
.live-slot-fullscreen:focus-visible {
    border-color: rgba(56, 189, 248, .7);
    color: #7dd3fc;
    opacity: 1;
}

.live-slot-fullscreen svg {
    width: 15px;
    height: 15px;
}

.live-slot:fullscreen {
    border: 0;
    background: #000;
}

.live-slot:fullscreen .live-slot-fullscreen {
    top: 12px;
    right: 12px;
}

.live-sidebar-empty {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    flex: 1;
    color: #64748b;
}

@media (max-width: 1080px) {
    .global-header {
        grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
    }

    .global-nav a {
        min-width: auto;
        padding: 0 10px;
    }

    .global-nav-parent { min-height: 42px; padding: 0 12px; border-radius: 4px; text-align: left; }
    .global-nav-parent span { display: inline; }

    .global-nav a span {
        display: none;
    }

    .live-workspace {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 960px) {
    .global-header {
        grid-template-columns: 1fr auto;
        min-height: 58px;
        padding: 0 12px;
        column-gap: 8px;
    }

    .global-menu-toggle {
        grid-column: 2;
        display: inline-grid;
        margin-right: 2px;
    }

    .global-nav {
        grid-column: 1 / -1;
        position: absolute;
        top: calc(100% + 1px);
        right: 8px;
        left: 8px;
        display: none;
        align-self: auto;
        flex-direction: column;
        gap: 2px;
        padding: 8px;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 6px;
        background: #08111f;
        box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
        max-height: calc(100vh - 74px);
        max-height: calc(100svh - 74px);
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-gutter: stable;
    }

    .global-nav.is-open {
        display: flex;
    }

    .global-nav-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .global-nav-parent {
        flex: 0 0 auto;
        width: 100%;
        min-height: 42px;
        padding: 0 12px;
        border-radius: 4px;
    }

    .global-submenu {
        position: static;
        width: auto;
        min-width: 0;
        margin: 2px 0 4px 12px;
        padding: 3px 0 3px 8px;
        border: 0;
        border-left: 1px solid rgba(255, 255, 255, .12);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .global-submenu a {
        width: 100%;
        min-height: 38px;
    }

    .global-nav a {
        min-height: 42px;
        padding: 0 12px;
        border-radius: 4px;
    }

    .global-nav a span {
        display: inline;
    }

    .global-nav a::after {
        top: 8px;
        right: auto;
        bottom: 8px;
        left: 0;
        width: 2px;
        height: auto;
    }

    .app-main,
    .app-main.is-live-page {
        height: auto;
        min-height: calc(100vh - 58px);
        min-height: calc(100svh - 58px);
        padding: 8px;
        overflow: visible;
    }

    .app-main.is-camera-page {
        padding: 0;
    }

    .app-main.is-camera-page .camera-view-container {
        max-width: none;
    }

    .app-main.is-live-page {
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
    }

    .is-live-page .app-content {
        height: auto;
    }

    .live-workspace {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .live-camera-sidebar {
        min-height: auto;
    }

    .live-sidebar-header,
    .live-sidebar-footer {
        display: none;
    }

    .live-camera-list {
        flex-direction: row;
        padding: 7px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .live-camera-option {
        flex: 0 0 168px;
        width: 168px;
    }

    .live-stage {
        min-height: 62vh;
    }

    .live-stage .live-wall,
    .live-wall[data-layout="4"],
    .live-wall[data-layout="6"],
    .live-wall[data-layout="9"] {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        overflow: visible;
    }
}

@media (max-height: 600px) {
    .login-panel {
        place-items: start center;
    }

    .login-box {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .login-brand {
        margin-bottom: 16px;
    }

    .logo-hexagon {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }
}

.login-box .btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 
        0 8px 20px rgba(37, 99, 235, 0.35),
        0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--muted);
}

.form-status {
    color: var(--muted);
    font-size: .9rem;
}

@media (max-width: 1180px) {

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1050;
        width: min(84vw, 300px);
        transform: translateX(-102%);
        transition: transform .2s ease;
    }
}

@media (min-width: 768px) {
    .col-md-2 {
        width: 16.666667%;
    }

    .col-md-3 {
        width: 25%;
    }

    .col-md-4 {
        width: 33.333333%;
    }

    .col-md-6 {
        width: 50%;
    }
}

@media (max-width: 680px) {

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-tile strong {
        font-size: 1.35rem;
    }
}

/* Custom Table styling matching Premium Dark theme */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--ink) !important;
    color: var(--ink) !important;
}

.table th, .table td {
    background-color: transparent !important;
    color: var(--ink) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.table tbody tr {
    background-color: rgba(15, 23, 42, 0.25) !important;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

.table thead th {
    background-color: rgba(30, 41, 59, 0.8) !important;
    color: var(--muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.text-muted {
    color: var(--muted) !important;
}

/* Premium Mobile/Smartphone Layout Optimizations */
@media (max-width: 768px) {
    .panel-block {
        padding: 12px !important;
        border-radius: 8px !important;
    }
}

@media (max-width: 576px) {
    .modal {
        padding: 8px !important;
    }
    .modal-dialog {
        margin: 8px !important;
    }
    .modal-body {
        padding: 12px !important;
    }
    .modal-header, .modal-footer {
        padding: 10px 12px !important;
    }
    .btn-create-camera {
        height: 34px !important;
        padding: 4px 10px !important;
        font-size: 0.85rem !important;
    }
    
    /* DVR Timeline Panel Responsive scaling */
    .camera-recording-panel {
        padding: 12px !important;
        border-radius: 8px !important;
    }
    .recording-panel-top {
        gap: 8px !important;
        margin-bottom: 10px !important;
    }
    .recording-controls {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 6px !important;
    }
    .recording-select, .recording-btn {
        flex: 1;
        height: 32px !important;
        font-size: 0.75rem !important;
        padding: 0 8px !important;
    }
    .dvr-current-row {
        margin: 8px 0 12px !important;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }
    .dvr-current-row span:first-child {
        font-size: 0.95rem !important;
    }
}

@media (max-width: 960px) {

    .live-stage .live-wall[data-layout="1"] {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto !important;
    }

    .live-stage .live-wall[data-layout="4"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: repeat(2, auto) !important;
    }

    .live-slot {
        aspect-ratio: 16 / 9;
    }
}

.mobile-live-mosaic {
    display: none;
}

@media (max-width: 960px) {
    .live-workspace {
        display: block;
    }

    .live-workspace > .live-camera-sidebar,
    .live-workspace > .live-stage {
        display: none;
    }

    .mobile-live-mosaic {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        gap: 0;
        /* The wall claims the viewport between the header and the action bar so
           the mosaic never leaves dead space below the last camera. */
        height: calc(100svh - 58px);
        margin-right: -8px;
        margin-left: -8px;
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        overflow: hidden;
    }

    .mobile-mosaic-header {
        position: fixed;
        z-index: 1050;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-height: calc(58px + env(safe-area-inset-bottom, 0px));
        padding:
            9px
            max(16px, calc(10px + env(safe-area-inset-right, 0px)))
            calc(9px + env(safe-area-inset-bottom, 0px))
            max(16px, calc(10px + env(safe-area-inset-left, 0px)));
        border: 1px solid rgba(255, 255, 255, .08);
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 0;
        background: rgba(8, 17, 31, .96);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, .28);
        backdrop-filter: blur(12px);
    }

    .mobile-mosaic-current {
        display: grid;
        flex: 1;
        gap: 2px;
        min-width: 0;
        text-align: left;
    }

    .mobile-mosaic-current strong {
        overflow: hidden;
        color: #dce6f3;
        font-size: .8rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-mosaic-current small {
        color: #64748b;
        font-size: .62rem;
    }

    .mobile-mosaic-actions {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-grid-layouts {
        display: flex;
        gap: 2px;
        padding: 2px;
        border: 1px solid rgba(255, 255, 255, .08);
        border-radius: 7px;
        background: rgba(2, 8, 18, .6);
    }

    .mobile-grid-layout-button,
    .mobile-grid-manager {
        display: inline-grid;
        flex: 0 0 auto;
        place-items: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 5px;
        color: #94a3b8;
        background: #0d1929;
    }

    .mobile-grid-layout-button {
        width: 30px;
        height: 30px;
        border-color: transparent;
        background: transparent;
    }

    .mobile-grid-layout-button:active,
    .mobile-grid-layout-button[aria-pressed="true"] {
        border-color: rgba(56, 189, 248, .35);
        color: #7dd3fc;
        background: rgba(14, 165, 233, .13);
        box-shadow: 0 0 0 1px rgba(56, 189, 248, .04) inset;
    }

    .mobile-grid-manager:active,
    .mobile-grid-manager[aria-pressed="true"] {
        border-color: #38bdf8;
        color: #7dd3fc;
    }

    .mobile-grid-layout-button svg,
    .mobile-grid-manager svg {
        width: 16px;
        height: 16px;
    }

    .mobile-mosaic-grid {
        display: flex;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        background: #000;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        touch-action: pan-x;
    }

    .mobile-mosaic-grid::-webkit-scrollbar {
        display: none;
    }

    .mobile-camera-card {
        position: relative;
        display: block;
        flex: 0 0 100%;
        min-width: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        background: #000;
        color: #dce6f3;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .mobile-camera-card:active {
        outline: 1px solid #38bdf8;
        outline-offset: -1px;
        background: #06111e;
    }

    .mobile-camera-preview {
        position: relative;
        display: block;
        aspect-ratio: 16 / 9;
        overflow: hidden;
        background: #03070d;
    }

    .mobile-camera-loading {
        position: absolute;
        z-index: 0;
        inset: 0;
        display: grid;
        place-content: center;
        justify-items: center;
        gap: 7px;
        color: #64748b;
        background:
            radial-gradient(circle at 50% 42%, rgba(30, 64, 94, .28), transparent 42%),
            #03070d;
        transition: opacity .18s ease, visibility .18s ease;
    }

    .mobile-camera-loading svg {
        width: 20px;
        height: 20px;
        animation: mobile-camera-loading-spin 1.1s linear infinite;
    }

    .mobile-camera-loading small {
        font-size: .6rem;
        font-weight: 650;
        letter-spacing: .02em;
    }

    .mobile-camera-preview.has-image .mobile-camera-loading {
        visibility: hidden;
        opacity: 0;
    }

    .mobile-camera-preview img {
        position: relative;
        z-index: 1;
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0;
        transition: opacity .18s ease;
    }

    .mobile-camera-preview img.is-loaded {
        opacity: 1;
    }

    .mobile-camera-overlay {
        position: absolute;
        z-index: 2;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 12px;
        padding: 28px 14px 12px;
        background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .82));
        pointer-events: none;
    }

    .mobile-camera-copy {
        display: grid;
        gap: 2px;
        min-width: 0;
    }

    .mobile-camera-copy strong {
        overflow: hidden;
        color: #fff;
        font-size: .92rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-camera-copy small {
        color: #cbd5e1;
        font-size: .68rem;
    }

    .mobile-camera-open {
        display: inline-grid;
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, .24);
        border-radius: 6px;
        background: rgba(8, 17, 31, .72);
        color: #f8fafc;
    }

    .mobile-camera-open svg {
        width: 15px;
        height: 15px;
    }

    .mobile-camera-offline {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        color: #475569;
        background: #03070d;
    }

    .mobile-camera-offline svg {
        width: 24px;
        height: 24px;
    }

    @keyframes mobile-camera-loading-spin {
        to { transform: rotate(360deg); }
    }

    .mobile-mosaic-empty {
        display: grid;
        place-content: center;
        justify-items: center;
        gap: 8px;
        min-height: 52vh;
        color: #64748b;
    }

    .mobile-live-mosaic .mobile-mosaic-grid {
        display: grid;
        grid-auto-rows: min-content;
        /* The wall starts right under the header; tiles keep the camera framing
           so any leftover height falls below the last row. */
        align-content: start;
        gap: 2px;
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        background: #05090f;
        scroll-snap-type: none;
    }

    .mobile-live-mosaic.mobile-grid-columns-1 .mobile-mosaic-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .mobile-live-mosaic.mobile-grid-columns-2 .mobile-mosaic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-live-mosaic.mobile-grid-columns-3 .mobile-mosaic-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Reached in landscape only, where the extra width keeps tiles legible. */
    .mobile-live-mosaic.mobile-grid-columns-4 .mobile-mosaic-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1px;
    }

    .mobile-live-mosaic .mobile-camera-card {
        display: block;
        width: auto;
        flex: none;
    }

    .mobile-live-mosaic .mobile-camera-card:not(.is-mobile-selected) {
        display: none;
    }

    .mobile-live-mosaic.mobile-grid-columns-2.has-odd-selection .mobile-camera-card.is-mobile-last {
        grid-column: 1 / -1;
    }

    .mobile-live-mosaic .mobile-camera-overlay {
        display: none;
    }

    .mobile-live-mosaic .mobile-camera-copy strong {
        font-size: .72rem;
    }

    .mobile-live-mosaic .mobile-camera-copy small,
    .mobile-live-mosaic .mobile-camera-open {
        display: none;
    }
}

@media (min-width: 600px) and (max-width: 960px) and (orientation: landscape) {
    .mobile-camera-preview {
        max-height: calc(100dvh - 116px);
    }

    .mobile-live-mosaic[data-mobile-grid-mode="auto"] .mobile-mosaic-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.mobile-camera-picker-dialog {
    width: min(92vw, 460px);
    max-height: min(82dvh, 720px);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: #08111f;
    color: #dce6f3;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .58);
}

.mobile-camera-picker-dialog::backdrop {
    background: rgba(2, 6, 15, .76);
    backdrop-filter: blur(4px);
}

.mobile-camera-picker-dialog[open] {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.mobile-camera-picker-dialog > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.mobile-camera-picker-dialog > header span {
    color: #38bdf8;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mobile-camera-picker-dialog > header h2 {
    margin: 2px 0 0;
    font-size: 1rem;
}

.mobile-camera-picker-dialog > header button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 6px;
    background: #0d1929;
    color: #94a3b8;
}

.mobile-camera-picker-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 8px;
    padding: 12px 14px 8px;
}

.mobile-camera-picker-tools label {
    position: relative;
}

.mobile-camera-picker-tools label svg {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 15px;
    transform: translateY(-50%);
    color: #64748b;
}

.mobile-camera-picker-tools input,
.mobile-camera-picker-tools select {
    width: 100%;
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 6px;
    background: #0d1929;
    color: #dce6f3;
    font-size: .72rem;
}

.mobile-camera-picker-tools input {
    padding: 7px 9px 7px 32px;
}

.mobile-camera-picker-tools select {
    padding: 7px 8px;
}

.mobile-camera-picker-summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 14px 10px;
    color: #64748b;
    font-size: .65rem;
}

.mobile-camera-picker-summary strong {
    color: #7dd3fc;
}

.mobile-camera-picker-list {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 4px 10px 10px;
    overflow-y: auto;
}

.mobile-camera-picker-list label {
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #0d1929;
}

.mobile-camera-picker-list label:has(input:checked) {
    border-color: rgba(56, 189, 248, .3);
    background: rgba(56, 189, 248, .08);
}

.mobile-camera-picker-list label[hidden] {
    display: none;
}

.mobile-camera-picker-list label > span:nth-child(2) {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.mobile-camera-picker-list strong,
.mobile-camera-picker-list small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-camera-picker-list strong {
    font-size: .75rem;
}

.mobile-camera-picker-list small {
    color: #64748b;
    font-size: .63rem;
}

.mobile-camera-picker-state {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.mobile-camera-picker-state.status-online,
.mobile-camera-picker-state.status-gravando {
    background: #22c55e;
}

.mobile-camera-picker-state.status-sem_video {
    background: #f59e0b;
}

.mobile-camera-picker-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #38bdf8;
}

.mobile-camera-picker-dialog > footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, .08);
}

@media (max-width: 480px) {
    .mobile-camera-picker-dialog {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 24px);
    }

    .mobile-camera-picker-tools {
        grid-template-columns: 1fr;
    }
}

/* Compact VMS composition for desktop live monitoring. */
@media (min-width: 761px) {
    .live-workspace {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 8px;
    }

    .live-camera-sidebar,
    .live-stage {
        border-radius: 4px;
    }

    .live-sidebar-header {
        min-height: 56px;
        padding: 10px 12px;
    }

    .live-camera-list {
        gap: 2px;
        padding: 6px;
    }

    .live-camera-option {
        grid-template-columns: 30px minmax(0, 1fr) 8px;
        min-height: 46px;
        padding: 6px 7px;
    }

    .live-camera-icon {
        width: 30px;
        height: 30px;
    }

    .live-stage .live-toolbar {
        min-height: 46px;
    }

    .live-stage .live-wall {
        gap: 4px;
        padding: 4px;
    }

    .live-stage .live-layout-controls {
        opacity: .72;
        transition: opacity .16s ease;
    }

    .live-stage:hover .live-layout-controls,
    .live-stage:focus-within .live-layout-controls {
        opacity: 1;
    }

    .live-stage .live-slot.is-selected {
        box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .72);
    }
}
