/* Asistentes IA como burbujas flotantes (Mía y Tulipán).
   Se cargan después del resto de estilos y solo afectan a los elementos movidos a <body>. */
html body > .personaje-ia-launcher.ia-bubble {
  position: fixed !important; right: 18px !important; left: auto; top: auto !important;
  bottom: calc(18px + (var(--ia-slot, 0) * 74px)) !important;
  z-index: 1400 !important; display: flex !important; align-items: center !important; justify-content: center !important;
  width: 62px !important; min-width: 62px !important; height: 62px !important; min-height: 62px !important;
  margin: 0 !important; padding: 4px !important; overflow: visible !important; cursor: pointer;
  border: 2px solid transparent !important; border-radius: 50% !important;
  background: linear-gradient(#1b1626, #1b1626) padding-box, linear-gradient(135deg, #ff5b98, #7b72ff) border-box !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 4px rgba(255,91,152,.10) !important;
  transition: transform .2s ease, box-shadow .2s ease;
}
html body > .personaje-ia-launcher.ia-bubble img {
  width: 50px !important; height: 50px !important; flex: 0 0 50px !important;
  border-radius: 50% !important; object-fit: cover; margin: 0 !important;
}
html body > .personaje-ia-launcher.ia-bubble > .ia-bubble-text,
html body > .personaje-ia-launcher.ia-bubble > i { display: none !important; }
html body > .personaje-ia-launcher.ia-bubble:hover,
html body > .personaje-ia-launcher.ia-bubble:focus-visible { transform: translateY(-2px) scale(1.06); }
html body > .personaje-ia-launcher.ia-bubble:focus-visible { outline: 3px solid #54e7ff; outline-offset: 3px; }
html body > .personaje-ia-launcher.ia-bubble.ia-bubble-active { box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 4px rgba(123,114,255,.35) !important; }
/* punto verde "en línea" */
html body > .personaje-ia-launcher.ia-bubble::before {
  content: ""; position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%;
  background: #2ee59d; border: 2px solid #151827; z-index: 2;
}
/* etiqueta al pasar el mouse */
html body > .personaje-ia-launcher.ia-bubble::after {
  content: attr(data-label); position: absolute; right: calc(100% + 12px); top: 50%;
  transform: translate(6px, -50%); opacity: 0; pointer-events: none; white-space: nowrap;
  padding: 7px 12px; border-radius: 12px; border: 1px solid rgba(255,91,152,.5);
  background: #151827; color: #fff; font: 600 12px "DM Sans", system-ui, sans-serif;
  transition: opacity .18s ease, transform .18s ease;
}
html body > .personaje-ia-launcher.ia-bubble:hover::after,
html body > .personaje-ia-launcher.ia-bubble:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
html body > .personaje-ia-launcher.ia-bubble.ia-bubble-active::after { opacity: 0; }
@keyframes iaPulse { 0% { box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 0 rgba(255,91,152,.6); } 100% { box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 18px rgba(255,91,152,0); } }
html body > .personaje-ia-launcher.ia-bubble.ia-bubble-attn { animation: iaPulse 2.2s ease-out 4; }

/* Ventana del chat */
html body > .personaje-ia-chat.ia-panel { position: fixed !important; z-index: 1399 !important; }
html body > .personaje-ia-chat.ia-panel.personaje-ia-chat-open {
  display: flex !important; flex-direction: column;
  right: 18px; left: auto; top: auto;
  bottom: calc(92px + (var(--ia-slot, 0) * 74px));
  width: min(370px, calc(100vw - 28px)) !important; max-height: min(540px, calc(100vh - 120px));
  margin: 0 !important; padding: 0 !important; overflow: hidden !important; border-radius: 20px !important;
  background: linear-gradient(160deg, rgba(31,20,42,.99), rgba(11,13,24,.99)) !important;
  border: 1px solid rgba(255,91,152,.4) !important; box-shadow: 0 24px 60px rgba(0,0,0,.55) !important;
  animation: iaChatOpen .18s ease-out;
}
html body > .personaje-ia-chat.ia-panel:not(.personaje-ia-chat-open) { display: none !important; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(255,91,152,.22), rgba(123,114,255,.18));
  border-bottom: 1px solid rgba(255,255,255,.08); user-select: none; -webkit-user-select: none;
}
html body > .personaje-ia-chat.ia-panel .personaje-ia-chat-head > span { flex: 1 1 auto; font-weight: 700; font-size: 14px; min-width: 0; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-chat-head small { font-size: 11px; opacity: .75; max-width: 46%; text-align: right; }
html body > .personaje-ia-chat.ia-panel .ia-head-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 34px; border: 2px solid rgba(255,91,152,.6); }
html body > .personaje-ia-chat.ia-panel .ia-close {
  flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font-size: 20px; line-height: 1;
}
html body > .personaje-ia-chat.ia-panel .ia-close:hover { background: rgba(255,255,255,.24); }
html body > .personaje-ia-chat.ia-panel .assistant-quick-actions { flex: 0 0 auto; padding: 8px 12px 0; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-messages { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 10px 12px; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-form { flex: 0 0 auto; padding: 10px 12px 12px; }


/* Controles del chat (atajos, campo de texto y botón) */
html body > .personaje-ia-chat.ia-panel .assistant-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; }
html body > .personaje-ia-chat.ia-panel .assistant-quick-actions button {
  border: 1px solid rgba(255,91,152,.55); background: rgba(255,91,152,.08); color: #fff; cursor: pointer;
  padding: 6px 12px; border-radius: 99px; font: 600 12px "DM Sans", system-ui, sans-serif;
}
html body > .personaje-ia-chat.ia-panel .assistant-quick-actions button:hover { background: rgba(255,91,152,.22); }
html body > .personaje-ia-chat.ia-panel .personaje-ia-form { display: flex; align-items: center; gap: 8px; border-top: 1px solid rgba(255,255,255,.08); }
html body > .personaje-ia-chat.ia-panel .personaje-ia-form input {
  flex: 1 1 auto; min-width: 0; padding: 10px 12px; border-radius: 12px; color: #fff;
  border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); font: 14px "DM Sans", system-ui, sans-serif;
}
html body > .personaje-ia-chat.ia-panel .personaje-ia-form input:focus { outline: 2px solid #54e7ff; outline-offset: 1px; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-form button {
  flex: 0 0 auto; border: 0; cursor: pointer; padding: 10px 14px; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, #ff5b98, #f51f48); font: 700 13px "DM Sans", system-ui, sans-serif;
}
html body > .personaje-ia-chat.ia-panel .personaje-ia-form button:disabled { opacity: .6; cursor: wait; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message { display: flex; gap: 8px; margin: 0 0 8px; align-items: flex-start; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message-user { flex-direction: row-reverse; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 11px; border-radius: 14px; background: rgba(255,255,255,.07); max-width: 82%; font-size: 13.5px; line-height: 1.45; }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message-user .personaje-ia-message-body { background: rgba(255,91,152,.2); }
html body > .personaje-ia-chat.ia-panel .personaje-ia-message-author { font-size: 11px; font-weight: 700; opacity: .7; }

@media (max-width: 680px) {
  html body > .personaje-ia-launcher.ia-bubble { right: 12px !important; width: 56px !important; min-width: 56px !important; height: 56px !important; min-height: 56px !important; bottom: calc(78px + (var(--ia-slot, 0) * 66px)) !important; }
  html body > .personaje-ia-launcher.ia-bubble img { width: 44px !important; height: 44px !important; flex-basis: 44px !important; }
  html body > .personaje-ia-launcher.ia-bubble::after { display: none; }
  html body > .personaje-ia-chat.ia-panel.personaje-ia-chat-open { right: 10px; bottom: calc(142px + (var(--ia-slot, 0) * 66px)); width: calc(100vw - 20px) !important; max-height: calc(100vh - 170px); }
}
@media (prefers-reduced-motion: reduce) {
  html body > .personaje-ia-launcher.ia-bubble, html body > .personaje-ia-chat.ia-panel.personaje-ia-chat-open { transition: none; animation: none !important; }
}
