/* Asistente de chat (demo con respuestas guiadas) */
.chat-fab { --mx: 0px; --my: 0px; position: fixed; right: 20px; bottom: 78px; z-index: 70; width: 64px; height: 64px; border: 0; border-radius: 50%; background: var(--navy-800); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 18px 40px -12px rgba(0,34,79,.55); transform: translate(var(--mx), var(--my)); transition: transform .25s var(--ease), background .25s; animation: bob 3.6s ease-in-out infinite; }
.chat-fab::before, .chat-fab::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--blue); opacity: 0; animation: ring 2.8s ease-out infinite; }
.chat-fab::after { animation-delay: 1.4s; }
.chat-fab:hover { background: var(--navy-700); }
.chat-fab svg { transition: transform .35s var(--ease); }
.chat-fab[aria-expanded="true"] { animation: none; }
.chat-fab[aria-expanded="true"]::before, .chat-fab[aria-expanded="true"]::after { display: none; }
.chat-fab[aria-expanded="true"] svg { transform: rotate(90deg) scale(.9); }
.chat-fab .badge-dot { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; animation: pulse 1.8s infinite; }
@keyframes bob { 50% { translate: 0 -6px; } }
@keyframes ring { 0% { transform: scale(1); opacity: .65; } 100% { transform: scale(1.7); opacity: 0; } }
.chat-hint { position: fixed; right: 94px; bottom: 92px; z-index: 70; background: #fff; color: var(--ink); padding: 12px 16px; border-radius: 16px 16px 4px 16px; box-shadow: 0 16px 40px -14px rgba(0,34,79,.4); font-size: .92rem; font-weight: 500; max-width: 220px; animation: hintIn .5s var(--ease) both; cursor: pointer; border: 1px solid var(--line); }
@keyframes hintIn { from { opacity: 0; transform: translateX(14px) scale(.9); } }

.chat { padding: 0; position: fixed; right: 20px; bottom: 154px; z-index: 75; width: min(390px, calc(100vw - 24px)); height: min(580px, calc(100svh - 190px)); background: #fff; border-radius: 22px; box-shadow: 0 40px 90px -20px rgba(0,34,79,.5); border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right; animation: chatIn .45s var(--ease) both; }
.chat[hidden] { display: none; }
@keyframes chatIn { from { opacity: 0; transform: scale(.82) translateY(20px); } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); color: #fff; }
.chat-av { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #00182e; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; position: relative; flex: none; }
.chat-av::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; background: #3ddc97; border: 2px solid var(--navy-800); border-radius: 50%; }
.chat-head b { display: block; font-family: var(--font-display); font-size: 1rem; }
.chat-head small { color: #b7c9e3; font-size: .78rem; }
.chat-close { margin-left: auto; background: rgba(255,255,255,.12); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.chat-close:hover { background: rgba(255,255,255,.22); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #f4f9ff, #fff); scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: .94rem; line-height: 1.45; animation: msgIn .4s var(--ease) both; overflow-wrap: anywhere; }
.msg.bot { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; color: var(--text); box-shadow: 0 6px 16px -10px rgba(0,34,79,.25); }
.msg.me { background: var(--navy-800); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.msg a { color: var(--blue-600); font-weight: 600; }
.msg.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.msg .ref { font-family: var(--font-display); font-weight: 700; }
.msg small { display: block; margin-top: 6px; color: var(--warn); }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.94); } }
.typing { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 18px; border-bottom-left-radius: 5px; padding: 14px 16px; display: flex; gap: 5px; animation: msgIn .3s var(--ease) both; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.quick button { border: 1.5px solid var(--blue); background: #fff; color: var(--navy-800); border-radius: 99px; padding: 8px 15px; font-weight: 600; font-size: .86rem; cursor: pointer; min-height: 38px; animation: msgIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); transition: background .2s, color .2s, transform .2s; }
.quick button:hover { background: var(--blue); color: #00182e; transform: translateY(-2px); }
.chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; }
.chat-form input { flex: 1; border: 1.5px solid var(--line); border-radius: 99px; padding: 11px 16px; min-height: 46px; min-width: 0; }
.chat-form input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); }
.chat-form button { border: 0; background: var(--blue); color: #00182e; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: transform .2s var(--ease); }
.chat-form button:hover { transform: scale(1.08) rotate(-8deg); }
.chat-note { font-size: .72rem; text-align: center; color: var(--muted); padding: 0 12px 10px; background: #fff; }

@media (max-width: 560px) {
  .chat { right: 8px; left: 8px; width: auto; bottom: 150px; height: min(560px, calc(100svh - 170px)); }
  .chat-fab { right: 14px; bottom: 70px; width: 58px; height: 58px; }
  .chat-hint { right: 82px; bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-fab, .chat-fab::before, .chat-fab::after, .chat-fab .badge-dot { animation: none !important; }
}
