/**
 * Surcharges mode sombre — chargé en dernier pour écraser les styles
 * des pages qui imposent du blanc (.card, .groupbox, .footer, etc.)
 */

/* --- Body / html / main : forcer fond sombre ---
   Certains style.css locaux appliquent "body, html { background-color:#f0f8ff; display:flex; }"
   ce qui rend l'élément <html> visible en bas de page si le body ne le remplit pas. */
html.theme-dark,
html.theme-dark body {
  background-color: var(--pri-bg) !important;
  background-image: none !important;
  color: var(--pri-text) !important;
}

html.theme-dark body {
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(31, 111, 235, 0.08), transparent 50%), var(--pri-bg) !important;
}

html.theme-dark main {
  background: transparent !important;
}

/* --- Cartes et blocs --- */
html.theme-dark .card,
html.theme-dark .card-body,
html.theme-dark .card-content,
html.theme-dark .cards-container .card,
html.theme-dark .card-container .card,
html.theme-dark .ue-card.card,
html.theme-dark .ue-card .card-body,
html.theme-dark .generation-card,
html.theme-dark [class*="card"] {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Prime-card (generation, formulaires) */
html.theme-dark .prime-card,
html.theme-dark .prime-card-header,
html.theme-dark .prime-card-body {
  background-color: var(--pri-card) !important;
  background-image: none !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .prime-card-header {
  background-color: var(--pri-bg-subtle) !important;
  background-image: none !important;
}

html.theme-dark .card h1,
html.theme-dark .card h2,
html.theme-dark .card h3,
html.theme-dark .card h4,
html.theme-dark .card h5,
html.theme-dark .card-title,
html.theme-dark .card p,
html.theme-dark .card-description,
html.theme-dark .ue-card .card-title {
  color: var(--pri-text) !important;
}

html.theme-dark .card-button,
html.theme-dark .card .btn-primary {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .card-button:hover,
html.theme-dark .card .btn-primary:hover {
  background-color: var(--pri-primary-hover) !important;
  border-color: var(--pri-primary-hover) !important;
  color: #fff !important;
}

/* Groupbox / blocs type formulaire ou section (cours, épreuve perso, mailing, etc.) */
html.theme-dark .groupbox,
html.theme-dark .groupbox-container .groupbox,
html.theme-dark .groupbox.collapsed,
html.theme-dark .groupbox-large {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Titre groupbox (certaines pages en bleu) */
html.theme-dark .groupbox-title {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .groupbox h2,
html.theme-dark .groupbox h3,
html.theme-dark .groupbox legend,
html.theme-dark .groupbox-title {
  color: var(--pri-text) !important;
  border-color: var(--pri-border) !important;
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .groupbox-content,
html.theme-dark .groupbox .form-group label {
  color: var(--pri-text) !important;
}

/* Prime-groupbox (composants formulaires / sections) */
html.theme-dark .prime-groupbox,
html.theme-dark .prime-groupbox-legend {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .prime-groupbox-legend {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-primary) !important;
}

/* ========== Accueil : Actions rapides, Activités récentes, Annonces ========== */
html.theme-dark .quick {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .quick h6 {
  color: var(--pri-text) !important;
}

html.theme-dark .quick h6 i {
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-prime-outline {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-prime-outline:hover {
  background-color: var(--pri-primary) !important;
  color: #fff !important;
}

/* Feed (activité récente forums) */
html.theme-dark .feed-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .snippet {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .tag,
html.theme-dark .tag-qcm,
html.theme-dark .tag-cours {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .tag-qcm {
  color: var(--pri-primary) !important;
}

html.theme-dark .tag-cours {
  color: var(--pri-success) !important;
}

/* Événements planning (aperçu EDT) */
html.theme-dark .event {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .event-head,
html.theme-dark .event-foot {
  color: var(--pri-text) !important;
}

html.theme-dark .badge-kind,
html.theme-dark .bk-general,
html.theme-dark .bk-classe,
html.theme-dark .bk-groupe {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Annonces importantes */
html.theme-dark .announce {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Bouton type lien (accueil, cartes) */
html.theme-dark .btn-linkish {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-linkish:hover {
  background-color: var(--pri-primary) !important;
  color: #fff !important;
}

/* Éditeur modal (annonces) */
html.theme-dark .editor-toolbar,
html.theme-dark .editor-toolbar button,
html.theme-dark .editor-area {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* ========== Forum (tuteurs) : listes, notices, KPI ========== */
html.theme-dark .notice {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .kpi .ico {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .muted-empty {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .select {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-outline {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-outline:hover {
  background-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .badge-type,
html.theme-dark .badge-qcm,
html.theme-dark .badge-cours,
html.theme-dark .badge-new,
html.theme-dark .badge-seen {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .badge-qcm {
  color: var(--pri-primary) !important;
}

html.theme-dark .badge-cours {
  color: var(--pri-success) !important;
}

html.theme-dark .badge-new {
  color: var(--pri-danger) !important;
}

html.theme-dark .badge-seen {
  color: var(--pri-success) !important;
}

/* Forum : message-item (liste messages) */
html.theme-dark .message-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .message-details,
html.theme-dark .ue-name {
  color: var(--pri-text) !important;
}

html.theme-dark .ue-name {
  color: var(--pri-primary) !important;
}

html.theme-dark .message-date {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .section-body,
html.theme-dark .meta {
  color: var(--pri-text) !important;
}

html.theme-dark .meta {
  color: var(--pri-text-muted) !important;
}

/* Footer principal (ne doit jamais passer en blanc) */
html.theme-dark .custom-footer {
  background: var(--pri-nav-footer-bg) !important;
  color: var(--pri-text-inverse) !important;
  border-top-color: var(--pri-border) !important;
}

/* Footer local (classe .footer dans le contenu des pages) — aligné sur le thème sombre */
html.theme-dark .footer {
  background-color: var(--pri-bg) !important;
  border-top: 1px solid var(--pri-border) !important;
  color: var(--pri-text) !important;
  box-shadow: none !important;
}

html.theme-dark .footer-content,
html.theme-dark .footer-left,
html.theme-dark .footer-right {
  color: var(--pri-text) !important;
}

html.theme-dark .footer-left p,
html.theme-dark .footer a {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .footer a:hover {
  color: var(--pri-primary) !important;
}

/* Éléments souvent en blanc dans les pages */
html.theme-dark .toolbar,
html.theme-dark .prime-toolbar,
html.theme-dark .card-head,
html.theme-dark .table-responsive,
html.theme-dark .modal-body,
html.theme-dark .modal-content .card {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .badge,
html.theme-dark .prime-kpi,
html.theme-dark .search-wrap input,
html.theme-dark .search input {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Dossiers / folders (liste, conteneurs) */
html.theme-dark .folder,
html.theme-dark .folder-header,
html.theme-dark .folder-content,
html.theme-dark .file-link,
html.theme-dark .file-list {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .folder-header {
  background-color: var(--pri-bg-subtle) !important;
}

/* Tableaux (toutes variantes) */
html.theme-dark .table-primedis,
html.theme-dark .table-primedis th,
html.theme-dark .table-primedis td {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .table-primedis thead th,
html.theme-dark .table-primedis .card-head {
  background-color: var(--pri-bg-subtle) !important;
  background-image: none !important;
  color: var(--pri-text) !important;
}

/* Barre de recherche (toutes pages) */
html.theme-dark .search-wrap {
  background-color: transparent !important;
}

html.theme-dark .searchbar {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .searchbar input {
  background-color: transparent !important;
  color: var(--pri-text) !important;
}

html.theme-dark .searchbar input::placeholder {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .search-wrap input {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Onglets (banque séries/épreuves, Bootstrap nav-tabs) */
html.theme-dark .tabs {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .tab-btn,
html.theme-dark .tab-btn.active {
  background-color: transparent !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .tab-btn.active {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .tab-btn i {
  color: var(--pri-primary) !important;
}

html.theme-dark .nav-tabs {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .nav-tabs .nav-link {
  background-color: transparent !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .nav-tabs .nav-link:hover {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .nav-tabs .nav-link.active {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

/* LCA tabs (affichage LCA) */
html.theme-dark .lca-tabs {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .lca-tab {
  background-color: transparent !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .lca-tab.active {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

/* Bootstrap card si utilisé directement */
html.theme-dark .card-img {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .card-footer {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* ========== Page démarrage série/épreuve : Historique + performances ========== */
html.theme-dark .kpi-circle {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .timeline-content {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .timeline-title,
html.theme-dark .timeline-date {
  color: var(--pri-text) !important;
}

html.theme-dark .timeline-date {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .round-button {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .round-button:hover {
  background-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .round-button.green {
  background-color: var(--pri-success-subtle) !important;
  border-color: var(--pri-success) !important;
  color: var(--pri-success) !important;
}

html.theme-dark .round-button.green:hover {
  background-color: var(--pri-success) !important;
  color: #fff !important;
}

/* Bootstrap list-group (page démarrage, modales) */
html.theme-dark .list-group-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Bootstrap btn-outline-secondary (modales, modifications) */
html.theme-dark .btn-outline-secondary {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-outline-secondary:hover {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border-strong) !important;
  color: var(--pri-text) !important;
}

/* Accueil / KPI / stats */
html.theme-dark .kpi,
html.theme-dark .kpi-row .kpi,
html.theme-dark .stat-box,
html.theme-dark .hero,
html.theme-dark .hero-top,
html.theme-dark .hero-body {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .hero-sub,
html.theme-dark .btn-linkish {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .btn-linkish:hover {
  color: var(--pri-primary) !important;
}

/* Conteneurs de page */
html.theme-dark .container-fluid,
html.theme-dark .page-shell,
html.theme-dark .container {
  background-color: transparent !important;
  color: var(--pri-text) !important;
}

/* Boutons icône / actions (admin, listes) */
html.theme-dark .icon-btn,
html.theme-dark .icon-edit,
html.theme-dark .icon-del {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .icon-btn:hover {
  background-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Pills / badges (Oui, Non, etc.) */
html.theme-dark .pill-yes,
html.theme-dark .pill-no {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .pill-yes {
  color: var(--pri-success) !important;
}

/* Form check / labels dans les cartes */
html.theme-dark .form-check-label,
html.theme-dark label {
  color: var(--pri-text) !important;
}

/* ========== Formulaires, dropdowns, switch (generation, épreuves, etc.) ========== */
html.theme-dark .form-control,
html.theme-dark input.form-control,
html.theme-dark select.form-control,
html.theme-dark textarea.form-control {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .switchline,
html.theme-dark .selected-input {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Toggle buttons (generation, etc.) */
html.theme-dark .toggle-buttons label,
html.theme-dark .toggle-buttons input[type="radio"] + label {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .toggle-buttons input[type="radio"]:checked + label {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

/* Custom dropdown (generation) */
html.theme-dark .custom-dropdown .dropdown-header,
html.theme-dark .dropdown-header,
html.theme-dark .dropdown-content,
html.theme-dark .dropdown-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .dropdown-item:hover {
  background-color: var(--pri-bg-subtle) !important;
}

/* Info note / alertes légères */
html.theme-dark .info-note {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Listbox, source-item, order-item (épreuves, création) */
html.theme-dark .listbox,
html.theme-dark .source-item,
html.theme-dark .order-item,
html.theme-dark .btn-add {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Tiles (tuteurs, admin) */
html.theme-dark .tile,
html.theme-dark .tile-footer {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Bootstrap table, list-group */
html.theme-dark .table,
html.theme-dark .table th,
html.theme-dark .table td,
html.theme-dark .list-group-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .table thead th {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

/* Panels, well, breadcrumb */
html.theme-dark .panel,
html.theme-dark .panel-body,
html.theme-dark .well,
html.theme-dark .breadcrumb,
html.theme-dark .breadcrumb-item {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Pagination, dropdown-menu Bootstrap */
html.theme-dark .pagination .page-link,
html.theme-dark .dropdown-menu {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Élément footer (balise) : ne jamais forcer en clair */
html.theme-dark footer.custom-footer {
  background: var(--pri-nav-footer-bg) !important;
  color: var(--pri-text-inverse) !important;
  border-top-color: rgba(255,255,255,0.1) !important;
}

/* Page generation : titres et zones */
html.theme-dark .page-title,
html.theme-dark .gen-wrap,
html.theme-dark .gen-wrap h1 {
  color: var(--pri-text) !important;
}

html.theme-dark .page-title i {
  color: var(--pri-primary) !important;
}

html.theme-dark .hint {
  color: var(--pri-text-muted) !important;
}

/* Bootstrap custom control / switch (labels visibles) */
html.theme-dark .custom-control-label,
html.theme-dark .custom-control-label::before {
  color: var(--pri-text) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
}

/* Inputs type number, checkbox, radio (couleur de fond) */
html.theme-dark input[type="number"],
html.theme-dark input[type="text"]:not(.form-control),
html.theme-dark input[type="email"] {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Champs QRP / modification (.field, .qrp-search) */
html.theme-dark .field,
html.theme-dark .qrp-search {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* ========== Banque (séries / épreuves) : cardx, item-card, exam-card ========== */
html.theme-dark .cardx,
html.theme-dark .cardx-h,
html.theme-dark .cardx-b {
  background-color: var(--pri-card) !important;
  background-image: none !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .cardx-h {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .pill-kpi {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .btn-ghostx {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-ghostx:hover {
  border-color: var(--pri-primary) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .mini-summary {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .item-card,
html.theme-dark .item-top,
html.theme-dark .item-body {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .item-top {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .exam-card,
html.theme-dark .exam-head,
html.theme-dark .exam-body {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .exam-head {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .exam-title,
html.theme-dark .exam-meta {
  color: var(--pri-text) !important;
}

html.theme-dark .exam-meta {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .item-title {
  color: var(--pri-text) !important;
}

/* KPI valeurs (banque) */
html.theme-dark .kpi .v {
  color: var(--pri-primary) !important;
}

html.theme-dark .kpi .l {
  color: var(--pri-text-muted) !important;
}

/* Bootstrap / texte secondaire */
html.theme-dark .text-muted {
  color: var(--pri-text-muted) !important;
}

/* Badges type série (DL, DP, KFP, LCA, TCS, épreuve) */
html.theme-dark .badge-type-serie {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .badge-type-serie.dl,
html.theme-dark .badge-type-serie.dp,
html.theme-dark .badge-type-serie.kfp,
html.theme-dark .badge-type-serie.lca,
html.theme-dark .badge-type-serie.tcs,
html.theme-dark .badge-type-serie.epreuve {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Modal header/footer/close (cohérence mode sombre) — administration, cours, etc. */
html.theme-dark .modal-header,
html.theme-dark .modal-content {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .modal-header {
  background-color: var(--pri-bg-subtle) !important;
  border-bottom-color: var(--pri-border) !important;
}

/* Pied des modales : toujours sombre (administration, comptes, effectifs, etc.) */
html.theme-dark .modal-footer,
html.theme-dark .custom-modal .modal-footer {
  background-color: var(--pri-bg-subtle) !important;
  border-top-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-modal,
html.theme-dark .custom-modal .modal-header,
html.theme-dark .custom-modal .modal-body {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-modal .modal-header {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .custom-modal .btn-light {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .modal-title,
html.theme-dark .close {
  color: var(--pri-text) !important;
}

html.theme-dark .close:hover {
  color: var(--pri-text-muted) !important;
}

/* Bootstrap .btn-light (cours, affichage cours, modales) */
html.theme-dark .btn-light {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-light:hover {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border-strong) !important;
  color: var(--pri-text) !important;
}

/* Boutons cours / planning / forum (primaire reste bleu, secondaires en carte) */
html.theme-dark .btn-prime {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-prime:hover {
  background-color: var(--pri-primary-subtle) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-follow {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-follow:hover {
  background-color: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

/* Cours : cartes UE, course-item, card-grid */
html.theme-dark .course-item {
  border-bottom-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .course-item .actions i {
  color: var(--pri-primary) !important;
}

/* ================================================================
   Planning / EDT (étudiant + admin) — grille calendrier
   ================================================================ */

/* Grille principale */
html.theme-dark .edt-grid {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

/* En-têtes des jours */
html.theme-dark .edt-header,
html.theme-dark .edt-header div,
html.theme-dark .edt-header > div:first-child {
  background: linear-gradient(180deg, var(--pri-card), var(--pri-bg-subtle)) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Colonne des heures */
html.theme-dark .edt-hours,
html.theme-dark .edt-hour {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Cellules de planning */
html.theme-dark .edt-cell {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .edt-cell:hover,
html.theme-dark .edt-grid-body > .edt-cell:hover {
  background: rgba(110, 168, 254, 0.06) !important;
}

/* Blocs événements : conservent leurs couleurs sémantiques (bleu/vert/rouge)
   mais légèrement plus sombres pour le mode sombre */
html.theme-dark .edt-block {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  color: #fff !important;
}

html.theme-dark .edt-block.groupe {
  background: #1a5ed0 !important;
}

html.theme-dark .edt-block.classe {
  background: #1a9e4a !important;
}

html.theme-dark .edt-block.general {
  background: #c0392b !important;
}

/* Panneau matières (admin) */
html.theme-dark .matiere-panel {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .matiere-item {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .matiere-item:hover {
  border-color: var(--pri-primary) !important;
}

html.theme-dark .matiere-item.bloc-libre {
  background: rgba(220, 53, 69, 0.12) !important;
  border-color: rgba(220, 53, 69, 0.4) !important;
  color: var(--pri-danger) !important;
}

/* Planning / EDT (étudiant + admin) : barre recherche, tableaux */
html.theme-dark .search-bar {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-table {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .custom-table th,
html.theme-dark .custom-table td {
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-table th {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-table tr:nth-child(even) {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .custom-table .actions .view {
  color: var(--pri-primary) !important;
}

html.theme-dark .management-buttons a {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .management-buttons a:hover {
  background-color: var(--pri-primary-hover) !important;
  border-color: var(--pri-primary-hover) !important;
  color: #fff !important;
}

html.theme-dark .btn-create-series {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .btn-create-series:hover {
  background-color: var(--pri-primary-hover) !important;
  color: #fff !important;
}

/* Mailing : form-section, question-block, list-buttons, toggle-buttons */
html.theme-dark .form-section {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .form-section h2 {
  color: var(--pri-primary) !important;
}

html.theme-dark .question-block {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .proposition-block,
html.theme-dark .proposition-block input[type="text"] {
  background-color: transparent !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .list-buttons button {
  background-color: var(--pri-primary) !important;
  border-color: var(--pri-primary) !important;
  color: #fff !important;
}

html.theme-dark .list-buttons button:hover {
  background-color: var(--pri-primary-hover) !important;
  color: #fff !important;
}

html.theme-dark .add-question-btn {
  background-color: var(--pri-success) !important;
  border-color: var(--pri-success) !important;
  color: #fff !important;
}

html.theme-dark .collapse-question-btn {
  background-color: var(--pri-warning) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .delete-question-btn {
  background-color: var(--pri-danger) !important;
  color: #fff !important;
}

/* Select / input sans .form-control (mailing, planning) */
html.theme-dark select:not(.form-control),
html.theme-dark textarea:not(.form-control) {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark input[readonly] {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

/* Mailing / génération : champs selected (IDs) */
html.theme-dark [id="selected-ues"],
html.theme-dark [id="selected-cours"],
html.theme-dark [id="selected-annees"],
html.theme-dark [id="selected-types"],
html.theme-dark [id="selected-tags"] {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .page-header h1 {
  color: var(--pri-primary) !important;
}

html.theme-dark .subtitle {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .qcm-container {
  background-color: transparent !important;
  color: var(--pri-text) !important;
}

/* Forum discussion : filter-select, pagination */
html.theme-dark .filter-select {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .pagination .page-link {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Tableaux génériques (administration, EDT) */
html.theme-dark table th,
html.theme-dark table td {
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark table th {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

html.theme-dark table {
  color: var(--pri-text) !important;
}

/* Administration / Données : zones blanches */
html.theme-dark .table-container,
html.theme-dark .dual-list,
html.theme-dark .list-container {
  background-color: transparent !important;
  color: var(--pri-text) !important;
}

html.theme-dark .list-container label {
  color: var(--pri-text) !important;
}

/* Header row (mailing) */
html.theme-dark .header-row {
  color: var(--pri-text) !important;
}

/* Bootstrap .btn-secondary (modales) */
html.theme-dark .btn-secondary {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .btn-secondary:hover {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

/* Bootstrap .btn-outline-danger (forum, cours) */
html.theme-dark .btn-outline-danger {
  background-color: transparent !important;
  border-color: var(--pri-danger) !important;
  color: var(--pri-danger) !important;
}

html.theme-dark .btn-outline-danger:hover {
  background-color: var(--pri-danger-subtle) !important;
  color: var(--pri-danger) !important;
}

/* Création épreuve personnalisée / modification : container, grid, pills, msg */
html.theme-dark .container-wrap,
html.theme-dark .grid {
  background-color: transparent !important;
  color: var(--pri-text) !important;
}

html.theme-dark .pill,
html.theme-dark .pill-dl,
html.theme-dark .pill-dp,
html.theme-dark .pill-kfp,
html.theme-dark .pill-tcs {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .pill-dl {
  color: var(--pri-primary) !important;
}

html.theme-dark .pill-dp {
  color: var(--pri-success) !important;
}

html.theme-dark .pill-kfp {
  color: var(--pri-warning) !important;
}

html.theme-dark .iconbtn {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .iconbtn:hover {
  background-color: var(--pri-bg-subtle) !important;
}

html.theme-dark .msg.ok {
  background-color: var(--pri-success-subtle) !important;
  border-color: var(--pri-success) !important;
  color: var(--pri-success) !important;
}

html.theme-dark .msg.warn {
  background-color: var(--pri-warning-subtle) !important;
  border-color: var(--pri-warning) !important;
  color: var(--pri-warning) !important;
}

/* Cards container (création dossier, séries) */
html.theme-dark .cards-container .card {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Alertes (cours, planning, etc.) */
html.theme-dark .alert-danger {
  background-color: var(--pri-danger-subtle) !important;
  border-color: var(--pri-danger) !important;
  color: var(--pri-danger) !important;
}

html.theme-dark .alert {
  background-color: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Row / col (pas de fond blanc) */
html.theme-dark .row {
  color: var(--pri-text) !important;
}

/* ================================================================
   Forum discussion (forum/forum.php) — propositions, boutons, pills
   ================================================================ */

/* Proposition neutre : déjà corrigée via var(--pri-card) dans la source.
   Propositions colorées (bonne/mauvaise/hors-concours) en dark. */
html.theme-dark .prop.ok {
  background: rgba(40, 167, 69, 0.15) !important;
  border-color: rgba(40, 167, 69, 0.45) !important;
}

html.theme-dark .prop.ok .letter {
  background: #28a745 !important;
  color: #fff !important;
  border-color: #28a745 !important;
}

html.theme-dark .prop.ko {
  background: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.45) !important;
}

html.theme-dark .prop.ko .letter {
  background: var(--pri-danger) !important;
  color: #fff !important;
  border-color: var(--pri-danger) !important;
}

html.theme-dark .prop.hc {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

html.theme-dark .prop.hc .letter {
  background: #f59e0b !important;
  color: #fff !important;
  border-color: #f59e0b !important;
}

/* Texte de correction */
html.theme-dark .corr {
  color: var(--pri-text-muted) !important;
}

/* Pills de statut (QCM ok/ko/hc) */
html.theme-dark .pill.ok {
  background-color: rgba(40, 167, 69, 0.15) !important;
  border-color: rgba(40, 167, 69, 0.35) !important;
  color: var(--pri-success) !important;
}

html.theme-dark .pill.ko {
  background-color: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.35) !important;
  color: var(--pri-danger) !important;
}

html.theme-dark .pill.hc {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: var(--pri-warning) !important;
}

/* Pills QRP */
html.theme-dark .pill.qrp-i {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
  color: #818cf8 !important;
}

html.theme-dark .pill.qrp-v {
  background-color: rgba(40, 167, 69, 0.15) !important;
  border-color: rgba(40, 167, 69, 0.35) !important;
  color: var(--pri-success) !important;
}

html.theme-dark .pill.qrp-inv {
  background-color: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.35) !important;
  color: var(--pri-danger) !important;
}

html.theme-dark .pill.qrp-ina {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: var(--pri-warning) !important;
}

/* Bouton "Suivre / Ne plus suivre" (forum discussion, classe .btn locale) */
html.theme-dark .forum-container .btn:not(.btn-primary) {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .forum-container .btn:not(.btn-primary):hover {
  background-color: var(--pri-bg-subtle) !important;
}

/* Boutons "Répondre" / "Supprimer" (.chip, déjà var(--pri-card) dans la source) */
html.theme-dark .chip {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .chip:hover {
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .chip.danger {
  color: var(--pri-danger) !important;
}

html.theme-dark .chip.danger:hover {
  border-color: var(--pri-danger) !important;
}

/* ================================================================
   Modification séries (modification.php QCM / LCA / KFP)
   Éléments sémantiques colorés qui utilisent des pastels clairs
   ================================================================ */

/* Bouton toggle "Vrai" (réponse correcte) */
html.theme-dark .btn-true {
  background: rgba(40, 167, 69, 0.15) !important;
  border-color: rgba(40, 167, 69, 0.4) !important;
  color: var(--pri-success) !important;
}

/* Bouton toggle "Faux" (réponse incorrecte) */
html.theme-dark .btn-false {
  background: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.4) !important;
  color: var(--pri-danger) !important;
}

/* Badge "au programme" */
html.theme-dark .programme {
  background: rgba(55, 48, 163, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  color: #818cf8 !important;
}

/* Badge "hors concours" */
html.theme-dark .hors-concours {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: var(--pri-warning) !important;
}

/* Badge type "prépa" */
html.theme-dark .btn-type.prepa {
  background: rgba(3, 105, 161, 0.15) !important;
  border-color: rgba(14, 165, 233, 0.4) !important;
  color: #38bdf8 !important;
}

/* Badge type "annale" */
html.theme-dark .btn-type.annale {
  background: rgba(22, 101, 52, 0.15) !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  color: var(--pri-success) !important;
}

/* Barre d'outils de carte (prime-toolbar) */
html.theme-dark .prime-toolbar {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

/* Dropdown custom (sélection UE/cours/tags) */
html.theme-dark .custom-dropdown .dropdown-header {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .custom-dropdown .dropdown-content {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .custom-dropdown .dropdown-item {
  color: var(--pri-text) !important;
}

html.theme-dark .custom-dropdown .dropdown-item:hover {
  background: var(--pri-bg-subtle) !important;
}

/* Proposition (groupbox de réponse QCM) */
html.theme-dark .proposition {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

/* Item de question dans la sidebar */
html.theme-dark .question-item {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Bouton "Créer une question" */
html.theme-dark .btn-create-question {
  background: var(--pri-card) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .btn-create-question:hover {
  background: var(--pri-bg-subtle) !important;
}

/* Zone vide (aucune question sélectionnée) */
html.theme-dark .question-details .empty-state {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Toggle switch (slider) */
html.theme-dark .slider {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .slider:before {
  background: var(--pri-text-muted) !important;
}

/* ================================================================
   Affichage des séries (libre, progressif, LCA, épreuve)
   ================================================================ */

/* Carte question */
html.theme-dark .question-card {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

/* Bouton proposition (neutre) */
html.theme-dark .proposition-btn {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .proposition-btn:hover {
  border-color: var(--pri-primary) !important;
}

/* Lettre de proposition (A, B, C…) */
html.theme-dark .letter {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Proposition sélectionnée (picked) */
html.theme-dark .proposition-btn.picked,
html.theme-dark .proposition-btn.picked .letter {
  background: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
}

/* Correction — bonne réponse */
html.theme-dark .proposition-btn.corr-true {
  background: rgba(63, 185, 80, 0.15) !important;
  border-color: rgba(63, 185, 80, 0.5) !important;
}

html.theme-dark .proposition-btn.corr-true .letter {
  background: var(--pri-success) !important;
  border-color: var(--pri-success) !important;
  color: #fff !important;
}

/* Correction — mauvaise réponse */
html.theme-dark .proposition-btn.corr-wrong {
  background: rgba(248, 81, 73, 0.15) !important;
  border-color: rgba(248, 81, 73, 0.5) !important;
}

html.theme-dark .proposition-btn.corr-wrong .letter {
  background: var(--pri-danger) !important;
  border-color: var(--pri-danger) !important;
  color: #fff !important;
}

/* Correction — réponse manquée (attendue non cochée) */
html.theme-dark .proposition-btn.corr-missed {
  background: rgba(210, 153, 34, 0.15) !important;
  border-color: rgba(210, 153, 34, 0.5) !important;
}

html.theme-dark .proposition-btn.corr-missed .letter {
  background: var(--pri-warning) !important;
  border-color: var(--pri-warning) !important;
  color: #fff !important;
}

/* Bloc de correction (résumé après validation) */
html.theme-dark .scorebox {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Chips de résultat correct/incorrect */
html.theme-dark .choice-chip.ok {
  background: rgba(63, 185, 80, 0.15) !important;
  border-color: rgba(63, 185, 80, 0.4) !important;
  color: var(--pri-success) !important;
}

html.theme-dark .choice-chip.ko {
  background: rgba(248, 81, 73, 0.15) !important;
  border-color: rgba(248, 81, 73, 0.4) !important;
  color: var(--pri-danger) !important;
}

html.theme-dark .choice-chip.neutral,
html.theme-dark .choice-chip {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Badges de type de question */
html.theme-dark .mode-badge {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .mode-qcm {
  background: rgba(55, 48, 163, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  color: #818cf8 !important;
}

html.theme-dark .mode-texte {
  background: rgba(21, 94, 117, 0.15) !important;
  border-color: rgba(34, 211, 238, 0.4) !important;
  color: #67e8f9 !important;
}

html.theme-dark .mode-zone {
  background: rgba(146, 64, 14, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: var(--pri-warning) !important;
}

/* Étiquette HC (hors-concours) */
html.theme-dark .hc-label {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: var(--pri-warning) !important;
}

/* Navigation questions (progressif) */
html.theme-dark .navitem {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .navitem.current {
  background: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
}

html.theme-dark .navitem.locked {
  background: var(--pri-bg-subtle) !important;
  color: var(--pri-text-muted) !important;
}

/* Barre de progression */
html.theme-dark .progress-track,
html.theme-dark [class*="progress"] {
  background: var(--pri-bg-subtle) !important;
}

/* Pills QRP */
html.theme-dark .qrp-pill,
html.theme-dark .qrp-option {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .qrp-panel {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

/* Chips sous-type et user-chip */
html.theme-dark .subtype-chip,
html.theme-dark .user-chip {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Champ texte réponse (QROC) */
html.theme-dark .answer-textarea,
html.theme-dark .bloc-text {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Zone numérique (QNUM) */
html.theme-dark .qnum-row {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .qnum-input {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Image de question */
html.theme-dark .question-image,
html.theme-dark .zone-img {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}

/* Modale de confirmation */
html.theme-dark .modal-content {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Lecteur LCA */
html.theme-dark .lca-reader {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .lca-tab {
  background: transparent !important;
  color: var(--pri-text-muted) !important;
}

html.theme-dark .lca-tab.active {
  background: var(--pri-primary-subtle) !important;
  border-color: var(--pri-primary) !important;
  color: var(--pri-primary) !important;
}

html.theme-dark .lca-toolbar {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

/* ================================================================
   Administration — Classements (administration/classements/)
   ================================================================ */

/* Inputs de résumé sélection (séries, groupes, classes) */
html.theme-dark #selected-series,
html.theme-dark #selected-groupes,
html.theme-dark #selected-classes {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Coefficient par série */
html.theme-dark .serie-coeff {
  background-color: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Modal body (fond de page dans la modale) */
html.theme-dark .modal-body {
  background-color: var(--pri-bg-subtle) !important;
  color: var(--pri-text) !important;
}

/* Héritage style.css : groupbox, form-section, card (anciens styles) */
html.theme-dark .groupbox,
html.theme-dark .form-section {
  background-color: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .groupbox h2,
html.theme-dark .form-section h2 {
  color: var(--pri-primary) !important;
}

/* ================================================================
   Drive des Cours (cours/cours.php + cours/get_courses.php)
   ================================================================ */

/* Items UE (boutons de la liste des UEs) */
html.theme-dark .ue-item {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .ue-item .icon {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

html.theme-dark .ue-item .name {
  color: var(--pri-text) !important;
}

html.theme-dark .ue-item .meta {
  color: var(--pri-text-muted) !important;
}

html.theme-dark .ue-item.active {
  background: linear-gradient(180deg, rgba(31, 111, 235, .12), var(--pri-card) 70%) !important;
  border-color: rgba(31, 111, 235, .5) !important;
}

/* Select UE (version mobile) */
html.theme-dark .ue-select {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* Zone vide (aucun cours sélectionné) */
html.theme-dark .empty {
  background: var(--pri-bg-subtle) !important;
  border-color: rgba(31, 111, 235, .3) !important;
  color: var(--pri-text-muted) !important;
}

/* Pill de stats (nb cours, etc.) */
html.theme-dark .pill {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text-muted) !important;
}

/* Cartes de cours (chargées en AJAX via get_courses.php) */
html.theme-dark .course-card {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

html.theme-dark .course-card a {
  color: var(--pri-primary) !important;
}

html.theme-dark .course-actions i {
  color: var(--pri-primary) !important;
}

html.theme-dark .course-actions i.fa-trash-alt {
  color: var(--pri-danger) !important;
}

html.theme-dark .course-actions i:hover {
  color: var(--pri-primary-hover) !important;
}


/* ============================================================
   Pages de CORRECTION des séries (correction_finale + épreuve)
   ============================================================ */

/* États de correction des propositions */
html.theme-dark .corr-true {
  background: linear-gradient(180deg, rgba(22,163,74,.18), rgba(22,163,74,.05)) !important;
  border-color: rgba(22,163,74,.55) !important;
}
html.theme-dark .corr-wrong {
  background: linear-gradient(180deg, rgba(220,53,69,.18), rgba(220,53,69,.05)) !important;
  border-color: rgba(220,53,69,.50) !important;
}
html.theme-dark .corr-missed {
  background: linear-gradient(180deg, rgba(245,158,11,.18), rgba(245,158,11,.05)) !important;
  border-color: rgba(245,158,11,.50) !important;
}

/* Propositions corrigées (mode épreuve) */
html.theme-dark .prop-wrong-checked {
  background: rgba(220,53,69,.12) !important;
  border-color: rgba(220,53,69,.40) !important;
}
html.theme-dark .prop-wrong-missed {
  background: rgba(220,53,69,.08) !important;
}
html.theme-dark .prop-good {
  background: rgba(22,163,74,.12) !important;
  border-color: rgba(22,163,74,.35) !important;
}

/* Badges de type de série */
html.theme-dark .badge-dl {
  background: rgba(11,59,140,.25) !important;
  border-color: rgba(30,100,220,.35) !important;
  color: #93c5fd !important;
}
html.theme-dark .badge-dp {
  background: rgba(21,94,117,.25) !important;
  border-color: rgba(6,182,212,.35) !important;
  color: #67e8f9 !important;
}
html.theme-dark .badge-kfp {
  background: rgba(124,45,18,.25) !important;
  border-color: rgba(234,88,12,.35) !important;
  color: #fdba74 !important;
}
html.theme-dark .badge-dossier {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-muted) !important;
}

/* Mode badges */
html.theme-dark .mode-badge {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-muted) !important;
}
html.theme-dark .mode-qcm {
  background: rgba(55,48,163,.20) !important;
  border-color: rgba(99,102,241,.35) !important;
  color: #a5b4fc !important;
}
html.theme-dark .mode-texte {
  background: rgba(8,145,178,.18) !important;
  border-color: rgba(6,182,212,.35) !important;
  color: #67e8f9 !important;
}
html.theme-dark .mode-zone {
  background: rgba(161,98,7,.22) !important;
  border-color: rgba(202,138,4,.35) !important;
  color: #fcd34d !important;
}

/* Chip de réponse */
html.theme-dark .choice-chip {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}
html.theme-dark .choice-chip.ok {
  background: rgba(22,163,74,.15) !important;
  border-color: rgba(22,163,74,.40) !important;
  color: #4ade80 !important;
}
html.theme-dark .choice-chip.ko {
  background: rgba(220,53,69,.15) !important;
  border-color: rgba(220,53,69,.40) !important;
  color: #f87171 !important;
}

/* Sidebar de navigation QCM */
html.theme-dark .qcm-sidebar-item {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .qcm-sidebar-item.ok {
  background: rgba(22,163,74,.15) !important;
  border-color: rgba(22,163,74,.40) !important;
}
html.theme-dark .qcm-sidebar-item.ko {
  background: rgba(220,53,69,.13) !important;
  border-color: rgba(220,53,69,.35) !important;
}
html.theme-dark .qcm-sidebar-item.mid {
  background: rgba(245,158,11,.15) !important;
  border-color: rgba(245,158,11,.35) !important;
}
html.theme-dark .qcm-sidebar-item.info {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}

/* Bulle de correction */
html.theme-dark .prop-corr {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-muted) !important;
}
html.theme-dark .prop-corr.error {
  background: rgba(245,158,11,.10) !important;
  border-color: rgba(245,158,11,.40) !important;
  color: #fbbf24 !important;
}
html.theme-dark .question-corr {
  background: rgba(245,158,11,.10) !important;
  border-color: rgba(245,158,11,.40) !important;
  color: #fcd34d !important;
}

/* Boîte de correction (mode épreuve) */
html.theme-dark .corr-box {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}
html.theme-dark .corr-box.danger {
  background: rgba(220,53,69,.10) !important;
  border-color: rgba(220,53,69,.35) !important;
}

/* Éléments divers */
html.theme-dark .scorebox,
html.theme-dark .scorepill,
html.theme-dark .ancrage-box,
html.theme-dark .scope-box {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
}
html.theme-dark .field,
html.theme-dark .stats-mini-value {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .dossier-chip {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .btn-forum {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}

/* ============================================================
   Page tuteurs/series/affichage/correction
   Redéfinition des variables sémantiques locales (--ok-bg, --ko-bg, etc.)
   ============================================================ */

/* Redéfinir les variables locales ok/ko/hc/qrp pour le dark mode.
   html.theme-dark (specificity 0,1,1) l'emporte sur :root (0,1,0) dans la page. */
html.theme-dark {
  --ok-bg:     rgba(22, 163, 74, .13);
  --ok-bd:     rgba(22, 163, 74, .38);
  --ok-t:      #4ade80;
  --ko-bg:     rgba(220, 53, 69, .12);
  --ko-bd:     rgba(220, 53, 69, .35);
  --ko-t:      #f87171;
  --hc-bg:     rgba(245, 158, 11, .13);
  --hc-bd:     rgba(245, 158, 11, .35);
  --hc-t:      #fbbf24;
  --qrp-i-bg:  rgba(55, 48, 163, .18);
  --qrp-i-bd:  rgba(99, 102, 241, .35);
  --qrp-i-t:   #a5b4fc;
  --qrp-v-bg:  rgba(22, 163, 74, .13);
  --qrp-v-bd:  rgba(22, 163, 74, .35);
  --qrp-v-t:   #4ade80;
  --qrp-inv-bg: rgba(220, 53, 69, .12);
  --qrp-inv-bd: rgba(220, 53, 69, .35);
  --qrp-inv-t:  #f87171;
  --qrp-ina-bg: rgba(245, 158, 11, .12);
  --qrp-ina-bd: rgba(245, 158, 11, .35);
  --qrp-ina-t:  #fbbf24;
}

/* Composants de la page de correction tuteur */
html.theme-dark .stat {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}
html.theme-dark .select {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .badge {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-muted) !important;
}
html.theme-dark .letter {
  background: var(--pri-bg-subtle) !important;
}
html.theme-dark .pill {
  background: var(--pri-bg-subtle) !important;
  border-color: var(--pri-border) !important;
}
/* pill ok/ko/hc/qrp héritent maintenant des variables redéfinies ci-dessus */
html.theme-dark .field {
  background: var(--pri-input-bg) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .btn-ghost,
html.theme-dark .btn-mini {
  background: var(--pri-card) !important;
  border-color: var(--pri-border) !important;
  color: var(--pri-text) !important;
}
html.theme-dark .zone-img {
  background: var(--pri-card) !important;
}