/* Palette alignee sur le dashboard Hermes amont (fond sombre, accent ambre). */
:root {
  --bg: #12100c;
  --panel: #1a1712;
  --line: #2e2820;
  --text: #ede6d8;
  --muted: #9a9078;
  --accent: #f0ad4e;
  --user: #2b2419;
  --err: #e5776b;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  /* Evite le zoom iOS au focus d'un champ (police < 16px). */
  font-size: 16px;
}

/* --------------------------------------------------------------- connexion */

#login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

#login-form {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
}

#login h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: #0d0b08;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1200;
  font-weight: 600;
}

#login-btn { width: 100%; margin-top: 22px; padding: 13px; }
button:disabled { opacity: 0.5; cursor: default; }

#login-error { color: var(--err); font-size: 14px; min-height: 20px; margin: 12px 0 0; }

/* -------------------------------------------------------------------- chat */

#chat {
  display: flex;
  flex-direction: column;
  /* dvh suit la barre d'adresse mobile, contrairement a vh. */
  height: 100dvh;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

header .title { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
header .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }

#status.ok { color: #7fc98b; }
#status.busy { color: var(--accent); }
#status.err { color: var(--err); }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.msg { display: flex; }
.msg.user { justify-content: flex-end; }

.bubble {
  max-width: min(680px, 85%);
  padding: 11px 14px;
  border-radius: 14px;
  line-height: 1.5;
  /* Conserve les retours a la ligne du modele sans casser les mots longs. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Reponse de l'agent : pleine largeur, sans cadre — le texte est le contenu
   principal, l'encadrer le comprime inutilement. Les messages utilisateur et
   les erreurs gardent leur bulle, c'est ce qui les distingue visuellement. */
.msg.agent { display: block; }

.msg.agent .bubble {
  max-width: none;
  width: 100%;
  background: none;
  border: 0;
  padding: 2px 0 6px;
}
.msg.user .bubble { background: var(--user); border: 1px solid var(--line); }
.msg.error .bubble { background: #2a1614; border: 1px solid var(--err); color: var(--err); }

#composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}

#text { flex: 1; resize: none; max-height: 160px; }

#send {
  width: 46px;
  flex: 0 0 46px;
  font-size: 20px;
  line-height: 1;
}

/* Au-dela du mobile, on centre la colonne de lecture. */
@media (min-width: 800px) {
  #messages, #composer {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
  }
}

/* ------------------------------------------- activite : reflexion et outils */

.activity {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151209;
  font-size: 13px;
  overflow: hidden;
}

.activity > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--accent);
  list-style: none;
}

.activity > summary::-webkit-details-marker { display: none; }
.activity.finished > summary { color: var(--muted); }

.activity-body {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thinking { color: var(--muted); font-style: italic; }

/* Point qui pulse tant que le tour est en cours. */
.spinner {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.activity.finished .spinner { animation: none; background: var(--muted); }

@keyframes pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

/* Reduit l'animation si l'utilisateur l'a demande au niveau systeme. */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

.tool {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-left: 2px solid var(--line);
  background: #0f0d08;
  border-radius: 6px;
}

.tool.running { border-left-color: var(--accent); }
.tool.done { border-left-color: #7fc98b; }
.tool.expandable { cursor: pointer; }

.tool-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.tool-meta { color: var(--muted); font-size: 12px; margin-left: auto; }

.tool-detail {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool.open .tool-detail { display: block; }

/* --------------------------------------------- ecran d'attente et deconnexion */

#boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.boot-inner { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* Bouton de deconnexion : discret dans l'en-tete, cible tactile suffisante. */
#logout {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

#logout:hover { color: var(--text); border-color: var(--muted); }
#user { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

header .meta { align-items: center; }

/* L'attribut `hidden` doit l'emporter sur les `display` poses plus haut
   (#boot, #login sont en grid) — sinon un ecran masque reste visible. */
[hidden] { display: none !important; }

/* ------------------------------------------------- panneau des conversations */

#chat { position: relative; }

#sidebar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  bottom: 0;
  width: 82vw;
  max-width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  /* Hors ecran par defaut sur mobile ; ouvert par le bouton ☰. */
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  padding-top: env(safe-area-inset-top);
}

#sidebar.open { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  #sidebar { transition: none; }
}

.sidebar-head { padding: 12px; border-bottom: 1px solid var(--line); }

#new-chat {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

#session-list { flex: 1; overflow-y: auto; padding: 8px; }

.session-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 4px;
  font-weight: 400;
}

.session-item:hover { background: #221d15; }
.session-item.current { border-color: var(--accent); background: #221d15; }

.session-title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Voile qui ferme le panneau au toucher, sur mobile. */
#scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
}

#menu {
  background: none;
  color: var(--text);
  font-size: 18px;
  padding: 0 10px 0 0;
  min-height: 30px;
}

header { gap: 8px; }
header .title { flex: 1; }

/* Au-dela de 900px le panneau reste ouvert en permanence. */
@media (min-width: 900px) {
  #sidebar { position: static; transform: none; width: 280px; max-width: none; }
  #menu, #scrim { display: none !important; }
  #chat {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto 1fr auto;
    height: 100dvh;
  }
  #chat > header { grid-column: 2; }
  #messages, #composer, #activity-bar { grid-column: 2; }
  #sidebar { grid-row: 1 / -1; }
}

/* ------------------------------------------------------------- sous-agents */

.subagent {
  border: 1px solid var(--line);
  border-left: 3px solid #8a7be0;
  border-radius: 10px;
  background: #14121c;
  font-size: 13px;
  overflow: hidden;
}

.subagent > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: #b0a6f0;
  list-style: none;
}

.subagent > summary::-webkit-details-marker { display: none; }
.subagent.finished > summary { color: var(--muted); }
.subagent.finished .spinner { animation: none; background: var(--muted); }

.sa-label { overflow: hidden; text-overflow: ellipsis; }
.sa-status { padding: 0 12px 6px; color: var(--muted); font-style: italic; }

.sa-text {
  padding: 0 12px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

/* --------------------------------------------------------- rendu Markdown */

/* Les bulles contiennent desormais du HTML : neutraliser les marges par defaut
   pour que le rythme vertical reste celui de la bulle. */
.bubble > *:first-child { margin-top: 0; }
.bubble > *:last-child { margin-bottom: 0; }
.bubble p { margin: 0 0 8px; }
.bubble h3, .bubble h4, .bubble h5, .bubble h6 {
  margin: 12px 0 6px;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.bubble ul, .bubble ol { margin: 6px 0 8px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble a { color: var(--accent); }
.bubble strong { font-weight: 650; }

.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: #0d0b08;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  overflow-wrap: anywhere;
}

.bubble pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: #0d0b08;
  border: 1px solid var(--line);
  border-radius: 8px;
  /* Le code ne doit pas elargir la page : il defile dans son propre cadre. */
  overflow-x: auto;
}

.bubble pre code {
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
  overflow-wrap: normal;
}

.bubble blockquote {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.bubble hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }

/* Le Markdown apporte ses propres retours a la ligne : pre-wrap ferait double
   emploi et creerait des espaces parasites entre blocs. */
.msg.agent .bubble, .sa-text { white-space: normal; }

/* ---------------------------------------------------- bandeau d'activite */

#activity-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  background: #1d1a10;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 13px;
}

.ab-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Conversation qui travaille, dans le panneau lateral. */
.session-item.working .session-title { color: var(--accent); }
.session-item.working .spinner { margin-right: 6px; display: inline-block; vertical-align: middle; }

/* Travaux de fond, rappeles en tete du panneau des conversations. */
#sidebar-activity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 8px 10px;
  background: #1d1a10;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
}

/* Le titre d'un sous-agent peut etre tres long (l'objectif complet) : le
   limiter a deux lignes plutot que de laisser deborder le cadre. */
.subagent > summary { align-items: flex-start; }

.sa-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* La pastille ne doit pas se comprimer face a un titre long. */
.subagent > summary .spinner { margin-top: 4px; }

/* ------------------------------------------- selecteur de modele et micro */

#model {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font: inherit;
  font-size: 12px;
  max-width: 150px;
  min-height: 30px;
}

#model:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
#model:disabled { opacity: 0.6; }
/* La liste deroulante native reste lisible sur fond sombre. */
#model option { background: var(--panel); color: var(--text); }

#mic {
  width: 46px;
  flex: 0 0 46px;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 18px;
}

#mic:hover:not(:disabled) { border-color: var(--muted); }
#mic:disabled { opacity: 0.4; }

/* Enregistrement en cours : bouton rouge qui pulse. */
#mic.recording {
  background: #7a2b24;
  border-color: var(--err);
  color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  #mic.recording { animation: none; }
}

/* L'en-tete doit tenir sur mobile : le titre cede la place au selecteur,
   qui est l'element le plus large. Sans cela le bouton de deconnexion
   sortait de l'ecran. */
header .title { flex: 0 1 auto; min-width: 0; overflow: hidden; }
header .meta { flex: 1 1 auto; justify-content: flex-end; min-width: 0; }

@media (max-width: 560px) {
  /* Le titre cede la place ; le statut reste, tronque au besoin — c'est lui
     qui dit si l'agent travaille. */
  header .title { display: none; }
  #model { max-width: 130px; }
  #status { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #user { display: none; }
}

/* ------------------------------------------- onglets et taches planifiees */

.tabs { display: flex; gap: 4px; margin-top: 10px; }

.tab {
  flex: 1;
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 400;
}

.tab.active { color: var(--accent); border-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }

#cron-panel { flex: 1; overflow-y: auto; padding: 8px; }

.cron-add { width: 100%; margin-bottom: 10px; padding: 9px; font-size: 13px; }

.cron-empty { color: var(--muted); font-size: 12px; padding: 12px 4px; text-align: center; }

.cron-item {
  border: 1px solid var(--line);
  border-left: 3px solid #7fc98b;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: #15130e;
}

/* Une tache en pause ne doit pas se confondre avec une tache active. */
.cron-item.paused { border-left-color: var(--muted); opacity: 0.7; }

.cron-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.cron-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

.cron-prompt {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  /* La consigne peut etre longue : deux lignes suffisent en apercu. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cron-buttons { display: flex; gap: 6px; margin-top: 9px; }

.cron-buttons button {
  flex: 1;
  font-size: 11px;
  padding: 6px 4px;
}

button.secondary {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.secondary:hover { color: var(--text); border-color: var(--muted); }
button.secondary.danger:hover { color: var(--err); border-color: var(--err); }

/* --------------------------------------------- formulaire de nouvelle tache */

#cron-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 20px;
}

#cron-form {
  width: 100%;
  max-width: 420px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

#cron-form h2 { margin: 0 0 14px; font-size: 17px; }
#cron-form select { width: 100%; padding: 11px; font: inherit; color: var(--text);
  background: #0d0b08; border: 1px solid var(--line); border-radius: 8px; }
#cron-form select option { background: var(--panel); }
#cron-form textarea { resize: vertical; }

.cron-actions { display: flex; gap: 8px; margin-top: 18px; }
.cron-actions button { flex: 1; padding: 11px; }

#cron-error { color: var(--err); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* Pastille sur l'onglet Taches : l'agent en a cree/modifie une pendant que le
   panneau etait ferme. */
.tab.dirty::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* -------------------------------------- historique des executions d'une tache */

/* Le nom de la tache devient un bouton : garder l'apparence d'un titre. */
.cron-name {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.cron-name:hover { color: var(--accent); }

.cron-runs {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.cron-run {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  margin-bottom: 5px;
  font: inherit;
  font-size: 11px;
  font-weight: 400;
}

.cron-run:hover { background: #221d15; border-color: var(--muted); }

.run-when { color: var(--accent); }

.run-preview {
  color: var(--muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------- barre de saisie : saisie / vocal */

#composer { flex-direction: column; gap: 0; }

#composer-idle,
#composer-rec {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

/* Quatre controles doivent tenir sur 375 px : les boutons sont compacts et
   sans bordure, seul le bouton d'envoi reste plein. */
#attach {
  width: 36px;
  flex: 0 0 36px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  min-height: 42px;
  padding: 0;
}

#attach:hover:not(:disabled) { color: var(--text); }
#attach:disabled { opacity: 0.4; }

/* Le champ prime : il absorbe l'espace restant et peut se reduire. */
#composer-idle #text { flex: 1 1 auto; min-width: 0; }

#composer-idle #mic,
#composer-idle #send {
  width: 40px;
  flex: 0 0 40px;
  min-height: 42px;
  font-size: 17px;
}

#composer-idle #mic { background: none; border: 0; }
#composer-idle #mic:hover:not(:disabled) { color: var(--accent); }

/* ------------------------------------------- mode enregistrement (vocal) */

#composer-rec {
  align-items: center;
  min-height: 44px;
}

#rec-cancel,
#rec-stop {
  width: 40px;
  flex: 0 0 40px;
  min-height: 40px;
  border: 0;
  font-size: 17px;
}

#rec-cancel { background: none; color: var(--muted); }
#rec-cancel:hover { color: var(--err); }
#rec-stop { background: var(--accent); color: #1a1200; }

/* Point rouge qui pulse : l'enregistrement est en cours. */
.rec-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--err);
  animation: pulse 1.2s ease-in-out infinite;
}

#rec-time {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text);
  flex: 0 0 auto;
}

/* Forme d'onde : barres alimentees par le niveau sonore reel. */
#rec-wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  overflow: hidden;
}

.wave-bar {
  flex: 1;
  min-width: 2px;
  height: 10%;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.75;
  transition: height 0.09s linear;
}

@media (prefers-reduced-motion: reduce) {
  .rec-dot { animation: none; }
  .wave-bar { transition: none; }
}

/* ------------------------------------------------------- pieces jointes */

#attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
  background: var(--panel);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 8px 5px 10px;
  background: #0d0b08;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.chip.uploading { opacity: 0.6; }

.chip-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-meta { color: var(--muted); font-size: 11px; }

.chip-remove {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  min-height: auto;
}

.chip-remove:hover { color: var(--err); }

/* Retour visuel pendant un glisser-deposer de fichiers. */
#chat.dragging::after {
  content: "Déposez pour joindre";
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(18, 16, 12, 0.85);
  border: 2px dashed var(--accent);
  color: var(--accent);
  font-size: 15px;
  pointer-events: none;
}

/* --------------------------- consommation, stop, copie, skills, slash */

/* Indicateur de contexte dans l'en-tete. */
#usage {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 8px;
  min-height: 26px;
}

#usage.warn { color: var(--accent); border-color: var(--accent); }

/* Bouton d'interruption : prend la place de l'envoi pendant un tour. */
#stop {
  width: 40px;
  flex: 0 0 40px;
  min-height: 42px;
  background: var(--err);
  color: #fff;
  font-size: 14px;
}

#stop:hover { opacity: 0.85; }

/* Copier une reponse : discret, revele au survol du message. */
.msg.agent { position: relative; }

.copy-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  padding: 2px 6px;
  min-height: 24px;
  opacity: 0;
  transition: opacity 0.15s;
}

.msg.agent:hover .copy-btn,
.copy-btn:focus { opacity: 1; }

/* Sur mobile il n'y a pas de survol : le bouton reste visible, en retrait. */
@media (hover: none) {
  .copy-btn { opacity: 0.5; }
}

/* --------------------------------------------- actions d'une conversation */

/* Les actions se superposent a la ligne plutot que de la retrecir : sinon les
   titres sont tronques a gauche sur un panneau de 300 px. */
.session-row { position: relative; margin-bottom: 4px; }
.session-row .session-item { width: 100%; margin-bottom: 0; padding-right: 52px; }

.session-actions {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.session-row:hover .session-actions { opacity: 1; }
@media (hover: none) { .session-actions { opacity: 0.55; } }

.session-actions button {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 5px;
  min-height: 22px;
}

.session-actions button:hover { color: var(--text); }
.session-actions button.danger:hover { color: var(--err); }

/* ------------------------------------------------- commandes slash (/) */

#slash-menu {
  max-height: 240px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.slash-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 9px 14px;
}

.slash-item.active,
.slash-item:hover { background: #221d15; }

.slash-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
  flex: 0 0 auto;
}

.slash-desc {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Un skill se distingue d'une commande systeme par sa categorie. */
.slash-item.is-skill .slash-name { color: #b0a6f0; }

.slash-badge {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
}
