/* =====================================================================
   Système de design · outil de l'agent IA
   Utilisé par TOUTES les pages (connexion, bureau, démonstration…).
   Polices : Lexend Deca (titres) + DM Sans (texte), chargées par Google Fonts.
   ===================================================================== */

:root {
  /* Couleurs */
  --fond: #FBF7F0;
  --surface: #FFFFFF;
  --surface-2: #F7F1E8;
  --texte: #1F1A17;
  --texte-2: #6B625B;
  --texte-3: #9A9088;
  --accent: #FF5C2A;
  --accent-fonce: #E8481A;
  --accent-pale: #FFEDE4;
  --jaune: #FFDB21;
  --jaune-pale: #FFF6CC;
  --vert: #2E9E6A;
  --vert-pale: #E2F3EA;
  --rouge: #D9443B;
  --rouge-pale: #FBE6E4;
  --bordure: #EDE6DC;
  --bordure-forte: #DDD3C6;
  --sapin: #2F4A3A;
  --or: #F2C14E;

  /* Formes */
  --rayon: 16px;
  --rayon-s: 12px;
  --rayon-xs: 8px;
  --ombre: 0 1px 2px rgba(31, 26, 23, .04), 0 8px 24px rgba(31, 26, 23, .06);
  --ombre-forte: 0 2px 6px rgba(31, 26, 23, .06), 0 18px 48px rgba(31, 26, 23, .16);
  --anneau: 0 0 0 3px rgba(255, 92, 42, .28);

  /* Typo */
  --police-titre: "Lexend Deca", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --transition: 150ms ease;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--police-titre); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; margin: 0; }
a { color: var(--accent-fonce); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--anneau); }
::selection { background: rgba(255, 219, 33, .55); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Carte ---------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 20px;
}
.carte-titre { font-size: 16px; margin-bottom: 4px; }
.carte-aide { color: var(--texte-2); font-size: 14px; margin: 0; }

/* ---------- Boutons « pilule » ---------- */
.bouton, .bouton-secondaire, .bouton-fantome {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.bouton { background: var(--accent); color: #fff; box-shadow: 0 2px 0 rgba(200, 60, 20, .25); }
.bouton:hover { background: var(--accent-fonce); }
.bouton:active { transform: translateY(1px); box-shadow: none; }
.bouton-secondaire { background: var(--surface); color: var(--texte); border-color: var(--bordure-forte); }
.bouton-secondaire:hover { border-color: var(--texte-3); background: var(--surface-2); }
.bouton-fantome { background: transparent; color: var(--texte-2); }
.bouton-fantome:hover { background: var(--surface-2); color: var(--texte); }
.bouton[disabled], .bouton-secondaire[disabled], .bouton-fantome[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.petit { min-height: 32px; padding: 0 13px; font-size: 13px; }
.bouton-danger { background: var(--surface); color: var(--rouge); border-color: #EFC3BF; }
.bouton-danger:hover { background: var(--rouge-pale); border-color: var(--rouge); }
.bouton-icone {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--texte-2);
  cursor: pointer; transition: background var(--transition), color var(--transition);
}
.bouton-icone:hover { background: var(--surface-2); color: var(--texte); }
.bouton-icone svg, .bouton svg, .bouton-secondaire svg, .bouton-fantome svg { width: 18px; height: 18px; flex: none; }

/* ---------- Pastilles d'état (point de couleur + texte) ---------- */
.pastille {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px 0 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--texte-2);
  font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--texte-3); flex: none; }
.pastille.ok { background: var(--vert-pale); color: #1F7A50; }
.pastille.ok::before { background: var(--vert); box-shadow: 0 0 0 3px rgba(46, 158, 106, .18); }
.pastille.attention { background: var(--jaune-pale); color: #7A5A00; }
.pastille.attention::before { background: #E8B400; }
.pastille.erreur { background: var(--rouge-pale); color: #A9302A; }
.pastille.erreur::before { background: var(--rouge); }
.pastille.travail { background: var(--accent-pale); color: #B8401A; }
.pastille.travail::before { background: var(--accent); animation: pastille-pulse 1.2s ease-in-out infinite; }
.pastille.neutre::before { background: var(--texte-3); }
button.pastille { cursor: pointer; }
button.pastille:hover { filter: brightness(.97); }
@keyframes pastille-pulse { 50% { transform: scale(.6); opacity: .5; } }

/* ---------- Champs ---------- */
.champ, .champ-texte {
  width: 100%; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--bordure-forte); border-radius: var(--rayon-s);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.champ:hover, .champ-texte:hover { border-color: var(--texte-3); }
.champ:focus, .champ-texte:focus { outline: none; border-color: var(--accent); box-shadow: var(--anneau); }
.champ-texte { resize: vertical; line-height: 1.55; }
.etiquette { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }

/* ---------- Onglets ---------- */
.onglets { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglet {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 15px; border-radius: 999px; border: 0;
  background: transparent; color: var(--texte-2); font-weight: 600; font-size: 14px; white-space: nowrap;
  cursor: pointer; transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.onglet:hover { color: var(--texte); }
.onglet[aria-selected="true"] { background: var(--surface); color: var(--texte); box-shadow: 0 1px 3px rgba(31, 26, 23, .12); }
.onglet svg { width: 17px; height: 17px; }

/* ---------- Fenêtre (modale) ---------- */
.fenetre {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: 0;
  border-radius: 20px; background: var(--surface); color: var(--texte); box-shadow: var(--ombre-forte);
}
.fenetre::backdrop { background: rgba(31, 26, 23, .38); backdrop-filter: blur(3px); }
.fenetre[open] { animation: fenetre-entree 180ms ease-out; }
.fenetre-corps { padding: 24px; }
.fenetre h2 { font-size: 19px; margin-bottom: 8px; }
.fenetre p { color: var(--texte-2); margin: 0 0 14px; }
.fenetre-boutons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
@keyframes fenetre-entree { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toast (message éphémère) ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 14px;
  background: var(--texte); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--ombre-forte); pointer-events: auto;
  animation: toast-entree 200ms ease-out;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--jaune); flex: none; }
.toast.ok::before { background: #5BD39A; }
.toast.erreur::before { background: #FF8A80; }
.toast.sortie { animation: toast-sortie 200ms ease-in forwards; }
@keyframes toast-entree { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-sortie { to { opacity: 0; transform: translateY(10px); } }

/* ---------- État vide ---------- */
.vide { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 32px 16px; color: var(--texte-2); }
.vide-illustration { width: 84px; height: 84px; }
.vide h3 { color: var(--texte); font-size: 18px; }
.vide p { margin: 0; max-width: 38ch; }

/* ---------- Squelette (chargement) ---------- */
.squelette {
  display: block; border-radius: var(--rayon-xs); min-height: 14px;
  background: linear-gradient(90deg, #F1EADF 0%, #F8F3EC 40%, #F1EADF 80%);
  background-size: 300% 100%; animation: squelette 1.3s linear infinite;
}
@keyframes squelette { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- Divers ---------- */
.tete-agent { display: block; flex: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }

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