/* Polices servies par Jarvis (sous-ensemble latin, variables) : aucune requête externe, dispo hors ligne. */
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/sora.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/bricolage.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000000;
  --bg2: #000000;
  --panel: #000000;
  --panel2: #050505;
  /* Accent du thème : canaux RVB réutilisés partout via rgba(var(--acc), x). Voir themes.js. */
  --acc: 255,31,50;
  --acc-hi: 255,90,103;
  --line: rgba(var(--acc),.14);
  --line2: rgba(var(--acc),.28);
  --text: #ffffff;
  --muted: #d4d4d8;
  --dim: #a1a1aa;
  --accent: rgb(var(--acc));
  --accent-2: rgb(var(--acc-hi));
  --accent-deep: #c8001a;
  --accent-soft: rgba(var(--acc),.16);
  --link: rgb(var(--acc-hi));
  --warn: #ff6b6b;
  --ok: #34d399;
  /* Encre (texte) et ombre de fond en canaux RVB : inversés par le mode clair. */
  --ink: 255,255,255;
  --shade: 0,0,0;
  --font: "Sora", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Sora", system-ui, sans-serif;
  --price: "Cormorant Garamond", "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: 0;
  text-rendering: optimizeLegibility;
}
html:has(#auth:not([hidden])), body:has(#auth:not([hidden])) {
  height: auto; min-height: 100%; overflow-y: auto;
}
html:has(#app:not([hidden])), body:has(#app:not([hidden])) {
  height: 100%; overflow: hidden;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--link); }
::selection { background: rgba(var(--acc),.35); }
::-webkit-scrollbar { width: 8px; height: 8px; }

/* Anti DevTools : flou + overlay tant que les outils sont ouverts */
html.devtools-lock, html.devtools-lock body { overflow: hidden !important; }
html.devtools-lock body > *:not(#devtools-lock) {
  filter: blur(14px) saturate(.6);
  pointer-events: none !important;
  user-select: none !important;
}
#devtools-lock {
  position: fixed; inset: 0; z-index: 2147483646;
  display: grid; place-items: center;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(2px);
  padding: 24px;
}
.devtools-lock-card {
  max-width: 420px; text-align: center;
  background: #0a0a0a; border: 1px solid rgba(var(--acc),.35);
  border-radius: 14px; padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.devtools-lock-card b {
  display: block; font-family: var(--display); font-size: 1.25rem;
  letter-spacing: .02em; margin-bottom: 10px;
}
.devtools-lock-card p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.5; }
::-webkit-scrollbar-thumb {
  background: rgba(var(--ink),.12); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 8px 12px; font-size: 13px; }
kbd {
  font: 10px var(--mono); padding: 2px 6px; border: 1px solid var(--line2);
  border-radius: 6px; color: var(--dim); white-space: nowrap; background: rgba(var(--ink),.02);
}

.mark {
  --s: 22px; width: var(--s); height: var(--s); border-radius: 7px; flex: none;
  display: inline-grid; place-items: center; background: var(--accent); color: #fff;
  font: 700 calc(var(--s) * .48)/1 var(--display); letter-spacing: -.04em; user-select: none;
}
.mark::before { content: 'J'; }
.mark.sm { --s: 16px; border-radius: 5px; }
.mark.busy { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 99; }
.boot .mark { --s: 40px; border-radius: 11px; }

.brand { display: flex; align-items: center; gap: 12px; font: 600 14px var(--display); letter-spacing: -.02em; color: var(--text); }
.brand-text { display: grid; gap: 2px; line-height: 1.15; }
.brand-text b { font-weight: 700; letter-spacing: .04em; font-size: 13px; }
.brand-text small { color: var(--dim); font-size: 10px; letter-spacing: .02em; font-weight: 500; font-family: var(--font); }
.mini-reactor {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font: 700 14px/1 var(--display);
  background: linear-gradient(160deg, var(--accent-2), var(--accent-deep));
  box-shadow: 0 1px 0 rgba(var(--ink),.12) inset;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line2);
  font-weight: 500; transition: background .15s, border-color .15s, transform .15s;
  text-decoration: none; color: var(--text);
}
.btn:hover { background: rgba(var(--acc),.08); border-color: rgba(var(--acc),.45); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); color: #fff; border-color: transparent;
  font-weight: 600; box-shadow: 0 1px 0 rgba(var(--ink),.16) inset, 0 8px 22px rgba(var(--acc),.28);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent; border-color: rgba(var(--ink),.14); color: var(--text);
}
.btn.ghost:hover { border-color: rgba(var(--ink),.28); background: rgba(var(--ink),.03); }
.btn.warn { color: var(--warn); border-color: rgba(var(--acc-hi),.28); }
.btn.warn:hover { background: rgba(var(--acc-hi),.08); }
.btn.wide { width: 100%; padding: 12px; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.icon-btn.toggle[aria-pressed="true"] { color: var(--accent-2); background: var(--accent-soft); }
.only-mobile { display: none; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 14px; }
.field small { color: var(--dim); font-weight: 400; }
.field input, .field textarea, .field select, .search {
  width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line2); color: var(--text); font-size: 15px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .search:focus {
  border-color: rgba(var(--acc),.55); box-shadow: 0 0 0 3px var(--accent-soft);
}
.error { color: var(--warn); font-size: 13px; min-height: 1em; margin: 0 0 12px; }
#auth-error.hint { color: var(--muted); }
.pin-input { font-family: var(--mono); letter-spacing: .35em; font-size: 17px; }

/* ---------- auth / landing ---------- */
.lp-modal {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 24px;
}
.lp-modal[hidden] { display: none !important; }
.lp-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(8px);
}
.lp-modal-card.auth-card {
  position: relative; z-index: 1; width: min(420px, calc(100vw - 48px));
  max-width: 420px; max-height: min(92vh, 720px); overflow: auto;
  box-shadow: 0 28px 80px rgba(0,0,0,.65); justify-self: center;
}
.lp-modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border-radius: 8px; color: var(--dim); font-size: 22px; line-height: 1;
}
.lp-modal-close:hover { color: var(--text); background: rgba(var(--ink),.06); }

.auth-card {
  width: 100%; text-align: left;
  padding: 28px 26px 24px; background: var(--panel2);
  border: 1px solid rgba(var(--ink),.1); border-radius: 20px;
}
.auth-title {
  font-family: var(--display); font-size: 22px; font-weight: 700;
  letter-spacing: -.02em; margin: 0 0 4px;
}
.auth-step {
  margin: 0 0 18px; font-size: 12px; font-weight: 500; color: var(--dim);
}
.pin-field small { display: block; margin-top: 6px; color: var(--dim); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.tabs {
  display: flex; gap: 20px; border-bottom: 1px solid rgba(var(--ink),.06);
  margin-bottom: 20px;
}
.tab {
  padding: 0 0 10px; margin-bottom: -1px; font-size: 14px; font-weight: 550;
  color: var(--dim); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-color: var(--accent); }
.auth-card .field { margin-bottom: 14px; }
.auth-card .field input {
  background: var(--bg); border-color: rgba(var(--ink),.1);
}
.auth-card .btn.primary {
  height: 48px; border-radius: 10px; font-size: 15px; margin-top: 2px;
}
.fine { font-size: 12px; color: var(--dim); margin: 14px 0 0; line-height: 1.45; }


/* ---------- app shell ---------- */
.app {
  display: grid; grid-template-columns: 272px 1fr; height: 100dvh; position: relative;
  background: var(--bg);
}
.app::before { content: none; }
.sidebar {
  position: relative; z-index: 2; background: var(--bg);
  border-right: 1px solid rgba(var(--acc),.22);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 8px; min-height: 0;
}
.side-top { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 14px; }
.new-chat {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border-radius: 10px; font-size: 13.5px; font-weight: 550; color: var(--text);
  border: 1px solid rgba(var(--acc),.4); background: rgba(var(--acc),.08); transition: .15s;
}
.new-chat:hover, .new-chat:focus-visible {
  border-color: var(--accent); background: rgba(var(--acc),.18);
}
.new-chat .i { color: var(--accent); width: 16px; height: 16px; }
.new-chat kbd { margin-left: auto; }
.search {
  padding: 9px 12px; font-size: 13px; background: rgba(var(--ink),.02);
  border-radius: 10px; border-color: var(--line);
}
.conv-list { flex: 1; overflow-y: auto; margin: 4px -2px 0; padding: 0 2px; }
.group {
  font-size: 10px; font-weight: 600; color: var(--dim); padding: 18px 10px 6px;
  letter-spacing: .1em; text-transform: uppercase;
}
.conv { display: flex; align-items: center; border-radius: 10px; border: 1px solid transparent; }
.conv:hover { background: rgba(var(--ink),.03); }
.conv.active { background: rgba(var(--acc),.14); border-color: rgba(var(--acc),.45); }
.conv-title {
  flex: 1; min-width: 0; padding: 9px 12px; color: var(--text); text-decoration: none;
  font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv:not(.active) .conv-title { color: var(--muted); }
.conv-more { opacity: 0; padding: 2px 8px; color: var(--muted); }
.conv:hover .conv-more, .conv.active .conv-more { opacity: 1; }
.side-bottom {
  margin-top: auto; padding: 12px; border: 1px solid rgba(var(--acc),.28); border-radius: 14px;
  background: var(--bg); display: grid; gap: 6px;
}
.usage { padding: 2px 4px 6px; font-size: 12px; }
.usage-row { display: flex; justify-content: space-between; color: var(--dim); margin-bottom: 8px; font-size: 11.5px; }
.usage-row span:first-child { color: var(--muted); font-weight: 550; }
.bar { height: 3px; border-radius: 2px; background: rgba(var(--acc),.15); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; box-shadow: 0 0 10px rgba(var(--acc),.55); }
.usage.high .bar i { background: var(--warn); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; width: 100%; }
.user-btn:hover { background: rgba(var(--ink),.04); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 600 12px var(--display); background: var(--accent-soft); border: 1px solid rgba(var(--acc),.3);
  color: var(--accent-2); flex: none;
}
.user-meta { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.user-meta b { font-weight: 550; font-size: 13px; }
.user-meta b, .user-meta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--dim); font-size: 11.5px; }
.user-meta small.online::before {
  content: ""; display: inline-block; width: 6px; height: 6px; background: var(--ok);
  border-radius: 50%; margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 2px rgba(52,211,153,.18);
}
.gear { color: var(--dim); display: grid; }
.admin-link {
  display: block; margin-bottom: 2px; padding: 8px 10px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); text-decoration: none; text-align: left;
}
.admin-link:hover { background: rgba(var(--ink),.04); color: var(--text); }
.scrim { display: none; }

.main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  overflow: hidden; background: transparent; z-index: 1;
}
.main.drag::after { display: none !important; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 12px 24px; min-height: 56px;
  border-bottom: 0; background: transparent; position: relative; z-index: 5;
}
.model-picker { position: relative; }
.model-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-weight: 550; font-size: 13px; border: 1px solid var(--line2); color: var(--text);
  background: rgba(var(--ink),.03);
}
.model-btn:hover { background: var(--accent-soft); border-color: rgba(var(--acc),.35); }
.chev { color: var(--dim); font-size: 10px; }
.top-actions { margin-left: auto; }
.top-actions .icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); color: var(--muted);
}
.top-actions .icon-btn:hover { color: var(--text); border-color: rgba(var(--acc),.3); }
.menu {
  position: absolute; z-index: 30; min-width: 280px; background: var(--bg);
  border: 1px solid rgba(var(--acc),.3); border-radius: 14px; padding: 6px;
  box-shadow: 0 16px 40px rgba(0,0,0,.7);
}
.model-picker .menu { top: calc(100% + 6px); left: 0; }
.pop { position: fixed; min-width: 170px; z-index: 95; } /* au-dessus du tiroir mobile (50) et de son voile */
.menu-item { display: grid; width: 100%; text-align: left; padding: 9px 11px; border-radius: 10px; gap: 2px; font-size: 13.5px; }
.menu-item:hover, .menu-item.active { background: rgba(var(--acc),.1); }
.menu-item.active .mi-main::after { content: '✓'; margin-left: auto; color: var(--accent); }
.menu-item.locked { opacity: .45; }
.menu-item.warn { color: var(--warn); }
.menu-item small { color: var(--dim); font-size: 12px; }
.mi-main { display: flex; align-items: center; gap: 8px; }
.mi-main b { font-weight: 550; }
.pro {
  font: 600 9px var(--font); font-style: normal; padding: 2px 6px; border-radius: 999px;
  border: 1px solid rgba(var(--acc),.35); color: var(--accent-2); letter-spacing: .04em;
}

/* empty + messages */
.scroller { flex: 1; overflow-y: auto; }
.empty {
  max-width: 760px; margin: 0 auto; padding: 8vh 28px 28px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.hero-mark {
  width: 80px; height: 80px; margin: 0 auto 28px; border-radius: 22px;
  display: grid; place-items: center; position: relative;
  background: linear-gradient(160deg, var(--accent-2), var(--accent-2) 55%, var(--accent-deep));
  color: #fff; font: 750 34px/1 var(--display);
  box-shadow: 0 1px 0 rgba(var(--ink),.22) inset, 0 0 0 1px rgba(var(--acc),.35), 0 22px 50px rgba(var(--acc),.45);
}
.hero-mark::after {
  content: ''; position: absolute; inset: -12px; border-radius: 28px;
  border: 1px solid rgba(var(--acc),.35); pointer-events: none;
  box-shadow: 0 0 40px rgba(var(--acc),.2);
}
.empty h2 {
  font-family: var(--display); font-size: clamp(28px, 3.6vw, 40px); font-weight: 700;
  margin: 0 0 8px; text-align: center; color: var(--text); letter-spacing: -.04em;
}
.empty .tagline {
  color: var(--accent-2); font-size: clamp(15px, 1.8vw, 17px); margin: 0 0 36px;
  font-weight: 500; max-width: 26em; line-height: 1.45;
}
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.starter {
  padding: 14px; min-height: 56px; text-align: left; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; line-height: 1.35; color: var(--text); cursor: pointer; font-weight: 500;
  border: 1px solid rgba(var(--acc),.22); border-radius: 12px; background: var(--bg);
  transition: border-color .15s, background .15s, transform .15s;
}
.starter:hover {
  border-color: var(--accent); background: rgba(var(--acc),.12); transform: translateY(-1px);
}
.starter > span {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: rgba(var(--acc),.18); color: var(--text); font-size: 12px; font-weight: 700;
  border: 1px solid rgba(var(--acc),.4); font-family: var(--display);
}

.messages { max-width: 760px; margin: 0 auto; padding: 16px 24px 40px; }
.msg { margin-bottom: 28px; }
.msg.user { display: grid; justify-items: end; }
.bubble {
  background: var(--bg); border: 1px solid rgba(var(--acc),.28); padding: 11px 14px;
  border-radius: 16px 16px 4px 16px; max-width: 80%; white-space: pre-wrap; word-wrap: break-word;
}
.msg.user .bubble {
  background: rgba(var(--acc),.14); border-color: rgba(var(--acc),.4);
}
.msg-att { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; }
.msg-att img { max-width: 220px; max-height: 220px; border-radius: 10px; cursor: zoom-in; }
.file-pill { padding: 6px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line2); font: 12.5px var(--mono); }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.msg-head b { font: 500 13px var(--font); color: var(--muted); }
.msg-head small { color: var(--dim); font: 12px var(--mono); }
.actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .12s; }
.msg:hover .actions, .msg:last-child .actions { opacity: 1; }
.act { padding: 3px 9px; font-size: 12px; color: var(--dim); border-radius: 6px; }
.act:hover { background: var(--panel2); color: var(--text); }
.status { color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots b { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.dots b:nth-child(2) { animation-delay: .15s; } .dots b:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.caret { display: inline-block; width: 6px; height: 1.05em; vertical-align: text-bottom; background: var(--accent); margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.error-box { padding: 10px 14px; border-radius: 8px; background: rgba(var(--acc-hi),.08); border: 1px solid rgba(var(--acc-hi),.25); color: #f0b0b0; font-size: 14px; }
.reasoning { border-left: 2px solid var(--line2); padding: 0 0 0 14px; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.reasoning summary { cursor: pointer; font-weight: 500; color: var(--dim); }
.reasoning-body { white-space: pre-wrap; max-height: 320px; overflow-y: auto; margin-top: 6px; }
.sources { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.source { flex: none; width: 190px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 13px; display: grid; gap: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source:hover { background: var(--panel); }
.source span { font: 11px var(--mono); color: var(--dim); }
.source small { color: var(--dim); }
.gen { margin: 10px 0 0; display: grid; gap: 8px; justify-items: start; }
.gen img { max-width: min(100%, 520px); border-radius: 10px; cursor: zoom-in; }
.img-skeleton {
  width: min(100%, 420px); aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; color: var(--dim); font-size: 14px;
  background: linear-gradient(110deg, var(--panel) 30%, var(--panel2) 50%, var(--panel) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

/* markdown */
.md { word-wrap: break-word; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h2, .md h3, .md h4, .md h5 { margin: 22px 0 8px; line-height: 1.3; letter-spacing: -.015em; font-weight: 600; font-family: var(--display); }
.md h2 { font-size: 20px; } .md h3 { font-size: 17px; } .md h4, .md h5 { font-size: 15px; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 12px; }
.md li { margin: 3px 0; } .md li.sub { margin-left: 20px; }
.md li::marker { color: var(--dim); }
.md strong { font-weight: 600; }
.md code { font: 13px var(--mono); background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 2px solid var(--accent); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md a { text-underline-offset: 3px; }
.code { margin: 0 0 14px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel2); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); font: 12px var(--mono); color: var(--dim); }
.copy-code { font-size: 12px; color: var(--dim); padding: 2px 6px; border-radius: 5px; }
.copy-code:hover { color: var(--text); }
.code pre { margin: 0; padding: 14px; overflow-x: auto; }
.code code { background: none; padding: 0; font-size: 13px; line-height: 1.6; }
.math { font: 14px var(--mono); text-align: center; padding: 12px; margin: 0 0 12px; background: var(--panel); border-radius: 8px; overflow-x: auto; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 8px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.md th { font-weight: 500; color: var(--muted); font-size: 13px; }
.md tr:last-child td { border-bottom: 0; }
.task { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--line2); border-radius: 3px; margin-right: 8px; vertical-align: -2px; }
.task.done { background: var(--muted); border-color: var(--muted); }
.cite { font: 10px var(--mono); color: var(--muted); background: var(--panel2); padding: 0 4px; border-radius: 4px; margin-left: 1px; }

/* composer */
.composer-wrap { padding: 0 24px 20px; position: relative; }
.composer {
  max-width: 760px; margin: 0 auto; background: var(--bg);
  border: 1px solid rgba(var(--acc),.4); border-radius: 18px; padding: 12px 12px 10px 16px;
  box-shadow: 0 0 0 1px rgba(var(--acc),.08), 0 16px 48px rgba(var(--acc),.12);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--acc),.18), 0 16px 48px rgba(var(--acc),.22);
}
.composer textarea {
  width: 100%; resize: none; border: 0; background: none; outline: none;
  font-size: 15px; max-height: 260px; padding: 4px 2px; display: block;
}
.composer textarea::placeholder { color: var(--dim); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.composer-bar .left, .composer-bar .right { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted); border: 1px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: var(--text); background: rgba(var(--ink),.04); }
.chip.toggle[aria-pressed="true"] {
  color: var(--accent-2); background: var(--accent-soft); border-color: rgba(var(--acc),.3);
}
.chip.select { background: rgba(var(--ink),.03); border-color: var(--line2); outline: none; }
.send {
  width: 36px; height: 36px; border-radius: 50%; font-size: 15px; font-weight: 600;
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent-2));
  transition: filter .12s; box-shadow: 0 1px 0 rgba(var(--ink),.2) inset, 0 0 18px rgba(var(--acc),.45);
}
.send:hover { filter: brightness(1.1); }
.send.stop { font-size: 12px; }
#mic-btn.rec { color: var(--warn); background: rgba(var(--acc-hi),.12); }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments:not(:empty) { margin-bottom: 8px; }
.att { position: relative; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); font: 12.5px var(--mono); display: flex; align-items: center; }
.att img { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; display: block; }
.att > span { padding: 7px 28px 7px 10px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line2); font-size: 9px; }
.disclaimer { text-align: center; font-size: 12px; color: var(--dim); margin: 8px 0 0; }
.to-bottom { position: absolute; top: -44px; left: 50%; transform: translateX(-50%); width: 32px; height: 32px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line2); }

/* voice — layout flottant complété dans app-premium.css */
.voice-hud {
  --lvl: 0; display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.voice-hud .btn { padding: 4px 10px; font-size: 12px; }
.voice-hud.listening { border-color: rgba(var(--acc-hi),.35); color: var(--warn); }
.voice-hud.thinking .voice-core { animation: pulse 1.2s ease-in-out infinite; }

/* modal / settings */
.modal {
  width: min(540px, calc(100vw - 32px)); max-height: 88vh; padding: 0; border: 1px solid rgba(var(--acc),.3);
  border-radius: 14px; background: var(--bg); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 40px rgba(var(--acc),.1);
}
.modal::backdrop, .lightbox::backdrop { background: rgba(0,0,0,.72); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; font-family: var(--display); }
.modal-body { padding: 0 18px 18px; }
.modal-body section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.modal-body section:last-child { border-bottom: 0; }
.modal-body section[hidden] { display: none !important; }
.modal-body h4 { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: var(--muted); }
.danger .row, .modal-body .row { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-body .row .grow { flex: 1 1 220px; min-width: 0; }
.modal-body .row input.grow { padding: 9px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); outline: none; }
.modal-body .row input.grow:focus { border-color: rgba(var(--acc),.55); }
.set-tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.set-tabs::-webkit-scrollbar { display: none; }
.set-tabs button { position: relative; padding: 10px 12px; font: 500 13px var(--font); color: var(--muted); white-space: nowrap; background: none; border: 0; cursor: pointer; }
.set-tabs button:hover { color: var(--text); }
.set-tabs button[aria-selected="true"] { color: var(--text); }
.set-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 1px; }
.set-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }

.meters { display: grid; gap: 14px; }
.meter-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.meter-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.meter small { display: block; margin-top: 5px; color: var(--dim); font-size: 12px; }
.meter.high .bar i, .meter.full .bar i { background: var(--warn); }
.meter .bar { height: 4px; }
.credits-box { margin-top: 16px; padding: 14px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg2); }
.credits-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.credits-head b { font: 500 20px var(--font); color: var(--text); font-variant-numeric: tabular-nums; }
.credits-box .muted { margin: 6px 0 10px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pack { display: grid; justify-items: center; gap: 1px; padding: 10px 6px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); }
.pack b { font-size: 16px; font-weight: 500; }
.pack small { color: var(--dim); font-size: 11px; }
.pack span { margin-top: 4px; font: 500 12px var(--mono); color: var(--muted); }

.item-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.item-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); font-size: 13.5px; }
.item-list li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-list li small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.item-list li .tag { font-size: 11px; font-weight: 500; color: var(--accent-2); }
.item-list .empty-item { color: var(--dim); justify-content: center; border-style: dashed; }
.item-list .x { width: 26px; height: 26px; border-radius: 6px; color: var(--muted); flex: none; }
.item-list .x:hover { color: var(--warn); background: rgba(var(--acc-hi),.1); }
.item-list li > span.tag { flex: none; }

.lightbox { padding: 0; border: 0; background: none; max-width: 94vw; max-height: 94vh; }
.lightbox button { padding: 0; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; display: block; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 9px 16px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line2);
  color: var(--text); font-weight: 500; transition: .2s; z-index: 100; font-size: 14px; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--warn); color: #1a0a0a; border-color: transparent; }

@media (max-width: 960px) {
  .auth-card { padding: 24px 20px; }
}
@media (max-width: 780px) {
  .only-mobile { display: inline-grid; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 88vw); z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 40; }
  .new-chat kbd { display: none; }
  .brand-text { display: none; }
  .app .logo .wordmark { display: block; }
  .starters { grid-template-columns: 1fr; }
  .empty { padding-top: 4vh; }
  .hero-mark { width: 60px; height: 60px; font-size: 26px; margin-bottom: 22px; }
  .messages { padding: 12px 16px 30px; }
  .composer-wrap { padding: 0 12px 14px; }
  .composer { border-radius: 16px; padding: 10px 12px 8px 14px; }
  .menu { min-width: min(280px, calc(100vw - 32px)); }
  .actions { opacity: 1; }
  .bubble { max-width: 90%; }
}
@media (max-width: 520px) {
  .starters { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .mark.busy, .dots b, .caret, .img-skeleton, .voice-hud.thinking .voice-core,
  .core-visual .cv-spin, .core-visual .cv-pulse, .core-visual .cv-core { animation: none !important; }
}


/* Historique paginé : bouton/sentinelle « Plus de conversations » */
.conv-more-load { display: block; width: calc(100% - 16px); margin: 6px 8px 10px; padding: 8px; border: 1px dashed var(--line, rgba(var(--ink),.12)); border-radius: 10px; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.conv-more-load:hover { color: var(--text, var(--text)); border-color: var(--accent, #e11d38); }

/* Hors ligne : indicateur + messages en attente d'envoi */
#user-username.offline { color: #f59e0b; }
.user-meta small.offline::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #f59e0b; vertical-align: 1px; }
.msg.user.pending { opacity: .62; }
.msg.user .pending-note { margin-top: 4px; font-size: 11.5px; color: var(--muted); text-align: right; }
.msg.user .pending-note::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #f59e0b; vertical-align: 1px; }
.packs-note { grid-column: 1 / -1; margin: 2px 0 0; text-align: center; }

/* ---------- photo de profil ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-img { background: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.avatar-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- glisser pour ouvrir / appui long ---------- */
.sidebar.dragging, .scrim.dragging { transition: none !important; }
.scrim { transition: opacity .2s; }
#conv-list .conv a { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#conv-list .conv.held { background: rgba(var(--acc),.12); transform: scale(.98); transition: transform .15s, background .15s; }
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90; opacity: 0; transition: opacity .18s; }
.sheet-back.show { opacity: 1; }
.sheet {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 91;
  max-width: 480px; margin: 0 auto; padding: 6px; border-radius: 18px;
  background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 -10px 40px rgba(0,0,0,.6);
  transform: translateY(115%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sheet.show { transform: none; }
.sheet-title { padding: 10px 12px 8px; color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sheet-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 12px; border-radius: 12px; font-size: 15px; text-align: left; color: var(--text); }
.sheet-btn .i { width: 18px; height: 18px; }
.sheet-btn:active { background: rgba(var(--ink),.06); }
.sheet-btn.warn { color: var(--warn); }
.sheet-btn.cancel { justify-content: center; color: var(--muted); margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }

/* ---------- longues conversations ---------- */
.msg-older { display: block; margin: 4px auto 14px; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; color: var(--dim); border: 1px solid var(--line); }
.msg-older:hover { color: var(--text); border-color: var(--line2); }
/* Les messages hors écran ne sont ni mis en page ni peints. */
.messages > .msg:not(:last-child) { content-visibility: auto; contain-intrinsic-size: auto 160px; }

.limit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.limit-actions .primary { background: #e11d2e; border-color: #e11d2e; color: #fff; }
.limit-banner { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 9px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid #e11d2e; color: var(--text); font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.55); }
.limit-banner .limit-x { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 14px; padding: 2px 4px; }

/* Répartition de l’utilisation */
.usage-history { margin-top: 20px; padding: 14px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg2); }
.usage-history h4 { margin: 0 0 7px; }
.usage-history p { margin: 6px 0 10px; }
.usage-history-list { display: grid; gap: 8px; font-size: 13px; }
.usage-history-row { display: flex; justify-content: space-between; gap: 12px; }
.usage-history-row b { font-variant-numeric: tabular-nums; }

/* Projets */
.proj-btn small.proj-current { margin-left: auto; color: var(--accent); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-intro, .proj-limit { opacity: .75; font-size: .9em; margin: .5em 0; }
.proj-new { display: flex; gap: .5em; margin: .75em 0; }
.proj-new input { flex: 1; min-width: 0; }
.proj-list { display: grid; gap: .75em; max-height: 60vh; overflow: auto; }
.proj-card { border: 1px solid rgba(var(--ink),.1); border-radius: 10px; padding: .75em; }
.proj-card.active { border-color: var(--accent); }
.proj-head { display: flex; justify-content: space-between; gap: .5em; flex-wrap: wrap; }
.proj-head small { opacity: .7; }
.proj-acts { display: flex; gap: .4em; flex-wrap: wrap; margin: .5em 0; }
.proj-files { list-style: none; margin: 0; padding: 0; display: grid; gap: .25em; }
.proj-files li { display: flex; align-items: center; gap: .5em; font-size: .9em; }
.proj-files li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-files li small { opacity: .7; }

/* Écrans tactiles : pas de survol, le bouton ⋯ (renommer, supprimer…) reste visible et assez grand pour le doigt. */
@media (hover: none) {
  .conv-more { opacity: .75; min-width: 40px; min-height: 36px; padding: 6px 10px; }
}

/* Statut en direct du mode dev : libellé + chrono + plan à cocher, sous le dernier message */
.dev-live { margin: 6px 0 14px; padding: 10px 14px; border: 1px solid rgba(var(--acc), .35); border-radius: 12px; background: rgba(var(--acc), .06); font-size: 14px; color: var(--muted); }
.dev-live .live-row { display: flex; align-items: center; gap: 8px; }
.dev-live .live-lbl { color: var(--text, var(--text)); }
.dev-live .live-t { font-variant-numeric: tabular-nums; }
.dev-live .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: live-pulse 1.2s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .3; } }
.dev-live .live-plan { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.dev-live .live-plan li { padding-left: 24px; position: relative; }
.dev-live .live-plan li::before { content: ''; position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border: 1.5px solid #666; border-radius: 4px; }
.dev-live .live-plan li.cur { color: var(--text, var(--text)); }
.dev-live .live-plan li.cur::before { border-color: var(--accent); }
.dev-live .live-plan li.ok { text-decoration: line-through; opacity: .7; }
.dev-live .live-plan li.ok::before { content: '✓'; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 11px; line-height: 14px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .dev-live .live-dot { animation: none; } }
.dev-summary { margin-top: 10px; padding: 8px 12px; border: 1px solid var(--line, #2a2a2a); border-radius: 10px; font-size: 14px; }
.dev-summary summary { cursor: pointer; }
.dev-summary ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.dev-summary .p { color: #4ade80; font-weight: 600; }
.dev-summary .m { color: var(--accent); font-weight: 600; }
.dev-summary .dev-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dev-summary .cmd-ok { color: var(--muted); }
.dev-summary .cmd-ko { color: var(--accent); }
.dev-summary .act.danger { border-color: var(--accent); color: var(--accent); }
.dev-summary .act.danger:disabled { opacity: .6; }

/* Couche premium de l'interface connectée — fond noir plein, accents rouges discrets. */
.app {
  --display: "Bricolage Grotesque", "Sora", system-ui, sans-serif;
  --glass: rgba(var(--shade), .72);
  --edge: rgba(var(--ink), .08);
  --edge-red: rgba(var(--acc), .28);
  background: var(--bg);
}
.app::after { content: none; display: none; }

/* ---------- barre latérale ---------- */
.app .sidebar {
  background: var(--bg);
  border-right: 1px solid rgba(var(--ink), .08);
  box-shadow: none;
  padding: 18px 14px; gap: 10px;
}
.app .sidebar .brand { letter-spacing: .02em; }
.app .sidebar .brand b, .app .sidebar .brand-text b { font-family: var(--display); font-weight: 700; letter-spacing: .06em; }
.app .new-chat {
  padding: 11px 14px; border-radius: 12px; font-weight: 600;
  border: 1px solid rgba(var(--acc-hi), .35);
  background: linear-gradient(180deg, rgba(var(--acc), .2), rgba(var(--acc), .07));
  box-shadow: inset 0 1px 0 rgba(var(--ink), .08), 0 8px 24px -12px rgba(var(--acc), .6);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.app .new-chat:hover, .app .new-chat:focus-visible {
  transform: translateY(-1px); border-color: rgba(var(--acc-hi), .7);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .12), 0 12px 30px -12px rgba(var(--acc), .85);
}
.app .new-chat kbd {
  font: 500 10.5px var(--mono); padding: 2px 6px; border-radius: 6px;
  background: rgba(var(--shade), .4); border: 1px solid var(--edge); color: rgba(var(--ink), .55);
}
.app .search {
  padding: 10px 12px 10px 34px; border-radius: 11px; border: 1px solid var(--edge);
  background: rgba(var(--ink), .025) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23786a6c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='m9.5 9.5 3 3'/%3E%3C/svg%3E") no-repeat 12px 50%;
  transition: border-color .15s, background-color .15s;
}
.app .search:focus { border-color: var(--edge-red); background-color: rgba(var(--acc), .04); outline: none; }
.app .group { font: 600 10px var(--mono); letter-spacing: .14em; color: rgba(var(--ink), .32); padding: 18px 12px 6px; }
.app .conv { border-radius: 10px; position: relative; transition: background .12s; }
.app .conv:hover { background: rgba(var(--ink), .035); }
.app .conv.active {
  background: linear-gradient(90deg, rgba(var(--acc), .16), rgba(var(--acc), .03));
  border-color: transparent;
}
.app .conv.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.app .side-bottom {
  border: 1px solid rgba(var(--ink), .1); border-radius: 16px; padding: 12px;
  background: var(--bg);
  box-shadow: none;
}
.app .usage-row span:first-child { color: var(--text); font-weight: 600; }
.app .usage-row { font-size: 11.5px; }
.app .bar { height: 4px; border-radius: 4px; background: rgba(var(--ink), .06); }
.app .bar i { background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); border-radius: 4px; }
.app .avatar {
  width: 34px; height: 34px; font: 700 13px var(--display); color: #fff;
  background: linear-gradient(150deg, var(--accent-2), var(--accent-deep)); border: 0;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .6), 0 0 0 3px rgba(var(--acc), .45);
}
.app .user-btn { border-radius: 12px; }
.app .gear { transition: transform .3s, color .2s; }
.app .user-btn:hover .gear { transform: rotate(60deg); color: var(--text); }

/* ---------- barre du haut ---------- */
.app .topbar { padding: 14px 26px; }
.app .model-btn {
  padding: 8px 14px; font-weight: 600; border: 1px solid var(--edge);
  background: rgba(var(--ink), .04); backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .06);
}
.app .model-btn::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.app .model-btn:hover { border-color: var(--edge-red); background: rgba(var(--acc), .08); }
.app .top-actions .icon-btn { border-color: var(--edge); background: rgba(var(--ink), .03); }
.app .menu {
  background: rgba(14, 9, 10, .92); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--edge); border-radius: 16px; padding: 6px;
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, .85), 0 0 0 1px rgba(var(--acc), .08);
  animation: ap-pop .16s ease-out;
}
.app .menu-item { border-radius: 11px; }
.app .menu-item:hover, .app .menu-item.active { background: rgba(var(--acc), .1); }
@keyframes ap-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- accueil vide ---------- */
.app .empty { padding-top: 9vh; position: relative; }
.app .empty::before { content: none; display: none; }
.app .hero-mark {
  width: 72px; height: 72px; border-radius: 22px; font: 800 32px/1 var(--display);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .3), 0 0 0 1px rgba(var(--acc-hi), .4), 0 24px 60px -6px rgba(var(--acc), .6);
}
.app .hero-mark::after {
  inset: -14px; border-radius: 30px; border: 1px solid rgba(var(--acc), .22);
  box-shadow: none; animation: ap-ring 3.6s ease-in-out infinite;
}
@keyframes ap-ring { 50% { inset: -20px; border-radius: 34px; opacity: .25; } }
.app .empty h2 {
  font: 700 clamp(32px, 4.4vw, 52px)/1.05 var(--display); letter-spacing: -.03em;
  font-variation-settings: 'opsz' 96; margin-bottom: 12px;
  background: linear-gradient(180deg, var(--text) 30%, rgba(var(--ink), .62)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app .empty .tagline { color: rgba(var(--ink), .55); font-weight: 400; margin-bottom: 40px; }
.app .starters { gap: 12px; }
.app .starter {
  min-height: 64px; padding: 14px 16px; border-radius: 14px; font-weight: 500; position: relative; overflow: hidden;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(var(--ink), .04), rgba(var(--ink), .012));
  box-shadow: inset 0 1px 0 rgba(var(--ink), .05);
  transition: transform .18s, border-color .18s, background .18s;
}
.app .starter::after {
  content: "→"; margin-left: auto; color: var(--accent); opacity: 0; transform: translateX(-6px);
  transition: opacity .18s, transform .18s;
}
.app .starter:hover {
  transform: translateY(-2px); border-color: var(--edge-red);
  background: linear-gradient(180deg, rgba(var(--acc), .12), rgba(var(--acc), .03));
}
.app .starter:hover::after { opacity: 1; transform: none; }
.app .starter > span {
  background: rgba(var(--acc), .12); border: 1px solid rgba(var(--acc), .3);
  color: var(--accent-2); font: 500 11px var(--mono); border-radius: 9px;
}

/* ---------- messages ---------- */
.app .msg { animation: ap-in .25s ease-out; }
@keyframes ap-in { from { opacity: 0; transform: translateY(6px); } }
.app .bubble { border: 1px solid var(--edge); background: rgba(var(--ink), .03); }
.app .msg.user .bubble {
  border: 1px solid rgba(var(--acc-hi), .35); border-radius: 18px 18px 6px 18px; padding: 12px 16px;
  background: linear-gradient(160deg, rgba(var(--acc), .22), rgba(var(--acc), .08));
  box-shadow: inset 0 1px 0 rgba(var(--ink), .06);
}
.app .msg-head b { font: 600 13px var(--display); color: var(--text); letter-spacing: .02em; }
.app .md pre, .app .code {
  border: 1px solid var(--edge) !important; border-radius: 14px !important;
  background: var(--bg) !important;
}

/* ---------- zone de saisie ---------- */
.app .composer-wrap { padding: 0 26px 18px; }
.app .composer-wrap::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 40px; pointer-events: none;
  background: linear-gradient(transparent, var(--bg));
}
.app .composer {
  border-radius: 22px; border: 1px solid rgba(var(--ink), .1);
  background: var(--bg);
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(var(--ink), .04);
  transition: border-color .2s, box-shadow .2s;
}
.app .composer:focus-within {
  border-color: rgba(var(--acc-hi), .45);
  box-shadow: inset 0 1px 0 rgba(var(--ink), .06), 0 0 0 3px rgba(var(--acc), .08);
}
.app .chip { border-radius: 999px; border: 1px solid transparent; transition: .15s; }
.app .chip:hover { border-color: var(--edge); background: rgba(var(--ink), .05); }
.app .chip.toggle[aria-pressed="true"] { background: rgba(var(--acc), .16); border-color: rgba(var(--acc-hi), .45); color: var(--text); }
.app .send {
  background: linear-gradient(160deg, var(--accent-2), var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(var(--ink), .3), 0 6px 18px -4px rgba(var(--acc), .7);
  transition: transform .15s, filter .15s;
}
.app .send:hover { transform: scale(1.06); filter: brightness(1.08); }
.app .disclaimer { color: rgba(var(--ink), .3); font-size: 11.5px; }

/* ---------- réglages ---------- */
.modal {
  border: 1px solid rgba(var(--ink), .1) !important; border-radius: 22px !important;
  background: var(--bg) !important;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .9) !important;
}
.modal::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(4px); }

/* ---------- marque / noyau ---------- */
.app .brand { gap: 12px; }
.app .mini-reactor {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; padding: 0;
  box-shadow: 0 0 0 1px rgba(var(--acc-hi), .35), 0 10px 24px -8px rgba(var(--acc), .55);
}
.app .welcome-core {
  width: min(210px, 46vw); height: min(210px, 46vw);
  margin: 0 auto 10px; color: var(--text);
}
.app .welcome-core .core-visual { width: 100%; height: 100%; display: block; }
.app .welcome-core .welcome-logo { width: 100%; height: 100%; display: block; object-fit: contain; }
.app .core-visual .cv-spin { transform-box: view-box; transform-origin: 0 0; }
.app .core-visual .cv-slow { animation: none; }
.app .core-visual .cv-rev { animation: ap-spin 90s linear infinite reverse; }
.app .core-visual .cv-mid { animation: ap-spin 46s linear infinite; }
.app .core-visual .cv-orbit { animation: none; }
.app .core-visual .cv-fast { animation: ap-spin 12s linear infinite; }
.app .core-visual .cv-pulse,
.app .core-visual .cv-core { transform-box: view-box; transform-origin: 0 0; animation: ap-breathe 4s ease-in-out infinite; }
.app .core-visual .cv-packet { filter: none; }
.app .core-visual .cv-halo { animation: none; }
.app .core-visual .cv-particles { display: none; }
.app .core-visual.is-thinking .cv-fast { animation-duration: 1.4s; }
@keyframes ap-spin { to { transform: rotate(360deg); } }
@keyframes ap-breathe {
  0%, 100% { transform: scale(.94); }
  50% { transform: scale(1.04); }
}
@keyframes ap-halo {
  0%, 100% { opacity: .85; }
  50% { opacity: 1; }
}
@keyframes ap-twinkle {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}
.app .empty .hero-mark { display: none; }
.app .mark-svg { color: var(--text); flex: none; display: block; }
.app .msg-head .mark-svg { margin-right: 2px; }
.app .mark-svg.mark-busy .mk-orbit {
  transform-origin: 32px 32px; animation: ap-spin 2.4s cubic-bezier(.6, 0, .4, 1) infinite;
}
.app .mark-svg.mark-busy .mk-core,
.app .mark-svg.mark-busy .mk-glow {
  transform-origin: 32px 32px; animation: ap-mark-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes ap-mark-pulse {
  from { transform: scale(.85); opacity: .7; }
  to { transform: scale(1.08); opacity: 1; }
}

/* ---------- usage card ---------- */
.app .usage-card {
  display: grid; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--edge);
  background: rgba(var(--ink), .025); transition: border-color .15s, background .15s;
}
.app .usage-card:hover { border-color: var(--edge-red); background: rgba(var(--acc), .06); }
.app .usage-card.high .bar i { background: linear-gradient(90deg, var(--accent-2), #ffb3be); }

/* ---------- image bar + drop ---------- */
.app .image-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 2px 4px 10px;
}
.app .image-bar[hidden] { display: none !important; }
.app .image-badge {
  font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-2); background: rgba(var(--acc), .12); border: 1px solid rgba(var(--acc-hi), .35);
  border-radius: 999px; padding: 5px 10px;
}
.app .mini-select {
  height: 30px; padding: 0 28px 0 10px; border-radius: 8px;
  border: 1px solid var(--edge); background: rgba(var(--shade), .35)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m3 5 4 4 4-4'/%3E%3C/svg%3E")
    no-repeat right 8px center; appearance: none; color: var(--text); font-size: .8rem;
}
.app .ratio-group { display: flex; gap: 4px; }
.app .ratio-group button {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--edge);
  background: transparent; color: rgba(var(--ink), .55); font: 500 .75rem/1 var(--mono); cursor: pointer;
}
.app .ratio-group button[aria-checked="true"] {
  color: var(--text); border-color: rgba(var(--acc-hi), .55); background: rgba(var(--acc), .14);
}
.app .main { position: relative; }
.app .drop-overlay {
  position: absolute; inset: 12px; z-index: 40; display: grid; place-items: center;
  border-radius: 22px; border: 2px dashed rgba(var(--acc-hi), .55);
  background: rgba(8, 4, 5, .88); backdrop-filter: blur(8px);
}
.app .drop-overlay[hidden] { display: none !important; }
.app .drop-overlay > div { display: grid; justify-items: center; gap: 8px; color: rgba(var(--ink), .55); text-align: center; }
.app .drop-overlay .i { width: 34px; height: 34px; stroke: var(--accent-2); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app .drop-overlay b { color: var(--text); font-size: 1.05rem; }
.app .drop-overlay span { font-size: 12.5px; }

/* ---------- markdown highlight + cites ---------- */
.app .md .hl-k { color: var(--accent-2); }
.app .md .hl-s { color: #ffc2a8; }
.app .md .hl-n { color: #9ad0ff; }
.app .md .hl-f { color: #d7b3ff; }
.app .md .hl-c { color: #6f6a6c; font-style: italic; }
.app .md a.cite {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  margin: 0 1px; border-radius: 5px; font: 600 .68rem/1 var(--mono); color: var(--accent-2);
  background: rgba(var(--acc), .14); text-decoration: none; vertical-align: 2px;
}
.app .md a.cite:hover { background: rgba(var(--acc), .28); color: var(--text); }
.app .code-head button.copy-code {
  height: 28px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: rgba(var(--ink), .55); font-size: .76rem; cursor: pointer;
}
.app .code-head button.copy-code:hover { background: rgba(var(--ink), .06); color: var(--text); }

/* ---------- voice hud rings (flottant comme v2) ---------- */
.app .voice-hud {
  position: fixed; left: 50%; bottom: max(118px, calc(env(safe-area-inset-bottom) + 108px));
  z-index: 80; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  border-radius: 999px; padding: 10px 14px 10px 10px; margin: 0;
  max-width: min(420px, calc(100vw - 32px));
  background: rgba(18, 10, 11, .94); border: 1px solid var(--edge);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .85), 0 0 0 1px rgba(var(--acc), .08);
  backdrop-filter: blur(14px);
}
.app .voice-hud[hidden] { display: none !important; }
.app .voice-hud b { font-weight: 500; font-size: .9rem; min-width: 110px; color: rgba(var(--ink),.85); }
.app .voice-core {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 50%; background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); color: #fff; flex: none;
}
.app .voice-core i {
  width: 10px; height: 10px; border-radius: 50%; background: var(--text);
  box-shadow: 0 0 10px rgba(var(--ink), .5);
}
.app .voice-core > span {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--acc-hi), .7);
  transform: scale(calc(1 + var(--lvl, 0) * .55));
  opacity: calc(.18 + var(--lvl, 0) * .7); transition: transform 80ms linear, opacity 80ms linear;
  pointer-events: none;
}
.app .voice-core > span + span {
  transform: scale(calc(1 + var(--lvl, 0) * 1.05));
  opacity: calc(var(--lvl, 0) * .55);
}
.app .voice-hud.listening .voice-core { background: linear-gradient(180deg, #ff8a70, var(--accent-deep)); }
.app .voice-hud.thinking .voice-core { animation: ap-pulse 1s ease-in-out infinite; }
@keyframes ap-pulse {
  0%, 100% { transform: scale(.94); filter: brightness(.95); }
  50% { transform: scale(1.06); filter: brightness(1.12); }
}

@media (max-width: 780px) {
  .app .topbar { padding: 12px 16px; }
  .app .composer-wrap { padding: 0 12px 12px; }
  .app .empty::before { width: 320px; }
  .app .welcome-core { width: 150px; height: 150px; }
  .app .drop-overlay { inset: 8px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .app .hero-mark::after, .app .msg, .app .menu,
  .app .core-visual .cv-spin, .app .core-visual .cv-pulse, .app .core-visual .cv-core,
  .app .voice-hud.thinking .voice-core { animation: none; }
}

/* =========================================================
   Vue conversation premium — réponses, markdown, code, tableaux
   ========================================================= */
.app .messages { max-width: 800px; padding-top: 28px; }
.app .main::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 260px; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 100% at 50% 0%, rgba(var(--acc), .09), transparent 70%);
}
.app .topbar {
  background: linear-gradient(180deg, rgba(var(--shade),.92), rgba(var(--shade),.6) 70%, transparent);
  backdrop-filter: blur(10px);
}

/* en-tête de la réponse */
.app .msg.assistant .msg-head { gap: 10px; margin-bottom: 14px; }
.app .msg.assistant .msg-head .mark.sm {
  width: 26px; height: 26px; border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(var(--ink),.25), 0 0 0 1px rgba(var(--acc-hi),.35), 0 6px 18px -4px rgba(var(--acc),.6);
}
.app .msg.assistant .msg-head small {
  font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; color: var(--accent-2);
  background: rgba(var(--acc),.1); border: 1px solid rgba(var(--acc-hi),.25);
}

/* réponse posée sur une carte fine avec un rail rouge */
.app .msg.assistant .md {
  position: relative; padding: 4px 0 4px 20px;
  font-size: 15.5px; line-height: 1.72; color: rgba(var(--ink),.88);
}
.app .msg.assistant .md::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-2), rgba(var(--acc),.15) 40%, transparent);
}

/* titres */
.app .md h1, .app .md h2, .app .md h3, .app .md h4 {
  font-family: var(--display); color: var(--text); letter-spacing: -.015em; line-height: 1.25;
  margin: 1.8em 0 .7em; font-weight: 700;
}
.app .md h1 { font-size: 1.6em; }
.app .md h2 { font-size: 1.35em; padding-bottom: .4em; border-bottom: 1px solid rgba(var(--ink),.07); }
.app .md h3 { font-size: 1.12em; display: flex; align-items: center; gap: 10px; }
.app .md h3::before {
  content: ""; width: 6px; height: 6px; border-radius: 2px; flex: none; transform: rotate(45deg);
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.app .md > :first-child { margin-top: 0; }
.app .md strong { color: var(--text); font-weight: 650; }
.app .md a:not(.cite) { color: var(--accent-2); text-decoration-color: rgba(var(--acc-hi),.4); text-underline-offset: 3px; }

/* listes */
.app .md ul { list-style: none; padding-left: 4px; }
.app .md ul > li { position: relative; padding-left: 20px; margin: .45em 0; }
.app .md ul > li::before {
  content: ""; position: absolute; left: 2px; top: .72em; width: 6px; height: 6px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--accent-2);
}
.app .md ol { padding-left: 1.4em; }
.app .md ol > li::marker { color: var(--accent-2); font: 600 .85em var(--mono); }

/* code en ligne */
.app .md :not(pre) > code {
  font: 500 .86em var(--mono); padding: .15em .45em; border-radius: 6px;
  color: #ffd0d5; background: rgba(var(--acc),.1); border: 1px solid rgba(var(--acc-hi),.2);
}

/* blocs de code */
.app .md .code {
  margin: 1.2em 0; overflow: hidden;
  border: 1px solid rgba(var(--ink),.09) !important; border-radius: 16px !important;
  background: linear-gradient(180deg, var(--panel2), var(--bg)) !important;
  box-shadow: inset 0 1px 0 rgba(var(--ink),.05), 0 20px 40px -24px rgba(0,0,0,.9);
}
.app .md .code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px 8px 14px; border-bottom: 1px solid rgba(var(--ink),.06);
  background: rgba(var(--ink),.025); font: 500 11px var(--mono); letter-spacing: .08em;
  text-transform: uppercase; color: rgba(var(--ink),.5);
}
.app .md .code-head > span { display: flex; align-items: center; gap: 10px; }
.app .md .code-head > span::before {
  content: ""; width: 34px; height: 8px; flex: none;
  background: radial-gradient(circle 4px at 4px 4px, var(--accent-2) 98%, transparent),
    radial-gradient(circle 4px at 17px 4px, rgba(var(--ink),.18) 98%, transparent),
    radial-gradient(circle 4px at 30px 4px, rgba(var(--ink),.1) 98%, transparent);
}
.app .md .code-head button.copy-code { border: 1px solid rgba(var(--ink),.08); text-transform: none; letter-spacing: 0; }
.app .md .code pre { margin: 0; padding: 16px 18px; background: transparent !important; border: 0 !important; font-size: 13.5px; line-height: 1.7; }
.app .md .code pre::-webkit-scrollbar { height: 6px; }
.app .md .code pre::-webkit-scrollbar-thumb { background: rgba(var(--acc),.35); border-radius: 6px; }

/* tableaux */
.app .md table {
  width: 100%; margin: 1.2em 0; border-collapse: separate; border-spacing: 0; overflow: hidden;
  border: 1px solid rgba(var(--ink),.09); border-radius: 14px; font-size: 14.5px;
}
.app .md thead th {
  text-align: left; padding: 12px 16px; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-2); background: linear-gradient(180deg, rgba(var(--acc),.14), rgba(var(--acc),.05));
  border-bottom: 1px solid rgba(var(--acc-hi),.25);
}
.app .md td { padding: 12px 16px; border-bottom: 1px solid rgba(var(--ink),.05); vertical-align: top; }
.app .md tbody tr:last-child td { border-bottom: 0; }
.app .md tbody tr:nth-child(even) td { background: rgba(var(--ink),.018); }
.app .md tbody tr:hover td { background: rgba(var(--acc),.05); }

/* citations + séparateurs */
.app .md blockquote {
  margin: 1.1em 0; padding: 12px 16px; border-left: 0; border-radius: 12px; color: rgba(var(--ink),.75);
  background: rgba(var(--acc),.06); box-shadow: inset 2px 0 0 var(--accent-2);
}
.app .md hr { border: 0; height: 1px; margin: 1.8em 0; background: linear-gradient(90deg, transparent, rgba(var(--acc-hi),.45), transparent); }

/* actions sous la réponse */
.app .msg .actions { gap: 4px; margin-top: 12px; padding-left: 20px; }
.app .msg .actions button {
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid rgba(var(--ink),.08); background: rgba(var(--ink),.02); color: rgba(var(--ink),.6);
  transition: .15s;
}
.app .msg .actions button:hover { color: var(--text); border-color: rgba(var(--acc-hi),.4); background: rgba(var(--acc),.08); }

/* message de l'utilisateur */
.app .msg.user .bubble { font-size: 15px; line-height: 1.6; max-width: 76%; }

@media (max-width: 780px) {
  .app .msg.assistant .md { padding-left: 14px; font-size: 15px; }
  .app .msg .actions { padding-left: 14px; }
  .app .md table { display: block; overflow-x: auto; }
}

/* =========================================================
   Fluidité de l'app
   ========================================================= */
.app { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.app ::selection { background: rgba(var(--acc), .45); color: var(--text); }
.app .scroller { scroll-behavior: smooth; overscroll-behavior: contain; scrollbar-gutter: stable; }
.app .conv-list { overscroll-behavior: contain; }
.app .scroller, .app .conv-list { scrollbar-width: thin; scrollbar-color: rgba(var(--acc), .3) transparent; }
.app .scroller::-webkit-scrollbar, .app .conv-list::-webkit-scrollbar { width: 8px; }
.app .scroller::-webkit-scrollbar-thumb, .app .conv-list::-webkit-scrollbar-thumb {
  background: rgba(var(--acc), .25); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box;
}
.app .scroller::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--acc), .5); }
.app button, .app .conv, .app .conv-title, .app .chip, .app .starter, .app .menu-item {
  transition-timing-function: cubic-bezier(.2, .8, .2, 1);
}
.app .conv, .app .menu-item { transition: background .2s, color .2s; }
.app .new-chat:active, .app .send:active, .app .starter:active, .app .chip:active { transform: scale(.97); }
.app .msg { animation-duration: .35s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
.app .empty { animation: ap-in .5s cubic-bezier(.2, .8, .2, 1); }
.app .starter { animation: ap-in .5s cubic-bezier(.2, .8, .2, 1) backwards; }
.app .starter:nth-child(2) { animation-delay: .04s; } .app .starter:nth-child(3) { animation-delay: .08s; }
.app .starter:nth-child(4) { animation-delay: .12s; } .app .starter:nth-child(5) { animation-delay: .16s; }
.app .starter:nth-child(6) { animation-delay: .2s; }
.app :focus-visible { outline: 2px solid rgba(var(--acc-hi), .75); outline-offset: 2px; }
.app .composer textarea { transition: height .15s ease-out; }
.modal[open] { animation: ap-pop .25s cubic-bezier(.2, .8, .2, 1); }
@media (max-width: 780px) {
  .app .sidebar { transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s; }
  .app .scrim { transition: opacity .3s; }
}
@media (prefers-reduced-motion: reduce) {
  .app .scroller { scroll-behavior: auto; }
  .app .empty, .app .starter, .modal[open] { animation: none; }
}


/* ==========================================================
   App connectée — retouches discrètes (garde le look d'origine)
   ========================================================== */
.app .conv-more { opacity: 0; transition: opacity .15s; }
.app .conv:hover .conv-more, .app .conv.active .conv-more, .app .conv-more:focus-visible { opacity: 1; }
.app .conv-title { transition: color .15s; }
.app .starter { transition: transform .22s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .22s, background .2s; }
.app .starter:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -22px rgba(var(--acc), .65); }
.app .composer:focus-within { box-shadow: 0 0 0 3px rgba(var(--acc), .09), 0 18px 50px -30px rgba(var(--acc), .5); }
.app .send { box-shadow: 0 6px 18px -8px rgba(var(--acc), .7); }
.app .send:disabled { filter: grayscale(.5) brightness(.65); box-shadow: none; transform: none; }
.app .mini-reactor { box-shadow: 0 0 14px rgba(var(--acc), .28); }
@media (prefers-reduced-motion: reduce) { .app .starter:hover { transform: none; } }

/* =========================================================
   Jarvis — expérience application mobile (téléphone + app installée)
   ========================================================= */
:root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --ease: cubic-bezier(.2, .8, .2, 1); }

/* Modèle unique : le sélecteur devient un simple titre */
.model-picker.single .chev { display: none; }
.model-picker.single .model-btn { cursor: default; }

/* Bouton « Installer l'app » (menu latéral) */
.install-app {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 14px; border: 1px solid rgba(var(--acc), .35); color: var(--text); text-align: left;
  background: linear-gradient(135deg, rgba(var(--acc), .18), rgba(var(--acc), .04));
  transition: transform .2s var(--ease), border-color .2s;
}
.install-app[hidden] { display: none; }
.install-app img { border-radius: 9px; box-shadow: 0 0 16px rgba(var(--acc), .35); }
.install-app span { display: grid; line-height: 1.25; }
.install-app b { font-size: 13.5px; font-weight: 600; }
.install-app small { font-size: 11.5px; color: var(--dim); }
.install-app:active { transform: scale(.97); }

/* Aide d'installation iPhone */
.ios-install .ios-steps { list-style: none; margin: 0; padding: 4px 20px 22px; display: grid; gap: 14px; }
.ios-install li { display: flex; gap: 14px; align-items: center; font-size: 15px; color: var(--muted); }
.ios-install li b { color: var(--text); }
.ios-install .n {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}
.ios-install .i { width: 17px; height: 17px; vertical-align: -3px; stroke: var(--accent-2); }

/* L'app installée ne doit jamais ressembler à une page web */
html.is-standalone, html.is-standalone body { overscroll-behavior: none; }
html.is-standalone .app { -webkit-user-select: none; user-select: none; }
html.is-standalone .app .md, html.is-standalone .app .bubble, html.is-standalone .app textarea,
html.is-standalone .app input { -webkit-user-select: text; user-select: text; }

@media (max-width: 780px) {
  html, body { overscroll-behavior-y: none; }
  .app { -webkit-tap-highlight-color: transparent; height: 100dvh; }
  .app button { touch-action: manipulation; }

  /* ---------- barre du haut : verre fumé, titre centré ---------- */
  .app .topbar {
    position: sticky; top: 0; min-height: 0;
    padding: calc(var(--safe-t) + 8px) 12px 8px;
    display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
    background: linear-gradient(180deg, rgba(var(--shade), .92), rgba(var(--shade), .55));
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid rgba(var(--acc), .12);
  }
  .app .topbar #open-side {
    width: 42px; height: 42px; border-radius: 14px; font-size: 19px; color: var(--text);
    border: 1px solid rgba(var(--ink), .08); background: rgba(var(--ink), .04);
  }
  .app .model-picker { justify-self: center; }
  .app .model-btn {
    padding: 8px 16px; font-size: 15px; letter-spacing: .02em;
    border-color: rgba(var(--acc), .28); background: rgba(var(--acc), .06);
  }
  .app .model-picker .menu { left: 50%; transform: translateX(-50%); }
  .app .top-actions { margin: 0; justify-self: end; }

  /* ---------- écran d'accueil ---------- */
  .app .scroller { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .app .scroller::-webkit-scrollbar { display: none; }
  .app .empty { padding: 5vh 18px 12px; }
  .app .welcome-core { width: 120px; height: 120px; margin-bottom: 6px; }
  .app .empty h2 { font-size: clamp(28px, 8.4vw, 36px); line-height: 1.1; }
  .app .empty .tagline { font-size: 15.5px; margin-bottom: 26px; }
  .app .starters { grid-template-columns: 1fr 1fr; gap: 10px; }
  .app .starter {
    min-height: 92px; padding: 14px; border-radius: 18px; text-align: left; font-size: 13.5px; line-height: 1.35;
    background: linear-gradient(160deg, rgba(var(--acc), .09), rgba(var(--ink), .02) 60%);
  }
  .app .starter:hover { transform: none; box-shadow: none; }
  .app .starter:active { transform: scale(.96); border-color: rgba(var(--acc), .5); }

  /* ---------- messages ---------- */
  .app .messages { padding: 14px 14px 24px; }
  .app .msg { margin-bottom: 22px; }
  .app .msg.user .bubble {
    max-width: 84%; font-size: 15.5px; padding: 11px 15px; border-radius: 22px 22px 6px 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border-color: transparent; color: #fff;
    box-shadow: 0 10px 26px -14px rgba(var(--acc), .8);
  }
  .app .msg.assistant .md { padding-left: 2px; font-size: 15.5px; line-height: 1.65; }
  .app .msg .actions { padding-left: 0; }
  .app .msg .actions button { min-width: 36px; min-height: 36px; }
  .app .md pre { border-radius: 14px; font-size: 12.5px; }
  .app .msg-att img { max-width: 70vw; border-radius: 16px; }

  /* ---------- zone de saisie : capsule flottante ---------- */
  .app .composer-wrap { padding: 0 10px calc(var(--safe-b) + 10px); }
  .app .composer-wrap::before { height: 60px; }
  .app .composer {
    border-radius: 26px; padding: 8px 8px 8px 16px;
    background: rgba(14, 14, 16, .92);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid rgba(var(--acc), .22);
    box-shadow: 0 -10px 40px -20px rgba(var(--acc), .35), 0 18px 40px -20px #000;
  }
  .app .composer textarea { font-size: 16px; /* évite le zoom auto d'iOS */ padding-top: 6px; max-height: 38dvh; }
  .app .composer-bar { flex-wrap: nowrap; gap: 6px; margin-top: 4px; }
  .app .composer-bar .left {
    flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
    padding-right: 14px;
  }
  .app .composer-bar .left::-webkit-scrollbar { display: none; }
  .app .composer-bar .right { flex: none; flex-wrap: nowrap; gap: 4px; }
  .app .chip {
    flex: none; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
    border: 1px solid rgba(var(--ink), .08); background: rgba(var(--ink), .03);
  }
  .app #attach-btn { width: 34px; padding: 0; justify-content: center; }
  .app .chip.toggle[aria-pressed="true"] { background: rgba(var(--acc), .18); border-color: rgba(var(--acc), .5); color: var(--text); }
  .app .composer-bar .right .icon-btn { width: 38px; height: 38px; border-radius: 50%; }
  .app .send { width: 42px; height: 42px; border-radius: 50%; font-size: 19px; }
  .app .disclaimer { font-size: 10.5px; margin-top: 6px; opacity: .7; }
  .app .to-bottom { width: 40px; height: 40px; }

  /* ---------- tiroir latéral ---------- */
  .app .sidebar {
    width: min(320px, 86vw);
    padding: calc(var(--safe-t) + 16px) 14px calc(var(--safe-b) + 14px);
    border-radius: 0 26px 26px 0; border-right: 1px solid rgba(var(--acc), .25);
    background: linear-gradient(180deg, var(--panel2), var(--bg) 40%);
  }
  .app .sidebar.open { box-shadow: 30px 0 80px rgba(0, 0, 0, .85), 1px 0 0 rgba(var(--acc), .3); }
  .app .brand-text { display: grid; }
  .app .scrim { display: block; position: fixed; inset: 0; z-index: 40; opacity: 0; pointer-events: none;
    background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .app .scrim.show { opacity: 1; pointer-events: auto; }
  .app .new-chat { padding: 13px 14px; border-radius: 14px; font-size: 14.5px; }
  .app .search { font-size: 16px; border-radius: 12px; }
  .app .conv { min-height: 44px; border-radius: 12px; }
  .app .conv-more { opacity: 1; }

  /* ---------- réglages : feuille qui monte du bas ---------- */
  .modal {
    width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 26px 26px 0 0;
    padding-bottom: var(--safe-b); border-bottom: 0;
  }
  .modal[open] { animation: jm-sheet .38s var(--ease); }
  .modal::backdrop { background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .modal .modal-head { position: relative; padding-top: 22px; }
  .modal .modal-head::before {
    content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 4px; background: rgba(var(--ink), .2);
  }
  .set-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .set-tabs button { flex: none; }

  .toast { bottom: calc(var(--safe-b) + 96px); top: auto; border-radius: 999px; }
}

/* App installée : on gagne encore un peu de place */
@media (max-width: 780px) and (display-mode: standalone) {
  .app .disclaimer { display: none; }
}

@keyframes jm-sheet { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .modal[open] { animation: none; }
}

/* =========================================================
   Mises à jour, hors ligne, lancement, installation
   ========================================================= */
.jv-banner {
  position: fixed; left: 50%; z-index: 120; width: min(440px, calc(100vw - 20px));
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: 20px; border: 1px solid rgba(var(--acc), .35); color: var(--text);
  background: rgba(12, 12, 14, .9); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 20px 50px -18px rgba(var(--acc), .55), 0 10px 30px rgba(0, 0, 0, .6);
  transform: translate(-50%, calc(-100% - 30px)); opacity: 0;
  transition: transform .5s cubic-bezier(.2, .9, .25, 1.15), opacity .3s;
}
.jv-banner.show { transform: translate(-50%, 0); opacity: 1; }
.jv-banner img { border-radius: 10px; flex: none; box-shadow: 0 0 18px rgba(var(--acc), .4); }
.jv-b-txt { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.jv-b-txt b { font-size: 14px; font-weight: 600; }
.jv-b-txt small { font-size: 12px; color: var(--dim); }
.jv-b-btn {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 13.5px var(--font); color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent-deep));
  box-shadow: 0 8px 20px -8px rgba(var(--acc), .9); position: relative; overflow: hidden;
}
.jv-b-btn::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(var(--ink), .35), transparent 70%);
  animation: jv-shine 2.6s ease-in-out infinite 1s;
}
.jv-b-btn:active { transform: scale(.95); }
.jv-b-btn:disabled { opacity: .7; }
.jv-b-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--dim); cursor: pointer; }
.jv-banner.offline { border-color: rgba(var(--ink), .14); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.jv-dot { flex: none; width: 10px; height: 10px; margin: 0 4px 0 6px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 12px #f59e0b; animation: jv-blink 1.4s ease-in-out infinite; }
@keyframes jv-shine { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes jv-blink { 50% { opacity: .35; } }

html.jv-updating body::after {
  content: ""; position: fixed; inset: 0; z-index: 200; background: var(--bg);
  animation: jv-fade .35s ease forwards;
}
@keyframes jv-fade { from { opacity: 0; } to { opacity: 1; } }

/* Bouton de mise à jour dans le menu latéral : n'apparaît que lorsqu'une nouvelle version existe */
.jv-version {
  position: relative; overflow: hidden; display: none; align-items: center; gap: 12px; width: 100%;
  margin-top: 10px; padding: 10px 10px 10px 12px; border-radius: 16px; cursor: pointer; text-align: left;
  border: 1px solid transparent; color: var(--text); font: 13px var(--font);
  background:
    linear-gradient(160deg, rgba(40, 4, 9, .96), rgba(10, 0, 2, .96)) padding-box,
    linear-gradient(135deg, rgba(var(--acc-hi), .85), rgba(var(--acc), .12) 50%, rgba(var(--acc-hi), .55)) border-box;
  box-shadow: 0 14px 34px -18px rgba(var(--acc), .75);
}
.jv-version.has-update { display: flex; animation: jv-rise .45s cubic-bezier(.2, .8, .2, 1); }
.jv-version::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(var(--ink), .09) 50%, transparent 70%);
  animation: jv-shine 3.2s ease-in-out infinite;
}
.jv-version .jv-v-ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(160deg, var(--accent-2), var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(var(--ink), .3), 0 6px 16px -4px rgba(var(--acc), .8);
}
.jv-version .jv-v-ico svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.jv-version .jv-v-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.jv-version .jv-v-txt b, .jv-version .jv-v-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jv-version .jv-v-txt b { font-weight: 600; font-size: 13px; }
.jv-version .jv-v-txt small { color: rgba(var(--ink), .55); font-size: 11.5px; }
.jv-version .jv-v-go {
  flex: none; padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(var(--ink), .1); border: 1px solid rgba(var(--ink), .14);
}
.jv-version:hover .jv-v-go { background: rgba(var(--ink), .18); }
.jv-version:active { transform: scale(.98); }

/* Zone de saisie : plus de rectangle de focus, un contour lumineux sur toute la barre */
.app .composer textarea:focus,
.app .composer textarea:focus-visible { outline: none; box-shadow: none; }
.app .composer:focus-within {
  border-color: transparent;
  background: linear-gradient(var(--panel2), var(--panel2)) padding-box,
    linear-gradient(135deg, rgba(var(--acc-hi), .9), rgba(var(--acc), .14) 45%, rgba(var(--acc-hi), .6)) border-box;
  box-shadow: 0 0 0 4px rgba(var(--acc), .06), 0 14px 40px -18px rgba(var(--acc), .6);
}

/* Écran de lancement (app installée uniquement) */
.jv-splash { display: none; }
html.is-standalone .boot .mark { display: none; }
html.is-standalone .jv-splash { display: grid; justify-items: center; gap: 16px; animation: jv-rise .6s cubic-bezier(.2, .8, .2, 1); }
.jv-splash img { border-radius: 24px; box-shadow: 0 0 60px rgba(var(--acc), .45); }
.jv-splash b { font: 800 22px var(--display); letter-spacing: .32em; padding-left: .32em; }
.jv-splash i { width: 120px; height: 2px; border-radius: 2px; overflow: hidden; background: rgba(var(--ink), .08); position: relative; }
.jv-splash i::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 2px; animation: jv-load 1s ease-in-out infinite; }
@keyframes jv-rise { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes jv-load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Bouton « App » dans la barre du site */
.x-nav-app { display: inline-flex; align-items: center; gap: 6px; }
.x-nav-app[hidden] { display: none; }
.x-nav-app svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Clavier ouvert sur téléphone : place maximale pour la conversation */
@media (max-width: 780px) {
  html.kb-open .app .disclaimer { display: none; }
  html.kb-open .app .composer-wrap { padding-bottom: 8px; }
  html.kb-open .app .welcome-core { display: none; }
  .jv-version { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .jv-banner, .jv-splash { transition: none; animation: none; }
  .jv-b-btn::after, .jv-splash i::after, .jv-dot { animation: none; }
}

/* ============ App Android Jarvis : écran de connexion seul, sans la landing ============ */
.is-native #auth > :not(#login-modal) { display: none !important; }
.is-native #auth { min-height: 100dvh; background: radial-gradient(120% 70% at 50% 0%, #2a0308 0%, var(--bg) 62%); }
.is-native .lp-modal-backdrop { background: transparent !important; backdrop-filter: none !important; }
.is-native .lp-modal-close { display: none !important; }
.is-native .lp-modal { padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
.is-native .lp-modal-card { box-shadow: 0 30px 80px -30px rgba(var(--acc), .45), 0 0 0 1px rgba(var(--ink), .06); }
.is-native .auth-mark { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 0 40px rgba(var(--acc), .35); }
.is-native .jv-splash { display: flex; }

/* ---------- guide d'installation iPhone ---------- */
.jv-banner.ios { max-width: 380px; width: calc(100% - 24px); top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
.ios-hint { display: flex; gap: 12px; align-items: flex-start; text-align: left; font-size: 13px; line-height: 1.45; }
.ios-hint ol { margin: 6px 0 0; padding-left: 18px; }
.ios-hint p { margin: 6px 0 0; }
.ios-share { width: 16px; height: 16px; vertical-align: -3px; color: #4ea1ff; }
.ios-x { background: none; border: 0; color: var(--dim); font-size: 16px; cursor: pointer; padding: 0 2px; flex: none; }
html.is-standalone .ios-install { display: none; }
.ios-install { width: 100%; margin-bottom: 6px; padding: 9px 12px; border-radius: 12px; border: 1px solid rgba(var(--acc), .3);
  background: rgba(var(--acc), .08); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }

/* Safari iOS : les hauteurs estimées des anciens messages faussent le bas de la conversation. */
@supports (-webkit-touch-callout: none) {
  .app .messages > .msg:not(:last-child) { content-visibility: visible; contain-intrinsic-size: none; }
}

/* =========================================================
   Fonctions ajoutées : thèmes, verrouillage, gestes, rappels, fichiers
   ========================================================= */

/* ---------- Apparence ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.theme-grid button {
  display: grid; justify-items: start; gap: 3px; padding: 10px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line2); background: rgba(var(--ink),.02); color: var(--text);
  transition: border-color .15s, background .15s, transform .15s;
}
.theme-grid button:active { transform: scale(.97); }
.theme-grid button[aria-checked="true"] { border-color: rgb(var(--acc)); background: rgba(var(--acc),.08); box-shadow: 0 0 0 1px rgb(var(--acc)) inset; }
.theme-grid b { font: 600 13px var(--display); }
.theme-grid small { color: var(--dim); font-size: 11px; }
.theme-grid .sw { width: 100%; height: 46px; border-radius: 9px; margin-bottom: 6px; display: block; border: 1px solid rgba(255,255,255,.08); }
.sw.red { background: radial-gradient(80% 120% at 30% 0%, rgba(255,31,50,.55), transparent 70%), #000; }
.sw.crimson { background: radial-gradient(80% 120% at 30% 0%, rgba(178,14,32,.5), transparent 70%), #000; }
.sw.oled { background: #000; border-color: rgba(255,255,255,.16); box-shadow: inset 0 -3px 0 rgb(255,31,50); }

.accent-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.acc-dot {
  --c: rgb(var(--acc)); position: relative; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  background: var(--c); border: 2px solid #000; box-shadow: 0 0 0 1px rgba(255,255,255,.18);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.acc-dot:active { transform: scale(.9); }
.acc-dot.on { box-shadow: 0 0 0 2px #fff; }
.acc-dot.def { background: conic-gradient(from 210deg, #ff1f32, #b20e20, #ff1f32); }
.acc-dot.def::after { content: "A"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px var(--display); color: #fff; }
.acc-dot.custom { background: conic-gradient(#ff1f32, #ff7a00, #f5c400, #22c55e, #00b8ff, #8b5cf6, #ff3d9a, #ff1f32); overflow: hidden; }
.acc-dot.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

/* ---------- Thème noir OLED : noir pur, sans halo ni dégradé ---------- */
html[data-theme="oled"] { --panel2: #000; }
html[data-theme="oled"] .app *,
html[data-theme="oled"] .modal,
html[data-theme="oled"] .menu { box-shadow: none !important; text-shadow: none !important; }
html[data-theme="oled"] .app *::before,
html[data-theme="oled"] .app *::after { box-shadow: none !important; }
html[data-theme="oled"] .app .bubble,
html[data-theme="oled"] .app .msg.user .bubble,
html[data-theme="oled"] .app .composer,
html[data-theme="oled"] .app .topbar,
html[data-theme="oled"] .app .sidebar,
html[data-theme="oled"] .app .conv.active,
html[data-theme="oled"] .modal { background: #000 !important; background-image: none !important; }
html[data-theme="oled"] .app .msg.user .bubble { border-color: rgba(var(--acc),.45) !important; }
html[data-theme="oled"] .app .main::before,
html[data-theme="oled"] .app .main::after,
html[data-theme="oled"] .app .welcome-core { filter: none !important; opacity: .5; }

/* ---------- Messages : apparition douce ---------- */
.app .msg.settled, #messages.instant .msg { animation: none !important; }
.app .msg.assistant .md > * { animation: ft-in .35s ease-out both; }
.app .msg.assistant.settled .md > *, #messages.instant .md > * { animation: none; }
@keyframes ft-in { from { opacity: 0; transform: translateY(3px); } }

/* ---------- Groupes / dossiers dans la liste ---------- */
.group.folder {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: none; border: 0;
  cursor: pointer; color: var(--muted); text-transform: none; letter-spacing: 0; font: 600 12px var(--font);
}
.group.folder svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; transition: transform .2s; }
.group.folder span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group.folder small { font: 500 10px var(--mono); color: var(--dim); padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); }
.group.folder:hover { color: var(--text); }
.group.folder.shut { color: var(--dim); }
.group.folder.shut svg { transform: rotate(-90deg); }

/* ---------- Glisser une conversation pour la supprimer ---------- */
.conv { transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .22s, background .15s; touch-action: pan-y; }
.conv.swiping { transition: none; }
.conv.armed { background: rgba(var(--acc),.22) !important; }
.conv.armed::after {
  content: "Supprimer"; position: absolute; right: -86px; top: 50%; transform: translateY(-50%);
  font: 600 11px var(--font); color: rgb(var(--acc-hi));
}
.conv { position: relative; }
.conv.gone { opacity: 0; pointer-events: none; }

/* ---------- Tirer pour actualiser ---------- */
.ptr {
  --d: 0px; --r: 0deg; position: absolute; left: 50%; top: 0; z-index: 6; pointer-events: none;
  width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 1px solid rgba(var(--acc),.4); opacity: 0;
  transform: translateY(calc(var(--d) - 40px)); transition: transform .25s, opacity .2s;
}
.ptr i {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(var(--acc),.35); border-top-color: rgb(var(--acc));
  transform: rotate(var(--r));
}
.ptr.pull { transition: none; opacity: 1; }
.ptr.ready i { border-color: rgb(var(--acc)); border-top-color: #fff; }
.ptr.busy { opacity: 1; }
.ptr.busy i { animation: spin .7s linear infinite; }
.topbar ~ .ptr { top: 52px; }
.side-ptr { position: relative; left: auto; margin: 0 auto -34px; flex: none; }

/* ---------- Carte de rappel ---------- */
.reminder {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid rgba(var(--acc),.3); background: rgba(var(--acc),.06); max-width: 460px;
  animation: ft-in .3s ease-out;
}
.reminder.on { border-color: rgb(var(--acc)); background: rgba(var(--acc),.12); }
.reminder.past { opacity: .55; }
.rem-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(var(--acc),.16); flex: none; }
.rem-ico svg { width: 18px; height: 18px; fill: none; stroke: rgb(var(--acc-hi)); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reminder.on .rem-ico { background: rgb(var(--acc)); }
.reminder.on .rem-ico svg { stroke: #fff; }
.rem-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rem-txt b { font: 600 13.5px var(--font); overflow-wrap: anywhere; }
.rem-txt small { color: var(--dim); font-size: 12px; }
.rem-txt small::first-letter { text-transform: uppercase; }
.rem-btn {
  flex: none; padding: 7px 12px; border-radius: 99px; font: 600 12px var(--font); color: #fff;
  background: rgb(var(--acc)); border: 0; cursor: pointer;
}
.reminder.on .rem-btn { background: transparent; border: 1px solid var(--line2); color: var(--muted); }

/* ---------- Pièces jointes : PDF et chargement ---------- */
.att > span em {
  font: 700 9.5px var(--mono); font-style: normal; color: #fff; background: rgb(var(--acc));
  padding: 2px 5px; border-radius: 4px; margin-right: 7px; vertical-align: 1px;
}
.att > span small { color: var(--dim); font-size: 11px; }
.att.loading { opacity: .8; }
.att.loading > span { padding-right: 12px; display: flex; align-items: center; gap: 8px; }
.att .spin {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid rgba(var(--acc),.3); border-top-color: rgb(var(--acc)); animation: spin .7s linear infinite;
}

/* ---------- Toast avec action (Annuler) ---------- */
.toast.action { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-act {
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font: 700 13px var(--font); color: rgb(var(--acc-hi)); text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- Petite fenêtre « Renommer / Dossier » ---------- */
#ask.sheet { width: min(420px, calc(100vw - 32px)); }
.ask-in { padding: 20px; display: grid; gap: 14px; margin: 0; }
.ask-in h3 { margin: 0; font: 600 17px var(--display); }
.ask-in input {
  width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line2); font-size: 16px; outline: none;
}
.ask-in input:focus { border-color: rgb(var(--acc)); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chips .chip { cursor: pointer; }
.ask-in .row.end { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 780px) {
  #ask.sheet[open] {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0 !important;
    border-bottom: 0; animation: jm-sheet .25s cubic-bezier(.2,.8,.2,1);
  }
  .ask-in { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Écran de verrouillage (app Android) ---------- */
.lock {
  position: fixed; inset: 0; z-index: 150; background: #000; display: grid; place-items: center;
  padding: 24px; animation: jv-fade .2s ease;
}
.lock.out { opacity: 0; transition: opacity .26s ease; }
html.locked .app, html.locked #toast { visibility: hidden; }
.lock-in { width: min(320px, 100%); display: grid; justify-items: center; gap: 16px; text-align: center; }
.lock-in img { border-radius: 22px; box-shadow: 0 0 60px rgba(var(--acc),.35); }
.lock-in > b { font: 600 18px var(--display); }
.lock-bio {
  display: grid; justify-items: center; gap: 8px; padding: 14px 22px; border-radius: 20px; cursor: pointer;
  background: rgba(var(--acc),.08); border: 1px solid rgba(var(--acc),.35); color: var(--text); font: 500 13px var(--font);
}
.lock-bio svg { width: 44px; height: 44px; fill: none; stroke: rgb(var(--acc-hi)); stroke-width: 1.5; stroke-linecap: round; }
.lock-bio:active { transform: scale(.96); }
.lock-form { display: flex; gap: 8px; width: 100%; }
.lock-form input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; background: #000; color: var(--text);
  border: 1px solid var(--line2); font: 500 18px var(--mono); letter-spacing: .3em; text-align: center; outline: none;
}
.lock-form input:focus { border-color: rgb(var(--acc)); }
.lock-err { min-height: 18px; margin: 0; color: rgb(var(--acc-hi)); font-size: 13px; }
.lock-out { background: none; border: 0; color: var(--dim); font-size: 13px; text-decoration: underline; cursor: pointer; }
.lock-in.shake { animation: ft-shake .4s; }
@keyframes ft-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
html[data-theme="oled"] .lock-in img { box-shadow: none; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .app .msg, .app .msg.assistant .md > *, .reminder, .lock, .lock-in.shake, #ask.sheet[open] { animation: none !important; }
  .conv, .ptr { transition: none; }
}

/* Couleurs des pastilles d'accent (pas de style en ligne : CSP) */
.acc-dot[data-accent="#ff7a00"] { --c: #ff7a00; }
.acc-dot[data-accent="#f5c400"] { --c: #f5c400; }
.acc-dot[data-accent="#22c55e"] { --c: #22c55e; }
.acc-dot[data-accent="#00b8ff"] { --c: #00b8ff; }
.acc-dot[data-accent="#8b5cf6"] { --c: #8b5cf6; }
.acc-dot[data-accent="#ff3d9a"] { --c: #ff3d9a; }

/* ---------- fluidité ---------- */
.md-part { display: contents; }
/* Téléphones : pas de flou en direct derrière ce qui défile (très coûteux sur Android d'entrée de gamme),
   fonds un peu plus opaques à la place ; animations limitées à transform/opacity. */
@media (max-width: 780px), (pointer: coarse) {
  .app .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: linear-gradient(180deg, rgba(var(--shade), .97), rgba(var(--shade), .82)); }
  .app .composer { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(14, 14, 16, .98); }
  .app .composer textarea { transition: none; }
  .scrim, .sheet-back { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .sidebar, .sheet { will-change: transform; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- paiement Litecoin ---------- */
button.pack { cursor: pointer; font: inherit; color: inherit; text-align: center; }
button.pack:hover { border-color: rgba(var(--acc), .6); }
.pack em { display: block; margin-top: 6px; font-style: normal; font-size: 11px; color: rgb(var(--acc-hi)); }
.pay-ltc { max-width: 380px; width: calc(100% - 32px); text-align: center; }
.pay-ltc h3 { margin: 0 0 4px; }
.pay-close { position: absolute; top: 10px; right: 10px; margin: 0; }
.pay-close button { background: none; border: 0; color: var(--dim); font-size: 18px; cursor: pointer; }
.pay-qr { width: 200px; height: 200px; margin: 12px auto; display: block; border-radius: 12px; image-rendering: pixelated; }
.pay-label { display: block; margin: 10px 0 4px; font-size: 12px; color: var(--dim); text-align: left; }
.pay-copy { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid rgba(var(--acc), .3); background: rgba(var(--ink), .04); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.pay-copy span { font-size: 12px; color: rgb(var(--acc-hi)); flex: none; }
.pay-copy.addr code { font-size: 12px; word-break: break-all; }
.pay-warn { font-size: 12px; color: #ffb3ba; margin: 12px 0 6px; }
.pay-status { margin: 12px 0 4px; font-size: 14px; }
.pay-status .ok { color: #4ade80; }

/* ---------- app Windows : écran « réservée aux gros abonnements » ---------- */
.desk-gate { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .96); }
.desk-gate-card { max-width: 380px; padding: 26px 22px; border-radius: 18px; border: 1px solid rgba(var(--acc), .4); background: var(--panel2); text-align: center; }
.desk-gate-card b { font-size: 18px; }
.desk-gate-card p { margin: 10px 0 0; }
.desk-gate-card button { margin-top: 18px; }

/* ---------- mode dev (app Windows) ---------- */
.dev-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 4px 8px; font-size: 12.5px; color: var(--muted); }
.dev-bar .dev-folder { color: var(--text); font-weight: 600; padding: 4px 10px; border-radius: 8px; background: rgba(var(--acc), .14); border: 1px solid rgba(var(--acc), .4); max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-bar .dev-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card { display: flex; align-items: center; gap: 9px; margin: 6px 0; padding: 8px 12px; border-radius: 10px; background: rgba(var(--ink), .03); border: 1px solid var(--line2); font-size: 13.5px; }
details.dev-card { display: block; }
details.dev-card > summary { display: flex; align-items: center; gap: 9px; cursor: pointer; list-style: none; }
details.dev-card > summary::-webkit-details-marker { display: none; }
.dev-card .dev-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card code { font-size: 12.5px; }
.dev-card .dev-st { flex: none; color: var(--muted); font-weight: 700; }
.dev-card.ok { border-color: rgba(52, 211, 153, .35); }
.dev-card.ok .dev-st { color: #34d399; }
.dev-card.err { border-color: rgba(var(--acc), .6); }
.dev-card.err .dev-st { color: rgb(var(--acc)); }
.dev-card pre, .dev-results pre { margin: 8px 0 0; max-height: 280px; overflow: auto; padding: 10px; border-radius: 8px; background: rgba(var(--shade), .45); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.msg.tool { margin: -6px 0; }
.dev-results { font-size: 12.5px; color: var(--muted); }
.dev-results > summary { cursor: pointer; width: fit-content; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--line2); }
.dev-undo { color: rgb(var(--acc)); }

/* ---------- mode dev v2 : diff, terminal, plan, @fichier ---------- */
.dev-card { display: block; }
.dev-row { display: flex; align-items: center; gap: 9px; }
.dev-row .dev-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card.run { border-color: rgba(var(--acc), .45); }
.dev-card.off { opacity: .55; }
.dev-stat { flex: none; font: 12px var(--mono); color: var(--muted); }
.dev-stat .p { color: #34d399; } .dev-stat .m { color: rgb(var(--acc)); }
.dev-src > summary { cursor: pointer; margin-top: 6px; font-size: 12px; color: var(--muted); }
.diff { margin-top: 8px; max-height: 340px; overflow: auto; border-radius: 8px; background: rgba(var(--shade), .45); font: 12px/1.55 var(--mono); padding: 6px 0; }
.diff .dl { padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
.diff .dl.add { background: rgba(52, 211, 153, .14); color: #a7f3d0; }
.diff .dl.del { background: rgba(var(--acc), .16); color: #fecaca; }
.diff .dl.gap { color: var(--muted); text-align: center; }
.dev-card pre.term { min-height: 22px; max-height: 300px; }
.dev-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dev-btns .act, .dev-stop { border: 1px solid var(--line2); padding: 5px 12px; font-size: 12.5px; }
.dev-btns .act.primary { background: rgb(var(--acc)); border-color: rgb(var(--acc)); color: #fff; }
.dev-stop, .dev-card .dev-undo { margin-top: 8px; }
.dev-plan ol { margin: 8px 0 0; padding-left: 22px; }
.dev-plan li { margin: 3px 0; }
.dev-wait { margin: 8px 0 0; color: var(--muted); }
.dev-step { margin: 12px 0 4px; padding-left: 10px; border-left: 3px solid rgb(var(--acc)); font-size: 13.5px; }
.dev-bar .dev-branch { font: 12px var(--mono); color: var(--muted); }
.dev-back { color: var(--muted); }
.composer { position: relative; }
.dev-at { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; padding: 4px; border-radius: 10px; background: #111114; border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.dev-at[hidden] { display: none; }
.dev-at button { text-align: left; padding: 6px 10px; border-radius: 6px; font: 12.5px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-at button.on, .dev-at button:hover { background: rgba(var(--acc), .22); }

/* Fluidité : animations décoratives en pause quand l'app est en arrière-plan ou au repos (économie GPU/batterie). */
html.jv-still *, html.jv-still *::before, html.jv-still *::after { animation-play-state: paused !important; }
html.jv-still .caret, html.jv-still .dots b, html.jv-still .ptr.busy i, html.jv-still .spin { animation-play-state: running !important; }

/* Appel vocal */
#call-btn.rec { color: #fff; background: rgb(var(--acc)); }
body.in-call #mic-btn { display: none; }

/* Point du jour (Jarvis proactif) */
.brief { width: 100%; max-width: 720px; margin: 4px auto 14px; padding: 14px 16px; border: 1px solid rgba(var(--acc),.28); border-radius: 16px; background: linear-gradient(180deg, rgba(var(--acc),.08), rgba(var(--acc),.02)); text-align: left; }
.brief[hidden] { display: none; }
.brief-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--acc-hi)); }
.brief-x { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; padding: 0 4px; }
.brief-x:hover { opacity: 1; }
.brief-sum { margin: 8px 0 10px; font-size: 14px; line-height: 1.5; opacity: .9; }
.brief-list { display: grid; gap: 8px; }
.brief-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(var(--ink),.08); background: rgba(var(--ink),.03); color: inherit; cursor: pointer; font: inherit; }
.brief-item:hover { border-color: rgba(var(--acc),.5); }
.brief-item b { font-size: 14px; }
.brief-item small { grid-row: 2; font-size: 12.5px; opacity: .75; }
.brief-item span { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 12.5px; color: rgb(var(--acc-hi)); white-space: nowrap; }
.brief-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.brief-idea { padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(var(--acc),.3); background: none; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.brief-idea:hover { background: rgba(var(--acc),.12); }

/* Abonnement LTC + parrainage */
.sub-box, .ref-box { margin-top: 18px; }
.sub-box[hidden], .ref-box[hidden], .ref-enter[hidden] { display: none; }
.sub-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line2); border-radius: 999px; gap: 2px; margin-top: 6px; }
.sub-toggle button { border: 0; background: none; color: inherit; font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.sub-toggle button[aria-pressed="true"] { background: rgb(var(--acc)); color: #fff; }
.sub-plans { grid-template-columns: repeat(2, 1fr); }
.sub-plan s { font-size: 11.5px; opacity: .55; }
.sub-plan.cur { border-color: rgba(var(--acc), .6); }
.ref-code { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border: 1px dashed rgba(var(--acc), .45); border-radius: 10px; }
.ref-code span { font-size: 12.5px; opacity: .7; }
.ref-code b { flex: 1; font-size: 17px; letter-spacing: .12em; }
.ref-enter { display: flex; gap: 8px; margin-top: 8px; }
.ref-enter input { flex: 1; min-width: 0; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg); color: inherit; font: inherit; }

/* fichiers générés */
.file-card { display: flex; align-items: center; gap: 12px; margin: 10px 0; padding: 12px 14px; border: 1px solid rgba(255, 58, 85, .28); border-radius: 14px; background: rgba(255, 58, 85, .06); }
.file-card .file-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font: 700 11px/1 var(--mono, monospace); letter-spacing: .04em; color: var(--text); background: linear-gradient(180deg, #ff3a55, #b30d26); }
.file-card.xlsx .file-ico { background: linear-gradient(180deg, #2f9e5b, #1d6b3c); }
.file-card.docx .file-ico { background: linear-gradient(180deg, #3d6fe0, #24479b); }
.file-card .file-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-card .file-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .file-txt small { opacity: .65; }
.file-pending { opacity: .7; font-style: italic; }
/* relance avant expiration */
.expiry-banner { position: fixed; z-index: 60; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 10px 10px 10px 16px; border-radius: 999px; border: 1px solid rgba(255, 58, 85, .45); background: rgba(18, 4, 7, .92); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); backdrop-filter: blur(10px); font-size: 14px; }
.expiry-banner .expiry-x { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 4px 6px; font-size: 14px; }
.expiry-banner .expiry-x:hover { opacity: 1; }
@media (max-width: 560px) { .expiry-banner { border-radius: 16px; flex-wrap: wrap; justify-content: center; text-align: center; } }
.push-box { margin-top: 18px; }
.promo-form { margin-top: 10px; }

/* partage / export, commandes, bug */
.share-picker { position: relative; }
.share-menu { right: 0; left: auto; top: calc(100% + 6px); min-width: 250px; }
.cmd-menu { position: absolute; left: 8px; right: auto; bottom: calc(100% + 6px); top: auto; min-width: 260px; max-height: 300px; overflow-y: auto; z-index: 30; }
.bug-form { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.bug-form textarea { width: 100%; resize: vertical; min-height: 70px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2, var(--panel2)); color: inherit; font: inherit; }
.bug-form .btn { align-self: flex-start; }
.app .share-menu, .app .cmd-menu { background: #0e090a; }
.app .topbar:has(.share-menu:not([hidden])), .app .composer-wrap:has(.cmd-menu:not([hidden])) { z-index: 60; }

/* Extension navigateur (réglages) */
.ext-box { margin-top: 18px; }
.ext-box[hidden], .ext-box [hidden] { display: none; }
.ext-box #ext-token { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; flex: 1; }
.ext-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ext-actions .btn { text-decoration: none; }

/* Menus Effort et Dossier de la zone de saisie : ils s'ouvrent au-dessus du champ. */
.effort-picker, .folder-picker { position: relative; display: inline-flex; }
.effort-picker[hidden], .folder-picker[hidden] { display: none; }
.effort-menu, .folder-menu { bottom: calc(100% + 8px); left: 0; z-index: 60; max-width: min(340px, calc(100vw - 32px)); }
.folder-menu { max-height: min(360px, 60vh); overflow-y: auto; }
.folder-menu small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.effort-menu .use { font-style: normal; font-size: 11px; color: var(--dim); margin-left: auto; padding-left: 10px; }
#folder-btn.on { border-color: rgba(var(--acc),.45); color: var(--text); }
#folder-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Confirmation dans l'app (remplace les fenêtres du navigateur). */
.confirm-text { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 4px 0 14px; }
.btn.primary.danger { background: var(--accent); border-color: var(--accent); }
.dev-warn { color: var(--warn, #f5a524); font-size: 13px; margin: 6px 0; }

/* ---------- choix de la crypto ---------- */
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 14px 0 4px; }
.coin-btn { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px; border: 1px solid rgba(var(--ink),.1); background: var(--panel2); color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s; }
.coin-btn:hover, .coin-btn:focus-visible { border-color: rgba(var(--acc),.6); transform: translateY(-1px); }
.coin-btn.last { border-color: rgba(var(--acc),.45); }
.coin-btn small { font-size: 11px; color: var(--dim); }
.coin-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 14px; color: #fff; background: #777; }
.coin-ico.btc { background: #f7931a; } .coin-ico.eth { background: #627eea; } .coin-ico.ltc { background: #345d9d; }
.coin-ico.sol { background: linear-gradient(135deg, #9945ff, #14f195); } .coin-ico.usdt { background: #26a17b; } .coin-ico.usdc { background: #2775ca; }
.pay-net { margin: 2px 0 0; font-size: 12px; color: var(--warn); }

/* Fonds supplémentaires et mode clair. Chargé en dernier dans le bundle : il gagne sur les couches précédentes. */

/* ---------- fonds sombres ---------- */
html[data-theme="graphite"] { --bg: #131418; --bg2: #131418; --panel: #17181d; --panel2: #1c1d23; }
html[data-theme="midnight"] { --bg: #0a0f1d; --bg2: #0a0f1d; --panel: #0e1426; --panel2: #131b31; }
html[data-theme="graphite"] .app .sidebar,
html[data-theme="midnight"] .app .sidebar { background: var(--panel); }

/* ---------- mode clair ---------- */
html[data-mode="light"] {
  --bg: #f6f6f8; --bg2: #ffffff; --panel: #ffffff; --panel2: #efeff3;
  --text: #14141a; --muted: #3f3f48; --dim: #6b6b76;
  --ink: 0,0,0; --shade: 255,255,255;
  --line: rgba(var(--acc),.18); --line2: rgba(var(--acc),.34);
  --link: var(--accent-deep);
  --warn: #d12a2a; --ok: #0f9f6e;
  color-scheme: light;
}
html[data-mode="light"] .app { --glass: rgba(255,255,255,.8); --edge: rgba(0,0,0,.09); }
html[data-mode="light"] .app .sidebar { background: var(--panel); border-right: 1px solid rgba(0,0,0,.07); }
html[data-mode="light"] .menu,
html[data-mode="light"] .modal { background: var(--panel); box-shadow: 0 18px 44px rgba(20,20,30,.16); }
html[data-mode="light"] .app .msg.user .bubble { background: rgba(var(--acc),.08); color: var(--text); }
html[data-mode="light"] .app .composer { background: var(--panel); box-shadow: 0 10px 30px rgba(20,20,30,.08); }
html[data-mode="light"] .menu-item:hover,
html[data-mode="light"] .menu-item.active { background: rgba(var(--acc),.08); }
html[data-mode="light"] ::selection { background: rgba(var(--acc),.22); }
/* Voiles et ombres : plus légers sur fond clair. */
html[data-mode="light"] .modal::backdrop,
html[data-mode="light"] .sheet-back,
html[data-mode="light"] .scrim.show { background: rgba(20,20,30,.32); }
html[data-mode="light"] .app .sidebar.open { box-shadow: 20px 0 60px rgba(20,20,30,.18); }
/* Les blocs de code restent sombres (coloration syntaxique pensée pour le noir). */
html[data-mode="light"] .app .md pre,
html[data-mode="light"] .dev-card pre,
html[data-mode="light"] .dev-results pre,
html[data-mode="light"] .diff {
  --bg: #111216; --panel2: #1a1b21; --text: #f2f2f5; --muted: #d4d4d8; --dim: #a1a1aa; --ink: 255,255,255; --shade: 0,0,0;
  color: var(--text);
}
html[data-mode="light"] .limit-banner { background: #fff4f4; color: var(--text); }
html[data-mode="light"] .acc-dot { border-color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
html[data-mode="light"] .acc-dot.on { box-shadow: 0 0 0 2px var(--text); }
/* Le mode OLED n'a pas de sens en clair : on garde juste ses ombres coupées. */
html[data-mode="light"][data-theme="oled"] .app .bubble,
html[data-mode="light"][data-theme="oled"] .app .composer,
html[data-mode="light"][data-theme="oled"] .app .topbar,
html[data-mode="light"][data-theme="oled"] .app .sidebar,
html[data-mode="light"][data-theme="oled"] .modal { background: var(--panel) !important; }

/* ---------- réglages d'apparence ---------- */
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.mode-row button {
  display: grid; gap: 6px; justify-items: center; padding: 12px 8px; border-radius: 14px;
  border: 1px solid rgba(var(--ink),.1); background: var(--panel2); color: var(--muted); font-size: 13px;
}
.mode-row button[aria-checked="true"] { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode-row .mode-sw { width: 44px; height: 28px; border-radius: 8px; border: 1px solid rgba(var(--ink),.14); }
.mode-sw.dark { background: linear-gradient(135deg, #000 50%, #1b1b20 50%); }
.mode-sw.light { background: linear-gradient(135deg, #fff 50%, #ececf0 50%); }
.mode-sw.auto { background: linear-gradient(135deg, #000 50%, #fff 50%); }
.sw.graphite { background: linear-gradient(160deg, #1c1d23, #131418); box-shadow: inset 0 -3px 0 rgb(255,31,50); }
.sw.midnight { background: linear-gradient(160deg, #131b31, #0a0f1d); box-shadow: inset 0 -3px 0 rgb(255,31,50); }
.size-row { display: flex; gap: 8px; flex-wrap: wrap; }
.size-row [aria-checked="true"] { background: rgba(var(--acc),.16); border-color: rgba(var(--acc),.5); color: var(--text); }
html[data-size="small"] { font-size: 14px; }
html[data-size="small"] body { font-size: 14px; }
html[data-size="large"] body { font-size: 16.5px; }
html[data-size="large"] .app .md { font-size: 16.5px; }

/* ---------- finitions globales ---------- */
/* L'en-tête des réglages reste au-dessus des onglets quand on fait défiler. */
.modal-head { z-index: 3; }
.modal { scrollbar-width: thin; scrollbar-color: rgba(var(--acc), .3) transparent; }

.modal-body .accent-row + h4 { margin-top: 18px; }
@media (min-width: 781px) {
  .modal[open] { animation: jt-pop .22s cubic-bezier(.2, .8, .2, 1); }
  .modal[open]::backdrop { animation: jt-fade .22s ease-out; }
}
@keyframes jt-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes jt-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .modal[open], .modal[open]::backdrop { animation: none; }
}
html[data-mode="light"] .modal::backdrop { background: rgba(20, 20, 28, .38); }
html[data-mode="light"] .modal { box-shadow: 0 24px 60px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04); }
