/* TOUTI — design tokens, palettes et modes d'affichage. GÉNÉRÉ par scripts/gen-touti-themes.py — ne pas éditer à la main.
 * Jetons sémantiques --touti-* ; alias de compatibilité (--navy, --gold, --beige, --bg, --white, --gray, --lgray, --green, --red, --amber) pour que le CSS historique suive sans réécriture.
 * Attributs : data-theme (palette) et data-mode (light|dark) sur <html> (ou sur un élément d'aperçu). Le mode sombre est un VRAI jeu de jetons (aucun filter/invert). */

:root,[data-theme]{
  --touti-success:#2a6b4a; --touti-warning:#c97a15; --touti-danger:#8b2a2a; --touti-info:#2a5f8f;
  --touti-on-status:#ffffff;
  --touti-presence-online:#2e9d5b; --touti-presence-busy:#e08a14; --touti-presence-dnd:#c0392b; --touti-presence-offline:#8a90a2; --touti-presence-long-absence:#9c8b78;
  --touti-text-muted:#5c6475; --touti-warning-text:#8a4f00; --touti-shadow:0 2px 12px rgba(13,31,60,.10); --touti-shadow-lg:0 8px 32px rgba(13,31,60,.18);
  color-scheme:light;
}

[data-theme="afriway-classic"]{
  --touti-chrome:#0d1f3c; --touti-chrome-2:#152849; --touti-chrome-3:#1c3260;
  --touti-primary:#0d1f3c; --touti-primary-contrast:#fafaf8; --touti-ink:#0d1f3c;
  --touti-accent:#b8952a; --touti-accent-2:#dfc070; --touti-accent-3:#f5e4a8; --touti-accent-contrast:#16120a;
  --touti-background:#ede9e0; --touti-surface:#fafaf8; --touti-surface-alt:#f4f1eb; --touti-text:#0d1f3c; --touti-border:#d8d3c8;
}

[data-theme="blue"]{
  --touti-chrome:#0b3a6e; --touti-chrome-2:#114d8f; --touti-chrome-3:#1a5fa8;
  --touti-primary:#0b3a6e; --touti-primary-contrast:#fbfcfe; --touti-ink:#0b3a6e;
  --touti-accent:#1e6fc4; --touti-accent-2:#64b5f6; --touti-accent-3:#bbdefb; --touti-accent-contrast:#ffffff;
  --touti-background:#e8eef5; --touti-surface:#fbfcfe; --touti-surface-alt:#f1f5fa; --touti-text:#0b3a6e; --touti-border:#cfd9e6;
}

[data-theme="green"]{
  --touti-chrome:#0f3d2e; --touti-chrome-2:#165a43; --touti-chrome-3:#1d7456;
  --touti-primary:#0f3d2e; --touti-primary-contrast:#fafdfb; --touti-ink:#0f3d2e;
  --touti-accent:#2e8f62; --touti-accent-2:#6fcf9a; --touti-accent-3:#c9efd9; --touti-accent-contrast:#16120a;
  --touti-background:#e6efe9; --touti-surface:#fafdfb; --touti-surface-alt:#f0f6f2; --touti-text:#0f3d2e; --touti-border:#cfdcd3;
}

[data-theme="violet"]{
  --touti-chrome:#2e1a5e; --touti-chrome-2:#43297f; --touti-chrome-3:#583a9c;
  --touti-primary:#2e1a5e; --touti-primary-contrast:#fcfbfe; --touti-ink:#2e1a5e;
  --touti-accent:#7e4fd0; --touti-accent-2:#b794f0; --touti-accent-3:#e2d4fa; --touti-accent-contrast:#ffffff;
  --touti-background:#ece8f4; --touti-surface:#fcfbfe; --touti-surface-alt:#f4f1f9; --touti-text:#2e1a5e; --touti-border:#d9d2e6;
}

[data-theme="bordeaux"]{
  --touti-chrome:#4a0f1f; --touti-chrome-2:#6b1a2e; --touti-chrome-3:#862440;
  --touti-primary:#4a0f1f; --touti-primary-contrast:#fdfafa; --touti-ink:#4a0f1f;
  --touti-accent:#b5485d; --touti-accent-2:#e07a8c; --touti-accent-3:#f5c9d1; --touti-accent-contrast:#ffffff;
  --touti-background:#f1e8e8; --touti-surface:#fdfafa; --touti-surface-alt:#f7f0f0; --touti-text:#4a0f1f; --touti-border:#e2d3d3;
}

[data-theme="graphite"]{
  --touti-chrome:#1f2430; --touti-chrome-2:#2b3140; --touti-chrome-3:#383f52;
  --touti-primary:#1f2430; --touti-primary-contrast:#fbfbfc; --touti-ink:#1f2430;
  --touti-accent:#5a6a88; --touti-accent-2:#a9b6cc; --touti-accent-3:#dbe2ee; --touti-accent-contrast:#ffffff;
  --touti-background:#e9ebee; --touti-surface:#fbfbfc; --touti-surface-alt:#f2f3f5; --touti-text:#1f2430; --touti-border:#d3d6dc;
}

[data-theme="sand"]{
  --touti-chrome:#5a4630; --touti-chrome-2:#735b3f; --touti-chrome-3:#8c704d;
  --touti-primary:#5a4630; --touti-primary-contrast:#fffdf9; --touti-ink:#5a4630;
  --touti-accent:#b07a2e; --touti-accent-2:#deb571; --touti-accent-3:#f3dfb8; --touti-accent-contrast:#16120a;
  --touti-background:#f3ece0; --touti-surface:#fffdf9; --touti-surface-alt:#f9f4ea; --touti-text:#5a4630; --touti-border:#e4d9c4;
}

[data-mode="dark"][data-theme="afriway-classic"]{
  --touti-chrome:#0b0e14; --touti-chrome-2:#121620; --touti-chrome-3:#121620;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#11141b; --touti-ink:#e6e9f2;
  --touti-accent:#d4b04a; --touti-accent-2:#d4b04a; --touti-accent-3:#202533; --touti-accent-contrast:#16120a;
  --touti-background:#11141b; --touti-surface:#181c26; --touti-surface-alt:#202533; --touti-text:#e6e9f2; --touti-border:#2d3445;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="blue"]{
  --touti-chrome:#08101a; --touti-chrome-2:#0f1b2b; --touti-chrome-3:#0f1b2b;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#0d1520; --touti-ink:#e6e9f2;
  --touti-accent:#5aa9ee; --touti-accent-2:#5aa9ee; --touti-accent-3:#1b2a3e; --touti-accent-contrast:#16120a;
  --touti-background:#0d1520; --touti-surface:#142030; --touti-surface-alt:#1b2a3e; --touti-text:#e6e9f2; --touti-border:#263a54;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="green"]{
  --touti-chrome:#08120f; --touti-chrome-2:#0f1d18; --touti-chrome-3:#0f1d18;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#0e1815; --touti-ink:#e6e9f2;
  --touti-accent:#4fc08a; --touti-accent-2:#4fc08a; --touti-accent-3:#1c2f28; --touti-accent-contrast:#16120a;
  --touti-background:#0e1815; --touti-surface:#15231e; --touti-surface-alt:#1c2f28; --touti-text:#e6e9f2; --touti-border:#2a4237;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="violet"]{
  --touti-chrome:#0e0a18; --touti-chrome-2:#171227; --touti-chrome-3:#171227;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#15111f; --touti-ink:#e6e9f2;
  --touti-accent:#a98af0; --touti-accent-2:#a98af0; --touti-accent-3:#261f3f; --touti-accent-contrast:#16120a;
  --touti-background:#15111f; --touti-surface:#1d1830; --touti-surface-alt:#261f3f; --touti-text:#e6e9f2; --touti-border:#382f58;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="bordeaux"]{
  --touti-chrome:#12080b; --touti-chrome-2:#1d0d13; --touti-chrome-3:#1d0d13;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#1a1013; --touti-ink:#e6e9f2;
  --touti-accent:#e07388; --touti-accent-2:#e07388; --touti-accent-3:#2f1e2a; --touti-accent-contrast:#16120a;
  --touti-background:#1a1013; --touti-surface:#251720; --touti-surface-alt:#2f1e2a; --touti-text:#e6e9f2; --touti-border:#4a2b33;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="graphite"]{
  --touti-chrome:#0c0e11; --touti-chrome-2:#14171b; --touti-chrome-3:#14171b;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#111316; --touti-ink:#e6e9f2;
  --touti-accent:#9fb0cc; --touti-accent-2:#9fb0cc; --touti-accent-3:#21252c; --touti-accent-contrast:#16120a;
  --touti-background:#111316; --touti-surface:#191c21; --touti-surface-alt:#21252c; --touti-text:#e6e9f2; --touti-border:#313640;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

[data-mode="dark"][data-theme="sand"]{
  --touti-chrome:#100c07; --touti-chrome-2:#19130b; --touti-chrome-3:#19130b;
  --touti-primary:#e6e9f2; --touti-primary-contrast:#17130d; --touti-ink:#e6e9f2;
  --touti-accent:#dcae62; --touti-accent-2:#dcae62; --touti-accent-3:#2a2218; --touti-accent-contrast:#16120a;
  --touti-background:#17130d; --touti-surface:#211b12; --touti-surface-alt:#2a2218; --touti-text:#e6e9f2; --touti-border:#3d3323;
  --touti-text-muted:#9aa4b8; --touti-warning-text:#e0a040; --touti-success:#4cae7c; --touti-warning:#e0a040; --touti-danger:#e5736f; --touti-info:#6aa8e0;
  --touti-presence-offline:#8791a5; --touti-presence-long-absence:#a89a88;
  --touti-shadow:0 2px 12px rgba(0,0,0,.45); --touti-shadow-lg:0 8px 32px rgba(0,0,0,.6); color-scheme:dark;
}

/* Alias de compatibilité : l'ancien code lit --navy / --gold… ; ils suivent maintenant la palette ET le mode. (html:root + [data-theme] : aussi valable pour les cartes d'aperçu) */
html:root,[data-theme]{
  --navy:var(--touti-ink); --navy2:var(--touti-chrome-2); --navy3:var(--touti-chrome-3);
  --gold:var(--touti-accent); --gold2:var(--touti-accent-2); --gold3:var(--touti-accent-3);
  --beige:var(--touti-surface-alt); --bg:var(--touti-background); --white:var(--touti-surface);
  --green:var(--touti-success); --red:var(--touti-danger); --amber:var(--touti-warning);
  --gray:var(--touti-text-muted); --lgray:var(--touti-border); --shadow:var(--touti-shadow); --shadow-lg:var(--touti-shadow-lg);
}
html:root[data-theme]{ background:var(--touti-background); }

/* Coquille TOUTI (barre du haut, brand, barre latérale) : fond « chrome » de la palette — identique à l'actuel en Classic clair ; en sombre, chrome sombre (le texte, lui, suit --navy). */
html[data-theme] #topbar{ background:var(--touti-chrome); }
html[data-theme] #topbar .tb-brand, html[data-theme] #sidebar{ background:var(--touti-chrome-2); }
html[data-theme] .btn-navy, html[data-theme] .ai-msg.user{ background:var(--touti-primary); color:var(--touti-primary-contrast); }
html[data-theme] .btn-navy:hover{ background:var(--touti-chrome-2); color:#fff; }
html[data-theme] .btn-gold{ background:var(--touti-accent); color:var(--touti-accent-contrast); }
html[data-theme] .btn-gold:hover{ background:var(--touti-accent-2); }
html[data-theme] .modal-header{ background:var(--touti-chrome); }
html[data-theme] .tb-avatar, html[data-theme] #user-avatar{ color:var(--touti-chrome); }
/* Surfaces génériques et champs (modales, cartes, tableaux, formulaires) — mode sombre inclus */
html[data-mode="dark"] body{ background:var(--touti-background); color:var(--touti-text); }
html[data-mode="dark"] .card, html[data-mode="dark"] .modal, html[data-mode="dark"] .kpi, html[data-mode="dark"] .tbl-wrap, html[data-mode="dark"] table{ background:var(--touti-surface); color:var(--touti-text); border-color:var(--touti-border); }
html[data-mode="dark"] th{ background:var(--touti-surface-alt); color:var(--touti-text-muted); border-color:var(--touti-border); }
html[data-mode="dark"] td{ border-color:var(--touti-border); }
html[data-mode="dark"] input, html[data-mode="dark"] select, html[data-mode="dark"] textarea{ background:var(--touti-surface-alt); color:var(--touti-text); border-color:var(--touti-border); }
html[data-mode="dark"] input::placeholder, html[data-mode="dark"] textarea::placeholder{ color:var(--touti-text-muted); }
html[data-mode="dark"] .btn-outline{ color:var(--touti-text); border-color:var(--touti-border); background:transparent; }

html[data-mode="dark"] #user-menu, html[data-mode="dark"] #lang-menu{ background:var(--touti-surface); color:var(--touti-text); border-color:var(--touti-border); }
html[data-mode="dark"] #user-menu div{ color:var(--touti-text); }
html[data-mode="dark"] ::-webkit-scrollbar-thumb{ background:var(--touti-border); }
/* Pastilles / badges : fond et texte accordés (AA) en clair comme en sombre */
html[data-theme] .badge-amber{ color:var(--touti-warning-text); }
html[data-mode="dark"] .badge-green{ background:rgba(76,174,124,.12); color:var(--touti-success); }
html[data-mode="dark"] .badge-red{ background:rgba(229,115,111,.12); color:var(--touti-danger); }
html[data-mode="dark"] .badge-amber{ background:rgba(224,160,64,.12); }
html[data-mode="dark"] .badge-gold{ background:rgba(255,255,255,.1); color:var(--touti-accent); }
html[data-mode="dark"] .badge-navy{ background:rgba(255,255,255,.12); color:var(--touti-text); }
/* Pastille de présence des avatars Baro (le vert historique reste pour « en ligne ») */
.ch-dot.busy{background:var(--touti-presence-busy)!important}.ch-dot.dnd{background:var(--touti-presence-dnd)!important}.ch-dot.idle{background:var(--touti-presence-offline)!important}
/* Pastilles de présence (couleur + symbole + texte accessible) */
.touti-pres{display:inline-flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:700;line-height:1}
.touti-pres-online{color:var(--touti-presence-online)} .touti-pres-busy{color:var(--touti-presence-busy)} .touti-pres-dnd{color:var(--touti-presence-dnd)}
.touti-pres-offline{color:var(--touti-presence-offline)} .touti-pres-long-absence{color:var(--touti-presence-long-absence)}
.touti-pres-t{color:var(--touti-text)}
.touti-pres-meeting{color:var(--touti-presence-busy)} .touti-pres-idle{color:var(--touti-text-muted)}
/* Police d'écriture personnelle (identifiant contrôlé sur <html data-font>) : indépendante de la palette et du mode */
@font-face{font-family:'Inter';src:url('/assets/fonts/InterVariable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
:root,[data-font="default"]{--touti-font-family:'Montserrat',sans-serif}
[data-font="inter"]{--touti-font-family:'Inter','Helvetica Neue',Arial,sans-serif}
[data-font="system"]{--touti-font-family:system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif}
[data-font="helvetica"]{--touti-font-family:'Helvetica Neue',Helvetica,Arial,sans-serif}
[data-font="verdana"]{--touti-font-family:Verdana,Geneva,'DejaVu Sans',sans-serif}
/* Un seul point d'application : les modules historiques codent encore font-family:Montserrat en dur (dashboard, WhatsApp, N'wele…) ; seule la police CHOISIE les remplace. Code et icônes exclus. */
html[data-font]:not([data-font="default"]) body, html[data-font]:not([data-font="default"]) body *:not(code):not(pre):not(kbd):not(samp):not(.fa):not([class*="material-"]):not(svg):not(svg *):not(.tset-font):not(.tset-font *){font-family:var(--touti-font-family)!important}
.tset-font,.tset-font *{font-family:var(--touti-font-family)}
/* Focus clavier visible partout */
html[data-theme] :focus-visible{ outline:2px solid var(--touti-accent); outline-offset:2px; }

