/* Console Spark (Lot 2) — même langage visuel que le panneau v2 :
   variables --p-* partagées, thème clair/sombre porté par la console
   elle-même ([data-draco-theme] sur <html>, choix persisté +
   prefers-color-scheme par défaut). */
:root {
  --p-fond: #fbfbfa; --p-surface: #ffffff; --p-bord: #e4e5e0;
  --p-texte: #242624; --p-doux: #6c7268; --p-faint: #8a8f84;
  --p-chip: #f4f5f1; --p-chip-bord: #d6d8d1; --p-chip-survol: #e9ebe4;
  --p-agent: #eef0ea; --p-champ: #ffffff; --p-code: #e8eae3;
  --p-appro-fond: #fdf6ec; --p-danger-fond: #f6e3de; --p-danger: #a03a28;
  --p-accent: #7c5cd6; --p-lien: #5b3df0; --p-ok: #2ea36b;
}
[data-draco-theme="dark"] {
  --p-fond: #17181a; --p-surface: #1f2023; --p-bord: #33353a;
  --p-texte: #eceeeb; --p-doux: #a6aba0; --p-faint: #83887e;
  --p-chip: #26272b; --p-chip-bord: #3a3c41; --p-chip-survol: #2e3036;
  --p-agent: #26272b; --p-champ: #1f2023; --p-code: #2c2e33;
  --p-appro-fond: #2a2118; --p-danger-fond: #40241f; --p-danger: #e8a08d;
  --p-lien: #b39df5;
}
* { box-sizing: border-box; }
html, body { height: 100%; }

/* ── Barres de défilement invisibles (0.16.1) ──────────────── */
/* Le défilement (molette, tactile, clavier) reste actif partout ;
   seule la barre affichée disparaît — fil, listes, sections,
   colonne de contexte, blocs de code et bloc d'édition compris.
   L'app tient dans 100dvh : ni html ni body ne défilent. */
html, body,
.rail-nav, .listes, .vue, .fil, .droite, .detail-carte,
.composer textarea, .carte textarea,
.msg.md pre, .m-rapport.md pre, .msg.md table, .m-rapport.md table {
  scrollbar-width: none; -ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar,
.rail-nav::-webkit-scrollbar, .listes::-webkit-scrollbar,
.vue::-webkit-scrollbar, .fil::-webkit-scrollbar, .droite::-webkit-scrollbar,
.detail-carte::-webkit-scrollbar,
.composer textarea::-webkit-scrollbar, .carte textarea::-webkit-scrollbar,
.msg.md pre::-webkit-scrollbar, .m-rapport.md pre::-webkit-scrollbar,
.msg.md table::-webkit-scrollbar, .m-rapport.md table::-webkit-scrollbar {
  width: 0; height: 0; display: none;
}
body {
  margin: 0; background: var(--p-fond); color: var(--p-texte);
  font: 14.5px/1.55 system-ui, "Segoe UI", sans-serif;
}
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; background: var(--p-champ); color: var(--p-texte);
  border: 1px solid var(--p-chip-bord); border-radius: 9px; padding: 8px 10px;
}
a { color: var(--p-lien); }
.doux { color: var(--p-doux); font-size: 13px; }
.etat { color: var(--p-doux); font-size: 13px; padding: 4px 2px; }

.app {
  display: grid; height: 100dvh;
  grid-template-columns: 60px 264px minmax(0, 1fr) 322px;
  grid-template-areas: "rail listes centre droite";
}
/* Sans cette garde, le display:grid ci-dessus écrase l'attribut hidden :
   la coquille restait visible au-dessus de l'écran de session (bug vu
   par Bruno le 2026-10-22, session non reconnue en bas de page). */
.app[hidden] { display: none; }
.app.sans-droite { grid-template-columns: 60px 264px minmax(0, 1fr); }
.app.sans-droite .droite { display: none; }

/* ── Rail d'icônes (0.15.0 — navigation façon app Muse) ────── */
.rail {
  grid-area: rail; background: var(--p-chip); border-right: 1px solid var(--p-bord);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0; gap: 10px; height: 100%; min-height: 0; overflow: hidden;
}
.rail-star { font-size: 23px; color: var(--p-accent); line-height: 1; flex: none; }
.rail-nav {
  display: flex; flex-direction: column; gap: 3px; align-items: center;
  flex: 1; min-height: 0; width: 100%; overflow-y: auto; overflow-x: hidden;
}
.rail-nav button {
  position: relative; border: 0; background: none; color: var(--p-texte);
  width: 42px; height: 42px; border-radius: 11px; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.rail-nav button:hover { background: var(--p-chip-survol); }
.rail-nav button.actif { background: var(--p-surface); box-shadow: inset 3px 0 0 var(--p-accent); color: var(--p-accent); }

/* ── Icônes monochromes monoline (0.16.1) ──────────────────── */
/* SVG inline partout (rail, chrome, composer) : un seul trait
   (stroke currentColor, 1.8), aucune ressource externe — la CSP
   de la console l'interdirait de toute façon. */
.ic { width: 20px; height: 20px; flex: none; }
.ic-inline { width: 15px; height: 15px; vertical-align: -3px; }
.icon-btn .ic { width: 17px; height: 17px; }
.composer-btn .ic, .composer-envoi .ic { width: 19px; height: 19px; }
.piece-retirer svg { width: 11px; height: 11px; stroke-width: 2.6; }
.recherche-wrap { position: relative; }
.recherche-wrap > .ic {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--p-doux); pointer-events: none;
}
.recherche-wrap .recherche { padding-left: 31px; }
.badge-rail {
  position: absolute; top: 2px; right: 2px; background: #cf4b32; color: #fff;
  border-radius: 999px; font-size: 10px; line-height: 1.5; padding: 0 5px; font-weight: 700;
}
.rail-pied { margin-top: auto; flex: none; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.rail-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--p-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex: none;
}

/* ── Colonne de listes (contenu selon la section active) ────── */
.listes {
  grid-area: listes; background: var(--p-surface); border-right: 1px solid var(--p-bord);
  display: flex; flex-direction: column; padding: 12px; gap: 9px; overflow-y: auto; min-width: 0;
}
.listes-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.liste-vue { display: flex; flex-direction: column; gap: 7px; min-height: 0; }
.liste-vue[hidden] { display: none; }
.liste-champ { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--p-doux); }
.liste-champ input, .liste-champ select { width: 100%; }
.j-filtres { display: flex; flex-direction: column; gap: 3px; }
.j-filtres label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 2px 4px; }
.listes-pied { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.brand-star { font-size: 22px; color: var(--p-accent); }
.brand-star.grand { font-size: 40px; }
.brand-titre { font-weight: 800; font-size: 17px; }
.icon-btn {
  border: 0; background: var(--p-agent); color: var(--p-texte);
  border-radius: 8px; width: 30px; height: 30px; font-size: 14px; flex: none;
}
.recherche { width: 100%; }
.btn-nouvelle {
  border: 0; border-radius: 10px; background: var(--p-accent); color: #fff;
  padding: 9px 12px; font-weight: 700; width: 100%;
}
.side-titre {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--p-doux); margin: 6px 2px 0;
}
.discussions { display: flex; flex-direction: column; gap: 2px; }

/* ── Section Discussions façon muse.ai (0.18.0) ────────────── */
/* Recherche en pilule + bouton ••• du panneau sur la même ligne ;
   rangées ÉPURÉES (une ligne : épingle éventuelle, titre en
   ellipsis, temps relatif et ••• au survol/rangée active) ;
   groupe « Discussions parallèles » repliable avec bouton + ;
   vue Archivées séparée ; menus contextuels partagés. */
#disc-normale { display: flex; flex-direction: column; gap: 7px; min-height: 0; }
#disc-archivees { display: flex; flex-direction: column; gap: 7px; min-height: 0; }
#disc-normale[hidden], #disc-archivees[hidden] { display: none; }
.recherche-ligne { display: flex; align-items: center; gap: 6px; }
.recherche-ligne .recherche-wrap { flex: 1; min-width: 0; }
.recherche-wrap .recherche { border-radius: 999px; }
.d-item {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px; padding: 7px 8px; cursor: pointer;
}
.d-item:hover { background: var(--p-chip); }
.d-item.actif { border-color: var(--p-accent); background: var(--p-chip); }
.d-item .d-epingle { display: inline-flex; flex: none; color: var(--p-doux); }
.d-item .d-epingle .ic { width: 14px; height: 14px; }
.d-item .d-titre {
  flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.d-item .d-quand {
  font-size: 12px; color: var(--p-faint); flex: none;
  opacity: 0; transition: opacity .12s ease;
}
.d-item .d-menu-btn {
  border: 0; background: none; color: var(--p-doux); flex: none;
  width: 24px; height: 24px; border-radius: 6px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s ease;
}
.d-item .d-menu-btn .ic { width: 16px; height: 16px; }
.d-item .d-menu-btn:hover { background: var(--p-chip-survol); color: var(--p-texte); }
.d-item:hover .d-quand, .d-item.actif .d-quand, .d-item:focus-within .d-quand,
.d-item:hover .d-menu-btn, .d-item.actif .d-menu-btn, .d-item:focus-within .d-menu-btn {
  opacity: 1;
}
/* Tactile : pas de survol — le temps et le ••• restent visibles
   et atteignables, les menus doivent y fonctionner aussi. */
@media (hover: none) {
  .d-item .d-quand { opacity: 1; }
  .d-item .d-menu-btn { opacity: .8; }
}
/* Renommage inline : le champ prend la place du titre, le reste
   de la rangée se tait pendant l'édition. */
.d-item .d-renom {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600;
  padding: 2px 6px; border-radius: 6px;
}
.d-item.en-renommage .d-quand, .d-item.en-renommage .d-menu-btn { display: none; }
/* En-tête du groupe « Discussions parallèles ». */
.d-groupe-hd { display: flex; align-items: center; gap: 2px; margin: 7px 0 1px; }
.d-groupe-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px;
  border: 0; background: none; color: var(--p-doux); text-align: left;
  font-size: 13px; font-weight: 700; padding: 4px 6px; border-radius: 7px;
}
.d-groupe-btn:hover { color: var(--p-texte); }
.d-groupe-btn .ic { width: 15px; height: 15px; flex: none; }
.d-groupe-plus {
  border: 0; background: none; color: var(--p-doux); flex: none;
  width: 26px; height: 26px; border-radius: 7px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.d-groupe-plus:hover { background: var(--p-chip-survol); color: var(--p-texte); }
.d-groupe-plus .ic { width: 16px; height: 16px; }
/* Menu contextuel partagé (rangées de discussion, panneau) :
   surface élevée arrondie, au-dessus des panneaux en
   surimpression (65/60) et du détail (80). */
.menu-ctx {
  position: fixed; z-index: 90; min-width: 224px; max-width: 80vw;
  background: var(--p-surface); border: 1px solid var(--p-bord);
  border-radius: 12px; box-shadow: 0 12px 34px rgb(0 0 0 / .28);
  padding: 5px; display: flex; flex-direction: column;
}
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: none; color: var(--p-texte); text-align: left;
  padding: 8px 9px; border-radius: 8px; font-size: 13.5px;
}
.menu-item:hover { background: var(--p-chip-survol); }
.menu-item .menu-ic {
  width: 17px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; color: var(--p-doux);
}
.menu-item .menu-ic .ic { width: 16px; height: 16px; }
.menu-item.danger { color: var(--p-danger); }
.menu-item.danger .menu-ic { color: var(--p-danger); }
/* Vue Archivées : retour rond + titre, la section entière bascule. */
.arch-hd { display: flex; align-items: center; gap: 9px; }
.arch-retour {
  width: 30px; height: 30px; border-radius: 50%; border: 0; flex: none;
  background: var(--p-agent); color: var(--p-texte); padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.arch-retour:hover { background: var(--p-chip-survol); }
.arch-retour .ic { width: 17px; height: 17px; }
.arch-titre { font-weight: 700; font-size: 14.5px; }
/* Retour à la principale, dans l'en-tête du centre : visible
   seulement pour une discussion parallèle ouverte (classe posée
   par majEntete). */
.retour-principale { display: none; }
.retour-principale.visible {
  display: inline-flex; align-items: center; justify-content: center;
}
/* Lignes de liste génériques (approbations, missions, agents, vaults) */
.l-item {
  border: 1px solid transparent; border-radius: 9px; padding: 6px 8px; cursor: pointer;
}
.l-item:hover { background: var(--p-chip); }
.l-item.actif { border-color: var(--p-accent); background: var(--p-chip); }
.l-item .l-meta { font-weight: 600; font-size: 13.5px; }
.l-item .l-sous { font-size: 12px; color: var(--p-doux); }
.l-item .pastille { margin-left: 0; margin-right: 6px; }
.agent-carte.cible { outline: 2px solid var(--p-accent); outline-offset: 1px; }

/* ── Colonne centrale ───────────────────────────────────────── */
.centre { grid-area: centre; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.centre-hd {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; flex: none;
  border-bottom: 1px solid var(--p-bord); background: var(--p-surface);
}
.centre-titres { flex: 1; min-width: 0; }
.vue-titre { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vue-sous { font-size: 12.5px; color: var(--p-doux); }
.disc-actions { display: none; gap: 6px; }
.disc-actions.visible { display: flex; }
/* 0.16.3 — mêmes boutons icône compacts que la liste des discussions :
   carrés 28 px, libellé en infobulle (title) et aria-label posés par
   le JS selon l'état de la discussion ouverte. */
.disc-actions button {
  border: 1px solid var(--p-chip-bord); background: var(--p-surface); color: var(--p-texte);
  border-radius: 7px; padding: 0; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
}
.disc-actions button .ic { width: 16px; height: 16px; }
.disc-actions button:hover { background: var(--p-chip-survol); }
.disc-actions button.danger { color: var(--p-danger); }
.vue { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.vue[hidden] { display: none; }
.vue-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--p-doux); margin: 18px 0 8px; }
.vue-conv { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
.fil {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px;
  max-width: 860px; width: 100%; margin: 0 auto;
}
.msg { max-width: 88%; padding: 9px 13px; border-radius: 13px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: #2f6fed; color: #fff; border-bottom-right-radius: 4px; }
.msg.agent { align-self: flex-start; background: var(--p-agent); border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; background: none; color: var(--p-doux); font-size: 12.5px; text-align: center; max-width: 96%; }
.puces {
  display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; flex: none;
  padding: 6px 16px 0; max-width: 860px; margin: 0 auto; width: 100%;
}
.puces button, .puce-info {
  border: 1px solid var(--p-chip-bord); background: var(--p-chip); color: var(--p-texte);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600;
}
.puces button:hover { background: var(--p-chip-survol); }
.puce-info { background: none; color: var(--p-doux); cursor: default; }
.saisie {
  display: flex; gap: 8px; padding: 10px 16px 4px; flex: none;
  max-width: 860px; margin: 0 auto; width: 100%;
}
.note {
  font-size: 11.5px; color: var(--p-faint); text-align: center; padding: 4px 16px 10px; flex: none;
}

/* ── Composer façon app Muse (0.16.0) ─────────────────────── */
/* Pilule : pièces jointes au-dessus, rangée de saisie dessous
   (＋, textarea auto-extensible, micro ou envoi rond bleu ↑).
   Pendant la dictée, la rangée d'enregistrement remplace la saisie. */
.composer {
  flex-direction: column; align-items: stretch; gap: 6px;
  background: var(--p-surface); border: 1px solid var(--p-bord);
  border-radius: 24px; padding: 8px 10px; margin-top: 6px;
  box-shadow: 0 1px 4px rgb(0 0 0 / .05);
}
.composer [hidden] { display: none !important; }
.composer-ligne { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; border: 0; background: none; resize: none; outline: none;
  padding: 8px 2px; max-height: 152px; overflow-y: auto; line-height: 1.45;
  /* Plancher : exactement une ligne (line-height + padding vertical).
     Sans lui, la mesure JS faite pendant que la coquille est encore
     masquée au démarrage (scrollHeight = 0) épinglait le champ à
     0 px — placeholder coupé en bas et widget ↕ dans la capture
     de Bruno (0.16.0). */
  min-height: calc(1.45em + 16px);
}
.composer-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: none;
  background: var(--p-chip); color: var(--p-texte); font-size: 17px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.composer-btn:hover { background: var(--p-chip-survol); }
.composer-btn.danger { color: var(--p-danger); }
.composer-envoi {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: none;
  background: #2f6fed; color: #fff; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.composer-envoi:disabled { opacity: .5; }
.composer-pieces { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 0; }
.piece-carte {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--p-chip); border: 1px solid var(--p-chip-bord);
  border-radius: 12px; padding: 5px 9px 5px 5px; max-width: 230px;
}
.piece-carte img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; display: block; }
.piece-nom { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piece-retirer {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
  border-radius: 50%; border: 0; background: var(--p-texte); color: var(--p-fond);
  font-size: 10px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
/* Rangée d'enregistrement de la dictée */
.composer-enreg { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.enreg-temps { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 36px; }
.enreg-texte {
  flex: 1; min-width: 0; color: var(--p-doux); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.enreg-onde { display: flex; align-items: center; gap: 3px; height: 26px; flex: none; }
.enreg-onde span { width: 4px; height: 30%; border-radius: 2px; background: #2f6fed; }
.composer.en-cours .enreg-onde span { animation: onde 1.05s ease-in-out infinite; }
.enreg-onde span:nth-child(3n+2) { animation-delay: .14s; }
.enreg-onde span:nth-child(3n) { animation-delay: .28s; }
.enreg-onde span:nth-child(4n) { animation-delay: .07s; }
.enreg-onde span:nth-child(5n) { animation-delay: .21s; }
@keyframes onde { 0%, 100% { height: 22%; } 50% { height: 96%; } }
/* Vignettes dans les bulles du fil */
.msg-pieces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.msg-pieces img { max-width: 190px; max-height: 150px; border-radius: 10px; display: block; }
.carte {
  background: var(--p-surface); border: 1px solid var(--p-bord); border-radius: 13px;
  padding: 14px 16px; margin-bottom: 14px;
}
.carte h3 { margin: 0 0 6px; font-size: 15px; }
.carte label { display: block; font-size: 12px; font-weight: 600; color: var(--p-doux); margin: 9px 0 3px; }
.carte select, .carte input, .carte textarea { width: 100%; }
.carte .btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn-accent {
  border: 0; border-radius: 10px; background: var(--p-accent); color: #fff;
  padding: 9px 14px; font-weight: 700; display: inline-block; text-decoration: none;
}
.carte .btns button:not(.btn-accent), .journal-barre button {
  border: 1px solid var(--p-chip-bord); background: var(--p-chip); color: var(--p-texte);
  border-radius: 9px; padding: 8px 12px; font-weight: 600;
}
/* Approbations */
.appro {
  background: var(--p-appro-fond); border: 1.6px solid #e8a13c; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 9px;
}
.appro .titre { font-weight: 700; font-size: 12px; color: #9a6a1c; text-transform: uppercase; letter-spacing: .4px; }
[data-draco-theme="dark"] .appro .titre { color: #e8bc7a; }
.appro .resume { margin: 5px 0 8px; }
.appro .btns { display: flex; gap: 7px; }
.appro .btns button { border: 0; border-radius: 8px; padding: 6px 11px; font-weight: 600; background: var(--p-agent); color: var(--p-texte); }
.appro .btns button.go { background: var(--p-ok); color: #fff; }
.appro.decidee { background: var(--p-surface); border-color: var(--p-bord); opacity: .75; }
/* Aujourd'hui */
.source-bloc h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--p-doux); margin: 10px 0 4px; }
.source-bloc ul { margin: 0; padding-left: 18px; }
/* Missions */
.m-item { border: 1px solid var(--p-bord); border-radius: 11px; padding: 9px 12px; margin-bottom: 8px; background: var(--p-surface); }
.m-entete { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.m-statut { font-size: 11.5px; font-weight: 700; color: var(--p-doux); white-space: nowrap; }
.m-statut.st-succeeded { color: var(--p-ok); }
.m-statut.st-failed { color: #cf4b32; }
.m-statut.st-running, .m-statut.st-paused_question { color: #9a6a1c; }
.m-meta { font-size: 12px; color: var(--p-doux); }
.m-rapport { font-size: 13px; margin-top: 5px; }
.m-item .btns { display: flex; gap: 7px; margin-top: 7px; }
.m-item .btns button { border: 0; border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--p-danger-fond); color: var(--p-danger); }
.m-item .btns button.reprendre { background: var(--p-chip); color: var(--p-texte); }
/* Agents */
.agent-carte { border: 1px solid var(--p-bord); border-radius: 11px; padding: 10px 13px; margin-bottom: 8px; background: var(--p-surface); }
.agent-carte .nom { font-weight: 700; }
.pastille { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--p-chip); color: var(--p-doux); margin-left: 8px; }
.pastille.ok { background: #dff2e7; color: #1d7a4c; }
[data-draco-theme="dark"] .pastille.ok { background: #173d29; color: #7fd6a8; }
.pastille.non { background: var(--p-danger-fond); color: var(--p-danger); }
.pastille.attente { background: var(--p-appro-fond); color: #9a6a1c; }
[data-draco-theme="dark"] .pastille.attente { color: #e8bc7a; }
.agent-carte .actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.agent-carte .comp-conf { margin-top: 9px; border-top: 1px dashed var(--p-bord); padding-top: 9px; }
/* Bloc webhook des instances muse-gitea (0.21.0) : état + secret à
   copier quand la pose automatique a échoué. */
.agent-carte .muse-webhook { margin-top: 9px; border-top: 1px dashed var(--p-bord); padding-top: 9px; }
.agent-carte .muse-webhook code { word-break: break-all; }
.agent-carte .muse-webhook .btns { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.agent-carte .comp-conf .btns { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.agent-carte .comp-conf .btns button { border: 1px solid var(--p-bord); border-radius: 8px; padding: 5px 10px; background: var(--p-surface); color: var(--p-texte); cursor: pointer; }
.agent-carte .comp-conf .btns button.danger { border-color: var(--p-danger, #c0392b); color: var(--p-danger, #c0392b); }
.agent-carte .actions button {
  border: 1px solid var(--p-chip-bord); background: var(--p-chip); color: var(--p-texte);
  border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600;
}
.agent-carte .actions button:hover { background: var(--p-chip-survol); }
.agent-carte .actions button.danger { color: var(--p-danger); }
.agent-carte .actions button.btn-accent { background: var(--p-accent); border-color: var(--p-accent); color: #fff; }
.carte label.case { display: flex; align-items: center; gap: 8px; color: var(--p-texte); font-size: 13px; }
.carte label.case input { width: auto; }
.carte code {
  background: var(--p-code); border-radius: 5px; padding: 1px 5px;
  font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.carte .plan-etapes { margin: 8px 0 2px; padding-left: 22px; }
.carte .plan-etapes li { margin: 8px 0; }
/* Journal */
.journal-barre { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.j-groupe { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--p-doux); margin: 12px 0 5px; }
.j-entree { display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.j-entree:hover { background: var(--p-chip); }
.j-heure { color: var(--p-doux); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.j-entree .j-type { font-size: 11.5px; color: var(--p-faint); }
.j-entree.masquee { color: var(--p-faint); font-style: italic; }
/* Mémoire */
.mem-resultat { border: 1px solid var(--p-bord); border-radius: 10px; padding: 8px 12px; margin-bottom: 7px; background: var(--p-surface); cursor: pointer; }
.mem-resultat:hover { border-color: var(--p-accent); }
.mem-resultat .chemin { font-weight: 600; font-size: 13px; }
.mem-resultat .extrait { font-size: 12.5px; color: var(--p-doux); white-space: pre-wrap; }
.mem-contenu {
  white-space: pre-wrap; word-wrap: break-word; background: var(--p-surface);
  border: 1px solid var(--p-bord); border-radius: 11px; padding: 12px 14px; font-size: 13.5px;
}
.portee {
  background: var(--p-chip); border: 1px dashed var(--p-chip-bord); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; color: var(--p-doux); margin-bottom: 12px;
}

/* ── Fond assombri des panneaux en surimpression (mobile) ──── */
/* Ordre d'empilement : centre (auto) < scrim (55) < droite (60)
   < listes (65). Affiché seulement aux largeurs où les panneaux
   sont en surimpression ET ouverts (règles dans les @media). */
.scrim {
  position: fixed; inset: 0; background: rgb(0 0 0 / .45);
  z-index: 55; display: none;
}

/* ── Colonne de droite : panneau de statut (0.17.0) ────────── */
/* Même rôle et même largeur qu'avant, nouvelle organisation
   interne façon panneau de statut muse.ai : en-tête d'identité
   centré, onglets segmentés à icônes, un seul contenu à la fois. */
.droite {
  grid-area: droite; border-left: 1px solid var(--p-bord); background: var(--p-surface);
  overflow-y: auto; padding: 13px 14px; display: flex; flex-direction: column; gap: 12px;
}
.droite ul { margin: 0; padding-left: 17px; }
.droite .mini { font-size: 13px; margin-bottom: 5px; }
.droite .appro { padding: 8px 10px; }
.droite .appro .btns button { padding: 4px 9px; font-size: 12px; }
.pan-id { text-align: center; padding: 6px 0 2px; }
.pan-medaillon {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--p-surface); border: 1.6px solid var(--p-accent);
  color: var(--p-accent); font-size: 29px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pan-nom { font-weight: 800; font-size: 17px; }
.pan-etat {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; color: var(--p-doux); margin-top: 2px;
}
.pan-point { width: 9px; height: 9px; border-radius: 50%; background: var(--p-faint); flex: none; }
.pan-point.ok { background: var(--p-ok); }
.pan-point.attente { background: #e8a13c; }
.pan-point.hors { background: #cf4b32; }
.pan-onglets {
  display: flex; gap: 2px; background: var(--p-chip);
  border: 1px solid var(--p-bord); border-radius: 999px; padding: 4px;
}
.pan-onglet {
  position: relative; flex: 1; border: 0; background: none; color: var(--p-doux);
  border-radius: 999px; padding: 7px 0;
  display: flex; align-items: center; justify-content: center;
}
.pan-onglet:hover { color: var(--p-texte); }
.pan-onglet.actif {
  background: var(--p-surface); color: var(--p-texte);
  box-shadow: 0 1px 3px rgb(0 0 0 / .14);
}
.pan-onglet .ic { width: 19px; height: 19px; }
.badge-onglet {
  position: absolute; top: 1px; right: calc(50% - 19px);
  background: #cf4b32; color: #fff; border-radius: 999px;
  font-size: 10px; line-height: 1.5; padding: 0 5px; font-weight: 700;
}
.pan-vue { min-height: 0; }
.pan-vue[hidden] { display: none; }
.pan-h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--p-doux); margin: 4px 0 7px;
}
.pan-vue .pan-h4:not(:first-child) { margin-top: 15px; }
/* Entrées d'activité cliquables (détail en surimpression). */
.j-entree.cliquable { cursor: pointer; }

/* ── Ligne d'état vivante (0.19.0) ─────────────────────────── */
/* Pendant un travail, le point de l'en-tête du panneau pulse en
   couleur d'accent ; le libellé change par transition façon
   muse.ai : le sortant glisse et fond, l'entrant prend sa place
   (~150 ms par phase). Aucun spinner, aucune barre : le texte
   raconte. */
.pan-point.vivant {
  background: var(--p-accent);
  animation: pan-pouls 1.6s ease-in-out infinite;
}
@keyframes pan-pouls {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: .7; }
}
#pan-etat-texte.etat-sortant { animation: etat-sort .15s ease-in forwards; }
#pan-etat-texte.etat-entrant { animation: etat-entre .18s ease-out; }
@keyframes etat-sort {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-4px); }
}
@keyframes etat-entre {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Cartes vivantes des missions en cours (onglet Activité) : le
   bouton Stop n'apparaît qu'au survol ou au focus, comme dans
   la vidéo muse.ai ; l'annulation passe par l'endpoint existant. */
.mission-vivante .mv-txt { flex: 1; min-width: 0; }
.mv-stop {
  flex: none; align-self: center; width: 27px; height: 27px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--p-chip-bord); background: var(--p-chip);
  color: var(--p-texte); border-radius: 8px; cursor: pointer;
  opacity: 0; transition: opacity .15s ease;
}
.mv-stop .ic { width: 13px; height: 13px; }
.mission-vivante:hover .mv-stop,
.mission-vivante:focus-within .mv-stop { opacity: 1; }
.mv-stop:hover { background: var(--p-chip-survol); }
/* Décisions récentes de l'onglet Approbations (lecture seule). */
.appro-decision { padding: 6px 8px; border-radius: 8px; }
.appro-decision:hover { background: var(--p-chip); }
/* Carte Identité : lignes libellé → valeur façon muse.ai. */
.id-carte {
  border: 1px solid var(--p-bord); border-radius: 12px; padding: 6px 12px;
  background: var(--p-chip);
}
.id-ligne {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--p-bord);
}
.id-ligne:last-child { border-bottom: 0; }
.id-lib { color: var(--p-doux); font-weight: 600; flex: none; }
.id-val { text-align: right; word-break: break-word; }

/* ── Détail en surimpression (0.17.0) ───────────────────────── */
/* Façon vue « tâche » muse.ai : carte élevée centrée sur fond
   assombri, badge d'état, faits en chronologie à gauche, contenu
   lisible à droite. Z-index au-dessus des panneaux (65/60). */
.detail-fond {
  position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.detail-fond[hidden] { display: none; }
.detail-carte {
  position: relative; background: var(--p-surface);
  border: 1px solid var(--p-bord); border-radius: 18px;
  width: 100%; max-width: 720px; max-height: 88dvh; overflow-y: auto;
  padding: 20px 22px; box-shadow: 0 18px 50px rgb(0 0 0 / .3);
}
.detail-x { position: absolute; top: 12px; right: 12px; }
.detail-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 2px 10px;
  background: var(--p-chip); color: var(--p-doux);
}
.detail-badge.ok { background: #dff2e7; color: #1d7a4c; }
[data-draco-theme="dark"] .detail-badge.ok { background: #173d29; color: #7fd6a8; }
.detail-badge.echec { background: var(--p-danger-fond); color: var(--p-danger); }
.detail-badge.info { background: var(--p-appro-fond); color: #9a6a1c; }
[data-draco-theme="dark"] .detail-badge.info { color: #e8bc7a; }
.detail-titre { margin: 9px 44px 2px 0; font-size: 17px; }
.detail-cols {
  display: grid; grid-template-columns: minmax(180px, 245px) minmax(0, 1fr);
  gap: 20px; margin-top: 14px;
}
@media (max-width: 640px) {
  .detail-cols { grid-template-columns: 1fr; }
}
/* Faits en chronologie verticale : point + trait de liaison. */
.d-fait { display: flex; gap: 10px; position: relative; padding-bottom: 13px; }
.d-fait::before {
  content: ""; position: absolute; left: 4px; top: 15px; bottom: -1px;
  width: 1px; background: var(--p-bord);
}
.d-fait:last-child { padding-bottom: 0; }
.d-fait:last-child::before { display: none; }
.d-point {
  width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px;
  background: var(--p-fond); border: 2px solid var(--p-accent); z-index: 1;
}
.d-fait-lib { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--p-doux); font-weight: 700; }
.d-fait-val { font-size: 13px; word-break: break-word; }
/* Contenu lisible : paires libellé/valeur, jamais de JSON brut. */
.d-paire { display: flex; gap: 10px; padding: 4px 0; font-size: 13px; }
.d-paire-lib { color: var(--p-doux); font-weight: 600; flex: none; min-width: 84px; }
.d-paire-val { word-break: break-word; min-width: 0; }
.d-h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--p-doux); margin: 16px 0 6px;
}
.d-sous-titre {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--p-doux); font-weight: 700; margin: 12px 0 4px;
}
.d-bloc-texte {
  white-space: pre-wrap; word-wrap: break-word; font-size: 13px;
  background: var(--p-chip); border-radius: 9px; padding: 8px 11px;
}
.d-bloc-texte.md { white-space: normal; }
.d-bloc-texte.md > *:first-child { margin-top: 0; }
.d-bloc-texte.md > *:last-child { margin-bottom: 0; }

/* ── Écrans (chargement / session) ──────────────────────────── */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login[hidden] { display: none; }
.login-carte {
  background: var(--p-surface); border: 1px solid var(--p-bord); border-radius: 16px;
  padding: 28px 30px; max-width: 430px; text-align: center;
}
.login-carte h1 { margin: 6px 0 10px; font-size: 22px; }
.lien-btn { margin-top: 6px; }

/* ── Markdown rendu par le service (mêmes règles que le panneau) */
.msg.md, .m-rapport.md { white-space: normal; }
.msg.md > *:first-child, .m-rapport.md > *:first-child { margin-top: 0; }
.msg.md > *:last-child, .m-rapport.md > *:last-child { margin-bottom: 0; }
.msg.md p, .m-rapport.md p { margin: 6px 0; }
.msg.md h1, .msg.md h2, .msg.md h3, .msg.md h4, .msg.md h5, .msg.md h6 { margin: 10px 0 4px; line-height: 1.3; }
.msg.md h1 { font-size: 17px; } .msg.md h2 { font-size: 16px; }
.msg.md h3 { font-size: 15px; } .msg.md h4, .msg.md h5, .msg.md h6 { font-size: 14px; }
.msg.md ul, .msg.md ol, .m-rapport.md ul, .m-rapport.md ol { margin: 6px 0; padding-left: 20px; }
.msg.md li, .m-rapport.md li { margin: 2px 0; }
.msg.md code, .m-rapport.md code {
  background: var(--p-code); border-radius: 5px; padding: 1px 5px;
  font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.msg.md pre, .m-rapport.md pre { background: var(--p-code); border-radius: 9px; padding: 9px 11px; overflow-x: auto; margin: 7px 0; }
.msg.md pre code, .m-rapport.md pre code { background: none; padding: 0; }
.msg.md blockquote, .m-rapport.md blockquote { border-left: 3px solid var(--p-accent); margin: 7px 0; padding: 2px 0 2px 11px; color: var(--p-doux); }
.msg.md blockquote.callout, .m-rapport.md blockquote.callout { border-radius: 0 8px 8px 0; padding: 6px 11px; color: var(--p-texte); background: var(--p-chip); }
.msg.md blockquote.callout-warning { border-left-color: #e8a13c; }
.msg.md blockquote.callout-danger { border-left-color: #cf4b32; }
.msg.md blockquote.callout-tip { border-left-color: var(--p-ok); }
.msg.md a, .m-rapport.md a { color: var(--p-lien); }
.msg.md table, .m-rapport.md table { border-collapse: collapse; margin: 7px 0; font-size: 12.5px; display: block; overflow-x: auto; max-width: 100%; }
.msg.md th, .msg.md td, .m-rapport.md th, .m-rapport.md td { border: 1px solid var(--p-bord); padding: 4px 8px; text-align: left; }
.msg.md hr, .m-rapport.md hr { border: 0; border-top: 1px solid var(--p-bord); margin: 9px 0; }
.msg.md input[type="checkbox"], .m-rapport.md input[type="checkbox"] { margin-right: 5px; }

/* ── Responsive ─────────────────────────────────────────────── */
.only-mobile { display: none; }
@media (max-width: 1180px) {
  .app { grid-template-columns: 60px 264px minmax(0, 1fr); }
  .app.sans-droite { grid-template-columns: 60px 264px minmax(0, 1fr); }
  .droite {
    position: fixed; top: 0; right: 0; height: 100dvh; width: 322px; max-width: 92vw;
    z-index: 60; box-shadow: -10px 0 30px rgb(0 0 0 / .2); transform: translateX(105%);
    transition: transform .25s ease;
  }
  .app.droite-ouverte .droite { transform: translateX(0); }
  .app.sans-droite .droite { display: flex; } /* le bouton ⓘ la fait glisser */
  .app.droite-ouverte .scrim { display: block; }
}
/* Panneau de discussions NON gardé visible (0.18.0) : en bureau,
   la colonne des listes quitte la grille et devient un panneau
   flottant façon mobile — ouverte par le ☰ du centre (le bouton
   devient visible), refermée par le choix d'une discussion, le
   scrim ou le ✕. Préférence persistée (menu ••• du panneau). */
@media (min-width: 901px) {
  .app.listes-flottantes .listes {
    position: fixed; top: 0; left: 60px; height: 100dvh; width: 264px; max-width: 80vw;
    z-index: 65; transform: translateX(calc(-100% - 64px));
    visibility: hidden; pointer-events: none; box-shadow: none;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .app.listes-flottantes.barre-ouverte .listes {
    transform: translateX(0); visibility: visible; pointer-events: auto;
    box-shadow: 10px 0 30px rgb(0 0 0 / .2);
    transition: transform .25s ease, visibility 0s;
  }
  .app.listes-flottantes.barre-ouverte .scrim { display: block; }
  .app.listes-flottantes #btn-menu,
  .app.listes-flottantes #btn-fermer-barre {
    display: inline-flex; align-items: center; justify-content: center;
  }
}
@media (min-width: 1181px) {
  .app.listes-flottantes {
    grid-template-columns: 60px minmax(0, 1fr) 322px;
    grid-template-areas: "rail centre droite";
  }
  .app.listes-flottantes.sans-droite {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas: "rail centre";
  }
}
@media (min-width: 901px) and (max-width: 1180px) {
  /* La droite est déjà fixe à ces largeurs : deux colonnes suffisent. */
  .app.listes-flottantes {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas: "rail centre";
  }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "rail centre"; }
  .app.sans-droite { grid-template-columns: 52px minmax(0, 1fr); }
  .rail-nav button { width: 44px; height: 44px; font-size: 21px; }
  /* Tiroir fermé : entièrement hors écran — le décalage tient compte
     du left: 52px (l'ancien -112% laissait ~20 px visibles, le
     liseré vu sur la capture de Bruno) —, invisible et inerte. */
  .listes {
    position: fixed; top: 0; left: 52px; height: 100dvh; width: 264px; max-width: 80vw;
    z-index: 65; transform: translateX(calc(-100% - 56px));
    visibility: hidden; pointer-events: none; box-shadow: none;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .app.barre-ouverte .listes {
    transform: translateX(0); visibility: visible; pointer-events: auto;
    box-shadow: 10px 0 30px rgb(0 0 0 / .2);
    transition: transform .25s ease, visibility 0s;
  }
  .app.barre-ouverte .scrim { display: block; }
  .only-mobile { display: inline-flex; align-items: center; justify-content: center; }
  .msg { max-width: 94%; }
}
