.wa {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: var(--ebano); color: var(--alabastro);
  box-shadow: 0 16px 40px -14px rgba(28,27,26,.6);
  opacity: 0; transform: scale(.9); pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.wa.is-visible, .wa[aria-expanded="true"] { opacity: 1; transform: scale(1); pointer-events: auto; }
.wa:active { transform: scale(.97); }
.wa:focus-visible { outline: 2px solid var(--ebano); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) { .wa:hover { transform: scale(1.08); } }
.wa svg { width: 26px; height: 26px; fill: currentColor; }
.wa::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--ebano); animation: ping 2.8s var(--ease) infinite; }
.wa[aria-expanded="true"]::before { animation: none; opacity: 0; }

.chat {
  position: fixed; right: 22px; bottom: 92px; z-index: 150;
  width: min(350px, calc(100vw - 32px)); height: min(500px, calc(100dvh - 180px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--alabastro); color: var(--ebano);
  box-shadow: 0 30px 80px -24px rgba(28,27,26,.45), 0 0 0 1px var(--linea);
  transform-origin: bottom right;
  opacity: 0; transform: translateY(8px) scale(.96);
  transition: opacity 200ms cubic-bezier(.23, 1, .32, 1), transform 200ms cubic-bezier(.23, 1, .32, 1);
}
.chat.is-open { opacity: 1; transform: none; }
.chat[hidden] { display: none; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; background: var(--ebano); color: var(--alabastro); }
.chat__avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--alabastro); box-shadow: 0 0 0 1px var(--linea-clara); }
.chat__head div { flex: 1; min-width: 0; }
.chat__head strong { display: block; font-weight: 600; font-size: 15px; }
.chat__head small { display: block; font-size: 12.5px; color: var(--topo); }
.chat__close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--alabastro); transition: background-color 150ms ease; }
.chat__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.chat__close:focus-visible { outline: 2px solid var(--alabastro); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .chat__close:hover { background: rgba(255,255,255,.12); } }

.chat__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 16px; background: var(--lino-claro); scrollbar-width: thin; scrollbar-color: var(--topo) transparent; }
.chat__msg { max-width: 85%; padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--blanco); font-size: 14px; line-height: 1.4; box-shadow: 0 1px 0 var(--linea); animation: chat-in 220ms cubic-bezier(.23, 1, .32, 1) both; }
.chat__msg--me { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--ebano); color: var(--alabastro); }
.chat__options { display: flex; flex-wrap: wrap; gap: 8px; animation: chat-in 220ms cubic-bezier(.23, 1, .32, 1) 80ms both; }
.chat__opt { padding: 8px 14px; border-radius: 100px; border: 1px solid var(--ebano); background: transparent; color: var(--ebano); font-size: 14px; font-weight: 500; transition: background-color 150ms ease, color 150ms ease, transform 120ms ease; }
.chat__opt:active { transform: scale(.97); }
.chat__opt:focus-visible, .chat__go:focus-visible { outline: 2px solid var(--ebano); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .chat__opt:hover { background: var(--ebano); color: var(--alabastro); } }
.chat__go { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 11px 18px; border-radius: 100px; background: var(--ebano); color: var(--alabastro); font-size: 14px; font-weight: 600; animation: chat-in 220ms cubic-bezier(.23, 1, .32, 1) 80ms both; transition: transform 120ms ease; }
.chat__go:active { transform: scale(.97); }
.chat__go svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.chat__restart { align-self: flex-start; font-size: 13px; color: var(--topo-oscuro); text-decoration: underline; text-underline-offset: 3px; }
.chat__options--list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.chat__options--list .chat__opt { padding: 8px 11px; font-size: 13.5px; line-height: 1.3; text-align: left; border-radius: 14px; border-color: var(--linea); background: var(--blanco); font-weight: 400; }
@media (hover: hover) and (pointer: fine) { .chat__options--list .chat__opt:hover { border-color: var(--ebano); background: var(--blanco); color: var(--ebano); } }
.chat__typing { display: inline-flex; gap: 4px; align-self: flex-start; padding: 14px 16px; }
.chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--topo); animation: chat-dot 1s ease-in-out infinite; }
.chat__typing i:nth-child(2) { animation-delay: .15s; }
.chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.chat__legal { font-size: 12.5px; color: var(--topo-oscuro); }
.chat__legal a { text-decoration: underline; text-underline-offset: 2px; }
.chat__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--linea); background: var(--alabastro); }
.chat__form[hidden] { display: none; }
.chat__form input { flex: 1; min-width: 0; height: 42px; padding: 0 16px; border-radius: 100px; border: 1px solid var(--linea); background: var(--blanco); font: inherit; font-size: 16px; color: var(--ebano); outline: none; transition: border-color 150ms ease; }
.chat__form input:focus { border-color: var(--ebano); }
.chat__form input[aria-invalid="true"] { border-color: var(--error); }
.chat__form button { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--ebano); color: var(--alabastro); transition: transform 120ms ease; }
.chat__form button:active { transform: scale(.95); }
.chat__form button:focus-visible { outline: 2px solid var(--ebano); outline-offset: 2px; }
.chat__form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  .wa { right: 16px; bottom: 16px; }
  .chat { left: 8px; right: 8px; bottom: 80px; width: auto; height: min(520px, calc(100dvh - 96px)); }
}
@media (prefers-reduced-motion: reduce) {
  .wa::before { animation: none; }
  .chat { transition: opacity 150ms ease; transform: none; }
  .chat__msg, .chat__options, .chat__go, .chat__typing i { animation: none; }
}
