/* Tableau de bord d'équipe — feuille de styles.
   Organisation : jetons et base -> composants communs -> barre latérale -> écrans ->
   conversation (mise en page à 3 colonnes : conversations | fil | tâches/fichiers) -> modales -> réactif. */

:root {
  --night: #0F1733;
  --navy: #24335D;
  --turq: #3BD9DB;
  --turq-soft: #8FE9EA;
  --ivory: #F6F2EA;
  --sand: #D7D3CB;
  --mute: #A9B0C6;
  --ochre: #C88A1C;
  --ochre-light: #E2A73C;
  --danger: #FF9E8A;
  --ready: #8FD9A8;
  --line: rgba(246,242,234,.10);
  --line-strong: rgba(246,242,234,.18);
  --card: rgba(246,242,234,.035);
  --serif: Fraunces, Georgia, serif;
}
* { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--night); color: var(--ivory);
  font-family: "DM Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; }
a { color: var(--turq); text-decoration: none; cursor: pointer; }
a:hover { color: var(--turq-soft); }
input, textarea, button, select { font-family: inherit; }
button { border-radius: 0; }
[hidden] { display: none !important; }
/* Nœuds ajoutés par une fusion de DOM : seule l'arrivée s'anime, le reste ne bouge pas. */
.is-new { animation: mnFade .2s ease; }
.is-hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: rgba(246,242,234,.14); }

@keyframes mnPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,217,219,.55); } 70% { box-shadow: 0 0 0 6px rgba(59,217,219,0); } }
@keyframes mnPulseRed { 0%,100% { box-shadow: 0 0 0 0 rgba(216,72,58,.6); } 70% { box-shadow: 0 0 0 8px rgba(216,72,58,0); } }
@keyframes mnFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Notification : `translate` (pas `transform`) pour garder le centrage translateX(-50%). */
@keyframes toastIn { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes toastDrop { from { opacity: 0; translate: 0 -6px; } to { opacity: 1; translate: 0 0; } }
@keyframes toastOut { to { opacity: 0; } }
@keyframes dots { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

.shell { display: flex; height: 100vh; background: linear-gradient(160deg, var(--navy) 0%, var(--night) 70%); position: relative; overflow: hidden; }

/* ── Typo & éléments communs ────────────────────────────────────────────── */
.eyebrow { font-size: 11px; letter-spacing: .25em; text-transform: uppercase; font-weight: 700; color: rgba(59,217,219,.85); }
.eyebrow.ochre { color: var(--ochre-light); }
.display { margin: 8px 0 0; font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.05; letter-spacing: -.02em; }
.display.xl { font-size: 40px; }
.display em { font-style: italic; color: var(--turq); }
.muted { color: var(--mute); }
.lead { margin: 10px 0 0; color: var(--mute); font-size: 15px; max-width: 540px; line-height: 1.55; }
.h2 { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; }
.label { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--mute); margin-bottom: 10px; }
.card { padding: 18px; background: var(--card); border: 1px solid var(--line); }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 20px; white-space: nowrap;
  border: 0; font-weight: 700; font-size: 13px; cursor: pointer; transition: opacity .15s ease, background .15s ease, border-color .15s ease, color .15s ease; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--turq); color: var(--navy); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-lg { padding: 13px 22px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--ivory); border: 1px solid rgba(246,242,234,.35); font-weight: 600; }
.btn-ghost:hover:not(:disabled) { border-color: var(--ivory); }
.btn-outline { background: transparent; color: var(--turq); border: 1px solid var(--turq); }
.btn-outline:hover { background: rgba(59,217,219,.12); }
.btn-text { background: transparent; color: var(--mute); font-weight: 600; padding: 11px 14px; }
.btn-text:hover { color: var(--ivory); }
.btn-stop { background: var(--ivory); color: var(--navy); }
.btn-stop:hover { opacity: .88; }
.btn-block { width: 100%; }
.btn-xs { padding: 5px 9px; font-size: 12px; font-weight: 600; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--mute); font-size: 12px; font-weight: 600; padding: 4px 8px; cursor: pointer; }
.icon-btn:hover { color: var(--ivory); border-color: var(--line-strong); }
.head-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; background: transparent; border: 1px solid var(--line-strong); color: var(--sand); font-size: 13px; font-weight: 600; cursor: pointer; }
.head-btn:hover:not(:disabled) { color: var(--ivory); border-color: rgba(246,242,234,.4); }
.head-btn:disabled { opacity: .45; cursor: not-allowed; }
.head-btn.active { color: var(--turq); border-color: var(--turq); }

.avatar { display: grid; place-items: center; font-family: var(--serif); font-style: italic; color: var(--navy); flex: none; position: relative; --av-inset: 0%; }
/* Point d'état (data-state posé par avatar() de util.js) : il se pose SUR le bord de l'avatar, en bas à droite. Son centre est à
   --av-inset du bord droit et du bord bas : 0 sur un carré (le coin) ; 14,645 % sur un cercle, soit (1 − cos 45°) × rayon, le point
   du cercle à 45° (valeur du Nouveau design, qui arrondit les avatars). La taille suit l'avatar ; l'anneau reprend le fond derrière (--av-ring). */
.avatar[data-state]::after { content: ""; position: absolute; right: var(--av-inset); bottom: var(--av-inset); box-sizing: border-box; width: clamp(11px, 24%, 22px); aspect-ratio: 1;
  transform: translate(50%, 50%); border-radius: 50%; border: max(2px, .07em) solid var(--av-ring, var(--night)); background: var(--mute); }
.avatar[data-state="working"]::after { background: var(--turq); }
.avatar[data-state="attention"]::after { background: var(--ochre-light); }
@media (prefers-reduced-motion: no-preference) { .avatar[data-state="working"]::after { animation: mnPulse 1.6s infinite; } }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-ready { background: rgba(143,217,168,.14); color: var(--ready); }
.tone-working { background: rgba(59,217,219,.18); color: var(--turq); }
.tone-working::before { animation: mnPulse 1.6s infinite; }
.tone-attention { background: rgba(200,138,28,.18); color: var(--ochre-light); }
.tone-paused { background: rgba(246,242,234,.10); color: var(--sand); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge { min-width: 22px; height: 20px; padding: 0 6px; background: var(--ochre); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.badge.live { background: rgba(59,217,219,.2); color: var(--turq); }
.badge.soft { background: rgba(59,217,219,.16); color: var(--turq); font-weight: 700; }

.switch { flex: none; width: 44px; height: 24px; border: 0; cursor: pointer; position: relative; background: rgba(246,242,234,.2); transition: background .2s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--ivory); transition: left .2s ease; }
.switch.on { background: var(--turq); }
.switch.on::after { left: 23px; }
.switch:disabled { opacity: .5; cursor: wait; }

.empty { padding: 16px; border: 1px dashed rgba(246,242,234,.2); color: var(--mute); font-size: 13px; }
.empty.big { padding: 48px; text-align: center; }
.empty.big .display { font-style: italic; color: var(--turq); font-size: 26px; }

.spinner { width: 14px; height: 14px; border: 2px solid rgba(59,217,219,.25); border-top-color: var(--turq); border-radius: 50%; animation: spin .8s linear infinite; flex: none; display: inline-block; }
.spinner.sm { width: 11px; height: 11px; }
.progress { height: 4px; background: rgba(246,242,234,.10); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--turq); transition: width .4s ease; }

/* Conversation et salon de groupe : le message remonte au-dessus de la zone de saisie. */
body:has(.main.main-full) .toast, body:has(.room-composer) .toast { bottom: 112px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 12px 20px; background: var(--ivory); color: var(--navy); font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: calc(100vw - 32px); text-align: center; animation: toastIn .2s var(--fx-ease) both; }
.toast.error { background: var(--danger); }
.toast.is-out { animation: toastOut .15s var(--fx-ease) both; }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-out { animation: none; } }
.loading { color: var(--mute); padding: 40px 0; }

/* Icônes au trait (remplacent les emojis) */
.ico { display: inline-block; vertical-align: -0.18em; flex: none; }
.btn .ico, .icon-btn .ico, .head-btn .ico, .quick-btn .ico { vertical-align: -0.2em; }

/* ── Connexion ──────────────────────────────────────────────────────────── */
.login { position: relative; z-index: 2; flex: 1; display: grid; place-items: center; padding: 24px 16px; overflow: auto; }
.login-card { width: 100%; max-width: 400px; padding: 32px; background: rgba(15,23,51,.7); border: 1px solid rgba(59,217,219,.22); display: flex; flex-direction: column; gap: 14px; animation: mnFade .35s ease; }
.login-card .brand { padding: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--sand); }
.login-card input, .modal input, .modal textarea, .modal select {
  padding: 12px 14px; border: 1px solid var(--line-strong); background: rgba(246,242,234,.05); color: var(--ivory); font-size: 15px; outline: none; }
.login-card input:focus, .modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--turq); }
.form-error { color: var(--danger); font-size: 13px; }

/* ── Barre latérale (menu) ──────────────────────────────────────────────── */
.sidebar { position: relative; z-index: 2; width: 248px; flex: none; display: flex; flex-direction: column; padding: 28px 16px 20px; background: rgba(15,23,51,.6); border-right: 1px solid rgba(59,217,219,.14); transition: width .18s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { width: 36px; height: 36px; background: var(--turq); display: grid; place-items: center; color: var(--navy); font-family: var(--serif); font-weight: 600; font-size: 18px; font-style: italic; flex: none; }
/* Marque : X blanc Mare Nostrum, à la place de l'ancien « B », même taille et même emplacement. */
.brand-home:hover { color: inherit; }
.brand-home { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; cursor: pointer; }
.brand-logo { flex: none; width: 36px; height: 36px; display: grid; place-items: center; }
.brand-logo img { display: block; width: 36px; height: 36px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .brand-name { white-space: nowrap; }
.brand-sub { font-size: 10px; letter-spacing: .25em; text-transform: uppercase; font-weight: 700; color: rgba(59,217,219,.8); }
.menu-toggle { display: none; place-items: center; margin-left: auto; background: transparent; border: 1px solid rgba(246,242,234,.25); color: var(--ivory); width: 40px; height: 38px; cursor: pointer; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; white-space: nowrap; border: 0; border-left: 3px solid transparent; cursor: pointer; text-align: left; font-size: 14px; font-weight: 500; color: var(--ivory); background: transparent; transition: background .15s ease, color .15s ease; }
.nav button:hover { background: rgba(246,242,234,.07); }
.nav button.active { background: var(--turq); color: var(--navy); border-left-color: var(--ivory); font-weight: 700; }
.nav .label-text { flex: 1; }
.nav button.active .badge.live { background: var(--navy); }
.health { margin-top: auto; padding: 14px 16px; background: rgba(59,217,219,.07); border: 1px solid rgba(59,217,219,.18); }
.health.bad { background: rgba(200,138,28,.10); border-color: rgba(200,138,28,.35); }
.health-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.health-title .dot { background: var(--turq); animation: mnPulse 2s infinite; }
.health.bad .dot { background: var(--ochre-light); animation: none; }
.health-sub { font-size: 12px; color: var(--mute); margin-top: 4px; line-height: 1.5; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 8px 0; font-size: 13px; color: var(--sand); }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me a { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mute); flex: none; }

.collapse-toggle { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 9px 11px; width: 100%; background: transparent; border: 1px solid rgba(246,242,234,.14); color: var(--mute); font-size: 12px; font-weight: 600; cursor: pointer; flex: none; }
.collapse-toggle:hover { color: var(--ivory); border-color: rgba(59,217,219,.3); }
.collapse-toggle svg { flex: none; transition: transform .18s ease; }
/* Rangée du haut (bouton + marque) : sans effet sur la mise en page d'origine ; le Nouveau design en fait une rangée. */
.nav-top { display: contents; }
.collapse-toggle .ct-face { display: none; }
/* Info-bulle de la barre (js/tooltip.js) : neutre ; le Nouveau design la met en pastille (design-v2.css). */
.tip { position: fixed; left: 0; top: 0; z-index: 100; display: flex; align-items: center; gap: 10px; width: max-content;
  max-width: min(340px, calc(100vw - 16px)); padding: 7px 10px 7px 12px; background: var(--navy); color: var(--ivory);
  border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 13px; font-weight: 600; line-height: 1.3; pointer-events: none; }
.tip[hidden] { display: none; }
.tip-keys { flex: none; padding: 1px 6px; font: inherit; font-size: 12px; color: var(--sand); border: 1px solid rgba(246,242,234,.25); }

/* Barre latérale réduite : icônes seules, tout le texte disparaît. */
.sidebar.collapsed { width: 76px; }
.sidebar.collapsed .brand { justify-content: center; padding: 0 0 26px; }
.sidebar.collapsed .brand-name, .sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav .label-text, .sidebar.collapsed .me span, .sidebar.collapsed .me-logout-text,
.sidebar.collapsed .health-sub, .sidebar.collapsed .collapse-toggle span { display: none; }
.sidebar.collapsed .nav button { justify-content: center; padding: 11px 6px; position: relative; }
/* Menu réduit : l'alerte reste visible sous forme de pastille posée sur l'icône. */
.sidebar.collapsed .nav .badge { position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px;
  padding: 0 4px; font-size: 10px; line-height: 1; border: 1px solid rgba(15,23,51,.85); pointer-events: none; }
/* Menu réduit : la santé du moteur se résume à un point (vert animé ou ocre). */
.sidebar.collapsed .health { margin-top: auto; padding: 12px 0; background: transparent; border: 0;
  display: grid; place-items: center; }
.sidebar.collapsed .health-title { gap: 0; font-size: 0; justify-content: center; }
.sidebar.collapsed .health-title .dot { width: 12px; height: 12px; }
.sidebar.collapsed .me { justify-content: center; padding-top: 14px; }
.sidebar.collapsed .collapse-toggle { justify-content: center; }
.sidebar.collapsed .collapse-toggle svg { transform: rotate(180deg); }
/* Classique, menu réduit : le bouton reste au-dessus de la marque comme avant (l'ordre n'a changé que menu ouvert). */
html:not([data-design="v2"]) .sidebar.collapsed .collapse-toggle { order: -1; }

/* ── Contenu ────────────────────────────────────────────────────────────── */
.main { position: relative; z-index: 1; flex: 1; min-width: 0; padding: 36px 44px 48px; overflow: auto; }
.screen { animation: mnFade .3s ease; }

/* Accueil */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-top: 32px; background: var(--line); border: 1px solid var(--line); }
.stat { padding: 20px 22px; background: rgba(15,23,51,.85); }
.stat-value { font-family: var(--serif); font-size: 36px; font-weight: 500; line-height: 1; }
.stat-label { margin-top: 10px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--mute); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 28px; margin-top: 32px; }
.live-tasks { cursor: pointer; border-color: rgba(59,217,219,.35); background: rgba(59,217,219,.05); }
.live-tasks:hover { border-color: var(--turq); }
.live-tasks .agent-role { display: flex; align-items: center; gap: 6px; }
.live-tasks .agent-role .ico { color: var(--turq); flex: none; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.agent-card { cursor: pointer; transition: border-color .15s ease, background .15s ease; text-align: left; color: inherit; font: inherit; display: flex; flex-direction: column; }
.agent-card:hover { border-color: rgba(59,217,219,.5); background: rgba(246,242,234,.06); }
.agent-card.is-live { border-color: rgba(59,217,219,.45); }
.agent-id { display: flex; align-items: center; gap: 12px; }
.agent-name { font-weight: 700; font-size: 15px; }
.agent-role { font-size: 12px; color: var(--mute); }
.agent-task { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--sand); }
.live-line { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--turq); font-weight: 600; min-width: 0; }
.live-line .ico { color: var(--turq); vertical-align: -0.15em; }
.live-line span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-plan { margin-top: 10px; font-size: 12px; color: var(--mute); }
.live-plan .progress { margin-top: 6px; }
.timeline-row { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline-row .time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--turq); min-width: 62px; font-size: 13px; }

.live-panel { margin-top: 28px; border: 1px solid rgba(59,217,219,.35); background: rgba(59,217,219,.05); }
.live-panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid rgba(59,217,219,.2); }
.live-panel-head .dot { background: var(--turq); animation: mnPulse 1.6s infinite; }
.live-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.live-row:first-of-type { border-top: 0; }
.live-row:hover { background: rgba(246,242,234,.04); }
.live-row .what { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-row .what .ico { color: var(--turq); vertical-align: -0.15em; }
.live-row .what span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row .sub { font-size: 12px; color: var(--mute); margin-top: 3px; }

/* Agents */
.agents-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; }
.agent-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid transparent; border-left: 3px solid transparent; background: transparent; color: var(--ivory); text-align: left; cursor: pointer; transition: background .15s ease; width: 100%; }
.agent-row:hover { background: rgba(246,242,234,.07); }
.agent-row.selected { background: rgba(59,217,219,.10); border-left-color: var(--turq); }
.detail { padding: 32px; }
.detail-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 28px; margin-top: 28px; }
.bullets { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.bullets li { display: flex; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--sand); }
.bullets li::before { content: ""; width: 6px; height: 6px; background: var(--turq); margin-top: 8px; flex: none; }
.big-num { font-family: var(--serif); font-size: 26px; }
/* État d'un agent dans la liste : couleur ET mot, jamais la couleur seule. */
.row-state { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.row-state .dot { background: currentColor; width: 7px; height: 7px; }
.row-state.tone-working .dot { animation: mnPulse 1.6s infinite; }
.history-row { display: flex; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; }
.history-row .when { color: var(--mute); min-width: 86px; font-variant-numeric: tabular-nums; }
.history-row .what { color: var(--sand); }

/* Missions */
.table { margin-top: 28px; overflow: hidden; border: 1px solid var(--line); }
.mission-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, auto) minmax(190px, auto) auto; gap: 28px; align-items: center; padding: 18px 22px; background: rgba(246,242,234,.025); border-top: 1px solid rgba(246,242,234,.08); }
.mission-row:first-child { border-top: 0; }
.mission-row.off .m-name { opacity: .5; }
.m-name { font-weight: 600; font-size: 15px; }
.warn { color: var(--ochre-light); font-size: 12px; margin-top: 2px; }

/* À valider : voir approvals.css */
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Journal */
.day-label { display: flex; align-items: center; gap: 14px; text-align: center; font-size: 11px; letter-spacing: .25em; text-transform: uppercase; font-weight: 700; color: var(--mute); margin-bottom: 14px; }
.day-label::before, .day-label::after { content: ""; flex: 1; height: 1px; background: rgba(246,242,234,.12); }
.log-row { display: grid; grid-template-columns: 56px 28px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid rgba(246,242,234,.08); }
.log-row .time { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.log-row .text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.log-row .text span { color: var(--sand); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: -12px 0 24px; }

/* Réglages */
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 24px; background: rgba(246,242,234,.025); border-top: 1px solid rgba(246,242,234,.08); }
.settings-row:first-child { border-top: 0; }
.settings-row .design-seg { flex-wrap: wrap; max-width: 100%; }
.s-label { font-weight: 600; font-size: 15px; }
.s-help { font-size: 13px; color: var(--mute); margin-top: 3px; line-height: 1.5; }

/* Groupes — liste des salons */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.group-card { min-width: 0; cursor: pointer; padding: 18px; background: var(--card); border: 1px solid var(--line); transition: border-color .15s ease, background .15s ease; text-align: left; color: inherit; font: inherit; display: flex; flex-direction: column; gap: 12px; }
.group-card:hover, .group-card:focus-visible { border-color: rgba(59,217,219,.5); background: rgba(246,242,234,.06); }
.group-card.running { border-color: rgba(59,217,219,.45); background: rgba(59,217,219,.05); }
.group-card.disbanded { opacity: .6; }
.group-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; min-width: 0; }
.group-name .ico { color: var(--turq); flex: none; }
.group-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-state { flex: none; }
.group-card-foot { font-size: 12px; line-height: 1.5; }

/* Rangée de membres (carte de liste et bandeau du salon) : puces avec avatar, @handle, meneur, modèle. */
.group-members { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.group-member { display: inline-flex; align-items: center; flex-wrap: wrap; max-width: 100%; min-width: 0; gap: 4px 6px; padding: 3px 9px 3px 3px; background: rgba(246,242,234,.05); border: 1px solid var(--line-strong); font-size: 12px; color: var(--sand); }
.group-member .avatar { flex: none; }
.gm-handle { font-weight: 600; color: var(--ivory); }
.gm-lead { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ochre-light); padding: 1px 5px; border: 1px solid rgba(200,138,28,.4); }
.gm-model { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .02em; color: var(--turq); padding: 1px 6px; background: rgba(59,217,219,.10); border: 1px solid rgba(59,217,219,.25); }

.gm-paused { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute);
  padding: 1px 5px; border: 1px solid var(--line-strong); }
.group-member.is-paused { opacity: .75; }
.group-member.is-paused .gm-handle { color: var(--sand); }

/* Salon de groupe — écran normal (défilement de page), pas de mise en page plein écran
   comme la conversation : le fil a une hauteur bornée et défile lui-même. */
.room-screen { display: flex; flex-direction: column; gap: 16px; }
.room-head { display: flex; align-items: flex-start; gap: 16px 20px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.room-back { flex: none; align-self: flex-start; }
.room-head-main { flex: 1 1 260px; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.room-title .eyebrow { display: block; }
.room-title .display { margin-top: 4px; font-size: 24px; }
.room-actions { flex: none; }
.room-members { flex: 1 1 100%; }

.room { max-height: 58vh; overflow: auto; min-height: 260px; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; background: rgba(15,23,51,.35); border: 1px solid var(--line); }
.room-round { display: flex; align-items: center; gap: 12px; text-align: center; margin: 10px 0 2px; }
.room-round::before, .room-round::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.room-round span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--mute); }
.room-empty { margin: auto; border: 0; }

/* Message d'un membre : filet de couleur (teinte de l'agent) à gauche, avatar, corps. */
.room-msg { display: flex; gap: 12px; max-width: 640px; }
.room-msg.agent, .room-msg.system { border-left: 3px solid var(--tint, var(--turq)); padding-left: 12px; }
.room-msg.system { border-left-color: var(--danger); }
.room-msg-body { min-width: 0; flex: 1; }
.room-msg-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--mute); margin-bottom: 4px; flex-wrap: wrap; }
.room-msg-head strong { color: var(--ivory); font-weight: 700; font-size: 13.5px; }
.room-handle { color: var(--mute); }
.room-msg-head .when { color: var(--mute); font-size: 11px; }
.room-msg-text { font-size: 14px; line-height: 1.6; color: var(--ivory); white-space: pre-wrap; overflow-wrap: break-word; }
.mention { font-weight: 700; color: var(--tint, var(--turq)); }
.mention-user { font-weight: 700; color: var(--ochre-light); }

/* Le message du user : aligné à droite, bulle turquoise — la limite de largeur est sur
   le conteneur (pas la bulle), même piste que .msg-me pour ne pas couper les mots courts. */
.room-msg.user { justify-content: flex-end; align-self: flex-end; max-width: 78%; }
.room-msg.user .room-msg-body { flex: none; max-width: 100%; display: flex; flex-direction: column; align-items: flex-end; }
.room-msg.user .room-msg-head { justify-content: flex-end; }
.room-msg.user .room-msg-text { background: var(--turq); color: var(--navy); padding: 12px 16px; }
/* Sur fond turquoise, la teinte de l'agent devient illisible : on garde le texte foncé, souligné. */
.room-msg.user .mention, .room-msg.user .mention-user { color: var(--navy); text-decoration: underline; }

/* « (pass) » : une ligne discrète, pas une bulle. */
.room-msg.pass { align-items: center; color: var(--mute); font-style: italic; font-size: 13px; max-width: none; }
.room-msg.pass .avatar { opacity: .7; }

.room-msg.system .room-msg-text, .room-msg.system { color: var(--sand); font-size: 13px; }
.room-msg.system { align-items: center; background: rgba(255,158,138,.08); padding: 10px 14px 10px 12px; max-width: 640px; }
.room-msg.system .ico { color: var(--danger); flex: none; }

/* Message qui interpelle @user : mise en valeur ochre, comme la bannière. */
.room-msg.room-ask { background: rgba(200,138,28,.08); padding: 8px 12px 8px 9px; border-left-color: var(--ochre); }
.room-msg.room-ask .room-msg-head strong { color: var(--ochre-light); }

/* Une ligne d'explication du vocabulaire (tour de parole, passe, meneur) et des membres en pause. */
.room-legend { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; line-height: 1.5; margin-top: -6px; }
.room-legend:empty { display: none; }
.room-legend .ico { color: var(--turq); flex: none; vertical-align: -0.15em; }
.room-legend-paused { display: inline-flex; align-items: center; gap: 6px; color: var(--sand); }
.room-legend-paused .ico { color: var(--sand); }

/* « Revenir en bas » : flotte au-dessus du fil sans prendre de place dans la colonne. */
.room-jump-wrap { position: sticky; bottom: 96px; z-index: 3; height: 0; display: flex; justify-content: center; pointer-events: none; margin: -10px 0 0; }
.room-jump-wrap .btn { pointer-events: auto; transform: translateY(-10px); box-shadow: 0 8px 22px rgba(8,12,28,.5); }

.room-banner:empty { display: none; }
.room-ask-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid rgba(200,138,28,.4); border-left-width: 3px; background: rgba(200,138,28,.10); color: var(--ochre-light); font-size: 13px; font-weight: 700; }
.room-ask-banner .ico { flex: none; color: var(--ochre-light); }

/* Message en cours de réception : pas d'animation d'entrée pour ne pas clignoter au sondage. */
.room-live { animation: none; }
.room-live .room-msg-head .when { color: var(--turq); display: inline-flex; align-items: center; gap: 6px; }

.room-closed { padding: 10px 2px; font-size: 13px; }

/* Composer du salon : mêmes proportions que la zone de saisie de la conversation. */
.room-composer { display: flex; gap: 8px; align-items: flex-end; padding: 6px; background: rgba(246,242,234,.05); border: 1px solid var(--line-strong); }
.room-composer:focus-within { border-color: rgba(59,217,219,.6); }
.room-composer textarea { flex: 1; border: 0; background: transparent; color: var(--ivory); font-size: 15px; outline: none; resize: none; max-height: 200px; padding: 10px 12px; line-height: 1.4; }
.room-composer textarea::placeholder { color: var(--mute); }
.room-composer textarea:disabled { opacity: .5; }
.room-composer .btn { flex: none; }
.room-hint { font-size: 11px; margin-top: -8px; }

/* ══ Conversation ══════════════════════════════════════════════════════════
   Trois colonnes sur grand écran : conversations · fil de discussion · panneau
   Tâches/Fichiers (côté opposé au menu). Le panneau devient un tiroir sur
   petit écran, ouvert par un bouton dans l'en-tête. */
.main.main-full { padding: 0; overflow: hidden; }
.main.main-full > .screen { height: 100%; animation: none; }
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100vh; height: 100dvh; background: rgba(15,23,51,.35); }
.conv-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; padding: 14px 10px; border-right: 1px solid var(--line); }
.conv-search { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); background: rgba(246,242,234,.05); color: var(--ivory); font-size: 13px; outline: none; }
.conv-search:focus { border-color: var(--turq); }
.conv-group { margin: 10px 6px 4px; }
#conv-items { display: flex; flex-direction: column; gap: 2px; }
.conv-item { position: relative; padding: 10px 12px; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--ivory); text-align: left; cursor: pointer; width: 100%; }
.conv-item:hover { background: rgba(246,242,234,.06); }
.conv-item.selected { background: rgba(59,217,219,.10); border-left-color: var(--turq); }
.conv-item .t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
/* Ordre fixe : le titre commence toujours à gauche ; les icônes (épingle, cercle) viennent APRÈS, à droite, et ne rétrécissent jamais. */
.conv-item .t .ico { color: var(--turq); }
.conv-item .tt { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.conv-pin { display: inline-flex; flex: none; color: var(--turq); }
/* Conversation qui travaille : un petit cercle discret à la fin de la ligne du titre, qui ne rétrécit jamais (le bleu vif reste celui de l'avatar).
   Mouvement réduit : il ne tourne plus, l'anneau et son arc restent visibles. Sur grand écran, les outils (épingler…) prennent sa place au survol. */
.conv-spin { flex: none; width: 15px; height: 15px; border: 2px solid var(--line-strong); border-top-color: var(--mute); border-radius: 50%; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .conv-spin { animation: none; } }
/* Au survol sur grand écran, les outils prennent la place : l'épingle et le cercle s'effacent, et le titre s'arrête avant les outils. */
@media (min-width: 1101px) {
  .conv-item:has(.conv-tools):hover .conv-pin, .conv-item:has(.conv-tools):focus-within .conv-pin,
  .conv-item:has(.conv-tools):hover .conv-spin, .conv-item:has(.conv-tools):focus-within .conv-spin { display: none; }
  .conv-item:has(.conv-tools):hover .t, .conv-item:has(.conv-tools):focus-within .t { padding-right: 92px; }
}
.conv-item .s { font-size: 11px; color: var(--mute); margin-top: 2px; }
.conv-tools { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: #1A2750; }
.conv-item:hover .conv-tools, .conv-item:focus-within .conv-tools { display: flex; }
.conv-tools .icon-btn { padding: 3px 6px; }
/* Conversations privées par défaut : ligne d'état, partage, message d'une conversation illisible (couleurs existantes seulement). */
.conv-item .s .conv-shared { display: inline-flex; align-items: center; gap: 4px; color: var(--turq); }
.conv-item .s .conv-shared .ico { vertical-align: -0.1em; }
.chat-head #chat-sub.conv-state { cursor: default; }
.chat-head .share-btn[hidden] { display: none; }
.conv-blocked { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 64px 20px; max-width: 460px; margin: 0 auto; }
.conv-blocked .cb-ico { color: var(--mute); display: grid; place-items: center; }
.conv-blocked .cb-text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ivory); }
.chat.is-blocked .composer-wrap { display: none; }

.chat-wrapper { display: flex; min-height: 0; min-width: 0; position: relative; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.chat.dropping::after { content: "Déposez vos fichiers ici"; position: absolute; inset: 12px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--turq); background: rgba(15,23,51,.85); color: var(--turq); font-weight: 700; font-size: 16px; pointer-events: none; }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head select { padding: 9px 12px; border: 1px solid var(--line-strong); background: var(--night); color: var(--ivory); font-size: 13px; cursor: pointer; }
.chat-head select option { background: var(--night); }
/* Agent en pause : l'en-tête le dit, pas seulement la zone de saisie. */
.chat-paused { flex: none; }

.messages { flex: 1; overflow: auto; padding: 24px 22px; min-height: 0; }
.thread { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg-me { display: flex; justify-content: flex-end; }
/* La limite de largeur est sur le conteneur (largeur pleine), pas sur la bulle : un pourcentage sur la bulle
   se calculait par rapport à un conteneur ajusté au contenu, ce qui coupait les mots courts en deux. */
.msg-me > div { max-width: 78%; display: flex; flex-direction: column; align-items: flex-end; }
.msg-me .bubble { max-width: 100%; padding: 12px 16px; background: var(--turq); color: var(--navy); white-space: pre-wrap; overflow-wrap: break-word; font-size: 14px; line-height: 1.55; }
.msg-me .meta { text-align: right; }
.msg-me.queued .bubble { background: transparent; color: var(--ivory); border: 1px dashed rgba(59,217,219,.6); }
.msg-me.queued .meta { color: var(--turq); }
.msg-me.queued .meta .ico { vertical-align: -0.1em; }
.turn { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.turn-body { min-width: 0; }
.turn-head { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; min-height: 22px; }
.turn-head strong { font-weight: 700; }
.turn-head .when { color: var(--mute); font-size: 12px; }
.turn-head .actions-inline { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s ease; }
.turn:hover .actions-inline, .turn:focus-within .actions-inline, .actions-inline.on { opacity: 1; }
.meta { font-size: 11px; color: var(--mute); margin-top: 4px; }

.text-block { font-size: 14.5px; line-height: 1.65; color: var(--ivory); overflow-wrap: anywhere; }
.text-block + .text-block, .steps + .text-block, .text-block + .steps, .steps + .steps { margin-top: 10px; }
.text-block p { margin: 0 0 10px; } .text-block p:last-child { margin-bottom: 0; }
.text-block ul, .text-block ol { margin: 4px 0 10px; padding-left: 22px; }
.text-block li { margin: 3px 0; }
.text-block code { background: rgba(15,23,51,.8); padding: 1px 5px; font-size: 13px; border: 1px solid var(--line); }
.text-block pre { background: rgba(8,12,28,.8); padding: 12px 14px; overflow-x: auto; white-space: pre; border: 1px solid var(--line); font-size: 13px; }
.text-block h3, .text-block h4 { margin: 14px 0 6px; font-size: 15px; }
.text-block blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--turq); color: var(--sand); }
.text-block hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.text-block .tbl { overflow-x: auto; margin: 8px 0 12px; }
.text-block table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.text-block th, .text-block td { border: 1px solid var(--line-strong); padding: 7px 10px; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 72px; }
.text-block th { background: rgba(246,242,234,.06); font-weight: 700; }
.cursor { display: inline-block; width: 8px; height: 1.05em; background: var(--turq); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s steps(1) infinite; }

/* Résumé de plan intégré à une réponse passée (repliable) */
.plan-summary { margin-bottom: 10px; border-left: 2px solid rgba(59,217,219,.35); padding-left: 12px; }
.plan-summary summary { cursor: pointer; color: var(--mute); font-size: 13px; padding: 3px 0; list-style: none; }
.plan-summary summary::-webkit-details-marker { display: none; }
.plan-summary summary:hover { color: var(--ivory); }
.plan-summary .task-list { padding: 4px 0 2px; }

/* Liste de tâches (reprise dans le panneau et dans le résumé ci-dessus) */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; font-size: 13.5px; line-height: 1.45; color: var(--sand); }
.task-box { position: relative; width: 16px; height: 16px; flex: none; margin-top: 1px; border: 1.5px solid rgba(246,242,234,.35); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--navy); }
.task-box .ico { color: var(--navy); }
.task.t-pending .task-box { border-style: solid; }
.task.t-in_progress { color: var(--ivory); font-weight: 600; }
.task.t-in_progress .task-box { border: 1.5px dashed var(--turq); }
.task-spin { position: absolute; inset: 2px; border: 2px solid rgba(59,217,219,.25); border-top-color: var(--turq); border-radius: 50%; animation: spin .8s linear infinite; }
.task.t-completed { color: var(--mute); }
.task.t-completed .task-txt { text-decoration: line-through; text-decoration-color: rgba(169,176,198,.55); }
.task.t-completed .task-box { background: var(--turq); border-color: var(--turq); }
.task.t-cancelled { color: var(--mute); }
.task.t-cancelled .task-txt { text-decoration: line-through; }
.task.t-cancelled .task-box { border-color: rgba(255,158,138,.6); color: var(--danger); }
.task.t-cancelled .task-box .ico { color: var(--danger); }

/* Étapes de travail (outils) */
.steps { border-left: 2px solid rgba(59,217,219,.35); padding-left: 12px; }
.steps-summary { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; color: var(--mute); font-size: 13px; cursor: pointer; padding: 3px 0; text-align: left; width: 100%; }
.steps-summary:hover { color: var(--ivory); }
.steps-summary .chev { display: inline-grid; place-items: center; transition: transform .15s ease; }
.steps.open .steps-summary .chev { transform: rotate(90deg); }
.steps-list { display: none; flex-direction: column; gap: 2px; padding: 4px 0 2px; }
.steps.open .steps-list { display: flex; }
.step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--sand); padding: 3px 0; min-width: 0; }
.step .sico { width: 18px; display: grid; place-items: center; flex: none; color: var(--turq); }
.step.failed .sico { color: var(--danger); }
.step .sdetail { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.step .state { margin-left: auto; flex: none; font-size: 12px; color: var(--mute); display: flex; align-items: center; }
.step .state .ico { color: var(--turq); }
.step.running { color: var(--ivory); }
.step.failed .state { color: var(--danger); }

.thinking { margin: 4px 0 10px; }
.thinking-toggle { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 2px 0; color: var(--mute); font-size: 13px; cursor: pointer; }
.thinking-toggle .ico { color: var(--mute); }
.thinking-toggle.live { background: linear-gradient(90deg, var(--mute) 0%, var(--ivory) 50%, var(--mute) 100%); background-size: 200px 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; }
.thinking-text { display: none; margin-top: 6px; padding: 8px 12px; border-left: 2px solid var(--line-strong); color: var(--mute); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; max-height: 180px; overflow: auto; }
.thinking.open .thinking-text { display: block; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 13px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; background: var(--turq); animation: dots 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
.turn-error { margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(255,158,138,.4); background: rgba(255,158,138,.08); color: var(--danger); font-size: 13px; }
.turn-note { margin-top: 10px; font-size: 12px; color: var(--mute); font-style: italic; }

/* Indications données pendant le travail de l'agent (/steer) */
.steer-note { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--ochre-light); background: rgba(226,167,60,.08); font-size: 13px; color: var(--sand); line-height: 1.45; }
.steer-note .ico { color: var(--ochre-light); margin-top: 2px; }
.steer-note strong { color: var(--ivory); font-weight: 600; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.choice-btn { padding: 8px 14px; background: rgba(59,217,219,.12); border: 1px solid var(--turq); color: var(--turq); font-size: 13px; font-weight: 700; cursor: pointer; text-align: left; }
.choice-btn:hover { background: var(--turq); color: var(--navy); }
.quick-sep { flex: 1; min-width: 8px; }
.quick-btn { padding: 6px 10px; background: transparent; border: 1px solid var(--line-strong); color: var(--mute); font-size: 12px; font-weight: 600; cursor: pointer; }
.quick-btn:hover { color: var(--ivory); border-color: rgba(246,242,234,.4); }

.day-divider { display: flex; align-items: center; gap: 12px; text-align: center; margin: 4px 0; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-divider span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--mute); }

.welcome { text-align: center; padding: 48px 16px 24px; }
.welcome .display { font-size: 28px; }
.welcome-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 620px; margin: 28px auto 0; text-align: left; }
/* Nombre impair de suggestions : la dernière occupe toute la largeur, pas de case vide. */
.welcome-cards.odd .welcome-card:last-child { grid-column: 1 / -1; }
.welcome-card { display: flex; align-items: center; gap: 12px; padding: 16px; background: rgba(246,242,234,.04); border: 1px solid var(--line-strong); color: var(--ivory); font-size: 14px; font-weight: 600; cursor: pointer; line-height: 1.35; text-align: left; }
.welcome-card:hover { border-color: var(--turq); background: rgba(59,217,219,.08); }
.welcome-card .wi { color: var(--turq); display: grid; place-items: center; flex: none; }
.welcome-card .wa { margin-left: auto; color: var(--turq); flex: none; }
.welcome-tips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 22px; font-size: 12px; color: var(--mute); }
.welcome-tips span { display: inline-flex; align-items: center; gap: 6px; }

.jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 3; }
.chip { flex: none; padding: 7px 12px; border: 1px solid rgba(59,217,219,.4); background: transparent; color: var(--turq); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { background: rgba(59,217,219,.12); }
.chip.active { background: var(--turq); color: var(--navy); border-color: var(--turq); }

/* Zone de saisie */
.composer-wrap { padding: 0 22px 18px; }
.pending-files { max-width: 820px; margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.pending { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; background: rgba(246,242,234,.06); border: 1px solid var(--line-strong); max-width: 260px; min-width: 0; }
.pending.error { border-color: rgba(255,158,138,.5); }
.pending img { width: 36px; height: 36px; object-fit: cover; flex: none; }
.pending .pi { width: 36px; height: 36px; display: grid; place-items: center; background: transparent; flex: none; }
.pending .pi .ftype { min-width: 36px; height: 36px; }
.pending .pmeta { min-width: 0; flex: 1; }
.pending .fn { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending .fs { font-size: 11px; color: var(--mute); }
.pending.error .fs { color: var(--danger); }
.pending .progress { margin-top: 4px; height: 3px; }

.composer { max-width: 820px; margin: 0 auto; display: flex; gap: 6px; align-items: flex-end; padding: 6px; background: rgba(246,242,234,.05); border: 1px solid var(--line-strong); }
.composer:focus-within { border-color: rgba(59,217,219,.6); }
.composer textarea { flex: 1; border: 0; background: transparent; color: var(--ivory); font-size: 15px; outline: none; resize: none; max-height: 200px; padding: 10px 0; line-height: 1.4; }
.composer textarea::placeholder { color: var(--mute); }
#later-btn { padding: 11px 14px; }
.tool-btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; color: var(--mute); cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.tool-btn:hover:not(:disabled) { color: var(--ivory); background: rgba(246,242,234,.06); }
.tool-btn:disabled { opacity: .4; cursor: default; }
.tool-btn.recording { color: #fff; background: #D8483A; animation: mnPulseRed 1.4s infinite; }
.tool-btn.busy { color: var(--turq); border-color: rgba(59,217,219,.4); cursor: wait; }
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #D8483A; margin-right: 4px; animation: blink 1s steps(1) infinite; vertical-align: middle; }
/* Ligne d'aide sous la zone de saisie : texte simple, centré, une seule ligne (coupée proprement, jamais sur deux lignes). */
.composer-hint { max-width: 820px; margin: 6px auto 0; font-size: 11px; line-height: 16px; color: var(--mute); text-align: center; }
.composer-hint > span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Ligne avec une icône (cercle, point) : le texte se coupe, l'icône reste juste après lui, sur la même ligne. */
.composer-hint .hint-busy { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.composer-hint .hint-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.composer-hint .hint-busy .spinner { margin: 0; }

/* Fichiers échangés dans la conversation */
.file-list { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(59,217,219,.10); border: 1px solid rgba(59,217,219,.35); color: var(--ivory); font-size: 13px; max-width: 280px; }
.file-chip:hover { background: rgba(59,217,219,.18); color: var(--ivory); }
.file-chip .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-chip .fs { color: var(--mute); font-size: 11px; flex: none; }
.file-chip .ftype { min-width: 26px; height: 22px; font-size: 9px; }
.file-thumb { cursor: zoom-in; }
.file-thumb img { display: block; max-width: 220px; max-height: 160px; object-fit: cover; border: 1px solid var(--line-strong); }
.file-link { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; background: rgba(59,217,219,.12); border: 1px solid rgba(59,217,219,.35); font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }
.file-link .ico { flex: none; }
.ftype { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border: 1px solid rgba(59,217,219,.45); color: var(--turq); font-size: 10px; font-weight: 700; letter-spacing: .04em; flex: none; }

.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(5,8,20,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 16px; animation: mnFade .15s ease; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--sand); font-size: 13px; }
.lb-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panneau « Une seule liste » — compteur en haut (une fois), tâches, puis fichiers en tuiles.
   Colonne persistante côté opposé au menu, tiroir sur petit écran. */
.side-panel { flex: none; width: 300px; border-left: 1px solid var(--line); background: rgba(15,23,51,.55); display: flex; flex-direction: column; min-height: 0; }
.side-close { display: none; }
.side-top { position: relative; flex: none; padding: 18px 16px 14px; border-bottom: 1px solid var(--line); }
.side-top.bare { display: none; }
.side-count { display: flex; align-items: baseline; gap: 8px; padding-right: 36px; }
.side-count b { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--ivory); }
.side-count span { font-size: 13px; color: var(--mute); }
.side-now { margin: 6px 0 12px; font-size: 13.5px; line-height: 1.4; color: var(--sand); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-now.running { color: var(--ivory); }
.side-top .side-close { position: absolute; top: 12px; right: 10px; }
.side-body { flex: 1; overflow: auto; min-height: 0; padding-bottom: 16px; }
.side-empty { padding: 16px; font-size: 13px; line-height: 1.5; color: var(--mute); }
.side-tasks { padding: 10px 12px 4px; gap: 2px; }
.side-tasks .task { padding: 7px 8px; border-radius: 0; overflow-wrap: anywhere; }
.side-tasks.long { max-height: 46vh; overflow: auto; overscroll-behavior: contain; }
.side-tasks .task.t-in_progress { background: rgba(59,217,219,.09); }
.side-sech { padding: 16px 16px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.side-tasks + .side-sech { margin-top: 6px; border-top: 1px solid var(--line); }
.ftiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px; }
.file-row { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line); color: var(--ivory); }
.file-row:hover { background: rgba(246,242,234,.05); color: var(--ivory); }
.file-row .fi .ftype { min-width: 34px; height: 30px; }
.file-row .fmeta { display: flex; flex-direction: column; gap: 1px; min-width: 0; width: 100%; }
.file-row .fn { font-size: 12.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-row .fs { font-size: 11px; line-height: 1.35; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fd { position: absolute; top: 10px; right: 10px; color: var(--turq); opacity: .7; }
.file-row:hover .fd { opacity: 1; }
/* Beaucoup de fichiers : une colonne de lignes compactes, nom sur une seule ligne. */
.ftiles.dense { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.ftiles.dense .file-row { flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; }
.ftiles.dense .file-row .fi .ftype { min-width: 30px; height: 26px; font-size: 9.5px; }
.ftiles.dense .file-row .fn { -webkit-line-clamp: 1; }
.ftiles.dense .file-row .fd { position: static; flex: none; }
/* Fichier introuvable : on le dit au lieu de proposer un lien mort. */
.file-row.gone { opacity: .75; }
.file-row.gone .fn { text-decoration: line-through; text-decoration-color: rgba(255,158,138,.6); }
.file-row.gone .fs { color: var(--danger); white-space: normal; }
.file-row.gone .fd { color: var(--danger); opacity: 1; }

/* ── Modales ────────────────────────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(8,12,28,.75); display: grid; place-items: center; padding: 16px; animation: mnFade .2s ease; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 28px; background: #16214A; border: 1px solid rgba(59,217,219,.25); display: flex; flex-direction: column; gap: 14px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--sand); }
.modal textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.modal select option { background: var(--night); }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.agent-modal { max-width: 560px; }
.agent-preview { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line-strong); background: rgba(246,242,234,.04); }
.agent-tips { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-left: 3px solid var(--turq); background: rgba(59,217,219,.06); font-size: 12.5px; color: var(--sand); line-height: 1.45; }
.agent-tips strong { color: var(--ivory); font-weight: 600; }

/* Listes déroulantes du produit : la flèche du système d'exploitation est remplacée par un chevron au trait. */
.modal select, .chat-head select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23D7D3CB' stroke-width='1.8' stroke-linecap='square'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
}
.modal select { min-height: 46px; }
.modal select:disabled { opacity: .5; cursor: default; }
/* Champ heure : l'icône native du navigateur est claire sur fond clair — on l'inverse. */
.modal input[type="time"], .modal input[type="date"] { min-height: 46px; }
.modal input[type="time"]::-webkit-calendar-picker-indicator,
.modal input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) brightness(1.6); opacity: .7; cursor: pointer; }

/* Cases à cocher et boutons radio habillés (mêmes couleurs que le reste du produit). */
.modal input[type="checkbox"], .modal input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(246,242,234,.05); border: 1.5px solid var(--line-strong); transition: background .12s ease, border-color .12s ease;
}
.modal input[type="radio"] { border-radius: 50%; }
.modal input[type="checkbox"]:hover:not(:disabled), .modal input[type="radio"]:hover:not(:disabled) { border-color: var(--turq); }
.modal input[type="checkbox"]:checked { background: var(--turq); border-color: var(--turq); }
.modal input[type="checkbox"]:checked::after { content: ""; width: 10px; height: 5px; margin-top: -3px;
  border-left: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(-45deg); }
.modal input[type="radio"]:checked { border-color: var(--turq); }
.modal input[type="radio"]:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--turq); }
.modal input[type="checkbox"]:disabled, .modal input[type="radio"]:disabled { opacity: .35; cursor: default; }
.modal input[type="checkbox"]:focus-visible, .modal input[type="radio"]:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; }
.modal .gm-model-select { flex: 1 1 100%; padding: 9px 38px 9px 12px; font-size: 13px; min-height: 40px; }
.modal .gm-lead-pick { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 12px; color: var(--sand); cursor: pointer; white-space: nowrap; }
.gm-row label { min-height: 40px; }

/* ── Réactif ────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .side-panel { width: 260px; }
}
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .agents-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  /* La liste des conversations devient une bande horizontale : hauteur fixe, cartes lisibles,
     outils (épingler / renommer) toujours visibles puisqu'il n'y a pas de survol au doigt. */
  /* Bande des conversations : outils (nouvelle + recherche) sur une ligne, cartes sur la suivante.
     La recherche garde sa largeur : son texte n'est plus coupé au milieu d'un mot. */
  .conv-list { flex: none; max-height: none; flex-direction: row; flex-wrap: wrap; align-items: center; overflow: visible; gap: 8px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .conv-list > .conv-top { order: 1; flex: 1 1 100%; }
  .conv-list > .label, .conv-group { display: none; }
  #conv-items { display: flex; flex-direction: row; gap: 6px; order: 3; flex: 1 0 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
  .conv-item { width: 200px; flex: none; display: flex; flex-direction: column; border: 1px solid var(--line); border-left-width: 3px; padding: 8px 10px; }
  .conv-tools { position: static; transform: none; display: flex; justify-content: flex-end; margin-top: auto; padding-top: 2px; background: transparent; }
  .conv-tools .icon-btn { padding: 2px 5px; }
  .mission-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
  .mission-row .m-freq, .mission-row .m-next { grid-column: 1; }
  /* L'interrupteur se cale sur la ligne du nom (et non au milieu des trois lignes). */
  .mission-row .switch { grid-row: 1 / span 3; grid-column: 2; align-self: start; margin-top: 2px; }

  .side-panel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 4; width: 320px; box-shadow: -12px 0 30px rgba(0,0,0,.35); background: #131D40; display: none; }
  .side-panel.open { display: flex; }
  .side-close { display: inline-flex; margin-left: auto; }
  .side-top.bare { display: flex; justify-content: flex-end; padding: 8px 10px; border-bottom: 0; }
  .side-top.bare .side-close { position: static; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { width: 100%; padding: 12px 16px; border-right: 0; border-bottom: 1px solid rgba(59,217,219,.14); position: sticky; top: 0; z-index: 10; background: #121C3E; }
  .brand { padding: 0; min-height: 40px; }
  .menu-toggle { display: grid; width: 42px; height: 40px; }
  .sidebar .nav, .sidebar .health, .sidebar .me { display: none; }
  /* La barre est horizontale : le mode « réduit » du bureau n'a plus lieu d'être,
     la marque et les libellés du menu restent lisibles. */
  .sidebar.collapsed { width: 100%; }
  .sidebar.collapsed .brand { justify-content: flex-start; padding: 0; }
  .sidebar.collapsed .brand-name, .sidebar.collapsed .brand-sub,
  .sidebar.collapsed .nav .label-text, .sidebar.collapsed .me span, .sidebar.collapsed .me-logout-text { display: block; }
  .sidebar.collapsed .nav .badge { display: grid; position: static; min-width: 22px; height: 20px; padding: 0 6px; font-size: 11px; border: 0; }
  .sidebar.collapsed .nav button { justify-content: flex-start; padding: 11px 14px; }
  .sidebar.collapsed .me { justify-content: space-between; padding: 14px 8px 0; }
  .sidebar.collapsed .health { padding: 14px 16px; background: rgba(59,217,219,.07); border: 1px solid rgba(59,217,219,.18); }
  .sidebar.collapsed .health.bad { background: rgba(200,138,28,.10); border-color: rgba(200,138,28,.35); }
  .sidebar.collapsed .health-title { gap: 8px; font-size: 12px; justify-content: flex-start; }
  .sidebar.collapsed .health-title .dot { width: 8px; height: 8px; }
  .sidebar.collapsed .health-sub { display: block; }
  .sidebar.open .nav { display: flex; margin-top: 12px; }
  .sidebar.open .health { display: block; margin-top: 12px; }
  .sidebar.open .me { display: flex; }
  .collapse-toggle { display: none; }
  .main { padding: 22px 16px 32px; overflow: visible; }
  .display { font-size: 28px; } .display.xl { font-size: 32px; }
  .agents-layout { grid-template-columns: minmax(0, 1fr); }
  .detail { padding: 20px 16px; }
  .detail-cols { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .detail .head { gap: 14px; }
  .detail .head > div:first-child { min-width: 0; }
  .detail .head .actions { width: 100%; margin-top: 0; }
  .detail .head .display { font-size: 24px !important; }
  .history-row .when { min-width: 72px; }
  .row-between { align-items: center; }

  /* Accueil : cartes et lignes resserrées. */
  .stats { margin-top: 24px; }
  .home-grid { gap: 24px; margin-top: 24px; }
  .agent-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
  .live-panel { margin-top: 22px; }
  .live-panel-head, .live-row { padding: 12px 14px; }
  .timeline-row .time { min-width: 56px; }

  /* Cibles tactiles : tout ce qui se touche fait au moins 40 px de haut. */
  .btn { min-height: 40px; }
  .icon-btn { min-height: 40px; padding: 8px 10px; }
  .quick-btn { min-height: 40px; padding: 10px 12px; }
  .choice-btn { min-height: 40px; }
  .btn-xs { padding: 9px 12px; font-size: 13px; min-height: 40px; }
  .head-btn { min-height: 40px; }
  .steps-summary, .thinking-toggle { min-height: 40px; }
  .task { padding: 9px 0; }
  .file-chip { min-height: 40px; }
  .chip { display: inline-flex; align-items: center; padding: 10px 14px; min-height: 40px; }
  .filters { gap: 8px; margin: -6px 0 20px; }
  .row-between a[data-go], .me a, .muted a[data-go], .muted a[data-action], .empty a[data-action],
  .meta a[data-action] {
    display: inline-flex; align-items: center; min-height: 40px; }
  /* Retirer une pièce jointe : la croix se touche aussi bien que le reste. */
  .pending .icon-btn { min-width: 40px; min-height: 40px; display: grid; place-items: center; padding: 0; }
  /* L'interrupteur garde son gabarit visuel ; des bordures transparentes élargissent la zone touchée. */
  .switch, .switch.on { background-clip: padding-box; }
  .switch { width: 52px; height: 40px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
  .switch::after { width: 18px; height: 18px; top: 3px; left: 3px; }
  .switch.on::after { left: 31px; }

  /* Message d'état sous la barre du haut : il ne recouvre jamais la zone de saisie. */
  .toast, body:has(.main.main-full) .toast, body:has(.room-composer) .toast { top: 76px; bottom: auto; left: 16px; right: 16px; transform: none; max-width: none; animation-name: toastDrop; }

  .main.main-full { overflow: visible; }
  .chat-layout { height: calc(100vh - 63px); height: calc(100dvh - 63px); margin: 0; }
  /* La conversation occupe exactement la hauteur visible, sans constante à deviner. */
  .shell:has(> .main.main-full) { height: 100dvh; min-height: 0; overflow: hidden; }
  .shell:has(> .main.main-full) .main.main-full { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .shell:has(> .main.main-full) .chat-layout { height: 100%; }
  .messages { padding: 18px 16px; }

  /* Bande des conversations : ligne d'outils (nouvelle + recherche) puis cartes défilant à l'horizontale. */
  .conv-list { max-height: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; overflow: visible; }
  #conv-items { order: 3; flex: 1 0 100%; overflow-x: auto; overflow-y: hidden; gap: 8px; padding-bottom: 2px; }
  .conv-item { width: 270px; min-height: 52px; justify-content: center; padding: 8px 134px 8px 10px; }
  .conv-tools { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin-top: 0; padding-top: 0; background: transparent; }
  .conv-tools .icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; display: grid; place-items: center; }
  /* L'en-tête passe à la ligne : le sélecteur d'agent et la pastille de modèle gardent leur place. */
  .chat-head { padding: 12px 16px; flex-wrap: wrap; gap: 8px; row-gap: 10px; }
  .chat-head #chat-sub:not(.conv-state) { display: none; }   /* l'état privée / partagée reste lisible sur téléphone */
  .chat-head #chat-sub.conv-state { font-size: 11.5px; }
  .chat-head > div:nth-child(2) { min-width: 0 !important; overflow: hidden; }
  .chat-head > div:nth-child(2) > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-head > div:nth-child(2) > #chat-sub.conv-state { white-space: normal; line-height: 1.3; }   /* « Privée : vous seul la voyez » ne se coupe pas */
  .head-btn { padding: 8px 11px; }
  /* La pastille d'agent gère sa propre taille (model-picker.css). */
  .chips { padding: 0 16px 10px; }
  .composer-wrap { padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .composer textarea::placeholder { font-size: 14px; }
  .tool-btn { width: 36px; height: 40px; }
  .composer .btn-primary, .composer .btn-stop { padding: 11px 12px; }
  #later-btn { padding: 11px 8px; font-size: 12px; }
  .msg-me > div { max-width: 90%; }
  .turn { grid-template-columns: minmax(0, 1fr); }
  .turn > .avatar { display: none; }
  .turn-head .actions-inline { opacity: 1; }
  .file-thumb img { max-width: 160px; }
  .modal .grid2 { grid-template-columns: 1fr; }
  .live-row { grid-template-columns: minmax(0, 1fr) auto; }
  .live-row > .avatar { display: none; }
  .welcome-cards { grid-template-columns: minmax(0, 1fr); }
  .welcome { padding: 32px 8px 18px; }
  .welcome .display { font-size: 24px; }
  .welcome-card { padding: 14px; min-height: 56px; }
  .side-panel { width: 100%; }
  .lightbox { padding: 52px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }

  /* Groupes : une colonne, salon en hauteur généreuse, composer collé en bas de l'écran. */
  .group-grid { grid-template-columns: minmax(0, 1fr); }
  .room-head { padding-bottom: 14px; gap: 12px; }
  .room-head-main { gap: 10px; }
  .room-title .display { font-size: 21px; }
  .room { max-height: none; flex: 1 1 auto; min-height: calc(100dvh - 360px); }
  .room-msg, .room-msg.system, .room-ask-banner { max-width: 100%; }
  .room-msg.user { max-width: 92%; }
  .group-member { min-height: 40px; }
  /* Les deux actions du groupe gardent leur mot : une icône seule serait ambiguë. */
  .room-actions .head-btn { min-height: 44px; padding: 10px 14px; }
  .room-actions .head-btn span { display: inline; }
  .room-legend { font-size: 11.5px; }
  .room-jump-wrap { bottom: 88px; }
  /* Le composer colle au bas de l'écran : le fil défile en dessous, dans la même colonne que le reste.
     L'indication sous le composer disparaît (comme #chat-sub) pour ne pas se superposer au composer collé. */
  .room-composer { position: sticky; bottom: 0; z-index: 1; background: var(--night); margin: 0 -16px;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border: 0; border-top: 1px solid var(--line); }
  .room-hint { display: none; }

  /* Modales : feuilles pleine largeur, champs à 16 px (iOS n'agrandit plus la page au focus). */
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { max-width: none; max-height: 92dvh; gap: 12px;
    padding: 20px 16px 0; border-left: 0; border-right: 0; border-bottom: 0; }
  /* Les boutons restent collés au bas de la feuille, même quand le formulaire défile. */
  .modal > .actions { position: sticky; bottom: 0; z-index: 1; margin: 0 -16px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: #16214A; border-top: 1px solid var(--line); }
  .modal textarea { min-height: 90px; }
  .modal .display { font-size: 22px !important; }
  .login-card input, .modal input, .modal textarea, .modal select { font-size: 16px; }
  /* iPhone : sous 16 px, Safari zoome sur le champ touché. */
  .composer textarea, .room-composer textarea, .conv-search, .task-answer-input, .project-modal .pk-part-input, .modal .gm-model-select { font-size: 16px; }
  .login-card { padding: 26px 20px; }
}
@media (max-width: 700px) {
  /* Place vraiment comptée : les boutons de l'en-tête de conversation se réduisent à leur icône.
     Le salon de groupe garde ses libellés (« Modifier », « Dissoudre »), trop ambigus sans texte. */
  .chat-head .head-btn span:not(.badge) { display: none; }
  .chat-head .head-btn { padding: 8px 10px; min-width: 40px; justify-content: center; }
}
@media (max-width: 560px) {
  /* Téléphone : le message occupe toute la largeur, les outils passent en dessous. */
  .composer { position: relative; flex-wrap: wrap; }
  .composer textarea { flex: 1 0 100%; order: -1; padding: 8px 6px; }
  .composer #send-btn { margin-left: auto; }
  .composer-hint { font-size: 10.5px; }

  /* En-tête de conversation sur une seule ligne : identité, outils, sélecteur d'agent. */
  .chat-head { padding: 10px 16px; flex-wrap: nowrap; }
  .chat-head > .avatar { width: 34px !important; height: 34px !important; font-size: 15px !important; }
  .chat-head > div:nth-child(2) { flex: 1 1 auto !important; min-width: 0 !important; }
  .chat-head > div:nth-child(2) > div:first-child { font-size: 15px !important; }
  .head-btn { padding: 9px 8px; }
  .jump { bottom: 150px; }
  .conv-item { width: 270px; min-height: 48px; }

  /* Titres et tuiles à l'échelle du téléphone : quatre chiffres en 2 × 2. */
  .display { font-size: 26px; } .display.xl { font-size: 30px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 16px 14px; }
  .stat-value { font-size: 28px; }
  .stat-label { margin-top: 8px; }

  .settings-row { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .mission-row { padding: 14px 16px; gap: 6px 14px; }
  .head { gap: 16px; }
  .head > .btn { width: 100%; white-space: normal; text-align: center; }
  .empty.big { padding: 32px 18px; }
  .empty.big .display { font-size: 22px; }

  /* Salon de groupe : marges resserrées, bulles quasi pleine largeur. */
  .room-title .display { font-size: 19px; }
  .room { padding: 14px 12px; gap: 10px; }
  .room-msg.agent, .room-msg.system, .room-msg.room-ask { padding-left: 9px; }
  .room-msg.user { max-width: 96%; }
  .room-round span { font-size: 10px; }
  .room-round { gap: 8px; }
}
@media (max-width: 430px) {
  /* Les trois réponses d'une validation s'empilent : chacune reste large et facile à viser. */
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
  .history-row { flex-direction: column; gap: 2px; }
  .log-row { grid-template-columns: 50px 24px minmax(0, 1fr); gap: 10px; }
}

/* Menu clic droit des conversations */
.ctx-menu { position: fixed; z-index: 95; min-width: 220px; max-width: min(300px, calc(100vw - 16px)); padding: 6px 0; background: #131D40; border: 1px solid var(--line-strong); box-shadow: 0 18px 40px rgba(8,12,28,.6); animation: mnFade .1s ease; }
.ctx-title { padding: 8px 14px 9px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; border: 0; background: transparent; color: var(--ivory); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: rgba(59,217,219,.12); outline: none; }
.ctx-item .ico { flex: none; color: var(--mute); }
.ctx-item.danger, .ctx-item.danger .ico { color: var(--danger); }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { background: rgba(255,158,138,.12); }
.ctx-sep { height: 1px; margin: 4px 0; background: var(--line); }
.conv-tools .icon-btn.danger:hover { color: var(--danger); }
@media (max-width: 860px) { .ctx-item { min-height: 44px; } }

/* Journal : « Afficher plus » */
.log-more { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 24px; }
.log-count { margin: 0; text-align: center; font-size: 13px; color: var(--mute); }

/* Fenêtre « Nouveau groupe » : ligne d'un agent choisi (posée par modals.js). */
.gm-row.gm-on { background: rgba(59, 217, 219, .06); }
html[data-design="v2"] .gm-row.gm-on { background: rgba(255, 255, 255, .04); }

/* Recherche dans les messages (lot 2) : extrait sous le titre, mot trouvé surligné, message trouvé signalé un instant. */
.conv-item .s.snip { font-size: 12px; line-height: 1.35; color: var(--ivory-dim, var(--mute)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.conv-item mark { background: rgba(59,217,219,.22); color: inherit; padding: 0 1px; border-radius: 2px; }
.conv-note { padding: 6px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.search-hit { animation: searchHit 2.4s ease-out; }
@keyframes searchHit { 0%, 55% { box-shadow: 0 0 0 2px rgba(59,217,219,.55); } 100% { box-shadow: 0 0 0 2px rgba(59,217,219,0); } }
@media (prefers-reduced-motion: reduce) { .search-hit { animation: none; outline: 2px solid rgba(59,217,219,.55); outline-offset: 2px; } }
@media (max-width: 700px) { .conv-item .s.snip { -webkit-line-clamp: 2; white-space: normal; } .conv-note { min-width: 200px; flex: none; } }

/* ══ Fiche Agents : « Ce qu'il a retenu » et « Voir tout » (savoir-faire) — début du bloc des lots 1 et 3 ══ */
.mem { margin-top: 14px; }
.mem-toggle, .skills-open { display: inline-flex; align-items: center; gap: 6px; margin-left: -8px; }
.skills-open { margin-top: 12px; }
.mem-toggle .ico, .skills-open .ico, .skl-theme-head .ico { transition: transform .15s ease; flex: none; }
.mem-toggle[aria-expanded="true"] .ico, .skl-theme-head[aria-expanded="true"] .ico { transform: rotate(90deg); }
.mem-body { margin-top: 10px; }
.mem-help { margin: 0 0 6px; }
.mem-label { margin: 16px 0 4px; }
.mem-row { display: flex; align-items: flex-start; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mem-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.55; color: var(--sand); white-space: pre-wrap; overflow-wrap: anywhere; }
.mem-tools { display: flex; gap: 2px; flex: none; }
.mem-tools .icon-btn.danger:hover { color: var(--danger); }
.mem-more { margin-left: -14px; }
.skills-modal { max-width: 640px; }
.skills-modal > * { flex-shrink: 0; }   /* la fenêtre défile : rien ne s'écrase */
.skills-modal .skl-help { margin: 0; }
.skl-theme, .skl-kept { margin-top: 16px; }
.skl-kept { padding-top: 14px; border-top: 1px solid var(--line); }
.skl-theme-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 0; background: transparent; border: 0; cursor: pointer; text-align: left; }
.skl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.skl-name { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.skl-desc { margin-top: 2px; font-size: 13px; line-height: 1.4; }
.skl-pill:not(.tone-ready) { background: rgba(246,242,234,.08); color: var(--sand); }
.skl-empty { padding: 24px 0; }
@media (prefers-reduced-motion: reduce) { .mem-toggle .ico, .skills-open .ico, .skl-theme-head .ico { transition: none; } }
@media (max-width: 720px) {
  .skl-row { grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 6px; }
  .skl-act { margin-left: -9px; }
  .mem-tools .icon-btn { min-width: 40px; }
}
/* ══ fin du bloc des lots 1 et 3 ══ */

/* Clé secrète : affichée en points tant que l'œil n'est pas ouvert (texte, pas mot de passe : le navigateur ne la prend pas pour un mot de passe). */
.kc-input.is-masked, #prov-key.is-masked { -webkit-text-security: disc; }

/* Remplissage automatique du navigateur : pas de fond bleu clair sur les champs de recherche et de saisie. */
input[type="search"]:-webkit-autofill, .dlg-input:-webkit-autofill, input.is-masked:-webkit-autofill, .kc-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--night) inset; box-shadow: 0 0 0 1000px var(--night) inset;
  -webkit-text-fill-color: var(--ivory); caret-color: var(--ivory); transition: background-color 99999s ease-out 0s;
}
