/* ================================================================
   MAGISTRALIS — GLACIAL IMPERIAL THEME OVERRIDE
   Attivato da: body.glacial-theme
   Injected via: /pwa-glacial/ (Toolkit locale — originali intatti)
   ================================================================ */

/* ─── BODY & SFONDO PRINCIPALE ───────────────────────────────── */
body.glacial-theme {
    background: linear-gradient(160deg, #ddf3fc 0%, #e8f7fd 55%, #f0f9ff 100%) !important;
    color: #141e30 !important;
}

body.glacial-theme #vanta-bg {
    background: linear-gradient(160deg, #b3e5fc 0%, #d9f0fc 40%, #eff9ff 100%) !important;
}
body.glacial-theme #vanta-bg canvas {
    mix-blend-mode: screen !important;
    opacity: 0.35 !important;
}

body.glacial-theme #bg-watermark {
    opacity: 0.06 !important;
    filter: blur(4px) grayscale(30%) brightness(0) !important;
}

body.glacial-theme #boot-screen {
    background: #ddf3fc !important;
}

/* ─── HEADER ─────────────────────────────────────────────────── */
body.glacial-theme .header {
    background-color: rgba(210, 238, 255, 0.9) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-bottom-color: rgba(197, 160, 89, 0.2) !important;
}

body.glacial-theme .header h1 {
    background: linear-gradient(to bottom, #0d1a28 10%, #1e3a5f 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
}

body.glacial-theme .header .motto {
    color: #c5a059 !important;
    opacity: 1 !important;
}

body.glacial-theme #structure-name {
    color: #141e30 !important;
    text-shadow: 0 1px 3px rgba(179, 229, 252, 0.5) !important;
}

body.glacial-theme #user-display-name {
    color: #141e30 !important;
    text-shadow: none !important;
}

body.glacial-theme #header-logo {
    filter: drop-shadow(0 2px 5px rgba(20, 30, 48, 0.2)) !important;
}

body.glacial-theme #install-button {
    background-color: rgba(179, 229, 252, 0.3) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.6) !important;
}
body.glacial-theme #install-button:hover {
    background-color: #b3e5fc !important;
    color: #141e30 !important;
    box-shadow: 0 0 15px rgba(179, 229, 252, 0.6) !important;
}

/* ─── PULSANTE TEMA (stato attivo in glaciale) ───────────────── */
body.glacial-theme .theme-switch-inner {
    background-color: #b3e5fc !important;
    color: #141e30 !important;
}
body.glacial-theme .theme-icon-svg {
    stroke: #141e30 !important;
}

/* ─── SIDEBAR MENU ───────────────────────────────────────────── */
body.glacial-theme .side-menu-card {
    background: rgba(220, 242, 255, 0.93) !important;
    border-color: rgba(197, 160, 89, 0.2) !important;
    box-shadow: 0 10px 30px rgba(20, 30, 48, 0.1) !important;
}

body.glacial-theme .text {
    background-color: rgba(220, 242, 255, 0.97) !important;
    border-color: rgba(255, 174, 0, 0.25) !important;
    box-shadow: 0 5px 15px rgba(20, 30, 48, 0.15) !important;
}

body.glacial-theme .menu-svg {
    background: rgba(179, 229, 252, 0.25) !important;
    box-shadow:
        inset 0 0 20px rgba(179, 229, 252, 0.2),
        0 5px 5px rgba(20, 30, 48, 0.06) !important;
}
body.glacial-theme .iso-pro:hover .menu-svg {
    background: rgba(179, 229, 252, 0.45) !important;
}

/* ─── CARD GENERICA ──────────────────────────────────────────── */
body.glacial-theme .card {
    background: rgba(255, 255, 255, 0.88) !important;
    color: #141e30 !important;
    box-shadow: 0 8px 32px rgba(20, 30, 48, 0.09) !important;
}
body.glacial-theme .card:hover {
    box-shadow: 0 8px 32px rgba(20, 30, 48, 0.09), 0 0 20px rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme .card h2,
body.glacial-theme .card h3 {
    color: #141e30 !important;
}
body.glacial-theme .card p {
    color: #2c4060 !important;
}

/* ─── TABS ───────────────────────────────────────────────────── */
body.glacial-theme .tabs-container {
    background-color: rgba(179, 229, 252, 0.1) !important;
}
body.glacial-theme .tab-button {
    color: rgba(20, 30, 48, 0.42) !important;
}
body.glacial-theme .tab-button.active {
    color: #141e30 !important;
    border-bottom-color: #7ab8e0 !important;
    background-color: rgba(179, 229, 252, 0.1) !important;
    text-shadow: 0 0 12px rgba(122, 184, 224, 0.45) !important;
}

/* ─── ADMIN HOME — TITOLO ────────────────────────────────────── */
body.glacial-theme .adm-page-title h2 {
    color: #c5a059 !important;
}
body.glacial-theme .adm-page-title p {
    color: rgba(20, 30, 48, 0.45) !important;
}

/* ─── ADMIN HOME — STAT CARDS ────────────────────────────────── */
body.glacial-theme .adm-stat-card {
    background: rgba(248, 253, 255, 0.96) !important;
    box-shadow:
        inset 0 0 20px rgba(179, 229, 252, 0.12),
        0 2px 12px rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme .adm-stat-card:hover {
    box-shadow:
        inset 0 0 20px rgba(179, 229, 252, 0.12),
        0 2px 12px rgba(20, 30, 48, 0.07),
        0 0 20px rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme .adm-stat-num  { color: #c5a059  !important; }
body.glacial-theme .adm-stat-label { color: rgba(197, 160, 89, 0.7) !important; }
body.glacial-theme .adm-stat-delta { color: #2c4060 !important; }

/* ─── ADMIN HOME — CARDS GRIGLIA ────────────────────────────── */
body.glacial-theme .adm-card {
    background: rgba(248, 253, 255, 0.96) !important;
    box-shadow:
        inset 0 0 20px rgba(179, 229, 252, 0.08),
        0 2px 12px rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme .adm-card:hover {
    box-shadow:
        inset 0 0 20px rgba(179, 229, 252, 0.08),
        0 2px 12px rgba(20, 30, 48, 0.07),
        0 0 20px rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme .adm-card-title {
    color: #c5a059 !important;
}
body.glacial-theme .adm-card-header {
    border-bottom-color: rgba(197, 160, 89, 0.15) !important;
}
body.glacial-theme .adm-section-label {
    color: rgba(197, 160, 89, 0.5) !important;
}
body.glacial-theme .adm-divider {
    background: rgba(20, 30, 48, 0.08) !important;
}

/* ─── ADMIN HOME — TABELLA ───────────────────────────────────── */
body.glacial-theme .adm-table th {
    color: #141e30 !important;
    border-bottom-color: rgba(197, 160, 89, 0.18) !important;
}
body.glacial-theme .adm-table td {
    color: #1e3350 !important;
    border-bottom-color: rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme .adm-table tr:hover td {
    background: rgba(179, 229, 252, 0.16) !important;
}
body.glacial-theme .adm-legend-row {
    color: #1e3350 !important;
}

/* ─── ADMIN HOME — QUICK LINKS ───────────────────────────────── */
body.glacial-theme .adm-quicklink {
    background: rgba(244, 251, 255, 0.9) !important;
    outline-color: rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme .adm-quicklink:hover {
    background: rgba(179, 229, 252, 0.18) !important;
    outline-color: rgba(197, 160, 89, 0.4) !important;
}
body.glacial-theme .adm-quicklink-title { color: #c5a059 !important; }
body.glacial-theme .adm-quicklink-sub   { color: rgba(20, 30, 48, 0.42) !important; }
body.glacial-theme .adm-quicklink-arrow { color: rgba(20, 30, 48, 0.18) !important; }
body.glacial-theme .adm-quicklink-icon  {
    background: rgba(179, 229, 252, 0.25) !important;
}

/* ─── ADMIN HOME — ALERT ─────────────────────────────────────── */
body.glacial-theme .adm-alert-text { color: #1e3350  !important; }
body.glacial-theme .adm-alert-time { color: rgba(20, 30, 48, 0.35) !important; }

/* ─── ADMIN HOME — EMERGENZA SLOT ────────────────────────────── */
body.glacial-theme .adm-emg-slot {
    background: rgba(240, 250, 255, 0.9) !important;
    outline-color: rgba(197, 160, 89, 0.14) !important;
}
body.glacial-theme .adm-emg-slot-label { color: #141e30 !important; }
body.glacial-theme .adm-emg-slot-nome  { color: #c5a059  !important; }
body.glacial-theme .adm-emg-slot-sub   { color: rgba(20, 30, 48, 0.52) !important; }
body.glacial-theme .adm-emg-cand-nome  { color: #141e30 !important; }
body.glacial-theme .adm-emg-cand-rank  { color: #c5a059  !important; }
body.glacial-theme .adm-emg-no-cand    { color: rgba(20, 30, 48, 0.38) !important; }
body.glacial-theme .adm-emg-footer     { color: rgba(20, 30, 48, 0.28) !important; }
body.glacial-theme .adm-emg-turno-info { color: rgba(20, 30, 48, 0.68) !important; }
body.glacial-theme .adm-emg-cand-clickable:hover {
    background: rgba(179, 229, 252, 0.18) !important;
    outline-color: rgba(197, 160, 89, 0.28) !important;
}

/* ─── ADMIN — MODALE EMERGENZA ───────────────────────────────── */
body.glacial-theme .adm-emg-modale-overlay {
    background: rgba(150, 210, 240, 0.7) !important;
}
body.glacial-theme .adm-emg-modale-box {
    background: rgba(240, 250, 255, 0.99) !important;
}
body.glacial-theme .adm-emg-modale-header {
    border-bottom-color: rgba(197, 160, 89, 0.14) !important;
}
body.glacial-theme .adm-emg-modale-footer {
    border-top-color: rgba(197, 160, 89, 0.14) !important;
}

/* ─── SISTEMA MODALE MAGISTRALIS ─────────────────────────────── */
body.glacial-theme .magistralis-modal-overlay {
    background: rgba(160, 215, 240, 0.72) !important;
}
body.glacial-theme .magistralis-modal,
body.glacial-theme .magistralis-modal-card {
    background: linear-gradient(180deg, #f0f8ff, #e8f5fd) !important;
    color: #141e30 !important;
    box-shadow: 0 0 40px rgba(20, 30, 48, 0.14) !important;
}
body.glacial-theme .magistralis-modal p {
    color: #2c4060 !important;
}
body.glacial-theme .modal-divider {
    background: linear-gradient(90deg, transparent, rgba(197,160,89,0.5), transparent) !important;
}
body.glacial-theme .modal-subtitle {
    color: #4a6080 !important;
}

/* ─── MODALE SCAMBI ──────────────────────────────────────────── */
body.glacial-theme .swap-context-header {
    background: rgba(197, 160, 89, 0.05) !important;
}
body.glacial-theme .swap-party strong {
    color: #c5a059 !important;
}
body.glacial-theme .swap-party span {
    color: #4a6080 !important;
}
body.glacial-theme .conflict-item {
    background: rgba(192, 57, 43, 0.04) !important;
}
body.glacial-theme .conflict-solution-box {
    border-top-color: rgba(20, 30, 48, 0.12) !important;
}
body.glacial-theme .solution-select {
    background: #ffffff !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.35) !important;
}
body.glacial-theme .solution-select:focus {
    border-color: #7ab8e0 !important;
}

/* ─── MODALI GENERICHE (pattern catch-all) ───────────────────── */
body.glacial-theme [class*="modal-overlay"],
body.glacial-theme [class*="modale-overlay"],
body.glacial-theme [class*="overlay-bg"] {
    background: rgba(150, 210, 235, 0.72) !important;
}
body.glacial-theme [class*="modal-box"],
body.glacial-theme [class*="modale-box"],
body.glacial-theme [class*="modal-content"]:not(.pdf-embed-container),
body.glacial-theme [class*="modal-card"] {
    background: rgba(240, 250, 255, 0.99) !important;
    color: #141e30 !important;
}

/* ─── PDF MODAL ──────────────────────────────────────────────── */
body.glacial-theme .pdf-modal-content {
    background: #f0f8ff !important;
    border-color: rgba(197, 160, 89, 0.3) !important;
}
body.glacial-theme .pdf-modal-header {
    background: #ddeef8 !important;
    border-bottom-color: rgba(179, 229, 252, 0.3) !important;
}

/* ─── LOGIN CARD ─────────────────────────────────────────────── */
body.glacial-theme .login-card input,
body.glacial-theme .login-card select {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.35) !important;
}
body.glacial-theme .login-card input::placeholder {
    color: rgba(20, 30, 48, 0.35) !important;
}
body.glacial-theme .login-card input:focus {
    background: #ffffff !important;
    border-color: #7ab8e0 !important;
    box-shadow: 0 0 20px rgba(179, 229, 252, 0.35) !important;
}

/* ─── INPUT / SELECT / TEXTAREA (tutti i moduli) ─────────────── */
body.glacial-theme input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.glacial-theme select,
body.glacial-theme textarea {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.3) !important;
}
body.glacial-theme input::placeholder,
body.glacial-theme textarea::placeholder {
    color: rgba(20, 30, 48, 0.35) !important;
}
body.glacial-theme input:focus:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.glacial-theme select:focus,
body.glacial-theme textarea:focus {
    background: #ffffff !important;
    border-color: #7ab8e0 !important;
    box-shadow: 0 0 18px rgba(179, 229, 252, 0.28) !important;
    outline: none !important;
}
body.glacial-theme select option {
    background: #f0f8ff !important;
    color: #141e30 !important;
}

/* ─── CUSTOM SELECT MAGISTRALIS ──────────────────────────────── */
body.glacial-theme [class*="custom-select"],
body.glacial-theme [class*="mag-select"] {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.3) !important;
}
body.glacial-theme [class*="select-dropdown"],
body.glacial-theme [class*="select-options"] {
    background: rgba(240, 250, 255, 0.98) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme [class*="select-option"]:hover,
body.glacial-theme [class*="select-item"]:hover {
    background: rgba(179, 229, 252, 0.22) !important;
}

/* ─── DROPDOWN MAGISTRALIS ───────────────────────────────────── */
body.glacial-theme [class*="mag-dropdown"],
body.glacial-theme [class*="dropdown-menu"],
body.glacial-theme [class*="dropdown-content"] {
    background: rgba(240, 250, 255, 0.98) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.2) !important;
    box-shadow: 0 8px 24px rgba(20, 30, 48, 0.12) !important;
}
body.glacial-theme [class*="dropdown-item"]:hover {
    background: rgba(179, 229, 252, 0.22) !important;
}

/* ─── TABELLA GENERICA (non-adm) ─────────────────────────────── */
body.glacial-theme table:not(.adm-table) {
    background: transparent !important;
}
body.glacial-theme table:not(.adm-table) th {
    background: rgba(210, 238, 255, 0.5) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.15) !important;
}
body.glacial-theme table:not(.adm-table) td {
    color: #1e3350 !important;
    border-color: rgba(20, 30, 48, 0.06) !important;
}
body.glacial-theme table:not(.adm-table) tr:hover td {
    background: rgba(179, 229, 252, 0.12) !important;
}

/* ─── PILL / BADGE STATUS (restano colorati) ─────────────────── */
body.glacial-theme .adm-pill-pending {
    background: rgba(243, 156, 18,  0.10) !important;
}
body.glacial-theme .adm-pill-ok {
    background: rgba(46,  204, 113, 0.08) !important;
}
body.glacial-theme .adm-pill-denied {
    background: rgba(231, 76,  60,  0.08) !important;
}
body.glacial-theme .adm-pill-muted {
    background: rgba(197, 160, 89,  0.08) !important;
}

/* ─── EMPTY STATE / LOADING ──────────────────────────────────── */
body.glacial-theme .empty-state {
    background-color: rgba(220, 242, 255, 0.3) !important;
    color: rgba(20, 30, 48, 0.52) !important;
    border-color: rgba(20, 30, 48, 0.06) !important;
}
body.glacial-theme #loading {
    color: rgba(20, 30, 48, 0.62) !important;
}

/* ─── CALENDAR ───────────────────────────────────────────────── */
body.glacial-theme [class*="calendar-header"],
body.glacial-theme [class*="cal-header"] {
    background: rgba(210, 238, 255, 0.85) !important;
    color: #141e30 !important;
}
body.glacial-theme [class*="calendar-cell"],
body.glacial-theme [class*="cal-cell"],
body.glacial-theme [class*="day-cell"] {
    background: rgba(240, 250, 255, 0.88) !important;
    color: #141e30 !important;
}
body.glacial-theme [class*="calendar-day"]:hover,
body.glacial-theme [class*="cal-day"]:hover {
    background: rgba(179, 229, 252, 0.3) !important;
}

/* ─── FERIE MODULE ───────────────────────────────────────────── */
body.glacial-theme [id*="ferie"],
body.glacial-theme [class*="ferie-card"],
body.glacial-theme [class*="ferie-panel"],
body.glacial-theme [class*="ferie-row"]:not(tr) {
    color: #141e30 !important;
}
body.glacial-theme [class*="ferie-header"] {
    background: rgba(210, 238, 255, 0.8) !important;
    color: #141e30 !important;
}

/* ─── TURNI MODULE ───────────────────────────────────────────── */
body.glacial-theme [id*="turni"],
body.glacial-theme [class*="turni-card"],
body.glacial-theme [class*="turni-panel"],
body.glacial-theme [class*="turni-slot"] {
    color: #141e30 !important;
}
body.glacial-theme [class*="turno-row"],
body.glacial-theme [class*="shift-row"] {
    color: #1e3350 !important;
}

/* ─── ANAGRAFICA MODULE ──────────────────────────────────────── */
body.glacial-theme [id*="anagrafica"],
body.glacial-theme [class*="anagrafica-card"],
body.glacial-theme [class*="anagrafica-header"] {
    color: #141e30 !important;
}

/* ─── CHAT MODULE ────────────────────────────────────────────── */
body.glacial-theme [id*="chat"],
body.glacial-theme [class*="chat-header"],
body.glacial-theme [class*="chat-input-area"] {
    background: rgba(240, 250, 255, 0.9) !important;
    color: #141e30 !important;
}
body.glacial-theme [class*="chat-bubble"],
body.glacial-theme [class*="message-bubble"],
body.glacial-theme [class*="chat-msg"] {
    background: rgba(230, 246, 255, 0.9) !important;
    color: #141e30 !important;
}

/* ─── SUPERADMIN ─────────────────────────────────────────────── */
body.glacial-theme [id*="superadmin"],
body.glacial-theme [class*="superadmin-card"] {
    color: #141e30 !important;
}

/* ─── AUDIT MODULE ───────────────────────────────────────────── */
body.glacial-theme [id*="audit"],
body.glacial-theme [class*="audit-card"],
body.glacial-theme [class*="audit-section"] {
    color: #141e30 !important;
}
body.glacial-theme [class*="audit-header"] {
    background: rgba(210, 238, 255, 0.8) !important;
    color: #141e30 !important;
}

/* ─── UDIENZE / PERSONALE ────────────────────────────────────── */
body.glacial-theme [id*="udienze"],
body.glacial-theme [id*="personale"],
body.glacial-theme [class*="udienze-card"],
body.glacial-theme [class*="personale-card"] {
    color: #141e30 !important;
}

/* ─── PRESIDENZA / DOCUMENTI ─────────────────────────────────── */
body.glacial-theme [id*="presidenza"],
body.glacial-theme [class*="presidenza-card"],
body.glacial-theme [class*="doc-card"] {
    color: #141e30 !important;
}

/* ─── SPIN BUTTON (.mag-button — es. ASSISTENTE AI) ─────────── */
body.glacial-theme .mag-button {
    background: rgba(240, 250, 255, 0.97) !important;
    color: #141e30 !important;
    text-shadow: none !important;
}
body.glacial-theme .mag-button:hover {
    background: rgba(215, 240, 255, 0.97) !important;
}
body.glacial-theme .mag-button-border {
    background: rgba(197, 160, 89, 0.22) !important;
}
/* selettori generici per varianti naming */
body.glacial-theme [class*="spin-btn"],
body.glacial-theme [class*="spin-button"],
body.glacial-theme [class*="mag-spin"] {
    background: rgba(240, 250, 255, 0.97) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.3) !important;
}

/* ─── NOTIFICHE / TOAST ──────────────────────────────────────── */
body.glacial-theme [class*="toast"],
body.glacial-theme [class*="notification-box"],
body.glacial-theme [class*="alert-toast"] {
    background: rgba(240, 250, 255, 0.97) !important;
    color: #141e30 !important;
    box-shadow: 0 4px 20px rgba(20, 30, 48, 0.14) !important;
}

/* ─── DARK INLINE CONTAINERS (override generico sfondo scuro) ── */
/* Copre i container che usano classi generiche con bg scuro */
body.glacial-theme [class*="-section"],
body.glacial-theme [class*="-panel"] {
    background-color: transparent !important;
}

/* Override specifico per background scuri espliciti nelle classi note */
body.glacial-theme .adm-emg-slot,
body.glacial-theme .adm-quicklink,
body.glacial-theme [class*="info-box"],
body.glacial-theme [class*="data-box"],
body.glacial-theme [class*="detail-box"] {
    background: rgba(240, 250, 255, 0.9) !important;
    color: #141e30 !important;
}

/* ─── GOLD BUTTONS — interno chiaro in glaciale ──────────────── */
/* Bordo gold istituzionale conservato; interno diventa bianco ghiaccio */

/* .gold-btn (login, azioni generali) */
body.glacial-theme .gold-btn::before {
    background-color: rgba(240, 250, 255, 0.97) !important;
}
body.glacial-theme .gold-btn span {
    color: #141e30 !important;
    text-shadow: none !important;
}
body.glacial-theme .gold-btn:hover::before {
    background-color: rgba(215, 240, 255, 0.97) !important;
}

/* .gold-btn-action (Stampa Turni, Funzionalità Avanzate, Elimina, ecc.) */
body.glacial-theme .gold-btn-action::before {
    background-color: rgba(240, 250, 255, 0.97) !important;
}
body.glacial-theme .gold-btn-action span {
    color: #141e30 !important;
    text-shadow: none !important;
}
body.glacial-theme .gold-btn-action:hover::before {
    background-color: rgba(215, 240, 255, 0.97) !important;
}
/* Danger buttons: rosso leggero */
body.glacial-theme .gold-btn-danger::before,
body.glacial-theme .gold-btn-action.gold-btn-danger::before {
    background-color: rgba(255, 245, 244, 0.97) !important;
}
body.glacial-theme .gold-btn-danger span,
body.glacial-theme .gold-btn-action.gold-btn-danger span {
    color: #c0392b !important;
}

/* .logout-mag-inner (pulsante Logout + badge utente) */
body.glacial-theme .logout-mag-inner {
    background-color: rgba(240, 250, 255, 0.97) !important;
    color: #141e30 !important;
}
body.glacial-theme .logout-mag-inner svg {
    fill: #141e30 !important;
}
body.glacial-theme .logout-mag-gold:hover .logout-mag-inner {
    background-color: rgba(215, 240, 255, 0.97) !important;
}
body.glacial-theme #user-badge-header .logout-mag-inner {
    background-color: rgba(240, 250, 255, 0.97) !important;
    color: #141e30 !important;
}

/* ================================================================
   BLOCCO 2 — COMPONENTI MODULO (layout_fixed.css + components.css)
   ================================================================ */

/* ─── CSS VARIABLES override per tutto il corpo glaciale ─────── */
body.glacial-theme {
    --text-primary:   #1e3350;
    --accent-gold:    #c5a059;
    --border-color:   rgba(197, 160, 89, 0.22);
    --bg-card:        rgba(240, 250, 255, 0.92);
    --text-secondary: rgba(20, 30, 48, 0.55);
}

/* ─── PANNELLO PRINCIPALE MODULI (.detail-panel-container) ──── */
/* Questo è il wrapper scuro di TUTTI i pannelli: ferie, turni,  */
/* anagrafica, cockpit decisionale, backup, ecc.                 */
body.glacial-theme .detail-panel-container {
    background: rgba(240, 250, 255, 0.94) !important;
    box-shadow: 0 4px 20px rgba(20, 30, 48, 0.08) !important;
    color: #141e30 !important;
}

/* ─── HEADER INTERNO PANNELLO (.detail-header) ───────────────── */
body.glacial-theme .detail-header {
    background: linear-gradient(90deg, #ddeef8, #e8f4fd) !important;
    border-bottom-color: rgba(197, 160, 89, 0.22) !important;
}
body.glacial-theme .detail-header *,
body.glacial-theme .detail-header h2,
body.glacial-theme .detail-header h3,
body.glacial-theme .detail-header span,
body.glacial-theme .detail-header p {
    color: #141e30 !important;
}

/* ─── GRUPPI DENTRO IL PANNELLO (.detail-group) ──────────────── */
body.glacial-theme .detail-group {
    background: rgba(224, 242, 255, 0.45) !important;
    border-color: rgba(197, 160, 89, 0.28) !important;
}
body.glacial-theme .group-title {
    color: #c5a059 !important;
    border-bottom-color: rgba(197, 160, 89, 0.28) !important;
}

/* ─── INPUT / TEXTAREA DENTRO .input-wrap ────────────────────── */
body.glacial-theme .input-wrap label {
    color: #4a6080 !important;
}
body.glacial-theme .input-wrap input,
body.glacial-theme .input-wrap textarea {
    background: rgba(255, 255, 255, 0.94) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.28) !important;
}
body.glacial-theme .input-wrap input:focus,
body.glacial-theme .input-wrap textarea:focus {
    background: #ffffff !important;
    border-color: #7ab8e0 !important;
    box-shadow: 0 0 10px rgba(179, 229, 252, 0.28) !important;
}
body.glacial-theme .input-wrap input:disabled,
body.glacial-theme .input-wrap textarea:disabled {
    background: rgba(200, 220, 235, 0.4) !important;
    color: rgba(20, 30, 48, 0.38) !important;
    border-color: rgba(20, 30, 48, 0.1) !important;
}

/* ─── MINI TABLE ─────────────────────────────────────────────── */
body.glacial-theme .mini-table-container {
    border-color: rgba(197, 160, 89, 0.3) !important;
}
body.glacial-theme .mini-table th {
    background: #ddeef8 !important;
    color: #141e30 !important;
}
body.glacial-theme .mini-table td {
    color: #1e3350 !important;
    border-bottom-color: rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme .mini-table tr.selected-mini td {
    background-color: rgba(197, 160, 89, 0.14) !important;
}
body.glacial-theme .mini-btn {
    border-color: rgba(20, 30, 48, 0.3) !important;
    color: #2c4060 !important;
}
body.glacial-theme .mini-btn:hover {
    border-color: #c5a059 !important;
    color: #c5a059 !important;
}

/* ─── CALENDARIO FERIE (.calendar-container) ─────────────────── */
body.glacial-theme .calendar-container {
    background: rgba(220, 242, 255, 0.35) !important;
    border-color: rgba(197, 160, 89, 0.22) !important;
    color: #2c4060 !important;
}

/* ─── PREVIEW STAMPA (.magistralis-preview-pane) ─────────────── */
body.glacial-theme .magistralis-preview-pane {
    background: #f4faff !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.35) !important;
}
body.glacial-theme .magistralis-preview-pane h2,
body.glacial-theme .magistralis-preview-pane h3,
body.glacial-theme .magistralis-preview-pane div {
    color: #141e30 !important;
}
body.glacial-theme .magistralis-preview-pane table { color: #1e3350 !important; }
body.glacial-theme .magistralis-preview-pane th {
    background: linear-gradient(to bottom, #ddeef8, #e8f4fd) !important;
    color: #141e30 !important;
    border-color: rgba(20, 30, 48, 0.14) !important;
}
body.glacial-theme .magistralis-preview-pane td {
    color: #1e3350 !important;
    border-color: rgba(20, 30, 48, 0.12) !important;
}

/* ─── TABLE SCROLL WRAPPER ───────────────────────────────────── */
body.glacial-theme .table-scroll-wrapper {
    background: transparent !important;
}

/* ─── VIEW HEADER (cockpit decisionale, ecc.) ───────────────── */
body.glacial-theme .view-header,
body.glacial-theme [class*="cockpit-header"],
body.glacial-theme [class*="module-header"] {
    background: rgba(220, 240, 255, 0.5) !important;
    border-bottom-color: rgba(197, 160, 89, 0.18) !important;
    color: #141e30 !important;
}
body.glacial-theme .view-header * { color: #141e30 !important; }

/* ─── LOG CONTAINERS (superadmin) ───────────────────────────── */
body.glacial-theme #vm-terminal-content,
body.glacial-theme #log-results-container,
body.glacial-theme #view-queue,
body.glacial-theme #view-health,
body.glacial-theme #view-svc,
body.glacial-theme #view-users {
    background-color: rgba(230, 245, 255, 0.6) !important;
    border-color: rgba(197, 160, 89, 0.22) !important;
    color: #141e30 !important;
}
body.glacial-theme #vm-command-line {
    background-color: rgba(215, 235, 252, 0.85) !important;
    border-top-color: rgba(20, 30, 48, 0.08) !important;
}
body.glacial-theme .log-tab { color: #2c4060 !important; }
body.glacial-theme .log-tab.active {
    color: #141e30 !important;
    background: rgba(197, 160, 89, 0.1) !important;
    border-color: rgba(197, 160, 89, 0.28) !important;
}

/* ─── HARDWARE MONITOR (ECharts — workaround CSS) ────────────── */
/* Il canvas ECharts usa colori dark JS-driven;                  */
/* chiarisce il widget con filter senza toccare il JS            */
body.glacial-theme [id*="hw-"],
body.glacial-theme [id*="hardware-monitor"],
body.glacial-theme [class*="hw-monitor"],
body.glacial-theme [class*="hardware-widget"] {
    background: rgba(230, 245, 255, 0.5) !important;
}
body.glacial-theme [id*="hw-"] canvas,
body.glacial-theme [id*="hardware-monitor"] canvas,
body.glacial-theme [class*="hw-monitor"] canvas {
    filter: brightness(1.6) saturate(0.85) contrast(0.9) !important;
}

/* ─── FERIE TABLE ────────────────────────────────────────────── */
body.glacial-theme .ferie-table th {
    color: #c5a059 !important;
    border-bottom-color: rgba(197, 160, 89, 0.22) !important;
}
body.glacial-theme .ferie-table td {
    color: #1e3350 !important;
    border-bottom-color: rgba(20, 30, 48, 0.07) !important;
}

/* ─── BUTTONS ROW ────────────────────────────────────────────── */
body.glacial-theme .buttons-row {
    background: transparent !important;
}

/* ================================================================
   BLOCCO 3 — MODULI SPECIFICI + TABELLE INTERNE
   ================================================================ */

/* ─── THEAD TD (moduli che usano td invece di th negli header) ── */
body.glacial-theme table thead td {
    background: rgba(210, 238, 255, 0.65) !important;
    background-image: none !important;
    color: #141e30 !important;
    border-bottom-color: rgba(197, 160, 89, 0.18) !important;
}
body.glacial-theme table thead tr {
    background: rgba(210, 238, 255, 0.65) !important;
    background-image: none !important;
}

/* ─── MAGISTRALIS TABLE COMPONENT (div-based, non <table>) ────── */
/* Il componente window.MagistralisTable genera header con          */
/* position:sticky come inline style invece di <thead>             */
/* Questo selettore cattura l'header div di qualsiasi MagTable     */
body.glacial-theme div[style*="sticky"] {
    background: rgba(210, 238, 255, 0.65) !important;
    backdrop-filter: blur(4px) !important;
}
/* Corpo righe del componente MagistralisTable */
body.glacial-theme .mg-table-body > div {
    background: transparent !important;
}
body.glacial-theme .mg-table-body > div:hover {
    background: rgba(179, 229, 252, 0.2) !important;
}

/* ─── FERIE: pannello sinistro (.db-container) ───────────────── */
body.glacial-theme .db-container {
    background: rgba(240, 250, 255, 0.94) !important;
}
/* Wrapper ricerca (div anonimo con background scuro) */
body.glacial-theme .db-container > [style*="rgba(0,0,0"],
body.glacial-theme .db-container > [style*="0,0,0"] {
    background: rgba(215, 238, 252, 0.55) !important;
    background-color: rgba(215, 238, 252, 0.55) !important;
}
/* Ferie search input (inline style quasi-trasparente su scuro) */
body.glacial-theme .ferie-search-input,
body.glacial-theme input.ferie-search-input {
    background: rgba(255, 255, 255, 0.94) !important;
    color: #141e30 !important;
    border-color: rgba(197, 160, 89, 0.3) !important;
}
/* Tabella storico ferie */
body.glacial-theme #ferie-table-wrap table thead th,
body.glacial-theme #ferie-table-wrap table thead tr {
    background: rgba(210, 238, 255, 0.65) !important;
    background-image: none !important;
    color: #141e30 !important;
    border-bottom-color: rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme #ferie-table-wrap table tbody tr {
    background: transparent !important;
    background-color: transparent !important;
}
body.glacial-theme #ferie-table-wrap table tbody td {
    color: #1e3350 !important;
    background: transparent !important;
    border-bottom-color: rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme #ferie-table-wrap table tbody tr:hover td {
    background: rgba(179, 229, 252, 0.18) !important;
}

/* ─── TABELLE DENTRO detail-panel-container ─────────────────── */
body.glacial-theme .detail-panel-container table thead th {
    background: rgba(210, 238, 255, 0.65) !important;
    background-image: none !important;
    color: #141e30 !important;
}
body.glacial-theme .detail-panel-container table tbody tr {
    background: transparent !important;
    background-color: transparent !important;
}
body.glacial-theme .detail-panel-container table tbody td {
    color: #1e3350 !important;
    background: transparent !important;
}
body.glacial-theme .detail-panel-container table tbody tr:hover td {
    background: rgba(179, 229, 252, 0.15) !important;
}

/* ─── TURNI: calendario tabella ──────────────────────────────── */
body.glacial-theme .detail-panel-container .table-scroll-wrapper table thead th,
body.glacial-theme [id*="turni-table"] thead th,
body.glacial-theme [class*="turni-table"] thead th {
    background: rgba(210, 238, 255, 0.65) !important;
    color: #141e30 !important;
}
body.glacial-theme .detail-panel-container .table-scroll-wrapper table tbody tr,
body.glacial-theme [id*="turni-table"] tbody tr,
body.glacial-theme [class*="turni-table"] tbody tr {
    background: transparent !important;
    background-color: transparent !important;
}
body.glacial-theme .detail-panel-container .table-scroll-wrapper table tbody td,
body.glacial-theme [id*="turni-table"] tbody td,
body.glacial-theme [class*="turni-table"] tbody td {
    color: #1e3350 !important;
    background: transparent !important;
}

/* ─── ANAGRAFICA: detail-header con inline style ─────────────── */
/* Già coperto da .detail-header con !important — qui forziamo   */
/* anche il testo del titolo che può avere color inline          */
body.glacial-theme .detail-header h3[style*="color:#c5a059"],
body.glacial-theme .detail-header h3[style*="color: #c5a059"] {
    color: #c5a059 !important;
}
/* Badge UTENZA ATTIVA in anagrafica */
body.glacial-theme #pwa-active-badge {
    background: rgba(230, 245, 255, 0.92) !important;
    border-color: rgba(197, 160, 89, 0.28) !important;
}
body.glacial-theme #pwa-active-badge > div:not([style*="2ecc71"]) {
    color: #141e30 !important;
}
body.glacial-theme #pwa-active-badge > div[style*="8899a6"] {
    color: #4a6080 !important;
}

/* ─── COCKPIT DECISIONALE (presidenza module) ────────────────── */
body.glacial-theme .pres-dashboard-wrapper {
    background: rgba(240, 250, 255, 0.94) !important;
    box-shadow: 0 0 30px rgba(20, 30, 48, 0.08) !important;
}
body.glacial-theme .pres-header {
    background: linear-gradient(90deg, #ddeef8, #e8f4fd) !important;
    border-bottom-color: rgba(197, 160, 89, 0.22) !important;
}
body.glacial-theme .pres-title-text {
    color: #141e30 !important;
    text-shadow: none !important;
}
/* AREA CONTENUTO — questa è la parte grigia: radial-gradient scuro */
body.glacial-theme .pres-content-area {
    background: rgba(240, 250, 255, 0.6) !important;
}
body.glacial-theme .pres-tabs-container {
    background: rgba(220, 240, 255, 0.2) !important;
}
body.glacial-theme .pres-tab {
    color: #2c4060 !important;
}
body.glacial-theme .pres-tab:hover {
    color: #141e30 !important;
    background: rgba(179, 229, 252, 0.15) !important;
}
body.glacial-theme .pres-tab.active {
    color: #c5a059 !important;
    background: linear-gradient(to top, rgba(197, 160, 89, 0.1), transparent) !important;
    border-bottom-color: #c5a059 !important;
    text-shadow: none !important;
}
/* Righe archivio */
body.glacial-theme .archive-row-item {
    background: rgba(240, 250, 255, 0.7) !important;
    border-bottom-color: rgba(20, 30, 48, 0.07) !important;
}
body.glacial-theme .archive-row-item:hover {
    background: rgba(179, 229, 252, 0.2) !important;
}
body.glacial-theme .meta-title   { color: #141e30 !important; }
body.glacial-theme .meta-subtitle { color: #4a6080 !important; }
body.glacial-theme .meta-id      { color: rgba(20, 30, 48, 0.45) !important; }
/* Inbox card */
body.glacial-theme .inbox-card {
    background: rgba(245, 252, 255, 0.9) !important;
    border-color: rgba(197, 160, 89, 0.2) !important;
}
body.glacial-theme .inbox-card:hover {
    box-shadow: 0 5px 15px rgba(20, 30, 48, 0.1) !important;
}
/* Card pratiche cockpit (classi generiche) */
body.glacial-theme [class*="pres-empty"],
body.glacial-theme [class*="pres-empty-state"],
body.glacial-theme [class*="pres-no-items"] {
    color: #2c4060 !important;
}

/* ─── SUPERADMIN BACKUP: stat cards (grayish) ───────────────── */
body.glacial-theme [class*="wal-stat"],
body.glacial-theme [class*="backup-stat"],
body.glacial-theme [id*="wal-stat"],
body.glacial-theme [id*="backup-stat"] {
    background: rgba(232, 247, 255, 0.85) !important;
    color: #141e30 !important;
}

/* ─── SCROLLBAR (quando visibile) ───────────────────────────── */
body.glacial-theme ::-webkit-scrollbar-track {
    background: rgba(220, 242, 255, 0.3) !important;
}
body.glacial-theme ::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.28) !important;
    border-radius: 4px !important;
}
body.glacial-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.48) !important;
}
