/* KANI — feuille de style unique (thème sombre, sobre, lisible). */:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #262b36;
  --fg: #e7e9ee;
  --muted: #98a0ae;
  --accent: #F2764B;
  --accent-2: #ffb38a;
  /* fond teinté des pastilles d'accent (n'existait pas : les puces et les
     numéros d'étape s'affichaient donc sans fond) */
  --accent-soft: #3A2418;
  --ok: #62c98a;
  --danger: #ff6b6b;
  /* jetons de DESIGN.md : ils étaient utilisés dans les règles récentes sans
     être définis — un `var()` non défini rend la propriété transparente, donc
     les pastilles « non lu » étaient invisibles. */
  --info: #5fa8f2;
  --warn: #e6b450;
  --fg-2: #b7bec9;
  --line-strong: #3a4250;
  --surface: var(--panel);
  --surface-2: var(--panel-2);
  --surface-3: var(--raised);
  /* surfaces secondaires : un seul endroit à changer pour le thème clair */
  --bg-2: #0c0e13;        /* colonnes latérales */
  --bg-3: #0b0d12;        /* rail */
  --raised: #1e2029;      /* bandeau mis en avant */
  --code-inline: #222733;
  --code-block: #161a22;
  --th: #1b2029;
  --pinned-line: #33405a;
  --late-bg: #3a2028;
  --late-fg: #ff9aa8;
  --late-line: #5a2b36;
  --note-ok: #9fd3a9;
  --shadow: 0 24px 60px #000a;
  --shadow-sm: 0 14px 34px #000a;
  /* famille à chasse fixe : utilisée par les tailles d'artefacts et les
     libellés techniques, elle n'était jamais définie (var() vide = police
     par défaut, donc des libellés qui ne s'alignaient pas en colonne). */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h2, h3, h4 { margin: 0 0 8px; font-weight: 650; }
a { color: var(--accent-2); text-decoration: none; }
input, textarea, select, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); margin: 8px 0; }
.ok { color: var(--ok); margin: 8px 0; }
.empty { color: var(--muted); padding: 14px 4px; }
.boot { padding: 40px; color: var(--muted); }
button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .15s, filter .15s;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #17110d; border-color: transparent; font-weight: 650; }
button.primary:hover { filter: brightness(1.07); }
button.small { padding: 6px 10px; font-size: 13px; }
button.mini { padding: 3px 8px; font-size: 12px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; }
button.mini:hover { color: var(--fg); }
button.danger { color: var(--danger); }
button.stop { background: var(--late-bg); color: var(--late-fg); border: 1px solid var(--late-line); }
input, textarea, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
/* ------------------------------------------------------------------ login */

.login-wrap { height: 100vh; display: grid; place-items: center; }
.login-card {
  width: min(380px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card .brand { font-size: 24px; font-weight: 700; letter-spacing: .04em; }
.login-card .logo { margin-right: 6px; }
.login-card .muted { margin: 0 0 10px; }
.login-error { color: var(--danger); font-size: 13px; }
/* --------------------------------------------------------------- coquille */

.app { display: grid; grid-template-columns: 212px 1fr; height: 100vh; overflow: hidden; }
.rail .brand { font-weight: 700; letter-spacing: .05em; font-size: 17px; padding: 0 8px; }
.rail .logo { margin-right: 5px; }

.rail .nav {
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: 1px solid transparent;
  text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--muted);
}
.rail .nav:hover { color: var(--fg); background: var(--panel); }
.rail .nav.on { color: var(--fg); background: var(--panel); border-color: var(--line); }
.rail .nav .ico { width: 18px; text-align: center; }
.rail-foot .user { display: flex; gap: 8px; align-items: center; }
.rail-foot .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel-2); color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; line-height: 1; font-weight: 700;
  font-size: 13px; text-align: center; flex-shrink: 0;
}
.rail-foot .who { display: flex; flex-direction: column; min-width: 0; }
.rail-foot .who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .who small { color: var(--muted); font-size: 12px; }
/* --------------------------------------------------------------------- chat */

.chat-layout { display: grid; position: relative;
  grid-template-columns: var(--convs-w, 252px) 6px minmax(0, 1fr) 6px var(--panel-w, 316px);
  height: 100%; overflow: hidden; }
.convs { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.convs-top { padding: 12px; }
.convs .search { margin: 0 12px 8px; }
.folders { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.chip.on { border-color: var(--accent); color: var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.conv { position: relative; padding: 9px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }

.conv:hover .del { opacity: 1; }
.tag {
  font-size: 12px; padding: 1px 6px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.messages { flex: 1; overflow-y: auto; padding: 22px 18px 8px; display: flex; flex-direction: column; gap: 14px; }
.welcome { margin: auto; text-align: center; color: var(--muted); max-width: 460px; }
.welcome h2 { color: var(--fg); font-size: 20px; }
.msg { max-width: 860px; word-break: break-word; }
.msg.user { align-self: flex-end; }
.msg.assistant .md { line-height: 1.6; }
.msg.assistant .md > *:first-child { margin-top: 0; }
.msg.tool {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12px; color: var(--muted);
  border-left: 2px solid var(--line); padding: 3px 10px;
}
.msg.tool .tool-name { color: var(--accent-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* raisonnement */
.reasoning { margin-bottom: 6px; }
.reasoning-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: none; padding: 0;
  color: var(--muted); font-size: 12px;
}
.reasoning-toggle:hover { color: var(--fg); border: none; }
.reasoning-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); opacity: .8; }
.reasoning-body {
  margin: 6px 0 0; padding: 10px 12px;
  background: var(--panel); border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; max-height: 320px; overflow-y: auto;
}
.composer textarea { flex: 1; min-height: 44px; max-height: 200px; resize: none; }
.attach {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
}
.attach input { display: none; }
.attach:hover { border-color: var(--accent); }
/* --------------------------------------------------------------- artefacts */

.artifacts { background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.artifacts > header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.artifacts .count { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; }

.artifact {
  display: flex; gap: 8px; align-items: center; padding: 7px 8px;
  border-radius: 8px; cursor: pointer; border: 1px solid transparent; font-size: 12px;
}
.artifact:hover { background: var(--panel); }
.artifact.active { background: var(--panel-2); border-color: var(--line); }
.artifact .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact .size { color: var(--muted); font-size: 12px; }
.preview { border-top: 1px solid var(--line); display: flex; flex-direction: column; height: 48%; min-height: 220px; }
.preview > header { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.preview > header .name { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.no-preview { padding: 18px; color: #333; text-align: center; }
.preview.full {
  position: fixed; inset: 24px; height: auto; min-height: 0; z-index: 60;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: var(--shadow);
}
.preview.full .preview-body { border-radius: 0 0 12px 12px; }
/* ------------------------------------------------------------------ pages */

.page { padding: 20px 24px; overflow-y: auto; height: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h2 { font-size: 18px; margin: 0; flex: 1; }
.form-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px;
}
.form-card h3 { font-size: 14px; color: var(--muted); }
.form-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-card .row input { flex: 1; min-width: 160px; }
.auto-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.auto {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; opacity: .62;
}
.auto.on { opacity: 1; border-color: var(--pinned-line); }
.auto-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.auto-name { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.auto-prompt { color: var(--muted); font-size: 12px; white-space: pre-wrap; max-height: 58px; overflow: hidden; }
.auto-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.auto-actions { display: flex; gap: 6px; flex-direction: column; }
table.users { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
table.users th, table.users td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users th { color: var(--muted); font-size: 12px; font-weight: 500; }
table.users select { padding: 4px 8px; }
/* -------------------------------------------------------------------- ops */

.ops { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.ops-head { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ops-head h2 { margin: 0; font-size: 17px; }
.ops-stats { display: flex; gap: 12px; color: var(--muted); font-size: 12px; flex: 1; flex-wrap: wrap; }

.column > header { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 4px 6px 10px; }
.badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--muted); font-size: 12px; }
.card:hover { border-color: var(--accent); }
.card.late { border-color: var(--late-line); }
.card-ref { font-weight: 700; font-size: 13px; }
.card-obj { font-size: 12.5px; margin: 2px 0; }
.card-client { font-size: 12px; color: var(--muted); }
.card-step { font-size: 12px; color: var(--accent-2); margin-top: 6px; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.late-txt { color: var(--late-fg); }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.fiche { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px 18px; }
.fiche > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fiche-ref { font-size: 18px; font-weight: 700; }
.fiche-obj { font-size: 13px; margin: 2px 0 8px; }
.fiche-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.next-action { margin: 12px 0; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--accent-2); }
.note-input { width: 100%; margin: 8px 0 10px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.step.done { opacity: .62; }
.step-head .dot { color: var(--accent); width: 14px; }
.step.done .dot { color: var(--ok); }
.step-titre { font-weight: 600; font-size: 13px; flex: 1; }
.step-body { font-size: 12px; color: var(--muted); margin: 6px 0 0 22px; }
.step-pieces { font-size: 12px; color: var(--accent-2); margin: 4px 0 0 22px; }
.step-note { font-size: 12px; color: var(--note-ok); margin: 4px 0 0 22px; }
.fiche-block h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.fiche-block ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.journal li { margin-bottom: 4px; }
.journal .at { color: var(--muted); }
.journal .act { color: var(--accent-2); }
/* --- markdown --- */
.md p { margin: .5em 0; }
.md h1, .md h2, .md h3 { margin: .8em 0 .4em; line-height: 1.25; }
.md h1 { font-size: 1.35em; }
.md h2 { font-size: 1.2em; }
.md ul, .md ol { margin: .4em 0 .4em 1.1em; padding: 0; }
.md code { background: var(--code-inline); padding: .12em .35em; border-radius: 4px; font-size: .9em; }
.md pre { background: var(--code-block); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: .6em 0; font-size: .93em; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 9px; }
.md th { background: var(--th); }
.md blockquote { border-left: 3px solid var(--line); margin: .6em 0; padding-left: 12px; color: var(--muted); }
.artifact-list .group {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 10px 8px 4px; list-style: none;
}
/* --- adaptatif : sous 1180px le panneau fichiers se masque, sous 900px la
       liste des conversations laisse la place au chat --- */
.chat-layout.no-panel { grid-template-columns: var(--convs-w, 252px) 6px minmax(0, 1fr); }

@media (max-width: 900px) {
/* le repli est décidé par le CSS : `!important` bat le style inline d'état */
  .app { grid-template-columns: 56px 1fr !important; }

/* mêmes règles que l'état replié, sans dépendre de la classe */
  .rail .label, .rail-foot .who { display: none; }

.rail-foot { align-items: center; }
.rail-foot .user { justify-content: center; gap: 0; }
.rail .logo-img { width: 26px; height: 26px; }
.rail .brand { font-size: 0; }
.rail .nav { justify-content: center; }
.rail .nav .ico { width: auto; }
.rail-foot .who { display: none; }
.chat-layout { grid-template-columns: 200px 6px minmax(0, 1fr); }

}
/* ================= v1.0 : thème clair, rail repliable, panneaux ============ */

/* thème clair : mêmes variables, valeurs inversées */
html[data-theme="light"] {
  --info: #2563eb;
  --warn: #9a6b00;
  --fg-2: #4a5262;
  --line-strong: #c7ccd6;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --line: #d9dee6;
  --fg: #1a1f27;
  --muted: #5e6b7d;
  --accent: #d9662f;
  --accent-2: #b4501f;
}
html[data-theme="light"] {
  --bg-2: #f8f9fb;
  --bg-3: #eef1f5;
  --raised: #fff4ec;
  --code-inline: #eceff4;
  --code-block: #f2f4f8;
  --th: #eef1f5;
  --pinned-line: #c9b6a0;
  --late-bg: #fdeaea;
  --late-fg: #b02a37;
  --late-line: #f0b6bb;
  --note-ok: #2f7d4f;
  --shadow: 0 24px 60px rgba(16, 24, 40, .18);
  --shadow-sm: 0 14px 34px rgba(16, 24, 40, .18);
}
/* surfaces qui restaient sombres en thème clair */
html[data-theme="light"] .conv { background: var(--panel); }
html[data-theme="light"] .conv.active { background: var(--panel-2); }
html[data-theme="light"] .tree-head:hover,
html[data-theme="light"] .artifact:hover { background: var(--panel-2); }
html[data-theme="light"] .no-preview { color: var(--fg); }
html[data-theme="light"] .sel-menu,
html[data-theme="light"] .conv .menu,
html[data-theme="light"] .modal { box-shadow: 0 18px 40px rgba(16, 24, 40, .18); }

/* rail repliable */
.app.rail-collapsed .rail { padding: 14px 8px; }
.app.rail-collapsed .rail .label { display: none; }
.app.rail-collapsed .rail .nav .ico { width: auto; }
.app.rail-collapsed .rail-foot .who { display: none; }
.app.rail-collapsed .rail-actions { flex-direction: column; align-items: center; }
.app.rail-collapsed .rail-foot .user { justify-content: center; gap: 0; }

/* poignées de redimensionnement */
.resizer, .panel-resizer {
  cursor: col-resize;
  background: transparent;
  position: relative;
}
.resizer { width: 6px; }
.panel-resizer { width: 6px; }
.resizer:hover, .panel-resizer:hover { background: var(--line); }
/* chrome du chat : tout tient sur une ligne, les sélecteurs se compactent */
.conv-head { flex-wrap: wrap; gap: 6px 8px; }

.panel-switch .mini.on { border-color: var(--accent); color: var(--fg); }
.panel-switch .mini:disabled { opacity: .4; cursor: not-allowed; }
/* panneau latéral unique (fichiers / opération / procédure) */
.side-panel {
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.side-panel > header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.panel-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.panel-body .artifact-list { flex: 1; }
.ops-panel, .procedures-panel { padding: 10px 12px; gap: 10px; }
.ops-panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.steps.compact .step { padding: 7px 9px; }
.steps.compact .step-body { display: none; }
.procedure-mini { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.procedure-mini-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* pièces d'opération */
ul.pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.pieces li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
ul.pieces li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* dossiers */
.folders .chip.folder { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

.folder-new input { width: 100%; font-size: 12px; padding: 5px 8px; }
.conv.pinned { border-color: var(--pinned-line); }

.conv:hover .conv-actions { display: flex; }
.conv .del { position: static;right: 4px;top: 5px;background: transparent;border: none;color: var(--muted);opacity: .7;padding: 2px 5px; }
/* ---- ops : tableau pleine largeur + fiche en surcouche ---- */
.ops { padding: 0; }
.board { display: flex;gap: 10px;padding: 14px 16px;overflow-x: auto;align-items: flex-start;min-height: 0;flex: 1; }
.column { background: var(--panel);border: 1px solid var(--line);border-radius: 12px;min-width: 220px;width: auto;padding: 10px;flex: 1 1 0;max-width: none;display: flex;flex-direction: column; }
.column.drop { border-color: var(--accent); background: var(--raised); }
html[data-theme="light"] .column.drop { background: #fff4ec; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tag.late { color: var(--late-fg); border-color: var(--late-line); }
.card-progress { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.card-progress .bar {
  flex: 1; height: 4px; background: var(--line); border-radius: 3px; overflow: hidden;
}
.card-progress .bar span { display: block; height: 100%; background: var(--accent); }
.card { background: var(--panel-2);border: 1px solid var(--line);border-radius: 10px;padding: 10px 12px;margin-bottom: 10px;cursor: grab; }
.card:active { cursor: grabbing; }
.fiche-overlay {
  position: fixed; inset: 0 0 0 auto; width: min(560px, 92vw);
  background: #0008; display: flex; justify-content: flex-end; z-index: 40;
}
.fiche-overlay .fiche {
  width: 100%; border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px #0006; height: 100%;
}
.preview.overlay {
  position: fixed; inset: 40px 60px 40px 60px; z-index: 60;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: var(--shadow);
}
.preview.inline { height: 300px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; }
/* ---- page Procédures ---- */
.procedures-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; min-height: 0; }

.procedure-card.on { border-color: var(--accent); background: var(--panel-2); }

.procedure-detail {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; overflow-y: auto; max-height: calc(100vh - 120px);
}
.procedure-objectif { color: var(--muted); font-size: 13px; }
ul.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
ul.docs li { display: flex; gap: 8px; align-items: center; font-size: 12px; }
ul.docs .kind { text-transform: uppercase; font-size: 12px; }
.page.procedures { overflow: hidden; display: flex; flex-direction: column; }
/* =============== v1.1 : liste de conversations compacte + menus ========== */

.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 12px 14px 4px;
}
.conv-list { list-style: none;margin: 0;padding: 0 6px 6px;overflow-y: auto;flex: 1; }
.conv-list.nested { padding-left: 14px; }
/* ligne compacte : pas de boîte, juste le titre */
.conv.compact {
  padding: 5px 8px; border-radius: 6px; border: none;
  display: flex; align-items: center; gap: 6px;
}
.conv.compact .conv-title {
  flex: 1; font-size: 12.5px; padding: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg);
}
.conv.compact:hover { background: var(--panel); }
.conv.compact.active { background: var(--panel-2); }
.conv.compact .dots {
  background: transparent; border: none; color: var(--muted);
  opacity: 0; padding: 0 4px; font-size: 14px; line-height: 1;
}
.conv.compact:hover .dots, .conv.compact.active .dots { opacity: .8; }
.conv.compact .dots:hover { color: var(--fg); }
/* menu contextuel d'une conversation */
.conv.compact { position: relative; }
.conv .menu {
  position: absolute; right: 4px; top: 26px; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 6px; width: 190px;
  display: flex; flex-direction: column; gap: 2px;
}
.conv .menu button {
  background: transparent; border: none; text-align: left;
  padding: 6px 8px; border-radius: 6px; font-size: 12.5px;
}
.conv .menu button:hover { background: var(--panel-2); }
.conv .menu button.danger { color: var(--danger); }
.conv .menu select { font-size: 12px; margin: 2px 0 4px; }
.conv .menu .menu-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 6px 8px 2px;
}
.conv .menu-backdrop { position: fixed; inset: 0; z-index: 29; }
/* un menu de 6 lignes n'a pas besoin d'un bouton « Fermer » : le clic
   extérieur le ferme (menu-backdrop), comme partout ailleurs. */
.conv input.rename {
  width: 100%; padding: 3px 6px; font-size: 12.5px;
  border-radius: 6px; border: 1px solid var(--accent);
}

.folder-group { margin-bottom: 2px; }
.folder-row {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
}
.folder-row:hover { background: var(--panel); }
.folder-row .chev {
  background: transparent; border: none; color: var(--muted);
  padding: 0 2px; font-size: 12px; width: 16px;
}
.folder-row .folder-name {
  flex: 1; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder-row .badge.small { font-size: 12px; padding: 0 6px; }
.folder-row .mini.ghost {
  background: transparent; border: none; opacity: .45; padding: 0 3px;
}
.folder-row:hover .mini.ghost { opacity: 1; }
/* raisonnement en markdown */
.reasoning-body.md { font-size: 12px; line-height: 1.55; color: var(--muted); }
.reasoning-body.md p { margin: .35em 0; }
.reasoning-body.md ul, .reasoning-body.md ol { margin: .3em 0 .3em 1em; }
/* logos/rail : bouton de déploiement plus visible */
.rail .brand { cursor: pointer; }
.app.rail-collapsed .rail .logo { font-size: 20px; }
/* aperçu texte brut */
.preview-body iframe.text-frame { background: #fff; }

.goal-step.done { opacity: .55; text-decoration: line-through; }
.goal-step .check {
  background: transparent; border: none; padding: 0 2px; color: var(--accent);
  font-size: 13px; line-height: 1.1;
}
/* documents de procédure */
ul.docs .doc-name { font-weight: 500; }
ul.docs code.path {
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  padding: 1px 5px; border-radius: 4px; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ================= v1.2 : icônes SVG, sélecteurs custom, dialogues ======== */

.icon { width: 16px; height: 16px; display: block; }
.icon-btn svg { width: 16px; height: 16px; }
/* logo (asset du repo) */
.logo-img { width: 22px; height: 22px; display: block; }
.app.rail-collapsed .logo-img { width: 26px; height: 26px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-login { font-size: 24px; font-weight: 700; gap: 10px; margin-bottom: 4px; }
.brand-login .logo-img { width: 40px; height: 40px; }
/* barre du haut de la liste : compacte, sans chevauchement */
.convs-top { display: flex; align-items: center; gap: 6px; padding: 10px; }
.convs-top .new-conv {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; font-size: 12.5px; line-height: 1;
}
.convs-top .new-conv svg { width: 14px; height: 14px; }
/* même hauteur que le bouton de création, pour une seule ligne nette */
.convs-top .mini {
  height: 28px; width: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.convs-top .mini svg { width: 14px; height: 14px; }
/* select custom */
.sel { position: relative; min-width: 0; }
.sel-btn:hover, .sel-btn.on { border-color: var(--accent); }
.sel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sel-chev { display: flex; transform: rotate(90deg); color: var(--muted); }
.sel-chev svg { width: 13px; height: 13px; }
.sel-backdrop { position: fixed; inset: 0; z-index: 40; }
.sel-menu {
  position: absolute; z-index: 41; top: calc(100% + 4px); left: 0; min-width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 40px #000a; padding: 5px; margin: 0; list-style: none;
  max-height: 320px; overflow-y: auto;
}
.sel-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 6px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.sel-item:hover { background: var(--panel-2); }
.sel-item.on { color: var(--accent); }
.sel-item .tick { width: 14px; display: flex; }
.sel-item .tick svg { width: 12px; height: 12px; }
/* menu de conversation : en overlay fixe (jamais rogné par la liste) */
.conv .menu { position: fixed; z-index: 60; }
.menu { display: flex; }
/* dialogue modal */
.modal-backdrop {
  position: fixed; inset: 0; background: #000a; z-index: 80;
  display: grid; place-items: center;
}
.modal {
  width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 30px 70px #000b;
}
.modal h3 { font-size: 15px; margin-bottom: 6px; }
.modal p { margin: 0 0 14px; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
button.danger-solid { background: var(--danger); color: #fff; border-color: transparent; font-weight: 600; }
.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
/* arbre de fichiers */
.file-tree { overflow-y: auto; }

.tree-head .chev { width: 10px; font-size: 12px; }

.artifact-list.nested { padding: 0 6px 6px 22px; }
/* --- rail : le bouton de repli doit rester visible et cliquable --- */
.rail { overflow: hidden; }

.app.rail-collapsed .rail-top {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.app.rail-collapsed .rail-toggle { width: 30px; height: 26px; }

/* ================= v1.3 : plus d'unicode décoratif, tout en CSS/SVG ======= */

.dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--muted); display: inline-block; flex-shrink: 0;
}
.dot.done { border-color: var(--ok); background: var(--ok); }
.fiche .step-head .dot, .ops-panel .step-head .dot { width: 11px; height: 11px; }
/* case à cocher d'une étape d'objectif */
.goal-step .check {
  width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--muted);
  background: transparent; padding: 0; margin-top: 2px; flex-shrink: 0;
}
.goal-step .check.done, .goal-step.done .check { border-color: var(--ok); background: var(--ok); }
.goal-step.done .check { color: var(--ok);position: relative; }
/* chevrons */
.chev { display: inline-flex; align-items: center; color: var(--muted); background: transparent; border: none; padding: 0; }
.chev svg { width: 12px; height: 12px; transition: transform .15s; }
.chev.open svg, .tree-head.open .chev svg { transform: rotate(90deg); }
/* icônes dans les lignes */
.folder-name { display: flex; align-items: center; gap: 6px; }
.folder-name svg { width: 14px; height: 14px; }
.conv-title { font-size: 13px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;padding-right: 18px;display: flex;align-items: center;gap: 5px; }
.conv-title svg { width: 11px; height: 11px; color: var(--accent); flex-shrink: 0; }

.msg.tool.failed .tool-name, .msg.tool.failed .tool-res { color: var(--danger); }
.reasoning-toggle svg { width: 13px; height: 13px; }
.attach svg { width: 17px; height: 17px; color: var(--muted); }
.conv .dots svg { width: 15px; height: 15px; }
.conv-head .mini svg, .rail-actions svg, .panel-switch svg { width: 14px; height: 14px; }
.conv-head .mini, .panel-switch .mini {
  display: inline-flex; align-items: center; gap: 5px;
}
.mini.ghost svg { width: 12px; height: 12px; }

.viewer {
  width: min(1120px, 94vw); min-height: 240px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 30px 80px #000c;
}

.viewer header {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.viewer header .mini { display: inline-flex; align-items: center; }

.viewer-body iframe, .viewer-body .doc-frame, .viewer-body .text-frame {
  width: 100%; height: 100%; border: 0; display: block; background: #fff;
}

.viewer-body .no-preview { padding: 28px; text-align: center; }
/* ================= paramètres ============================================= */
.settings { padding: 0; overflow: hidden; }
.settings-shell {
  display: grid; grid-template-columns: 230px minmax(0, 1fr);
  height: 100%; min-height: 0;
}
.set-group-title {
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); padding: 12px 10px 6px;
}
.set-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: transparent; border: none; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--fg); text-align: left;
}
.set-item:hover { background: var(--panel-2); }
.set-item.on { background: var(--panel); color: var(--accent); font-weight: 600; }
.set-item .ico { display: flex; color: var(--muted); }
.set-item.on .ico { color: var(--accent); }
.set-item svg { width: 16px; height: 16px; }
.set-side-foot {
  margin-top: auto; padding: 12px 10px 4px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line);
}
.set-side-foot .dot { width: 8px; height: 8px; }
.set-panel { overflow-y: auto; padding: 22px 26px 40px; min-height: 0; }
.set-panel h2 { font-size: 17px; margin-bottom: 14px; }
.set-panel h3 { font-size: 13px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.set-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 12px;
  max-width: 720px;
}
.set-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.set-field > span { font-size: 12px; color: var(--muted); }
.set-field input { width: 100%; }
.set-field .sel { max-width: 320px; }
.set-field .sel-btn { padding: 7px 10px; font-size: 13px; }
.set-row { display: flex; gap: 12px; flex-wrap: wrap; }
.set-readonly { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.set-readonly > span { font-size: 12px; color: var(--muted); }
.set-readonly b { font-size: 13px; font-weight: 600; }
.set-readonly b.small { font-size: 12px; font-weight: 500; color: var(--muted); word-break: break-all; }
.set-readonly.wide { grid-column: 1 / -1; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; max-width: 820px; }
.set-hint { font-size: 12px; color: var(--muted); max-width: 720px; margin: 0 0 10px; }
.set-hint code { background: var(--code-inline); padding: 1px 5px; border-radius: 4px; }
.set-note { padding: 8px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; }
.set-note.ok { background: var(--panel); border: 1px solid var(--line); color: var(--ok); }
.set-note.err { background: var(--panel); border: 1px solid var(--late-line); color: var(--late-fg); }
/* liste des secrets */
.secret-list { list-style: none; padding: 0; margin: 0; max-width: 720px; }
.secret {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); margin-bottom: 6px;
}
.secret-name { font-family: ui-monospace, monospace; font-size: 12.5px; flex: 1; }
.secret-mask { font-size: 12px; color: var(--muted); }
.secret .tag.off { opacity: .6; }
.secret-actions { display: flex; gap: 4px; }
.secret-actions svg { width: 14px; height: 14px; }
.table { border-collapse: collapse; width: 100%; max-width: 900px; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.small { font-size: 12px; word-break: break-all; }

@media (max-width: 900px) {
.settings-shell { grid-template-columns: 1fr; }
.set-group-title, .set-side-foot { display: none; }
.set-item { width: auto; }

}
/* écran de démarrage (même visuel que index.html, une fois Yew monté) */
.boot-splash {
  height: 100vh; width: 100vw;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: var(--bg); color: var(--fg);
}
.boot-splash .mark { width: 68px; height: 68px; display: block; }
.boot-splash .track {
  width: 148px; height: 3px; border-radius: 2px;
  background: var(--line); overflow: hidden;
}
.boot-splash .track i {
  display: block; height: 100%; width: 42%; border-radius: 2px;
  background: var(--accent);
  animation: boot-slide 1.15s cubic-bezier(.4,0,.2,1) infinite;
}
.boot-splash .word {
  font-size: 12px; letter-spacing: .34em; text-transform: uppercase;
  opacity: .55; padding-left: .34em;
}

@keyframes boot-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}
@media (prefers-reduced-motion: reduce) {
.boot-splash .track i { animation: none; width: 100%; opacity: .5; }

}
/* journal d'activité */
.activity-list { list-style: none; padding: 0; margin: 0; max-width: 860px; }
.activity-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.act-kind {
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--accent);
  min-width: 120px;
}
.act-detail { flex: 1; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-ts { color: var(--muted); font-size: 12px; }
/* ================= v1.4 : variante A « Atelier » — P0 ===================== */

/* 1. Focus clavier visible partout (aucune règle n'existait) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus:not(:focus-visible) { outline: none; }
/* 2. Accent lisible en thème clair : #D9662F ne passait pas AA (3,33:1) */
html[data-theme="light"] {
  /* #D9662F donnait 3,33:1 et #c4532b 4,24:1 — il faut 4,5:1 minimum */
  --accent: #b84d26;
  --accent-2: #8f3a1a;
  --accent-soft: #F7E9E3;
}
/* 3. Cibles de clic : jamais moins de 32 px (44 px pour les actions primaires) */
button.mini, .mini {
  min-height: 32px;
  min-width: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn { display: inline-flex;align-items: center;justify-content: center;padding: 6px;min-width: 34px;min-height: 34px; }
.conv .dots, .dots {
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .55;
}
.conv:hover .dots, .conv.active .dots, .dots:focus-visible { opacity: 1; }
.chev { min-width: 28px; min-height: 28px; justify-content: center; }
button.primary, button.stop { min-height: 38px; }
/* 4. Plus rien sous 12 px */
.rail .label, .conv .meta, .artifact .size, .badge.small,
.muted.small, .set-hint, .auto-meta, .doc-head, .act-ts { font-size: 12px; }
.conv-title, .folder-name, .artifact .name { font-size: 13px; }
/* 5. Rail « Atelier » : 56 px, icônes centrées, libellés au survol seulement */
.rail { padding: 12px 0; }
.app.rail-collapsed .rail { padding: 12px 0; }
.app.rail-collapsed .rail .nav { justify-content: center;width: 40px;height: 40px; }
.app.rail-collapsed .rail-foot { align-items: center;padding-top: 10px; }
/* 6. En-tête de conversation : titre + contexte + actions */
.conv-head { height: 56px; gap: 10px; }
.chip { font-size: 12px;padding: 3px 9px;border-radius: 999px;border: 1px solid var(--line);background: var(--surface-2);color: var(--fg-2);white-space: nowrap; }
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip.warn { color: var(--warn); }
/* 7. Composer : hauteur minimale confortable */
.composer textarea, .composer .input { min-height: 44px; }
/* 8. fin des textes < 12 px (libellés courts, badges, en-têtes de groupe) */
.badge, .badge.small, .tag, .kind, .ext,
ul.docs .kind, .folder-row .badge.small, .activity-row .act-kind,
.section-label, .group, .set-group-title, .auto-name .tag { font-size: 12px; }
.artifact .kind { font-size: 12px;font-weight: 700;letter-spacing: .02em;color: var(--muted);width: 26px;text-align: center; }
/* 9. bouton de repli du rail : 32 px minimum */
.rail-toggle, .app.rail-collapsed .rail-toggle { width: 34px; height: 32px; padding: 0; }
/* 10. derniers réglages P0 : cibles et tailles minimales */
.chev, .chev.open { min-width: 32px; min-height: 32px; }
.sel-btn { display: flex;align-items: center;gap: 6px;width: 100%;background: var(--panel-2);border: 1px solid var(--line);border-radius: 8px;padding: 4px 8px;font-size: 12px;color: var(--fg);cursor: pointer;min-height: 32px; }
.section-label, .set-group-title, .group, .rail .label { font-size: 12px; }
/* 11. menu contextuel : entrées de 32 px */
.conv .menu button, .menu button { min-height: 32px; }
/* ================= v1.5 : en-tête de conversation compact ================= */

.conv-head { position: relative; }
/* le bloc d'actions colle a droite : le titre de la conversation vivait ici et
   servait de ressort (`flex: 1`) ; lui retire, il faut pousser explicitement. */
.head-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; margin-left: auto; }
.head-actions .icon-btn.on { background: var(--raised); color: var(--fg); }
/* Popover de contexte : dossier, opération, agent */
.ctx-backdrop { position: fixed; inset: 0; z-index: 60; }

.ctx-field { display: flex; flex-direction: column; gap: 5px; }
.ctx-field > span { font-size: 12px; color: var(--fg-2); }
.ctx-field .sel-wrap, .ctx-field .sel-btn { width: 100%; max-width: 100%; }
/* Onglets du panneau : là où ils agissent */
.panel-tabs { display: flex; align-items: center; gap: 2px; padding: 0 6px 0 8px; }
/* 12. l'en-tête ne se replie jamais sur deux lignes */
.conv-head { flex-wrap: nowrap; overflow: hidden; align-items: center; }
.conv-head > * { min-width: 0; }
.conv-head .chips:empty { display: none; }
/* ================= v1.6 : pile d'affichage et onglets ==================== */

/* 1. Pile explicite : la page active est toujours au-dessus du rail, et les
      modales (z 40 à 90) toujours au-dessus des pages. */
.rail { position: relative; z-index: 10; }
.content { display: flex;flex-direction: column;overflow: hidden;min-width: 0;position: relative;z-index: 1; }
.content > .page { position: relative; z-index: 1; }
.set-side { border-right: 1px solid var(--line);background: var(--bg-2);padding: 16px 10px;display: flex;flex-direction: column;gap: 2px;overflow-y: auto;position: relative;z-index: 2; }
/* 2. Onglets du panneau : vrais onglets soulignés, sans boîte ni rayon —
      ils prennent 10 px de moins en hauteur chacun et ne « flottent » plus.
      `.side-panel > header` (même élément, plus spécifique) imposait encore
      10/12 px de padding : les onglets mesuraient 327 px dans 311 px et le
      bouton de fermeture sortait de la fenêtre de 27 px. */
.side-panel > header.panel-tabs,
.panel-tabs {
  height: 40px; padding: 0 6px 0 8px; gap: 0; overflow: hidden;
  border-bottom: 1px solid var(--line); align-items: stretch;
}
.panel-tabs .ptab { height: 40px;padding: 0 11px;border-radius: 0;font-size: 12.5px;color: var(--muted);white-space: nowrap;background: none;border: none;border-bottom: 2px solid transparent;margin-bottom: -1px;display: inline-flex;align-items: center; }
.panel-tabs .ptab:hover:not(:disabled) { background: none;color: var(--fg-2); }
.panel-tabs .ptab.on { background: none;color: var(--fg);border-bottom-color: var(--accent); }
.panel-tabs .ptab:disabled { opacity: .4;cursor: default; }
/* Le libellé change de longueur avec la langue : en français, « Fichiers /
   Opération / Procédure / Contexte » faisait déborder la barre de 23 px et
   sortait le bouton de fermeture de la fenêtre. Les onglets se resserrent et
   tronquent ; le bouton de fermeture, lui, ne se comprime jamais. */
.panel-tabs .ptab { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.panel-tabs .close { margin-left: auto;align-self: center;flex: 0 0 auto; }
/* 3. Numéro d'étape : pastille pleine, le chiffre ne déborde plus du cercle */
.step-num {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; line-height: 1;
}
.step-head { display: flex;align-items: center;gap: 8px; }
/* 4. Cartes de réglages : même rayon que le reste (12 px) */
.set-card, .form-card { border-radius: 12px; }
/* ================= v1.7 : ergonomie de la conversation ==================== */

/* Le fil est le seul conteneur qui défile : le bouton « revenir en bas » se
   positionne donc par rapport à la section, pas au défilement du document. */
.conversation { position: relative; }
.jump-bottom:hover { color: var(--fg); border-color: var(--line-strong); }
.jump-bottom .icon { width: 15px; height: 15px; }
/* Indicateur d'écriture : trois points qui respirent */
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: kani-typing 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .16s; }
.typing span:nth-child(3) { animation-delay: .32s; }

@keyframes kani-typing {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}/* Zone de saisie : grandit avec le texte, dans la limite de 200 px */
.composer textarea { min-height: 44px; max-height: 200px; overflow-y: auto; resize: none; }

@media (prefers-reduced-motion: reduce) {
.typing span { animation: none; opacity: .6; }

}
/* ================= v1.8 : liste des conversations — états ================ */

/* Ligne de conversation : plus de « boîte » bordée. Un fond très discret au
   survol, un liseré d'accent à gauche pour l'active, et c'est tout. */
.conv {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px 7px 10px;
  border: none; border-radius: 7px;
  transition: background .14s ease;
}
.conv:hover { background: var(--panel); }
.conv.active { background: var(--panel-2);border-color: var(--line); }
.conv.active::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 2px; border-radius: 2px; background: var(--accent);
}
.conv .conv-title { flex: 1; min-width: 0; padding-right: 4px; }
/* Indicateur d'état : en cours (pulsation) ou répondu non lu (point plein) */
.conv .status {
  width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%;
  background: transparent; transition: background .16s ease;
}
.conv .status.running {
  background: var(--accent);
  animation: kani-pulse 1.4s ease-out infinite;
}
.conv .status.unread { background: var(--info); }
.conv.is-unread .conv-title { font-weight: 600; color: var(--fg); }

@keyframes kani-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(242, 118, 75, .55); }
  70%  { box-shadow: 0 0 0 6px rgba(242, 118, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 118, 75, 0); }
}

@media (prefers-reduced-motion: reduce) {
.conv .status.running { animation: none; }

}
/* ================= v1.9 : outils interactifs ============================= */

.ui-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ui-card header b { font-size: 13px; font-weight: 600; color: var(--fg); flex: 1; }
.ui-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto;
  animation: kani-pulse 1.6s ease-out infinite;
}
.ui-kind {
  font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}
.ui-body { padding: 13px 14px; display: flex; flex-direction: column; gap: 11px; }
.ui-choice:hover { border-color: var(--line-strong); color: var(--fg); }
.ui-choice.on { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.ui-radio {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto;
}
.ui-radio.box { border-radius: 4px; }
.ui-choice.on .ui-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.ui-choice small { margin-left: auto; color: var(--muted); font-size: 12px; }
.ui-field textarea { resize: vertical; min-height: 56px; }
.ui-field input:focus, .ui-field textarea:focus, .ui-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.ui-field input[type="password"] { font-family: ui-monospace, monospace; letter-spacing: .06em; }
.ui-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-suggestions button {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12px; color: var(--fg-2);
}
.ui-suggestions button:hover { border-color: var(--accent); color: var(--accent); }
.ui-existing { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.ui-lock {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ok);
}
.ui-lock .icon { width: 13px; height: 13px; }
.ui-error { font-size: 12px; color: var(--danger); }
/* ============ v2.0 : aperçu dans le panneau + carte document ============= */

/* Le panneau affiche le document sur toute sa largeur : l'arborescence
   disparaît, l'aperçu prend la place, et le chat reste utilisable à côté. */
.panel-preview { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.preview-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.preview-bar .icon-btn:first-child .icon { transform: rotate(90deg); }
.preview-name {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-size { font-size: 12px; color: var(--muted); }
.preview-body { flex: 1;overflow: auto;background: var(--bg);min-height: 0; }
.preview-body iframe, .preview-body img { width: 100%; height: 100%; border: 0; display: block; }
.preview-body img { max-width: 100%;display: block;margin: 0 auto;object-fit: contain; }
.preview-body .no-preview { padding: 22px; color: var(--muted); text-align: center; }
.preview-body .no-preview a { color: var(--accent); }
/* Carte « document publié » dans le fil : le bouton ouvre le panneau */
.doc-card {
  display: flex; align-items: center; gap: 10px; max-width: 520px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); margin-top: 2px;
}
.doc-card .kind {
  font-size: 12px; letter-spacing: .04em; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 2px 7px;
}
.doc-card .doc-name {
  flex: 1; min-width: 0; font-size: 13px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ================= v2.1 : barre latérale unique ========================== */

/* L'application n'a plus qu'une colonne : chaque écran pose sa propre grille
   (chat : barre + conversation [+ panneau], autres : barre + page). */
.app { display: block; height: 100vh; overflow: hidden; }

.side-head .logo-img { width: 26px; height: 26px; border-radius: 7px; }
.side-head .word { font-size: 14px; font-weight: 650; letter-spacing: .01em; }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.side-nav-item .icon { width: 17px; height: 17px; color: var(--muted); }
/* pied : le bloc utilisateur, seul point d'entrée des menus */
.side-foot { position: relative; padding: 8px; border-top: 1px solid var(--line); flex-shrink: 0; }
.side-user .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: var(--panel-2); color: var(--fg-2);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600; line-height: 1;
}
.side-user .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-user .who b {
  font-size: 13px; font-weight: 600; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user .who small { font-size: 12px; color: var(--muted); }

.side-user .caret .icon { width: 14px; height: 14px; }

.side-menu-item .icon { width: 16px; height: 16px; color: var(--muted); }

@media (max-width: 900px) {

}
/* la barre latérale et la conversation tiennent exactement la fenêtre : sans
   ça le pied de la barre descend sous l'écran et le menu s'ouvre hors champ */
.chat-layout { height: 100%; min-height: 0; }
.chat-layout > .sidebar,
.chat-layout > .conversation { height: 100%; min-height: 0; }
/* hauteur définie de bout en bout : app → content → layout */
.app > .content { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.page-layout { display: grid;grid-template-columns: 300px minmax(0, 1fr);height: 100%;min-height: 0;flex: 1; }
.side-head .brand { display: flex;align-items: center;gap: 9px;height: 30px;padding: 0 7px;margin-left: -7px;border-radius: 8px; }
.side-head .brand:hover { background: var(--panel); }
/* même largeur de barre latérale sur tous les écrans (la conversation, elle,
   reste redimensionnable à la souris) */
.page-layout { grid-template-columns: 264px minmax(0, 1fr); }
/* en-tête de la barre latérale : une seule ligne, des boutons de même hauteur.
   28 px : la hauteur du texte (12,5 px) plus 8 px de respiration ; 34 px
   faisait un pavé plus haut que le titre, pour un mot de quatre lettres. */
.convs-top { display: flex; align-items: center; gap: 6px; }
.convs-top button, .convs-top .primary { height: 28px; min-height: 28px; }
.convs-top .primary { width: auto;padding: 0 10px; }
.convs-top .icon-btn { width: 28px; min-width: 28px; height: 28px; min-height: 28px; }

.convs-top .primary.small { height: 28px; min-height: 28px; font-size: 12.5px; }
/* ============ v2.2 : navigation plate, sans « boîtes » =================== */

/* Les entrées de navigation et les lignes de menu ne sont plus des rectangles
   remplis : le survol et l'état actif passent par la couleur du texte et de
   l'icône. Moins de cadre, plus de lisibilité. */
.side-nav-item,
.side-menu-item,
.side-user {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.side-nav-item.on { background: none;color: var(--accent);font-weight: 600; }
.side-nav-item.on .icon { color: var(--accent); }
.side-nav-item:hover .icon { color: var(--fg-2); }
.side-nav-item.on:hover .icon { color: var(--accent); }

.side-menu-item:hover .icon { color: var(--accent); }

.side-user:hover, .side-user.open { background: none; }
.side-user:hover .who b, .side-user.open .who b { color: var(--accent); }
/* le menu lui-même garde son fond : c'est un panneau flottant, pas un bouton */
.side-menu { padding: 8px; }
/* ============ v2.3 : rythme et alignement des composants du chat ========= */

/* Le fil : une seule échelle d'espacement (4 px), marges symétriques. */
.messages { padding: 20px 20px 14px; gap: 16px; }
/* Une carte de question appartient au fil : même largeur de colonne que le
   texte de l'agent, mêmes marges internes dans les trois composants. */
.ui-cards { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.ui-card { border: 1px solid var(--line);border-radius: 12px;background: var(--surface);max-width: 640px;overflow: hidden; }
.ui-card header { display: flex;align-items: center;gap: 9px;padding: 12px 14px;border-bottom: 1px solid var(--line); }
.ui-card .ui-body { padding: 12px 14px; gap: 12px; }
.ui-choices { display: flex;flex-direction: column;gap: 8px; }
.ui-choice { display: flex;align-items: center;gap: 10px;width: 100%;text-align: left;padding: 8px 10px;border: 1px solid var(--line);border-radius: 9px;font-size: 13px;color: var(--fg-2); }
.ui-field { display: flex;flex-direction: column;gap: 6px; }
.ui-field textarea, .ui-field input, .ui-field select { background: var(--bg);border: 1px solid var(--line);border-radius: 8px;padding: 8px 10px;color: var(--fg);font: 13px/1.5 inherit;outline: none;width: 100%; }
.ui-actions { display: flex;justify-content: flex-end;gap: 8px;margin-top: 4px; }
.ui-actions .btn { height: 34px; padding: 0 14px; }
/* Lignes d'outil : plus compactes, alignées sur la même marge. */
.msg.tool { padding: 6px 10px; border-radius: 8px; gap: 8px; }
/* La zone de saisie et le bouton « revenir en bas » partagent la même marge. */
.composer { padding: 12px 20px 14px; gap: 8px; }
.jump-bottom { position: absolute;left: 50%;transform: translateX(-50%);bottom: 104px;z-index: 5;display: inline-flex;align-items: center;gap: 6px;height: 34px;padding: 0 14px;border-radius: 999px;background: var(--raised);border: 1px solid var(--line);color: var(--fg-2);font-size: 12.5px;box-shadow: var(--shadow); }
/* La carte « document publié » s'aligne sur les cartes de question. */
.doc-card { max-width: 640px; padding: 10px 12px; border-radius: 10px; }
/* colonne de lecture : texte et cartes partagent le même bord droit */
.messages .msg, .ui-card, .doc-card { max-width: 720px; }
/* le bouton « revenir en bas » ne recouvre plus le contenu : il est calé à
   droite, au-dessus de la zone de saisie */
.jump-bottom {
  left: auto; right: 28px; transform: none; bottom: 96px;
}
/* une seule grille de lecture : la zone de saisie s'arrête au même bord droit
   que le texte et les cartes (colonne de 720 px + marge de 20) */
.composer { max-width: 760px; }
/* ============ v2.4 : file d'attente des messages ======================== */

.queue {
  max-width: 760px; display: flex; flex-direction: column; gap: 6px;
  padding: 0 20px 8px;
}
.queue-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.queue-head .badge { background: var(--accent-soft); color: var(--accent); border: none; }
.queue-head button { margin-left: auto; height: 26px; padding: 0 10px; font-size: 12px; }
.queue-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px dashed var(--line); border-radius: 9px;
  background: var(--surface); font-size: 13px; color: var(--fg-2);
}
.queue-text {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-item .mini { height: 26px; padding: 0 8px; font-size: 12px; }
.queue-input {
  flex: 1; height: 30px; background: var(--bg); border: 1px solid var(--accent);
  border-radius: 7px; padding: 0 9px; color: var(--fg); font: 13px inherit; outline: none;
}

.todo-item .check {
  width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px;
  border: 1.5px solid var(--line-strong); border-radius: 5px;
  display: grid; place-items: center; color: transparent;
}
.todo-item .check .icon { width: 11px; height: 11px; }
.todo-item .check.done { background: var(--ok); border-color: var(--ok); color: #08210f; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }

.composer .queue-send { width: 40px; padding: 0; justify-content: center; }
.composer .queue-send .icon { width: 16px; height: 16px; }

/* ============ v2.5 : une seule colonne de lecture, en-tête compris ======= */

/* Les messages s'arrêtaient à 860 px alors que la saisie s'arrête à 760 :
   deux colonnes pour un même fil. On garde 760 partout. */
.msg, .msg.user, .ui-card, .doc-card { max-width: 760px; }
/* L'en-tête est une barre pleine largeur (filet), mais son CONTENU s'aligne
   sur la colonne : padding droit calculé pour finir à 20 + 760. */
.conv-head { padding-right: max(18px, calc(100% - 780px)); }
/* Le fil lui-même est borné à la colonne : sans ça les messages s'alignent à
   droite sur la largeur du panneau et l'en-tête sur une autre grille. */
.messages { max-width: 800px; margin-right: auto; }
/* `margin-right:auto` seul ne suffit pas : en colonne flex, la zone de saisie
   se réduisait à la largeur de son contenu (356 px). */
.composer { width: 100%; max-width: 800px; }
/* ============ v2.6 : la colonne de lecture est CENTRÉE ================== */

/* v2.5 bornait le fil à 800 px mais le collait à gauche : sur une fenêtre
   large, tout le contenu s'entassait à gauche et la moitié droite restait
   vide. Une colonne de lecture se centre. */
.messages, .composer { margin-left: auto; margin-right: auto; }
/* l'en-tête suit la même colonne : padding symétrique calculé */
.conv-head {
  padding-left: max(18px, calc((100% - 800px) / 2));
  padding-right: max(18px, calc((100% - 800px) / 2));
}

/* ============ v2.7 : comportement en fenêtre étroite ==================== */

/* Sous 1200 px, les deux colonnes fixes mangent la conversation : on les
   resserre avant de masquer quoi que ce soit. */
@media (max-width: 1200px) {
.chat-layout { grid-template-columns: 210px 6px minmax(0, 1fr) 6px 264px; }
.chat-layout.no-panel { grid-template-columns: 210px 6px minmax(0, 1fr); }

}

/* Sous 1000 px, le panneau droit ne peut plus vivre dans la grille : il passe
   en surcouche par-dessus le fil, ouvert seulement quand on le demande. */
@media (max-width: 1000px) {
.chat-layout, .chat-layout.no-panel { grid-template-columns: 210px 6px minmax(0, 1fr); }
.chat-layout > .side-panel {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 25;
    width: min(360px, 88vw);
    box-shadow: -20px 0 44px rgba(0, 0, 0, .5);
    border-left: 1px solid var(--line);
  }
.chat-layout > .panel-resizer { display: none; }

}

/* Sous 820 px, la liste des conversations devient une bande d'icônes étroite
   plutôt qu'une colonne de 200 px qui étouffe le chat. */
@media (max-width: 820px) {
.chat-layout, .chat-layout.no-panel { grid-template-columns: 148px 6px minmax(0, 1fr); }
.chat-layout > .sidebar { padding-left: 6px; padding-right: 6px; }
.conv-list .conv .conv-meta, .conv-list .conv .conv-sub { display: none; }

}
/* ============ v2.8 : les outils dans le fil =============================
   Une ligne d'outil n'est pas un message : c'est un état. Verbe + objet +
   état + durée, 34 px, dépliable. Tout le détail reste au dépliage.          */

.tool-row, .tool-group {
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
  overflow: hidden; max-width: 620px;
}
.tool-head {
  display: flex; align-items: center; gap: 9px; min-height: 34px;
  padding: 5px 10px; cursor: pointer; font-size: 12.5px; color: var(--fg-2);
  user-select: none;
}
.tool-head:hover { background: var(--surface-3); }
.tool-head .ico { display: grid; place-items: center; flex: 0 0 auto; color: var(--info); }
.tool-head .ico .icon { width: 14px; height: 14px; }
.tool-head .verb { font-weight: 550; color: var(--fg); white-space: nowrap; }
.tool-head .obj {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 1;
}
.tool-head .meta {
  margin-left: auto; color: var(--muted); font-size: 12px; flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.tool-head .chev { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.tool-head .dots { display: inline-flex; gap: 3px; }
.tool-head .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--info); }
/* en cours : un balayage de 2 px en bas. Pas de spinner : il recentre la ligne
   et le fil saute à chaque appel. */
.tool-row.run, .tool-group.run { position: relative; border-color: var(--line-strong); }
.tool-row.run::after, .tool-group.run::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 38%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: kani-sweep 1.15s linear infinite;
}

@keyframes kani-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}.tool-row.run .ico { color: var(--accent); }
/* terminé / échec */
.tool-row .ico { color: var(--ok); }
.tool-row.fail { border-color: #4d2422; background: #1d1213; }
.tool-row.fail .ico, .tool-row.fail .meta { color: var(--danger); }
.tool-row.fail .verb { color: #f6b2ae; }
/* dépliage : arguments, puis sortie bornée */
.tool-args, .tool-out {
  margin: 0; padding: 8px 11px; border-top: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.5; color: var(--fg-2); white-space: pre-wrap;
  word-break: break-word;
}
.tool-args { color: var(--muted); max-height: 96px; overflow: auto; }
.tool-out { background: var(--bg); max-height: 240px; overflow: auto; }
.tool-group-body { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.tool-group-body .tool-row { max-width: none; }
/* raisonnement en direct */
.reasoning.live .dot { animation: kani-pulse 1.4s ease-in-out infinite; }
.reasoning.live .reasoning-toggle { color: var(--fg-2); }

@media (prefers-reduced-motion: reduce) {
.tool-row.run::after, .tool-group.run::after { animation: none; opacity: .5; }
.reasoning.live .dot { animation: none; }

}
/* Les enfants du fil ne doivent JAMAIS se comprimer : en colonne flex,
   `overflow:hidden` sur une ligne d'outil met son min-height à 0 et la boîte
   s'écrase à 2 px quand le fil est long (ses enfants débordent alors dehors). */
.messages > * { flex: 0 0 auto; }
/* hauteur cible d'une ligne d'outil : 34 px au total (32 de contenu + filets) */
.tool-head { min-height: 32px; padding: 4px 10px; line-height: 1.35; }
.tool-head .verb, .tool-head .obj, .tool-head .meta { line-height: 1.35; }
/* les enfants de la ligne ne se tendent pas sur la hauteur du parent
   (les points et le chevron prenaient 32 px et faisaient 40 px au total) */
.tool-head { align-items: center; }
.tool-head > *, .tool-head .dots, .tool-head .chev, .tool-head .icon {
  align-self: center; height: auto; flex: 0 0 auto;
}
/* des règles globales `.chev { min-height: 28px }
` et `.dots` gonflaient la
   ligne à 42 px ; dans une ligne d'outil on rend ces marges internes */
.tool-head .chev, .tool-head .dots { min-width: 0; min-height: 0; padding: 0; }
/* import d'un bloc .env dans les réglages */
.env-bulk {
  width: 100%; min-height: 132px; resize: vertical;
  background: var(--bg); color: var(--fg-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  line-height: 1.55;
}
.env-bulk:focus { outline: none; border-color: var(--accent); }
.env-bulk-foot { align-items: center; justify-content: space-between; margin-top: 8px; }
.set-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; }
.set-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* ============ v2.9 : la page Paramètres ne se replie pas à moitié ========
   Une règle de base (`.page-layout { grid-template-columns: 264px 1fr }
`),
   écrite APRÈS le media query, l'écrasait tout en gardant `.sidebar` en
   display:none : la grille restait à deux colonnes, `.page` tombait dans la
   colonne de 264 px et les deux tiers droits de l'écran restaient vides.
   Le repli est donc posé en fin de feuille, où il gagne. */
@media (max-width: 900px) {
.page-layout,
  .page-layout > .page { grid-template-columns: minmax(0, 1fr); }

}
/* Les cartes de réglages s'arrêtaient à 720 px collées à gauche : à 900 px de
   fenêtre, 150 px de vide à droite. Une seule colonne bornée, centrée. */
.set-panel > * { width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; }
/* même largeur que le reste de la colonne : sans ça les cartes s'arrêtaient à
   720 px pendant que les titres allaient à 820, deux bords droits pour un seul
   contenu */
.set-card { max-width: 820px; }

/* sous 900 px la navigation devient une barre : on resserre l'écart avec le
   contenu, sinon le titre flotte 60 px sous les onglets */
@media (max-width: 900px) {
.set-panel { padding: 14px 20px 32px; }
.set-side { flex-direction: row;flex-wrap: wrap;align-items: center;overflow-x: auto;padding: 10px 12px;gap: 6px; }
.set-panel h2 { margin-bottom: 10px; }

}
/* ============ v3.0 : la colonne de lecture grandit avec l'écran =========
   Sur un écran large (2 900 px), la colonne restait à 800 px : deux bandes
   noires de 850 px de chaque côté, l'impression d'un fil « écrasé ».
   Une seule source de vérité, `--read-w`, utilisée par le fil, la saisie et
   l'en-tête — sinon on retombe sur trois largeurs différentes.            */

:root { --read-w: clamp(780px, 46vw, 1200px); }
.messages,
.composer,
.queue {
  width: 100%;
  max-width: var(--read-w);
  margin-left: auto;
  margin-right: auto;
}
/* dans la colonne, les messages prennent toute la largeur disponible */
.messages .msg,
.msg,
.msg.user,
.ui-card,
.doc-card { max-width: 100%; }
/* l'en-tête est une barre pleine largeur, son contenu suit la colonne */
.conv-head {
  padding-left: max(18px, calc((100% - var(--read-w)) / 2));
  padding-right: max(18px, calc((100% - var(--read-w)) / 2));
}
/* les lignes d'outil restent bornées : une commande de 1 200 px ne se lit pas */
.tool-row,
.tool-group { max-width: min(100%, 760px); }
/* largeur de lecture choisie dans les réglages (Conversation) */
html[data-readw="confort"] { --read-w: 780px; }
html[data-readw="large"] { --read-w: min(100%, 1240px); }
html[data-readw="pleine"] { --read-w: 100%; }
/* ============ v3.1 : le fil prend tout l'espace disponible ==============
   Décision produit (Mat) : pas de colonne de lecture étroite, le chat occupe
   la largeur, avec une marge de quelques pixels sur les bords. Les anciennes
   largeurs (780/1240) restent disponibles dans les réglages pour qui préfère
   une ligne courte.                                                       */

/* Décision produit (Mat) : « auto » = toute la largeur. Une ligne courte est
   un CHOIX dans les réglages (confort 780, large 1240), jamais le défaut. */
:root { --read-w: 100%; }
.messages, .composer, .queue { max-width: var(--read-w); }
/* la marge sur les bords : 16 px, pas plus */
.messages { padding-left: 16px; padding-right: 16px; }
.composer { display: flex;gap: 8px;align-items: flex-end;padding: 12px 18px 16px;border-top: 1px solid var(--line);max-width: 800px;margin-right: auto;padding-left: 16px;padding-right: 16px; }
.conv-head { display: flex;align-items: center;gap: 12px;padding: 12px 18px;border-bottom: 1px solid var(--line);padding-left: 16px;padding-right: 16px; }
/* une ligne d'outil profite aussi de la largeur */
.tool-row, .tool-group { max-width: 100%; }
html[data-readw="auto"] { --read-w: 100%; }
/* La bulle de l'utilisateur garde une largeur de lecture : étirée sur 2 300 px
   elle devenait un bandeau gris d'un bord à l'autre. L'assistant, lui, prend
   toute la largeur (c'est du texte, pas une bulle). */
.msg.user { max-width: min(100%, 900px); }
.msg.user .bubble { background: var(--panel-2);border: 1px solid var(--line);border-radius: 12px;padding: 10px 14px;white-space: pre-wrap;width: auto;max-width: 100%; }
/* connecteurs (comptes externes) */
.conn-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.conn {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.conn-dot.on { background: var(--ok); }
.conn-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.conn-id b { font-size: 13px; color: var(--fg); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.conn-meta { font-size: 12px; color: var(--muted); }
.conn-url {
  display: block; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--fg-2); word-break: break-all;
}
.conn-write { margin: 4px 0 10px; align-items: flex-start; }
.conn-write span { font-size: 12px; line-height: 1.45; color: var(--muted); }
/* ============ v3.2 : le popover de contexte n'est plus rogné ============
   `.conv-head { overflow: hidden }
` servait à empêcher l'en-tête de déborder
   horizontalement — mais il rognait aussi le popover (247 px de haut dans une
   barre de 56 px) : le panneau s'ouvrait, invisible, sous le chat.
   On clippe le contenu qui doit l'être (le titre, les puces), pas la barre. */
.conv-head { overflow: visible; }
.conv-head .chips { display: flex;gap: 6px;align-items: center;margin-left: 4px;flex: 0 0 auto;overflow: hidden;min-width: 0; }
.conv-head .conv-name { min-width: 0;flex: 1 1 auto;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: block;line-height: 1.25; }
/* ============ v3.3 : objectif et tâches au-dessus de la saisie ============
   Ils vivaient dans le panneau latéral, derrière un onglet : il fallait
   ouvrir un panneau pour savoir où en était la tâche. Même place que la file
   d'attente — juste au-dessus de l'input, repliés par défaut. */
.strip {
  width: 100%;
  max-width: var(--read-w);
  margin: 0 auto 6px;
  padding: 0 16px;
}
.strip-head {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px; color: var(--fg-2);
  cursor: pointer; user-select: none;
}
.strip-head:hover { border-color: var(--line-strong); }
.strip-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); flex: 0 0 auto;
}
.strip-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.strip-head .badge { background: var(--accent-soft); color: var(--accent); border: none; flex: 0 0 auto; }
.strip-head .chev { color: var(--muted); flex: 0 0 auto; font-size: 12px; width: 12px; text-align: center; }
.strip-track {
  height: 2px; margin: 4px 2px 0; border-radius: 2px; background: var(--line);
  overflow: hidden;
}
.strip-track > i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.strip-body {
  margin: 6px 0 0; padding: 6px 2px 2px; list-style: none;
  display: flex; flex-direction: column; gap: 1px;
  max-height: 168px; overflow-y: auto;
}
.strip-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 8px; border-radius: 7px;
  font-size: 12.5px; color: var(--fg-2); cursor: pointer;
}
.strip-item:hover { background: var(--surface-2); }
.strip-item.done { color: var(--muted); }
.strip-item.done > span:last-child { text-decoration: line-through; }
.strip-item .check {
  flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: transparent; padding: 0; display: grid; place-items: center;
}
.strip-item .check.done { background: var(--ok); border-color: var(--ok); }
.strip-item .check svg { width: 10px; height: 10px; color: var(--bg); }
.strip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ============ v3.4 : panneau Fichiers en explorateur ============
   Un arbre, pas des chemins : chaque dossier apparaît une fois, à sa
   profondeur. L'aperçu prend tout le panneau ; l'arbre reste monté (masqué)
   pour retrouver dépliages et défilement au retour. */
.file-tree { display: flex; flex-direction: column; padding: 0; min-height: 0; }
.file-tree.hidden { display: none; }
.explorer-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px 6px; flex: 0 0 auto;
}
.explorer-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.explorer-bar .badge { background: var(--surface-3); color: var(--fg-2); border: none; }
.explorer-size { font: 12px var(--mono); color: var(--muted); }
.explorer-spacer { flex: 1; }
.explorer-filter {
  display: flex; align-items: center; gap: 6px;
  margin: 0 8px 6px; padding: 0 8px; height: 28px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  color: var(--muted); flex: 0 0 auto;
}
.explorer-filter .ico svg { width: 12px; height: 12px; }
.explorer-filter input {
  all: unset; flex: 1; min-width: 0; color: var(--fg); font-size: 12px;
}
.explorer-filter .clear {
  background: transparent; border: none; color: var(--muted);
  display: grid; place-items: center; padding: 0; cursor: pointer;
}
.explorer-filter .clear svg { width: 11px; height: 11px; }
.explorer-error {
  margin: 0 8px 6px; padding: 6px 8px; border-radius: 7px;
  background: rgba(242,112,107,.12); border: 1px solid rgba(242,112,107,.35);
  color: var(--danger); font-size: 12px;
}
.file-tree .tree { flex: 1; overflow: auto; padding: 2px 6px 10px; min-height: 0; }
.file-tree .row {
  display: flex; align-items: center; gap: 6px;
  height: 27px; padding-right: 6px; border-radius: 6px;
  cursor: default; user-select: none;
}
.file-tree .row:hover { background: var(--surface-2); }
.file-tree .row.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(242,118,75,.35); }
.file-tree .row.sel .name { color: var(--fg); }
.file-tree .row.drop {
  background: rgba(242,118,75,.14);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.file-tree .row.dir { cursor: pointer; }
.file-tree .row.dir .name { color: var(--fg); }
.file-tree .row.file { cursor: pointer; }
.file-tree .row.file .name { color: var(--fg-2); }
.file-tree .tw {
  width: 12px; height: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--muted);
  transition: transform .12s ease;
}
.file-tree .tw svg { width: 9px; height: 9px; }
.file-tree .tw.open { transform: rotate(90deg); }
.file-tree .row.file .tw { visibility: hidden; }
.file-tree .folder { color: #E6B450; display: grid; place-items: center; flex: 0 0 auto; }
.file-tree .folder svg { width: 15px; height: 15px; }
.file-tree .doc { color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.file-tree .doc svg { width: 13px; height: 13px; }
.file-tree .name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px;
}
.file-tree .count {
  font: 12px var(--mono); color: var(--muted); background: var(--surface-3);
  border-radius: 5px; padding: 1px 5px; flex: 0 0 auto;
}
.file-tree .count.zero { opacity: .45; }
.file-tree .ext {
  font: 12px var(--mono); letter-spacing: .04em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; line-height: 15px;
  flex: 0 0 auto;
}
.file-tree .size {
  font: 12px var(--mono); color: var(--muted);
  min-width: 46px; text-align: right; flex: 0 0 auto;
}
.file-tree .empty-hint { height: 22px; }
.file-tree .empty-hint .name { font-size: 12px; color: var(--muted); font-style: italic; }
/* ---------------------------------------------------- liste des conversations v3
   La vue est un choix explicite (chips), le dossier est du contenu (arbre).
   Actions de dossier au survol : trois glyphes permanents volaient la place du
   nom, qui se tronquait deja a 264 px. */
.view-chips {display:flex;gap:4px;flex-wrap:wrap;padding:2px 0 6px}
.view-chips .chip {display:flex;align-items:center;gap:5px;border:1px solid var(--line);
  background:transparent;color:var(--fg-2);border-radius:20px;padding:2px 9px;font-size:12px;
  cursor:pointer;font-family:inherit;height:24px}
.view-chips .chip:hover {background:var(--surface-2);color:var(--fg)}
.view-chips .chip.on {background:var(--accent-soft);border-color:var(--accent);color:var(--fg)}
.view-chips .chip .c {font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.view-chips .chip.on .c {color:var(--fg-2)}
.view-chips .chip .x {opacity:.6;font-size:12px;line-height:1}
.folder-row.focus {background:var(--accent-soft);box-shadow:inset 2px 0 0 var(--accent)}
.fcount {font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums;min-width:14px;text-align:right}
.fcount.unread {background:var(--accent);color:#1a0d07;border-radius:9px;font-weight:700;
  font-size:12px;padding:0 5px;min-width:16px;text-align:center}
.fold-acts {display:flex;gap:1px;opacity:0;transition:opacity .1s}
.folder-row:hover .fold-acts {opacity:1}
.fold-acts .mini {width:20px;height:20px;padding:0;display:grid;place-items:center}
.fold-acts .mini.on {color:var(--accent)}
.folder-rename {width:calc(100% - 16px);margin:2px 0 4px 16px;background:var(--surface-2);
  border:1px solid var(--accent);border-radius:6px;padding:4px 7px;color:var(--fg);
  font-family:inherit;font-size:12px}
.folder-rename:focus {outline:none}
.folder-new { padding: 6px 10px 8px;display: none; }
.folder-new.on {display:block}
.conv-list.nested .conv {min-height:30px}
.unfiled-drop {display:flex;flex-direction:column}
/* ------------------------------------------------- onglet Contexte (chaîne)
   Une fiche, pas un éditeur : référence, où sont les fichiers, quoi faire
   ensuite. Les listes de fichiers restent dans l'onglet Files. */
.ctx-panel {padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.ctx-head {display:flex;flex-direction:column;gap:2px}
.ctx-head b {font-size:14px;letter-spacing:.01em}
.ctx-sub {font-size:12px;color:var(--muted)}
.ctx-objet {font-size:12.5px;color:var(--fg-2)}
.ctx-grid {display:grid;grid-template-columns:auto 1fr;gap:6px 12px;margin:4px 0 0;font-size:12px}
.ctx-grid dt {color:var(--muted);white-space:nowrap}
.ctx-grid dd {margin:0;overflow:hidden;text-overflow:ellipsis}
.ctx-grid dd.mono {font-family:ui-monospace,monospace;font-size:12px;color:var(--fg-2)}
.ok-dot {color:var(--ok)}
.ok-dot::before {content:"●";margin-right:5px;font-size:12px}
.ctx-next {border-top:1px solid var(--line);padding-top:9px;margin-top:2px}
.ctx-next .lab {font-size:12px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.ctx-next p {margin-top:3px;font-size:12.5px;color:var(--fg-2);line-height:1.45}
.ctx-empty {padding:18px 6px;display:flex;flex-direction:column;gap:6px}
.ctx-empty p {font-size:12.5px;line-height:1.5}
/* journal dépliable d'une tâche de fond, dans le fil */
.job-log { padding: 4px 8px 8px 26px; }

.strip-item .check.running {
  border-color: var(--accent);
  animation: job-pulse 1.4s ease-in-out infinite;
}

@keyframes job-pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }/* En-tête de conversation : le titre vit dans la barre latérale, la place
   libérée sert aux agents et aux tâches de fond (menus déroulants). */
.conv-head { position: relative; }
.head-menu-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: 6px;
  font-size: 11.5px; color: var(--fg);
  background: var(--surface-2); border-color: var(--line-strong);
}
.head-menu-btn:hover { border-color: var(--accent); }
.head-menu-btn.on { border-color: var(--accent); color: var(--fg); }
.head-menu-btn .pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: job-pulse 1.3s ease-in-out infinite;
}
.head-pop {
  position: absolute; right: 16px; top: 50px; z-index: 31;
  width: min(440px, calc(100% - 28px));
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: 0 18px 40px #000b; padding: 8px;
}
.head-pop-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg-2); padding: 4px 8px 6px;
}
.head-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.head-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: 12px;
}
.head-row:hover { background: var(--surface-2); }
.head-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.head-row-meta { font: 10.5px var(--mono); color: var(--fg-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.head-row .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.head-row .dot.running { background: var(--accent); animation: job-pulse 1.3s ease-in-out infinite; }
.head-row .dot.done { background: var(--ok); }
.head-row .dot.failed, .head-row .dot.killed, .head-row .dot.cancelled { background: var(--danger); }
/* ============ v2.9 : corrections de l'audit UI/UX ======================
   1. largeur de lecture bornée (≈ 76 caractères)
   2. une ligne d'actions par message : heure, copier, réutiliser, régénérer
   3. panneau droit : surcouche pleine largeur + voile sous 820 px
   4. bouton primaire lisible en thème clair                              */

/* 1 — largeur de lecture : elle vit dans --read-w (voir le réglage
   « Largeur de lecture »). Ne JAMAIS poser de max-width en dur ici : ça
   écrase la variable et rend le réglage muet. */
.messages > .msg,
.messages > .tool-row,
.messages > .tool-group,
.messages > .doc-card,
.messages > .ui-card { max-width: 100%; }
/* 2 — actions : discrètes au repos, nettes au survol ou au clavier */
.msg-acts {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  opacity: .55; transition: opacity .15s ease;
}
.msg.user .msg-acts { justify-content: flex-end; }
.msg:hover .msg-acts,
.msg-acts:focus-within { opacity: 1; }
.msg-acts .msg-time {
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
/* des icônes, pas des libellés. La règle globale impose 32 px de cible
   (jamais moins) : on garde le carré, mais sans cadre au repos, pour que la
   ligne d'actions reste plus légère qu'une rangée de boutons texte. */
.msg-acts .act {
  padding: 0; width: 32px; height: 32px;
  background: transparent; border-color: transparent;
}
.msg-acts .act:hover,
.msg-acts .act:focus-visible {
  background: var(--panel-2); border-color: var(--line); color: var(--fg);
}
.msg-acts .act .icon { width: 15px; height: 15px; }
.msg-acts .act.done { color: var(--ok); border-color: var(--ok); }
.day-sep {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin: 4px 0 2px;
}
.day-sep::before, .day-sep::after {
  content: ""; height: 1px; background: var(--line); flex: 1;
}
/* 3 — surcouche : le voile capte le clic, le panneau prend toute la largeur */
.panel-backdrop { display: none; }

@media (max-width: 1000px) {
.panel-backdrop {
    display: block; position: fixed; inset: 0; z-index: 24;
    background: rgba(0, 0, 0, .5);
  }

}

@media (max-width: 820px) {
.chat-layout > .side-panel {
    left: 0; right: 0; width: 100vw; max-width: 100vw;
    box-shadow: none;
  }
.side-panel > header.panel-tabs .ptab { min-height: 44px; }

}
/* 4 — thème clair : texte du bouton primaire sous AA (3,68:1 → 5,09:1) */
html[data-theme="light"] button.primary { color: #fff; }
/* ============ Documents publiés, au bas de la réponse ====================
   Un agent qui produit trois livrables laissait l'utilisateur chercher dans
   le panneau Fichiers. La réponse porte désormais la liste de ce qu'elle a
   publié, chaque ligne ouvrant l'aperçu dans le panneau.                */

.msg-docs {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 520px; margin-top: 12px; padding: 7px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2);
}
.msg-docs-head {
  display: flex; align-items: center; gap: 7px;
  padding: 1px 5px 5px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.msg-docs-head .count {
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0 6px; font-size: 11.5px; letter-spacing: 0;
  color: var(--fg-2); font-variant-numeric: tabular-nums;
}
.doc-pill {
  display: flex; align-items: center; gap: 9px; width: 100%;
  min-height: 34px; padding: 5px 8px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 7px;
}
.doc-pill:hover { background: var(--surface-3); border-color: var(--line); }
.doc-pill:focus-visible { background: var(--surface-3); border-color: var(--accent); }
.doc-pill .doc-kind {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
}
.doc-pill .doc-kind .icon { width: 13px; height: 13px; }
.doc-pill .doc-pill-name {
  flex: 1; min-width: 0; font-size: 13px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-pill .doc-pill-act {
  flex: 0 0 auto; font-size: 12px; color: var(--accent); opacity: .85;
}
.doc-pill:hover .doc-pill-act { opacity: 1; }

/* sur mobile, le nom passe sur deux lignes plutôt que d'être coupé */
@media (max-width: 820px) {
.msg-docs { max-width: 100%; }
.doc-pill .doc-pill-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

}
/* Réglages éditables en tête du panneau Contexte (workspace, opération, agent).
   Ils vivaient dans un popover d'en-tête qui posait un second voile plein
   écran : deux voiles empilés, et un clic extérieur ne fermait plus rien. */
.ctx-fields {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 0 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.ctx-fields .ctx-field { display: flex; flex-direction: column; gap: 4px; }
.ctx-fields .ctx-field > span { font-size: 12px; color: var(--muted); }
/* ============ Contexte épinglé ==========================================
   Une puce = un élément que l'agent doit avoir en tête pour CETTE
   conversation. Elle vit au-dessus de la saisie, se retire d'un clic, et
   n'occupe pas le champ de texte (on ne se bat pas avec un chemin).      */

.pins-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  width: 100%; max-width: var(--read-w);
  margin-left: auto; margin-right: auto;
  padding: 0 16px 6px;
}
.pins-bar .pins-label {
  font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin-right: 2px;
}
.pin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 320px; padding: 3px 4px 3px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: 12.5px; color: var(--fg-2);
}
.pin-chip .pin-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent);
}
.pin-chip .pin-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.pin-chip .pin-x {
  display: grid; place-items: center; width: 20px; height: 20px;
  padding: 0; min-width: 0; min-height: 0;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  border-radius: 50%;
}
.pin-chip .pin-x:hover { color: var(--danger); background: var(--panel-2); }
.pin-chip .pin-x .icon { width: 11px; height: 11px; }
.ctx-pins { display: flex; gap: 6px; padding: 0 0 10px; }
/* Épingle au survol d'une ligne de l'arborescence : invisible tant qu'on ne
   survole pas, mais toujours dans le DOM pour rester accessible au clavier. */
.row-pin {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 22px; height: 22px; padding: 0; margin-left: 2px;
  min-width: 0; min-height: 0;
  border: none; background: transparent; border-radius: 5px;
  color: var(--muted); opacity: 0; cursor: pointer;
}
.row-pin .icon { width: 13px; height: 13px; }
.row:hover .row-pin, .row:focus-within .row-pin { opacity: 1; }
.row-pin:hover { color: var(--accent); background: var(--panel-2); }
/* Note libre dans le journal d'opération : un champ + un bouton, sous le fil.
   Le journal est la mémoire partagée de l'opération — l'auteur est affiché
   pour que « qui a fait quoi » reste lisible sans ouvrir la fiche. */
.journal .who { color: var(--accent); font-size: 12px; }
.note-add { display: flex; gap: 6px; margin-top: 8px; }
.note-add .note-input { flex: 1 1 auto; min-width: 0; height: 30px; }
/* Groupes d'un compte : puces retirables + un select pour ajouter.
   Un groupe s'enlève d'un clic, sans passer par une case à cocher muette. */
.grp-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.grp-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 3px 1px 7px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: 12px; color: var(--fg-2);
}
.grp-chip .grp-x {
  display: grid; place-items: center; width: 16px; height: 16px; padding: 0;
  min-width: 0; min-height: 0; border: none; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 50%; font-size: 13px; line-height: 1;
}
.grp-chip .grp-x:hover { color: var(--danger); background: var(--panel-2); }
.grp-add { height: 24px; font-size: 12px; padding: 0 4px; max-width: 110px; }
/* Un groupe sur une procédure : même pastille que la version, teinte différente
   pour qu'on distingue « quelle version » de « qui la voit ». */
.tag.grp { background: var(--accent-soft); color: var(--accent); }
/* ============ Colonne : onglets Chat / Demandes =========================
   Un seul conteneur, deux contenus. Le compteur vit sur l'onglet : on voit
   qu'on nous attend sans quitter son fil. Une seule grille à 12 px.        */

.side-tabs {
  display: flex; gap: 2px; padding: 0 12px; flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.side-tab.on { color: var(--fg); font-weight: 650; border-bottom-color: var(--accent); }

/* Liste des demandes : plus dense qu'une conversation, parce qu'elle se lit
   en balayant du regard (type, priorité, heure). */
.notif-list { list-style: none; margin: 0; padding: 8px 6px 10px; overflow-y: auto; flex: 1; }
.notif-row {
  position: relative; padding: 8px 10px 8px 12px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
}
.notif-row:hover { background: var(--panel); }
.notif-row.unread::before {
  content: ""; position: absolute; left: 3px; top: 12px; width: 3px; height: 14px;
  border-radius: 2px; background: var(--accent);
}
.nr-top { display: flex; align-items: center; gap: 6px; font-size: 9.5px;
  font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.nr-kind.k-validation { color: var(--warn); }
.nr-kind.k-document { color: var(--accent-2); }
.nr-kind.k-question { color: var(--info); }
.nr-kind.k-information { color: var(--ok); }
.nr-prio { width: 6px; height: 6px; border-radius: 50%; }
.nr-prio.p-haute { background: var(--danger); }
.nr-prio.p-normale { background: var(--warn); }
.nr-prio.p-basse { background: var(--muted); }

.nr-from { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }

/* ============ Détail d'une demande ===================================== */

.page.demandes { padding: 18px 22px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; max-width: 860px; }
.dem-head { display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; }
.dem-when { margin-left: auto; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--muted); font-size: 11px; }
.dem-title { font-size: 17px; font-weight: 650; line-height: 1.3; margin: 0; letter-spacing: -.01em; }
.dem-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.dem-pills .pill { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
  font-size: 11px; color: var(--fg-2); }
.dem-body { margin: 0; font-size: 13px; line-height: 1.6; color: var(--fg-2); }
.dem-from { font-size: 11.5px; color: var(--muted); }
.dem-lab { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 800; }
.dem-reply, .dem-answer {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 12px; display: flex; flex-direction: column; gap: 9px;
}
.dem-answer p { margin: 0; font-size: 13px; color: var(--fg); line-height: 1.55; }
.dem-choice {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font-size: 12.5px;
  color: var(--fg-2); display: flex; gap: 9px; align-items: center;
  background: transparent; cursor: pointer; text-align: left;
}
.dem-choice .box { width: 12px; height: 12px; border: 1.5px solid var(--line-strong);
  border-radius: 3px; flex: 0 0 12px; }
.dem-choice.on { border-color: var(--accent); color: var(--fg); background: rgba(242,118,75,.07); }
.dem-choice.on .box { border-color: var(--accent); background: var(--accent); }
.dem-input { height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px;
  background: var(--bg-2); color: var(--fg); font-size: 12.5px; width: 100%; }
.dem-input:focus { outline: none; border-color: var(--line-strong); }
.dem-drop { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 14px;
  text-align: center; font-size: 12px; color: var(--muted); }
.dem-actions { display: flex; gap: 8px; align-items: center; }
.dem-err { font-size: 12px; color: var(--danger); }
.dem-journal ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex;
  flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--fg-2); }
.dem-journal .at { color: var(--muted); font-variant-numeric: tabular-nums; }
.dem-journal .ev { color: var(--accent-2); font-weight: 600; }
.dem-empty { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none; }
/* Délais par priorité : trois lignes, deux champs, la pastille de couleur à
   gauche pour que la règle se lise d'un coup d'œil. */
.delai-row { display: flex; align-items: flex-end; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.delai-row:last-of-type { border-bottom: none; }
.delai-row b { min-width: 108px; font-size: 12.5px; font-weight: 600; }
.delai-row .set-field { flex: 0 0 120px; }
.delai-row .set-field input { height: 28px; }
/* ============ Haut de la colonne : une seule grille =====================
   Trois marges coexistaient (en-tête 14, actions 10, filtres 12) : la colonne
   paraissait décrochée. Une seule valeur, 12 px, partout.                  */

.side-head { padding: 0 12px; }
.side-body > .convs-top .new-conv,
.side-body > .convs-top .icon-btn { height: 28px; min-height: 28px; }
.side-body > .search,
.side-body > .convs .search { height: 28px; border-radius: 7px; }
/* Les filtres tiennent sur UNE ligne : « Archives » orpheline sur la
   deuxième donnait l'impression d'un bloc en vrac. */
.side-body > .folders,
.side-body > .convs .folders {
  padding: 0 12px 8px; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none;
}
.side-body > .folders::-webkit-scrollbar { height: 0; }
.side-body .chip { flex: 0 0 auto; font-size: 11.5px; padding: 2px 8px; }
/* Filtres de la colonne : sur UNE ligne, marges alignées sur le reste (12 px).
   « Archives » seule sur une deuxième ligne était le défaut le plus visible. */
.side-body .view-chips {
  display: flex; flex-wrap: nowrap; gap: 6px;
  padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none;
}
.side-body .view-chips::-webkit-scrollbar { height: 0; }
.side-body .view-chips .chip { flex: 0 0 auto; height: 22px; font-size: 11.5px; }
/* le logo s aligne sur la même grille que les boutons : la marge négative
   historique (\-7px, pour coller le bouton au bord) le décrochait de 7 px. */
.side-head .brand { padding: 0; margin-left: 0; }
/* ============ Utilisateurs : pastille de rôle, notes, et modal ========== */

.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; }
.role-tag.admin { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.adm-notes { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 320px; }
.note-pill { font-size: 11px; padding: 1px 7px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg-2);
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-acts { display: flex; gap: 6px; justify-content: flex-end; }
button.mini.icon { width: 28px; min-width: 28px; height: 28px; padding: 0; display: grid; place-items: center; }
button.mini.icon .icon { width: 14px; height: 14px; }
/* ---- modal (composant `ui::Modal`) ---- */
.modal-voile { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(6,7,10,.62); padding: 24px; }
.modal-boite { width: 100%; max-height: min(84vh, 780px); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 12px; display: flex;
  flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.5); overflow: hidden; }
.modal-tete { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-tete h3 { margin: 0 0 2px; font-size: 14px; font-weight: 650; }
.modal-x { margin-left: auto; width: 26px; height: 26px; border-radius: 6px; border: none;
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; }
.modal-x:hover { color: var(--fg); background: var(--panel-2); }
.modal-corps { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-pied { display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line); background: var(--bg-2); flex: 0 0 auto; }
.ed-field { display: flex; flex-direction: column; gap: 5px; }
.ed-field > span:first-child { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; }
.ed-field input { height: 32px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-2); color: var(--fg); padding: 0 10px; font-size: 13px; }
.ed-field input:focus { outline: none; border-color: var(--line-strong); }
.note-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.note-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px;
  border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--fg-2); max-width: 100%; }
.note-chip .note-x { width: 16px; height: 16px; border: none; background: transparent;
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; border-radius: 50%; }
.note-chip .note-x:hover { color: var(--danger); background: var(--panel); }
.note-add-row { display: flex; align-items: center; gap: 8px; }
.note-add-row input { flex: 1 1 auto; min-width: 0; }
.note-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note-count.full { color: var(--warn); }

/* Responsive : le modal prend la largeur, le tableau défile plutôt que d'écraser. */
@media (max-width: 760px) {
.modal-voile { padding: 10px; }
.modal-boite { max-height: 92vh; }
.adm-notes { max-width: 160px; }
.page.admin table.users { display: block; overflow-x: auto; white-space: nowrap; }

}
/* ============ Colonne : compacte, et les filtres toujours visibles ========
   Les dossiers étaient rendus AVANT les actions et les filtres : en ouvrir
   plusieurs poussait « Toutes / Sans workspace / Archivées » hors de la vue.
   On remet l'ordre visuel (actions → recherche → filtres → dossiers →
   conversations) sans toucher au balisage : `order` sur les enfants d'un
   conteneur flex, et le bloc du haut reste collé en défilant.            */

.side-body { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.side-body > .folder-group { order: 4; flex: 0 0 auto; }
.side-body > .conv-list { order: 5; flex: 0 0 auto; overflow: visible; }
.side-body > .convs-top,
.side-body > .search,
.side-body > .view-chips {
  position: sticky; z-index: 2; background: var(--bg-2);
}
.side-body > .convs-top { padding: 10px 12px 8px;gap: 6px;order: 1;flex: 0 0 auto;top: 0; }
/* Compact : une conversation tient en deux lignes serrées. 9+9 px de padding
   vertical pour un titre et une méta, c'est 6 px perdus par ligne — sur vingt
   conversations, une de moins à l'écran. */
.side-body .conv { padding: 5px 8px; border-radius: 6px; }
.side-body .conv-title { font-size: 12.5px; }
.side-body .conv-meta { margin-top: 1px; font-size: 11px; }
.side-body .folder-row { padding: 4px 6px; }
.side-body > .search, .side-body .search { height: 26px; margin-bottom: 6px; }
/* les décalages collants suivent les hauteurs réelles : 46 px d'actions
   puis 26 px de recherche */
.side-body > .convs-top { top: 0; }
.side-body > .search { margin: 0 12px 8px;order: 2;flex: 0 0 auto;top: 46px; }
.side-body > .view-chips { order: 3;flex: 0 0 auto;top: 72px;padding-bottom: 6px; }
.side-body .conv-list { padding: 0 6px 8px;gap: 0; }
.side-body .conv { padding: 3px 8px; min-height: 0; line-height: 1.35; }
.side-body .conv .dots .icon { width: 13px; height: 13px; }
.side-body .section-label { padding: 8px 12px 4px; }
/* Demandes : la page par défaut quand rien n'attend. Sans elle, l'écran
   gardait la dernière demande ouverte et laissait croire qu'elle était
   encore en attente. */
.dem-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 52vh; text-align: center; padding: 24px;
}
.dem-empty .de-mark {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.dem-empty .de-mark .icon { width: 22px; height: 22px; }
.dem-empty h2 { font-size: 16px; font-weight: 600; margin: 4px 0 0; }
.dem-empty p { max-width: 46ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
/* Select avec recherche (opérations, dossiers) : la liste garde 8 lignes
   visibles, le champ reste en haut quel que soit le défilement. */
.ssel { width: 100%; }
.ssel-pop { padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.ssel-q {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 7px; padding: 5px 8px; font-size: 12.5px; color: var(--fg);
}
.ssel-q:focus { outline: none; border-color: var(--accent); }
.ssel-list { list-style: none; margin: 0; padding: 0; max-height: 232px; overflow-y: auto; }
.ssel-list .sel-item { white-space: normal; }
.ssel-lab { overflow: hidden; text-overflow: ellipsis; }
.ssel-count { text-align: right; padding: 0 4px; }
/* ==================== état « ça travaille » =============================
   Deux endroits, deux intensités : la ligne de la conversation dans la
   colonne (discrète, on doit pouvoir lire la liste), et la boîte de la
   conversation ouverte (un contour qui respire). Aucun contour au repos :
   il n'apparaît que pendant un tour. */

.conv.is-running { position: relative; overflow: hidden; }
.conv.is-running .conv-title { color: var(--fg); }
.conv.is-running::before {
  content: ""; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2px;
  border-radius: 2px; background: var(--accent);
  animation: kani-bar 1.5s ease-in-out infinite;
}
.conv.is-running::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 6px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-soft) 45%, transparent 90%);
  background-size: 220% 100%;
  animation: kani-sweep 2.6s linear infinite;
  opacity: .55;
}

@keyframes kani-bar {
  0%, 100% { opacity: .35; transform: scaleY(.55); }
  50%      { opacity: 1;   transform: scaleY(1); }
}
@keyframes kani-sweep {
  0%   { background-position: 120% 0; }
  100% { background-position: -60% 0; }
}.conversation.is-streaming { position: relative; }
.conversation.is-streaming::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 12px;
  box-shadow: inset 0 0 0 1.5px var(--accent);
  animation: kani-breathe 2.4s ease-in-out infinite;
}

@keyframes kani-breathe {
  0%, 100% { opacity: .18; }
  50%      { opacity: .55; }
}

/* Respecte « réduire les animations » : un contour fixe suffit alors. */
@media (prefers-reduced-motion: reduce) {
.conv.is-running::before, .conv.is-running::after,
  .conversation.is-streaming::after { animation: none; }
.conv.is-running::after { opacity: 0; }

}
/* ============ Tablette / mobile : burger + tiroir ======================
   Sous 900 px la colonne de navigation était masquée (aucun moyen de la
   rouvrir), puis réduite à un bandeau minuscule. Une colonne de 200 px sur une
   tablette ne se lit pas : elle s'ouvre en tiroir pleine hauteur, par-dessus la
   page, et se referme au choix d'une entrée. */
.nav-burger { display: none; }

@media (max-width: 900px) {
.nav-burger.on { border-color: var(--accent); color: var(--accent); }
.nav-burger svg { width: 16px; height: 16px; }
.page-layout > .sidebar.open { transform: none; }
/* le tiroir est la colonne entière (onglets, navigation, compte) : ses
     entrées gardent leur taille de bureau, c'est tout l'intérêt */
  .page-layout > .sidebar .side-nav-item {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13.5px;
  }
.page-layout > .sidebar .side-tabs .side-tab { min-height: 34px; }
/* le burger ne doit jamais passer sur le titre : c'est le conteneur de la
     page qui réserve la bande, pas la page elle-même (le titre n'est pas
     toujours un enfant direct selon la vue) */
  .page-layout { padding-top: 46px; }

}
/* ============ Revue de la colonne =======================================
   1. Deux navigations cohabitaient : les onglets Chat/Demandes s'affichaient
      aussi sur les pages (Opérations, Procédures…), où ils n'ont aucun sens.
      Ils sont désormais réservés au contexte Chat.
   2. Le burger n'existait que sur les pages : en Chat, la colonne tombait à
      148 px sur une tablette, sans moyen de la masquer. Il est partout.
   3. Sous 900 px la colonne du Chat devient un tiroir, comme celle des pages. */
.sidebar.pages .side-tabs { display: none; }

@media (max-width: 900px) {
.chat-layout > .sidebar.open { transform: none; }
/* la conversation garde toute la largeur : plus de colonne écrasée */
  .chat-layout,
  .chat-layout.no-panel { grid-template-columns: minmax(0, 1fr); }

}
/* La navigation du Chat n'apparaît que dans le tiroir : sur un écran large, la
   colonne du Chat reste les onglets et la liste des conversations, sinon on
   retombe sur deux navigations empilées. */
.sidebar:not(.pages) .side-nav { display: none; }

@media (max-width: 900px) {
.sidebar:not(.pages).open .side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
  }

}

/* ============ Réglages en tablette : le menu colle au haut ==============
   Le bandeau réservé au burger (46 px) s'ajoutait au padding propre à la page
   de réglages : le menu horizontal « se détachait » du haut et l'onglet actif
   flottait au milieu de la zone. Ici la page gère elle-même sa bande : le
   menu commence à droite du burger, sur la même ligne. */
@media (max-width: 900px) {
.page-layout:has(.set-panel) { padding-top: 0; }
.page-layout:has(.set-panel) .set-side .seg,
  .page-layout:has(.set-panel) .set-side button {
    min-height: 28px;
    padding: 2px 9px;
    font-size: 12px;
  }
.page-layout:has(.set-panel) .set-panel { padding: 10px 14px 24px; }
.page-layout:has(.set-panel) .set-panel h2 { margin-top: 2px; }

}

/* À 800 px le menu des réglages restait une colonne de sept entrées : 190 px de
   hauteur avant d'arriver au contenu. Il devient une barre horizontale
   défilable, collée en haut, à droite du burger. */
@media (max-width: 900px) {
.page-layout:has(.set-panel) .set-side > * { flex: 0 0 auto; white-space: nowrap; }

}

/* Le conteneur gardait une hauteur de 100 % héritée de la mise en page bureau :
   d'où 190 px de vide sous des boutons de 28 px. */
@media (max-width: 900px) {
.page-layout:has(.set-panel) .set-side .set-group-title,
  .page-layout:has(.set-panel) .set-side .set-side-foot { display: none; }

}

/* La cause des 190 px : les huit entrées passaient à la ligne dans une barre
   de 800 px (trois rangées). Une seule rangée qui défile. */
@media (max-width: 900px) {
.page-layout:has(.set-panel) .set-side { padding: 4px 10px 4px 46px;gap: 4px;align-items: center;border-bottom: 1px solid var(--line);display: flex;flex-direction: row;flex-wrap: nowrap !important;overflow-x: auto;overflow-y: hidden;height: auto !important;min-height: 0 !important;max-height: none !important;position: relative;top: auto;border-right: none; }
.page-layout:has(.set-panel) .set-side .set-item { flex: 0 0 auto; }
.page-layout:has(.set-panel) .settings-shell { grid-template-rows: auto minmax(0, 1fr); }

}
/* 1. filtres : une seule ligne, qui défile si elle ne tient pas */
.side-body > .view-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 10px 6px;
  gap: 4px;
  scrollbar-width: none;
}
.side-body > .view-chips::-webkit-scrollbar { display: none; }
.side-body > .view-chips > * { flex: 0 0 auto; }
/* 2. libellé de section : proche de SA liste, loin de ce qui précède */
.side-body > .section-label {
  margin: 10px 0 2px;
  padding: 0 12px;
}
/* 3. conversations : même retrait pour toutes, titre qui s'arrête avant les
   actions — plus de texte qui touche le bord */
.side-body .conv { padding: 2px 6px 2px 2px; gap: 6px; }
.side-body .conv .conv-title { line-height: 1.35;min-width: 0;flex: 1 1 auto;overflow: hidden;text-overflow: ellipsis;white-space: nowrap; }
.side-body .conv .dots { width: 20px;height: 20px;min-width: 20px;min-height: 20px;padding: 0;flex: 0 0 auto; }
/* 4. dossiers : le nom occupe l'espace, les actions restent à droite */
.side-body .folder-row { padding: 2px 6px 2px 4px; gap: 5px; }
.side-body .folder-row .folder-name { font-size: 12px;min-width: 0;flex: 1 1 auto;overflow: hidden;text-overflow: ellipsis;white-space: nowrap; }
/* 5. un groupe de dossier se distingue de ses conversations : 8 px entre
   groupes, 0 à l'intérieur */
.side-body .folder-group + .folder-group { margin-top: 6px; }
.side-body .folder-group > .conv-list { padding-top: 0; }
/* 6. le pied ne flotte plus : même écart que les autres blocs */
.sidebar .side-foot { margin-top: auto; }
/* ================= Refonte : rail + liste contextuelle ==================
   Une seule navigation (le rail). Plus d'onglets, plus de liste textuelle,
   plus de menu qui refaisait la navigation : le compte porte thème et
   déconnexion, rien d'autre. */
:root { --rail-w: 54px; }
.sidebar { position: relative;display: flex;flex-direction: row;min-height: 0;height: 100%;background: var(--bg-2);border-right: 1px solid var(--line);align-items: stretch; }
.rail { background: var(--bg-3);border-right: 1px solid var(--line);display: flex;flex-direction: column;gap: 2px;padding: 8px 0;width: var(--rail-w);flex: 0 0 var(--rail-w);align-items: center;position: relative; }
.rail-btn {
  width: 34px; height: 34px; border-radius: 9px; position: relative;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.rail-btn:hover { color: var(--fg); background: var(--panel); }
.rail-btn.on { color: var(--accent); background: var(--panel); border-color: var(--line); }
.rail-btn .icon { width: 17px; height: 17px; }
.rail-badge {
  position: absolute; top: 1px; right: 1px; min-width: 14px; text-align: center;
  background: var(--accent); color: #151013; font-size: 9px; font-weight: 700;
  border-radius: 8px; padding: 0 3px; line-height: 14px;
}
.rail-foot { border-top: 1px solid var(--line);padding-top: 12px;display: flex;flex-direction: column;gap: 6px;margin-top: auto;align-items: center;padding-bottom: 4px;position: relative; }
.rail-av {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg-2);
  font-size: 11px; font-weight: 650;
}
.rail-av.on { border-color: var(--accent); color: var(--accent); }

.pop-item.danger { color: #e0836f; }
.listecol { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chat-layout,
.chat-layout.no-panel {
  grid-template-columns: calc(var(--convs-w) + var(--rail-w)) 6px minmax(0, 1fr);
}

@media (max-width: 900px) {
.chat-layout, .chat-layout.no-panel { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.sidebar { border-right: 0; }
.listecol {
    position: fixed; inset: 0 auto 0 var(--rail-w); width: min(84vw, 296px);
    z-index: 80; transition: transform .2s ease;
    /* -100 % laisserait un bord sur le rail (296 px de large décalés de 296
       laissent le premier bouton sous le voile) : on sort AUSSI de la largeur
       du rail. */
    transform: translateX(calc(-100% - var(--rail-w)));
    background: var(--bg-2); box-shadow: 18px 0 48px #000c;
  }
.listecol.open { transform: none; }
.drawer-veil { position: fixed;inset: 0;z-index: 70;background: #0009;left: var(--rail-w); }
.nav-burger { display: none !important;place-items: center;position: fixed;top: 8px;left: 8px;z-index: 75;width: 34px;height: 34px;padding: 0;border-radius: 9px;background: var(--panel);border: 1px solid var(--line);color: var(--fg); }

}

/* Sous 900 px, la colonne d'une PAGE n'est plus un tiroir : elle ne contient
   que le rail (54 px), qui doit rester visible en permanence. Sans ça, tout
   le bloc était translaté hors de l'écran et la navigation disparaissait. */
@media (max-width: 900px) {
.page-layout { grid-template-columns: var(--rail-w) minmax(0, 1fr) !important;grid-template-rows: none !important;padding-top: 0 !important; }
.page-layout > .page { grid-column: 1 / -1;padding-top: 12px !important; }

}

/* Le rail ne doit jamais s'étirer avec la page : l'avatar doit rester à
   portée, en bas de la fenêtre, pas en bas du document. */
@media (max-width: 900px) {
.page-layout > .sidebar { position: sticky !important;inset: 0 auto 0 0;width: var(--rail-w) !important;z-index: 80;transform: none !important;transition: transform .2s ease;box-shadow: none !important;display: flex;border-right: 1px solid var(--line) !important;top: 0;height: 100vh; }
.rail { overflow: hidden;padding: 14px 8px;height: 100%; }

}
/* ============ Liste de la colonne : une seule échelle ==================
   Remplace les quatre passes de surcharges empilées aujourd'hui. Règle
   unique : 2 px d'écart entre deux lignes, 6 px entre deux groupes, 10 px
   autour d'un bloc. Rien d'autre ne doit fixer une hauteur dans cette zone. */
.sidebar .listecol { --l-pad: 10px; }
/* en-tête de liste : actions + recherche + filtres, 3 blocs serrés */
.sidebar .convs-top { padding: 5px var(--l-pad) 4px; gap: 6px; }
.sidebar .convs-top .new-conv,
.sidebar .convs-top .icon-btn { height: 26px; min-height: 26px; }
.sidebar .search { height: 26px; margin: 0 var(--l-pad) 4px; padding: 0 8px; font-size: 12px; }
.sidebar .view-chips {
  display: flex; flex-wrap: nowrap; gap: 4px;
  padding: 0 var(--l-pad) 6px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.sidebar .view-chips::-webkit-scrollbar { display: none; }
.sidebar .view-chips > * { flex: 0 0 auto; }
.sidebar .view-chips .chip { height: 22px; min-height: 22px; padding: 0 8px; font-size: 11.5px; }
/* libellé de section : 10 px au-dessus, 2 px en dessous de sa liste */
.sidebar .section-label {
  margin: 10px 0 2px; padding: 0 var(--l-pad);
  font-size: 10px; line-height: 13px; letter-spacing: .09em;
}
/* lignes : 24 px, même retrait, texte tronqué proprement */
.sidebar .folder-group { margin: 0; }
.sidebar .folder-group + .folder-group { margin-top: 6px; }
.sidebar .folder-row { min-height: 24px; padding: 2px 6px 2px 4px; gap: 5px; }
.sidebar .folder-row .chev { width: 18px; height: 18px; min-width: 18px; min-height: 18px; padding: 0; }
.sidebar .folder-row .folder-name {
  min-width: 0; flex: 1 1 auto; font-size: 12px; line-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .folder-row .fold-acts { height: 18px; display: flex; gap: 2px; }
.sidebar .folder-row .fold-acts button,
.sidebar .folder-row .fold-acts .mini {
  width: 18px; height: 18px; min-width: 18px; min-height: 18px; padding: 0; opacity: .4;
}
.sidebar .folder-row:hover .fold-acts button,
.sidebar .folder-row:hover .fold-acts .mini { opacity: 1; }
.sidebar .conv-list { padding: 0 6px 6px; gap: 0; }
.sidebar .conv { min-height: 24px; padding: 2px 6px 2px 20px; gap: 6px; }
.sidebar .conv .conv-title {
  min-width: 0; flex: 1 1 auto; font-size: 12.5px; line-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .conv .dots { flex: 0 0 auto; width: 18px; height: 18px; min-width: 18px; min-height: 18px; padding: 0; }
.sidebar .conv .dots .icon { width: 12px; height: 12px; }

/* Sous 900 px la grille n'avait que DEUX colonnes déclarées pour cinq
   enfants : le redimensionneur et le panneau tombaient en lignes implicites et
   la conversation se retrouvait dans la colonne de 54 px du rail — d'où un
   écran noir avec tout entassé à gauche. Placement explicite. */
@media (max-width: 900px) {
.chat-layout,
  .chat-layout.no-panel {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }
.chat-layout > .conversation { grid-column: 2; grid-row: 1; min-width: 0; }
.chat-layout > .resizer { display: none !important; }
.chat-layout > .side-panel {
    grid-column: 1 / -1; grid-row: 1;
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(88vw, 380px); z-index: 85;
  }

}

/* Le rail ne part JAMAIS hors écran : c'est la liste qui est un tiroir.
   La règle mobile précédente translatait toute la colonne (rail compris). */
@media (max-width: 900px) {
.chat-layout > .sidebar { position: static !important;inset: 0 auto 0 0;width: var(--rail-w) !important;z-index: 80;transform: none !important;transition: transform .2s ease;box-shadow: none !important;padding-right: 10px;grid-column: 1;grid-row: 1;min-width: var(--rail-w) !important;padding: 0 !important;overflow: visible !important;border-right: 1px solid var(--line) !important; }

}
/* ============ Pages : un conteneur de lecture ==========================
   Sur une fenêtre large, le contenu des pages était collé à gauche avec un
   vide de l'autre côté (détail d'une demande, cartes d'automatisation), et les
   formulaires s'étiraient sur toute la largeur. Une seule règle de lecture,
   la même que le fil de conversation. */
.page { --page-w: 980px; }
.page > * { max-width: var(--page-w); }
.page > .page-head,
.page > h2 { max-width: var(--page-w); }
/* formulaires : jamais pleine largeur, 460 px suffisent pour un champ */
.set-field input,
.set-field select,
.set-field .sel { max-width: 460px; }
.set-card > .set-row,
.set-card > .set-field { max-width: 620px; }
/* le détail d'une demande se lit comme un document */
.demandes { --page-w: 860px; }
.demandes .dem-body { max-width: 72ch; }
/* les cartes d'automatisation restent lisibles : texte borné, actions à droite */
.auto .auto-prompt,
.auto .auto-carnet { max-width: 78ch; }

/* ============ La conversation occupe la largeur =========================
   `--read-w` valait clamp(780px, 46vw, 1200px) : à 1440 px de fenêtre, 46 vw
   donne 662 → ramené à 780 px dans une zone de 1386. Résultat : le fil et la
   saisie n'occupaient que la moitié, avec deux bandes noires. La largeur suit
   maintenant la place disponible, avec une marge de lecture raisonnable. */
:root { --read-w: clamp(880px, 92%, 1500px); }
html[data-readw="confort"] { --read-w: clamp(680px, 62%, 860px); }
html[data-readw="large"] { --read-w: min(100%, 1500px); }

/* L'accueil ne doit pas être un timbre-poste au milieu du vide */
.welcome { max-width: min(720px, 100%); }

/* Le M de l'avatar était posé sur la ligne de base du bouton, donc en haut à
   gauche du cercle. Un bouton ne centre pas son texte par défaut. */
.rail-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  font-family: inherit;
}

/* Une règle fixait 800 px en dur sur la saisie : le fil suivait --read-w mais
   pas la barre d'écriture, d'où deux largeurs différentes à l'écran. */
.messages, .composer, .queue { max-width: var(--read-w); margin-left: auto; margin-right: auto; }

/* ============ Le trou au milieu : la grille des pages ==================
   `.page-layout` réservait encore `var(--convs-w)` (264 px) pour la colonne,
   alors que sur une page cette colonne ne contient plus que le rail (54 px) :
   il restait 210 px de vide à l'intérieur de la barre. La grille suit
   maintenant la largeur réelle du rail. */
.page-layout,
.page-layout > .page {
  grid-template-columns: var(--rail-w) minmax(0, 1fr) !important;
}
.page-layout > .sidebar {
  width: var(--rail-w) !important;
  min-width: var(--rail-w) !important;
  max-width: var(--rail-w) !important;
  flex: 0 0 var(--rail-w);
}
.page-layout > .page { grid-column: 2; }

/* ============ Le panneau de droite tombait dans une colonne de 6 px =====
   En ramenant .chat-layout à trois colonnes (rail + liste + conversation),
   j'ai laissé le panneau et son redimensionneur hors grille : ils atterrissaient
   dans des colonnes implicites de 6 px, à cheval sur la liste. C'était le bloc
   vide au milieu de l'écran. Les cinq zones sont déclarées explicitement. */
.chat-layout {
  grid-template-columns: calc(var(--convs-w, 264px) + var(--rail-w)) 6px minmax(0, 1fr) !important;
}
.chat-layout:not(.no-panel) {
  grid-template-columns:
    calc(var(--convs-w, 264px) + var(--rail-w)) 6px minmax(0, 1fr) 6px var(--panel-w, 312px) !important;
}
.chat-layout > .sidebar { grid-column: 1; grid-row: 1; }
.chat-layout > .resizer { grid-column: 2; grid-row: 1; }
.chat-layout > .conversation { grid-column: 3; grid-row: 1; min-width: 0; }
.chat-layout > .panel-resizer { grid-column: 4; grid-row: 1; }
.chat-layout > .side-panel { grid-column: 5; grid-row: 1; min-width: 0; width: auto; }

@media (max-width: 900px) {
  .chat-layout,
  .chat-layout:not(.no-panel) {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) !important;
  }
  .chat-layout > .sidebar { grid-column: 1; }
  .chat-layout > .conversation { grid-column: 2; }
  .chat-layout > .resizer,
  .chat-layout > .panel-resizer { display: none !important; }
  .chat-layout > .side-panel { grid-column: 1 / -1; }
}

/* ============ Demandes : la liste existait, largeur 0 ==================
   La page Demandes utilise .page-layout, dont j'ai fixé la colonne à la seule
   largeur du rail (54 px). La liste des demandes était bien rendue dedans —
   trois lignes dans le DOM — mais écrasée à 0 px. Quand la colonne contient une
   liste, elle reprend la largeur rail + liste. */
.page-layout:has(.listecol) {
  grid-template-columns: calc(var(--convs-w, 264px) + var(--rail-w)) minmax(0, 1fr) !important;
}
.page-layout:has(.listecol) > .sidebar {
  width: calc(var(--convs-w, 264px) + var(--rail-w)) !important;
  min-width: 0 !important;
  max-width: none !important;
}
.page-layout:has(.listecol) > .page { grid-column: 2; }

@media (max-width: 900px) {
  .page-layout:has(.listecol) {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) !important;
  }
  .page-layout:has(.listecol) > .sidebar {
    width: var(--rail-w) !important;
    position: static !important;
    transform: none !important;
  }
}

/* Liste des procédures dans la colonne (même famille que les demandes) */
.proc-side { list-style: none; margin: 0; padding: 0 6px 8px; }
.proc-row {
  display: flex; align-items: baseline; gap: 6px; min-height: 26px;
  padding: 3px 6px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.proc-row:hover { background: var(--panel); }

.proc-obj {
  min-width: 0; flex: 1 1 auto; color: var(--fg-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* La procédure dans la colonne : les mêmes informations que la carte d'avant
   (version, domaine, nombre d'étapes et de documents), sur deux lignes. */
.proc-row { display: block; padding: 4px 6px; min-height: 0; }
.proc-top { display: flex; align-items: baseline; gap: 6px; }
.proc-row .proc-obj { font-size: 12px; color: var(--fg); }
.proc-v { flex: 0 0 auto; font-size: 10px; color: var(--accent); }
.proc-bot { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
/* la page des procédures n'a plus qu'un panneau de détail */
.procedures-layout { grid-template-columns: minmax(0, 1fr) !important; }

/* ============ Ordre de la colonne (régression) ==========================
   Le nettoyage CSS a supprimé les règles `order` ; seules trois entrées en
   avaient encore. En flex, tout enfant sans `order` vaut 0 et passe DEVANT
   celles à 1, 2, 3 — d'où « + Nouvelle », la recherche et les filtres
   relégués sous les dossiers. Chaque enfant reçoit son numéro : 0 n'est
   jamais un défaut acceptable ici. */
.side-body > .convs-top { order: 1; }
.side-body > .search { order: 2; }
.side-body > .view-chips { order: 3; }
.side-body > .section-label { order: 4; }
.side-body > .workspaces-tree { order: 5; }
.side-body > .unfiled-drop { order: 6; }
.side-body > .conv-list { order: 7; }
.side-body > .notif-list,
.side-body > .proc-side { order: 5; }
.side-body > .dem-side-empty { order: 5; }

/* Automatisation en pause : la ligne s'éteint, sans disparaître. */
.proc-row.off .proc-obj { color: var(--muted); }
/* La carte unique respire : c'est le sujet de la page. */
.auto-list { max-width: 100%; }
.auto .auto-actions { align-self: flex-start; }

/* ============ Procédures : le détail prend la page ======================
   La liste vit dans la colonne : la carte autour du détail n'a plus de raison
   d'être (elle encadrait un élément qui était déjà un choix parmi d'autres).
   Le document s'affiche à même la page, en colonne de lecture. */
.page.procedures .procedure-detail {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 900px;
}
.page.procedures .procedure-detail > header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.page.procedures .procedure-detail .fiche-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--muted); letter-spacing: .04em;
}
.page.procedures .procedure-detail h3 {
  font-size: 19px; font-weight: 620; margin: 2px 0 6px; line-height: 1.25;
}
.page.procedures .procedure-detail .fiche-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* les étapes : une liste lisible, pas une pile de cartes */
.page.procedures .procedure-detail ol,
.page.procedures .procedure-detail ul { padding-left: 0; list-style: none; margin: 0; }
.page.procedures .procedure-detail li {
  border: 0; border-radius: 0; background: none;
  border-top: 1px solid var(--line);
  padding: 9px 0; display: flex; gap: 10px; align-items: baseline;
}
.page.procedures .procedure-detail li:first-child { border-top: 0; }

/* la page entière respire : un seul bloc de lecture */
.page.procedures { padding-top: 14px; }
.page.procedures > .page-head { margin-bottom: 6px; }

/* Ligne de la colonne = un lien réel : le gestionnaire de clic ne se
   déclenchait pas (aucune trace, aucun changement d'URL), un <a href> ne peut
   pas rater sa cible et garde le lien profond dans l'URL. */
.proc-row { padding: 0; }
.proc-link {
  display: block; padding: 4px 6px; border-radius: 6px;
  color: inherit; text-decoration: none;
}
.proc-link:hover { background: var(--panel); }

/* ============ Rail : plus de boîte de sélection =========================
   La boîte autour de l'icône active n'était pas centrée sur l'icône (les
   glyphes n'ont pas tous la même largeur optique) et doublait l'information
   déjà portée par la couleur. On ne garde que la couleur, et on centre
   réellement chaque icône. */
.rail-btn,
.rail-btn.on {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
}
.rail-btn.on { color: var(--accent) !important; }
.rail-btn.on svg { color: currentColor; }
.rail-btn:hover { color: var(--fg); background: transparent !important; }
/* largeur optique identique : les glyphes sont centrés dans leur carré */
.rail-btn .icon { width: 18px; height: 18px; display: block; margin: 0 auto; }

/* Pied des réglages : compte à gauche, déconnexion à droite */
.set-side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.set-side-foot .foot-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.foot-logout {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer;
}
.foot-logout:hover { color: var(--danger, #e5484d); border-color: currentColor; }

/* ============ Automatisations : plein page, sans carte ==================
   Comme les procédures : la liste est dans la colonne, la page ne montre
   qu'une automatisation. Une carte autour d'un élément unique ne délimite
   plus rien — on garde la lecture, on retire la boîte. */
.page.automations .auto-list { list-style: none; margin: 0; padding: 0; max-width: 900px; }
.page.automations .auto {
  background: transparent; border: 0; box-shadow: none; border-radius: 0;
  padding: 0; margin: 0;
}
.page.automations .auto .auto-name { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 6px; }
.page.automations .auto .auto-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.page.automations .auto .auto-meta > * {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--panel); color: var(--muted);
}
.page.automations .auto .auto-row { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.page.automations .auto .carnet { max-height: none; }

/* ============================================================================
   NORME DES COLONNES DE PAGE (listecol)
   Une seule grammaire pour Chat, Demandes, Procédures, Automatisations :
   en-tête fixe, zones filtrables, sections étiquetées, lignes à deux niveaux
   de lecture, état actif marqué par un filet d'accent — pas de boîte autour.
   ============================================================================ */
.listecol {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: transparent;
}

/* --- sections : étiquette discrète, jamais un titre ---------------------- */
.listecol .section-label {
  padding: 10px 12px 4px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}

/* --- lignes : deux niveaux, une hauteur stable, un filet d'accent -------- */
.listecol .notif-row,
.listecol .proc-row {
  position: relative; padding: 7px 10px 7px 12px; border-radius: 7px;
  transition: background .12s ease;
}
.listecol .notif-row::before,
.listecol .proc-row::before {
  content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px; background: transparent;
  transition: background .12s ease;
}
.listecol .notif-row:hover,
.listecol .proc-row:hover { background: var(--panel); }
.listecol .notif-row.unread::before,
.listecol .proc-row.focus::before,
.listecol .proc-row:not(.off):hover::before { background: var(--accent); }
.listecol .notif-row.unread { font-weight: 550; }
.listecol .proc-row.off { opacity: .55; }

/* --- état vide : centré, discret, jamais un bloc ------------------------- */
.listecol .dem-side-empty {
  margin: auto 12px; padding: 18px 0; text-align: center;
  color: var(--muted); font-size: 12.5px; line-height: 1.5;
}

/* ============================================================================
   PAGE AUTOMATISATIONS
   Une automatisation par page : l'en-tête porte le nom, l'état et les actions ;
   le corps se lit comme une fiche, en sections séparées par des filets.
   ============================================================================ */
.page.automations { padding: 22px 0 40px; }
.page.automations .auto-list { display: block; }

/* grille : fiche à gauche, actions à droite */
.page.automations .auto {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px; align-items: start; padding: 0 0 6px;
}

/* --- titre --------------------------------------------------------------- */
.page.automations .auto .auto-name {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 20px; font-weight: 650; letter-spacing: -.015em; margin: 0 0 4px;
}
.page.automations .auto .auto-name .tag {
  font-size: 11px; font-weight: 550; letter-spacing: 0;
  padding: 2px 8px; border-radius: 999px;
  background: var(--panel); color: var(--muted);
}
.page.automations .auto.on .auto-name .tag:first-of-type {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

/* --- énoncé : ce que fait l'automatisation, en lecture calme -------------- */
.page.automations .auto .auto-prompt {
  margin: 14px 0 0; padding: 10px 14px;
  border-left: 2px solid var(--line); border-radius: 0 8px 8px 0;
  background: var(--panel); color: var(--fg);
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
}

/* --- carnet : mémoire de l'automatisation, replié à quatre lignes -------- */
.page.automations .auto .auto-carnet {
  margin-top: 12px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 12.5px; line-height: 1.55; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; cursor: pointer;
}
.page.automations .auto .auto-carnet:hover { color: var(--fg); }

/* --- méta : cadence, dernier passage, prochaine exécution --------------- */
.page.automations .auto .auto-meta {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  font-size: 12px; color: var(--muted);
}
.page.automations .auto .auto-meta .auto-run { display: inline-flex; align-items: center; gap: 6px; }

/* --- actions : colonne stable à droite, jamais sous le texte ------------ */
.page.automations .auto .auto-actions {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  min-width: 120px; padding-top: 2px;
}
.page.automations .auto .auto-actions .mini { justify-content: center; }

/* --- formulaire de création / édition : panneau au-dessus, discret ------- */

@media (max-width: 900px) {
  .page.automations .auto { grid-template-columns: minmax(0, 1fr); }
  .page.automations .auto .auto-actions { flex-direction: row; flex-wrap: wrap; }
}

/* ============ Automatisations : toute la largeur, respiration ============
   Une automatisation par page : rien ne justifie une colonne étroite. La fiche
   occupe l'espace disponible et se aère verticalement. */
.page.automations { padding: 28px 32px 56px; max-width: none; }
.page.automations .auto-list { max-width: none; }
.page.automations .auto {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px; padding: 0;
}
.page.automations .auto .auto-name { font-size: 22px; margin: 0 0 6px; }
.page.automations .auto .auto-prompt {
  margin: 20px 0 0; padding: 16px 20px; font-size: 14px; line-height: 1.65;
}
.page.automations .auto .auto-carnet {
  margin-top: 20px; padding: 16px 20px; font-size: 13px; line-height: 1.6;
}
.page.automations .auto .auto-meta {
  margin-top: 24px; padding-top: 16px; gap: 10px 24px; font-size: 12.5px;
}
.page.automations .auto .auto-actions { min-width: 150px; gap: 8px; padding-top: 4px; }
/* le formulaire de création respire aussi quand il est ouvert */
.page.automations .panel, .page.automations form { margin-bottom: 28px; }

@media (max-width: 900px) {
  .page.automations { padding: 20px 16px 40px; }
  .page.automations .auto { gap: 20px; }
}

/* ============ Automatisations : la page respire et occupe la largeur ======
   La fiche se déploie sur deux axes : texte à gauche, actions dans un panneau
   à droite, et les faits techniques répartis en bandeau plutôt qu'entassés sur
   une seule ligne. */
.page.automations { padding: 32px 44px 64px; }
.page.automations .auto { gap: 48px; align-items: start; }

/* les faits ne sont plus une ligne dense : chaque information a sa colonne */
.page.automations .auto .auto-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px 28px; margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5;
}
.page.automations .auto .auto-meta > span {
  display: flex; flex-direction: column; gap: 3px; color: var(--muted);
}
.page.automations .auto .auto-meta > span::first-line { color: var(--fg); }

/* les actions deviennent un panneau : elles ne flottent plus dans le vide */
.page.automations .auto .auto-actions {
  min-width: 176px; gap: 8px; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.page.automations .auto .auto-actions .mini { width: 100%; padding: 7px 10px; }
.page.automations .auto .auto-actions .mini:first-child { font-weight: 600; }

/* l'énoncé et le carnet prennent la largeur, avec de l'air autour */
.page.automations .auto .auto-prompt { margin: 24px 0 0; padding: 18px 22px; }
.page.automations .auto .auto-carnet { margin-top: 22px; padding: 18px 22px; }

@media (max-width: 1100px) {
  .page.automations { padding: 24px 24px 48px; }
  .page.automations .auto { gap: 24px; }
  .page.automations .auto .auto-actions { min-width: 150px; }
}

/* Historique des exécutions : la fiche a une trace, la page a de la hauteur */
.page.automations .auto-hist { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.page.automations .auto-hist-title {
  margin: 0 0 12px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.page.automations .auto-hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.page.automations .auto-hist-row { border-radius: 7px; }
.page.automations .auto-hist-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 7px; color: inherit; text-decoration: none; font-size: 12.5px;
  color: var(--muted); transition: background .12s ease, color .12s ease;
}
.page.automations .auto-hist-link:hover { background: var(--panel); color: var(--fg); }
.page.automations .auto-hist-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent); opacity: .85;
}
.page.automations .auto-hist-row.fail .auto-hist-dot { background: var(--danger, #e5484d); }
.page.automations .auto-hist-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bouton de création en tête de colonne (même famille que « + Nouvelle » du chat) */
.listecol .col-actions { padding: 10px 12px 6px; }
.listecol .col-actions .new-conv { width: 100%; justify-content: center; }

/* Le bouton de création de la colonne : présent, pas imposant. */
.listecol .col-actions { padding: 8px 12px 4px; }
.listecol .col-actions .new-conv {
  width: 100%; justify-content: center;
  height: 26px; padding: 0 10px; font-size: 12.5px; font-weight: 550;
  border-radius: 6px;
}
.listecol .col-actions .new-conv svg { width: 14px; height: 14px; }

/* Compact, comme « + Nouvelle » du chat : la largeur du texte, pas de la colonne. */
.listecol .col-actions .new-conv.primary,
.listecol .col-actions .new-conv {
  width: auto !important; min-height: 0 !important; height: 26px !important;
  padding: 0 10px !important; margin: 0; gap: 5px;
}

/* Icône et mot sur la même ligne, centrés verticalement. Le décalage venait
   du line-height hérité et du svg en display:inline (ligne de base du texte). */
.listecol .col-actions .new-conv {
  display: inline-flex !important; align-items: center !important;
  justify-content: center !important; line-height: 1 !important;
}
.listecol .col-actions .new-conv svg { display: block; flex: 0 0 auto; margin: 0; }
.listecol .col-actions .new-conv span { display: block; line-height: 1; margin: 0; position: static; }

/* Fil du dernier passage : on lit l'exécution sans quitter la page */
.page.automations .auto-thread { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.page.automations .auto-thread-body {
  max-height: 420px; overflow-y: auto; padding: 4px 6px 4px 0;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.page.automations .auto-msg {
  font-size: 13px; line-height: 1.55; padding: 9px 13px; border-radius: 9px;
  max-width: 88%; white-space: pre-wrap; word-break: break-word;
}
.page.automations .auto-msg.role-user {
  align-self: flex-end; background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.page.automations .auto-msg.role-assistant { background: var(--panel); color: var(--fg); }
.page.automations .auto-msg-tool {
  font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted);
}

/* Le fil du dernier passage utilise le même rendu Markdown que le chat */
.page.automations .auto-msg-text.md > :first-child { margin-top: 0; }
.page.automations .auto-msg-text.md > :last-child { margin-bottom: 0; }
.page.automations .auto-msg-text.md p { margin: 0 0 8px; }
.page.automations .auto-msg-text.md ul,
.page.automations .auto-msg-text.md ol { margin: 6px 0 8px; padding-left: 20px; }
.page.automations .auto-msg-text.md li { margin: 2px 0; }
.page.automations .auto-msg-text.md code {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--panel); padding: 1px 5px; border-radius: 4px;
}
.page.automations .auto-msg-text.md pre {
  background: var(--panel); padding: 10px 12px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0;
}
.page.automations .auto-msg-text.md table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.page.automations .auto-msg-text.md th,
.page.automations .auto-msg-text.md td { border: 1px solid var(--line); padding: 4px 8px; }
.page.automations .auto-msg-text.md a { color: var(--accent); }

/* ============ Actions : barre en haut à droite, plus de colonne ==========
   Empilées à droite, les quatre actions faisaient toute la hauteur et
   laissaient une bande vide sous elles. Elles deviennent une barre horizontale
   ancrée sur la ligne du titre, qui ne consomme plus de hauteur. */
.page.automations .auto {
  position: relative;
  display: block;
  padding-right: 0;
}
.page.automations .auto .auto-actions {
  position: absolute; top: 0; right: 0;
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  min-width: 0; width: auto;
  padding: 0; border: 0; background: none;
}
.page.automations .auto .auto-actions .mini {
  width: auto; padding: 5px 11px; border-radius: 7px;
  white-space: nowrap; font-size: 12.5px;
}
/* le titre s'arrête avant la barre d'actions au lieu de passer dessous */
.page.automations .auto .auto-name { padding-right: 260px; }
@media (max-width: 900px) {
  .page.automations .auto .auto-actions { position: static; flex-wrap: wrap; margin-top: 12px; }
  .page.automations .auto .auto-name { padding-right: 0; }
}

/* ============ Le bandeau de faits : trois cartes, pas une ligne de texte ==
   « dernier : … / prochain : … » se lisait comme un journal technique ; une
   étiquette au-dessus d'une valeur se lit d'un coup d'œil. */
.page.automations .auto .auto-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-top: 28px; padding-top: 0; border-top: 0;
}
.page.automations .auto .auto-meta .fact {
  display: flex; flex-direction: column; gap: 5px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 40%, transparent);
  text-decoration: none; color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.page.automations .auto .auto-meta .fact em {
  font-style: normal; font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.page.automations .auto .auto-meta .fact b {
  font-weight: 550; font-size: 13px; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.page.automations .auto .auto-meta .fact-link:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.page.automations .auto .auto-meta .fact-link b { color: var(--accent); }

/* ============ Réglages → MCP ============================================ */
.mcp-bar { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; flex-wrap: wrap; }
.mcp-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px; padding: 16px 18px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent;
}
.mcp-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.mcp-form label.wide { grid-column: 1 / -1; }
.mcp-form label.check { flex-direction: row; align-items: center; gap: 8px; }
.mcp-form input[type="text"], .mcp-form input:not([type]), .mcp-form textarea {
  font: inherit; font-size: 13px; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px;
}
.mcp-form textarea { font-family: ui-monospace, monospace; font-size: 12px; resize: vertical; }
.mcp-form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.mcp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mcp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.mcp-row.off { opacity: .55; }
.mcp-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.mcp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.mcp-dot.on { background: var(--accent); }
.mcp-actions { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 800px) { .mcp-row { flex-direction: column; align-items: flex-start; } }

/* Le voile du dialogue de confirmation ne couvrait pas tout : la barre
   d'icônes et la colonne gardent leur propre empilement. On supprime le voile
   (il ne servait qu'à assombrir) et on place le dialogue au-dessus de tout. */
.modal-backdrop {
  background: transparent !important;
  z-index: 200 !important;
  backdrop-filter: none !important;
}
.modal-backdrop .modal {
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px var(--line-strong, var(--line));
}

/* Quelle que soit la boîte de référence (le dialogue vit dans la page, pas dans
   le document), on impose la taille de la fenêtre : le voile couvrait 980 px au
   lieu de 1440. */
.modal-backdrop {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  inset: 0 !important;
  margin: 0 !important;
}

/* `.page > *` plafonne tout enfant à 980 px : le voile du dialogue était
   rogné par cette règle, d'où la zone assombrie qui n'allait pas jusqu'aux
   bords. La modale s'affranchit du plafond. */
.page > .modal-backdrop { max-width: none !important; width: 100vw !important; }

/* Boîte principale : un sélecteur et son bouton sur une ligne */
.conn-primary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.conn-primary > div:first-child { min-width: 260px; flex: 0 1 320px; }
