/* ===== Variables CSS (Design Tokens) ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Brand Colors (Preserved) */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Light Mode */
    --bg-main: #f8fafc;
    --surface: #ffffff;
    --surface-rgb: 255, 255, 255;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --border-light: rgba(226, 232, 240, 0.5);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
    
    /* Geometry & Motion */
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    /* Layout */
    --sidebar-width: 300px;
    --sidebar-collapsed-width: 88px;
}

[data-theme="dark"] {
    /* Dark Mode overrides */
    --bg-main: #020617; /* Slate 950 */
    --surface: #0f172a; /* Slate 900 */
    --surface-rgb: 15, 23, 42;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #1e293b;
    --border-light: rgba(30, 41, 59, 0.5);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    --shadow-glow: 0 0 30px rgba(37, 99, 235, 0.25);
    
    --background: var(--bg-main); /* Fallback */
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ===== Utilities ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* Responsive table columns */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* ===== Monitor Dashboard Specific ===== */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.monitor-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.monitor-card:hover {
    box-shadow: var(--shadow-lg);
}

.monitor-card.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.monitor-card.primary h2, 
.monitor-card.primary p,
.monitor-card.primary .label {
    color: rgba(255, 255, 255, 0.9);
}

.monitor-card.primary .value {
    color: white;
}

.monitor-card h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.attendance-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.attendance-status-banner {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg-main);
    text-align: center;
    font-weight: 600;
}

.btn-large {
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.progress-container {
    margin-top: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.progress-bar-large {
    height: 12px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.monitor-card.primary .progress-bar-large {
    background: rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.5s ease-out;
}

.monitor-card.primary .progress-fill {
    background: white;
}

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    font-weight: 600;
}

.log-duration {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Glass Panel Mixin */
.glass-panel {
    background: rgba(var(--surface-rgb), 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}

/* ===== Theme Toggle ===== */
.theme-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 9999;
    transition: var(--transition);
}
.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}

/* ===== Login ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 10;
}

.login-box {
    background: rgba(var(--surface-rgb), 0.65) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 32px 30px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(30px);
    opacity: 0;
}

@keyframes slideUpFade {
    to { opacity: 1; transform: translateY(0); }
}

.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img, .login-logo svg { 
    width: 60px; height: 60px; 
    filter: drop-shadow(0 4px 6px rgba(37,99,235,0.3));
    margin-bottom: 12px;
}
.login-logo h1 { font-size: 1.5rem; color: var(--text-primary); }
.login-logo p  { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { 
    display: block; 
    margin-bottom: 6px; 
    color: var(--text-primary); 
    font-weight: 600; 
    font-size: 0.9rem; 
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-primary);
    min-height: 42px;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
    transform: translateY(-1px);
}
.form-group input::placeholder { color: var(--text-secondary); opacity: 0.6; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 46px;
    position: relative;
    overflow: hidden;
    gap: 10px;
}
.btn::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.btn:hover::after { opacity: 1; }

.btn-primary { 
    background: var(--primary); 
    color: white; 
    width: 100%; 
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}
.btn-primary:hover { 
    background: var(--primary-dark); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23); 
}
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger    { background: var(--danger); color: white; box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39); }
.btn-danger:hover { transform: translateY(-2px); }
.btn-success   { background: var(--success); color: white; box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39); }

/* ===== Alerts ===== */
.alert { 
    padding: 14px 20px; 
    border-radius: var(--radius); 
    margin-bottom: 24px; 
    animation: fadeInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-error   { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

/* ===== Dashboard Layout ===== */
.dashboard-layout { display: flex; min-height: 100vh; background: var(--bg-main); }

/* ===== Dashboard Visual Refresh (Phase 1) ===== */
.dashboard-layout {
    background:
        radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.11), transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(56, 189, 248, 0.09), transparent 32%),
        radial-gradient(circle at 52% 100%, rgba(147, 197, 253, 0.08), transparent 38%),
        var(--bg-main);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, rgba(242, 246, 255, 0.92) 0%, rgba(236, 242, 255, 0.88) 100%);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}
.sidebar-logo img {
    border-radius: 8px;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}
.sidebar-logo svg { width: 32px; height: 32px; color: var(--primary); flex-shrink: 0; }
.sidebar-logo h2  { font-family: var(--font-heading); font-size: 1.1rem; color: var(--text-primary); white-space: nowrap; }

.nav-menu { list-style: none; flex: 1; }
.nav-menu li { margin-bottom: 4px; }
.nav-menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}
.nav-menu a::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--primary); transform: scaleY(0); transition: transform 0.3s;
}
.nav-menu a:hover,
.nav-menu a.active { 
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border-color: rgba(99, 102, 241, 0.24);
    transform: translateX(2px);
}
.nav-menu a.active::before { transform: scaleY(1); }

/* Mantener estilo neutro en sección Asignación de Laboratorios */
#menuHorario a:hover,
#menuHorario a.active {
    background: rgba(37,99,235,0.08);
    color: var(--primary);
    border-color: transparent;
    transform: none;
}
.nav-menu svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-menu a span { white-space: nowrap; }

.sidebar-footer { padding-top: 20px; border-top: 1px solid var(--border-light); }

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-logout:hover { 
    background: rgba(239, 68, 68, 0.1); 
    border-color: var(--danger); 
    transform: translateY(-1px);
}

/* Collapsible Desktop */
.sidebar.collapsed { width: var(--sidebar-collapsed-width); padding: 24px 16px; }
.sidebar.collapsed .sidebar-logo h2,
.sidebar.collapsed .nav-menu a span,
.sidebar.collapsed .btn-logout span { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; gap: 0; padding-bottom: 24px; }
.sidebar.collapsed .nav-menu a { justify-content: center; padding: 14px; }
.sidebar.collapsed .btn-logout { justify-content: center; padding: 14px; gap: 0; font-size: 0; }
.sidebar.collapsed .btn-logout svg { width: 22px; height: 22px; margin: 0; }
.sidebar.collapsed + .main-content { margin-left: var(--sidebar-collapsed-width); }

.btn-collapse-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: var(--transition);
    color: var(--text-secondary);
}
.btn-collapse-sidebar:hover { background: rgba(37,99,235,0.08); color: var(--primary); border-color: var(--primary); }
.sidebar.collapsed .btn-collapse-sidebar { padding: 10px 0; }
.btn-collapse-sidebar svg { width: 22px; height: 22px; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.sidebar.collapsed .btn-collapse-sidebar svg { transform: rotate(180deg); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px 48px;
    transition: var(--transition);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
    background: rgba(241, 246, 255, 0.78);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.header h1 { font-size: 1.6rem; color: var(--text-primary); letter-spacing: -0.02em; margin-bottom: 4px; }
.header p  { color: var(--text-secondary); font-size: 0.9rem; }
.menu-toggle { display: none; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.stat-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-5deg); }
.stat-icon.blue   { background: rgba(37,99,235,0.12); color: var(--primary); }
.stat-icon.green  { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon svg    { width: 28px; height: 28px; }
.stat-info { position: relative; z-index: 1; }
.stat-info { display: flex; flex-direction: column; }
.stat-info h3 { font-size: 1.8rem; color: var(--text-primary); margin: 0; line-height: 1.2; font-weight: 800; }
.stat-info p  { color: var(--text-secondary); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin: 2px 0 0 0; }
.stat-info .sub-text { font-size: 0.75rem; color: var(--text-secondary); margin-top: 6px; font-weight: 500; }

/* Cards & Tables */
.admin-card, .attendance-card, .form-card, .table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    transition: var(--transition);
}
.table-container { overflow-x: auto; }

.admin-card { padding: 32px; }
.form-card { padding: 40px; }
.form-card h2, .admin-card h2, .attendance-card h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 16px;
    background: var(--surface);
}
.table-header h2 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.search-box { display: flex; align-items: center; gap: 12px; }
.search-box input { 
    border-radius: 12px; 
    padding: 10px 18px; 
    background: var(--bg-main); 
    border: 1px solid var(--border); 
    font-size: 0.95rem;
    min-width: 280px;
    transition: var(--transition);
}
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: var(--surface);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead { background: var(--bg-main); }
th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 800;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}
tbody tr { transition: var(--transition); }
tbody tr:nth-child(even) { background: var(--bg-main); }
tbody tr:hover { background: rgba(var(--primary-rgb, 37, 99, 235), 0.08); }

.header .btn.btn-primary {
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

[data-theme="dark"] .dashboard-layout {
    background:
        radial-gradient(circle at 12% 10%, rgba(59, 130, 246, 0.16), transparent 35%),
        radial-gradient(circle at 92% 10%, rgba(14, 165, 233, 0.12), transparent 32%),
        var(--bg-main);
}

[data-theme="dark"] .sidebar,
[data-theme="dark"] .header,
[data-theme="dark"] .admin-card,
[data-theme="dark"] .attendance-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .stat-card {
    border-color: rgba(148, 163, 184, 0.18);
    background: var(--surface);
}

.status-badge {
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.status-active   { background: rgba(16,185,129,0.15); color: var(--success); }
.status-inactive { background: rgba(239,68,68,0.15); color: var(--danger); }

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: var(--transition);
}
.btn-edit   { background: rgba(37,99,235,0.1); color: var(--primary); }
.btn-edit:hover { background: var(--primary); color: white; }
.btn-delete { background: rgba(239,68,68,0.1); color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: white; }

/* Grid Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-row.triple { grid-template-columns: 2fr 1fr 1fr; }
.form-group.full-width { grid-column: 1 / -1; }

.btn-group { display: flex; gap: 12px; margin-top: 24px; }

/* Collapsible Form Animation */
.form-toggle-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 16px 24px; background: rgba(var(--surface-rgb), 0.5);
    border-radius: var(--radius); transition: var(--transition);
    border: 1px solid var(--border);
    font-size: 1.1rem;
    font-weight: 700;
}
.form-toggle-header:hover { 
    background: var(--bg-main); 
    border-color: var(--primary-light);
    transform: translateX(4px);
}
.toggle-arrow {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%; background: var(--surface);
    box-shadow: var(--shadow-sm); transition: var(--transition); border: 1px solid var(--border-light);
}
.toggle-arrow svg { width: 18px; height: 18px; color: var(--primary); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.toggle-arrow.collapsed svg { transform: rotate(0deg); }
.toggle-arrow.expanded svg  { transform: rotate(180deg); }
.form-body { overflow: hidden; transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.4s; max-height: 2000px; opacity: 1; margin-top: 24px; }
.form-body.hidden { max-height: 0; opacity: 0; margin-top: 0; }

/* Mobile Sidebar Drawer Overlay */
.sidebar-overlay { 
    display: none; position: fixed; inset: 0; background: rgba(2,6,23,0.6); 
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 99; transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; }

/* Modal Responsive */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2,6,23,0.7); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-content {
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 600px;
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
    overflow: hidden;
}
@keyframes zoomIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-header { 
    padding: 24px; 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.4rem; color: var(--text-primary); }

.modal-close { 
    background: var(--bg-main); 
    color: var(--text-secondary); 
    border: 1px solid var(--border); 
    height: 36px; 
    width: 36px; 
    border-radius: 50%; 
    cursor: pointer; 
    transition: var(--transition); 
    display:flex; 
    align-items:center; 
    justify-content:center;
    font-size: 20px;
}
.modal-close:hover { 
    background: rgba(239,68,68,0.1); 
    color: var(--danger); 
    border-color: var(--danger);
    transform: rotate(90deg); 
}

/* Responsive Adjustments */
@media (max-width: 1023px) {
    .menu-toggle {
        display: flex !important; align-items: center; justify-content: center;
        background: var(--surface); color: var(--text-primary); border: 1px solid var(--border);
        padding: 8px; border-radius: var(--radius-sm);
    }
    .menu-toggle:hover { background: var(--bg-main); }
    .sidebar { transform: translateX(-100%); width: 280px !important; box-shadow: var(--shadow-lg); }
    .sidebar.active { transform: translateX(0); }
    .sidebar.collapsed + .main-content { margin-left: 0 !important; }
    .main-content { margin-left: 0 !important; padding: 20px 16px; }
    .form-row, .form-row.triple { grid-template-columns: 1fr; gap: 12px; }
    .form-card, .admin-card { padding: 20px; }
    .table-container { overflow-x: auto; }
    table { min-width: 700px; }
    .header h1 { font-size: 1.5rem; }
    .theme-toggle-btn { bottom: 16px; right: 16px; }
}

@media (max-width: 639px) {
    .login-box { padding: 28px 20px; }
    .stats-grid { grid-template-columns: 1fr; gap: 16px;}
    .search-box { width: 100%; }
    .search-box input { width: 100%; }
    .btn-group { flex-direction: column; }
    .action-btn { padding: 6px 10px; font-size: 0.75rem;}
}

/* ===== Custom Checkmarks & Horario (Registro) ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    user-select: none;
}
.checkbox-label input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark {
    height: 20px; width: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex; justify-content: center; align-items: center;
    transition: var(--transition);
}
.checkbox-label:hover input ~ .checkmark { border-color: var(--primary); }
.checkbox-label input:checked ~ .checkmark { background-color: var(--primary); border-color: var(--primary); }
.checkmark:after {
    content: ""; display: none; width: 5px; height: 10px;
    border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-bottom: 2px;
}
.checkbox-label input:checked ~ .checkmark:after { display: block; }

.horario-grupo {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 16px; padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-sm); border: 1px solid var(--border-light);
}
.horario-header { display: flex; justify-content: space-between; align-items: center; }
.horario-inputs { display: flex; align-items: center; gap: 12px; }
.time-input {
    padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-main);
    color: var(--text-primary); font-size: 0.9rem; font-family: var(--font-body);
}

@media (max-width: 639px) {
    .horario-inputs { flex-direction: column; align-items: stretch; }
}
