/* ============================================================
   theme-overrides.css — COPERTURA GLOBALE TEMA CHIARO/SCURO
   ------------------------------------------------------------
   Caricato per ULTIMO nell'<head>: porta a tema CHIARO tutte le
   superfici/popup/testi che le singole pagine definiscono con
   colori scuri hardcoded. Il tema scuro è quello nativo
   dell'app, quindi qui si interviene quasi solo su
   [data-theme="light"].

   Palette chiara di riferimento (coerente con theme-variables):
   superficie   #ffffff      sfondo app   #eef2f9
   testo        #1f2937      secondario   #64748b
   bordo        #e5e7eb      bordo input  #d1d5db
   accento      #1d4ed8
   ============================================================ */

/* ==================== MODALI CUSTOM (.modal-*) ==================== */

[data-theme="light"] .modal-backdrop {
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(4px);
}

[data-theme="light"] .modal-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
}

[data-theme="light"] .modal-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #111827 !important;
}

[data-theme="light"] .modal-body {
    background: #ffffff !important;
    color: #1f2937 !important;
}

[data-theme="light"] .modal-footer {
    background: #f8fafc !important;
    border-top: 1px solid #e5e7eb !important;
}

[data-theme="light"] .modal-title {
    color: #111827 !important;
}

[data-theme="light"] .modal-subtitle {
    color: #64748b !important;
}

[data-theme="light"] .modal-icon-wrap {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
}

/* ==================== CONFIRM BOX ==================== */

[data-theme="light"] .confirm-overlay,
[data-theme="light"] .confirm-overlay-top {
    background: rgba(15, 23, 42, 0.45) !important;
}

[data-theme="light"] .confirm-box {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
}

    [data-theme="light"] .confirm-box h1,
    [data-theme="light"] .confirm-box h2,
    [data-theme="light"] .confirm-box h3,
    [data-theme="light"] .confirm-box h4 {
        color: #111827 !important;
    }

    [data-theme="light"] .confirm-box p,
    [data-theme="light"] .confirm-box span:not(.mud-icon-root):not([class*="badge"]):not([class*="chip"]) {
        color: #475569 !important;
    }

/* ==================== POPUP CUSTOM (.popup-*) ==================== */

[data-theme="light"] .popup-overlay,
[data-theme="light"] .popup-overlay-cestino {
    background: rgba(15, 23, 42, 0.45) !important;
}

[data-theme="light"] .popup-box,
[data-theme="light"] .popup-box-cestino,
[data-theme="light"] .popup-content,
[data-theme="light"] .popup-successo {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
}

    [data-theme="light"] .popup-box h1, [data-theme="light"] .popup-box h2,
    [data-theme="light"] .popup-box h3, [data-theme="light"] .popup-box h4,
    [data-theme="light"] .popup-box-cestino h1, [data-theme="light"] .popup-box-cestino h2,
    [data-theme="light"] .popup-box-cestino h3, [data-theme="light"] .popup-box-cestino h4,
    [data-theme="light"] .popup-content h1, [data-theme="light"] .popup-content h2,
    [data-theme="light"] .popup-content h3, [data-theme="light"] .popup-content h4 {
        color: #111827 !important;
    }

[data-theme="light"] .popup-message {
    color: #475569 !important;
}

[data-theme="light"] .popup-item {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
}

[data-theme="light"] .popup-input,
[data-theme="light"] .popup-input input {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
}

[data-theme="light"] .popup-badge,
[data-theme="light"] .popup-count {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border-color: #bfdbfe !important;
}

/* ==================== SUPERFICI MUDBLAZOR (popover, menu, liste) ==================== */

[data-theme="light"] .mud-popover {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14) !important;
}

[data-theme="light"] .mud-list {
    background: #ffffff !important;
    color: #1f2937 !important;
}

[data-theme="light"] .mud-list-item,
[data-theme="light"] .mud-list-item .mud-typography,
[data-theme="light"] .mud-menu-list .mud-menu-item {
    color: #1f2937 !important;
}

    [data-theme="light"] .mud-list-item:hover,
    [data-theme="light"] .mud-menu-list .mud-menu-item:hover {
        background: #f1f5f9 !important;
    }

[data-theme="light"] .mud-tooltip {
    background: #111827 !important;
    color: #ffffff !important;
}

[data-theme="light"] .mud-alert {
    color: inherit !important;
}

[data-theme="light"] .mud-card,
[data-theme="light"] .mud-expansion-panel {
    background: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #e5e7eb !important;
}

[data-theme="light"] .mud-divider {
    border-color: #e5e7eb !important;
}

[data-theme="light"] .mud-checkbox .mud-typography,
[data-theme="light"] .mud-radio .mud-typography {
    color: #1f2937 !important;
}

/* Select/menu aperti (rendono dentro il popover provider a fine body) */
[data-theme="light"] .mud-select .mud-input,
[data-theme="light"] .mud-select .mud-input-adornment {
    color: #1f2937 !important;
}

/* ==================== TESTI CON STILE INLINE SCURO → CHIARO ==================== */
/* Le pagine usano molto style="color:#...". Qui le varianti più comuni. */

[data-theme="light"] .mud-main-content [style*="color:#e2e8f0"],
[data-theme="light"] .mud-main-content [style*="color: #e2e8f0"],
[data-theme="light"] .mud-main-content [style*="color:#f1f5f9"],
[data-theme="light"] .mud-main-content [style*="color: #f1f5f9"],
[data-theme="light"] .mud-main-content [style*="color:#f8fafc"],
[data-theme="light"] .mud-main-content [style*="color: #f8fafc"],
[data-theme="light"] .mud-main-content [style*="color:#cbd5e1"],
[data-theme="light"] .mud-main-content [style*="color: #cbd5e1"] {
    color: #374151 !important;
}

[data-theme="light"] .mud-main-content [style*="color:#94a3b8"],
[data-theme="light"] .mud-main-content [style*="color: #94a3b8"],
[data-theme="light"] .mud-main-content [style*="color:#64748b"],
[data-theme="light"] .mud-main-content [style*="color: #64748b"] {
    color: #64748b !important;
}

[data-theme="light"] .mud-main-content [style*="color:#60a5fa"],
[data-theme="light"] .mud-main-content [style*="color: #60a5fa"],
[data-theme="light"] .mud-main-content [style*="color:#93c5fd"],
[data-theme="light"] .mud-main-content [style*="color: #93c5fd"],
[data-theme="light"] .mud-main-content [style*="color:#38bdf8"],
[data-theme="light"] .mud-main-content [style*="color: #38bdf8"],
[data-theme="light"] .mud-main-content [style*="color:#bfdbfe"],
[data-theme="light"] .mud-main-content [style*="color: #bfdbfe"] {
    color: #1d4ed8 !important;
}

[data-theme="light"] .mud-main-content [style*="color:#fbbf24"],
[data-theme="light"] .mud-main-content [style*="color: #fbbf24"],
[data-theme="light"] .mud-main-content [style*="color:#fcd34d"],
[data-theme="light"] .mud-main-content [style*="color: #fcd34d"],
[data-theme="light"] .mud-main-content [style*="color:#fde047"],
[data-theme="light"] .mud-main-content [style*="color: #fde047"] {
    color: #b45309 !important;
}

[data-theme="light"] .mud-main-content [style*="color:#4ade80"],
[data-theme="light"] .mud-main-content [style*="color: #4ade80"],
[data-theme="light"] .mud-main-content [style*="color:#86efac"],
[data-theme="light"] .mud-main-content [style*="color: #86efac"] {
    color: #15803d !important;
}

[data-theme="light"] .mud-main-content [style*="color:#f87171"],
[data-theme="light"] .mud-main-content [style*="color: #f87171"],
[data-theme="light"] .mud-main-content [style*="color:#fca5a5"],
[data-theme="light"] .mud-main-content [style*="color: #fca5a5"] {
    color: #b91c1c !important;
}

/* ==================== SFONDI CON STILE INLINE SCURO → CHIARO ==================== */

[data-theme="light"] .mud-main-content [style*="background:#0f172a"],
[data-theme="light"] .mud-main-content [style*="background: #0f172a"],
[data-theme="light"] .mud-main-content [style*="background-color:#0f172a"],
[data-theme="light"] .mud-main-content [style*="background-color: #0f172a"],
[data-theme="light"] .mud-main-content [style*="background:#020617"],
[data-theme="light"] .mud-main-content [style*="background: #020617"],
[data-theme="light"] .mud-main-content [style*="background:#0b1120"],
[data-theme="light"] .mud-main-content [style*="background: #0b1120"] {
    background: #f8fafc !important;
}

[data-theme="light"] .mud-main-content [style*="background:#1e293b"],
[data-theme="light"] .mud-main-content [style*="background: #1e293b"],
[data-theme="light"] .mud-main-content [style*="background-color:#1e293b"],
[data-theme="light"] .mud-main-content [style*="background-color: #1e293b"],
[data-theme="light"] .mud-main-content [style*="background:#16213a"],
[data-theme="light"] .mud-main-content [style*="background: #16213a"] {
    background: #ffffff !important;
}

[data-theme="light"] .mud-main-content [style*="background:#334155"],
[data-theme="light"] .mud-main-content [style*="background: #334155"],
[data-theme="light"] .mud-main-content [style*="background-color:#334155"],
[data-theme="light"] .mud-main-content [style*="background-color: #334155"] {
    background: #e2e8f0 !important;
}

[data-theme="light"] .mud-main-content [style*="background:#1e3a8a"],
[data-theme="light"] .mud-main-content [style*="background: #1e3a8a"],
[data-theme="light"] .mud-main-content [style*="background-color:#1e3a8a"],
[data-theme="light"] .mud-main-content [style*="background-color: #1e3a8a"],
[data-theme="light"] .mud-main-content [style*="background:#1d3a8a"],
[data-theme="light"] .mud-main-content [style*="background: #1d3a8a"] {
    background: #eff6ff !important;
    color: #1e3a8a !important;
}

[data-theme="light"] .mud-main-content [style*="background:rgba(255,255,255,0.05)"],
[data-theme="light"] .mud-main-content [style*="background: rgba(255,255,255,0.05)"],
[data-theme="light"] .mud-main-content [style*="background:rgba(255, 255, 255, 0.05)"],
[data-theme="light"] .mud-main-content [style*="background: rgba(255, 255, 255, 0.05)"],
[data-theme="light"] .mud-main-content [style*="background:rgba(255,255,255,0.1)"],
[data-theme="light"] .mud-main-content [style*="background: rgba(255,255,255,0.1)"] {
    background: #f1f5f9 !important;
}

[data-theme="light"] .mud-main-content [style*="background:rgba(15,23,42"],
[data-theme="light"] .mud-main-content [style*="background: rgba(15,23,42"],
[data-theme="light"] .mud-main-content [style*="background:rgba(15, 23, 42"],
[data-theme="light"] .mud-main-content [style*="background: rgba(15, 23, 42"],
[data-theme="light"] .mud-main-content [style*="background:rgba(30,41,59"],
[data-theme="light"] .mud-main-content [style*="background: rgba(30,41,59"],
[data-theme="light"] .mud-main-content [style*="background:rgba(30, 41, 59"],
[data-theme="light"] .mud-main-content [style*="background: rgba(30, 41, 59"] {
    background: #f8fafc !important;
}

/* ==================== BORDI INLINE SCURI → CHIARI ==================== */

[data-theme="light"] .mud-main-content [style*="border:1px solid #334155"],
[data-theme="light"] .mud-main-content [style*="border: 1px solid #334155"],
[data-theme="light"] .mud-main-content [style*="border:1px solid #475569"],
[data-theme="light"] .mud-main-content [style*="border: 1px solid #475569"],
[data-theme="light"] .mud-main-content [style*="border:1px solid rgba(255,255,255"],
[data-theme="light"] .mud-main-content [style*="border: 1px solid rgba(255,255,255"],
[data-theme="light"] .mud-main-content [style*="border:1px solid rgba(255, 255, 255"],
[data-theme="light"] .mud-main-content [style*="border: 1px solid rgba(255, 255, 255"] {
    border-color: #e5e7eb !important;
}

/* ==================== POPUP FUORI DAL MAIN CONTENT ====================
   I modali spesso sono renderizzati a fine body (fixed): le regole basate
   su .mud-main-content non li raggiungono. Ripetiamo i pattern principali
   per i contenitori popup noti. */

[data-theme="light"] .modal-card [style*="color:#e2e8f0"],
[data-theme="light"] .modal-card [style*="color: #e2e8f0"],
[data-theme="light"] .modal-card [style*="color:white"],
[data-theme="light"] .modal-card [style*="color: white"],
[data-theme="light"] .modal-card [style*="color:#fff"],
[data-theme="light"] .modal-card [style*="color: #fff"],
[data-theme="light"] .confirm-box [style*="color:white"],
[data-theme="light"] .confirm-box [style*="color: white"],
[data-theme="light"] .confirm-box [style*="color:#fff"],
[data-theme="light"] .confirm-box [style*="color: #fff"],
[data-theme="light"] .popup-box [style*="color:white"],
[data-theme="light"] .popup-box [style*="color: white"],
[data-theme="light"] .popup-box [style*="color:#fff"],
[data-theme="light"] .popup-box [style*="color: #fff"] {
    color: #1f2937 !important;
}

[data-theme="light"] .modal-card [style*="color:#94a3b8"],
[data-theme="light"] .modal-card [style*="color: #94a3b8"],
[data-theme="light"] .modal-card [style*="color:#cbd5e1"],
[data-theme="light"] .modal-card [style*="color: #cbd5e1"],
[data-theme="light"] .confirm-box [style*="color:#94a3b8"],
[data-theme="light"] .confirm-box [style*="color: #94a3b8"] {
    color: #64748b !important;
}

[data-theme="light"] .modal-card [style*="background:#0f172a"],
[data-theme="light"] .modal-card [style*="background: #0f172a"],
[data-theme="light"] .modal-card [style*="background:#1e293b"],
[data-theme="light"] .modal-card [style*="background: #1e293b"],
[data-theme="light"] .modal-card [style*="background:rgba(15,23,42"],
[data-theme="light"] .modal-card [style*="background: rgba(15,23,42"],
[data-theme="light"] .modal-card [style*="background:rgba(255,255,255,0.05)"],
[data-theme="light"] .modal-card [style*="background: rgba(255,255,255,0.05)"] {
    background: #f8fafc !important;
}

/* Testo generico dentro i modali: etichette e paragrafi scuri */
[data-theme="light"] .modal-card label,
[data-theme="light"] .modal-card p,
[data-theme="light"] .modal-body label,
[data-theme="light"] .modal-body p {
    color: #374151 !important;
}

[data-theme="light"] .modal-card input,
[data-theme="light"] .modal-card textarea,
[data-theme="light"] .modal-card select,
[data-theme="light"] .popup-box input,
[data-theme="light"] .popup-box textarea,
[data-theme="light"] .popup-box select {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
}

/* ==================== TABELLE/LISTE DENTRO POPUP ==================== */

[data-theme="light"] .modal-card table th,
[data-theme="light"] .popup-box table th {
    background: #f1f5f9 !important;
    color: #111827 !important;
    border-color: #e5e7eb !important;
}

[data-theme="light"] .modal-card table td,
[data-theme="light"] .popup-box table td {
    color: #374151 !important;
    border-color: #eef0f4 !important;
}

/* ==================== GUIDA INTERATTIVA (driver.js) ====================
   Il popover del tour guidato (pulsante GUIDA) segue il tema attivo. */

[data-theme="light"] .etil-driver-theme {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
    color: #1f2937 !important;
}

    [data-theme="light"] .etil-driver-theme .driver-popover-title {
        color: #1d4ed8 !important;
    }

    [data-theme="light"] .etil-driver-theme .driver-popover-description {
        color: #475569 !important;
    }

    [data-theme="light"] .etil-driver-theme .driver-popover-footer .driver-popover-prev-btn {
        background-color: transparent !important;
        border: 1px solid #d1d5db !important;
        color: #475569 !important;
    }

        [data-theme="light"] .etil-driver-theme .driver-popover-footer .driver-popover-prev-btn:hover {
            background-color: #f1f5f9 !important;
            color: #111827 !important;
        }

    [data-theme="light"] .etil-driver-theme .driver-popover-progress-text {
        color: #94a3b8 !important;
    }

    [data-theme="light"] .etil-driver-theme .driver-popover-close-btn {
        color: #64748b !important;
    }

[data-theme="light"] .driver-popover-arrow {
    border-color: #ffffff !important;
}

/* ==================== PAGINA: DATABASE DOMANDE ==================== */

/* Badge materia (es. TUEL): blu scuro leggibile su bianco */
[data-theme="light"] .badge-materia {
    color: #1e40af !important;
    background: #dbeafe !important;
    border-color: #93c5fd !important;
}

/* Badge categoria: viola scuro leggibile */
[data-theme="light"] .badge-categoria {
    color: #6d28d9 !important;
    background: #ede9fe !important;
    border-color: #c4b5fd !important;
}

/* Badge "N risposte": indaco scuro leggibile */
[data-theme="light"] .badge-risposte {
    color: #4338ca !important;
    background: #e0e7ff !important;
    border-color: #a5b4fc !important;
}

/* Badge generico nelle tabelle (trattini, ecc.) */
[data-theme="light"] .page-wrapper .badge {
    color: #475569 !important;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

/* Sottotitolo header ("Archivio completo • N visualizzate") */
[data-theme="light"] .title-section p {
    color: #64748b !important;
}

    [data-theme="light"] .title-section p strong {
        color: #1d4ed8 !important;
    }

/* ==================== PAGINA: CESTINO ==================== */

[data-theme="light"] .cestino-header {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-bottom: 3px solid #ef4444 !important;
    color: #1f2937 !important;
}

[data-theme="light"] .cestino-tab {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #475569 !important;
}

    [data-theme="light"] .cestino-tab.active,
    [data-theme="light"] .cestino-tab[class*="active"] {
        background: #fef2f2 !important;
        border-color: #fca5a5 !important;
        color: #b91c1c !important;
    }

[data-theme="light"] .cestino-table,
[data-theme="light"] .cestino-table-container {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

[data-theme="light"] .cestino-table th {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}

[data-theme="light"] .cestino-table td {
    color: #374151 !important;
    border-bottom: 1px solid #eef0f4 !important;
}

[data-theme="light"] .cestino-table tr:hover {
    background: #f8fafc !important;
}

[data-theme="light"] .cestino-toolbar {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
}

[data-theme="light"] .dettaglio-card {
    background: #ffffff !important;
    color: #1f2937 !important;
}

[data-theme="light"] .benvenuto-card {
    background: #ffffff !important;
    border: 2px solid #bfdbfe !important;
    color: #1f2937 !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2) !important;
}

    [data-theme="light"] .benvenuto-card h1,
    [data-theme="light"] .benvenuto-card h2,
    [data-theme="light"] .benvenuto-card h3 {
        color: #111827 !important;
    }

    [data-theme="light"] .benvenuto-card p {
        color: #475569 !important;
    }

/* ==================== PAGINA: DATABASE TEMPORANEI ==================== */

[data-theme="light"] .page-wrapper {
    background-color: transparent !important;
    color: #1f2937 !important;
}

[data-theme="light"] .header-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08) !important;
}

    [data-theme="light"] .header-card h1,
    [data-theme="light"] .header-card h2 {
        color: #111827 !important;
    }

[data-theme="light"] .session-selector {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

[data-theme="light"] .session-label {
    color: #64748b !important;
}

[data-theme="light"] .stat-pill {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #1f2937 !important;
}

[data-theme="light"] .turno-box {
    background: #faf5ff !important;
    border: 1px solid #d8b4fe !important;
}

[data-theme="light"] .table-wrapper {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

[data-theme="light"] .pro-table thead {
    background: #f1f5f9 !important;
    border-bottom: 2px solid #e5e7eb !important;
}

[data-theme="light"] .pro-table th {
    color: #111827 !important;
}

[data-theme="light"] .pro-table td {
    color: #374151 !important;
    border-bottom: 1px solid #eef0f4 !important;
}

[data-theme="light"] .pro-table tbody tr:hover {
    background: #f8fafc !important;
}

[data-theme="light"] .selezione-count {
    color: #1d4ed8 !important;
}

[data-theme="light"] .preview-box {
    background: #ffffff !important;
    border: 1px solid #93c5fd !important;
    color: #1f2937 !important;
}

[data-theme="light"] .preview-header {
    background: #eff6ff !important;
    color: #1e3a8a !important;
    border-bottom: 1px solid #dbeafe !important;
}

[data-theme="light"] .preview-body {
    background: #ffffff !important;
    color: #374151 !important;
}

/* Titolo header e testo domanda: il componente li imposta bianchi/chiari (regole piu' specifiche), qui li riportiamo scuri sul tema chiaro */
[data-theme="light"] .preview-header h3 {
    color: #1e3a8a !important;
}

[data-theme="light"] .preview-body h4 {
    color: #111827 !important;
}

/* Pulsante CHIUDI del popup anteprima */
[data-theme="light"] .preview-box .btn-secondary {
    color: #1d4ed8 !important;
    border-color: #93c5fd !important;
}

[data-theme="light"] .risposta-row {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
}

[data-theme="light"] .risposta-corretta {
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    color: #15803d !important;
}

[data-theme="light"] .empty-state {
    color: #64748b !important;
}

[data-theme="light"] .turno-input,
[data-theme="light"] .turno-input-wrap input,
[data-theme="light"] .turno-input-wrap select {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
}

/* Pulsanti azione header: colori pieni e leggibili su chiaro */
[data-theme="light"] .btn-template {
    background: #ecfeff !important;
    color: #0e7490 !important;
    border-color: #67e8f9 !important;
}

[data-theme="light"] .btn-reset-turni {
    background: #fffbeb !important;
    color: #b45309 !important;
    border-color: #fcd34d !important;
}

[data-theme="light"] .btn-elimina-sessione {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

/* Barra paginazione sopra la tabella */
[data-theme="light"] .pagination-controls {
    background: #f1f5f9 !important;
    border-color: #e5e7eb !important;
}

[data-theme="light"] .page-info {
    color: #475569 !important;
}

/* Pillole statistiche sessione: valori leggibili */
[data-theme="light"] .stat-pill .label {
    color: #64748b !important;
}

[data-theme="light"] .stat-pill.green .value { color: #15803d !important; }
[data-theme="light"] .stat-pill.amber .value { color: #b45309 !important; }
[data-theme="light"] .stat-pill.blue .value { color: #1d4ed8 !important; }
[data-theme="light"] .stat-pill.gray .value { color: #475569 !important; }

/* Toggle "SOLO DISPONIBILI" */
[data-theme="light"] .toggle-wrap {
    background: #f1f5f9 !important;
    border-color: #d1d5db !important;
    color: #475569 !important;
}

/* Azioni riga tabella */
[data-theme="light"] .btn-anteprima {
    background: #f0f9ff !important;
    color: #0369a1 !important;
    border-color: #7dd3fc !important;
}

[data-theme="light"] .btn-trash-row {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

[data-theme="light"] .badge-disponibile {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #86efac !important;
}

/* ==================== EXTRA SICUREZZA TEMA SCURO ====================
   Pochi casi: elementi pensati "chiari" che devono restare leggibili
   anche in scuro (il resto dell'app è nativamente scuro). */

[data-theme="dark"] .mud-tooltip {
    background: #f8fafc !important;
    color: #0f172a !important;
}

/* ==================== ELENCO QUESTIONARI (VediQuestionari) ====================
   La pagina nasce con card "glass" scure e testo chiaro: su tema chiaro
   risultavano slavate/illeggibili. Qui le riportiamo a card bianche. */

[data-theme="light"] .glass-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .glass-card::before {
    background: none !important;
}

[data-theme="light"] .glass-card:hover {
    background: #ffffff !important;
    border-color: #93c5fd !important;
    box-shadow: 0 18px 40px rgba(30, 58, 138, 0.12) !important;
}

[data-theme="light"] .card-name {
    color: #111827 !important;
    text-shadow: none !important;
}

[data-theme="light"] .info-item {
    color: #475569 !important;
}

[data-theme="light"] .info-text strong {
    color: #1e293b !important;
}

[data-theme="light"] .glass-divider {
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.12), transparent) !important;
}

[data-theme="light"] .glass-card-bottom {
    border-top: 1px solid #e5e7eb !important;
}

[data-theme="light"] .btn-rinomina {
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    color: #1d4ed8 !important;
}

[data-theme="light"] .open-indicator {
    color: #1d4ed8 !important;
}

[data-theme="light"] .domande-pill {
    background: #ecfeff !important;
    border: 1px solid #a5f3fc !important;
    color: #0e7490 !important;
}

[data-theme="light"] .domande-pill-empty {
    background: #fffbeb !important;
    border: 1px solid #fde68a !important;
    color: #b45309 !important;
}

/* Header banner: su tema chiaro deve essere chiaro con testo scuro.
   L'icona cartella resta nel suo riquadro blu (.header-icon), quindi
   coloriamo solo i testi (.mud-typography) e non l'icona. */
[data-theme="light"] .page-header {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border: 1px solid #bfdbfe !important;
}

[data-theme="light"] .page-header .mud-typography-h4 {
    color: #0f172a !important;
}

/* Header con titolo in <h1>/<p> (es. pagina Genera Template) */
[data-theme="light"] .page-header .header-text h1 {
    color: #0f172a !important;
}

[data-theme="light"] .page-header .header-text p {
    color: #475569 !important;
}

[data-theme="light"] .page-header .mud-typography-body2,
[data-theme="light"] .page-header [style*="color: #94a3b8"],
[data-theme="light"] .page-header [style*="color:#94a3b8"] {
    color: #475569 !important;
}

/* Riquadro icona cartella: chiaro con icona blu sul tema chiaro */
[data-theme="light"] .header-icon {
    background: #ffffff !important;
    border: 1px solid #bfdbfe !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="light"] .header-icon .mud-icon-root {
    color: #2563eb !important;
}

/* Barra di ricerca (MudTextField outlined): sfondo bianco e testo scuro */
[data-theme="light"] .search-field,
[data-theme="light"] .search-field .mud-input,
[data-theme="light"] .search-field .mud-input-control,
[data-theme="light"] .search-field .mud-input-control .mud-input-root,
[data-theme="light"] .search-field .mud-input-root,
[data-theme="light"] .search-field .mud-input-slot,
[data-theme="light"] .search-field .mud-input-adornment {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

[data-theme="light"] .search-field .mud-input-root input,
[data-theme="light"] .search-field input {
    color: #1f2937 !important;
}

[data-theme="light"] .search-field .mud-input-outlined-border {
    border-color: #cbd5e1 !important;
}

[data-theme="light"] .loading-container,
[data-theme="light"] .empty-state {
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
    color: #475569 !important;
}

/* ==================== CENTRO IMPORTAZIONE (ImportQuestions) ====================
   Pagina nativamente scura: su tema chiaro card/footer/input vanno schiariti.
   Alcuni testi sono bianchi via classe CSS (non inline), quindi gli override
   inline globali del MainLayout non li raggiungono: li coloriamo qui. */
[data-theme="light"] .header-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border: 1px solid #bfdbfe !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.10) !important;
}

[data-theme="light"] .import-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .import-card.card-active {
    border-color: #10b981 !important;
    background: #f0fdf4 !important;
}

[data-theme="light"] .card-title {
    color: #0f172a !important;
}

[data-theme="light"] .card-desc,
[data-theme="light"] .status-text {
    color: #475569 !important;
}

[data-theme="light"] .custom-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1f2937 !important;
}

    [data-theme="light"] .custom-input::placeholder {
        color: #94a3b8 !important;
    }

[data-theme="light"] .btn-state-disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
}

[data-theme="light"] .upload-box {
    background: #f8fafc !important;
    border: 2px dashed #cbd5e1 !important;
}

    [data-theme="light"] .upload-box:hover {
        border-color: #f59e0b !important;
        background: #fff7ed !important;
    }

[data-theme="light"] .footer-bar {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 5px solid #3b82f6 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .btn-start:disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
}

/* ==================== NUOVO DIPENDENTE (CreaUtente) ====================
   Pagina nativamente scura: schiariamo form-card, input, footer e sidebar. */

/* Qui l'header è un semplice titolo (non un banner): annulliamo lo sfondo
   che le regole globali .page-header applicherebbero, altrimenti il riquadro
   si sovrappone all'intestazione del form sottostante. */
[data-theme="light"] .create-container .page-header {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 0 28px 0 !important;
    position: relative !important;
    z-index: 2 !important;
}

/* Spazio equilibrato tra header e form (no sovrapposizione, no buco enorme) */
[data-theme="light"] .create-container .create-layout {
    margin-top: 0 !important;
}

[data-theme="light"] .page-title {
    color: #0f172a !important;
}

[data-theme="light"] .page-subtitle {
    color: #475569 !important;
}

[data-theme="light"] .form-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
    backdrop-filter: none !important;
}

[data-theme="light"] .form-header {
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%) !important;
    border-bottom: 1px solid #eef2f6 !important;
}

[data-theme="light"] .form-header-text h2 {
    color: #0f172a !important;
}

[data-theme="light"] .form-header-text p {
    color: #475569 !important;
}

[data-theme="light"] .field-label {
    color: #334155 !important;
}

[data-theme="light"] .form-footer {
    background: #f8fafc !important;
    border-top: 1px solid #eef2f6 !important;
}

/* Input MudTextField nella form-card: bianchi con testo scuro */
[data-theme="light"] .form-card .mud-input,
[data-theme="light"] .form-card .mud-input-control,
[data-theme="light"] .form-card .mud-input-control .mud-input-root,
[data-theme="light"] .form-card .mud-input-slot {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

[data-theme="light"] .form-card .mud-input-slot,
[data-theme="light"] .form-card .mud-input input {
    color: #1f2937 !important;
}

[data-theme="light"] .form-card .mud-input-outlined-border {
    border-color: #cbd5e1 !important;
}

/* Sidebar informativa */
[data-theme="light"] .info-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .info-card-content h4 {
    color: #0f172a !important;
}

[data-theme="light"] .info-card-content p {
    color: #475569 !important;
}

[data-theme="light"] .sidebar-stats {
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%) !important;
    border: 1px solid #dbeafe !important;
}

[data-theme="light"] .sidebar-stat-number {
    color: #1e3a8a !important;
}

[data-theme="light"] .sidebar-stat-label {
    color: #475569 !important;
}

/* ==================== GESTIONE DIPENDENTI (ListaUtenti) ====================
   Pagina nativamente scura: schiariamo stat-box, ricerca e card utente.
   Scoped a .dipendenti-container per non toccare altre pagine. */
[data-theme="light"] .dipendenti-container .stat-box {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
    backdrop-filter: none !important;
}

[data-theme="light"] .dipendenti-container .stat-number {
    color: #0f172a !important;
}

[data-theme="light"] .dipendenti-container .stat-label {
    color: #475569 !important;
}

[data-theme="light"] .dipendenti-container .search-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1f2937 !important;
}

[data-theme="light"] .dipendenti-container .user-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05) !important;
}

    [data-theme="light"] .dipendenti-container .user-card:hover {
        background: #f8fafc !important;
    }

    [data-theme="light"] .dipendenti-container .user-card.card-online {
        border-left-color: #22c55e !important;
    }

    [data-theme="light"] .dipendenti-container .user-card.card-offline {
        border-left-color: #94a3b8 !important;
    }

    [data-theme="light"] .dipendenti-container .user-card.current-user-card {
        background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%) !important;
        border-color: #bfdbfe !important;
        border-left-color: #3b82f6 !important;
    }

[data-theme="light"] .dipendenti-container .user-name {
    color: #0f172a !important;
}

[data-theme="light"] .dipendenti-container .user-email {
    color: #475569 !important;
}

/* Bordino del pallino di stato: bianco per staccarlo dalla card chiara */
[data-theme="light"] .dipendenti-container .status-dot {
    border-color: #ffffff !important;
}

[data-theme="light"] .dipendenti-container .action-btn {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

    [data-theme="light"] .dipendenti-container .action-btn:hover {
        background: #e2e8f0 !important;
    }

[data-theme="light"] .dipendenti-container .empty-state h3 {
    color: #0f172a !important;
}

/* ==================== LOG DI SISTEMA (SystemLogs) ====================
   Pagina nativamente scura. Scoped a .syslog-page per non toccare altre
   pagine che usano .page-wrapper. */
[data-theme="light"] .syslog-page {
    background-color: transparent !important;
    color: #1f2937 !important;
}

/* Login / Accesso Limitato */
[data-theme="light"] .syslog-page .login-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12) !important;
    backdrop-filter: none !important;
}

    [data-theme="light"] .syslog-page .login-card h2 {
        color: #0f172a !important;
    }

[data-theme="light"] .syslog-page .modern-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1f2937 !important;
}

/* Header banner */
[data-theme="light"] .syslog-page .dashboard-header {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border: 1px solid #bfdbfe !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.10) !important;
}

    [data-theme="light"] .syslog-page .dashboard-header h1 {
        color: #0f172a !important;
    }

    [data-theme="light"] .syslog-page .dashboard-header p {
        color: #475569 !important;
    }

    [data-theme="light"] .syslog-page .dashboard-header [style*="background: rgba(255,255,255,0.1)"] {
        background: #ffffff !important;
        border: 1px solid #bfdbfe !important;
    }

    [data-theme="light"] .syslog-page .dashboard-header .mud-icon-root {
        color: #2563eb !important;
    }

/* Card statistiche */
[data-theme="light"] .syslog-page .stat-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

    [data-theme="light"] .syslog-page .stat-info h3 {
        color: #0f172a !important;
    }

    [data-theme="light"] .syslog-page .stat-info p {
        color: #64748b !important;
    }

/* Barra controlli + pannello filtri */
[data-theme="light"] .syslog-page .controls-bar,
[data-theme="light"] .syslog-page .filters-panel {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .syslog-page .filter-select {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1f2937 !important;
}

[data-theme="light"] .syslog-page .btn-glass {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

    [data-theme="light"] .syslog-page .btn-glass:hover {
        background: #e2e8f0 !important;
        border-color: #94a3b8 !important;
    }

/* Tabella log */
[data-theme="light"] .syslog-page .log-container {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .syslog-page .log-header {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .syslog-page .log-row {
    border-bottom: 1px solid #eef2f6 !important;
}

    [data-theme="light"] .syslog-page .log-row:hover {
        background: #f8fafc !important;
    }

    /* Orario (era #94a3b8) e nome utente (era bianco) */
    [data-theme="light"] .syslog-page .log-row [style*="color: #94a3b8"] {
        color: #64748b !important;
    }

    [data-theme="light"] .syslog-page .log-row [style*="color: white"] {
        color: #0f172a !important;
    }

    [data-theme="light"] .syslog-page .log-row [style*="color: #cbd5e1"] {
        color: #334155 !important;
    }

/* Paginazione */
[data-theme="light"] .syslog-page .page-info {
    color: #64748b !important;
}

[data-theme="light"] .syslog-page .page-btn {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

    [data-theme="light"] .syslog-page .page-btn:hover:not(:disabled) {
        background: #2563eb !important;
        color: #ffffff !important;
    }

/* Popup dettagli log */
[data-theme="light"] .modal-card.syslog-modal {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

    [data-theme="light"] .modal-card.syslog-modal .modal-body {
        color: #334155 !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .modal-header h3,
    [data-theme="light"] .modal-card.syslog-modal .modal-header .mud-icon-root {
        color: #ffffff !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .diff-table td {
        background: #f8fafc !important;
        color: #334155 !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .diff-new {
        background: #f0fdf4 !important;
        color: #166534 !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .diff-old {
        background: #fef2f2 !important;
        color: #7f1d1d !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .backup-body {
        background: #f8fafc !important;
    }

    [data-theme="light"] .modal-card.syslog-modal .import-detail-box {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
    }

        [data-theme="light"] .modal-card.syslog-modal .import-detail-box [style*="color: white"] {
            color: #0f172a !important;
        }

/* ==================== DEVELOPER PANEL ====================
   Le classi .glass-panel/.glass-table/.dev-header/.control-box hanno già
   override nel MainLayout: qui sistemiamo i testi (text-white), la barra
   delle tab (MudTabs usa il colore Surface scuro) e la casella di testo. */
[data-theme="light"] .dev-container .text-white {
    color: #0f172a !important;
}

[data-theme="light"] .dev-container .text-gray-400 {
    color: #475569 !important;
}

[data-theme="light"] .dev-container .dev-header {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

/* Barra delle tab (in MudBlazor 8 è .mud-tabs-tabbar, usa il colore Surface scuro) */
[data-theme="light"] .dev-container .mud-tabs-tabbar {
    background-color: #eff6ff !important;
    border-radius: 10px !important;
}

[data-theme="light"] .dev-container .mud-tab {
    color: #475569 !important;
}

    [data-theme="light"] .dev-container .mud-tab.mud-tab-active {
        color: #1d4ed8 !important;
    }

/* Casella di testo "Invia Messaggio" e altri campi (glass-input) bianchi */
[data-theme="light"] .dev-container .glass-input .mud-input,
[data-theme="light"] .dev-container .glass-input .mud-input-control,
[data-theme="light"] .dev-container .glass-input .mud-input-control .mud-input-root,
[data-theme="light"] .dev-container .glass-input .mud-input-slot {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

[data-theme="light"] .dev-container .glass-input input,
[data-theme="light"] .dev-container .glass-input textarea,
[data-theme="light"] .dev-container .glass-input .mud-input-slot {
    color: #1f2937 !important;
}

[data-theme="light"] .dev-container .glass-input .mud-input-outlined-border {
    border-color: #cbd5e1 !important;
}

/* ==================== POPUP "NOVITÀ & AGGIORNAMENTI" (patch notes) ====================
   Era troppo piccolo (max-width 600px): lo ingrandiamo mantenendolo finestra. */
.patch-popup {
    max-width: 920px !important;
    max-height: 88vh !important;
}

/* ==================== PAGINE DI AUTENTICAZIONE ====================
   Login / Reset / ForgotPassword hanno un design scuro proprio e usano la
   classe .glass-card (come altre pagine). In tema chiaro l'override globale
   di .glass-card le rendeva bianche e illeggibili: qui ripristiniamo lo
   stile scuro per le sole pagine auth (.auth-shell). */
[data-theme="light"] .auth-shell .glass-card {
    background: rgba(20, 35, 55, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: none !important;
}

    [data-theme="light"] .auth-shell .glass-card:hover {
        background: rgba(20, 35, 55, 0.45) !important;
        transform: none !important;
    }

/* ==================== GUIDA (Centro di Formazione) ==================== */
[data-theme="light"] .guida-container .header-section {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    backdrop-filter: none !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .guida-container .page-title {
    color: #0f172a !important;
}

[data-theme="light"] .guida-container .page-subtitle {
    color: #475569 !important;
}

[data-theme="light"] .guida-container .glass-action-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    backdrop-filter: none !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

    [data-theme="light"] .guida-container .card-cyan:hover {
        background: #f8fafc !important;
        border-color: #67e8f9 !important;
    }

    [data-theme="light"] .guida-container .card-red:hover {
        background: #f8fafc !important;
        border-color: #fecaca !important;
    }

    [data-theme="light"] .guida-container .card-text h3 {
        color: #0f172a !important;
    }

    [data-theme="light"] .guida-container .card-text p {
        color: #475569 !important;
    }

[data-theme="light"] .guida-container .card-arrow {
    background: #eff6ff !important;
    color: #2563eb !important;
}

/* Visualizzatore PDF (modal, fuori dal container) */
[data-theme="light"] .pdf-modal-content {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .pdf-modal-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

    [data-theme="light"] .pdf-modal-header h3 {
        color: #0f172a !important;
    }
