/* ═══════════════════════════════════════════════════════════════════════════
   Eutarcus LaunchPAD — Design System
   ───────────────────────────────────────────────────────────────────────────
   Source unique de vérité pour les tokens et les composants partagés.
   Chargé avant le <style> de chaque page. Toute règle dupliquée dans une
   page doit être supprimée, pas surchargée.

   Direction : régie de diffusion. Deux registres typographiques stricts —
   la sans porte la prose destinée à l'opérateur, la mono porte la vérité
   machine (identifiants n8n, webhooks, durées, décomptes). L'or est réservé
   à trois usages : l'écran actif, l'action primaire, l'état « en cours ».
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Fonds & surfaces ─────────────────────────────────────────────────── */
  --bg:            #0b0d12;
  --panel:         #131722;
  --panel-2:       #1a1f2d;
  --panel-3:       #232939;
  --panel-hover:   rgba(255, 255, 255, 0.035);

  /* ── Traits ───────────────────────────────────────────────────────────── */
  --line:          #2a3145;
  --line-subtle:   #1d2231;
  --line-strong:   #3a4360;

  /* ── Texte ────────────────────────────────────────────────────────────── */
  --txt:           #e8ecf5;
  --txt-dim:       #b6c0d4;
  --muted:         #98a2b8;
  --muted-deep:    #7b86a1;

  /* ── Marque : or. Écran actif, action primaire, état en cours. ────────── */
  --accent:        #d4af37;
  --accent-hi:     #e6c65c;
  --accent-lo:     #8f7524;
  --accent-glow:   rgba(212, 175, 55, 0.14);
  --accent-line:   rgba(212, 175, 55, 0.32);

  /* ── États. Le warn vire à l'orange : l'ambre d'origine (#fbbf24) était
        à 8° de teinte de l'or de marque, les deux se confondaient. ──────── */
  --ok:            #34d399;
  --ok-glow:       rgba(52, 211, 153, 0.12);
  --run:           #60a5fa;
  --run-glow:      rgba(96, 165, 250, 0.14);
  --warn:          #fb923c;
  --warn-glow:     rgba(251, 146, 60, 0.13);
  --err:           #f87171;
  --err-glow:      rgba(248, 113, 113, 0.13);
  --idle:          #6d7791;

  /* ── Typographie ──────────────────────────────────────────────────────── */
  --font-ui:   ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono",
               Menlo, Consolas, "Liberation Mono", monospace;

  --fs-micro:  11px;
  --fs-xs:     12px;
  --fs-sm:     13px;
  --fs-base:   14px;
  --fs-md:     15px;
  --fs-lg:     18px;
  --fs-xl:     22px;
  --fs-2xl:    28px;

  --lh-tight:  1.25;
  --lh-base:   1.55;

  /* ── Espacement, rayons, ombres ───────────────────────────────────────── */
  --sp-1: 4px;   --sp-2: 6px;   --sp-3: 8px;   --sp-4: 12px;
  --sp-5: 16px;  --sp-6: 20px;  --sp-7: 24px;  --sp-8: 32px;
  --sp-9: 40px;  --sp-10: 48px;

  --r-sm: 6px;   --r-md: 10px;  --r-lg: 14px;  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-2: 0 4px 14px rgba(0, 0, 0, 0.28);
  --sh-3: 0 12px 34px rgba(0, 0, 0, 0.42);

  /* ── Coquille ─────────────────────────────────────────────────────────── */
  --rail-w:      212px;
  --content-max: 1600px;

  --t-fast: .12s ease;
  --t-base: .18s ease;

  /* ── Alias hérités. Les pages historiques les utilisent encore ; ils
        pointent vers les tokens canoniques pour que la dérive cesse.
        Ne pas en ajouter, et retirer au fur et à mesure des reprises. ───── */
  --text:     var(--txt);
  --border:   var(--line);
  --bd:       var(--line);
  --bg-card:  var(--panel);
  --panel-subtle: var(--panel-2);
  --gold:      var(--accent);
  --gold-glow: var(--accent-glow);
  --green:     var(--ok);
  --green-glow: var(--ok-glow);
  --cyan:      var(--run);
  --cyan-glow: var(--run-glow);
  --purple:    #bc8cff;
  --purple-glow: rgba(188, 140, 255, 0.13);
  --orange:    var(--warn);
  --orange-glow: var(--warn-glow);

  /* Ces trois-là n'ont jamais été définies nulle part : les pages les
     appelaient déjà dans le vide. --accent-subtle n'avait même pas de
     valeur de repli, son bouton s'affichait donc sans fond. */
  --danger:        var(--err);
  --accent-subtle: var(--accent-glow);
  --bg2:           var(--bg);

  font-family: var(--font-ui);
  color-scheme: dark;
}

/* ═══ Base ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-left: var(--rail-w);
  max-width: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video, canvas { max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: var(--lh-tight); margin: 0; font-weight: 650; }
h1 { font-size: var(--fs-lg); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-md); letter-spacing: -0.005em; }
h3 { font-size: var(--fs-base); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }

::selection { background: var(--accent-glow); color: var(--txt); }

/* Focus visible partout, sans anneau au clic souris. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ═══ Barres de défilement ═══════════════════════════════════════════════ */

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: var(--r-pill);
  border: 3px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted-deep); }

/* ═══ Registre machine ═══════════════════════════════════════════════════
   Tout ce qui est vérité machine — identifiant n8n, chemin de webhook,
   durée, décompte — se compose en mono. La distinction est structurelle :
   elle dit au lecteur « ceci vient du système, pas de nous ».            */

.mono, .tech, .tech-chip, .wf-id, .duration, .count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.tech-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 2px var(--sp-2);
  font-size: var(--fs-micro);
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-sm);
}

/* ═══ Coquille : rail de navigation ══════════════════════════════════════
   Le rail est fixe et hors flux : il s'installe sur toutes les pages sans
   modifier leur markup. Les destinations sont groupées par rôle dans la
   chaîne éditoriale, parce que huit onglets à plat n'apprennent rien sur
   l'ordre des opérations.                                                */

.rail {
  position: fixed; inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rail-brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--line-subtle);
  flex: none;
}
.rail-brand-mark {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  font-size: 15px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-lo) 100%);
  color: #1a1405;
  border-radius: var(--r-sm);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
.rail-brand-name {
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: .02em;
  color: var(--txt); line-height: 1.2;
}
.rail-brand-sub {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--muted-deep);
  letter-spacing: .06em; text-transform: uppercase;
}

.rail-nav { flex: 1; padding: var(--sp-4) var(--sp-3) var(--sp-5); }

.rail-group + .rail-group { margin-top: var(--sp-5); }
.rail-group-label {
  padding: 0 var(--sp-3) var(--sp-2);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted-deep);
}

.rail-link {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-sm); font-weight: 550;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.rail-link:hover { background: var(--panel-hover); color: var(--txt); text-decoration: none; }
.rail-link-icon { font-size: 14px; width: 18px; text-align: center; flex: none; }

.rail-link[aria-current="page"] {
  background: var(--accent-glow);
  color: var(--accent-hi);
  font-weight: 650;
}
.rail-link[aria-current="page"]::before {
  content: ""; position: absolute;
  inset-block: 6px; left: -12px; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}

/* Compteur d'exécutions en cours, posé sur la destination concernée. */
[hidden] { display: none !important; }

.rail-link-tally {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--run); color: #06121f;
}

.rail-foot {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line-subtle);
  font-size: var(--fs-micro); color: var(--muted-deep);
}
.rail-foot a { color: var(--muted-deep); }
.rail-foot a:hover { color: var(--accent-hi); text-decoration: none; }

/* ═══ Coquille : en-tête & contenu ═══════════════════════════════════════ */

header {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-subtle);
  position: sticky; top: 0; z-index: 20;
}
header h1 {
  font-size: var(--fs-md); font-weight: 650; margin: 0;
  display: flex; align-items: center; gap: var(--sp-2);
}
header .muted { font-weight: 450; }
.spacer { flex: 1; }

main {
  padding: var(--sp-6);
  max-width: min(var(--content-max), 100%);
  margin: 0 auto;
  display: grid; gap: var(--sp-6);
  min-width: 0;
}
/* Un enfant de grille ne rétrécit pas sous son contenu par défaut : sans
   ceci, un seul libellé insécable pousse toute la page en largeur. */
main > *, .grid > *, .card > * { min-width: 0; }

.grid { display: grid; gap: var(--sp-5); min-width: 0; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* La barre d'onglets historique est remplacée par le rail. On la neutralise
   ici plutôt que de la retirer de huit fichiers en une fois. */
.root-tabs { display: none !important; }

/* ═══ Carte ══════════════════════════════════════════════════════════════ */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  min-width: 0;
}
.card > h2 {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin: 0 0 var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line-subtle);
  font-size: var(--fs-md);
}
.card > h2 > span:first-child { flex: 1; min-width: 0; }
.card-quiet { background: var(--panel-2); border-color: var(--line-subtle); }

/* ═══ Boutons ════════════════════════════════════════════════════════════
   Une seule base, trois tailles, quatre intentions. Les treize noms
   historiques (primary, go, ctrl, filter-btn, valid-btn…) sont aliasés en
   fin de section pour que rien ne casse pendant la reprise des pages.    */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  line-height: 1.4;
  color: var(--txt-dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.btn:hover:not(:disabled) {
  background: var(--panel-3); border-color: var(--line-strong); color: var(--txt);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .45; cursor: not-allowed; transform: none;
}

.btn-primary {
  color: #1a1405;
  background: linear-gradient(178deg, var(--accent-hi) 0%, var(--accent) 100%);
  border-color: var(--accent-lo);
  font-weight: 680;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hi); border-color: var(--accent); color: #1a1405;
}

.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 34%, var(--line)); }
.btn-danger:hover:not(:disabled) { background: var(--err-glow); border-color: var(--err); color: var(--err); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-hover); border-color: transparent; color: var(--txt); }

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-md); }

/* Le bouton porte son propre état d'attente : plus de libellé qui ment
   pendant qu'une requête est en vol. */
.btn[data-busy="true"] { pointer-events: none; opacity: .7; }
.btn[data-busy="true"]::before {
  content: ""; width: 12px; height: 12px; flex: none;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: eut-spin .7s linear infinite;
}
@keyframes eut-spin { to { transform: rotate(360deg); } }

/* Alias hérités — même socle, plus de divergence visuelle. */
button.primary, a.primary, .btn.primary,
button.go, .valid-btn, button.primary-lg {
  color: #1a1405;
  background: linear-gradient(178deg, var(--accent-hi) 0%, var(--accent) 100%);
  border-color: var(--accent-lo);
  font-weight: 680;
}
button.primary-lg, .btn.primary-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-md); }
button.secondary, .btn.secondary, .btn-secondary {
  color: var(--txt-dim); background: var(--panel-2); border-color: var(--line);
}
.btn-xs { padding: 3px var(--sp-2); font-size: var(--fs-micro); }

.filter-btn, .mode-tab, .ctrl, .toggle {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter-btn:hover, .mode-tab:hover, .ctrl:hover, .toggle:hover {
  color: var(--txt); background: var(--panel-hover); border-color: var(--line-strong);
}
.filter-btn.active, .mode-tab.active, .ctrl.active, .toggle.active {
  color: var(--accent-hi);
  background: var(--accent-glow);
  border-color: var(--accent-line);
}

.filter-group, .filters-row {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}

/* ═══ Formulaires ════════════════════════════════════════════════════════ */

.field, .champ { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }

.lab, .art-lbl, label.lab {
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}

input[type="text"], input[type="search"], input[type="number"],
input[type="date"], input[type="email"], input[type="url"],
select, textarea, .select-ctrl, .art-val-input, .search-input {
  padding: var(--sp-3) var(--sp-4);
  font-family: inherit; font-size: var(--fs-sm);
  color: var(--txt);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 0;
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--line-strong);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--muted-deep); }
input:disabled, select:disabled, textarea:disabled {
  opacity: .5; cursor: not-allowed; background: var(--panel-2);
}
textarea { resize: vertical; line-height: var(--lh-base); }

input[type="checkbox"], input[type="radio"] {
  width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer;
}

.search-input { font-size: var(--fs-md); padding: var(--sp-4) var(--sp-5); }

/* ═══ Pastilles & états ══════════════════════════════════════════════════ */

.pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 3px var(--sp-3);
  font-size: var(--fs-micro); font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pill-ok   { color: var(--ok);   background: var(--ok-glow);   border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.pill-run  { color: var(--run);  background: var(--run-glow);  border-color: color-mix(in srgb, var(--run) 26%, transparent); }
.pill-warn { color: var(--warn); background: var(--warn-glow); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.pill-err  { color: var(--err);  background: var(--err-glow);  border-color: color-mix(in srgb, var(--err) 26%, transparent); }
.pill-accent { color: var(--accent-hi); background: var(--accent-glow); border-color: var(--accent-line); }

.dot {
  width: 7px; height: 7px; flex: none;
  border-radius: 50%;
  background: var(--idle);
  display: inline-block;
}
.dot.ok   { background: var(--ok); }
.dot.run  { background: var(--run); }
.dot.warn { background: var(--warn); }
.dot.err  { background: var(--err); }

/* « En cours » est le seul état qui respire : c'est ce que l'opérateur
   doit repérer sans chercher. */
.dot.run, .dot.running {
  background: var(--run);
  animation: eut-pulse 1.8s ease-in-out infinite;
}
@keyframes eut-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--run-glow); }
  50%      { box-shadow: 0 0 0 5px transparent; }
}

.ok   { color: var(--ok); }
.run  { color: var(--run); }
.warn { color: var(--warn); }
.err  { color: var(--err); }
.muted { color: var(--muted); }

/* ═══ Cartes de statistique ══════════════════════════════════════════════ */

.stat-card {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  background: var(--panel-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-md);
}
.stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xl); font-weight: 650;
  color: var(--txt); line-height: 1.1;
}
.stat-label {
  font-size: var(--fs-micro); font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
}

/* ═══ Tableaux ═══════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-md);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead th {
  position: sticky; top: 0; z-index: 1;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--fs-micro); font-weight: 650;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--panel-hover); }
td .mono, td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ═══ Vide & erreur ══════════════════════════════════════════════════════
   Un écran vide est une invitation à agir, pas un constat. Une erreur dit
   ce qui s'est passé et ce qu'on peut faire — jamais « une erreur est
   survenue ».                                                            */

.empty, .empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-9) var(--sp-6);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.empty-title, .empty-state-title {
  font-size: var(--fs-base); font-weight: 620; color: var(--txt-dim);
}
.empty-hint { font-size: var(--fs-xs); color: var(--muted-deep); max-width: 46ch; }

.err-box, .alert {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--err);
  background: var(--err-glow);
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent);
}
.alert-warn { color: var(--warn); background: var(--warn-glow); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-ok   { color: var(--ok);   background: var(--ok-glow);   border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-info { color: var(--run);  background: var(--run-glow);  border-color: color-mix(in srgb, var(--run) 30%, transparent); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 650; margin-bottom: 2px; }
.alert-detail { color: var(--txt-dim); font-weight: 450; }
.alert-detail .mono { color: var(--muted); }

/* ═══ Modales ════════════════════════════════════════════════════════════ */

.valid-overlay, .modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: var(--sp-6);
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(4px);
}
.valid-box, .modal-box {
  width: min(680px, 100%);
  max-height: min(84vh, 900px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  overflow: hidden;
}
.valid-head, .modal-head {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line-subtle);
}
.valid-titre, .modal-title { font-size: var(--fs-md); font-weight: 650; }
.valid-sub, .modal-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.valid-body, .modal-body { padding: var(--sp-5) var(--sp-6); overflow-y: auto; flex: 1; }
.valid-pied, .modal-foot {
  display: flex; align-items: center; gap: var(--sp-3); justify-content: flex-end;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-subtle);
  background: var(--panel-2);
}
.valid-count { font-family: var(--font-mono); color: var(--accent-hi); font-weight: 650; }

/* ═══ Surface de lancement ═══════════════════════════════════════════════
   Tout déclenchement passe par cette carte, quel que soit l'écran. Elle
   nomme le workflow n8n visé, son webhook, et les workflows enchaînés —
   y compris ceux que le serveur déclenche en cascade. Rien ne part sans
   que l'opérateur ait lu ce qui va partir.                               */

.launch {
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
}
.launch-head { display: flex; align-items: flex-start; gap: var(--sp-4); }
.launch-what { flex: 1; min-width: 0; }
.launch-title { font-size: var(--fs-base); font-weight: 650; color: var(--txt); }
.launch-desc { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

.launch-target {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: var(--fs-micro);
}
.launch-target-lab {
  color: var(--muted-deep);
  letter-spacing: .06em; text-transform: uppercase;
}
.launch-target-wf { color: var(--accent-hi); font-weight: 650; }
.launch-target-id { color: var(--muted); }
.launch-target-hook { color: var(--run); }

/* Un workflow enchaîné se déclare ici. Il ne doit plus jamais partir en
   silence depuis le serveur. */
.launch-chain {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-micro);
  color: var(--warn);
  background: var(--warn-glow);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
  border-radius: var(--r-sm);
}
.launch-chain .mono { color: var(--txt-dim); }
.launch-actions {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}

/* ═══ Notifications ══════════════════════════════════════════════════════ */

.toast-stack {
  position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-3);
  width: min(400px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--panel-3);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--muted);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  font-size: var(--fs-sm);
  animation: eut-toast-in .22s cubic-bezier(.2, .8, .3, 1);
}
.toast-ok   { border-left-color: var(--ok); }
.toast-err  { border-left-color: var(--err); }
.toast-warn { border-left-color: var(--warn); }
.toast-info { border-left-color: var(--run); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 650; color: var(--txt); }
.toast-detail { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.toast-detail .mono { color: var(--txt-dim); }
.toast-close {
  flex: none; padding: 0 var(--sp-1); background: none; border: none;
  color: var(--muted-deep); cursor: pointer; font-size: var(--fs-base);
}
.toast-close:hover { color: var(--txt); }
@keyframes eut-toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ═══ Utilitaires ════════════════════════════════════════════════════════ */

.row      { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.col      { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.between  { justify-content: space-between; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap   { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ═══ Responsive ═════════════════════════════════════════════════════════
   Sous 960px le rail devient une barre horizontale défilante en tête de
   page : la navigation reste visible, sans voler la largeur au contenu. */

@media (max-width: 860px) {
  body { padding-left: 0; }

  .rail {
    position: sticky; inset: 0 auto auto 0;
    width: 100%; height: auto;
    flex-direction: row; align-items: center; gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-right: none; border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden;
  }
  .rail-brand { padding: 0 var(--sp-3) 0 0; border-bottom: none; border-right: 1px solid var(--line-subtle); }
  .rail-brand-sub { display: none; }
  .rail-nav { display: flex; gap: var(--sp-2); padding: 0; flex: 1; }
  .rail-group { display: flex; align-items: center; gap: var(--sp-1); }
  .rail-group + .rail-group {
    margin-top: 0; margin-left: var(--sp-2);
    padding-left: var(--sp-2); border-left: 1px solid var(--line-subtle);
  }
  .rail-group-label { display: none; }
  .rail-link { padding: var(--sp-2) var(--sp-3); white-space: nowrap; flex: none; }
  .rail-link[aria-current="page"]::before { display: none; }
  .rail-link[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .rail-foot { display: none; }

  header { padding: var(--sp-3) var(--sp-4); }
  main   { padding: var(--sp-4); gap: var(--sp-4); }
  .card  { padding: var(--sp-4); border-radius: var(--r-md); }
  .toast-stack { right: var(--sp-3); left: var(--sp-3); bottom: var(--sp-3); width: auto; }
}

/* ═══ Mouvement réduit ═══════════════════════════════════════════════════ */

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

/* ═══ Monitoring ═════════════════════════════════════════════════════════
   Trois niveaux de lecture. La ligne d'état répond en permanence à « que
   se passe-t-il ? ». Le détail s'ouvre à la demande, et de lui-même quand
   un traitement démarre. Le corpus — chiffres qui ne bougent pas pendant
   une exécution — passe au troisième plan.                               */

.mon {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mon:has(.mon-line .dot.run) { border-color: var(--accent-line); }

/* ── Niveau 1 : ligne d'état ─────────────────────────────────────────── */

.mon-line {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5);
}
.mon-what { flex: 1; min-width: 180px; }
.mon-wf {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--fs-sm); font-weight: 650; color: var(--txt);
}
.mon-state {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 1px var(--sp-2);
  border-radius: var(--r-sm);
}
.mon-state-run { color: var(--run);  background: var(--run-glow); }
.mon-state-ok  { color: var(--ok);   background: var(--ok-glow); }
.mon-state-err { color: var(--err);  background: var(--err-glow); }

.mon-step { font-size: var(--fs-xs); color: var(--muted); margin-top: 1px; }
.mon-step-err { color: var(--err); }

.mon-elapsed, .mon-prog {
  font-size: var(--fs-xs); font-weight: 650; color: var(--txt-dim);
  padding: 2px var(--sp-2);
  background: var(--panel-2);
  border-radius: var(--r-sm);
}
.mon-eta { font-size: var(--fs-micro); color: var(--run); }

.mon-track {
  flex: none; width: 120px; height: 4px;
  background: var(--panel-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.mon-track > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--run), var(--accent));
  border-radius: inherit;
  transition: width .4s ease;
}

.mon-exec {
  font-size: var(--fs-micro); color: var(--muted);
  padding: 2px var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.mon-exec:hover { color: var(--accent-hi); border-color: var(--accent-line); text-decoration: none; }
.mon-toggle { margin-left: auto; }

/* ── Niveau 2 : détail ───────────────────────────────────────────────── */

.mon-detail {
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-5);
  border-top: 1px solid var(--line-subtle);
  background: var(--panel-2);
}
.mon-current-title { font-size: var(--fs-sm); font-weight: 620; color: var(--txt); }
.mon-current-sub   { font-size: var(--fs-xs); color: var(--muted); }
.mon-meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.mon-steps {
  --mon-steps-visible: 5;
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1px;
  max-height: calc(var(--mon-steps-visible) * 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mon-steps li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center; gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  border-radius: var(--r-sm);
}
.mon-steps li .step-ic {
  display: grid; place-items: center;
  width: 16px; height: 16px;
  font-size: 10px; font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
}
.mon-steps li.done  { color: var(--txt-dim); }
.mon-steps li.done .step-ic  { color: var(--ok);  border-color: var(--ok);  background: var(--ok-glow); }
.mon-steps li.error { color: var(--err); background: var(--err-glow); }
.mon-steps li.error .step-ic { color: var(--err); border-color: var(--err); }
.mon-steps li.active {
  color: var(--txt); font-weight: 600;
  background: var(--run-glow);
}
.mon-steps li.active .step-ic {
  border-color: var(--run);
  border-top-color: transparent;
  animation: eut-spin .8s linear infinite;
}
.mon-steps li .step-label {
  display: flex; align-items: center; gap: var(--sp-1);
  min-width: 0;
}
.mon-steps li .step-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.mon-steps li .step-hint { font-size: 10px; color: var(--muted-deep); flex: none; }
.mon-steps li .step-loop {
  flex: none;
  padding: 1px var(--sp-2);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent-hi);
  background: var(--accent-glow);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
}
.mon-steps li .step-time {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro); color: var(--muted-deep);
}
.mon-steps li.active .step-time { color: var(--run); font-weight: 650; }

/* ── Niveau 3 : corpus & services ────────────────────────────────────── */

.mon-more {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: var(--sp-3) var(--sp-5);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none; border-top: 1px solid var(--line-subtle);
  cursor: pointer; text-align: left;
  transition: color var(--t-fast), background var(--t-fast);
}
.mon-more:hover { color: var(--txt); background: var(--panel-hover); }
.mon-more-sum {
  flex: 1; font-size: var(--fs-micro); color: var(--muted-deep);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mon-corpus {
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-5);
  border-top: 1px solid var(--line-subtle);
  background: var(--panel-2);
}
.mon-sub { font-size: var(--fs-micro); color: var(--muted); }
.mon-services { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ── Alerte GPU résiduel ─────────────────────────────────────────────── */

.gpu-residual-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  font-family: inherit; font-size: var(--fs-micro); font-weight: 650;
  color: var(--warn);
  background: var(--warn-glow);
  border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.gpu-residual-btn:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.gpu-residual-btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 860px) {
  .mon-line { padding: var(--sp-3) var(--sp-4); gap: var(--sp-2); }
  .mon-track { width: 72px; }
  .mon-more-sum { display: none; }
}
