/* =============================================================================
 * widget-skin.css — Storefront AI voice/chat widget reskin (Devaito)
 * -----------------------------------------------------------------------------
 * ADDITIVE overlay loaded AFTER the widget's own hashed CSS. It never edits the
 * compiled bundle; it only overrides the widget's (Vue-scoped) class names to
 * give an ElevenLabs-class look: a living gradient "orb" launcher, a clean
 * theme-adaptive card, brand-violet accents. Injected at request time only for
 * stores in features.voice_widget_skin_tenants (canary), so it is inert/absent
 * everywhere else (fleet stays byte-identical).
 *
 * Specificity note: the bundle uses `.x[data-v-####]` (0,2,0). To win reliably
 * from an unscoped sheet we use `!important` on the overridden values. We only
 * touch colours / surfaces / shape / shadow — never layout or animation timing.
 *
 * Brand: violet #472af2 → #7c3aed, halo #a78bfa. Orb blends violet→blue→teal→amber.
 * =========================================================================== */

:root {
  --dvx-violet: #5a3ff0;
  --dvx-violet-2: #7c3aed;
  --dvx-halo: #a78bfa;
  --dvx-ink: #101322;
  --dvx-muted: #5b6478;
  --dvx-card: rgba(255, 255, 255, 0.94);
  --dvx-card-border: rgba(17, 19, 34, 0.08);
  --dvx-card-shadow: 0 18px 60px rgba(24, 18, 60, 0.22), 0 2px 8px rgba(24, 18, 60, 0.10);
}

/* The signature living orb — reused by launcher, avatar and send button. */
@keyframes dvxOrbShimmer {
  0%, 100% { filter: hue-rotate(0deg) saturate(1.05) brightness(1); }
  50%      { filter: hue-rotate(-12deg) saturate(1.15) brightness(1.06); }
}
@keyframes dvxHalo {
  0%   { transform: scale(1);   opacity: .55; }
  70%  { transform: scale(1.7); opacity: 0;   }
  100% { transform: scale(1.7); opacity: 0;   }
}

/* ###########################################################################
 * PART A — NATIVE Q&A widget  (#dvai-* from buildAssistantWidget)
 * This is the widget live on storefronts today (violet button + white card).
 * We give it the ElevenLabs-class look: a living gradient-orb launcher, a clean
 * white/dark card, an orb avatar header, brand-violet bubbles. IDs → we match
 * with `!important` and rely on being loaded after the widget's inline <style>.
 * ######################################################################### */

/* Launcher → living gradient orb */
#dvai-b {
  width: 64px !important;
  height: 64px !important;
  background:
    radial-gradient(120% 120% at 28% 22%, var(--dvx-halo) 0%, rgba(167,139,250,0) 42%),
    radial-gradient(120% 120% at 78% 26%, #5b8cff 0%, rgba(91,140,255,0) 46%),
    radial-gradient(120% 120% at 72% 80%, #22d3ee 0%, rgba(34,211,238,0) 45%),
    radial-gradient(120% 120% at 26% 82%, #f5c451 0%, rgba(245,196,81,0) 50%),
    linear-gradient(135deg, var(--dvx-violet), var(--dvx-violet-2)) !important;
  box-shadow:
    0 10px 30px rgba(90, 63, 240, 0.42),
    0 2px 6px rgba(24, 18, 60, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.35) !important;
  animation: dvxOrbShimmer 8s ease-in-out infinite !important;
  overflow: visible !important;
}
#dvai-b svg { filter: drop-shadow(0 1px 2px rgba(20,12,50,0.45)) !important; transform: scale(1.02); }
#dvai-b::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, var(--dvx-halo) 0%, rgba(124,58,237,0.35) 60%, transparent 72%) !important;
  animation: dvxHalo 2.6s ease-out infinite !important;
  z-index: -1 !important;
}
#dvai-b:hover {
  box-shadow: 0 14px 40px rgba(90,63,240,0.5), 0 3px 10px rgba(24,18,60,0.3) !important;
}

/* Card */
#dvai-p {
  background: var(--dvx-card) !important;
  border: 1px solid var(--dvx-card-border) !important;
  border-radius: 24px !important;
  box-shadow: var(--dvx-card-shadow) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

/* Header → clean, orb avatar */
#dvai-h {
  background: transparent !important;
  color: var(--dvx-ink) !important;
  border-bottom: 1px solid var(--dvx-card-border) !important;
  padding: 14px 16px !important;
}
#dvai-h .nm { color: var(--dvx-ink) !important; font-weight: 700 !important; letter-spacing: -0.01em; }
#dvai-h .x { color: var(--dvx-muted) !important; }
#dvai-h .d {
  width: 30px !important;
  height: 30px !important;
  background:
    radial-gradient(120% 120% at 30% 22%, var(--dvx-halo) 0%, rgba(167,139,250,0) 45%),
    radial-gradient(120% 120% at 75% 80%, #22d3ee 0%, rgba(34,211,238,0) 48%),
    linear-gradient(135deg, var(--dvx-violet), var(--dvx-violet-2)) !important;
  box-shadow: 0 4px 12px rgba(90,63,240,0.35) !important;
}

/* Messages */
#dvai-m { background: transparent !important; }
.dvai-msg.usr {
  background: linear-gradient(135deg, var(--dvx-violet), var(--dvx-violet-2)) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(90,63,240,0.28) !important;
}
.dvai-msg.bot {
  background: #fff !important;
  color: var(--dvx-ink) !important;
  border: 1px solid var(--dvx-card-border) !important;
}

/* Input row */
#dvai-f { background: transparent !important; border-top: 1px solid var(--dvx-card-border) !important; }
#dvai-i {
  background: rgba(17,19,34,0.035) !important;
  border: 1px solid var(--dvx-card-border) !important;
  color: var(--dvx-ink) !important;
}
#dvai-i:focus {
  border-color: var(--dvx-violet) !important;
  box-shadow: 0 0 0 3px rgba(90,63,240,0.18) !important;
  background: #fff !important;
}
#dvai-s {
  background: linear-gradient(135deg, var(--dvx-violet), var(--dvx-violet-2)) !important;
  box-shadow: 0 6px 16px rgba(90,63,240,0.4) !important;
}

/* Native widget — dark storefront adaptation */
@media (prefers-color-scheme: dark) {
  .dvai-msg.bot {
    background: rgba(255,255,255,0.06) !important;
    color: var(--dvx-ink) !important;
    border-color: var(--dvx-card-border) !important;
  }
  #dvai-i { background: rgba(255,255,255,0.06) !important; color: var(--dvx-ink) !important; }
  #dvai-i:focus { background: rgba(255,255,255,0.10) !important; }
}

/* ###########################################################################
 * PART B — LiveKit bundle widget  (.chatbot-*)  —  PEAU v2 (18/09/2026)
 *
 * Parti pris : un CHROME NEUTRE (surface pleine, encre, filets) qui ne jure avec
 * aucune charte, et une ORBE vivante qui porte, elle, la couleur DU TENANT.
 * La couleur vient de la page (sonde du bouton principal, posée par le script
 * compagnon dans --dvx-a / --dvx-a2 / --dvx-a3 / --dvx-on-a). Sans script, les
 * valeurs par défaut ci-dessous s'appliquent : rien ne dépend du JS pour tenir.
 *
 * Ce que la v1 faisait de travers, mesuré à l'écran :
 *  - la pastille allumait « le mode courant » alors qu'AUCUNE session n'est ouverte :
 *    les deux boutons sont des ACTIONS (écrire / parler), pas des onglets ;
 *  - deux icônes muettes, aucun mot : on ne sait pas ce que fait le micro ;
 *  - l'état vocal = une boîte blanche vide avec deux petits boutons ;
 *  - le bouton flottant connecté = une orbe sans icône, qui RACCROCHE au clic ;
 *  - la carte intérieure et la carte extérieure portent la MÊME classe
 *    `.chatbot-container` : tout était peint deux fois (double filet, double ombre).
 * ######################################################################### */

@property --dvx-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  --dvx-a: #5a3ff0;            /* accent du tenant (repli : violet Devaito) */
  --dvx-a2: #22b8ee;           /* compagnon froid  */
  --dvx-a3: #f5b651;           /* compagnon chaud  */
  --dvx-on-a: #ffffff;         /* encre lisible SUR l'accent */
  --dvx-surface: #ffffff;
  --dvx-surface-2: #f4f5f7;
  --dvx-ink: #0f1115;
  --dvx-muted: #667085;
  --dvx-line: rgba(15, 17, 21, 0.09);
  --dvx-cta-bg: #0f1115;
  --dvx-cta-ink: #ffffff;
  --dvx-danger: #e5484d;
  --dvx-shadow: 0 1px 2px rgba(15, 17, 21, 0.06), 0 8px 24px rgba(15, 17, 21, 0.12), 0 24px 60px rgba(15, 17, 21, 0.14);
  --dvx-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --dvx-orb-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    inset 0 -5px 10px rgba(0, 0, 0, 0.14),
    0 4px 14px rgba(15, 17, 21, 0.22);
  /* Icônes Lucide en masque : la couleur suit `currentColor`, plus aucun `fill="#fff"` à combattre. */
  --dvx-i-chat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.9 20A9 9 0 1 0 4 16.1L2 22Z'/%3E%3C/svg%3E");
  --dvx-i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' x2='12' y1='19' y2='22'/%3E%3C/svg%3E");
  --dvx-i-micoff: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='2' x2='22' y1='2' y2='22'/%3E%3Cpath d='M18.89 13.23A7.12 7.12 0 0 0 19 12v-2'/%3E%3Cpath d='M5 10v2a7 7 0 0 0 12 5'/%3E%3Cpath d='M15 9.34V5a3 3 0 0 0-5.68-1.33'/%3E%3Cpath d='M9 9v3a3 3 0 0 0 5.12 2.12'/%3E%3Cline x1='12' x2='12' y1='19' y2='22'/%3E%3C/svg%3E");
  --dvx-i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
  --dvx-i-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --dvx-i-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3Cpath d='M12 19V5'/%3E%3C/svg%3E");
  --dvx-i-hangup: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91'/%3E%3Cline x1='22' x2='2' y1='2' y2='22'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --dvx-surface: #16171d;
    --dvx-surface-2: #22242c;
    --dvx-ink: #f3f4f6;
    --dvx-muted: #9aa3b5;
    --dvx-line: rgba(255, 255, 255, 0.11);
    --dvx-cta-bg: #ffffff;
    --dvx-cta-ink: #0f1115;
    --dvx-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.45);
    /* jetons de la PARTIE A (widget natif), dont le mode sombre vivait dans l'ancienne partie B */
    --dvx-card: rgba(18, 20, 30, 0.92);
    --dvx-card-border: rgba(255, 255, 255, 0.10);
    --dvx-card-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

@keyframes dvxSpin   { to { --dvx-ang: 360deg; } }
@keyframes dvxRise   { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dvxBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes dvxSpeak  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes dvxRing   { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.55); opacity: 0; } }

/* L'ORBE. Écrite en toutes lettres sur chaque porteur, et PAS dans une variable : un `var()` logé dans
   une propriété personnalisée est résolu là où elle est déclarée (:root) — l'angle animé sur l'élément
   n'y arriverait jamais, et l'orbe resterait figée. */
.chatbot-mode-bubble::before,
.chatbot-mode-bubble-restore,
.chatbot-widget-button,
.chatbot-header .bot-avatar {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 70% 78%, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0) 55%),
    conic-gradient(from var(--dvx-ang), var(--dvx-a), var(--dvx-a2), var(--dvx-a3), var(--dvx-a)) !important;
}

/* ---------------------------------------------------------------------------
 * 1. PASTILLE AU REPOS  —  [ orbe ]  [ Écrire ]  [ ● Parler ]  ×
 *    Deux ACTIONS nommées. « Parler » est l'appel principal (ce qui distingue
 *    l'assistant d'un simple chat) ; s'il n'y a qu'un mode, c'est lui l'appel.
 * ------------------------------------------------------------------------- */
.chatbot-mode-bubble {
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  right: 20px !important;
  gap: 6px !important;
  padding: 7px 8px 7px 7px !important;
  border-radius: 999px !important;
  background: var(--dvx-surface) !important;
  border: 1px solid var(--dvx-line) !important;
  box-shadow: var(--dvx-shadow) !important;
  font-family: var(--dvx-font) !important;
  animation: dvxRise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
}
/* L'orbe : signature visuelle, et cible de clic (le script compagnon ouvre l'action principale). */
.chatbot-mode-bubble::before {
  content: "";
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin-right: 4px;
  border-radius: 50%;
  box-shadow: var(--dvx-orb-shadow);
  animation: dvxSpin 10s linear infinite, dvxBreath 5s ease-in-out infinite;
  cursor: pointer;
}
.chatbot-mode-bubble .bubble-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 42px;
  height: 42px !important;
  padding: 0 12px !important;
  gap: 8px;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--dvx-ink) !important;
  font: 600 14px/1 var(--dvx-font) !important;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease !important;
  -webkit-tap-highlight-color: transparent;
}
.chatbot-mode-bubble .bubble-btn[data-dvx-label] { padding: 0 16px 0 13px !important; }
.chatbot-mode-bubble .bubble-btn[data-dvx-label]::after { content: attr(data-dvx-label); }
.chatbot-mode-bubble .bubble-btn:hover { background: var(--dvx-surface-2) !important; }
.chatbot-mode-bubble .bubble-btn:active { transform: scale(0.97); }
.chatbot-mode-bubble .bubble-btn:focus-visible,
.chatbot-mode-bubble-restore:focus-visible,
.chatbot-widget-button:focus-visible,
.chatbot-voice-container .vad-button:focus-visible {
  outline: 2px solid var(--dvx-a) !important;
  outline-offset: 2px !important;
}
/* Icônes : le SVG plein du bundle laisse la place au trait Lucide. */
.chatbot-mode-bubble .bubble-btn svg { display: none !important; }
.chatbot-mode-bubble .bubble-btn:not(.close-btn)::before {
  content: "";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--dvx-i-chat) center / contain no-repeat;
  mask: var(--dvx-i-chat) center / contain no-repeat;
}
.chatbot-mode-bubble .bubble-btn[aria-label^="voice"]::before,
.chatbot-mode-bubble .bubble-btn[data-dvx-mode="voice"]::before {
  -webkit-mask-image: var(--dvx-i-mic);
  mask-image: var(--dvx-i-mic);
}
/* Appel principal : « Parler », ou l'unique mode proposé. */
.chatbot-mode-bubble .bubble-btn[aria-label^="voice"],
.chatbot-mode-bubble .bubble-btn[data-dvx-mode="voice"],
.chatbot-mode-bubble .bubble-btn:first-child:nth-last-child(2) {
  background: var(--dvx-cta-bg) !important;
  color: var(--dvx-cta-ink) !important;
  box-shadow: 0 1px 2px rgba(15, 17, 21, 0.2), 0 4px 12px rgba(15, 17, 21, 0.16) !important;
}
.chatbot-mode-bubble .bubble-btn[aria-label^="voice"]:hover,
.chatbot-mode-bubble .bubble-btn[data-dvx-mode="voice"]:hover,
.chatbot-mode-bubble .bubble-btn:first-child:nth-last-child(2):hover {
  background: var(--dvx-cta-bg) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 17, 21, 0.2), 0 8px 20px rgba(15, 17, 21, 0.22) !important;
}
/* Fermer : présent, discret. Le « × » texte du bundle est remplacé par le trait. */
.chatbot-mode-bubble .bubble-btn.close-btn {
  min-width: 0;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  margin-left: 0 !important;
  font-size: 0 !important;
  color: var(--dvx-muted) !important;
  opacity: 1 !important;          /* v2.1 : à 70 % d'un gris, la croix se perdait — contraste 4,8:1 désormais */
}
.chatbot-mode-bubble .bubble-btn.close-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--dvx-i-x) center / contain no-repeat;
  mask: var(--dvx-i-x) center / contain no-repeat;
}
.chatbot-mode-bubble .bubble-btn.close-btn::after { content: none !important; }
.chatbot-mode-bubble .bubble-btn.close-btn:hover { color: var(--dvx-ink) !important; background: var(--dvx-surface-2) !important; }

/* Téléphone : seul l'appel principal garde son mot ; cibles de 44 px. */
@media (max-width: 480px) {
  .chatbot-mode-bubble { right: 12px !important; }
  .chatbot-mode-bubble .bubble-btn { height: 44px !important; min-width: 44px; }
  .chatbot-mode-bubble::before { width: 44px; height: 44px; }
  .chatbot-mode-bubble .bubble-btn[data-dvx-mode="text"]:not(:nth-last-child(2)) { padding: 0 !important; }
  .chatbot-mode-bubble .bubble-btn[data-dvx-mode="text"]:not(:nth-last-child(2))::after { content: none; }
  .chatbot-mode-bubble .bubble-btn.close-btn { width: 36px !important; height: 36px !important; min-width: 0; }
}
/* Au doigt : les deux croix (masquer la pastille, fermer le chat) et le bouton d'envoi passent à 40 px et plus. */
@media (pointer: coarse) {
  .chatbot-mode-bubble .bubble-btn.close-btn { width: 40px !important; height: 40px !important; }
  .chatbot-header .action-btn { width: 40px !important; height: 40px !important; }
  .chatbot-header .action-btn svg { width: 18px !important; height: 18px !important; }
}

/* Pastille repliée → une petite orbe, pas un rond gris à 70 %. */
.chatbot-mode-bubble-restore {
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  right: 20px !important;
  width: 48px !important;
  height: 48px !important;
  opacity: 1 !important;
  color: #fff !important;
  box-shadow: var(--dvx-orb-shadow), 0 8px 24px rgba(15, 17, 21, 0.18) !important;
  animation: dvxSpin 10s linear infinite;
  transition: transform 0.18s ease !important;
}
.chatbot-mode-bubble-restore:hover { transform: scale(1.06); }
.chatbot-mode-bubble-restore svg { display: none !important; }
.chatbot-mode-bubble-restore::before {
  content: "";
  width: 20px;
  height: 20px;
  background: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  -webkit-mask: var(--dvx-i-chat) center / contain no-repeat;
  mask: var(--dvx-i-chat) center / contain no-repeat;
}

/* ---------------------------------------------------------------------------
 * 2. BOUTON FLOTTANT (session ouverte) — orbe + chevron : « replier / terminer ».
 * ------------------------------------------------------------------------- */
.chatbot-widget-button {
  width: 56px !important;
  height: 56px !important;
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  box-shadow: var(--dvx-orb-shadow), 0 10px 28px rgba(15, 17, 21, 0.2) !important;
  animation: dvxSpin 10s linear infinite !important;
  z-index: 999999999 !important;
}
.chatbot-widget-button svg {
  color: #fff !important;
  width: 26px !important; height: 26px !important;
  min-width: 26px !important; min-height: 26px !important;
  flex: 0 0 auto !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)) !important;
}
.chatbot-widget-button:not(.active):not(.speaking)::before {
  background: var(--dvx-a) !important;
  opacity: 0.35 !important;
  animation: dvxRing 2.4s ease-out infinite !important;
  z-index: -1;
}
.chatbot-widget-button:hover { box-shadow: var(--dvx-orb-shadow), 0 14px 36px rgba(15, 17, 21, 0.26) !important; }

/* ---------------------------------------------------------------------------
 * 3. CARTE DE CHAT
 *    🚨 L'enveloppe ET la carte intérieure portent `.chatbot-container` : on
 *    peint l'enveloppe, et on remet la carte intérieure à nu.
 * ------------------------------------------------------------------------- */
.chatbot-container {
  background: var(--dvx-surface) !important;
  border: 1px solid var(--dvx-line) !important;
  border-radius: 24px !important;
  box-shadow: var(--dvx-shadow) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  font-family: var(--dvx-font) !important;
  animation: dvxRise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.chatbot-container .chatbot-container,
.chatbot-container .chatbot-voice-container {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  animation: none !important;
}
.chatbot-container.text-mode { bottom: calc(max(20px, env(safe-area-inset-bottom)) + 68px) !important; }

.chatbot-header {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--dvx-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--dvx-ink) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.chatbot-header h2 { color: var(--dvx-ink) !important; font: 650 16px/1.2 var(--dvx-font) !important; letter-spacing: -0.01em; }
.chatbot-header .status-line, .chatbot-header .status { color: var(--dvx-muted) !important; font-size: 12.5px !important; }
.chatbot-header .bot-avatar {
  box-shadow: var(--dvx-orb-shadow) !important;
  animation: dvxSpin 10s linear infinite;
}
.chatbot-header .bot-avatar svg { display: none !important; }   /* l'orbe EST l'avatar */
.chatbot-header .action-btn {
  background: var(--dvx-surface-2) !important;
  color: var(--dvx-ink) !important;
}
.chatbot-header .action-btn:hover { filter: brightness(0.94); }
.chatbot-header .action-btn.close-btn:hover { background: var(--dvx-ink) !important; color: var(--dvx-surface) !important; filter: none; }
.chatbot-header .action-btn svg { stroke-width: 2.4; }
.chatbot-header .action-btn [fill="#fff"], .chatbot-header .action-btn [fill="#fff"] * { fill: var(--dvx-ink) !important; }
.chatbot-header .action-btn [stroke="#fff"], .chatbot-header .action-btn [stroke="#fff"] * { stroke: var(--dvx-ink) !important; }

.messages-container { background: transparent !important; }
.message.user-message .message-bubble {
  background: var(--dvx-a) !important;
  color: var(--dvx-on-a) !important;
  box-shadow: none !important;
}
.message.bot-message .message-bubble {
  background: var(--dvx-surface-2) !important;
  color: var(--dvx-ink) !important;
  border: 0 !important;
}
.message .message-time { color: var(--dvx-muted) !important; }
.welcome-message, .welcome-message p { color: var(--dvx-muted) !important; }
.welcome-message h3 { color: var(--dvx-ink) !important; font: 650 17px/1.3 var(--dvx-font) !important; letter-spacing: -0.01em; }

.input-container {
  background: transparent !important;
  border-top: 1px solid var(--dvx-line) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
/* Questions d'amorce (posées en style en ligne par le script compagnon) : à la couleur du tenant. */
[data-agent-starters] button {
  background: var(--dvx-surface) !important;
  color: var(--dvx-ink) !important;
  border: 1px solid var(--dvx-line) !important;
  font: 500 13px/1.2 var(--dvx-font) !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}
[data-agent-starters] button:hover { background: var(--dvx-surface-2) !important; border-color: var(--dvx-a) !important; }
.text-input-wrapper .text-input {
  background: var(--dvx-surface-2) !important;
  border: 1px solid transparent !important;
  color: var(--dvx-ink) !important;
  font-family: var(--dvx-font) !important;
}
.text-input-wrapper .text-input:focus {
  border-color: var(--dvx-a) !important;
  box-shadow: 0 0 0 3px rgba(127, 127, 127, 0.16) !important;
  background: var(--dvx-surface) !important;
  outline: none !important;
}
.text-input-wrapper .text-input::placeholder { color: var(--dvx-muted) !important; }
.text-input-wrapper .send-button {
  background: var(--dvx-a) !important;
  color: var(--dvx-on-a) !important;
  box-shadow: none !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.text-input-wrapper .send-button:disabled { background: var(--dvx-surface-2) !important; color: var(--dvx-muted) !important; opacity: 1 !important; }
.text-input-wrapper .send-button:not(:disabled):hover { transform: scale(1.05); }
.text-input-wrapper .send-button svg { display: none !important; }
.text-input-wrapper .send-button::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--dvx-i-up) center / contain no-repeat;
  mask: var(--dvx-i-up) center / contain no-repeat;
}

/* Conditions d'utilisation */
.terms-overlay { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.terms-modal {
  background: var(--dvx-surface) !important;
  color: var(--dvx-ink) !important;
  border: 1px solid var(--dvx-line) !important;
  border-radius: 24px !important;
  box-shadow: var(--dvx-shadow) !important;
  font-family: var(--dvx-font) !important;
  animation: dvxRise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.terms-modal h3 { color: var(--dvx-ink) !important; font: 650 18px/1.3 var(--dvx-font) !important; letter-spacing: -0.01em; }
.terms-modal .terms-body, .terms-modal .terms-body p { color: var(--dvx-muted) !important; font-size: 14px !important; line-height: 1.55 !important; }
.terms-modal .terms-body a { color: var(--dvx-ink) !important; text-decoration: underline !important; text-underline-offset: 2px; }
.terms-modal .terms-actions { align-items: center !important; }
/* `.btn` est aussi une classe du THÈME de la boutique : on neutralise ce qui en fuit (marges, hauteurs, majuscules). */
.terms-modal .terms-actions .btn { margin: 0 !important; width: auto !important; min-width: 0 !important; height: auto !important; text-transform: none !important; letter-spacing: 0 !important; border-radius: 999px !important; font: 600 14px/1 var(--dvx-font) !important; padding: 12px 18px !important; }
.terms-modal .terms-actions .btn-primary { background: var(--dvx-cta-bg) !important; color: var(--dvx-cta-ink) !important; border-color: var(--dvx-cta-bg) !important; }
.terms-modal .terms-actions .btn-secondary { background: transparent !important; color: var(--dvx-ink) !important; border: 1px solid var(--dvx-line) !important; }

/* ---------------------------------------------------------------------------
 * 4. APPEL VOCAL — une BARRE D'APPEL :  [ orbe ]  À l'écoute…   (micro) (raccrocher)
 *    L'orbe est le bouton flottant du bundle, amené DANS la barre et rendu inerte
 *    (son clic raccroche : sur une orbe, c'est une surprise ; le bouton rouge le dit).
 *    Tout repose sur :has() — sans lui, on retombe sur la disposition d'origine.
 * ------------------------------------------------------------------------- */
.chatbot-voice-container .vad-buttons-container .vad-button {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  transition: transform 0.15s ease, background 0.15s ease;
}
.chatbot-voice-container .vad-buttons-container .vad-button:hover { transform: scale(1.06); }
.chatbot-voice-container .vad-buttons-container .vad-button svg { display: none !important; }
.chatbot-voice-container .vad-buttons-container .vad-button::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--dvx-i-mic) center / contain no-repeat;
  mask: var(--dvx-i-mic) center / contain no-repeat;
}
.chatbot-voice-container .vad-buttons-container .mute-mic {
  background-color: var(--dvx-surface-2) !important;
  color: var(--dvx-ink) !important;
}
.chatbot-voice-container .vad-buttons-container .end-call {
  background-color: var(--dvx-danger) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
}
.chatbot-voice-container .vad-buttons-container .end-call::before {
  -webkit-mask-image: var(--dvx-i-hangup);
  mask-image: var(--dvx-i-hangup);
}

@supports selector(:has(*)) {
  /* Micro coupé : l'icône « micro » du bundle a 2 tracés, « micro coupé » en a 3. */
  .chatbot-voice-container .mute-mic:has(svg path:nth-child(3)) {
    background-color: rgba(229, 72, 77, 0.12) !important;
    color: var(--dvx-danger) !important;
  }
  .chatbot-voice-container .mute-mic:has(svg path:nth-child(3))::before {
    -webkit-mask-image: var(--dvx-i-micoff);
    mask-image: var(--dvx-i-micoff);
  }

  .chatbot-container:not(.text-mode):has(> .chatbot-voice-container) {
    bottom: max(20px, env(safe-area-inset-bottom)) !important;
    right: 20px !important;
    width: min(340px, calc(100vw - 24px)) !important;
    height: 72px !important;
    border-radius: 999px !important;
    overflow: visible !important;
  }
  .chatbot-container:not(.text-mode) > .chatbot-voice-container {
    flex-direction: row !important;
    align-items: center !important;
    height: 70px !important;
    max-width: none !important;
    padding: 0 12px 0 78px !important;
    overflow: visible !important;
    box-sizing: border-box;
  }
  .chatbot-container:not(.text-mode) > .chatbot-voice-container::before {
    content: attr(data-dvx-status);
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--dvx-ink);
    font: 600 14.5px/1.2 var(--dvx-font);
    letter-spacing: -0.005em;
  }
  .chatbot-container:not(.text-mode) > .chatbot-voice-container:not([data-dvx-status])::before { content: "Listening…"; }
  .chatbot-container:not(.text-mode) > .chatbot-voice-container[data-dvx-muted]:has(.mute-mic svg path:nth-child(3))::before {
    content: attr(data-dvx-muted);
    color: var(--dvx-muted);
  }
  .chatbot-container:not(.text-mode) > .chatbot-voice-container .vad-buttons-container { gap: 8px !important; height: auto !important; flex: 0 0 auto; }

  /* L'orbe, dans la barre. */
  .chatbot-widget-button:has(.speaking-animation) {
    width: 54px !important;
    height: 54px !important;
    right: calc(20px + min(340px, 100vw - 24px) - 54px - 9px) !important;
    bottom: calc(max(20px, env(safe-area-inset-bottom)) + 9px) !important;
    pointer-events: none !important;
    animation: dvxSpin 6s linear infinite, dvxBreath 3.2s ease-in-out infinite !important;
    box-shadow: var(--dvx-orb-shadow) !important;
  }
  .chatbot-widget-button.speaking:has(.speaking-animation),
  .chatbot-widget-button:has(.speaking-animation.speaking-active) {
    animation: dvxSpin 2.4s linear infinite, dvxSpeak 0.7s ease-in-out infinite !important;
  }
  /* Les ondes blanches du bundle deviennent un halo à la couleur du tenant. */
  .chatbot-widget-button:has(.speaking-animation)::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; right: 0 !important;
    width: auto !important; height: auto !important;
    border: 2px solid var(--dvx-a) !important;
    background: transparent !important;
    border-radius: 50% !important;
    animation: dvxRing 2s ease-out infinite !important;
  }
  .chatbot-widget-button .speaking-animation { opacity: 0 !important; }
  .chatbot-widget-button .speaking-animation.speaking-active { opacity: 0.9 !important; }
  .chatbot-widget-button .speaking-animation .center-dot { display: none !important; }

  /* Session texte : le bouton flottant dit ce qu'il fait — replier. */
  .chatbot-widget-button.active:not(:has(.speaking-animation))::before {
    content: "";
    position: static;
    width: 24px;
    height: 24px;
    background: #fff;
    opacity: 1;
    animation: none;
    border-radius: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
    -webkit-mask: var(--dvx-i-down) center / contain no-repeat;
    mask: var(--dvx-i-down) center / contain no-repeat;
  }

  @media (max-width: 480px) {
    .chatbot-container:not(.text-mode):has(> .chatbot-voice-container) { right: 12px !important; }
    .chatbot-widget-button:has(.speaking-animation) { right: calc(12px + min(340px, 100vw - 24px) - 54px - 9px) !important; }
  }
}

/* ---------------------------------------------------------------------------
 * 5. Mouvement réduit : l'orbe reste belle, immobile.
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .chatbot-mode-bubble, .chatbot-mode-bubble::before, .chatbot-mode-bubble-restore,
  .chatbot-widget-button, .chatbot-widget-button::before, .chatbot-widget-button::after,
  .chatbot-container, .terms-modal, .chatbot-header .bot-avatar {
    animation: none !important;
  }
}
