/* ============================================================
   Aur.IA.c — styles
   Thèmes : auriak (maison), claude, chatgpt, gemini, mistral
   Modes  : light / dark (data-mode sur <html>)
   ============================================================ */

@font-face { font-family: "Bricolage Grotesque"; font-weight: 400; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2"); }

/* ---------- Jetons : Aur.IA.c (basalte, rouge Salers, prairie du Cantal) ---------- */
:root {
  --fs: 16px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-ui);
  --font-reply: var(--font-ui);
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --sidebar: #ECE8E0;
  --hover: rgba(43, 48, 54, .07);
  --active: rgba(43, 48, 54, .11);
  --text: #23272B;
  --muted: #6B6F72;
  --border: #DDD7CC;
  --accent: #8E2F1F;
  --accent-hover: #772617;
  --on-accent: #FFFFFF;
  --accent-soft: #F3E3DC;
  --ok: #4D6A35;
  --danger: #B3261E;
  --user-bubble: #E7E2D7;
  --user-text: var(--text);
  --code-bg: #F0EDE6;
  --composer-bg: var(--surface);
  --composer-radius: 18px;
  --bubble-radius: 18px;
  --shadow: 0 1px 2px rgba(35, 39, 43, .05), 0 6px 24px rgba(35, 39, 43, .06);
  --avatar: block;
  --welcome-color: var(--text);
  --sidebar-w: 272px;
  --content-w: 780px;
  --radius: 12px;
}
[data-mode="dark"] {
  --bg: #1B1F22;
  --surface: #23282C;
  --sidebar: #15181A;
  --hover: rgba(232, 228, 220, .07);
  --active: rgba(232, 228, 220, .12);
  --text: #E8E4DC;
  --muted: #9A9D9F;
  --border: #33393E;
  --accent: #D2694F;
  --accent-hover: #E07C62;
  --on-accent: #1B1F22;
  --accent-soft: #3A2924;
  --ok: #8DB06B;
  --danger: #F2827A;
  --user-bubble: #2E3438;
  --code-bg: #15181A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
}

/* ---------- Thème « Claude » ---------- */
[data-theme="claude"] {
  --font-reply: "Tiempos Text", Charter, "Iowan Old Style", Georgia, Cambria, serif;
  --font-display: "Tiempos Headline", Charter, Georgia, serif;
  --bg: #FAF9F5; --surface: #FFFFFF; --sidebar: #F0EEE6; --text: #3D3929; --muted: #83807A;
  --border: #E4E1D7; --accent: #C96442; --accent-hover: #B5583A; --on-accent: #fff; --accent-soft: #F5E4DC;
  --user-bubble: #F0EEE6; --code-bg: #F5F4EE; --composer-radius: 20px; --avatar: none;
}
[data-theme="claude"][data-mode="dark"] {
  --bg: #262624; --surface: #30302E; --sidebar: #1F1E1D; --text: #F5F4EE; --muted: #A6A39B;
  --border: #3E3E3A; --accent: #D97757; --accent-hover: #E38A6C; --on-accent: #1F1E1D; --accent-soft: #3D2E28;
  --user-bubble: #141413; --code-bg: #1F1E1D;
}

/* ---------- Thème « ChatGPT » ---------- */
[data-theme="chatgpt"] {
  --font-display: var(--font-ui);
  --bg: #FFFFFF; --surface: #FFFFFF; --sidebar: #F9F9F9; --text: #0D0D0D; --muted: #8F8F8F;
  --border: #E5E5E5; --accent: #0D0D0D; --accent-hover: #333; --on-accent: #fff; --accent-soft: #F0F0F0;
  --user-bubble: #F4F4F4; --code-bg: #F9F9F9; --composer-radius: 28px; --bubble-radius: 22px; --avatar: none;
  --shadow: 0 2px 8px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);
}
[data-theme="chatgpt"][data-mode="dark"] {
  --bg: #212121; --surface: #303030; --sidebar: #171717; --text: #ECECEC; --muted: #9B9B9B;
  --border: #3A3A3A; --accent: #FFFFFF; --accent-hover: #DDD; --on-accent: #0D0D0D; --accent-soft: #2F2F2F;
  --user-bubble: #303030; --code-bg: #171717; --composer-bg: #303030; --shadow: none;
}

/* ---------- Thème « Gemini » ---------- */
[data-theme="gemini"] {
  --font-display: "Google Sans", "Product Sans", var(--font-ui);
  --bg: #FFFFFF; --surface: #FFFFFF; --sidebar: #F0F4F9; --text: #1F1F1F; --muted: #5E5E5E;
  --border: #DDE3EA; --accent: #0B57D0; --accent-hover: #0842A0; --on-accent: #fff; --accent-soft: #D3E3FD;
  --user-bubble: #E9EEF6; --code-bg: #F0F4F9; --composer-bg: #F0F4F9; --composer-radius: 28px; --avatar: block;
}
[data-theme="gemini"][data-mode="dark"] {
  --bg: #131314; --surface: #1E1F20; --sidebar: #1E1F20; --text: #E3E3E3; --muted: #A3A3A3;
  --border: #3C4043; --accent: #A8C7FA; --accent-hover: #C2D7FB; --on-accent: #062E6F; --accent-soft: #283142;
  --user-bubble: #333537; --code-bg: #1E1F20; --composer-bg: #1E1F20;
}
[data-theme="gemini"] .welcome h1 {
  background: linear-gradient(74deg, #4285F4 0, #9B72CB 9%, #D96570 20%, #D96570 24%, #9B72CB 35%, #4285F4 44%, #9B72CB 50%, #D96570 56%, var(--bg) 75%, var(--bg) 100%);
  background-size: 400% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Thème « Le Chat » (Mistral) ---------- */
[data-theme="mistral"] {
  --font-display: var(--font-ui);
  --bg: #FFFAF3; --surface: #FFFFFF; --sidebar: #FBF1E3; --text: #1E1B16; --muted: #7A7064;
  --border: #EADCC8; --accent: #FA500F; --accent-hover: #E04300; --on-accent: #fff; --accent-soft: #FFE3D3;
  --user-bubble: #F8E9D5; --code-bg: #FBF3E8; --composer-radius: 14px; --bubble-radius: 14px; --avatar: block;
}
[data-theme="mistral"][data-mode="dark"] {
  --bg: #1A1714; --surface: #24201C; --sidebar: #141210; --text: #F2EBE1; --muted: #A69B8E;
  --border: #3A332B; --accent: #FF7A38; --accent-hover: #FF925A; --on-accent: #1A1714; --accent-soft: #3B2619;
  --user-bubble: #2E2822; --code-bg: #141210;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  font: 1rem/1.55 var(--font-ui); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
code { font-family: var(--font-mono); font-size: .88em; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 500; text-decoration: none; color: var(--text); font-size: .94rem;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ============================================================
   Bandeau accès de test
   ============================================================ */
.bypass-banner {
  flex: none; padding: 4px 12px; text-align: center; font-size: .78rem; line-height: 1.4; background: #F2C94C; color: #3B2F00;
}

/* ============================================================
   Mise en page
   ============================================================ */
body:not(.auth-page) { display: flex; flex-direction: column; height: 100dvh; }
.app { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; gap: 6px;
  background: var(--sidebar); padding: 10px 10px 8px; border-right: 1px solid var(--border);
  transition: margin-left .22s ease, transform .22s ease;
}
.app.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.only-collapsed { display: none; }
.app.collapsed .only-collapsed { display: inline-grid; }

.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px 6px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand img { width: 28px; height: 28px; }
.brand span { font: 700 1.2rem/1 var(--font-display); letter-spacing: -.01em; }

.new-chat {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  font-weight: 600; font-size: .93rem; background: var(--surface); border: 1px solid var(--border);
}
.new-chat:hover { border-color: var(--accent); }
.new-chat svg { color: var(--accent); }

.search { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 10px; color: var(--muted); }
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; outline: 0; font-size: .9rem; }
.search svg { width: 17px; height: 17px; }

.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.conv-group { font-size: .74rem; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.conv-item {
  position: relative; display: flex; align-items: center; border-radius: 9px; font-size: .9rem;
}
.conv-item a {
  flex: 1; min-width: 0; padding: 7px 10px; color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.conv-item:hover, .conv-item.menu-open { background: var(--hover); }
.conv-item.active { background: var(--active); }
.conv-item .more { opacity: 0; width: 28px; height: 28px; margin-right: 4px; }
.conv-item:hover .more, .conv-item.active .more, .conv-item.menu-open .more { opacity: 1; }
.conv-item input { flex: 1; margin: 3px; padding: 4px 7px; border: 1px solid var(--accent); border-radius: 7px; background: var(--surface); outline: 0; font-size: .9rem; }
.conv-empty { padding: 20px 12px; color: var(--muted); font-size: .88rem; }

.side-bottom { border-top: 1px solid var(--border); padding-top: 6px; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.user-btn:hover { background: var(--hover); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem;
}
.user-meta { flex: 1; min-width: 0; line-height: 1.2; }
.user-meta strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: .76rem; }
.user-btn .chev { color: var(--muted); width: 16px; height: 16px; }

.scrim { display: none; }

/* ---------- Zone principale ---------- */
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 52px; }
.model-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px;
  font-weight: 600; font-size: 1rem; max-width: 60vw;
}
.model-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-btn:hover { background: var(--hover); }
.model-btn svg { width: 16px; height: 16px; color: var(--muted); }
.preset-pill {
  font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}

.chat { flex: 1; overflow-y: auto; overflow-anchor: none; scroll-behavior: smooth; }
.thread { max-width: var(--content-w); margin: 0 auto; padding: 8px 20px 24px; }

/* ---------- Accueil (nouvelle conversation) ---------- */
.welcome { display: none; }
.main.is-empty .chat { flex: 0 1 auto; display: flex; align-items: flex-end; justify-content: center; min-height: 36vh; overflow: visible; }
.main.is-empty .thread { display: none; }
.main.is-empty .welcome { display: block; text-align: center; padding: 0 20px 18px; }
.welcome h1 {
  margin: 0; font: 600 clamp(1.8rem, 4.2vw, 2.6rem)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--welcome-color);
}
.welcome p { margin: 8px 0 0; color: var(--muted); font-size: 1.05rem; }
.welcome h1 img { width: .9em; height: .9em; vertical-align: -.06em; margin-right: .25em; }

/* ---------- Messages ---------- */
.msg { margin: 22px 0; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble {
  max-width: min(85%, 640px); background: var(--user-bubble); color: var(--user-text);
  padding: 10px 16px; border-radius: var(--bubble-radius); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user .bubble.editing { width: 100%; max-width: 100%; padding: 10px; }
.msg.user .bubble textarea {
  width: 100%; min-height: 80px; border: 0; outline: 0; background: transparent; resize: vertical; line-height: 1.5;
}
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.msg.assistant { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.msg.assistant .av { display: var(--avatar); width: 28px; height: 28px; margin-top: 2px; }
.msg.assistant .av img { width: 28px; height: 28px; }
[data-theme="gemini"] .msg.assistant .av, [data-theme="mistral"] .msg.assistant .av {
  border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center;
}
[data-theme="gemini"] .msg.assistant .av img, [data-theme="mistral"] .msg.assistant .av img { width: 18px; height: 18px; }
.msg.assistant .body { min-width: 0; grid-column: 2; }
[data-theme="claude"] .msg.assistant, [data-theme="chatgpt"] .msg.assistant { display: block; }

.md { font-family: var(--font-reply); line-height: 1.7; overflow-wrap: anywhere; }
[data-theme="claude"] .md { font-size: 1.04em; line-height: 1.72; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md pre { margin: .75em 0; }
.md ul, .md ol { padding-left: 1.5em; }
.md li + li { margin-top: .25em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-ui); line-height: 1.3; margin: 1.3em 0 .5em; }
.md h1 { font-size: 1.45em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; }
.md blockquote { border-left: 3px solid var(--border); margin-left: 0; padding: 2px 0 2px 14px; color: var(--muted); }
.md :not(pre) > code { background: var(--code-bg); padding: .12em .38em; border-radius: 6px; border: 1px solid var(--border); }
.md a { text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.md img { max-width: 100%; border-radius: 10px; }
.md .table-wrap { overflow-x: auto; margin: .9em 0; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: .92em; margin: 0; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--code-bg); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }

.code-block { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: .9em 0; background: var(--code-bg); }
.code-head {
  display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 14px; font: .78rem var(--font-ui);
  color: var(--muted); border-bottom: 1px solid var(--border);
}
.code-head .lang { flex: 1; }
.code-head button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 7px; color: var(--muted); }
.code-head button:hover { background: var(--hover); color: var(--text); }
.code-head svg { width: 15px; height: 15px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: .86rem; line-height: 1.55; }
.code-block pre code { font-size: inherit; background: none !important; padding: 0 !important; }
.compact .code-block pre { padding: 10px 12px; }

.think { margin: 0 0 12px; border-left: 2px solid var(--border); padding-left: 12px; font-family: var(--font-ui); }
.think summary {
  cursor: pointer; list-style: none; color: var(--muted); font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: "▸"; transition: transform .15s; }
.think[open] summary::before { transform: rotate(90deg); }
.think .think-body { color: var(--muted); font-size: .9rem; white-space: pre-wrap; margin-top: 6px; max-height: 360px; overflow-y: auto; }
.think.live summary span { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.caret::after {
  content: ""; display: inline-block; width: .55em; height: 1.05em; vertical-align: -.15em; margin-left: 2px;
  background: var(--accent); border-radius: 2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.waiting { display: inline-flex; gap: 5px; padding: 8px 0; }
.waiting i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.waiting i:nth-child(2) { animation-delay: .15s; } .waiting i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 6px; color: var(--muted); min-height: 30px; }
.msg.user .msg-actions { opacity: 0; transition: opacity .15s; }
.msg.user:hover .msg-actions, .msg.user:focus-within .msg-actions { opacity: 1; }
.msg-actions button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.msg-actions svg { width: 17px; height: 17px; }
.msg-actions .meta { font-size: .76rem; margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.error .md { color: var(--danger); }

.att-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; max-width: min(85%, 640px); }
.att {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .82rem; text-decoration: none; color: var(--text);
}
.att .ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: .62rem; font-weight: 700; text-transform: uppercase; flex: none; }
.att .nm { min-width: 0; line-height: 1.2; }
.att .nm b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .nm small { color: var(--muted); }
.att.img { padding: 0; overflow: hidden; }
.att.img img { display: block; width: 72px; height: 72px; object-fit: cover; }
.att .rm { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); margin-left: auto; }
.att .rm:hover { background: var(--hover); color: var(--danger); }
.att.img .rm { position: absolute; top: 3px; right: 3px; background: rgba(0, 0, 0, .55); color: #fff; }
.att.img { position: relative; }
.att.uploading { opacity: .6; }
.att.uploading .ico { animation: pulse 1s infinite; }

/* ---------- Saisie ---------- */
.composer-wrap { position: relative; max-width: var(--content-w); width: 100%; margin: 0 auto; padding: 0 16px calc(10px + env(safe-area-inset-bottom)); }
.main.is-empty .composer-wrap { flex: 1; }
.composer {
  background: var(--composer-bg); border: 1px solid var(--border); border-radius: var(--composer-radius);
  box-shadow: var(--shadow); padding: 10px 10px 8px 14px; transition: border-color .15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
[data-theme="chatgpt"] .composer:focus-within, [data-theme="gemini"] .composer:focus-within { border-color: var(--border); }
.composer textarea {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent;
  max-height: 40vh; padding: 4px 2px; line-height: 1.5; font-size: 1rem;
}
.composer textarea::placeholder { color: var(--muted); }
.composer .att-list { display: flex; flex-wrap: wrap; gap: 6px; }
.composer .att-list:not(:empty) { margin-bottom: 8px; }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); font-size: .84rem; color: var(--muted); max-width: 200px;
}
.chip-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-btn:hover { color: var(--text); background: var(--hover); }
.chip-btn.on { color: var(--text); background: var(--accent-soft); border-color: transparent; }
.hint { font-size: .75rem; color: var(--muted); margin-right: 6px; }
.send {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); transition: opacity .15s, transform .1s;
}
[data-theme="claude"] .send, [data-theme="mistral"] .send { border-radius: 10px; }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):active { transform: scale(.94); }
.send .i-stop { display: none; }
.send.stop .i-send { display: none; }
.send.stop .i-stop { display: block; fill: currentColor; stroke: none; }
.disclaimer { text-align: center; font-size: .74rem; color: var(--muted); margin: 8px 0 0; }
.main.is-empty .disclaimer { display: none; }

.presets-row { display: none; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.main.is-empty .presets-row { display: flex; }
.presets-row button {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: .88rem; color: var(--text);
}
.presets-row button:hover { border-color: var(--accent); }
.presets-row button.on { background: var(--accent-soft); border-color: var(--accent); }

.scroll-down {
  position: absolute; left: 50%; top: -48px; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text);
}

.drop-overlay {
  position: absolute; inset: 0; z-index: 30; display: none; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(2px);
}
.drop-overlay div { padding: 28px 40px; border: 2px dashed var(--accent); border-radius: 18px; font-weight: 600; color: var(--accent); background: var(--surface); }
.main.dragging .drop-overlay { display: grid; }

/* ============================================================
   Menus, popovers, toasts
   ============================================================ */
.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: min(360px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow), 0 12px 40px rgba(0,0,0,.12);
  padding: 5px; animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px;
  font-size: .9rem; text-align: left; color: var(--text); text-decoration: none;
}
.menu button:hover, .menu a:hover, .menu .kbd-sel { background: var(--hover); }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.menu svg { width: 17px; height: 17px; color: var(--muted); }
.menu .danger svg { color: currentColor; }
.menu .label { padding: 6px 10px 2px; font-size: .74rem; color: var(--muted); font-weight: 600; }
.menu .check { margin-left: auto; color: var(--accent); }

.model-menu { width: 380px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: min(520px, 70vh); }
.model-menu .mm-search { padding: 8px; border-bottom: 1px solid var(--border); }
.model-menu .mm-search input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); outline: 0; }
.model-menu .mm-list { overflow-y: auto; padding: 5px; }
.model-menu .mm-item { display: flex; align-items: center; gap: 8px; }
.model-menu .mm-item > button:first-child { flex: 1; min-width: 0; }
.model-menu .mm-item .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-menu .star { width: 30px; height: 30px; padding: 0; justify-content: center; color: var(--muted); flex: none; }
.model-menu .star.on { color: #D9A520; }
.model-menu .star.on svg { fill: currentColor; color: #D9A520; }
.model-menu .mm-foot { padding: 6px 8px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); }
.tag { font-size: .68rem; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--text); }

.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-size: .9rem; box-shadow: var(--shadow); animation: pop .15s ease-out; max-width: min(520px, 92vw);
}
.toast.err { background: var(--danger); color: #fff; }

/* ============================================================
   Fenêtres modales
   ============================================================ */
.modal {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
.modal::backdrop { background: rgba(10, 12, 14, .45); backdrop-filter: blur(2px); }
.modal[open] { animation: pop .15s ease-out; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; }
.modal-head h2 { margin: 0; font: 600 1.15rem var(--font-display); }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; }
.modal p { margin: 0 0 10px; color: var(--muted); }

.settings { width: min(860px, calc(100vw - 24px)); height: min(640px, calc(100dvh - 24px)); }
.settings-body { flex: 1; display: flex; min-height: 0; border-top: 1px solid var(--border); }
.tabs { width: 190px; flex: none; padding: 10px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); }
.tabs button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: .92rem; text-align: left; color: var(--muted); }
.tabs button:hover { background: var(--hover); color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--active); color: var(--text); font-weight: 600; }
.tabs svg { width: 18px; height: 18px; }
.tab-panels { flex: 1; overflow-y: auto; padding: 8px 26px 26px; }
.panel h3 { font: 600 1rem var(--font-ui); margin: 20px 0 4px; }
.panel h3:first-child { margin-top: 12px; }
.panel .sub { color: var(--muted); font-size: .86rem; margin: 0 0 12px; }

.field { padding: 13px 0; border-bottom: 1px solid var(--border); }
.field:last-child { border-bottom: 0; }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field label, .field .lbl { display: block; font-weight: 500; font-size: .93rem; }
.field .help { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; font-weight: 400; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email], .field select, .field textarea {
  width: 100%; margin-top: 8px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); outline: 0;
}
.field.row select, .field.row input[type=number] { width: auto; min-width: 140px; margin-top: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.5; font-size: .92rem; }
.range { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.range input[type=range] { flex: 1; accent-color: var(--accent); }
.range output { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }

.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--hover); gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: .86rem; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.theme-card { border: 2px solid var(--border); border-radius: 12px; padding: 6px; text-align: left; background: var(--surface); }
.theme-card.on { border-color: var(--accent); }
.theme-card .pv { display: flex; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(0,0,0,.06); }
.theme-card .pv i { display: block; }
.theme-card .pv .s { width: 28%; }
.theme-card .pv .m { flex: 1; position: relative; }
.theme-card .pv .b { position: absolute; right: 8px; top: 10px; width: 46%; height: 12px; border-radius: 6px; }
.theme-card .pv .l1, .theme-card .pv .l2 { position: absolute; left: 8px; height: 6px; border-radius: 3px; opacity: .5; }
.theme-card .pv .l1 { top: 32px; width: 70%; } .theme-card .pv .l2 { top: 44px; width: 50%; }
.theme-card .pv .c { position: absolute; right: 8px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%; }
.theme-card strong { display: block; font-size: .86rem; padding: 6px 4px 2px; }

.list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 600; font-size: .92rem; }
.list-item .grow small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .emoji { font-size: 1.3rem; width: 32px; text-align: center; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.badge { font-size: .7rem; padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: #F2C94C33; color: #9A6B00; }
[data-mode="dark"] .badge.warn { color: #F2C94C; }
.inline-form { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; margin-top: 12px; }
.inline-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-form .field { padding: 0; border: 0; }
.inline-form .actions { display: flex; justify-content: flex-end; gap: 8px; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); border-radius: 12px; padding: 4px 14px; margin-top: 14px; }

kbd { font: .78rem var(--font-mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--bg); }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: .9rem; }

/* ============================================================
   Pages d'authentification
   ============================================================ */
.auth-page { overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand img { width: 34px; height: 34px; }
.auth-brand span { font: 700 1.45rem var(--font-display); letter-spacing: -.01em; }
.auth-card h1 { font: 600 1.35rem var(--font-display); margin: 0 0 14px; }
.auth-note { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.auth-form { display: grid; gap: 14px; margin-top: 6px; }
.auth-form label { display: grid; gap: 6px; font-size: .88rem; font-weight: 500; }
.auth-form input:not([type=checkbox]) { padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); outline: 0; font-size: 1rem; }
.auth-form input:focus { border-color: var(--accent); }
.auth-form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.auth-form .check input { margin-top: 4px; accent-color: var(--accent); }
.auth-form .btn { padding: 11px; margin-top: 4px; }
.otp { font: 600 1.4rem/1 var(--font-mono) !important; letter-spacing: .3em; text-align: center; }
.auth-link { display: block; text-align: center; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.auth-foot { color: var(--muted); font-size: .78rem; margin-top: 18px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 12px; }
.alert.ko { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.alert.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: .86rem; }
.checks .ok { color: var(--ok); } .checks .ko { color: var(--danger); font-weight: 600; } .checks .warn { color: #B07B00; }
.mfa-grid { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; margin-bottom: 16px; }
.qr { background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--border); }
.qr svg { width: 100%; height: auto; display: block; stroke: none; }
.steps { margin: 0; padding-left: 1.2em; font-size: .9rem; display: grid; gap: 8px; }
.secret { display: inline-block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: var(--code-bg); word-break: break-all; }
.recovery { columns: 2; padding-left: 1.4em; font-size: 1rem; margin: 0 0 14px; }
.recovery li { margin-bottom: 6px; }
.row-actions { display: flex; gap: 8px; margin-bottom: 14px; }

/* ============================================================
   Densité compacte
   ============================================================ */
.compact .msg { margin: 14px 0; }
.compact .md { line-height: 1.55; }
.compact .msg.user .bubble { padding: 7px 13px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; margin-left: 0 !important;
    transform: translateX(-100%); width: min(86vw, 320px);
  }
  .app.side-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .35); }
  .only-collapsed { display: inline-grid !important; }
  #btn-collapse { display: none; }
  .thread { padding: 4px 14px 18px; }
  .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .hint { display: none; }
  .msg-actions .meta { display: none; }
  .msg.user .msg-actions { opacity: 1; }
  .main.is-empty .chat { min-height: 30vh; }
  .settings { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; margin: 0; }
  .settings-body { flex-direction: column; }
  .tabs { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px 10px; scrollbar-width: none; }
  .tabs button { white-space: nowrap; flex: none; }
  .tab-panels { padding: 4px 16px 24px; }
  .model-menu { width: calc(100vw - 16px); }
}
@media (max-width: 560px) {
  .mfa-grid { grid-template-columns: 1fr; }
  .qr { max-width: 220px; margin: 0 auto; }
  .checks { grid-template-columns: 1fr; }
  .inline-form .two { grid-template-columns: 1fr; }
  .field.row { flex-wrap: wrap; }
  .msg.user .bubble, .att-row { max-width: 92%; }
  .msg.assistant { gap: 10px; }
  .welcome h1 { font-size: 1.75rem; }
}
@media (hover: none) {
  .conv-item .more { opacity: 1; }
}

/* ============================================================
   Projets
   ============================================================ */
.conv-group.with-btn { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.conv-group .icon-btn { width: 26px; height: 26px; border-radius: 7px; }
.conv-group .icon-btn svg { width: 16px; height: 16px; }
.conv-item .pico { flex: none; width: 22px; margin-left: 8px; text-align: center; font-size: .95rem; }
.conv-item.project a { padding-left: 6px; }
.conv-item .cp { font-size: .8em; margin-right: 5px; opacity: .85; }
.conv-more { display: block; width: 100%; text-align: left; padding: 5px 10px; font-size: .82rem; color: var(--muted); border-radius: 8px; }
.conv-more:hover { background: var(--hover); color: var(--text); }

.project-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 4px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-pill:hover { box-shadow: inset 0 0 0 1px var(--accent); }

.main.is-project .thread, .main.is-project .welcome { display: none; }
.main.is-project .presets-row { display: flex; justify-content: flex-start; }
.main.is-project .disclaimer { display: none; }
.project-page { max-width: 1040px; margin: 0 auto; padding: 18px 24px 40px; }
.pp-head { display: flex; align-items: flex-start; gap: 12px; }
.pp-head h1 { flex: 1; margin: 0; font: 600 clamp(1.5rem, 3vw, 2rem)/1.2 var(--font-display); letter-spacing: -.015em; }
.pp-head h1 .ic { margin-right: .3em; }
.pp-desc { color: var(--muted); margin: 6px 0 18px; max-width: 70ch; }
.pp-slot .composer-wrap { padding: 0; max-width: none; margin: 0 0 8px; }
.pp-slot .presets-row { margin-top: 10px; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; margin-top: 26px; align-items: start; }
.pp-grid h2 { font: 600 .95rem var(--font-ui); margin: 0; }
.pp-convs h2 { margin-bottom: 8px; }
.pp-conv { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  text-decoration: none; color: var(--text); margin-bottom: 8px; }
.pp-conv:hover { border-color: var(--accent); }
.pp-conv b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-conv small { color: var(--muted); font-size: .8rem; }
.pp-empty { color: var(--muted); font-size: .92rem; padding: 18px; border: 1px dashed var(--border); border-radius: 12px; }

.card { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 14px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head .icon-btn { width: 30px; height: 30px; }
.card .clamp { margin: 0; color: var(--muted); font-size: .88rem; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.meter { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; margin: 4px 0 4px; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .3s; }
.meter.warn i { background: #D9A520; } .meter.full i { background: var(--danger); }
.meter-label { font-size: .76rem; color: var(--muted); }
.doc-list { margin-top: 10px; display: grid; gap: 2px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 9px; }
.doc:hover { background: var(--hover); }
.doc .ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--on-accent);
  font-size: .6rem; font-weight: 700; text-transform: uppercase; flex: none; }
.doc.off .ico { background: var(--border); color: var(--muted); }
.doc .nm { flex: 1; min-width: 0; line-height: 1.25; }
.doc .nm b { display: block; font-weight: 500; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .nm small { color: var(--muted); font-size: .74rem; }
.doc.off .nm b { color: var(--muted); }
.doc .switch { transform: scale(.85); }
.doc .icon-btn { width: 28px; height: 28px; }
.doc.uploading { opacity: .55; }
.doc-drop { margin-top: 10px; padding: 14px; text-align: center; font-size: .82rem; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; cursor: pointer; }
.doc-drop:hover { border-color: var(--accent); color: var(--text); }

.form-grid { display: grid; gap: 12px; }
.form-grid .two { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.form-grid label { display: grid; gap: 5px; font-size: .88rem; font-weight: 500; }
.form-grid input, .form-grid textarea { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); outline: 0; width: 100%; }
.form-grid textarea { resize: vertical; min-height: 140px; line-height: 1.5; font-size: .92rem; }
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--accent); }
.form-grid .help { font-weight: 400; color: var(--muted); font-size: .8rem; }
.modal.wide { width: min(640px, calc(100vw - 24px)); }

@media (max-width: 900px) {
  .project-page { padding: 8px 14px 30px; }
  .pp-grid { grid-template-columns: 1fr; }
  .pp-side { order: -1; }
  .project-pill { max-width: 130px; }
}

/* ============================================================
   Prompts « / »
   ============================================================ */
.slash-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; max-height: min(340px, 50vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow), 0 12px 40px rgba(0,0,0,.12);
  padding: 5px; animation: pop .12s ease-out;
}
.composer { position: relative; }
.main.is-empty .slash-menu, .pp-slot .slash-menu { bottom: auto; top: calc(100% + 6px); }
.pp-slot .composer-wrap, .main.is-empty .composer-wrap { z-index: 5; }
.slash-item { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.slash-item.sel, .slash-item:hover { background: var(--hover); }
.slash-item code { flex: none; color: var(--accent); font-weight: 600; font-size: .86rem; background: none; border: 0; padding: 0; }
.slash-item .t { flex: none; font-size: .9rem; font-weight: 500; }
.slash-item .p { flex: 1; min-width: 0; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slash-foot { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px 3px; border-top: 1px solid var(--border); margin-top: 4px; font-size: .74rem; color: var(--muted); }
.slash-foot button { color: var(--accent); font-size: .78rem; }
.slash-empty { padding: 10px; font-size: .86rem; color: var(--muted); }
.var-grid { display: grid; gap: 10px; }
.var-grid label { display: grid; gap: 5px; font-size: .88rem; font-weight: 500; text-transform: none; }
.var-grid input { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); outline: 0; }
.var-grid input:focus { border-color: var(--accent); }
.prompt-preview { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); white-space: pre-wrap; max-height: 3.2em; overflow: hidden; }

/* ============================================================
   Voix
   ============================================================ */
.mic.listening { color: #fff; background: var(--danger); animation: micpulse 1.4s ease-in-out infinite; }
.mic.busy { color: var(--accent); animation: pulse 1s infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }
.composer.listening { border-color: var(--danger); }
.msg-actions button.speaking { color: var(--accent); background: var(--accent-soft); }
.voice-test { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

/* ============================================================
   Recherche dans les documents (RAG)
   ============================================================ */
.rag-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.rag-line select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); font-size: .82rem; }
.rag-line .btn-sm { padding: 3px 9px; font-size: .78rem; }
.src-row { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.src-row:last-of-type { border-bottom: 0; }
.src-row .top { display: flex; align-items: center; gap: 6px; }
.src-row code { flex: 1; min-width: 0; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-row small { display: block; color: var(--muted); font-size: .74rem; margin-top: 2px; }
.src-row small.err { color: var(--danger); }
.src-row .meter { margin-top: 6px; }
.src-form { display: grid; gap: 8px; margin-top: 10px; }
.src-form input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); outline: 0; font-size: .84rem; width: 100%; }
.src-form input:focus { border-color: var(--accent); }

.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-family: var(--font-ui); }
.sources > span { font-size: .76rem; color: var(--muted); margin-right: 2px; }
.src-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 3px 10px 3px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: .78rem; color: var(--text);
}
.src-chip:hover { border-color: var(--accent); }
.src-chip b { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent-soft); font-size: .7rem; }
.src-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
sup.cite { font: 600 .68em var(--font-ui); vertical-align: super; line-height: 0; }
sup.cite a { display: inline-block; padding: 1px 5px; margin: 0 1px; border-radius: 999px; background: var(--accent-soft); color: var(--text); text-decoration: none; cursor: pointer; }
sup.cite a:hover { background: var(--accent); color: var(--on-accent); }
.passage { white-space: pre-wrap; font-size: .9rem; line-height: 1.6; max-height: 50vh; overflow-y: auto; padding: 12px 14px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--border); color: var(--text); }
.search-results { display: grid; gap: 8px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.search-results .r { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: .84rem; }
.search-results .r b { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; margin-bottom: 4px; }
.search-results .r b small { color: var(--muted); font-weight: 400; }
.search-results .r p { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================================================
   Mots de passe, choix de la double authentification, e-mails
   ============================================================ */
.pw-box { margin-top: 2px; font-size: .8rem; font-weight: 400; }
.pw-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pw-btn { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: .78rem; color: var(--text); }
.pw-btn:hover { border-color: var(--accent); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter i { height: 5px; border-radius: 3px; background: var(--border); transition: background .2s; }
.pw-box[data-level="1"] .pw-meter i:nth-child(-n+1) { background: var(--danger); }
.pw-box[data-level="2"] .pw-meter i:nth-child(-n+2) { background: #D9A520; }
.pw-box[data-level="3"] .pw-meter i:nth-child(-n+3) { background: var(--ok); }
.pw-box[data-level="4"] .pw-meter i { background: var(--ok); }
.pw-level { display: block; min-height: 1.2em; margin-top: 3px; color: var(--muted); font-weight: 600; }
.pw-rules { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; color: var(--muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓ "; }
.pw-gen { margin: 6px 0 0; color: var(--text); background: var(--accent-soft); padding: 6px 9px; border-radius: 8px; }
@media (max-width: 480px) { .pw-rules { grid-template-columns: 1fr; } }

.method-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--hover); margin-bottom: 16px; }
.method-tabs a { text-align: center; padding: 8px 6px; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 500; }
.method-tabs a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.send-row { display: flex; gap: 8px; align-items: center; }
.send-row .btn { white-space: nowrap; }
.send-row small { color: var(--muted); font-size: .8rem; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .86rem; }
.auth-links a { color: var(--muted); }
.mfa-choice { display: grid; gap: 10px; margin: 6px 0 4px; }
.mfa-choice a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.mfa-choice a:hover { border-color: var(--accent); }
.mfa-choice a b { display: block; margin-bottom: 2px; }
.mfa-choice a small { color: var(--muted); }

/* ============================================================
   v1.6 : réponses longues, contexte, fichiers générés
   ============================================================ */
.status-line { font-size: .84rem; color: var(--muted); margin-top: 6px; font-family: var(--font-ui); animation: pulse 1.4s ease-in-out infinite; }
.trunc { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: 12px; font: .86rem/1.4 var(--font-ui);
  background: color-mix(in srgb, #D9A520 14%, var(--surface)); border: 1px solid color-mix(in srgb, #D9A520 45%, var(--border)); }
.trunc span { flex: 1; min-width: 200px; }

.ctx-gauge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font: 600 .76rem var(--font-ui); color: var(--muted); }
.ctx-gauge:hover { background: var(--hover); color: var(--text); }
.ctx-gauge svg { width: 18px; height: 18px; }
.ctx-gauge circle { fill: none; stroke-width: 3; }
.ctx-gauge .trk { stroke: var(--border); }
.ctx-gauge .val { stroke: var(--ok); stroke-linecap: round; transition: stroke-dasharray .4s; }
.ctx-gauge[data-level="mid"] .val { stroke: #D9A520; }
.ctx-gauge[data-level="high"] .val { stroke: var(--danger); }
.ctx-gauge[data-level="high"] { color: var(--danger); }
.ctx-pop { padding: 12px 14px; width: 330px; max-width: calc(100vw - 32px); font-size: .86rem; }
.ctx-pop p { margin: 8px 0 0; color: var(--muted); }
.ctx-pop .meter { margin-top: 10px; }
.ctx-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ctx-actions .btn { width: auto; }
.menu .ctx-pop button.btn { display: inline-flex; width: auto; padding: 5px 10px; }
.hint-sm { font-size: .76rem; }

.summary-divider { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px 0; font: .8rem var(--font-ui); color: var(--muted); }
.summary-divider::before, .summary-divider::after { content: ""; flex: 1; border-top: 1px dashed var(--border); }
.summary-divider button { color: var(--accent); font-size: .8rem; }

.files-panel { margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; font-family: var(--font-ui); }
.fp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--code-bg); }
.fp-head > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; }
.fp-head svg { width: 17px; height: 17px; color: var(--accent); }
.fp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fp-actions .btn svg { width: 15px; height: 15px; color: inherit; }
.fp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.fp-file { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: var(--surface); min-width: 0; box-shadow: 0 0 0 .5px var(--border); }
.fp-file .ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: .62rem; font-weight: 700; text-transform: uppercase; flex: none; }
.fp-file .nm { flex: 1; min-width: 0; line-height: 1.25; }
.fp-file .nm b { display: block; font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-file .nm small { color: var(--muted); font-size: .74rem; }
.fp-file .icon-btn { width: 32px; height: 32px; flex: none; }
.modal.preview { width: min(1100px, calc(100vw - 24px)); height: calc(100dvh - 48px); }
.modal.preview .modal-head { gap: 8px; }
.modal.preview iframe { flex: 1; width: 100%; border: 0; border-top: 1px solid var(--border); background: #fff; border-radius: 0 0 16px 16px; }
@media (max-width: 560px) { .fp-list { grid-template-columns: 1fr; } .modal.preview { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; } }
.bypass-banner.emergency { background: var(--danger); color: #fff; }
.diag { display: grid; gap: 6px; margin-top: 10px; font-size: .86rem; }
.diag div { display: flex; gap: 8px; align-items: flex-start; }
.diag .st { flex: none; width: 20px; font-weight: 700; }
.diag .ok .st { color: var(--ok); } .diag .ko .st { color: var(--danger); }
.diag small { display: block; color: var(--muted); word-break: break-word; }
.transcript { margin-top: 10px; max-height: 220px; overflow: auto; font: .74rem/1.45 var(--font-mono); background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.mlog { display: grid; gap: 4px; margin-top: 8px; }
.mlog details { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .82rem; }
.mlog summary { cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; }
.mlog summary::-webkit-details-marker { display: none; }
.mlog .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.mlog .ko .dot { background: var(--danger); }
.mlog pre { white-space: pre-wrap; font: .74rem/1.45 var(--font-mono); margin: 6px 0 0; color: var(--muted); }

.model-menu .mm-foot button { width: auto; }
.diag .warn .st { color: #B07B00; } .diag .info .st { color: var(--muted); }

/* ============================================================
   v1.10 : mémoire, tableau de bord
   ============================================================ */
.mem-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-family: var(--font-ui); }
.mem-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 4px 6px 4px 10px; border-radius: 999px; font-size: .8rem;
  background: color-mix(in srgb, var(--ok) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); }
.mem-chip svg { width: 15px; height: 15px; color: var(--ok); }
.mem-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-chip button { font-size: .76rem; color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.mem-chip button:hover { background: var(--hover); color: var(--text); }
.mem-chip.removed { opacity: .6; }
.mem-manage { font-size: .78rem; color: var(--accent); }

.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-warn { display: grid; gap: 6px; margin-bottom: 14px; }
.dash-warn div { padding: 9px 12px; border-radius: 10px; font-size: .86rem; }
.dash-warn .danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); font-weight: 600; }
.dash-warn .warn { background: #F2C94C2a; color: #8A6300; }
[data-mode="dark"] .dash-warn .warn { color: #F2C94C; }
.dash-warn .info { background: var(--hover); color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.kpi small { display: block; color: var(--muted); font-size: .78rem; }
.kpi b { display: block; font: 700 1.5rem/1.25 var(--font-display); margin: 2px 0; }
.dl { font-size: .76rem; color: var(--muted); }
.dl.up { color: var(--ok); } .dl.down { color: var(--danger); }
.dash-chart { width: 100%; height: auto; display: block; }
.dash-chart .bar { fill: var(--accent); opacity: .85; }
.dash-chart g:hover .bar { opacity: 1; }
.dash-chart .tick { fill: var(--muted); font: 10px var(--font-ui); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-grid .card { margin-bottom: 14px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .76rem; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.dash-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tr.muted td { color: var(--muted); }
.health { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.health b { display: block; font-size: .88rem; }
.health small { color: var(--muted); font-size: .8rem; }
.health .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--border); }
.health .dot.ok { background: var(--ok); } .health .dot.warn { background: #D9A520; } .health .dot.ko { background: var(--danger); }
.health .dot.wait { animation: pulse 1s infinite; }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } }
.panel .card { margin-bottom: 14px; }
.panel .card-head h2 { font: 600 .95rem var(--font-ui); margin: 0; }
.settings.wide-panel { width: min(1180px, calc(100vw - 24px)); height: min(860px, calc(100dvh - 24px)); }
.dash-chart, .dash-chart * { stroke: none; }
.kpis { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .settings.wide-panel { width: 100vw; height: 100dvh; } }
.fb-box { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 12px; display: grid; gap: 2px; }
.fb-box .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .fb-box .two { grid-template-columns: 1fr; } }
.fb-box .help { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.fb-box > strong { font-size: .93rem; }

/* ============================================================
   v1.12 : skills
   ============================================================ */
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-family: var(--font-ui); }
.skill-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.skill-chip small { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#btn-skills { display: inline-flex; align-items: center; gap: 5px; }
.skill-editor .two { grid-template-columns: 90px 1fr; }

/* ============================================================
   v1.13 : plugins
   ============================================================ */
.tool-steps { display: grid; gap: 4px; margin: 0 0 12px; font-family: var(--font-ui); }
.tool-step { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .84rem; }
.tool-step summary { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; list-style: none; }
.tool-step summary::-webkit-details-marker { display: none; }
.tool-step .ta { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool-step .ts { margin-left: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.tool-step.ok .ts { color: var(--ok); } .tool-step.ko .ts, .tool-step.refused .ts { color: var(--danger); }
.tool-step .tr { padding: 0 10px 8px 36px; color: var(--muted); font-size: .8rem; white-space: pre-wrap; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-confirm { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, #D9A520 50%, var(--border));
  background: color-mix(in srgb, #D9A520 10%, var(--surface)); font-family: var(--font-ui); font-size: .88rem; }
.tc-call { display: flex; gap: 10px; margin-top: 8px; }
.tc-call .ti { font-size: 1.2rem; }
.tc-call dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: .82rem; }
.tc-call dt { color: var(--muted); } .tc-call dd { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }
.tc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.plugin-card { opacity: .85; } .plugin-card.on { opacity: 1; border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.pl-head { display: flex; gap: 12px; align-items: flex-start; }
.pl-icon { font-size: 1.6rem; line-height: 1; }
.pl-tools { margin-top: 10px; display: grid; gap: 6px; }
.pl-tool { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; background: var(--hover); }
.pl-tool > .grow { flex: 1; min-width: 0; }
.pl-tool small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.pl-tool code { font-size: .82rem; }
.pl-access { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; font-size: .82rem; }
.pl-access > label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.pl-access select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: inherit; font-size: .82rem; }
.pl-access > .sub { margin: 0; font-size: .78rem; }
.pl-users { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: .8rem; }
.chip-check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.chip-check small { color: var(--muted); }
.pl-info { margin-top: 10px; font-size: .8rem; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pl-warn { margin-top: 10px; font-size: .8rem; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn, #c98a00) 12%, transparent); }
.pl-settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; align-items: end; }
.pl-settings label { display: grid; gap: 4px; font-size: .82rem; font-weight: 500; }
.pl-settings input, .pl-settings select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }

/* ============================================================
   v1.14 : paramètres regroupés, cases à cocher, éditeur de code
   ============================================================ */
.tabs { overflow-y: auto; }
.tab-search { width: 100%; padding: 7px 10px; margin-bottom: 6px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); font-size: .84rem; outline: 0; }
.tab-search:focus { border-color: var(--accent); }
.tab-group { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; }
.tab-group:first-of-type { padding-top: 4px; }
@media (max-width: 900px) { .tab-search, .tab-group { display: none; } }

/* Cases à cocher et boutons radio : jamais étirés par les styles de champs */
input[type="checkbox"], input[type="radio"] {
  width: 16px !important; height: 16px; min-width: 16px; padding: 0 !important; margin: 0; flex: none;
  accent-color: var(--accent); vertical-align: middle; cursor: pointer;
}
.switch input[type="checkbox"] { width: 100% !important; height: 100%; opacity: 0; position: absolute; inset: 0; }
label.check, .form-grid label.check { display: flex !important; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.mcp-srv { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; opacity: .85; }
.mcp-srv.on { opacity: 1; border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.mcp-tool { cursor: pointer; align-items: flex-start; }
.mcp-tool input { margin-top: 3px; }

/* ---------- v1.18 : panneau « Outils » ---------- */
.tools-panel .modal-head { display: flex; align-items: center; justify-content: space-between; }
.tools-panel .modal-body { display: grid; gap: 14px; }
.tp-alert { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 0; }
.tp-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.tp-how > div { display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--hover); font-size: .82rem; }
.tp-how span { color: var(--muted); }
.tp-search { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: inherit; }
.tp-list { display: grid; gap: 10px; }
.tp-plugin { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.tp-plugin.off { opacity: .85; border-style: dashed; }
.tp-head { display: flex; gap: 10px; align-items: flex-start; }
.tp-head .grow { flex: 1; min-width: 0; }
.tp-head small { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.tp-head .badge { margin-left: 6px; }
.tp-icon { font-size: 1.4rem; line-height: 1; }
.tp-need { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: .82rem; padding: 8px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tp-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-ex { border: 1px solid var(--border); background: var(--bg); color: inherit; border-radius: 999px; padding: 5px 11px; font-size: .8rem; cursor: pointer; text-align: left; }
.tp-ex:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tp-head .badge { display: inline-block; }
.tp-cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-cmd { display: inline-flex; gap: 8px; align-items: baseline; border: 1px solid var(--border); background: var(--hover); border-radius: 8px; padding: 5px 10px; cursor: pointer; color: inherit; font-size: .78rem; }
.tp-cmd span { color: var(--muted); }
.tp-cmd:hover { border-color: var(--accent); }
.tp-cmd code { font-size: .8rem; white-space: nowrap; color: var(--accent); }
.tp-details summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.tp-tools { display: grid; gap: 6px; margin-top: 8px; }
.tp-tool { padding: 8px 10px; border-radius: 9px; background: var(--hover); font-size: .84rem; }
.tp-tool small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.tp-params { margin: 4px 0 0; padding-left: 18px; font-size: .76rem; color: var(--muted); }
.tp-params code { font-size: .74rem; }
.tp-foot { display: flex; justify-content: flex-end; }
@media (max-width: 600px) {
  .tp-how { grid-template-columns: 1fr; gap: 4px; }
  .tp-how > div { display: block; padding: 7px 10px; }
  .tp-how > div b { margin-right: 4px; }
  #btn-tools span { display: none; }
}
.alert.warn { background: color-mix(in srgb, #c98a00 14%, transparent); border: 1px solid color-mix(in srgb, #c98a00 35%, transparent); }

/* ---------- v1.19 : réponses en arrière-plan ---------- */
.conv-item.busy > a::before, .conv-item.unread > a::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.conv-item.busy > a::before { background: var(--accent); animation: genPulse 1.1s ease-in-out infinite; }
.conv-item.unread:not(.busy) > a::before { background: var(--ok, #2e7d4f); }
.conv-item.unread > a { font-weight: 600; }
@keyframes genPulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- v1.20 : connexions OAuth ---------- */
.conn-detect { font-size: .82rem; padding: 7px 10px; border-radius: 8px; background: var(--hover); }
.conn-oauth .alert { font-size: .84rem; }
.ok-txt { color: var(--ok, #2e7d4f); }
.warn-txt { color: #b07800; }
.pl-help { margin-top: 10px; font-size: .8rem; }
.pl-help summary { cursor: pointer; color: var(--muted); }
.pl-help p { margin: 6px 0 0; line-height: 1.5; }
.copy-uri { cursor: copy; background: var(--hover); padding: 1px 5px; border-radius: 5px; word-break: break-all; }

/* ---------- v1.21 : application Microsoft personnelle ---------- */
.conn-own { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.conn-own summary { cursor: pointer; font-weight: 500; font-size: .88rem; }
.conn-own summary span { font-weight: 400; color: var(--muted); font-size: .8rem; }
.conn-own[open] summary { margin-bottom: 8px; }
.conn-own-help { font-size: .8rem; color: var(--muted); line-height: 1.55; margin: 0 0 10px; }
.conn-own-help p { margin: 0 0 6px; }
.conn-own-help ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---------- v1.22 : fichiers produits par un outil (document Word…) ---------- */
.tool-file { display: inline-flex; align-items: center; gap: 12px; margin: 6px 0 2px; padding: 9px 16px 9px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none; max-width: 100%; }
.tool-file:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.tool-file .tf-icon { flex-shrink: 0; width: 34px; height: 40px; border-radius: 6px; background: #2B579A; color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.tool-file .tf-name { display: flex; flex-direction: column; font-size: .9rem; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-file .tf-name small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.tool-file .tf-icon.xl { background: #217346; }
.tool-file .tf-icon.pp { background: #C43E1C; }
.tool-file .tf-icon.pdf { background: #B3261E; font-size: 11px; }

/* v1.27 : génération longue — ligne de progression rassurante */
.gen-progress { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2, rgba(0,0,0,.04)); border: 1px solid var(--border); font: .86rem/1.45 var(--font-ui); color: var(--text); }
.gen-progress small { color: var(--muted); font-size: .8rem; }
.gen-progress .gp-dot { flex-shrink: 0; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--accent, #8E2F1F);
  animation: gp-pulse 1.4s ease-in-out infinite; }
@keyframes gp-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .gen-progress .gp-dot { animation: none; } }

/* v1.29 : documents de projet — mode recherche, dossiers importés */
.meter.search i { background: var(--accent-soft, #F3E3DC); }
.meter-label b { color: var(--text); font-weight: 600; }
.doc-folder { border-radius: 10px; }
.doc-folder > summary { display: flex; align-items: center; gap: 10px; padding: 8px 6px; cursor: pointer; list-style: none; border-radius: 10px; }
.doc-folder > summary::-webkit-details-marker { display: none; }
.doc-folder > summary:hover { background: var(--hover); }
.doc-folder > summary .ico { width: 34px; text-align: center; font-size: 1.2rem; }
.doc-folder > summary .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-folder > summary small { color: var(--muted); font-size: .78rem; }
.doc-folder[open] > summary { background: var(--hover); }
.doc-folder > .doc { padding-left: 22px; }
.doc-rm-all { margin-top: 8px; }
