/* SB Admin 2 (Bootstrap 4) : surcharges pour le thème sombre de Toast.
   Une seule interface : le thème est défini par data-theme sur <html>. */
[data-theme="dark"] {
    --toast-niveau-premiere-texte: #8dd8cf;
    --toast-niveau-premiere-fond: #243f40;
    --toast-niveau-deuxieme-texte: #ccb3f0;
    --toast-niveau-deuxieme-fond: #39304d;
    --toast-fond: #171c28;
    --toast-fond-carte: #252d3c;
    --toast-fond-elevation: #2c3545;
    --toast-bordure: #465062;
    --toast-texte: #e5e9f1;
    --toast-texte-secondaire: #b6c0d0;
    --toast-bleu-action: #6e8eeb;
    --toast-bleu-action-survol: #91aaff;
    --toast-bleu-fond: rgba(110, 142, 235, .14);
    --toast-bleu-focus: rgba(110, 142, 235, .32);
    --toast-bleu-bouton-texte: #fff;
    --toast-succes-action: #2d7d52;
    --toast-succes-survol: #236541;
    --toast-succes-texte: #9ae2b9;
    --toast-succes-fond: #1f4937;
    --toast-attention-action: #f1cd81;
    --toast-attention-fond: #483d27;
    --toast-attention-bouton-texte: #252a35;
    --toast-orange-action: #ffb66e;
    --toast-orange-fond: #4a3427;
    --toast-info-action: #8bd3df;
    --toast-info-fond: #24414a;
    --toast-secondaire-action: #b6c0d0;
    --toast-secondaire-survol: #e5e9f1;
    --toast-secondaire-fond: #343e50;
    --toast-case-bordure: #8793a6;
    --toast-danger-action: #b6324b;
    --toast-danger-survol: #97283d;
    --toast-danger-fond: #572d38;
    --toast-danger-texte: #ffacb9;
    --toast-violet-action: #bda3f2;
    --toast-violet-fond: #392d50;
    --toast-rouge-action: var(--toast-danger-action);
    --toast-rouge-action-survol: var(--toast-danger-survol);
    --toast-rouge-fond: rgba(244, 140, 150, .12);
}
[data-theme="dark"] body,
[data-theme="dark"] #wrapper,
[data-theme="dark"] #content-wrapper,
[data-theme="dark"] #content {
    background-color: var(--toast-fond);
    color: var(--toast-texte);
}
[data-theme="dark"] .topbar,
[data-theme="dark"] .sticky-footer,
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .bg-white {
    background-color: var(--toast-fond-carte) !important;
    color: var(--toast-texte);
}
[data-theme="dark"] .topbar.toast-admin-topbar { background-color: #3d3628 !important; border-bottom-color: #c99a43; }
[data-theme="dark"] .toast-admin-profile-toggle,
[data-theme="dark"] .toast-admin-profile-toggle:hover,
[data-theme="dark"] .toast-admin-profile-toggle:focus { border-color: #806a3c; background-color: #4a402e; color: #f5d892 !important; }
[data-theme="dark"] .toast-profile-menu .toast-profile-admin-link { color: #f5d892 !important; }
[data-theme="dark"] .toast-profile-menu .toast-profile-admin-link:hover,
[data-theme="dark"] .toast-profile-menu .toast-profile-admin-link:focus { background-color: #483d27; color: #ffe6a8 !important; }
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] #confirmationModifications [data-modifications-revenir] {
    color: #fff;
    background-color: #43536a;
    border-color: #8492a7;
}
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-secondary:focus,
[data-theme="dark"] .btn-secondary:active,
[data-theme="dark"] .btn-secondary.active,
[data-theme="dark"] #confirmationModifications [data-modifications-revenir]:hover,
[data-theme="dark"] #confirmationModifications [data-modifications-revenir]:focus,
[data-theme="dark"] #confirmationModifications [data-modifications-revenir]:active {
    color: #fff;
    background-color: #53647c;
    border-color: #a6b3c5;
}
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .dropdown-divider,
[data-theme="dark"] .list-group-item {
    border-color: var(--toast-bordure);
}
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .table-light,
[data-theme="dark"] .table thead th {
    background-color: var(--toast-fond-elevation) !important;
    color: var(--toast-texte);
}
[data-theme="dark"] .toast-suivi-prof .toast-suivi-chapitre,
[data-theme="dark"] .toast-suivi-prof .toast-suivi-chapitre > .toast-suivi-entete {
    border-color: color-mix(in srgb, var(--toast-bordure) 60%, var(--toast-fond-carte));
}
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-dark,
[data-theme="dark"] .modal-title,
[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .page-link {
    color: var(--toast-texte) !important;
}
[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .copyright {
    color: var(--toast-texte-secondaire) !important;
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select,
[data-theme="dark"] .page-link,
[data-theme="dark"] .input-group-text {
    background-color: var(--toast-fond-elevation);
    color: var(--toast-texte);
    border-color: var(--toast-bordure);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .custom-select:focus {
    background-color: var(--toast-fond-elevation);
    color: var(--toast-texte);
}
[data-theme="dark"] .form-control::placeholder {
    color: #a3afc0;
}
/* Les navigateurs qui prennent en charge color-scheme adaptent aussi le calendrier natif. */
[data-theme="dark"] input[type="date"].form-control {
    color-scheme: dark;
}
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    color: var(--toast-texte);
    border-color: var(--toast-bordure);
}
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table-hover tbody tr:hover,
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus,
[data-theme="dark"] .page-item.active .page-link {
    background-color: #364257;
    color: #fff !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--toast-texte-secondaire) !important;
}
[data-theme="dark"] .toast-tableau-administration .page-link,
[data-theme="dark"] .toast-tableau-administration button.dt-paging-button {
    background: var(--toast-fond-elevation);
    color: var(--toast-texte) !important;
    border-color: var(--toast-bordure);
}
[data-theme="dark"] .toast-tableau-administration .page-item:not(.disabled) .page-link:hover,
[data-theme="dark"] .toast-tableau-administration .page-item:not(.disabled) .page-link:focus-visible,
[data-theme="dark"] .toast-tableau-administration button.dt-paging-button:hover:not(.disabled),
[data-theme="dark"] .toast-tableau-administration button.dt-paging-button:focus-visible {
    background: var(--toast-bleu-fond);
    color: var(--toast-bleu-action-survol) !important;
    border-color: var(--toast-bleu-action);
}
[data-theme="dark"] .toast-tableau-administration .page-item.active .page-link,
[data-theme="dark"] .toast-tableau-administration button.dt-paging-button.current {
    background: var(--toast-bleu-action);
    color: var(--toast-bleu-bouton-texte) !important;
    border-color: var(--toast-bleu-action);
}
[data-theme="dark"] .toast-tableau-administration .page-item.disabled .page-link,
[data-theme="dark"] .toast-tableau-administration button.dt-paging-button.disabled {
    background: var(--toast-fond-carte);
    color: var(--toast-texte-secondaire) !important;
    border-color: var(--toast-bordure);
}
[data-theme="dark"] .toast-pdf-stage {
    background: #131823;
}
/* La zone du PDF proprement dite reste blanche : contenu du document non recolorisé */

[data-theme="dark"] .sidebar.bg-gradient-primary {
    background-color: #121827;
    background-image: linear-gradient(180deg, #202c45 0%, #101827 100%);
}
[data-theme="dark"] .sidebar .sidebar-heading {
    color: #b2c2e2;
}
[data-theme="dark"] .toast-breadcrumb .breadcrumb-item.active,
[data-theme="dark"] .toast-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--toast-texte-secondaire);
}
[data-theme="dark"] .toast-breadcrumb a {
    color: #91b5ff;
}

/* Couleurs sémantiques partagées par Bootstrap et les composants Toast. */
[data-theme="dark"] .text-primary { color: var(--toast-bleu-action) !important; }
[data-theme="dark"] .text-success { color: var(--toast-succes-texte) !important; }
[data-theme="dark"] .text-danger { color: var(--toast-danger-texte) !important; }
[data-theme="dark"] .text-warning { color: var(--toast-attention-action) !important; }
[data-theme="dark"] .text-info { color: var(--toast-info-action) !important; }
[data-theme="dark"] .text-secondary { color: var(--toast-texte-secondaire) !important; }
[data-theme="dark"] .bg-primary,
[data-theme="dark"] .bg-success,
[data-theme="dark"] .bg-danger,
[data-theme="dark"] .bg-warning,
[data-theme="dark"] .bg-info,
[data-theme="dark"] .bg-secondary { color: var(--toast-texte) !important; }
[data-theme="dark"] .bg-primary { background-color: var(--toast-bleu-fond) !important; }
[data-theme="dark"] .bg-success { background-color: var(--toast-succes-fond) !important; }
[data-theme="dark"] .bg-danger { background-color: var(--toast-danger-fond) !important; }
[data-theme="dark"] .bg-warning { background-color: var(--toast-attention-fond) !important; }
[data-theme="dark"] .bg-info { background-color: var(--toast-info-fond) !important; }
[data-theme="dark"] .bg-secondary { background-color: var(--toast-secondaire-fond) !important; }
[data-theme="dark"] .toast-profile-menu .dropdown-item:not(.text-danger):hover,
[data-theme="dark"] .toast-profile-menu .dropdown-item:not(.text-danger):focus,
[data-theme="dark"] .toast-profile-menu .dropdown-item:not(.text-danger):active { background-color: var(--toast-bleu-fond); color: var(--toast-texte); }
[data-theme="dark"] .toast-profile-menu .dropdown-item.text-danger:hover,
[data-theme="dark"] .toast-profile-menu .dropdown-item.text-danger:focus { background-color: var(--toast-danger-fond); color: var(--toast-danger-texte) !important; }
