:root {
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #F1F3F6;
  --line: #E3E7EC;
  --line-strong: #D5DBE3;
  --ink: #0F1A2A;
  --ink-2: #3A4658;
  --ink-3: #5B6678;
  --accent: #C2410C;
  --accent-ink: #FFFFFF;
  --accent-soft: #FDEBE1;
  --accent-soft-ink: #9A3208;
  --accent-line: #F3C3A6;
  --bubble: #0F1A2A;
  --bubble-ink: #FFFFFF;
  --ok: #0A6B4F;
  --danger: #B42318;
  --shadow: 0 8px 24px rgba(15, 26, 42, 0.07);
  --code-bg: #0F1A2A;
  --code-ink: #E6EAF0;
  --radius: 14px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --display: 'Bricolage Grotesque', 'DM Sans', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B111C; --surface: #121A28; --surface-2: #172133; --surface-3: #1C273A;
    --line: #253147; --line-strong: #31405A; --ink: #EEF1F6; --ink-2: #C3CAD6; --ink-3: #95A0B2;
    --accent: #F07A3E; --accent-ink: #1A0D05; --accent-soft: #3A2215; --accent-soft-ink: #FFB48A; --accent-line: #6B3A20;
    --bubble: #26334A; --bubble-ink: #F3F5F9; --ok: #4CC79A; --danger: #FF8A80;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35); --code-bg: #070B12; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B111C; --surface: #121A28; --surface-2: #172133; --surface-3: #1C273A;
  --line: #253147; --line-strong: #31405A; --ink: #EEF1F6; --ink-2: #C3CAD6; --ink-3: #95A0B2;
  --accent: #F07A3E; --accent-ink: #1A0D05; --accent-soft: #3A2215; --accent-soft-ink: #FFB48A; --accent-line: #6B3A20;
  --bubble: #26334A; --bubble-ink: #F3F5F9; --ok: #4CC79A; --danger: #FF8A80;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35); --code-bg: #070B12; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.app.with-preview { grid-template-columns: 280px minmax(0, 1fr) minmax(360px, 46%); }

/* Sidebar */
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; stroke: none; }
.brand-name { font: 700 22px var(--display); letter-spacing: -0.02em; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-soft-ink); }
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary.small { height: 42px; padding: 0 18px; }
.btn-ghost { height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 14px; }
.btn-ghost.danger { color: var(--danger); }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink-3); }
.search svg { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); }
.side-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); padding: 4px 10px 0; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.chat-item { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.chat-item:hover, .chat-item.active { background: var(--surface-3); }
.chat-item .open { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-item.active .open { color: var(--ink); font-weight: 600; }
.chat-item .del { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: var(--ink-3); display: none; align-items: center; justify-content: center; }
.chat-item:hover .del, .chat-item.active .del { display: flex; }
.chat-item .del svg { width: 16px; height: 16px; }
.empty-list { padding: 8px 12px; font-size: 13px; color: var(--ink-3); }
.side-foot { display: flex; flex-direction: column; gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 14px; border-radius: var(--radius); background: #0B1324; color: #FFFFFF; border: 1px solid var(--line); text-align: left; }
.plan-card:hover { background: #121D33; }
.plan-text { font-size: 13px; color: #C9D1DC; line-height: 1.45; }
.plan-meter { height: 5px; border-radius: 5px; background: #2C3A50; overflow: hidden; }
.plan-meter span { display: block; height: 100%; width: 0; background: #F08A4B; border-radius: 5px; transition: width .3s; }
.plan-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.plan-title { font-weight: 600; }
.plan-sub { color: #F5A576; font-size: 12px; font-weight: 600; }
.theme-switch { display: flex; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.theme-switch button { flex: 1; height: 36px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.theme-switch button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 26, 42, 0.1); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; background: transparent; border-radius: 12px; text-align: left; color: var(--ink-3); }
.user-row:hover { background: var(--surface-3); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.user-sub { font-size: 12px; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); min-height: 64px; }
.chat-title { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.lang-select { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lang-select svg { width: 16px; height: 16px; color: var(--ink-3); }
.lang-select select { border: 0; background: transparent; outline: none; font-size: 14px; font-weight: 500; max-width: 130px; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.outline { border: 1px solid var(--line); color: var(--ink); }
.icon-btn.listening { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
.only-mobile { display: none; }

.thread { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.welcome { max-width: 780px; margin: 0 auto; padding: 8vh 24px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.welcome h2 { margin: 0; font: 700 clamp(30px, 4.4vw, 44px)/1.08 var(--display); letter-spacing: -0.03em; max-width: 640px; }
.welcome > p { margin: 0 0 18px; font-size: 17px; color: var(--ink-3); max-width: 560px; }
.actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; transition: border-color .15s, transform .15s; }
.action:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.action b { display: block; font-weight: 600; font-size: 15px; }
.action small { display: block; font-size: 13px; color: var(--ink-3); }
.ai { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.a1 { background: #FDEBE1; color: #B83A0B; } .a2 { background: #E6EEFC; color: #2453B8; } .a3 { background: #E3F4EC; color: #0A6B4F; }
.a4 { background: #F2ECFB; color: #6532B0; } .a5 { background: #FFF4D6; color: #8A5A00; } .a6 { background: #FCE7EE; color: #A3214F; }

/* Messages */
.messages { max-width: 780px; margin: 0 auto; padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 24px; }
.msg-user { align-self: flex-end; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bubble { padding: 12px 16px; border-radius: 18px 18px 4px 18px; background: var(--bubble); color: var(--bubble-ink); white-space: pre-wrap; word-wrap: break-word; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg-files img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); font-size: 13px; color: var(--ink-2); max-width: 220px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip svg { width: 16px; height: 16px; }
.msg-hope { display: flex; gap: 12px; align-items: flex-start; }
.hope-avatar { width: 32px; height: 32px; flex: none; }
.hope-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-family: var(--display); line-height: 1.25; margin: 1.2em 0 .5em; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 16px; }
.md p { margin: .6em 0; }
.md ul, .md ol { padding-left: 1.4em; margin: .6em 0; }
.md li { margin: .25em 0; }
.md code { font: 13px var(--mono); background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
.md pre { background: var(--code-bg); color: var(--code-ink); padding: 14px 16px; border-radius: 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; margin: .8em 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md blockquote { margin: .8em 0; padding: .2em 1em; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.md a { font-weight: 500; }
.cursor::after { content: ''; display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; background: var(--accent); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; opacity: .7; } .dots i:nth-child(3) { animation-delay: .3s; opacity: .45; }
@keyframes bounce { 40% { transform: translateY(-4px); } }
.steps { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.steps div { display: flex; align-items: center; gap: 8px; }
.steps svg { width: 15px; height: 15px; color: var(--ok); stroke-width: 2.4; }
.app-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.app-card .ai { background: #E3F4EC; color: #0A6B4F; }
.app-card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-card-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-card-meta small { color: var(--ink-3); font-size: 13px; }
.app-card .btn-primary { height: 40px; padding: 0 14px; font-size: 14px; }
.gen-image { position: relative; max-width: 460px; }
.gen-image img { width: 100%; display: block; border-radius: 16px; border: 1px solid var(--line); }
.img-placeholder { max-width: 460px; aspect-ratio: 1; border-radius: 16px; background: var(--surface-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--ink-3); font-size: 14px; }
.img-placeholder svg { width: 32px; height: 32px; }
.img-actions, .msg-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.img-actions .btn-ghost { height: 36px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.img-actions svg { width: 15px; height: 15px; }
.msg-actions { gap: 2px; color: var(--ink-3); }
.msg-actions .icon-btn { width: 36px; height: 36px; border-radius: 8px; color: var(--ink-3); }
.msg-actions svg { width: 16px; height: 16px; }
.msg-actions .icon-btn.playing { color: var(--accent); background: var(--accent-soft); }
.msg-actions .icon-btn.loading { color: var(--accent); animation: pulse 1.2s infinite; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources a { display: inline-flex; align-items: center; max-width: 240px; padding: 6px 10px; border-radius: 20px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sources a:hover { border-color: var(--line-strong); color: var(--ink); }
.error-box { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* Composer */
.composer-wrap { padding: 8px 20px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.chips { max-width: 780px; margin: 0 auto 10px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.composer { max-width: 780px; margin: 0 auto; border: 1.5px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--ink-3); }
.composer textarea { display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 16px 18px 6px; font-size: 16px; line-height: 1.5; max-height: 200px; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px 10px; }
.left-tools, .right-tools { display: flex; align-items: center; gap: 4px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.toggle svg { width: 15px; height: 15px; }
.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-soft-ink); font-weight: 600; }
.send { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--ink); color: var(--surface); display: flex; align-items: center; justify-content: center; }
.send:disabled { opacity: .35; cursor: default; }
.send.stop { background: var(--accent); color: var(--accent-ink); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; }
.attachments:empty { display: none; }
.att { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 30px 6px 6px; border-radius: 12px; background: var(--surface-3); font-size: 13px; max-width: 220px; }
.att img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .x { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.att .x svg { width: 12px; height: 12px; }
.disclaimer { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--ink-3); }

/* Preview */
.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }
.preview[hidden] { display: none; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.tabs button { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 26, 42, 0.1); }
.preview-actions { display: flex; align-items: center; gap: 6px; }
.preview iframe { flex: 1; width: 100%; border: 0; background: #FFFFFF; }
.code-view { flex: 1; margin: 0; overflow: auto; padding: 16px; background: var(--code-bg); color: var(--code-ink); font: 13px/1.55 var(--mono); white-space: pre; }

/* Settings */
.settings { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 20px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
.settings::backdrop { background: rgba(11, 17, 28, 0.5); }
.settings form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.settings h2 { margin: 0; font: 700 22px var(--display); }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.settings input, .settings textarea { font-weight: 400; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); outline: none; resize: vertical; }
.settings input:focus, .settings textarea:focus { border-color: var(--accent); }
.settings small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.voice-row { display: flex; gap: 8px; }
.voice-row select { flex: 1; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); font-weight: 400; }
.voice-row .btn-ghost { height: 42px; }
.voice-row .btn-ghost.loading, .voice-row .btn-ghost.playing { color: var(--accent); border-color: var(--accent-line); }
.settings-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 4px; }

.toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-size: 14px; box-shadow: var(--shadow); z-index: 60; max-width: calc(100vw - 32px); }
.scrim { display: none; }

/* Connexion */
body.auth-open { overflow: hidden; }
.auth { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); overflow-y: auto; }
.auth-brand { background: #0B1324; color: #FFFFFF; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 28px; padding: 64px clamp(32px, 6vw, 96px); }
.auth-logo { width: 96px; height: 96px; stroke: none; border-radius: 26px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.auth-pitch { margin: 0; max-width: 440px; font: 600 clamp(24px, 2.6vw, 34px)/1.25 var(--display); letter-spacing: -0.02em; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-logo-sm { display: none; width: 56px; height: 56px; stroke: none; border-radius: 16px; margin-bottom: 8px; }
.auth-head h1 { margin: 0; font: 700 28px/1.15 var(--display); letter-spacing: -0.02em; }
.auth-head p { margin: 0; color: var(--ink-3); }
.auth-view { display: flex; flex-direction: column; gap: 16px; }
.auth-google { display: flex; align-items: center; justify-content: center; gap: 10px; height: 50px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-weight: 600; color: var(--ink); }
.auth-google:hover { background: var(--surface-2); }
.auth-google svg { width: 20px; height: 20px; stroke: none; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-tabs { display: flex; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.auth-tabs button { flex: 1; height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 26, 42, .1); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.auth-form input, .auth-form select { height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); font-size: 16px; font-weight: 400; color: var(--ink); outline: none; }
.auth-form input:focus, .auth-form select:focus { border-color: var(--accent); background: var(--surface); }
.auth-form small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.auth-form .btn-primary { height: 50px; margin-top: 4px; }
.auth-form .btn-primary:disabled { opacity: .6; }
.auth-switch { display: flex; gap: 18px; border-bottom: 1px solid var(--line); }
.auth-switch button { border: 0; background: none; padding: 0 0 10px; font-size: 15px; font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-switch button.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.phone-row { display: flex; gap: 8px; }
.phone-row select { flex: none; width: 118px; padding: 0 8px; }
.phone-row input { flex: 1; min-width: 0; }
.otp { letter-spacing: .5em; text-align: center; font-size: 22px !important; font-family: var(--mono); }
.auth-link { align-self: center; border: 0; background: none; padding: 6px; color: var(--accent); font-size: 14px; font-weight: 600; }
.auth-done { align-items: center; text-align: center; }
.auth-done p { margin: 0; line-height: 1.55; }
.auth-done small { color: var(--ink-3); }
.auth-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-soft-ink); display: flex; align-items: center; justify-content: center; }
.auth-icon svg { width: 28px; height: 28px; }
.auth-msg { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 14px; line-height: 1.45; }
.auth-msg.ok { background: #E3F4EC; color: #0A6B4F; }
.code-form { width: 100%; text-align: left; }
.auth-link:disabled { color: var(--ink-3); }
.offer .btn-ghost.small { height: 38px; font-size: 13px; }
.offer button.btn-primary { width: 100%; }
.auth-legal { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* Compte et offres */
.account { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.account-wrap { padding: 24px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; max-height: calc(100dvh - 24px); box-sizing: border-box; }
.account-head { display: flex; align-items: center; gap: 14px; }
.account-head > div { flex: 1; min-width: 0; }
.account-head h2 { margin: 0; font: 700 20px var(--display); }
.account-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.avatar.big { width: 52px; height: 52px; font-size: 20px; }
.acc-plan { padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.acc-plan-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-3); }
.acc-plan-top b { font: 700 18px var(--display); color: var(--ink); }
.acc-plan small { color: var(--ink-3); }
.usage { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.usage-title { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.usage-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.usage-row .bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.usage-row .bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.account h3 { margin: 4px 0 0; font: 700 17px var(--display); }
.offers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.offer { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.offer.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.offer-top { display: flex; flex-direction: column; gap: 2px; }
.offer-top b { font-size: 15px; }
.offer-top span { font: 700 20px var(--display); }
.offer-top small { font: 400 13px var(--font); color: var(--ink-3); }
.offer ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; flex: 1; }
.offer .btn-primary { text-decoration: none; font-size: 14px; height: 42px; }
.offer-badge { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-soft-ink); }
.offers-note { margin: 0; font-size: 13px; color: var(--ink-3); }
.api-credit { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.api-credit-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.api-credit-top small { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.api-balance { flex: none; text-align: right; display: flex; flex-direction: column; }
.api-balance span { font-size: 12px; color: var(--ink-3); }
.api-balance b { font: 700 22px var(--display); white-space: nowrap; }
.api-credit-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.api-credit-row select { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 14px; }
.api-credit-row .btn-ghost { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
@media (max-width: 520px) {
  .api-credit-top { flex-direction: column; }
  .api-balance { text-align: left; }
  .api-credit-row select, .api-credit-row .btn-primary { flex: 1 1 140px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-logo-sm { display: block; }
  .auth-panel { align-items: flex-start; padding-top: max(32px, env(safe-area-inset-top)); }
  .offers { grid-template-columns: minmax(0, 1fr); }
  .account-wrap { padding: 20px 16px; }
}

/* Conversation vocale en direct */
.live-launch { background: var(--accent-soft); color: var(--accent-soft-ink); }
.live-launch:hover { background: var(--accent-line); }
body.live-open { overflow: hidden; }
.live { position: fixed; inset: 0; z-index: 70; background: #0B1324; color: #FFFFFF; display: flex; flex-direction: column; padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.live-top { display: flex; align-items: center; justify-content: space-between; }
.live-title { font: 600 15px var(--font); color: #C9D1DC; letter-spacing: .02em; }
.live .icon-btn { color: #FFFFFF; }
.live .icon-btn:hover { background: rgba(255, 255, 255, .08); }
.live-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; min-height: 0; }
.live-orb { position: relative; width: 184px; height: 184px; border: 0; border-radius: 50%; background: transparent; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.orb-logo { position: relative; z-index: 2; width: 112px; height: 112px; stroke: none; border-radius: 30px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 12px 40px rgba(0, 0, 0, .45); transition: transform .3s ease; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 106, 26, .55); opacity: 0; }
.live[data-phase="listening"] .ring { animation: ripple 2.4s ease-out infinite; }
.live[data-phase="listening"] .r2 { animation-delay: .8s; }
.live[data-phase="listening"] .r3 { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(.62); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
.live[data-phase="thinking"] .r1 { opacity: 1; border: 3px solid transparent; border-top-color: #FF6A1A; border-right-color: rgba(255, 106, 26, .4); transform: scale(.8); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: scale(.8) rotate(360deg); } }
.live[data-phase="speaking"] .orb-logo { animation: talk .5s ease-in-out infinite alternate; }
.live[data-phase="speaking"] .r1 { opacity: 1; background: radial-gradient(circle, rgba(255, 106, 26, .28) 0%, rgba(255, 106, 26, 0) 70%); border-color: transparent; animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scale(1); } to { transform: scale(1.07); } }
@keyframes glow { from { transform: scale(.85); } to { transform: scale(1.15); } }
.live[data-phase="paused"] .orb-logo, .live[data-phase="error"] .orb-logo { opacity: .45; }
.live-state { margin: 0; font: 600 20px var(--display); }
.live-you { margin: 0; max-width: 560px; min-height: 1.5em; font-size: 17px; line-height: 1.5; color: #FFFFFF; }
.live-hope { margin: 0; max-width: 560px; min-height: 1.5em; font-size: 16px; line-height: 1.55; color: #F5A576; }
.live-you:empty, .live-hope:empty { visibility: hidden; }
.live-bottom { display: flex; justify-content: center; gap: 12px; }
.live-btn { min-width: 132px; height: 50px; padding: 0 22px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 25px; background: rgba(255, 255, 255, .06); color: #FFFFFF; font: 600 15px var(--font); }
.live-btn:hover { background: rgba(255, 255, 255, .12); }
.live-btn.end { background: #C2410C; border-color: #C2410C; }
.live-btn.end:hover { background: #A8380A; }

@media (max-width: 1100px) {
  .app.with-preview { grid-template-columns: 280px minmax(0, 1fr); }
  .preview { position: fixed; inset: 0; z-index: 40; border: 0; }
}
@media (max-width: 860px) {
  .app, .app.with-preview { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .app.side-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(11, 17, 28, 0.45); z-index: 45; }
  .scrim[hidden] { display: none; }
  .topbar { padding: 8px 8px 8px 6px; min-height: 58px; }
  .chat-title { font-size: 15px; }
  .lang-select select { max-width: 92px; }
  .welcome { padding-top: 5vh; }
  .welcome > p { font-size: 15px; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .action { padding: 14px; }
  .messages { padding: 18px 14px 8px; }
  .msg-user { max-width: 90%; }
  .composer-wrap { padding: 6px 10px 10px; }
  .chat-item .del { display: flex; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Profil utilisateur */
.profile-form { gap: 16px; }
.pick { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pick legend { width: 100%; padding: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.pick legend small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.pick button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface-2); font-size: 14px; color: var(--ink-2); text-align: left; }
.pick button.on { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.pick button:disabled { opacity: .5; }
.acc-profile { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 14px 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; }
.acc-profile > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-profile span { font-size: 12px; color: var(--ink-3); }
.acc-profile b { font-size: 15px; }
.acc-profile small { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.acc-profile .btn-ghost { flex: none; }

/* Questions de précision (carte façon Claude) */
.ask-card { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.ask-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ask-top > div { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.ask-top b { font-size: 15px; }
.ask-top small { font-size: 12.5px; color: var(--ink-3); }
.ask-badge { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-ink); }
.ask-badge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-count { flex: none; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 4px 9px; border-radius: 20px; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.ask-count.full { background: var(--accent-soft); color: var(--accent-soft-ink); }
.ask-list { list-style: none; margin: 0; padding: 0; }
.ask-q { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.ask-label { display: flex; gap: 10px; align-items: flex-start; }
.ask-num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ink); color: var(--surface); margin-top: 1px; }
.ask-text { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.ask-hint { font-size: 12px; color: var(--ink-3); }
.ask-opts { display: flex; flex-direction: column; gap: 8px; }
.ask-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 46px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); text-align: left; font-size: 14.5px; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.ask-opt:hover { border-color: var(--accent-line); background: var(--surface-2); }
.ask-opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.ask-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ask-opt-text small { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.ask-opt[aria-checked="true"] .ask-opt-text > span { font-weight: 600; }
.ask-box { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--surface); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.ask-opt[role="radio"] .ask-box { border-radius: 50%; }
.ask-opt[aria-checked="true"] .ask-box { border-color: var(--accent); background: var(--accent); }
.ask-opt[role="checkbox"][aria-checked="true"] .ask-box::after { content: ''; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.ask-opt[role="radio"][aria-checked="true"] .ask-box::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); }
.ask-free, .ask-other textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.ask-free { height: 46px; }
.ask-free:focus, .ask-other textarea:focus { border-color: var(--accent); }
.ask-other { display: flex; flex-direction: column; gap: 8px; padding: 16px; font-size: 14px; font-weight: 600; }
.ask-other small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.ask-other textarea { resize: vertical; min-height: 64px; }
.ask-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 16px 16px; }
.ask-actions .btn-primary { height: 46px; padding: 0 20px; flex: 1 1 auto; }
.ask-actions .btn-ghost { height: 46px; flex: 0 1 auto; }
.ask-card.done { box-shadow: none; border-style: dashed; }
.ask-card.done .ask-top { border-bottom: 0; background: transparent; }
.ask-card.done .ask-badge { background: var(--surface-3); color: var(--ok); }
.ask-card.done .ask-badge svg { stroke: currentColor; }
@media (max-width: 520px) { .ask-actions .btn-ghost, .ask-actions .btn-primary { flex: 1 1 100%; } }

/* Fichiers téléchargeables */
.file-cards { display: flex; flex-direction: column; gap: 10px; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.file-ico { flex: none; width: 44px; height: 52px; border-radius: 8px; display: grid; place-items: end center; padding-bottom: 8px; background: var(--fc); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .4px; position: relative; clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%); }
.file-ico::after { content: ''; position: absolute; top: 0; right: 0; width: 28%; height: 22%; background: rgba(255,255,255,.35); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.file-ico.sm { width: 26px; height: 32px; font-size: 7px; padding-bottom: 4px; border-radius: 5px; letter-spacing: 0; }
.file-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.file-meta b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { font-size: 12.5px; color: var(--ink-3); }
.file-card .btn-primary { flex: none; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.file-card .btn-primary svg { width: 17px; height: 17px; }
.file-card .btn-primary:disabled { opacity: .65; }
.dl-wrap { position: relative; display: inline-flex; }
.dl-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; min-width: 230px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px rgba(15,26,42,.16); display: flex; flex-direction: column; }
.dl-menu button { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; font-size: 14px; color: var(--ink); text-align: left; }
.dl-menu button:hover { background: var(--surface-3); }
@media (max-width: 520px) { .file-card .btn-primary span { display: none; } .file-card .btn-primary { width: 44px; padding: 0; justify-content: center; } }

/* ---------- Réflexion (résumé du raisonnement) ---------- */
.think { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.think > summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 500; color: var(--ink-3); user-select: none; }
.think > summary::-webkit-details-marker { display: none; }
.think > summary::after { content: ''; width: 7px; height: 7px; margin-left: 2px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.think[open] > summary::after { transform: rotate(45deg); }
.think > summary svg { width: 16px; height: 16px; color: var(--accent); }
.think > summary:hover { color: var(--ink-2); }
.think-body { padding: 0 14px 12px 36px; font-size: 14px; color: var(--ink-3); max-height: 340px; overflow-y: auto; }

/* ---------- Blocs de code ---------- */
.code-block { margin: .8em 0; border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 14px; font: 12px var(--mono); color: #95A0B2; border-bottom: 1px solid rgba(255,255,255,.08); }
.code-copy { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #C3CAD6; font-family: inherit; font-size: 12px; font-weight: 500; }
.code-copy:hover { background: rgba(255,255,255,.08); color: #fff; }
.code-copy svg { width: 14px; height: 14px; }
.code-copy.done { color: #4CC79A; }
.md .code-block pre { margin: 0; border-radius: 0; }
.md pre code { font: 13px/1.55 var(--mono); }
/* Couleurs de coloration syntaxique (highlight.js), lisibles sur le fond sombre des blocs */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-doctag { color: #FF9E64; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: #9ECE6A; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #F7C873; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #7AA2F7; }
.hljs-title.class_, .hljs-type, .hljs-name, .hljs-selector-class, .hljs-selector-id { color: #E0AF68; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #7C869A; font-style: italic; }
.hljs-variable, .hljs-params, .hljs-property, .hljs-attribute, .hljs-tag { color: #C0CAF5; }
.hljs-regexp, .hljs-link, .hljs-deletion { color: #F7768E; }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }

/* ---------- Formules ---------- */
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.md .katex { font-size: 1.08em; }
.math-raw { white-space: pre-wrap; }

/* ---------- Message envoyé : copier / modifier ---------- */
.user-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.msg-user:hover .user-actions, .user-actions:focus-within { opacity: 1; }
@media (hover: none) { .user-actions { opacity: .7; } }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.edit-box { width: min(640px, 82vw); display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--accent-line); border-radius: 16px; background: var(--surface); }
.edit-box textarea { width: 100%; min-height: 60px; resize: none; border: 0; background: transparent; color: var(--ink); font: inherit; line-height: 1.55; outline: none; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.edit-actions .btn-ghost, .edit-actions .btn-primary { height: 38px; padding: 0 16px; font-size: 14px; }

@media (max-width: 420px) { #deepToggle span, #webToggle span { display: none; } #deepToggle, #webToggle { padding: 0 10px; } }
.msg-user .user-actions { margin-top: -4px; }

/* Conversation vocale : l'orbe suit le volume réel de la voix de Hope */
.live.reactive[data-phase="speaking"] .orb-logo { animation: none; transform: scale(calc(1 + var(--level, 0) * .16)); transition: transform .06s linear; }
.live.reactive[data-phase="speaking"] .r1 { animation: none; transform: scale(calc(1.02 + var(--level, 0) * .5)); opacity: calc(.45 + var(--level, 0)); transition: transform .08s linear, opacity .08s linear; }

/* Image en cours de création */
.img-placeholder { position: relative; overflow: hidden; }
.img-placeholder::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.8s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .img-placeholder::before { background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); } }
:root[data-theme="dark"] .img-placeholder::before { background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); }
@keyframes shimmer { to { transform: translateX(100%); } }
.img-timer { min-height: 1em; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Proposition des notifications « réponse prête » */
.push-offer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 auto 10px; padding: 10px 12px; max-width: 760px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 14px; }
.push-offer[hidden] { display: none; }
.push-offer span { flex: 1 1 260px; }
.push-offer .btn-ghost, .push-offer .btn-primary { height: 36px; padding: 0 14px; font-size: 14px; }
.side-legal { margin: 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.side-legal a { color: var(--ink-3); }
.consent-box { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.consent-box .check-row, .consent .check-row { font-size: 14px; font-weight: 400; }
.check-row a { color: var(--accent); }
.consent p { margin: 0; font-size: 14px; color: var(--ink-2); }
.consent-points { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.privacy-box { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 12px; }
.privacy-box legend { padding: 0 6px; font-size: 14px; font-weight: 700; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Connecteurs */
.connectors { width: min(560px, calc(100vw - 24px)); }
.conn-wrap { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.conn-head { display: flex; justify-content: space-between; align-items: center; }
.conn-head h2 { margin: 0; font: 700 22px var(--display); }
.conn-lead, .conn-help { margin: 0; font-size: 14px; color: var(--ink-2); }
.conn-help a { color: var(--accent); }
.conn-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.conn-card.off { opacity: .7; }
.conn-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.conn-ico.gcal { background: #E8F0FE; color: #1A73E8; }
.conn-ico svg { width: 22px; height: 22px; }
.conn-meta { display: flex; flex-direction: column; min-width: 0; }
.conn-meta small { color: var(--ink-3); font-size: 12.5px; overflow-wrap: anywhere; }
.conn-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.conn-sub { margin: 6px 0 0; font: 700 15px var(--display); }
#connList { display: flex; flex-direction: column; gap: 8px; }
.conn-empty { margin: 0; font-size: 13px; color: var(--ink-3); }
.conn-add { border: 1px dashed var(--line-strong); border-radius: 14px; padding: 10px 14px; }
.conn-add summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
.conn-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.conn-note { color: var(--ink-3); font-size: 12px; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 12px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) {
  .conn-card { grid-template-columns: 40px minmax(0, 1fr); }
  .conn-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.legal-links { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--ink-3); } .legal-links a { color: var(--ink-3); }

/* Tuile « Modèles » sur toute la largeur (téléphone : grille de 2) */
@media (max-width: 760px) { .action.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; } }

/* Modèles prêts à l'emploi */
.templates { width: min(760px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; overflow: hidden; display: none; flex-direction: column; }
.templates[open] { display: flex; }
.tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 0 20px; }
.tpl-lead { margin: 6px 20px 12px; color: var(--ink-3); font-size: 14px; }
.tpl-body { overflow-y: auto; padding: 0 20px 20px; }
.tpl-body h3 { margin: 16px 0 8px; font: 600 13px var(--font, inherit); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; transition: border-color .15s, transform .15s; }
.tpl:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tpl small { color: var(--ink-3); font-size: 13px; }

/* Bouton « Installer l'application » */
.install-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px; border: 1px dashed var(--accent-line); border-radius: 12px; background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; font-size: 14px; }
.install-btn[hidden] { display: none; }
.install-btn svg { width: 18px; height: 18px; }
.doc-card .ai { background: #E8EEFB; color: #2B579A; }
@media (max-width: 520px) { .preview-actions .btn-ghost, .preview-actions .btn-primary { height: 36px; padding: 0 10px; font-size: 13px; } }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-actions .btn-ghost, .doc-actions .btn-primary { height: 38px; padding: 0 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.doc-actions svg { width: 16px; height: 16px; }
@media (max-width: 520px) { .doc-card { flex-wrap: wrap; } .doc-card .doc-actions { width: 100%; justify-content: stretch; } .doc-card .doc-actions button { flex: 1; justify-content: center; } }

/* Suggestions de suite, Continuer, mémoire */
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest .chip { height: auto; min-height: 34px; padding: 6px 12px; white-space: normal; text-align: left; border-color: var(--accent-line); color: var(--accent-soft-ink); background: var(--accent-soft); }
.continue-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; }
.continue-btn svg { width: 16px; height: 16px; }
.mem-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--accent-line); border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--ink-2); }
.mem-card > svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.mem-card > span:first-of-type { flex: 1 1 220px; }
.mem-card.done { border-style: solid; border-color: var(--line); color: var(--ink-3); }
.mem-card.done svg { color: var(--ok); }
.mem-actions { display: flex; gap: 6px; }
.mem-actions .btn-ghost, .mem-actions .btn-primary { height: 34px; padding: 0 12px; font-size: 13px; }
.queued { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.queued svg { width: 13px; height: 13px; }

/* Commandes « / » */
.composer { position: relative; }
.slash { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 40; max-height: 320px; overflow-y: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, .16); }
.slash[hidden] { display: none; }
.slash-item { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font-size: 14px; }
.slash-item b { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.slash-item span { color: var(--ink-2); }
.slash-item.sel, .slash-item:hover { background: var(--surface-3); }

/* Réglage à cocher */
.check-row { display: flex; gap: 12px; align-items: flex-start; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check-row > span { display: block; font-weight: 400; line-height: 1.45; }
.check-row > span > b { display: block; }
.settings label.check-row, .auth-form label.check-row { flex-direction: row; }
.check-row span small { display: block; margin-top: 2px; }

/* Liste des conversations : groupes, épingles, menu « ⋯ » */
.list-group { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.list-group svg { width: 14px; height: 14px; }
.chat-item { position: relative; }
.chat-item .open .pin svg { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; color: var(--accent); }
.chat-item .more { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: var(--ink-3); display: none; align-items: center; justify-content: center; flex: none; }
.chat-item .more svg { width: 18px; height: 18px; }
.chat-item:hover .more, .chat-item.active .more, .chat-item .more[aria-expanded="true"] { display: inline-flex; }
@media (hover: none) { .chat-item .more { display: inline-flex; } }
.chat-menu { position: absolute; right: 6px; top: calc(100% - 4px); z-index: 50; min-width: 210px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, .18); display: flex; flex-direction: column; }
.chat-menu button { padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; font-size: 14px; }
.chat-menu button:hover { background: var(--surface-3); }
.chat-menu .danger { color: var(--danger, #C62828); }
.icon-btn svg, .btn-ghost.icon-only svg { width: 18px; height: 18px; }
.btn-ghost.icon-only { width: 38px; padding: 0 !important; justify-content: center; }

/* Parrainage */
.acc-ref { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin: 14px 0 4px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--accent-soft); }
.acc-ref[hidden] { display: none; }
.acc-ref-top { display: flex; gap: 12px; align-items: flex-start; }
.acc-ref-top small { display: block; color: var(--ink-2); margin-top: 2px; }
.acc-ref-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.acc-ref-ico svg { width: 20px; height: 20px; }
.acc-ref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acc-ref-row b { font-family: var(--mono); letter-spacing: .08em; }
.acc-ref > small { color: var(--ink-3); }
.doc-actions button { white-space: nowrap; }
@media (max-width: 520px) { .doc-card .doc-actions .icon-only { flex: 0 0 42px; } }

/* Projets dans la liste des conversations */
.side-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-add { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font: 600 12px var(--font); text-transform: none; letter-spacing: 0; }
.side-add svg { width: 14px; height: 14px; }
.side-add:hover { border-color: var(--accent-line); color: var(--accent-soft-ink); }
.project-group { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); padding-right: 4px; }
.project-group > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-btn { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.grp-btn:hover { background: var(--surface-3); color: var(--ink); }
.grp-btn svg { width: 16px; height: 16px; }
.empty-list.small { padding: 2px 12px 6px; font-size: 12.5px; }

/* Bandeau des modes actifs (Mode Étude, projet) */
.mode-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.mode-bar[hidden] { display: none; }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 600; max-width: 100%; }
button.mode-pill { padding-right: 12px; }
.mode-pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-pill > span:not(.pname) { flex: none; }
.mode-pill .pname { margin-left: -2px; }
.mode-pill svg { width: 15px; height: 15px; }
.mode-pill.study { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-soft-ink); }
.mode-pill button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.mode-pill button svg { width: 13px; height: 13px; }
.mode-pill button:hover { background: rgba(0, 0, 0, .08); }

/* Menu « Joindre » sur téléphone (photo ou fichier) */
.left-tools { position: relative; min-width: 0; }
/* Outils (comme dans Claude) : menu et puces des outils actifs */
.tool-chips { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tool-chips::-webkit-scrollbar { display: none; }
.tool-chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--accent-line); border-radius: 999px; background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; }
.tool-chip svg { width: 15px; height: 15px; }
.tool-chip .x { width: 13px; height: 13px; opacity: .7; }
.tools-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 45; width: min(330px, calc(100vw - 28px)); max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, .18); }
.tools-menu .tm-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font-size: 14px; }
.tools-menu .tm-item:hover, .tools-menu .tm-item:focus-visible { background: var(--surface-3); outline: none; }
.tools-menu .tm-item > svg { width: 20px; height: 20px; color: var(--ink-2); }
.tools-menu .tm-item small { display: block; font-size: 12px; color: var(--ink-3); }
.tools-menu .tm-item .tm-val { font-size: 13px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 2px; }
.tools-menu .tm-item .tm-val svg { width: 16px; height: 16px; }
.tools-menu .tm-item.sel { color: var(--accent); font-weight: 600; }
.tools-menu .tm-sep { margin: 6px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tools-menu .tm-note { margin: 2px 10px 8px; font-size: 12.5px; color: var(--ink-3); }
.tools-menu .tm-err { color: var(--danger); }
.tsw { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong); transition: background .15s; flex: none; }
.tsw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tsw.on { background: var(--accent); }
.tsw.on::after { transform: translateX(14px); }
.conn-err { color: var(--danger) !important; }
@media (max-width: 420px) { .tool-chip span { display: none; } .tool-chip { padding: 0 8px; } }
.attach-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 45; min-width: 250px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, .18); display: flex; flex-direction: column; }
.attach-menu button { display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; }
.attach-menu button:hover { background: var(--surface-3); }
.attach-menu svg { width: 22px; height: 22px; color: var(--accent); }
.attach-menu span { display: flex; flex-direction: column; }
.attach-menu b { font-size: 14px; }
.attach-menu small { font-size: 12.5px; color: var(--ink-3); }

/* Quiz interactif */
.quiz-card { border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.quiz-list { list-style: none; margin: 0; padding: 6px 16px 14px; display: flex; flex-direction: column; gap: 16px; }
.quiz-q { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.quiz-q + .quiz-q { border-top: 1px solid var(--line); }
.quiz-text { display: flex; gap: 10px; margin: 0; font-weight: 600; line-height: 1.45; }
.quiz-opts { display: flex; flex-direction: column; gap: 6px; padding-left: 32px; }
.quiz-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-align: left; font-size: 14.5px; line-height: 1.4; }
.quiz-opt:not(:disabled):hover { border-color: var(--accent-line); background: var(--accent-soft); }
.quiz-letter { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font: 700 12px var(--mono); background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2); }
.quiz-opt.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.quiz-opt.ok .quiz-letter { background: var(--ok); border-color: var(--ok); color: #fff; }
.quiz-opt.ko { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.quiz-opt.ko .quiz-letter { background: var(--danger); border-color: var(--danger); color: #fff; }
.quiz-opt.off { opacity: .6; }
.quiz-opt:disabled { cursor: default; }
.quiz-why { margin: 0 0 0 32px; padding: 8px 12px; border-left: 3px solid var(--line-strong); color: var(--ink-2); font-size: 14px; }
.quiz-q.right .quiz-why { border-left-color: var(--ok); }
.quiz-q.wrong .quiz-why { border-left-color: var(--danger); }
.quiz-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.quiz-end b { font: 700 18px var(--display); }
.quiz-end > span:not(.quiz-actions) { flex: 1 1 200px; color: var(--ink-2); font-size: 14px; }
.quiz-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz-actions .btn-ghost, .quiz-actions .btn-primary { height: auto; min-height: 40px; padding: 8px 14px; font-size: 14px; white-space: normal; line-height: 1.25; }
@media (max-width: 520px) { .quiz-opts, .quiz-why { padding-left: 0; margin-left: 0; } .quiz-actions { width: 100%; } .quiz-actions button { flex: 1; } }

/* Rappels */
.rem-card, .list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); }
.rem-card { box-shadow: var(--shadow); flex-wrap: wrap; }
.rem-card.off { box-shadow: none; border-style: dashed; color: var(--ink-3); }
.rem-ico { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.rem-ico svg { width: 20px; height: 20px; }
.rem-meta { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rem-meta b { font-size: 14.5px; overflow-wrap: anywhere; }
.rem-meta small { color: var(--ink-3); font-size: 13px; }
.rem-meta small:first-letter { text-transform: uppercase; }
.rem-err { color: var(--accent-soft-ink) !important; }
.rem-card .btn-ghost, .rem-card .btn-primary, .list-row .btn-ghost { height: 36px; padding: 0 12px; font-size: 13px; }

/* Résultat d'un programme Python */
.code-head { gap: 4px; }
.code-head > span { flex: 1; }
.code-run { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: #F07A3E; color: #1A0D05; font: 600 12px var(--font); }
.code-run:hover { background: #FF8A4B; }
.code-run svg { width: 12px; height: 12px; }
.code-block:has(+ .py-out) { margin-bottom: 0; border-radius: 12px 12px 0 0; }
.py-out { margin: 0 0 14px; border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface); overflow: hidden; }
.py-out.failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.py-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; }
.py-head small { color: var(--ink-3); }
.py-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.py-head .btn-ghost { height: 32px; padding: 0 10px; font-size: 13px; }
.py-out.running .py-head { color: var(--ink-2); }
.py-out.running .btn-ghost { margin-left: auto; }
.py-text { margin: 0; padding: 12px 14px; max-height: 360px; overflow: auto; font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--surface); }
.py-err { color: var(--danger); }
.py-img { display: block; max-width: 100%; margin: 10px auto; border-radius: 8px; background: #fff; }
.py-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 12px; }
.py-files .btn-ghost { display: inline-flex; align-items: center; gap: 6px; height: 36px; font-size: 13px; }
.py-files svg { width: 15px; height: 15px; }
.py-empty { margin: 0; padding: 12px 14px; color: var(--ink-3); font-size: 13.5px; }

/* Versions d'une réponse régénérée */
.versions { display: inline-flex; align-items: center; gap: 0; margin-right: 4px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.versions .icon-btn:disabled { opacity: .35; }

/* Image synchronisée en version allégée */
.gen-image figcaption { padding: 6px 2px 0; font-size: 12.5px; color: var(--ink-3); }

/* Projet, listes du compte */
.project-dialog form { gap: 14px; }
.project-dialog .tpl-head { padding: 0; }
.project-dialog .tpl-lead { margin: -6px 0 0; }
.project-dialog select, .settings select#setStyle, .settings select#setLiveVoice { height: 42px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); font-weight: 400; }
.proj-files { display: flex; flex-direction: column; gap: 8px; }
.proj-files-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; }
.proj-files .attachments { padding: 0; }
.proj-files .py-empty { padding: 4px 0; }
.settings-actions .grow { flex: 1; }
.list-dialog { width: min(560px, calc(100vw - 24px)); max-height: min(80vh, 760px); }
.list-dialog[open] { display: flex; flex-direction: column; }
.list-body { overflow-y: auto; padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.list-row { box-shadow: none; flex-wrap: wrap; }
.list-row .btn-ghost.danger { color: var(--danger); }
.acc-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.acc-links .btn-ghost { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.acc-links .btn-ghost[hidden] { display: none; }
.acc-links svg { width: 16px; height: 16px; }

/* ---------- Galerie « Affiches pro » ---------- */
.posters .pst-filters { display: flex; flex: none; gap: 8px; overflow-x: auto; padding: 2px 20px 10px; scrollbar-width: none; }
.posters .pst-filters::-webkit-scrollbar { display: none; }
.pst-filters button { flex: none; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pst-filters button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pst { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; transition: border-color .15s, transform .15s, box-shadow .15s; }
.pst:hover, .pst:focus-visible { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .12); }
.pst b { font-size: 14px; line-height: 1.25; padding: 0 2px; }
.pst small { color: var(--ink-3); font-size: 12.5px; line-height: 1.35; padding: 0 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Mini-maquette : fond dégradé de la palette, logo, titre, sujet, bloc d'infos. */
.pst-mine { position: relative; padding: 0; }
.pst-pick { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; padding: 8px 8px 10px; border: 0; background: none; color: inherit; text-align: left; font: inherit; }
.pst-thumb { display: block; width: 100%; max-height: 210px; object-fit: cover; border-radius: 10px; background: var(--surface-2, #eee); }
.pst-blank { background: linear-gradient(160deg, var(--surface-2, #e8e8e8), var(--line)); }
.pst-del { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px; line-height: 28px; padding: 0; }
.pst-howto { margin-bottom: 4px; }
.pst-mock { position: relative; display: block; width: 100%; max-height: 210px; border-radius: 10px; overflow: hidden; background: radial-gradient(120% 80% at 80% 15%, color-mix(in srgb, var(--c1) 85%, transparent), transparent 60%), linear-gradient(160deg, var(--c0), color-mix(in srgb, var(--c0) 55%, #000) 90%); }
.pst-mock i { position: absolute; display: block; }
.pm-logo { left: 8%; top: 6%; width: 18%; height: 5%; border-radius: 3px; background: color-mix(in srgb, var(--c4) 80%, transparent); }
.pm-t1 { left: 8%; top: 15%; width: 62%; height: 10%; border-radius: 3px; background: var(--c3); }
.pm-t2 { left: 8%; top: 28%; width: 44%; height: 6%; border-radius: 3px; background: var(--c2); }
.pm-who { right: 4%; bottom: 0; width: 50%; height: 60%; background:
  radial-gradient(ellipse 19% 15% at 50% 21%, color-mix(in srgb, var(--c1) 35%, #2a1a12) 98%, transparent 100%),
  radial-gradient(ellipse 50% 46% at 50% 100%, color-mix(in srgb, var(--c4) 30%, #1a1a1a) 98%, transparent 100%); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c1) 60%, transparent)); }
.pm-who.pm-soft { opacity: .75; }
.pm-shape { right: 8%; bottom: 18%; width: 38%; aspect-ratio: 1; border-radius: 30% 70% 60% 40% / 40% 40% 60% 60%; background: var(--c2); opacity: .9; }
.pm-info { left: 8%; bottom: 7%; width: 46%; height: 9%; border-radius: 999px; background: var(--c2); box-shadow: 0 -14px 0 -4px color-mix(in srgb, var(--c4) 55%, transparent); }
@media (max-width: 520px) { .pst-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* Logos vectoriels */
.logo-card { margin: 12px 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); max-width: 520px; }
.logo-stage { display: flex; align-items: center; justify-content: center; padding: 28px; background: #fff; transition: background .2s; }
.logo-stage[data-bg="dark"] { background: #111318; }
.logo-stage[data-bg="none"] { background: repeating-conic-gradient(#e9e9ec 0 25%, #fff 0 50%) 0 0 / 18px 18px; }
.logo-img { display: block; width: 100%; max-width: 420px; max-height: 300px; object-fit: contain; }
.logo-actions { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.logo-bgs { display: inline-flex; gap: 6px; margin-right: auto; }
.logo-bg { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); padding: 0; background: #fff; }
.logo-bg[data-logo-bg="dark"] { background: #111318; }
.logo-bg[data-logo-bg="none"] { background: repeating-conic-gradient(#d5d5da 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.logo-bg.on { outline: 2px solid var(--accent, #c2410c); outline-offset: 2px; }
.logo-actions .btn-ghost, .logo-actions .btn-primary { height: 34px; padding: 0 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.logo-actions svg { width: 16px; height: 16px; }
