/* src/darkmoon/web/static/css/app.css — interface du site (spec C). Jetons et polices : tokens.css.
   Une section par composant ; aucun style en ligne (CSP stricte). */

/* ===== Base ============================================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--font-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #dbe6ff; }
::placeholder { color: var(--muted); opacity: 1; }

.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); font-size: .86em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link {
  position: absolute; left: var(--s3); top: -60px; z-index: 100;
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--ink); color: #fff;
}
.skip-link:focus { top: var(--s3); }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 28px; height: 28px; }

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: inset -4px -3px 0 0 #93b4ff;
}
.brand.lg { font-size: 26px; }
.brand.lg::before { width: 18px; height: 18px; box-shadow: inset -6px -4px 0 0 #93b4ff; }

/* ===== Boutons ========================================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 38px; padding: 0 var(--s4);
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--soft); color: var(--ink);
  font-weight: 600; font-size: 14px; line-height: 1.1; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { background: var(--soft-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .25); }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: var(--bg); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--err-ink); }
.btn.danger:hover, .btn.armed { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.btn.sm { min-height: 32px; padding: 0 var(--s3); font-size: 13px; border-radius: 9px; }
.btn.lg { min-height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--soft); }
.btn.primary:disabled:hover { background: var(--accent); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line-2); background: var(--bg); }
.icon-btn.xs { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.xs .icon { width: 16px; height: 16px; }
.icon-btn[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.link { padding: 0; border: 0; background: none; color: var(--accent-ink); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ===== Champs ========================================================================================== */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .field input, .field textarea, .field select {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--ink);
  font-size: 14px; font-weight: 400;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { resize: vertical; line-height: 1.55; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
.check { display: inline-flex; align-items: center; gap: var(--s2); font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

/* ===== Pastilles, points d'état, alertes ================================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 10px; border-radius: var(--r-pill); background: var(--soft); color: var(--ink-2);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.pill .icon { width: 14px; height: 14px; }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); white-space: normal; }
.pill.err { background: var(--err-bg); color: var(--err-ink); }
.pill.api { background: var(--accent-soft); color: var(--accent-ink); }

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; color: var(--st-none); }
.dot.start { color: var(--st-start); }
.dot.gen { color: var(--st-gen); }
.dot.ok { color: var(--st-ok); }
.dot.err { color: var(--st-err); }
.dot.pulse { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px color-mix(in srgb, currentColor 0%, transparent); }
}

.alert {
  display: flex; align-items: flex-start; gap: var(--s2);
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.5;
}
.alert .icon { margin-top: 2px; }
.alert.error { background: var(--err-bg); color: var(--err-ink); }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert.info { background: var(--accent-soft); color: var(--accent-ink); }

.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.kbd {
  display: inline-block; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 6px; background: var(--bg); color: var(--ink-2); font: 500 11px/18px var(--font-mono);
}
.skeleton {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--soft) 25%, #f9fafd 50%, var(--soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.skeleton.w60 { width: 60%; }
.skeleton.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Menus =========================================================================================== */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  min-width: 220px; max-width: min(360px, calc(100vw - 24px)); padding: 6px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-2);
  animation: pop var(--t) var(--ease);
}
.menu.menu-right { left: auto; right: 0; }
.menu.menu-up { top: auto; bottom: calc(100% + 8px); }
.menu form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 9px; background: none; color: var(--ink);
  font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--soft); text-decoration: none; }
.menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-item.danger { color: var(--err-ink); }
.menu-item.danger:hover, .menu-item.armed { background: var(--err-bg); color: var(--err-ink); }
.menu-label { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.menu-empty { padding: 10px; font-size: 14px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ===== Fenêtres (dialog natif : rôle, piège du focus, Échap) ============================================ */
dialog { padding: 0; border: 0; background: transparent; color: inherit; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(20, 24, 36, .32); }
.modal { width: min(720px, calc(100vw - 32px)); margin: auto; }
.modal.wide { width: min(980px, calc(100vw - 32px)); }
.modal[open] { animation: pop var(--t) var(--ease); }
.modal-card {
  display: flex; flex-direction: column; max-height: min(88vh, 900px);
  background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: var(--s3); padding: 20px 24px 8px; }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-body { flex: 1 1 auto; min-height: 0; display: grid; align-content: start; gap: var(--s4); padding: var(--s3) 24px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s4) 24px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.modal-foot .grow { font-size: 13px; }

/* ===== Toasts (aria-live) ============================================================================== */
.toasts {
  position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: grid; gap: var(--s2); width: min(520px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  border: 1px solid transparent; border-radius: 14px; background: var(--ink); color: #fff;
  box-shadow: var(--shadow-2); font-size: 14px; pointer-events: auto;
  animation: toast-in var(--t) var(--ease);
}
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast.success > .icon { color: #4ade80; }
.toast.error { background: var(--bg); color: var(--err-ink); border-color: var(--err-line); }
.toast .icon-btn { color: inherit; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .14); color: inherit; }
.toast.error .icon-btn:hover { background: var(--err-bg); }
.toast .btn { min-height: 28px; padding: 0 10px; font-size: 13px; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t), transform var(--t); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ===== Connexion ======================================================================================= */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: var(--s5);
  background: radial-gradient(1100px 520px at 50% -12%, var(--accent-soft), transparent 62%), var(--bg);
}
.login-card {
  width: min(400px, 100%); display: grid; gap: var(--s5); padding: 40px 32px 32px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-1);
}
.login-card header { display: grid; gap: var(--s2); }
.login-form { display: grid; gap: var(--s4); }

/* ===== Barre du haut ================================================================================== */
.topbar {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  height: var(--topbar-h); padding: 0 var(--s4) 0 var(--s5);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .brand { margin-right: var(--s2); }
.topbar-end { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }

/* ===== Corps : barre latérale + zone principale ======================================================= */
.app-body { display: flex; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }

.sidebar {
  flex: none; width: var(--sidebar-w); display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s4) var(--s3); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
}
.new-conv {
  display: flex; align-items: center; gap: var(--s2); padding: 10px 12px;
  border: 1px dashed #cdd6ea; border-radius: 12px; color: var(--accent-ink);
  font-size: 14px; font-weight: 600; transition: background var(--t-fast), border-color var(--t-fast);
}
.new-conv:hover { background: var(--accent-soft); border-color: var(--accent-line); text-decoration: none; }
.new-conv[aria-current="page"] { background: var(--accent-soft); border-style: solid; border-color: var(--accent-line); }
.conv-list { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.conv-item { position: relative; }
.conv-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px;
}
.conv-link:hover { background: var(--soft); text-decoration: none; }
.conv-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-badge {   /* discussion créée par l'API (spec E §9) */
  flex: none; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 700; line-height: 1.7; letter-spacing: .03em;
}
.conv-meta { flex: none; font-size: 12px; color: var(--muted); }
.conv-link[aria-current="page"] .conv-meta { color: var(--accent-ink); }
.conv-item[data-status="queued"] .dot { color: var(--st-start); }
.conv-item[data-status="running"] .dot { color: var(--st-gen); animation: pulse 1.6s var(--ease) infinite; }
.conv-item[data-status="done"] .dot { color: var(--st-ok); }
.conv-item[data-status="error"] .dot { color: var(--st-err); }
.conv-item[data-status="error"] .conv-meta { color: var(--err-ink); }
.conv-actions { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity var(--t-fast); }
.conv-item:hover .conv-actions, .conv-item:focus-within .conv-actions { opacity: 1; }
.conv-item:hover .conv-meta, .conv-item:focus-within .conv-meta { visibility: hidden; }
.conv-actions .icon-btn { background: var(--bg); }
.conv-empty { padding: 4px 10px; }
/* spec D : recherche, groupes par date, type de la première pièce jointe (le point d'état se pose sur l'icône) */
.side-search {
  display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s1); padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--muted);
}
.side-search:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.side-search input {
  flex: 1; min-width: 0; height: 34px; padding: 0; border: 0; outline: none; background: none;
  color: var(--ink); font-size: 14px;
}
.conv-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
.conv-group-label { margin: var(--s3) 10px var(--s1); }
.conv-kind {
  position: relative; display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px;
  color: var(--muted);
}
.conv-kind .dot { position: absolute; right: -3px; bottom: -2px; width: 7px; height: 7px; box-shadow: 0 0 0 2px var(--surface); }
.conv-item[data-status="done"] .conv-kind .dot, .conv-item[data-status="empty"] .conv-kind .dot { display: none; }
.conv-link[aria-current="page"] .conv-kind { color: var(--accent-ink); }

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

.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; overflow-y: auto; padding: var(--s6) var(--s5) var(--s5); }
.chat { max-width: var(--read-w); margin: 0 auto; }
.chat-head {
  display: flex; align-items: flex-start; gap: var(--s3);
  margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line);
}
.chat-head-text { flex: 1; min-width: 0; display: grid; gap: 10px; }
.chat-title { font-family: var(--font-display); font-size: 20px; font-weight: 500; overflow-wrap: anywhere; }

/* ===== Accueil « Que voulez-vous faire ? » (spec D §8) : saisie centrée, modèle et capacités, suggestions ===== */
.home { max-width: var(--read-w); margin: 0 auto; display: grid; gap: var(--s4); padding-top: 8vh; }
.home .hero-title { margin-bottom: var(--s2); text-align: center; font-size: 28px; }
.home .composer { width: 100%; margin: 0; }
.home .composer textarea { min-height: 76px; }
.caps { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cap {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid transparent;
  border-radius: var(--r-pill); background: var(--soft); color: var(--ink-2);
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.cap .icon { width: 14px; height: 14px; }
.cap.no { border-color: var(--line-2); border-style: dashed; background: none; color: var(--muted); text-decoration: line-through; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.suggestion {
  display: grid; gap: 4px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.suggestion:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); }
.model-chip { max-width: 260px; }
.model-chip .ellipsis { min-width: 0; }

/* ===== Cartes de prompts ================================================================================ */
.hero-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.prompt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.prompt-card {
  display: grid; align-content: start; gap: 6px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
button.prompt-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.pc-title { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 700; overflow-wrap: anywhere; }
.pc-text {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: 13px; line-height: 1.5;
}
.prompt-card.run-all { border-style: dashed; border-color: #cdd6ea; background: var(--surface); }
.prompt-card.run-all .pc-title { color: var(--accent-ink); }
.prompt-card.none { grid-column: 1 / -1; justify-items: start; background: var(--surface); }
.prompt-card.loading { opacity: .6; pointer-events: none; }

/* ===== Îlot du pod (toutes les pages) ================================================================== */
.island {
  position: fixed; z-index: 35; right: 20px; bottom: 24px; width: 288px;
  display: grid; gap: 6px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  transition: border-color var(--t), bottom var(--t);
}
body[data-page="conversation"] .island { bottom: calc(var(--composer-h) + 28px); }
.island-head {
  display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 0;
  border: 0; background: none; color: var(--ink); text-align: left;
}
.island-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }
.island-aside { flex: none; color: var(--muted); font: 500 12px var(--font-mono); }
.island[data-state="ready"] .island-aside {
  padding: 1px 8px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-ink);
  font-family: var(--font-text); font-weight: 600;
}
.island-sub { color: var(--muted); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.island-sub.mono { font-size: 11.5px; }
.island[data-state="error"] { border-color: var(--err-line); }
.island[data-state="error"] .island-sub {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--err-ink);
}
.island-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  padding: 3px 10px; border: 1px solid var(--accent-line); border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px;
}
.tag-chip:hover { background: #e2eaff; }
.island-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.island[data-state="none"] .island-actions .btn { flex: 1; }
.bar {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  border: 0; border-radius: 9px; background: var(--soft-2); overflow: hidden;
}
.bar::-webkit-progress-bar { background: var(--soft-2); border-radius: 9px; }
.bar::-webkit-progress-value { background: var(--accent); border-radius: 9px; transition: width var(--t); }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 9px; }

/* ===== Panneau de détails du pod (dialog à droite) ===================================================== */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(380px, 100vw); height: 100%; max-height: 100%; margin: 0; }
.drawer[open] { animation: slide-in var(--t) var(--ease); }
.drawer-card {
  display: flex; flex-direction: column; gap: var(--s4); height: 100%; padding: 20px 22px;
  background: var(--bg); box-shadow: var(--shadow-2); overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; gap: 10px; }
.drawer-head h2 { flex: 1; font-size: 18px; }
.stepbar { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stepbar li { height: 5px; border-radius: 9px; background: var(--soft-2); }
.stepbar li.done { background: var(--accent); }
.stepbar li.current { background: linear-gradient(90deg, var(--accent) 50%, var(--soft-2) 50%); }
.step-caption { margin-top: calc(-1 * var(--s2)); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content 1fr; margin: 0; font-size: 14px; }
.kv dt, .kv dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv dt { padding-right: var(--s4); color: var(--muted); }
.kv dd { display: grid; gap: 2px; text-align: right; overflow-wrap: anywhere; }
.kv dd .mono { font-size: 11px; }
.drawer-empty { margin: var(--s2) 0; font-size: 14px; line-height: 1.6; }
.keep {
  display: flex; align-items: center; gap: var(--s2); padding: 8px 8px 8px 12px;
  border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px;
}
.queue { list-style: none; display: grid; gap: 2px; margin-top: var(--s2); }
.queue a { display: flex; align-items: center; gap: var(--s2); padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 14px; }
.queue a:hover { background: var(--soft); text-decoration: none; }
.drawer-foot { display: grid; gap: var(--s2); margin-top: auto; }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

/* Fin de conversation : l'îlot flotte au-dessus des derniers messages, on peut toujours les faire défiler au-delà. */
body[data-page="conversation"] .chat-scroll { padding-bottom: calc(var(--island-h, 150px) + 40px); }
body[data-page="home"] .home { padding-bottom: calc(var(--island-h, 150px) + 24px); }

/* Accueil : l'îlot ne recouvre pas les cartes de prompts. Sur grand écran la colonne se décale juste assez pour
   lui laisser sa place (largeur de l'îlot + marges, de chaque côté pour rester centrée) ; en dessous, il se
   réduit en pastille, comme sur téléphone. */
@media (width >= 1380px) {
  body[data-page="home"] .chat-scroll {
    --island-room: 332px;   /* 288 px d'îlot, 20 px du bord, 24 px d'écart */
    padding-right: max(var(--s5), calc(var(--s5) + var(--sidebar-w) + var(--read-w) + 2 * var(--island-room) - 100vw));
  }
}
@media (640px < width < 1380px) {   /* bornes sans trou : un zoom donne des largeurs fractionnaires */
  body[data-page="home"] .island {
    right: 16px; width: auto; max-width: 360px; padding: 8px 14px; border-radius: var(--r-pill);
  }
  body[data-page="home"] .island .island-sub {   /* première ligne (coût, message d'erreur) seule, ellipsée */
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; line-height: 1.35;
  }
  body[data-page="home"] .island :is(.island-sub.mono, .island-tags, .island-actions, .bar) { display: none; }
}

/* ===== Fenêtre « Clés d'API » (spec E §4.2) ============================================================ */
.key-list { list-style: none; display: grid; gap: 6px; margin: 0; padding: 0; }
.key-item { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.key-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.key-text .small { overflow-wrap: anywhere; }
.key-name { font-size: 14px; overflow-wrap: anywhere; }
.key-name code { color: var(--muted); font: 500 12px var(--font-mono); }
.key-created { display: grid; gap: var(--s2); padding: 12px 14px; border: 1px solid var(--accent-line); border-radius: var(--r-md); background: var(--accent-soft); }
.key-secret-row { display: flex; align-items: center; gap: var(--s2); }
.key-secret {
  flex: 1; min-width: 0; padding: 6px 8px; border-radius: var(--r-sm); background: var(--bg);
  font: 500 12.5px var(--font-mono); overflow-wrap: anywhere; user-select: all;
}
.key-example {
  margin: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg);
  font: 11.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.key-form { display: grid; gap: var(--s3); }
.key-scope { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.key-models { display: grid; gap: 4px; padding-left: 24px; }

/* ===== Fenêtre « Choisir un modèle » =================================================================== */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.model-card {
  display: grid; align-content: start; gap: 7px; min-height: 152px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg); color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
button.model-card:hover { border-color: var(--accent-line); }
.model-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.mc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mc-name { margin-right: auto; font-family: var(--font-display); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.mc-source { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.mc-specs { color: var(--ink-2); font-size: 12px; }
.mc-foot { display: flex; align-items: center; gap: var(--s2); margin-top: 2px; }
.mc-price { margin-left: auto; color: var(--ink); font-size: 14px; font-weight: 600; }
.mc-eta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.mc-error { color: var(--err-ink); font-size: 13px; line-height: 1.45; }
/* lien enregistré : la carte (bouton radio) et son ✕ « Oublier » sont frères, jamais imbriqués */
.model-slot { position: relative; display: grid; }
.model-slot .mc-head { padding-right: 30px; }
.mc-forget {
  position: absolute; top: 9px; right: 9px; display: inline-flex; align-items: center; gap: 4px;
  min-width: 26px; height: 26px; padding: 0 5px; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: var(--bg); color: var(--muted);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.mc-forget .icon { width: 14px; height: 14px; }
.mc-forget:hover { background: var(--soft); color: var(--ink); }
.mc-forget.armed { padding: 0 8px; background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.hf-zone { display: grid; gap: var(--s2); }
.hf-field {
  display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 12px;
  border: 1px solid var(--line-2); border-radius: 12px; color: var(--muted);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.hf-field:focus-within {
  border-color: var(--accent); box-shadow: var(--focus-ring); outline: 2px solid var(--accent); outline-offset: -1px;
}
.hf-field input { flex: 1; min-width: 0; padding: 6px 0; border: 0; outline: none; background: none; color: var(--ink); font-size: 14px; }
.hf-tags { display: grid; gap: var(--s2); }
#model-dialog .modal-foot .btn.primary { min-width: 240px; }

/* ===== Messages de la conversation ===================================================================== */
.messages { display: grid; gap: var(--s6); }
.msg.user { display: flex; justify-content: flex-end; }
.bubble { max-width: min(78%, 620px); padding: 12px 16px; border-radius: 18px 18px 6px 18px; background: var(--soft); }
.user-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); line-height: 1.6; }
.attach { display: flex; align-items: center; gap: 6px; margin-top: var(--s2); color: var(--muted); font-size: 12.5px; }
.bubble .att-chips { margin-top: var(--s2); }
.bubble .att-chip { background: var(--bg); }
.mc-caps, .island-caps { justify-content: flex-start; }
.island-caps { flex-wrap: nowrap; gap: 2px 10px; overflow: hidden; }
.island-caps .cap { padding: 0; border: 0; background: none; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.island-caps .cap.no { color: var(--muted); }
body[data-page="home"] .island .island-caps { display: none; }
.kv dd .caps { justify-content: flex-end; }
.msg.assistant { display: grid; gap: var(--s3); }
.thinking { justify-self: start; max-width: 100%; }
.thinking summary {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 5px 12px; list-style: none; cursor: pointer;
  border-radius: var(--r-pill); background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600;
  user-select: none;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary:hover { color: var(--ink-2); }
.think-toggle::after { content: "afficher"; color: var(--accent-ink); }
.thinking[open] .think-toggle::after { content: "masquer"; }
.thinking-body {
  margin-top: var(--s3); padding: 2px 0 2px var(--s4); border-left: 2px solid var(--line-2);
  color: var(--muted); font-size: 14px;
}

/* Markdown assaini des réponses : titres en Unbounded, corps 15 px / 1,7 */
.md { color: var(--ink-2); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 14px; }
.md h1, .md h2, .md h3 {
  margin: 26px 0 10px; color: var(--ink); font-family: var(--font-display); font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.35;
}
.md h1 { font-size: 21px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 15.5px; }
.md h4, .md h5, .md h6 { margin: 20px 0 8px; color: var(--ink); font-size: 15px; font-weight: 700; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--muted); }
.md strong { color: var(--ink); font-weight: 700; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md blockquote { padding: 2px 0 2px var(--s4); border-left: 3px solid var(--accent-line); color: var(--muted); }
.md code { padding: 1px 6px; border-radius: 6px; background: var(--soft); font: .86em var(--font-mono); }
.md pre { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow-x: auto; }
.md pre code { padding: 0; background: none; font-size: 13px; line-height: 1.6; }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.md th, .md td { padding: 8px 12px; border: 1px solid var(--line-2); text-align: left; }
.md th { background: var(--surface); color: var(--ink); font-weight: 700; }
.md hr { height: 1px; margin: 24px 0; border: 0; background: var(--line); }
.md img { max-width: 100%; }
.answer.streaming > :last-child::after {
  content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -2px;
  border-radius: 2px; background: var(--accent); animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.msg-wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.msg-wait::before {
  content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%;
  background: currentColor; color: var(--st-start); animation: pulse 1.6s var(--ease) infinite;
}
.msg[data-status="running"] .msg-wait::before { color: var(--st-gen); }
.msg[data-status="cancelled"] .msg-wait::before { color: var(--st-none); animation: none; }
.warnings { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.warnings:empty { display: none; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px var(--s4); }
.msg-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -8px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; font-weight: 600;
}
.act:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.act[data-action="retry"] { color: var(--accent-ink); }
.act[data-action="cancel"] { color: var(--err-ink); }
.msg-meta { color: var(--muted); font-size: 11.5px; }
.msg-meta:empty { display: none; }
.jump {
  position: absolute; z-index: 20; left: 50%; bottom: calc(var(--composer-h) + 16px); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--bg); color: var(--ink-2);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-1);
}
.jump:hover { color: var(--ink); }

/* ===== Zone de saisie ================================================================================= */
.composer {
  position: relative; flex: none; display: grid; gap: var(--s2);
  width: min(var(--read-w), calc(100% - 48px)); margin: 0 auto 20px; padding: 10px 10px 10px 14px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.composer:focus-within {
  border-color: #c7d5f5; box-shadow: var(--shadow-1), var(--focus-ring); outline: 2px solid var(--accent); outline-offset: -1px;
}
.composer textarea {
  width: 100%; min-height: 30px; padding: 6px 4px 2px; border: 0; outline: none; resize: none;
  background: none; color: var(--ink); font-size: 15px; line-height: 1.55;
}
.composer-bar { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s2); min-width: 0; }   /* sans quoi la grille de la saisie s’élargit à la somme des puces */
.composer-bar > * { flex: none; }
/* une seule ligne : le nom du modèle et le raisonnement se tassent ; l'aide clavier se raccourcit puis disparaît (composer.js) */
.composer-bar > :is(.model-chip, .chip.select, .chip.static) { flex: 0 1 auto; min-width: 0; }
.composer-bar > .chip.static .ellipsis { min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--bg); color: var(--ink-2);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
button.chip:hover { background: var(--soft); }
.chip.accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
button.chip.accent:hover { background: #e2eaff; }
.chip.static { color: var(--muted); }
.chip.select { padding-right: 8px; }
.chip.select select {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  -webkit-appearance: none; appearance: none; padding: 0 2px 0 0; border: 0; outline: none;
  background: none; color: inherit; font: inherit; cursor: pointer;
}
.chip.select:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.gauge { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.gauge.warn { color: var(--warn-ink); }
.composer-hint {
  flex: 1 1 0; min-width: 0; overflow: hidden; text-align: right; white-space: nowrap; text-overflow: ellipsis;
  color: var(--muted); font-size: 12px;
}
.composer-hint.short .hint-more { display: none; }
.composer-hint.cramped { visibility: hidden; }
.composer-bar .send { flex: none; margin-left: auto; }
.send {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 12px; background: var(--accent); color: #fff;
  transition: background var(--t-fast), opacity var(--t-fast);
}
.send:hover { background: var(--accent-ink); }
.send:disabled { opacity: .35; cursor: not-allowed; }
.send:disabled:hover { background: var(--accent); }
.composer-block {
  display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 12px; border-radius: 12px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: 13.5px; font-weight: 600;
}
.composer-block.info { background: var(--accent-soft); color: var(--accent-ink); }
.composer-block [data-role="text"] { flex: 1; }
.composer-block .btn { border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); }

/* ===== Pièces jointes (spec D §8) : puces compactes, voile de dépôt, aperçu ============================== */
.attach-btn { flex: none; }
.att-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.att-chip {
  display: flex; align-items: center; gap: 2px; max-width: min(280px, 100%); padding: 3px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
}
.att-chip.warn { border-color: #fcd9b6; background: var(--warn-bg); }
.att-chip[data-state="error"] { border-color: var(--err-line); background: var(--err-bg); }
.att-open {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 6px 0 0;
  border: 0; border-radius: 9px; background: none; color: inherit; text-align: left;
}
.att-open:disabled { cursor: default; }
.att-thumb {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; overflow: hidden;
  border-radius: 8px; background: #475569; color: #fff; font: 700 9.5px var(--font-mono);
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb[data-label="PDF"] { background: #e11d48; }
.att-thumb[data-label="DOC"] { background: #2563eb; }
.att-thumb[data-label="XLS"] { background: #16a34a; }
.att-thumb[data-label="PPT"] { background: #ea580c; }
.att-thumb[data-label="{ }"] { background: #7c3aed; }
.att-thumb[data-label="IMG"] { background: #0ea5e9; }
.att-chip[data-state="loading"] .att-thumb { opacity: .55; animation: pulse 1.6s var(--ease) infinite; }
.att-text { display: grid; min-width: 0; line-height: 1.3; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.att-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.att-chip.warn .att-meta { color: var(--warn-ink); }
.att-chip[data-state="error"] .att-meta { color: var(--err-ink); }
.drop-veil {
  position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); background: rgba(238, 243, 255, .92);
}
.drop-card { display: grid; justify-items: center; gap: 6px; color: var(--accent-ink); font-size: 16px; text-align: center; }
.preview-images { display: grid; gap: var(--s3); }
.preview-images img { justify-self: center; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.preview-text {
  max-height: 60vh; margin: 0; padding: 14px 16px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: 13px/1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.prompts-menu { width: 380px; }
.prompts-menu-list { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.check-row:hover { background: var(--soft); }
.check-row input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.check-text { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.check-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-foot { display: flex; align-items: center; gap: var(--s2); margin-top: 6px; padding: 8px 4px 2px 10px; border-top: 1px solid var(--line); }
.menu-foot .btn { margin-left: auto; }
.slash-menu { top: auto; bottom: calc(100% + 8px); left: 10px; width: min(440px, calc(100% - 20px)); max-width: none; }
.slash-menu [role="listbox"] { max-height: min(300px, 50vh); overflow-y: auto; }
/* accueil : la saisie est dans .chat-scroll, un menu ouvert vers le haut y serait coupé : il s'ouvre vers le bas */
body[data-page="home"] .menu.menu-up, body[data-page="home"] .slash-menu { top: calc(100% + 6px); bottom: auto; }
.slash-item { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.slash-item[aria-selected="true"], .slash-item:hover { background: var(--accent-soft); }
.slash-name { flex: none; color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.slash-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }

/* ===== Bibliothèque de prompts ========================================================================= */
#prompts-dialog .modal-card { height: min(88vh, 760px); }
.library { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px 1fr; border-top: 1px solid var(--line); }
.library-side {
  display: flex; flex-direction: column; gap: 10px; padding: var(--s4);
  border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto;
}
.library-items { list-style: none; display: grid; gap: 2px; }
.library-item {
  display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); text-align: left;
}
.library-item:hover { background: var(--soft); }
.library-item.current { background: var(--accent-soft); color: var(--accent-ink); }
.li-name { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.li-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.library-editor { display: flex; flex-direction: column; gap: 14px; padding: 18px 24px 22px; overflow-y: auto; }
.library-editor .field.grow { flex: 1; display: flex; flex-direction: column; }
.library-editor textarea { flex: 1; min-height: 240px; }

/* Toasts au-dessus de la saisie dans l'espace de travail */
body[data-page="conversation"] .toasts { bottom: calc(var(--composer-h) + 8px); }
body .toasts.in-dialog { bottom: 24px; }

/* ===== Responsive, écrans tactiles, mouvement réduit (spec C §6, §7.6) ================================== */
.sidebar-toggle { display: none; }
.scrim { display: none; }

@media (max-width: 960px) {
  .sidebar-toggle { display: inline-grid; margin-left: -8px; }
  .topbar { gap: var(--s2); padding-left: var(--s4); }
  .sidebar {
    position: fixed; z-index: 45; top: var(--topbar-h); bottom: 0; left: 0; width: min(300px, 86vw);
    box-shadow: var(--shadow-2); transform: translateX(-105%); visibility: hidden;
    transition: transform var(--t) var(--ease), visibility var(--t);
  }
  body.sidebar-open .sidebar { transform: none; visibility: visible; }
  .scrim { display: block; position: fixed; z-index: 44; inset: var(--topbar-h) 0 0 0; background: rgba(20, 24, 36, .28); }
  .island { width: 260px; }
  /* iOS Safari zoome la page sur un champ de moins de 16 px */
  .side-search input, .composer textarea, .hf-field input { font-size: 16px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .hide-sm { display: none; }
  .topbar { padding: 0 var(--s3); }
  .topbar .brand { gap: 0; margin-right: 0; font-size: 0; }   /* le point-lune seul ; le nom reste lu */
  .topbar-end { gap: 2px; }
  .chat-scroll { padding: var(--s5) var(--s4) var(--s4); }
  body[data-page="conversation"] .chat-scroll { padding-bottom: calc(var(--island-h, 56px) + 24px); }
  .jump { left: 12px; transform: none; }
  .bubble { max-width: 88%; }
  .composer { width: calc(100% - 16px); margin-bottom: 8px; border-radius: 16px; }
  .composer-bar { flex-wrap: wrap; }
  .composer-hint { display: none; }
  .gauge { margin-left: auto; }
  .prompt-cards { grid-template-columns: 1fr; }
  .modal, .modal.wide { width: 100vw; height: 100dvh; margin: 0; }
  .modal-card, #prompts-dialog .modal-card { height: 100%; max-height: none; border-radius: 0; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  #model-dialog .modal-foot .btn.primary { min-width: 0; }
  .model-grid { grid-template-columns: 1fr; }
  .library { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .library-side { max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .drawer { width: 100vw; }
  .island { left: auto; right: 12px; width: auto; max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: var(--r-pill); }
  .island .island-sub.mono, .island .island-tags, .island .island-actions, .island .bar { display: none; }
  /* première ligne (coût, message d'erreur) conservée, sur une seule ligne ellipsée */
  .island .island-sub, .island[data-state="error"] .island-sub {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 80px);
    font-size: 11.5px; line-height: 1.35;
  }
  .island-title { max-width: 46vw; }
  body[data-page="conversation"] .island { bottom: calc(var(--composer-h) + 10px); }
  .prompts-menu { width: min(360px, calc(100vw - 24px)); }
  /* spec D : accueil, pièces jointes, capacités */
  .home { padding-top: 3vh; gap: var(--s3); }
  .home .hero-title { font-size: 22px; }
  .home .composer textarea { min-height: 56px; }
  .suggestions { grid-template-columns: 1fr; }
  .model-chip { max-width: 46vw; }
  .att-chip { max-width: 100%; }
  .island .island-caps { display: none; }
  .preview-text { max-height: none; }
}

@media (pointer: coarse) {
  .icon-btn, .icon-btn.xs, .sidebar-toggle, .toast .icon-btn { min-width: 44px; min-height: 44px; }
  .mc-forget { top: 4px; right: 4px; min-width: 40px; height: 40px; }
  .model-slot .mc-head { padding-right: 40px; }
  .toast .btn { min-height: 44px; }
  .btn.sm, .conv-link, .menu-item, .chip { min-height: 40px; }
  .att-open, .suggestion { min-height: 44px; }
  .chip { display: inline-flex; align-items: center; }
}

@media (hover: none) {   /* bouton d'actions toujours visible, sa place réservée : l'état reste écrit, pas seulement la couleur */
  .conv-actions { opacity: 1; }
  .conv-link { padding-right: 52px; }
  .conv-item:hover .conv-meta, .conv-item:focus-within .conv-meta { visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
