/* ======================================
   🔹 PALETTE SCORE N / D / AN (OFFICIELLE)
====================================== */
:root {
    --score-n-bg: #d1e7dd;
    --score-n-border: #0f5132;
    --score-n-fg: #0f5132;

    --score-d-bg: #fff3cd;
    --score-d-border: #664d03;
    --score-d-fg: #664d03;

    --score-an-bg: #f8d7da;
    --score-an-border: #842029;
    --score-an-fg: #842029;
}
/* Chemin : static/css/style.css */

/* ======================================
   🎨 VARIABLES CSS - THÈME MARÉCHAL
====================================== */
:root {
    /* Couleurs du thème Maréchal */
    --theme-primary: #ecaf6d; /* Cuivre/Selle */
    --theme-secondary: #2C1810; /* Fer forgé sombre */
    --theme-accent: #D4A574; /* Or vieilli */

    /* Tons naturels */
    --earth-dark: #3E2723;
    --earth-light: #F5E6D3;
    --metal-gray: #5D4E37;
    --forge-red: #dac5c2;

    --surface: #FAFAF8;
    --surface-contrast: #1A1512;
    --muted: #8D7B68;

    /* Variables Bootstrap compatibles */
    --brand: rgb(181, 95, 11);
    --brand-contrast: #ffffff;
    --danger: #e40000;

    --menu-active-bg: #E9D8C9; /* Marron clair lisible */
    --menu-active-fg: #272727; /* Texte foncé pour contraste (option) */

    /* Couleurs score intervention (N / D / AN) */
    --score-n-bg: rgba(25, 135, 84, 0.85);
    --score-n-fg: #0f5132;
    --score-n-border: #198754;

    --score-d-bg: rgba(248, 144, 8, 0.85);
    --score-d-fg: #664d03;
    --score-d-border: #f89008;

    --score-an-bg: rgba(220, 53, 69, 0.85);
    --score-an-fg: #842029;
    --score-an-border: #dc3545;
}

/* ======================================
   🔹 STYLES DE BASE
====================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: linear-gradient(135deg, var(--earth-light) 0%, #E8DCC8 100%);
    color: var(--surface-contrast);
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    color: var(--theme-primary);
}

h5, h6 {
    color: #f3c292;
}

/* Liens */
a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    text-decoration: none;
}

/* ======================================
   🔹 NAVBAR
====================================== */
.navbar {
    background: linear-gradient(180deg, var(--theme-primary) 0%, var(--theme-secondary) 100%) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid var(--theme-accent);
}

.navbar .navbar-brand {
    color: var(--theme-accent) !important;
    font-family: "Playfair Display", serif;
    font-weight: 800;
    font-size: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
}

.navbar .form-control {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    backdrop-filter: blur(8px);
    border-radius: 8px;
}

.navbar .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.navbar .form-control:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--theme-accent);
    color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(212, 165, 116, 0.25);
}

.navbar .btn-outline-secondary {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    font-weight: 600;
}

.navbar .btn-outline-secondary:hover {
    background: var(--theme-accent);
    color: var(--theme-secondary);
    transform: translateY(-1px);
}

.hover-card {
    transition: .3s;
    cursor: pointer
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15) !important
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center
}

/* ======================================
   🔹 SIDEBAR
====================================== */
.sidebar {
    /*height: 100vh;*/
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--theme-secondary) 0%, #1A1410 100%);
    color: var(--theme-accent);
    overflow-y: auto;
    border-right: 3px solid var(--metal-gray);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
}

.sidebar a {
    color: rgba(212, 165, 116, 0.85);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.75rem 1rem !important;
}

.sidebar a::before {
    /* content: "🔨"; */
    position: absolute;
    left: -20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.sidebar a:hover::before,
.sidebar a.active::before {
    left: 0.5rem;
    opacity: 1;
}

.sidebar a:hover,
.sidebar .active {
    background: var(--menu-active-bg) !important;
    color: var(--menu-active-fg) !important;
    border-left: 4px solid var(--theme-accent);
    border-radius: 0 8px 8px 0;
    padding-left: 2rem !important;
}

.sidebar hr {
    border-color: rgba(212, 165, 116, 0.3) !important;
    margin: 1rem 0.75rem;
}

/* ======================================
   🔹 CONTENU PRINCIPAL
====================================== */
main {
    background: #fff;
    border-radius: 12px;
    min-height: 90vh;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--theme-primary);
    position: relative;
    overflow: hidden;
}

main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--theme-primary);
}

/* ======================================
   🔹 CARTES
====================================== */
.card {
    border: 2px solid var(--metal-gray);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
    background: var(--surface);
    color: var(--surface-contrast);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.3);
    border-color: var(--theme-primary);
}

.card-header {
    background: linear-gradient(135deg, var(--theme-primary) 0%, #6B3410 100%) !important;
    color: #fff !important;
    font-family: "Playfair Display", serif;
    font-weight: 700;
    border-bottom: 3px solid var(--theme-primary) !important;
    padding: 1rem 1.25rem;
}

/* ======================================
   🔹 BOUTONS
====================================== */
.btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
}

.btn-outline-dark {
    border: 2px solid var(--theme-primary);
    color: var(--theme-primary);
}

.btn-outline-dark:hover {
    background: var(--theme-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-outline-secondary:hover {
    background: var(--metal-gray);
    border-color: var(--metal-gray);
    color: #fff;
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

.btn-outline-danger {
    border-color: var(--forge-red);
    color: var(--forge-red);
}

.btn-outline-danger:hover {
    background: var(--forge-red);
    color: #fff;
}

/* Boutons personnalisés marque */
.btn-brand {
    background-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
    border: 1px solid var(--brand) !important;
}

.btn-brand:hover {
    filter: brightness(0.92);
}

.btn-outline-brand {
    background-color: transparent !important;
    color: var(--brand) !important;
    border: 1px solid var(--brand) !important;
}

.btn-outline-brand:hover {
    background-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

/* ======================================
   🔹 BADGES
====================================== */
.badge {
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.badge.bg-secondary {
    background: var(--metal-gray) !important;
}

.badge-brand {
    background-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

/* ======================================
   🔹 TABLEAUX
====================================== */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background: var(--earth-light);
    color: var(--theme-primary);
}

.table tbody tr:hover {
    background: rgba(139, 69, 19, 0.1);
}

.table-light {
    --bs-table-bg: color-mix(in srgb, var(--brand) 8%, white);
}

/* ======================================
   🔹 CARTES INTERVENTION
====================================== */
.inter-card {
    border: 2px solid var(--metal-gray);
    transition: all 0.3s ease;
}

.inter-card:hover {
    border-color: var(--theme-primary);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.25);
}

.inter-card .img-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem 0.75rem 0 0;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--earth-light) 0%, #E8DCC8 100%);
}

.inter-card .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.inter-card:hover .img-wrap img {
    transform: scale(1.08);
}

.inter-card .overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.75rem;
    background: linear-gradient(180deg, transparent 0%, rgba(44, 24, 16, 0.9) 100%);
    color: var(--theme-accent);
}

.inter-card .badge-title {
    background: rgba(139, 69, 19, 0.8);
    border: 1px solid var(--theme-primary);
    color: #fff;
    font-weight: 700;
}

/* ====== INFOSTABLE UX (N/D/AN + vides + mobile) ====== */
#infosTable .empty-field {
    background-color: #fff0f0 !important;
    border-color: #dc3545 !important;
}

/* === SCORE N / D / AN — CONTENEUR UNIFIÉ === */
td.score-n,
select.score-n,
span.score-n {
    background-color: var(--score-n-bg) !important;
    border: 1px solid var(--score-n-border) !important;
    color: var(--score-n-fg) !important;
    font-weight: 600;
    padding: 4px;
    border-radius: 4px ;

}

td.score-d,
select.score-d,
span.score-d {
    background-color: var(--score-d-bg) !important;
    border: 1px solid var(--score-d-border) !important;
    color: var(--score-d-fg) !important;
    font-weight: 600;
    padding: 4px;
    border-radius: 4px ;

}

td.score-an,
select.score-an,
span.score-an {
    background-color: var(--score-an-bg) !important;
    border: 1px solid var(--score-an-border) !important;
    color: var(--score-an-fg) !important;
    font-weight: 600;
    padding: 4px;
    border-radius: 4px ;

}

/* Mobile : masquer le chevron (Android OK, iOS limité) */
@media (max-width: 768px) {
    #infosTable select,
    #rowBulkPicker {
        -webkit-appearance: none;
        appearance: none;
        background-image: none !important;
        padding-right: 0.5rem;
    }

    #infosTable select::-ms-expand,
    #rowBulkPicker::-ms-expand {
        display: none;
    }
}

/* ======================================
   🔹 FOOTER
====================================== */
footer {
    background: var(--theme-secondary);
    color: var(--theme-accent);
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 3px solid var(--theme-accent);
}

/* ======================================
   🔹 OFFCANVAS
====================================== */
.offcanvas {
    background: linear-gradient(180deg, var(--theme-secondary) 0%, #1A1410 100%) !important;
}

.offcanvas-header {
    background: rgba(212, 165, 116, 0.1);
    border-bottom: 2px solid var(--theme-accent);
}

.offcanvas-title {
    color: var(--theme-accent) !important;
}

.offcanvas .nav-link {
    color: rgba(212, 165, 116, 0.85);
    padding: 10px !important;
    font-size: 1rem;
    /*border-bottom: 1px solid rgba(212, 165, 116, 0.15);*/
}

.offcanvas .nav-link:hover {
    background: rgba(212, 165, 116, 0.2) !important;
    border-left: 4px solid var(--theme-accent);
    color: inherit !important;
}

.offcanvas .nav-link.active {
    background: var(--menu-active-bg) !important;
    color: var(--menu-active-fg) !important;
    border-left: 4px solid var(--theme-accent);
}

/* ======================================
   🔹 CLASSES UTILITAIRES
====================================== */
.text-brand {
    color: var(--theme-secondary) !important;
}

.bg-brand {
    background-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

.border-brand {
    border-color: var(--brand) !important;
}

.text-danger {
    color: var(--brand) !important;
}

.text-muted {
    color: var(--muted) !important;
}

.card-header-brand {
    background: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

.navbar-brand-bg {
    background: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

/* ======================================
   🔹 OVERRIDES BOOTSTRAP
====================================== */
.btn-danger,
.text-bg-danger,
.bg-danger {
    background-color: var(--danger) !important;
    border-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
}

.alert-danger {
    --bs-alert-color: var(--brand-contrast);
    --bs-alert-bg: color-mix(in srgb, var(--brand) 10%, white);
    --bs-alert-border-color: var(--brand);

    color: var(--brand-contrast);
    background: var(--bs-alert-bg);
    border-color: var(--bs-alert-border-color);
}

/* ======================================
   🔹 ANIMATIONS
====================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.inter-card {
    animation: fadeIn 0.4s ease-out;
}

/* ======================================
   🔹 SCROLLBAR PERSONNALISÉE
====================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--earth-light);
}

::-webkit-scrollbar-thumb {
    background: var(--metal-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
}

/* ======================================
   📱 RESPONSIVE - MOBILE (<768px)
====================================== */
@media (max-width: 767.98px) {
    body {
        background: var(--surface);
    }

    h1 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem !important;
    }

    .navbar .form-control,
    .navbar form .btn {
        display: none;
    }

    .sidebar {
        display: none !important;
    }

    .offcanvas {
        width: 85vw;
        max-width: 320px;
    }

    main {
        border-radius: 0;
        margin-left: 0 !important;
        box-shadow: none;
        border: none;
        min-height: calc(100vh - 60px);
    }

    main::before {
        height: 4px;
    }

    .main-wrap {
        padding-top: 0;
    }

    .card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }

    .card-header {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        border-radius: 8px;
        border: 1px solid var(--metal-gray);
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
    }

    .badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.65rem;
    }

    section {
        margin-bottom: 1.5rem !important;
    }

    .inter-card {
        margin-bottom: 1.25rem;
    }

    .inter-card .card-body {
        padding: 1rem;
    }

    .inter-card .legend {
        font-size: 0.875rem;
    }

    footer {
        font-size: 0.875rem;
        padding: 1rem;
        margin-top: 2rem;
    }

    .form-control,
    .form-select {
        font-size: 1rem;
        padding: 0.75rem;
        min-height: 44px;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .alert {
        font-size: 0.875rem;
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
}

/* ======================================
   📱 RESPONSIVE - TABLETTE (768px - 991px)
====================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        display: none !important;
    }

    .navbar-toggler {
        display: block !important;
    }

    main {
        margin-left: 0 !important;
    }

    h1 {
        font-size: 2rem;
    }

    .card-header {
        font-size: 1.1rem;
    }

    .navbar .form-control {
        max-width: 300px;
    }

    .offcanvas {
        width: 320px;
    }
}

/* ======================================
   🖥️ RESPONSIVE - DESKTOP (≥992px)
====================================== */
@media (min-width: 992px) {
    .sidebar {
        display: block !important;
    }

    .navbar-toggler {
        display: none !important;
    }

    main {
        margin-left: 0;
    }

    .main-wrap {
        padding-top: 0;
    }
}

/* ======================================
   📱 RESPONSIVE - TRÈS PETITS ÉCRANS (<375px)
====================================== */
@media (max-width: 374px) {
    h1 {
        font-size: 1.5rem !important;
    }

    .navbar-brand {
        font-size: 1rem !important;
    }

    .card-header h5 {
        font-size: 0.95rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.65rem 1rem;
    }
}

/* ==== STYLE CALENDRIER (rappelle ton thème brun) ==== */
.calendar-card {
    background: #f6efe5;
}

.calendar-header {
    background: #3a1f12;
    color: #f3e6d8;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f3e6d8;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-weekdays div {
    color: #6a5244;
    text-align: center;
}

.calendar-cell {
    background: #fff;
    border-radius: 0.75rem;
    min-height: 78px;
    padding: 0.5rem;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.calendar-cell.out {
    opacity: 0.45;
}

.calendar-day {
    font-weight: 600;
    color: #4a342a;
    font-size: 0.95rem;
}

.calendar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1;
    border: 1px solid transparent;
}

.tag.visit {
    background: #fde2e2;
    border-color: #f6b9b9;
}

.tag.training {
    background: #e6ecff;
    border-color: #c7d3ff;
}

.tag.other {
    background: #efe7dc;
    border-color: #dccab3;
}

/* === Override Title Menu (including Offcanvas) === */
.title_menu {
    color: #F5E6D3 !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid #ecaf6d;
}


/* ======================================
   🌙 MODE SOMBRE (GLOBAL)
   Fond foncé + texte blanc/brand sur toutes les pages
====================================== */
html[data-theme="dark"] .logo-preview {
    background-color: #0f1115;
}
/* Aide le navigateur (inputs/scrollbars) */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

/* Overrides variables en sombre */
html[data-theme="dark"] {
    --earth-light: #0b1220;
    --surface: #111827;
    --surface-contrast: #e5e7eb;
    --muted: #9ca3af;

    --menu-active-bg: rgba(236, 175, 109, 0.18);
    --menu-active-fg: #f3f4f6;

    --metal-gray: rgba(255, 255, 255, 0.14);
    --forge-red: #f2b8b5;
}

/* Base page */
html[data-theme="dark"] body {
    /* Fond global "black" (plus profond que le gradient actuel) */
    background-color: #070a0f;
    background-image: radial-gradient(1200px 800px at 20% 0%, rgba(236, 175, 109, 0.10) 0%, rgba(7, 10, 15, 0.00) 55%),
    radial-gradient(900px 600px at 80% 20%, rgba(212, 165, 116, 0.08) 0%, rgba(7, 10, 15, 0.00) 55%),
    linear-gradient(135deg, #070a0f 0%, #0b1220 70%, #0f172a 100%);
    color: var(--surface-contrast);
}

/* Titres */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 {
    color: var(--theme-primary);
}

html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
    color: #f3c292;
}

/* Liens : brand */
html[data-theme="dark"] a {
    color: var(--theme-primary);
}
html[data-theme="dark"] a:hover {
    color: var(--theme-accent);
}

/* Contenu principal */
html[data-theme="dark"] main {
    background-color: #0b0e13;
    border-color: rgba(236, 175, 109, 0.22);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] main::before {
    background: linear-gradient(90deg, rgba(236, 175, 109, 0.75) 0%, rgba(212, 165, 116, 0.35) 50%, rgba(236, 175, 109, 0.75) 100%);
}

/* Sections génériques */
html[data-theme="dark"] section,
html[data-theme="dark"] .section,
html[data-theme="dark"] .content-section,
html[data-theme="dark"] .theme-surface {
    background-color: #0f1115; /* surface sombre (black) */
    color: #ffffff;
}

/* Texte */
html[data-theme="dark"] p,
html[data-theme="dark"] span,
html[data-theme="dark"] li,
html[data-theme="dark"] label,
html[data-theme="dark"] small {
    color: #e5e7eb;
}

/* text-muted Bootstrap */
html[data-theme="dark"] .text-muted {
    color: var(--muted) !important;
}

/* Cards */
html[data-theme="dark"] .card {
    background: #111520; /* card plus sombre */
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .card:hover {
    border-color: rgba(236, 175, 109, 0.55);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Card header : garde ton gradient mais corrige les bordures */
html[data-theme="dark"] .card-header {
    border-bottom-color: rgba(236, 175, 109, 0.55) !important;
}

/* Badges */
html[data-theme="dark"] .badge.bg-secondary {
    background: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Tables */
html[data-theme="dark"] .table {
    color: #e5e7eb;
}

html[data-theme="dark"] .table thead {
    background: #0b0e13; /* thead plus noir */
    color: #ffffff;
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td {
    border-color: rgba(255, 255, 255, 0.10);
}

/* Lignes par défaut */
html[data-theme="dark"] .table tbody tr {
    background-color: #0f1115; /* noir profond */
    color: #e5e7eb;
}

/* Alternance subtile */
html[data-theme="dark"] .table tbody tr:nth-child(even) {
    background-color: #10131a;
}

/* Hover lisible mais discret */
html[data-theme="dark"] .table tbody tr:hover {
    background-color: #151a24;
}

/* Forçage explicite des lignes "black" (réutilisable sur toutes les pages) */
html[data-theme="dark"] tr.tr-black {
    background-color: #0f1115 !important;
    color: #e5e7eb !important;
}

html[data-theme="dark"] tr.tr-black:nth-child(even) {
    background-color: #10131a !important;
}

html[data-theme="dark"] tr.tr-black:hover {
    background-color: #151a24 !important;
}

/* Form controls */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: #020617;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .form-control::placeholder {
    color: #9ca3af;
}

/* Sidebar / Offcanvas (pour cohérence) */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .offcanvas {
    border-right-color: rgba(255, 255, 255, 0.12);
}

/* Thead custom (table-head) en sombre */
html[data-theme="dark"] thead.table-head {
    background: #0b0e13; /* header noir */
    color: #ffffff;
}

/* TH (chaque colonne) en noir en mode sombre */
html[data-theme="dark"] th.th-black {
    background: #0b0e13 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] thead.table-head a {
    color: #ffffff !important;
}

/* =====================================
   POPUPS / MODALS / TOASTS – MODE SOMBRE
   ===================================== */

/* Bootstrap Modal */
html[data-theme="dark"] .modal-content {
    background-color: #0f1115;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    background-color: #0b0e13;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .modal-body {
    background-color: #0f1115;
    color: #e5e7eb;
}

html[data-theme="dark"] .modal-title {
    color: var(--theme-primary);
}

html[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.85;
}

/* Backdrop (si besoin d'un fond plus profond) */
html[data-theme="dark"] .modal-backdrop.show {
    opacity: 0.75;
}

/* Bootstrap Toast */
html[data-theme="dark"] .toast {
    background-color: #0f1115;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .toast-header {
    background-color: #0b0e13;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .toast-body {
    color: #e5e7eb;
}

/* Dropdowns (menus) */
html[data-theme="dark"] .dropdown-menu {
    background-color: #0f1115;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .dropdown-item {
    color: #e5e7eb;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

html[data-theme="dark"] .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.10);
}

/* Popovers / Tooltips */
html[data-theme="dark"] .popover {
    background-color: #0f1115;
    border-color: rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

html[data-theme="dark"] .popover-header {
    background-color: #0b0e13;
    border-bottom-color: rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

html[data-theme="dark"] .popover-body {
    color: #e5e7eb;
}

html[data-theme="dark"] .tooltip-inner {
    background-color: #0b0e13;
    color: #ffffff;
}

/* SweetAlert2 (si utilisé) */
html[data-theme="dark"] .swal2-popup {
    background: #0f1115 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .swal2-title {
    color: var(--theme-primary) !important;
}

html[data-theme="dark"] .swal2-html-container {
    color: #e5e7eb !important;
}

html[data-theme="dark"] .swal2-icon {
    filter: brightness(0.95);
}

/* Responsive: mobile — garder le fond "black" cohérent en dark */
@media (max-width: 767.98px) {
    html[data-theme="dark"] body {
        background-color: #070a0f !important;
        background-image: radial-gradient(1200px 800px at 20% 0%, rgba(236, 175, 109, 0.10) 0%, rgba(7, 10, 15, 0.00) 55%),
                          radial-gradient(900px 600px at 80% 20%, rgba(212, 165, 116, 0.08) 0%, rgba(7, 10, 15, 0.00) 55%),
                          linear-gradient(135deg, #070a0f 0%, #0b1220 70%, #0f172a 100%) !important;
    }
}

.switch-brand .form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.switch-brand .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(236, 175, 109, 0.25); /* adapte à ta couleur */
}