/* =============================================================================
 * admin-metallic-dark.css — Phase A — Thème signature dark metallic
 *
 * Palette : graphite/titanium (surfaces) + chrome (accents) + copper rose (CTA)
 *
 * Approche :
 *   - Appliqué SYSTÉMATIQUEMENT sur data-theme="dark" (défault admin)
 *   - Coexiste avec le light mode existant (on n'écrase pas si data-theme="light")
 *   - Metallic = gradients linéaires verticaux 2-stop + highlight 1px top + shadow deep
 *   - Tous les tokens en CSS vars pour tweaks futurs
 *   - Respecte prefers-reduced-motion + focus-visible WCAG
 * ============================================================================= */

:root[data-theme="dark"] {
    /* ================= Palette ================= */
    /* Surfaces : dégradés graphite/titanium brushed */
    --mt-bg-0: #05080d;            /* fond page (presque noir bleuté) */
    --mt-bg-1: #0a0f18;            /* fond niveau 1 (panels) */
    --mt-bg-2: #111827;            /* fond niveau 2 (cards) */
    --mt-bg-3: #1a2130;            /* fond niveau 3 (inputs, hover) */
    --mt-bg-4: #242c3c;            /* fond niveau 4 (actifs) */

    /* Gradients métalliques (brushed titanium feel) */
    --mt-surf-card: linear-gradient(180deg, #1b2230 0%, #10151f 100%);
    --mt-surf-panel: linear-gradient(180deg, #151c28 0%, #0a101a 100%);
    --mt-surf-inset: linear-gradient(180deg, #0e141e 0%, #151d2a 100%);
    --mt-surf-btn: linear-gradient(180deg, #2b3647 0%, #1a222f 100%);
    --mt-surf-btn-hover: linear-gradient(180deg, #384456 0%, #232c3c 100%);

    /* Accent chrome (primary) — argent poli */
    --mt-chrome-100: #e8ecf1;
    --mt-chrome-200: #cdd4dd;
    --mt-chrome-300: #a8b1bd;
    --mt-chrome-400: #7b8594;
    --mt-chrome-500: #5a6474;
    --mt-surf-chrome: linear-gradient(180deg, #dde3eb 0%, #9ba5b3 50%, #6b7480 100%);
    --mt-surf-chrome-hover: linear-gradient(180deg, #f0f4f9 0%, #b0bac8 50%, #7d8694 100%);

    /* Accent copper rose (CTA chaud) */
    --mt-copper-100: #f5d5b8;
    --mt-copper-300: #d9966b;
    --mt-copper-500: #b8733a;
    --mt-copper-700: #8a5426;
    --mt-surf-copper: linear-gradient(180deg, #d9966b 0%, #b8733a 55%, #8a5426 100%);
    --mt-surf-copper-hover: linear-gradient(180deg, #e8a879 0%, #c78345 55%, #9a6230 100%);

    /* Accent électrique (liens, focus) */
    --mt-electric: #7dd3fc;
    --mt-electric-glow: rgba(125, 211, 252, 0.35);

    /* Text */
    --mt-text-0: #f1f5f9;           /* primary */
    --mt-text-1: #cbd5e1;           /* secondary */
    --mt-text-2: #94a3b8;           /* tertiary */
    --mt-text-3: #64748b;           /* muted */

    /* Lines & highlights */
    --mt-line: rgba(255, 255, 255, 0.06);
    --mt-line-strong: rgba(255, 255, 255, 0.12);
    --mt-highlight-top: rgba(255, 255, 255, 0.08); /* 1px highlight haut des surfaces métalliques */
    --mt-highlight-inner: rgba(255, 255, 255, 0.03);

    /* Shadows profondes */
    --mt-sh-xs: 0 1px 2px rgba(0,0,0,0.5);
    --mt-sh-sm: 0 2px 6px rgba(0,0,0,0.55), inset 0 1px 0 var(--mt-highlight-top);
    --mt-sh-md: 0 6px 16px rgba(0,0,0,0.6), inset 0 1px 0 var(--mt-highlight-top);
    --mt-sh-lg: 0 15px 35px rgba(0,0,0,0.7), inset 0 1px 0 var(--mt-highlight-top);
    --mt-sh-xl: 0 25px 50px rgba(0,0,0,0.8), inset 0 1px 0 var(--mt-highlight-top);
    --mt-sh-glow-copper: 0 0 0 1px rgba(184,115,58,0.35), 0 6px 20px rgba(184,115,58,0.3);
    --mt-sh-glow-chrome: 0 0 0 1px rgba(205,212,221,0.35), 0 6px 20px rgba(205,212,221,0.18);
}

/* ============= Page-level dark ============= */
:root[data-theme="dark"] body {
    background: var(--mt-bg-0);
    color: var(--mt-text-0);
    background-image:
        radial-gradient(1200px 600px at 10% -10%, rgba(184,115,58,0.05) 0%, transparent 55%),
        radial-gradient(1000px 500px at 90% 110%, rgba(125,211,252,0.04) 0%, transparent 55%),
        linear-gradient(180deg, #06090f 0%, var(--mt-bg-0) 60%);
    background-attachment: fixed;
}

/* Empêche le flash blanc au premier paint */
html[data-theme="dark"] { background-color: var(--mt-bg-0, #05080d); }

/* ============= Typography crispée sur dark ============= */
:root[data-theme="dark"] body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3 {
    color: var(--mt-text-0);
    letter-spacing: -0.015em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
:root[data-theme="dark"] p,
:root[data-theme="dark"] span,
:root[data-theme="dark"] div,
:root[data-theme="dark"] li {
    color: inherit;
}
:root[data-theme="dark"] a { color: var(--mt-electric); transition: color 120ms; }
:root[data-theme="dark"] a:hover { color: var(--mt-copper-100); }
:root[data-theme="dark"] .text-muted,
:root[data-theme="dark"] .text-secondary { color: var(--mt-text-2) !important; }
:root[data-theme="dark"] .text-dark,
:root[data-theme="dark"] .text-black { color: var(--mt-text-0) !important; }

/* ============= Main shell / sidebar ============= */
:root[data-theme="dark"] .main-wrap,
:root[data-theme="dark"] .main-content,
:root[data-theme="dark"] .main-content-wrap,
:root[data-theme="dark"] .content-wrap {
    background: transparent;
}
:root[data-theme="dark"] .main-header,
:root[data-theme="dark"] .header-for-top,
:root[data-theme="dark"] .main-header-for-top {
    background: var(--mt-surf-panel) !important;
    border-bottom: 1px solid var(--mt-line-strong);
    box-shadow: var(--mt-sh-sm);
    backdrop-filter: blur(10px);
}
:root[data-theme="dark"] .sidebar-left,
:root[data-theme="dark"] .sidebar-left-secondary {
    background: var(--mt-surf-panel) !important;
    border-right: 1px solid var(--mt-line-strong);
}
:root[data-theme="dark"] .sidebar-left .nav-item a,
:root[data-theme="dark"] .sidebar-left .nav-item > a,
:root[data-theme="dark"] .sidebar-left-secondary .sub-menu a {
    color: var(--mt-text-1);
    border-radius: 10px;
    margin: 2px 8px;
    padding: 0.55rem 0.85rem;
    transition: background 120ms, color 120ms, transform 120ms;
}
:root[data-theme="dark"] .sidebar-left .nav-item a:hover {
    background: var(--mt-bg-3);
    color: var(--mt-chrome-100);
    transform: translateX(2px);
}
:root[data-theme="dark"] .sidebar-left .nav-item.active > a,
:root[data-theme="dark"] .sidebar-left .nav-item a.active {
    background: linear-gradient(90deg, rgba(184,115,58,0.22) 0%, rgba(184,115,58,0.08) 100%);
    color: var(--mt-copper-100);
    border-left: 3px solid var(--mt-copper-300);
}
:root[data-theme="dark"] .sidebar-left .nav-item i,
:root[data-theme="dark"] .sidebar-left-secondary .sub-menu i {
    color: var(--mt-chrome-300);
}

/* Logo header contrast sur dark */
:root[data-theme="dark"] .logo-header img,
:root[data-theme="dark"] .main-header .logo img {
    filter: brightness(1.1);
}

/* ============= Cards metallic ============= */
:root[data-theme="dark"] .card {
    background: var(--mt-surf-card) !important;
    border: 1px solid var(--mt-line-strong) !important;
    border-radius: 14px;
    box-shadow: var(--mt-sh-md);
    color: var(--mt-text-0);
    /* Note: pas de overflow: hidden pour laisser les dropdowns sortir.
       Pas de ::before highlight 1px : conflit potentiel avec enfants position:absolute. */
}
:root[data-theme="dark"] .card:hover {
    box-shadow: var(--mt-sh-lg);
    transform: translateY(-2px);
}
:root[data-theme="dark"] .card-header {
    background: var(--mt-surf-inset) !important;
    border-bottom: 1px solid var(--mt-line-strong);
    color: var(--mt-text-0);
    font-weight: 600;
    letter-spacing: -0.01em;
}
:root[data-theme="dark"] .card-body,
:root[data-theme="dark"] .card-footer {
    background: transparent !important;
}
:root[data-theme="dark"] .card-footer {
    border-top: 1px solid var(--mt-line);
}

/* ============= Buttons metallic ============= */
:root[data-theme="dark"] .btn {
    border-radius: 10px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: transform 120ms, box-shadow 120ms, filter 120ms;
    position: relative;
    border: 1px solid var(--mt-line-strong);
    color: var(--mt-text-0);
    background: var(--mt-surf-btn);
    box-shadow: var(--mt-sh-sm);
}
:root[data-theme="dark"] .btn:hover {
    background: var(--mt-surf-btn-hover);
    transform: translateY(-1px);
    box-shadow: var(--mt-sh-md);
}
:root[data-theme="dark"] .btn:active {
    transform: translateY(0);
    filter: brightness(0.92);
}
:root[data-theme="dark"] .btn:focus-visible {
    outline: 2px solid var(--mt-electric);
    outline-offset: 2px;
}
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .bouton-se-connecter {
    background: var(--mt-surf-copper) !important;
    border: 1px solid var(--mt-copper-700) !important;
    color: #fff !important;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
    box-shadow: var(--mt-sh-sm), inset 0 1px 0 rgba(255,255,255,0.25);
}
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .bouton-se-connecter:hover {
    background: var(--mt-surf-copper-hover) !important;
    box-shadow: var(--mt-sh-md), var(--mt-sh-glow-copper), inset 0 1px 0 rgba(255,255,255,0.25);
}
:root[data-theme="dark"] .btn-secondary {
    background: var(--mt-surf-chrome) !important;
    color: #1a2130 !important;
    border: 1px solid var(--mt-chrome-500) !important;
    font-weight: 600;
}
:root[data-theme="dark"] .btn-secondary:hover {
    background: var(--mt-surf-chrome-hover) !important;
    box-shadow: var(--mt-sh-md), var(--mt-sh-glow-chrome);
}
:root[data-theme="dark"] .btn-success { background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important; border-color: #065f46 !important; color: #fff !important; }
:root[data-theme="dark"] .btn-danger  { background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%) !important; border-color: #991b1b !important; color: #fff !important; }
:root[data-theme="dark"] .btn-warning { background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%) !important; border-color: #92400e !important; color: #fff !important; }
:root[data-theme="dark"] .btn-info    { background: linear-gradient(180deg, #0ea5e9 0%, #0369a1 100%) !important; border-color: #075985 !important; color: #fff !important; }
:root[data-theme="dark"] .btn-outline-primary,
:root[data-theme="dark"] .btn-outline-secondary {
    background: transparent !important;
    border-color: var(--mt-line-strong) !important;
    color: var(--mt-text-0) !important;
}

/* ============= Forms metallic ============= */
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="tel"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
    background: var(--mt-surf-inset) !important;
    border: 1px solid var(--mt-line-strong) !important;
    color: var(--mt-text-0) !important;
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
    transition: border-color 120ms, box-shadow 120ms;
}
:root[data-theme="dark"] .form-control::placeholder,
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
    color: var(--mt-text-3);
}
:root[data-theme="dark"] .form-control:focus,
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] textarea:focus,
:root[data-theme="dark"] select:focus {
    border-color: var(--mt-copper-300) !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4), 0 0 0 3px rgba(184,115,58,0.25) !important;
    outline: none;
}
:root[data-theme="dark"] label,
:root[data-theme="dark"] .form-label {
    color: var(--mt-text-1);
    font-weight: 500;
    font-size: 0.875rem;
}
:root[data-theme="dark"] .form-check-input {
    background-color: var(--mt-bg-3);
    border-color: var(--mt-line-strong);
}
:root[data-theme="dark"] .form-check-input:checked {
    background: var(--mt-surf-copper);
    border-color: var(--mt-copper-500);
}

/* ============= Tables metallic ============= */
:root[data-theme="dark"] .table {
    color: var(--mt-text-0);
    background: transparent;
    border-collapse: separate;
    border-spacing: 0;
}
:root[data-theme="dark"] .table thead th {
    background: var(--mt-surf-panel) !important;
    color: var(--mt-chrome-200) !important;
    border-bottom: 1px solid var(--mt-line-strong);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 1rem;
}
:root[data-theme="dark"] .table tbody td {
    border-bottom: 1px solid var(--mt-line) !important;
    color: var(--mt-text-1);
    padding: 0.75rem 1rem;
    background: transparent !important;
}
:root[data-theme="dark"] .table tbody tr {
    transition: background 100ms;
}
:root[data-theme="dark"] .table tbody tr:hover {
    background: var(--mt-bg-2) !important;
}
:root[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.015) !important;
}
:root[data-theme="dark"] .table-bordered,
:root[data-theme="dark"] .table-bordered td,
:root[data-theme="dark"] .table-bordered th {
    border-color: var(--mt-line-strong) !important;
}

/* ============= Badges & chips ============= */
:root[data-theme="dark"] .badge {
    font-weight: 500;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
:root[data-theme="dark"] .badge-primary   { background: var(--mt-surf-copper) !important; color: #fff !important; }
:root[data-theme="dark"] .badge-secondary { background: var(--mt-surf-chrome) !important; color: #0a0f18 !important; }
:root[data-theme="dark"] .badge-success   { background: linear-gradient(180deg, #10b981, #047857) !important; color: #fff !important; }
:root[data-theme="dark"] .badge-danger    { background: linear-gradient(180deg, #ef4444, #b91c1c) !important; color: #fff !important; }
:root[data-theme="dark"] .badge-warning   { background: linear-gradient(180deg, #f59e0b, #b45309) !important; color: #fff !important; }
:root[data-theme="dark"] .badge-info      { background: linear-gradient(180deg, #0ea5e9, #0369a1) !important; color: #fff !important; }

/* ============= Alerts ============= */
:root[data-theme="dark"] .alert {
    background: var(--mt-surf-inset) !important;
    border-radius: 10px;
    border: 1px solid var(--mt-line-strong);
    border-left-width: 4px;
    color: var(--mt-text-0);
    box-shadow: var(--mt-sh-xs);
}
:root[data-theme="dark"] .alert-success { border-left-color: #10b981; }
:root[data-theme="dark"] .alert-danger  { border-left-color: #ef4444; }
:root[data-theme="dark"] .alert-warning { border-left-color: #f59e0b; }
:root[data-theme="dark"] .alert-info    { border-left-color: #0ea5e9; }

/* ============= Modals ============= */
:root[data-theme="dark"] .modal-content {
    background: var(--mt-surf-card) !important;
    border: 1px solid var(--mt-line-strong);
    border-radius: 16px;
    box-shadow: var(--mt-sh-xl);
    color: var(--mt-text-0);
    overflow: hidden;
}
:root[data-theme="dark"] .modal-content::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    pointer-events: none;
}
:root[data-theme="dark"] .modal-header {
    background: var(--mt-surf-inset) !important;
    border-bottom: 1px solid var(--mt-line-strong) !important;
}
:root[data-theme="dark"] .modal-footer {
    background: rgba(0,0,0,0.2) !important;
    border-top: 1px solid var(--mt-line) !important;
}
:root[data-theme="dark"] .modal-backdrop { background: #000; }
:root[data-theme="dark"] .modal-backdrop.show { opacity: 0.75; }

/* ============= Dropdowns ============= */
:root[data-theme="dark"] .dropdown-menu {
    background: var(--mt-surf-card) !important;
    border: 1px solid var(--mt-line-strong) !important;
    border-radius: 10px;
    box-shadow: var(--mt-sh-lg);
    padding: 0.35rem;
    color: var(--mt-text-0);
}
:root[data-theme="dark"] .dropdown-item {
    color: var(--mt-text-1) !important;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: background 100ms, color 100ms;
}
:root[data-theme="dark"] .dropdown-item:hover,
:root[data-theme="dark"] .dropdown-item:focus {
    background: var(--mt-bg-3) !important;
    color: var(--mt-chrome-100) !important;
}
:root[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--mt-line-strong);
}

/* ============= Nav tabs / pills ============= */
:root[data-theme="dark"] .nav-tabs {
    border-bottom: 1px solid var(--mt-line-strong);
}
:root[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--mt-text-1);
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 0.5rem 1rem;
}
:root[data-theme="dark"] .nav-tabs .nav-link.active,
:root[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--mt-copper-100);
    background: var(--mt-bg-2);
    border-bottom: 2px solid var(--mt-copper-300);
}
:root[data-theme="dark"] .nav-pills .nav-link.active {
    background: var(--mt-surf-copper) !important;
    color: #fff !important;
}

/* ============= Pagination ============= */
:root[data-theme="dark"] .page-link {
    background: var(--mt-surf-btn) !important;
    border: 1px solid var(--mt-line-strong) !important;
    color: var(--mt-text-1) !important;
    border-radius: 8px;
    margin: 0 2px;
}
:root[data-theme="dark"] .page-link:hover {
    background: var(--mt-bg-3) !important;
    color: var(--mt-chrome-100) !important;
}
:root[data-theme="dark"] .page-item.active .page-link {
    background: var(--mt-surf-copper) !important;
    border-color: var(--mt-copper-500) !important;
    color: #fff !important;
}

/* ============= Toasts ============= */
:root[data-theme="dark"] .toast,
:root[data-theme="dark"] #liveToast,
:root[data-theme="dark"] .adm-toast {
    background: var(--mt-surf-card) !important;
    border: 1px solid var(--mt-line-strong);
    color: var(--mt-text-0);
    box-shadow: var(--mt-sh-lg);
}

/* ============= Scrollbar dark metallic ============= */
:root[data-theme="dark"] *::-webkit-scrollbar { width: 12px; height: 12px; }
:root[data-theme="dark"] *::-webkit-scrollbar-track { background: var(--mt-bg-1); }
:root[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3a4458, #1f2837);
    border-radius: 10px;
    border: 2px solid var(--mt-bg-1);
    background-clip: padding-box;
}
:root[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #52617a, #2a3648);
    background-clip: padding-box;
}

/* ============= Focus accessibility ============= */
:root[data-theme="dark"] :focus-visible {
    outline: 2px solid var(--mt-copper-300);
    outline-offset: 2px;
}

/* ============= Skeleton loading avec shimmer metallic ============= */
:root[data-theme="dark"] .adm-skeleton,
:root[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, var(--mt-bg-2) 0%, var(--mt-bg-3) 50%, var(--mt-bg-2) 100%);
    background-size: 200% 100%;
    animation: mtShimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes mtShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============= Login page specifics ============= */
:root[data-theme="dark"] .gradient-form,
:root[data-theme="dark"] section.gradient-form {
    background: radial-gradient(1000px 600px at 50% 50%, rgba(184,115,58,0.08), transparent 60%), var(--mt-bg-0) !important;
    min-height: 100vh;
}
:root[data-theme="dark"] .gradient-custom-2,
:root[data-theme="dark"] .img-gauche {
    background: linear-gradient(135deg, #1a2130 0%, #0a0f18 100%) !important;
    position: relative;
}
:root[data-theme="dark"] .img-gauche::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(184,115,58,0.15), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(125,211,252,0.08), transparent 50%);
    pointer-events: none;
}
:root[data-theme="dark"] .card.rounded-3.text-black {
    background: var(--mt-surf-card) !important;
    color: var(--mt-text-0) !important;
    border: 1px solid var(--mt-line-strong);
    box-shadow: var(--mt-sh-xl);
}
:root[data-theme="dark"] .message-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    color: #fca5a5;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* ============= Text utility overrides ============= */
:root[data-theme="dark"] .text-primary { color: var(--mt-copper-100) !important; }
:root[data-theme="dark"] .text-info    { color: var(--mt-electric) !important; }
:root[data-theme="dark"] .text-success { color: #6ee7b7 !important; }
:root[data-theme="dark"] .text-danger  { color: #fca5a5 !important; }
:root[data-theme="dark"] .text-warning { color: #fcd34d !important; }
:root[data-theme="dark"] .bg-light,
:root[data-theme="dark"] .bg-white     { background: var(--mt-surf-panel) !important; color: var(--mt-text-0) !important; }
:root[data-theme="dark"] .bg-dark      { background: var(--mt-bg-0) !important; }

/* Note : pas de filter sur <canvas>. Chart.js/ApexCharts doivent être
   configurés avec options dark via leur API (chart.options.theme = 'dark'). */

/* ============= Breadcrumb ============= */
:root[data-theme="dark"] .breadcrumb {
    background: transparent;
    padding: 0.4rem 0;
}
:root[data-theme="dark"] .breadcrumb-item,
:root[data-theme="dark"] .breadcrumb-item a {
    color: var(--mt-text-2);
}
:root[data-theme="dark"] .breadcrumb-item.active {
    color: var(--mt-chrome-200);
}
:root[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--mt-text-3);
}

/* ============= Tooltip ============= */
:root[data-theme="dark"] .tooltip-inner {
    background: var(--mt-bg-4);
    color: var(--mt-text-0);
    border: 1px solid var(--mt-line-strong);
    font-size: 0.78rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

/* ============= Dashboard KPI highlight ============= */
/* Fix 22:30 : gradient text-clip rendait les chiffres invisibles. Couleur
   solide chrome-100 + drop-shadow léger = lisibilité garantie. */
:root[data-theme="dark"] .card .text-20,
:root[data-theme="dark"] .card .stat-value,
:root[data-theme="dark"] .card .number-lg {
    color: #ffffff !important;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* ============= Fix notifications dropdown legacy (header.blade.php) ============= */
/* Le header.blade.php a des styles inline avec bg:#fff et bg:#f8f9fa qui cassaient
   en dark. Override ici pour que le dropdown de notifications respecte le thème. */
:root[data-theme="dark"] .notification-dropdown-fixed {
    background: var(--mt-bg-2) !important;
    border: 1px solid var(--mt-line-strong) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7) !important;
}
:root[data-theme="dark"] .notification-body-fixed {
    background: var(--mt-bg-2) !important;
    color: var(--mt-text-0);
}
:root[data-theme="dark"] .notification-item-fixed {
    border-bottom-color: var(--mt-line) !important;
    color: var(--mt-text-1);
    background: transparent !important;
}
:root[data-theme="dark"] .notification-item-fixed:hover {
    background-color: var(--mt-bg-3) !important;
}
:root[data-theme="dark"] .notification-item-fixed[style*="#f8f9fa"] {
    background-color: var(--mt-bg-2) !important;
}
:root[data-theme="dark"] .notification-item-fixed[style*="#fff3cd"] {
    background-color: rgba(184, 115, 58, 0.1) !important;
    border-left: 3px solid var(--mt-copper-300);
}
:root[data-theme="dark"] .notification-footer-fixed {
    background-color: var(--mt-bg-1) !important;
    border-top: 1px solid var(--mt-line-strong) !important;
}
:root[data-theme="dark"] .notification-content-fixed h6,
:root[data-theme="dark"] .notification-content-fixed p {
    color: var(--mt-text-0);
}
:root[data-theme="dark"] .notification-content-fixed p {
    color: var(--mt-text-1);
}

/* Même traitement pour le dropdown messages (duplique structure) */
:root[data-theme="dark"] [class*="message-dropdown"],
:root[data-theme="dark"] [class*="message-body"],
:root[data-theme="dark"] [class*="message-item"] {
    background-color: var(--mt-bg-2) !important;
    color: var(--mt-text-0);
}

/* ============= Fix général : éléments qui hard-codent white ============= */
/* Bootstrap legacy / vues admin qui utilisent bg-white direct ou style inline */
:root[data-theme="dark"] [style*="background-color:#fff"]:not(input):not(button),
:root[data-theme="dark"] [style*="background-color: #fff"]:not(input):not(button),
:root[data-theme="dark"] [style*="background:#fff"]:not(input):not(button),
:root[data-theme="dark"] [style*="background: #fff"]:not(input):not(button) {
    background: var(--mt-bg-2) !important;
    color: var(--mt-text-0) !important;
}
:root[data-theme="dark"] [style*="#f8f9fa"]:not(input):not(button) {
    background-color: var(--mt-bg-2) !important;
}

/* ============= Floating action buttons (my notifs bell + dark toggle) ============= */
:root[data-theme="dark"] #adm-notif-bell {
    background: var(--mt-surf-copper) !important;
    border: 1px solid var(--mt-copper-700) !important;
    box-shadow: var(--mt-sh-md), inset 0 1px 0 rgba(255,255,255,0.2);
}
:root[data-theme="dark"] #adm-notif-bell:hover {
    background: var(--mt-surf-copper-hover) !important;
    box-shadow: var(--mt-sh-lg), var(--mt-sh-glow-copper);
}
:root[data-theme="dark"] #adm-dark-toggle {
    background: var(--mt-surf-btn) !important;
    color: var(--mt-chrome-100) !important;
    border: 1px solid var(--mt-line-strong) !important;
    box-shadow: var(--mt-sh-sm);
}

/* ============= Accordion ============= */
:root[data-theme="dark"] .accordion-item {
    background: var(--mt-surf-card);
    border: 1px solid var(--mt-line-strong);
    color: var(--mt-text-0);
    border-radius: 10px !important;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
:root[data-theme="dark"] .accordion-button {
    background: transparent !important;
    color: var(--mt-text-0) !important;
    box-shadow: none !important;
}
:root[data-theme="dark"] .accordion-button:not(.collapsed) {
    background: var(--mt-bg-3) !important;
    color: var(--mt-copper-100) !important;
}
:root[data-theme="dark"] .accordion-body {
    background: transparent !important;
}

/* ============= Progress bar ============= */
:root[data-theme="dark"] .progress {
    background: var(--mt-bg-3);
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
    height: 8px;
}
:root[data-theme="dark"] .progress-bar {
    background: var(--mt-surf-copper);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}

/* ============= Reduced motion ============= */
@media (prefers-reduced-motion: reduce) {
    :root[data-theme="dark"] * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    :root[data-theme="dark"] .card:hover,
    :root[data-theme="dark"] .btn:hover { transform: none; }
}

/* ============= Print ============= */
@media print {
    :root[data-theme="dark"] body { background: #fff !important; color: #000 !important; }
    :root[data-theme="dark"] .card { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 1px solid #ccc !important; }
}
