/* =============================================================================
 * admin-bootstrap-compat.css — Couche de compatibilite Bootstrap -> theme metallique
 * Cybergear / console d'administration — 2026-08-03
 *
 * POURQUOI CE FICHIER
 * -------------------
 * La console charge Bootstrap 4.1.3 (public/admin/assets/styles/css/themes/
 * lite-purple.min.css, banniere "Bootstrap v4.1.3") mais 161 vues Blade ont ete
 * ecrites, au fil du temps, avec la syntaxe Bootstrap 5. Deux consequences
 * mesurees sur l'arbre reel :
 *
 *   1. 36 classes Bootstrap 5 (382 occurrences) n'existent dans AUCUNE feuille
 *      chargee ni dans aucun <style> inline : me-*, ms-*, ps-*, gap-*, fw-*,
 *      fs-*, text-end, float-end, btn-close, form-select-sm, accordion-*...
 *      Elles ne produisent donc AUCUN style : espacements ecrases, croix de
 *      fermeture invisibles, colonnes de montants non alignees a droite.
 *   2. Les utilitaires clairs de Bootstrap 4 encore actifs peignent des surfaces
 *      lumineuses sur un fond #05080d : .table-light #ececec, .thead-light #eee,
 *      .table-dark #cccace (oui, clair), .btn-light #bbb, .list-group-item #fff,
 *      .input-group-text #eee, .close #000.
 *
 * Ce fichier corrige les DEUX en une passe, sans toucher a une seule vue.
 *
 * PORTEE — ce qui est volontairement ABSENT ici
 * ---------------------------------------------
 * Deja traite par admin-metallic-dark.css / admin-dark-enforce.css, non duplique :
 *   .bg-light .bg-white .text-dark .text-black .text-body .border .card
 *   .table-striped .table-hover .table-bordered .modal-content .modal-footer
 *   .dropdown-menu .page-link .form-control .form-select .text-muted
 *   .text-secondary .alert .btn-outline-secondary
 *
 * UNE seule regle existante est volontairement SUPERSEDEE : la palette de badges
 * de admin-metallic-dark.css:347-352, dont cinq des six degrades echouent au
 * critere WCAG AA avec la couleur de texte qui leur est associee (details et
 * ratios mesures en PARTIE 3).
 *
 * ORDRE DE CHARGEMENT — OBLIGATOIRE
 * ---------------------------------
 * A charger EN DERNIER, apres admin-cockpit.css
 * (cf. app/Http/Middleware/InjectAdminEnhancements.php, constante CSS_COCKPIT).
 * Plusieurs regles de la PARTIE 4 doivent primer sur admin-dark-enforce.css :
 * elles s'appuient sur une specificite superieure ET sur l'ordre de cascade.
 *
 * REGLES DE REDACTION
 * -------------------
 *   - Aucune couleur inventee : toute valeur passe par un jeton --mt-*, suivi de
 *     sa valeur de repli inline (meme convention que admin-dark-enforce.css).
 *     Les seuls hexadecimaux ecrits en clair sont les six degrades semantiques
 *     de la PARTIE 3 (cuivre / chrome / vert / rouge / ambre / bleu). Ils
 *     restent dans les familles de teintes du theme et chacun est accompagne
 *     de son ratio de contraste mesure.
 *   - PARTIE 1 (geometrie) : NON scopee au theme — un espacement manquant l'est
 *     dans les deux themes.
 *   - PARTIES 2 a 6 (couleurs) : scopees :root[data-theme="dark"] pour ne pas
 *     casser le mode clair, qui reste accessible via le bouton de bascule
 *     (public/admin/assets/js/admin-ergonomic-v2.js, cle localStorage adm_theme).
 * ========================================================================== */


/* =============================================================================
 * PARTIE 1 — POLYFILL BOOTSTRAP 5 -> BOOTSTRAP 4  (geometrie, les deux themes)
 * 36 classes / 382 occurrences mesurees dans resources/views/admin/
 * ========================================================================== */

/* ---- 1.1 Marges logiques (ms-* / me-*) — 133 occurrences -------
 * me-2 seule : 98 occurrences dans 42 fichiers.
 * Proprietes logiques : correctes en LTR et compatibles d'un futur RTL
 * (public/admin/assets/styles/css/bootstrap-rtl.css existe dans l'arbre). */
.ms-0 { margin-inline-start: 0 !important; }
.ms-1 { margin-inline-start: .25rem !important; }
.ms-2 { margin-inline-start: .5rem !important; }
.ms-3 { margin-inline-start: 1rem !important; }
.ms-4 { margin-inline-start: 1.5rem !important; }
.ms-5 { margin-inline-start: 3rem !important; }
.ms-auto { margin-inline-start: auto !important; }

.me-0 { margin-inline-end: 0 !important; }
.me-1 { margin-inline-end: .25rem !important; }
.me-2 { margin-inline-end: .5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }
.me-4 { margin-inline-end: 1.5rem !important; }
.me-5 { margin-inline-end: 3rem !important; }
.me-auto { margin-inline-end: auto !important; }

/* ---- 1.2 Paddings logiques (ps-* / pe-*) — 9 occurrences ------------------ */
.ps-0 { padding-inline-start: 0 !important; }
.ps-1 { padding-inline-start: .25rem !important; }
.ps-2 { padding-inline-start: .5rem !important; }
.ps-3 { padding-inline-start: 1rem !important; }
.ps-4 { padding-inline-start: 1.5rem !important; }
.ps-5 { padding-inline-start: 3rem !important; }

.pe-0 { padding-inline-end: 0 !important; }
.pe-1 { padding-inline-end: .25rem !important; }
.pe-2 { padding-inline-end: .5rem !important; }
.pe-3 { padding-inline-end: 1rem !important; }
.pe-4 { padding-inline-end: 1.5rem !important; }
.pe-5 { padding-inline-end: 3rem !important; }

/* ---- 1.3 gap-* — 13 occurrences (gap-1:1, gap-2:11, gap-3:1) ------------------------------
 * Utilise systematiquement avec .d-flex dans les vues (ex. audit-log.blade.php:26,
 * scraping/dashboard.blade.php:35). Sans cette regle, les elements sont colles. */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: .25rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }
.row-gap-2 { row-gap: .5rem !important; }
.column-gap-2 { column-gap: .5rem !important; }

/* ---- 1.4 Gouttieres de grille g-* — 9 occurrences -------------------------
 * Bootstrap 4 n'a pas de systeme de gouttiere variable. g-0 est reproduit
 * fidelement ; g-1..g-3 sont APPROXIMES par un row-gap vertical (la gouttiere
 * horizontale de 15px de Bootstrap 4 est conservee). Approximation assumee :
 * le rendu est correct visuellement, le risque de casser une grille est nul. */
.row.g-0 { margin-inline: 0 !important; }
.row.g-0 > [class*="col"] { padding-inline: 0 !important; }
.row.g-1 { row-gap: .25rem; }
.row.g-2 { row-gap: .5rem; }
.row.g-3 { row-gap: 1rem; }
.row.g-4 { row-gap: 1.5rem; }

/* ---- 1.5 Alignement de texte — 48 occurrences (text-end:45, text-start:3) ----------------
 * Impact fonctionnel direct : layout/kpi-dashboard-widget.blade.php:59 et
 * commande/show.blade.php:348 alignent des colonnes de quantites et de montants.
 * Sans .text-end les chiffres restent colles a gauche et deviennent illisibles
 * en lecture verticale. */
.text-start { text-align: left !important; }
.text-end   { text-align: right !important; }

/* ---- 1.6 Flottants — 13 occurrences --------------------------------------- */
.float-start { float: left !important; }
.float-end   { float: right !important; }

/* ---- 1.7 Graisses et tailles de police — 68 occurrences ------------------- */
.fw-light    { font-weight: 300 !important; }
.fw-normal   { font-weight: 400 !important; }
.fw-medium   { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold     { font-weight: 700 !important; }
.fw-bolder   { font-weight: 800 !important; }

.fs-1 { font-size: 2.25rem !important; }
.fs-2 { font-size: 1.75rem !important; }
.fs-3 { font-size: 1.5rem !important; }
.fs-4 { font-size: 1.25rem !important; }
.fs-5 { font-size: 1.125rem !important; }
.fs-6 { font-size: 1rem !important; }
/* Revue du 2026-08-03 : 18 badges de production portent `badge ... fs-6`
   (location/index.blade.php:152,156, location/show.blade.php:142,167,
   commande/refund.blade.php:10...). Le theme leur donne .72rem ; forcer 1rem
   ferait passer ces etiquettes de ~22 a ~28 px de haut et deformerait les
   lignes de tableau. Sur un badge, fs-6 signifie « un peu plus grand », pas
   « taille de corps de texte ». */
.badge.fs-6 { font-size: .82rem !important; }

/* ---- 1.8 Divers utilitaires — 21 occurrences ------------------------------ */
.text-decoration-none { text-decoration: none !important; }
.text-wrap    { white-space: normal !important; }
.text-nowrap  { white-space: nowrap !important; }
.text-reset   { color: inherit !important; }
.overflow-auto   { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.top-0    { top: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.start-0  { left: 0 !important; }
.end-0    { right: 0 !important; }
.rounded-3 { border-radius: .5rem !important; }
.d-grid { display: grid !important; }
.d-grid > .btn { width: 100%; }

/* ---- 1.9 Bordures directionnelles Bootstrap 5 ----------------------------- */
/* Revue du 2026-08-03 : sans !important, une vue qui pose deliberement un
   lisere d'accent de 4px garde la main. */
.border-start { border-left: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)); }
.border-end   { border-right: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)) !important; }
.border-1 { border-width: 1px !important; }
.border-2 { border-width: 2px !important; }
.border-3 { border-width: 3px !important; }
.border-4 { border-width: 4px !important; }

/* ---- 1.10 .form-select-sm — 9 occurrences, 7 fichiers ---------------------
 * .form-select est deja habille (admin-metallic-dark.css, admin-ergonomic-v2.css)
 * mais la variante -sm n'existe nulle part : le select reste en taille normale
 * dans les barres de filtres (ex. audit-log.blade.php:28). */
/* Revue du 2026-08-03 : admin-metallic-dark.css:255 habille .form-select sous
   :root[data-theme="dark"], soit une specificite (0,2,0) contre (0,1,0) ici.
   Sans elevation, la variante -sm ne changeait que la taille du texte et
   laissait le padding et le rayon de la taille normale : un select plus petit
   en apparence, mais toujours aussi haut. */
.form-select-sm,
:root[data-theme="dark"] .form-select-sm,
:root[data-theme="light"] .form-select-sm {
    padding-top: .25rem;
    padding-bottom: .25rem;
    padding-inline-start: .5rem;
    font-size: .8125rem;
    border-radius: .25rem;
}

/* ---- 1.11 .btn-close — 61 occurrences, 27 fichiers ------------------------
 * LE defaut le plus visible de l'inventaire. Bootstrap 5 rend cette croix via
 * une image de fond SVG ; Bootstrap 4 ne connait que .close. Resultat actuel :
 * 61 boutons de fermeture de modale totalement vides et invisibles
 * (ex. fournisseur.blade.php:111, collection.blade.php:468, commande/show.blade.php:499).
 * La croix est dessinee ici en SVG inline, teintee pour le fond sombre. */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: .3em;
    border: 0;
    border-radius: .4rem;
    background: transparent
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23cbd5e1'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E")
        center / 1em auto no-repeat;
    opacity: .65;
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}
.btn-close:hover,
.btn-close:focus-visible { opacity: 1; }
/* Revue du 2026-08-03 : le fond de survol est scope, sinon on obtenait un carre
   bleu-nuit sous une croix sombre en theme clair. */
:root[data-theme="dark"] .btn-close:hover,
:root[data-theme="dark"] .btn-close:focus-visible {
    background-color: var(--mt-bg-3, #1a2130);
}
:root[data-theme="light"] .btn-close:hover,
:root[data-theme="light"] .btn-close:focus-visible {
    background-color: rgba(0, 0, 0, .06);
}
.btn-close:focus-visible {
    outline: 2px solid var(--mt-electric, #7dd3fc);
    outline-offset: 2px;
}
/* En mode clair la croix claire disparaitrait : on repasse sur une croix sombre. */
:root[data-theme="light"] .btn-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23334155'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E");
}

/* ---- 1.12 Accordeon Bootstrap 5 — 8 occurrences, 3 fichiers ---------------
 * ATTENTION : ceci n'habille que l'apparence. Le depliage repose sur
 * data-bs-toggle="collapse", que le bundle Bootstrap 4.1.3 charge par
 * resources/views/admin/layout/main.blade.php:69 n'ecoute pas. Voir RISQUES. */
/* Revue du 2026-08-03 : la geometrie reste commune aux deux themes, mais les
   couleurs sont scopees. Non scopees, elles peignaient un fond bleu-nuit sur le
   theme clair, accessible par le bouton flottant et par Ctrl+Shift+L. */
.accordion-item {
    border-radius: 10px;
    margin-bottom: .5rem;
    overflow: hidden;
}
.accordion-header { margin: 0; }
.accordion-collapse:not(.show) { display: none; }
.accordion-flush .accordion-item { border-inline: 0; border-radius: 0; }

:root[data-theme="dark"] .accordion-item {
    background: var(--mt-surf-card, linear-gradient(180deg, #1b2230, #10151f));
    border: 1px solid var(--mt-line, rgba(255,255,255,.06));
}


/* =============================================================================
 * PARTIE 2 — SURFACES CLAIRES RESIDUELLES -> JETONS --mt-*   (theme sombre)
 * Uniquement les classes qu'aucune couche existante ne traite.
 * ========================================================================== */

/* ---- 2.1 En-tetes de tableaux clairs — 20 occurrences, 14 fichiers --------
 *   .table-light   : #ececec  (curation/index.blade.php:71, roles/index.blade.php:139,
 *                    scraping/dashboard.blade.php:76, location/show.blade.php)
 *   .thead-light th: #eee
 *   .table-dark    : #cccace dans ce theme — un gris CLAIR, malgre son nom.
 * Contraste mesure #ececec sur --mt-bg-2 #111827 : 15,0:1 — une bande blanche
 * en haut de chaque tableau. */
:root[data-theme="dark"] .table-light,
:root[data-theme="dark"] .table-light > td,
:root[data-theme="dark"] .table-light > th,
:root[data-theme="dark"] .table .thead-light th,
:root[data-theme="dark"] .thead-light th,
:root[data-theme="dark"] .table-dark,
:root[data-theme="dark"] .table-dark > td,
:root[data-theme="dark"] .table-dark > th {
    background: var(--mt-surf-panel, linear-gradient(180deg, #151c28, #0a101a)) !important;
    color: var(--mt-chrome-200, #cbd5e1) !important;
    border-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
}
/* Revue du 2026-08-03 : reprend a l'identique l'en-tete de tableau du theme
   (admin-metallic-dark.css:310-315) — sinon un tableau portant .table-light
   n'avait pas la meme allure que ses voisins sur la meme page. */
:root[data-theme="dark"] .table-light th,
:root[data-theme="dark"] .thead-light th {
    font-weight: 600;
    font-size: .75rem;
    letter-spacing: .2px;
    text-transform: uppercase;
}

/* ---- 2.2 .btn-light — 17 occurrences, 11 fichiers -------------------------
 * Bootstrap 4 : fond #bbb, texte #47404f. Un bouton gris clair sur fond #05080d
 * (produits/nouveau.blade.php, produits/product.blade.php, collection.blade.php:227,
 * product-top.blade.php:175). Remappe sur la surface bouton metallique, la meme
 * que celle utilisee par .btn-secondary dans admin-metallic-dark.css. */
:root[data-theme="dark"] .btn-light {
    background: var(--mt-surf-btn, linear-gradient(180deg, #2b3647, #1a222f)) !important;
    border: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
    box-shadow: inset 0 1px 0 var(--mt-highlight-top, rgba(255,255,255,.08));
}
:root[data-theme="dark"] .btn-light:hover,
:root[data-theme="dark"] .btn-light:focus {
    background: var(--mt-surf-btn-hover, linear-gradient(180deg, #384456, #232c3c)) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
}

/* ---- 2.3 .btn-outline-light / .btn-outline-dark — 6 occurrences -----------
 * layout/header.blade.php (2), messages/show.blade.php (1), faqs/index.blade.php (3).
 * admin-metallic-dark.css:247 traite deja -primary et -secondary, pas ces deux la. */
:root[data-theme="dark"] .btn-outline-light,
:root[data-theme="dark"] .btn-outline-dark {
    background: transparent !important;
    border: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    color: var(--mt-text-1, #cbd5e1) !important;
}
:root[data-theme="dark"] .btn-outline-light:hover,
:root[data-theme="dark"] .btn-outline-dark:hover,
:root[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--mt-surf-btn, linear-gradient(180deg, #2b3647, #1a222f)) !important;
    border-color: var(--mt-chrome-400, #7b8594) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
}

/* ---- 2.4 .list-group-item — 11 occurrences, 4 fichiers --------------------
 * Bootstrap 4 : background #fff, bordure rgba(0,0,0,.125). Contraste du fond
 * blanc sur la page #05080d : 20,1:1. Concerne le menu lateral de la fiche
 * fournisseur (fournisseur.blade.php:81-86), sales-report/index.blade.php,
 * banners/edit.blade.php. */
:root[data-theme="dark"] .list-group-item {
    background: var(--mt-surf-card, linear-gradient(180deg, #1b2230, #10151f)) !important;
    background-color: var(--mt-bg-2, #111827) !important;
    border-color: var(--mt-line, rgba(255,255,255,.06)) !important;
    color: var(--mt-text-1, #cbd5e1) !important;
}
:root[data-theme="dark"] .list-group-item-action { color: var(--mt-text-1, #cbd5e1) !important; }
:root[data-theme="dark"] .list-group-item-action:hover,
:root[data-theme="dark"] .list-group-item-action:focus {
    background-color: var(--mt-bg-3, #1a2130) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
}
:root[data-theme="dark"] .list-group-item.active,
:root[data-theme="dark"] .list-group-item-action.active {
    background: var(--mt-surf-copper, linear-gradient(180deg, #d9966b, #b8733a 55%, #8a5426)) !important;
    border-color: var(--mt-copper-500, #b8733a) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .list-group-item.disabled,
:root[data-theme="dark"] .list-group-item:disabled {
    background-color: var(--mt-bg-1, #0a0f18) !important;
    color: var(--mt-text-3, #64748b) !important;
}

/* ---- 2.5 .input-group-text — 7 occurrences, 3 fichiers --------------------
 * Bootstrap 4 : background #eee, texte #665c70. Ce sont les pastilles EUR et %
 * accolees aux champs de prix (location/create.blade.php:93/121/155,
 * location/edit.blade.php, fournisseur/dashbord2.blade.php) : un carre blanc
 * colle a un champ desormais sombre. */
:root[data-theme="dark"] .input-group-text {
    background: var(--mt-surf-btn, linear-gradient(180deg, #2b3647, #1a222f)) !important;
    background-color: var(--mt-bg-3, #1a2130) !important;
    border: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    color: var(--mt-text-1, #cbd5e1) !important;
}

/* ---- 2.6 .close (bouton de fermeture Bootstrap 4) — 29 occurrences, 23 fichiers
 * Bootstrap 4 : color #000 + text-shadow 0 1px 0 #fff + opacity .5.
 * Une croix NOIRE, ombree de blanc, a 50 % d'opacite sur un fond #111827 :
 * contraste effectif de l'ordre de 1,2:1. Invisible.
 * Aucune des six feuilles maison ne contient la chaine ".close". */
:root[data-theme="dark"] .close,
:root[data-theme="dark"] button.close {
    color: var(--mt-text-1, #cbd5e1) !important;
    text-shadow: none !important;
    opacity: .7 !important;
}
:root[data-theme="dark"] .close:not(:disabled):not(.disabled):hover,
:root[data-theme="dark"] .close:not(:disabled):not(.disabled):focus {
    color: var(--mt-text-0, #f1f5f9) !important;
    opacity: 1 !important;
}

/* ---- 2.7 .bg-secondary — 24 occurrences, 17 fichiers ----------------------
 * Bootstrap 4 : #52495a, un mauve-gris herite du theme lite-purple, etranger a
 * la palette graphite/cuivre. Utilise a la fois comme fond de bloc
 * (location/show.blade.php:22, home.blade.php:186) et comme couleur de badge.
 * Le cas badge est traite en PARTIE 3, plus specifique, et prime. */
:root[data-theme="dark"] .bg-secondary {
    background: var(--mt-surf-panel, linear-gradient(180deg, #151c28, #0a101a)) !important;
    background-color: var(--mt-bg-3, #1a2130) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
}

/* ---- 2.8 Utilitaires -subtle de Bootstrap 5.3 -----------------------------
 * La chaine "subtle" n'apparait dans AUCUNE feuille chargee (verifie sur les
 * 13 feuilles concatenees du <head>). Ces classes ne produisent donc rien du tout.
 * On leur donne une existence coherente avec le theme plutot que de les laisser
 * muettes. bg-light-subtle : 1 occurrence aujourd'hui, mais la famille revient
 * des qu'un ecran est ecrit en Bootstrap 5. */
:root[data-theme="dark"] [class*="-subtle"] {
    background-color: var(--mt-bg-3, #1a2130) !important;
    color: var(--mt-text-1, #cbd5e1) !important;
}
:root[data-theme="dark"] .bg-success-subtle { box-shadow: inset 3px 0 0 #10b981; }
:root[data-theme="dark"] .bg-danger-subtle  { box-shadow: inset 3px 0 0 #ef4444; }
:root[data-theme="dark"] .bg-warning-subtle { box-shadow: inset 3px 0 0 #f59e0b; }
:root[data-theme="dark"] .bg-info-subtle    { box-shadow: inset 3px 0 0 #0ea5e9; }
:root[data-theme="dark"] .bg-primary-subtle { box-shadow: inset 3px 0 0 var(--mt-copper-300, #d9966b); }


/* =============================================================================
 * PARTIE 3 — BADGES : UNIFICATION DES DEUX NOMMAGES + CONFORMITE AA (dark)
 *
 * CONSTAT 1 — nommage. admin-metallic-dark.css:347-352 habille .badge-primary /
 * -secondary / -success / -danger / -warning / -info, c'est-a-dire le nommage
 * Bootstrap 4. Mais les vues ecrivent massivement la forme Bootstrap 5
 * <span class="badge bg-success"> : 91 occurrences dans 47 fichiers
 * (bg-success 29, bg-secondary 18, bg-warning 13, bg-danger 12, bg-info 7,
 * bg-primary 6, bg-light 5). Ces 91 badges n'heritent donc PAS de la palette
 * metallique : ils tombent sur les fonds bruts de lite-purple.min.css
 * (#4caf50, #f44336, #ffc107, #663399, #003473) avec une couleur de texte
 * simplement heritee du parent.
 *
 * CONSTAT 2 — contraste. Les degrades de admin-metallic-dark.css:349-352 sont
 * associes a `color: #fff`, mais leur stop HAUT est trop clair pour du blanc :
 *   succes  #10b981 / blanc = 2,54:1     danger  #ef4444 / blanc = 3,76:1
 *   info    #0ea5e9 / blanc = 2,77:1     warning #f59e0b / blanc = 2,15:1
 *   cuivre  #d9966b / blanc = 2,46:1     (WCAG AA petit texte = 4,5:1)
 * Le texte du badge est en 75 % de la taille de base : le seuil applicable est
 * bien 4,5:1, pas 3:1.
 *
 * DECISION. Cette partie habille les DEUX nommages avec un seul jeu de degrades,
 * choisi pour que le stop le PLUS CLAIR passe deja AA. Elle prime volontairement
 * sur admin-metallic-dark.css:347-352 (chargement posterieur). Ratios obtenus,
 * mesures stop haut / stop bas :
 *   cuivre  #a35c28 -> #8a5426, texte #fff        5,10 / 6,22
 *   chrome  #dde3eb -> #9ba5b3, texte #0a0f18    14,86 / 7,70
 *   succes  #047857 -> #065f46, texte #fff        5,48 / 7,68
 *   danger  #dc2626 -> #991b1b, texte #fff        4,83 / 8,31
 *   warning #fbbf24 -> #f59e0b, texte #05080d    12,01 / 9,34
 *   info    #0369a1 -> #075985, texte #fff        5,93 / 7,56
 * Les teintes restent dans les familles deja utilisees par le theme
 * (#8a5426 = --mt-copper-700, #dde3eb / #9ba5b3 = stops de --mt-surf-chrome).
 * ========================================================================== */
:root[data-theme="dark"] .badge-primary,
:root[data-theme="dark"] .badge.bg-primary {
    background: linear-gradient(180deg, #a35c28 0%, #8a5426 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .badge-secondary,
:root[data-theme="dark"] .badge.bg-secondary {
    background: linear-gradient(180deg, #dde3eb 0%, #9ba5b3 100%) !important;
    color: var(--mt-bg-1, #0a0f18) !important;
}
:root[data-theme="dark"] .badge-success,
:root[data-theme="dark"] .badge.bg-success {
    background: linear-gradient(180deg, #047857 0%, #065f46 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .badge-danger,
:root[data-theme="dark"] .badge.bg-danger {
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .badge-warning,
:root[data-theme="dark"] .badge.bg-warning {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: var(--mt-bg-0, #05080d) !important;
}
:root[data-theme="dark"] .badge-info,
:root[data-theme="dark"] .badge.bg-info {
    background: linear-gradient(180deg, #0369a1 0%, #075985 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .badge.bg-light,
:root[data-theme="dark"] .badge.bg-white,
:root[data-theme="dark"] .badge-light {
    background: var(--mt-surf-btn, linear-gradient(180deg, #2b3647, #1a222f)) !important;
    color: var(--mt-text-0, #f1f5f9) !important;
    border: 1px solid var(--mt-line-strong, rgba(255,255,255,.12)) !important;
}
:root[data-theme="dark"] .badge.bg-dark {
    background: var(--mt-surf-inset, linear-gradient(180deg, #0e141e, #151d2a)) !important;
    color: var(--mt-text-1, #cbd5e1) !important;
}
/* Bootstrap 4 ne pose aucune couleur de texte sur .badge : elle est heritee du
 * parent. Filet de securite pour toute combinaison bg-* non listee ci-dessus. */
:root[data-theme="dark"] .badge[class*="bg-"] { text-shadow: none; }


/* =============================================================================
 * PARTIE 4 — REPARATION DE CONTRASTE : .text-dark SUR FOND VIF  (theme sombre)
 *
 * admin-dark-enforce.css force `.text-dark { color: var(--mt-text-0) }` en
 * !important pour tous les cas. C'est juste quand .text-dark est sur un fond
 * sombre. Ca devient un defaut d'accessibilite quand le fond est une couleur
 * vive claire, ce qui est precisement l'idiome Bootstrap 5 "bg-warning text-dark".
 *
 * Mesure : texte #f1f5f9 sur .bg-warning #ffc107 = 1,49:1.
 *          Le texte Bootstrap natif #47404f donnait 6,09:1.
 * 15 occurrences dans 10 fichiers, dont 8 sur bg-warning :
 *   layout/sidebar.blade.php:160        (compteur de curation du menu)
 *   commande/refund.blade.php:144, :314
 *   location/show.blade.php:142, :167
 *   location/index.blade.php:164
 *   cart.blade.php:56
 *   tracabilite/inscriptions.blade.php:85
 *
 * Specificite 0,4,0 (deux classes + :root + attribut) contre 0,3,0 pour
 * admin-dark-enforce.css, et chargement posterieur : cette regle prime.
 * ========================================================================== */
:root[data-theme="dark"] .bg-warning.text-dark,
:root[data-theme="dark"] .bg-warning .text-dark,
:root[data-theme="dark"] .badge.bg-warning.text-dark,
:root[data-theme="dark"] .table-warning.text-dark {
    color: var(--mt-bg-0, #05080d) !important;
}
:root[data-theme="dark"] .bg-light.text-dark,
:root[data-theme="dark"] .bg-white.text-dark {
    /* .bg-light et .bg-white sont deja repeints en sombre par
     * admin-dark-enforce.css:20-24 : le texte doit rester CLAIR ici. */
    color: var(--mt-text-0, #f1f5f9) !important;
}


/* =============================================================================
 * PARTIE 5 — FONDS CONTEXTUELS BRUTS -> PALETTE METALLIQUE  (theme sombre)
 * .bg-primary #663399 (19 occ), .bg-info #003473 (13 occ) : deux violets/bleus
 * du theme lite-purple, sans rapport avec l'accent cuivre de la console.
 * .bg-success / .bg-danger / .bg-warning sont conserves dans leur registre
 * semantique (vert / rouge / ambre) mais assombris pour tenir sur le fond.
 * Ne s'applique PAS aux .badge, deja traites en PARTIE 3 (specificite superieure).
 * ========================================================================== */
:root[data-theme="dark"] .bg-primary:not(.badge) {
    background: linear-gradient(180deg, #a35c28 0%, #8a5426 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .bg-info:not(.badge) {
    background: linear-gradient(180deg, #0369a1 0%, #075985 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .bg-success:not(.badge) {
    background: linear-gradient(180deg, #047857 0%, #065f46 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .bg-danger:not(.badge) {
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%) !important;
    color: #fff !important;
}
:root[data-theme="dark"] .bg-warning:not(.badge) {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: var(--mt-bg-0, #05080d) !important;
}


/* =============================================================================
 * PARTIE 6 — BORDURES CLAIRES RESIDUELLES  (theme sombre)
 * Bootstrap 4 pose #dee2e6 / #eee sur des composants que les couches existantes
 * ne couvrent pas : en-tete de modale, onglets, groupes de champs.
 * ========================================================================== */
/* Revue du 2026-08-03 : --mt-line (.06) affaiblissait les separateurs voulus
   par le theme. On reprend --mt-line-strong (.12), la valeur deja utilisee par
   admin-metallic-dark.css pour ces memes bordures. Les champs d'un input-group
   sont retires : leur bordure de focus cuivre etait ecrasee. */
:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .nav-tabs,
:root[data-theme="dark"] .card-header {
    border-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
}
:root[data-theme="dark"] .input-group > .form-control:not(:focus) {
    border-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
}
:root[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--mt-text-2, #94a3b8) !important;
    border-color: transparent !important;
}
:root[data-theme="dark"] .nav-tabs .nav-link.active,
:root[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    /* Bootstrap 4 met ici background-color:#fff — un onglet blanc.
       Revue du 2026-08-03 : admin-metallic-dark.css:432-434 marque l'onglet actif
       par `color: --mt-copper-100` et `border-bottom: 2px solid --mt-copper-300`.
       Une regle border-color raccourcie effacait ce lisere : l'etat actif n'etait
       plus signale que par une nuance de fond. On ne touche donc qu'aux trois
       bords que Bootstrap peint en clair, et on conserve le bas au cuivre. */
    background: var(--mt-bg-3, #1a2130) !important;
    color: var(--mt-copper-100, #f5d9c4) !important;
    border-top-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    border-left-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    border-right-color: var(--mt-line-strong, rgba(255,255,255,.12)) !important;
    border-bottom: 2px solid var(--mt-copper-300, #d9966b) !important;
}


/* =============================================================================
 * PARTIE 7 — GARDE-FOUS
 * ========================================================================== */

/* La PARTIE 1 est volontairement non scopee : un espacement manquant l'est dans
 * les deux themes. Trois de ses regles portent malgre tout une couleur, et
 * chacune a son pendant clair — a maintenir si l'une d'elles evolue :
 *   .border-start / .border-end  -> ici meme, juste en dessous ;
 *   .btn-close                   -> PARTIE 1.11, croix sombre + fond de survol ;
 *   .accordion-item              -> PARTIE 1.12, couleurs scopees en sombre,
 *                                   la geometrie seule restant commune.
 * Revue du 2026-08-03 : ce commentaire affirmait qu'il n'y en avait que deux,
 * et .accordion-item peignait effectivement un bloc bleu-nuit sur fond clair. */
:root[data-theme="light"] .border-start { border-left-color: rgba(15,23,42,.12) !important; }
:root[data-theme="light"] .border-end   { border-right-color: rgba(15,23,42,.12) !important; }

/* Respect de la preference systeme, comme les autres feuilles du theme. */
@media (prefers-reduced-motion: reduce) {
    .btn-close { transition: none; }
}

/* Impression : on ne veut pas envoyer des aplats sombres a l'imprimante. */
@media print {
    :root[data-theme="dark"] .table-light,
    :root[data-theme="dark"] .thead-light th,
    :root[data-theme="dark"] .list-group-item,
    :root[data-theme="dark"] .input-group-text {
        background: #fff !important;
        color: #000 !important;
    }
}
