/* =====================================================
   ASISTENTE VIRTUAL (n8n)
   ===================================================== */
.chat-toggle{
  position:fixed;right:22px;bottom:22px;z-index:960;
  width:62px;height:62px;border-radius:50%;border:0;cursor:pointer;
  background:var(--rojo);color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 12px 34px -10px rgba(255,0,0,.75);
  transition:transform .4s var(--ease),background .3s,box-shadow .3s;
}
.chat-toggle:hover{transform:scale(1.08)}
.chat-toggle.open{background:var(--negro);box-shadow:0 12px 34px -12px rgba(0,0,0,.8)}
.chat-toggle svg{width:26px;height:26px;stroke:#fff;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.chat-toggle .ico-x{display:none}
.chat-toggle.open .ico-chat{display:none}
.chat-toggle.open .ico-x{display:block}

.chat-window{
  position:fixed;right:22px;bottom:96px;z-index:961;
  width:min(380px,calc(100vw - 32px));
  height:min(560px,calc(100vh - 140px));
  background:var(--negro);border:1px solid var(--linea);border-radius:18px;
  display:none;flex-direction:column;overflow:hidden;
  box-shadow:0 30px 70px -20px rgba(0,0,0,.85);
}
.chat-window.open{display:flex}
.chat-head{
  display:flex;align-items:center;gap:12px;padding:16px 18px;
  background:var(--negro-2);border-bottom:1px solid var(--linea);
}
.chat-avatar{
  width:40px;height:40px;border-radius:50%;background:var(--rojo);color:#fff;
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;
  font-family:var(--serif);font-weight:900;font-size:16px;
}
.chat-head b{display:block;font-size:14px;font-weight:700}
.chat-head span{display:flex;align-items:center;gap:6px;font-size:11px;color:rgba(255,255,255,.55)}
.chat-head .on{width:7px;height:7px;border-radius:50%;background:#00D26A;box-shadow:0 0 8px #00D26A}
.chat-body{
  flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:10px;
  scrollbar-width:thin;
}
.chat-body::-webkit-scrollbar{width:6px}
.chat-body::-webkit-scrollbar-thumb{background:rgba(255,255,255,.18);border-radius:8px}
.msg{
  max-width:84%;padding:11px 14px;border-radius:14px;font-size:13.5px;line-height:1.5;
  white-space:pre-wrap;word-break:break-word;
}
.msg.bot{
  align-self:flex-start;background:var(--negro-2);border:1px solid var(--linea);
  color:rgba(255,255,255,.9);border-bottom-left-radius:4px;
}
.msg.user{
  align-self:flex-end;background:var(--rojo);color:#fff;border-bottom-right-radius:4px;
}
.msg.typing{color:rgba(255,255,255,.5);font-style:italic}
.chat-foot{
  display:flex;align-items:flex-end;gap:8px;padding:12px;border-top:1px solid var(--linea);
  background:var(--negro-2);
}
.chat-foot textarea{
  flex:1;resize:none;background:var(--negro);border:1px solid var(--linea);color:#fff;
  border-radius:12px;padding:11px 13px;font-size:13.5px;font-family:var(--sans);
  max-height:96px;outline:none;transition:border-color .3s;
}
.chat-foot textarea:focus{border-color:var(--rojo)}
.chat-foot button{
  width:42px;height:42px;border-radius:12px;border:0;cursor:pointer;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;transition:.3s;
}
.chat-foot button svg{width:19px;height:19px;stroke:#fff;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.btn-send{background:var(--rojo)}
.btn-send:hover{filter:brightness(1.15)}
.btn-mic{background:rgba(255,255,255,.12)}
.btn-mic:hover{background:rgba(255,255,255,.22)}
.btn-mic.recording{background:var(--rojo);animation:pulseMic 1.1s infinite}
@keyframes pulseMic{
  0%,100%{box-shadow:0 0 0 0 rgba(255,0,0,.65)}
  70%{box-shadow:0 0 0 12px rgba(255,0,0,0)}
}
.chat-pie{font-size:10.5px;color:rgba(255,255,255,.28);text-align:center;padding:0 12px 10px;background:var(--negro-2)}
@media(max-width:520px){
  .chat-window{right:12px;left:12px;bottom:90px;width:auto;height:min(70vh,520px)}
  .chat-toggle{right:14px;bottom:14px;width:56px;height:56px}
}
