/* Vinculación obligatoria WhatsApp — primer ingreso (producción) */
.wa-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 25000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 12, 22, 0.92);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  animation: waSetupFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.wa-setup-overlay[hidden] {
  display: none !important;
}
.wa-setup-overlay.is-complete {
  animation: waSetupFadeOut 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes waSetupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes waSetupFadeOut {
  to { opacity: 0; visibility: hidden; }
}

.wa-setup-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  animation: waSetupSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
@keyframes waSetupSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wa-setup-close-btn {
  position: absolute;
  top: 0;
  left: 0;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(10, 18, 30, 0.9);
  color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  z-index: 2;
}
.wa-setup-close-btn:hover {
  background: rgba(22, 34, 52, 0.96);
  color: #fff;
}
.wa-setup-close-btn:active {
  transform: scale(0.97);
}
.wa-setup-close-btn span {
  font-size: 1rem;
  line-height: 1;
}

.wa-setup-progress-head {
  text-align: center;
  margin-bottom: 18px;
  padding: 0 52px;
}
.wa-setup-progress-head h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f4f7fb;
  letter-spacing: -0.02em;
}
.wa-setup-progress-head p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.45;
}

.wa-setup-progress-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.wa-setup-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1e5a8a, #3b82f6, #d4a054);
  background-size: 200% 100%;
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  animation: waSetupShimmer 2.2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.45);
}
@keyframes waSetupShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.wa-setup-milestones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}
.wa-setup-milestone {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.35s ease;
}
.wa-setup-milestone.active {
  color: #d4a054;
}
.wa-setup-milestone.done {
  color: #5bc49f;
}
.wa-setup-milestone-dot {
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: transform 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
}
.wa-setup-milestone.active .wa-setup-milestone-dot {
  background: #d4a054;
  box-shadow: 0 0 12px rgba(212, 160, 84, 0.7);
  transform: scale(1.2);
  animation: waSetupPulse 1.4s ease-in-out infinite;
}
.wa-setup-milestone.done .wa-setup-milestone-dot {
  background: #5bc49f;
  box-shadow: 0 0 10px rgba(91, 196, 159, 0.5);
}
@keyframes waSetupPulse {
  0%, 100% { transform: scale(1.15); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.85; }
}

.wa-setup-card {
  background: linear-gradient(165deg, rgba(22, 38, 58, 0.95), rgba(12, 22, 38, 0.98));
  border: 1px solid rgba(212, 160, 84, 0.28);
  border-radius: 20px;
  padding: 24px 22px 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.wa-setup-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 14px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
.wa-setup-status-badge.is-ready {
  background: rgba(91, 196, 159, 0.15);
  border-color: rgba(91, 196, 159, 0.4);
  color: #7dffb3;
}
.wa-setup-status-badge.is-error {
  background: rgba(220, 80, 80, 0.12);
  border-color: rgba(255, 120, 120, 0.35);
  color: #fca5a5;
}
.wa-setup-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: waSetupPulse 1.2s ease-in-out infinite;
}
.wa-setup-status-badge.is-ready .wa-setup-status-dot {
  animation: none;
}

.wa-setup-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
.wa-setup-card .wa-setup-desc {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.55;
}

.wa-setup-qr-wrap {
  text-align: center;
  margin: 8px 0 16px;
}
.wa-setup-qr-frame {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  animation: waSetupQrIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.wa-setup-qr-frame.is-waiting {
  animation: waSetupQrIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both, waSetupQrGlow 2.5s ease-in-out infinite 0.5s;
}
@keyframes waSetupQrIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes waSetupQrGlow {
  0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(59, 130, 246, 0); }
  50% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(59, 130, 246, 0.2); }
}
.wa-setup-qr-frame img {
  display: block;
  width: min(260px, 72vw);
  height: auto;
}

.wa-setup-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 16px;
}
.wa-setup-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #d4a054;
  animation: waSetupSpin 0.85s linear infinite;
}
@keyframes waSetupSpin {
  to { transform: rotate(360deg); }
}

.wa-setup-steps-list {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.55;
}
.wa-setup-steps-list li {
  margin: 6px 0;
}
.wa-setup-steps-list strong {
  color: rgba(255, 255, 255, 0.85);
}

.wa-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.wa-setup-btn {
  flex: 1;
  min-width: 140px;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wa-setup-btn:active {
  transform: scale(0.98);
}
.wa-setup-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}
.wa-setup-btn-primary:hover {
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.45);
}
.wa-setup-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.wa-setup-success-icon {
  width: 64px;
  height: 64px;
  margin: 8px auto 16px;
  border-radius: 50%;
  background: rgba(91, 196, 159, 0.15);
  border: 2px solid rgba(91, 196, 159, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  animation: waSetupSuccessPop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes waSetupSuccessPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.wa-setup-loader .wa-setup-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.84rem;
}
.wa-setup-qr-hint {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}
.wa-setup-error-detail {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(220, 80, 80, 0.08);
  border: 1px solid rgba(255, 120, 120, 0.22);
  color: rgba(255, 200, 200, 0.92);
  line-height: 1.55;
}

body.wa-setup-locked #topbar,
body.wa-setup-locked #content,
body.wa-setup-locked #dock-wrapper,
body.wa-setup-locked #platform-bar,
body.wa-setup-locked #impersonation-bar,
body.wa-setup-locked #demo-banner {
  pointer-events: none;
  user-select: none;
}

@media (max-height: 820px) {
  .wa-setup-overlay {
    align-items: flex-start;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .wa-setup-shell {
    max-height: calc(100dvh - 28px);
  }
  .wa-setup-card {
    padding: 18px 18px 16px;
  }
  .wa-setup-progress-head {
    margin-bottom: 14px;
  }
  .wa-setup-milestones {
    margin-bottom: 14px;
  }
  .wa-setup-qr-frame {
    padding: 10px;
  }
  .wa-setup-qr-frame img {
    width: min(220px, 62vw);
  }
  .wa-setup-steps-list li {
    margin: 4px 0;
  }
  .wa-setup-actions {
    margin-top: 14px;
  }
}
