/* Jetons et composants de base de l'application.

   Un seul jeu de variables pour toute l'app, sur :root. Le thème sombre les
   redéfinit deux fois, à l'identique : sous prefers-color-scheme (réglage du
   poste, sauf choix « clair » explicite) et sous [data-theme="dark"] (choix
   explicite, posé par le serveur ou theme.js). Aucune règle de composant ne
   porte de couleur en dur : c'est ce qui rend le sombre complet.

   Langage : fond minéral chaud, surfaces blanches, un seul accent (le citron
   de la marque), actions principales en vert profond. La gravité se dit par
   une pastille et un libellé, jamais par une bordure colorée. */

:root {
  color-scheme: light;
  --bg: #F1F4F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --surface-3: #E3E9E7;
  --line: #DCE3E1;
  --line-soft: #E8EDEB;
  --line-strong: #728480;
  --ink: #132024;
  --muted: #566669;
  --placeholder: #616F72;

  --rail: #1F2D35;
  --rail-ink: #ACBCC0;
  --rail-ink-strong: #E6EFEE;
  --rail-active: #2C3E47;
  --rail-avatar: #34474F;

  --accent: #86E3C4;
  --accent-ink: #12242A;
  --primary: #0E6B5C;
  --primary-hover: #0A5247;
  --primary-ink: #FFFFFF;
  --primary-soft: #E2F4EE;
  --link: #0E6B5C;
  --link-hover: #0A5247;

  --crit: #B42318;
  --crit-soft: #FDECEA;
  --warn: #9A5B00;
  --warn-ink: #7A4B00;
  --warn-soft: #FFF4D6;
  --ok: #1E7A4C;
  --ok-ink: #1E6B44;
  --ok-soft: #E5F4EC;
  --info: #2F5AA8;
  --info-soft: #E6EEFB;
  --neutral-soft: #EDF2F1;
  --neutral-ink: #34464B;

  --reads-bg: #E2F4EE;
  --reads-ink: #0E6B5C;
  --bubble-user: #0E6B5C;
  --bubble-user-ink: #FFFFFF;
  --bubble-ai: #F1F4F3;

  --focus: #0E6B5C;
  --scrim: rgba(13, 20, 23, .48);
  --shadow-1: 0 1px 2px rgba(19, 32, 36, .06);
  --shadow-2: 0 8px 24px rgba(19, 32, 36, .08);
  --shadow-pop: 0 18px 48px rgba(19, 32, 36, .18);

  /* Identité des agents : un monogramme sur une teinte douce. */
  --ag-p-bg: #86E3C4;   --ag-p-fg: #12242A;
  --ag-ca-bg: #E6EEFB;  --ag-ca-fg: #2F5AA8;
  --ag-ve-bg: #E5F4EC;  --ag-ve-fg: #1E7A4C;
  --ag-cl-bg: #F3E8FA;  --ag-cl-fg: #7A3E9D;
  --ag-ma-bg: #FDEDE3;  --ag-ma-fg: #B4501E;
  --ag-se-bg: #E8F3F6;  --ag-se-fg: #1F6B7A;
  --ag-te-bg: #FBE9E9;  --ag-te-fg: #A33A3A;
  --ag-de-bg: #EEEDF9;  --ag-de-fg: #4B47A6;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Anciens noms, encore lus par quelques feuilles de modules : ils pointent
     vers les jetons ci-dessus et suivent donc le thème. */
  --paper: var(--surface);
  --cream: var(--bg);
  --green: var(--ok);
  --orange: var(--warn);
  --red: var(--crit);

  --rail-w: 72px;
  --panel-w: 400px;
  --topbar-h: 68px;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0D1417;
    --surface: #152024;
    --surface-2: #11191C;
    --surface-3: #1C292E;
    --line: #24333A;
    --line-soft: #1C292E;
    --line-strong: #5F7A84;
    --ink: #E6EFEE;
    --muted: #94A7A8;
    --placeholder: #879A9C;
    --rail: #091013;
    --rail-ink: #94A7A8;
    --rail-ink-strong: #E6EFEE;
    --rail-active: #1A272C;
    --rail-avatar: #24333A;
    --primary: #86E3C4;
    --primary-hover: #A8EDD6;
    --primary-ink: #0F2226;
    --primary-soft: #133029;
    --link: #86E3C4;
    --link-hover: #A8EDD6;
    --crit: #F97066;
    --crit-soft: #3A1A17;
    --warn: #F5C35B;
    --warn-ink: #F5C35B;
    --warn-soft: #3A2E0F;
    --ok: #5FD18F;
    --ok-ink: #7FD6A2;
    --ok-soft: #15301F;
    --info: #9DB9F0;
    --info-soft: #1A2740;
    --neutral-soft: #1C292E;
    --neutral-ink: #B5C6C6;
    --reads-bg: #133029;
    --reads-ink: #9CEBD1;
    --bubble-user: #1A3530;
    --bubble-user-ink: #E6EFEE;
    --bubble-ai: #1C292E;
    --focus: #86E3C4;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-pop: 0 18px 48px rgba(0, 0, 0, .55);
    --ag-ca-bg: #1A2740;  --ag-ca-fg: #9DB9F0;
    --ag-ve-bg: #15301F;  --ag-ve-fg: #7FD6A2;
    --ag-cl-bg: #2D1D38;  --ag-cl-fg: #CFA3EA;
    --ag-ma-bg: #3B2518;  --ag-ma-fg: #F2A67C;
    --ag-se-bg: #15303A;  --ag-se-fg: #7CC7D6;
    --ag-te-bg: #3A1C1C;  --ag-te-fg: #F29B9B;
    --ag-de-bg: #23223F;  --ag-de-fg: #B1AEF0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1417;
  --surface: #152024;
  --surface-2: #11191C;
  --surface-3: #1C292E;
  --line: #24333A;
  --line-soft: #1C292E;
  --line-strong: #5F7A84;
  --ink: #E6EFEE;
  --muted: #94A7A8;
  --placeholder: #879A9C;
  --rail: #091013;
  --rail-ink: #94A7A8;
  --rail-ink-strong: #E6EFEE;
  --rail-active: #1A272C;
  --rail-avatar: #24333A;
  --primary: #86E3C4;
  --primary-hover: #A8EDD6;
  --primary-ink: #0F2226;
  --primary-soft: #133029;
  --link: #86E3C4;
  --link-hover: #A8EDD6;
  --crit: #F97066;
  --crit-soft: #3A1A17;
  --warn: #F5C35B;
  --warn-ink: #F5C35B;
  --warn-soft: #3A2E0F;
  --ok: #5FD18F;
  --ok-ink: #7FD6A2;
  --ok-soft: #15301F;
  --info: #9DB9F0;
  --info-soft: #1A2740;
  --neutral-soft: #1C292E;
  --neutral-ink: #B5C6C6;
  --reads-bg: #133029;
  --reads-ink: #9CEBD1;
  --bubble-user: #1A3530;
  --bubble-user-ink: #E6EFEE;
  --bubble-ai: #1C292E;
  --focus: #86E3C4;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-pop: 0 18px 48px rgba(0, 0, 0, .55);
  --ag-ca-bg: #1A2740;  --ag-ca-fg: #9DB9F0;
  --ag-ve-bg: #15301F;  --ag-ve-fg: #7FD6A2;
  --ag-cl-bg: #2D1D38;  --ag-cl-fg: #CFA3EA;
  --ag-ma-bg: #3B2518;  --ag-ma-fg: #F2A67C;
  --ag-se-bg: #15303A;  --ag-se-fg: #7CC7D6;
  --ag-te-bg: #3A1C1C;  --ag-te-fg: #F29B9B;
  --ag-de-bg: #23223F;  --ag-de-fg: #B1AEF0;
}

/* ------------------------------------------------- contrastes, mesurés

   Rapports calculés (WCAG 2.1, formule de luminance relative) par
   test-accessibilite.mjs, qui relit ces jetons et échoue sous 4,5:1 pour du
   texte courant et sous 3:1 pour un ÉLÉMENT D'INTERFACE (critère 1.4.11 :
   bordure d'un champ, d'un bouton secondaire, anneau de focalisation).
   Les valeurs ci-dessous sont celles de la colonne « après ».

   jeton sur fond                          rôle                        avant   après
   --------------------------------------  --------------------------  -----   -----
   CLAIR
   --ink sur --bg                          texte courant                15,06   15,06
   --ink sur --surface                     texte sur une carte          16,67   16,67
   --muted sur --surface                   texte secondaire              6,00    6,00
   --muted sur --bg                        texte secondaire              5,42    5,42
   --placeholder sur --surface             invite d'un champ             4,73    5,22   (#677679 → #616F72)
   --rail-ink sur --rail                   rail de navigation            5,75    7,21   (#94A9AE → #ACBCC0)
   --rail-ink-strong sur --rail            rail survolé                 12,08   12,08
   --accent sur --rail                     rail, entrée active           9,29    9,29
   --link sur --surface                    lien sur une carte            6,41    6,41
   --link sur --bg                         lien sur le fond              5,79    5,79
   --primary-ink sur --primary             bouton principal              6,41    6,41
   --accent-ink sur --accent               bouton accent                10,52   10,52
   --ok-ink sur --ok-soft                  pastille « terminé »          5,70    5,70
   --warn-ink sur --warn-soft              pastille « à surveiller »     6,76    6,76
   --crit sur --crit-soft                  pastille « critique »         5,75    5,75
   --info sur --info-soft                  pastille d'information        5,71    5,71
   --neutral-ink sur --neutral-soft        pastille neutre               8,75    8,75
   --crit / --warn / --ok sur --surface    gravité en texte         6,57/5,43/5,33 (inchangé)
   --reads-ink sur --reads-bg              compteur de lectures          5,62    5,62
   --bubble-user-ink sur --bubble-user     bulle du client               6,41    6,41
   --bg sur --ink                          toast                        15,06   15,06
   libellé d'un bouton désactivé           voir ci-dessous               3,09    4,88

   SOMBRE
   --ink sur --bg                          texte courant                15,89   15,89
   --ink sur --surface                     texte sur une carte          14,20   14,20
   --muted sur --surface                   texte secondaire              6,61    6,61
   --placeholder sur --surface             invite d'un champ             5,64    5,64
   --rail-ink sur --rail                   rail de navigation            7,63    7,63   (déjà au-dessus d'AAA)
   --rail-ink-strong sur --rail            rail survolé                 16,39   16,39
   --link sur --surface                    lien sur une carte           10,92   10,92
   --primary-ink sur --primary             bouton principal             10,80   10,80
   --ok-ink / --warn-ink / --crit          pastilles              8,17/8,14/5,62 (inchangé)
   --info sur --info-soft                  pastille d'information        7,55    7,55
   --neutral-ink sur --neutral-soft        pastille neutre               8,43    8,43
   --reads-ink sur --reads-bg              compteur de lectures         10,26   10,26
   libellé d'un bouton désactivé           voir ci-dessous               3,28    5,94

   Ce que la mesure a démenti : le rail n'était pas à 3,6:1 mais à 5,75:1 —
   au-dessus du seuil AA depuis le changement de palette. Il est tout de même
   remonté à 7,21:1 (AAA), parce qu'il porte du texte de 12 px.

   Les bordures, remontées au-dessus de 3:1 (25/09/2026). Elles étaient à
   1,50:1 en clair et 1,58:1 en sombre : sous les 3:1 que le critère 1.4.11
   demande à un élément d'interface, donc un champ dont on ne voyait pas le
   contour. Seul --line-strong a changé de valeur — la teinte, pas le dessin :
   le gris minéral de la charte, descendu (clair) et monté (sombre) jusqu'à
   franchir le seuil sur les QUATRE fonds sur lesquels un contrôle se pose.
   --line et --line-soft, qui ne portent que des séparations et le bord des
   cartes, n'ont pas bougé : une séparation décorative n'est pas un élément
   d'interface. En revanche les contrôles qui étaient restés sur --line — puces
   de suggestion, filtres du journal, bascules de ligne, la zone de saisie
   d'une création, les boutons d'historique marketing, les icônes du tableau de
   bord — sont passés sur --line-strong : c'est leur contour qui les identifie.

   jeton sur fond                          rôle                        avant   après
   --------------------------------------  --------------------------  -----   -----
   CLAIR (--line-strong : #CBD5D2 → #728480)
   --line-strong sur --surface             bordure d'un champ            1,50    3,94
   --line-strong sur --bg                  champ posé sur le fond        1,36    3,56
   --line-strong sur --surface-2           champ sur une surface douce   1,42    3,73
   --line-strong sur --surface-3           contrôle désactivé            1,22    3,21
   --muted sur --surface                   bordure survolée              6,00    6,00
   --focus sur --surface                   anneau de focalisation        6,41    6,41
   --focus sur --bg                        anneau sur le fond            5,79    5,79
   --crit sur --surface                    bordure d'un bouton qui détruit 6,57  6,57
   --primary sur --surface                 bordure d'une proposition     6,41    6,41

   SOMBRE (--line-strong : #2F424A → #5F7A84)
   --line-strong sur --surface             bordure d'un champ            1,58    3,64
   --line-strong sur --bg                  champ posé sur le fond        1,77    4,08
   --line-strong sur --surface-2           champ sur une surface douce   1,69    3,90
   --line-strong sur --surface-3           contrôle désactivé            1,42    3,27
   --muted sur --surface                   bordure survolée              6,61    6,61
   --focus sur --surface                   anneau de focalisation       10,92   10,92
   --focus sur --bg                        anneau sur le fond           12,22   12,22
   --crit sur --surface                    bordure d'un bouton qui détruit 5,96  5,96
   --primary sur --surface                 bordure d'une proposition    10,92   10,92

   Ce qui reste volontairement sous le seuil : le fond menthe de --accent
   (1,52:1 sur --surface). Ce n'est pas une bordure mais un aplat, et ce qui
   identifie le bouton qu'il remplit est son libellé, à 10,52:1. Le corriger
   reviendrait à changer la couleur de la marque. */

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
img, svg { max-width: 100%; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Beaucoup de blocs reçoivent un display explicite : sans cette règle,
   l'attribut hidden y serait sans effet. */
[hidden] { display: none !important; }
::placeholder { color: var(--placeholder); opacity: 1; }
::selection { background: var(--accent); color: var(--accent-ink); }
code, kbd, pre, samp, .mono { font-family: var(--font-mono); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
table { border-collapse: collapse; }

.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: fixed; left: 12px; top: -80px; z-index: 3000; padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-ink);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

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

/* ------------------------------------------------------------- boutons */

.btn, .primary, .secondary, .btn-accent, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm);
  font: 600 14px/1.2 var(--font); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s;
}
.primary { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--primary-ink); }
.secondary, .btn { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.secondary:hover:not(:disabled), .btn:hover:not(:disabled) { border-color: var(--muted); }
.btn-accent { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-accent:hover { background: #D8FF9F; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: var(--surface-3); }
/* Désactivé : un gris franc plutôt qu'une transparence. À opacity .55, le
   libellé d'un bouton principal tombait à 3,09:1 — lisible pour personne, et
   la désactivation ne se lisait qu'à la pâleur. Ici le libellé garde 4,88:1
   (clair) et 5,94:1 (sombre), et le fond neutre dit l'indisponibilité. */
.primary:disabled, .secondary:disabled, .btn:disabled, .btn-ghost:disabled, .btn-accent:disabled, .mini-btn:disabled {
  background: var(--surface-3); color: var(--muted); border-color: var(--line-strong); opacity: 1;
}
.btn-danger { color: var(--crit); }
/* Cibles tactiles : 44 px à toutes les largeurs, pas seulement sur téléphone.
   Ces boutons portent des actions de plein droit — « Préparer le lot de meta
   descriptions », « Demander à l'agent », les gestes d'un constat — et une
   souris imprécise ou une main qui tremble ne vise pas mieux sur un écran
   large que sur un petit. Le texte reste à sa taille : c'est la zone
   cliquable qui grandit, par min-height et par un peu de marge intérieure. */
.link, .link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0;
  border: 0; background: none; color: var(--link); font: 700 13px/1.3 var(--font); cursor: pointer; text-align: left;
}
.link:hover, .link-btn:hover { color: var(--link-hover); text-decoration: underline; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface);
  color: var(--ink); font: 600 13px/1.2 var(--font);
}
.mini-btn:hover:not(:disabled) { border-color: var(--muted); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
[aria-busy="true"] { cursor: progress; }

/* Contrôle segmenté : Observer / Planifier / Exécuter, tailles, thème. */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--radius); background: var(--surface-3); }
.seg button {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: 600 13px/1.2 var(--font);
}
/* Le contrôle sert de groupe de boutons (aria-pressed) et de barre d'onglets
   (aria-selected, declinaisons.js) : les deux états se peignent pareil. */
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-1); }
.seg button:hover:not([aria-pressed="true"]):not([aria-selected="true"]) { color: var(--ink); }

/* -------------------------------------------------------------- surfaces */

.panel, .card {
  min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head > div { min-width: 0; }
.panel h2, .card h2 { font-size: 16px; font-weight: 700; }
.eyebrow, .section-title {
  margin: 0 0 6px; font: 700 12px/1.4 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.muted, .table-note, .chart-note { color: var(--muted); }
.table-note { font-size: 13px; margin-top: 4px; }
.accent { display: none; } /* ancien point décoratif des titres */
.empty-state { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }

/* Pastilles : état, gravité, étiquettes. */
.tag, .pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px;
  background: var(--neutral-soft); color: var(--neutral-ink); font: 700 12px/1.25 var(--font); white-space: nowrap;
}
.tag.green, .pill-ok { background: var(--ok-soft); color: var(--ok-ink); }
.tag.orange, .pill-warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag.red, .pill-crit { background: var(--crit-soft); color: var(--crit); }
.tag.blue, .pill-info { background: var(--info-soft); color: var(--info); }
.sev { display: inline-flex; align-items: center; gap: 8px; font: 700 12px/1.3 var(--font); letter-spacing: .04em; text-transform: uppercase; }
.sev::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sev-critique, .sev-critical { color: var(--crit); }
.sev-important, .sev-warning { color: var(--warn); }
.sev-mineur, .sev-minor { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-crit { background: var(--crit); }

/* Étiquette d'environnement : jamais décorative, toujours lisible. */
.env-badge {
  display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 6px;
  font: 700 12px/1.2 var(--font); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
.env-badge[data-env="production"] { background: var(--crit-soft); color: var(--crit); }
.env-badge[data-env="preproduction"] { background: var(--warn-soft); color: var(--warn-ink); }

/* Monogramme d'agent. */
.mono-badge {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm);
  font: 700 15px/1 var(--font-display); background: var(--neutral-soft); color: var(--neutral-ink);
}
.mono-badge.sm { width: 28px; height: 28px; border-radius: var(--radius-xs); font-size: 12px; }
.mono-badge.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 17px; }
.mono-badge[data-agent-key="copilot"] { background: var(--ag-p-bg); color: var(--ag-p-fg); letter-spacing: -0.03em; }
.mono-badge[data-agent-key="catalog"] { background: var(--ag-ca-bg); color: var(--ag-ca-fg); }
.mono-badge[data-agent-key="sales"] { background: var(--ag-ve-bg); color: var(--ag-ve-fg); }
.mono-badge[data-agent-key="customers"] { background: var(--ag-cl-bg); color: var(--ag-cl-fg); }
.mono-badge[data-agent-key="marketing"] { background: var(--ag-ma-bg); color: var(--ag-ma-fg); }
.mono-badge[data-agent-key="seo"] { background: var(--ag-se-bg); color: var(--ag-se-fg); }
.mono-badge[data-agent-key="technical"] { background: var(--ag-te-bg); color: var(--ag-te-fg); }
.mono-badge[data-agent-key="dev"] { background: var(--ag-de-bg); color: var(--ag-de-fg); }

/* --------------------------------------------------------------- champs */

input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input:not([type]), select, textarea {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 14px; max-width: 100%;
}
textarea { line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); }
label { color: var(--ink); }
/* Une case se vise par son libellé : c'est la rangée entière qui est la cible,
   et elle fait 44 px comme les autres. */
label.check, label.risk-accept, label.creation-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }

/* -------------------------------------------------------------- tableaux */

.table-panel { overflow-x: auto; }
.table-panel table, .data-table { width: 100%; font-size: 14px; }
.table-panel th, .data-table th {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left;
  font: 700 12px/1.3 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.table-panel td, .data-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table-panel tr:last-child td { border-bottom: 0; }
.table-panel td small { display: block; color: var(--muted); font-size: 12px; }
.num, .table-panel td:nth-child(2) { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- dialogues */

dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: var(--scrim); }
dialog h2 { font: 700 20px/1.3 var(--font-display); letter-spacing: -.01em; margin-bottom: 8px; }
dialog p { color: var(--muted); line-height: 1.55; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head .close, dialog .close:not(.secondary):not(.primary) {
  width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 22px;
}
.modal-head .close:hover { background: var(--surface-3); color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.notice { margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.55; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--bg); font-size: 14px; line-height: 1.45; box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, transform .2s, visibility .2s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- chargement */

.typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: typing 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* Ce qui détruit se voit. Un bouton « Supprimer » ne doit pas ressembler à un
   bouton « Modifier » : il porte la couleur des choses critiques, sans crier —
   le texte en `--crit` sur le fond ordinaire (5,62:1 en clair, 5,43:1 en
   sombre), une bordure de la même teinte, et un fond qui ne s'allume qu'au
   survol. Le poids de la décision est porté par l'écran d'approbation, pas par
   la couleur d'un bouton. */
.danger, .mini-btn.danger {
  border: 1px solid var(--crit); background: var(--surface); color: var(--crit);
}
.danger:hover:not(:disabled), .mini-btn.danger:hover:not(:disabled) {
  background: var(--crit-soft); border-color: var(--crit);
}
button.danger {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-xs); font: 600 13px/1.2 var(--font); cursor: pointer;
}
