/* =====================================================
   CSSA 74 — Design System (Intranet)
   ===================================================== */

:root {
    --cssa-primary:    #002D5A;
    --cssa-red:        #D12027;
    --cssa-green:      #1A7B45;
    --cssa-yellow:     #FFD100;
    --cssa-blue-light: #2B90C6;
    --cssa-bg:         #F8FAFC;
    --cssa-text:       #0F172A;
    --cssa-border:     #E2E8F0;
    --cssa-muted:      #64748B;
}

/* ── Base ──────────────────────────────────────────── */
html { font-size: 15px; position: relative; min-height: 100%; }

body {
    background-color: var(--cssa-bg);
    color: var(--cssa-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* ── Layout ────────────────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
    width: 256px;
    min-height: 100vh;
    background-color: var(--cssa-primary);
    color: white;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
    padding: 1.375rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 3px;              /* épaisseur du cercle : augmenter/réduire cette valeur */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}
@media (max-width: 767px) {
    .sidebar-logo { width: 40px; height: 40px; }
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
}
.sidebar-link:hover {
    background-color: rgba(255,255,255,.08);
    color: white;
    border-left-color: rgba(255,209,0,.6);
}
.sidebar-link.active {
    background-color: rgba(255,255,255,.12);
    color: white;
    border-left-color: var(--cssa-yellow);
}
.sidebar-link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    margin-top: 0.5rem;
}

/* Collapsible group button */
.sidebar-group-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,.65);
    background: none;
    border: none;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sidebar-group-btn:hover {
    background-color: rgba(255,255,255,.08);
    color: white;
    border-left-color: rgba(255,209,0,.6);
}
.sidebar-group-btn.open {
    color: white;
}
.sidebar-group-btn .chev {
    margin-left: auto;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: rgba(255,255,255,.3);
    transition: transform 0.2s ease, color 0.15s ease;
}
.sidebar-group-btn.open .chev {
    transform: rotate(90deg);
    color: rgba(255,255,255,.55);
}
.sidebar-group-btn svg:not(.chev) {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

/* Sub-nav */
.sidebar-subnav {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.sidebar-subnav.open {
    max-height: 400px;
}
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.5rem 0.5rem 2.85rem;
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    font-size: 0.8rem;
    font-weight: 500;
}
.sidebar-sublink:hover {
    background-color: rgba(255,255,255,.06);
    color: rgba(255,255,255,.9);
    border-left-color: rgba(255,209,0,.4);
}
.sidebar-sublink.active {
    background-color: rgba(255,255,255,.1);
    color: white;
    border-left-color: var(--cssa-yellow);
}
.sidebar-sublink svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke-width: 1.75;
}
.sidebar-count {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--cssa-yellow);
    color: #002D5A;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cssa-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Main content ──────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 1.75rem 2rem;
    overflow-y: auto;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--cssa-primary);
    margin-bottom: 0;
}

/* ── Stat cards ────────────────────────────────────── */
.stat-card {
    background: white;
    border-radius: 0.875rem;
    padding: 1.375rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    border-top: 3px solid transparent;
    height: 100%;
}
.stat-card .stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--cssa-muted);
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--cssa-text);
}
.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--cssa-muted);
}
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Content cards ─────────────────────────────────── */
.content-card {
    background: white;
    border-radius: 0.875rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    overflow: hidden;
}
.content-card-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--cssa-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
}
.content-card-body { padding: 1.375rem; }

/* ── Action card (dark) ────────────────────────────── */
.action-card {
    background: var(--cssa-primary);
    border-radius: 0.875rem;
    padding: 1.375rem;
    color: white;
    position: relative;
    overflow: hidden;
}
.action-card .ac-circle {
    position: absolute;
    right: -1.5rem;
    bottom: -1.5rem;
    width: 7rem;
    height: 7rem;
    background: rgba(255,255,255,.05);
    border-radius: 50%;
}

/* ── Buttons ───────────────────────────────────────── */
.btn-cssa {
    background-color: var(--cssa-primary);
    border-color: var(--cssa-primary);
    color: white;
    font-weight: 600;
    border-radius: 0.5rem;
}
.btn-cssa:hover {
    background-color: #001f3e;
    border-color: #001f3e;
    color: white;
}
.btn-cssa-outline {
    border: 1.5px solid var(--cssa-primary);
    color: var(--cssa-primary);
    background: transparent;
    font-weight: 600;
    border-radius: 0.5rem;
}
.btn-cssa-outline:hover {
    background-color: var(--cssa-primary);
    color: white;
}
.btn-cssa-yellow {
    background-color: var(--cssa-yellow);
    border-color: var(--cssa-yellow);
    color: var(--cssa-primary);
    font-weight: 700;
    border-radius: 0.5rem;
}
.btn-cssa-yellow:hover {
    background-color: #e6bd00;
    border-color: #e6bd00;
    color: var(--cssa-primary);
}
.btn-ghost {
    background: rgba(255,255,255,.1);
    border: none;
    color: white;
    border-radius: 0.5rem;
}
.btn-ghost:hover {
    background: rgba(255,255,255,.2);
    color: white;
}

/* ── Tables ────────────────────────────────────────── */
.cssa-table th {
    background: #F8FAFC;
    color: var(--cssa-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--cssa-border);
    padding: .75rem 1rem;
}
.cssa-table td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-color: var(--cssa-border);
}
.cssa-table tbody tr:hover { background: #F8FAFC; }

/* ── Badges ────────────────────────────────────────── */
.badge-cssa-green  { background: #DCFCE7; color: var(--cssa-green);  padding: .3em .7em; border-radius: .375rem; font-size: .75rem; font-weight: 600; }
.badge-cssa-red    { background: #FEE2E2; color: var(--cssa-red);    padding: .3em .7em; border-radius: .375rem; font-size: .75rem; font-weight: 600; }
.badge-cssa-blue   { background: #DBEAFE; color: #1D4ED8;             padding: .3em .7em; border-radius: .375rem; font-size: .75rem; font-weight: 600; }
.badge-cssa-yellow { background: #FEF9C3; color: #854D0E;             padding: .3em .7em; border-radius: .375rem; font-size: .75rem; font-weight: 600; }
.badge-cssa-gray   { background: #F1F5F9; color: var(--cssa-muted);  padding: .3em .7em; border-radius: .375rem; font-size: .75rem; font-weight: 600; }

/* ── Tableau Tâches (Kanban) ───────────────────────── */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}
.kanban-column {
    background: var(--cssa-bg);
    border: 1px solid var(--cssa-border);
    border-radius: 0.875rem;
    padding: .75rem;
    min-height: 200px;
    transition: background-color .15s ease;
}
.kanban-column.drag-over { background: #E0ECF7; }
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: .85rem;
    color: var(--cssa-primary);
    padding: .25rem .25rem .75rem;
}
.kanban-column-count {
    background: white;
    border: 1px solid var(--cssa-border);
    border-radius: 999px;
    font-size: .72rem;
    color: var(--cssa-muted);
    padding: .05rem .55rem;
}
.kanban-column-body { display: flex; flex-direction: column; gap: .6rem; min-height: 40px; }
.kanban-card {
    background: white;
    border: 1px solid var(--cssa-border);
    border-radius: .625rem;
    padding: .65rem .75rem;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.kanban-card:hover { border-color: var(--cssa-blue-light); }
.kanban-card.dragging { opacity: .4; }
.kanban-card-title { font-size: .85rem; font-weight: 600; color: var(--cssa-text); }
.kanban-quick-add { margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--cssa-border); }

@media (max-width: 991px) {
    .kanban-board { grid-template-columns: 1fr; }
}

/* ── Forms ─────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: var(--cssa-border);
    font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--cssa-blue-light);
    box-shadow: 0 0 0 3px rgba(43,144,198,.15);
}
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cssa-text);
    margin-bottom: .4rem;
}

/* ── Alerts ────────────────────────────────────────── */
.alert {
    border-radius: 0.625rem;
    border: none;
    font-size: 0.875rem;
}
/* Hide empty validation-summary on GET (no errors yet) */
.validation-summary-valid { display: none !important; }

/* ── Utility colors ────────────────────────────────── */
.text-cssa-primary  { color: var(--cssa-primary)  !important; }
.text-cssa-blue     { color: var(--cssa-blue-light)!important; }
.text-cssa-red      { color: var(--cssa-red)       !important; }
.text-cssa-green    { color: var(--cssa-green)     !important; }
.text-cssa-yellow   { color: var(--cssa-yellow)    !important; }
.bg-cssa-primary    { background-color: var(--cssa-primary)  !important; }
.bg-cssa-blue       { background-color: var(--cssa-blue-light)!important; }
.bg-cssa-red        { background-color: var(--cssa-red)       !important; }
.bg-cssa-green      { background-color: var(--cssa-green)     !important; }
.bg-cssa-yellow     { background-color: var(--cssa-yellow)    !important; }

/* ── Login page ────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--cssa-primary) 0%, #00428a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        left: -256px;
        transition: left 0.25s ease;
        z-index: 1045;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1044;
    }
    .sidebar-overlay.open { display: block; }
    .main-content {
        padding: 1rem;
    }
}

/* ── Accordéon points d'ordre du jour (PV) ─────────── */
.agenda-toggle .agenda-chevron {
    transition: transform .15s ease;
}
.agenda-toggle[aria-expanded="true"] .agenda-chevron {
    transform: rotate(90deg);
}

/* =====================================================
   Extension du design system — pages de détail (CRM)
   Additif uniquement : les variables/classes ci-dessus ne
   sont pas renommées (elles sont utilisées telles quelles
   dans ~260 endroits des vues Evenements/Reunions/...).
   ===================================================== */

:root {
    --cssa-surface:        #FFFFFF;
    --cssa-primary-hover:  #001F3E;
    --cssa-blue-soft:      #EFF6FF;
    --cssa-blue-strong:    #1D4ED8;
    --cssa-green-soft:     #F0FDF4;
    --cssa-red-soft:       #FEF2F2;
    --cssa-red-border:     #FECACA;
    --cssa-amber:          #854D0E;
    --cssa-amber-soft:     #FEF9C3;
    --cssa-sky:            #0369A1;
    --cssa-sky-soft:       #F0F9FF;
    --cssa-text-secondary: #475569;
    --cssa-border-subtle:  #EDF1F5;
    --cssa-radius-sm:      .5rem;
    --cssa-radius-md:      .75rem;
    --cssa-radius-lg:      .875rem;
    --cssa-shadow-card:    0 1px 2px rgba(15,23,42,.05);
}

/* Cartes plus plates : un seul liseré fin + ombre discrète plutôt que le
   double box-shadow "carte Bootstrap" empilé sur toute la page. */
.content-card {
    background: var(--cssa-surface);
    border: 1px solid var(--cssa-border-subtle);
    border-radius: var(--cssa-radius-lg);
    box-shadow: var(--cssa-shadow-card);
    overflow: hidden;
}
.content-card-header {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--cssa-border-subtle);
}
.content-card-body { padding: 1.125rem 1.25rem; }
.content-card-body.is-empty { padding: .7rem 1.25rem; }

/* Libellé / valeur de champ (remplace le style inline répété partout) */
.field-label {
    font-size: .7rem;
    font-weight: 700;
    color: var(--cssa-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .15rem;
}
.field-value { font-size: .9rem; font-weight: 500; color: var(--cssa-text); }

.section-divider {
    border-top: 1px solid var(--cssa-border-subtle);
    margin-top: 1.1rem;
    padding-top: 1.1rem;
}

/* État vide compact : une section sans donnée ne doit pas peser autant
   qu'une section remplie. */
.empty-state {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--cssa-muted);
    font-size: .82rem;
    padding: .15rem 0;
}

/* Action destructive discrète (Retirer / Annuler / Supprimer en ligne) */
.btn-danger-ghost {
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .55rem;
    color: var(--cssa-red);
    border: 1px solid var(--cssa-red-border);
    background: var(--cssa-surface);
    border-radius: var(--cssa-radius-sm);
    line-height: 1.4;
}
.btn-danger-ghost:hover { background: var(--cssa-red-soft); border-color: var(--cssa-red); }

/* Boutons secondaires "teintés" (Publier / Clôturer / e-mail) — remplacent
   les styles inline dupliqués dans les cartes d'action. */
.btn-cssa-ghost-blue  { background: var(--cssa-blue-soft);  color: var(--cssa-blue-strong); border: none; font-weight: 600; border-radius: var(--cssa-radius-sm); }
.btn-cssa-ghost-blue:hover  { background: #E0EBFC; color: var(--cssa-blue-strong); }
.btn-cssa-ghost-green { background: var(--cssa-green-soft); color: var(--cssa-green);       border: none; font-weight: 600; border-radius: var(--cssa-radius-sm); }
.btn-cssa-ghost-green:hover { background: #DCFCE7; color: var(--cssa-green); }
.btn-cssa-ghost-amber { background: var(--cssa-amber-soft); color: var(--cssa-amber);       border: none; font-weight: 600; border-radius: var(--cssa-radius-sm); }
.btn-cssa-ghost-amber:hover { background: #FDE68A; color: var(--cssa-amber); }
.btn-cssa-ghost-sky   { background: var(--cssa-sky-soft);   color: var(--cssa-sky);         border: none; font-weight: 600; border-radius: var(--cssa-radius-sm); }
.btn-cssa-ghost-sky:hover   { background: #E0F2FE; color: var(--cssa-sky); }

.btn-icon-ghost {
    width: 2.1rem;
    height: 2.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--cssa-radius-sm);
    border: 1px solid var(--cssa-border);
    background: var(--cssa-surface);
    color: var(--cssa-text-secondary);
    flex-shrink: 0;
}
.btn-icon-ghost:hover { background: var(--cssa-bg); color: var(--cssa-text); }

/* Bandeau de KPIs (en-tête événement) */
.kpi-strip {
    display: flex;
    flex-wrap: wrap;
    background: var(--cssa-surface);
    border: 1px solid var(--cssa-border-subtle);
    border-radius: var(--cssa-radius-lg);
    box-shadow: var(--cssa-shadow-card);
    overflow: hidden;
}
.kpi-item { flex: 1 1 0; min-width: 118px; padding: .85rem 1rem; border-right: 1px solid var(--cssa-border-subtle); }
.kpi-item:last-child { border-right: none; }
.kpi-value { font-size: 1.3rem; font-weight: 800; line-height: 1.15; color: var(--cssa-text); }
.kpi-label {
    font-size: .68rem;
    font-weight: 700;
    color: var(--cssa-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .2rem;
}

/* Barre de statistiques générique (résumé financier, participants, bilan) */
.stat-bar { display: flex; flex-wrap: wrap; }
.stat-bar-item { flex: 1 1 0; min-width: 96px; padding: .65rem .5rem; text-align: center; border-right: 1px solid var(--cssa-border-subtle); }
.stat-bar-item:last-child { border-right: none; }
.stat-bar-value { font-size: 1.1rem; font-weight: 800; line-height: 1; }
.stat-bar-label {
    font-size: .68rem;
    color: var(--cssa-muted);
    margin-top: .2rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Menu déroulant harmonisé (actions secondaires) */
.dropdown-menu {
    border: 1px solid var(--cssa-border-subtle);
    border-radius: var(--cssa-radius-md);
    box-shadow: 0 8px 24px rgba(15,23,42,.12);
    padding: .4rem;
}
.dropdown-menu .dropdown-item { border-radius: .45rem; font-size: .85rem; font-weight: 500; padding: .5rem .65rem; }
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus { background: var(--cssa-bg); }
.dropdown-menu .dropdown-item.text-danger:hover,
.dropdown-menu .dropdown-item.text-danger:focus { background: var(--cssa-red-soft); }
.dropdown-menu .dropdown-divider { margin: .35rem 0; border-color: var(--cssa-border-subtle); }
/* Éditeur Quill du contenu de discussion d'un point d'ordre du jour (Reunions/_AgendaItem) —
   plus grand par défaut et redimensionnable manuellement pour la saisie de contenus longs. */
.quill-agenda-editor .ql-editor {
    min-height: 240px;
    max-height: 70vh;
    resize: vertical;
    overflow-y: auto;
}

/* Survol des lignes de la matrice de permissions (remplace onmouseover/onmouseout inline — SEC-5) */
.permissions-row-hover:hover { background: #FAFAFA; }
[data-theme="dark"] .permissions-row-hover:hover { background: rgba(255,255,255,.04); }

/* ==========================================================================
   MODE SOMBRE
   Activé via [data-theme="dark"] sur <html> (voir _Layout.cshtml + site.js).
   --cssa-primary et les couleurs de marque (rouge/vert/jaune) ne sont PAS
   redéfinies : la sidebar (déjà bleu marine) reste identique dans les deux
   thèmes, seuls le fond de page et les surfaces (cards, tables, formulaires)
   basculent.
   ========================================================================== */
[data-theme="dark"] {
    --cssa-bg:             #0f172a;
    --cssa-text:           #e2e8f0;
    --cssa-border:         #334155;
    --cssa-muted:          #94a3b8;
    --cssa-surface:        #1e293b;
    --cssa-text-secondary: #cbd5e1;
    --cssa-border-subtle:  #334155;
    /* Bootstrap 5 tokens */
    --bs-body-bg:        #0f172a;
    --bs-body-color:     #e2e8f0;
    --bs-border-color:   #334155;
    --bs-secondary-bg:   #1e293b;
    --bs-tertiary-bg:    #0f172a;
    --bs-emphasis-color: #f8fafc;
    color-scheme: dark;
}
[data-theme="dark"] body { background-color: var(--cssa-bg); color: var(--cssa-text); }

/* --cssa-primary sert de couleur de TEXTE sur le fond de page (page-title,
   outline button) — sur fond sombre il devient illisible, donc ces usages
   précis (et eux seuls) sont éclaircis. */
[data-theme="dark"] .page-title,
[data-theme="dark"] .text-cssa-primary { color: #93c5fd !important; }
[data-theme="dark"] .btn-cssa-outline { border-color: #3b82f6; color: #93c5fd; }
[data-theme="dark"] .btn-cssa-outline:hover { background-color: #1d4ed8; border-color: #1d4ed8; color: #fff; }
[data-theme="dark"] .btn-close { filter: invert(1); }

/* Cards & surfaces */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .content-card,
[data-theme="dark"] .content-card-header,
[data-theme="dark"] .kpi-strip,
[data-theme="dark"] .btn-icon-ghost,
[data-theme="dark"] .btn-danger-ghost { background: var(--cssa-surface); border-color: var(--cssa-border); }
[data-theme="dark"] .field-value { color: var(--cssa-text); }
[data-theme="dark"] .btn-icon-ghost { color: var(--cssa-text-secondary); }
[data-theme="dark"] .btn-icon-ghost:hover { background: var(--cssa-bg); color: var(--cssa-text); }
[data-theme="dark"] .btn-danger-ghost:hover { background: #3f1212; }
[data-theme="dark"] .btn-cssa-ghost-blue  { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .btn-cssa-ghost-blue:hover  { background: #234876; color: #bfdbfe; }
[data-theme="dark"] .btn-cssa-ghost-green { background: #052e16; color: #86efac; }
[data-theme="dark"] .btn-cssa-ghost-green:hover { background: #0a4020; color: #bbf7d0; }
[data-theme="dark"] .btn-cssa-ghost-amber { background: #422006; color: #fde68a; }
[data-theme="dark"] .btn-cssa-ghost-amber:hover { background: #593311; color: #fef08a; }
[data-theme="dark"] .btn-cssa-ghost-sky   { background: #073455; color: #7dd3fc; }
[data-theme="dark"] .btn-cssa-ghost-sky:hover   { background: #0c4a6e; color: #bae6fd; }

/* Dropdowns */
[data-theme="dark"] .dropdown-menu { background-color: var(--cssa-surface); border-color: var(--cssa-border); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
[data-theme="dark"] .dropdown-menu .dropdown-item { color: var(--cssa-text); }
[data-theme="dark"] .dropdown-menu .dropdown-item:hover,
[data-theme="dark"] .dropdown-menu .dropdown-item:focus { background: var(--cssa-bg); color: var(--cssa-text); }
[data-theme="dark"] .dropdown-menu .dropdown-item.text-danger:hover,
[data-theme="dark"] .dropdown-menu .dropdown-item.text-danger:focus { background: #3f1212; }
[data-theme="dark"] .dropdown-menu .dropdown-divider { border-color: var(--cssa-border); }

/* Tables */
[data-theme="dark"] .cssa-table th { background: var(--cssa-bg); color: var(--cssa-muted); border-color: var(--cssa-border); }
[data-theme="dark"] .cssa-table td { border-color: var(--cssa-border); }
[data-theme="dark"] .cssa-table tbody tr:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .table { color: var(--cssa-text); border-color: var(--cssa-border); }
[data-theme="dark"] .table > :not(caption) > * > * { background-color: transparent; }
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-striped-bg: rgba(255,255,255,.04); }
[data-theme="dark"] .table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(255,255,255,.08); }
[data-theme="dark"] .table thead th { border-color: var(--cssa-border); color: var(--cssa-muted); }

/* Formulaires */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background-color: var(--cssa-surface); border-color: var(--cssa-border); color: var(--cssa-text); }
[data-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { background-color: var(--cssa-surface); border-color: #3b82f6; color: var(--cssa-text); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
[data-theme="dark"] .form-label { color: #cbd5e1; }
[data-theme="dark"] .form-text  { color: var(--cssa-muted); }
[data-theme="dark"] select option { background: var(--cssa-surface); color: var(--cssa-text); }

/* Alertes */
[data-theme="dark"] .alert         { border-width: 0; }
[data-theme="dark"] .alert-success { background: #052e16; color: #bbf7d0; }
[data-theme="dark"] .alert-danger  { background: #3f1212; color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: #422006; color: #fde68a; }
[data-theme="dark"] .alert-info    { background: #073455; color: #bae6fd; }
[data-theme="dark"] .alert-light   { background: var(--cssa-surface); color: var(--cssa-text); border: 1px solid var(--cssa-border); }
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .badge.bg-white { background: var(--cssa-border) !important; color: var(--cssa-text) !important; }

/* Tableau Tâches (Kanban) — .kanban-column utilise déjà --cssa-bg/--cssa-border */
[data-theme="dark"] .kanban-column-count { background: var(--cssa-surface); border-color: var(--cssa-border); color: var(--cssa-muted); }
[data-theme="dark"] .kanban-column.drag-over { background: #1d3461; }
[data-theme="dark"] .kanban-card { background: var(--cssa-surface); border-color: var(--cssa-border); }
[data-theme="dark"] .kanban-card:hover { border-color: var(--cssa-blue-light); }
[data-theme="dark"] .kanban-card-title { color: var(--cssa-text); }

/* Modals & onglets */
[data-theme="dark"] .modal-content { background-color: var(--cssa-surface); color: var(--cssa-text); border-color: var(--cssa-border); }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer { border-color: var(--cssa-border); }
[data-theme="dark"] .nav-tabs { border-color: var(--cssa-border); }
[data-theme="dark"] .nav-tabs .nav-link { color: var(--cssa-muted); }
[data-theme="dark"] .nav-tabs .nav-link.active { background: var(--cssa-surface); border-color: var(--cssa-border) var(--cssa-border) var(--cssa-surface); color: var(--cssa-text); }

/* Bascule de thème (bouton topbar) */
.theme-toggle-btn .icon-sun  { display: none; }
.theme-toggle-btn .icon-moon { display: inline-flex; }
[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: inline-flex; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }

/* FullCalendar (Evenements/Calendrier) */
[data-theme="dark"] .fc {
    --fc-border-color: #334155;
    --fc-neutral-bg-color: #1e293b;
    --fc-list-event-hover-bg-color: #334155;
    --fc-button-text-color: #e2e8f0;
    --fc-button-bg-color: #334155;
    --fc-button-border-color: #334155;
    --fc-button-hover-bg-color: #3b4a5f;
    --fc-button-hover-border-color: #3b4a5f;
    --fc-button-active-bg-color: #1d4ed8;
    --fc-button-active-border-color: #1d4ed8;
}
[data-theme="dark"] .fc-col-header-cell,
[data-theme="dark"] .fc-daygrid-day-number,
[data-theme="dark"] .fc-toolbar-title,
[data-theme="dark"] .fc-list-day-text,
[data-theme="dark"] .fc-list-day-side-text { color: #e2e8f0; }
[data-theme="dark"] .fc-daygrid-day.fc-day-today,
[data-theme="dark"] .fc-timegrid-col.fc-day-today { background-color: rgba(59,130,246,.12) !important; }

/* ── Rattrapage des styles inline couleur/fond codés en dur dans les vues ──
   Les sélecteurs d'attribut ciblent des teintes précises et connues (voir
   audit des ~226 occurrences dans Views/) ; l'indicateur "i" les rend
   insensibles à la casse. Objectif : neutraliser les combinaisons pastel-sur-
   clair les plus fréquentes, pas une couverture exhaustive des cas rares. */
[data-theme="dark"] [style*="background:#fff" i],
[data-theme="dark"] [style*="background:white" i],
[data-theme="dark"] [style*="background:#f8fafc" i],
[data-theme="dark"] [style*="background:#f9fafb" i],
[data-theme="dark"] [style*="background:#fafafa" i],
[data-theme="dark"] [style*="background:#f1f5f9" i] { background-color: var(--cssa-surface) !important; }
[data-theme="dark"] [style*="background:#fef3c7" i],
[data-theme="dark"] [style*="background:#fffbeb" i],
[data-theme="dark"] [style*="background:#fef9c3" i] { background-color: #422006 !important; }
[data-theme="dark"] [style*="background:#fee2e2" i],
[data-theme="dark"] [style*="background:#fef2f2" i],
[data-theme="dark"] [style*="background:#fff1f2" i] { background-color: #3f1212 !important; }
[data-theme="dark"] [style*="background:#f0fdf4" i],
[data-theme="dark"] [style*="background:#dcfce7" i] { background-color: #052e16 !important; }
[data-theme="dark"] [style*="background:#eff6ff" i],
[data-theme="dark"] [style*="background:#eef2ff" i] { background-color: #1e3a5f !important; }
[data-theme="dark"] [style*="background:#ede9fe" i] { background-color: #2e1065 !important; }
[data-theme="dark"] [style*="background:#f3f4f6" i],
[data-theme="dark"] [style*="background:#e2e8f0" i] { background-color: #334155 !important; }
[data-theme="dark"] [style*="background:#fff7ed" i] { background-color: #431407 !important; }

[data-theme="dark"] [style*="color:#92400e" i],
[data-theme="dark"] [style*="color:#78350f" i] { color: #fde68a !important; }
[data-theme="dark"] [style*="color:#dc2626" i],
[data-theme="dark"] [style*="color:#b91c1c" i],
[data-theme="dark"] [style*="color:#991b1b" i] { color: #fca5a5 !important; }
[data-theme="dark"] [style*="color:#6b7280" i],
[data-theme="dark"] [style*="color:#9ca3af" i],
[data-theme="dark"] [style*="color:#64748b" i],
[data-theme="dark"] [style*="color:#374151" i] { color: #94a3b8 !important; }
[data-theme="dark"] [style*="color:#c2410c" i] { color: #fdba74 !important; }
[data-theme="dark"] [style*="color:#166534" i],
[data-theme="dark"] [style*="color:#15803d" i],
[data-theme="dark"] [style*="color:#16a34a" i] { color: #86efac !important; }
[data-theme="dark"] [style*="color:#5b21b6" i],
[data-theme="dark"] [style*="color:#7c3aed" i],
[data-theme="dark"] [style*="color:#3b0764" i] { color: #d8b4fe !important; }
[data-theme="dark"] [style*="color:#1d4ed8" i],
[data-theme="dark"] [style*="color:#4338ca" i] { color: #93c5fd !important; }
[data-theme="dark"] [style*="color:#d97706" i] { color: #fbbf24 !important; }

[data-theme="dark"] [style*="#fde68a" i] { border-color: #78350f !important; }
[data-theme="dark"] [style*="#fecaca" i] { border-color: #7f1d1d !important; }
[data-theme="dark"] [style*="#cbd5e1" i] { border-color: #334155 !important; }
[data-theme="dark"] [style*="#86efac" i] { border-color: #166534 !important; }
[data-theme="dark"] [style*="#a5b4fc" i] { border-color: #3730a3 !important; }
