/* ---- Asistente de IA (chat flotante) ---- */
.ag-fab { position: fixed; right: 18px; bottom: 18px; z-index: 1800; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 18px; color: #fff; font-size: 14.5px; cursor: pointer;
  background: linear-gradient(135deg, #1d3f73, #7c3aed); box-shadow: 0 10px 28px rgba(76, 29, 149, .45); }
.ag-fab:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ag-fab.oculto { display: none; }
.ag-panel { position: fixed; right: 18px; bottom: 18px; z-index: 2400; width: min(440px, calc(100vw - 24px)); height: min(680px, calc(100dvh - 36px)); display: flex; flex-direction: column; background: var(--o-surface,#fff); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .4); border: 1px solid var(--o-border,#e2e8f0); }
.ag-cab { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; color: #fff; background: linear-gradient(135deg, #12274a, #5b21b6); }
.ag-cab div { display: grid; } .ag-cab small { color: #d6c9ff; font-size: 12px; }
.ag-x { border: 0; background: rgba(255, 255, 255, .15); color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.ag-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--o-info-bg,#f6f8fc); }
.ag-bienvenida p { margin: 0 0 8px; color: var(--o-muted,#475569); }
.ag-chip { display: inline-block; margin: 0 6px 6px 0; border: 1px solid var(--o-info-b,#c9d6ea); background: var(--o-surface,#fff); border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--o-heading,#1d3f73); text-align: left; }
.ag-chip:hover { background: var(--o-info-bg,#eaf1fb); }
.ag-m { display: flex; flex-direction: column; gap: 6px; max-width: 94%; }
.ag-m.yo { align-self: flex-end; align-items: flex-end; } .ag-m.ag { align-self: flex-start; }
.ag-burbuja { padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-break: break-word; }
.ag-m.yo .ag-burbuja { background: #1d3f73; color: #fff; border-bottom-right-radius: 4px; }
.ag-m.ag .ag-burbuja { background: var(--o-surface,#fff); border: 1px solid var(--o-border,#e2e8f0); border-bottom-left-radius: 4px; color: var(--o-text,#0f172a); }
.ag-pensando { display: flex; gap: 5px; padding: 14px 16px; } .ag-pensando i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; animation: ag-p 1s infinite ease-in-out; }
.ag-pensando i:nth-child(2) { animation-delay: .15s; } .ag-pensando i:nth-child(3) { animation-delay: .3s; }
@keyframes ag-p { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.ag-tarjetas { display: grid; gap: 6px; }
.ag-tarjeta { display: grid; gap: 1px; text-align: left; border: 1px solid var(--o-border,#e2e8f0); border-left: 4px solid #94a3b8; background: var(--o-surface,#fff); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.ag-tarjeta:hover { background: var(--o-info-bg,#f1f6fd); } .ag-tarjeta strong { font-size: 13.5px; } .ag-tarjeta span { font-size: 12.5px; color: var(--o-muted,#475569); } .ag-tarjeta small { font-size: 12px; color: var(--o-muted,#64748b); }
.ag-tarjeta.ok { border-left-color: #10b981; } .ag-tarjeta.bloqueado, .ag-tarjeta.critica { border-left-color: #ef4444; } .ag-tarjeta.aviso, .ag-tarjeta.sinplaza, .ag-tarjeta.pendiente { border-left-color: #f59e0b; }
.ag-propuesta { border: 2px solid #7c3aed; background: var(--o-purple-bg,#faf7ff); border-radius: 14px; padding: 12px 14px; }
.ag-propuesta.resuelta { opacity: .6; border-color: var(--o-border-strong,#cbd5e1); background: var(--o-surface-2,#f8fafc); }
.ag-propuesta ul { margin: 6px 0 10px; padding-left: 18px; font-size: 13px; color: var(--o-muted,#475569); } .ag-propuesta li { margin: 2px 0; white-space: pre-wrap; }
.ag-acciones { display: flex; gap: 8px; } .ag-acciones button { width: auto; flex: 1; }
.ag-entrada { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--o-border,#e2e8f0); background: var(--o-surface,#fff); }
.ag-entrada textarea, .ag-entrada input { flex: 1; min-width: 0; border: 1px solid var(--o-border,#e2e8f0); border-radius: 999px; padding: 10px 14px; font-size: 15px; outline: none; }
.ag-entrada textarea { border-radius: 18px; resize: none; line-height: 1.35; max-height: 140px; font-family: inherit; }
.ag-entrada { align-items: flex-end; }
.ag-entrada textarea:focus, .ag-entrada input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.ag-mic, .ag-enviar { width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; font-size: 16px; flex: none; }
.ag-mic { background: var(--o-surface-3,#eef2f7); } .ag-mic.on { background: #ef4444; color: #fff; animation: ag-latido 1.1s infinite; }
@keyframes ag-latido { 50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, .2); } }
.ag-enviar { background: #7c3aed; color: #fff; } .ag-enviar:disabled { opacity: .4; cursor: default; }
@media (max-width: 760px) {
  .ag-fab { right: 12px; bottom: 12px; padding: 12px; } .ag-fab b { display: none; }
  .ag-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}

.ag-fab .ico, .ag-x .ico, .ag-mic .ico, .ag-enviar .ico { display: block; }
.ag-fab { gap: 8px; } .ag-x, .ag-mic, .ag-enviar { display: inline-grid; place-items: center; }

/* cuadro de texto del asistente: ancho completo, tipografia de la app y altura estable (una linea hasta que se escribe mas) */
.ag-entrada { width: 100%; box-sizing: border-box; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.ag-entrada textarea { flex: 1 1 auto; width: 100%; box-sizing: border-box; min-height: 44px; height: 44px; font-family: inherit !important; font-size: 16px; line-height: 1.35; padding: 11px 16px; border: 1.5px solid var(--o-border-strong,#cbd5e1); border-radius: 22px; background: var(--o-surface-2,#f8fafc); color: var(--o-text,#0f172a); overflow-y: auto; transition: border-color .15s, box-shadow .15s, background .15s; }
.ag-entrada textarea::placeholder { color: var(--o-faint,#94a3b8); font-family: inherit; }
.ag-entrada textarea:focus { background: var(--o-surface,#fff); border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.ag-entrada .ag-mic, .ag-entrada .ag-enviar { width: 44px; height: 44px; }
.ag-entrada .ag-enviar:not(:disabled) { box-shadow: 0 2px 8px rgba(124, 58, 237, .35); }
