/* DA « Biomorphic Glow » — voir Documents/DA/DESIGN.MD
   Sombre d'abord, lumière diffuse, formes organiques, typographie aérée. */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --void: #050505;
  --surface: #101010;
  --elevated: #181818;
  --hover: #1f1f1f;
  --line: rgb(255 255 255 / 0.06);
  --line-strong: rgb(255 255 255 / 0.12);

  --ivory: #f7f5f2;
  --text: #f7f5f2;
  --text-soft: rgb(247 245 242 / 0.72);
  --text-muted: rgb(247 245 242 / 0.48);

  --lavender: #bfa8ff;
  --purple: #8d7cff;
  --blue: #a8d9ff;
  --cream: #fff2e4;
  --glow-purple: #c7b7ff;
  --danger: #ffb4c0;

  --glow: 0 0 0 1px rgb(191 168 255 / 0.35), 0 0 28px rgb(191 168 255 / 0.18);
  --glow-soft: 0 0 40px rgb(191 168 255 / 0.12);

  --r-sm: 14px;
  --r: 24px;
  --r-lg: 32px;
  --pill: 999px;

  --font: "Geist", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 288px;
  /* Grain de film (bruit SVG), partagé par le fond de l'app et la connexion. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font: 300 16px/1.55 var(--font);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}

/* Fond : membrane lumineuse sur le bord droit (DA, bg-hero-left-top),
   sous un voile qui la retient là où s'affiche la conversation, puis grain. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, var(--void) 0%, rgb(5 5 5 / 0.92) 40%, rgb(5 5 5 / 0.6) 72%, rgb(5 5 5 / 0.3) 100%),
    url("img/bg-app.webp") right top / cover no-repeat,
    var(--void);
}
/* Écran en hauteur : version portrait, lumière en haut à droite seulement. */
@media (max-aspect-ratio: 1/1) {
  body::before {
    background:
      linear-gradient(180deg, rgb(5 5 5 / 0.35) 0%, rgb(5 5 5 / 0.75) 30%, var(--void) 45%),
      url("img/bg-app-mobile.webp") right top / cover no-repeat,
      var(--void);
  }
}
body::after {
  /* Derrière l'interface : le grain ne se mélange qu'au fond, sans recalcul de l'UI animée. */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.09; mix-blend-mode: overlay;
  background-image: var(--grain);
}

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::selection { background: rgb(191 168 255 / 0.35); color: var(--ivory); }
:focus-visible { outline: none; box-shadow: var(--glow); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-muted); }
.small { font-size: 0.84rem; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 42px; padding: 0 1.25rem;
  border: 1px solid transparent; border-radius: var(--pill);
  background: none; color: var(--text-soft);
  font: inherit; font-weight: 400; letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), box-shadow 0.45s var(--ease), border-color 0.35s var(--ease);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--ivory); color: var(--void); font-weight: 500; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 32px rgb(247 245 242 / 0.25), 0 0 64px rgb(191 168 255 / 0.25); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn-outline { border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: rgb(191 168 255 / 0.4); box-shadow: var(--glow-soft); }
.btn-danger:hover:not(:disabled) { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 0.9rem; font-size: 0.86rem; }
.btn-icon { width: 42px; min-width: 42px; padding: 0; color: var(--text-muted); }
.btn-icon:hover:not(:disabled) { background: var(--hover); color: var(--text); }

.select {
  min-height: 36px; padding: 0 2rem 0 1rem; max-width: 15rem;
  border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f5f2' stroke-opacity='.5' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 0.7rem center / 14px no-repeat;
  color: var(--text-soft); font: inherit; font-size: 0.86rem; letter-spacing: 0.02em;
  appearance: none; cursor: pointer;
  transition: border-color 0.35s var(--ease), box-shadow 0.45s var(--ease);
}
.select:hover { border-color: var(--line-strong); }
.select option { background: var(--elevated); color: var(--text); }

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem; margin: 0;
  font-size: 1.15rem; font-weight: 500; letter-spacing: 0.08em; text-transform: lowercase; color: var(--ivory);
}
.brand-mark { width: 30px; height: 30px; }

.form-error { min-height: 1.25rem; margin: 0.5rem 0 0; color: var(--danger); font-size: 0.88rem; }

/* ── Connexion ───────────────────────────────────────────── */
.login {
  position: relative; min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: url("img/bg-login.webp") center / cover no-repeat, var(--void);
}
.login::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgb(5 5 5 / 0.55), rgb(5 5 5 / 0.05) 75%);
}
/* Le fond de connexion couvre celui de la page : il reçoit son propre grain. */
.login::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.18; mix-blend-mode: overlay; background-image: var(--grain);
}
@media (max-aspect-ratio: 1/1) {
  .login { background-image: url("img/bg-login-mobile.webp"); }
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 48px 40px 40px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: rgb(16 16 16 / 0.82); box-shadow: var(--glow-soft);
  text-align: center;
}
.login-orb { display: block; width: 96px; height: 96px; margin: 0 auto 16px; animation: breathe 6s var(--ease) infinite; }
.login-card .brand { display: flex; justify-content: center; }
.login-title { margin: 0.5rem 0 2rem; font-size: 0.95rem; font-weight: 300; letter-spacing: 0.02em; color: var(--text-muted); }
.field-label { display: block; margin-bottom: 0.5rem; font-size: 0.78rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.login-card .field-label { text-align: left; }
.login-card input {
  width: 100%; min-height: 48px; padding: 0 1.1rem;
  border: 1px solid var(--line-strong); border-radius: var(--pill);
  background: var(--void); color: var(--text); font: inherit;
  transition: box-shadow 0.45s var(--ease), border-color 0.35s var(--ease);
}
.login-card input:focus { outline: none; border-color: transparent; box-shadow: var(--glow); }
.login-card .btn { margin-top: 1rem; min-height: 48px; }

/* ── Disposition ─────────────────────────────────────────── */
.shell { display: flex; height: 100%; height: 100dvh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgb(10 10 10 / 0.78); border-right: 1px solid var(--line);
}
.sidebar-top { padding: 24px 16px 16px; display: grid; gap: 12px; }
.sidebar-top .brand { padding: 0 8px 12px; }
.conv-list-wrap { flex: 1; overflow-y: auto; padding: 8px; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv-item {
  display: block; width: 100%; padding: 0.6rem 0.9rem; margin-bottom: 2px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted);
  font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}
.conv-item:hover { background: var(--hover); color: var(--text); }
.conv-item[aria-current="true"] { background: var(--elevated); color: var(--text); box-shadow: inset 2px 0 0 var(--lavender); }
.conv-empty { padding: 0.75rem 0.9rem; font-size: 0.86rem; }
.sidebar-bottom { padding: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px; }

.usage { padding: 14px 16px; border-radius: var(--r); background: var(--surface); font-size: 0.8rem; color: var(--text-muted); }
.usage-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.7rem; }
.usage-percent { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.02em; color: var(--ivory); text-transform: none; }
.usage-bar { height: 4px; border-radius: var(--pill); background: var(--line-strong); overflow: hidden; }
.usage-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--lavender), var(--cream));
  box-shadow: 0 0 12px rgb(191 168 255 / 0.6);
  transition: width 0.6s var(--ease);
}
.usage-fill.is-high { background: linear-gradient(90deg, var(--lavender), var(--danger)); }
.usage-detail { margin: 0.6rem 0 0; font-size: 0.76rem; }

.profile-btn { position: relative; justify-content: flex-start; }
.profile-dot {
  position: absolute; top: 50%; right: 16px; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--lavender); box-shadow: 0 0 10px var(--lavender); animation: pulse 2.4s var(--ease) infinite;
}

.scrim { display: none; }

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

.topbar { display: flex; align-items: center; gap: 0.5rem; padding: 14px 24px; }
.menu-toggle { display: none; }
.conv-title {
  flex: 1; min-width: 0; margin: 0;
  font-size: 0.95rem; font-weight: 400; letter-spacing: 0.02em; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* Posées sur la lumière du fond : un léger fond sombre les garde lisibles. */
.topbar-actions .btn-icon { background: rgb(5 5 5 / 0.55); color: var(--text-soft); }

/* ── Accueil ─────────────────────────────────────────────── */
.messages { flex: 1; overflow-y: auto; padding: 24px 24px 16px; scroll-behavior: smooth; }
.messages > * { max-width: 760px; margin-left: auto; margin-right: auto; }

.welcome { padding-top: 5vh; text-align: center; animation: rise 0.6s var(--ease) both; }
.welcome-orb { display: block; width: 132px; height: 132px; margin: 0 auto 8px; filter: drop-shadow(0 0 32px rgb(191 168 255 / 0.25)); animation: breathe 7s var(--ease) infinite; }
.welcome h2 { margin: 0 0 0.6rem; font-size: 2.1rem; font-weight: 400; letter-spacing: 0.02em; }
.welcome p { margin: 0 auto 2rem; max-width: 34rem; color: var(--text-muted); }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; text-align: left; }
.mode-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r);
  background: rgb(16 16 16 / 0.7); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.4s var(--ease), background-color 0.4s var(--ease), box-shadow 0.5s var(--ease);
}
.mode-card .icon { grid-row: span 2; width: 22px; height: 22px; color: var(--text-muted); transition: color 0.4s var(--ease); }
.mode-card:hover { border-color: var(--line-strong); background: var(--surface); }
.mode-card:hover .icon { color: var(--lavender); }
.mode-card[aria-checked="true"] {
  border-color: rgb(191 168 255 / 0.35);
  background: radial-gradient(120% 140% at 0% 0%, rgb(191 168 255 / 0.14), rgb(16 16 16 / 0.9) 60%);
  box-shadow: var(--glow-soft);
}
.mode-card[aria-checked="true"] .icon { color: var(--lavender); }
.mode-label { font-weight: 400; font-size: 0.92rem; letter-spacing: 0.01em; line-height: 1.3; }
.mode-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }

.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 32px; }
.suggestion {
  padding: 0.6rem 1.1rem; border: 1px solid var(--line); border-radius: var(--pill);
  background: transparent; color: var(--text-soft); font: inherit; font-size: 0.88rem; letter-spacing: 0.02em;
  cursor: pointer; transition: border-color 0.4s var(--ease), color 0.4s var(--ease), box-shadow 0.5s var(--ease);
}
.suggestion:hover { border-color: rgb(191 168 255 / 0.35); color: var(--text); box-shadow: var(--glow-soft); }

.profile-hint { font-size: 0.88rem; }
.link-btn { padding: 0; border: 0; background: none; color: var(--lavender); font: inherit; text-decoration: underline; text-decoration-color: rgb(191 168 255 / 0.4); text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { text-decoration-color: var(--lavender); }

/* ── Messages ────────────────────────────────────────────── */
.msg { margin-bottom: 32px; }
.msg.is-new { animation: rise 0.45s var(--ease) both; }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .msg-body {
  max-width: 85%; padding: 14px 20px; border-radius: var(--r) var(--r) 8px var(--r);
  background: var(--elevated); color: var(--text); font-weight: 350;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%;
  padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--surface); font-size: 0.8rem; color: var(--text-soft);
}
.file-chip .icon { width: 14px; height: 14px; color: var(--lavender); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { display: inline-flex; border: 0; padding: 0; background: none; color: var(--text-muted); cursor: pointer; }
.file-chip button:hover { color: var(--text); }

.msg-assistant .msg-body { font-size: 1.02rem; font-weight: 320; line-height: 1.75; color: rgb(247 245 242 / 0.9); overflow-wrap: anywhere; }
.msg-body > :first-child { margin-top: 0; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body strong { font-weight: 500; color: var(--ivory); }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 { font-weight: 500; letter-spacing: 0.02em; line-height: 1.3; margin: 1.6em 0 0.6em; color: var(--ivory); }
.msg-body h1 { font-size: 1.3rem; }
.msg-body h2 { font-size: 1.15rem; }
.msg-body h3, .msg-body h4 { font-size: 1rem; }
.msg-body p, .msg-body ul, .msg-body ol { margin: 0 0 1em; }
.msg-body li { margin-bottom: 0.3em; }
.msg-body li::marker { color: var(--lavender); }
.msg-body blockquote { margin: 0 0 1em; padding: 0.2em 1.2em; border-left: 2px solid var(--lavender); color: var(--text-soft); }
.msg-body code { font-family: var(--font-mono); font-size: 0.86em; padding: 0.15em 0.4em; border-radius: 6px; background: var(--elevated); color: var(--cream); }
.msg-body pre {
  position: relative; padding: 16px 104px 16px 20px; /* place du bouton Copier */ border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  white-space: pre-wrap; overflow-wrap: anywhere; /* équations lisibles d'un bloc */
}
.code-copy {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--elevated); color: var(--text-muted); font: inherit; font-size: 0.74rem; letter-spacing: 0.04em;
  cursor: pointer; opacity: 0; transition: opacity 0.4s var(--ease), color 0.35s var(--ease);
}
.code-copy .icon { width: 13px; height: 13px; }
.msg-body pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--text); }
@media (hover: none) { .code-copy { opacity: 1; } }
.msg-body pre code { padding: 0; background: none; }
.msg-body table { display: block; overflow-x: auto; border-collapse: collapse; margin-bottom: 1em; font-size: 0.9rem; }
.msg-body th, .msg-body td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line-strong); text-align: left; vertical-align: top; }
.msg-body th { font-weight: 500; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.msg-body a { color: var(--blue); text-decoration-color: rgb(168 217 255 / 0.35); text-underline-offset: 3px; }
.msg-body hr { border: 0; height: 1px; margin: 2em 0; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }

.msg-meta { display: flex; align-items: center; gap: 4px; margin-top: 10px; opacity: 0.6; transition: opacity 0.4s var(--ease); }
.msg:hover .msg-meta { opacity: 1; }
.msg-meta .btn { min-height: 32px; padding: 0 0.75rem; font-size: 0.8rem; }
.msg-note { margin-top: 0.75rem; font-size: 0.84rem; color: var(--text-muted); font-style: italic; }

.msg-sources { margin-top: 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-sm); background: rgb(16 16 16 / 0.7); font-size: 0.86rem; }
.msg-sources summary { cursor: pointer; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.msg-sources ol { margin: 0.75rem 0 0; padding-left: 1.4rem; }
.msg-sources li { margin-bottom: 0.35rem; overflow-wrap: anywhere; }
.msg-sources li::marker { color: var(--text-muted); }
.msg-sources a { color: var(--blue); text-decoration: none; }
.msg-sources a:hover { text-decoration: underline; text-underline-offset: 3px; }

.search-status { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; font-size: 0.84rem; color: var(--text-muted); }
.search-status .icon { width: 15px; height: 15px; color: var(--blue); animation: pulse 1.8s var(--ease) infinite; }

/* Fichiers produits par les calculs de Claude. */
.msg-outputs { display: grid; gap: 12px; margin-top: 16px; }
.msg-outputs .msg-files { justify-content: flex-start; margin: 0; }
.out-figure { margin: 0; }
.out-figure img {
  display: block; max-width: 100%; max-height: 560px; width: auto; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--ivory); /* graphiques matplotlib : fond clair d'origine */
}
.out-figure figcaption { margin-top: 6px; }
.out-download, .file-chip-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.8rem; text-decoration: none; transition: color 0.35s var(--ease), border-color 0.35s var(--ease); }
.out-download .icon { width: 14px; height: 14px; }
.out-download:hover, .file-chip-link:hover { color: var(--text); }
.file-chip-link:hover { border-color: rgb(191 168 255 / 0.4); }

/* Notes de mémoire prises pendant la réponse. */
.msg-memory { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 14px; font-size: 0.82rem; color: var(--text-muted); }
.msg-memory .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--lavender); }
.msg-memory ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.msg-memory strong { font-weight: 400; color: var(--text-soft); }

/* Indicateur « Claude réfléchit » : un orbe qui respire. */
.thinking { display: inline-flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--text-muted); letter-spacing: 0.02em; }
.thinking-orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--ivory), var(--lavender) 45%, var(--purple) 75%, transparent 100%);
  box-shadow: 0 0 16px rgb(191 168 255 / 0.7);
  animation: breathe 1.8s var(--ease) infinite;
}

/* ── Saisie ──────────────────────────────────────────────── */
.composer { padding: 0 24px calc(16px + env(safe-area-inset-bottom)); }
.composer > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin-bottom: 8px; }
.attachments:empty { display: none; }
.composer-box {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: rgb(16 16 16 / 0.92);
  transition: border-color 0.4s var(--ease), box-shadow 0.5s var(--ease);
}
.composer-box:focus-within { border-color: transparent; box-shadow: var(--glow); }
.composer-box.is-dragging { border-color: var(--lavender); border-style: dashed; box-shadow: var(--glow-soft); }
.composer textarea {
  flex: 1; min-height: 42px; max-height: 40vh; padding: 10px 4px;
  border: 0; outline: none; resize: none; background: none;
  color: var(--text); font: inherit; font-weight: 350; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:focus-visible { box-shadow: none; } /* la lueur est portée par .composer-box */
.btn-send { width: 42px; min-width: 42px; padding: 0; }
.btn-send .icon { width: 20px; height: 20px; }
.btn-stop { background: var(--elevated); color: var(--ivory); border-color: var(--line-strong); }
.btn-stop .icon { width: 14px; height: 14px; fill: currentColor; }

.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.select-sm { min-height: 34px; font-size: 0.82rem; }
.toggle {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 34px; padding: 0 1rem;
  border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface);
  color: var(--text-muted); font: inherit; font-size: 0.82rem; letter-spacing: 0.02em; cursor: pointer;
  transition: border-color 0.4s var(--ease), color 0.4s var(--ease), box-shadow 0.5s var(--ease), background-color 0.4s var(--ease);
}
.toggle .icon { width: 15px; height: 15px; }
.toggle:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.toggle.is-on {
  border-color: rgb(168 217 255 / 0.4); color: var(--blue);
  background: radial-gradient(120% 200% at 0% 50%, rgb(168 217 255 / 0.14), var(--surface) 70%);
  box-shadow: 0 0 24px rgb(168 217 255 / 0.14);
}
.toggle:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Fiche « Mon mémoire » ───────────────────────────────── */
.dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text);
  box-shadow: 0 0 80px rgb(141 124 255 / 0.15);
}
.dialog[open] { animation: rise 0.45s var(--ease) both; }
.dialog::backdrop { background: rgb(5 5 5 / 0.72); }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.dialog-head { padding: 32px 32px 8px; }
.dialog-head h2 { margin: 0 0 0.5rem; font-size: 1.4rem; font-weight: 400; letter-spacing: 0.02em; }
.dialog-head p { margin: 0; }
.dialog-body { overflow-y: auto; padding: 16px 32px; display: grid; gap: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 32px 24px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field input, .field textarea {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--void); color: var(--text); font: inherit; font-size: 0.93rem; font-weight: 350; resize: vertical;
  transition: box-shadow 0.45s var(--ease), border-color 0.35s var(--ease);
}
.field input:focus, .field textarea:focus { outline: none; border-color: transparent; box-shadow: var(--glow); }
.field ::placeholder { color: var(--text-muted); opacity: 0.7; }

.memory-panel { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.memory-panel p { margin: 0; }
.memory-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.memory-head h3 { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; }
.memory-head h3 .icon { width: 15px; height: 15px; color: var(--lavender); }
.memory-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.memory-note {
  display: flex; align-items: center; gap: 8px; padding: 0.5rem 0.5rem 0.5rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--void);
  font-size: 0.88rem; font-weight: 350; color: var(--text-soft);
}
.memory-note span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.memory-note .btn-icon { width: 32px; min-width: 32px; min-height: 32px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 7rem; transform: translateX(-50%); z-index: 50;
  padding: 0.7rem 1.3rem; border: 1px solid var(--line-strong); border-radius: var(--pill);
  background: var(--elevated); color: var(--text); font-size: 0.88rem; letter-spacing: 0.02em;
  box-shadow: 0 0 40px rgb(191 168 255 / 0.18);
  animation: rise 0.4s var(--ease) both;
}

/* ── Mouvement : lent, respirant ─────────────────────────── */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    width: min(85vw, var(--sidebar-w)); background: var(--surface);
    transform: translateX(-100%); transition: transform 0.45s var(--ease);
  }
  .sidebar.is-open { transform: none; box-shadow: 0 0 80px rgb(0 0 0 / 0.8); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(5 5 5 / 0.7); }
  .scrim[hidden] { display: none !important; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 12px; }
  .select { max-width: 9.5rem; }
  .topbar-actions .btn-sm { padding: 0 0.55rem; }
  .messages { padding: 16px; }
  .composer { padding-left: 16px; padding-right: 16px; }
  .msg-user .msg-body { max-width: 92%; }
  .welcome h2 { font-size: 1.7rem; }
  .welcome-orb { width: 96px; height: 96px; }
  .mode-cards { grid-template-columns: 1fr 1fr; }
  .mode-card { padding: 12px 14px; }
  .mode-desc { display: none; }
  .mode-card .icon { grid-row: auto; }
  .field-row { grid-template-columns: 1fr; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 20px; padding-right: 20px; }
  .login-card { padding: 40px 24px 32px; }
}

@media (max-width: 520px) {
  #rename-chat, #export-chat { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
