/* Vitrina de WhatsApp en la portada (1.14.11).
   Solo muestra funciones reales: recepción por webhook, historial y envío de texto.
   Sin JavaScript: la animación es CSS y respeta "reducir movimiento". */
#authView {
  --wa-brand: #25d366;
  --wa-head: #0b6b5b;
  --wa-head-ink: #ffffff;
  --wa-chat-bg: #efeae2;
  --wa-dots: rgba(17, 27, 33, .06);
  --wa-in-bg: #ffffff;
  --wa-out-bg: #d9fdd3;
  --wa-msg-ink: #111b21;
  --wa-time: #667781;
  --wa-compose-bg: #f0f2f5;
  --wa-compose-field: #ffffff;
}
html:is([data-theme="dark"], [data-theme="soft"]) #authView {
  --wa-head: #1f2c34;
  --wa-head-ink: #e9edef;
  --wa-chat-bg: #0b141a;
  --wa-dots: rgba(233, 237, 239, .05);
  --wa-in-bg: #202c33;
  --wa-out-bg: #005c4b;
  --wa-msg-ink: #e9edef;
  --wa-time: #a3b3bc;
  --wa-compose-bg: #1f2c34;
  --wa-compose-field: #2a3942;
}

/* Insignia del hero */
#authView .wa-badge { display: inline-flex; align-items: center; gap: 9px; }
#authView .wa-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--wa-brand); flex: 0 0 8px; }
#authView .wa-pulse::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--wa-brand); opacity: 0; animation: wa-ping 2.4s ease-out infinite; }
@keyframes wa-ping { 0% { transform: scale(.5); opacity: .8; } 80%, 100% { transform: scale(1.6); opacity: 0; } }


/* ===== Franja oscura del inicio (siempre oscura, como un banner) ===== */
#authView .wa-banner {
  --wa-chat-bg: #0b141a; --wa-dots: rgba(233,237,239,.05); --wa-in-bg: #202c33; --wa-out-bg: #005c4b;
  --wa-msg-ink: #e9edef; --wa-time: #9fb0ba; --wa-compose-bg: #17232b; --wa-compose-field: #2a3942;
  --bn-ink: #f2f7fb; --bn-muted: #a9bccd; --bn-line: rgba(140,190,230,.18); --bn-green: #34d77b;
  position: relative; overflow: hidden; color: var(--bn-ink); border-radius: 24px 24px 0 0;
  background:
    radial-gradient(circle at 78% 18%, rgba(56,140,255,.28), transparent 42%),
    radial-gradient(circle at 46% 72%, rgba(37,211,102,.20), transparent 38%),
    radial-gradient(rgba(140,190,255,.10) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(135deg, #04162b 0%, #072748 55%, #04304a 100%);
}
#authView .wa-flow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#authView .wa-flow path { fill: none; stroke: #2fd3c4; stroke-width: 1.4; opacity: .35; stroke-dasharray: 6 10; animation: wa-flow 6s linear infinite; }
#authView .wa-flow path:nth-child(2n) { stroke: #34d77b; animation-duration: 8s; }
@keyframes wa-flow { to { stroke-dashoffset: -160; } }
#authView .wa-banner > :not(.wa-flow) { position: relative; }
#authView .wa-banner .welcome-nav { border-bottom-color: var(--bn-line); }
#authView .wa-banner .welcome-brand strong, #authView .wa-banner h1 { color: var(--bn-ink); }
#authView .wa-banner .welcome-brand small, #authView .wa-banner .welcome-nav nav a { color: var(--bn-muted); }
#authView .wa-banner .welcome-nav nav a:hover { color: var(--bn-green); }
#authView .wa-banner .brand-mark { background: rgba(52,215,123,.14); color: var(--bn-green); }
#authView .wa-banner .welcome-outline { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.22); color: var(--bn-ink); }
#authView .wa-banner .welcome-outline:hover { background: rgba(255,255,255,.12); }
#authView .wa-banner .welcome-badge { background: rgba(52,215,123,.14); color: var(--bn-green); }
#authView .wa-hero { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 40px; padding: 50px 36px 26px 42px; }
#authView .wa-banner .welcome-intro h1 { font-size: clamp(32px, 3.2vw, 42px); line-height: 1.08; text-transform: none; }
#authView .wa-banner .welcome-intro h1 span { color: var(--bn-green); }
#authView .wa-banner .welcome-intro > p:not(.welcome-trial) { color: var(--bn-muted); }
#authView .wa-banner .welcome-intro > p.wa-sub { color: var(--bn-ink); font-size: 17px; line-height: 1.5; margin: 0 0 12px; font-weight: 600; }
#authView .wa-banner .wa-sub strong { color: var(--bn-green); }
#authView .wa-banner .welcome-trial strong { color: var(--bn-green); }
#authView .wa-banner .welcome-trial > span, #authView .wa-banner .auth-social { color: var(--bn-muted); }
#authView .wa-tagline { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 42px 30px; }
#authView .wa-tagline p { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.3px; text-transform: uppercase; color: var(--bn-ink); }
#authView .wa-tagline p span { color: var(--bn-green); }

/* ===== Monitor con el CRM ===== */
#authView .wa-stage { position: relative; margin: 0; padding: 18px 22px 0; min-width: 0; }
#authView .wa-monitor { position: relative; z-index: 1; }
#authView .wa-screen { container-type: inline-size; border-radius: 14px; padding: 7px; background: linear-gradient(160deg, #22344a, #0b1522); border: 1px solid rgba(160,200,240,.25); box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 60px rgba(47,211,196,.15); }
#authView .wa-stand { width: 22%; height: 22px; margin: 0 auto; background: linear-gradient(#1a2a3c, #0d1824); clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); }
#authView .wa-stand::after { content: ''; display: block; width: 180%; height: 6px; margin: 22px 0 0 -40%; border-radius: 6px; background: #1a2a3c; }
#authView .wa-topbar { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: #0f1c27; border-radius: 9px 9px 0 0; border-bottom: 1px solid rgba(255,255,255,.06); }
#authView .wa-top-brand { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 700; color: #d7e4ee; }
#authView .wa-top-brand b { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; background: rgba(52,215,123,.18); color: var(--bn-green); font-size: 8px; }
#authView .wa-top-dots { display: flex; gap: 5px; }
#authView .wa-top-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); }
#authView .wa-app { display: grid; grid-template-columns: 108px 128px minmax(0, 1fr) 114px; height: 310px; background: #111b21; border-radius: 0 0 9px 9px; overflow: hidden; font-size: 10px; color: #d9e3ea; }

#authView .wa-side { list-style: none; margin: 0; padding: 8px 6px; display: grid; align-content: start; gap: 2px; background: #0d1720; border-right: 1px solid rgba(255,255,255,.06); }
#authView .wa-side-item { display: flex; align-items: center; gap: 6px; padding: 6px 6px; border-radius: 6px; color: #9fb0ba; white-space: nowrap; min-width: 0; }
#authView .wa-side-item span { overflow: hidden; text-overflow: ellipsis; }
#authView .wa-side-item i { flex: 0 0 14px; width: 14px; height: 14px; display: grid; }
#authView .wa-side-item svg { width: 14px; height: 14px; }
#authView .wa-side-item b { margin-left: auto; min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; background: #25d366; color: #052e17; font-size: 8px; }
#authView .wa-side-item.is-active { background: rgba(37,211,102,.16); color: #fff; font-weight: 700; }
#authView .wa-side-item.is-active i { color: var(--bn-green); }

#authView .wa-list { border-right: 1px solid rgba(255,255,255,.06); min-width: 0; background: #111b21; }
#authView .wa-list-head { padding: 9px 9px 7px; }
#authView .wa-list-head strong { display: block; font-size: 12px; color: #fff; }
#authView .wa-list-head span { display: block; margin-top: 6px; padding: 5px 8px; border-radius: 6px; background: #202c33; color: #8696a0; font-size: 9px; }
#authView .wa-list ul { list-style: none; margin: 0; padding: 0; }
#authView .wa-chat-item { position: relative; display: flex; gap: 7px; align-items: center; padding: 7px 9px; border-top: 1px solid rgba(255,255,255,.05); }
#authView .wa-chat-item.is-active { background: #2a3942; }
#authView .wa-chat-item div { min-width: 0; flex: 1; }
#authView .wa-chat-item strong { display: block; font-size: 10px; color: #e9edef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 34px; }
#authView .wa-chat-item small { display: block; font-size: 9px; color: #8696a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; padding-right: 14px; }
#authView .wa-chat-item em { position: absolute; top: 7px; right: 8px; font-style: normal; font-size: 8px; color: #8696a0; }
#authView .wa-chat-item > b { position: absolute; right: 8px; bottom: 7px; min-width: 14px; height: 14px; border-radius: 7px; display: grid; place-items: center; background: #25d366; color: #052e17; font-size: 8px; }
#authView .wa-av { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #dfe5e7; color: #3b4a54; font-size: 8px; font-weight: 800; }
#authView .wa-av.big { width: 40px; height: 40px; flex-basis: 40px; font-size: 12px; margin: 0 auto 6px; }

#authView .wa-conv { display: flex; flex-direction: column; min-width: 0; background: var(--wa-chat-bg); }
#authView .wa-conv-head { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: #202c33; }
#authView .wa-conv-head strong { display: block; font-size: 11px; color: #e9edef; }
#authView .wa-conv-head small { display: block; font-size: 9px; color: var(--bn-green); }
#authView .wa-chat { flex: 1; display: grid; gap: 7px; align-content: start; padding: 10px; background-image: radial-gradient(var(--wa-dots) 1px, transparent 1px); background-size: 12px 12px; }
#authView .wa-day { justify-self: center; font-size: 8px; padding: 3px 8px; border-radius: 6px; background: #182229; color: #8696a0; }
#authView .wa-msg { position: relative; margin: 0; max-width: 86%; padding: 6px 8px 15px; border-radius: 8px; font-size: 10px; line-height: 1.4; color: var(--wa-msg-ink); box-shadow: 0 1px 1px rgba(0,0,0,.25); overflow-wrap: anywhere; }
#authView .wa-msg time { position: absolute; right: 7px; bottom: 3px; font-size: 8px; color: var(--wa-time); }
#authView .wa-in { justify-self: start; background: var(--wa-in-bg); border-top-left-radius: 2px; }
#authView .wa-out { justify-self: end; background: var(--wa-out-bg); border-top-right-radius: 2px; }
#authView .wa-slot { display: grid; }
#authView .wa-slot > * { grid-area: 1 / 1; }
#authView .wa-typing { justify-self: end; align-self: start; margin: 0; display: inline-flex; gap: 3px; padding: 8px 10px; border-radius: 8px; border-top-right-radius: 2px; background: var(--wa-out-bg); }
#authView .wa-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--wa-time); animation: wa-dot 1s ease-in-out infinite; }
#authView .wa-typing i:nth-child(2) { animation-delay: .15s; }
#authView .wa-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes wa-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
#authView .wa-compose { display: flex; align-items: center; gap: 7px; padding: 7px 8px; background: var(--wa-compose-bg); }
#authView .wa-compose span { flex: 1; padding: 6px 10px; border-radius: 14px; background: var(--wa-compose-field); color: #8696a0; font-size: 9px; }
#authView .wa-compose b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #00a884; color: #fff; font-size: 10px; }

#authView .wa-info { padding: 12px 9px; text-align: center; background: #0f1a21; border-left: 1px solid rgba(255,255,255,.06); min-width: 0; }
#authView .wa-info > strong { display: block; font-size: 10px; color: #fff; }
#authView .wa-info > small { display: block; font-size: 9px; color: #8696a0; margin-top: 2px; }
#authView .wa-info dl { margin: 10px 0 0; display: grid; gap: 6px; text-align: left; }
#authView .wa-info dl div { padding: 6px 7px; border-radius: 6px; background: #17242d; }
#authView .wa-info dt { font-size: 8px; color: #8696a0; }
#authView .wa-info dd { margin: 2px 0 0; font-size: 9px; color: #e9edef; overflow-wrap: anywhere; }
#authView .wa-chip { display: inline-block; padding: 1px 6px; border-radius: 4px; background: rgba(255,184,77,.18); color: #ffc46b; font-size: 8px; font-weight: 700; }
@container (max-width: 560px) { #authView .wa-app { grid-template-columns: 96px 118px minmax(0, 1fr); } #authView .wa-info { display: none; } }
@container (max-width: 420px) { #authView .wa-app { grid-template-columns: 34px minmax(0, 1fr); } #authView .wa-side-item span, #authView .wa-side-item b { display: none; } #authView .wa-list { display: none; } }

/* Íconos flotantes */
#authView .wa-float { position: absolute; z-index: 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.35); animation: wa-bob 5s ease-in-out infinite; }
#authView .wa-float svg { width: 22px; height: 22px; }
#authView .wa-float > b { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; background: #ff4d5e; font-size: 9px; }
#authView .wa-hub { left: -40px; top: 64%; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5cf09a, #12a84f); box-shadow: 0 0 0 8px rgba(52,215,123,.15), 0 0 50px rgba(52,215,123,.55); animation-duration: 6s; }
#authView .wa-hub svg { width: 38px; height: 38px; stroke-width: 1.6; }
#authView .wa-bell { left: 36%; top: -4px; background: linear-gradient(135deg, #3d8bff, #2563eb); animation-delay: -1s; }
#authView .wa-team { right: -6px; top: 22%; background: linear-gradient(135deg, #3d8bff, #1d4ed8); animation-delay: -2s; }
#authView .wa-money { right: -6px; top: 50%; background: linear-gradient(135deg, #34d77b, #15a34a); animation-delay: -3s; }
#authView .wa-chart { right: 8%; top: 74%; background: linear-gradient(135deg, #34d77b, #0f9f6e); animation-delay: -4s; }
@keyframes wa-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
#authView .wa-banner .wa-toasts { margin-top: 18px; max-width: none; }
#authView .wa-banner .wa-toast { background: rgba(10,28,46,.85); border-color: rgba(140,190,230,.22); color: var(--bn-ink); box-shadow: 0 12px 28px rgba(0,0,0,.3); backdrop-filter: blur(6px); }
#authView .wa-banner .wa-toast small { color: var(--bn-muted); }
#authView .wa-banner .wa-toast-icon { background: rgba(52,215,123,.16); color: var(--bn-green); }

/* Avisos del CRM que flotan junto al teléfono */
#authView .wa-toasts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 460px; margin: 14px auto 0; }
#authView .wa-toast { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 28px var(--shadow); color: var(--ink); }
#authView .wa-toast strong { display: block; font-size: 12px; }
#authView .wa-toast small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
#authView .wa-toast-icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center; background: var(--green-soft); color: var(--teal); font-weight: 800; }

/* Secuencia en bucle de 11 s: llega el mensaje, el CRM lo guarda, se responde, el cliente confirma. */
#authView :is(.wa-a1, .wa-a2, .wa-a3, .wa-a4, .wa-a5, .wa-a6) { animation-duration: 11s; animation-iteration-count: infinite; animation-timing-function: ease-out; animation-fill-mode: both; }
#authView .wa-a1 { animation-name: wa-step-1; }
#authView .wa-a2 { animation-name: wa-step-2; }
#authView .wa-a3 { animation-name: wa-step-3; }
#authView .wa-a4 { animation-name: wa-step-4; }
#authView .wa-a5 { animation-name: wa-step-5; }
#authView .wa-a6 { animation-name: wa-step-6; }
@keyframes wa-step-1 { 0%, 3% { opacity: 0; transform: translateY(8px); } 7%, 92% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
@keyframes wa-step-2 { 0%, 12% { opacity: 0; transform: translateX(-10px); } 17%, 90% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }
@keyframes wa-step-3 { 0%, 24% { opacity: 0; } 27%, 40% { opacity: 1; } 42%, 100% { opacity: 0; } }
@keyframes wa-step-4 { 0%, 41% { opacity: 0; transform: translateY(8px); } 45%, 92% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
@keyframes wa-step-5 { 0%, 50% { opacity: 0; transform: translateX(10px); } 55%, 90% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }
@keyframes wa-step-6 { 0%, 64% { opacity: 0; transform: translateY(8px); } 68%, 92% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }

/* Sección "WhatsApp integrado" */
#authView .wa-section { background: linear-gradient(180deg, var(--green-soft), transparent 70%); }
#authView .wa-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
#authView .wa-features article { border: 1px solid var(--line); border-radius: 12px; padding: 21px; background: var(--surface); }
#authView .wa-feature-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--teal); }
#authView .wa-feature-icon svg { width: 20px; height: 20px; }
#authView .wa-features h3 { color: var(--ink); font-size: 15px; margin: 16px 0 9px; letter-spacing: -.2px; }
#authView .wa-features p { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0; }
#authView .wa-steps { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'title cta' 'steps steps'; align-items: center; gap: 20px 24px; margin-top: 22px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
#authView .wa-steps-title { grid-area: title; }
#authView .wa-steps ol { grid-area: steps; }
#authView .wa-steps > .btn-primary { grid-area: cta; }
#authView .wa-steps-title h3 { color: var(--ink); font-size: 17px; margin: 0 0 6px; }
#authView .wa-steps-title p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
#authView .wa-steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
#authView .wa-steps li { display: flex; gap: 11px; align-items: flex-start; }
#authView .wa-steps li > b { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; font-size: 12px; }
#authView .wa-steps li strong { display: block; color: var(--ink); font-size: 13px; }
#authView .wa-steps li div > span { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 4px; }
#authView .wa-steps .btn-primary { white-space: nowrap; }

@media (max-width: 1050px) {
  #authView .wa-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  #authView .wa-hero { grid-template-columns: 1fr; padding: 34px 25px 20px; }
  #authView .wa-tagline { padding: 16px 25px 26px; }
}
@media (max-width: 650px) {
  #authView .wa-banner { border-radius: 16px 16px 0 0; }
  #authView .wa-hero { padding: 28px 22px 16px; }
  #authView .wa-stage { padding: 14px 4px 0; }
  #authView .wa-app { height: 300px; }
  #authView :is(.wa-hub, .wa-team, .wa-money, .wa-chart) { display: none; }
  #authView .wa-bell { left: auto; right: 8px; top: -2px; width: 36px; height: 36px; }
  #authView .wa-tagline { display: grid; padding: 14px 22px 24px; }
  #authView .wa-tagline p { font-size: 17px; }
  #authView .wa-features { grid-template-columns: 1fr; }
  #authView .wa-steps { padding: 20px; }
  #authView .wa-steps { grid-template-columns: 1fr; grid-template-areas: 'title' 'steps' 'cta'; }
  #authView .wa-steps ol { grid-template-columns: 1fr; }
  #authView .wa-steps .btn-primary { justify-self: stretch; white-space: normal; }
  #authView .wa-toasts { grid-template-columns: 1fr; }
  #authView .wa-msg { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  #authView .wa-pulse::after, #authView .wa-typing i, #authView .wa-float, #authView .wa-flow path { animation: none; }
  #authView :is(.wa-a1, .wa-a2, .wa-a4, .wa-a5, .wa-a6) { animation: none; opacity: 1; transform: none; }
  #authView .wa-a3 { animation: none; opacity: 0; }
}

/* Enlace discreto al acceso privado (solo en el equipo del propietario) */
#authView .owner-link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 11px; cursor: pointer; opacity: .7; }
#authView .owner-link:hover { opacity: 1; color: var(--accent); }
#authView .owner-link.hidden { display: none; }
