/* ═══════════════════════════════════════════════════════════════════════
   XYZ Panel — design system « Carte de l'agence » (Map/docs/UX-UI.md)
   (même système que twdm-panel : une seule langue visuelle pour les deux)

   Port fidèle du guide : tokens (§3), composants (§4), mise en page (§5 :
   topbar 56 px, stage pointillé, panneaux flottants), blocs en relief (§6),
   câbles « fibre » (§7), indicateurs live (§8).

   Deux écarts voulus, et seulement deux :
     • l'accent d'interaction est le VERT #D2FD3C (le guide : bleu #3b82f6) ;
     • le bouton principal est vert (le guide : blanc). Un seul par écran.

   Les anciens noms de classes/variables restent valides (alias en bas de
   :root) pour que les <style> et style="" des templates suivent le thème.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* ── §3 Tokens (noms du guide) ── */
  --color-canvas: #0b0b0d;       /* fond (stage) */
  --color-surface: #141417;      /* panneaux */
  --color-raised: #1b1b1f;       /* boutons secondaires */
  --color-subtle: #1f1f24;       /* survol, tuiles de chiffres */
  --color-line: #27272c;         /* bordures */
  --color-line-strong: #3a3a41;  /* bordures au survol */
  --color-ink: #f4f4f5;          /* texte principal */
  --color-ink-2: #d4d4d8;
  --color-ink-3: #a1a1aa;        /* texte secondaire, labels */
  --color-ink-4: #71717a;        /* tertiaire, placeholders */
  --color-accent: #D2FD3C;       /* L'accent d'interaction — vert conservé */
  --color-good: #22c55e;
  --color-bad: #f87171;
  --color-warn: #f59e0b;

  --chrome: #0f0f12;             /* topbar, sidebar, fond des champs */
  --chrome-line: #1f1f24;
  --panel-line: #26262b;

  --accent-rgb: 210, 253, 60;
  --accent-hover: #dcff66;
  --accent-ring: rgba(var(--accent-rgb), 0.25);   /* halo de focus */
  --accent-halo: 0 0 30px -6px rgba(var(--accent-rgb), 0.65);

  --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -12px rgba(0, 0, 0, 0.75);
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 16px 40px -10px rgba(0, 0, 0, 0.8);

  /* Couleurs par type (§3) — une couleur = un sens */
  --kind-source: #0ea5e9;
  --kind-step: #8b5cf6;
  --kind-money: #10b981;
  --kind-treasury: #f59e0b;
  --kind-pole: #3b82f6;
  --kind-market: #14b8a6;

  /* Graphiques (§3, validés daltonisme) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-other: #52525b;

  --font: "Geist", "Geist Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ── Alias historiques (utilisés par les styles inline des templates) ── */
  --bg: var(--color-canvas);
  --panel: var(--color-surface);
  --panel-2: var(--color-raised);
  --panel-3: var(--chrome);
  --subtle: var(--color-subtle);
  --border: var(--color-line);
  --border-soft: rgba(39, 39, 44, 0.7);
  --line-strong: var(--color-line-strong);
  --text: var(--color-ink);
  --ink-2: var(--color-ink-2);
  --muted: var(--color-ink-3);
  --ink-4: var(--color-ink-4);
  --accent: var(--color-accent);
  --accent-ink: #18181b;                       /* texte sur fond clair (§6.1) */
  --accent-dim: rgba(var(--accent-rgb), 0.12);
  --green: #4ade80;
  --red: var(--color-bad);
  --yellow: #fcd34d;
  --warn: var(--color-warn);
  --sky: #38bdf8;
  --violet: #a78bfa;
  --radius: 14px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-field: 9px;
}

/* ═══ Base ═══════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
strong, b { font-weight: 600; }

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

* { scrollbar-width: thin; scrollbar-color: #2c2c33 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(var(--accent-rgb), 0.22); color: var(--color-ink); }

:focus-visible { outline: 2px solid rgba(var(--accent-rgb), 0.6); outline-offset: 2px; }

/* Chiffres : toujours tabulaires (§3 .num) */
.num, .mono { font-variant-numeric: tabular-nums; }
.code { font-family: var(--mono); font-size: 0.92em; }

.i { width: 16px; height: 16px; flex-shrink: 0; }

/* ═══ Mise en page (§5) ══════════════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Stage : fond de carte pointillé (React Flow : gap 22, size 1.3, #2a2a30)
   + lueur très discrète en haut pour la profondeur (verte au lieu de bleue). */
.stage {
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(var(--accent-rgb), 0.065), transparent 65%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='11' cy='11' r='0.85' fill='%232a2a30'/%3E%3C/svg%3E") 0 0 / 22px 22px,
    var(--color-canvas);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

/* ── Sidebar (même disposition qu'avant, style « chrome » de la carte) ── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--chrome);
  border-right: 1px solid var(--chrome-line);
}

.brand {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--chrome-line);
}

.brand-name { font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
.brand-sub { font-size: 12px; color: var(--color-ink-3); line-height: 1.3; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }

.section-label {
  padding: 16px 10px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-4);
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }

/* Items de menu (§4 .menu-item) */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-ink-2);
  transition: background-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-ink-3); transition: color 0.12s; }
.nav-link:hover { background: var(--color-subtle); color: var(--color-ink); }
.nav-link:hover svg { color: var(--color-ink-2); }

/* Sélection = l'état « enfoncé » du segmented + l'accent vert */
.nav-link.active {
  background: #222228;
  color: var(--color-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.nav-link.active svg { color: var(--color-accent); filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.45)); }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--chrome-line); }
.sidebar-foot .btn { justify-content: flex-start; }

/* ── Topbar 56 px (§5) ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px 0 24px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-line);
}

.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.topbar .title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb { font-size: 15px; font-weight: 500; color: var(--color-ink-3); white-space: nowrap; transition: color 0.12s; }
.crumb:hover { color: var(--color-ink); }
.crumb-sep { color: var(--color-ink-4); font-size: 15px; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-right form { display: inline-flex; }
.topbar-sep { width: 1px; height: 20px; background: var(--chrome-line); margin: 0 2px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 4px 0 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-ink-2);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-ink);
  background: linear-gradient(180deg, #2b2b32, #1e1e23);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ── Metricsbar / sous-barre 48 px (§5) — filtres, période, KPIs ── */
.subbar {
  position: sticky;
  top: 56px;
  z-index: 25;
  min-height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 14px 7px 24px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-line);
}
.subbar .input { height: 32px; font-size: 13.5px; }
.subbar .spacer { flex: 1; }
.subbar-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-ink-3); white-space: nowrap; }

/* KPI séparés par un filet vertical (.kpi : label 11.5 px, valeur 15 px) */
.kpis { display: flex; align-items: stretch; flex-wrap: wrap; }
.kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  border-left: 1px solid var(--chrome-line);
  line-height: 1.25;
}
.kpi-label { font-size: 11.5px; color: var(--color-ink-3); white-space: nowrap; }
.kpi-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-value .sub { font-size: 12px; font-weight: 500; color: var(--color-ink-3); }

/* ═══ Composants de base (§4) ════════════════════════════════════════════ */

/* ── Boutons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--color-line);
  background: var(--color-raised);
  color: var(--color-ink);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #24242a; border-color: var(--color-line-strong); }
.btn:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Principal : vert (rôle du bouton blanc de la carte) — un seul par écran */
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #0b0b0d;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary { background: var(--color-raised); }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--color-ink-3); }
.btn-ghost:hover { background: var(--color-subtle); border-color: transparent; color: var(--color-ink); }

/* Danger (§4 .btn--danger) : texte rouge, teinte au survol */
.btn-danger { color: var(--color-bad); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: var(--color-bad); }
.btn-ghost.btn-danger { color: var(--color-bad); }
/* Confirmation de suppression : bouton danger plein */
.btn-danger-solid { background: #ef4444; border-color: #ef4444; color: #fff; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-danger-solid:hover { background: #f05252; border-color: #f05252; color: #fff; }

/* Avertissement : écriture réelle sur X (branding, warmup, re-scrape) */
.btn-warn {
  background: var(--color-warn);
  border-color: var(--color-warn);
  color: #0b0b0d;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-warn:hover { background: #fbab2c; border-color: #fbab2c; }

.btn-violet { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
.btn-violet:hover { background: #9a70f8; border-color: #9a70f8; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-block { width: 100%; }
.btn .kbd { margin-left: 2px; font-size: 11px; color: rgba(11, 11, 13, 0.55); }

/* Petits boutons-icônes des tableaux */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-ink-3);
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.12s, color 0.12s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--color-subtle); color: var(--color-ink); }
.icon-btn.danger:hover { color: var(--color-bad); background: rgba(248, 113, 113, 0.1); }
.icon-btn.accent { color: var(--color-accent); }
.icon-btn.accent:hover { color: var(--color-accent); background: rgba(var(--accent-rgb), 0.1); }
.actions-cell .icon-btn + .icon-btn, .actions-cell form + .icon-btn, .actions-cell .icon-btn + form { margin-left: 0; }

/* ── Champs (§4 .field) ── */
.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-3);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--color-line);
  background: var(--chrome);
  color: var(--color-ink);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: var(--color-line-strong); }
.input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--color-ink-4); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }

textarea.input { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
textarea.input.mono, textarea.input.code { font-family: var(--mono); font-size: 13px; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-image: 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='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
select.input[multiple] { height: auto; min-height: 36px; padding: 4px 6px; background-image: none; }
select.input option { background: var(--color-surface); color: var(--color-ink); }

input[type="file"].input { padding: 0 6px 0 0; line-height: 34px; color: var(--color-ink-3); font-size: 13px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  height: 26px;
  margin: 0 10px 0 4px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--color-line);
  background: var(--color-raised);
  color: var(--color-ink);
  font: 500 12.5px var(--font);
  cursor: pointer;
}

.input.btn-sm, .input-sm { height: 28px; padding: 0 8px; font-size: 12.5px; border-radius: 8px; }
select.input.btn-sm, select.input-sm { padding-right: 26px; background-position: right 8px center; }

/* Champ avec icône (recherche) */
.field-icon { position: relative; display: inline-flex; align-items: center; }
.field-icon > svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--color-ink-4); pointer-events: none; }
.field-icon > .input { padding-left: 30px; }

.help { font-size: 12px; color: var(--color-ink-3); }
.help strong { color: var(--color-ink-2); }

/* ── Interrupteur à segments (§4 .segmented) — onglets, périodes, on/off ── */
.segmented, .seg, .platform-tabs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--chrome);
  border: 1px solid var(--color-line);
}
.segmented > button, .segmented > a, .segmented > .btn,
.seg > .seg-tab, .platform-tabs > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-ink-3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.12s, background 0.12s;
}
.segmented > button:hover, .segmented > a:hover, .segmented > .btn:hover,
.seg > .seg-tab:hover, .platform-tabs > button:hover { color: var(--color-ink); background: transparent; }
.segmented > [aria-pressed="true"], .segmented > .active,
.seg > .seg-tab.active, .platform-tabs > button.active {
  background: #26262c;
  color: var(--color-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.segmented .badge { height: 18px; padding: 0 6px; font-size: 11px; }
.segmented .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.segmented > [aria-pressed="true"] .dot.on { background: var(--color-good); box-shadow: 0 0 6px var(--color-good); }
.segmented > [aria-pressed="true"] .dot.warn { background: var(--color-warn); box-shadow: 0 0 6px var(--color-warn); }
.segmented-block { display: flex; }
.segmented-block > * { flex: 1; }
.seg { display: flex; margin-bottom: 18px; }
.seg > .seg-tab { flex: 1; }

/* ── Panneaux (§4 .panel) ── */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--color-line);
}
.panel-head > :first-child { min-width: 0; }
.panel-head .help { white-space: normal; }
.panel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 600; color: var(--color-ink); }
.panel-body { padding: 16px; }
.panel-section { padding: 16px; border-top: 1px solid var(--color-line); }
.panel-section:first-child { border-top: 0; }
.section-title { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--color-ink-3); }

.card {
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
}

/* Tuile sélectionnable / encart (case à cocher, radio) */
.card-soft {
  background: #17171b;
  border: 1px solid var(--color-line);
  border-radius: 10px;
}
label.card-soft { cursor: pointer; transition: border-color 0.12s, background 0.12s, box-shadow 0.12s; }
label.card-soft:hover { border-color: var(--color-line-strong); background: #1a1a1f; }
label.card-soft:has(input:checked) {
  border-color: rgba(var(--accent-rgb), 0.65);
  background: rgba(var(--accent-rgb), 0.05);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.3), 0 0 24px -10px rgba(var(--accent-rgb), 0.6);
}
label.card-soft:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* Carte d'option « type vierge » (§9 menu Ajouter : tuile d'icône + nom + phrase d'aide) */
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.option-card { display: flex; align-items: flex-start; gap: 11px; padding: 12px; }
.option-card > input[type="radio"], .option-card > input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.option-card { position: relative; }
.option-name { display: block; font-size: 13.5px; font-weight: 600; color: var(--color-ink); line-height: 1.3; }
.option-help { display: block; margin-top: 2px; font-size: 12px; color: var(--color-ink-3); line-height: 1.4; }

/* Puces à cocher (« Masquer : … », filtres) */
.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  background: var(--color-raised);
  color: var(--color-ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip-check:hover { border-color: var(--color-line-strong); color: var(--color-ink); }
.chip-check:has(input:checked) { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.08); color: var(--color-ink); }
.chip-check input { width: 13px; height: 13px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ── Menus (Échap / clic à côté pour fermer) ── */
.menu { position: relative; display: inline-flex; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 230px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  animation: fade-in 0.16s ease-out;
}
.menu-pop.right { left: auto; right: 0; }
.menu-title { padding: 6px 10px 4px; font-size: 12px; font-weight: 500; color: var(--color-ink-4); }
.menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-ink-2);
  font-family: var(--font);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.menu-item:hover { background: var(--color-subtle); color: var(--color-ink); }
.menu-item input { margin: 0; }
.menu-sep { height: 1px; margin: 6px -6px; background: var(--color-line); }

/* ── Tuile d'icône « app » (§6.1 .node-logo) : fond coloré, reflet, tranche ── */
.app-tile, .node-logo, .stat-ic, .brand-logo {
  --tile: var(--color-accent);
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--tile);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 3px 0 color-mix(in srgb, var(--tile) 50%, #000),
    0 7px 12px -3px rgba(0, 0, 0, 0.7);
}
.app-tile::after, .node-logo::after, .stat-ic::after, .brand-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 52%);
}
.app-tile svg, .node-logo svg, .stat-ic svg, .brand-logo svg {
  position: relative;
  z-index: 1;
  width: 55%;
  height: 55%;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
/* Fond clair → texte #18181b (luminance > 170, §6.1) */
.t-accent, .brand-logo, .stat-ic { --tile: var(--color-accent); color: #18181b; }
.t-sky { --tile: #0ea5e9; color: #fff; }
.t-violet { --tile: #8b5cf6; color: #fff; }
.t-emerald { --tile: #10b981; color: #fff; }
.t-amber { --tile: #f59e0b; color: #18181b; }
.t-red { --tile: #ef4444; color: #fff; }
.t-teal { --tile: #14b8a6; color: #fff; }
.t-pink { --tile: #ec4899; color: #fff; }
.t-blue { --tile: #3b82f6; color: #fff; }
.t-gray { --tile: #3f3f46; color: #e4e4e7; }
.app-tile.lg { width: 40px; height: 40px; border-radius: 12px; }
.app-tile.sm { width: 22px; height: 22px; border-radius: 7px; }
.app-tile.sm::after { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 55%); }

.brand-logo { width: 30px; height: 30px; }

/* ── KPI : tuiles du rapport (§11 : valeur 24 px, sparkline, dernier point accent) ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  position: relative;
  min-width: 0;
  padding: 14px 16px 15px;
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
}

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; margin-bottom: 8px; }
.stat-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--color-ink-3); }
.stat-label .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.stat-ic { width: 24px; height: 24px; border-radius: 8px; }

.stat-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}
.stat-sub { margin-left: 4px; font-size: 13.5px; font-weight: 500; letter-spacing: 0; color: var(--color-ink-3); }
.stat-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stat .help { margin-top: 4px; }

.spark { display: block; width: 120px; height: 30px; overflow: visible; }
.spark path { fill: none; stroke: var(--color-ink-4); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-area { fill: rgba(161, 161, 170, 0.06); stroke: none; }
.spark circle { fill: var(--color-accent); filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), 0.8)); }

/* Tuile de chiffre (§4 : rounded-lg bg-subtle px-2.5 py-2) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tile { min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--color-subtle); }
.tile-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--color-ink-3); white-space: nowrap; }
.tile-label .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile-value { margin-top: 1px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-ink); }

/* Lignes clé → valeur (panneau de détails §10) */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(39, 39, 44, 0.7); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv > :first-child { color: var(--color-ink-3); }
.kv > :last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* ── Barre de progression ── */
.bar { flex: 1; height: 4px; overflow: hidden; border-radius: 999px; background: #25252b; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.45);
  transition: width 0.6s ease;
}
.bar-pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--color-ink-3); }

/* ── Pastilles (rayon 999 px) ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.badge .dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.badge svg { width: 12px; height: 12px; }

.badge-accent { color: var(--color-accent); background: rgba(var(--accent-rgb), 0.1); border-color: rgba(var(--accent-rgb), 0.28); }
.badge-green { color: #4ade80; background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.26); }
.badge-red { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.28); }
.badge-red .dot { background: var(--color-bad); }
.badge-yellow { color: #fcd34d; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.28); }
.badge-orange { color: #fdba74; background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.28); }
.badge-orange .dot { background: #fb923c; }
.badge-sky { color: #7dd3fc; background: rgba(14, 165, 233, 0.11); border-color: rgba(14, 165, 233, 0.3); }
.badge-sky .dot { background: #38bdf8; }
.badge-violet { color: #c4b5fd; background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.32); }
.badge-violet .dot { background: #a78bfa; }
.badge-pink { color: #f9a8d4; background: rgba(236, 72, 153, 0.11); border-color: rgba(236, 72, 153, 0.3); }
.badge-blue { color: #93c5fd; background: rgba(59, 130, 246, 0.11); border-color: rgba(59, 130, 246, 0.3); }
.badge-blue .dot { background: #60a5fa; }
.badge-gray { color: var(--color-ink-3); background: var(--color-raised); border-color: var(--color-line); }
.badge-gray .dot { box-shadow: none; }

.badge-toggle { cursor: pointer; transition: filter 0.12s, border-color 0.12s; }
.badge-toggle:hover { filter: brightness(1.15); }
.badge-sm { height: 18px; padding: 0 7px; font-size: 11px; gap: 5px; }

/* ── Tableaux ── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink-3);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}
.table-wrap .table thead th { position: sticky; top: 0; z-index: 1; }
.table td {
  padding: 11px 14px;
  font-size: 13.5px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(39, 39, 44, 0.65);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.1s; }
.table tbody tr:hover { background: rgba(31, 31, 36, 0.55); }
.table tbody tr:has(input[type="checkbox"]:checked) { background: rgba(var(--accent-rgb), 0.045); }
.table a:not(.btn):not(.icon-btn):hover { color: var(--color-accent); }

.ident { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ident-name { font-weight: 600; }
.avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  object-fit: cover;
  background: var(--color-raised);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 0 1px var(--color-line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-3);
}

/* ── Encarts contextuels (messages qui restent dans la page) ── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px 10px 14px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--color-ink-2);
  animation: fade-in 0.16s ease-out;
}
.flash a { color: var(--color-ink); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25); text-underline-offset: 3px; }
.flash a:hover { color: var(--color-accent); text-decoration-color: currentColor; }
.flash strong { color: var(--color-ink); }
.flash-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--color-ink-3); }
.flash-success { background: rgba(34, 197, 94, 0.06); border-color: rgba(34, 197, 94, 0.22); }
.flash-success .flash-dot { background: var(--color-good); box-shadow: 0 0 8px var(--color-good); }
.flash-error { background: rgba(248, 113, 113, 0.06); border-color: rgba(248, 113, 113, 0.25); }
.flash-error .flash-dot { background: var(--color-bad); box-shadow: 0 0 8px var(--color-bad); }
.flash-warning { background: rgba(245, 158, 11, 0.06); border-color: rgba(245, 158, 11, 0.24); }
.flash-warning .flash-dot { background: var(--color-warn); box-shadow: 0 0 8px var(--color-warn); }
.flash-info { background: rgba(14, 165, 233, 0.05); border-color: rgba(14, 165, 233, 0.22); }
.flash-info .flash-dot { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.flash span:last-child { color: inherit; }

/* ── Toasts (§4 : en bas au centre, 3,5 s — 6 s pour une erreur — 4 max) ── */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 100001;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  max-width: 560px;
  padding: 8px 6px 8px 14px;
  border: 1px solid #2c2c33;
  border-radius: 12px;
  background: #1b1b1f;
  box-shadow: var(--shadow-pop);
  font-size: 13.5px;
  color: var(--color-ink);
  animation: toast-in 0.18s ease-out;
}
.toast.is-leaving { opacity: 0; translate: 0 6px; transition: opacity 0.2s, translate 0.2s; }
.toast-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--color-good); box-shadow: 0 0 8px var(--color-good); }
.toast-error .toast-dot { background: var(--color-bad); box-shadow: 0 0 8px var(--color-bad); }
.toast-warning .toast-dot { background: var(--color-warn); box-shadow: 0 0 8px var(--color-warn); }
.toast-info .toast-dot { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.toast-msg { flex: 1; min-width: 0; line-height: 1.4; }
.toast-close {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-ink-4);
  cursor: pointer;
}
.toast-close:hover { background: var(--color-subtle); color: var(--color-ink); }
.toast-close svg { width: 14px; height: 14px; }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }

/* ── État vide (§5 : carte centrée + une phrase + bouton) ── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 40px 20px;
  text-align: center;
}
.empty > .app-tile { margin-bottom: 10px; }
.empty > svg { width: 22px; height: 22px; color: var(--color-ink-4); margin-bottom: 6px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--color-ink); }
.empty-text { max-width: 360px; font-size: 13px; color: var(--color-ink-3); }
.empty > .btn { margin-top: 14px; }

/* ── Modales (§4 : voile noir 60 %, .panel centré, Échap / clic à côté) ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 32px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
}
.modal-overlay.is-open { display: flex; }
.modal-card {
  width: 640px;
  max-width: 100%;
  margin: auto;
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  animation: fade-in 0.16s ease-out;
}
.modal-card.modal-wide { width: 920px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--color-line);
}
.modal-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.modal-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.modal-sub { margin-top: 1px; font-size: 12.5px; color: var(--color-ink-3); }
.modal-close {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--color-subtle); color: var(--color-ink); }
.modal-close svg { width: 16px; height: 16px; }
.modal-tabs { padding: 14px 18px 0; }
.modal-body { padding: 18px; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-line);
}

/* Confirmation (§4 : toujours une modale, bouton danger) */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.confirm-overlay.is-open { display: flex !important; }
.confirm-card {
  width: 420px;
  max-width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  animation: fade-in 0.16s ease-out;
}
.confirm-body { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 18px; }
.confirm-title { display: none; }
.confirm-msg { padding-top: 3px; font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--color-ink); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--color-line); }
.confirm-actions .btn { min-width: 96px; }

/* Panneau de détails flottant à droite (§5 / §10) */
.xpv-overlay { display: none; position: fixed; inset: 0; z-index: 9990; background: transparent; }
.xpv-overlay.is-open { display: block; }
.xpv-drawer {
  position: fixed;
  top: 68px;
  right: 12px;
  bottom: 12px;
  z-index: 9991;
  width: 380px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateX(14px);
  pointer-events: none;
  transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}
.xpv-drawer.is-open { opacity: 1; transform: none; pointer-events: auto; }
.xpv-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--color-line); }
.xpv-head .panel-title { margin: 0; }
.xpv-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-ink-3);
  cursor: pointer;
}
.xpv-close:hover { background: var(--color-subtle); color: var(--color-ink); }
.xpv-close svg { width: 16px; height: 16px; }
.xpv-body { flex: 1; overflow-y: auto; padding-bottom: 20px; }
.xpv-banner { display: block; width: 100%; height: 116px; object-fit: cover; background: var(--color-raised); }
.xpv-tweet { padding: 12px 16px; border-bottom: 1px solid var(--color-line); font-size: 13px; line-height: 1.45; color: var(--color-ink); white-space: pre-wrap; }
.xpv-tweet-meta { display: flex; gap: 14px; margin-top: 6px; font-size: 11.5px; color: var(--color-ink-3); font-variant-numeric: tabular-nums; }

/* ═══ Graphiques (§11 : colonnes, infobulle, bouton Tableau) ═════════════ */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 22px; }
.chart.tight { gap: 3px; }
.chart-col {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  cursor: default;
}
.chart-bar, .chart-stack {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 1px 1px;
  transition: opacity 0.12s, filter 0.12s;
}
.chart-bar { background: var(--color-accent); }
.chart-stack { display: flex; flex-direction: column; overflow: hidden; }
.chart-stack .s-other { background: var(--series-2); }
.chart-stack .s-sent { background: var(--color-accent); }
.chart:hover .chart-col:not(:hover) .chart-bar,
.chart:hover .chart-col:not(:hover) .chart-stack { opacity: 0.45; }
.chart-val { font-size: 10.5px; font-weight: 500; line-height: 1; color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.chart-date { height: 13px; font-size: 10.5px; line-height: 13px; color: var(--color-ink-4); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-tip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  z-index: 10;
  margin-bottom: 6px;
  padding: 6px 9px;
  transform: translateX(-50%);
  border: 1px solid #2c2c33;
  border-radius: 9px;
  background: #1b1b1f;
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.chart-col:hover .chart-tip { opacity: 1; }
.chart-col:first-child .chart-tip { left: 0; transform: none; }
.chart-col:last-child .chart-tip { left: auto; right: 0; transform: none; }
.chart-tip .s { color: var(--color-accent); font-weight: 600; }
.chart-tip .o { color: #f0884f; font-weight: 600; }
.chart-col.is-today .chart-bar { box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.55); }
.chart-col.is-today .chart-date { color: var(--color-ink-2); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--color-ink-3); }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; vertical-align: 0; }
.view-table[hidden], .view-chart[hidden] { display: none !important; }

/* ═══ La carte : objets en relief (§6) ═══════════════════════════════════ */
.flow { position: relative; margin: 0 0 18px; padding: 22px 6px 30px; }
.flow-cables { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.flow-row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 64px; }

/* 6.1 Bloc 3D : tranche (dégradé de la couleur du type) + dessus éclairé */
.node3d { --kind: #3b82f6; --depth: 8px; position: relative; width: 230px; flex: none; }
.node3d__side {
  position: absolute;
  left: 1px;
  right: 1px;
  top: 0;
  bottom: calc(var(--depth) * -1);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--kind) 78%, #000) 0%, color-mix(in srgb, var(--kind) 34%, #000) 100%);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.45), 0 calc(var(--depth) + 6px) 22px -6px rgba(0, 0, 0, 0.9);
  transition: top 0.18s ease;
}
.node-card {
  --ring: 0 0 0 0 transparent;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  background:
    radial-gradient(130% 160% at 0% 0%, rgba(255, 255, 255, 0.09), transparent 46%),
    linear-gradient(180deg, #2b2b32 0%, #1e1e23 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--ring), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
a.node-card { color: inherit; }
.node3d:hover .node-card { transform: translateY(-3px); }
.node3d:hover .node3d__side { top: -3px; }
.node-card:focus-visible { outline: none; --ring: 0 0 0 2px var(--color-accent), var(--accent-halo); border-color: transparent; }
.node-card__body { display: block; min-width: 0; flex: 1; }
.node-card__name { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--color-ink); overflow-wrap: anywhere; }
.node-card__kind { display: block; margin-top: 2px; font-size: 12px; color: var(--color-ink-3); }
.node-card__kind .num { color: var(--color-ink); font-weight: 600; font-size: 13.5px; }
.node-logo { width: 36px; height: 36px; border-radius: 10px; }

/* Pastille de chiffre sur le bloc (mode « Chiffres » : « 634 aujourd'hui ») */
.node-tag {
  position: absolute;
  top: -10px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #141417;
  border: 1px solid color-mix(in srgb, var(--kind) 45%, transparent);
  color: color-mix(in srgb, var(--kind) 40%, white);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease;
}
.node3d:hover .node-tag { transform: translateY(-3px); }

/* 6.2 Bloc « point d'arrivée » : plus grand, plus épais, halo de sa couleur */
.node3d--money { --depth: 13px; width: 300px; }
.node3d--money .node3d__side {
  border-radius: 18px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.45), 0 calc(var(--depth) + 8px) 30px -6px rgba(0, 0, 0, 0.9),
    0 0 46px -6px color-mix(in srgb, var(--kind) 45%, transparent);
}
.node3d--money .node-card {
  gap: 14px;
  padding: 16px 17px;
  border-radius: 18px;
  background:
    radial-gradient(130% 160% at 0% 0%, color-mix(in srgb, var(--kind) 22%, transparent), transparent 55%),
    linear-gradient(180deg, #2c2f30 0%, #1d1f20 100%);
  border-color: color-mix(in srgb, var(--kind) 35%, rgba(255, 255, 255, 0.08));
}
.node3d--money .node-card__name { font-size: 17px; font-weight: 700; }
.node3d--money .node-card__kind { font-size: 12.5px; color: color-mix(in srgb, var(--kind) 55%, white); }
.node3d--money .node-logo { width: 48px; height: 48px; border-radius: 13px; }
.node-big { display: block; margin-top: 2px; font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.node-big .sub { font-size: 13.5px; font-weight: 500; letter-spacing: 0; color: var(--color-ink-3); }
.node-meter { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.node-meter .bar { height: 3px; background: rgba(0, 0, 0, 0.35); }
.node-meter .bar-fill { display: block; }
a.node-tag:hover { filter: brightness(1.15); }

/* 6.4 Points de connexion */
.port {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  border-radius: 50%;
  border: 1.5px solid #52525b;
  background: #1d1d22;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.port--in { left: -6px; }
.port--out { right: -6px; }
.node3d:hover .port { border-color: var(--color-accent); }

/* 7.1 Câble : gaine claire + intérieur sombre + fibre de la couleur du flux */
.cable-sheath { fill: none; stroke: #3a3a43; stroke-width: 11; stroke-linecap: round; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }
.cable-inner { fill: none; stroke: #111115; stroke-width: 8; stroke-linecap: round; }
.flow-edge { fill: none; stroke: color-mix(in srgb, currentColor 55%, transparent); stroke-width: 2.2; }
/* 7.2 Points lumineux */
.edge-pulse { fill: #fff; filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 0 3px #fff); }

/* ═══ Indicateurs live (§8) ══════════════════════════════════════════════ */
.live-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-good);
  box-shadow: 0 0 6px var(--color-good);
  animation: live-breathe 2.4s ease-in-out infinite;
}
.live-dot.is-error { background: var(--color-warn); box-shadow: 0 0 6px var(--color-warn); }
@keyframes live-breathe { 50% { opacity: 0.45; } }

.live-ping {
  position: absolute;
  inset: -1px;
  z-index: 4;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 1.5px rgba(var(--accent-rgb), 0.9), 0 0 22px 2px rgba(var(--accent-rgb), 0.45);
  animation: live-ping 0.9s ease-out forwards;
}
@keyframes live-ping { from { opacity: 1; scale: 1; } to { opacity: 0; scale: 1.06; } }

/* Bouton « ● Live » de la topbar : clic = pause/reprise des animations */
.live-toggle { gap: 8px; }
html.is-paused .live-dot,
html.is-paused .live-toggle .live-dot { background: var(--color-ink-4); box-shadow: none; animation: none; }
html.is-paused .conn-badge .dot, html.is-paused .brand-badge .dot, html.is-paused .conn-dots::after { animation: none; }

/* ═══ Utilitaires ════════════════════════════════════════════════════════ */
.muted { color: var(--color-ink-3); }
.faint { color: var(--color-ink-4); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2.stretch { align-items: stretch; }

/* Fil d'activité */
.feed { max-height: 320px; overflow-y: auto; }
.feed-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid rgba(39, 39, 44, 0.65); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 6px; height: 6px; margin-top: 7px; flex-shrink: 0; border-radius: 50%; background: var(--color-ink-4); }
.feed-dot.lvl-error { background: var(--color-bad); box-shadow: 0 0 6px var(--color-bad); }
.feed-dot.lvl-warning { background: var(--color-warn); box-shadow: 0 0 6px var(--color-warn); }
.feed-dot.lvl-success { background: var(--color-good); box-shadow: 0 0 6px var(--color-good); }
.feed-msg { font-size: 13px; line-height: 1.4; color: var(--color-ink-2); overflow-wrap: anywhere; }
.feed-meta { margin-top: 2px; font-size: 11.5px; color: var(--color-ink-4); font-variant-numeric: tabular-nums; }
/* Panneau qui prend la hauteur de son voisin et fait défiler son contenu */
@media (min-width: 1101px) {
  .panel.fill { display: flex; flex-direction: column; contain: size; }
  .panel.fill > .feed, .panel.fill > .empty, .panel.fill > .table-wrap { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
}
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.page-grid > .panel + .panel { margin-top: 0; }
.grid-2 > .panel + .panel { margin-top: 0; }

.page-back { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 4px; flex-shrink: 0; background: var(--color-line); }

.page-intro { margin: -4px 0 16px; font-size: 13.5px; color: var(--color-ink-3); }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .form-span { grid-column: 1 / -1; }
.form-foot { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 2px; }
.form-row { margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline-block; margin-left: 2px; }

/* Encart repliable (historique — gardé pour compatibilité) */
.addbox { margin-bottom: 16px; background: var(--color-surface); border: 1px solid var(--panel-line); border-radius: 14px; box-shadow: var(--shadow-panel); }
.addbox > summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; list-style: none; cursor: pointer; user-select: none; border-radius: 14px; }
.addbox > summary::-webkit-details-marker { display: none; }
.addbox > summary:hover { background: rgba(31, 31, 36, 0.5); }
.addbox-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.addbox-title svg { color: var(--color-accent); }
.addbox-chev { width: 7px; height: 7px; margin-left: auto; flex-shrink: 0; border-right: 1.5px solid var(--color-ink-3); border-bottom: 1.5px solid var(--color-ink-3); transform: rotate(45deg); transition: transform 0.2s ease; }
.addbox[open] > summary .addbox-chev { transform: rotate(225deg); }
.addbox[open] > summary { border-bottom: 1px solid var(--color-line); border-radius: 14px 14px 0 0; }
.addbox > .page-grid, .addbox-body { padding: 16px; }

/* Indicateurs « connexion… » / « branding… » */
.conn-badge .dot, .brand-badge .dot { animation: connPulse 1s ease-in-out infinite; }
.conn-dots::after { content: ""; display: inline-block; width: 1ch; text-align: left; animation: connDots 1.4s steps(1, end) infinite; }
@keyframes connPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes connDots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
.brand-badge { color: #fdba74; background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.28); }

/* Chargement */
#topbar-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100002;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.8);
  opacity: 0;
  pointer-events: none;
  transition: width 0.2s ease, opacity 0.3s ease;
}
#topbar-progress.active { opacity: 1; }
.btn .btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
.btn.is-loading { pointer-events: none; opacity: 0.75; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
#nav-veil {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 11, 13, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#nav-veil.active { opacity: 1; transition-delay: 0.25s; }
#nav-veil .veil-spinner {
  width: 30px;
  height: 30px;
  border: 2.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.fade-in { animation: fade-in 0.16s ease-out; }
@keyframes fade-in { from { opacity: 0; translate: 0 4px; } }

/* ═══ Connexion ══════════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 380px; padding: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; border-bottom: 1px solid var(--color-line); }
.login-brand .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
.login-title { font-size: 15px; font-weight: 600; line-height: 1.25; }
.login-sub { margin-top: 1px; font-size: 12.5px; color: var(--color-ink-3); }
.login-main { padding: 20px 22px 22px; }
.login-card .btn-primary { height: 38px; margin-top: 4px; }
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 9px 12px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 9px;
  background: rgba(248, 113, 113, 0.07);
  color: #fca5a5;
  font-size: 13px;
}
.login-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--color-ink-4); }

/* ═══ XYZ — compléments (mêmes règles du guide, besoins propres au panel X) ═══ */

/* Logo image (Doritos) dans la barre latérale */
.brand-logo-img { height: 26px; width: auto; max-width: 92px; object-fit: contain; flex-shrink: 0; }

/* Horloge New York (topbar, à côté de Live) */
.ny-clock { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; font-size: 13.5px; font-weight: 500; color: var(--color-ink-2); white-space: nowrap; }
.ny-clock-label { font-size: 11.5px; font-weight: 600; color: var(--color-ink-4); }
@media (max-width: 760px) { .ny-clock-label { display: none; } }

/* Compteur à côté du titre de la topbar */
.title-count { font-size: 15px; font-weight: 500; color: var(--color-ink-4); }

/* Segments sous forme de radios (ex. format d'import) */
.segmented > label {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 7px; color: var(--color-ink-3);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 0.12s, background 0.12s;
}
.segmented > label:hover { color: var(--color-ink); }
.segmented > label:has(input:checked) {
  background: #26262c; color: var(--color-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.segmented > label > input[type="radio"] { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

/* Carte d'option cliquable (bouton) */
button.option-card { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: border-color 0.12s, background 0.12s, box-shadow 0.12s; }
button.option-card:hover { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.04); }

/* Aperçu live (contenu du panneau de détails) */
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.xpv-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--color-accent); border-right-color: transparent; border-radius: 50%; animation: btn-spin 0.6s linear infinite; }
.xpv-error { padding: 20px 16px; font-size: 13px; color: #fca5a5; }
.xpv-profile { padding: 14px 16px 16px; border-bottom: 1px solid var(--color-line); }
.xpv-bio { margin-top: 10px; font-size: 13px; line-height: 1.45; color: var(--color-ink-2); white-space: pre-wrap; }
.xpv-link { display: block; margin-top: 6px; font-size: 12px; color: var(--color-accent); overflow-wrap: anywhere; }
.xpv-loc { margin-top: 4px; font-size: 12px; color: var(--color-ink-3); }
.xpv-section { padding: 14px 16px 6px; font-size: 12px; font-weight: 500; color: var(--color-ink-3); }
.xpv-none { padding: 4px 16px 16px; font-size: 13px; color: var(--color-ink-3); }

/* Pastille « fantôme » + pastilles cliquables */
.badge-ghost { color: var(--color-ink-3); background: transparent; border-color: var(--color-line); }
a.badge, button.badge { cursor: pointer; text-decoration: none; transition: filter 0.12s, border-color 0.12s, color 0.12s; }
a.badge:hover, button.badge:hover { filter: brightness(1.15); }
button.badge { font-family: var(--font); }

/* Puces de filtre (liens) : « Connectés · 22 » — accent quand actif */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  background: var(--color-raised);
  color: var(--color-ink-2);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip:hover { border-color: var(--color-line-strong); color: var(--color-ink); }
.chip svg { width: 13px; height: 13px; flex-shrink: 0; }
.chip .count { color: var(--color-ink-4); font-variant-numeric: tabular-nums; }
.chip.warn .count { color: var(--color-warn); }
.chip.active { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.08); color: var(--color-ink); }
.chip.active .count { color: var(--color-accent); }
.chip.off { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); color: #fca5a5; }
.chip.retry { border-color: rgba(249, 115, 22, 0.3); background: rgba(249, 115, 22, 0.07); color: #fdba74; }
.chip.retry .count { color: #fdba74; }
.chip-x {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: -4px;
  border-radius: 999px; color: var(--color-ink-4); text-decoration: none; transition: background 0.12s, color 0.12s;
}
.chip-x:hover { background: var(--color-subtle); color: var(--color-bad); }
.chip-x svg { width: 12px; height: 12px; }

.filters { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--color-line); }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter-label { min-width: 118px; font-size: 12px; font-weight: 500; color: var(--color-ink-4); }
.filter-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.filter-tools .input { height: 32px; font-size: 13.5px; }
.filter-tools .spacer { flex: 1; }
/* Plusieurs petits groupes de filtres sur une seule ligne */
.filter-row-groups { gap: 8px 22px; }
.filter-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter-group + .filter-group { padding-left: 22px; border-left: 1px solid var(--color-line); }
.filter-group:first-child .filter-label { min-width: 118px; }
.filter-group .filter-label { min-width: 0; margin-right: 2px; }
.filter-tools .filter-group-end { margin-left: auto; }
/* Liste des comptes : tags sur 1-2 lignes, proxy sur une ligne */
.tags-cell { min-width: 178px; }
.tags-cell .badge { gap: 3px; padding: 0 6px; }
.tags-cell .badge svg { width: 10px; height: 10px; }
.proxy-cell > span.muted { display: inline-block; max-width: 80px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barre de sélection multiple (actions groupées) */
.bulkbar {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 8px 16px;
  background: color-mix(in srgb, var(--color-accent) 6%, #141417);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.25);
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.8);
}
.bulkbar-count { margin-right: 6px; font-size: 13px; color: var(--color-ink-2); white-space: nowrap; }
.bulkbar-count b { color: var(--color-accent); font-variant-numeric: tabular-nums; }
.bulkbar .toolbar-sep { margin: 0 2px; }

/* Bloc « tient dans l'écran » : la liste défile DANS le panneau (en-tête de tableau
   collant, filtres et pagination toujours visibles) au lieu de faire défiler la page.
   Hauteur affinée en JS (base.html) selon la position du bloc. Ordinateur seulement. */
@media (min-width: 901px) {
  .panel.fit { display: flex; flex-direction: column; max-height: calc(100vh - 104px); }
  .panel.fit > * { flex: none; }
  .panel.fit > .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
  .content:has(.panel.fit) { padding-bottom: 16px; }
}

/* Pied de tableau (compteur + pagination) */
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--color-line); font-size: 12.5px; color: var(--color-ink-3); }
.pager { display: flex; align-items: center; gap: 6px; }

/* Ligne de tableau cliquable / cellule identité */
.table tr.is-click { cursor: pointer; }
.ident-sub { font-size: 12px; color: var(--color-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ident-tags { display: inline-flex; align-items: center; gap: 4px; }
.ident a.ident-name { color: var(--color-ink); }
.ident a.ident-name:hover { color: var(--color-accent); }
.cell-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tweet-text { max-width: 440px; font-weight: 500; line-height: 1.4; color: var(--color-ink); overflow-wrap: anywhere; }
.tweet-meta { margin-top: 3px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-ink-3); }
.tweet-meta svg { width: 12px; height: 12px; }
.metrics { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.metrics span { display: inline-flex; align-items: center; gap: 4px; }
.metrics svg { width: 13px; height: 13px; }

/* Tableau compact (dans un encart) */
.table.compact th { padding: 8px 10px; }
.table.compact td { padding: 8px 10px; font-size: 13px; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table.compact th:first-child, .table.compact td:first-child { padding-left: 0; }
.table.compact th:last-child, .table.compact td:last-child { padding-right: 0; }

/* Mini-jauge (seuil de vues d'un tweet test, etc.) */
.bar.sm { flex: none; width: 120px; height: 4px; }
.bar-fill.good { background: var(--color-good); box-shadow: 0 0 10px rgba(34, 197, 94, 0.45); }
.bar > .bar-fill { display: block; }   /* un <span> de remplissage doit être bloc, sinon la barre reste vide */
.meter { display: flex; align-items: center; gap: 8px; }

/* En-tête de fiche (compte) : avatar + identité + actions */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 18px 18px 18px 20px; }
.profile-head .avatar { width: 60px; height: 60px; font-size: 22px; }
.profile-name { font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.profile-handle { margin-top: 1px; font-size: 13.5px; color: var(--color-ink-3); }
.profile-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.profile-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.profile-bio { padding: 0 20px 16px; font-size: 13.5px; line-height: 1.5; color: var(--color-ink-2); white-space: pre-wrap; }
.profile-bio a { color: var(--color-accent); overflow-wrap: anywhere; }

/* Grille de lignes clé → valeur (détails) */
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; padding: 6px 16px 10px; }
.kv-grid .kv { border-bottom: 1px solid rgba(39, 39, 44, 0.7); }

/* Encarts dépliables (Branding, Sélection intelligente, Session…) */
.fold { background: var(--color-surface); border: 1px solid var(--panel-line); border-radius: 14px; box-shadow: var(--shadow-panel); }
.fold > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px 0 12px; list-style: none; cursor: pointer; user-select: none; border-radius: 14px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: rgba(31, 31, 36, 0.5); }
.fold-title { display: flex; flex-direction: column; min-width: 0; }
.fold-title b { font-size: 14px; font-weight: 600; color: var(--color-ink); }
.fold-title span { font-size: 12px; color: var(--color-ink-3); }
.fold-chev { margin-left: auto; width: 16px; height: 16px; color: var(--color-ink-3); transition: transform 0.2s ease; flex-shrink: 0; }
.fold[open] > summary .fold-chev { transform: rotate(180deg); }
.fold[open] > summary { border-bottom: 1px solid var(--color-line); border-radius: 14px 14px 0 0; }
.fold-body { padding: 16px; }
.fold-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.fold-grid > *, .grid-2 > *, .page-grid > * { min-width: 0; }

/* Étapes « comment ça marche » (une phrase de contexte, pas de décor) */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 16px; }
.step { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border-radius: 12px; background: #17171b; border: 1px solid var(--color-line); }
.step-name { font-size: 13.5px; font-weight: 600; color: var(--color-ink); line-height: 1.3; }
.step-help { margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--color-ink-3); }
.step-help b { color: var(--color-ink-2); font-weight: 600; }

/* Sélecteur de comptes (cases à cocher en grille) */
.picker-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.picker-all { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px;
  max-height: 210px; overflow-y: auto; padding: 6px; border: 1px solid var(--color-line); border-radius: 10px; background: var(--chrome);
}
.picker-grid label { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 7px; font-size: 13px; color: var(--color-ink-2); cursor: pointer; transition: background 0.12s; }
.picker-grid label:hover { background: var(--color-subtle); color: var(--color-ink); }
/* Warmup : progression en segments (un par jour), le jour en cours se remplit */
.wu-prog { min-width: 168px; }
.wu-track { display: flex; gap: 4px; }
.wu-seg { position: relative; flex: 1; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
.wu-seg i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, #059669, #34d399); }
.wu-seg.done i { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.wu-seg.now i { background: linear-gradient(90deg, #10b981, var(--color-accent)); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.45); }
.wu-seg.now i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent); transform: translateX(-100%); animation: wu-shine 2.4s ease-in-out infinite; }
@keyframes wu-shine { to { transform: translateX(100%); } }
.wu-prog-meta { display: flex; align-items: baseline; gap: 2px; margin-top: 6px; font-size: 12px; color: var(--color-ink-4); }
.wu-prog-meta b { color: var(--color-ink); font-weight: 600; }
.wu-prog-meta em { margin-left: auto; font-style: normal; color: var(--color-ink-3); }
.wu-sess { font-size: 12.5px; color: var(--color-ink-4); }
.wu-sess b { color: var(--color-ink); font-weight: 600; font-size: 13.5px; }
.wu-dots { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: 1px; }
.wu-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.wu-dots i.on { background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.6); }
@media (prefers-reduced-motion: reduce) { .wu-seg.now i::after { animation: none; } }
.picker-grid label.is-busy { opacity: 0.45; cursor: not-allowed; }
.picker-grid label.is-busy:hover { background: transparent; color: var(--color-ink-2); }
.picker-grid label.is-busy .badge { margin-left: auto; }
.picker-grid label:has(input:checked) { color: var(--color-ink); background: rgba(var(--accent-rgb), 0.06); }

/* Case à cocher en ligne avec son libellé */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--color-ink-2); cursor: pointer; user-select: none; }
.check:hover { color: var(--color-ink); }
.check .muted { font-size: 12px; }

/* Ligne d'édition dépliée sous une ligne de tableau */
.table tr.edit-row > td { background: #17171b; padding: 16px; }

/* Puces de suggestion (labels existants dans une modale) */
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggest button { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--color-line); background: var(--color-raised); color: var(--color-ink-2); font: 500 12px var(--font); cursor: pointer; transition: border-color 0.12s, color 0.12s; }
.suggest button:hover { border-color: rgba(var(--accent-rgb), 0.6); color: var(--color-ink); }

/* Branding groupé : case à cocher + champ, champ grisé tant que la case est vide */
.brand-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; }
.brand-row > .check { min-height: 36px; }
.brand-row .input:disabled { opacity: 0.35; }
.brand-ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.brand-ctl > .segmented { align-self: flex-start; }
.brand-row:not(.is-on) .brand-ctl { opacity: 0.4; pointer-events: none; }
.brand-row:not(.is-on) .brand-ctl .input:disabled { opacity: 1; }

/* Petite aide clavier */
.kbd-hint { font-size: 12px; color: var(--color-ink-4); }

/* Overview : 4 blocs reliés (comptes → contenu → publication → publiés) */
.flow-row.four { gap: 44px; }
.flow-row.four .node3d { width: auto; flex: 1 1 0; min-width: 0; max-width: 236px; }
.flow-row.four .node3d--money { flex: 1.35 1 0; max-width: 310px; }

/* Branche warmup : même grille que la ligne du dessus (colonnes alignées),
   reliée à « Comptes actifs » par un câble vertical */
.flow-branch { margin-top: 54px; align-items: flex-start; }
.flow-branch.is-idle .node3d:not(.flow-spacer) { opacity: 0.55; }
.flow-spacer { visibility: hidden; pointer-events: none; }
.port--down { top: auto; bottom: calc(-6px - var(--depth)); left: 50%; margin-top: 0; margin-left: -5.5px; }
.port--up { top: -6px; left: 50%; margin-top: 0; margin-left: -5.5px; }
.wu-days { display: flex; gap: 4px; margin-top: 6px; }
.wu-day {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px;
  border-radius: 6px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10.5px; font-weight: 600; color: var(--color-ink-4);
}
.wu-day b { font-weight: 700; color: var(--color-ink-3); }
.wu-day.on { color: color-mix(in srgb, var(--kind) 55%, white); border-color: color-mix(in srgb, var(--kind) 35%, transparent); }
.wu-day.on b { color: var(--color-ink); }

/* Ligne de fil (liste de tweets publiés) */
.feed-item .badge { flex-shrink: 0; }
.feed-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.feed-text { flex: 1; min-width: 0; font-size: 13px; color: var(--color-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { flex-shrink: 0; font-size: 11.5px; color: var(--color-ink-4); font-variant-numeric: tabular-nums; }

/* Console de logs (fond « chrome », police mono) */
.console {
  max-height: 340px; overflow-y: auto; padding: 10px 0; background: var(--chrome);
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
.console-line { display: flex; gap: 10px; padding: 1px 16px; color: var(--color-ink-2); }
.console-line:hover { background: rgba(255, 255, 255, 0.025); }
.console-ts { flex-shrink: 0; color: var(--color-ink-4); font-variant-numeric: tabular-nums; }
.console-act { flex-shrink: 0; color: var(--color-ink-3); }
.console-msg { min-width: 0; overflow-wrap: anywhere; }
.console-line.lvl-error .console-msg { color: #fca5a5; }
.console-line.lvl-warning .console-msg { color: #fcd34d; }
.console-line.lvl-success .console-msg { color: #86efac; }

/* ═══ Responsive ═════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  .flow-row.four { gap: 30px; }
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-row { gap: 40px; }
  .node3d { width: 200px; }
  .node3d--money { width: 270px; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.even, .page-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .flow-row, .flow-row.four { flex-direction: column; gap: 46px; }
  .node3d, .node3d--money,
  .flow-row.four .node3d, .flow-row.four .node3d--money { width: min(320px, 100%); max-width: none; flex: none; }
  .fold-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-head { flex-wrap: wrap; }
  .profile-actions { margin-left: 0; justify-content: flex-start; }
  .filter-label { min-width: 0; width: 100%; }
  .filter-group + .filter-group { padding-left: 0; border-left: 0; }
  .port--in { left: 50%; top: -6px; margin-top: 0; margin-left: -5.5px; }
  .port--out { right: auto; left: 50%; top: auto; bottom: -6px; margin-top: 0; margin-left: -5.5px; }
  .node3d--money .port--in { top: -6px; }
  .flow-branch { margin-top: 46px; align-items: center; }
  .flow-spacer, .port--down, .port--up { display: none; }
}

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar .brand-text,
  .sidebar .section-label,
  .sidebar .nav-text,
  .sidebar .logout-text { display: none; }
  .brand { justify-content: center; padding: 0 8px; }
  .sidebar nav { padding: 8px; }
  .nav-group { gap: 4px; margin-bottom: 12px; }
  .nav-link { justify-content: center; padding: 10px; }
  .sidebar-foot .btn { justify-content: center; }
  .content { padding: 20px 16px 48px; }
  .topbar { padding: 0 10px 0 16px; }
  .subbar { padding: 7px 10px 7px 16px; }
  .user-chip .user-name { display: none; }
}

@media (max-width: 760px) {
  .topbar .lbl { display: none; }
  .topbar .btn:has(.lbl) { width: 34px; padding: 0; }
  .crumb, .crumb-sep { display: none; }
  .kpi { padding: 4px 12px; }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-overlay { padding: 16px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot, .conn-badge .dot, .brand-badge .dot { animation: none; }
  .node-card, .node3d__side, .node-tag { transition: none; }
}
