/* ==========================================================================
   SYNTX · RECUPERAR ACCESO
   Celular: pantalla completa tipo app (barra arriba, pasos con progreso, botón al alcance del pulgar).
   PC: la misma app dentro de una tarjeta centrada.
   ========================================================================== */
:root {
  --rc-bg: #06070a;
  --rc-card: #0c0f1a;
  --rc-line: rgba(255, 255, 255, 0.08);
  --rc-soft: rgba(255, 255, 255, 0.04);
  --rc-text: #f8fafc;
  --rc-sub: #94a3b8;
  --rc-muted: #64748b;
  --rc-accent: #818cf8;
  --rc-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #ec4899 100%);
  --rc-ok: #34d399;
  --rc-bad: #fb7185;
  --rc-warn: #fbbf24;
  --rc-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --rc-head: 'Outfit', var(--rc-font);
  --rc-mono: 'JetBrains Mono', ui-monospace, monospace;
  --rc-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body.rc {
  font-family: var(--rc-font); font-size: 13px; color: var(--rc-text); background: var(--rc-bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.rc-glow {
  position: fixed; inset: -20% -10% auto; height: 60vh; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 60% at 30% 30%, rgba(99, 102, 241, 0.22), transparent 70%),
              radial-gradient(50% 50% at 80% 10%, rgba(236, 72, 153, 0.14), transparent 70%);
  filter: blur(10px);
}

/* ---------- La app (celular: pantalla completa) ---------- */
.rc-app {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  max-width: 440px; margin: 0 auto;
}

.rc-bar { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 8px; height: 46px; }
.rc-back, .rc-badge { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; font-size: 1.05rem; }
.rc-back { background: var(--rc-soft); border: 1px solid var(--rc-line); color: #e2e8f0; transition: background 150ms ease; }
.rc-back:active { background: rgba(255, 255, 255, 0.1); }
.rc-badge { color: var(--rc-accent); }
.rc-bar-tx { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.rc-bar-tx b { font-size: 0.82rem; font-weight: 700; }
.rc-bar-tx small { font-size: 0.66rem; font-weight: 600; color: var(--rc-muted); }

.rc-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 4px 0 0; }
.rc-progress i { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; position: relative; }
.rc-progress i::after { content: ''; position: absolute; inset: 0; background: var(--rc-grad); transform: scaleX(0); transform-origin: left; transition: transform 420ms var(--rc-ease); }
.rc-app[data-step="1"] .rc-progress i:nth-child(-n+1)::after,
.rc-app[data-step="2"] .rc-progress i:nth-child(-n+2)::after,
.rc-app[data-step="3"] .rc-progress i:nth-child(-n+3)::after,
.rc-app[data-step="4"] .rc-progress i:nth-child(-n+4)::after,
.rc-app[data-step="5"] .rc-progress i::after { transform: scaleX(1); }

/* ---------- Encabezado del paso ---------- */
.rc-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px 0 14px; }
.rc-ic {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-size: 1.3rem; color: #fff;
  background: var(--rc-grad); box-shadow: 0 10px 24px -12px rgba(139, 92, 246, 0.9);
}
.rc-hero h1 { margin-top: 6px; font-family: var(--rc-head); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.rc-hero p { font-size: 0.8rem; line-height: 1.45; color: var(--rc-sub); max-width: 34ch; }
.rc-app[data-step="5"] .rc-hero { display: none; }

/* ---------- Aviso ---------- */
.rc-msg { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 9px 11px; border-radius: 11px; font-size: 0.76rem; font-weight: 600; line-height: 1.4; animation: rcIn 260ms var(--rc-ease); }
.rc-msg i { flex-shrink: 0; margin-top: 1px; font-size: 0.95rem; }
.rc-msg.is-error { color: #fecdd3; background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.3); }
.rc-msg.is-error i { color: var(--rc-bad); }
.rc-msg.is-success { color: #bbf7d0; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); }
.rc-msg.is-success i { color: var(--rc-ok); }
.rc-msg.is-info { color: #fde68a; background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.28); }
.rc-msg.is-info i { color: var(--rc-warn); }

/* ---------- Pasos ---------- */
.rc-step { display: none; flex: 1; flex-direction: column; gap: 12px; }
.rc-step.is-on { display: flex; animation: rcIn 320ms var(--rc-ease); }
.rc-step.is-back { animation-name: rcBack; }
@keyframes rcIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes rcBack { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.rc-field { display: flex; flex-direction: column; gap: 6px; }
.rc-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; color: #cbd5e1; }
.rc-input {
  position: relative; display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 12px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--rc-line); transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.rc-input:focus-within { border-color: rgba(129, 140, 248, 0.65); background: rgba(99, 102, 241, 0.06); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16); }
.rc-input > i { flex-shrink: 0; font-size: 1.05rem; color: var(--rc-muted); }
.rc-input:focus-within > i { color: var(--rc-accent); }
.rc-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 600; }
.rc-input input::placeholder { color: #475569; font-weight: 500; }
.rc-prefix { flex-shrink: 0; padding: 4px 7px; border-radius: 8px; font-style: normal; font-family: var(--rc-mono); font-size: 0.74rem; font-weight: 700; color: #c7d2fe; background: rgba(99, 102, 241, 0.14); }
#numero { font-family: var(--rc-mono); letter-spacing: 0.06em; }
.rc-ok { display: none; color: var(--rc-ok); font-size: 1.1rem; }
.rc-input.is-valid .rc-ok { display: block; animation: rcPop 260ms var(--rc-ease); }
@keyframes rcPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.rc-eye { flex-shrink: 0; width: 30px; height: 30px; display: grid; place-items: center; margin-right: -6px; border-radius: 9px; font-size: 1.05rem; color: var(--rc-muted); }
.rc-eye:active { background: rgba(255, 255, 255, 0.08); }

.rc-help { display: flex; gap: 7px; font-size: 0.72rem; line-height: 1.45; color: var(--rc-sub); }
.rc-help i { flex-shrink: 0; margin-top: 1px; font-size: 0.9rem; color: var(--rc-accent); }
.rc-help b { color: #e2e8f0; font-weight: 700; overflow-wrap: anywhere; }

/* Correo enmascarado */
.rc-mail { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 13px; background: rgba(99, 102, 241, 0.07); border: 1px dashed rgba(129, 140, 248, 0.35); }
.rc-mail-ic { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 1.05rem; color: #c7d2fe; background: rgba(99, 102, 241, 0.16); }
.rc-mail-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rc-mail-tx small { font-size: 0.64rem; font-weight: 600; color: var(--rc-muted); }
.rc-mail-tx b { font-family: var(--rc-mono); font-size: 0.82rem; font-weight: 700; color: #e0e7ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Código: 6 casillas sobre un solo campo (pegar y autocompletar funcionan) */
.rc-otp { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.rc-otp input { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; border: 0; outline: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 2em; -webkit-text-fill-color: transparent; }
.rc-otp span {
  height: 52px; display: grid; place-items: center; border-radius: 12px; font-family: var(--rc-mono); font-size: 1.25rem; font-weight: 700;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--rc-line); transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.rc-otp span.is-filled { border-color: rgba(129, 140, 248, 0.45); background: rgba(99, 102, 241, 0.08); }
.rc-otp.is-focus span.is-current { border-color: var(--rc-accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }
.rc-otp.is-focus span.is-current::after { content: ''; width: 2px; height: 20px; border-radius: 2px; background: var(--rc-accent); animation: rcBlink 1s steps(1) infinite; }
.rc-otp.is-bad span { border-color: rgba(244, 63, 94, 0.55); animation: rcShake 320ms ease; }
@keyframes rcBlink { 50% { opacity: 0; } }
@keyframes rcShake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* Seguridad de la contraseña */
.rc-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: -4px; }
.rc-meter i { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); transition: background 200ms ease; }
.rc-meter small { grid-column: 1 / -1; font-size: 0.66rem; font-weight: 600; color: var(--rc-muted); }
.rc-meter[data-level="1"] i:nth-child(-n+1) { background: var(--rc-bad); }
.rc-meter[data-level="2"] i:nth-child(-n+2) { background: var(--rc-warn); }
.rc-meter[data-level="3"] i:nth-child(-n+3) { background: #a3e635; }
.rc-meter[data-level="4"] i { background: var(--rc-ok); }
.rc-meter[data-level="1"] small { color: var(--rc-bad); }
.rc-meter[data-level="2"] small { color: var(--rc-warn); }
.rc-meter[data-level="3"] small, .rc-meter[data-level="4"] small { color: var(--rc-ok); }
.rc-rules { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.rc-rules li { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 0.66rem; font-weight: 700; color: var(--rc-muted); background: var(--rc-soft); border: 1px solid var(--rc-line); transition: color 160ms ease, border-color 160ms ease; }
.rc-rules li i { font-size: 0.85rem; opacity: 0.4; }
.rc-rules li.is-ok { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.35); }
.rc-rules li.is-ok i { color: var(--rc-ok); opacity: 1; }

/* Botones: abajo, al alcance del pulgar */
.rc-actions { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 14px; }
.rc-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border-radius: 14px;
  font-size: 0.9rem; font-weight: 800; color: #fff; background: var(--rc-grad); box-shadow: 0 14px 28px -16px rgba(139, 92, 246, 0.95);
  transition: transform 120ms ease, opacity 160ms ease, filter 160ms ease;
}
.rc-btn:active { transform: scale(0.98); }
.rc-btn i { font-size: 1.05rem; }
.rc-btn:disabled { opacity: 0.45; cursor: default; }
.rc-btn.is-loading { pointer-events: none; }
.rc-btn.is-loading > * { visibility: hidden; }
.rc-btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: rcSpin 700ms linear infinite; }
@keyframes rcSpin { to { transform: rotate(360deg); } }
.rc-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 11px; font-size: 0.76rem; font-weight: 700; color: #a5b4fc; }
.rc-link:active { background: var(--rc-soft); }
.rc-link:disabled { color: var(--rc-muted); cursor: default; }
.rc-link b { font-family: var(--rc-mono); }

/* Listo */
.rc-done { align-items: center; justify-content: center; text-align: center; gap: 10px; padding-top: 10vh; }
.rc-done.is-on { display: flex; }
.rc-check svg { width: 76px; height: 76px; }
.rc-check circle { fill: rgba(16, 185, 129, 0.12); stroke: var(--rc-ok); stroke-width: 2; stroke-dasharray: 151; stroke-dashoffset: 151; animation: rcDraw 600ms var(--rc-ease) forwards; }
.rc-check path { fill: none; stroke: var(--rc-ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: rcDraw 420ms 380ms var(--rc-ease) forwards; }
@keyframes rcDraw { to { stroke-dashoffset: 0; } }
.rc-done h2 { margin-top: 6px; font-family: var(--rc-head); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.rc-done p { max-width: 30ch; font-size: 0.8rem; line-height: 1.5; color: var(--rc-sub); }
.rc-done .rc-actions { width: 100%; align-items: stretch; }
.rc-auto { font-size: 0.7rem; color: var(--rc-muted); }

.rc-foot { display: flex; align-items: center; justify-content: center; gap: 5px; padding-top: 14px; font-size: 0.64rem; font-weight: 600; color: #475569; }
.rc-foot i { color: var(--rc-muted); }

/* ---------- Celulares chicos: todo más compacto ---------- */
@media (max-width: 360px) {
  body.rc { font-size: 12px; }
  .rc-app { padding-left: 12px; padding-right: 12px; }
  .rc-bar { height: 42px; grid-template-columns: 32px 1fr 32px; }
  .rc-back, .rc-badge { width: 32px; height: 32px; border-radius: 10px; font-size: 0.95rem; }
  .rc-hero { padding: 16px 0 10px; gap: 5px; }
  .rc-ic { width: 36px; height: 36px; border-radius: 11px; font-size: 1.1rem; }
  .rc-hero h1 { font-size: 1.12rem; }
  .rc-hero p { font-size: 0.72rem; }
  .rc-step { gap: 10px; }
  .rc-input { height: 42px; border-radius: 11px; padding: 0 10px; }
  .rc-otp { gap: 5px; }
  .rc-otp span { height: 44px; border-radius: 10px; font-size: 1.05rem; }
  .rc-btn { height: 44px; border-radius: 12px; font-size: 0.82rem; }
  .rc-help, .rc-msg { font-size: 0.68rem; }
  .rc-mail { padding: 9px 10px; }
  .rc-mail-tx b { font-size: 0.74rem; }
}

/* Pantallas bajas (teclado abierto): se aprieta el encabezado */
@media (max-height: 600px) {
  .rc-hero { padding: 12px 0 8px; }
  .rc-ic { display: none; }
  .rc-hero h1 { margin-top: 0; font-size: 1.08rem; }
  .rc-done { padding-top: 2vh; }
}

/* ---------- PC y tablets: la misma app en una tarjeta centrada ---------- */
@media (min-width: 600px) {
  body.rc { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; }
  .rc-app {
    width: 100%; max-width: 420px; min-height: 600px; padding: 14px 24px 18px; border-radius: 24px;
    background: rgba(12, 15, 26, 0.92); border: 1px solid var(--rc-line); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .rc-btn:hover { filter: brightness(1.08); }
  .rc-back:hover { background: rgba(255, 255, 255, 0.08); }
  .rc-link:hover:not(:disabled) { color: #c7d2fe; }
}

@media (prefers-reduced-motion: reduce) {
  .rc-step.is-on, .rc-msg, .rc-input.is-valid .rc-ok { animation: none; }
  .rc-progress i::after { transition: none; }
  .rc-check circle, .rc-check path { animation: none; stroke-dashoffset: 0; }
}
