/* ============================================================
   Modo oscuro (nocturno). Bootstrap 5.3 pone sus colores oscuros con
   data-bs-theme="dark" en .app-shell; aquí solo se ajusta lo propio
   de la app. Los documentos (boletines, actas, récords, recibos)
   llevan data-bs-theme="light": siempre en blanco, como el papel.
   ============================================================ */

.app-shell[data-bs-theme=dark] {
    background: #0f1522;
    color: var(--bs-body-color);
    color-scheme: dark;
}
/* Botones "outline-dark" y títulos que usaban el negro fijo */
[data-bs-theme=dark] .btn-outline-dark:not([data-bs-theme=light] *) { --bs-btn-color: #dbe3ef; --bs-btn-border-color: #5b6882; --bs-btn-hover-bg: #dbe3ef; --bs-btn-hover-color: #0f1522; }
[data-bs-theme=dark] .btn-outline-secondary:not([data-bs-theme=light] *) { --bs-btn-color: #b7c2d3; --bs-btn-border-color: #4a5670; }

/* Barra de arriba y tarjetas (Clásico) */
[data-bs-theme=dark] .topbar { background: #151d2e; border-bottom-color: #243049; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
[data-bs-theme=dark] .card { background: #151d2e; box-shadow: 0 2px 14px rgba(0, 0, 0, .35); }
[data-bs-theme=dark] .card-header.bg-white,
[data-bs-theme=dark] .bg-white:not([data-bs-theme=light] *) { background-color: #1b2438 !important; }
[data-bs-theme=dark] .bg-light:not([data-bs-theme=light] *) { background-color: #1b2438 !important; }
[data-bs-theme=dark] .table-light:not([data-bs-theme=light] *) {
    --bs-table-bg: #1f2a40; --bs-table-color: #dbe3ef; --bs-table-border-color: #2c3952;
    color: #dbe3ef;
}
[data-bs-theme=dark] .table-secondary:not([data-bs-theme=light] *) {
    --bs-table-bg: #243049; --bs-table-color: #dbe3ef; color: #dbe3ef;
}
[data-bs-theme=dark] .text-dark:not(.badge):not([data-bs-theme=light] *) { color: #e6ecf5 !important; }
[data-bs-theme=dark] .page-body a:not(.btn):not(.nav-item):not(.badge):not(.cr-acceso):not(.cr-pendiente):not([data-bs-theme=light] *) { color: #8fb4ff; }

/* Casillas con color puesto a mano (encabezados de bloques, RP pendiente, estados…):
   se quedan claritas para que se distingan, con letra oscura para que se lean. */
[data-bs-theme=dark] [style*="background:#"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: #"]:not([data-bs-theme=light] *) { color: #1f2430; }
/* …pero los fondos blancos puestos a mano pasan a oscuros */
[data-bs-theme=dark] [style*="background:#fff;"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: #fff;"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background:#ffffff"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: #ffffff"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background:white"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: white"]:not([data-bs-theme=light] *) { background: #1b2438 !important; color: inherit; }
/* Fondos oscuros puestos a mano: letra blanca */
[data-bs-theme=dark] [style*="background:#003DA5"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: #003DA5"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background:#0F1C33"]:not([data-bs-theme=light] *),
[data-bs-theme=dark] [style*="background: #0F1C33"]:not([data-bs-theme=light] *) { color: #fff; }

/* Casillas de calificación y campos */
[data-bs-theme=dark] input:not([type=checkbox]):not([type=radio]):not([data-bs-theme=light] *),
[data-bs-theme=dark] select:not([data-bs-theme=light] *),
[data-bs-theme=dark] textarea:not([data-bs-theme=light] *) { color-scheme: dark; }

/* Documentos: siempre como papel */
[data-bs-theme=light] { color-scheme: light; }
.app-shell[data-bs-theme=dark] [data-bs-theme=light] { background-color: #fff; color: #212529; }

/* ── Cristal oscuro ── */
.tema-cristal[data-bs-theme=dark] {
    background: #0b1220;
    --cr-texto: #e6ecf5;
    --cr-suave: #9aa7bd;
}
.tema-cristal[data-bs-theme=dark]::before { opacity: .35; }
.tema-cristal[data-bs-theme=dark]::after  { opacity: .18; }
.tema-cristal[data-bs-theme=dark] .topbar { background: rgba(20, 28, 46, .72); border-color: rgba(255, 255, 255, .08); }
.tema-cristal[data-bs-theme=dark] .card { background: rgba(21, 29, 46, .92); border-color: rgba(255, 255, 255, .06); }
.tema-cristal[data-bs-theme=dark] .cr-vidrio { background: rgba(21, 29, 46, .72); border-color: rgba(255, 255, 255, .08); }
.tema-cristal[data-bs-theme=dark] .cr-acceso { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .08); color: var(--cr-texto); }
.tema-cristal[data-bs-theme=dark] .cr-acceso:hover { background: rgba(255, 255, 255, .12); }
.tema-cristal[data-bs-theme=dark] .cr-pendiente { border-top-color: rgba(255, 255, 255, .08); }
.tema-cristal[data-bs-theme=dark] .cr-periodo .cr-barra { background: #243049; }
.tema-cristal[data-bs-theme=dark] .chip-anio { background: rgba(30, 79, 168, .3); color: #a9c4ff !important; }
.tema-cristal[data-bs-theme=dark] .btn-campana { background: rgba(255, 255, 255, .08); color: var(--cr-texto); }
.tema-cristal[data-bs-theme=dark] .cr-hero { background: rgba(5, 10, 20, .7); }
.tema-cristal[data-bs-theme=dark].reducir-transparencia .topbar,
.tema-cristal[data-bs-theme=dark].reducir-transparencia .cr-vidrio { background: #151d2e; }

@media print {
    .app-shell[data-bs-theme=dark] { background: #fff; }
}

/* Insignias claras (p. ej. «Promedio») */
[data-bs-theme=dark] .badge.bg-light:not([data-bs-theme=light] *),
[data-bs-theme=dark] .badge.bg-white:not([data-bs-theme=light] *) { background-color: #2a3650 !important; color: #e6ecf5 !important; border-color: #3a4866 !important; }

/* Registro de calificaciones: casillas P / RP */
[data-bs-theme=dark] .in-p, [data-bs-theme=dark] .in-esp { border-color: #3a4866; background-color: #111827; color: #e6ecf5; }
[data-bs-theme=dark] .in-rp { background: #1f2a40; border-color: #34425e; color: #dbe3ef; }
[data-bs-theme=dark] .in-rp.rp-inactivo { background: #161e2e; border-color: #222c40; color: #56627a; }
[data-bs-theme=dark] .in-p.bajo { background: #5a1f25; color: #ffb3b8; }
[data-bs-theme=dark] .in-rp.rp-pendiente { background: #fff3b0; border-color: #e0a800; color: #1f2430; }
[data-bs-theme=dark] .in-rp.rp-hecho { background: #1e4d3a; border-color: #3f8f6b; color: #d6f5e6; }
[data-bs-theme=dark] .in-rp.rp-invalido { background: #5a2a22; border-color: #dc3545; color: #ffb3b8; }

/* Encabezado del centro dentro de las pantallas (vista de reportes) */
[data-bs-theme=dark] .enc-centro:not([data-bs-theme=light] *) { color: #dbe3ef; }
[data-bs-theme=dark] .enc-centro:not([data-bs-theme=light] *) .enc-nombre { color: #8fb4ff; }
[data-bs-theme=dark] .enc-centro:not([data-bs-theme=light] *) .enc-lema,
[data-bs-theme=dark] .enc-centro:not([data-bs-theme=light] *) .enc-datos,
[data-bs-theme=dark] .enc-centro:not([data-bs-theme=light] *) .enc-emision { color: #b7c2d3; }
