/**
 * OptiGest360° — Refonte de l'interface : JETONS
 * =================================================
 * Valeurs EXACTES de la maquette validée par l'Owner le 2026-09-10
 * (palette.json + statuts de la console, admin tokens.css). Chargée seulement
 * quand le drapeau `ui.refonte_2026` est allumé (views-refonte/partials/refonte-head).
 *
 * Règles de rôle — elles décident de la couleur, pas l'écran :
 *   · violet = action et position : bouton principal, navigation active, liens,
 *     focus, sélection ;
 *   · orange léger = contexte et catégorie : exercice actif, « Avoir »,
 *     « Facture récurrente ». JAMAIS un statut ;
 *   · l'extrémité rouge du dégradé du logo (#ED562F) est exclue de l'interface :
 *     8° de teinte la séparent du rouge « anomalie » ;
 *   · le dégradé ne vit que dans le logo.
 *
 * Contrastes vérifiés dans les deux thèmes (≥ 4,5:1 pour tout couple de texte).
 * En sombre, les rôles s'inversent : le bouton violet porte un texte SOMBRE.
 */

html[data-refonte] {
    color-scheme: light;

    /* ── Surfaces et encres ── */
    --ui-bg: #F7F5F9;
    --ui-surface: #FFFFFF;
    --ui-surface-2: #F4F2F8;
    --ui-border: #E7E5EE;
    --ui-text-1: #19161E;
    --ui-text-2: #544E61;
    --ui-text-3: #645E70;
    --ui-text-disabled: #ABA6B6;

    /* ── Violet : action et position ── */
    --ui-accent: #9D2ACB;
    --ui-accent-strong: #6D1E9B;          /* bouton principal — blanc dessus 9,09:1 */
    --ui-accent-strong-hover: #5F1B8B;    /* violet profond du logo */
    --ui-accent-fg: #6D1E9B;              /* liens, texte violet */
    --ui-accent-subtle: #F7F0FE;          /* fond de sélection */
    --ui-accent-border: #E6D1FA;
    --ui-on-accent: #FFFFFF;

    /* ── Orange léger : contexte et catégorie ── */
    --ui-brand2: #F58129;
    --ui-brand2-fg: #A75605;
    --ui-brand2-bg: #FEF2E9;
    --ui-brand2-border: #FED4B9;

    /* ── Grammaire des statuts à six tons ── */
    --ui-neutral-fg: #544E61;   --ui-neutral-bg: #F4F2F8;   --ui-neutral-border: #E7E5EE;
    --ui-info-fg: #0B6B80;      --ui-info-bg: #E4F4F8;      --ui-info-border: #B7DFE9;
    --ui-progress-fg: #6D1E9B;  --ui-progress-bg: #F7F0FE;  --ui-progress-border: #E6D1FA;
    --ui-success-fg: #0F7A4F;   --ui-success-bg: #E7F5EC;   --ui-success-border: #BFE5CD;
    --ui-warning-fg: #8A5F07;   --ui-warning-bg: #FCF3DE;   --ui-warning-border: #F0DCB0;
    --ui-danger-fg: #B32D2D;    --ui-danger-bg: #FBEAEA;    --ui-danger-border: #F2C4C4;

    /* Rouge plein : SEULEMENT dans la fenêtre de confirmation (DL/13). */
    --ui-danger-fill: #DC2626;
    --ui-danger-fill-hover: #B91C1C;

    /* Constantes : ne basculent PAS avec le thème (aucun bloc sombre ne les
       redéfinit). Papier d'un document (toujours clair, comme à l'impression),
       blanc sous un QR code, une signature ou le bouton d'un interrupteur, texte
       sur rouge plein ; logo WhatsApp (clair : 4,1:1 ; le vert vif sur sombre). */
    --ui-blanc: #FFFFFF;
    --ui-paper-ink: #19161E;
    --ui-paper-muted: #645E70;
    --ui-paper-tint: #F7F5F9;
    --ui-paper-line: #E7E5EE;
    --ui-paper-link: #6D1E9B;
    --ui-whatsapp: #128C7E;
    --ui-whatsapp-sombre: #25D366;

    /* Piste d'un contrôle éteint : premier neutre à 3:1 contre la carte — un
       interrupteur doit se voir sans être allumé (la console était sous 3:1). */
    --ui-track-off: #9793A0;

    /* ── Élévation ── */
    --ui-shadow: 0 4px 16px rgba(25, 22, 30, 0.08);
    --ui-shadow-sm: 0 1px 2px rgba(25, 22, 30, 0.08);
    --ui-shadow-overlay: 0 24px 64px rgba(25, 22, 30, 0.22);
    --ui-glow: 0 6px 16px rgba(109, 30, 155, 0.28);
    --ui-scrim: rgba(25, 22, 30, 0.40);
    --ui-focus-ring: 0 0 0 2px var(--ui-surface), 0 0 0 4px var(--ui-accent-fg);

    --ui-nav-count-on: rgba(255, 255, 255, 0.22);
    --ui-skeleton: #F4F2F8;

    /* ── Typographie ── */
    --ui-font-sans: 'Hanken Grotesk', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --ui-font-display: 'Sora', 'Hanken Grotesk', sans-serif;
    --ui-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

    /* ── Glyphes des contrôles natifs (une URL ne lit pas les variables CSS :
          une version par thème). Chevron = text-3, coche = on-accent. ── */
    --ui-glyph-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645E70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --ui-glyph-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    --ui-glyph-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}

html[data-refonte][data-theme="dark"] {
    color-scheme: dark;

    --ui-bg: #15131B;
    --ui-surface: #1E1A25;
    --ui-surface-2: #282331;
    --ui-border: #363042;
    --ui-text-1: #F1EFF5;
    --ui-text-2: #C3BFCE;
    --ui-text-3: #A49EB1;
    --ui-text-disabled: #6F697B;

    --ui-accent: #C088EB;
    --ui-accent-strong: #C999F0;          /* texte SOMBRE dessus : 8,15:1 */
    --ui-accent-strong-hover: #D6ADF7;
    --ui-accent-fg: #D0A6F3;
    --ui-accent-subtle: #342242;
    --ui-accent-border: #56396C;
    --ui-on-accent: #15131B;

    --ui-brand2: #FB9D59;
    --ui-brand2-fg: #FCB17E;
    --ui-brand2-bg: #3D2514;
    --ui-brand2-border: #6E401E;

    --ui-neutral-fg: #C3BFCE;   --ui-neutral-bg: #282331;   --ui-neutral-border: #363042;
    --ui-info-fg: #67C2D6;      --ui-info-bg: #1A2C33;      --ui-info-border: #2C4E59;
    --ui-progress-fg: #D0A6F3;  --ui-progress-bg: #342242;  --ui-progress-border: #56396C;
    --ui-success-fg: #6FCE93;   --ui-success-bg: #1B2E27;   --ui-success-border: #2C5140;
    --ui-warning-fg: #E5B85C;   --ui-warning-bg: #37301F;   --ui-warning-border: #5C4C25;
    --ui-danger-fg: #ED8484;    --ui-danger-bg: #33242C;    --ui-danger-border: #5A3440;

    --ui-track-off: #6A6773;

    --ui-shadow: 0 4px 16px rgba(0, 0, 0, 0.40);
    --ui-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --ui-shadow-overlay: 0 24px 64px rgba(0, 0, 0, 0.60);
    --ui-glow: 0 6px 16px rgba(201, 153, 240, 0.22);
    --ui-scrim: rgba(0, 0, 0, 0.60);

    --ui-nav-count-on: rgba(21, 19, 27, 0.16);
    --ui-skeleton: #363042;

    --ui-glyph-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A49EB1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --ui-glyph-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2315131B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    --ui-glyph-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2315131B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}
