/* 72_01: opt-in esclusivo data-bs-theme=dark. Nessuna regola light alterata.
   Applica al layout condiviso e componenti comuni; pagine CSS specialistiche
   (editor, FullCalendar, grafici, stampe/PDF) richiedono validazione dedicata. */
html[data-bs-theme="dark"] {
    color-scheme: dark;
    --cpm-primary: #8fb7ff;
    --cpm-primary-rgb: 143,183,255;
    --cpm-primary-hover: #b1ceff;
    --cpm-primary-dark: #b1ceff;
    --cpm-primary-soft: #192e4a;
    --cpm-primary-border: #345175;
    --cpm-success: #61d6a0;
    --cpm-success-rgb: 97,214,160;
    --cpm-success-hover: #8deac1;
    --cpm-success-soft: #163b31;
    --cpm-success-border: #2d6855;
    --cpm-warning: #ffd074;
    --cpm-warning-rgb: 255,208,116;
    --cpm-warning-hover: #ffe4a9;
    --cpm-warning-soft: #463718;
    --cpm-warning-border: #73592e;
    --cpm-danger: #ff929d;
    --cpm-danger-rgb: 255,146,157;
    --cpm-danger-hover: #ffb2ba;
    --cpm-danger-soft: #461e28;
    --cpm-danger-border: #75414b;
    --cpm-info: #77dcef;
    --cpm-info-rgb: 119,220,239;
    --cpm-info-hover: #a6edfa;
    --cpm-info-soft: #153943;
    --cpm-info-border: #31616c;
    --cpm-background: #101820;
    --cpm-surface: #1b2935;
    --cpm-surface-soft: #233443;
    --cpm-text: #eff4fa;
    --cpm-text-secondary: #c5d1dd;
    --cpm-muted: #a4b6c7;
    --cpm-border: #3c5062;
    --cpm-border-strong: #597085;
    --cpm-shadow-sm: 0 4px 14px rgba(0,0,0,.24);
    --cpm-shadow-md: 0 10px 28px rgba(0,0,0,.32);
    --cpm-shadow-lg: 0 18px 45px rgba(0,0,0,.40);
    --bs-body-color: var(--cpm-text);
    --bs-body-bg: var(--cpm-background);
    --bs-border-color: var(--cpm-border);
    --bs-link-color: var(--cpm-primary);
    --bs-link-hover-color: var(--cpm-primary-hover);
    --bs-primary: var(--cpm-primary);
    --bs-primary-rgb: var(--cpm-primary-rgb);
}
html[data-bs-theme="dark"] body {
    color: var(--cpm-text);
    background: var(--cpm-background);
}
/* Fascia logo condivisa: il template usa bg-white fuori da app-layout-content. */
html[data-bs-theme="dark"] .brand-banner {
    background-color: var(--cpm-surface) !important;
    border-bottom-color: var(--cpm-border) !important;
}
/* Il layout condiviso usa classi bg-light/bg-white anche come superfici. */
html[data-bs-theme="dark"] body.bg-light,
html[data-bs-theme="dark"] .app-layout-content .bg-light,
html[data-bs-theme="dark"] .app-layout-content .bg-white {
    background-color: var(--cpm-surface) !important;
}
html[data-bs-theme="dark"] .app-layout-content .text-dark:not(.btn):not(.badge):not(.alert) {
    color: var(--cpm-text) !important;
}
html[data-bs-theme="dark"] .app-layout-content .text-muted {
    color: var(--cpm-muted) !important;
}
html[data-bs-theme="dark"] .app-sidebar-topbar {
    background: var(--cpm-surface);
    color: var(--cpm-text);
    border-bottom-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .app-sidebar-brand,
html[data-bs-theme="dark"] .app-sidebar-brand:hover { color: var(--cpm-primary); }
html[data-bs-theme="dark"] .app-sidebar-toggle { border-color: var(--cpm-border); }
html[data-bs-theme="dark"] .app-sidebar-toggle:hover,
html[data-bs-theme="dark"] .app-sidebar-notif-btn,
html[data-bs-theme="dark"] .app-sidebar-notif-btn:hover {
    background: var(--cpm-surface-soft);
    color: var(--cpm-text);
}
html[data-bs-theme="dark"] .app-sidebar-toggler-line { background: var(--cpm-text); }
/* Preservare volutamente i gradienti professionista/famiglia della sidebar. */
html[data-bs-theme="dark"] .app-sidebar:not(.app-sidebar--professional):not(.app-sidebar--family),
html[data-bs-theme="dark"] .app-sidebar:not(.app-sidebar--professional):not(.app-sidebar--family) .app-sidebar-header {
    background: var(--cpm-surface);
    color: var(--cpm-text);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .app-sidebar:not(.app-sidebar--professional):not(.app-sidebar--family) .app-sidebar-close {
    background: var(--cpm-surface-soft);
    color: var(--cpm-text);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .cpm-card,
html[data-bs-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .offcanvas,
html[data-bs-theme="dark"] .list-group-item {
    color: var(--cpm-text);
    background-color: var(--cpm-surface);
    border-color: var(--cpm-border);
}
/* Primary/success/danger buttons remain high-contrast (text and surface are separate tokens). */
html[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #265fba;
    --bs-btn-border-color: #265fba;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #3273d0;
    --bs-btn-hover-border-color: #3273d0;
}
html[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: var(--cpm-primary);
    --bs-btn-border-color: var(--cpm-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #265fba;
    --bs-btn-hover-border-color: #265fba;
}
html[data-bs-theme="dark"] .btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: #116b4d;
    --bs-btn-border-color: #116b4d;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #16835e;
    --bs-btn-hover-border-color: #16835e;
}
html[data-bs-theme="dark"] .btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: #a93246;
    --bs-btn-border-color: #a93246;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #c33c53;
    --bs-btn-hover-border-color: #c33c53;
}
html[data-bs-theme="dark"] .bg-primary:not(.alert) {
    background-color: #265fba !important;
}
html[data-bs-theme="dark"] .page-help-card {
    background: linear-gradient(135deg, rgba(143,183,255,.07), transparent 55%), var(--cpm-surface);
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .page-help-list li,
html[data-bs-theme="dark"] .page-help-note { color: var(--cpm-text-secondary); }
html[data-bs-theme="dark"] .page-help-note {
    background: var(--cpm-surface-soft);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .page-help-icon {
    background: var(--cpm-surface-soft);
    color: var(--cpm-primary);
}
html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] .input-group-text {
    color: var(--cpm-text);
    background-color: var(--cpm-surface-soft);
    border-color: var(--cpm-border-strong);
}
html[data-bs-theme="dark"] .form-control::placeholder { color: var(--cpm-muted); }
html[data-bs-theme="dark"] .table { --bs-table-bg: var(--cpm-surface); --bs-table-color: var(--cpm-text); --bs-table-border-color: var(--cpm-border); }
/* Never globally recolor alerts, badges, charts, external embeds, signed PDF or printing. */
/* 72_01_03: allineare il banner al centro della zona contenuti con sidebar desktop.
   Il mobile/PWA e il tema chiaro mantengono i rispettivi colori e dimensioni. */
@media (min-width: 992px) {
    body.app-sidebar-desktop .brand-banner {
        margin-left: var(--cpm-sidebar-width);
        width: calc(100% - var(--cpm-sidebar-width));
    }
}

/* 72_01_03: soltanto Admin Dashboard; nessun cambiamento di classi Bootstrap o markup funzionale. */
html[data-bs-theme="dark"] .cpm-admin-dashboard .table > thead.table-light {
    --bs-table-bg: var(--cpm-surface-soft);
    --bs-table-color: var(--cpm-text);
    --bs-table-border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-admin-dashboard .btn-outline-dark {
    --bs-btn-color: var(--cpm-text);
    --bs-btn-border-color: var(--cpm-border-strong);
    --bs-btn-hover-color: var(--cpm-background);
    --bs-btn-hover-bg: var(--cpm-text);
    --bs-btn-hover-border-color: var(--cpm-text);
    --bs-btn-active-color: var(--cpm-background);
    --bs-btn-active-bg: var(--cpm-text);
    --bs-btn-active-border-color: var(--cpm-text);
}

/* 72_01_04: solo workspace Studio in Dark Mode.
   Gli sfondi pastello chiari definiti dal design system e dal template
   rendevano il testo del tema scuro poco leggibile. */
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section--blue-deep {
    --cpm-studio-section-soft: #1b3350;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section--green-deep {
    --cpm-studio-section-soft: #193b30;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section--orange-deep {
    --cpm-studio-section-soft: #40331d;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header {
    color: var(--cpm-text);
    background: linear-gradient(90deg, var(--cpm-studio-section-soft), var(--cpm-surface) 78%) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header h1,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header h2,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header h3 {
    color: var(--cpm-text);
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header .text-muted,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header p {
    color: var(--cpm-text-secondary) !important;
}
/* Dashboard Studio: il template imposta quattro sfondi chiari con !important. */
html[data-bs-theme="dark"] .cpm-studio-workspace > .row.g-3.mb-4 .cpm-professional-stat {
    color: var(--cpm-text) !important;
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace > .row.g-3.mb-4 > :nth-child(1) .cpm-professional-stat {
    background: var(--cpm-primary-soft) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace > .row.g-3.mb-4 > :nth-child(2) .cpm-professional-stat {
    background: var(--cpm-success-soft) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace > .row.g-3.mb-4 > :nth-child(3) .cpm-professional-stat {
    background: var(--cpm-info-soft) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace > .row.g-3.mb-4 > :nth-child(4) .cpm-professional-stat {
    background: var(--cpm-warning-soft) !important;
}
/* Elenco pratiche / importazioni: intestazioni e badge leggibili. */
html[data-bs-theme="dark"] .cpm-studio-workspace .table > thead.table-light {
    --bs-table-bg: var(--cpm-surface-soft);
    --bs-table-color: var(--cpm-text);
    --bs-table-border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-studio-workspace .badge.bg-light.text-dark {
    background-color: var(--cpm-surface-soft) !important;
    color: var(--cpm-text) !important;
    border-color: var(--cpm-border-strong) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-studio-section > .card-header .badge {
    background-color: var(--cpm-surface-soft) !important;
    color: var(--cpm-text) !important;
}
/* Moduli Crea pratica / Importa: no superfici grigio-chiare sul tema scuro. */
html[data-bs-theme="dark"] .cpm-studio-workspace .bg-light-subtle {
    background-color: var(--cpm-surface-soft) !important;
    color: var(--cpm-text);
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .alert-light {
    color: var(--cpm-text);
    background-color: var(--cpm-primary-soft);
}
/* Header: il design-system forza pulsanti bianchi con testo troppo chiaro. */
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-primary,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-dark,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-secondary {
    color: var(--cpm-text) !important;
    background: var(--cpm-surface-soft) !important;
    border-color: var(--cpm-border-strong) !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-primary:hover,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-primary:focus,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-dark:hover,
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-outline-secondary:hover {
    color: #fff !important;
    background: #265fba !important;
    border-color: #3273d0 !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-hero .btn-primary {
    color: #fff !important;
    background: #265fba !important;
    border-color: #265fba !important;
}


/* 72_01_05: Dashboard Avvocato, soltanto tema scuro. Le varianti pastello
   e l'Autopilot usano colori chiari inline nel template originario. */
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero {
    color: var(--cpm-text);
    background: linear-gradient(135deg, #193452 0%, #243d61 100%);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero h1 {
    color: var(--cpm-text) !important;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .text-muted {
    color: var(--cpm-text-secondary) !important;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-primary {
    color: #184d93 !important;
    background: #f2f6fc !important;
    border-color: #b7cbea !important;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-danger {
    color: #8f263a !important;
    background: #fff6f7 !important;
    border-color: #e7aab5 !important;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-primary:hover,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-primary:focus-visible,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-danger:hover,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-professional-hero .btn-outline-danger:focus-visible {
    color: #172b42 !important;
    background: #ffffff !important;
}
/* Il partial Autopilot contiene uno style proprio: usare il namespace dashboard. */
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-card,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-family-snapshot,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-family-child-row,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-planning-wrap {
    color: var(--cpm-text);
    background: var(--cpm-surface);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-family-data-chip {
    color: var(--cpm-text-secondary);
    background: var(--cpm-surface-soft);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-family-note {
    color: var(--cpm-text);
    background: #322b23;
    border-color: #705639;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-action-count,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-section {
    color: var(--cpm-text);
    background: var(--cpm-surface-soft);
    border-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-action-count.is-overdue,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-section.is-overdue {
    background: #38232b;
    border-color: #87515a;
    border-left-color: #ff929d;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-action-count.is-today,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-section.is-today {
    background: #40331d;
    border-color: #80653a;
    border-left-color: #ffd074;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-action-count.is-week,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-section.is-week {
    background: #1b3350;
    border-color: #49668d;
    border-left-color: #8fb7ff;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-item {
    border-top-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-item.is-reminder-due {
    color: var(--cpm-text);
    background: #40331d;
    border-color: #967241;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-reminder-label,
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-reminder-status {
    color: #ffe0a0;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-reminder-status.is-valid {
    color: #8deac1;
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-planning-status {
    color: var(--cpm-text-secondary);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-planning-row {
    border-top-color: var(--cpm-border);
}
html[data-bs-theme="dark"] .cpm-professional-dashboard .cpm-autopilot-card .badge.bg-light.text-dark {
    color: var(--cpm-text) !important;
    background: var(--cpm-surface-soft) !important;
    border-color: var(--cpm-border-strong) !important;
}

/* 72_01_07: Contrasto semantico delle superfici colorate (solo tema scuro).
   Colori chiari/pastello -> inchiostro scuro; superfici intense -> testo chiaro.
   Non modificare badge, alert, pulsanti, stampe, e anteprime documentali. */
html[data-bs-theme="dark"] {
    --cpm-ink-on-light: #172638;
    --cpm-ink-muted-on-light: #40546a;
}
/* Classi Bootstrap con sfondo SOLIDO, non versioni trasparenti. */
html[data-bs-theme="dark"] .app-layout-content :is(.bg-warning, .bg-info):not(.badge):not(.btn):not(.alert):not([class*="bg-opacity-"]) {
    color: var(--cpm-ink-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content :is(.bg-warning, .bg-info):not(.badge):not(.btn):not(.alert):not([class*="bg-opacity-"]) :is(.text-white, .text-light, .text-muted) {
    color: var(--cpm-ink-on-light) !important;
}
/* Verde/rosso saturi abbastanza profondi per mantenere il testo bianco. */
html[data-bs-theme="dark"] .app-layout-content :is(.bg-success, .bg-danger):not(.badge):not(.btn):not(.alert):not([class*="bg-opacity-"]) {
    color: #fff !important;
}
html[data-bs-theme="dark"] .app-layout-content .bg-success:not(.badge):not(.btn):not(.alert):not([class*="bg-opacity-"]) {
    background-color: #116b4d !important;
}
html[data-bs-theme="dark"] .app-layout-content .bg-danger:not(.badge):not(.btn):not(.alert):not([class*="bg-opacity-"]) {
    background-color: #a93246 !important;
}
/* Etichette numeriche Lettere: nessuna trasparenza sui caratteri piccoli. */
html[data-bs-theme="dark"] .app-layout-content .stat-card :is(.small, .h2) {
    opacity: 1 !important;
}
/* La fascia chiara della pagina Lettere deve usare SEMPRE testo scuro. */
html[data-bs-theme="dark"] .app-layout-content .letter-page-hero {
    background: linear-gradient(135deg, #ffffff, #f5f9ff) !important;
    color: var(--cpm-ink-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-page-hero h1 {
    color: var(--cpm-ink-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-page-hero .text-muted {
    color: var(--cpm-ink-muted-on-light) !important;
}
/* Selettore modello: superficie scura, titoli e descrizioni chiari. */
html[data-bs-theme="dark"] .app-layout-content .letter-type-card {
    background: var(--cpm-surface-soft) !important;
    color: var(--cpm-text) !important;
    border-color: var(--cpm-border-strong) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-type-card.selected {
    background: var(--cpm-primary-soft) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-type-card h6 {
    color: var(--cpm-text) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-type-card .text-muted {
    color: var(--cpm-text-secondary) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-category-bar {
    background: var(--cpm-surface-soft) !important;
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-category-btn:not(.active) {
    color: var(--cpm-text) !important;
    background: var(--cpm-surface) !important;
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-category-btn.active {
    color: #fff !important;
    background: linear-gradient(135deg, #265fba, #184c98) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachments-panel,
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-item {
    background: var(--cpm-surface-soft) !important;
    color: var(--cpm-text) !important;
    border-color: var(--cpm-border) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-item.is-processing {
    background: var(--cpm-warning-soft) !important;
    border-color: var(--cpm-warning-border) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-item.is-ready {
    background: var(--cpm-success-soft) !important;
    border-color: var(--cpm-success-border) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-meta {
    color: var(--cpm-text-secondary) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-item.is-processing .letter-attachment-status {
    color: var(--cpm-warning) !important;
}
html[data-bs-theme="dark"] .app-layout-content .letter-attachment-item.is-ready .letter-attachment-status {
    color: var(--cpm-success) !important;
}
/* La pagina cartacea e il suo contenuto rimangono chiari e indipendenti dalla UI. */
html[data-bs-theme="dark"] .app-layout-content .preview-box {
    background: #fff !important;
    color: var(--cpm-ink-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content .preview-box .text-muted {
    color: var(--cpm-ink-muted-on-light) !important;
}
/* Archivio documentale: le card chiare mantengono il design, ma non testo bianco. */
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-search, .archive-stat, .archive-result, .archive-result-selected, .archive-lock) {
    color: var(--cpm-ink-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell :is(.archive-card, .archive-search, .archive-stat, .archive-result, .archive-result-selected, .archive-lock) :is(.text-dark, .text-muted, .text-white) {
    color: var(--cpm-ink-muted-on-light) !important;
}
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-blue { color: #174c8b !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-green { color: #116335 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-cyan { color: #0b6178 !important; }
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .archive-stat-orange { color: #87520b !important; }
/* L'estremità celeste del gradiente era troppo luminosa per il testo bianco. */
html[data-bs-theme="dark"] .app-layout-content .studio-archive-shell .studio-archive-hero {
    background: linear-gradient(125deg, #08366c 0%, #1252a0 58%, #075667 100%) !important;
    color: #fff !important;
}

/* 72_01_08_03 — Gestisci pratiche Family: selezione del titolare in Dark Mode.
   Il design-system usa #eef2ff per --cpm-group-soft del gruppo owner: sul tema
   scuro il nome/titolo e i controlli risultano poco leggibili. Solo visuale;
   valori checked/disabled, assegnazioni, autosave e logica JS invariati. */
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-selector .cpm-professional-group--owner {
    --cpm-group-soft: #263e57;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-selector .cpm-professional-group--owner
.cpm-professional-option:has(.js-assigned-member-checkbox:checked) {
    background: var(--cpm-group-soft) !important;
    border-color: #7393b0 !important;
    color: #eff4fa !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-selector .cpm-professional-group--owner
.cpm-professional-option:has(.js-assigned-member-checkbox:checked) .form-check-label {
    color: #eff4fa !important;
}
html[data-bs-theme="dark"] .cpm-studio-workspace .cpm-professional-selector .cpm-professional-group--owner
.cpm-professional-option:has(.js-assigned-member-checkbox:checked) .form-check-input:disabled ~ .form-check-label {
    color: #c5d1dd !important;
    opacity: .85;
}

@media print {
    html[data-bs-theme="dark"] { color-scheme: light; }
    html[data-bs-theme="dark"] body { background: #fff !important; color: #000 !important; }
}
