/* ==========================================================================
   Dashboard v3 — palette sémantique + zones narratives
   Inspiration : Linear.app × Vercel × Bloomberg Terminal (data-density pro)
   ========================================================================== */

:root {
    /* Brand */
    --dashv3-brand: #5b3f9c;
    --dashv3-brand-soft: rgba(91, 63, 156, 0.08);
    --dashv3-brand-strong: #4a3380;

    /* Sémantique */
    --dashv3-success: #10b981;
    --dashv3-success-soft: rgba(16, 185, 129, 0.08);
    --dashv3-warning: #f59e0b;
    --dashv3-warning-soft: rgba(245, 158, 11, 0.08);
    --dashv3-danger: #ef4444;
    --dashv3-danger-soft: rgba(239, 68, 68, 0.08);

    /* Échelle neutre 9 niveaux (Linear-style) */
    --dashv3-n50:  #fafafa;
    --dashv3-n100: #f5f5f5;
    --dashv3-n200: #e5e5e5;
    --dashv3-n300: #d4d4d4;
    --dashv3-n400: #a3a3a3;
    --dashv3-n500: #737373;
    --dashv3-n600: #525252;
    --dashv3-n700: #404040;
    --dashv3-n800: #262626;
    --dashv3-n900: #171717;

    /* Couleurs par zone aligné palette PDF unique
       Z1 purple AGS, Z2 blue, Z3 cyan, Z4 emerald, Z5 amber */
    --dashv3-z1-accent: #5b3f9c;          /* Diagnostic — purple AGS */
    --dashv3-z1-bg: rgba(91, 63, 156, 0.03);
    --dashv3-z2-accent: #2563eb;          /* Présence — blue */
    --dashv3-z2-bg: rgba(37, 99, 235, 0.03);
    --dashv3-z3-accent: #0ea5e9;          /* Performance — cyan */
    --dashv3-z3-bg: rgba(14, 165, 233, 0.03);
    --dashv3-z4-accent: #10b981;          /* Tech — emerald */
    --dashv3-z4-bg: rgba(16, 185, 129, 0.03);
    --dashv3-z5-accent: #f59e0b;          /* Actions — amber */
    --dashv3-z5-bg: rgba(245, 158, 11, 0.03);

    /* Ombres */
    --dashv3-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --dashv3-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --dashv3-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);

    /* Typo (densité Inter, déjà loadée) */
    --dashv3-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --dashv3-fs-xs: 0.7rem;
    --dashv3-fs-sm: 0.82rem;
    --dashv3-fs-md: 0.92rem;
    --dashv3-fs-lg: 1.05rem;
    --dashv3-fs-xl: 1.5rem;

    /*echelle d'espacement (4 / 8 / 12 / 16 / 24 px)
       referencee par les media queries responsives. */
    --dashv3-space-1: 4px;
    --dashv3-space-2: 8px;
    --dashv3-space-3: 12px;
    --dashv3-space-4: 16px;
    --dashv3-space-5: 24px;

    /* Transitions */
    --dashv3-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode override (basé sur body.dark-mode pattern existant)inversion semantique de l'echelle neutre n50..n900
   pour que les regles n50 (card bg) et n900 (text) restent valides en
   dark sans changer les selecteurs. */
body.dark-mode {
    --dashv3-z1-bg: rgba(91, 63, 156, 0.10);
    --dashv3-z2-bg: rgba(37, 99, 235, 0.10);
    --dashv3-z3-bg: rgba(14, 165, 233, 0.10);
    --dashv3-z4-bg: rgba(16, 185, 129, 0.10);
    --dashv3-z5-bg: rgba(245, 158, 11, 0.10);
    --dashv3-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --dashv3-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --dashv3-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    /*palette neutre INVERSEE pour dark mode */
    --dashv3-n50:  #1a1a1a;       /* Fond carte (etait #fafafa light) */
    --dashv3-n100: #262626;       /* Fond legerement plus clair */
    --dashv3-n200: #2d2d2d;       /* Bordure subtile */
    --dashv3-n300: #404040;       /* Bordure normale */
    --dashv3-n400: #525252;       /* Text muted */
    --dashv3-n500: #737373;       /* Text secondaire (= light n500, OK contraste sur dark) */
    --dashv3-n600: #a3a3a3;       /* Text body */
    --dashv3-n700: #d4d4d4;       /* Text emphasized */
    --dashv3-n800: #e5e5e5;       /* Text strong */
    --dashv3-n900: #fafafa;       /* Titres / text principal (etait #171717 light) */
}

/* ==========================================================================
   TOC sticky horizontal (5 anchors zone-X)
   ========================================================================== */

.dashv3-toc {
    position: sticky;
    top: 60px;                              /* sous la navbar */
    z-index: 99;
    display: flex;
    flex-wrap: nowrap;                      /* garde le scroll horizontal */
    gap: 4px;
    padding: 8px 12px;
    margin: 0 -12px 18px;
    background: var(--bs-body-bg, #ffffff);
    border-bottom: 1px solid var(--dashv3-n200);
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;                        /* contraint au parent */
    scrollbar-width: thin;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body.dark-mode .dashv3-toc {
    background: rgba(23, 23, 23, 0.96);
    border-bottom-color: var(--dashv3-n800);
    backdrop-filter: blur(8px);
}

.dashv3-toc-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: var(--dashv3-fs-sm);
    font-weight: 500;
    color: var(--dashv3-n600);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;                         /* indispensable pour overflow-x */
    transition: background var(--dashv3-transition), color var(--dashv3-transition);
}

.dashv3-toc-item:hover {
    background: var(--dashv3-brand-soft);
    color: var(--dashv3-brand);
    text-decoration: none;
}

.dashv3-toc-item.is-active {
    background: var(--dashv3-brand-soft);
    color: var(--dashv3-brand);
    font-weight: 600;
}

body.dark-mode .dashv3-toc-item {
    color: var(--dashv3-n400);
}

body.dark-mode .dashv3-toc-item:hover,
body.dark-mode .dashv3-toc-item.is-active {
    color: #c7d2fe;
    background: rgba(139, 92, 246, 0.15);
}

/* ==========================================================================
   Wrappers de zones narratives
   ========================================================================== */

.dashv3-zone {
    scroll-margin-top: 110px;               /* compense TOC sticky pour anchor */
    margin-bottom: 24px;
    padding: 16px 0;
}

/* Zone header — titre PRINCIPAL pro (Linear x Vercel x Bloomberg).
   Plus gros, tight, eyebrow zone + accent line forte au-dessus pour creer
   une vraie hierarchie vs section-header sub-titres. */
.dashv3-zone-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 24px 0 18px;
    padding: 0 0 14px 0;
    border-bottom: 1px solid var(--dashv3-n200);
    position: relative;
}
.dashv3-zone-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;  /* heritera la couleur zone via les regles ci-dessous */
}

.dashv3-zone[data-zone="1"] .dashv3-zone-header { color: var(--dashv3-z1-accent); }
.dashv3-zone[data-zone="2"] .dashv3-zone-header { color: var(--dashv3-z2-accent); }
.dashv3-zone[data-zone="3"] .dashv3-zone-header { color: var(--dashv3-z3-accent); }
.dashv3-zone[data-zone="4"] .dashv3-zone-header { color: var(--dashv3-z4-accent); }
.dashv3-zone[data-zone="5"] .dashv3-zone-header { color: var(--dashv3-z5-accent); }

.dashv3-zone-title {
    margin: 8px 0 0 0;
    font-size: 1.5rem;          /* 24 px — vrai titre principal pro */
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--dashv3-n900);
    display: flex;
    align-items: center;
    gap: 10px;
    font-feature-settings: "tnum";
}

/* Eyebrow uppercase Z1/5 etc. — generee via ::before sur le span emoji */
.dashv3-zone[data-zone="1"] .dashv3-zone-header::after { content: 'Zone 1 / 5'; }
.dashv3-zone[data-zone="2"] .dashv3-zone-header::after { content: 'Zone 2 / 5'; }
.dashv3-zone[data-zone="3"] .dashv3-zone-header::after { content: 'Zone 3 / 5'; }
.dashv3-zone[data-zone="4"] .dashv3-zone-header::after { content: 'Zone 4 / 5'; }
.dashv3-zone[data-zone="5"] .dashv3-zone-header::after { content: 'Zone 5 / 5'; }

.dashv3-zone-header::after {
    order: -1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: currentColor;
    padding-top: 14px;
    margin-bottom: -2px;
}

body.dark-mode .dashv3-zone-title {
    color: var(--dashv3-n900);  /* en dark = #fafafa, fix lisibilite */
}

body.dark-mode .dashv3-zone-header {
    border-bottom-color: var(--dashv3-n300);
}

.dashv3-zone-intro {
    margin: 0;
    font-size: var(--dashv3-fs-md);
    color: var(--dashv3-n500);
    max-width: 720px;
    line-height: 1.5;
}

body.dark-mode .dashv3-zone-intro {
    color: var(--dashv3-n500);  /* en dark = #737373 = lisible */
}

/* Sub-titre de section (sous une zone) — secondaire clair Linear-style :
   accent-line vertical 3 px en couleur zone, weight 600, plus petit que zone-title.
   Ces regles surchargent le `.section-header` legacy de client-dashboard.css. */
.dashv3-zone .section-header {
    margin: 18px 0 12px 0;
    padding: 0 0 0 12px;
    border-left: 3px solid var(--dashv3-n300);
    border-radius: 0;
    background: transparent;
    min-height: 0;
}
.dashv3-zone[data-zone="1"] .section-header { border-left-color: var(--dashv3-z1-accent); }
.dashv3-zone[data-zone="2"] .section-header { border-left-color: var(--dashv3-z2-accent); }
.dashv3-zone[data-zone="3"] .section-header { border-left-color: var(--dashv3-z3-accent); }
.dashv3-zone[data-zone="4"] .section-header { border-left-color: var(--dashv3-z4-accent); }
.dashv3-zone[data-zone="5"] .section-header { border-left-color: var(--dashv3-z5-accent); }

.dashv3-zone .section-header .section-title {
    font-size: 1.05rem;          /* 17 px — clearly smaller than zone-title 24 px */
    font-weight: 600;
    color: var(--dashv3-n900);
    line-height: 1.4;
    letter-spacing: -0.005em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
body.dark-mode .dashv3-zone .section-header .section-title {
    color: var(--dashv3-n900);  /* en dark = clair */
}
.dashv3-zone .section-header .section-title i.bi {
    color: var(--dashv3-n500);
    font-size: 0.95em;
}

/* ==========================================================================
   Carte Top 3 actions (Zone 1)
   ========================================================================== */

.dashv3-top3 {
    /* flat bg blanc, plus de gradient pastel */
    background: white;
    border: 1px solid var(--dashv3-z5-accent);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

/*dark mode override : fond fonce + texte clair */
body.dark-mode .dashv3-top3 {
    background: var(--dashv3-n50);          /* #1a1a1a en dark */
    border-color: var(--dashv3-z5-accent);
}
body.dark-mode .dashv3-top3-item:hover {
    background: rgba(245, 158, 11, 0.10);
}
body.dark-mode .dashv3-top3-meta {
    color: var(--dashv3-n600);
}
body.dark-mode .dashv3-top3-effort {
    color: var(--dashv3-n600);
}

.dashv3-top3-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dashv3-top3-title {
    margin: 0;
    font-size: var(--dashv3-fs-md);
    font-weight: 700;
    color: var(--dashv3-z5-accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashv3-top3-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: top3-counter;
}

.dashv3-top3-item {
    counter-increment: top3-counter;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: var(--dashv3-fs-sm);
    transition: background var(--dashv3-transition);
}

.dashv3-top3-item:hover {
    background: rgba(139, 92, 246, 0.06);
}

.dashv3-top3-item::before {
    content: counter(top3-counter);
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--dashv3-z5-accent);
    color: white;
    font-weight: 700;
    font-size: var(--dashv3-fs-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashv3-top3-name {
    flex: 1 1 auto;
    font-weight: 500;
    color: var(--dashv3-n900);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .dashv3-top3-name {
    /*n100 etait #262626 en dark = noir illisible.
       n900 en dark = #fafafa = clair, contraste WCAG AA. */
    color: var(--dashv3-n900);
}

.dashv3-top3-meta {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    font-size: var(--dashv3-fs-xs);
    color: var(--dashv3-n500);
}

.dashv3-top3-impact {
    color: var(--dashv3-success);
    font-weight: 600;
}

.dashv3-top3-effort {
    color: var(--dashv3-n400);
}

.dashv3-top3-sticky-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--dashv3-z5-accent);
    font-size: 0.6rem;
    font-weight: 600;
    margin-left: 4px;
}

.dashv3-top3-footer {
    margin-top: 12px;
    text-align: right;
    font-size: var(--dashv3-fs-xs);
}

.dashv3-top3-footer a {
    color: var(--dashv3-z5-accent);
    text-decoration: none;
    font-weight: 500;
}

.dashv3-top3-footer a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Bouton "Revenir à l'ancien dashboard" ========================================================================== */

.dashv3-revert-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--dashv3-n700);
    color: white;
    font-size: var(--dashv3-fs-xs);
    font-weight: 500;
    cursor: pointer;
    border: none;
    box-shadow: var(--dashv3-shadow-md);
    opacity: 0.8;
    transition: opacity var(--dashv3-transition);
}

.dashv3-revert-btn:hover {
    opacity: 1;
}

/* ==========================================================================
   Skeleton loaders
   ========================================================================== */

.dashv3-skeleton {
    background: linear-gradient(90deg, var(--dashv3-n200) 0%, var(--dashv3-n100) 50%, var(--dashv3-n200) 100%);
    background-size: 200% 100%;
    animation: dashv3-skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes dashv3-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .dashv3-skeleton { animation: none; }
}

/* ==========================================================================
   Responsive (3 breakpoints : 375 / 768 / 1024)
   Mood board pro Linear/Vercel/Bloomberg : densite calibree par viewport.
   ========================================================================== */

/* Tablette portrait & desktop reduit (1024px et moins) */
@media (max-width: 1024px) {
    .dashv3-zone-header {
        padding: 14px 16px;
    }
    .dashv3-toc {
        overflow-x: auto;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    .dashv3-zone {
        margin-bottom: var(--dashv3-space-3);
    }
}

/* Mobile portrait & tablette (768px et moins) */
@media (max-width: 768px) {
    .dashv3-zone-header {
        padding: 12px 14px;
    }
    .dashv3-zone-title {
        font-size: var(--dashv3-fs-md);
    }
    .dashv3-toc {
        gap: 2px;
        padding: 6px 8px;
        position: sticky;
        top: 0;
        z-index: 50;
        /*annule la marge negative -12px qui faisait
           deborder le TOC hors de son container parent .container, causant
           un scrollWidth body > viewport (+74px observe par Playwright).
           Sur mobile on garde le scroll-x interne au TOC mais sans deborder. */
        margin-left: 0;
        margin-right: 0;
    }
    .dashv3-toc-item {
        padding: 4px 10px;
        font-size: var(--dashv3-fs-xs);
    }
    .dashv3-top3-meta {
        flex-direction: column;
        gap: 2px;
        text-align: right;
    }
    .dashv3-top3 {
        padding: var(--dashv3-space-3);
    }
    .dashv3-top3-card {
        padding: var(--dashv3-space-2) var(--dashv3-space-3);
    }
}

/* Mobile petit (375px et moins, iPhone SE) */
@media (max-width: 375px) {
    .dashv3-zone {
        border-left-width: 3px;
    }
    .dashv3-zone-header {
        padding: 10px 12px;
        gap: 6px;
    }
    .dashv3-zone-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
    .dashv3-zone-title {
        font-size: var(--dashv3-fs-sm);
        line-height: 1.25;
    }
    .dashv3-toc {
        gap: 2px;
        padding: 4px 6px;
    }
    .dashv3-toc-item {
        padding: 3px 8px;
        font-size: 10px;
    }
    .dashv3-top3-card {
        flex-direction: column;
        align-items: stretch;
    }
    .dashv3-top3-action {
        font-size: var(--dashv3-fs-sm);
    }
}

/* ==========================================================================
   Accessibilite WCAG 2.1 AA — focus visible et contrast minimum
   ========================================================================== */

.dashv3-toc-item:focus-visible,
.dashv3-top3-card:focus-visible,
.dashv3-zone:focus-visible {
    outline: 3px solid var(--dashv3-brand);
    outline-offset: 3px;
    border-radius: 4px;
}

/* TOC active state — synchronise via IntersectionObserver (a11y) */
.dashv3-toc-item[aria-current="true"] {
    background: var(--dashv3-brand);
    color: white;
    font-weight: 700;
}
.dashv3-toc-item[aria-current="true"]:hover {
    background: var(--dashv3-brand);
    opacity: 0.92;
}

/* Iter 7 — WCAG 2.1 AA target-size : touch targets minimum 24x24 px (level AA)scoppees sous .dashv3-zone pour eviter fuite vers les autres
   pages (login, audits, admin) qui ont leurs propres boutons compacts intentionnels. */
.dashv3-zone .btn.btn-sm,
.dashv3-zone button.btn-sm,
.dashv3-zone .metric-help,
.dashv3-zone .btn-add-discovered,
.dashv3-zone .action-status-select,
.dashv3-zone .btn-link.p-0 {
    min-height: 24px;
    min-width: 24px;
}
/* Iter 7 — collapse toggles AEO (chevrons p-0) : zone tactile etendue */
.dashv3-zone button.btn-sm.btn-link.p-0,
.dashv3-zone button.btn.btn-sm.btn-link.p-0 {
    min-height: 24px !important;
    min-width: 24px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Iter 7 — color-contrast : overrides Bootstrap pour atteindre 4.5:1 sur fond blanc.
   Couleurs Bootstrap default echouent toutes (text-muted #6c757d = 4.0:1). */
/*overrides Bootstrap text-* avec variantes dark mode */
body .text-muted { color: #4b5563 !important; }
body.dark-mode .text-muted { color: #a3a3a3 !important; }
body .text-secondary { color: #475569 !important; }
body.dark-mode .text-secondary { color: #d4d4d4 !important; }
body .text-success { color: #15803d !important; }
body.dark-mode .text-success { color: #4ade80 !important; }
body .text-info { color: #0369a1 !important; }
body.dark-mode .text-info { color: #38bdf8 !important; }
body .text-warning { color: #92400e !important; }
body.dark-mode .text-warning { color: #fbbf24 !important; }

/* ==========================================================================Visual transformation (Linear × Vercel × Bloomberg mood board)
   3 passes ULTRATHINK :
     P1 audit  : 40x .dash-card / 33x .shadow-sm dans dashboard ; .dash-card
                 utilisee aussi dans 10+ autres templates.
     P2 scope  : tous les overrides scoppes sous .dashv3-zone (specificite
                 0,2,0 > .dash-card 0,1,0). !important reserve aux utility
                 Bootstrap (.shadow-sm, .h-100) qui peuvent charger apres.
     P3 escape : classe .dashv3-keep-shadow pour cards qui doivent garder
                 leur visuel "alerte" (rouge fonde, etc).
   ========================================================================== */

/* Cards : flat Linear style (border 1px, no shadow lourd, square-ish radius) */
.dashv3-zone .dash-card,
.dashv3-zone .chart-card,
.dashv3-zone .metric-card {
    border: 1px solid var(--dashv3-n200);
    border-radius: 8px;
    background: white;
    box-shadow: none !important;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover : subtle border highlight + tres legere shadow (Vercel style) */
.dashv3-zone .dash-card:hover,
.dashv3-zone .chart-card:hover {
    border-color: var(--dashv3-brand);
    box-shadow: var(--dashv3-shadow-sm) !important;
}

/* Card body padding coherent avec l'echelle d'espacement */
.dashv3-zone .dash-card .card-body,
.dashv3-zone .chart-card {
    padding: var(--dashv3-space-4);
    background: white;
    background-image: none;
}

/* Tabular numbers (Bloomberg-style data-density) sur tous les chiffres */
.dashv3-zone .metric-value,
.dashv3-zone .value,
.dashv3-zone [data-countup],
.dashv3-zone .badge,
.dashv3-zone .hero-grade-score,
.dashv3-zone .dashv3-top3-meta strong,
.dashv3-zone td,
.dashv3-zone th {
    font-feature-settings: "tnum" 1, "ss01" 1;
    font-variant-numeric: tabular-nums;
}

/* Typographie : titres tight, color coherent, no italic decoratifselecteur .dashv3-zone-title scoppe sous .dashv3-zone
   pour eviter fuite vers d'autres pages utilisant la meme classe */
.dashv3-zone h2,
.dashv3-zone h3,
.dashv3-zone h4,
.dashv3-zone h5,
.dashv3-zone h6,
.dashv3-zone .dashv3-zone-title {
    font-weight: 600;
    color: var(--dashv3-n900);
    letter-spacing: -0.01em;
    font-style: normal;
    font-family: var(--dashv3-font);
}

/* Boutons : square-ish radius (Linear/Vercel) au lieu de pill 50px */
.dashv3-zone .btn {
    border-radius: 6px;
    font-weight: 500;
}
.dashv3-zone .btn.btn-sm {
    border-radius: 4px;
}

/* Empty / no-data states : minimal Linear-style */
.dashv3-zone .empty-state,
.dashv3-zone .text-muted.text-center {
    color: var(--dashv3-n500);
}

/* Echappement explicite pour les cards qui doivent garder un visuel fort
   (alerte critique, hallucination, brand safety rouge etc.) */
.dashv3-zone .dash-card.dashv3-keep-shadow,
.dashv3-zone .dash-card.dashv3-alert {
    box-shadow: var(--dashv3-shadow-md) !important;
}

/* Section headers : harmonisation des h6 "section-header" inline */
.dashv3-zone .section-header h6,
.dashv3-zone .section-header {
    font-weight: 600;
    color: var(--dashv3-n900);
    margin-bottom: var(--dashv3-space-3);
}

/* Dark mode overridepalette inverse pour les cards plates */
body.dark-mode .dashv3-zone .dash-card,
body.dark-mode .dashv3-zone .chart-card,
body.dark-mode .dashv3-zone .metric-card {
    background: var(--dashv3-n50);
    border-color: var(--dashv3-n300);
}
body.dark-mode .dashv3-zone .dash-card:hover,
body.dark-mode .dashv3-zone .chart-card:hover {
    border-color: var(--dashv3-brand);
}
body.dark-mode .dashv3-zone .dash-card .card-body {
    background: var(--dashv3-n50);
}
body.dark-mode .dashv3-zone h2,
body.dark-mode .dashv3-zone h3,
body.dark-mode .dashv3-zone h4,
body.dark-mode .dashv3-zone h5,
body.dark-mode .dashv3-zone h6 {
    color: var(--dashv3-n900);
}

/* ==========================================================================Wrappers <details> repliable avec etat localStorage
   ========================================================================== */

details.dashv3-collapsible {
    transition: opacity 200ms ease;
}

details.dashv3-collapsible > summary {
    list-style: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /*touch target WCAG 2.5.5 minimum 44 px sur mobile */
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
    align-items: center;
}

details.dashv3-collapsible > summary::-webkit-details-marker {
    display: none;
}

details.dashv3-collapsible > summary::marker {
    display: none;
}

details.dashv3-collapsible > summary:hover .dashv3-collapsible-chevron {
    color: var(--dashv3-brand);
}

details.dashv3-collapsible > summary:focus-visible {
    outline: 2px solid var(--dashv3-brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Print : forcer details ouverts pour PDF */
@media print {
    details.dashv3-collapsible {
        display: block;
    }
    details.dashv3-collapsible > summary {
        display: block;
    }
    details.dashv3-collapsible[open] > * { display: block !important; }
    details.dashv3-collapsible:not([open]) > *:not(summary) { display: block !important; }
}

/* Microinteractions : ripple subtle sur boutons primary inside .dashv3-zone */
.dashv3-zone .btn-primary,
.dashv3-zone .btn-success {
    position: relative;
    overflow: hidden;
}
.dashv3-zone .btn-primary::after,
.dashv3-zone .btn-success::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 400ms ease, height 400ms ease;
    pointer-events: none;
}
.dashv3-zone .btn-primary:active::after,
.dashv3-zone .btn-success:active::after {
    width: 200%; height: 200%;
    transition: 0s;
}

/* Forced colors mode (Windows High Contrast) */
@media (forced-colors: active) {
    .dashv3-zone {
        border: 1px solid CanvasText;
    }
    .dashv3-toc-item[aria-current="true"] {
        outline: 2px solid Highlight;
    }
}
