/* --- TIPOGRAFÍA Y COLORES (MODERNO) --- */
:root {
    --primary: #1e3a8a;
    /* Azul corporativo profundo */
    --primary-light: #3b82f6;
    --secondary: #475569;
    /* Azul brillante para acentos */
    --accent: #0284c7;
    /* Azul muy claro para fondos tenues */
    --background: #f8fafc;
    --bg-body: #f8fafc;
    /* Gris muy claro (fondo general) */
    --surface: #ffffff;
    --bg-card: #ffffff;
    /* Blanco para tarjetas y contenedores */
    --text-main: #334155;
    --text-color: #334155;
    /* Gris muy oscuro casi negro */
    --text-muted: #64748b;
    /* Gris medio para textos secundarios */
    --success: #10b981;
    /* Verde esmeralda (Presente) */
    --danger: #ef4444;
    /* Rojo coral (Ausente) */
    --warning: #f59e0b;
    /* Naranja vibrante (Alertas) */
    --info: #0ea5e9;
    /* Azul claro (Justificada) */
    --border: #e2e8f0;
    /* Gris claro para bordes */
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Niveles */
    --prees-color: #ea580c;
    --prim-color: #16a34a;
    --bach-color: #7c3aed;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Rules with transitions for Dark Mode */
* {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(40px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* General transitions to elements for smooth theming */
.action-panel,
.top-bar,
.daily-widget-container,
.class-card,
.modal,
.table-container,
header,
input,
select,
textarea,
.data-table th,
.styled-table th,
.data-table td,
.styled-table td,
.tab-btn,
.level-btn,
#login,
.stat-card {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* --- ANIMACIONES --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

/* --- HEADER --- */
header {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

header h2 {
    margin: 5px 0 0;
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* --- LOADING & NOTIFICATIONS --- */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--primary);
    font-weight: bold;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* NOTIFICACION: Z-INDEX ALTO */
#notification {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--primary);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    /* Siempre encima de modales */
    animation: slideIn 0.3s ease-out;
}

.notif-warning {
    background-color: var(--danger) !important;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- LOGIN --- */
#login {
    max-width: 400px;
    margin: 40px auto;
    background: white;
    padding: 35px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid #e2e8f0;
}

.error-msg {
    color: var(--danger);
    font-weight: 500;
    margin-top: 15px;
    min-height: 20px;
    font-size: 0.9rem;
}

.login-header h2 {
    color: var(--primary);
    margin: 10px 0 25px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.2rem;
}

.input-wrapper input {
    padding-left: 40px !important;
}

/* --- INPUTS & BUTTONS --- */
input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.2s;
    background: #f8fafc;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    color: #64748b;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    margin: 0;
}

.password-toggle:hover {
    color: var(--primary);
    background: transparent;
}

.password-toggle:focus {
    outline: none;
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.password-toggle i {
    transition: transform 0.2s ease;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 16px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: #0369a1;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-text {
    background: transparent;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-text i {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-text:hover {
    color: var(--primary);
    background-color: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-text:hover i {
    transform: scale(1.15) rotate(-5deg);
}

.btn-text:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- GRID INSCRIPCION MEJORADO --- */
.inscripcion-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
    padding: 10px 0;
}

.grid-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.full-width {
    grid-column: 1 / -1;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

@media (max-width: 500px) {
    .inscripcion-grid {
        grid-template-columns: 1fr;
    }
}

/* --- TOP BAR & NAV --- */
.top-bar {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
    margin-bottom: 25px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    background: white;
    color: #64748b;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
    flex: 1 1 auto;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(30, 58, 138, 0.2);
}

.badge {
    background: var(--danger);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 5px;
}

/* --- PANELES --- */
.action-panel {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.action-panel h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.1rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- CARDS & DASHBOARD --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* --- DASHBOARD DAILY WIDGET --- */
.mt-30 {
    margin-top: 30px;
}

.daily-widget {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.daily-widget:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}
.daily-header {
    padding: 15px 20px;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.daily-header span {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
}
.bg-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #334155 100%);
}

.daily-table {
    width: 100%;
    border-collapse: collapse;
}
.daily-table th {
    background: #f8fafc;
    color: var(--text-muted);
    padding: 12px 15px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    text-align: left;
}
.daily-table td {
    padding: 15px 20px;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
    font-size: 1.05rem;
}
.daily-table tbody tr:last-child td {
    border-bottom: none;
}

.obs-list {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
}
.obs-list::-webkit-scrollbar {
    width: 6px;
}
.obs-list::-webkit-scrollbar-track {
    background: transparent;
}
.obs-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.obs-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.obs-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
}
.obs-card:hover {
    border-color: #cbd5e1;
}
.obs-card strong {
    display: block;
    color: var(--primary);
    margin-bottom: 6px;
    font-size: 0.95rem;
}
.obs-card p {
    margin: 0;
    color: var(--secondary);
}
.obs-card.alert {
    background: #fef2f2;
    border-color: #fca5a5;
    border-left: 4px solid var(--danger);
}
.obs-card.alert strong {
    color: var(--danger);
}

.dashboard-section-title h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary);
}

/* --- DAILY WIDGET CONTROL --- */
.daily-widget-container {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.daily-header-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
}

.daily-header-control span {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input-highlight {
    border: 2px solid var(--accent) !important;
    background: #f0f9ff;
    font-weight: bold;
    color: var(--primary);
    width: auto;
}

/* Cajas resumen P/A */
.stats-summary-box {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.summary-item {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.summary-item.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.summary-item.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.summary-item i {
    font-size: 2rem;
    margin-bottom: 5px;
    opacity: 0.8;
}

.summary-item .val {
    font-size: 2rem;
    font-weight: bold;
}

.summary-item .lbl {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Tabla Estilizada */
.styled-table {
    width: 100%;
    border-collapse: collapse;
}

.styled-table th {
    background: #f8fafc;
    color: #64748b;
    padding: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.styled-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 1.1rem;
}

.status-pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.status-pill.success {
    background: #d1fae5;
    color: #047857;
}

.status-pill.danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* --- OTHER TABLES --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table-container {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
}

/* --- CLASES CARDS --- */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.class-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    border-top: 4px solid #ccc;
}

.class-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.class-card h4 {
    color: var(--primary);
    margin: 0 0 10px 0;
}

.class-card.prees {
    border-top-color: var(--prees-color);
}

.class-card.prim {
    border-top-color: var(--prim-color);
}

.class-card.bach {
    border-top-color: var(--bach-color);
}

/* --- NIVELES BUTTONS --- */
.level-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.level-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 20px;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.level-btn.active {
    color: white;
    border-color: transparent;
}

.level-btn.prees.active {
    background: var(--prees-color);
}

.level-btn.prim.active {
    background: var(--prim-color);
}

.level-btn.bach.active {
    background: var(--bach-color);
}

/* --- MULTI SELECT & CHIPS --- */
.multi-select-box {
    border: 1px solid #cbd5e1;
    padding: 5px;
    border-radius: 8px;
    min-height: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    background: #f8fafc;
}

.chip {
    background: #e0f2fe;
    color: #0284c7;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chip .remove {
    cursor: pointer;
    font-weight: bold;
}

.search-box-container {
    position: relative;
}

.custom-dropdown {
    max-height: 150px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.custom-dropdown div {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
}

.custom-dropdown div:hover {
    background: #f1f5f9;
}

/* --- MODAL --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}

/* --- FORM ROW RESPONSIVE --- */
.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
}

@media(max-width: 600px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tab-btn {
        width: 100%;
    }
}

/* --- ASISTENCIA --- */
.btn-check {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #94a3b8;
}

.btn-check:hover {
    background: #f1f5f9;
}

.btn-check.btn-presente.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-check.btn-emergencia.active {
    background: #d97706;
    color: white;
    border-color: #d97706;
}

.btn-check.btn-jubilado.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.btn-check.btn-ausente.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-check.btn-aj.active {
    background: #0ea5e9;
    /* Sky blue */
    color: white;
    border-color: #0ea5e9;
}

/* --- ALUMNO RETIRADO (SOFT DELETE) --- */
.alumno-retirado {
    opacity: 0.55;
    background: #f9fafb !important;
    position: relative;
    transition: opacity 0.3s ease;
}

.alumno-retirado:hover {
    opacity: 0.75;
}

.alumno-retirado td {
    color: #9ca3af !important;
}

.badge-retirado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #dc2626;
    background: #fef2f2;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
    letter-spacing: 0.5px;
    position: absolute;
    bottom: 2px;
    left: 5px;
    white-space: nowrap;
    animation: pulseRetirado 2s ease-in-out infinite;
}

.badge-retirado i {
    font-size: 0.75rem;
}

@keyframes pulseRetirado {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Dark mode support */
[data-theme="dark"] .alumno-retirado {
    background: #1e1e1e !important;
}

[data-theme="dark"] .badge-retirado {
    background: #450a0a;
    border-color: #991b1b;
    color: #fca5a5;
}

[data-theme="dark"] .alumno-retirado td {
    color: #6b7280 !important;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 30px 0;
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: auto;
}

.lapso-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
}

/* --- NUEVOS ESTILOS DASHBOARD --- */
.level-separator {
    margin: 25px 0 10px 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prees-text {
    color: var(--prees-color);
}

.prim-text {
    color: var(--prim-color);
}

.bach-text {
    color: var(--bach-color);
}

.global-text {
    color: var(--primary);
}

.prees-bg {
    background: var(--prees-color);
}

.prim-bg {
    background: var(--prim-color);
}

.bach-bg {
    background: var(--bach-color);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card.total {
    background: white;
    border-color: #cbd5e1;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-card .icon-box {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .info {
    display: flex;
    flex-direction: column;
}

.stat-card .info small {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .info strong {
    font-size: 1.4rem;
    color: #334155;
    line-height: 1.2;
}

.divider-global {
    margin: 30px 0;
    border: 0;
    border-top: 2px dashed #cbd5e1;
}

.summary-item.plain {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-color);
}

.summary-item.plain .lbl {
    color: #64748b;
}

/* --- ESTILOS PARA IMPRESIÃ“N --- */
@media print {

    header,
    .top-bar,
    .nav-container,
    .btn-primary,
    .btn-danger,
    footer,
    .control-bar,
    .save-bar,
    .tab-buttons,
    .action-panel h3 button,
    #loadingOverlay {
        display: none !important;
    }

    body,
    .container,
    .tab-content,
    .action-panel,
    .daily-widget-container {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    table {
        width: 100% !important;
        border: 1px solid #000 !important;
    }

    th,
    td {
        border: 1px solid #000 !important;
        color: black !important;
    }

    /* Asegurar que se vea la info clave */
    .dashboard-section-title,
    .daily-header-control {
        border-bottom: 2px solid black !important;
    }
}

/* --- ESTILOS HORARIO V10 --- */
.horario-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 5px;
    font-size: 0.9rem;
}

.horario-table th {
    background: var(--primary);
    color: white;
    padding: 12px 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}

.horario-table td {
    vertical-align: top;
    padding: 4px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    background: white;
    min-width: 130px;
}

.horario-table td:last-child {
    border-right: none;
}

.hora-cell {
    background: #f8fafc !important;
    font-weight: bold;
    color: var(--secondary);
    text-align: center;
    vertical-align: middle !important;
    width: 90px;
    border-right: 2px solid #e2e8f0 !important;
}

/* Selectores Miniatura */
.select-mini-prof {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    padding: 4px;
    margin-bottom: 3px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: white;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.select-mini-prof:hover {
    border-color: var(--accent);
}

.select-mini-aula {
    display: block;
    width: 100%;
    font-size: 0.7rem;
    padding: 3px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    color: #64748b;
}

/* ConfiguraciÃ³n Modal Items */
.config-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    background: white;
}

.config-item:last-child {
    border-bottom: none;
}

.item-input {
    border: 1px solid #cbd5e1;
    padding: 6px;
    border-radius: 4px;
    width: 100%;
    margin-right: 8px;
    font-size: 0.9rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--danger);
}

/* AnimaciÃ³n de fila en agenda */
.celda-activa {
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.celda-activa:hover {
    background-color: #eff6ff !important;
    border-left-color: var(--accent);
    transform: translateX(2px);
}

/* NUEVO: TARJETA PRÃ“XIMA CLASE */
.next-class-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: 0.2s;
    border-left: 5px solid #cbd5e1;
}

.next-class-card.active {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: #22c55e;
    color: #14532d;
}

.next-class-card.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(22, 163, 74, 0.1);
}

.next-class-card.upcoming {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: #3b82f6;
    color: #1e3a8a;
}

.next-class-card.upcoming:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.1);
}

/* ===== AGENDA TIMELINE CARDS ===== */
.agenda-timeline-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.agenda-timeline-container::before {
    content: '';
    position: absolute;
    left: 39px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0, #e2e8f0);
    z-index: 0;
}

.agenda-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.agenda-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.agenda-card.agenda-en-curso {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
    border-left: 4px solid #22c55e;
}

.agenda-card.agenda-completado {
    background: #fafafa;
    border-color: #e2e8f0;
    opacity: 0.7;
}

.agenda-card.agenda-pendiente {
    background: white;
    border-color: #e2e8f0;
    border-left: 4px solid #0284c7;
}

.agenda-card.agenda-fijo {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
    border-left: 4px solid #3b82f6;
}

/* Timeline dot */
.agenda-timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.agenda-dot-en-curso {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
    animation: pulse-green 1.5s ease infinite;
}

.agenda-dot-completado { background: #94a3b8; }
.agenda-dot-pendiente  { background: #0284c7; }
.agenda-dot-fijo       { background: #3b82f6; }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
    50%       { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1); }
}

/* Hora */
.agenda-hora {
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
}

.agenda-hora-label {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.agenda-hora-small {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Info central */
.agenda-info {
    flex: 1;
    min-width: 0;
}

.agenda-materia {
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-grupo {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Meta derecha */
.agenda-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.agenda-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-encurso   { background: #dcfce7; color: #15803d; }
.badge-completado{ background: #f1f5f9; color: #64748b; }
.badge-pendiente { background: #e0f2fe; color: #0369a1; }
.badge-fijo      { background: #dbeafe; color: #1e40af; }

.agenda-aula {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 3px;
}

.agenda-ir-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
    margin-top: 2px;
}

.agenda-ir-btn:hover {
    background: #1e40af;
    transform: translateX(2px);
}

/* Responsive Agenda (iPhone/Mobile) */
@media (max-width: 480px) {
    .agenda-card {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    .agenda-hora {
        min-width: 45px;
    }
    .agenda-info {
        flex: 1 1 100%;
        margin-left: 20px;
    }
    .agenda-meta {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin-top: 5px;
    }
    .agenda-ir-btn {
        margin-left: auto;
    }
}

/* Dark mode agenda */
[data-theme="dark"] .agenda-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .agenda-card:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .agenda-card.agenda-en-curso {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}
[data-theme="dark"] .agenda-card.agenda-pendiente {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .agenda-card.agenda-fijo {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}
[data-theme="dark"] .agenda-hora-label { color: var(--primary-light); }
[data-theme="dark"] .agenda-materia    { color: var(--text-main); }
[data-theme="dark"] .agenda-timeline-container::before {
    background: var(--border);
}
[data-theme="dark"] .agenda-timeline-dot {
    border-color: var(--bg-card);
}

.data-table th,
.data-table td {
    vertical-align: top;
}

.col-alumno {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    height: 45px;
    white-space: normal !important;
    overflow: hidden;
    position: relative;
}

/* --- RESPONSIVIDAD TABLA ASISTENCIA EN DISPOSITIVOS MOVILES --- */
@media (max-width: 768px) {

    .data-table th,
    .data-table td {
        padding: 8px 5px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Bugfix para Safari: position sticky en celdas falla con border-collapse: collapse */
    .data-table,
    .edit-students-table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    /* Mantener columna # fija a la izquierda */
    #tablaAlumnos th:nth-child(1),
    #tablaAlumnos td:nth-child(1),
    #tablaAlumnosEditar th:nth-child(1),
    #tablaAlumnosEditar td:nth-child(1) {
        position: sticky !important;
        position: -webkit-sticky !important;
        left: 0 !important;
        background: #ffffff !important;
        z-index: 10 !important;
        min-width: 40px !important;
        max-width: 40px !important;
        text-align: center !important;
    }

    /* Columna estática (nombres) para que acompañe el scroll y siga al # */
    #tablaAlumnos th:nth-child(2),
    #tablaAlumnos td:nth-child(2),
    #tablaAlumnos td.col-alumno,
    #tablaAlumnosEditar th:nth-child(2),
    #tablaAlumnosEditar td:nth-child(2) {
        position: sticky !important;
        position: -webkit-sticky !important;
        /* Importante para iOS */
        left: 40px !important;
        /* Desplazado para dejar espacio al # */
        background: #ffffff !important;
        z-index: 10 !important;
        /* Sombra derecha */
        box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.15);
    }

    #tablaAlumnos th:nth-child(1),
    #tablaAlumnosEditar th:nth-child(1),
    #tablaAlumnos th:nth-child(2),
    #tablaAlumnosEditar th:nth-child(2) {
        z-index: 11 !important;
        background: #f8fafc !important;
    }

    /* Solución a inputs de tipo fecha y otros campos que se salen en teléfonos */
    input[type="date"],
    #fechaAsistencia,
    #addAluNacimiento,
    .control-item input,
    .control-item select {
        width: 100% !important;
        box-sizing: border-box !important;
        max-width: 100%;
        display: block;
    }

    /* Evitar que las tablas o grids empujen el contenedor principal */
    .edit-students-table,
    .action-panel>div[style*="grid"] {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Botones más grandes para dedos */
    .btn-check {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        padding: 0;
        margin: 0 3px;
        border-radius: 8px;
    }

    .obs-input {
        width: 120px;
        font-size: 0.85rem;
        padding: 6px;
    }

    .date-row {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stats-summary-box {
        flex-direction: column;
    }
}

/* --- MODO OSCURO (DARK THEME) --- */
:root[data-theme="dark"] {
    /* Paleta de Colores Específica para Dark Mode */
    --bg-body: #0f172a;        /* Azul muy oscuro (Casi negro) para el fondo base */
    --bg-card: #1e293b;        /* Azul pizarra (Elevaciones/Cards) */
    --bg-hover: #334155;       /* Color sólido para estados hover */
    
    --text-main: #f8fafc;      /* Blanco roto brillante para títulos */
    --text-color: #e2e8f0;     /* Texto estándar */
    --text-muted: #94a3b8;     /* Texto secundario / tenue */
    
    --primary: #3b82f6;        /* Azul primary visible en tema oscuro */
    --primary-light: #60a5fa;  
    --secondary: #64748b;
    --accent: #38bdf8;         /* Cyan vibrante para foco */
    
    --border: #334155;         /* Bordes neutros oscuros */
    --border-light: #475569;   /* Bordes ligeramente más claros para inputs */
    
    --success: #10b981;        /* Verde legible (Esmeralda) */
    --danger: #ef4444;         /* Rojo puro legible */
    --warning: #f59e0b;
    --info: #0ea5e9;
    
    /* Sombras más profundas y acordes a fondos oscuros */
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    
    color-scheme: dark;
}

[data-theme="dark"] body {
    background-color: var(--bg-body);
    color: var(--text-color);
}

/* Modales, Cards, Paneles principales */
[data-theme="dark"] .action-panel,
[data-theme="dark"] .top-bar,
[data-theme="dark"] .daily-widget-container,
[data-theme="dark"] .class-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .table-container,
[data-theme="dark"] #login,
[data-theme="dark"] .custom-dropdown,
[data-theme="dark"] .stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* Header principal */
[data-theme="dark"] header {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* Inputs, Selects, Textareas */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #0f172a;
    color: var(--text-main);
    border-color: var(--border-light);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    background-color: #1e293b;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); /* Sombra glow azul claro */
}

/* Addon para input (íconos, toggles) */
[data-theme="dark"] .input-icon {
    color: var(--text-muted);
}
[data-theme="dark"] .password-toggle {
    background: transparent;
    color: var(--text-muted);
}
[data-theme="dark"] .password-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Contenedores Multi-Select & Chips */
[data-theme="dark"] .multi-select-box {
    background-color: #0f172a;
    border-color: var(--border-light);
}

[data-theme="dark"] .chip {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-light);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Tablas */
[data-theme="dark"] .data-table th,
[data-theme="dark"] .styled-table th {
    background-color: #0f172a;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

[data-theme="dark"] .data-table td,
[data-theme="dark"] .styled-table td {
    color: var(--text-color);
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-card);
}

[data-theme="dark"] .styled-table tbody tr:hover,
[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .edit-students-table tbody tr:hover td {
    background-color: var(--bg-hover) !important; /* Suave resaltado en hover */
}

/* Botones y Navegación (Tabs) */
[data-theme="dark"] .tab-btn {
    background-color: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border);
    box-shadow: none;
}

[data-theme="dark"] .tab-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

[data-theme="dark"] .tab-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* Class Cards Específico */
[data-theme="dark"] .class-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .class-card:hover {
    background-color: var(--bg-hover);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-light);
}

[data-theme="dark"] .class-card h4 {
    color: var(--text-main);
}

/* Botones de Niveles */
[data-theme="dark"] .level-btn {
    background-color: transparent;
    color: var(--text-muted);
    border-color: var(--border-light);
}

[data-theme="dark"] .level-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

[data-theme="dark"] .level-btn.active {
    color: #ffffff;
    border-color: transparent;
}

[data-theme="dark"] .level-btn.prees.active { background-color: var(--prees-color); }
[data-theme="dark"] .level-btn.prim.active { background-color: var(--prim-color); }
[data-theme="dark"] .level-btn.bach.active { background-color: var(--bach-color); }

/* Dropdown Hover en Búsqueda y Dropdowns Nativos */
[data-theme="dark"] .custom-dropdown div:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

/* Widgets y Títulos Internos */
[data-theme="dark"] .action-panel h3,
[data-theme="dark"] .daily-header-control span,
[data-theme="dark"] .dashboard-section-title h3,
[data-theme="dark"] .login-header h2 {
    color: var(--text-main);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .date-input-highlight {
    background: #0f172a !important;
    border-color: var(--primary) !important;
    color: var(--primary-light) !important;
}

/* Badges y Pills de estado en modo oscuro */
[data-theme="dark"] .status-pill.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

[data-theme="dark"] .status-pill.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

[data-theme="dark"] .badge {
    background-color: #ef4444; 
    color: #ffffff;
}

/* Loading overlay para Dark Mode */
[data-theme="dark"] #loadingOverlay {
    background: rgba(15, 23, 42, 0.85); /* Azul muy oscuro con opacidad */
    backdrop-filter: blur(8px);
    color: var(--primary-light);
}

[data-theme="dark"] .spinner {
    border-color: var(--border-light);
    border-top-color: var(--primary-light);
}

/* Botones estándar (primario, éxito, etc) */
[data-theme="dark"] .btn-primary { background: var(--primary); }
[data-theme="dark"] .btn-primary:hover { background: #2563eb; }

[data-theme="dark"] .btn-success { background: var(--success); }
[data-theme="dark"] .btn-success:hover { background: #059669; }

[data-theme="dark"] .btn-danger { background: var(--danger); }
[data-theme="dark"] .btn-danger:hover { background: #dc2626; }

[data-theme="dark"] .btn-text { color: var(--text-muted); background: transparent; }
[data-theme="dark"] .btn-text:hover { color: var(--primary-light); background: rgba(255, 255, 255, 0.05); text-decoration: none; border-radius: var(--radius); }

/* Custom Scrollbars para modo oscuro (Navegadores Webkit) */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-body);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 6px;
    border: 3px solid var(--bg-body); /* Fake padding */
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* --- OVERRIDES PARA ESTILOS INLINE EN MODO OSCURO --- */
[data-theme="dark"] [style*="background:#f0fdf4"],
[data-theme="dark"] [style*="background: #f0fdf4"] {
    background-color: rgba(22, 101, 52, 0.2) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

[data-theme="dark"] [style*="background:#fff7ed"],
[data-theme="dark"] [style*="background: #fff7ed"] {
    background-color: rgba(154, 52, 18, 0.2) !important;
    border-color: rgba(249, 115, 22, 0.3) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"] {
    background-color: var(--bg-hover) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background: #fff"] {
    background-color: transparent !important;
}

[data-theme="dark"] [style*="background:#eff6ff"],
[data-theme="dark"] [style*="background: #eff6ff"] {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f1f5f9"] {
    background-color: var(--bg-card) !important;
    color: var(--text-muted) !important;
}

/* Color fixes for forced inline text colors */
[data-theme="dark"] [style*="color:#c2410c"] { color: #fb923c !important; }
[data-theme="dark"] [style*="color:#1e3a8a"] { color: var(--primary-light) !important; }
[data-theme="dark"] [style*="color:#166534"] { color: #4ade80 !important; }
[data-theme="dark"] [style*="color:#b45309"],
[data-theme="dark"] [style*="color:#b91c1c"] { color: #fca5a5 !important; }
[data-theme="dark"] [style*="color:#8b5cf6"] { color: #a78bfa !important; }

/* --- FIX TABLA HORARIO Y ALUMNOS --- */
[data-theme="dark"] .horario-table {
    border-color: var(--border);
}
[data-theme="dark"] .horario-table th {
    background: #0f172a;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
[data-theme="dark"] .horario-table td,
[data-theme="dark"] .horario-table .hora-cell {
    background: var(--bg-card) !important;
    color: var(--text-color) !important;
    border-color: var(--border);
}
[data-theme="dark"] .horario-table tbody tr:hover td {
    background: var(--bg-hover) !important;
}

[data-theme="dark"] .edit-students-table th {
    background: #0f172a;
    color: var(--text-muted);
    border-color: var(--border);
}
[data-theme="dark"] .edit-students-table td {
    background: var(--bg-card);
    color: var(--text-color);
    border-color: var(--border);
}
[data-theme="dark"] .edit-students-table tr:hover td {
    background: var(--bg-hover) !important;
}

[data-theme="dark"] [style*="background:#fef2f2"],
[data-theme="dark"] [style*="background: #fef2f2"] {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] [style*="background:#f3e8ff"],
[data-theme="dark"] [style*="background: #f3e8ff"] {
    background-color: rgba(139, 92, 246, 0.2) !important;
    color: #c4b5fd !important;
}

/* --- FIX MORE WHITE BACKGROUNDS IN DARK MODE --- */
[data-theme="dark"] .btn-check {
    background-color: rgba(30, 41, 59, 0.5);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    transition: all 0.2s ease;
}

[data-theme="dark"] .btn-check.btn-presente { border-color: rgba(16, 185, 129, 0.3); color: rgba(16, 185, 129, 0.9); }
[data-theme="dark"] .btn-check.btn-presente:hover { background-color: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.5); }
[data-theme="dark"] .btn-check.btn-presente.active { background-color: var(--success); color: white; border-color: var(--success); }

[data-theme="dark"] .btn-check.btn-ausente { border-color: rgba(239, 68, 68, 0.3); color: rgba(239, 68, 68, 0.9); }
[data-theme="dark"] .btn-check.btn-ausente:hover { background-color: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.5); }
[data-theme="dark"] .btn-check.btn-ausente.active { background-color: var(--danger); color: white; border-color: var(--danger); }

[data-theme="dark"] .btn-check.btn-aj { border-color: rgba(14, 165, 233, 0.3); color: rgba(14, 165, 233, 0.9); }
[data-theme="dark"] .btn-check.btn-aj:hover { background-color: rgba(14, 165, 233, 0.15); border-color: rgba(14, 165, 233, 0.5); }
[data-theme="dark"] .btn-check.btn-aj.active { background-color: #0ea5e9; color: white; border-color: #0ea5e9; }

[data-theme="dark"] .btn-check.btn-jubilado { border-color: rgba(139, 92, 246, 0.3); color: rgba(139, 92, 246, 0.9); }
[data-theme="dark"] .btn-check.btn-jubilado:hover { background-color: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.5); }
[data-theme="dark"] .btn-check.btn-jubilado.active { background-color: #8b5cf6; color: white; border-color: #8b5cf6; }
[data-theme="dark"] .lapso-box {
    background-color: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .stat-card.total {
    background-color: var(--bg-hover) !important;
}
[data-theme="dark"] .summary-item.plain {
    background-color: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .select-mini-prof,
[data-theme="dark"] .btn-mini-prof {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-light);
}
[data-theme="dark"] .config-item {
    background-color: var(--bg-card);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .next-class-card {
    background-color: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .next-class-card.active {
    background-color: rgba(34, 197, 94, 0.1); 
}
[data-theme="dark"] .next-class-card.upcoming {
    background-color: rgba(59, 130, 246, 0.1); 
}
[data-theme="dark"] .obs-card {
    background-color: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .obs-card.alert {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"] {
    background-color: transparent !important;
}

@media (max-width: 768px) {
    [data-theme="dark"] #tablaAlumnos th:nth-child(1),
    [data-theme="dark"] #tablaAlumnos td:nth-child(1),
    [data-theme="dark"] #tablaAlumnosEditar th:nth-child(1),
    [data-theme="dark"] #tablaAlumnosEditar td:nth-child(1),
    [data-theme="dark"] #tablaAlumnos th:nth-child(2),
    [data-theme="dark"] #tablaAlumnos td:nth-child(2),
    [data-theme="dark"] #tablaAlumnos td.col-alumno,
    [data-theme="dark"] #tablaAlumnosEditar th:nth-child(2),
    [data-theme="dark"] #tablaAlumnosEditar td:nth-child(2) {
        background-color: var(--bg-card) !important;
    }
    
    [data-theme="dark"] #tablaAlumnos th:nth-child(1),
    [data-theme="dark"] #tablaAlumnosEditar th:nth-child(1),
    [data-theme="dark"] #tablaAlumnos th:nth-child(2),
    [data-theme="dark"] #tablaAlumnosEditar th:nth-child(2) {
        background-color: #0f172a !important;
    }
}

[data-theme="dark"] [style*="background:#f0f9ff"],
[data-theme="dark"] [style*="background: #f0f9ff"] {
    background-color: rgba(14, 165, 233, 0.15) !important;
}

[data-theme="dark"] .daily-widget {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .bg-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}
[data-theme="dark"] .bg-secondary {
    background: linear-gradient(135deg, #334155 0%, #0f172a 100%);
}
[data-theme="dark"] .daily-table th {
    background: #0f172a;
    color: var(--text-muted);
    border-color: var(--border);
}
[data-theme="dark"] .daily-table td {
    color: var(--text-color);
    border-color: var(--border);
}

