:root { --x-ease: cubic-bezier(.2, .8, .2, 1); }
.x-chat, .x-chat-btn { --ground: #070A09; --surface: #0D1211; --surface-2: #141B18; --line: #1C2622; --line-2: #2C3A34; --text: #E9F2ED; --muted: #8FA69B; --signal: #3DF08B; --signal-dim: #1FA862; --signal-wash: #0C2418; --on-signal: #051109; --ease-out: var(--x-ease); }
.x-chat { --sans: 'Geist', ui-sans-serif, system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, Menlo, monospace; }
/* ═══════════ ASSISTANT (chat.js) — bulle au-dessus de WhatsApp ═══════════ */
.x-chat-btn {
  position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 95; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); color: var(--signal); border: 1.5px solid var(--signal);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out), background .25s;
}
.x-chat-btn.on { opacity: 1; transform: none; pointer-events: auto; }
.x-chat-btn:hover { background: var(--signal-wash); }
.x-chat-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.x-chat-btn svg { width: 26px; height: 26px; }
.x-chat-open .x-chat-btn { opacity: 0; pointer-events: none; transform: scale(.8); }

.x-chat {
  position: fixed; z-index: 97;
  right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(380px, calc(100vw - 36px)); height: min(580px, calc(100vh - 150px));
  display: flex; flex-direction: column;
  background: var(--ground); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(61, 240, 139, .06);
  font-family: var(--sans);
  opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .28s var(--ease-out), transform .28s var(--ease-out);
}
.x-chat.on { opacity: 1; transform: none; }
.x-chat[hidden] { display: none; }

.x-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.x-chat-mark {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--signal); color: var(--on-signal);
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.x-chat-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.x-chat-who strong { font-size: 15px; font-weight: 600; }
.x-chat-status { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--signal); display: flex; align-items: center; gap: 6px; }
.x-chat-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 8px var(--signal); }
.x-chat-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.x-chat-close:hover { color: var(--text); background: var(--surface-2); }
.x-chat-close svg { width: 18px; height: 18px; }

.x-chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.x-chat-msg { margin: 0; max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.x-bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.x-me { align-self: flex-end; background: var(--signal); color: var(--on-signal); border-bottom-right-radius: 4px; }
.x-typing { display: flex; gap: 5px; padding: 14px; }
.x-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: x-dots 1s infinite ease-in-out; }
.x-typing i:nth-child(2) { animation-delay: .15s; }
.x-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes x-dots { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.x-chat-chips { display: flex; gap: 8px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.x-chat-chips::-webkit-scrollbar { display: none; }
.x-chat-chip {
  flex: none; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
  transition: border-color .2s, color .2s;
}
.x-chat-chip:hover { border-color: var(--signal); color: var(--signal); }

.x-chat-acts { display: flex; gap: 8px; padding: 0 16px 10px; flex: none; }
.x-chat-act {
  flex: 1; text-align: center; padding: 9px 10px; border-radius: 10px; text-decoration: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--signal); border: 1px solid var(--signal);
}
.x-chat-act:hover { background: var(--signal-wash); }
.x-chat-act-main { background: var(--signal); color: var(--on-signal); }
.x-chat-act-main:hover { background: var(--signal-dim); }

.x-chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.x-chat-in {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px;
  background: var(--ground); color: var(--text); border: 1px solid var(--line-2);
  font: 16px/1.3 var(--sans); outline: none;
}
.x-chat-in:focus { border-color: var(--signal); }
.x-chat-in::placeholder { color: var(--muted); }
.x-chat-send { width: 44px; flex: none; border: 0; border-radius: 12px; cursor: pointer; background: var(--signal); color: var(--on-signal); display: grid; place-items: center; }
.x-chat-send:hover { background: var(--signal-dim); }
.x-chat-send svg { width: 20px; height: 20px; }
.x-chat-note { margin: 0; padding: 0 16px 10px; background: var(--surface); font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--muted); text-align: center; flex: none; }

@media (max-width: 900px) { .x-chat-btn { width: 52px; height: 52px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); } }
/* téléphone : panneau pleine largeur, WhatsApp masqué derrière */
@media (max-width: 600px) {
  .x-chat {
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto; height: min(620px, calc(100dvh - 80px)); border-radius: 16px;
  }
  .x-chat-open .x-wa, .x-chat-open .x-hint { opacity: 0 !important; pointer-events: none !important; }
}
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .x-chat, .x-chat-btn { transition: none; } .x-typing i { animation: none; } }


/* ─── parcours guidé : choix rapides dans la conversation ─── */
.x-chat-choices { display: flex; flex-wrap: wrap; gap: 8px; align-self: stretch; animation: x-pop .35s var(--x-ease) both; }
.x-chat-choices .x-chat-chip { text-decoration: none; }
.x-chat-links .x-chip-wa { background: #25D366; border-color: #25D366; color: #06140c; }
.x-chat-links .x-chip-main { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
@keyframes x-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.x-chat-msg { animation: x-pop .3s var(--x-ease) both; }

/* ─── « réfléchit » : orbe qui respire + texte balayé de lumière ─── */
.x-think { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.x-orb { width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, var(--signal), #9dfcc6, #1FA862, var(--signal));
  box-shadow: 0 0 12px rgba(61, 240, 139, .6); animation: x-orb 1.1s linear infinite, x-breathe 1.6s ease-in-out infinite; }
@keyframes x-orb { to { transform: rotate(360deg); } }
@keyframes x-breathe { 50% { box-shadow: 0 0 20px rgba(61, 240, 139, .9); } }
.x-think-txt { font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  background: linear-gradient(90deg, var(--muted) 0%, var(--text) 45%, var(--signal) 50%, var(--text) 55%, var(--muted) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: x-shine 1.6s linear infinite; }
@keyframes x-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.x-dots { display: flex; gap: 3px; }
.x-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--signal); animation: x-dots 1s infinite ease-in-out; }
.x-dots i:nth-child(2) { animation-delay: .15s; } .x-dots i:nth-child(3) { animation-delay: .3s; }
/* la réponse s'écrit : curseur vert */
.x-typing-on::after { content: ''; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--signal); animation: x-caret .7s steps(2) infinite; }
@keyframes x-caret { to { visibility: hidden; } }
