/* ==========================================================================
   TDI NVR Protect — Apple Design System (macOS / visionOS / Apple TV)
   Liquid Glass • Translucent Surfaces • Micro-Spring Animations • SF Pro
   ========================================================================== */

:root {
    /* Apple System Colors (Dark Mode) */
    --apple-bg: #000000;
    --apple-surface: rgba(28, 28, 32, 0.65);
    --apple-surface-elevated: rgba(44, 44, 48, 0.75);
    --apple-surface-subtle: rgba(255, 255, 255, 0.05);
    --apple-surface-hover: rgba(255, 255, 255, 0.12);
    
    --apple-border: rgba(255, 255, 255, 0.10);
    --apple-border-light: rgba(255, 255, 255, 0.18);
    --apple-border-active: #0a84ff;
    
    --apple-specular: inset 0 1px 0 0 rgba(255, 255, 255, 0.16);
    --apple-specular-subtle: inset 0 1px 0 0 rgba(255, 255, 255, 0.08);

    --apple-blue: #0a84ff;
    --apple-blue-hover: #409cff;
    --apple-green: #30d158;
    --apple-red: #ff453a;
    --apple-orange: #ff9f0a;
    --apple-cyan: #64d2ff;
    
    --text-primary: #ffffff;
    --text-secondary: rgba(235, 235, 245, 0.65);
    --text-tertiary: rgba(235, 235, 245, 0.40);
    --text-quaternary: rgba(235, 235, 245, 0.25);

    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;

    --spring-easing: cubic-bezier(0.16, 1, 0.3, 1);
    --spring-duration: 0.35s;

    --radius-pill: 9999px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --blur-glass: 28px;
    --blur-subtle: 16px;
    
    color-scheme: dark only;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--apple-bg);
    background-image: 
        radial-gradient(circle at 50% -10%, rgba(30, 48, 80, 0.35) 0%, transparent 60%),
        radial-gradient(circle at 85% 90%, rgba(20, 25, 40, 0.25) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-stack);
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    letter-spacing: -0.01em;
}

/* ==========================================================================
   Apple ID / macOS Lock Screen Login
   ========================================================================== */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(circle at 50% 20%, rgba(35, 55, 95, 0.45) 0%, transparent 65%),
        radial-gradient(circle at 20% 80%, rgba(20, 30, 50, 0.3) 0%, transparent 50%),
        #000000;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: rgba(30, 30, 34, 0.65);
    backdrop-filter: blur(var(--blur-glass)) saturate(190%);
    -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(190%);
    border: 1px solid var(--apple-border);
    box-shadow: 
        var(--apple-specular),
        0 24px 64px -12px rgba(0, 0, 0, 0.85);
    border-radius: 24px;
    padding: 44px 36px 36px;
    text-align: center;
    transition: transform var(--spring-duration) var(--spring-easing);
}

.logo-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid var(--apple-border-light);
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.3),
        0 8px 24px -4px rgba(0, 0, 0, 0.5);
    color: var(--apple-cyan);
    margin-bottom: 18px;
}

.login-header h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 6px;
}

.login-header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-left: 4px;
    letter-spacing: 0.02em;
}

.form-group input {
    width: 100%;
    background: rgba(20, 20, 24, 0.7);
    border: 1px solid var(--apple-border);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    padding: 12px 14px;
    outline: none;
    transition: all var(--spring-duration) var(--spring-easing);
}

.form-group input:focus {
    border-color: var(--apple-blue);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 0 0 3px rgba(10, 132, 255, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    margin: 16px 4px 24px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    margin-right: 8px;
    accent-color: var(--apple-blue);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all 0.25s var(--spring-easing);
    user-select: none;
}

.btn-primary {
    background: linear-gradient(180deg, #1f8eff 0%, #0071e3 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.35),
        0 4px 14px rgba(0, 113, 227, 0.45);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #3399ff 0%, #0a84ff 100%);
    transform: translateY(-1px);
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.45),
        0 6px 20px rgba(0, 113, 227, 0.55);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-block {
    width: 100%;
}

.alert-box {
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.35);
    color: #ff9f9a;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-bottom: 18px;
}

.login-footer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Apple Floating Menu Bar & Controls
   ========================================================================== */

.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Floating Glass Header */
.app-header {
    height: 52px;
    background: rgba(20, 20, 24, 0.70);
    backdrop-filter: blur(var(--blur-glass)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%);
    border-bottom: 1px solid var(--apple-border);
    box-shadow: var(--apple-specular-subtle), 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 100;
    user-select: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-branding {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.brand-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--apple-border-light);
    color: var(--apple-cyan);
    box-shadow: var(--apple-specular);
}

.site-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    box-shadow: var(--apple-specular-subtle);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--text-primary);
}

.site-pill .badge {
    background: rgba(100, 210, 255, 0.15);
    color: var(--apple-cyan);
    border: 1px solid rgba(100, 210, 255, 0.25);
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--apple-green);
    background: rgba(48, 209, 88, 0.12);
    border: 1px solid rgba(48, 209, 88, 0.25);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
}

.live-pulse {
    width: 6px;
    height: 6px;
    background-color: var(--apple-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--apple-green);
    animation: applePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes applePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.25); }
}

/* Apple Segmented Controls */
.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.segmented-control {
    display: flex;
    background: rgba(118, 118, 128, 0.22);
    border: 1px solid var(--apple-border);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-pill);
    padding: 3px;
}

.segmented-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.22s var(--spring-easing);
    user-select: none;
    letter-spacing: -0.01em;
}

.segmented-btn:hover {
    color: #ffffff;
}

.segmented-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 
        0 1px 4px rgba(0, 0, 0, 0.4),
        var(--apple-specular);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.clock-display {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
    padding: 0 4px;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--apple-border);
    box-shadow: var(--apple-specular-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s var(--spring-easing);
}

.glass-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.glass-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Apple Sidebar Rail (visionOS Style Minimal Rail)
   ========================================================================== */

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.icon-rail {
    width: 52px;
    background: rgba(18, 18, 22, 0.60);
    backdrop-filter: blur(var(--blur-subtle));
    border-right: 1px solid var(--apple-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 14px;
    z-index: 90;
    user-select: none;
}

.rail-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s var(--spring-easing);
    position: relative;
}

.rail-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

.rail-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--apple-border);
    box-shadow: var(--apple-specular);
}

.rail-btn.active::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 3px;
    height: 18px;
    background: var(--apple-blue);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px rgba(10, 132, 255, 0.6);
}

/* ==========================================================================
   Viewport & Pagination
   ========================================================================== */

.viewport-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 10px 12px;
}

.pagination-bar {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
    user-select: none;
    margin-bottom: 4px;
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    color: var(--text-primary);
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s var(--spring-easing);
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--apple-border-light);
}

.page-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ==========================================================================
   Apple Camera Grid & Rounded Video Cards
   ========================================================================== */

.camera-grid {
    flex: 1;
    display: grid;
    gap: 10px;
    overflow-y: auto;
    align-content: stretch;
    padding-bottom: 6px;
}

.camera-grid.layout-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: 100%;
}

.camera-grid.layout-2x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    height: 100%;
}

.camera-grid.layout-3x3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    height: 100%;
}

.camera-grid.layout-4x4 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    height: 100%;
}

.camera-grid.layout-all {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: minmax(190px, 1fr);
    overflow-y: auto;
}

/* Glass Camera Card */
.camera-card {
    background: rgba(18, 18, 22, 0.85);
    border: 1px solid var(--apple-border);
    box-shadow: 
        var(--apple-specular-subtle),
        0 8px 24px rgba(0, 0, 0, 0.45);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: 
        transform 0.35s var(--spring-easing),
        box-shadow 0.35s var(--spring-easing),
        border-color 0.25s var(--spring-easing);
    cursor: pointer;
}

.camera-card:hover {
    transform: scale(1.008) translateY(-2px);
    border-color: var(--apple-border-light);
    box-shadow: 
        var(--apple-specular),
        0 14px 36px rgba(0, 0, 0, 0.65);
}

/* Top Floating Glass Badge */
.card-header-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

.camera-title-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(var(--blur-subtle));
    -webkit-backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--apple-specular-subtle), 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.camera-num {
    background: rgba(10, 132, 255, 0.25);
    border: 1px solid rgba(10, 132, 255, 0.4);
    color: var(--apple-cyan);
    padding: 0 5px;
    border-radius: 4px;
    font-size: 9.5px;
    font-family: var(--font-mono);
}

.camera-badge {
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.camera-badge.hd {
    color: var(--apple-cyan);
    border-color: rgba(100, 210, 255, 0.3);
    background: rgba(10, 132, 255, 0.2);
}

/* Video Container & Streams */
.video-viewport {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #060709;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Instant Snapshot Poster Layer (Apple Smooth Preview) */
.camera-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #0d0e12;
    filter: brightness(0.96);
    transform: scale(1.002);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    pointer-events: none;
}

.camera-poster.fade-out {
    opacity: 0;
}

/* Video Player Layer */
video-stream {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent !important;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

video-stream.stream-active {
    opacity: 1;
}

video-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
    background: transparent !important;
}

/* Ocultar barra de controles HTML5 nativos para estética pura Apple */
video-stream video::-webkit-media-controls {
    display: none !important;
}

video-stream video::-webkit-media-controls-enclosure {
    display: none !important;
}

video-stream .info {
    display: none !important;
}

/* Offline Apple State Card */
.camera-offline-overlay {
    position: absolute;
    inset: 0;
    background: rgba(14, 14, 18, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
    z-index: 5;
}

.offline-icon-bubble {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 69, 58, 0.12);
    border: 1px solid rgba(255, 69, 58, 0.25);
    color: var(--apple-red);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.camera-offline-overlay .offline-text {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.camera-offline-overlay .offline-sub {
    font-size: 10.5px;
    color: var(--text-tertiary);
}

/* Bottom Floating Glass Action Capsule */
.card-hover-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 18, 22, 0.75);
    backdrop-filter: blur(var(--blur-subtle));
    -webkit-backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid var(--apple-border-light);
    box-shadow: var(--apple-specular), 0 4px 16px rgba(0, 0, 0, 0.4);
    padding: 3px 6px;
    border-radius: var(--radius-pill);
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.25s var(--spring-easing);
    z-index: 10;
}

.camera-card:hover .card-hover-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--spring-easing);
}

.action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.1);
}

/* ==========================================================================
   Apple TV Theater Focus View & macOS Floating Dock
   ========================================================================== */

.focus-view-container {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(36px);
    display: flex;
    flex-direction: column;
    z-index: 80;
    padding: 14px 18px 18px;
    animation: fadeInFocus 0.3s var(--spring-easing);
}

@keyframes fadeInFocus {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.focus-topbar {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    z-index: 85;
}

.focus-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid var(--apple-border-light);
    box-shadow: var(--apple-specular);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.22s var(--spring-easing);
}

.focus-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.focus-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid var(--apple-border);
    padding: 6px 18px;
    border-radius: var(--radius-pill);
}

.focus-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--blur-subtle));
    border: 1px solid var(--apple-border-light);
    padding: 4px 8px;
    border-radius: var(--radius-pill);
}

/* Theater Viewport */
.focus-video-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: 20px;
    border: 1px solid var(--apple-border);
    box-shadow: 
        var(--apple-specular),
        0 20px 80px rgba(0, 0, 0, 0.95);
    overflow: hidden;
    padding: 8px;
}

.focus-aspect-box {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    max-width: calc((100vh - 220px) * 16 / 9);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
}

.focus-aspect-box video-stream,
.focus-aspect-box video-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
}

.focus-nav-prev, .focus-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(25, 25, 30, 0.65);
    backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--apple-border-light);
    box-shadow: var(--apple-specular), 0 8px 24px rgba(0, 0, 0, 0.6);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--spring-easing);
    z-index: 82;
}

.focus-nav-prev { left: 18px; }
.focus-nav-next { right: 18px; }

.focus-nav-prev:hover, .focus-nav-next:hover {
    background: var(--apple-blue);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 30px rgba(10, 132, 255, 0.5);
}

/* macOS Style Floating Camera Dock */
.focus-bottom-strip {
    margin-top: 14px;
    height: 76px;
    background: rgba(28, 28, 34, 0.65);
    backdrop-filter: blur(var(--blur-glass)) saturate(180%);
    border: 1px solid var(--apple-border-light);
    box-shadow: var(--apple-specular), 0 16px 40px rgba(0, 0, 0, 0.7);
    border-radius: 22px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    overflow-x: auto;
    z-index: 85;
}

.strip-item {
    height: 56px;
    min-width: 104px;
    background: rgba(20, 20, 24, 0.65);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s var(--spring-easing);
    user-select: none;
}

.strip-item:hover {
    border-color: var(--apple-border-light);
    transform: translateY(-2px);
    background: rgba(35, 35, 42, 0.85);
}

.strip-item.active {
    border-color: var(--apple-blue);
    background: rgba(10, 132, 255, 0.2);
    box-shadow: 
        0 0 0 1px var(--apple-blue),
        0 4px 16px rgba(10, 132, 255, 0.4);
}

.strip-item .strip-name {
    font-size: 10.5px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.strip-item .strip-status {
    font-size: 9.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
}

.strip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--apple-green);
    box-shadow: 0 0 6px var(--apple-green);
}

.strip-dot.offline {
    background: var(--apple-red);
    box-shadow: 0 0 6px var(--apple-red);
}

/* ==========================================================================
   Apple Native Dialogs & Side Panels
   ========================================================================== */

/* Native dialog styling conforming to Modern Web Guidance */
dialog:modal {
    overscroll-behavior: contain;
    border: none;
    background: transparent;
    padding: 0;
    margin: auto;
    color: inherit;
    max-width: 90vw;
}

dialog::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* System Settings / Hardware Modal */
.apple-modal-card {
    width: 540px;
    background: rgba(32, 32, 36, 0.85);
    backdrop-filter: blur(var(--blur-glass)) saturate(190%);
    border: 1px solid var(--apple-border-light);
    box-shadow: var(--apple-specular), 0 32px 80px rgba(0, 0, 0, 0.8);
    border-radius: 24px;
    overflow: hidden;
    animation: modalPop 0.3s var(--spring-easing);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    height: 52px;
    border-bottom: 1px solid var(--apple-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.modal-body {
    padding: 22px;
    max-height: 70vh;
    overflow-y: auto;
}

.diag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.diag-item {
    background: rgba(20, 20, 24, 0.6);
    border: 1px solid var(--apple-border);
    box-shadow: var(--apple-specular-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.diag-item .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.diag-item .value {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.apple-info-banner {
    background: rgba(10, 132, 255, 0.1);
    border: 1px solid rgba(10, 132, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 12px;
    color: #d0e7ff;
    line-height: 1.5;
}

/* Side Drawer */
.drawer-panel {
    position: fixed;
    top: 52px;
    bottom: 0;
    left: 52px;
    width: 330px;
    background: rgba(25, 25, 30, 0.85);
    backdrop-filter: blur(var(--blur-glass));
    border-right: 1px solid var(--apple-border);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    z-index: 205;
    animation: slideInDrawer 0.3s var(--spring-easing);
}

@keyframes slideInDrawer {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.drawer-header {
    height: 52px;
    border-bottom: 1px solid var(--apple-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}

.drawer-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.drawer-search {
    padding: 12px 18px;
    border-bottom: 1px solid var(--apple-border);
}

.drawer-search input {
    width: 100%;
    background: rgba(15, 15, 18, 0.7);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-pill);
    color: #ffffff;
    padding: 8px 14px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s var(--spring-easing);
}

.drawer-search input:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

.drawer-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.drawer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--spring-easing);
    margin-bottom: 4px;
}

.drawer-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.drawer-item.active {
    background: rgba(10, 132, 255, 0.18);
    border-left: 3px solid var(--apple-blue);
}

/* Custom Minimalist Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Apple Multi-Site Toolbar & Instant Search Bar (v2.1.0)
   ========================================================================== */

.site-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(20, 20, 24, 0.65);
    backdrop-filter: blur(var(--blur-glass)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    z-index: 50;
    flex-wrap: wrap;
    box-shadow: var(--apple-specular-subtle), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.site-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-tabs::-webkit-scrollbar {
    display: none;
}

.site-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s var(--spring-easing);
    user-select: none;
    white-space: nowrap;
}

.site-pill-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.site-pill-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        var(--apple-specular);
}

.badge-count {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-tertiary);
}

.site-pill-btn.active .badge-count {
    background: var(--apple-blue);
    color: #ffffff;
}

.device-tabs {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
}

.device-tabs::-webkit-scrollbar {
    display: none;
}

.device-pill-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-tertiary);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 10.5px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.device-pill-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.device-pill-btn.active {
    background: rgba(10, 132, 255, 0.22);
    color: #64d2ff;
    border-color: var(--apple-blue);
    box-shadow: 0 0 10px rgba(10, 132, 255, 0.3);
}

.subbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.toggle-live-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--apple-border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s var(--spring-easing);
    user-select: none;
    white-space: nowrap;
}

.toggle-live-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.toggle-pill-track {
    width: 24px;
    height: 13px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    position: relative;
    transition: background 0.22s ease;
    display: inline-block;
}

.toggle-pill-thumb {
    width: 9px;
    height: 9px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.22s var(--spring-easing), background 0.22s ease;
}

.toggle-live-btn.active {
    background: rgba(48, 209, 88, 0.15);
    border-color: rgba(48, 209, 88, 0.45);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(48, 209, 88, 0.2);
}

.toggle-live-btn.active .toggle-pill-track {
    background: var(--apple-green);
}

.toggle-live-btn.active .toggle-pill-thumb {
    transform: translateX(11px);
    background: #ffffff;
}

.search-capsule {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    width: 250px;
    transition: all 0.25s var(--spring-easing);
    color: var(--text-secondary);
}

.search-capsule:focus-within {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
    width: 300px;
    color: #ffffff;
}

.search-capsule input {
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 11.5px;
    font-family: inherit;
    width: 100%;
}

.search-capsule input::placeholder {
    color: var(--text-tertiary);
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    line-height: 1;
}

.clear-search-btn:hover {
    color: #ffffff;
}

/* Site Badges in Cards */
.site-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
}

.site-tag.site-ARI {
    background: rgba(10, 132, 255, 0.3);
    color: #70c4ff;
    border: 1px solid rgba(10, 132, 255, 0.45);
}

.site-tag.site-3PT {
    background: rgba(191, 90, 242, 0.3);
    color: #df9eff;
    border: 1px solid rgba(191, 90, 242, 0.45);
}

.site-tag.site-SSP {
    background: rgba(48, 209, 88, 0.3);
    color: #72ff97;
    border: 1px solid rgba(48, 209, 88, 0.45);
}

.cam-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   Apple Theater Playback Studio (Reprodução Histórica & Timeline 24h)
   ========================================================================== */

.playback-view-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    background: #000000;
    z-index: 60;
    padding: 12px;
    gap: 10px;
    overflow: hidden;
}

.playback-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(22, 22, 26, 0.75);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--apple-border);
    flex-wrap: wrap;
    gap: 10px;
}

.playback-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.playback-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.playback-cam-picker,
.playback-date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.apple-glass-select,
.apple-glass-date {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--apple-border);
    color: #ffffff;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 11.5px;
    outline: none;
    transition: all 0.2s var(--spring-easing);
}

.apple-glass-select:focus,
.apple-glass-date:focus {
    border-color: var(--apple-blue);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.apple-glass-select optgroup {
    background: #1c1c1e;
    color: var(--apple-blue);
}

.apple-glass-select option {
    background: #2c2c2e;
    color: #ffffff;
}

.date-quick-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.date-quick-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.date-quick-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

/* Playback Video Viewport */
.playback-video-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    background: #050508;
    border-radius: var(--radius-lg);
    border: 1px solid var(--apple-border);
    overflow: hidden;
}

.playback-player-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playback-stream-target {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

/* Caixa de Proporção Inteligente de Playback (Corrige Anamorfismo 1080N e Widescreen) */
.playback-aspect-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    transition: aspect-ratio 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.playback-aspect-box.aspect-16-9 {
    aspect-ratio: 16 / 9;
    max-width: calc((100vh - 270px) * 16 / 9);
    max-height: 100%;
    width: 100%;
}

.playback-aspect-box.aspect-16-9 video-stream,
.playback-aspect-box.aspect-16-9 video-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important; /* Estica 960x1080 (1080N) para 16:9 widescreen real */
}

.playback-aspect-box.aspect-4-3 {
    aspect-ratio: 4 / 3;
    max-width: calc((100vh - 270px) * 4 / 3);
    max-height: 100%;
    width: 100%;
}

.playback-aspect-box.aspect-4-3 video-stream,
.playback-aspect-box.aspect-4-3 video-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
}

.playback-aspect-box.aspect-auto {
    width: 100%;
    height: 100%;
}

.playback-aspect-box.aspect-auto video-stream,
.playback-aspect-box.aspect-auto video-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.playback-stream-target video-stream {
    width: 100%;
    height: 100%;
    max-height: 100%;
    opacity: 1 !important;
}

/* Seletor de Proporção (Aspect Ratio Glass Pills) */
.aspect-ratio-selector {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-pill);
    padding: 2px;
    gap: 2px;
}

.aspect-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
}

.aspect-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.aspect-btn.active {
    background: var(--apple-blue);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(10, 132, 255, 0.4);
}

.playback-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 24px;
}

.playback-placeholder p {
    font-size: 13px;
    max-width: 320px;
}

.playback-osd-overlay {
    position: absolute;
    top: 14px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.osd-cam-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.osd-clock {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 15px;
    font-weight: 700;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* Floating Playback Transport Bar */
.playback-transport-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: rgba(22, 22, 26, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--apple-border);
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transport-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--apple-border);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s var(--spring-easing);
}

.transport-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.06);
}

.transport-btn.play-btn {
    width: 42px;
    height: 42px;
    background: var(--apple-blue);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
}

.transport-btn.play-btn:hover {
    background: #2b95ff;
    transform: scale(1.08);
}

.transport-btn .btn-subtext {
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    margin-top: -2px;
}

.transport-time-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.transport-time-display .cur-time {
    color: #ffffff;
    font-weight: 700;
}

.transport-time-display .sep {
    margin: 0 4px;
    opacity: 0.4;
}

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

/* Apple 24h Interactive Timeline Track */
.playback-timeline-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(18, 18, 22, 0.85);
    backdrop-filter: blur(25px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--apple-border);
}

.timeline-ruler {
    display: flex;
    justify-content: space-between;
    font-size: 9.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-tertiary);
    padding: 0 4px;
    user-select: none;
}

.timeline-track-container {
    height: 44px;
    position: relative;
    background: rgba(10, 10, 12, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    cursor: crosshair;
    user-select: none;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.timeline-track-bg {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 4.1666%
    );
}

.timeline-segments-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.timeline-segment {
    position: absolute;
    top: 6px;
    bottom: 6px;
    border-radius: 3px;
    transition: opacity 0.15s;
}

.timeline-segment.motion {
    background: #ff9f0a;
    box-shadow: 0 0 6px rgba(255, 159, 10, 0.5);
}

.timeline-segment.continuous {
    background: #30d158;
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.5);
}

.timeline-hover-needle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.7);
    pointer-events: none;
    z-index: 15;
}

.timeline-hover-needle .needle-tooltip {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    font-size: 10px;
    font-family: ui-monospace, monospace;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff453a;
    box-shadow: 0 0 10px rgba(255, 69, 58, 0.8);
    pointer-events: none;
    z-index: 20;
    transition: left 0.1s linear;
}

.timeline-playhead .playhead-cap {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: #ff453a;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.timeline-playhead .playhead-badge {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff453a;
    color: #ffffff;
    font-size: 8.5px;
    font-family: ui-monospace, monospace;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

.timeline-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-legend {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timeline-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.timeline-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.timeline-legend .dot-continuous { background: #30d158; }
.timeline-legend .dot-motion { background: #ff9f0a; }
.timeline-legend .dot-empty { background: rgba(255, 255, 255, 0.15); }

/* Export Modal Specifics */
.export-modal-card {
    max-width: 480px;
}

.export-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.export-form-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.export-form-grid label {
    display: block;
    font-size: 11.5px;
    color: var(--text-tertiary);
    margin-bottom: 5px;
}

.apple-input-readonly {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--apple-border);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    width: 100%;
}

.export-action-row {
    display: flex;
    justify-content: flex-end;
}

/* =========================================================================
   Apple Glass Users & Credentials Management Modal
   ========================================================================= */

.users-modal-card {
    max-width: 840px;
    width: 90vw;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

.users-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.users-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apple-border);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    flex: 1;
    max-width: 320px;
}

.users-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 12px;
    width: 100%;
}

.users-table-container {
    background: rgba(15, 15, 18, 0.5);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 380px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.apple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.apple-table th {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--apple-border);
}

.apple-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

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

.user-cell-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-cell-name {
    font-weight: 600;
    color: #ffffff;
}

.user-cell-username {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(175, 82, 222, 0.2);
    border: 1px solid rgba(175, 82, 222, 0.4);
    color: #d17bff;
}

.role-badge.operador {
    background: rgba(10, 132, 255, 0.2);
    border: 1px solid rgba(10, 132, 255, 0.4);
    color: var(--apple-cyan);
}

.role-badge.visualizador {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.status-indicator-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
}

.status-indicator-pill .indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator-pill.active {
    color: var(--apple-green);
}
.status-indicator-pill.active .indicator-dot {
    background: var(--apple-green);
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.6);
}

.status-indicator-pill.inactive {
    color: var(--text-tertiary);
}
.status-indicator-pill.inactive .indicator-dot {
    background: var(--text-tertiary);
}

.sites-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.site-badge-mini {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 600;
}

.action-buttons-group {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.btn-table-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-table-action:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-table-action.danger:hover {
    background: rgba(255, 69, 58, 0.25);
    border-color: rgba(255, 69, 58, 0.5);
    color: #ff453a;
}

/* User Form Cards */
.user-form-card, .user-pwd-card {
    background: rgba(22, 22, 28, 0.95);
    border: 1px solid var(--apple-border-light);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-top: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.user-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-form-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.btn-text-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}
.btn-text-close:hover {
    color: #fff;
}


