/* ==========================================================================
   NASRINE V2 : fondation du design system
   Tokens, base, composants partagés (vitrine, compte, admin).
   Les styles propres à une surface vivent dans store.css / account.css / admin.css.
   Polices chargées par les layouts : Bricolage Grotesque (display) + Figtree (texte).
   ========================================================================== */

:root {
    /* ---- Couleurs de marque (issues du logo) ---- */
    --forest-50:  oklch(0.97 0.02 145);
    --forest-100: oklch(0.93 0.045 145);
    --forest-200: oklch(0.86 0.075 145);
    --forest-500: oklch(0.53 0.13 143);
    --forest-600: oklch(0.45 0.125 143);  /* vert du logo #1F6420 : action principale */
    --forest-700: oklch(0.38 0.105 144);
    --forest-800: oklch(0.30 0.075 150);
    --forest-900: oklch(0.23 0.05 152);   /* surfaces sombres (footer, hero) */

    --piment-50:  oklch(0.96 0.02 25);
    --piment-100: oklch(0.92 0.045 25);
    --piment-500: oklch(0.55 0.18 27);
    --piment-600: oklch(0.46 0.175 25);   /* rouge du logo #A3141E : prix, promo, danger */
    --piment-700: oklch(0.39 0.15 25);

    --soleil-100: oklch(0.96 0.06 90);
    --soleil-200: oklch(0.92 0.11 88);
    --soleil-400: oklch(0.82 0.166 79);   /* jaune du logo #FBB415 : surlignage, badge promo */
    --soleil-600: oklch(0.66 0.14 72);
    --soleil-800: oklch(0.45 0.09 65);    /* texte sur fond soleil */

    /* ---- Neutres chauds (teintés vers la terre) ---- */
    --cream-0:   oklch(0.995 0.004 90);   /* surface carte */
    --cream-50:  oklch(0.98 0.012 88);    /* fond de page */
    --cream-100: oklch(0.96 0.028 94);    /* crème du ruban du logo */
    --cream-200: oklch(0.91 0.022 80);
    --cream-300: oklch(0.85 0.024 75);    /* bordures fortes */
    --earth-400: oklch(0.66 0.025 65);
    --earth-500: oklch(0.55 0.025 62);    /* texte atténué (AA sur cream) */
    --earth-700: oklch(0.38 0.03 58);     /* texte secondaire */
    --earth-900: oklch(0.26 0.042 60);    /* brun du logo #3A2410 : texte principal */

    /* ---- Rôles sémantiques ---- */
    --bg:            var(--cream-50);
    --bg-subtle:     var(--cream-100);
    --surface:       var(--cream-0);
    --surface-sunk:  var(--cream-100);
    --border:        var(--cream-200);
    --border-strong: var(--cream-300);
    --text:          var(--earth-900);
    --text-2:        var(--earth-700);
    --text-muted:    var(--earth-500);
    --text-on-dark:  oklch(0.97 0.012 88);

    --primary:        var(--forest-600);
    --primary-hover:  var(--forest-700);
    --primary-soft:   var(--forest-50);
    --primary-ink:    var(--forest-700);
    --price:          var(--piment-600);
    --focus-ring:     oklch(0.82 0.166 79 / 0.9);

    --success:      var(--forest-600);
    --success-bg:   var(--forest-50);
    --success-line: var(--forest-200);
    --warning:      oklch(0.52 0.11 68);
    --warning-bg:   var(--soleil-100);
    --warning-line: var(--soleil-200);
    --danger:       var(--piment-600);
    --danger-bg:    var(--piment-50);
    --danger-line:  var(--piment-100);
    --info:         oklch(0.48 0.11 240);
    --info-bg:      oklch(0.96 0.02 240);
    --info-line:    oklch(0.89 0.045 240);

    /* ---- Typographie ---- */
    --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
    --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: clamp(2rem, 1.5rem + 2vw, 2.75rem);
    --text-4xl: clamp(2.5rem, 1.6rem + 4vw, 4.5rem);

    /* ---- Espacement (base 4px) ---- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-section: clamp(3rem, 2rem + 4vw, 6rem);

    /* ---- Formes ---- */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Ombres teintées (jamais de noir pur) */
    --shadow-xs: 0 1px 2px oklch(0.24 0.025 55 / 0.06);
    --shadow-sm: 0 1px 3px oklch(0.24 0.025 55 / 0.08), 0 1px 2px oklch(0.24 0.025 55 / 0.04);
    --shadow-md: 0 6px 20px -4px oklch(0.24 0.025 55 / 0.12);
    --shadow-lg: 0 18px 40px -12px oklch(0.24 0.025 55 / 0.22);

    /* ---- Mouvement ---- */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);     /* ease-out-quint */
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast: 140ms;
    --dur: 220ms;
    --dur-slow: 420ms;

    --container: 1240px;
    --gutter: clamp(1rem, 0.6rem + 1.6vw, 2rem);
    --header-h: 64px;
    --bottom-tab-h: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    color-scheme: light;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
    font-feature-settings: "ss01";
}
img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--primary-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--forest-800); }
p, li { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--text);
    text-wrap: balance;
    font-variation-settings: "opsz" 48;
}
h1 { font-size: var(--text-3xl); font-weight: 800; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5, h6 { font-size: var(--text-base); }
::selection { background: var(--soleil-200); color: var(--earth-900); }
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}
[hidden] { display: none !important; }
.scroll-locked { overflow: hidden; }

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.stack > * + * { margin-top: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* ===== Boutons ===== */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-border: var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 44px;
    padding: 0.625rem 1.125rem;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}
.btn:hover { color: var(--btn-fg); background: var(--btn-bg-hover, var(--surface-sunk)); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.btn i { font-size: 0.95em; }

.btn-primary {
    --btn-bg: var(--primary);
    --btn-bg-hover: var(--primary-hover);
    --btn-fg: var(--text-on-dark);
    --btn-border: transparent;
    box-shadow: var(--shadow-xs);
}
.btn-secondary, .btn-outline {
    --btn-bg: var(--surface);
    --btn-bg-hover: var(--cream-100);
    --btn-fg: var(--text);
    --btn-border: var(--border-strong);
}
.btn-ghost {
    --btn-bg: transparent;
    --btn-bg-hover: var(--cream-100);
    --btn-fg: var(--text-2);
    --btn-border: transparent;
}
.btn-soleil, .btn-accent {
    --btn-bg: var(--soleil-400);
    --btn-bg-hover: var(--soleil-200);
    --btn-fg: var(--earth-900);
    --btn-border: transparent;
}
.btn-danger {
    --btn-bg: var(--piment-600);
    --btn-bg-hover: var(--piment-700);
    --btn-fg: var(--text-on-dark);
    --btn-border: transparent;
}
.btn-outline-danger {
    --btn-bg: var(--surface);
    --btn-bg-hover: var(--danger-bg);
    --btn-fg: var(--danger);
    --btn-border: var(--danger-line);
}
.btn-success { --btn-bg: var(--forest-600); --btn-bg-hover: var(--forest-700); --btn-fg: var(--text-on-dark); --btn-border: transparent; }
.btn-warning { --btn-bg: var(--soleil-400); --btn-bg-hover: var(--soleil-200); --btn-fg: var(--earth-900); --btn-border: transparent; }
.btn-light, .btn-outline-light {
    --btn-bg: oklch(1 0 0 / 0.08);
    --btn-bg-hover: oklch(1 0 0 / 0.16);
    --btn-fg: var(--text-on-dark);
    --btn-border: oklch(1 0 0 / 0.28);
}
.btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 0.85rem 1.5rem; font-size: var(--text-base); border-radius: var(--radius); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

.btn-loading { position: relative; pointer-events: none; }
.btn-spinner, .spinner {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: nx-spin 0.7s linear infinite;
}
@keyframes nx-spin { to { transform: rotate(360deg); } }

/* ===== Formulaires ===== */
.form-group { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); }
.form-grid { display: grid; gap: 0 var(--space-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid .full-width, .form-grid .span-2 { grid-column: 1 / -1; }
.form-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
}
.form-label .required, .required-mark { color: var(--danger); margin-left: 2px; }
.form-control, .form-select {
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem; /* 16px : pas de zoom auto sur iOS */
    line-height: 1.4;
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
    appearance: none;
}
.form-control::placeholder { color: var(--earth-400); }
.form-control:hover { border-color: var(--earth-400); }
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px oklch(0.45 0.12 145 / 0.18);
}
.form-control:disabled, .form-control[readonly] { background: var(--surface-sunk); color: var(--text-2); }
textarea.form-control { min-height: 110px; resize: vertical; }
select.form-control, .form-select {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235b4a3c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
}
.form-control.is-invalid, .form-control:user-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px oklch(0.48 0.17 25 / 0.18); }
.form-hint, .form-text { font-size: var(--text-xs); color: var(--text-muted); }
.form-error, .invalid-feedback { font-size: var(--text-xs); color: var(--danger); font-weight: 600; }
.input-group { display: flex; align-items: stretch; }
.input-group > .form-control { flex: 1; min-width: 0; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.input-group-text {
    display: inline-flex; align-items: center; padding: 0 0.85rem;
    background: var(--surface-sunk); border: 1px solid var(--border-strong);
    border-radius: var(--radius); color: var(--text-2); font-size: var(--text-sm); font-weight: 600;
}
.input-group > .input-group-text:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 3rem; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: grid; place-items: center; color: var(--text-muted);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-sunk); }

.check { display: inline-flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 1.1em; height: 1.1em; margin-top: 0.2em; }

/* Interrupteur */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--cream-300); border-radius: var(--radius-pill);
    transition: background-color var(--dur) var(--ease-out);
}
.toggle-slider::before {
    content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
    background: var(--cream-0); border-radius: 50%; box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease-out);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.toggle-sm { width: 36px; height: 20px; }
.toggle-sm .toggle-slider::before { width: 14px; height: 14px; }
.toggle-sm input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ===== Surfaces ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.card-body { padding: var(--space-6); }
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { font-size: var(--text-lg); }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--space-6) 0; }

/* ===== Badges & statuts ===== */
.badge {
    display: inline-flex; align-items: center; gap: 0.35em;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--cream-100);
    color: var(--text-2);
    border: 1px solid var(--border);
}
.badge::before { content: none; }
.badge-dot::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge-success, .badge-livre, .badge-paye, .badge-active, .badge-green, .green { background: var(--success-bg); color: var(--forest-700); border-color: var(--success-line); }
.badge-warning, .badge-en-attente, .badge-pending, .badge-yellow, .yellow { background: var(--warning-bg); color: var(--soleil-800); border-color: var(--warning-line); }
.badge-danger, .badge-annule, .badge-echoue, .badge-red, .red { background: var(--danger-bg); color: var(--piment-700); border-color: var(--danger-line); }
.badge-info, .badge-blue, .blue { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-neutral, .badge-gray, .gray { background: var(--cream-100); color: var(--text-2); border-color: var(--border); }
.badge-promo { background: var(--soleil-400); color: var(--earth-900); border-color: transparent; font-weight: 750; }

/* ===== Alertes ===== */
.alert {
    display: flex; gap: var(--space-3); align-items: flex-start;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    color: var(--text);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
}
.alert > i:first-child { margin-top: 0.2em; flex-shrink: 0; }
.alert-success { background: var(--success-bg); border-color: var(--success-line); color: var(--forest-800); }
.alert-success > i:first-child { color: var(--success); }
.alert-danger, .alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--piment-700); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--soleil-800); }
.alert-info { background: var(--info-bg); border-color: var(--info-line); color: oklch(0.36 0.09 240); }

/* ===== Tableaux ===== */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 650;
    color: var(--text-muted);
    padding: 0.7rem 1rem;
    background: var(--surface-sunk);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: oklch(0.98 0.012 88 / 0.7); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table .text-right { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== États ===== */
.empty-state {
    display: grid; justify-items: center; text-align: center; gap: var(--space-3);
    padding: var(--space-12) var(--space-6);
    color: var(--text-2);
}
.empty-state-icon {
    width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--cream-100); color: var(--earth-500); font-size: 1.5rem;
}
.empty-state h3, .empty-state h2 { font-size: var(--text-lg); }
.empty-state p { max-width: 42ch; color: var(--text-muted); }
.empty-inline { padding: var(--space-6); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

.skeleton {
    background: linear-gradient(90deg, var(--cream-100) 0%, var(--cream-200) 50%, var(--cream-100) 100%);
    background-size: 200% 100%;
    animation: nx-shimmer 1.4s var(--ease-in-out) infinite;
    border-radius: var(--radius-sm);
}
@keyframes nx-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Overlay de chargement (loader.js) */
.loader-overlay {
    position: fixed; inset: 0; z-index: 2000;
    display: grid; place-items: center;
    background: oklch(0.98 0.012 88 / 0.78);
    opacity: 0; transition: opacity var(--dur) var(--ease-out);
}
.loader-overlay.active { opacity: 1; }
.loader-overlay-content {
    display: grid; justify-items: center; gap: var(--space-3);
    padding: var(--space-6) var(--space-8);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.loader-spinner {
    width: 36px; height: 36px; border-radius: 50%;
    border: 3px solid var(--forest-100); border-top-color: var(--primary);
    animation: nx-spin 0.8s linear infinite;
}
.loader-text { font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }

/* Toasts de secours (si SweetAlert2 absent) */
.toast-container {
    position: fixed; z-index: 2100; top: calc(var(--header-h) + 0.75rem); right: 1rem;
    display: grid; gap: var(--space-2); pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; gap: var(--space-2); align-items: center;
    padding: 0.75rem 1rem; border-radius: var(--radius);
    background: var(--earth-900); color: var(--text-on-dark);
    font-size: var(--text-sm); font-weight: 600; box-shadow: var(--shadow-lg);
    animation: nx-toast-in var(--dur) var(--ease-out);
}
.toast-success i { color: var(--forest-200); }
.toast-error i { color: var(--piment-100); }
.toast-out { opacity: 0; transform: translateY(-6px); transition: all var(--dur) var(--ease-out); }
@keyframes nx-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* SweetAlert2 : alignement sur la marque */
.swal2-popup { font-family: var(--font-body) !important; border-radius: var(--radius-lg) !important; color: var(--text) !important; }
.swal2-title { font-family: var(--font-display) !important; color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--primary) !important; border-radius: var(--radius) !important; }
.swal2-styled.swal2-cancel { background: var(--cream-200) !important; color: var(--text) !important; border-radius: var(--radius) !important; }
.swal2-styled:focus { box-shadow: 0 0 0 3px var(--focus-ring) !important; }

/* Select2 : alignement sur .form-control */
.select2-container--default .select2-selection--single {
    min-height: 44px; border: 1px solid var(--border-strong) !important; border-radius: var(--radius) !important;
    display: flex; align-items: center; background: var(--surface);
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text); padding-left: 0.875rem; line-height: 1.4; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px; right: 8px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--primary) !important; box-shadow: 0 0 0 3px oklch(0.45 0.12 145 / 0.18); }
.select2-dropdown { border-color: var(--border-strong) !important; border-radius: var(--radius) !important; overflow: hidden; box-shadow: var(--shadow-md); }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--primary) !important; }
.select2-search__field { border-radius: var(--radius-sm) !important; }

/* ===== Prix ===== */
.price, .text-price { color: var(--price); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.old-price { color: var(--text-muted); text-decoration: line-through; font-weight: 500; font-size: 0.85em; white-space: nowrap; }
.price-nowrap, .nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ===== Utilitaires ===== */
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 1rem; top: -100px; z-index: 3000;
    background: var(--earth-900); color: var(--text-on-dark); padding: 0.6rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; color: var(--text-on-dark); }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-2) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-center { text-align: center; }
.text-right, .text-end { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.full-width, .w-100 { width: 100%; }
.cell-wrap { white-space: normal; overflow-wrap: anywhere; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mt-4 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === Fragments partagés (agent parcours client) === */
/* Arbre de parrainage (fragments/referral-tree.html) : client + admin.
   Liste indentée verticale, branches repliables via <details>, pas de défilement horizontal. */
.rt { min-width: 0; }
.rt-list { list-style: none; margin: 0; padding: 0; }
.rt-list .rt-list {
    margin-left: 17px;
    padding-left: var(--space-3);
    border-left: 1px solid var(--border-strong);
}
.rt-item { position: relative; min-width: 0; }
.rt-list .rt-list > .rt-item::before {
    content: ""; position: absolute; left: calc(-1 * var(--space-3)); top: 26px;
    width: calc(var(--space-3) - 2px); height: 1px; background: var(--border-strong);
}
.rt-branch > summary { list-style: none; cursor: pointer; border-radius: var(--radius); }
.rt-branch > summary::-webkit-details-marker { display: none; }
.rt-branch > summary:hover .rt-node { background: var(--cream-100); }
.rt-branch > summary .rt-avatar::after {
    content: "\2212"; position: absolute; right: -4px; bottom: -4px;
    width: 16px; height: 16px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong);
    font-size: 12px; font-weight: 700; line-height: 1;
}
.rt-branch:not([open]) > summary .rt-avatar::after { content: "+"; }
.rt-node {
    display: flex; align-items: center; gap: var(--space-3);
    min-height: 52px; padding: var(--space-2);
    border-radius: var(--radius);
    min-width: 0;
    transition: background-color var(--dur-fast) var(--ease-out);
}
.rt-avatar {
    position: relative; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--cream-100); color: var(--text-2);
    border: 1px solid var(--border-strong);
    font-size: var(--text-xs); font-weight: 750; letter-spacing: 0.02em;
}
.rt-avatar--sm { width: 32px; height: 32px; }
.node-partenaire.rt-avatar, .node-partenaire .rt-avatar { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.node-eligible.rt-avatar, .node-eligible .rt-avatar { background: var(--soleil-400); color: var(--earth-900); border-color: transparent; }
.rt-main { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.rt-name { font-weight: 650; font-size: var(--text-sm); color: var(--text); overflow-wrap: anywhere; }
.rt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); font-size: var(--text-xs); color: var(--text-muted); }
.rt-code { font-size: var(--text-xs); color: var(--text-2); background: none; padding: 0; white-space: nowrap; }
.rt-count i { font-size: 0.85em; }
.rt-badge { flex-shrink: 0; }
.rt-root > .rt-item > .rt-branch > summary .rt-node,
.rt-root > .rt-item > .rt-leaf .rt-node { background: var(--primary-soft); }
.rt-empty {
    display: grid; justify-items: center; gap: var(--space-2); text-align: center;
    padding: var(--space-8) var(--space-4); color: var(--text-muted); font-size: var(--text-sm);
}
.rt-empty i { font-size: 1.5rem; color: var(--earth-400); }

/* Aperçu compact */
.rt-preview-sum { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--space-2); }
.rt-preview-list { list-style: none; margin: 0; padding: 0; display: grid; }
.rt-preview-item {
    display: flex; align-items: center; gap: var(--space-3);
    min-height: 52px; padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
}
.rt-preview-item:last-child { border-bottom: 0; }
.rt-preview-name { flex: 1; min-width: 0; font-weight: 600; font-size: var(--text-sm); overflow-wrap: anywhere; }
.rt-preview-count { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rt-preview-more { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }

@media (max-width: 400px) {
    .rt-list .rt-list { margin-left: 12px; padding-left: var(--space-2); }
    .rt-list .rt-list > .rt-item::before { left: calc(-1 * var(--space-2)); width: calc(var(--space-2) - 2px); }
}
@media (min-width: 640px) {
    .rt-list .rt-list { margin-left: 20px; padding-left: var(--space-5); }
    .rt-list .rt-list > .rt-item::before { left: calc(-1 * var(--space-5)); width: calc(var(--space-5) - 2px); }
}
