/* ----- Asistente IA ----- */
.ai-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1500; border: none; cursor: pointer;
  background: linear-gradient(135deg, #7c4dff, #2f6bff); color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(60, 60, 200, .35);
}
.ai-fab:hover { filter: brightness(1.08); }
.ai-panel {
  position: fixed; right: 18px; bottom: 76px; z-index: 1600; width: 390px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 100px); background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 22, 40, .28); display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border);
}
.ai-head { display: flex; align-items: center; gap: 6px; padding: 12px 14px; background: linear-gradient(135deg, #7c4dff, #2f6bff); color: #fff; }
.ai-head .small { opacity: .85; }
.ai-icon { background: rgba(255, 255, 255, .18); border: none; color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.ai-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f7f8fc; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; line-height: 1.45; font-size: 13.5px; overflow-x: auto; }
.ai-msg p { margin: 0 0 6px; }
.ai-msg p:last-child { margin: 0; }
.ai-msg ul { margin: 4px 0; padding-left: 18px; }
.ai-msg table { border-collapse: collapse; font-size: 12px; margin: 4px 0; }
.ai-msg th, .ai-msg td { border: 1px solid var(--border); padding: 4px 6px; text-align: left; }
.ai-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg.error { background: #fde4e5; color: #9b1c21; border-color: #f3c3c5; }
.ai-msg.typing { display: flex; gap: 4px; padding: 12px 14px; }
.ai-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b5; animation: blink 1.2s infinite; }
.ai-msg.typing span:nth-child(2) { animation-delay: .2s; }
.ai-msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; background: #fff; }
.ai-quick button {
  flex-shrink: 0; border: 1px solid #d9d2ff; background: #f4f1ff; color: #5a35d6; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.ai-form { display: flex; gap: 8px; padding: 10px 12px 12px; background: #fff; }
.ai-form textarea { resize: none; max-height: 90px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@media (max-width: 520px) {
  .ai-panel { right: 8px; left: 8px; width: auto; bottom: 70px; height: calc(100vh - 90px); }
  .ai-fab span { display: none; }
}
