/**
 * BodyCam NVR — Dark Surveillance Theme
 */

/* ============================================================================
   Design Tokens
   ============================================================================ */
:root {
    /* Redwood dark neutral palette (warm grays, not cold blue-navy) */
    --nvr-bg: #161616;
    --nvr-surface: #1e1e1e;
    --nvr-surface-2: #252525;
    --nvr-surface-3: #2d2d2d;
    --nvr-border: #3c3c3c;
    --nvr-border-light: #4a4a4a;
    --nvr-text: #e0e0e0;
    --nvr-text-muted: #a8a8a8;
    --nvr-text-dim: #6b6b6b;
    --nvr-recording: #8ab4f8;
    --nvr-upload: #fdd663;
    --nvr-live: #81c995;
    --nvr-live-glow: rgba(129, 201, 149, 0.3);
    --nvr-alert: #f28b82;
    --nvr-alert-glow: rgba(242, 139, 130, 0.3);
    --nvr-marker: #fdd663;
    --nvr-playhead: #f28b82;
    --nvr-clip: #b39ddb;
    --nvr-accent: #8ab4f8;
    --nvr-accent-hover: #aecbfa;
    --nvr-font: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --nvr-font-mono: 'IBM Plex Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --nvr-sidebar-w: 310px;
    --nvr-topbar-h: 48px;
    --nvr-radius: 8px;
    --nvr-radius-sm: 4px;
    --nvr-radius-lg: 12px;
    --nvr-transition: 150ms ease;
    --nvr-transition-panel: 250ms ease;

    /* Redwood semantic colors */
    --nvr-primary-light: #1a3a5c;
    --nvr-danger: #f28b82;
    --nvr-danger-light: #3d2020;
    --nvr-success: #81c995;
    --nvr-success-light: #1e3a2a;
    --nvr-warning: #fdd663;
    --nvr-warning-light: #3d3520;
    --nvr-info: #8ab4f8;
    --nvr-neutral: #6b6b6b;

    /* Shadows */
    --nvr-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --nvr-shadow-md: 0 2px 6px 2px rgba(0, 0, 0, 0.4);
    --nvr-shadow-lg: 0 4px 12px 4px rgba(0, 0, 0, 0.5);

    /* Glow intensity scale */
    --nvr-glow-sm: 0 0 8px rgba(138, 180, 248, 0.1);
    --nvr-glow-md: 0 0 16px rgba(138, 180, 248, 0.18);
    --nvr-glow-lg: 0 0 28px rgba(138, 180, 248, 0.28);

    /* Z-index scale */
    --nvr-z-base: 1;
    --nvr-z-overlay: 10;
    --nvr-z-sidebar: 100;
    --nvr-z-sticky: 150;
    --nvr-z-fixed: 200;
    --nvr-z-tooltip: 250;
    --nvr-z-kbd: 500;
    --nvr-z-modal: 1000;
    --nvr-z-toast: 2000;
    --nvr-z-dialog: 2500;
    --nvr-z-ctx-menu: 3000;
    --nvr-z-cmd-palette: 6000;
    --nvr-z-top: 9999;
}

/* ============================================================================
   Item 27: Light Theme Overrides
   ============================================================================ */
[data-theme="light"] {
    --nvr-bg: #f5f5f5;
    --nvr-surface: #ffffff;
    --nvr-surface-2: #f0f0f0;
    --nvr-surface-3: #e5e5e5;
    --nvr-border: #d4d4d4;
    --nvr-border-light: #c0c0c0;
    --nvr-text: #1a1a1a;
    --nvr-text-muted: #666666;
    --nvr-text-dim: #999999;
    --nvr-recording: #2563eb;
    --nvr-upload: #d97706;
    --nvr-live: #16a34a;
    --nvr-live-glow: rgba(22, 163, 74, 0.3);
    --nvr-alert: #dc2626;
    --nvr-alert-glow: rgba(220, 38, 38, 0.3);
    --nvr-marker: #d97706;
    --nvr-playhead: #dc2626;
    --nvr-clip: #7c3aed;
    --nvr-accent: #2563eb;
    --nvr-accent-hover: #1d4ed8;
    --nvr-primary-light: #dbeafe;
    --nvr-danger: #dc2626;
    --nvr-danger-light: #fee2e2;
    --nvr-success: #16a34a;
    --nvr-success-light: #dcfce7;
    --nvr-warning: #d97706;
    --nvr-warning-light: #fef3c7;
    --nvr-info: #2563eb;
    --nvr-neutral: #999999;
    --nvr-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --nvr-shadow-md: 0 2px 6px 2px rgba(0, 0, 0, 0.08);
    --nvr-shadow-lg: 0 4px 12px 4px rgba(0, 0, 0, 0.1);
    --nvr-glow-sm: 0 0 8px rgba(37, 99, 235, 0.15);
    --nvr-glow-md: 0 0 16px rgba(37, 99, 235, 0.22);
    --nvr-glow-lg: 0 0 28px rgba(37, 99, 235, 0.30);
}
/* Light theme: hide scanlines, soften sidebar */
[data-theme="light"] .nvr-scanlines { display: none; }
[data-theme="light"] .nvr-sidebar { background: #ffffff; border-right-color: #d4d4d4; }
[data-theme="light"] .nvr-topbar { background: #ffffff; border-bottom-color: #d4d4d4; }
[data-theme="light"] .nvr-nav-item:hover { background: rgba(0, 0, 0, 0.04); }
[data-theme="light"] .nvr-nav-item.active { background: rgba(37, 99, 235, 0.08); color: #2563eb; }
[data-theme="light"] .nvr-stat-card { background: #ffffff; border-color: #d4d4d4; }
[data-theme="light"] .nvr-login-overlay { background: rgba(255,255,255,0.9); }
[data-theme="light"] .nvr-login-card { background: #ffffff; border-color: #d4d4d4; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c0c0c0; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #999; }
[data-theme="light"] .scifi-modal { background: #ffffff; border-color: #d4d4d4; color: #1a1a1a; }
[data-theme="light"] .scifi-modal-overlay { background: rgba(0,0,0,0.3); }
[data-theme="light"] .nvr-tl-tooltip { background: #ffffff; border-color: #d4d4d4; color: #1a1a1a; }

/* ============================================================================
   Reset & Base
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--nvr-bg);
    color: var(--nvr-text);
    font-family: var(--nvr-font);
    font-size: 18px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--nvr-border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--nvr-text-dim); }

/* ============================================================================
   App Layout
   ============================================================================ */
.nvr-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ============================================================================
   Sidebar
   ============================================================================ */
.nvr-sidebar {
    width: var(--nvr-sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
    border-right: 1px solid var(--nvr-border);
    transition: width var(--nvr-transition-panel), transform var(--nvr-transition-panel);
    overflow: hidden;
    z-index: var(--nvr-z-sidebar);
}

.nvr-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.nvr-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--nvr-text);
}

.nvr-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--nvr-radius);
    flex-shrink: 0;
}

.nvr-logo-text {
    font-weight: 600;
    font-size: 17px;
    color: var(--nvr-text);
    white-space: nowrap;
}

.nvr-logo-subtitle {
    font-size: 14px;
    color: var(--nvr-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nav Items */
.nvr-sidebar-nav {
    padding: 8px;
    flex-shrink: 0;
}

.nvr-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-left: 3px solid transparent;
    color: var(--nvr-text-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--nvr-transition);
    white-space: nowrap;
    user-select: none;
}

.nvr-nav-item:hover {
    color: var(--nvr-text);
    background: var(--nvr-surface-2);
}

.nvr-nav-item.active {
    color: var(--nvr-text);
    background: var(--nvr-primary-light);
    border-left-color: var(--nvr-accent);
}

.nvr-nav-item.active svg { color: var(--nvr-accent); }

/* Badge */
.nvr-badge {
    margin-left: auto;
    background: var(--nvr-live);
    color: #000;
    font-size: 14px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.nvr-badge-danger { background: var(--nvr-danger-light); color: var(--nvr-danger); }
.nvr-badge-warning { background: var(--nvr-warning-light); color: var(--nvr-marker); }
.nvr-badge-info { background: var(--nvr-primary-light); color: var(--nvr-accent); }

/* tabular-nums for numeric displays */
.nvr-stat-value, .nvr-badge, .nvr-device-meta, .nvr-tl-axis-tick { font-variant-numeric: tabular-nums; }

/* Sidebar Sections */
.nvr-sidebar-section-label {
    padding: 16px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--nvr-text-dim);
    flex-shrink: 0;
}

/* Device Filter */
.nvr-device-filter-wrap {
    padding: 0 8px 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.nvr-btn-reset-order {
    background: none;
    border: 1px solid transparent;
    color: var(--nvr-text-dim, #555);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 150ms, color 150ms;
    flex-shrink: 0;
}
.nvr-btn-reset-order:hover { opacity: 1; color: var(--nvr-accent); }
.nvr-device-filter {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    background: var(--nvr-surface-2, #2a2a2e);
    border: 1px solid var(--nvr-border, #3a3a3e);
    border-radius: 6px;
    color: var(--nvr-text, #e0e0e0);
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
}
.nvr-device-filter:focus {
    border-color: var(--nvr-text-muted, #999);
}
.nvr-device-filter::placeholder {
    color: var(--nvr-text-dim, #666);
}

/* Device List */
.nvr-device-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

.nvr-device-list-empty {
    padding: 16px 12px;
    color: var(--nvr-text-dim);
    font-size: 15px;
    text-align: center;
}

.nvr-device-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--nvr-radius-sm);
    cursor: pointer;
    transition: all var(--nvr-transition);
    font-size: 15px;
    white-space: nowrap;
}

.nvr-device-item:hover { background: var(--nvr-surface-2); }
.nvr-device-item.selected { background: var(--nvr-surface-3); }

/* Drag-to-reorder */
.nvr-device-drag-handle {
    cursor: grab;
    color: var(--nvr-text-dim, #555);
    font-size: 14px;
    letter-spacing: -2px;
    user-select: none;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 150ms;
    line-height: 1;
    padding: 0 2px;
}
.nvr-device-draggable:hover .nvr-device-drag-handle { opacity: 0.6; }
.nvr-device-drag-handle:hover { opacity: 1 !important; color: var(--nvr-accent); }
.nvr-device-dragging {
    opacity: 0.4;
    background: var(--nvr-surface-2);
}
.nvr-device-drag-placeholder {
    height: 2px;
    background: var(--nvr-accent, #6366f1);
    border-radius: 1px;
    margin: 2px 10px;
    box-shadow: 0 0 6px var(--nvr-accent, #6366f1);
}

.nvr-device-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nvr-text-dim);
    flex-shrink: 0;
}

.nvr-device-dot.live {
    background: var(--nvr-live);
    box-shadow: 0 0 6px var(--nvr-live-glow);
    animation: nvr-pulse 2s ease-in-out infinite;
}

@keyframes nvr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nvr-device-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--nvr-text);
}

.nvr-device-label {
    color: var(--nvr-text-dim);
    font-size: 14px;
}

.nvr-device-count {
    color: var(--nvr-text-dim);
    font-size: 14px;
    font-family: var(--nvr-font-mono);
}

/* Device Type Icon (inline SVG in sidebar items + cards) */
.nvr-device-type-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}
.nvr-device-type-icon svg { width: 14px; height: 14px; }

/* Category Group Headers (sidebar) */
.nvr-category-group { margin-bottom: 2px; }
.nvr-category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 4px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--nvr-text-dim);
    transition: color var(--nvr-transition);
}
.nvr-category-header:hover { color: var(--nvr-text-muted); }
.nvr-category-chevron {
    transition: transform 150ms ease;
    flex-shrink: 0;
    opacity: 0.5;
}
.nvr-category-group.collapsed .nvr-category-chevron { transform: rotate(-90deg); }
.nvr-category-group.collapsed .nvr-category-devices { display: none; }
.nvr-category-label { flex: 1; min-width: 0; }
.nvr-category-count {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-dim);
    opacity: 0.6;
}
.nvr-category-live-count {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 3px;
    background: rgba(129, 201, 149, 0.15);
    color: var(--nvr-live);
}

/* Overview Category Section Header */
.nvr-category-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--nvr-border);
}
.nvr-category-section-header:first-child { margin-top: 0; }
.nvr-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}
.nvr-category-badge svg { width: 12px; height: 12px; }
.nvr-category-device-count {
    font-size: 14px;
    color: var(--nvr-text-muted);
    margin-left: auto;
}

/* Device card type badge */
.nvr-card-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--nvr-surface-2);
    color: var(--nvr-text-muted);
    margin-top: 4px;
}
.nvr-card-type-badge svg { width: 10px; height: 10px; }

/* Sidebar Footer */
.nvr-sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nvr-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--nvr-surface-3);
    color: var(--nvr-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.nvr-user-name {
    flex: 1;
    font-size: 15px;
    color: var(--nvr-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   Main Content
   ============================================================================ */
.nvr-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Top Bar */
.nvr-topbar {
    height: var(--nvr-topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--nvr-surface);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-topbar-title {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.nvr-topbar-status {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.nvr-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--nvr-text-muted);
}

.nvr-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--nvr-text-dim);
}

.nvr-status-dot.connected {
    background: var(--nvr-live);
    box-shadow: 0 0 6px var(--nvr-live-glow);
}

.nvr-clock {
    font-family: var(--nvr-font-mono);
    font-size: 15px;
    color: var(--nvr-text-muted);
    letter-spacing: 0.5px;
}

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

.nvr-portal-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 280px;
    background: var(--nvr-surface-2, #2a2a2e);
    border: 1px solid var(--nvr-border, #3a3a3e);
    border-radius: var(--nvr-radius, 8px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
    padding: 4px 0;
}
.nvr-portal-menu.show { display: block; }
.nvr-portal-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--nvr-text-muted, #999);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}
.nvr-portal-menu a:hover {
    background: var(--nvr-surface-3, #3a3a3e);
    color: var(--nvr-text, #e0e0e0);
}

/* View Container */
.nvr-view-container {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

/* ============================================================================
   Buttons
   ============================================================================ */
.nvr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    background: var(--nvr-surface-2);
    color: var(--nvr-text);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--nvr-transition);
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.nvr-btn:hover { background: var(--nvr-surface-3); border-color: var(--nvr-border-light); }
.nvr-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nvr-btn-primary {
    background: var(--nvr-accent);
    border-color: var(--nvr-accent);
    color: #fff;
}

.nvr-btn-primary:hover { background: var(--nvr-accent-hover); }
.nvr-btn:active:not(:disabled) { transform: scale(0.97); }
.nvr-btn-primary:active:not(:disabled) { box-shadow: 0 0 12px rgba(138, 180, 248, 0.3); }

.nvr-btn-danger {
    background: var(--nvr-danger);
    border-color: var(--nvr-danger);
    color: #fff;
}

.nvr-btn-danger:hover { background: #e04a3f; }

.nvr-btn-success {
    background: var(--nvr-success);
    border-color: var(--nvr-success);
    color: #fff;
}

.nvr-btn-success:hover { opacity: 0.85; }

.nvr-btn-warning {
    background: var(--nvr-warning);
    border-color: var(--nvr-warning);
    color: #000;
}

.nvr-btn-warning:hover { opacity: 0.85; }

.nvr-btn-secondary {
    background: var(--nvr-surface-2);
    border-color: var(--nvr-border-light);
    color: var(--nvr-text);
}

.nvr-btn-secondary:hover { background: var(--nvr-surface-3); border-color: var(--nvr-text-dim); }

.nvr-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--nvr-text-muted);
}

.nvr-btn-ghost:hover { color: var(--nvr-text); background: var(--nvr-surface-2); }

.nvr-btn-lg { padding: 12px 24px; font-size: 16px; }
.nvr-btn-sm { padding: 5px 10px; font-size: 14px; }

.nvr-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--nvr-radius-sm);
    background: transparent;
    color: var(--nvr-text-muted);
    cursor: pointer;
    transition: all var(--nvr-transition);
}

.nvr-btn-icon:hover { background: var(--nvr-surface-2); color: var(--nvr-text); }

/* ============================================================================
   Device Overview — Card Grid
   ============================================================================ */
.nvr-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.nvr-device-card {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--nvr-transition);
    box-shadow: var(--nvr-shadow-sm);
}

.nvr-device-card:hover {
    border-color: var(--nvr-border-light);
    transform: translateY(-1px);
    box-shadow: var(--nvr-shadow-md);
}

.nvr-device-card.live { border-color: var(--nvr-live); }

.nvr-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.nvr-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nvr-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-card-thumb-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.3;
}

.nvr-card-live-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(22, 163, 74, 0.9);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.nvr-card-live-badge .nvr-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: nvr-pulse 1.5s ease-in-out infinite;
}

.nvr-card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
}

.nvr-card-body {
    padding: 10px 12px;
}

.nvr-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nvr-card-device-id {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-dim);
}

.nvr-card-meta {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: var(--nvr-text-muted);
}

.nvr-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================================
   Stats Row
   ============================================================================ */
.nvr-stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.nvr-stat-card {
    flex: 1;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    padding: 16px 20px;
    box-shadow: var(--nvr-shadow-sm);
}

.nvr-stat-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    margin-bottom: 4px;
}

.nvr-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--nvr-text);
    font-family: var(--nvr-font-mono);
}

.nvr-stat-value.live { color: var(--nvr-live); }
.nvr-stat-value.alert { color: var(--nvr-alert); }
.nvr-stat-unit {
    font-size: 15px;
    font-weight: 500;
    color: var(--nvr-text-muted);
    margin-left: 2px;
}

/* ============================================================================
   Archive Storage Card
   ============================================================================ */
.nvr-archive-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--nvr-shadow-sm);
}
.nvr-archive-card.nvr-archive-active {
    border-color: var(--nvr-accent);
}
.nvr-archive-card.nvr-archive-disabled {
    border-style: dashed;
    border-color: var(--nvr-border-light);
}
.nvr-archive-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nvr-surface-2);
    border-radius: var(--nvr-radius);
    color: var(--nvr-accent);
}
.nvr-archive-body {
    flex: 1;
    min-width: 0;
}
.nvr-archive-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--nvr-text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nvr-archive-connected-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nvr-live);
    box-shadow: 0 0 6px var(--nvr-live-glow);
    flex-shrink: 0;
}
.nvr-archive-desc {
    font-size: 15px;
    color: var(--nvr-text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}
.nvr-archive-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 15px;
    color: var(--nvr-text-muted);
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.nvr-archive-meta strong {
    color: var(--nvr-text);
    font-weight: 600;
}
.nvr-archive-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.nvr-archive-input {
    width: 60px;
    padding: 5px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    font-size: 15px;
    font-family: var(--nvr-font-mono);
    text-align: center;
    outline: none;
}
.nvr-archive-input:focus {
    border-color: var(--nvr-accent);
    box-shadow: 0 0 0 2px var(--nvr-primary-light);
}
.nvr-archive-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.nvr-archive-status {
    display: flex;
    align-items: center;
}
.nvr-archive-badge {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}
.nvr-archive-badge-indigo {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}
.nvr-archive-badge-purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c4b5fd;
}
.nvr-archive-badge-disabled {
    background: var(--nvr-surface-3);
    color: var(--nvr-text-dim);
}

/* ============================================================================
   Archive Browser
   ============================================================================ */
.nvr-archive-browser {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nvr-archive-device-group {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    overflow: hidden;
    box-shadow: var(--nvr-shadow-sm);
}
.nvr-archive-device-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--nvr-surface-2);
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--nvr-border);
    transition: background var(--nvr-transition);
}
.nvr-archive-device-header:hover {
    background: var(--nvr-surface-3);
}
.nvr-archive-device-header .nvr-archive-badge {
    margin-left: auto;
}
.nvr-archive-device-entries {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nvr-archive-device-entries.expanded {
    max-height: 2000px;
}
.nvr-archive-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 15px;
    border-bottom: 1px solid rgba(60, 60, 60, 0.4);
    transition: background var(--nvr-transition);
}
.nvr-archive-entry:last-child { border-bottom: none; }
.nvr-archive-entry:hover { background: var(--nvr-surface-2); }
.nvr-archive-entry-info {
    flex: 1;
    min-width: 0;
}
.nvr-archive-entry-filename {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-archive-entry-time {
    font-size: 14px;
    color: var(--nvr-text-muted);
}
.nvr-archive-entry-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================================================
   Archive Player
   ============================================================================ */
.nvr-archive-player {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}
.nvr-archive-player-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
}
.nvr-archive-player-header .nvr-archive-badge {
    margin-left: 4px;
}
.nvr-archive-player-top {
    display: flex;
    gap: 1px;
    background: var(--nvr-border);
    border: 1px solid var(--nvr-border);
    border-top: none;
    border-radius: 0 0 var(--nvr-radius) var(--nvr-radius);
    overflow: hidden;
    flex: 1;
    min-height: 0;
}
.nvr-archive-player-video {
    flex: 1;
    min-width: 0;
    background: #000;
    display: flex;
    flex-direction: column;
}
.nvr-archive-player-video video {
    width: 100%;
    flex: 1;
    min-height: 300px;
    object-fit: contain;
    background: #000;
}
.nvr-archive-player-transcript {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
}
.nvr-archive-player-transcript-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}
.nvr-archive-player-transcript-lines {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    max-height: 400px;
}
.nvr-archive-player-transcript-line {
    padding: 3px 12px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--nvr-text);
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}
.nvr-archive-player-transcript-line.active {
    background: rgba(99, 102, 241, 0.1);
}
.nvr-archive-player-transcript-time {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: #a5b4fc;
    margin-right: 6px;
}

/* ============================================================================
   Legal Archive Card
   ============================================================================ */
.nvr-legal-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--nvr-shadow-sm);
}
.nvr-legal-card.nvr-legal-active {
    border-color: #f59e0b;
}
.nvr-legal-card.nvr-legal-disabled {
    border-style: dashed;
    border-color: var(--nvr-border-light);
}
.nvr-legal-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nvr-surface-2);
    border-radius: var(--nvr-radius);
    color: #f59e0b;
}
.nvr-legal-body {
    flex: 1;
    min-width: 0;
}
.nvr-legal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--nvr-text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nvr-legal-connected-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
    flex-shrink: 0;
}
.nvr-legal-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 15px;
    color: var(--nvr-text-muted);
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.nvr-legal-meta strong {
    color: var(--nvr-text);
    font-weight: 600;
}
.nvr-legal-desc {
    font-size: 15px;
    color: var(--nvr-text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}
.nvr-legal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.nvr-legal-badge {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}
.nvr-legal-badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.nvr-legal-badge-disabled {
    background: var(--nvr-surface-3);
    color: var(--nvr-text-dim);
}

/* Legal Archive Browser */
.nvr-legal-browser {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nvr-legal-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 15px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    transition: background var(--nvr-transition);
}
.nvr-legal-entry:hover { background: var(--nvr-surface-2); }
.nvr-legal-entry-info {
    flex: 1;
    min-width: 0;
}
.nvr-legal-entry-name {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-legal-entry-meta {
    font-size: 14px;
    color: var(--nvr-text-muted);
}
.nvr-legal-entry-size {
    flex-shrink: 0;
    font-size: 14px;
    font-family: var(--nvr-font-mono);
    color: var(--nvr-text-muted);
}

/* ============================================================================
   Operations Panel
   ============================================================================ */
.nvr-ops-panel {
    position: fixed;
    bottom: 0;
    left: var(--nvr-sidebar-w);
    width: 437px;
    max-height: 300px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-bottom: none;
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
    box-shadow: var(--nvr-shadow-lg);
    z-index: var(--nvr-z-sticky);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nvr-ops-panel.collapsed {
    max-height: 36px;
}
.nvr-ops-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
    cursor: pointer;
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
    user-select: none;
}
.nvr-ops-header:hover {
    background: var(--nvr-surface-2);
}
.nvr-ops-header .nvr-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
    flex-shrink: 0;
}
.nvr-ops-count {
    margin-left: auto;
    font-size: 14px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--nvr-accent);
    color: #fff;
}
.nvr-ops-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.nvr-ops-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(60, 60, 60, 0.4);
}
.nvr-ops-item:last-child { border-bottom: none; }
.nvr-ops-type {
    font-size: 13px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.nvr-ops-type.archive { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.nvr-ops-type.restore { background: rgba(34, 197, 94, 0.15); color: var(--nvr-live); }
.nvr-ops-type.delete { background: rgba(239, 68, 68, 0.15); color: var(--nvr-alert); }
.nvr-ops-filename {
    flex: 1;
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.nvr-ops-message {
    font-size: 14px;
    color: var(--nvr-text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}
.nvr-ops-status {
    font-size: 13px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}
.nvr-ops-status.running { background: rgba(59, 130, 246, 0.15); color: var(--nvr-accent); }
.nvr-ops-status.completed { background: rgba(34, 197, 94, 0.15); color: var(--nvr-live); }
.nvr-ops-status.failed { background: rgba(239, 68, 68, 0.15); color: var(--nvr-alert); }

@media (max-width: 768px) {
    .nvr-ops-panel {
        left: 0;
        width: 100%;
    }
}

/* ============================================================================
   Activity Feed
   ============================================================================ */
.nvr-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.nvr-section-title {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--nvr-text-muted);
}

.nvr-activity-list {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    overflow: hidden;
    box-shadow: var(--nvr-shadow-sm);
}

.nvr-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--nvr-border);
    font-size: 15px;
    transition: background var(--nvr-transition);
}

.nvr-activity-item:last-child { border-bottom: none; }
.nvr-activity-item:hover { background: var(--nvr-surface-2); }

.nvr-activity-time {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 65px;
}

.nvr-activity-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.nvr-activity-icon.recording { background: rgba(59, 130, 246, 0.15); color: var(--nvr-recording); }
.nvr-activity-icon.alert { background: rgba(239, 68, 68, 0.15); color: var(--nvr-alert); }
.nvr-activity-icon.marker { background: rgba(245, 158, 11, 0.15); color: var(--nvr-marker); }
.nvr-activity-icon.live { background: rgba(34, 197, 94, 0.15); color: var(--nvr-live); }
.nvr-activity-icon.upload { background: rgba(245, 158, 11, 0.15); color: var(--nvr-upload); }

.nvr-activity-text { flex: 1; color: var(--nvr-text); min-width: 0; }
.nvr-activity-device { color: var(--nvr-accent); font-weight: 600; }
.nvr-activity-detail { color: var(--nvr-text-muted); }

.nvr-activity-empty {
    padding: 24px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* ============================================================================
   Loading & Spinner
   ============================================================================ */
.nvr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.nvr-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--nvr-border);
    border-top-color: var(--nvr-accent);
    border-radius: 50%;
    animation: nvr-spin 0.8s linear infinite;
    will-change: transform;
}

@keyframes nvr-spin { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } } /* alias — used by inline styles in nvr.js */

/* ============================================================================
   Login Overlay
   ============================================================================ */
.nvr-login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nvr-bg);
    z-index: var(--nvr-z-modal);
}

.nvr-login-card {
    width: 100%;
    max-width: 500px;
    padding: 48px;
    background: rgba(10, 16, 24, 0.94);
    border: 1px solid rgba(0, 190, 255, 0.35);
    border-radius: 14px;
    box-shadow: 0 0 30px rgba(0, 170, 255, 0.18), inset 0 0 20px rgba(0, 130, 255, 0.06), 0 0 80px rgba(0, 60, 180, 0.04);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.nvr-login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.nvr-login-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--nvr-radius-lg);
    margin-bottom: 8px;
}

.nvr-login-logo-title {
    font-size: 22px;
    font-weight: 600;
    color: #d8f2ff;
}

.nvr-login-logo-subtitle {
    font-size: 14px;
    color: var(--nvr-accent);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.nvr-login-error {
    display: none;
    background: var(--nvr-danger-light);
    color: var(--nvr-alert);
    padding: 8px 16px;
    border-radius: var(--nvr-radius);
    font-size: 15px;
    margin-bottom: 16px;
}

.nvr-login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-login-divider::before,
.nvr-login-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid rgba(0, 190, 255, 0.12);
}

.nvr-form-group {
    margin-bottom: 20px;
}

.nvr-form-label {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 500;
    color: #8ea1bd;
    letter-spacing: 0.5px;
}

.nvr-login-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(12, 19, 28, 0.95);
    border: 1px solid rgba(0, 190, 255, 0.22);
    border-radius: 8px;
    color: #e3f2ff;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color var(--nvr-transition), box-shadow var(--nvr-transition);
}

.nvr-login-input:focus {
    border-color: rgba(0, 190, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 190, 255, 0.1), 0 0 12px rgba(0, 190, 255, 0.08);
}
.nvr-login-input::placeholder { color: #4a6080; }

/* NVR login — passkey button (orange accent) */
.nvr-login-card .nvr-btn-primary {
    background: rgba(255, 140, 30, 0.14);
    border: 1px solid rgba(255, 140, 30, 0.45);
    color: #ffc080;
}
.nvr-login-card .nvr-btn-primary:hover {
    background: rgba(255, 140, 30, 0.22);
    box-shadow: 0 0 20px rgba(255, 140, 30, 0.15);
}
/* NVR login — password button (cyan accent) */
.nvr-login-card .nvr-btn-secondary {
    background: rgba(0, 160, 255, 0.1);
    border: 1px solid rgba(0, 180, 255, 0.3);
    color: #b0d8ff;
}
.nvr-login-card .nvr-btn-secondary:hover {
    background: rgba(0, 160, 255, 0.18);
    border-color: rgba(0, 180, 255, 0.45);
    box-shadow: 0 0 15px rgba(0, 160, 255, 0.1);
}
/* Scanline overlay on NVR login card */
.nvr-login-card > .nvr-login-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,190,255,0.015) 2px, rgba(0,190,255,0.015) 4px);
    pointer-events: none;
    border-radius: 14px;
    z-index: 2;
}

/* ============================================================================
   Toast
   ============================================================================ */
.nvr-toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: var(--nvr-z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nvr-toast {
    padding: 10px 16px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-left: 4px solid var(--nvr-accent);
    border-radius: var(--nvr-radius);
    color: var(--nvr-text);
    font-size: 15px;
    box-shadow: var(--nvr-shadow-lg);
    animation: nvr-toast-in 0.2s ease-out;
    max-width: 360px;
}

.nvr-toast.error { border-left-color: var(--nvr-danger); }
.nvr-toast.success { border-left-color: var(--nvr-live); }
.nvr-toast.info { border-left-color: var(--nvr-accent); }
.nvr-toast.warning { border-left-color: var(--nvr-amber, #ffaa00); }

@keyframes nvr-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Timeline View
   ============================================================================ */
.nvr-tl {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

/* Top row: video + transcript */
.nvr-tl-top {
    display: flex;
    gap: 1px;
    background: var(--nvr-border);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
    overflow: hidden;
    min-height: 0;
    flex-shrink: 0;
}

.nvr-tl-video-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #000;
}

.nvr-tl-video-wrap .video-js,
.nvr-tl-video-wrap .video-js.vjs-redwood {
    width: 100%;
    height: 504px;
}
.nvr-tl-video-wrap video {
    width: 100%;
    height: 504px;
    background: #000;
    object-fit: contain;
}

.nvr-tl-video-placeholder {
    width: 100%;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* Transport bar under video */
.nvr-tl-transport {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--nvr-surface);
    border-top: 1px solid var(--nvr-border);
}

.nvr-tl-time {
    font-family: var(--nvr-font-mono);
    font-size: 15px;
    color: var(--nvr-text-muted);
    white-space: nowrap;
}

.nvr-tl-seg-info {
    font-size: 14px;
    color: var(--nvr-text-dim);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Transcript panel */
.nvr-tl-transcript {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
}

.nvr-tl-transcript-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-tl-transcript-lines {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    max-height: 200px;
}

.nvr-tl-transcript-line {
    padding: 3px 12px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--nvr-text);
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}

.nvr-tl-transcript-line.active {
    background: rgba(59, 130, 246, 0.08);
}

.nvr-tl-transcript-time {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-accent);
    margin-right: 6px;
}

.nvr-tl-transcript-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* Timeline bar area */
.nvr-tl-bar-section {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-top: none;
    padding: 8px 12px;
}

.nvr-tl-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.nvr-tl-controls .nvr-sep {
    width: 1px;
    height: 18px;
    background: var(--nvr-border);
    margin: 0 2px;
}

.nvr-tl-clip-range {
    font-size: 14px;
    color: var(--nvr-text-muted);
    font-family: var(--nvr-font-mono);
}

.nvr-tl-canvas-wrap {
    position: relative;
    height: 48px;
    cursor: pointer;
    user-select: none;
}

.nvr-tl-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.nvr-tl-axis {
    position: relative;
    height: 18px;
    margin-top: 2px;
}

.nvr-tl-axis-tick {
    position: absolute;
    top: 0;
    font-size: 14px;
    color: var(--nvr-text-dim);
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--nvr-font-mono);
}

.nvr-tl-tooltip {
    position: fixed;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    padding: 6px 10px;
    font-size: 14px;
    color: var(--nvr-text);
    pointer-events: none;
    z-index: var(--nvr-z-fixed);
    display: none;
    white-space: pre-line;
    font-family: var(--nvr-font-mono);
    max-width: 420px;
    line-height: 1.5;
}
.nvr-tl-tooltip .tt-time {
    color: var(--nvr-text-dim);
    font-size: 14px;
}
.nvr-tl-tooltip .tt-seg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    border-top: 1px solid var(--nvr-border);
    padding-top: 4px;
}
.nvr-tl-tooltip .tt-file {
    font-weight: 600;
    color: var(--nvr-accent);
    word-break: break-all;
}
.nvr-tl-tooltip .tt-row {
    display: block;
}
.nvr-tl-tooltip .tt-lbl {
    color: var(--nvr-text-muted);
    min-width: 60px;
    display: inline-block;
}
.nvr-tl-tooltip .tt-stage-active  { color: var(--nvr-success, #4caf50); }
.nvr-tl-tooltip .tt-stage-nearline { color: var(--nvr-warning, #ff9800); }
.nvr-tl-tooltip .tt-stage-archive  { color: var(--nvr-text-dim); }
.nvr-tl-tooltip .tt-stage-legal    { color: var(--nvr-danger, #f44336); font-weight: 600; }
/* Item 24: Thumbnail preview in tooltip */
.nvr-tl-tooltip .tt-thumb {
    display: block;
    max-width: 200px;
    max-height: 120px;
    border-radius: 3px;
    margin-bottom: 4px;
    object-fit: cover;
}

/* Timeline Legend */
.nvr-tl-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    font-size: 14px;
    color: var(--nvr-text-muted);
    flex-wrap: wrap;
}
.nvr-tl-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.nvr-tl-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.nvr-tl-legend-circle {
    border-radius: 50%;
    width: 8px;
    height: 8px;
}
.nvr-tl-legend-triangle {
    width: 0;
    height: 0;
    background: none !important;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid currentColor;
    border-radius: 0;
}
.nvr-tl-legend-line {
    width: 2px;
    height: 12px;
    border-radius: 1px;
}
.nvr-tl-legend-dash {
    width: 14px;
    height: 0;
    background: none !important;
    border-top: 2px dashed;
    border-radius: 0;
}

/* Timeline Loading Overlay */
.nvr-tl-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--nvr-surface, #141418);
    color: var(--nvr-text, #e0e0e0);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.02em;
    z-index: 2;
}
.nvr-tl-loading-overlay .nvr-spinner {
    width: 32px;
    height: 32px;
}

/* Bottom row: transcript + monitor + events */
.nvr-tl-bottom {
    display: flex;
    gap: 1px;
    background: var(--nvr-border);
    border: 1px solid var(--nvr-border);
    border-top: none;
    border-radius: 0 0 var(--nvr-radius) var(--nvr-radius);
    overflow: hidden;
    flex-shrink: 0;
}

.nvr-tl-map {
    flex: 1;
    min-width: 0;
    background: var(--nvr-surface);
    position: relative;
}

.nvr-tl-map-inner {
    width: 100%;
    height: 100%;
}

.nvr-tl-map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-tl-events {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
}

.nvr-tl-events-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-tl-events-list {
    flex: 1;
    overflow-y: auto;
    max-height: 188px;
}

.nvr-tl-event-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
    cursor: pointer;
    transition: background var(--nvr-transition);
}

.nvr-tl-event-item:hover { background: var(--nvr-surface-2); }

.nvr-tl-event-time {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 1px;
}

.nvr-tl-event-badge {
    font-size: 13px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.nvr-tl-event-badge.alert { background: rgba(239, 68, 68, 0.15); color: var(--nvr-alert); }
.nvr-tl-event-badge.marker { background: rgba(245, 158, 11, 0.15); color: var(--nvr-marker); }

/* Device Info Header (shown above video when device type is known) */
.nvr-tl-device-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--nvr-surface);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}
.nvr-tl-device-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.nvr-tl-device-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--nvr-text);
}
.nvr-tl-device-type-badge {
    font-size: 14px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Monitor Data Panel (sits between map and events in bottom row) */
.nvr-tl-monitor {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
    overflow: hidden;
}
.nvr-tl-monitor-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}
.nvr-tl-monitor-tabs {
    display: flex;
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}
.nvr-tl-monitor-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 14px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--nvr-text-dim);
    cursor: pointer;
    transition: color var(--nvr-transition), border-color var(--nvr-transition);
}
.nvr-tl-monitor-tab:hover { color: var(--nvr-text); }
.nvr-tl-monitor-tab.active {
    color: var(--nvr-text);
    border-bottom-color: var(--nvr-accent);
}
.nvr-tl-monitor-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Monitor Gauges Grid */
.nvr-tl-monitor-gauges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}
.nvr-tl-monitor-gauge {
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    padding: 6px 8px;
    text-align: center;
}
.nvr-tl-monitor-gauge-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--nvr-text-dim);
    margin-bottom: 2px;
}
.nvr-tl-monitor-gauge-value {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--nvr-font-mono);
    color: var(--nvr-text);
    line-height: 1.2;
}
.nvr-tl-monitor-gauge-unit {
    font-size: 11px;
    font-weight: 400;
    color: var(--nvr-text-dim);
    margin-left: 2px;
}

/* Monitor Recent Entries */
.nvr-tl-monitor-recent {
    margin-top: 8px;
}
.nvr-tl-monitor-recent-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--nvr-text-dim);
    padding: 4px 0;
    border-bottom: 1px solid var(--nvr-border);
    margin-bottom: 2px;
}
.nvr-tl-monitor-recent-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid rgba(60, 60, 60, 0.3);
}
.nvr-tl-monitor-recent-time {
    font-family: var(--nvr-font-mono);
    font-size: 11px;
    color: var(--nvr-text-dim);
    flex-shrink: 0;
}

.nvr-tl-event-text {
    flex: 1;
    color: var(--nvr-text);
    min-width: 0;
}

.nvr-tl-events-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* ============================================================================
   Multi-View
   ============================================================================ */
.nvr-mv {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.nvr-mv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
    flex-wrap: wrap;
}

.nvr-mv-device-picker {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nvr-mv-select {
    padding: 4px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    min-width: 180px;
}

.nvr-mv-select:focus {
    border-color: var(--nvr-accent);
    box-shadow: 0 0 0 3px var(--nvr-primary-light);
    outline: none;
}

.nvr-mv-layout-btns {
    display: flex;
    gap: 2px;
}

.nvr-mv-layout-btns .nvr-btn.active {
    background: var(--nvr-accent);
    color: #fff;
}

.nvr-mv-transport {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nvr-mv-time {
    font-family: var(--nvr-font-mono);
    font-size: 15px;
    color: var(--nvr-text-muted);
    white-space: nowrap;
}

.nvr-mv-speed {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.nvr-mv-speed .nvr-btn.active {
    background: var(--nvr-accent);
    color: #fff;
}

/* Middle: grid + map */
.nvr-mv-middle {
    display: flex;
    gap: 1px;
    background: var(--nvr-border);
    border: 1px solid var(--nvr-border);
    border-top: none;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Video grid */
.nvr-mv-grid {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
    background: var(--nvr-border);
}

.nvr-mv-grid[data-layout="1x1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.nvr-mv-grid[data-layout="1x2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.nvr-mv-grid[data-layout="2x1"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.nvr-mv-grid[data-layout="2x2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nvr-mv-grid[data-layout="3x3"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }

.nvr-mv-slot {
    background: #000;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color var(--nvr-transition);
}

.nvr-mv-slot video {
    flex: 1;
    width: 100%;
    min-height: 0;
    object-fit: contain;
    background: #000;
}

.nvr-mv-slot.nvr-mv-empty {
    background: var(--nvr-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: var(--nvr-border);
}

.nvr-mv-slot-placeholder {
    color: var(--nvr-text-dim);
    font-size: 16px;
}

.nvr-mv-slot-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.nvr-mv-slot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nvr-mv-slot-label {
    font-weight: 600;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nvr-mv-slot-info {
    font-size: 14px;
    color: var(--nvr-text-dim);
    margin-left: auto;
    white-space: nowrap;
}

.nvr-mv-slot-audio,
.nvr-mv-slot-remove {
    padding: 0 4px;
    font-size: 15px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--nvr-transition);
}

.nvr-mv-slot-audio:hover,
.nvr-mv-slot-remove:hover { opacity: 1; }

.nvr-mv-slot-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: var(--nvr-text-dim);
    font-size: 15px;
    z-index: 5;
}

/* Map panel */
.nvr-mv-map-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--nvr-surface);
}

.nvr-mv-map-inner {
    width: 100%;
    height: 100%;
}

.nvr-mv-map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* Timeline section */
.nvr-mv-timeline-section {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-top: none;
    border-radius: 0 0 var(--nvr-radius) var(--nvr-radius);
    padding: 6px 12px;
}

.nvr-mv-tl-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.nvr-mv-tl-canvas-wrap {
    position: relative;
    min-height: 48px;
    cursor: pointer;
    user-select: none;
}

.nvr-mv-tl-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.nvr-mv-tl-axis {
    position: relative;
    height: 18px;
    margin-top: 2px;
}

/* ============================================================================
   Live Monitor
   ============================================================================ */
.nvr-lm {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.nvr-lm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
}

.nvr-lm-status {
    font-size: 15px;
    color: var(--nvr-text-muted);
    font-weight: 500;
}

.nvr-lm-layout-btns {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.nvr-lm-layout-btns .nvr-btn.active {
    background: var(--nvr-accent);
    color: #fff;
}

.nvr-lm-body {
    display: flex;
    gap: 1px;
    background: var(--nvr-border);
    border: 1px solid var(--nvr-border);
    border-top: none;
    border-radius: 0 0 var(--nvr-radius) var(--nvr-radius);
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.nvr-lm-grid {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
    background: var(--nvr-border);
    grid-template-columns: 1fr;
}

.nvr-lm-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: var(--nvr-surface);
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-lm-slot {
    background: #000;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color var(--nvr-transition);
}

.nvr-lm-video-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
    background: #000;
}

.nvr-lm-slot video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.nvr-lm-slot-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.nvr-lm-slot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nvr-lm-slot-label {
    font-weight: 600;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nvr-lm-rec-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 14px;
    font-weight: 700;
    color: var(--nvr-alert);
    letter-spacing: 0.5px;
}

.nvr-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: nvr-pulse 1.5s ease-in-out infinite;
}

.nvr-lm-lt-switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    margin-left: 4px;
    cursor: pointer;
}
.nvr-lm-lt-switch input { opacity: 0; width: 0; height: 0; }
.nvr-lm-lt-slider {
    position: absolute;
    inset: 0;
    background: var(--nvr-border);
    border-radius: 8px;
    transition: background 0.2s;
}
.nvr-lm-lt-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.nvr-lm-lt-switch input:checked + .nvr-lm-lt-slider { background: var(--nvr-success); }
.nvr-lm-lt-switch input:checked + .nvr-lm-lt-slider::before { transform: translateX(12px); }

.nvr-lm-slot-tl-btn {
    margin-left: 4px;
}

.nvr-lm-pin-btn {
    padding: 2px 4px;
    color: var(--nvr-text-muted);
    transition: color 0.15s;
}
.nvr-lm-pin-btn.pinned {
    color: #f59e0b;
}

.nvr-lm-rec-timer {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-alert);
    margin-left: 2px;
}

.nvr-lm-slot-offline {
    opacity: 0.5;
}
.nvr-lm-slot-offline .nvr-lm-video-wrap video {
    filter: grayscale(1);
}

/* Video overlays: health (top-left), GPS (top-right), transcript (bottom) */
.nvr-lm-overlay-health {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: var(--nvr-radius-sm);
    font-family: var(--nvr-font-mono);
    font-size: 13px;
    color: var(--nvr-accent);
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
}

.nvr-lm-overlay-gps {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--nvr-radius-sm);
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: #fff;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
}

.nvr-lm-overlay-transcript {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    font-size: 15px;
    color: #fff;
    pointer-events: none;
    z-index: 5;
    line-height: 1.4;
    min-height: 32px;
}

.nvr-lm-overlay-ts {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-right: 4px;
}

/* Sidebar: map + info */
.nvr-lm-sidebar {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nvr-surface);
}

.nvr-lm-map-wrap {
    height: 300px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--nvr-border);
}

.nvr-lm-map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-lm-info-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 180px;
}

.nvr-lm-info-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}

.nvr-lm-info-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.nvr-lm-info-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

.nvr-lm-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 15px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}

.nvr-lm-info-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nvr-lm-info-name {
    flex: 1;
    color: var(--nvr-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nvr-lm-info-meta {
    font-size: 14px;
    color: var(--nvr-text-dim);
    white-space: nowrap;
}
.nvr-lm-info-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}
.nvr-lm-info-actions .nvr-btn {
    padding: 2px 6px;
    font-size: 13px;
}

/* Live Transcript Panel */
.nvr-lm-transcript-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid var(--nvr-border);
    min-height: 120px;
}
.nvr-lm-transcript-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
    border-bottom: 1px solid var(--nvr-border);
    flex-shrink: 0;
}
.nvr-lm-transcript-feed {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    font-size: 15px;
    line-height: 1.5;
}
.nvr-lm-transcript-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}
.nvr-lm-transcript-line {
    display: flex;
    gap: 6px;
    padding: 3px 10px;
    align-items: baseline;
}
.nvr-lm-transcript-line:hover {
    background: var(--nvr-surface-2);
}
.nvr-lm-transcript-ts {
    font-size: 14px;
    color: var(--nvr-text-dim);
    font-family: var(--nvr-font-mono);
    flex-shrink: 0;
    white-space: nowrap;
}
.nvr-lm-transcript-device {
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-lm-transcript-text {
    flex: 1;
    word-break: break-word;
}

/* Alert flash overlay on live video slot */
.nvr-lm-alert-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 40px;
    background: rgba(239, 68, 68, 0.18);
    animation: nvr-alert-pulse 0.6s ease-in-out 3;
    opacity: 0;
    animation-fill-mode: forwards;
}

.nvr-lm-alert-flash.show {
    opacity: 1;
}

.nvr-lm-alert-flash-text {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--nvr-radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Alert border flash on slot */
.nvr-lm-slot.nvr-lm-alert-border {
    animation: nvr-slot-border-flash 0.5s ease-in-out 4;
}
@keyframes nvr-slot-border-flash {
    0%, 100% { border-color: var(--nvr-border, #333); box-shadow: none; }
    50% { border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
}

@keyframes nvr-alert-pulse {
    0%, 100% { background: rgba(239, 68, 68, 0.08); }
    50% { background: rgba(239, 68, 68, 0.25); }
}

/* Alert count badge in info panel */
.nvr-lm-info-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--nvr-alert);
    font-size: 14px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* ============================================================================
   Placeholder
   ============================================================================ */
.nvr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--nvr-text-dim);
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
}

.nvr-placeholder svg { opacity: 0.3; width: 48px; height: 48px; }
.nvr-placeholder-text { font-size: 17px; font-weight: 500; color: var(--nvr-text-muted); }
.nvr-placeholder-sub { font-size: 15px; color: var(--nvr-text-dim); }

/* ============================================================================
   Menu toggle (mobile)
   ============================================================================ */
.nvr-menu-toggle { display: none; }

/* ============================================================================
   Keyboard Shortcut Hint
   ============================================================================ */
.nvr-kbd-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--nvr-radius-lg);
    z-index: var(--nvr-z-kbd);
    pointer-events: none;
    animation: nvr-kbd-fade 0.8s ease-out forwards;
}

@keyframes nvr-kbd-fade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 768px) {
    .nvr-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: var(--nvr-z-fixed);
        transform: translateX(0);
    }
    .nvr-sidebar.collapsed { transform: translateX(-100%); width: var(--nvr-sidebar-w); }
    .nvr-menu-toggle { display: inline-flex; }
    .nvr-stats-row { flex-direction: column; }

    /* Timeline: stack video + transcript vertically */
    .nvr-tl-top { flex-direction: column; }
    .nvr-tl-top .nvr-tl-map { height: 200px; }
    .nvr-tl-bottom { flex-direction: column; }
    .nvr-tl-transcript { max-height: 160px; }
    .nvr-tl-events { width: 100%; }

    /* Multi-view: hide map sidebar */
    .nvr-mv-map-panel { display: none; }
    .nvr-mv-header { flex-wrap: wrap; gap: 6px; }

    /* Live monitor: stack sidebar below */
    .nvr-lm-body { flex-direction: column; }
    .nvr-lm-sidebar { width: 100%; flex-direction: column; max-height: 360px; }
    .nvr-lm-map-wrap { height: 150px; }
    .nvr-lm-info-panel { max-height: 100px; }
    .nvr-lm-transcript-panel { min-height: 80px; max-height: 140px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet landscape: narrower sidebar */
    .nvr-sidebar { --nvr-sidebar-w: 200px; }
    .nvr-lm-sidebar { width: 360px; }
}

@media (min-width: 1920px) {
    .nvr-tl-video-wrap .video-js,
    .nvr-tl-video-wrap .video-js.vjs-redwood { height: 648px; }
    .nvr-tl-video-wrap video { height: 648px; }
    .nvr-tl-video-placeholder { height: 540px; }
}

/* ============================================================================
   Detected Faces View
   ============================================================================ */
.nvr-faces-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.nvr-faces-device-select {
    background: var(--nvr-surface-2);
    color: var(--nvr-text);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    padding: 6px 10px;
    font-size: 15px;
    font-family: var(--nvr-font);
    cursor: pointer;
    min-width: 180px;
}

.nvr-faces-device-select:focus {
    outline: none;
    border-color: var(--nvr-accent);
}

.nvr-faces-count {
    font-size: 15px;
    color: var(--nvr-text-muted);
}

.nvr-faces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 0 4px;
}

.nvr-face-card {
    background: var(--nvr-surface-2, #2a2a2e);
    border: 1px solid var(--nvr-border, #3a3a3e);
    border-radius: var(--nvr-radius);
    overflow: hidden;
    transition: border-color var(--nvr-transition);
}

.nvr-face-card:hover {
    border-color: var(--nvr-text-muted, #999);
}

.nvr-face-img {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--nvr-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nvr-face-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nvr-face-img-placeholder {
    color: var(--nvr-text-dim);
}

.nvr-face-info {
    padding: 8px 10px;
}

.nvr-face-device {
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nvr-face-time {
    font-size: 14px;
    color: var(--nvr-text-muted);
    margin-top: 2px;
}

.nvr-face-conf {
    font-size: 14px;
    color: var(--nvr-text-dim);
    margin-top: 2px;
}

@media (max-width: 768px) {
    .nvr-faces-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
}

/* Duplicate light theme block removed — consolidated into main block above */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c0c0c0; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

[data-theme="light"] .nvr-tl-transcript-line { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .nvr-tl-transcript-line.active { background: rgba(59,130,246,0.08); }
[data-theme="light"] .nvr-tl-event-item { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .nvr-archive-entry { border-bottom-color: rgba(0,0,0,0.06); }

/* ============================================================================
   Thumbnail Preview Tooltip (Timeline)
   ============================================================================ */
.nvr-tl-thumb-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: var(--nvr-z-tooltip);
    display: none;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    box-shadow: var(--nvr-shadow-lg);
    overflow: hidden;
    text-align: center;
}
.nvr-tl-thumb-tooltip img {
    display: block;
    width: 240px;
    height: auto;
    background: #000;
}
.nvr-tl-thumb-tooltip-time,
.nvr-tl-thumb-time {
    padding: 3px 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--nvr-font-mono);
    color: var(--nvr-text);
    background: var(--nvr-surface-2);
}
.nvr-tl-thumb-seg-info {
    padding: 1px 8px 3px;
    font-size: 13px;
    font-family: var(--nvr-font-mono);
    color: var(--nvr-text-dim);
    background: var(--nvr-surface-2);
}
.nvr-tl-thumb-scrub {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
}
.nvr-tl-thumb-scrub-fill {
    height: 100%;
    background: var(--nvr-primary, #6366f1);
    transition: width 0.05s linear;
}

/* ============================================================================
   Redaction Overlay (Timeline)
   ============================================================================ */
#tlRedactBtn.active {
    background: var(--nvr-alert);
    color: #fff;
}
.nvr-tl-redact-panel {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 12px 16px;
    margin-top: 8px;
}
.nvr-tl-redact-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
}
.nvr-tl-redact-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
}
.nvr-redact-tool.active {
    background: var(--nvr-accent, #3b82f6) !important;
    color: #fff !important;
}
.nvr-tl-redact-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    font-size: 14px;
    color: var(--nvr-text-muted);
}
.nvr-tl-redact-item button {
    background: none;
    border: none;
    color: var(--nvr-alert);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

/* ============================================================================
   Face Groups (enhanced faces view)
   ============================================================================ */
.nvr-faces-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.nvr-face-group-card {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--nvr-transition);
}
.nvr-face-group-card:hover {
    border-color: var(--nvr-accent);
}
.nvr-face-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.nvr-face-group-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--nvr-surface-2);
    flex-shrink: 0;
}
.nvr-face-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--nvr-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
}
.nvr-face-group-label-input {
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    padding: 3px 8px;
    font-size: 15px;
    font-family: inherit;
    width: 140px;
    outline: none;
}
.nvr-face-group-label-input:focus {
    border-color: var(--nvr-accent);
}

/* ============================================================================
   Map View (full-page live map)
   ============================================================================ */
.nvr-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
}
.nvr-map-inner {
    width: 100%;
    height: 100%;
}
.nvr-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    gap: 6px;
    align-items: center;
}
.nvr-map-mini-player {
    width: 320px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    overflow: hidden;
    box-shadow: var(--nvr-shadow-lg);
}
.nvr-map-mini-player video {
    width: 100%;
    height: 180px;
    background: #000;
    display: block;
}
.nvr-map-mini-player-header {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
}

/* ============================================================================
   Geofences View
   ============================================================================ */
.nvr-geofences-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
}
.nvr-geofences-map {
    flex: 1;
    min-height: 600px;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    overflow: hidden;
}
.nvr-geofences-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nvr-geofence-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    font-size: 15px;
    cursor: pointer;
    transition: border-color var(--nvr-transition);
}
.nvr-geofence-item:hover {
    border-color: var(--nvr-accent);
}

/* ============================================================================
   Reports View
   ============================================================================ */
.nvr-report-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-end;
}
.nvr-report-form label {
    font-size: 15px;
    color: var(--nvr-text-muted);
    display: block;
    margin-bottom: 2px;
}
.nvr-report-form input,
.nvr-report-form select {
    padding: 6px 10px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.nvr-report-form input:focus,
.nvr-report-form select:focus {
    border-color: var(--nvr-accent);
}
.nvr-report-preview {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 24px;
    min-height: 200px;
}
.nvr-report-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--nvr-border);
}
.nvr-report-section {
    margin-bottom: 20px;
}
.nvr-report-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--nvr-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nvr-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.nvr-report-table th,
.nvr-report-table td {
    padding: 6px 10px;
    border: 1px solid var(--nvr-border);
    text-align: left;
}
.nvr-report-table th {
    background: var(--nvr-surface-2);
    font-weight: 600;
    color: var(--nvr-text);
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    body { background: #fff !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .nvr-sidebar, .nvr-topbar, .nvr-toast-container, .nvr-scanlines, .nvr-report-form { display: none !important; }
    .nvr-main { margin: 0; padding: 0; }
    .nvr-view-container { padding: 0; overflow: visible; }
    .nvr-report-preview { border: none; box-shadow: none; padding: 0; background: #fff !important; color: #000 !important; }
    .nvr-report-header { border-bottom-color: #999; }
    .nvr-report-section { page-break-inside: avoid; }
    .nvr-report-section h3 { color: #000 !important; }
    .nvr-report-table { page-break-inside: auto; }
    .nvr-report-table tr { page-break-inside: avoid; }
    .nvr-report-table th { background: #eee !important; color: #000 !important; }
    .nvr-report-table th, .nvr-report-table td { border-color: #999; color: #000 !important; }
    .nvr-btn { display: none !important; }
    .nvr-report-footer { display: block !important; text-align: center; font-size: 14px; color: #666; margin-top: 24px; padding-top: 12px; border-top: 1px solid #ccc; }
    @page { margin: 1.5cm; size: A4; }
}

/* ============================================================================
   Futuristic Homepage-Inspired Enhancements
   ============================================================================ */

/* --- Login Overlay: Portal image background ------------------------------- */
.nvr-login-overlay {
    background: #0a0a0e;
}
.nvr-login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/portals/images/btn_nvr.png') center center / contain no-repeat;
    opacity: 0.3;
    filter: blur(2px) saturate(1.3);
}
.nvr-login-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(10,10,14,0.3) 0%, rgba(10,10,14,0.92) 70%);
}
.nvr-login-card {
    position: relative;
    z-index: 1;
}

/* Corner accent brackets on login card — cyan glow */
.nvr-login-card::before, .nvr-login-card::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: rgba(0, 190, 255, 0.5);
    border-style: solid;
    pointer-events: none;
    filter: drop-shadow(0 0 4px rgba(0, 190, 255, 0.3));
}
.nvr-login-card::before {
    top: -1px; left: -1px;
    border-width: 2px 0 0 2px;
    border-radius: 6px 0 0 0;
}
.nvr-login-card::after {
    bottom: -1px; right: -1px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 6px 0;
}

/* --- Sidebar Header: Subtle portal image ---------------------------------- */
.nvr-sidebar-header {
    position: relative;
    overflow: hidden;
}
.nvr-sidebar-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/portals/images/btn_nvr.png') center center / cover no-repeat;
    opacity: 0.05;
    filter: saturate(0.5);
    pointer-events: none;
}

/* --- Glowing accent line under sidebar header ----------------------------- */
.nvr-sidebar-header {
    border-bottom: none;
    box-shadow: 0 1px 0 0 var(--nvr-border);
}
.nvr-sidebar-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(138, 180, 248, 0.25), transparent);
    z-index: 1;
}

/* --- Subtle portal image background on main content area ------------------ */
.nvr-view-container {
    position: relative;
    background-color: var(--nvr-bg);
}
.nvr-view-container::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: url('/portals/images/btn_nvr.png') center 20% / cover no-repeat;
    opacity: 0.08;
    filter: saturate(0.6) brightness(1.2);
}
.nvr-view-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(80, 140, 255, 0.04) 0%, var(--nvr-bg) 75%);
}
.nvr-view-container > * {
    position: relative;
    z-index: 1;
}

/* --- Glowing active nav item ---------------------------------------------- */
.nvr-nav-item.active {
    box-shadow: inset 3px 0 8px -4px rgba(138, 180, 248, 0.3);
}

/* --- Sci-fi stat cards --------------------------------------------------- */
.nvr-stat-card {
    border-color: rgba(138, 180, 248, 0.12);
    background: linear-gradient(135deg, var(--nvr-surface) 0%, rgba(138, 180, 248, 0.02) 100%);
    box-shadow: var(--nvr-shadow-sm), 0 0 12px rgba(138, 180, 248, 0.03);
}
.nvr-stat-card::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 16px; height: 16px;
    border-top: 2px solid rgba(138, 180, 248, 0.3);
    border-left: 2px solid rgba(138, 180, 248, 0.3);
    border-radius: 2px 0 0 0;
    pointer-events: none;
}
.nvr-stat-card::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 16px; height: 16px;
    border-bottom: 2px solid rgba(138, 180, 248, 0.3);
    border-right: 2px solid rgba(138, 180, 248, 0.3);
    border-radius: 0 0 2px 0;
    pointer-events: none;
}
.nvr-stat-card { position: relative; }

/* --- Sci-fi device cards ------------------------------------------------- */
.nvr-device-card {
    border-color: rgba(138, 180, 248, 0.08);
    transition: border-color var(--nvr-transition), box-shadow var(--nvr-transition);
}
.nvr-device-card:hover {
    border-color: rgba(138, 180, 248, 0.2);
    box-shadow: 0 0 16px rgba(138, 180, 248, 0.06), var(--nvr-shadow-md);
}

/* --- Glowing section headers --------------------------------------------- */
.nvr-section-header {
    position: relative;
}
.nvr-section-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(138, 180, 248, 0.2), transparent 60%);
}

/* Timeline bookmarks */
.nvr-tl-events-section-header {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--nvr-text-dim, #888);
    padding: 8px 10px 4px;
    letter-spacing: 0.5px;
}
.nvr-tl-bookmark-item {
    position: relative;
}
.nvr-tl-bookmark-item .nvr-tl-bookmark-del {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--nvr-text-dim, #888);
    cursor: pointer;
    font-size: 17px;
    padding: 2px 6px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}
.nvr-tl-bookmark-item:hover .nvr-tl-bookmark-del {
    opacity: 1;
}
.nvr-tl-bookmark-del:hover {
    color: #ef4444 !important;
}
.nvr-tl-event-badge.bookmark {
    background: #06b6d4;
    color: #fff;
}

/* Search result highlighting */
mark { background: #854d0e; color: #fef08a; padding: 0 1px; border-radius: 2px; }

/* ============================================================================
   Device Uptime Chart
   ============================================================================ */
.nvr-storage-trend-chart {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    text-align: center;
    min-height: 200px;
}
.nvr-section-actions { display: flex; gap: 6px; align-items: center; }
.nvr-uptime-chart {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    min-height: 200px;
}
.nvr-uptime-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nvr-uptime-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.nvr-uptime-label {
    width: 140px;
    flex-shrink: 0;
    font-size: 15px;
    color: var(--nvr-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-uptime-bar-bg {
    flex: 1;
    height: 14px;
    background: var(--nvr-surface-2, #2a2a3e);
    border-radius: 3px;
    overflow: hidden;
}
.nvr-uptime-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.nvr-uptime-pct {
    width: 40px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--nvr-font-mono, monospace);
    color: var(--nvr-text);
}

/* ============================================================================
   Alert Heatmap
   ============================================================================ */
.nvr-heatmap-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}
.nvr-heatmap-table {
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 14px;
    font-family: var(--nvr-font-mono, monospace);
}
.nvr-heatmap-table th {
    padding: 3px 6px;
    font-weight: 600;
    color: var(--nvr-text-dim);
    text-align: center;
    font-size: 13px;
}
.nvr-heatmap-label {
    padding: 3px 10px 3px 0;
    text-align: right;
    white-space: nowrap;
    color: var(--nvr-text-muted);
    font-size: 14px;
}
.nvr-heatmap-cell {
    width: 28px;
    height: 24px;
    text-align: center;
    border-radius: 3px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.1s;
    cursor: default;
}
.nvr-heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 2;
    position: relative;
}
.nvr-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    margin-top: 8px;
}
.nvr-heatmap-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* Audio Focus */
.nvr-lm-audio-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(34, 197, 94, 0.85);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 6;
    pointer-events: none;
}
.nvr-lm-slot.nvr-lm-audio-focused {
    box-shadow: 0 0 0 2px #22c55e, 0 0 12px rgba(34, 197, 94, 0.25);
}

/* ============================================================================
   Multi-Device Timeline
   ============================================================================ */
.nvr-mtl {
    display: flex; flex-direction: column; height: 100%; padding: 16px;
}
.nvr-mtl-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; margin-bottom: 8px;
}
.nvr-mtl-status {
    font-size: 15px; color: var(--nvr-text-dim, #888);
}
.nvr-mtl-body {
    flex: 1; overflow-y: auto; background: var(--nvr-surface, #1e1e2e);
    border: 1px solid var(--nvr-border, #333); border-radius: 8px;
    user-select: none;
}
.nvr-mtl-rows { }
.nvr-mtl-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--nvr-text-muted, #888);
    font-size: 13px;
}
.nvr-mtl-row {
    transition: background 0.15s;
}
.nvr-mtl-row:hover {
    background: rgba(99, 102, 241, 0.08);
}
.nvr-mtl-axis {
    border-top: 1px solid var(--nvr-border, #333);
    padding: 4px 0; min-height: 24px;
}
.nvr-mtl-legend {
    display: flex; gap: 16px; padding: 8px 0; flex-wrap: wrap;
    font-size: 14px; color: var(--nvr-text-dim, #888);
}

/* ============================================================================
   Accessibility
   ============================================================================ */

/* Skip-to-content link — visible only on focus */
.skip-to-content {
    position: fixed; top: -100%; left: 16px; z-index: 100000;
    padding: 8px 16px; background: var(--nvr-accent, #6366f1); color: #fff;
    border-radius: 0 0 8px 8px;
    font-size: 16px; font-weight: 600; text-decoration: none;
    transition: top 0.15s;
}
.skip-to-content:focus { top: 0; outline: 2px solid var(--nvr-accent, #6366f1); outline-offset: 2px; }

/* Keyboard focus indicators */
:focus-visible {
    outline: 2px solid var(--nvr-accent, #6366f1);
    outline-offset: 2px;
}
.nvr-nav-item:focus-visible { outline: 2px solid var(--nvr-accent, #6366f1); outline-offset: -2px; border-radius: 6px; }

/* --- Health Trend Charts -------------------------------------------------- */
.nvr-health-chart {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
}

/* Predictive Battery Alerts */
.nvr-battery-predict {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 10px;
    font-family: var(--nvr-font-mono, 'SF Mono', 'Cascadia Code', 'Consolas', monospace);
}
.nvr-battery-predict-ok {
    color: var(--nvr-accent, #6366f1);
    background: rgba(99, 102, 241, 0.12);
}
.nvr-battery-predict-warning {
    color: var(--nvr-marker, #f59e0b);
    background: rgba(245, 158, 11, 0.15);
    animation: nvrBattWarn 2s ease-in-out infinite;
}
.nvr-battery-predict-critical {
    color: var(--nvr-alert, #f28b82);
    background: rgba(239, 68, 68, 0.15);
    animation: nvrBattCrit 1s ease-in-out infinite;
}
@keyframes nvrBattWarn { 0%,100%{opacity:1} 50%{opacity:0.7} }
@keyframes nvrBattCrit { 0%,100%{opacity:1} 50%{opacity:0.5} }
@media (prefers-reduced-motion: reduce) {
    .nvr-battery-predict-warning, .nvr-battery-predict-critical { animation: none; }
}

/* High-contrast mode */
@media (forced-colors: active) {
    .nvr-btn, .nvr-badge, .nvr-card { border: 1px solid ButtonText; }
    .nvr-nav-item.active { border-left: 3px solid Highlight; }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================================
   Tactical Ops Enhancements (ported from next-gen)
   ============================================================================ */

/* --- Scanline Overlay ---------------------------------------------------- */
.nvr-scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--nvr-z-top);
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
    opacity: 0.22;
}

/* --- Raster overlay for video panels ------------------------------------- */
.nvr-raster {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 4px, rgba(138, 180, 248, 0.06) 4px, rgba(138, 180, 248, 0.06) 5px);
    pointer-events: none;
    z-index: 1;
}

/* --- Panel glow effect --------------------------------------------------- */
.nvr-card {
    box-shadow: var(--nvr-shadow-sm), inset 0 0 18px rgba(138, 180, 248, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.nvr-card:hover {
    border-color: rgba(138, 180, 248, 0.25);
    box-shadow: var(--nvr-shadow-md), 0 0 16px rgba(138, 180, 248, 0.08);
    transform: translateY(-1px);
}

/* --- Tactical monospace data displays ------------------------------------ */
.nvr-mono {
    font-family: var(--nvr-font-mono);
    letter-spacing: 0.5px;
}

/* --- Accent glow on active elements -------------------------------------- */
.nvr-nav-item.active {
    box-shadow: inset 3px 0 8px -4px rgba(138, 180, 248, 0.3);
}

/* --- Sync profile controls ----------------------------------------------- */
.nvr-mv-sync-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    margin-bottom: 8px;
}
.nvr-mv-sync-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--nvr-text-muted);
}
.nvr-mv-sync-select {
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    background: var(--nvr-surface-2);
    color: var(--nvr-text);
    padding: 5px 8px;
    font-size: 15px;
    min-width: 130px;
}
.nvr-mv-drift-badge {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-accent);
    border: 1px solid rgba(138, 180, 248, 0.22);
    border-radius: 999px;
    padding: 2px 10px;
    background: rgba(138, 180, 248, 0.06);
}
.nvr-mv-sync-config {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    margin-bottom: 8px;
}
.nvr-mv-sync-config label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nvr-text-muted);
}
.nvr-mv-sync-config input {
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    background: var(--nvr-surface-2);
    color: var(--nvr-text);
    padding: 5px 6px;
    font-size: 15px;
}
.nvr-mv-sync { display: flex; align-items: center; gap: 6px; }
.nvr-mv-drift {
    font-family: var(--nvr-font-mono); font-size: 14px; color: var(--nvr-text-dim);
    white-space: nowrap; min-width: 50px;
}
.nvr-mv-drift.nvr-mv-drift-warn { color: var(--nvr-alert, #f28b82); }
.nvr-mv-drift.nvr-mv-drift-ok { color: var(--nvr-live, #81c995); }

/* --- Stacked multi-device timeline --------------------------------------- */
.nvr-mv-stacked-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    margin-bottom: 8px;
}
.nvr-mv-stacked-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--nvr-accent);
    margin-bottom: 4px;
}
.nvr-mv-stack-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px;
    align-items: center;
}
.nvr-mv-stack-device {
    font-family: var(--nvr-font-mono);
    font-size: 15px;
    color: var(--nvr-text);
    padding: 4px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-mv-stack-device:hover {
    border-color: var(--nvr-accent);
}
.nvr-mv-stack-track {
    position: relative;
    border: 1px solid var(--nvr-border);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--nvr-radius-sm);
    height: 24px;
    overflow: hidden;
}
.nvr-mv-stack-seg {
    position: absolute;
    top: 5px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--nvr-accent), var(--nvr-recording));
    opacity: 0.85;
}
.nvr-mv-stack-cursor {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    z-index: 2;
}

@media (max-width: 1200px) {
    .nvr-mv-sync-config { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nvr-mv-stack-row { grid-template-columns: 1fr; }
}

/* ============================================================================
   Command Palette (Cmd/Ctrl+K)
   ============================================================================ */
.cmd-palette-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 20vh; z-index: var(--nvr-z-cmd-palette);
    opacity: 0; visibility: hidden; transition: opacity 150ms ease, visibility 150ms ease;
}
.cmd-palette-overlay.active { opacity: 1; visibility: visible; }
.cmd-palette {
    background: var(--nvr-surface); border: 1px solid var(--nvr-border-light);
    border-radius: var(--nvr-radius-lg); box-shadow: var(--nvr-shadow-lg), 0 0 20px rgba(138, 180, 248, 0.08);
    width: 100%; max-width: 520px; overflow: hidden;
}
.cmd-palette-input {
    width: 100%; padding: 14px 18px; font-size: 17px; font-family: inherit;
    border: none; border-bottom: 1px solid var(--nvr-border);
    background: transparent; color: var(--nvr-text); outline: none;
}
.cmd-palette-input::placeholder { color: var(--nvr-text-dim); }
.cmd-palette-results { max-height: 320px; overflow-y: auto; padding: 6px 0; }
.cmd-palette-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px; cursor: pointer; font-size: 15px;
    color: var(--nvr-text-muted); transition: background 80ms ease;
}
.cmd-palette-item:hover, .cmd-palette-item.active {
    background: var(--nvr-primary-light); color: var(--nvr-accent);
}
.cmd-palette-item-icon { width: 16px; text-align: center; opacity: 0.6; }
.cmd-palette-empty { padding: 18px; text-align: center; color: var(--nvr-text-dim); font-size: 15px; }
.cmd-palette-hint { padding: 8px 18px; font-size: 14px; color: var(--nvr-text-dim); border-top: 1px solid var(--nvr-border); display: flex; gap: 12px; }
.cmd-palette-hint kbd { background: var(--nvr-surface-2); border: 1px solid var(--nvr-border); border-radius: 4px; padding: 0 4px; font-size: 14px; }

/* --- Cross-Device Correlation (#84) --------------------------------------- */
.nvr-input {
    padding: 6px 10px;
    background: var(--nvr-surface-2, #2a2a2e);
    border: 1px solid var(--nvr-border, #3a3a3e);
    border-radius: var(--nvr-radius, 6px);
    color: var(--nvr-text, #e0e0e0);
    font-size: 15px;
    outline: none;
}
.nvr-input:focus { border-color: var(--nvr-text-muted, #999); }

/* --- Evidence Timeline (#87) ---------------------------------------------- */
.nvr-evidence-timeline {
    padding: 12px;
    border: 1px solid var(--nvr-border, #333);
    border-radius: 8px;
    background: var(--nvr-surface-alt, #1a1a2e);
}
.nvr-evidence-timeline-svg {
    width: 100%;
    height: 60px;
}
.nvr-et-dot {
    cursor: pointer;
    transition: r 0.15s;
}
.nvr-et-dot:hover { r: 9; }
.nvr-et-date {
    fill: var(--nvr-text-muted, #666);
    font-size: 14px;
    font-family: inherit;
}
.nvr-et-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.nvr-et-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.nvr-et-undated {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.nvr-et-undated-chip {
    font-size: 14px;
    color: var(--nvr-text, #e0e0e0);
    padding: 3px 8px;
    background: var(--nvr-surface, #1e1e1e);
    border-radius: 4px;
}

/* Case Picker Modal */
.nvr-case-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--nvr-z-top);
}
.nvr-case-picker-panel {
    background: var(--nvr-bg, #121212);
    border: 1px solid var(--nvr-border, #333);
    border-radius: 10px;
    width: 380px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.nvr-case-picker-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--nvr-border, #333);
    cursor: pointer;
    transition: background 0.15s;
}
.nvr-case-picker-item:hover {
    background: var(--nvr-surface-alt, #1a1a2e);
}

/* ============================================================================
   Sci-Fi Modal Cards — Alert Rules
   ============================================================================ */
.scifi-modal-overlay {
    position: fixed; inset: 0; z-index: var(--nvr-z-modal);
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.scifi-modal-overlay.active { opacity: 1; visibility: visible; }
.scifi-modal {
    position: relative;
    width: 560px; max-width: 92vw; max-height: 88vh;
    background: rgba(10, 16, 24, 0.96);
    border: 1px solid rgba(0, 190, 255, 0.28);
    border-radius: 12px;
    box-shadow:
        0 0 40px rgba(0, 140, 255, 0.12),
        inset 0 0 30px rgba(0, 100, 255, 0.04),
        0 24px 48px rgba(0, 0, 0, 0.4);
    color: #d8f2ff;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}
.scifi-modal-overlay.active .scifi-modal { transform: scale(1) translateY(0); }
.scifi-modal::before {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 190, 255, 0.012) 2px, rgba(0, 190, 255, 0.012) 4px);
    pointer-events: none; z-index: 3; border-radius: 12px;
}
.scifi-modal::after {
    content: ''; position: absolute; bottom: -1px; right: -1px;
    width: 24px; height: 24px;
    border-bottom: 2px solid rgba(0, 190, 255, 0.45);
    border-right: 2px solid rgba(0, 190, 255, 0.45);
    border-radius: 0 0 6px 0; pointer-events: none;
    filter: drop-shadow(0 0 3px rgba(0, 190, 255, 0.25));
}
.scifi-modal-bracket-tl {
    position: absolute; top: -1px; left: -1px;
    width: 24px; height: 24px;
    border-top: 2px solid rgba(0, 190, 255, 0.45);
    border-left: 2px solid rgba(0, 190, 255, 0.45);
    border-radius: 6px 0 0 0; pointer-events: none; z-index: 4;
    filter: drop-shadow(0 0 3px rgba(0, 190, 255, 0.25));
}
.scifi-modal-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid rgba(0, 190, 255, 0.12);
    display: flex; align-items: center; justify-content: space-between;
    position: relative; z-index: 2;
}
.scifi-modal-title {
    font-size: 16px; font-weight: 600;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: #b0d8ff; margin: 0;
}
.scifi-modal-title-accent {
    display: inline-block; width: 3px; height: 14px;
    background: rgba(0, 190, 255, 0.7); border-radius: 2px;
    margin-right: 10px; vertical-align: middle;
    box-shadow: 0 0 6px rgba(0, 190, 255, 0.4);
}
.scifi-modal-close {
    background: none; border: 1px solid rgba(255, 255, 255, 0.1);
    color: #6a8aa8; cursor: pointer; font-size: 19px;
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.scifi-modal-close:hover {
    color: #f28b82; border-color: rgba(242, 139, 130, 0.3);
    box-shadow: 0 0 10px rgba(242, 139, 130, 0.15);
}
.scifi-modal-body {
    padding: 20px 24px; overflow-y: auto; max-height: 60vh;
    position: relative; z-index: 2;
}
.scifi-field { margin-bottom: 18px; }
.scifi-field:last-child { margin-bottom: 0; }
.scifi-label {
    display: block; font-size: 14px; font-weight: 600;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: #6a8aad; margin-bottom: 6px;
}
.scifi-input, .scifi-select, .scifi-textarea {
    width: 100%; box-sizing: border-box;
    padding: 10px 14px; font-size: 16px; font-family: inherit;
    background: rgba(12, 19, 28, 0.9);
    border: 1px solid rgba(0, 190, 255, 0.18);
    border-radius: 8px; color: #e3f2ff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease; outline: none;
}
.scifi-input:focus, .scifi-select:focus, .scifi-textarea:focus {
    border-color: rgba(0, 190, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 190, 255, 0.08), 0 0 14px rgba(0, 190, 255, 0.06);
}
.scifi-input::placeholder, .scifi-textarea::placeholder { color: #3c5670; }
.scifi-select {
    -webkit-appearance: none;
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a8aad' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.scifi-select option { background: #0c131c; color: #e3f2ff; }
.scifi-modal-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(0, 190, 255, 0.10);
    display: flex; justify-content: flex-end; gap: 10px;
    position: relative; z-index: 2;
}
.scifi-btn {
    padding: 9px 22px; font-size: 15px; font-weight: 600;
    letter-spacing: 0.8px; text-transform: uppercase;
    border-radius: 8px; border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s ease; font-family: inherit;
}
.scifi-btn-primary {
    background: rgba(0, 160, 255, 0.15);
    border-color: rgba(0, 180, 255, 0.4); color: #a0d4ff;
}
.scifi-btn-primary:hover:not(:disabled) {
    background: rgba(0, 160, 255, 0.25);
    border-color: rgba(0, 180, 255, 0.6);
    box-shadow: 0 0 18px rgba(0, 160, 255, 0.15);
}
.scifi-btn-cancel {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1); color: #6a8aa8;
}
.scifi-btn-cancel:hover { background: rgba(255, 255, 255, 0.08); color: #8ea8c4; }
.scifi-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scifi-chip {
    padding: 5px 14px; font-size: 15px; font-weight: 500;
    border-radius: 20px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #7a96b0; transition: all 0.15s ease;
}
.scifi-chip:hover { border-color: rgba(0, 190, 255, 0.25); color: #a0c4e0; }
.scifi-chip.active {
    border-color: rgba(0, 190, 255, 0.45);
    background: rgba(0, 190, 255, 0.1);
    color: #b0d8ff;
    box-shadow: 0 0 8px rgba(0, 190, 255, 0.1);
}

/* --- Themed Dialog (replaces native alert/confirm/prompt) ---------------- */
.nvr-dialog-overlay {
    position: fixed; inset: 0; z-index: var(--nvr-z-dialog);
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    animation: nvrDialogFadeIn 150ms ease;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
@keyframes nvrDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
.nvr-dialog-overlay .scifi-modal { transform: scale(1) translateY(0); max-width: 420px; animation: nvrDialogSlideIn 200ms cubic-bezier(0.22,1,0.36,1); }
@keyframes nvrDialogSlideIn { from { transform: scale(0.92) translateY(12px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.nvr-dialog-message { font-size: 16px; color: #d8f2ff; margin-bottom: 14px; white-space: pre-line; }
.nvr-dialog-message:last-child { margin-bottom: 0; }
.nvr-dialog-select-list { max-height: 280px; overflow-y: auto; }
.nvr-dialog-select-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 24px; cursor: pointer; font-size: 16px;
    color: #7a96b0; transition: all 80ms ease;
    border-bottom: 1px solid rgba(0, 190, 255, 0.06);
}
.nvr-dialog-select-item:last-child { border-bottom: none; }
.nvr-dialog-select-item:hover { background: rgba(0, 160, 255, 0.08); color: #a0d4ff; }

/* Page Help Button */
.page-help-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0;
    border-radius: 4px; font-size: 15px; font-weight: 600; line-height: 1;
    margin-left: 10px; flex-shrink: 0; cursor: pointer;
    background: transparent; color: var(--nvr-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all var(--nvr-transition);
}
.page-help-btn:hover {
    background: rgba(0,190,255,0.1); border-color: rgba(0,190,255,0.4); color: #00beff;
    box-shadow: 0 0 10px rgba(0,190,255,0.15);
}
.page-help-body { font-size: 16px; line-height: 1.75; color: #b8d4e8; }

/* ==========================================================================
   Items 1-4: Connection Health, Reconnect Overlay, Visibility
   ========================================================================== */

/* Health indicator dot on video cells */
.nvr-health-dot {
    position: absolute; top: 6px; right: 6px; z-index: 5;
    width: 10px; height: 10px; border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.5);
    transition: background 300ms ease, box-shadow 300ms ease;
}
.nvr-health-dot[data-health="connected"] {
    background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6);
}
.nvr-health-dot[data-health="buffering"] {
    background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.6);
    animation: nvrHealthPulse 1.2s ease infinite;
    will-change: opacity;
}
.nvr-health-dot[data-health="disconnected"] {
    background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6);
}
.nvr-health-dot[data-health="idle"] {
    background: #64748b; box-shadow: none;
}
@keyframes nvrHealthPulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* Reconnect overlay on video cells */
.nvr-reconnect-overlay {
    position: absolute; inset: 0; z-index: 8;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    color: #e0e0e0; font-size: 15px; gap: 8px;
    backdrop-filter: blur(2px);
}
.nvr-reconnect-overlay .nvr-reconnect-spinner {
    width: 24px; height: 24px; border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #3b82f6; border-radius: 50%;
    animation: nvrSpin 0.8s linear infinite;
    will-change: transform;
}
@keyframes nvrSpin { to { transform: rotate(360deg); } }
.nvr-reconnect-overlay .nvr-reconnect-msg {
    text-align: center; max-width: 180px; line-height: 1.4;
}
.nvr-reconnect-overlay .nvr-reconnect-retry {
    margin-top: 4px; padding: 4px 12px; font-size: 14px;
    background: rgba(59,130,246,0.3); border: 1px solid rgba(59,130,246,0.5);
    border-radius: 4px; color: #93c5fd; cursor: pointer;
    transition: background 150ms ease;
}
.nvr-reconnect-overlay .nvr-reconnect-retry:hover {
    background: rgba(59,130,246,0.5);
}

/* No-signal overlay (static frame) */
.nvr-no-signal {
    position: absolute; inset: 0; z-index: 7;
    display: flex; align-items: center; justify-content: center;
    background: repeating-linear-gradient(
        0deg, rgba(30,30,40,0.9) 0px, rgba(30,30,40,0.9) 2px,
        rgba(40,40,55,0.9) 2px, rgba(40,40,55,0.9) 4px
    );
    color: #ef4444; font-size: 15px; font-weight: 600;
    letter-spacing: 1px; text-transform: uppercase;
}

/* Live Monitor reconnect overlay */
.nvr-lm-reconnect-overlay {
    position: absolute; inset: 0; z-index: 8;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    color: #e2e8f0; font-size: 15px;
    backdrop-filter: blur(3px);
    pointer-events: auto;
}
.nvr-lm-reconnect-text {
    text-align: center; max-width: 200px; line-height: 1.5;
    font-family: var(--nvr-font-mono, 'Courier New', monospace);
    font-size: 15px; letter-spacing: 0.5px;
}
.nvr-lm-reconnect-retry {
    display: inline-block; margin-top: 6px; padding: 3px 10px;
    font-size: 14px; color: #93c5fd; cursor: pointer;
    border: 1px solid rgba(59,130,246,0.5);
    border-radius: 4px; background: rgba(59,130,246,0.2);
    transition: background 150ms ease;
}
.nvr-lm-reconnect-retry:hover {
    background: rgba(59,130,246,0.45);
}

/* ==========================================================================
   Item 7: Canvas Time Ruler
   ========================================================================== */
.nvr-tl-ruler {
    position: relative; height: 22px; width: 100%;
    margin-top: 6px;
    background: var(--nvr-surface-alt, #141422);
    border-bottom: 1px solid var(--nvr-border, #333);
    font-size: 13px; color: var(--nvr-text-dim, #666);
    overflow: visible; user-select: none;
}
.nvr-tl-ruler-tick {
    position: absolute; top: 0; bottom: 0; width: 1px;
    background: var(--nvr-border, #333);
}
.nvr-tl-ruler-tick.major { background: rgba(255,255,255,0.15); }
.nvr-tl-ruler-label {
    position: absolute; bottom: 2px;
    white-space: nowrap; font-family: var(--nvr-font-mono, monospace);
    font-size: 13px; color: var(--nvr-text-dim, #888);
    transform: translateX(-50%);
}

/* ==========================================================================
   Item 8: Sidebar Context Menu (Jump to Same Time)
   ========================================================================== */
.nvr-ctx-menu {
    position: fixed; z-index: var(--nvr-z-ctx-menu);
    background: var(--nvr-surface-2, #1e1e2e);
    border: 1px solid var(--nvr-border, #333);
    border-radius: 6px; padding: 4px 0;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    animation: nvrCtxFadeIn 100ms ease;
}
@keyframes nvrCtxFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.nvr-ctx-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; font-size: 15px;
    color: var(--nvr-text, #e0e0e0); cursor: pointer;
    transition: background 100ms ease;
}
.nvr-ctx-menu-item:hover {
    background: rgba(59,130,246,0.15); color: #93c5fd;
}
.nvr-ctx-menu-item svg { flex-shrink: 0; opacity: 0.6; }
.nvr-ctx-menu-divider {
    height: 1px; margin: 4px 8px;
    background: var(--nvr-border, #333);
}
.nvr-ctx-menu-item.disabled {
    opacity: 0.35; pointer-events: none;
}

/* ==========================================================================
   Item 5: Replay Workspace
   ========================================================================== */
.nvr-rw {
    display: grid; height: 100%; gap: 6px; padding: 6px;
    grid-template-columns: 240px 1fr 280px;
    grid-template-rows: 1fr auto;
}
.nvr-rw-tl-panel {
    grid-row: 1 / 3; overflow-y: auto;
    background: var(--nvr-surface, #1a1a2e); border-radius: 6px;
    border: 1px solid var(--nvr-border, #333);
}
.nvr-rw-tl-panel-header {
    padding: 8px 12px; font-size: 15px; font-weight: 600;
    border-bottom: 1px solid var(--nvr-border, #333);
    color: var(--nvr-text, #e0e0e0);
    display: flex; align-items: center; justify-content: space-between;
}
.nvr-rw-device-strip {
    padding: 6px 10px; cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 100ms ease;
}
.nvr-rw-device-strip:hover { background: rgba(59,130,246,0.08); }
.nvr-rw-device-strip.selected { background: rgba(59,130,246,0.15); }
.nvr-rw-device-strip canvas {
    width: 100%; height: 24px; display: block; border-radius: 3px;
}
.nvr-rw-video-panel {
    display: grid; gap: 4px; grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.nvr-rw-video-panel[data-count="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.nvr-rw-video-panel[data-count="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.nvr-rw-video-slot {
    position: relative; background: #000; border-radius: 4px; overflow: hidden;
    border: 1px solid var(--nvr-border, #333);
}
.nvr-rw-video-slot video { width: 100%; height: 100%; object-fit: contain; }
.nvr-rw-map-panel {
    grid-row: 1 / 3; overflow: hidden;
    background: var(--nvr-surface, #1a1a2e); border-radius: 6px;
    border: 1px solid var(--nvr-border, #333);
}
.nvr-rw-map-inner { width: 100%; height: 100%; }
.nvr-rw-shared-tl {
    grid-column: 2; position: relative;
    background: var(--nvr-surface, #1a1a2e); border-radius: 6px;
    border: 1px solid var(--nvr-border, #333); padding: 4px;
}
.nvr-rw-shared-tl canvas { width: 100%; height: 40px; display: block; }
.nvr-rw-transport {
    display: flex; align-items: center; gap: 6px; padding: 4px 0 0;
}

/* Multiview slot health border */
.nvr-mv-slot { position: relative; }
.nvr-mv-slot[data-conn="connected"] { border-color: rgba(34,197,94,0.4) !important; }
.nvr-mv-slot[data-conn="buffering"] { border-color: rgba(245,158,11,0.4) !important; }
.nvr-mv-slot[data-conn="disconnected"] { border-color: rgba(239,68,68,0.4) !important; }

/* Live monitor slot health */
.nvr-lm-slot { position: relative; }
.nvr-lm-slot[data-conn="connected"] .nvr-lm-slot-border { border-color: rgba(34,197,94,0.3); }
.nvr-lm-slot[data-conn="disconnected"] .nvr-lm-slot-border { border-color: rgba(239,68,68,0.3); }

/* ============================================================================
   Item 11 — Device Association Chain
   ============================================================================ */
.nvr-device-assoc {
    display: block;
    font-size: 13px;
    color: var(--nvr-text-dim);
    margin-top: 1px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-assoc-arrow {
    color: var(--nvr-text-dim);
    opacity: 0.5;
    margin: 0 2px;
    font-size: 13px;
}
.nvr-card-assoc {
    margin-top: 4px;
}
.nvr-card-assoc .nvr-device-assoc {
    font-size: 14px;
}

/* ============================================================================
   Item 10 — Device Identity Card
   ============================================================================ */
.nvr-dic-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: var(--nvr-z-fixed);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    opacity: 0;
    transition: opacity 0.2s ease;
    overflow-y: auto;
}
.nvr-dic-overlay.active { opacity: 1; }
.nvr-dic {
    width: 480px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    box-shadow: var(--nvr-shadow-lg);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}
.nvr-dic-overlay.active .nvr-dic { transform: translateY(0); }
.nvr-dic-header {
    position: relative;
    padding: 16px 12px 12px;
    text-align: center;
    background: var(--nvr-surface-2);
    border-bottom: 1px solid var(--nvr-border);
}
.nvr-dic-close {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 19px;
}
.nvr-dic-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--nvr-border-light);
    margin-bottom: 8px;
}
.nvr-dic-title { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nvr-dic-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nvr-dic-type-badge svg { width: 12px; height: 12px; }
.nvr-dic-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--nvr-text);
}
.nvr-dic-id {
    font-family: var(--nvr-font-mono);
    font-size: 14px;
    color: var(--nvr-text-dim);
}
.nvr-dic-status {
    text-align: center;
    padding: 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.nvr-dic-status.live {
    background: rgba(34,197,94,0.1);
    color: var(--nvr-live);
}
.nvr-dic-status.offline {
    background: var(--nvr-surface-2);
    color: var(--nvr-text-dim);
}
.nvr-dic-chain {
    padding: 8px 12px;
    font-size: 14px;
    color: var(--nvr-text-muted);
    text-align: center;
    border-bottom: 1px solid var(--nvr-border);
}
.nvr-dic-chain span { white-space: nowrap; }
.nvr-dic-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--nvr-border);
}
.nvr-dic-stat {
    padding: 8px;
    text-align: center;
    background: var(--nvr-surface);
}
.nvr-dic-stat-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-dic-stat-lbl {
    font-size: 13px;
    color: var(--nvr-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}
.nvr-dic-actions {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nvr-dic-actions .nvr-btn { width: 100%; justify-content: center; }

/* ============================================================================
   Item 9 + 12 + 13 — Recording Browser
   ============================================================================ */
.nvr-rb { display: flex; flex-direction: column; gap: 12px; }

/* Filters */
.nvr-rb-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
}
.nvr-rb-filter-sel {
    padding: 5px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.nvr-rb-filter-sel:focus { border-color: var(--nvr-accent); }
.nvr-rb-filter-date {
    padding: 4px 8px;
    background: var(--nvr-surface-2);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-sm);
    color: var(--nvr-text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.nvr-rb-filter-date:focus { border-color: var(--nvr-accent); }
.nvr-rb-filter-spacer { flex: 1; }

/* Bulk actions bar */
.nvr-rb-bulk {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--nvr-primary-light);
    border: 1px solid var(--nvr-accent);
    border-radius: var(--nvr-radius);
    flex-wrap: wrap;
}
.nvr-rb-bulk-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-accent);
    margin-right: 4px;
}
.nvr-rb-bulk-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 150px;
}
.nvr-rb-bulk-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--nvr-accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}
.nvr-rb-bulk-progress-text {
    font-size: 14px;
    font-family: var(--nvr-font-mono);
    color: var(--nvr-text-muted);
    white-space: nowrap;
}

/* Summary row */
.nvr-rb-summary {
    display: flex;
    gap: 16px;
    padding: 6px 14px;
    font-size: 15px;
    color: var(--nvr-text-muted);
}

.nvr-rb-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0;
}
.nvr-rb-page-info {
    font-size: 13px;
    color: var(--nvr-text-muted);
    min-width: 100px;
    text-align: center;
}

/* Groups */
.nvr-rb-group {
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    overflow: hidden;
}
.nvr-rb-group.collapsed .nvr-rb-group-body { display: none; }
.nvr-rb-group.collapsed .nvr-rb-chevron { transform: rotate(-90deg); }
.nvr-rb-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--nvr-surface-2);
    cursor: pointer;
    user-select: none;
    transition: background var(--nvr-transition);
}
.nvr-rb-group-header:hover { background: var(--nvr-surface-3); }
.nvr-rb-chevron {
    transition: transform 150ms ease;
    flex-shrink: 0;
    opacity: 0.5;
}
.nvr-rb-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--nvr-text);
}
.nvr-rb-group-meta {
    font-size: 14px;
    color: var(--nvr-text-muted);
    margin-left: auto;
}
.nvr-rb-group-sel {
    font-size: 14px;
    color: var(--nvr-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

/* Recording table */
.nvr-rb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.nvr-rb-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}
.nvr-rb-table th {
    padding: 8px 10px;
    background: var(--nvr-surface-2);
    color: var(--nvr-text-muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--nvr-border);
    white-space: nowrap;
}
.nvr-rb-th-sortable { cursor: pointer; user-select: none; }
.nvr-rb-th-sortable:hover { color: var(--nvr-text); }
.nvr-rb-th-sel { width: 32px; text-align: center; }
.nvr-rb-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(60,60,60,0.4);
    color: var(--nvr-text);
    vertical-align: middle;
}
.nvr-rb-table tr:hover td { background: var(--nvr-surface-2); }
.nvr-rb-table tr.nvr-rb-selected td { background: rgba(138,180,248,0.08); }
.nvr-rb-device { font-weight: 500; }
.nvr-rb-assoc {
    font-size: 14px;
    color: var(--nvr-text-dim);
    display: block;
    margin-top: 2px;
}

/* Storage badge */
.nvr-rb-storage-badge {
    font-size: 14px;
    font-weight: 600;
}

/* Lifecycle visualization (4 dots) */
.nvr-rb-lifecycle {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}
.nvr-rb-lc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nvr-surface-3);
    border: 1px solid var(--nvr-border);
    transition: all 0.2s ease;
}
.nvr-rb-lc-dot.active {
    background: var(--lc-color, var(--nvr-live));
    border-color: var(--lc-color, var(--nvr-live));
    box-shadow: 0 0 6px color-mix(in srgb, var(--lc-color, var(--nvr-live)) 40%, transparent);
}
.nvr-rb-lc-days {
    font-size: 14px;
    color: var(--nvr-text-dim);
    margin-left: 4px;
    font-family: var(--nvr-font-mono);
}

/* Empty state */
.nvr-rb-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--nvr-text-dim);
    font-size: 15px;
}

/* ============================================================================
   Item 16: Sidebar Nav Sections
   ============================================================================ */
.nvr-sidebar-section-label {
    padding: 10px 16px 4px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nvr-text-dim);
}
.nvr-nav-section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.nvr-nav-section-toggle:hover {
    color: var(--nvr-text-muted);
}
.nvr-nav-section-chevron {
    transition: transform 0.2s ease;
}
.nvr-nav-section-toggle.expanded .nvr-nav-section-chevron,
.nvr-nav-section-toggle:not(.expanded):not(:first-of-type) .nvr-nav-section-chevron {
    /* default: pointing down = expanded */
}
.nvr-nav-section.collapsed {
    display: none;
}
.nvr-nav-section-toggle:not(.expanded) .nvr-nav-section-chevron {
    transform: rotate(-90deg);
}
.nvr-nav-section-toggle.expanded .nvr-nav-section-chevron {
    transform: rotate(0deg);
}

/* Playback section is expanded by default — its toggle starts as expanded */
.nvr-sidebar-section-label.nvr-nav-section-toggle:first-of-type {
    /* Already expanded state */
}

/* ============================================================================
   Item 18: Keyboard Shortcuts Modal
   ============================================================================ */
.nvr-kb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.nvr-kb-table tr + tr {
    border-top: 1px solid var(--nvr-border, #333);
}
.nvr-kb-table td {
    padding: 8px 10px;
    vertical-align: middle;
}
.nvr-kb-key {
    width: 60px;
    text-align: center;
}
.nvr-kb-key kbd {
    display: inline-block;
    min-width: 28px;
    padding: 3px 8px;
    font-size: 15px;
    font-family: var(--nvr-font-mono, monospace);
    color: var(--nvr-text);
    background: var(--nvr-surface-2, #2a2a2e);
    border: 1px solid var(--nvr-border, #444);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    text-align: center;
}

/* ============================================================================
   Item 20: Overview Quick Filters
   ============================================================================ */
.nvr-ov-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 8px 0;
    margin-bottom: 4px;
}
.nvr-ov-filter-select {
    font-size: 15px;
    padding: 4px 8px;
    min-width: 120px;
}
.nvr-ov-filter-text {
    font-size: 15px;
    padding: 4px 10px;
    min-width: 180px;
    flex: 1;
    max-width: 300px;
}

/* ============================================================================
   Items 21-23: Map & Spatial Enhancements
   ============================================================================ */
.nvr-map-hist-toolbar {
    padding: 8px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius) var(--nvr-radius) 0 0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.nvr-map-hist-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
}
.nvr-map-hist-playback {
    display: flex;
    gap: 6px;
    align-items: center;
}
.nvr-map-hist-legend {
    padding: 6px 12px;
    background: var(--nvr-surface);
    border: 1px solid var(--nvr-border);
    border-top: none;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
}
.nvr-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--nvr-text-muted);
}
.nvr-map-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
}

/* C6: Loading skeletons */
@keyframes skeleton-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--nvr-surface-3, #2d2d2d) 25%, var(--nvr-border, #3c3c3c) 50%, var(--nvr-surface-3, #2d2d2d) 75%);
    background-size: 800px 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-heading { height: 22px; width: 50%; margin-bottom: 16px; }
.skeleton-card { height: 100px; border-radius: 12px; margin-bottom: 12px; }
.skeleton-row { display: flex; gap: 12px; margin-bottom: 10px; }
.skeleton-row .skeleton-cell { height: 16px; flex: 1; border-radius: 4px; }
.skeleton-row .skeleton-cell:first-child { flex: 0 0 40px; }
.skeleton-row .skeleton-cell:last-child { flex: 0 0 80px; }
.skeleton-table { padding: 16px; }
.skeleton-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.skeleton-loading-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 0 8px; color: var(--nvr-text-muted, #8c8c8c);
    font-size: 18px; font-family: var(--nvr-font, 'Inter', sans-serif);
}
.skeleton-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--nvr-border, #3c3c3c);
    border-top-color: var(--nvr-accent, #8ab4f8);
    border-radius: 50%;
    animation: skeleton-spin 0.8s linear infinite;
}
@keyframes skeleton-spin { to { transform: rotate(360deg); } }

/* ---------- Language Badge ---------- */
.nvr-lang-badge { display: inline-block; font-size: 18px; font-weight: 700; padding: 1px 5px; margin-right: 5px; border-radius: 3px; background: var(--nvr-accent-cyan, #00d4ff); color: #000; text-transform: uppercase; letter-spacing: 0.5px; vertical-align: middle; }
.nvr-lang-toggle { font-size: 12px; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--nvr-border, #333); border-radius: 3px; background: transparent; color: var(--nvr-text-dim, #888); cursor: pointer; vertical-align: middle; }
.nvr-lang-toggle:hover { background: rgba(255,255,255,0.05); }

/* ============================================================================
   Ops Console (NVR Reimagine Slice A/B/C)
   ============================================================================ */
.nvr-oc-hero {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius-lg);
    background: linear-gradient(130deg, color-mix(in srgb, var(--nvr-accent) 14%, var(--nvr-surface)), var(--nvr-surface));
    margin-bottom: 12px;
}
.nvr-oc-hero h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px;
}
.nvr-oc-hero p {
    margin: 0;
    color: var(--nvr-text-muted);
    font-size: 14px;
}
.nvr-oc-hero-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.nvr-oc-stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.nvr-oc-stat {
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    background: var(--nvr-surface);
    padding: 12px 14px;
}
.nvr-oc-stat-label {
    font-size: 13px;
    color: var(--nvr-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}
.nvr-oc-stat-value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--nvr-font-mono);
}

.nvr-oc-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
}
.nvr-oc-main-col,
.nvr-oc-side-col {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
    gap: 12px;
    min-width: 0;
}

.nvr-oc-card {
    border: 1px solid var(--nvr-border, #3a3a3e);
    border-radius: var(--nvr-radius-lg);
    background: var(--nvr-surface-2, #2a2a2e);
    padding: 12px;
    min-width: 0;
}
.nvr-oc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.nvr-oc-card-header h3 {
    margin: 0;
    font-size: 15px;
}
.nvr-oc-subtitle {
    font-size: 13px;
    color: var(--nvr-text-muted);
}
.nvr-oc-inline-controls,
.nvr-oc-inline-actions,
.nvr-oc-ai-actions,
.nvr-oc-cart-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.nvr-oc-inline-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--nvr-text-muted);
}
.nvr-oc-inline-controls .nvr-input,
.nvr-oc-inline-controls .nvr-select {
    font-size: 13px;
    padding: 4px 6px;
    min-height: 30px;
}
.nvr-oc-window {
    padding: 8px 10px;
    border: 1px dashed var(--nvr-border-light);
    border-radius: var(--nvr-radius);
    color: var(--nvr-text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.nvr-oc-moment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 440px;
    overflow-y: auto;
    padding-right: 2px;
}
.nvr-oc-moment-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 10px;
    background: var(--nvr-surface-2);
}
.nvr-oc-moment-row.selected {
    border-color: var(--nvr-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--nvr-accent) 45%, transparent);
}
.nvr-oc-moment-main {
    min-width: 0;
    flex: 1;
}
.nvr-oc-moment-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 14px;
}
.nvr-oc-severity {
    font-size: 12px;
    letter-spacing: .06em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
}
.nvr-oc-moment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--nvr-text-muted);
}
.nvr-oc-moment-detail {
    margin-top: 4px;
    font-size: 13px;
    color: var(--nvr-text);
    opacity: .85;
}
.nvr-oc-moment-actions {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.nvr-oc-node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.nvr-oc-node {
    text-align: left;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    background: var(--nvr-surface-2);
    color: var(--nvr-text);
    padding: 8px;
    cursor: pointer;
}
.nvr-oc-node.active {
    border-color: var(--nvr-accent);
    background: color-mix(in srgb, var(--nvr-accent) 10%, var(--nvr-surface-2));
}
.nvr-oc-node.live .nvr-oc-node-top strong {
    color: var(--nvr-live);
}
.nvr-oc-node-top {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 14px;
    margin-bottom: 3px;
}
.nvr-oc-node-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nvr-text-dim);
}
.nvr-oc-node-dot.live {
    background: var(--nvr-live);
    box-shadow: 0 0 6px var(--nvr-live-glow);
}
.nvr-oc-node-id {
    font-size: 13px;
    color: var(--nvr-text-muted);
    font-family: var(--nvr-font-mono);
}
.nvr-oc-node-sub {
    display: block;
    font-size: 13px;
    color: var(--nvr-text-muted);
    margin-top: 2px;
}
.nvr-oc-link-title {
    font-size: 13px;
    color: var(--nvr-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.nvr-oc-link-list {
    max-height: 170px;
    overflow-y: auto;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    background: var(--nvr-surface-2);
}
.nvr-oc-link-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
    padding: 7px 9px;
    border-bottom: 1px solid color-mix(in srgb, var(--nvr-border) 55%, transparent);
    font-size: 13px;
}
.nvr-oc-link-row:last-child {
    border-bottom: none;
}
.nvr-oc-link-type {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--nvr-text-muted);
    background: var(--nvr-surface-3);
    border-radius: 999px;
    padding: 2px 6px;
}

.nvr-oc-cart-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 270px;
    overflow-y: auto;
}
.nvr-oc-cart-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    padding: 8px;
    background: var(--nvr-surface-2);
}
.nvr-oc-cart-main {
    min-width: 0;
    flex: 1;
}
.nvr-oc-cart-title {
    font-size: 14px;
    margin-bottom: 2px;
}
.nvr-oc-cart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--nvr-text-muted);
}
.nvr-oc-cart-devices {
    margin-top: 3px;
    font-size: 13px;
    color: var(--nvr-text-muted);
}

.nvr-oc-ai-input {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.45;
}
.nvr-oc-ai-output {
    margin: 8px 0 0;
    border: 1px solid var(--nvr-border);
    border-radius: var(--nvr-radius);
    background: var(--nvr-surface-2);
    padding: 10px;
    font-size: 13px;
    line-height: 1.5;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--nvr-text);
}
.nvr-oc-empty {
    padding: 16px 10px;
    text-align: center;
    color: var(--nvr-text-muted);
    border: 1px dashed var(--nvr-border-light);
    border-radius: var(--nvr-radius);
    font-size: 13px;
}

@media (max-width: 1280px) {
    .nvr-oc-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    .nvr-oc-main-col,
    .nvr-oc-side-col {
        display: flex;
        flex-direction: column;
        grid-row: auto;
    }
}
@media (max-width: 900px) {
    .nvr-oc-stat-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .nvr-oc-moment-row {
        flex-direction: column;
    }
}
@media (max-width: 620px) {
    .nvr-oc-stat-row {
        grid-template-columns: 1fr;
    }
    .nvr-oc-hero {
        flex-direction: column;
    }
}

/* ==========================================================================
   Dashboard Landing Page
   ========================================================================== */
.nvr-db-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: var(--nvr-radius-lg);
    background: linear-gradient(135deg, var(--nvr-surface-2, #2a2a2e) 0%, var(--nvr-surface, #1e1e22) 100%);
    border: 1px solid var(--nvr-border, #3a3a3e);
}
.nvr-db-hero h2 { margin: 0; font-size: 17px; }
.nvr-db-hero p { margin: 4px 0 0; font-size: 13px; color: var(--nvr-text-muted); }

.nvr-db-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
    margin-top: 12px;
}
.nvr-db-col {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
    gap: 12px;
    min-width: 0;
}

.nvr-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.nvr-db-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--nvr-text-muted);
    padding: 6px 8px;
    border-bottom: 1px solid var(--nvr-border);
}
.nvr-db-table td {
    padding: 8px;
    border-bottom: 1px solid var(--nvr-border-light, rgba(255,255,255,0.05));
}
.nvr-db-table tr:hover td {
    background: var(--nvr-surface, #1e1e22);
}
.nvr-db-mono {
    font-family: var(--nvr-font-mono);
    font-size: 13px;
}

.nvr-db-device-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nvr-db-device-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--nvr-radius);
}
.nvr-db-device-row:hover {
    background: var(--nvr-surface, #1e1e22);
}
.nvr-db-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nvr-text-dim, #555);
    flex-shrink: 0;
}
.nvr-db-status-dot.live {
    background: var(--nvr-live, #22c55e);
    box-shadow: 0 0 6px var(--nvr-live, #22c55e);
}
.nvr-db-device-name {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nvr-db-device-meta {
    font-size: 12px;
    color: var(--nvr-text-muted);
    font-family: var(--nvr-font-mono);
}

.nvr-db-storage-bar {
    width: 100%;
    height: 4px;
    background: var(--nvr-border, #3a3a3e);
    border-radius: 2px;
    margin: 4px 0;
}
.nvr-db-storage-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--nvr-accent, #3b82f6);
    transition: width 0.3s;
}

.nvr-db-empty {
    padding: 20px;
    text-align: center;
    color: var(--nvr-text-muted);
    font-size: 13px;
}
.nvr-db-more {
    padding: 6px 8px;
    font-size: 12px;
    color: var(--nvr-text-dim);
    text-align: center;
}

@media (max-width: 1280px) {
    .nvr-db-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    .nvr-db-col {
        display: flex;
        flex-direction: column;
        grid-row: auto;
    }
}
@media (max-width: 620px) {
    .nvr-db-hero { flex-direction: column; text-align: center; gap: 8px; }
}

/* ==========================================================================
   Reduced Motion — WCAG 2.1 AA
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
