/* Chat flotante público — estilo WhatsApp + transiciones premium */
.cw-webchat-root {
  --cw-wc-cyan: #00f3ff;
  --cw-wc-mint: #00ff9d;
  --cw-wc-deep: #0a0a0f;
  --cw-wc-violet: #7c5cff;
  --cw-wa-bg: #0b141a;
  --cw-wa-header: #1f2c34;
  --cw-wa-in: #202c33;
  --cw-wa-out: #005c4b;
  --cw-wa-compose: #1f2c34;
  --cw-wa-input: #2a3942;
  --cw-wa-accent: #00a884;
  position: fixed;
  right: 1.55rem;
  bottom: 1.9rem;
  z-index: 10050;
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  color: #e9edef;
  background: transparent;
  /* No usar perspective aquí: en móvil rompe position:fixed del panel */
}

/* ── FAB: orbe circular verde + negro (invertido) ── */
.cw-webchat-fab {
  --cw-orb-a: #0a0a0f;
  --cw-orb-b: #041810;
  --cw-orb-c: #0d1a16;
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #e8fff6;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    filter 0.3s ease;
  animation: cwWcFabFloat 4.2s ease-in-out infinite;
  will-change: transform, opacity;
  transform-style: preserve-3d;
  filter: brightness(1.2);
}

.cw-webchat-fab:hover,
.cw-webchat-fab:focus-visible {
  transform: scale(1.1) translateY(-4px);
  outline: none;
  animation-play-state: paused;
}

.cw-webchat-fab:hover .cw-webchat-fab-ring,
.cw-webchat-fab:focus-visible .cw-webchat-fab-ring,
.cw-webchat-fab:hover .cw-webchat-fab-rings,
.cw-webchat-fab:focus-visible .cw-webchat-fab-rings,
.cw-webchat-fab:hover .cw-webchat-fab-orb,
.cw-webchat-fab:focus-visible .cw-webchat-fab-orb,
.cw-webchat-fab:hover .cw-webchat-fab-shadow,
.cw-webchat-fab:focus-visible .cw-webchat-fab-shadow,
.cw-webchat-fab:hover .cw-webchat-fab-blob,
.cw-webchat-fab:focus-visible .cw-webchat-fab-blob,
.cw-webchat-fab:hover .cw-webchat-fab-shine,
.cw-webchat-fab:focus-visible .cw-webchat-fab-shine,
.cw-webchat-fab:hover .cw-webchat-fab-shell::before,
.cw-webchat-fab:focus-visible .cw-webchat-fab-shell::before {
  animation-play-state: paused;
}

.cw-webchat-fab:active {
  transform: scale(0.94);
  transition-duration: 0.12s;
}

.cw-webchat-fab.is-open {
  animation: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.55);
  filter: blur(5px);
}

/* Chooser abierto: FAB se queda visible y “activo” */
.cw-webchat-fab.is-chooser-open {
  animation: none;
  transform: scale(1.06) translateY(-2px);
}

.cw-webchat-fab.is-chooser-open .cw-webchat-fab-tag {
  opacity: 0;
  transform: translateY(-50%) translateX(12px);
  pointer-events: none;
}

/* ── Launcher: Chat en vivo | WhatsApp (borde recorrido + pulsos) ── */
@property --cw-launch-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.cw-webchat-launcher {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.85rem);
  width: min(300px, calc(100vw - 2.2rem));
  z-index: 4;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 0.28s ease,
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s ease;
}

.cw-webchat-launcher.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.cw-webchat-launcher__card {
  --cw-launch-angle: 0deg;
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 0.6rem;
  padding: 1rem 0.9rem 0.9rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.98) 0%, rgba(10, 10, 15, 0.96) 55%, rgba(8, 14, 18, 0.98) 100%);
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: visible; /* orbe del chat completo */
}

/* Color solo en el borde (recorrido conic + mask) */
.cw-webchat-launcher__border {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--cw-launch-angle, 0deg),
    transparent 0%,
    rgba(0, 243, 255, 0.15) 8%,
    #00f3ff 16%,
    #00ff9d 28%,
    #25d366 38%,
    transparent 52%,
    transparent 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
  opacity: 0.95;
}

.cw-webchat-launcher.is-open .cw-webchat-launcher__border {
  animation: cwLaunchBorderSpin 2.6s linear infinite;
}

.cw-webchat-launcher__eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 0.2rem;
  padding: 0.15rem 0.25rem 0.35rem;
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #ffffff;
}

.cw-webchat-launcher__opt {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: calc(72px * 0.5) 1fr 18px;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.78rem 0.8rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: #e9edef;
  cursor: pointer;
  text-align: left;
  font: inherit;
  overflow: hidden;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.cw-webchat-launcher__opt:hover,
.cw-webchat-launcher__opt:focus-visible {
  outline: none;
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.cw-webchat-launcher__opt--chat {
  border-color: rgba(255, 255, 255, 0.14);
  overflow: visible;
}

.cw-webchat-launcher__opt--chat:hover,
.cw-webchat-launcher__opt--chat:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.cw-webchat-launcher__opt--wa {
  border-color: rgba(255, 255, 255, 0.14);
}

.cw-webchat-launcher__opt--wa:hover,
.cw-webchat-launcher__opt--wa:focus-visible {
  border-color: rgba(37, 211, 102, 0.55);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.cw-webchat-launcher__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 1.18rem;
  position: relative;
  flex-shrink: 0;
}

/* Misma caja y escala que el avatar al conversar (.cw-webchat-avatar / --head) */
.cw-webchat-launcher__icon--orb {
  width: calc(72px * 0.5);
  height: calc(72px * 0.5);
  border-radius: 0;
  overflow: visible;
  color: inherit;
  background: transparent !important;
  box-shadow: none !important;
}

.cw-webchat-launcher__icon--orb .cw-webchat-avatar {
  width: 100%;
  height: 100%;
}

/* Mismo tratamiento compacto que dentro del panel de chat */
.cw-webchat-launcher__icon--orb .cw-webchat-orb-shell {
  animation: none;
}

.cw-webchat-launcher__icon--orb .cw-webchat-fab-shadow {
  display: none;
}

.cw-webchat-launcher__icon--orb .cw-webchat-fab-rings {
  animation: none;
}

.cw-webchat-launcher__icon--orb .cw-webchat-fab-glow {
  opacity: 0.35;
  inset: calc(-12px * var(--orb-scale));
  filter: blur(calc(10px * var(--orb-scale)));
}

.cw-webchat-launcher__icon--orb .cw-webchat-avatar::after {
  display: none; /* sin punto “en línea” en el menú */
}

.cw-webchat-launcher__opt--chat .cw-webchat-launcher__icon:not(.cw-webchat-launcher__icon--orb) {
  color: #00f3ff;
  background: rgba(0, 243, 255, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(0, 243, 255, 0.28),
    0 0 18px rgba(0, 243, 255, 0.22);
}

/* WhatsApp: botón flotante redondo (mismo tamaño que el orbe del chat) */
.cw-webchat-launcher__opt--wa .cw-webchat-launcher__icon {
  display: grid;
  place-items: center;
  width: calc(72px * 0.5);
  height: calc(72px * 0.5);
  border-radius: 50%;
  font-size: 1.28rem;
  line-height: 0;
  color: #ffffff;
  background: linear-gradient(160deg, #3be07a 0%, #25d366 45%, #1ebe57 100%);
  box-shadow:
    0 6px 16px rgba(2, 8, 23, 0.35),
    0 0 18px rgba(37, 211, 102, 0.45),
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -6px 12px rgba(0, 80, 40, 0.22);
}

/* Centrado óptico: el glifo de WhatsApp viene un poco torcido en FA */
.cw-webchat-launcher__opt--wa .cw-webchat-launcher__icon i {
  display: grid;
  place-items: center;
  width: 1em;
  height: 1em;
  margin: 0;
  padding: 0;
  line-height: 1;
  font-style: normal;
  speak: never;
}

.cw-webchat-launcher__opt--wa .cw-webchat-launcher__icon i::before {
  display: block;
  width: 1em;
  line-height: 1;
  text-align: center;
  transform: translate(0.03em, 0.02em);
}

.cw-webchat-launcher.is-open .cw-webchat-launcher__opt--wa .cw-webchat-launcher__icon {
  animation: cwLaunchWaFabPulse 1.8s ease-in-out infinite;
}

.cw-webchat-launcher__opt--wa:hover .cw-webchat-launcher__icon,
.cw-webchat-launcher__opt--wa:focus-visible .cw-webchat-launcher__icon {
  animation: none;
  transform: scale(1.06);
  box-shadow:
    0 8px 20px rgba(2, 8, 23, 0.4),
    0 0 26px rgba(37, 211, 102, 0.55),
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    inset 0 -6px 12px rgba(0, 80, 40, 0.22);
}

.cw-webchat-launcher__copy {
  display: grid;
  gap: 0.14rem;
  min-width: 0;
}

.cw-webchat-launcher__copy strong {
  font-size: 0.94rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.cw-webchat-launcher__copy small {
  font-size: 0.72rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.62);
}

.cw-webchat-launcher__arrow {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  transition: transform 0.22s ease, color 0.22s ease;
}

.cw-webchat-launcher__opt:hover .cw-webchat-launcher__arrow,
.cw-webchat-launcher__opt:focus-visible .cw-webchat-launcher__arrow {
  color: rgba(255, 255, 255, 0.9);
  transform: translateX(3px);
}

.cw-webchat-launcher__opt--chat:hover .cw-webchat-launcher__arrow {
  color: #00f3ff;
}

.cw-webchat-launcher__opt--wa:hover .cw-webchat-launcher__arrow {
  color: #25d366;
}

@keyframes cwLaunchBorderSpin {
  to { --cw-launch-angle: 360deg; }
}

@keyframes cwLaunchWaFabPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 6px 16px rgba(2, 8, 23, 0.35),
      0 0 14px rgba(37, 211, 102, 0.35),
      inset 0 1px 2px rgba(255, 255, 255, 0.35),
      inset 0 -6px 12px rgba(0, 80, 40, 0.22);
  }
  50% {
    transform: scale(1.05);
    box-shadow:
      0 8px 20px rgba(2, 8, 23, 0.38),
      0 0 26px rgba(37, 211, 102, 0.55),
      inset 0 1px 2px rgba(255, 255, 255, 0.4),
      inset 0 -6px 12px rgba(0, 80, 40, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-webchat-launcher.is-open .cw-webchat-launcher__border,
  .cw-webchat-launcher.is-open .cw-webchat-launcher__icon,
  .cw-webchat-launcher .cw-webchat-fab-glow,
  .cw-webchat-launcher .cw-webchat-fab-shadow,
  .cw-webchat-launcher .cw-webchat-fab-rings,
  .cw-webchat-launcher .cw-webchat-fab-ring,
  .cw-webchat-launcher .cw-webchat-fab-orb,
  .cw-webchat-launcher .cw-webchat-fab-blob,
  .cw-webchat-launcher .cw-webchat-fab-shine,
  .cw-webchat-launcher .cw-webchat-orb-shell::before {
    animation: none !important;
  }
}

/* Hablando (TTS): orbe + anillos + burbuja */
.cw-webchat-fab.is-speaking {
  animation: cwWcFabSpeak 0.52s ease-in-out infinite;
}

.cw-webchat-fab.is-speaking::before,
.cw-webchat-fab.is-speaking::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 157, 0.55);
  pointer-events: none;
  animation: cwWcSpeakRing 1.35s ease-out infinite;
}

.cw-webchat-fab.is-speaking::after {
  animation-delay: 0.68s;
}

.cw-webchat-fab.is-speaking .cw-webchat-fab-orb,
.cw-webchat-root.is-speaking .cw-webchat-avatar .cw-webchat-fab-orb {
  animation: cwWcOrbSpeak 0.44s ease-in-out infinite;
  box-shadow:
    0 calc(14px * var(--orb-scale)) calc(32px * var(--orb-scale)) rgba(2, 8, 23, 0.48),
    0 0 calc(22px * var(--orb-scale)) rgba(0, 255, 157, 0.45),
    0 0 0 1px rgba(10, 10, 15, 0.35),
    inset 0 calc(1px * var(--orb-scale)) calc(3px * var(--orb-scale)) rgba(255, 255, 255, 0.55),
    inset 0 calc(-10px * var(--orb-scale)) calc(20px * var(--orb-scale)) rgba(0, 80, 50, 0.38);
}

.cw-webchat-fab.is-speaking .cw-webchat-fab-ring,
.cw-webchat-root.is-speaking .cw-webchat-avatar .cw-webchat-fab-ring {
  animation-duration: 2.4s;
}

.cw-webchat-root.is-speaking .cw-webchat-avatar::after {
  background: #00ff9d;
  animation: cwWcSpeakDot 0.55s ease-in-out infinite;
}

.cw-webchat-root.is-speaking .cw-webchat-head p {
  color: #00ff9d;
}

.cw-webchat-speak-bubble {
  position: absolute;
  right: 0;
  bottom: calc(72px + 0.55rem);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(10, 10, 15, 0.94);
  border: 1px solid rgba(0, 255, 157, 0.38);
  box-shadow: 0 8px 24px rgba(2, 8, 23, 0.38), 0 0 16px rgba(0, 255, 157, 0.18);
  opacity: 0;
  transform: translateY(6px) scale(0.92);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 10051;
}

.cw-webchat-speak-bubble.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.cw-webchat-root.is-open .cw-webchat-speak-bubble {
  bottom: auto;
  top: calc(100% - min(72vh, 640px) - 2.6rem);
}

.cw-webchat-speak-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #00ff9d;
  white-space: nowrap;
}

.cw-webchat-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.cw-webchat-wave i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(to top, #00ff9d, #00f3ff);
  transform-origin: bottom center;
  animation: cwWcWave 0.46s ease-in-out infinite;
}

.cw-webchat-wave i:nth-child(2) { animation-delay: 0.08s; }
.cw-webchat-wave i:nth-child(3) { animation-delay: 0.16s; }
.cw-webchat-wave i:nth-child(4) { animation-delay: 0.24s; }
.cw-webchat-wave i:nth-child(5) { animation-delay: 0.32s; }

@keyframes cwWcFabSpeak {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.05); }
}

@keyframes cwWcSpeakRing {
  0% { transform: scale(1); opacity: 0.75; }
  100% { transform: scale(1.38); opacity: 0; }
}

@keyframes cwWcOrbSpeak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

@keyframes cwWcOrbGlowSpeak {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes cwWcWave {
  0%, 100% { transform: scaleY(0.32); opacity: 0.65; }
  50% { transform: scaleY(1); opacity: 1; }
}

@keyframes cwWcSpeakDot {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.cw-webchat-fab-tag {
  position: absolute;
  right: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  white-space: nowrap;
  padding: 0.4rem 0.72rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-align: left !important;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: #e8fff6;
  background: rgba(10, 10, 15, 0.92);
  border: 1px solid rgba(0, 255, 157, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(2, 8, 23, 0.38);
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  animation: cwWcTagIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

/* Recorte circular (iOS): sin halo externo grueso en el FAB flotante */
.cw-webchat-fab-visual {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: visible;
  isolation: isolate;
  contain: layout style;
  pointer-events: none;
  z-index: 1;
}

/* FAB flotante: sin halo difuso grueso; anillos + orbe como antes */
.cw-webchat-fab .cw-webchat-fab-glow {
  display: none !important;
}

.cw-webchat-fab .cw-webchat-fab-shell::before {
  box-shadow: inset 0 0 calc(6px * var(--orb-scale)) rgba(0, 255, 157, 0.15);
}

.cw-webchat-fab .cw-webchat-fab-shadow {
  opacity: 0.46;
  filter: blur(calc(3px * var(--orb-scale)));
}

.cw-webchat-fab .cw-webchat-fab-orb {
  box-shadow:
    0 calc(12px * var(--orb-scale)) calc(28px * var(--orb-scale)) rgba(2, 8, 23, 0.42),
    0 0 calc(18px * var(--orb-scale)) rgba(0, 255, 157, 0.42),
    0 0 0 1px rgba(10, 10, 15, 0.35),
    inset 0 calc(1px * var(--orb-scale)) calc(3px * var(--orb-scale)) rgba(255, 255, 255, 0.62),
    inset 0 calc(-10px * var(--orb-scale)) calc(20px * var(--orb-scale)) rgba(0, 80, 50, 0.38);
}

.cw-webchat-fab .cw-webchat-fab-ring {
  box-shadow: 0 0 calc(8px * var(--orb-scale)) rgba(0, 255, 157, 0.22);
}

.cw-webchat-fab.is-open .cw-webchat-fab-tag {
  animation: none;
  opacity: 0;
  transform: translateY(-50%) translateX(12px) scale(0.92);
}

.cw-webchat-fab-tag::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  background: rgba(10, 10, 15, 0.92);
  border-right: 1px solid rgba(0, 255, 157, 0.28);
  border-top: 1px solid rgba(0, 255, 157, 0.28);
  transform: rotate(45deg);
  border-radius: 1px;
}

.cw-webchat-fab-shell,
.cw-webchat-orb-shell {
  --orb-scale: 1;
  --cw-orb-a: #0a0a0f;
  --cw-orb-b: #041810;
  --cw-orb-c: #0d1a16;
  position: relative;
  width: calc(72px * var(--orb-scale));
  height: calc(72px * var(--orb-scale));
  display: grid;
  place-items: center;
  perspective: calc(220px * var(--orb-scale));
  transform-style: preserve-3d;
  flex-shrink: 0;
  overflow: visible;
}

.cw-webchat-orb-shell--head {
  --orb-scale: 0.5;
}

/* Dentro del panel: sin levitación (el FAB flotante conserva el efecto) */
.cw-webchat-panel .cw-webchat-orb-shell {
  animation: none;
}

.cw-webchat-panel .cw-webchat-orb-shell .cw-webchat-fab-shadow {
  animation: none;
  opacity: 0.34;
  transform: scale(0.78);
}

.cw-webchat-panel .cw-webchat-orb-shell .cw-webchat-fab-rings {
  animation: none;
}

.cw-webchat-fab-shell::before,
.cw-webchat-orb-shell::before {
  content: '';
  position: absolute;
  inset: calc(-2px * var(--orb-scale));
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 157, 0.5);
  box-shadow:
    0 0 calc(12px * var(--orb-scale)) rgba(0, 255, 157, 0.42),
    inset 0 0 calc(8px * var(--orb-scale)) rgba(0, 255, 157, 0.15);
  pointer-events: none;
  z-index: 4;
  animation: cwWcShellPulse 3s ease-in-out infinite;
}

.cw-webchat-fab-shadow {
  position: absolute;
  bottom: calc(-12px * var(--orb-scale));
  left: 50%;
  width: calc(52px * var(--orb-scale));
  height: calc(12px * var(--orb-scale));
  margin-left: calc(-26px * var(--orb-scale));
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    rgba(0, 255, 157, 0.45) 0%,
    rgba(0, 200, 120, 0.18) 45%,
    transparent 72%
  );
  filter: blur(calc(5px * var(--orb-scale)));
  pointer-events: none;
  z-index: 0;
  animation: cwWcFabShadow 4.2s ease-in-out infinite;
}

.cw-webchat-fab-glow {
  position: absolute;
  inset: calc(-20px * var(--orb-scale));
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 255, 157, 0.82) 0%,
    rgba(0, 255, 157, 0.52) 32%,
    rgba(0, 224, 140, 0.28) 52%,
    rgba(0, 255, 157, 0.1) 68%,
    transparent 78%
  );
  opacity: 0.95;
  filter: blur(calc(16px * var(--orb-scale)));
  transition: opacity 0.35s ease, filter 0.35s ease;
  pointer-events: none;
  animation: cwWcOrbGlow 2.8s ease-in-out infinite;
}

.cw-webchat-fab-rings {
  position: absolute;
  inset: calc(-10px * var(--orb-scale));
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 1;
  animation: cwWcRingsBob 4.2s ease-in-out infinite;
}

.cw-webchat-fab-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: calc(1.5px * var(--orb-scale)) solid transparent;
  box-shadow: 0 0 calc(10px * var(--orb-scale)) rgba(0, 255, 157, 0.22);
}

.cw-webchat-fab-ring--1 {
  border-top-color: rgba(0, 255, 157, 0.85);
  border-right-color: rgba(0, 255, 157, 0.35);
  border-bottom-color: rgba(0, 255, 157, 0.12);
  transform: rotateX(68deg);
  animation: cwWcRingSpin 5.5s linear infinite;
}

.cw-webchat-fab-ring--2 {
  border-top-color: rgba(120, 255, 200, 0.75);
  border-left-color: rgba(0, 255, 157, 0.4);
  transform: rotateX(68deg) rotateZ(72deg);
  animation: cwWcRingSpinRev 7.5s linear infinite;
}

.cw-webchat-fab-ring--3 {
  border-top-color: rgba(0, 255, 157, 0.65);
  border-right-color: rgba(0, 255, 157, 0.2);
  transform: rotateX(68deg) rotateZ(144deg);
  animation: cwWcRingSpin3 10s linear infinite;
}

.cw-webchat-fab-orb {
  position: relative;
  width: calc(60px * var(--orb-scale));
  height: calc(60px * var(--orb-scale));
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  z-index: 3;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.72) 0%, transparent 34%),
    radial-gradient(circle at 70% 70%, rgba(0, 180, 110, 0.55) 0%, transparent 55%),
    linear-gradient(160deg, #4dffbf 0%, #00ff9d 38%, #00e08c 72%, #00c97a 100%);
  box-shadow:
    0 calc(18px * var(--orb-scale)) calc(42px * var(--orb-scale)) rgba(2, 8, 23, 0.5),
    0 0 calc(36px * var(--orb-scale)) rgba(0, 255, 157, 0.72),
    0 0 calc(64px * var(--orb-scale)) rgba(0, 255, 157, 0.32),
    0 0 0 1px rgba(10, 10, 15, 0.35),
    inset 0 calc(1px * var(--orb-scale)) calc(3px * var(--orb-scale)) rgba(255, 255, 255, 0.55),
    inset 0 calc(-10px * var(--orb-scale)) calc(20px * var(--orb-scale)) rgba(0, 80, 50, 0.38);
  animation: cwWcOrbBreath 3.2s ease-in-out infinite;
}

.cw-webchat-fab-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(calc(12px * var(--orb-scale)));
  mix-blend-mode: multiply;
  opacity: 0.72;
}

.cw-webchat-fab-blob--a {
  width: 70%;
  height: 70%;
  top: -10%;
  left: -8%;
  background: var(--cw-orb-a);
  animation: cwWcBlobDriftA 6s ease-in-out infinite;
}

.cw-webchat-fab-blob--b {
  width: 68%;
  height: 68%;
  right: -12%;
  bottom: -10%;
  background: var(--cw-orb-b);
  opacity: 0.65;
  animation: cwWcBlobDriftB 7s ease-in-out infinite;
}

.cw-webchat-fab-blob--c {
  width: 52%;
  height: 52%;
  left: 24%;
  bottom: 10%;
  background: var(--cw-orb-c);
  opacity: 0.7;
  animation: cwWcBlobDriftC 5.4s ease-in-out infinite;
}

.cw-webchat-fab-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.86) 0%, transparent 26%),
    radial-gradient(circle at 72% 78%, rgba(10, 10, 15, 0.14) 0%, transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.26) 0%, transparent 42%);
  pointer-events: none;
  z-index: 2;
  animation: cwWcOrbSpin 14s linear infinite;
}

@keyframes cwWcFabFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  20% {
    transform: translateY(-6px) rotate(-1.2deg);
  }
  50% {
    transform: translateY(-16px) rotate(0deg);
  }
  80% {
    transform: translateY(-6px) rotate(1.2deg);
  }
}

@keyframes cwWcFabShadow {
  0%, 100% {
    transform: scale(1) translateX(0);
    opacity: 0.55;
  }
  50% {
    transform: scale(0.58) translateX(0);
    opacity: 0.22;
  }
}

@keyframes cwWcShellPulse {
  0%, 100% {
    opacity: 0.65;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes cwWcRingsBob {
  0%, 100% { transform: translateY(0) rotateZ(0deg); }
  50% { transform: translateY(-3px) rotateZ(8deg); }
}

@keyframes cwWcRingSpin {
  from { transform: rotateX(68deg) rotateZ(0deg); }
  to { transform: rotateX(68deg) rotateZ(360deg); }
}

@keyframes cwWcRingSpinRev {
  from { transform: rotateX(68deg) rotateZ(72deg); }
  to { transform: rotateX(68deg) rotateZ(-288deg); }
}

@keyframes cwWcRingSpin3 {
  from { transform: rotateX(68deg) rotateZ(144deg); }
  to { transform: rotateX(68deg) rotateZ(504deg); }
}

@keyframes cwWcOrbSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes cwWcTagIn {
  from { opacity: 0; transform: translateY(-50%) translateX(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}

@keyframes cwWcOrbGlow {
  0%, 100% { opacity: 0.78; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.14); }
}

@keyframes cwWcOrbBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes cwWcBlobDriftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12%, 10%) scale(1.08); }
}

@keyframes cwWcBlobDriftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10%, -8%) scale(1.1); }
}

@keyframes cwWcBlobDriftC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-8%, -10%) scale(1.12); }
}

/* ── Panel estilo WhatsApp + apertura premium ── */
.cw-webchat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(400px, calc(100vw - 1.4rem));
  height: min(580px, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  color: #e9edef;
  background: var(--cw-wa-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 168, 132, 0.12),
    0 0 40px rgba(0, 168, 132, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 24px, 0) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.32s;
  will-change: transform, opacity;
}

.cw-webchat-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 168, 132, 0.18),
    0 0 56px rgba(0, 168, 132, 0.14);
}

.cw-webchat-panel.is-closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 16px, 0) scale(0.97);
}

.cw-webchat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: linear-gradient(180deg, #1f2c34 0%, #1a252d 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
  animation: cwWcHeadSlide 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
  overflow: visible;
  z-index: 2;
}

.cw-webchat-head-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  overflow: visible;
}

.cw-webchat-avatar {
  position: relative;
  flex: 0 0 auto;
  width: calc(72px * 0.5);
  height: calc(72px * 0.5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.cw-webchat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.cw-webchat-avatar::after {
  content: '';
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid #1f2c34;
  animation: cwWcOnlinePulse 2.2s ease-in-out infinite;
  z-index: 5;
}

.cw-webchat-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-webchat-head p {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: #25d366;
  opacity: 1;
}

.cw-webchat-head-actions {
  display: flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.cw-webchat-iconbtn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.cw-webchat-iconbtn i {
  pointer-events: none;
  line-height: 1;
}

.cw-webchat-iconbtn.is-on {
  color: #25d366;
}

.cw-webchat-iconbtn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: scale(1.08);
}

.cw-webchat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.15rem 0.2rem 0.55rem;
  align-self: stretch;
  animation: cwWcBubbleIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cw-webchat-action-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1f2c34;
  color: #e9edef;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.55rem 0.85rem;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.cw-webchat-action-btn:hover {
  background: #2a3942;
  border-color: rgba(0, 168, 132, 0.45);
  transform: translateY(-1px);
}

.cw-webchat-action-btn:active {
  transform: scale(0.97);
}

.cw-webchat-action-btn.is-wa {
  background: #075e54;
  border-color: rgba(37, 211, 102, 0.45);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.cw-webchat-action-btn.is-wa:hover {
  background: #128c7e;
  border-color: #25d366;
}

.cw-webchat-action-btn.is-wa.is-primary {
  width: 100%;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #25d366 0%, #128c7e 100%);
  border-color: #25d366;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.28);
}

.cw-webchat-action-btn.is-wa.is-primary:hover {
  background: linear-gradient(180deg, #2fe472 0%, #0f9f8a 100%);
  transform: translateY(-1px);
}

.cw-webchat-action-btn.is-wa i {
  font-size: 1.15em;
  line-height: 1;
}

@media (max-width: 520px) {
  .cw-webchat-actions {
    gap: 0.4rem;
    padding-bottom: 0.65rem;
  }

  .cw-webchat-action-btn {
    font-size: 0.8rem;
    padding: 0.58rem 0.8rem;
    min-height: 42px;
  }
}


/* Fondo chat: binario suave, alineado en filas */
.cw-webchat-log {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: visible;
  overflow-y: auto;
  padding: 0.85rem 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: #e9edef;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  background-color: #0b141a;
  background-image:
    linear-gradient(180deg, rgba(11, 20, 26, 0.58) 0%, rgba(11, 20, 26, 0.42) 50%, rgba(11, 20, 26, 0.6) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='192' viewBox='0 0 240 192'%3E%3Cg fill='%2300a884' fill-opacity='0.14' font-family='Consolas,Courier New,monospace' font-size='18' font-weight='600'%3E%3Ctext x='8' y='24'%3E0 1 0 1 1 0 1 0 1 0%3C/text%3E%3Ctext x='8' y='48'%3E1 0 1 0 0 1 0 1 0 1%3C/text%3E%3Ctext x='8' y='72'%3E0 0 1 1 0 1 1 0 1 0%3C/text%3E%3Ctext x='8' y='96'%3E1 1 0 0 1 0 1 1 0 0%3C/text%3E%3Ctext x='8' y='120'%3E0 1 1 0 1 0 0 1 1 0%3C/text%3E%3Ctext x='8' y='144'%3E1 0 0 1 1 1 0 0 1 1%3C/text%3E%3Ctext x='8' y='168'%3E0 1 0 1 0 1 1 0 0 1%3C/text%3E%3Ctext x='8' y='192'%3E1 0 1 0 1 0 0 1 0 1%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 220px 176px;
  background-attachment: local;
  animation: cwWcLogFade 0.55s ease 0.12s both;
}

.cw-webchat-msg {
  position: relative;
  z-index: 1;
  max-width: 84%;
  padding: 0.5rem 0.65rem 0.4rem;
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.18);
  border: 0;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  animation: cwWcBubbleIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cw-webchat-msg.is-instant {
  opacity: 1;
  transform: none;
  animation: none;
}

.cw-webchat-msg > small {
  display: block;
  font-size: 0.62rem;
  opacity: 0.55;
  margin-bottom: 0.2rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.2;
}

.cw-webchat-msg-body {
  display: block;
  white-space: pre-wrap;
}

.cw-webchat-msg.is-typing .cw-webchat-msg-body::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: rgba(233, 237, 239, 0.85);
  border-radius: 1px;
  animation: cwWcCaret 0.75s steps(1) infinite;
}

@keyframes cwWcCaret {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cw-webchat-msg.is-typing .cw-webchat-msg-body::after {
    animation: none;
    opacity: 0.7;
  }
}


.cw-webchat-msg.is-bot {
  align-self: flex-start;
  background: var(--cw-wa-in);
  color: #e9edef;
  border-top-left-radius: 0;
}

.cw-webchat-msg.is-bot::before {
  content: '';
  position: absolute;
  top: 0;
  left: -6px;
  border-top: 6px solid var(--cw-wa-in);
  border-left: 6px solid transparent;
}

.cw-webchat-msg.is-user {
  align-self: flex-end;
  background: var(--cw-wa-out);
  color: #e9edef;
  border-top-right-radius: 0;
}

.cw-webchat-msg.is-user::before {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  border-top: 6px solid var(--cw-wa-out);
  border-right: 6px solid transparent;
}

.cw-webchat-msg.is-system {
  align-self: center;
  max-width: 92%;
  background: rgba(17, 27, 33, 0.9);
  color: rgba(233, 237, 239, 0.88);
  font-size: 0.74rem;
  border-radius: 8px;
  box-shadow: none;
  opacity: 1;
  transform: none;
}

.cw-webchat-msg.is-system::before {
  display: none;
}

.cw-webchat-progress {
  position: relative;
  z-index: 2;
  padding: 0.4rem 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: rgba(233, 237, 239, 0.7);
  background: #111b21;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex: 0 0 auto;
}

.cw-webchat-compose {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.7rem 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--cw-wa-compose);
  flex: 0 0 auto;
  animation: cwWcComposeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both;
}

.cw-webchat-compose input {
  border-radius: 22px;
  border: 0;
  background: var(--cw-wa-input);
  color: #e9edef;
  padding: 0.65rem 0.95rem;
  font: inherit;
  min-width: 0;
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

.cw-webchat-compose input::placeholder {
  color: rgba(233, 237, 239, 0.45);
}

.cw-webchat-compose input:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.5);
  background: #314650;
}

.cw-webchat-mic {
  border: 0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  color: #d1d7db;
  background: #2a3942;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1.05rem;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  flex: 0 0 auto;
}

.cw-webchat-mic i {
  pointer-events: none;
  line-height: 1;
}

.cw-webchat-mic:hover {
  background: #314650;
  color: #fff;
  transform: scale(1.06);
}

.cw-webchat-mic.is-listening {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
  animation: cwWcMicPulse 1.2s ease-out infinite;
  font-size: 0.85rem;
}

.cw-webchat-mic.is-listening:hover {
  background: #b91c1c;
}

.cw-webchat-mic.is-unavailable {
  opacity: 0.5;
}

.cw-webchat-mic[hidden] {
  display: none !important;
}

@keyframes cwWcMicPulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.cw-webchat-send {
  border: 0;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  padding: 0;
  cursor: pointer;
  color: #fff;
  background: var(--cw-wa-accent);
  box-shadow: 0 6px 16px rgba(0, 168, 132, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, background 0.2s ease;
}

.cw-webchat-send i {
  pointer-events: none;
  line-height: 1;
  transform: translateX(1px);
}

.cw-webchat-send:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 8px 22px rgba(0, 168, 132, 0.45);
  background: #00b894;
}

.cw-webchat-send:active:not(:disabled) {
  transform: scale(0.94);
}

.cw-webchat-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.cw-webchat-captcha {
  padding: 0.55rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: #111b21;
  flex: 0 0 auto;
}

.cw-webchat-captcha[hidden] {
  display: none !important;
}

/* Bloqueo de scroll de fondo (móvil) sin position:fixed en body */
html.cw-webchat-noscroll,
body.cw-webchat-noscroll {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

body.cw-webchat-noscroll .cw-webchat-panel,
body.cw-webchat-noscroll .cw-webchat-log,
body.cw-webchat-noscroll .cw-webchat-compose {
  touch-action: manipulation;
}

body.cw-webchat-noscroll .cw-webchat-log {
  touch-action: pan-y;
}

@keyframes cwWcHeadSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}

@keyframes cwWcComposeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes cwWcLogFade {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@keyframes cwWcBubbleIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cwWcOnlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(37, 211, 102, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .cw-webchat-fab,
  .cw-webchat-fab-tag,
  .cw-webchat-fab-glow,
  .cw-webchat-fab-shadow,
  .cw-webchat-fab-rings,
  .cw-webchat-fab-ring,
  .cw-webchat-fab-orb,
  .cw-webchat-fab-blob,
  .cw-webchat-fab-shine,
  .cw-webchat-fab-shell::before,
  .cw-webchat-orb-shell,
  .cw-webchat-orb-shell::before,
  .cw-webchat-orb-shell .cw-webchat-fab-glow,
  .cw-webchat-orb-shell .cw-webchat-fab-shadow,
  .cw-webchat-orb-shell .cw-webchat-fab-rings,
  .cw-webchat-orb-shell .cw-webchat-fab-ring,
  .cw-webchat-orb-shell .cw-webchat-fab-orb,
  .cw-webchat-orb-shell .cw-webchat-fab-blob,
  .cw-webchat-orb-shell .cw-webchat-fab-shine,
  .cw-webchat-panel,
  .cw-webchat-msg,
  .cw-webchat-head,
  .cw-webchat-compose,
  .cw-webchat-log {
    animation: none !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
  }
  .cw-webchat-msg {
    opacity: 1;
    transform: none;
  }
  .cw-webchat-fab-tag {
    opacity: 1;
    transform: translateY(-50%);
  }
}

@media (max-width: 520px) {
  .cw-webchat-root {
    --cw-vv-height: 100dvh;
    --cw-vv-top: 0px;
    --cw-kb-offset: 0px;
    right: 1.15rem;
    bottom: calc(1.3rem + env(safe-area-inset-bottom, 0px));
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    z-index: 10060;
  }

  .cw-webchat-launcher {
    width: min(300px, calc(100vw - 1.5rem));
    bottom: calc(100% + 0.7rem);
  }

  .cw-webchat-launcher__card {
    padding: 0.8rem;
    border-radius: 18px;
  }

  .cw-webchat-fab {
    position: relative;
    right: auto;
    bottom: auto;
    width: 72px;
    height: 72px;
    z-index: 2;
    background: transparent;
  }

  .cw-webchat-fab-visual {
    width: 92px;
    height: 92px;
  }

  .cw-webchat-fab-shell {
    --orb-scale: 1;
  }

  .cw-webchat-orb-shell--head {
    --orb-scale: 0.472222;
  }

  .cw-webchat-avatar {
    width: calc(72px * 0.472222);
    height: calc(72px * 0.472222);
  }

  .cw-webchat-launcher__icon--orb,
  .cw-webchat-launcher__opt--wa .cw-webchat-launcher__icon {
    width: calc(72px * 0.472222);
    height: calc(72px * 0.472222);
  }

  .cw-webchat-launcher__opt {
    grid-template-columns: calc(72px * 0.472222) 1fr 18px;
  }

  .cw-webchat-fab-tag {
    font-size: 0.7rem;
    font-weight: 650;
    padding: 0.34rem 0.58rem;
    right: calc(100% + 0.45rem);
    left: auto;
    max-width: none;
    white-space: nowrap;
    line-height: 1.2;
    text-align: left !important;
    justify-content: flex-start;
    display: inline-flex;
  }

  .cw-webchat-fab-tag::after {
    right: -4px;
    left: auto;
  }

  /*
   * Panel móvil estilo WhatsApp:
   * - Cabecera fija arriba
   * - Mensajes scrollables en el centro
   * - Barra de escribir pegada abajo del viewport visual
   *   (sube con el teclado; la cabecera no se mueve)
   */
  .cw-webchat-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--cw-vv-top, 0px);
    bottom: auto;
    width: 100%;
    width: 100dvw;
    height: var(--cw-vv-height, 100dvh);
    max-height: var(--cw-vv-height, 100dvh);
    border-radius: 0;
    border: 0;
    transform-origin: center center;
    box-shadow: none;
    padding-bottom: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10070;
  }

  .cw-webchat-panel.is-open {
    transform: translate3d(0, 0, 0) scale(1);
    height: var(--cw-vv-height, 100dvh);
    max-height: var(--cw-vv-height, 100dvh);
  }

  .cw-webchat-panel.is-closing {
    transform: translate3d(0, 8%, 0) scale(1);
  }

  .cw-webchat-head {
    flex: 0 0 auto;
    position: relative;
    z-index: 6;
    padding: 0.65rem 0.75rem;
    padding-top: calc(0.55rem + env(safe-area-inset-top, 0px));
  }

  .cw-webchat-progress {
    flex: 0 0 auto;
  }

  .cw-webchat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.7rem 0.65rem 0.85rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .cw-webchat-msg {
    max-width: 88%;
    font-size: 0.92rem;
    padding: 0.55rem 0.7rem 0.45rem;
  }

  .cw-webchat-captcha {
    flex: 0 0 auto;
  }

  .cw-webchat-compose {
    flex: 0 0 auto;
    position: relative;
    z-index: 6;
    gap: 0.4rem;
    padding: 0.5rem 0.55rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: var(--cw-wa-compose);
  }

  .cw-webchat-compose input {
    font-size: 16px; /* evita zoom automático en iOS */
    min-height: 44px;
    padding: 0.7rem 0.9rem;
    border-radius: 24px;
  }

  .cw-webchat-mic,
  .cw-webchat-send {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .cw-webchat-iconbtn {
    width: 42px;
    height: 42px;
  }

  /* Con teclado abierto: cabecera sigue visible; compose sin safe-area extra */
  .cw-webchat-root.is-keyboard-open .cw-webchat-head {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .cw-webchat-root.is-keyboard-open .cw-webchat-compose {
    padding-bottom: 0.5rem;
  }
}

/*
 * iOS Safari: capa estable sin recorte agresivo (ya no hay halo blur externo).
 */
@supports (-webkit-touch-callout: none) {
  .cw-webchat-fab {
    background: transparent !important;
  }

  .cw-webchat-fab-visual {
    -webkit-transform: translate(-50%, -50%) translateZ(0);
    transform: translate(-50%, -50%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .cw-webchat-fab-tag {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(10, 10, 15, 0.96);
  }
}

/* Calendario agendar llamada */
.cw-webchat-schedule {
  margin: 0.65rem 0 0.85rem;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-width: 100%;
}

.cw-webchat-schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.cw-webchat-schedule-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f3f4f6;
  flex: 1;
  text-align: center;
}

.cw-webchat-schedule-nav {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cw-webchat-schedule-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cw-webchat-schedule-nav:not(:disabled):hover {
  background: rgba(99, 102, 241, 0.35);
}

.cw-webchat-schedule-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.cw-webchat-schedule-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cw-webchat-schedule-day {
  aspect-ratio: 1;
  min-height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f9fafb;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

.cw-webchat-schedule-day.is-empty {
  background: transparent;
  pointer-events: none;
}

.cw-webchat-schedule-day.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.cw-webchat-schedule-day:not(.is-disabled):not(.is-empty):hover {
  background: rgba(99, 102, 241, 0.28);
}

.cw-webchat-schedule-day.is-selected {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
}

.cw-webchat-schedule-times {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cw-webchat-schedule-times-label {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.cw-webchat-schedule-times-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.cw-webchat-schedule-time {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #f3f4f6;
  font-size: 0.74rem;
  padding: 0.45rem 0.25rem;
  cursor: pointer;
}

.cw-webchat-schedule-time:hover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.2);
}

.cw-webchat-schedule-time.is-selected {
  border-color: transparent;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
}

.cw-webchat-schedule-empty {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.cw-webchat-schedule-foot {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cw-webchat-schedule-summary {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.35;
}

.cw-webchat-schedule-confirm {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
}

.cw-webchat-schedule-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cw-webchat-schedule-confirm:not(:disabled):hover {
  filter: brightness(1.08);
}

@media (max-width: 520px) {
  .cw-webchat-schedule-times-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
