/* ============================================================
   OXYTRANSPORTS — Back-office admin
   Design system tokens : design-tokens.css (Poppins + Inter, bordeaux #601010)
   ============================================================ */

@import url('design-tokens.css');

/* ────── Reset ────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    color: var(--fg-1);
    background: var(--bg-1);
    font-size: var(--fs-16);
    line-height: var(--lh-base);
}

a { color: var(--brand-secondary); }
a:hover { color: var(--brand-secondary-hover); }

button, input, select, textarea { font-family: inherit; }

img { display: block; }

/* ──────────────────────────────────────────────────────────────
   LOGIN PAGE (index.html)
   ────────────────────────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ot-burgundy-700), var(--ot-burgundy-900));
    padding: var(--sp-4);
}

.login-card {
    background: var(--surface-0);
    padding: var(--sp-7) var(--sp-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
}

.login-logo {
    display: block;
    margin: 0 auto var(--sp-5);
    height: 56px;
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: var(--fs-20);
    font-weight: 600;
    text-align: center;
    margin: 0 0 var(--sp-6);
    color: var(--ink-900);
    letter-spacing: var(--tracking-tight);
}

.login-card label {
    display: block;
    margin-bottom: var(--sp-4);
}

.login-card label span {
    display: block;
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--ink-700);
    margin-bottom: var(--sp-2);
}

.login-card input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-sm);
    font-size: var(--fs-16);
    color: var(--ink-900);
    background: var(--surface-0);
    transition: border-color var(--dur-base), box-shadow var(--dur-base);
}

.login-card input:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: var(--focus-ring-bordeaux);
}

.login-card button {
    width: 100%;
    padding: var(--sp-4);
    border: none;
    border-radius: var(--radius-md);
    background: var(--brand-secondary);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-16);
    cursor: pointer;
    transition: background var(--dur-base) var(--ease-standard);
}

.login-card button:hover { background: var(--brand-secondary-hover); }
.login-card button:disabled { opacity: 0.6; cursor: wait; }

.error {
    color: var(--danger);
    background: var(--danger-bg-subtle);
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    margin-top: var(--sp-4);
    font-size: var(--fs-14);
    text-align: center;
}

/* ──────────────────────────────────────────────────────────────
   ADMIN LAYOUT (other pages)
   ────────────────────────────────────────────────────────────── */

.admin-page { background: var(--bg-1); min-height: 100vh; }

/* Skip-link : visible uniquement quand focusé au clavier. WCAG 2.4.1 Bypass Blocks.
   Anime transform (pas top) pour rester sur le compositor — pas de layout thrash. */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--ink-900);
    color: #fff;
    padding: var(--sp-3) var(--sp-5);
    font-family: var(--font-display);
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: 9999;
    transform: translateY(-110%);
    transition: transform var(--dur-fast) var(--ease-standard);
}
.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid var(--brand-secondary);
    outline-offset: 2px;
}
[data-theme="dark"] .skip-link { background: var(--surface-2); color: var(--fg-1); }

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
    background: var(--surface-0);
    padding: var(--sp-3) var(--sp-6);
    border-bottom: 1px solid var(--line-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-logo { height: 44px; width: auto; }

.admin-nav {
    display: flex;
    gap: var(--sp-1);
    align-items: center;
    flex: 1;
    justify-content: center;
}

.admin-nav a {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--ink-700);
    text-decoration: none;
    font-size: var(--fs-14);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    transition: all var(--dur-base) var(--ease-standard);
}

.admin-nav a:hover {
    color: var(--brand-secondary);
    background: var(--ot-burgundy-50);
    text-decoration: none;
}

.admin-nav a.active {
    color: #fff;
    background: var(--brand-secondary);
    font-weight: 600;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: var(--fs-14);
    color: var(--ink-700);
}

.admin-user button {
    background: transparent;
    border: 1px solid var(--line-200);
    color: var(--ink-700);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--fs-14);
    font-family: var(--font-display);
    font-weight: 500;
    transition: all var(--dur-base);
}

.admin-user button:hover {
    background: var(--ot-burgundy-50);
    color: var(--brand-secondary);
    border-color: var(--ot-burgundy-300);
}

/* Dark : les survols nav/header utilisent une surface sombre au lieu du rose clair */
[data-theme="dark"] .admin-nav a:hover,
[data-theme="dark"] .admin-user button:hover { background: var(--surface-2); color: var(--brand-secondary); border-color: var(--border-strong); }

.admin-main {
    /* Full largeur : pas de max-width, le contenu s'étale sur toute la fenêtre.
       Padding latéral sp-7 (48px) pour conserver une respiration sur les bords. */
    padding: var(--sp-7) var(--sp-7) var(--sp-9);
}

.admin-main h1 {
    font-family: var(--font-display);
    /* Bolder : h1 passe de 30/700 à 42/800 — le titre devient un point d'ancrage immédiat
       au lieu d'un libellé fonctionnel. Ratio h1/body : 1.875 → 2.625. */
    font-weight: 800;
    font-size: var(--fs-42);
    line-height: var(--lh-tight);
    color: var(--ink-900);
    margin: 0 0 var(--sp-6);
    letter-spacing: var(--tracking-tight);
}

/* Eyebrow optionnel : <p class="page-eyebrow">Opérations</p><h1>…</h1> */
.admin-main .page-eyebrow {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--brand-secondary);
    margin: 0 0 var(--sp-2);
}

.admin-main h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-20);
    color: var(--ink-900);
    margin: var(--sp-7) 0 var(--sp-4);
    letter-spacing: var(--tracking-tight);
}

/* ──────────────────────────────────────────────────────────────
   FILTERS BAR
   ────────────────────────────────────────────────────────────── */

.filters {
    background: var(--surface-0);
    padding: var(--sp-4) var(--sp-5);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-5);
    display: flex;
    gap: var(--sp-4);
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.filters label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-14);
    color: var(--ink-700);
    font-weight: 500;
}

.filters select,
.filters input {
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-sm);
    font-size: var(--fs-14);
    color: var(--ink-900);
    background: var(--surface-0);
    transition: border-color var(--dur-base);
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: var(--focus-ring-bordeaux-soft);
}

/* ──────────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────────── */

.btn-primary,
.btn-secondary,
.btn-tertiary,
button.btn-primary,
button.btn-secondary,
button.btn-tertiary,
a.btn-primary,
a.btn-secondary,
a.btn-tertiary {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-14);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--dur-base) var(--ease-standard);
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-secondary);
    color: #fff;
    border-color: var(--brand-secondary);
}
.btn-primary:hover { background: var(--brand-secondary-hover); border-color: var(--brand-secondary-hover); }

.btn-secondary {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.btn-secondary:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }

.btn-tertiary {
    background: transparent;
    color: var(--ink-700);
    border-color: var(--line-300);
}
.btn-tertiary:hover {
    background: var(--bg-1);
    color: var(--ink-900);
    border-color: var(--ink-700);
}

button.btn-edit,
.filters button {
    background: var(--brand-secondary);
    color: #fff;
    border: none;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 600;
    transition: background var(--dur-base);
}
button.btn-edit:hover, .filters button:hover { background: var(--brand-secondary-hover); }

.btn-accept {
    background: var(--success);
    color: #fff;
    border: none;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 600;
    transition: background var(--dur-base);
}
.btn-accept:hover { background: var(--ox-green-800); }

.btn-refuse {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 600;
    margin-left: var(--sp-2);
    transition: background var(--dur-base);
}
.btn-refuse:hover { background: var(--danger-strong); }

/* ──────────────────────────────────────────────────────────────
   DATA TABLES
   ────────────────────────────────────────────────────────────── */

/* Bolder : la table cesse d'être une "card marketing" et devient une surface de données.
   - Radius réduit (md → sm) pour un cadre plus précis
   - Header inversé : ink-900 fond / blanc texte, pour planter le repère
   - Padding cellules réduit (sp-3/sp-4 → sp-2/sp-3) : densité */
.data-table {
    width: 100%;
    background: var(--surface-0);
    border: 1px solid var(--line-200);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th {
    background: var(--ink-900);
    color: #fff;
    text-align: left;
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    border-bottom: 1px solid var(--ink-900);
}

.data-table td {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--line-100);
    font-size: var(--fs-14);
    color: var(--ink-900);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background var(--dur-base);
}
.data-table tbody tr:hover { background: var(--bg-1); }

/* Dark : l'en-tête utilisait --ink-900 (qui bascule en quasi-blanc) → header pâle
   + texte blanc = illisible. On le garde sombre via une surface élevée. */
[data-theme="dark"] .data-table th {
    background: var(--surface-2);
    color: var(--fg-1);
    border-bottom-color: var(--border-medium);
}

/* ──────────────────────────────────────────────────────────────
   BADGES (statuts)
   ────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 4px var(--sp-3);
    border-radius: var(--radius-pill);
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Bolder : badges passent de pastel-bg + colored-text à solid-bg + white-text.
   Les chips ressortent dans les listes denses au lieu de fondre en arrière-plan.
   Couleurs darkened pour passer WCAG AA (4.5:1) avec texte blanc sur fs-12. */
.badge-nouvelle, .badge-en_attente { background: var(--ox-sky-700); color: #fff; }
.badge-en_cours, .badge-publiee, .badge-ouvert { background: var(--ox-wheat-700); color: #fff; }
.badge-traitee, .badge-acceptee { background: var(--ox-green-700); color: #fff; }
.badge-reservee, .badge-validee, .badge-attribue { background: var(--ot-burgundy-700); color: #fff; }
.badge-annulee, .badge-refusee, .badge-archivee, .badge-clos { background: var(--ink-600); color: #fff; }
/* Dark : --ink-600 bascule en gris clair → blanc/clair illisible. Garde un gris foncé. */
[data-theme="dark"] .badge-annulee,
[data-theme="dark"] .badge-refusee,
[data-theme="dark"] .badge-archivee,
[data-theme="dark"] .badge-clos { background: var(--ink-300); }

/* ──────────────────────────────────────────────────────────────
   KPI CARDS (dashboard)
   ────────────────────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
    margin: 0 0 var(--sp-7);
}

/* KPI cards distilled : la couleur passe sur la donnée elle-même (kpi-value),
   plus de top-stripe (variante du side-stripe banni). Bordure 1px neutre conservée. */
.kpi-card {
    background: var(--surface-0);
    padding: var(--sp-5);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink-900);
    transition: transform var(--dur-base) var(--ease-standard),
                box-shadow var(--dur-base) var(--ease-standard);
    position: relative;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

/* Catégories : la teinte vit dans la donnée, pas dans une bordure décorative. */
.kpi-blue     .kpi-value { color: var(--ox-sky-600); }
.kpi-green    .kpi-value { color: var(--ox-green-700); }
.kpi-orange   .kpi-value { color: var(--ox-wheat-600); }
.kpi-bordeaux .kpi-value { color: var(--ot-burgundy-700); }

.kpi-value {
    font-family: var(--font-display);
    font-size: var(--fs-48);
    font-weight: 800;
    color: var(--ink-900);
    line-height: 1;
    letter-spacing: var(--tracking-tight);
}

.kpi-label {
    font-family: var(--font-body);
    font-size: var(--fs-14);
    color: var(--fg-2);
    margin-top: var(--sp-2);
}

/* ──────────────────────────────────────────────────────────────
   MODAL
   ────────────────────────────────────────────────────────────── */

/* Pattern legacy : <div class="modal" hidden> <div class="modal-content">...
   Exclusion explicite de <dialog>, qui a son comportement natif (caché si pas
   d'attribut [open]) et qui utilise sa propre classe dialog.modal scope. */
.modal:not(dialog) {
    position: fixed;
    inset: 0;
    background: rgba(28, 42, 34, 0.55);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: var(--sp-4);
}

.modal:not(dialog)[hidden] { display: none; }

.modal-content {
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: var(--sp-5);
    font-family: var(--font-display);
    font-size: var(--fs-24);
    font-weight: 700;
    color: var(--ink-900);
}

.modal-actions {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--line-200);
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ──────────────────────────────────────────────────────────────
   FORMS
   ────────────────────────────────────────────────────────────── */

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
}

.grid2 label,
fieldset label,
form > label {
    display: block;
    font-family: var(--font-display);
    font-size: var(--fs-12);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-700);
    margin-bottom: var(--sp-3);
}

.grid2 label input, .grid2 label select, .grid2 label textarea,
fieldset label input, fieldset label select, fieldset label textarea,
form > label input, form > label select, form > label textarea {
    width: 100%;
    padding: var(--sp-3);
    margin-top: var(--sp-2);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-sm);
    font-size: var(--fs-14);
    font-family: var(--font-body);
    color: var(--ink-900);
    background: var(--surface-0);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    transition: border-color var(--dur-base);
}

.grid2 label input:focus, .grid2 label select:focus, .grid2 label textarea:focus,
fieldset label input:focus, fieldset label select:focus, fieldset label textarea:focus,
form > label input:focus, form > label select:focus, form > label textarea:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: var(--focus-ring-bordeaux-soft);
}

fieldset {
    border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin-bottom: var(--sp-4);
    background: var(--surface-0);
}

fieldset legend {
    padding: 0 var(--sp-3);
    font-family: var(--font-display);
    font-size: var(--fs-14);
    font-weight: 700;
    color: var(--brand-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
}

.form-actions {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-5);
    flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────────
   NOTICES (placeholder, suggestion, etc.)
   ────────────────────────────────────────────────────────────── */

/* Notices : fond teinté + bordure complète 1px, pas de side-stripe (banni). */
.placeholder-notice {
    background: var(--ox-wheat-100);
    border: 1px solid var(--ox-wheat-300);
    padding: var(--sp-4) var(--sp-5);
    margin: var(--sp-4) 0;
    border-radius: var(--radius-sm);
    font-size: var(--fs-14);
    color: var(--ink-700);
}

.suggestion-notice {
    background: var(--ot-burgundy-50);
    border: 1px solid var(--ot-burgundy-200);
    padding: var(--sp-4) var(--sp-5);
    margin: var(--sp-4) 0;
    border-radius: var(--radius-md);
    font-size: var(--fs-14);
    color: var(--ink-900);
}

.suggestion-notice strong { color: var(--brand-secondary); }
.suggestion-notice button {
    background: var(--brand-secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--fs-12);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur-base);
}
.suggestion-notice button:hover { background: var(--brand-secondary-hover); }

/* ──────────────────────────────────────────────────────────────
   SYSTEM STATUS LIST
   ────────────────────────────────────────────────────────────── */

#system-status {
    list-style: none;
    padding: var(--sp-4) var(--sp-5);
    background: var(--surface-0);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 0;
}

#system-status li {
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--line-100);
    font-size: var(--fs-14);
    color: var(--ink-700);
}

#system-status li:last-child { border-bottom: none; }
#system-status strong { color: var(--ox-green-700); }

/* ──────────────────────────────────────────────────────────────
   MODAL-OVERLAY (pattern unifié pour les modals non-<dialog>)
   ──────────────────────────────────────────────────────────────
   Usage HTML :
     <div class="modal-overlay" id="my-modal">
         <div class="modal">
             <h2>Titre</h2>
             ...contenu...
         </div>
     </div>
   Toggle via JS : .classList.add('open') / .classList.remove('open')
   La fermeture par backdrop click et Escape est gérée par
   window.bindModalCloseUX() (cf. admin.js).
   ────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 42, 34, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--sp-4);
}
.modal-overlay.open { display: flex; }

.modal-overlay .modal {
    background: var(--surface-0);
    border-radius: var(--radius-md);
    padding: var(--sp-6);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-overlay .modal h2 {
    margin-top: 0;
    margin-bottom: var(--sp-4);
    font-family: var(--font-display);
    font-size: var(--fs-20);
    font-weight: 700;
    color: var(--ink-900);
}

/* Bouton danger (utilisé par confirmAsync et les boutons Supprimer) */
.btn-danger,
button.btn-danger,
a.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-14);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--danger);
    background: var(--danger);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--dur-base) var(--ease-standard);
    line-height: 1;
    white-space: nowrap;
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

/* ──────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS (UX win)
   ────────────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}

/* Toasts : leading glyph coloré plutôt que side-stripe (banni).
   Bordure 1px complète + glyph ::before qui porte la couleur de type. */
.toast {
    background: var(--surface-0);
    color: var(--ink-900);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line-200);
    font-size: var(--fs-14);
    font-weight: 500;
    min-width: 280px;
    max-width: 420px;
    animation: toast-in 0.3s var(--ease-standard);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.toast::before {
    content: 'ℹ';
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-18);
    line-height: 1;
    flex-shrink: 0;
    color: var(--info);
}

.toast.toast-success::before { content: '✓'; color: var(--success); }
.toast.toast-error::before   { content: '✕'; color: var(--danger); }
.toast.toast-warning::before { content: '⚠'; color: var(--warning); }
.toast.toast-info::before    { content: 'ℹ'; color: var(--info); }

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ──────────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .admin-header {
        flex-wrap: wrap;
        padding: var(--sp-3) var(--sp-4);
    }
    .admin-nav {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        gap: var(--sp-1);
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    /* Touch targets : padding élargi pour atteindre 44px haut min (WCAG 2.5.5).
       sp-3 vertical = 12px + line-height ~20px + 12px = 44px. */
    .admin-nav a { padding: var(--sp-3) var(--sp-4); min-height: 44px; }
    .admin-user button { padding: var(--sp-3) var(--sp-4); min-height: 44px; }
    button.btn-edit, .filters button,
    .btn-accept, .btn-refuse { padding: var(--sp-3) var(--sp-4); min-height: 44px; }
    .data-table button { min-height: 44px; }

    .admin-main { padding: var(--sp-4) var(--sp-4) var(--sp-7); }
    .admin-main h1 { font-size: var(--fs-24); }
    .grid2 { grid-template-columns: 1fr; }

    /* Tables : scroll horizontal au lieu de débordement */
    .data-table,
    .comm-table,
    .prix-table,
    .fourn-table,
    .prod-table,
    .hist-table,
    .dest-table { font-size: var(--fs-12); }
    .data-table th, .data-table td,
    .comm-table th, .comm-table td,
    .prix-table th, .prix-table td,
    .fourn-table th, .fourn-table td,
    .prod-table th, .prod-table td,
    .hist-table th, .hist-table td,
    .dest-table th, .dest-table td { padding: var(--sp-2) var(--sp-3); }

    /* Wrapper auto-scroll pour les tables non-déjà-wrappées */
    main.admin-main > table,
    main.admin-main > div > table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content { padding: var(--sp-4); }
    .modal-overlay .modal { padding: var(--sp-4); max-width: 100%; }
    .kpi-value { font-size: var(--fs-36); }

    /* Toast container : pleine largeur en bas sur mobile, plus visible */
    .toast-container {
        top: auto;
        bottom: var(--sp-4);
        left: var(--sp-4);
        right: var(--sp-4);
    }
    .toast { min-width: 0; max-width: 100%; }

    /* Cards 1 colonne pour le dashboard et la liste tarif */
    .stats-row, .kpi-grid, .recap-cards {
        grid-template-columns: 1fr !important;
    }
    .envoi-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 600px) {
    .admin-logo { height: 36px; }
    .admin-user { font-size: var(--fs-12); }
    .admin-user button { padding: var(--sp-1) var(--sp-3); }
    .admin-main { padding: var(--sp-3); }
    .admin-main h1 { font-size: var(--fs-20); }
    .filters { padding: var(--sp-3); gap: var(--sp-2); }
}

/* =====================================================================
   SPRINT 2 — Composants standardisés (additif, 2026-05-18)
   Ces classes remplacent à terme les variantes éparpillées (.ot-table,
   .prod-table, .data-table, etc.) et la fragmentation inline <style>.
   Les pages historiques continuent à fonctionner ; les nouvelles pages
   doivent utiliser ces classes.
   ===================================================================== */

/* ── 1. KPI grid + tile (utilisé dans dashboards) ────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}
.kpi-tile {
    background: var(--surface-0);
    border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
a.kpi-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08)); }
.kpi-tile .kpi-label {
    font-size: var(--fs-12, 0.72rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-500);
    font-weight: 600;
}
.kpi-tile .kpi-value {
    font-size: var(--fs-28, 1.6rem);
    font-weight: 700;
    color: var(--ot-burgundy-700);
    margin-top: 4px;
    line-height: 1;
}
.kpi-tile .kpi-sub {
    font-size: var(--fs-12);
    color: var(--ink-500);
    margin-top: 4px;
}
/* Variantes couleur KPI */
.kpi-tile.kpi--warn   .kpi-value { color: #b85c00; }
.kpi-tile.kpi--info   .kpi-value { color: #0D47A1; }
.kpi-tile.kpi--hold   .kpi-value { color: #7B6500; }
.kpi-tile.kpi--ok     .kpi-value { color: #1B5E20; }
.kpi-tile.kpi--danger .kpi-value { color: #B71C1C; }
.kpi-tile.kpi--neutral .kpi-value { color: var(--ink-700); }

/* ── 2. Toolbar (barre de filtres standardisée) ──────────────────── */
.std-toolbar {
    display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
    margin-bottom: var(--sp-3); padding: 0.8rem 1rem;
    background: var(--surface-0); border: 1px solid var(--line-200);
    border-radius: var(--radius-md);
}
.std-toolbar select, .std-toolbar input {
    padding: 0.4rem 0.6rem; border: 1px solid var(--line-200);
    border-radius: var(--radius-sm); font-size: var(--fs-14); font-family: inherit;
}
.std-toolbar label.field-label {
    font-size: var(--fs-12); color: var(--ink-500);
    text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600;
}
.std-toolbar .spacer { margin-left: auto; }

/* ── 3. Table unifiée (.admin-table) ─────────────────────────────── */
.admin-table {
    width: 100%; border-collapse: collapse; background: var(--surface-0);
    box-shadow: var(--shadow-sm); border-radius: var(--radius-md);
    overflow: hidden;
}
.admin-table thead { background: var(--brand-secondary, var(--ot-burgundy-700)); color: #fff; }
.admin-table th, .admin-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-size: var(--fs-14);
    border-bottom: 1px solid var(--line-200);
    vertical-align: top;
}
.admin-table thead th { font-weight: 600; }
.admin-table tbody tr:hover { background: var(--bg-1); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table td.num,
.admin-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td.actions,
.admin-table th.actions { white-space: nowrap; text-align: right; }
.admin-table--compact th,
.admin-table--compact td { padding: 0.3rem 0.55rem; font-size: var(--fs-12); }
.admin-table--striped tbody tr:nth-child(even) { background: var(--ink-50); }

/* Tri colonnes : header avec data-sort */
.admin-table thead th[data-sort] {
    cursor: pointer; user-select: none;
}
.admin-table thead th[data-sort]::after {
    content: ' ⇅'; opacity: 0.5; font-size: 0.85em;
}
.admin-table thead th[data-sort][data-sort-dir="asc"]::after { content: ' ▲'; opacity: 1; }
.admin-table thead th[data-sort][data-sort-dir="desc"]::after { content: ' ▼'; opacity: 1; }

/* Tri colonnes : nouveau helper bindSortableTable() — classe .sortable */
th.sortable {
    cursor: pointer; user-select: none;
    position: relative; padding-right: 1.4em !important;
}
th.sortable::after {
    content: '⇅';
    position: absolute; right: 0.5em; top: 50%;
    transform: translateY(-50%);
    opacity: 0.4; font-size: 0.85em;
}
th.sortable.sort-asc::after  { content: '▲'; opacity: 1; }
th.sortable.sort-desc::after { content: '▼'; opacity: 1; }
th.sortable:focus-visible    { outline: 2px solid var(--brand-primary, #6E1D1C); outline-offset: -2px; }

/* Sticky thead — classe utilitaire à mettre sur le <table> */
.sticky-thead thead th {
    position: sticky; top: 0; z-index: 2;
}
/* Sticky tfoot — classe utilitaire pour les tables avec totaux */
.sticky-tfoot tfoot tr {
    position: sticky; bottom: 0; z-index: 2;
    background: var(--bg-1, #F5F7F6);
    font-weight: 600;
}

/* ── 4. Pills / badges status unifiés ────────────────────────────── */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--fs-12);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.4;
}
.tag--info    { background: #DBEAFE; color: #1E3A8A; }
.tag--warn    { background: #FFF3E0; color: #6A4100; }
.tag--hold    { background: #FFF8E1; color: #7B6500; }
.tag--ok      { background: #C8E6C9; color: #1B5E20; }
.tag--success { background: #E6F6E9; color: #1B5E20; }
.tag--danger  { background: #FFCDD2; color: #B71C1C; }
.tag--cancel  { background: #FFCDD2; color: #B71C1C; text-decoration: line-through; }
.tag--neutral { background: #F0F2F1; color: #4D5C53; }

/* Dark : repalettise KPI + tags via les tokens --status-* (qui basculent) */
[data-theme="dark"] .kpi-tile.kpi--warn   .kpi-value { color: var(--status-warn-fg); }
[data-theme="dark"] .kpi-tile.kpi--info   .kpi-value { color: var(--status-info-fg); }
[data-theme="dark"] .kpi-tile.kpi--hold   .kpi-value { color: var(--status-warn-fg); }
[data-theme="dark"] .kpi-tile.kpi--ok     .kpi-value { color: var(--status-ok-fg); }
[data-theme="dark"] .kpi-tile.kpi--danger .kpi-value { color: var(--status-danger-fg); }
[data-theme="dark"] .tag--info    { background: var(--status-info-bg);    color: var(--status-info-fg); }
[data-theme="dark"] .tag--warn    { background: var(--status-warn-bg);    color: var(--status-warn-fg); }
[data-theme="dark"] .tag--hold    { background: var(--status-warn-bg);    color: var(--status-warn-fg); }
[data-theme="dark"] .tag--ok,
[data-theme="dark"] .tag--success { background: var(--status-ok-bg);      color: var(--status-ok-fg); }
[data-theme="dark"] .tag--danger,
[data-theme="dark"] .tag--cancel  { background: var(--status-danger-bg);  color: var(--status-danger-fg); }
[data-theme="dark"] .tag--neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }

/* ── 5. Boutons compacts (.btn-sm) standardisés ──────────────────── */
.std-btn,
button.std-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--line-200);
    background: var(--surface-0);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--fs-12);
    font-family: inherit;
    font-weight: 600;
    color: var(--ink-700);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 0.35rem;
    transition: background var(--motion-fast) var(--ease-standard);
}
.std-btn:hover { background: var(--ink-50); }
.std-btn--primary {
    background: var(--brand-secondary, var(--ot-burgundy-700));
    color: #fff;
    border-color: var(--brand-secondary, var(--ot-burgundy-700));
}
.std-btn--primary:hover { background: var(--ot-burgundy-800); border-color: var(--ot-burgundy-800); }
.std-btn--success {
    background: var(--ox-green-600); color: #fff; border-color: var(--ox-green-600);
}
.std-btn--success:hover { background: var(--ox-green-700); border-color: var(--ox-green-700); }
.std-btn--danger {
    background: #B91C1C; color: #fff; border-color: #B91C1C;
}
.std-btn--danger:hover { background: #991414; }
.std-btn--ghost {
    background: transparent; border-color: transparent; color: var(--ink-600);
}
.std-btn--ghost:hover { background: var(--ink-50); }
.std-btn[disabled],
.std-btn--disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── 6. Empty state (état vide standardisé) ──────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--sp-7) var(--sp-4);
    color: var(--ink-500);
    background: var(--surface-0);
    border-radius: var(--radius-md);
    border: 1px dashed var(--line-200);
}
.empty-state .empty-icon {
    font-size: 2.2rem;
    margin-bottom: var(--sp-2);
    opacity: 0.4;
}
.empty-state h3 {
    margin: 0 0 var(--sp-2);
    font-family: var(--font-display);
    font-size: var(--fs-16);
    color: var(--ink-700);
    font-weight: 600;
}
.empty-state p { margin: 0 0 var(--sp-3); font-size: var(--fs-14); }
.empty-state .empty-cta { margin-top: var(--sp-3); }

/* ── 7. Loading skeleton (placeholder shimmer) ───────────────────── */
@keyframes admin-skeleton-shimmer {
    0%   { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}
.skeleton,
.skeleton-line,
.skeleton-block {
    display: inline-block;
    background-color: var(--ink-100);
    background-image: linear-gradient(90deg, var(--ink-100) 0%, var(--ink-50) 50%, var(--ink-100) 100%);
    background-size: 600px 100%;
    border-radius: var(--radius-sm);
    animation: admin-skeleton-shimmer 1.4s infinite linear;
    color: transparent !important;
    user-select: none;
}
.skeleton-line { height: 0.9em; width: 100%; }
.skeleton-block { width: 100%; height: 100px; }
.skeleton-row td { padding: var(--sp-2); }
.skeleton-row td > span { display: block; height: 1em; background-color: var(--ink-100); border-radius: var(--radius-sm); }

/* ── 8. Skip-to-content (a11y) ───────────────────────────────────── */
.skip-to-content {
    position: absolute; left: -9999px; top: 0;
    background: var(--ot-burgundy-700); color: #fff;
    padding: 0.5rem 1rem; text-decoration: none;
    font-weight: 600; z-index: 10000;
    border-radius: 0 0 var(--radius-md) 0;
}
.skip-to-content:focus { left: 0; }

/* ── 9. Breadcrumb (a11y + UX) ───────────────────────────────────── */
.breadcrumb {
    list-style: none; padding: 0; margin: 0 0 var(--sp-3);
    display: flex; flex-wrap: wrap; gap: 0.3rem;
    font-size: var(--fs-12); color: var(--ink-500);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 0.3rem; }
.breadcrumb li + li::before {
    content: '›'; color: var(--ink-300); margin-right: 0.3rem;
}
.breadcrumb a { color: var(--ink-600); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-secondary); text-decoration: underline; }
.breadcrumb li[aria-current="page"] { color: var(--ink-800); font-weight: 600; }

/* ── 10. Hamburger mobile pour admin-nav ─────────────────────────── */
.admin-nav-toggle {
    display: none;
    position: relative;
    width: 40px; height: 40px;
    border: 1px solid var(--line-200);
    background: var(--surface-0);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    margin: 0 var(--sp-2);
}
.admin-nav-toggle::before,
.admin-nav-toggle::after,
.admin-nav-toggle span {
    content: '';
    position: absolute;
    left: 8px; right: 8px;
    height: 2px;
    background: var(--ink-700);
    transition: transform var(--motion-fast), opacity var(--motion-fast), top var(--motion-fast);
    border-radius: 1px;
}
.admin-nav-toggle::before { top: 12px; }
.admin-nav-toggle span    { top: 19px; display: block; }
.admin-nav-toggle::after  { top: 26px; }
.admin-nav-toggle[aria-expanded="true"]::before { top: 19px; transform: rotate(45deg); }
.admin-nav-toggle[aria-expanded="true"] span    { opacity: 0; }
.admin-nav-toggle[aria-expanded="true"]::after  { top: 19px; transform: rotate(-45deg); }

@media (max-width: 900px) {
    .admin-nav-toggle { display: inline-block; }
    .admin-header .admin-nav {
        display: none;
        position: fixed;
        top: 64px; left: 0; right: 0;
        background: var(--surface-0);
        flex-direction: column;
        align-items: stretch;
        padding: var(--sp-3);
        box-shadow: 0 4px 14px rgba(0,0,0,0.12);
        z-index: 200;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    .admin-header .admin-nav.open { display: flex; }
    .admin-header .admin-nav > a,
    .admin-header .admin-nav .nav-group { width: 100%; }
    .admin-header .admin-nav .nav-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 0 0 var(--sp-3);
        display: flex;
    }
}

/* ── 11. Focus visible (a11y) ────────────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--ot-burgundy-500);
    outline-offset: 2px;
    border-radius: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* =====================================================================
   "NEW GEN SENIOR-FRIENDLY" — overlay 2026-05-18
   Typo plus généreuse, densité aérée, dark mode, microinteractions douces.
   ===================================================================== */

/* ── Body : fond avec dégradé subtil ─────────────────────────────── */
body.admin-page {
    background: var(--page-bg) !important;
    color: var(--fg-1);
    transition: background var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard);
}

/* ── Header : look premium ───────────────────────────────────────── */
body.admin-page .admin-header {
    background: var(--surface-0);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

/* ── Titres : plus grands et plus lisibles ──────────────────────── */
.admin-main h1 {
    font-size: clamp(1.6rem, 1.5rem + 0.6vw, 2.2rem);
    letter-spacing: -0.015em;
    margin-bottom: var(--sp-2);
}
.admin-main h2 {
    font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.5rem);
    letter-spacing: -0.01em;
    margin-top: var(--sp-6);
}
.admin-main .page-subtitle,
.admin-main p {
    font-size: var(--fs-16);
    color: var(--fg-2);
    line-height: 1.6;
}

/* ── KPI tile new gen ────────────────────────────────────────────── */
.kpi-tile {
    padding: var(--tile-padding);
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--surface-elev);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}
.kpi-tile .kpi-label {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--fg-2);
    margin-bottom: 8px;
}
.kpi-tile .kpi-value {
    font-size: clamp(1.8rem, 1.5rem + 1vw, 2.4rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin-top: 0;
}
.kpi-tile .kpi-sub {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--fg-2);
}
.kpi-tile .kpi-spark {
    margin-top: 12px;
    width: 100%;
    height: 36px;
    display: block;
}
.kpi-tile .kpi-icon {
    position: absolute;
    top: 16px; right: 16px;
    width: 22px; height: 22px;
    color: var(--ink-400);
    opacity: 0.6;
}
a.kpi-tile, button.kpi-tile {
    cursor: pointer;
    transition: transform var(--motion-fast) var(--ease-standard),
                box-shadow var(--motion-base) var(--ease-standard),
                border-color var(--motion-fast) var(--ease-standard);
}
a.kpi-tile:hover, button.kpi-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-medium);
    text-decoration: none;
}

/* ── Boutons new gen : tailles confortables (44-52px) ───────────── */
.std-btn {
    min-height: var(--btn-h-md);
    padding: 0 18px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 10px;
    border-width: 1px;
    transition: background var(--motion-fast) var(--ease-standard),
                transform var(--motion-fast) var(--ease-standard),
                box-shadow var(--motion-fast) var(--ease-standard);
}
.std-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.std-btn:active { transform: translateY(0); }
.std-btn--lg {
    min-height: var(--btn-h-lg);
    padding: 0 24px;
    font-size: 1rem;
    border-radius: 12px;
}
.std-btn--icon { padding-left: 14px; padding-right: 14px; }
.std-btn .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Inputs new gen : plus hauts, focus ring ─────────────────────── */
.std-toolbar input,
.std-toolbar select,
.std-toolbar textarea {
    min-height: var(--input-h);
    padding: 0 14px;
    font-size: 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--border-medium);
    background: var(--surface-0);
    color: var(--fg-1);
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.std-toolbar input:focus,
.std-toolbar select:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px rgba(110, 29, 28, 0.12);
}

/* ── Admin table new gen : lignes plus hautes, hover doux ──────── */
.admin-table {
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: var(--surface-elev);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.admin-table thead { background: var(--surface-2); color: var(--fg-1); }
.admin-table thead th {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-2);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.admin-table tbody td {
    padding: 14px 16px;
    font-size: 0.92rem;
    line-height: 1.45;
    min-height: var(--row-min-height);
}
.admin-table tbody tr {
    transition: background var(--motion-fast) var(--ease-standard);
}
.admin-table tbody tr:hover { background: var(--surface-1); }

/* ── Status pill new gen : padding + iconotype ──────────────────── */
.tag {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tag::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.85;
}
.tag--warn    { background: var(--status-warn-bg);    color: var(--status-warn-fg);    border-color: var(--status-warn-line); }
.tag--info    { background: var(--status-info-bg);    color: var(--status-info-fg);    border-color: var(--status-info-line); }
.tag--hold    { background: var(--status-info-bg);    color: var(--status-info-fg);    border-color: var(--status-info-line); }
.tag--ok,
.tag--success { background: var(--status-ok-bg);      color: var(--status-ok-fg);      border-color: var(--status-ok-line); }
.tag--danger,
.tag--cancel  { background: var(--status-danger-bg);  color: var(--status-danger-fg);  border-color: var(--status-danger-line); }
.tag--neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); border-color: var(--status-neutral-line); }

/* ── Theme toggle : bouton sun/moon dans le header ──────────────── */
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border-medium);
    background: var(--surface-0);
    color: var(--ink-700);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--motion-fast), transform var(--motion-fast), border-color var(--motion-fast);
}
.theme-toggle:hover {
    background: var(--surface-1);
    transform: scale(1.05);
    border-color: var(--border-strong);
}
.theme-toggle .icon { width: 20px; height: 20px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

/* ── Layout du admin-user (header right) : aligner cleanly ──────── */
.admin-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

/* ── Sparkline réutilisable ──────────────────────────────────────── */
.sparkline-svg { display: block; width: 100%; height: 100%; }
.sparkline-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.sparkline-area { fill: currentColor; opacity: 0.08; }
.sparkline-dot  { fill: currentColor; }
.sparkline-up   { color: var(--status-danger-fg); }
.sparkline-down { color: var(--status-ok-fg); }
.sparkline-flat { color: var(--fg-2); }

/* ── Icônes Lucide standard : taille consistante ────────────────── */
svg.icon {
    width: 1em; height: 1em;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    vertical-align: -0.15em;
}

/* ── Microinteractions globales : focus rings douces ─────────────── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brand-secondary);
    outline-offset: 2px;
}

/* ── Skip to content : visible quand focus ──────────────────────── */
.skip-to-content {
    background: var(--brand-secondary);
    color: #fff;
}

/* ── Anim douce d'apparition pour les cartes ────────────────────── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.kpi-grid > .kpi-tile {
    animation: fade-in-up var(--motion-base) var(--ease-standard) both;
}
.kpi-grid > .kpi-tile:nth-child(1) { animation-delay: 0ms; }
.kpi-grid > .kpi-tile:nth-child(2) { animation-delay: 40ms; }
.kpi-grid > .kpi-tile:nth-child(3) { animation-delay: 80ms; }
.kpi-grid > .kpi-tile:nth-child(4) { animation-delay: 120ms; }
.kpi-grid > .kpi-tile:nth-child(5) { animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) {
    .kpi-grid > .kpi-tile { animation: none; }
    * { transition: none !important; animation: none !important; }
}

/* ── Dark mode overrides spécifiques admin.css ──────────────────── */
[data-theme="dark"] .admin-table thead { background: var(--surface-2); }
[data-theme="dark"] .admin-table tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .std-btn { background: var(--surface-1); border-color: var(--border-medium); color: var(--ink-800); }
[data-theme="dark"] .std-btn:hover { background: var(--surface-2); }
[data-theme="dark"] .std-toolbar { background: var(--surface-elev); }
[data-theme="dark"] .kpi-tile { background: var(--surface-elev); border-color: var(--border-medium); }

/* ── Composant entitySelect (autocomplete entreprise) ───────────── */
[data-entity-select] {
    display: inline-block;
    width: 100%;
}
.entity-select-input {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line-200, #D8E0DA);
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: inherit;
    width: 100%;
    min-width: 220px;
    background: var(--surface-1, #fff);
    color: var(--ink-800, #1a1a1a);
}
.entity-select-input:focus {
    outline: 2px solid var(--brand-secondary);
    outline-offset: 1px;
    border-color: var(--brand-secondary);
}
[data-theme="dark"] .entity-select-input {
    background: var(--surface-1);
    border-color: var(--border-medium);
    color: var(--ink-800);
}

/* ── Marge € badge couleur (propositions, AO) ──────────────────── */
.margin-positive { color: #1B5E20; font-weight: 600; }
.margin-negative { color: #B71C1C; font-weight: 600; }
.margin-zero     { color: var(--ink-500, #5d6b62); }
[data-theme="dark"] .margin-positive { color: #81C784; }
[data-theme="dark"] .margin-negative { color: #E57373; }

/* ── Mini-stepper sticky (formulaires multi-sections) ──────────── */
.form-stepper {
    display: flex; gap: 0; flex-wrap: wrap;
    position: sticky; top: 0; z-index: 5;
    background: var(--surface-1, #fff);
    padding: 0.5rem;
    border-bottom: 1px solid var(--line-200, #D8E0DA);
    margin: 0 0 1rem;
}
.form-stepper a {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    color: var(--ink-600, #4D5C53);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 120ms ease, border-color 120ms ease;
}
.form-stepper a:hover { color: var(--brand-secondary); }
.form-stepper a.current {
    color: var(--brand-secondary);
    border-bottom-color: var(--brand-secondary);
    font-weight: 600;
}
[data-theme="dark"] .form-stepper { background: var(--surface-elev); border-color: var(--border-medium); }

/* ── Workflow stepper 3 étapes (pages multi-tabs) ──────────────── */
.workflow-stepper {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}
.workflow-stepper .step {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: #F0F2F1;
    color: var(--ink-600, #4D5C53);
    font-size: 0.82rem;
    font-weight: 500;
}
.workflow-stepper .step.active {
    background: var(--brand-secondary);
    color: #fff;
}
.workflow-stepper .step.done {
    background: #C8E6C9;
    color: #1B5E20;
}
.workflow-stepper .step-sep {
    color: var(--ink-400, #9AA5A0);
    font-size: 1.2rem;
}
[data-theme="dark"] .workflow-stepper .step { background: var(--surface-2); }
[data-theme="dark"] .workflow-stepper .step.done { background: #2E7D32; color: #fff; }

/* ── Bandeau relance (publier-offre.html) ──────────────────────── */
.relance-banner {
    background: #FFF8E1;
    border: 1px solid #FFD54F;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin: 0 0 1rem;
    color: #6D4C00;
    font-size: 0.9rem;
}
.relance-banner strong { color: #4D3700; }
[data-theme="dark"] .relance-banner { background: #4D3700; color: #FFE082; border-color: #B28704; }
[data-theme="dark"] .relance-banner strong { color: #FFF59D; }

