/* ============================================================
   AEXIUM AI — Chat · Thème AEXIUM LABS
   Palette : navy #05080f / #0a101f · encre #f0f4fa
             cyan #22d3ee (signature) · bleu #2563eb
             violet #8b5cf6 · or antique #c9a227 (touches premium)
   ============================================================ */

:root {
  --bg0: #05080f;
  --bg1: #0a101f;
  --bg2: #101a30;
  --bg3: #16223d;
  --ink: #f0f4fa;
  --ink-dim: #b8c2d4;
  --ink-faint: #6b7a94;
  --cyan: #22d3ee;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --gold: #c9a227;
  --violet: #8b5cf6;
  --violet-deep: #6a5bb8;
  --violet-neon: #c084fc;
  --danger: #e06c6c;
  --ok: #7fd08f;
  --border: #1d2a4d;
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg0);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hidden { display: none !important; }

/* Sécurité : l'attribut hidden gagne toujours sur les display des composants. */
[hidden] { display: none !important; }

/* Focus bien visible (accessibilité) */
:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============ Boutons ============ */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #1a1408;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--ink-dim);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--ink); }

.btn-danger {
  background: var(--danger);
  color: #2a0d0d;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-block { width: 100%; display: block; }

.btn[disabled] { opacity: 0.55; cursor: wait; }

.btn .btn-spinner {
  display: none;
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
  margin-left: 0.5em;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading .btn-label { opacity: 0.7; }

@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  min-width: 48px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  font-size: 1.35rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--bg3); color: var(--ink); }

.send-btn {
  background: linear-gradient(135deg, var(--violet-deep), var(--violet));
  color: #fff;
}
.send-btn:hover { filter: brightness(1.12); color: #fff; }

.stop-btn {
  background: var(--danger);
  color: #2a0d0d;
}
.stop-btn:hover { filter: brightness(1.1); color: #2a0d0d; }

/* ============ Écran de connexion ============ */
.screen { min-height: 100dvh; }

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(60rem 30rem at 50% -10%, rgba(143, 127, 224, 0.14), transparent 60%),
    radial-gradient(40rem 24rem at 50% 110%, rgba(211, 171, 99, 0.10), transparent 60%),
    var(--bg0);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.brand { text-align: center; margin-bottom: 1.75rem; }

.brand-mark {
  width: 72px; height: 72px;
  margin: 0 auto 0.9rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 35%, #101a30, #05080f 75%);
  border: 1px solid var(--border);
  box-shadow: 0 0 32px rgba(34, 211, 238, 0.25);
}
.brand-mark svg { width: 44px; height: 44px; display: block; }
.brand-mark-lg { width: 84px; height: 84px; }
.brand-mark-lg svg { width: 52px; height: 52px; }

.brand-name {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  background: linear-gradient(120deg, var(--cyan), #f0d9a8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { margin: 0.4rem 0 0; color: var(--ink-dim); font-size: 1rem; }

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  color: var(--ink);
}
.field input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  min-height: 52px;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus {
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 0 3px rgba(211, 171, 99, 0.25);
}

.form-error {
  background: rgba(224, 108, 108, 0.12);
  border: 1px solid rgba(224, 108, 108, 0.5);
  color: #f0a8a8;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
}

.login-hint {
  margin: 1.1rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ============ Coquille applicative ============ */
#app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ---- Barre latérale ---- */
#sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.side-head { padding: 1rem 1rem 0.6rem; }

.search-wrap { margin-top: 0.7rem; }
.search-wrap input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  min-height: 46px;
}
.search-wrap input::placeholder { color: var(--ink-faint); }
.search-wrap input:focus { border-color: var(--violet); outline: none; }

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.6rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.conv-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  padding: 0.9rem 0.6rem 0.35rem;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.25rem;
}
.conv-item:hover { background: var(--bg2); }
.conv-item.active { background: var(--bg3); box-shadow: inset 3px 0 0 var(--cyan); }

.conv-title-btn {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  padding: 0.65rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-actions { display: flex; gap: 0.1rem; opacity: 0; }
.conv-item:hover .conv-actions,
.conv-item:focus-within .conv-actions,
.conv-item.active .conv-actions { opacity: 1; }

.mini-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 8px;
  color: var(--ink-dim);
  font-size: 1rem;
  cursor: pointer;
}
.mini-btn:hover { background: var(--bg3); color: var(--ink); }
.mini-btn.danger:hover { background: rgba(224,108,108,0.15); color: var(--danger); }

.conv-rename-input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg0);
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 0.55rem 0.6rem;
}

.conv-empty {
  color: var(--ink-faint);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 1rem;
}

.side-foot {
  border-top: 1px solid var(--border);
  padding: 0.9rem 1rem;
}
.user-chip {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 0.8rem;
}
.user-avatar {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.2rem;
}
.user-meta { min-width: 0; }
.user-meta strong { display: block; font-size: 0.98rem; }
.user-meta small {
  display: block; color: var(--ink-faint); font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 30;
}

/* ---- Zone principale ---- */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg0);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg1);
}

#btn-menu { display: none; }

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.persona-select {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  min-height: 44px;
  max-width: 11rem;
  cursor: pointer;
}
.persona-select:focus { border-color: var(--violet); outline: none; }

/* ---- Fil de discussion ---- */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.messages {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.msg { display: flex; flex-direction: column; gap: 0.35rem; }
.msg-user { align-items: flex-end; }
.msg-assistant { align-items: flex-start; }

.msg-author {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.msg-user .msg-author { color: var(--violet); }
.msg-assistant .msg-author { color: var(--cyan); }

.bubble {
  max-width: 100%;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  overflow-wrap: break-word;
  word-break: break-word;
}
.msg-user .bubble {
  background: linear-gradient(135deg, rgba(143,127,224,0.22), rgba(143,127,224,0.12));
  border: 1px solid rgba(143,127,224,0.35);
  border-bottom-right-radius: 4px;
  max-width: 85%;
}
.msg-assistant .bubble {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  width: 100%;
}

.bubble p { margin: 0 0 0.8em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 0.8em; padding-left: 1.5rem; }
.bubble li { margin-bottom: 0.3em; }
.bubble a { color: var(--cyan); }
.bubble strong { color: #fff; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  margin: 0.9em 0 0.5em;
  line-height: 1.3;
}
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }
.bubble blockquote {
  margin: 0 0 0.8em;
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 3px solid var(--violet);
  color: var(--ink-dim);
}

/* Blocs de code */
.codeblock {
  margin: 0.8em 0;
  background: #050509;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.codeblock-head button {
  background: none; border: 1px solid var(--border);
  color: var(--ink-dim);
  font: inherit; font-size: 0.8rem;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  min-height: 36px;
}
.codeblock-head button:hover { color: var(--cyan); border-color: var(--blue); }
.codeblock pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.5;
}
.codeblock code { font-family: inherit; }
.bubble code.inline {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(143,127,224,0.15);
  border: 1px solid rgba(143,127,224,0.25);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

/* Curseur de frappe pendant le streaming */
.streaming-caret::after {
  content: "▍";
  color: var(--cyan);
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.msg-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  min-height: 38px;
  cursor: pointer;
}
.tool-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.tool-btn.active { color: var(--cyan); border-color: var(--blue); }

.msg-stats {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ---- État vide ---- */
.empty-state {
  max-width: 560px;
  margin: 6vh auto 0;
  padding: 0 1.5rem 2rem;
  text-align: center;
}
.empty-state h3 { font-size: 1.6rem; margin: 0.6rem 0 0.4rem; }
.empty-state p { color: var(--ink-dim); margin: 0 0 1.4rem; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}
.chip {
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  min-height: 48px;
  cursor: pointer;
}
.chip:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---- Zone de saisie ---- */
.composer-wrap {
  border-top: 1px solid var(--border);
  background: var(--bg1);
  padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
}
.composer {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}
.composer:focus-within { border-color: var(--violet); }

#input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  resize: none;
  padding: 0.7rem 0.5rem;
  max-height: 200px;
  line-height: 1.5;
  overflow-y: hidden; /* auto-resize : jamais de scrollbar */
}
#input::placeholder { color: var(--ink-faint); }
#input:focus { outline: none; }

.plus-item.listening .plus-ico {
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---- Menu "+" du compositeur ---- */
.plus-wrap { position: relative; }
#btn-plus { transition: transform 0.18s ease; }
#btn-plus[aria-expanded="true"] { transform: rotate(45deg); color: var(--cyan); }
.plus-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 230px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  padding: 0.35rem;
  z-index: 60;
  animation: plus-pop 0.16s ease-out;
  transform-origin: bottom left;
}
@keyframes plus-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.plus-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
}
.plus-item:hover, .plus-item:focus-visible { background: var(--bg3); outline: none; }
.plus-ico { font-size: 1.15rem; width: 1.6rem; text-align: center; }
.plus-label { flex: 1; }
.plus-item.listening .plus-ico { animation: pulse 1.2s ease-in-out infinite; }
.plus-item.listening .plus-label { color: var(--danger); }

/* ---- Épinglé / archivé ---- */
.mini-btn.active { color: var(--cyan); }
.msg-thumb {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}
.conv-group-label.pinned-label { color: var(--cyan); }
.count-badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.1em 0.4em;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--ink-dim);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.archived-list { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.35rem; }
.archived-list .conv-item { opacity: 0.75; }
.archived-empty { font-size: 0.85rem; color: var(--ink-faint); padding: 0.4rem 0.2rem; }

.composer-hint {
  max-width: 820px;
  margin: 0.45rem auto 0;
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ---- Modale ---- */
.modal-root {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal h3 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.modal p { margin: 0 0 1.4rem; color: var(--ink-dim); }
.modal-actions { display: flex; gap: 0.7rem; justify-content: flex-end; }
.modal-actions .btn { min-width: 120px; }

/* ---- Toasts ---- */
.toast-root {
  position: fixed;
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-size: 0.92rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ============ Mobile : tiroir ============ */
@media (max-width: 900px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 24px 0 60px rgba(0,0,0,0.5);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-scrim[hidden] { display: none; }
  #btn-menu { display: inline-flex; }
  .conv-actions { opacity: 1; } /* tactile : toujours visibles */
  .messages { padding: 1rem 0.9rem 0.75rem; }
  .msg-user .bubble { max-width: 92%; }
  .persona-select { max-width: 8.5rem; }
  .composer-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Conversation vocale (overlay 100 % local) ---- */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}
.voice-card {
  width: min(420px, calc(100vw - 3rem));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.6rem;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.voice-card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.voice-status { color: var(--muted); min-height: 2.4em; margin: 0 0 0.8rem; }
.voice-transcript {
  max-height: 180px;
  overflow-y: auto;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.voice-transcript:empty { display: none; }
.vt-final { margin: 0.3rem 0; }
.vt-final strong { color: var(--cyan); }
.vt-interim { margin: 0.3rem 0; color: var(--muted); font-style: italic; }
.vt-reply { margin: 0.5rem 0 0.2rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); }
.voice-mic {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: radial-gradient(circle at 35% 30%, #1c2f45, #0b1626);
  font-size: 2.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  margin-bottom: 1rem;
}
.voice-mic:hover { transform: scale(1.06); }
.voice-mic.listening {
  animation: micPulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 8px rgba(34, 211, 238, 0.15);
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.12); }
  50% { box-shadow: 0 0 0 16px rgba(34, 211, 238, 0.04); }
}
.voice-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
}
.voice-note { font-size: 0.82rem; color: var(--muted); margin: 0 0 1rem; }

/* ---- Panneau documents ---- */
.artifacts-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  z-index: 70;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.28s cubic-bezier(0.32, 0.72, 0.24, 1);
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.artifacts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.artifacts-head h3 { margin: 0; font-size: 1.05rem; }
.artifacts-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.art-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
}
.art-tab.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #06222a;
  font-weight: 600;
}
.artifacts-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.art-list { display: flex; flex-direction: column; gap: 0.4rem; }
.art-item {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  width: 100%;
}
.art-item.active { border-color: var(--cyan); }
.art-lang {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  flex-shrink: 0;
}
.art-preview {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.art-view { flex: 1; display: flex; flex-direction: column; min-height: 200px; }
.art-iframe {
  width: 100%;
  flex: 1;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.art-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  font-size: 0.84rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ---- Sortie d'exécution de code ---- */
.code-run-out {
  margin-top: 0.5rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}
.code-run-out pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
}
.doc-code-btn, .run-code-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
}
.doc-code-btn:hover, .run-code-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---- Avatar personnalisé ---- */
.avatar-ph.avatar-custom { padding: 0; overflow: hidden; }
.avatar-ph.avatar-custom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Statistiques d'usage ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat-num { font-size: 1.4rem; font-weight: 700; color: var(--cyan); }
.stat-label { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
