/* Agente de IA NexosTienda (HUD) — identidad Nexos: navy #0B2545 + naranja #FF8A00, Poppins. Motor: agent.js */
/* Agente de IA demostrativo (HUD). Colores de marca: variables --g, --y, --b en .kxa */
.kxa { --g: #FF8A00; --y: #FFC266; --b: #7FB2E5; --ink: #f5f5f7; --mut: #8a8a93; --line: rgba(255, 255, 255, .12); position: fixed; right: 22px; bottom: 22px; z-index: 9999; font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); }
.kxa *, .kxa *::before, .kxa *::after { box-sizing: border-box; }
.kxa button { font: inherit; color: inherit; cursor: pointer; }
.kxa svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Orbe: anéis giratórios e núcleo com o globo da marca */
.kxa-orb { position: relative; display: inline-grid; place-items: center; width: var(--s, 44px); height: var(--s, 44px); flex: none; }
.kxa-orb i, .kxa-orb b { position: absolute; border-radius: 50%; }
.kxa-r1 { inset: 0; background: conic-gradient(from 0deg, var(--g), var(--y), var(--b), var(--g)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: kxa-spin 5s linear infinite; filter: drop-shadow(0 0 6px rgba(255, 138, 0, .6)); }
.kxa-r2 { inset: 13%; border: 1.5px dashed rgba(255, 255, 255, .7); animation: kxa-spin 9s linear infinite reverse; }
.kxa-r3 { inset: 25%; background: conic-gradient(from 90deg, transparent 0 55%, var(--g) 80%, transparent); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); animation: kxa-spin 3s linear infinite; }
.kxa-orb b { inset: 33%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff 0%, #ffffff 40%, #FF8A00 100%); box-shadow: 0 0 14px rgba(255, 138, 0, .8), 0 0 28px rgba(255, 194, 102, .35); animation: kxa-pulse 2.6s ease-in-out infinite; overflow: hidden; }
.kxa-orb b img { width: 82%; height: 82%; object-fit: contain; }
.kxa-orb--fab { --s: 46px; } .kxa-orb--sm { --s: 36px; } .kxa-orb--lg { --s: 112px; margin-bottom: 6px; }
.kxa-orb--lg .kxa-r1 { -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); }
@keyframes kxa-spin { to { transform: rotate(360deg); } }
@keyframes kxa-pulse { 50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 138, 0, 1), 0 0 38px rgba(255, 194, 102, .5); } }

/* Botão flutuante */
.kxa-fab { position: relative; display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); background: radial-gradient(circle at 30% 25%, #173B69 0%, #0F2D52 70%); box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 4px rgba(255, 138, 0, .12), inset 0 0 18px rgba(255, 138, 0, .35); transition: transform .2s ease, box-shadow .2s ease; }
.kxa-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 36px rgba(0, 0, 0, .6), 0 0 0 5px rgba(255, 194, 102, .2), inset 0 0 22px rgba(255, 138, 0, .5); }
.kxa-fab:focus-visible { outline: 3px solid var(--y); outline-offset: 3px; }
.kxa-ping { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--g); opacity: 0; animation: kxa-ping 2.8s ease-out 3; pointer-events: none; }
@keyframes kxa-ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
.kxa.is-open .kxa-ping { display: none; }
.kxa-tip { position: absolute; right: 76px; bottom: 14px; padding: 9px 14px; border-radius: 12px; background: #0F2D52; border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: .88rem; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); opacity: 0; transform: translateX(8px); pointer-events: none; transition: opacity .3s ease, transform .3s ease; }
.kxa-tip::after { content: ""; position: absolute; right: -6px; top: 50%; width: 10px; height: 10px; background: #0F2D52; border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.kxa-tip.is-on { opacity: 1; transform: none; }

/* Painel */
.kxa-panel { position: absolute; right: 0; bottom: 80px; width: min(404px, calc(100vw - 24px)); height: min(676px, calc(100dvh - 120px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .32); background: radial-gradient(120% 70% at 0% 0%, rgba(255, 194, 102, .12), transparent 55%), radial-gradient(120% 70% at 100% 100%, rgba(255, 138, 0, .2), transparent 55%), linear-gradient(165deg, #0F2D52 0%, #081C36 55%, #06152B 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 138, 0, .08), 0 0 60px rgba(255, 138, 0, .18); animation: kxa-in .28s cubic-bezier(.2, .9, .3, 1); }
.kxa-panel[hidden] { display: none; }
@keyframes kxa-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.kxa.is-wide .kxa-panel { width: min(760px, calc(100vw - 24px)); height: calc(100dvh - 44px); bottom: 0; }
.kxa-hud { position: absolute; inset: 0; pointer-events: none; z-index: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 34px), repeating-linear-gradient(90deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 34px); }
.kxa-hud::before, .kxa-hud::after { content: ""; position: absolute; width: 20px; height: 20px; border: 2px solid rgba(255, 194, 102, .7); }
.kxa-hud::before { left: 10px; top: 10px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.kxa-hud::after { right: 10px; bottom: 10px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; border-color: rgba(255, 138, 0, .8); }
.kxa-head, .kxa-body, .kxa-form, .kxa-note { position: relative; z-index: 1; }
.kxa-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 138, 0, .12), transparent); }
.kxa-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--g), var(--y), var(--b), transparent); background-size: 200% 100%; animation: kxa-scan 4s linear infinite; }
@keyframes kxa-scan { to { background-position: -200% 0; } }
.kxa-ttl { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kxa-ttl b { font: 700 1.05rem "Sora", "Manrope", sans-serif; letter-spacing: .02em; color: #fff; }
.kxa-ttl small { display: flex; align-items: center; gap: 6px; color: var(--mut); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kxa-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g); box-shadow: 0 0 6px var(--g); flex: none; }
@keyframes kxa-blink { 50% { opacity: .35; } }
.kxa-act { display: flex; gap: 4px; }
.kxa-act button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--mut); }
.kxa-act button:hover { color: #fff; background: rgba(255, 255, 255, .08); border-color: var(--line); }
.kxa-act button:focus-visible { outline: 2px solid var(--y); }
.kxa-body { flex: 1; overflow-y: auto; padding: 14px 18px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.kxa-body::-webkit-scrollbar { width: 6px; } .kxa-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 6px; }
.kxa-welcome { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-top: 6px; }
.kxa-welcome h2 { margin: 0; font: 700 1.25rem "Sora", "Manrope", sans-serif; color: #fff; text-shadow: 0 0 22px rgba(255, 138, 0, .6); }
.kxa-welcome p { margin: 0; max-width: 28em; color: var(--mut); font-size: .92rem; }
.kxa-starts, .kxa-rel ul { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.kxa-starts { margin-top: 12px; text-align: start; }
.kxa-starts button, .kxa-rel button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 11px; text-align: start; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .045); transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.kxa-starts button:hover, .kxa-rel button:hover { background: rgba(255, 138, 0, .18); border-color: rgba(255, 194, 102, .7); transform: translateX(2px); }
.kxa-starts button:focus-visible, .kxa-rel button:focus-visible { outline: 2px solid var(--y); }
.kxa-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: rgba(255, 138, 0, .22); color: #FFC47A; flex: none; }
.kxa-starts span:nth-child(2), .kxa-rel button span:first-child { flex: 1; font-weight: 600; font-size: .92rem; }
.kxa-go { color: var(--mut); display: grid; } .kxa-go svg { width: 18px; height: 18px; }
.kxa[dir="rtl"] .kxa-go svg { transform: scaleX(-1); }
.kxa-m { max-width: 92%; padding: 11px 14px; border-radius: 16px; font-size: .94rem; word-wrap: break-word; animation: kxa-msg .25s ease; }
@keyframes kxa-msg { from { opacity: 0; transform: translateY(6px); } }
.kxa-m--u { margin-inline-start: auto; color: #fff; background: linear-gradient(135deg, #E67A00, #E67A00); border-end-end-radius: 4px; box-shadow: 0 6px 18px rgba(230, 122, 0, .35); }
.kxa-m--a { margin-inline-end: auto; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-inline-start: 3px solid var(--g); border-end-start-radius: 4px; box-shadow: 0 0 24px rgba(255, 138, 0, .08); }
.kxa-m a { color: var(--y); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; } .kxa-m a:hover { color: #fff; }
.kxa-think { display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-size: .86rem; }
.kxa-think i { width: 6px; height: 6px; border-radius: 50%; background: var(--g); animation: kxa-bounce 1s infinite ease-in-out; } .kxa-think i:nth-child(3) { animation-delay: .15s; } .kxa-think i:nth-child(4) { animation-delay: .3s; }
@keyframes kxa-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.kxa-rel { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.kxa-rel small { display: block; margin-bottom: 8px; color: var(--mut); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.kxa-rel button { padding: 8px 10px; font-size: .86rem; }
.kxa-form { display: flex; align-items: center; gap: 10px; margin: 8px 16px 0; padding: 7px 7px 7px 16px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .8); transition: border-color .2s ease, box-shadow .2s ease; }
.kxa-form:focus-within { border-color: var(--g); box-shadow: 0 0 0 3px rgba(255, 194, 102, .18), 0 0 24px rgba(255, 194, 102, .2); }
.kxa-in { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; padding: 8px 0; }
.kxa-in::placeholder { color: #8a8a93; }
.kxa-send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: linear-gradient(#0F2D52, #0F2D52) padding-box, conic-gradient(var(--g), var(--y), var(--b), var(--g)) border-box; color: #fff; transition: transform .15s ease, box-shadow .15s ease; }
.kxa-send:hover { transform: scale(1.06); box-shadow: 0 0 16px rgba(255, 138, 0, .7); }
.kxa-send:focus-visible { outline: 2px solid var(--y); outline-offset: 2px; }
.kxa[dir="rtl"] .kxa-send svg { transform: scaleX(-1); }
.kxa-note { margin: 0; padding: 8px 20px 12px; text-align: center; color: #8a8a93; font-size: .72rem; }

@media (max-width: 560px) {
  .kxa { right: 14px; bottom: 14px; }
  .kxa.is-open .kxa-fab, .kxa.is-open .kxa-tip { display: none; }
  .kxa-panel, .kxa.is-wide .kxa-panel { position: fixed; inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .kxa-tip { right: 70px; bottom: 10px; }
}
@media (max-width: 899px) { body:has(.tabs-bottom) .kxa:not(.is-open) { bottom: 86px; } }
@media (prefers-reduced-motion: reduce) { .kxa *, .kxa *::before, .kxa *::after { animation: none !important; transition: none !important; } .kxa-ping { display: none; } }

/* Solo para el equipo: oculto mientras se muestra el login o el alta inicial */
body:has(#loginScreen:not([hidden])) .kxa, body:has(#setupScreen:not([hidden])) .kxa { display: none; }
