/* Tableau aux couleurs du thème de l'université : ajouter la classe « table-theme » au <table>.
   Teintes : cisnet/backend/layouts/partials/theme_hero_variables.blade.php (mode sombre compris).
   Sans !important : une page garde ses propres règles (cartes sur téléphone, colonnes fixes…). */
.table-theme {
    border: 1px solid var(--theme-table-outline, #dbe5ee);
    /* Fond blanc pur ; rayures et survol ci-dessous, sans les voiles gris de Bootstrap et de DataTables. */
    --bs-table-bg: var(--theme-table-row, #fff); --bs-table-striped-bg: transparent; --bs-table-hover-bg: transparent;
}
table.table.dataTable.table-theme { --dt-row-stripe: 255, 255, 255; --dt-row-hover: 255, 255, 255; }
html[data-cn-theme="dark"] table.table.dataTable.table-theme { --dt-row-stripe: 0, 0, 0; --dt-row-hover: 0, 0, 0; }
/* En-tête : toujours la teinte claire du thème, sauf cellule, ligne ou en-tête déjà colorés (classes table-*, bg-*, style). */
.table-theme > thead:not(:where([class*="table-"]:not(.table-light), [class*="bg-"]:not(.bg-light))) > tr:not(:where([class*="table-"], [class*="bg-"], [style*="background"])) > :is(th, td):not(:where([class*="table-"], [class*="bg-"], [style*="background"])) {
    background: var(--theme-table-head, #eef6fb) !important; color: #16324F; font-weight: 600; vertical-align: middle;
    border: 1px solid var(--theme-table-head-border, #cfe0ee);
}
.table-theme > tbody > tr > td, .table-theme > tbody > tr > th, .table-theme > tfoot > tr > td, .table-theme > tfoot > tr > th { vertical-align: middle; }
/* Sur téléphone, les tableaux présentés en cartes gardent leurs propres bordures. */
@media (min-width: 768px) {
    .table-theme > tbody > tr > td, .table-theme > tbody > tr > th, .table-theme > tfoot > tr > td, .table-theme > tfoot > tr > th { border: 1px solid var(--theme-table-border, #e3ebf2); }
}
.table-theme > tfoot > tr > th:not(:where([class*="table-"], [class*="bg-"])) { background: var(--theme-table-head, #eef6fb); }
/* Lignes alternées : impaires en blanc pur, paires nuancées du thème ; les lignes et cellules colorées sont conservées. */
.table-theme.table-striped > tbody > tr:nth-of-type(odd):not(:where([class*="table-"], [class*="bg-"])) > td:not(:where([class*="table-"], [class*="bg-"])),
.table-theme.table-striped > tbody > tr:nth-of-type(odd) > .dt-sticky-col { background: var(--theme-table-row, #fff); }
.table-theme.table-striped > tbody > tr:nth-of-type(even):not(:where([class*="table-"], [class*="bg-"])) > td:not(:where([class*="table-"], [class*="bg-"])),
.table-theme.table-striped > tbody > tr:nth-of-type(even) > .dt-sticky-col { background: var(--theme-table-stripe, #f8fbfe); }
/* Survol, sans effacer les lignes et cellules colorées (succès, alerte…). */
.table-theme.table-theme > tbody > tr:nth-of-type(n):not(:where([class*="table-"], [class*="bg-"])):hover > td:not(:where([class*="table-"], [class*="bg-"])) { background: var(--theme-table-hover, #eef6fb); }
html[data-cn-theme="dark"] .table-theme > thead > tr > :is(th, td) { color: #e6f0fa !important; }
/* Coins arrondis (comme la liste des facultés) : le conteneur qui défile (.table-responsive, ou la cellule de DataTables
   placée dans un .table-responsive) porte le cadre arrondi ; le tableau perd son cadre extérieur et les bordures des cellules
   du bord. Il ne découpe rien de plus : ce conteneur défilait déjà. Seulement quand le tableau y est seul (une aide ou un
   bouton à côté reste hors du cadre) et sur écran : les tableaux en cartes sur téléphone gardent leur présentation. */
@media (min-width: 768px) {
    .table-responsive:has(> table.table-theme:only-child),
    .table-responsive :is(.dataTables_wrapper .col-sm-12, .dt-layout-table > *):has(> table.table-theme:only-child) {
        border: 1px solid var(--theme-table-outline, #dbe5ee); border-radius: 12px; overflow-x: auto; padding: 0;
    }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child {
        border: 0; margin-top: 0 !important; margin-bottom: 0 !important;
    }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody, tfoot) > tr > :first-child { border-left: 0 !important; }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody, tfoot) > tr > :last-child { border-right: 0 !important; }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody:first-child, colgroup:first-child + tbody) > tr:first-child > * { border-top: 0 !important; }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody, tfoot):last-child > tr:last-child > * { border-bottom: 0 !important; }
    /* Les lignes elles-mêmes (Bootstrap borde les <tr> des tableaux bordés) : sans quoi un second trait double le cadre. */
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody, tfoot) > tr { border-left: 0 !important; border-right: 0 !important; }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody:first-child, colgroup:first-child + tbody) > tr:first-child { border-top: 0 !important; }
    :is(.table-responsive, .table-responsive .dataTables_wrapper .col-sm-12, .table-responsive .dt-layout-table > *) > table.table-theme:only-child > :is(thead, tbody, tfoot):last-child > tr:last-child { border-bottom: 0 !important; }
}
/* Mention aux couleurs du thème (Exécutif…). */
.badge-theme { background: var(--theme-hero-start, #185fa5); color: #fff; }
/* Boutons à menu (« Actions ») dans les tableaux : contour à la couleur du thème, plein au survol et ouvert. */
.table-theme .dropdown-toggle:is(.btn-outline-primary, .btn-outline-info) {
    --bs-btn-color: var(--theme-hero-start, #185fa5); --bs-btn-border-color: var(--theme-hero-start, #185fa5);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--theme-hero-start, #185fa5); --bs-btn-hover-border-color: var(--theme-hero-start, #185fa5);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--theme-hero-start, #185fa5); --bs-btn-active-border-color: var(--theme-hero-start, #185fa5);
    box-shadow: none;
}
.table-theme .dropdown-toggle:is(.btn-primary, .btn-info) {
    --bs-btn-color: #fff; --bs-btn-bg: var(--theme-hero-start, #185fa5); --bs-btn-border-color: var(--theme-hero-start, #185fa5);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: color-mix(in srgb, var(--theme-hero-start, #185fa5) 88%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--theme-hero-start, #185fa5) 88%, #000);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: color-mix(in srgb, var(--theme-hero-start, #185fa5) 80%, #000); --bs-btn-active-border-color: color-mix(in srgb, var(--theme-hero-start, #185fa5) 80%, #000);
    box-shadow: none;
}
html[data-cn-theme="dark"] .table-theme .dropdown-toggle:is(.btn-outline-primary, .btn-outline-info) { --bs-btn-color: color-mix(in srgb, var(--theme-hero-start, #185fa5) 45%, #fff); --bs-btn-border-color: color-mix(in srgb, var(--theme-hero-start, #185fa5) 45%, #fff); }
/* Onglets (nav-tabs, nav-pills, customtab, customtab2) : couleur du thème ; les pages qui ont leur propre style le gardent. */
.nav-tabs, .nav-pills { --bs-nav-link-color: color-mix(in srgb, var(--theme-hero-start, #185fa5) 75%, #4f5467); --bs-nav-link-hover-color: var(--theme-hero-start, #185fa5); }
.nav-tabs {
    --bs-nav-tabs-link-active-color: var(--theme-hero-start, #185fa5);
    --bs-nav-tabs-link-hover-border-color: var(--theme-table-border, #e3ebf2) var(--theme-table-border, #e3ebf2) var(--theme-table-head-border, #cfe0ee);
    --bs-nav-tabs-border-color: var(--theme-table-head-border, #cfe0ee);
    --bs-nav-tabs-link-active-border-color: var(--theme-table-head-border, #cfe0ee) var(--theme-table-head-border, #cfe0ee) var(--bs-body-bg);
}
.nav-tabs > .nav-item > .nav-link.active { font-weight: 600; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--theme-hero-start, #185fa5); --bs-nav-pills-link-active-color: #fff; }
.profile-tab li a.nav-link.active, .customtab li a.nav-link.active { border-bottom-color: var(--theme-hero-start, #185fa5); color: var(--theme-hero-start, #185fa5); }
.profile-tab li a.nav-link:hover, .customtab li a.nav-link:hover { color: var(--theme-hero-start, #185fa5); }
.customtab2 li a.nav-link.active, .customtab2 li a.nav-link:hover { background: var(--theme-hero-start, #185fa5); color: #fff; }
html[data-cn-theme="dark"] .nav-tabs, html[data-cn-theme="dark"] .nav-pills { --bs-nav-link-color: #b8c6d6; --bs-nav-link-hover-color: #fff; --bs-nav-tabs-link-active-color: #fff; }
