/* dmagh canvas — brand: violet #6b2bd9 · magenta #c026d3 · pink #ff1493 · gold #ffd400 · bg #07060c · fg #f4f0ff
   Thèmes : sombre (défaut, `:root`) et clair (`html[data-theme="light"]`) — posés par canvas-boot.js avant le premier
   rendu (réglage `theme` = auto | light | dark, persisté dans dmagh.ui.settings). Toute couleur de surface passe par
   une variable : jamais de fond/ombre codé en dur dans les règles. */

:root {
  color-scheme: dark;
  --bg: #07060c;
  --bg-soft: #0a0812;
  --bg-deep: #05040a;
  --panel: #120e1c;
  --panel-2: #171226;
  --panel-3: #1a1528;
  --panel-deep: #0a0810;
  --panel-elev: #14121c;
  --code-bg: #0b0a12;
  --line: rgba(167, 139, 250, 0.16);
  --line-strong: rgba(167, 139, 250, 0.32);
  --fg: #f4f0ff;
  --fg-dim: #b9b0d6;
  --fg-mute: #8a80a8;
  --violet: #6b2bd9;
  --violet-soft: #a78bfa;
  --magenta: #c026d3;
  --magenta-soft: #e879f9;
  --pink: #ff1493;
  --rose: #fb7185;
  --gold: #ffd400;
  --gold-soft: #fbbf24;
  --ok: #3ecf8e;
  --err: #f87171;
  --grad-text: linear-gradient(105deg, #c4b5fd 0%, #e879f9 45%, #fbbf24 100%);
  --grad-brand: linear-gradient(120deg, var(--violet), var(--magenta) 55%, #e11d48);
  /* surfaces translucides / ombres (thémées) */
  --topbar-bg: rgba(10, 8, 18, 0.85);
  --sidebar-bg: rgba(10, 8, 18, 0.5);
  --composer-bg: rgba(10, 8, 18, 0.65);
  --overlay-bg: rgba(7, 6, 12, 0.92);
  --scrim: rgba(5, 4, 10, 0.62);
  --shadow: rgba(0, 0, 0, 0.5);
  --shadow-soft: rgba(0, 0, 0, 0.35);
  --shadow-strong: rgba(0, 0, 0, 0.7);
  --highlight: rgba(255, 255, 255, 0.08);
  --kbd-bg: rgba(255, 255, 255, 0.12);
  --kbd-border: rgba(255, 255, 255, 0.25);
  --kbd-fg: rgba(244, 240, 255, 0.85);
  --on-brand: #fff;
  --brand-glow: rgba(192, 38, 211, 0.45);
  /* alias utilisés par les panneaux Hub / dock / voix */
  --border: var(--line);
  --bg-elev: var(--panel-elev);
  --muted: var(--fg-mute);
  --accent: var(--violet-soft);
  --mono: var(--font-mono);
  --radius: 12px;
  --font-ui: "Syne", "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "JetBrainsMono Nerd Font", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- thème clair ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3fc;
  --bg-soft: #faf8fe;
  --bg-deep: #ece7f7;
  --panel: #ffffff;
  --panel-2: #f3eff9;
  --panel-3: #ebe5f5;
  --panel-deep: #ffffff;
  --panel-elev: #ffffff;
  --code-bg: #f1edf8;
  --line: rgba(76, 29, 149, 0.14);
  --line-strong: rgba(76, 29, 149, 0.3);
  --fg: #1a1230;
  --fg-dim: #4a4163;
  --fg-mute: #70678c;
  --violet-soft: #6d28d9;
  --magenta-soft: #a21caf;
  --rose: #e11d48;
  --gold: #eab308;
  --gold-soft: #b45309;
  --ok: #15803d;
  --err: #dc2626;
  --grad-text: linear-gradient(105deg, #5b21b6 0%, #a21caf 45%, #b45309 100%);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --sidebar-bg: rgba(255, 255, 255, 0.55);
  --composer-bg: rgba(255, 255, 255, 0.72);
  --overlay-bg: rgba(246, 243, 252, 0.94);
  --scrim: rgba(26, 18, 48, 0.42);
  --shadow: rgba(26, 18, 48, 0.16);
  --shadow-soft: rgba(26, 18, 48, 0.1);
  --shadow-strong: rgba(26, 18, 48, 0.24);
  --highlight: rgba(26, 18, 48, 0.06);
  --kbd-bg: rgba(255, 255, 255, 0.22);
  --kbd-border: rgba(255, 255, 255, 0.45);
  --kbd-fg: rgba(255, 255, 255, 0.95);
  --brand-glow: rgba(192, 38, 211, 0.22);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 40%, var(--bg-deep) 100%);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 10px var(--brand-glow));
}
.brand-word {
  font-family: var(--font-ui); font-weight: 800; font-size: 1.15rem; letter-spacing: 0.02em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tag {
  font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold-soft); border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 999px;
  padding: 0.12rem 0.5rem;
}
.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 0.55rem; }

.chip {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.18rem 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42ch;
}
.chip-dir { color: var(--violet-soft); }
.chip-muted { color: var(--fg-mute); }

.badge {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ok); border: 1px solid rgba(62, 207, 142, 0.4); border-radius: 999px; padding: 0.14rem 0.6rem;
}
.badge.badge-warn { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.4); }

.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.18rem 0.65rem;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-mute); }
.pill-on .pill-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill-on { color: var(--ok); }
.pill-off .pill-dot { background: var(--err); }
.pill-off { color: var(--err); }

/* ---------- buttons / inputs ---------- */
.btn {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.82rem;
  border-radius: 10px; border: 1px solid transparent; padding: 0.42rem 0.9rem;
  cursor: pointer; color: var(--fg); background: var(--panel-2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--magenta-soft); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad-brand); box-shadow: 0 4px 18px rgba(192, 38, 211, 0.35); }
.btn-primary:hover { box-shadow: 0 6px 22px rgba(192, 38, 211, 0.5); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--fg-dim); }
.btn-ghost:hover { color: var(--fg); border-color: var(--violet-soft); }
.btn-danger:hover { color: var(--err); border-color: var(--err); }
.btn-sm { padding: 0.28rem 0.6rem; font-size: 0.76rem; }

.input, .select, textarea {
  font-family: var(--font-body); font-size: 0.86rem; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.45rem 0.7rem; outline: none;
}
.input:focus, .select:focus, textarea:focus { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(192, 38, 211, 0.18); }
.select { font-family: var(--font-mono); font-size: 0.78rem; max-width: 24ch; }
.select option { background: var(--panel-2); }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 264px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.8rem; border-right: 1px solid var(--line); background: var(--sidebar-bg);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar-head h2 {
  margin: 0; font-family: var(--font-ui); font-size: 0.95rem; letter-spacing: 0.04em;
  color: var(--violet-soft);
}
.session-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.session-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; color: var(--fg-dim);
}
.session-item:hover { background: var(--panel-2); color: var(--fg); }
.session-item.active { background: var(--panel-3); border-color: var(--line-strong); color: var(--fg); }
.session-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-mute); flex-shrink: 0; }
.session-dot.busy { background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.session-title { flex: 1; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-time { font-family: var(--font-mono); font-size: 0.66rem; color: var(--fg-mute); flex-shrink: 0; }
.session-empty { color: var(--fg-mute); font-size: 0.82rem; text-align: center; padding: 1.4rem 0.5rem; }

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

/* ---------- tabs ---------- */
.tabs-row {
  display: flex; align-items: flex-end; gap: 0.35rem;
  padding: 0.45rem 1rem 0; border-bottom: 1px solid var(--line);
  min-width: 0;
}
.tabs {
  display: flex; align-items: center; gap: 0.25rem;
  flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { height: 3px; }
.tab {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.84rem;
  background: none; border: none; color: var(--fg-mute); cursor: pointer;
  padding: 0.5rem 0.9rem; border-bottom: 2px solid transparent;
  flex: none; white-space: nowrap;
}
.tab:hover { color: var(--fg-dim); }
.tab.active {
  color: var(--fg);
  border-image: linear-gradient(90deg, var(--violet), var(--magenta)) 1;
}
.session-actions {
  display: flex; gap: 0.35rem; padding-bottom: 0.3rem;
  flex: none; align-items: center;
}

.tab-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tab-panel.active { display: flex; }

/* ---------- messages ---------- */
.messages { flex: 1; overflow-y: auto; padding: 1.1rem 1.2rem 0.4rem; display: flex; flex-direction: column; gap: 0.9rem; }
.msg { max-width: min(78ch, 92%); display: flex; flex-direction: column; gap: 0.35rem; }
.msg-role {
  font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--fg-mute);
}
.msg[data-role="user"] { align-self: flex-end; align-items: flex-end; }
.msg[data-role="user"] .msg-body {
  background: var(--grad-brand); border-radius: 14px 14px 4px 14px;
  padding: 0.6rem 0.85rem; box-shadow: 0 4px 18px rgba(107, 43, 217, 0.3);
}
.msg[data-role="assistant"] { align-self: flex-start; }
.msg[data-role="assistant"] .msg-body {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px;
  padding: 0.65rem 0.9rem;
}
.msg-body { width: 100%; overflow-wrap: break-word; }
.msg-body.streaming { border-color: rgba(251, 191, 36, 0.45); }
.msg-error {
  background: rgba(248, 113, 113, 0.08) !important;
  border: 1px solid rgba(248, 113, 113, 0.45) !important;
  border-radius: 4px 14px 14px 14px;
  color: var(--err);
  font-size: 0.86rem;
  padding: 0.6rem 0.85rem;
}
.msg-warn {
  background: rgba(251, 191, 36, 0.07) !important;
  border: 1px solid rgba(251, 191, 36, 0.4) !important;
  border-radius: 4px 14px 14px 14px;
  color: var(--gold-soft);
  font-size: 0.86rem;
  padding: 0.6rem 0.85rem;
}
.msg-time { font-family: var(--font-mono); font-size: 0.64rem; color: var(--fg-mute); }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0.45rem 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-ui); margin: 0.8rem 0 0.35rem; line-height: 1.3; }
.md h1 { font-size: 1.2rem; } .md h2 { font-size: 1.08rem; } .md h3 { font-size: 0.98rem; }
.md a { color: var(--magenta-soft); text-decoration: none; border-bottom: 1px solid rgba(232, 121, 249, 0.35); }
.md a:hover { border-bottom-color: var(--magenta-soft); }
.md code {
  font-family: var(--font-mono); font-size: 0.82em;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 6px; padding: 0.08rem 0.35rem;
}
.md pre {
  background: var(--panel-deep); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 0.85rem; overflow-x: auto; margin: 0.55rem 0;
}
.md pre code { background: none; border: none; padding: 0; font-size: 0.8rem; line-height: 1.5; }
.md ul, .md ol { margin: 0.4rem 0; padding-left: 1.35rem; }
.md li { margin: 0.18rem 0; }
.md blockquote {
  margin: 0.5rem 0; padding: 0.25rem 0.9rem;
  border-left: 3px solid var(--magenta); color: var(--fg-dim); background: rgba(192, 38, 211, 0.07);
  border-radius: 0 8px 8px 0;
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 0.8rem 0; }
/* Tableaux markdown. L'enveloppe porte le défilement : sans elle, une table large débordait de la bulle
   et poussait toute la conversation horizontalement sur téléphone. */
.md-table-wrap { overflow-x: auto; margin: 0.5rem 0; max-width: 100%; scrollbar-width: thin; }
.md table { border-collapse: collapse; margin: 0; font-size: 0.84rem; }
.md th, .md td { border: 1px solid var(--line-strong); padding: 0.3rem 0.6rem; text-align: left; vertical-align: top; }
.md th { background: var(--panel-3); font-family: var(--font-ui); font-weight: 600; white-space: nowrap; }
.md tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-3) 45%, transparent); }

/* ---------- waiting dock (busy / réflexion) — GIF marque au-dessus du composer ---------- */
.waiting-dock {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid rgba(107, 43, 217, 0.28);
  background: linear-gradient(
    90deg,
    rgba(107, 43, 217, 0.12),
    rgba(192, 38, 211, 0.08) 55%,
    rgba(251, 191, 36, 0.06)
  );
  pointer-events: none;
}
.waiting-dock.hidden { display: none !important; }
.waiting-logo-wrap {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.waiting-logo {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(192, 38, 211, 0.35));
}
.waiting-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.waiting-caption {
  font-family: var(--font-ui);
  font-weight: 650;
  font-size: 0.84rem;
  color: var(--fg);
}
.waiting-sub {
  font-size: 0.72rem;
  color: var(--fg-mute);
}
@media (max-width: 640px) {
  .waiting-sub { display: none; }
  .waiting-dock { padding: 0.45rem 0.7rem; }
}

.part-tool, .part-reasoning {
  margin: 0.3rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  font-size: 0.8rem;
}
.part-tool summary, .part-reasoning summary {
  cursor: pointer; padding: 0.4rem 0.7rem; font-family: var(--font-mono); font-size: 0.74rem;
  color: var(--violet-soft); list-style: none; display: flex; align-items: center; gap: 0.45rem;
}
.part-tool summary::before { content: "⚙"; }
.part-reasoning summary::before { content: "✦"; color: var(--gold-soft); }
.part-tool .tool-state { margin-left: auto; color: var(--fg-mute); }
.part-tool .tool-state.running { color: var(--gold); }
.part-tool pre, .part-reasoning .reasoning-body {
  margin: 0; padding: 0.5rem 0.7rem; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-dim);
  white-space: pre-wrap; overflow-wrap: break-word; max-height: 320px; overflow-y: auto;
}
.part-muted {
  display: inline-block; font-family: var(--font-mono); font-size: 0.7rem; color: var(--fg-mute);
  border: 1px dashed var(--line-strong); border-radius: 999px; padding: 0.1rem 0.6rem; margin: 0.2rem 0;
}

/* ---------- dynamic tool views ---------- */
.part-tool { overflow: hidden; }
.part-tool.tool-running { border-color: rgba(251, 191, 36, 0.45); box-shadow: 0 0 14px rgba(251, 191, 36, 0.08); }
.part-tool.tool-error { border-color: rgba(248, 113, 113, 0.5); }
.part-tool.tool-completed { opacity: 0.88; }
.tool-icon { color: var(--gold-soft); width: 1.1rem; text-align: center; flex-shrink: 0; }
.tool-label { color: var(--violet-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-body { border-top: 1px solid var(--line); }
.tool-kv { display: flex; gap: 0.5rem; padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.tool-k { color: var(--fg-mute); font-family: var(--font-mono); font-size: 0.7rem; min-width: 4.5rem; }
.tool-v { color: var(--fg-dim); font-family: var(--font-mono); overflow-wrap: anywhere; }
.tool-output {
  margin: 0.2rem 0.7rem 0.55rem; padding: 0.5rem 0.65rem; border-radius: 8px;
  background: var(--panel-deep); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-dim);
  white-space: pre-wrap; overflow-wrap: break-word; max-height: 320px; overflow-y: auto;
}
.tool-error { color: var(--err); border-color: rgba(248, 113, 113, 0.4); }

.terminal { background: #080610; border-radius: 8px; margin: 0.35rem 0.7rem 0.6rem; border: 1px solid var(--line); overflow: hidden; }
.terminal-cmd {
  display: flex; gap: 0.5rem; padding: 0.45rem 0.65rem;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg);
  background: rgba(167, 139, 250, 0.06); border-bottom: 1px solid var(--line);
}
.terminal-prompt { color: var(--ok); font-weight: 700; }
.terminal-out {
  margin: 0; padding: 0.5rem 0.65rem; font-family: var(--font-mono); font-size: 0.74rem;
  color: var(--fg-dim); white-space: pre-wrap; overflow-wrap: break-word; max-height: 340px; overflow-y: auto;
}
.terminal-running { padding: 0.4rem 0.65rem; font-family: var(--font-mono); font-size: 0.74rem; color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }

.diff { padding: 0.3rem 0 0.5rem; }
.diff-old, .diff-new {
  margin: 0.25rem 0.7rem; padding: 0.45rem 0.6rem; border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.74rem; white-space: pre-wrap; overflow-wrap: break-word;
  max-height: 260px; overflow-y: auto;
}
.diff-old { background: rgba(248, 113, 113, 0.07); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; }
.diff-new { background: rgba(62, 207, 142, 0.06); border: 1px solid rgba(62, 207, 142, 0.3); color: #86efac; }

.todo-list { list-style: none; margin: 0.25rem 0; padding: 0.3rem 0.7rem 0.55rem; display: flex; flex-direction: column; gap: 0.28rem; }
.todo-item { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.82rem; color: var(--fg-dim); }
.todo-icon { font-size: 0.7rem; width: 1rem; text-align: center; flex-shrink: 0; }
.todo-item.completed { color: var(--fg-mute); text-decoration: line-through; }
.todo-item.completed .todo-icon { color: var(--ok); }
.todo-item.in_progress .todo-icon { color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.todo-item.cancelled { color: var(--fg-mute); }
.todo-item.cancelled .todo-icon { color: var(--err); }

.step-line {
  height: 0; border-top: 1px dashed var(--line-strong); margin: 0.5rem 0 0.2rem;
  position: relative;
}
.step-line.finish { border-top-style: solid; opacity: 0.5; }

.patch-card, .file-card {
  display: inline-flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-2);
  padding: 0.35rem 0.7rem; margin: 0.2rem 0; font-size: 0.78rem; color: var(--fg-dim);
  text-decoration: none; max-width: 100%;
}
a.file-card:hover { border-color: var(--magenta); color: var(--fg); }
.patch-icon, .file-icon { color: var(--gold-soft); }
.file-mime { font-family: var(--font-mono); font-size: 0.64rem; color: var(--fg-mute); }

.typing { display: inline-flex; gap: 4px; padding: 0.35rem 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--magenta-soft); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.welcome { margin: auto; text-align: center; max-width: 46ch; color: var(--fg-dim); }
.welcome h2 {
  font-family: var(--font-ui); font-size: 1.5rem; margin: 0.8rem 0 0.4rem;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 0 18px rgba(192, 38, 211, 0.5));
}
.welcome code { font-family: var(--font-mono); font-size: 0.8em; background: var(--panel-3); border-radius: 6px; padding: 0.1rem 0.4rem; color: var(--magenta-soft); }

/* ---------- permissions — approbation (bottom sheet responsive, jamais coupé) ---------- */
.permission-bar {
  flex-shrink: 0;                 /* ne jamais se laisser pousser hors-écran (mobile/clavier) */
  max-height: 48vh;               /* une grosse demande scrolle en interne, le composer reste visible */
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 0.7rem 1.2rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  border-top: 2px solid rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.13), rgba(192, 38, 211, 0.08) 60%, var(--panel));
  box-shadow: 0 -14px 40px var(--shadow);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.permission-bar.pulse { animation: perm-pulse 1.3s ease-out 2; }
@keyframes perm-pulse {
  0%   { box-shadow: 0 -14px 40px var(--shadow), inset 0 2px 0 rgba(251,191,36,0.9); }
  50%  { box-shadow: 0 -14px 46px rgba(192,38,211,0.4), inset 0 2px 0 rgba(251,191,36,0.5); }
  100% { box-shadow: 0 -14px 40px var(--shadow), inset 0 2px 0 rgba(251,191,36,0); }
}
.permission-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "head actions" "body actions";
  align-items: center; gap: 0.35rem 0.9rem;
}
.permission-head { grid-area: head; display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.permission-icon { font-size: 1.05rem; }
.permission-q { font-size: 0.9rem; color: var(--fg); font-weight: 700; }
.permission-name { font-family: var(--font-mono); font-size: 0.82rem; color: var(--gold-soft); font-weight: 650; }
.permission-count { font-family: var(--font-mono); font-size: 0.66rem; color: var(--magenta-soft); background: var(--panel-3); border-radius: 999px; padding: 0 0.4rem; }
.permission-patterns { grid-area: body; display: flex; gap: 0.35rem; flex-wrap: wrap; min-width: 0; }
.permission-patterns code {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--magenta-soft);
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 6px; padding: 0.14rem 0.5rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.permission-actions { grid-area: actions; display: flex; gap: 0.4rem; align-items: center; }
.permission-actions .btn { white-space: nowrap; }
.perm-hint { font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-mute); }
@media (hover: none) { .perm-hint { display: none; } } /* raccourcis clavier masqués au tactile */

/* Tablette + mobile : sheet plein largeur, gros boutons de contrôle rapide (tap ≥ 44px) */
@media (max-width: 900px) {
  .permission-card { grid-template-columns: 1fr; grid-template-areas: "head" "body" "actions"; gap: 0.55rem; }
  .permission-actions { width: 100%; }
  .permission-actions .btn { flex: 1; min-height: 44px; font-size: 0.9rem; }
  .permission-patterns code { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
  .permission-bar { max-height: 62vh; padding: 0.85rem 0.9rem calc(0.85rem + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px 0 0; }
  .permission-actions { flex-wrap: wrap; }
  .permission-actions .btn-primary { flex-basis: 100%; }
}

/* ---------- composer ---------- */
.composer { flex-shrink: 0; position: relative; padding: 0.7rem 1.2rem calc(0.8rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--composer-bg); }
.board-reminder {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--line); border-left: 3px solid var(--gold, #d4a017);
  border-radius: 10px; background: var(--panel); font-size: 0.82rem; color: var(--ink);
  cursor: pointer; user-select: none;
}
.board-reminder:hover { background: var(--hover, rgba(127,127,127,0.08)); }
.board-reminder .br-glyph { opacity: 0.9; }
.board-reminder .br-count { font-weight: 600; color: var(--gold, #d4a017); white-space: nowrap; }
.board-reminder .br-titles { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }
.board-reminder .br-close { margin-left: auto; padding: 0 0.3rem; opacity: 0.6; font-size: 0.9rem; background: none; border: none; color: inherit; cursor: pointer; }
.board-reminder.hidden { display: none; }
#prompt {
  width: 100%; resize: none; font-size: 0.92rem; line-height: 1.5;
  background: var(--panel); border-radius: 12px; padding: 0.65rem 0.85rem;
  min-height: 3.2rem; max-height: 40vh;
}
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.5rem; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 0.5rem; }

.slash-palette {
  position: absolute; left: 1.2rem; right: 1.2rem; bottom: calc(100% - 0.4rem);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 -8px 40px var(--shadow); max-height: 260px; overflow-y: auto; z-index: 30;
}
.slash-item { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0.8rem; cursor: pointer; }
.slash-item:hover, .slash-item.selected { background: var(--panel-3); }
.slash-name { font-family: var(--font-mono); font-size: 0.8rem; color: var(--magenta-soft); flex-shrink: 0; }
.slash-desc { font-size: 0.78rem; color: var(--fg-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slash-empty { padding: 0.6rem 0.8rem; color: var(--fg-mute); font-size: 0.8rem; }
/* badge de source (projet · skill · mcp · hub · canvas) + pied d'aide de la palette « / » */
.slash-desc { flex: 1; min-width: 0; }
.slash-src { flex-shrink: 0; margin-left: auto; font-family: var(--font-mono); font-size: 0.62rem; padding: 0.05rem 0.4rem; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-mute); }
.slash-src-skill { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.4); }
.slash-src-hub { color: var(--violet-soft); border-color: rgba(167, 139, 250, 0.4); }
.slash-src-builtin { color: var(--fg-dim); }
.slash-src-mcp { color: #34d399; border-color: rgba(52, 211, 153, 0.4); }
.slash-foot { display: flex; gap: 0.9rem; align-items: center; padding: 0.35rem 0.8rem; border-top: 1px solid var(--line); font-size: 0.68rem; color: var(--fg-mute); }
.slash-foot .slash-count { margin-left: auto; font-family: var(--font-mono); }

/* ---------- playground ---------- */
.playground { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; padding: 1.2rem; }
.pg-col h3 {
  font-family: var(--font-ui); font-size: 0.92rem; color: var(--violet-soft);
  margin: 0 0 0.7rem; letter-spacing: 0.03em;
}
.pg-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.pg-field span { font-size: 0.78rem; color: var(--fg-mute); font-family: var(--font-mono); }
.pg-field textarea { font-family: var(--font-mono); font-size: 0.82rem; resize: vertical; }
.pg-hint { font-size: 0.78rem; color: var(--fg-mute); }
.pg-commands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.pg-command { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.7rem; background: var(--panel); }
.pg-command-name { font-family: var(--font-mono); font-size: 0.8rem; color: var(--magenta-soft); }
.pg-command-desc { font-size: 0.78rem; color: var(--fg-dim); margin-top: 0.15rem; }
.pg-command-src { font-family: var(--font-mono); font-size: 0.64rem; color: var(--fg-mute); margin-left: 0.5rem; }

/* ---------- vscode panel ---------- */
.pg-check { flex-direction: row !important; align-items: center; gap: 0.5rem; }
.pg-check input { accent-color: var(--magenta); width: 15px; height: 15px; }
.pg-check span { font-family: var(--font-body) !important; color: var(--fg-dim) !important; font-size: 0.82rem !important; }
.vs-result {
  margin-top: 0.9rem; border: 1px solid rgba(62, 207, 142, 0.4); border-radius: 10px;
  background: rgba(62, 207, 142, 0.06); padding: 0.7rem 0.85rem; font-size: 0.84rem;
}
.vs-result code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--gold-soft); background: var(--panel-3); border-radius: 6px; padding: 0.1rem 0.4rem; }
.vs-result .vs-url { display: inline-block; margin: 0.25rem 0; }
.vs-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.vs-list-head h3 { margin: 0; }
.vs-instances { display: flex; flex-direction: column; gap: 0.5rem; }
.vs-instance {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.35rem;
}
.vs-instance-top { display: flex; align-items: center; gap: 0.55rem; }
.vs-instance-name { font-family: var(--font-mono); font-size: 0.82rem; color: var(--violet-soft); flex: 1; }
.vs-state { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; border-radius: 999px; padding: 0.12rem 0.55rem; }
.vs-state.running { color: var(--ok); border: 1px solid rgba(62, 207, 142, 0.4); }
.vs-state.exited, .vs-state.stopped { color: var(--fg-mute); border: 1px solid var(--line-strong); }
.vs-instance-meta { font-size: 0.74rem; color: var(--fg-mute); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-instance-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.vs-empty { color: var(--fg-mute); font-size: 0.82rem; padding: 0.8rem 0.2rem; }

.btn-burger { display: none; }
@media (max-width: 900px) {
  .btn-burger { display: inline-block; }
}
.msg { position: relative; }
.msg-actions { display: flex; gap: 0.3rem; opacity: 0; transition: opacity 0.15s ease; }
.msg:hover .msg-actions { opacity: 1; }
.msg-copy {
  font-family: var(--font-mono); font-size: 0.64rem; color: var(--fg-mute);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.08rem 0.45rem; cursor: pointer;
}
.msg-copy:hover { color: var(--magenta-soft); border-color: var(--magenta); }
.msg-usage { font-family: var(--font-mono); font-size: 0.64rem; color: var(--gold-soft); opacity: 0.8; }
.chip-warn { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.45); }
.vs-provider-badge {
  font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--magenta-soft); border: 1px solid rgba(232, 121, 249, 0.35); border-radius: 999px; padding: 0.1rem 0.5rem;
}
.vs-ctx { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.2rem 0; }
.vs-cred-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.vs-url { display: inline-block; margin: 0.3rem 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--magenta-soft); }
.vs-steps { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.vs-step { font-family: var(--font-mono); font-size: 0.74rem; }
.vs-step-ok { color: var(--ok); }
.vs-step-skipped { color: var(--fg-mute); }
.vs-step-failed { color: var(--err); }

/* ---------- statusbar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 1rem; border-top: 1px solid var(--line);
  background: var(--topbar-bg);
}
.spacer { flex: 1; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 3rem; right: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--violet-soft);
  border-radius: 10px; padding: 0.55rem 0.9rem; max-width: 46ch; font-size: 0.84rem;
  box-shadow: 0 8px 30px var(--shadow); animation: slide-in 0.18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.gold { border-left-color: var(--gold); }
@keyframes slide-in { from { transform: translateX(12px); opacity: 0; } }

.hidden { display: none !important; }

/* ---------- pad (artefacts & étapes) ---------- */
.pad {
  position: fixed; top: 49px; right: 0; bottom: 33px; width: min(560px, 44vw); z-index: 60;
  display: flex; flex-direction: column;
  background: var(--overlay-bg); backdrop-filter: blur(14px);
  border-left: 1px solid var(--line-strong);
  box-shadow: -12px 0 40px var(--shadow);
  animation: pad-in 0.18s ease;
}
@keyframes pad-in { from { transform: translateX(24px); opacity: 0; } }
.pad-head { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); }
.pad-tabs { display: flex; gap: 0.2rem; }
.pad-tab {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.8rem;
  background: none; border: none; color: var(--fg-mute); cursor: pointer; padding: 0.35rem 0.7rem;
  border-bottom: 2px solid transparent;
}
.pad-tab.active { color: var(--fg); border-image: linear-gradient(90deg, var(--violet), var(--magenta)) 1; }
.pad-head-actions { display: flex; gap: 0.25rem; }
.pad-progress { position: relative; height: 22px; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow: hidden; }
.pad-progress-fill {
  height: 100%; width: 40%; background: var(--grad-brand); opacity: 0.6;
  animation: pad-slide 1.4s ease-in-out infinite;
}
@keyframes pad-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.pad-progress-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--fg-dim);
}
.pad-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.pad-panel.active { display: flex; }
.pad-artifact-list {
  display: flex; gap: 0.35rem; padding: 0.5rem 0.7rem; overflow-x: auto; border-bottom: 1px solid var(--line);
}
.pad-artifact-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--fg-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.6rem; cursor: pointer;
}
.pad-artifact-chip:hover { border-color: var(--violet-soft); color: var(--fg); }
.pad-artifact-chip.active { border-color: var(--magenta); color: var(--magenta-soft); background: var(--panel-3); }
.pad-artifact-chip .chip-new { color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.pad-artifact-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pad-artifact-meta {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--fg-mute);
}
.pad-artifact-meta .spacer { flex: 1; }
.pad-artifact-body { flex: 1; min-height: 0; overflow: auto; background: #fff; }
.pad-artifact-body.dark { background: var(--bg-soft); }
.pad-artifact-body iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }
.pad-artifact-body pre { margin: 0; padding: 0.8rem; font-family: var(--font-mono); font-size: 0.76rem; color: var(--fg-dim); white-space: pre-wrap; overflow-wrap: break-word; }
.pad-artifact-body img.svg-artifact { display: block; max-width: 100%; margin: 1rem auto; }
.pad-empty { margin: auto; text-align: center; color: var(--fg-mute); font-size: 0.84rem; padding: 2rem 1rem; }
.pad-steps-list { flex: 1; overflow-y: auto; padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.35rem; }
.pad-step {
  display: flex; gap: 0.55rem; align-items: baseline;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
}
.pad-step-icon { color: var(--gold-soft); flex-shrink: 0; }
.pad-step.running { border-color: rgba(251, 191, 36, 0.45); }
.pad-step.error { border-color: rgba(248, 113, 113, 0.5); }
.pad-step-label { color: var(--violet-soft); font-family: var(--font-mono); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-step-status { margin-left: auto; font-family: var(--font-mono); font-size: 0.64rem; color: var(--fg-mute); flex-shrink: 0; }
.pad-step.running .pad-step-status { color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.pad-foot {
  display: flex; gap: 0.3rem; padding: 0.45rem 0.7rem; border-top: 1px solid var(--line);
  padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
}
.pad-foot .btn.active { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.5); }
.count-badge {
  background: var(--grad-brand); border-radius: 999px; font-family: var(--font-mono); font-size: 0.62rem;
  padding: 0.05rem 0.4rem; margin-left: 0.25rem;
}
.pad-lock {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--overlay-bg); backdrop-filter: blur(12px);
}
.pad-lock-card { text-align: center; max-width: 22rem; }
.pad-lock-card h2 { font-family: var(--font-ui); background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 900px) {
  .pad { width: 100vw; top: 0; bottom: 0; border-left: none; padding-top: env(safe-area-inset-top, 0px); }
}

/* ---------- pad editor + csv ---------- */
.pad-editor {
  flex: 1; min-height: 0; width: 100%; resize: none; border: none; outline: none;
  background: var(--panel-deep); color: var(--fg);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55;
  padding: 0.8rem 0.9rem;
}
.pad-editor:focus { box-shadow: inset 0 0 0 2px rgba(192, 38, 211, 0.35); }
.csv-table { border-collapse: collapse; margin: 0.7rem; font-size: 0.78rem; max-width: calc(100% - 1.4rem); }
.csv-table th, .csv-table td { border: 1px solid var(--line-strong); padding: 0.28rem 0.55rem; text-align: left; }
.csv-table th { background: var(--panel-3); font-family: var(--font-ui); color: var(--violet-soft); position: sticky; top: 0; }

/* ---------- board (kanban universel) ---------- */
.board-wrap { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.9rem; }
.board-head { display: flex; align-items: center; gap: 0.6rem; }
.board-feedback { display: flex; gap: 0.5rem; }
.board-feedback .input { flex: 1; }
.board-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 900px) { .board-cols { grid-template-columns: 1fr; } }
.board-col h3, .board-sessions-title { font-family: var(--font-ui); font-size: 0.9rem; color: var(--violet-soft); margin: 0 0 0.5rem; }
.board-items { display: flex; flex-direction: column; gap: 0.4rem; }
.board-item {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 0.5rem 0.7rem; font-size: 0.8rem; display: flex; gap: 0.5rem; align-items: baseline;
}
.board-item .bi-id { font-family: var(--font-mono); font-size: 0.7rem; color: var(--magenta-soft); flex-shrink: 0; }
.board-item .bi-status { margin-left: auto; font-family: var(--font-mono); font-size: 0.64rem; flex-shrink: 0; }
.bi-status.done { color: var(--ok); }
.bi-status.backlog { color: var(--fg-mute); }
.bi-status.in_progress { color: var(--gold); }
.bi-status.review { color: var(--magenta-soft); }
.board-item.feed { border-left: 3px solid var(--gold); }
.board-item.feed.reply { border-left-color: var(--ok); }
.board-item.feed.out { border-left-color: var(--violet-soft); }
.board-item .bi-meta { font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-mute); }
.board-session { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 0.6rem 0.8rem; }
.board-session h4 { margin: 0 0 0.5rem; font-size: 0.84rem; font-family: var(--font-ui); color: var(--fg-dim); }
.board-session-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.board-mini-col h5 { margin: 0 0 0.35rem; font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-mute); }
.board-mini-col .board-item { padding: 0.35rem 0.55rem; font-size: 0.74rem; }

/* ---------- board approvals + dnd ---------- */
.board-approval { margin-bottom: 0.4rem; }
.approval-card {
  border: 1px solid rgba(251, 191, 36, 0.5); border-radius: 12px;
  background: linear-gradient(120deg, rgba(251, 191, 36, 0.1), rgba(192, 38, 211, 0.06));
  padding: 0.75rem 0.95rem; display: flex; flex-direction: column; gap: 0.45rem;
  animation: pad-in 0.2s ease;
}
.approval-head { display: flex; align-items: center; gap: 0.5rem; }
.approval-icon { color: var(--gold); font-size: 1.1rem; }
.approval-kind { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold-soft); }
.approval-title { font-family: var(--font-ui); font-weight: 700; font-size: 0.95rem; }
.approval-body { font-size: 0.8rem; color: var(--fg-dim); }
.approval-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.board-item-draggable { cursor: grab; }
.board-item-draggable:active { cursor: grabbing; opacity: 0.85; }
.board-mini-col.drag-over { outline: 2px dashed var(--magenta); outline-offset: 4px; border-radius: 8px; background: rgba(192, 38, 211, 0.06); }

/* ---------- board : cartes interactives + modale de carte (Monday-like) ---------- */
.board-sessions-hint { font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-mute); font-weight: 400; margin-left: 0.5rem; }
.board-session-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.board-session-head h4 { margin: 0 0 0.5rem; }
.btn-xs { padding: 0.15rem 0.5rem; font-size: 0.68rem; }
.board-card { position: relative; cursor: pointer; transition: border-color 0.12s ease, transform 0.12s ease; border-left: 3px solid var(--line-strong); }
.board-card:hover, .board-card:focus-visible { border-color: var(--magenta-soft); transform: translateY(-1px); outline: none; }
.board-card.prio-high { border-left-color: var(--gold); }
.board-card.prio-medium { border-left-color: var(--violet-soft); }
.board-card.prio-low { border-left-color: var(--line-strong); }
.board-card .bc-text { flex: 1; min-width: 0; }
.board-card .bc-count {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 0.6rem; padding: 0 0.35rem; border-radius: 999px;
  background: rgba(192, 38, 211, 0.18); color: var(--magenta-soft);
}
.board-mini-col[data-status="in_progress"] h5 { color: var(--gold); }
.board-mini-col[data-status="completed"] h5 { color: var(--ok); }

/* ---------- board distant (plateforme liée : Odoo, Monday, Jira, ServiceNow…) ---------- */
.board-remote { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.board-remote-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.board-remote-col { background: rgba(255, 255, 255, 0.015); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.55rem; }
.board-remote-card { border: 1px solid var(--line); border-left: 3px solid var(--violet-soft); border-radius: 8px; background: var(--panel); padding: 0.35rem 0.5rem; margin-bottom: 0.3rem; }
.board-remote-card:hover { border-color: var(--magenta-soft); }
.board-remote-line { display: flex; gap: 0.4rem; align-items: baseline; font-size: 0.72rem; line-height: 1.35; color: var(--fg-dim); }
.board-remote-line .bi-id { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-mute); }
.board-remote-meta { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.25rem; }
.board-remote-date { font-family: var(--font-mono); font-size: 0.6rem; color: var(--fg-mute); }
.modal-note-input { width: 100%; margin-top: 0.5rem; font-family: var(--font-ui); font-size: 0.8rem; resize: vertical; }
.board-remote-actions { display: flex; gap: 0.25rem; margin-top: 0.3rem; }
.board-remote-actions .btn { flex-shrink: 0; }
.vs-empty-tight { padding: 0.3rem 0.5rem; font-size: 0.7rem; }
@media (max-width: 900px) { .board-remote { grid-template-columns: 1fr; } }
#board-loop-state[data-status="running"] { border-color: rgba(52, 211, 153, 0.5); }
#board-loop-state[data-status="waiting_approval"] { border-color: rgba(251, 191, 36, 0.7); color: var(--gold-soft); }
#board-loop-state[data-status="paused"] { color: var(--fg-mute); }
.board-item .bi-text { flex: 1; min-width: 0; display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: baseline; }
.board-item .bi-card {
  font-family: var(--font-mono); font-size: 0.62rem; padding: 0 0.4rem; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--panel-3); color: var(--violet-soft); cursor: pointer;
}
.board-item .bi-card:hover { border-color: var(--magenta-soft); }
.board-item.feed.card { border-left-color: var(--magenta); }
.card-modal { display: flex; flex-direction: column; gap: 0.7rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.card-status.pending { color: var(--fg-mute); }
.card-status.in_progress { color: var(--gold); border-color: rgba(251, 191, 36, 0.5); }
.card-status.completed { color: var(--ok); }
.card-status.cancelled { color: var(--fg-mute); text-decoration: line-through; }
.card-prio.prio-high { color: var(--gold-soft); }
.card-key { color: var(--magenta-soft); font-family: var(--font-mono); }
.card-moves { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.card-hint { margin: 0; font-size: 0.72rem; color: var(--fg-mute); line-height: 1.45; }
.card-note { display: flex; flex-direction: column; gap: 0.45rem; }
.card-note textarea.input { resize: vertical; min-height: 2.6rem; }
.card-note-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.card-wake { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; color: var(--fg-dim); cursor: pointer; }
.card-activity-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.card-activity-head h3 { margin: 0; font-family: var(--font-ui); font-size: 0.85rem; color: var(--violet-soft); }
.card-activity { max-height: 40vh; overflow-y: auto; }
@media (max-width: 640px) {
  .card-moves .btn { flex: 1 1 100%; }
  .card-activity { max-height: 32vh; }
}

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, 0.35); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sidebar { position: absolute; z-index: 40; height: calc(100% - 49px - 33px); transform: translateX(-100%); transition: transform 0.18s ease; background: var(--bg-soft); }
  .sidebar.open { transform: translateX(0); }
  .playground { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================================
   UI kit — modals, palette, menus, toasts v2, réglages, raccourcis, états vides
   (CSP strict : tout en classes / custom properties, zéro style inline)
   ===================================================================================== */

/* ---------- préférences (data-attributes sur <html>) ---------- */
html[data-font="s"] body { font-size: 13.2px; }
html[data-font="l"] body { font-size: 16px; }
html[data-density="compact"] .messages { gap: 0.5rem; padding-top: 0.7rem; }
html[data-density="compact"] .msg { gap: 0.2rem; }
html[data-density="compact"] .session-item { padding: 0.3rem 0.5rem; }
html[data-density="compact"] .composer { padding: 0.45rem 0.9rem 0.55rem; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important;
}

/* ---------- focus visible (clavier) ---------- */
:focus-visible { outline: 2px solid var(--magenta-soft); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .chip-btn:focus-visible { outline-offset: 1px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- kbd ---------- */
.kbd {
  font-family: var(--font-mono); font-size: 0.62rem; line-height: 1; color: var(--fg-dim);
  background: var(--panel-3); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.18rem 0.38rem; white-space: nowrap;
}
.kbd-inline { margin-left: 0.35rem; color: var(--kbd-fg); background: var(--kbd-bg); border-color: var(--kbd-border); }
.btn-palette { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--fg-mute); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.55rem 0.3rem 0.7rem; min-width: 12rem; justify-content: flex-start; }
.btn-palette:hover { color: var(--fg); border-color: var(--line-strong); }
.btn-palette-text { flex: 1; text-align: left; font-size: 0.8rem; }
.btn-icon { padding-inline: 0.55rem; font-size: 1rem; }
/* bascule thème : la lune en sombre (→ passer en clair), le soleil en clair (→ passer en sombre) */
.btn-theme .theme-glyph { display: none; line-height: 1; }
html[data-theme="dark"] .btn-theme .theme-glyph-dark { display: inline; }
html[data-theme="light"] .btn-theme .theme-glyph-light { display: inline; color: var(--gold-soft); }
.btn-theme:hover .theme-glyph { filter: drop-shadow(0 0 6px var(--brand-glow)); }
.palette-glyph { color: var(--magenta-soft); font-size: 0.95rem; }

/* ---------- chips composer ---------- */
.chip-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; max-width: 22ch; transition: border-color 0.15s ease, color 0.15s ease; }
.chip-btn:hover { border-color: var(--magenta); color: var(--fg); }
.chip-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-model .chip-glyph { color: var(--magenta-soft); }
.chip-agent .chip-glyph { color: var(--gold-soft); }
.chip-tokens { font-family: var(--font-mono); }

/* ---------- sessions : groupes par jour + menu ⋯ ---------- */
.session-group {
  list-style: none; font-family: var(--font-ui); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-mute); padding: 0.65rem 0.5rem 0.25rem; user-select: none;
}
.session-group:first-child { padding-top: 0.2rem; }
.session-item { position: relative; padding-right: 1.9rem; }
.session-more {
  position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--fg-mute);
  font-size: 0.9rem; line-height: 1; padding: 0.1rem 0.3rem; cursor: pointer; opacity: 0; transition: opacity 0.15s ease;
}
.session-item:hover .session-more, .session-item:focus-within .session-more, .session-item.active .session-more { opacity: 1; }
.session-more:hover { color: var(--fg); border-color: var(--line-strong); background: var(--panel-3); }
@media (hover: none) { .session-more { opacity: 1; } }
.session-empty .empty { padding: 1.4rem 0.4rem; }

/* ---------- messages : actions + « revenir » ---------- */
.msg-copy.msg-danger:hover { color: var(--err); border-color: var(--err); }
.msg[data-role="user"] .msg-actions { justify-content: flex-end; }
@media (hover: none) { .msg-actions { opacity: 0.85; } }

.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jump {
  position: absolute; left: 50%; bottom: 0.8rem; transform: translateX(-50%);
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.35rem 0.9rem; font-size: 0.78rem; cursor: pointer; box-shadow: 0 10px 30px var(--shadow);
  display: inline-flex; align-items: center; gap: 0.4rem; animation: jump-in 0.18s ease; z-index: 3;
}
.jump:hover { border-color: var(--magenta); }
.jump.has-new { border-color: var(--magenta); background: linear-gradient(120deg, rgba(107, 43, 217, 0.5), var(--brand-glow)); }
@keyframes jump-in { from { transform: translate(-50%, 8px); opacity: 0; } }

/* ---------- skeleton / états vides ---------- */
.skeleton { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.4rem 0; }
.skeleton-messages { padding: 1.1rem 1.2rem; }
.skeleton-line {
  height: 0.85rem; width: var(--w, 70%); border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 40%, var(--panel-2) 80%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem; padding: 1.6rem 1rem; color: var(--fg-dim); }
.empty-icon { font-size: 1.7rem; color: var(--magenta-soft); filter: drop-shadow(0 0 12px var(--brand-glow)); }
.empty-title { margin: 0; font-family: var(--font-ui); font-size: 0.95rem; color: var(--fg); }
.empty-text { margin: 0 0 0.5rem; font-size: 0.8rem; max-width: 38ch; }

/* ---------- toasts v2 ---------- */
.toast {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: start; gap: 0.55rem;
  position: relative; overflow: hidden; padding-bottom: 0.7rem;
}
.toast.leaving { animation: toast-out 0.16s ease forwards; }
@keyframes toast-out { to { transform: translateX(16px); opacity: 0; } }
.toast-icon { font-family: var(--font-mono); font-weight: 700; color: var(--violet-soft); line-height: 1.4; }
.toast.ok .toast-icon { color: var(--ok); }
.toast.err .toast-icon { color: var(--err); }
.toast.gold .toast-icon { color: var(--gold); }
.toast.warn { border-left-color: var(--gold-soft); }
.toast.warn .toast-icon { color: var(--gold-soft); }
.toast-body { min-width: 0; }
.toast-line { overflow-wrap: anywhere; }
.toast-action {
  background: var(--panel-3); color: var(--magenta-soft); border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 0.74rem; font-weight: 600; padding: 0.2rem 0.55rem; cursor: pointer; white-space: nowrap;
}
.toast-action:hover { border-color: var(--magenta); color: var(--fg); }
.toast-close { background: none; border: none; color: var(--fg-mute); cursor: pointer; font-size: 0.8rem; padding: 0 0.1rem; line-height: 1.4; }
.toast-close:hover { color: var(--fg); }
.toast-progress {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--violet-soft), var(--magenta-soft));
  animation: toast-progress var(--toast-ms, 4200ms) linear forwards;
}
.toast.paused .toast-progress { animation-play-state: paused; }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- modals (<dialog>) ---------- */
#modal-root dialog.modal {
  border: 1px solid var(--line-strong); border-radius: 18px; padding: 0; margin: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--fg);
  width: min(560px, calc(100vw - 2rem)); max-height: min(86vh, 900px);
  box-shadow: 0 30px 90px var(--shadow-strong), 0 0 0 1px rgba(232, 121, 249, 0.08), 0 0 60px rgba(107, 43, 217, 0.18);
  opacity: 0; transform: translateY(10px) scale(0.985);
  transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
}
#modal-root dialog.modal.open { opacity: 1; transform: none; }
#modal-root dialog.modal.closing { opacity: 0; transform: translateY(8px) scale(0.99); }
#modal-root dialog.modal-sm { width: min(460px, calc(100vw - 2rem)); }
#modal-root dialog.modal-lg { width: min(820px, calc(100vw - 2rem)); }
#modal-root dialog::backdrop { background: var(--scrim); backdrop-filter: blur(6px); }
.modal-head { display: flex; align-items: flex-start; gap: 0.8rem; padding: 1.1rem 1.2rem 0.4rem; }
.modal-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.modal-eyebrow { font-family: var(--font-ui); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-soft); }
.modal-danger .modal-eyebrow { color: var(--err); }
.modal-title { margin: 0; font-family: var(--font-ui); font-size: 1.12rem; font-weight: 800; letter-spacing: 0.01em; }
.modal-close { flex: none; }
.modal-body { padding: 0.4rem 1.2rem 0.6rem; overflow: auto; min-height: 0; }
.modal-text { margin: 0.2rem 0; color: var(--fg-dim); line-height: 1.55; }
.modal-detail { margin: 0.2rem 0; color: var(--fg-mute); font-size: 0.82rem; }
.modal-stack { display: flex; flex-direction: column; gap: 0.6rem; }
.modal-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; color: var(--fg-mute); }
.modal-field .input { font-size: 0.92rem; }
.modal-error { color: var(--err); font-size: 0.78rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.7rem 1.2rem 1.1rem; border-top: 1px solid var(--line); }
.btn-danger-solid { background: linear-gradient(120deg, #b91c1c, #e11d48) !important; border-color: transparent !important; }
.btn-danger-solid:hover { filter: brightness(1.08); }
.modal-action:disabled { opacity: 0.45; cursor: not-allowed; }

/* partage */
.share-row { display: flex; gap: 0.5rem; align-items: center; }
.share-url { flex: 1; font-family: var(--font-mono); font-size: 0.78rem; }
.share-open { color: var(--magenta-soft); font-size: 0.82rem; text-decoration: none; }
.share-open:hover { text-decoration: underline; }

/* diagnostic */
.diag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.diag-item { display: grid; grid-template-columns: 8rem 1fr; gap: 0.6rem; font-size: 0.8rem; }
.diag-key { color: var(--fg-mute); font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; padding-top: 0.15rem; }
.diag-val { font-family: var(--font-mono); font-size: 0.76rem; color: var(--fg); overflow-wrap: anywhere; }
.diag-bad { color: var(--err); }

/* réglages */
.settings { display: flex; flex-direction: column; gap: 0.55rem; }
.settings-section { margin: 0.6rem 0 0.1rem; font-family: var(--font-ui); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--magenta-soft); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: none; }
.settings-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.settings-label { font-size: 0.9rem; color: var(--fg); }
.settings-hint { font-size: 0.74rem; color: var(--fg-mute); }
.segmented { display: inline-flex; background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px; flex: none; }
.segmented-btn { background: transparent; border: none; color: var(--fg-mute); font-size: 0.76rem; font-weight: 600; padding: 0.3rem 0.75rem; border-radius: 999px; cursor: pointer; }
.segmented-btn.active { background: linear-gradient(120deg, var(--violet), var(--magenta)); color: #fff; }
.switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-3); cursor: pointer; transition: background 0.18s ease; padding: 0; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--fg-dim); transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.18s ease; }
.switch.on { background: linear-gradient(120deg, var(--violet), var(--magenta)); border-color: transparent; }
.switch.on .switch-knob { transform: translateX(18px); background: #fff; }

/* écosystème dmagh (Hub) — cartes d'état réel */
.eco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.7rem; margin-top: 0.6rem; }
.eco-card { border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.8rem; background: var(--bg-elev); display: flex; flex-direction: column; gap: 0.35rem; border-left-width: 3px; }
.eco-on { border-left-color: var(--ok, #4ade80); } .eco-off { border-left-color: var(--fg-dim); } .eco-negotiate { border-left-color: var(--warn, #f5b342); } .eco-unavailable, .eco-unknown { border-left-color: var(--border); }
.eco-top { display: flex; align-items: center; gap: 0.45rem; }
.eco-title { margin: 0; font-size: 0.95rem; flex: 1; }
.eco-glyph { color: var(--fg-dim); white-space: nowrap; }
.eco-state { font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--border); color: var(--fg-dim); white-space: nowrap; }
.eco-state-on { color: var(--ok, #4ade80); } .eco-state-negotiate { color: var(--warn, #f5b342); } .eco-state-unavailable { color: var(--err); }
.eco-role { margin: 0; font-size: 0.85rem; }
.eco-detail { margin: 0; font-size: 0.8rem; }
.eco-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: auto; }
.eco-doc { font-size: 0.72rem; margin-left: auto; }
/* bureau natif */
.desk { display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.88rem; }
.desk-list { display: flex; flex-direction: column; gap: 0.25rem; }
.desk-row { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.desk-row-manual { opacity: 0.7; }
.desk-cmd, .desk-file { display: block; font-family: var(--mono); font-size: 0.78rem; background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.5rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.desk-step { border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.6rem; }
.desk-step summary { cursor: pointer; }
.desk-ok { color: var(--ok, #4ade80); margin: 0.15rem 0; } .desk-ko { color: var(--err); margin: 0.15rem 0; }
.desk-actions { display: flex; gap: 0.4rem; }
/* parcours dock — bas droite, une étape à la fois */
.dock { position: fixed; right: 14px; bottom: 14px; z-index: 59; width: min(360px, calc(100vw - 28px)); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 0.6rem 0.75rem; box-shadow: 0 10px 30px var(--shadow-soft); font-size: 0.84rem; display: flex; flex-direction: column; gap: 0.35rem; }
.dock-head { display: flex; align-items: center; gap: 0.45rem; }
.dock-eyebrow { font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-dim); white-space: nowrap; }
.dock-bar { flex: 1; height: 4px; background: var(--code-bg); border-radius: 999px; overflow: hidden; }
.dock-fill { height: 100%; background: var(--magenta); transition: width 0.3s; }
.dock-count { font-size: 0.72rem; }
.dock-title { margin: 0; display: flex; gap: 0.4rem; align-items: baseline; }
.dock-glyph { color: var(--fg-dim); white-space: nowrap; }
.dock-why { margin: 0; font-size: 0.8rem; }
.dock-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.dock-meta { margin: 0; font-size: 0.72rem; }
/* Tous écrans : bulle d'aide et carte de premiers pas se posent AU-DESSUS du composeur (hauteur réelle --composer-h,
   suivie en JS) — jamais sur « Envoyer » ni sur la puce du modèle (constaté aussi sur ordinateur). */
@media (min-width: 901px) {
  body .dock { bottom: calc(var(--composer-h, 0px) + 12px); }
  body .helpdesk-bubble { bottom: calc(var(--composer-h, 0px) + 12px); }
}
/* ≤ 900 px (téléphone, tablette, app mobile) : le composeur occupe tout le bas — la carte de premiers pas se pose
   AU-DESSUS (et au-dessus du 🆘), jamais sur « Envoyer » ni sur la puce du modèle (constaté sur iPad). */
@media (max-width: 900px) { body .dock { right: 10px; bottom: calc(var(--composer-h, 240px) + 58px); max-height: calc(100vh - var(--composer-h, 240px) - 130px); overflow: auto; } }

/* onboarding */
.onb { display: flex; flex-direction: column; gap: 0.8rem; min-height: 22rem; }
.onb-dots { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.onb-dot { font-size: 0.75rem; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--fg-dim); }
.onb-dot.active { border-color: var(--magenta); color: var(--fg); } .onb-dot.done { color: var(--ok, #4ade80); }
.onb-content h3 { margin: 0 0 0.4rem; }
.onb-list { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.88rem; line-height: 1.6; }

/* vocal (🎙) — même machine à états que TUI / mobile ; bannière d'état au-dessus de la barre du composer */
.btn-voice { font-size: 1.05rem; line-height: 1; min-width: 2.4rem; }
.btn-voice.voice-recording { background: var(--err); color: #fff; animation: voice-pulse 1.1s ease-in-out infinite; }
.btn-voice.voice-busy { opacity: 0.6; cursor: progress; }
.btn-voice:disabled { opacity: 0.4; cursor: not-allowed; }
@keyframes voice-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.55); } 50% { box-shadow: 0 0 0 8px rgba(255, 93, 108, 0); } }
.voice-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; margin: 0.3rem 0; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); font-size: 0.82rem; }
.voice-banner-recording { border-color: var(--err); }
.voice-banner-review { border-color: var(--warn, #f5b342); }
.voice-banner-error { border-color: var(--err); }
.voice-banner-text { flex: 1; min-width: 12rem; }
.voice-live { flex-basis: 100%; font-style: italic; }
.voice-banner-actions { display: flex; gap: 0.3rem; }

/* helpdesk flottant (🆘) — bouton discret + bulle intelligente (jamais pendant une génération) */
.helpdesk-fab {
  position: fixed; left: 14px; bottom: 14px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--fg); font-size: 1.15rem; line-height: 1;
  box-shadow: 0 6px 20px var(--shadow-soft); cursor: pointer; opacity: 0.82; transition: opacity 0.15s, transform 0.15s;
}
.helpdesk-fab:hover, .helpdesk-fab:focus-visible { opacity: 1; transform: translateY(-1px); outline: 2px solid var(--magenta); outline-offset: 2px; }
.helpdesk-bubble {
  position: fixed; left: 14px; bottom: 68px; z-index: 61; width: min(340px, calc(100vw - 28px));
  background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--magenta);
  border-radius: 12px; padding: 0.7rem 0.8rem; box-shadow: 0 10px 30px var(--shadow-soft); font-size: 0.86rem;
  animation: helpdesk-in 0.18s ease-out;
}
@keyframes helpdesk-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.helpdesk-bubble-warning { border-left-color: var(--warn, #f5b342); }
.helpdesk-bubble-sos { border-left-color: var(--err); }
.helpdesk-bubble-info { border-left-color: var(--fg-dim); }
.helpdesk-bubble-head { display: flex; align-items: center; gap: 0.45rem; }
.helpdesk-bubble-head b { flex: 1; }
.helpdesk-glyph { color: var(--fg-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.helpdesk-x { background: none; border: 0; color: var(--fg-dim); cursor: pointer; font-size: 0.9rem; }
.helpdesk-bubble-text { margin: 0.35rem 0 0.55rem; color: var(--fg-dim); }
.helpdesk-bubble-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.helpdesk-never { margin-left: auto; opacity: 0.7; }
.helpdesk-menu { display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.88rem; }
.helpdesk-menu-list { display: flex; flex-direction: column; gap: 0.3rem; }
.helpdesk-item {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.5rem; align-items: start; text-align: left;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.7rem; color: var(--fg); cursor: pointer;
}
.helpdesk-item:hover, .helpdesk-item:focus-visible { border-color: var(--magenta); }
.helpdesk-item-text { display: flex; flex-direction: column; gap: 0.15rem; }
.helpdesk-item-text .muted { font-size: 0.8rem; }
.helpdesk-foot { font-size: 0.78rem; }
.helpdesk-form .helpdesk-check { flex-direction: row; align-items: flex-start; gap: 0.5rem; }
/* assistant d'usage — extraits de la documentation embarquée (jamais de synthèse) */
.helpdesk-ask-form { display: flex; gap: 0.4rem; align-items: center; }
.helpdesk-ask-form .input { flex: 1; min-width: 0; }
.helpdesk-ask-results { display: flex; flex-direction: column; gap: 0.4rem; max-height: min(60vh, 520px); overflow: auto; }
.helpdesk-ask-uncovered { margin: 0; padding: 0.5rem 0.7rem; border: 1px solid var(--yellow, #d4a72c); border-radius: 10px; color: var(--fg); background: var(--code-bg); font-size: 0.86rem; }
.helpdesk-ask-hit { border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg); padding: 0.35rem 0.7rem; }
.helpdesk-ask-hit > summary { cursor: pointer; font-size: 0.86rem; }
.helpdesk-ask-hit > summary .muted { font-size: 0.78rem; }
.helpdesk-excerpt { font-size: 0.84rem; line-height: 1.45; margin: 0.4rem 0 0.2rem; color: var(--fg); }
.helpdesk-excerpt p { margin: 0.25rem 0; }
.helpdesk-excerpt ul, .helpdesk-excerpt ol { margin: 0.25rem 0 0.35rem; padding-left: 1.2rem; }
.helpdesk-excerpt li { margin: 0.12rem 0; }
.helpdesk-excerpt code { font-family: var(--mono, ui-monospace, monospace); font-size: 0.8rem; padding: 0 0.25rem; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }
.helpdesk-excerpt-table { border-collapse: collapse; margin: 0.3rem 0; font-size: 0.8rem; width: 100%; }
.helpdesk-excerpt-table td { border: 1px solid var(--border); padding: 0.2rem 0.4rem; vertical-align: top; }
.helpdesk-excerpt-table tr:first-child td { font-weight: 600; background: var(--bg); }
/* mes tickets — liste + fil (helpdesk dmagh, sous le compte dmagh.ai) */
.helpdesk-ticket-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: min(60vh, 520px); overflow: auto; }
.helpdesk-ticket-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.6rem; align-items: start; text-align: left; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.7rem; color: var(--fg); cursor: pointer; font: inherit; }
.helpdesk-ticket-row:hover, .helpdesk-ticket-row:focus-visible { border-color: var(--magenta); }
.helpdesk-ticket-stage { font-size: 0.74rem; padding: 0.15rem 0.45rem; border-radius: 999px; border: 1px solid var(--yellow, #d4a72c); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.helpdesk-ticket-stage.is-assigned { border-color: var(--green, #3fb950); }
.helpdesk-ticket-stage.is-closed { border-color: var(--border); color: var(--fg-dim); }
.helpdesk-ticket-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.helpdesk-ticket-main b { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }
.helpdesk-ticket-main .muted { font-size: 0.76rem; }
.helpdesk-thread-desc { white-space: pre-wrap; font-size: 0.84rem; color: var(--fg-dim); margin: 0; max-height: 7rem; overflow: auto; }
.helpdesk-thread-feed { display: flex; flex-direction: column; gap: 0.4rem; max-height: min(45vh, 380px); overflow: auto; padding: 0.2rem 0; }
.helpdesk-msg { border-radius: 10px; padding: 0.45rem 0.7rem; max-width: 92%; border: 1px solid var(--border); background: var(--code-bg); }
.helpdesk-msg.is-mine { align-self: flex-end; border-color: var(--magenta); }
.helpdesk-msg.is-support { align-self: flex-start; border-color: var(--green, #3fb950); }
.helpdesk-msg-head { font-size: 0.74rem; color: var(--fg-dim); margin-bottom: 0.2rem; }
.helpdesk-msg-body { white-space: pre-wrap; font-size: 0.86rem; line-height: 1.45; }
.helpdesk-reply-form { display: flex; flex-direction: column; gap: 0.4rem; }
.helpdesk-reply-form .input { width: 100%; box-sizing: border-box; }
.helpdesk-reply-form .btn { align-self: flex-end; }
.helpdesk-mail-setup .modal-field { display: flex; flex-direction: column; gap: 0.25rem; }
.helpdesk-mail-adv > summary { cursor: pointer; font-size: 0.82rem; }
.helpdesk-mail-adv .modal-stack { margin-top: 0.4rem; }
/* Écran étroit (téléphone, app mobile) : le composeur occupe tout le bas. En bas à gauche, la bulle recouvrait le
   bouton du modèle et captait le tap (sélecteur de modèles « introuvable » dans l'app) → ancrée en haut, sous la barre. */
@media (max-width: 900px) {
  body .helpdesk-bubble { left: 10px; right: 10px; width: auto; bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 58px); }
  /* 🆘 : en bas à gauche il chevauchait la puce du modèle → à droite, juste AU-DESSUS du composeur (hauteur réelle
     suivie en JS : --composer-h, le composeur grandit avec le texte) */
  body .helpdesk-fab { left: auto; right: 12px; bottom: calc(var(--composer-h, 240px) + 10px); width: 38px; height: 38px; font-size: 1rem; }
}

/* /capabilities — manifeste réel, icônes (i)(!)(?)(🆘) */
.capabilities { display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.86rem; }
.capabilities-head { display: flex; flex-direction: column; gap: 0.2rem; }
.capabilities h4 { margin: 0.4rem 0 0; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-dim); }
.capabilities-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.capabilities-list .cap { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.5rem; align-items: start; line-height: 1.35; }
.capabilities-list .cap-glyph { font-variant-numeric: tabular-nums; color: var(--fg-dim); }
.capabilities-list .cap-icon-warning .cap-glyph { color: var(--warn, #f5b342); }
.capabilities-list .cap-icon-sos .cap-glyph { color: var(--err); }
.capabilities-list .cap-icon-help .cap-glyph { color: var(--magenta); }
.capabilities-list .cap-state { font-weight: 600; }
.capabilities-list .cap-state-on { color: var(--ok, #4ad991); }
.capabilities-list .cap-state-off { color: var(--fg-dim); }
.capabilities-list .cap-state-negotiate { color: var(--warn, #f5b342); }
.capabilities-list .cap-state-unavailable { color: var(--fg-dim); font-style: italic; }
.capabilities-list .cap-feature { color: var(--warn, #f5b342); }

/* raccourcis */
.shortcuts { display: flex; flex-direction: column; gap: 0.35rem; }
.shortcuts-row { display: grid; grid-template-columns: 7.5rem 1fr; align-items: center; gap: 0.7rem; font-size: 0.84rem; color: var(--fg-dim); padding: 0.25rem 0; }
.shortcuts-row .kbd { justify-self: start; font-size: 0.7rem; }

/* ---------- palette de commandes ---------- */
#modal-root dialog.palette { width: min(640px, calc(100vw - 2rem)); margin-top: 9vh; max-height: min(70vh, 640px); }
.palette-input-wrap { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.palette-input { flex: 1; background: transparent; border: none; color: var(--fg); font-size: 1rem; outline: none; font-family: var(--font-body); }
.palette-input::placeholder { color: var(--fg-mute); }
.palette-kbd { font-family: var(--font-mono); font-size: 0.6rem; color: var(--fg-mute); border: 1px solid var(--line); border-radius: 5px; padding: 0.15rem 0.35rem; }
/* flex-basis AUTO (pas `flex: 1` = base 0 %) : dans un <dialog> à hauteur automatique, WebKit (Safari, WKWebView de
   l'app iOS) réduisait une base 0 % à une liste de hauteur nulle → palette réduite au champ de filtre, aucun modèle
   visible (Chromium l'étirait). Base auto = hauteur du contenu, plafonnée par le max-height du dialogue, puis défilement. */
.palette-list { overflow: auto; padding: 0.4rem; min-height: 0; flex: 1 1 auto; }
.palette-group { font-family: var(--font-ui); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-mute); padding: 0.55rem 0.7rem 0.25rem; }
.palette-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.7rem; border-radius: 10px; cursor: pointer; color: var(--fg-dim); }
.palette-item.selected { background: linear-gradient(120deg, rgba(107, 43, 217, 0.35), rgba(192, 38, 211, 0.25)); color: var(--fg); }
.palette-item.current .palette-label { color: var(--gold-soft); }
.palette-icon { width: 1.3rem; text-align: center; color: var(--magenta-soft); font-family: var(--font-mono); flex: none; }
.palette-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.05rem; }
.palette-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { font-size: 0.72rem; color: var(--fg-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-current { font-family: var(--font-ui); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-soft); border: 1px solid rgba(251, 191, 36, 0.4); border-radius: 999px; padding: 0.1rem 0.45rem; }
.palette-empty { padding: 1rem 1rem 0.6rem; text-align: center; color: var(--fg-mute); }
.palette-empty-hint { font-size: 0.72rem; margin: 0.35rem 0 0.6rem; opacity: 0.85; }
.palette-empty .palette-item.palette-suggest { text-align: left; opacity: 0.92; }
.palette-foot { display: flex; gap: 1rem; padding: 0.5rem 1rem; border-top: 1px solid var(--line); font-size: 0.68rem; color: var(--fg-mute); }

/* ---------- menu contextuel ---------- */
.menu {
  position: fixed; z-index: 120; min-width: 13rem; padding: 0.3rem;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 18px 50px var(--shadow-strong); opacity: 0; transform: translateY(-4px) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.menu.open { opacity: 1; transform: none; }
.menu-item { display: flex; align-items: center; gap: 0.55rem; width: 100%; background: none; border: none; text-align: left; color: var(--fg-dim); font-size: 0.86rem; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-3); color: var(--fg); outline: none; }
.menu-item.danger { color: var(--rose); }
.menu-item.danger:hover { background: rgba(225, 29, 72, 0.15); color: #fecdd3; }
.menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.menu-icon { width: 1.1rem; text-align: center; font-family: var(--font-mono); color: var(--magenta-soft); }
.menu-item.danger .menu-icon { color: var(--rose); }
.menu-label { flex: 1; }
.menu-hint { font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-mute); }
.menu-sep { height: 1px; background: var(--line); margin: 0.25rem 0.4rem; }

/* ---------- pad agrandi ---------- */
.pad.expanded { width: min(92vw, 1100px); }

/* ---------- mobile : feuilles en bas, palette plein écran ---------- */
@media (max-width: 900px) {
  .btn-palette { min-width: 0; padding: 0.3rem 0.55rem; }
  .btn-palette-text, #kbd-palette, .btn-doc { display: none; }
  .topbar { gap: 0.5rem; }
  #modal-root dialog.modal {
    width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0 0;
    border-radius: 18px 18px 0 0; border-bottom: none; transform: translateY(18px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #modal-root dialog.modal.open { transform: none; }
  #modal-root dialog.modal.closing { transform: translateY(18px); }
  #modal-root dialog.palette { margin: 0; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; justify-content: center; }
  .shortcuts-row { grid-template-columns: 6rem 1fr; }
  .diag-item { grid-template-columns: 1fr; gap: 0.1rem; }
  .pad.expanded { width: 100vw; }
}
.skeleton-sessions { padding: 0.4rem 0.5rem; }
.skeleton-sessions .skeleton-line { height: 1.1rem; border-radius: 8px; }
.settings-row-stack { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

/* ---------- mobile : palette ancrée en haut (clavier en bas), topbar dégagée, onglets défilants ---------- */
@media (max-width: 900px) {
  #modal-root dialog.palette { margin: 0 auto auto; max-height: 80vh; border-radius: 0 0 18px 18px; border-top: none; transform: translateY(-12px); }
  #modal-root dialog.palette.open { transform: none; }
  #modal-root dialog.palette.closing { transform: translateY(-12px); }
}
@media (max-width: 640px) {
  .brand-tag, #auth-badge { display: none; }
  .brand-word { font-size: 1rem; }
  .topbar { padding: 0.45rem 0.6rem; gap: 0.35rem; }
  .topbar-actions { gap: 0.3rem; margin-left: auto; }
  .topbar-center { display: none; }
  .tabs-row { padding-inline: 0.5rem; gap: 0.2rem; }
  .tabs { scroll-padding-inline: 0.5rem; }
  .tab { padding: 0.5rem 0.7rem; font-weight: 600; }
  .session-actions { max-width: 42%; overflow-x: auto; }
  #btn-compact, #btn-rename { display: none; } /* disponibles via la palette ⌘K et le menu ⋯ */
  .composer { padding: 0.5rem 0.6rem 0.6rem; }
  .composer-left .chip-btn { max-width: 12ch; flex: none; }
  /* barre du composeur : les puces (modèle d'abord) défilent dans la place restante, « Envoyer » reste TOUJOURS
     visible (sans ça la barre débordait : Envoyer hors écran sur 320 px, puces rognées sur 393 px) */
  .composer-bar { gap: 0.4rem; }
  .composer-left { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .composer-left::-webkit-scrollbar { display: none; }
  .composer-right { flex: none; }
  .messages { padding: 0.8rem 0.7rem 0.4rem; }
  .msg-actions { flex-wrap: wrap; }
  .statusbar { overflow-x: auto; scrollbar-width: none; }
}

/* ---------- accueil (aucune session) : actions rapides + astuces ---------- */
.welcome-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1rem; }
/* « Reprendre ou commencer » : sessions récentes du dossier (plus d'ouverture ni de création automatique) */
.resume-list { display: flex; flex-direction: column; gap: 0.35rem; margin: 1rem auto 0; width: min(100%, 34rem); text-align: left; }
.resume-item { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.6rem 0.8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2, transparent); color: var(--fg); cursor: pointer; font: inherit; text-align: left; min-height: 44px; }
.resume-item:hover, .resume-item:focus-visible { border-color: var(--magenta-soft); outline: none; }
.resume-item.last { border-color: rgba(192, 38, 211, 0.45); }
.resume-icon { flex: none; color: var(--magenta-soft); font-size: 1.05rem; }
.resume-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.resume-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.resume-meta { font-size: 0.72rem; color: var(--fg-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.welcome-clean { margin-top: 0.8rem; opacity: 0.8; }
.session-empty-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding: 0.5rem 0.7rem; font-size: 0.72rem; color: var(--fg-mute); border-top: 1px dashed var(--line); margin-top: 0.4rem; }
.session-empty-row span { flex: 1; min-width: 10ch; }
.welcome-actions .btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.welcome-tips { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; margin-top: 1.4rem; text-align: left; font-size: 0.78rem; color: var(--fg-mute); }
.welcome-tip { display: flex; align-items: center; gap: 0.5rem; }
.welcome-tip .kbd { flex: none; min-width: 1.6rem; text-align: center; }
@media (max-width: 640px) { .welcome-tips { grid-template-columns: 1fr; } }

/* ---------- permission : entrée animée (le run est bloqué, il faut répondre) ---------- */
.permission-bar.pulse { animation: permission-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes permission-in {
  0% { transform: translateY(8px); opacity: 0; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
  60% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.12); }
  100% { transform: none; opacity: 1; box-shadow: none; }
}

/* ---------- clavier développeur (tactile / app mobile) ---------- */
.devkeys {
  display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; padding: 0 0 0.5rem;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.devkeys::-webkit-scrollbar { display: none; }
.devkey {
  flex: none; min-width: 2.6rem; height: 2.3rem; padding: 0 0.6rem; scroll-snap-align: start;
  font-family: var(--font-mono); font-size: 0.86rem; color: var(--fg);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 9px;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.devkey:active, .devkey.pressed { transform: translateY(1px); border-bottom-width: 1px; background: var(--panel-3); }
/* la barre défile au doigt (pan-x) : un glissement ne frappe aucune touche */
.devkeys { touch-action: pan-x; }
.devkey { touch-action: pan-x; }
@media (pointer: coarse) { .devkey { min-width: 2.9rem; height: 2.75rem; font-size: 0.95rem; } }
.devkey-action { color: var(--magenta-soft); border-color: rgba(232, 121, 249, 0.4); }
@media (hover: hover) and (pointer: fine) { .devkey:hover { border-color: var(--magenta); } }

/* ---------- VS Code : onglet responsive mobile / iPad ---------- */
.pg-col, .vs-instance { min-width: 0; }
.vs-instance-name { overflow-wrap: anywhere; min-width: 0; }
/* champs du formulaire pleine largeur (les libellés d'options sont longs : plus de troncature à 24ch) */
.pg-field .select, .pg-field .input { max-width: 100%; width: 100%; }
.vs-result code, .vs-result .vs-url, .vs-url { overflow-wrap: anywhere; white-space: normal; max-width: 100%; }
/* iPad paysage : deux colonnes plus serrées */
@media (min-width: 901px) and (max-width: 1180px) {
  .playground { gap: 1rem; padding: 1rem; }
}
/* iPad portrait / téléphone : une colonne, instances d'abord (le formulaire est long), actions ≥ 44 px */
@media (max-width: 900px) {
  #tab-vscode .pg-col:nth-child(2) { order: -1; }
  #tab-vscode .pg-col + .pg-col { padding-top: 0.6rem; border-top: 1px solid var(--line); }
  #btn-vs-provision { width: 100%; min-height: 44px; font-size: 0.9rem; }
  .vs-list-head .btn { min-height: 40px; }
  .vs-instance-actions .btn { min-height: 40px; flex: 1 1 auto; }
}
@media (max-width: 640px) {
  .playground { padding: 0.8rem 0.7rem; gap: 0.9rem; }
  .vs-instance-top { flex-wrap: wrap; }
  .vs-instance-meta { white-space: normal; overflow-wrap: anywhere; }
}
@media (pointer: coarse) {
  .pg-field .select, .pg-field .input { min-height: 44px; font-size: 0.9rem; }
  .pg-check input { width: 22px; height: 22px; }
}

/* ---------- Hub · gestion native (TUI parity) ---------- */
.hub-wrap {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: minmax(11rem, 14rem) 1fr;
  gap: 0;
}
.hub-nav {
  border-right: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.hub-nav-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 0.9rem 0.35rem; border-bottom: 1px solid var(--line);
}
.hub-nav-head h2 { margin: 0; font-size: 0.95rem; font-weight: 650; }
.hub-nav-hint {
  margin: 0; padding: 0.35rem 0.9rem 0.55rem;
  font-size: 0.72rem; color: var(--muted); line-height: 1.35;
}
.hub-nav-list {
  flex: 1; overflow-y: auto; padding: 0.35rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.hub-nav-item {
  text-align: left; border: 0; background: transparent; color: var(--fg);
  padding: 0.55rem 0.65rem; border-radius: 8px; cursor: pointer;
  font-size: 0.82rem; display: flex; flex-direction: column; gap: 0.15rem;
}
.hub-nav-item:hover, .hub-nav-item:focus-visible { background: var(--panel-2); outline: none; }
.hub-nav-item.active { background: rgba(107, 43, 217, 0.22); box-shadow: inset 0 0 0 1px rgba(192, 38, 211, 0.35); }
.hub-nav-item .hub-nav-title { font-weight: 600; }
.hub-nav-item .hub-nav-slash { font-size: 0.7rem; color: var(--muted); font-family: var(--font-mono); }
.hub-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.hub-main-head {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
}
.hub-main-head h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.hub-panel-body {
  flex: 1; overflow-y: auto; padding: 0.9rem 1rem 1.4rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.hub-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.45rem;
}
.hub-card-row {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
}
.hub-card-title { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hub-card-meta { font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); }
.hub-pre {
  margin: 0; padding: 0.75rem; border-radius: 10px; background: var(--code-bg);
  border: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.74rem;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow-y: auto;
  line-height: 1.45; color: var(--fg);
}
.hub-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.hub-empty { color: var(--muted); font-size: 0.88rem; padding: 1rem 0.2rem; }
.hub-badge-on { color: #34d399; font-weight: 650; font-size: 0.75rem; }
.hub-badge-off { color: var(--muted); font-weight: 650; font-size: 0.75rem; }
.hub-note {
  margin: 0 0 0.75rem; padding: 0.55rem 0.7rem; font-size: 0.78rem; line-height: 1.4;
  color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.hub-note code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-dim); }
/* Board lié à un MCP absent / non connecté : alerte visible, jamais silencieuse */
.hub-card-warn { border-color: rgba(251, 191, 36, 0.55); background: linear-gradient(180deg, rgba(251, 191, 36, 0.08), transparent 70%); }
.hub-card-warn .hub-card-title { color: var(--gold-soft); }
.hub-card-warn .hub-note { margin: 0.4rem 0 0.5rem; }
.hub-code { margin: 0 0 0.55rem; padding: 0.5rem 0.65rem; font-family: var(--font-mono); font-size: 0.74rem; line-height: 1.35; color: var(--fg); border: 1px solid var(--line); border-radius: 8px; background: var(--shadow-soft); overflow-x: auto; user-select: all; -webkit-user-select: all; }
.chip-ok { color: #34d399; border-color: rgba(52, 211, 153, 0.45); }

/* --- Board : synchro plateforme (chips d'état) + actions inline sur les cartes --- */
.board-card { position: relative; padding-right: 0.5rem; }
.bc-sync { display: inline-flex; margin-left: 0.35rem; font-size: 0.66rem; padding: 0.05rem 0.4rem; vertical-align: middle; }
.bc-sync[data-sync="ok"], .bc-sync[data-sync="echo"] { color: #34d399; border-color: rgba(52, 211, 153, 0.45); }
.bc-sync[data-sync="inbound"] { color: var(--violet-soft); border-color: rgba(167, 139, 250, 0.45); }
.bc-sync[data-sync="pending"], .bc-sync[data-sync="pending_agent"] { color: var(--fg-mute); border-style: dashed; }
.bc-sync[data-sync="failed"] { color: #fca5a5; border-color: rgba(252, 165, 165, 0.55); }
.bc-sync[data-sync="skipped"], .bc-sync[data-sync="none"] { color: var(--fg-mute); }
.bc-sync-retry { cursor: pointer; }
.bc-sync-retry:hover { border-color: var(--magenta); color: var(--fg); }
.bc-actions { display: inline-flex; gap: 0.15rem; margin-left: auto; align-items: center; opacity: 0; transition: opacity 0.12s ease; }
.board-card:hover .bc-actions, .board-card:focus-within .bc-actions, .board-card:focus .bc-actions { opacity: 1; }
@media (hover: none), (pointer: coarse) { .bc-actions { opacity: 1; } }
.bc-act {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.7rem; height: 1.7rem; padding: 0 0.35rem;
  border: 1px solid var(--line); border-radius: 7px; background: var(--highlight); color: var(--fg-dim); font-size: 0.78rem; line-height: 1;
  cursor: pointer; text-decoration: none; transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.bc-act:hover, .bc-act:focus-visible { border-color: var(--magenta); color: var(--fg); background: rgba(192, 38, 211, 0.12); outline: none; }
.bc-act-primary { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.4); }
.bc-act-link { color: var(--violet-soft); }
@media (pointer: coarse) { .bc-act { min-width: 2.1rem; height: 2.1rem; font-size: 0.9rem; } }
/* Activité : sens / transition / acteur / lien */
.bi-dir { min-width: 5.5rem; font-family: var(--font-mono); font-size: 0.68rem; }
.feed.origin-platform { border-left-color: var(--violet-soft); }
.feed[data-mirror="failed"] { border-left-color: #fca5a5; }
.feed[data-mirror="ok"] .bi-dir, .feed[data-mirror="echo"] .bi-dir { color: #34d399; }
.feed[data-mirror="failed"] .bi-dir { color: #fca5a5; }
.feed[data-mirror="pending"] .bi-dir, .feed[data-mirror="pending_agent"] .bi-dir { color: var(--fg-mute); }
.bi-fromto, .bi-actor { margin-right: 0.35rem; font-size: 0.64rem; padding: 0 0.35rem; }
.bi-retry { margin-left: 0.4rem; }
.bi-link { margin-right: 0.35rem; color: var(--violet-soft); text-decoration: none; }
.bi-link:hover { color: var(--fg); }
/* Modale de carte : ligne plateforme */
.card-platform { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.35rem 0 0.6rem; }
.card-lanciio { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.6rem; }
.card-lanciio-select { min-width: 16rem; font-size: 0.78rem; }
.card-lanciio-chip { border-color: var(--magenta); }
.card-remote { text-decoration: none; }
a.card-remote:hover { border-color: var(--magenta); color: var(--fg); }
/* Bandeau de synchro sous le chip loop */
.board-sync-state { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.board-sync-state .chip { font-size: 0.66rem; }
.hub-section-title {
  margin: 1rem 0 0.45rem; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.02em;
  color: var(--fg-dim); text-transform: uppercase;
}
.hub-section-title:first-of-type { margin-top: 0.35rem; }
.hub-feat-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.75rem; }
.hub-feat {
  font-family: var(--font-mono); font-size: 0.68rem; padding: 0.2rem 0.45rem;
  border: 1px solid var(--line); border-radius: 6px; color: var(--fg-dim); background: var(--panel-2);
}
.hub-feat.off { opacity: 0.45; text-decoration: line-through; }
.hub-quota-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.75rem; }
.hub-quota {
  font-size: 0.75rem; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); background: var(--panel-2);
}
.hub-quota b { color: var(--fg-dim); font-weight: 650; margin-right: 0.25rem; }
.hub-log-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.55rem; }
.hub-log-stat {
  font-family: var(--font-mono); font-size: 0.72rem; padding: 0.2rem 0.45rem;
  border-radius: 6px; border: 1px solid var(--line); color: var(--muted);
}
.hub-log-stat.err { color: #f87171; border-color: #7f1d1d; }
.hub-log-stat.warn { color: #fbbf24; border-color: #78350f; }
.hub-log-stat.info { color: #93c5fd; border-color: #1e3a5f; }
.hub-log-stat.dbg { color: var(--muted); }
.hub-log-levels { margin-bottom: 0.45rem; }
.hub-log-levels .hub-btn {
  font-family: var(--font-mono); font-size: 0.72rem; padding: 0.25rem 0.55rem;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.hub-log-levels .hub-btn-active { color: var(--fg); border-color: var(--accent); background: var(--panel-2); }
.hub-log-view {
  margin-top: 0.55rem; padding: 0.55rem 0.65rem; border-radius: 10px; background: var(--code-bg);
  border: 1px solid var(--line); max-height: 28rem; overflow: auto; font-family: var(--font-mono);
  font-size: 0.72rem; line-height: 1.45;
}
.hub-log-line { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-dim); padding: 0.05rem 0; }
.hub-log-line.hub-log-error { color: #fca5a5; }
.hub-log-line.hub-log-warn { color: #fcd34d; }
.hub-log-line.hub-log-info { color: #bfdbfe; }
.hub-log-line.hub-log-debug { color: var(--muted); }
.hub-log-view mark { background: #854d0e; color: #fef3c7; padding: 0 0.1rem; border-radius: 2px; }
@media (max-width: 900px) {
  .hub-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .hub-nav { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .hub-nav-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 0.35rem; padding: 0.45rem; }
  .hub-nav-item { flex: none; min-width: 7.5rem; }
}

/* --- Hub · KB ingest (ingestion visuelle) --- */
.ingest-progress { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.5rem 0; }
.ingest-bar { height: 6px; border-radius: 999px; background: var(--highlight); overflow: hidden; }
.ingest-bar-fill { height: 100%; width: 4%; border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--magenta)); transition: width 0.4s ease; }
.ingest-progress-text { font-size: 0.72rem; color: var(--fg-mute); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ingest-error { border-color: rgba(252, 165, 165, 0.5); color: #fca5a5; }
.ingest-source { padding: 0.5rem 0; border-top: 1px solid var(--line); }
.ingest-source:first-of-type { border-top: 0; }
.ingest-source.off { opacity: 0.6; }
.ingest-source-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.ingest-source-label { font-weight: 600; font-size: 0.86rem; }
.ingest-source-meta { margin: 0.2rem 0 0.35rem; font-size: 0.74rem; color: var(--fg-mute); word-break: break-all; }
.ingest-form .settings-row-stack .input { width: 100%; }
.ingest-mcp-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ingest-mcp-row select { flex: 1; min-width: 12rem; }
.ingest-env { display: flex; flex-direction: column; gap: 0.4rem; }
.ingest-hit .bi-id { font-family: var(--font-mono); min-width: 3rem; color: var(--gold-soft); }
.ingest-hit b { color: var(--fg); font-weight: 600; margin-right: 0.35rem; }

/* ---------- mémoire collaborative (carte) + intégrations ---------- */
.card-memory { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.card-memory-list .feed.kind-memory .bi-text { white-space: normal; }
.feed.kind-memory .bi-dir { color: var(--gold-soft, #fbbf24); }
.feed.kind-hold .bi-dir { color: #f87171; }
.feed.memory-decision .bi-dir { color: #34d399; }
.feed.memory-constraint .bi-dir { color: #60a5fa; }
.card-memory-actions { gap: 0.35rem; flex-wrap: wrap; margin-top: 0.35rem; }
.card-hold.btn-primary { animation: none; }
.int-usecases { font-size: 0.72rem; color: var(--fg-mute); }
[data-license="negotiate"] { border-color: rgba(251, 191, 36, 0.55); }

/* ---------- Cowork : poste de travail agentique (grille fixe, halos sans mouvement) ---------- */
.cowork { flex: 1; min-height: 0; overflow: hidden; display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.3fr) minmax(240px, 0.9fr); gap: 0.9rem; padding: 0.9rem 1.1rem; }
.cowork-col { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.9rem; }
.cowork-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 0.95rem; box-shadow: 0 0 0 1px transparent, 0 0 22px rgba(107, 43, 217, 0.06); }
.cowork-card-pending.has-pending { border-color: rgba(255, 212, 0, 0.55); animation: cowork-glow 2.4s ease-in-out infinite; }
@keyframes cowork-glow { 0%, 100% { box-shadow: 0 0 0 1px rgba(255, 212, 0, 0.18), 0 0 14px rgba(255, 212, 0, 0.16); } 50% { box-shadow: 0 0 0 1px rgba(255, 212, 0, 0.45), 0 0 30px rgba(255, 212, 0, 0.36); } }
.cowork-title { margin: 0 0 0.45rem; font-family: var(--font-ui); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cowork-hint { margin: 0 0 0.6rem; font-size: 0.78rem; color: var(--fg-mute); }
.cowork-empty { font-size: 0.8rem; color: var(--fg-mute); padding: 0.3rem 0; }
.cowork-list { display: flex; flex-direction: column; gap: 0.35rem; }
.cowork-missions { display: grid; grid-template-columns: 1fr; gap: 0.4rem; }
.cowork-mission { display: flex; align-items: flex-start; gap: 0.6rem; text-align: left; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--fg); cursor: pointer; font: inherit; }
.cowork-mission:hover, .cowork-mission:focus-visible { border-color: var(--line-strong); box-shadow: 0 0 18px var(--brand-glow); outline: none; }
.cowork-mission-glyph { flex: none; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 8px; background: var(--grad-brand); color: var(--on-brand); font-size: 0.85rem; box-shadow: 0 0 12px var(--brand-glow); }
.cowork-mission-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.cowork-mission-name { font-weight: 650; font-size: 0.86rem; }
.cowork-mission-desc { font-size: 0.74rem; color: var(--fg-mute); }
.cowork-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); font-size: 0.82rem; }
.cowork-row .cowork-glyph { flex: none; width: 1.2rem; text-align: center; color: var(--violet-soft); }
.cowork-row .cowork-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cowork-row .cowork-meta { flex: none; font-family: var(--font-mono); font-size: 0.7rem; color: var(--fg-mute); }
.cowork-row.completed .cowork-text { text-decoration: line-through; color: var(--fg-mute); }
.cowork-row.in_progress, .cowork-row.running { border-color: rgba(192, 38, 211, 0.45); box-shadow: 0 0 14px var(--brand-glow); }
.cowork-row.error { border-color: rgba(248, 113, 113, 0.5); }
.cowork-row.pending-item { border-color: rgba(255, 212, 0, 0.4); background: rgba(255, 212, 0, 0.05); }
.cowork-row .btn { padding: 0.15rem 0.5rem; font-size: 0.74rem; }
.cowork-screen { min-height: 120px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--panel-deep); overflow: hidden; }
.cowork-screen iframe { width: 100%; height: 190px; border: 0; display: block; background: var(--panel-deep); pointer-events: none; }
.cowork-screen.has-screen { border-style: solid; box-shadow: 0 0 22px var(--brand-glow); }
.cowork-actions { display: flex; gap: 0.4rem; margin-top: 0.55rem; }
.cowork-caps { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; }
.cowork-cap { display: flex; gap: 0.5rem; align-items: baseline; }
.cowork-cap .cowork-cap-state { flex: none; font-family: var(--font-mono); font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 999px; border: 1px solid var(--line); color: var(--fg-dim); }
.cowork-cap .cowork-cap-state.on { color: var(--ok); border-color: rgba(62, 207, 142, 0.4); }
.cowork-cap .cowork-cap-state.off { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.4); }
.cowork-missing { font-size: 0.76rem; color: var(--fg-mute); margin-top: 0.3rem; }
.tab-cowork { position: relative; }
.tab-cowork.has-pending::after { content: ""; position: absolute; top: 0.35rem; right: 0.2rem; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
@media (max-width: 1100px) { .cowork { grid-template-columns: 1fr 1fr; } .cowork-center { grid-column: 1 / -1; order: -1; } }
@media (max-width: 700px) { .cowork { grid-template-columns: 1fr; overflow-y: auto; } .cowork-col { overflow: visible; } }
@media (prefers-reduced-motion: reduce) { .cowork-card-pending.has-pending { animation: none; box-shadow: 0 0 0 1px rgba(255, 212, 0, 0.45); } }

/* ---------- question (outil `question`) : modale bidirectionnelle ---------- */
.question-form { display: flex; flex-direction: column; gap: 0.9rem; }
.question-block { margin: 0; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); min-width: 0; }
.question-legend { padding: 0 0.35rem; }
.question-header { font-family: var(--font-ui); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-soft); }
.question-text { margin: 0.2rem 0 0.6rem; font-size: 0.92rem; }
.question-options { display: flex; flex-direction: column; gap: 0.35rem; }
.question-option { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.question-option:has(input:checked) { border-color: rgba(192, 38, 211, 0.55); box-shadow: 0 0 16px var(--brand-glow); }
.question-option input { margin-top: 0.2rem; accent-color: var(--magenta); }
.question-option-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.question-option-text small { color: var(--fg-mute); font-size: 0.76rem; }
.question-custom { margin-top: 0.5rem; width: 100%; }

/* ---------- Hub · Tunnel manager ---------- */
.tunnel-form { display: flex; flex-direction: column; gap: 0.6rem; }
.tunnel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.55rem 0.8rem; }
.tunnel-grid .pg-field { margin: 0; }
.tunnel-grid .pg-field small { display: block; margin-top: 0.15rem; }
.tunnel-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.4rem; }
.tunnel-row { border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.7rem; background: var(--panel-2); display: flex; flex-direction: column; gap: 0.3rem; }
.tunnel-row.disabled { opacity: 0.6; }
.tunnel-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tunnel-dot { color: var(--ok); }
.tunnel-row.disabled .tunnel-dot { color: var(--fg-mute); }
.tunnel-name { font-size: 0.92rem; }
.tunnel-url { font-family: var(--font-mono); font-size: 0.78rem; color: var(--violet-soft); overflow-wrap: anywhere; text-decoration: none; }
.tunnel-url:hover { text-decoration: underline; text-shadow: 0 0 10px var(--brand-glow); }

/* ---------- approbation (ask · edit · full) + env ---------- */
.chip-approval[data-mode="edit"] { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.45); }
.chip-approval[data-mode="full"] { color: var(--on-brand); background: linear-gradient(120deg, var(--magenta), #e11d48); border-color: transparent; box-shadow: 0 0 12px var(--brand-glow); }
.cowork-approval { display: flex; align-items: center; gap: 0.5rem; margin: -0.2rem 0 0.5rem; }
.cowork-approval .segmented-btn { font-size: 0.72rem; padding: 0.15rem 0.5rem; }
.env-value { font-family: var(--font-mono); font-size: 0.76rem; color: var(--fg-dim); background: var(--code-bg); border-radius: 6px; padding: 0.1rem 0.4rem; overflow-wrap: anywhere; }
.mcp-snippet { display: block; white-space: pre-wrap; margin: 0.35rem 0 0; padding: 0.5rem 0.6rem; max-height: 14rem; overflow: auto; }
.prov-sources { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.prov-src { font-family: var(--font-mono); font-size: 0.68rem; }
.prov-conflict { color: var(--gold-soft); }
.chip-sandbox[data-network="on"] { color: var(--gold-soft); border-color: rgba(251, 191, 36, 0.45); }
.chip-sandbox[data-kind="fleet"] { color: var(--on-brand); background: linear-gradient(120deg, var(--violet, #7c3aed), var(--magenta)); border-color: transparent; }
.sandbox-opt { display: block; width: 100%; text-align: left; white-space: normal; margin: 0.25rem 0; }
.cowork-fleet-head { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.35rem; }
.mcp-summary .input { margin-top: 0.4rem; }
.mcp-badge { font-family: var(--font-mono); font-size: 0.7rem; }
.mcp-actions { margin-left: auto; display: inline-flex; gap: 0.2rem; flex-wrap: wrap; }
.mcp-tools { margin: 0.35rem 0 0 0.25rem; display: grid; gap: 0.2rem; }
.mcp-tool { display: flex; gap: 0.4rem; align-items: baseline; flex-wrap: wrap; }
.mcp-recipes { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.mcp-bind { cursor: pointer; }
.collab-role { max-width: 8rem; padding: 0.15rem 0.4rem; font-size: 0.78rem; }
.collab-matrix { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.collab-matrix th, .collab-matrix td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); text-align: center; }
.collab-matrix td.collab-perm { text-align: left; }
.collab-cell.on { color: var(--ok, #22c55e); font-weight: 600; }

/* lanci.io · explorateur dynamique (catalogue vivant) */
.lanciio-tool-select { max-width: 42ch; margin-left: auto; }
.lanciio-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.5rem 0.9rem; margin-top: 0.5rem; }
.lanciio-form > .hub-card-meta { grid-column: 1 / -1; }
.lanciio-field { display: flex; flex-direction: column; gap: 0.2rem; }
.lanciio-field .input, .lanciio-field .select { width: 100%; max-width: none; }
.lanciio-field input[type="checkbox"] { width: auto; align-self: flex-start; }
.lanciio-result { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem; }
.lanciio-table-wrap { overflow: auto; max-height: 22rem; border: 1px solid var(--line); border-radius: 10px; }
.lanciio-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-family: var(--font-mono); }
.lanciio-table th, .lanciio-table td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; max-width: 28ch; overflow-wrap: anywhere; }
.lanciio-table th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 600; }
.lanciio-row-actions { white-space: nowrap; }
.lanciio-row-actions .btn { margin-right: 0.25rem; }
.lanciio-kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.8rem; align-items: baseline; }
.lanciio-raw summary { cursor: pointer; }
.lanciio-field-chip { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; }
.helpdesk-mail-oauth .modal-field[hidden], .helpdesk-mail-setup label[hidden], .helpdesk-mail-oauth[hidden] { display: none; }
.helpdesk-oauth-code { font-family: var(--mono, ui-monospace, monospace); font-size: 1.6rem; letter-spacing: 0.18em; text-align: center; padding: 0.6rem 0.8rem; border: 1px dashed var(--magenta); border-radius: 10px; background: var(--code-bg); user-select: all; }
.helpdesk-oauth .btn { align-self: flex-start; }
