/* Programa de Referidos SIVOL — Kanagawa Dragon */
:root {
  color-scheme: dark;
  --bg: #16161d;
  --ink: #c5c9c5;
  --muted: #9cabca;
  --card: #1f1f28;
  --line: #2a2a37;
  --line-strong: #363646;
  --accent: #7e9cd8;
  --accent-2: #ffa066;
  --danger: #ff5d62;
  --ok: #98bb6c;
  --side: #1a1a22;
  --on-accent: #16161d;
  --ok-bg: #1a2e1f;
  --ok-line: #2f4a35;
  --danger-bg: #2e1a1c;
  --danger-line: #4a2a2e;
  font-family: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 500px at 10% -10%, #1f1f28 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #1a1a22 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
* { scrollbar-color: var(--line-strong) var(--bg); scrollbar-width: thin; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
img { max-width: 100%; height: auto; }
::selection { background: rgba(126, 156, 216, 0.35); }

.shell { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 5.5rem; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; background: var(--side); color: var(--ink);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top a { color: var(--ink); text-decoration: none; }
.top .brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; }
.top .brand img { display: block; background: #fff; border-radius: 6px; padding: 2px; width: 120px; height: auto; }
.top nav { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.top nav a {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 0.4rem 0.75rem;
  font-weight: 600; font-size: 0.95rem;
}
.top nav a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

main { flex: 1; width: min(720px, 100%); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.hero {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 4vw, 2rem); }
.hero p { margin: 0.35rem 0; color: var(--muted); }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.1rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.35rem;
}
.auth-stack { width: min(520px, 100%); margin: 0 auto; }
.auth-brand { text-align: center; margin-bottom: 1rem; }
.auth-brand img { background: #fff; border-radius: 8px; padding: 4px; }
.auth-brand h1 { margin: 0.75rem 0 0.25rem; font-size: 1.45rem; }
.lede { color: var(--muted); margin: 0.25rem 0 0; }

/* Landing (inicio): tarjetas de elección con botones iguales y alineados */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.choice-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
}
.choice-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.choice-card h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.choice-desc { margin: 0; color: var(--muted); line-height: 1.55; }
.choice-actions { margin-top: auto; padding-top: 1.25rem; }
.btn-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 3.4rem;
  padding: 0.9rem 1.25rem;
  border-radius: 12px;
  text-align: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.btn-choice:hover { filter: brightness(1.1); }
.btn-choice--alt { background: var(--accent-2); border-color: var(--accent-2); }
.choice-options { list-style: none; margin: 0.85rem 0 0; padding: 0; text-align: center; }
.choice-options li { margin: 0.3rem 0; font-size: 0.92rem; color: var(--muted); }

.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-bottom: 1rem; }
.auth-tabs a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.4rem;
  text-decoration: none; color: var(--ink); font-weight: 600; background: var(--card);
  min-height: 48px;
}
.auth-tabs a.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

form { display: grid; gap: 0.85rem; }
label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"] {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 0.75rem 0.85rem; background: var(--bg); color: var(--ink); min-height: 48px;
}
input::placeholder { color: var(--line-strong); }
input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 0.25rem; width: 1.1rem; height: 1.1rem; }

.captcha-box {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  background: var(--side); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem;
}
.captcha-q { font-weight: 700; flex: 1 1 140px; }
.captcha-box input { flex: 1 1 90px; width: auto; min-height: 44px; }
.captcha-box button {
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong);
  min-height: 44px; padding: 0.5rem 0.75rem; border-radius: 8px; font-weight: 600;
}
.captcha-box button:hover { background: var(--line); }

button, .btn {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px;
  padding: 0.85rem 1rem; cursor: pointer; min-height: 48px; font-weight: 600;
  text-align: center; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center;
}
button:disabled { background: var(--line-strong); color: var(--muted); cursor: not-allowed; }
button.ghost, .btn.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong);
}
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn-row > * { flex: 1 1 140px; }

.alert {
  background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line);
  border-radius: 10px; padding: 0.75rem 0.9rem;
}
.ok-box {
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line);
  border-radius: 10px; padding: 0.75rem 0.9rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.code-highlight {
  font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem;
  font-weight: 700; letter-spacing: 0.08em; background: var(--ok-bg); color: var(--ok);
  padding: 0.2rem 0.5rem; border-radius: 6px;
}

.modal-back {
  position: fixed; inset: 0; background: rgba(10, 10, 14, 0.65);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.modal-back[hidden] { display: none !important; }
.modal {
  background: var(--card); border-radius: 16px; width: min(440px, 100%);
  border: 1px solid var(--line-strong); overflow: hidden;
  max-height: 100%;
  display: flex; flex-direction: column;
}
.modal.wide { width: min(1000px, calc(100vw - 2rem)); }
.modal-head {
  flex: 0 0 auto;
  padding: 0.9rem 1.1rem; font-weight: 700; color: var(--ink); background: var(--side);
  border-bottom: 1px solid var(--line);
}
.modal.ok .modal-head { background: var(--ok); color: var(--on-accent); border-bottom: 0; }
.modal.error .modal-head { background: var(--danger); color: var(--on-accent); border-bottom: 0; }
.modal-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.1rem; display: grid; gap: 0.6rem; align-content: start;
}
.modal-body p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.modal-actions {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: flex-end; padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--line);
}
.modal-actions > * { flex: 0 1 auto; min-width: 150px; }

@media (max-width: 640px) {
  .modal-back {
    padding: 0.5rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }
  .modal, .modal.wide { width: 100%; border-radius: 14px; }
  .modal-actions > * { flex: 1 1 100%; }
}

.terms-box {
  max-height: 220px; overflow: auto; border: 1px solid var(--line);
  border-radius: 10px; padding: 0.85rem; background: var(--bg);
  font-size: 0.9rem; white-space: pre-wrap; color: var(--ink);
}

.payout-box {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem;
  margin: 0; min-width: 0; display: grid; gap: 0.6rem;
}
.payout-box legend { font-weight: 600; padding: 0 0.3rem; }

.preview-box {
  background: var(--ok-bg); border: 1px solid var(--ok-line); border-radius: 10px;
  padding: 0.75rem 0.9rem; display: grid; gap: 0.35rem; font-size: 0.95rem;
}
.preview-box[hidden] { display: none !important; }

.receipt-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.9rem; display: grid; gap: 0.45rem;
}
.receipt-box[hidden] { display: none !important; }
.receipt-line {
  display: flex; justify-content: space-between; gap: 0.75rem;
  flex-wrap: wrap; font-size: 0.95rem;
}
.receipt-line span { color: var(--muted); }
.receipt-line strong { text-align: right; word-break: break-all; }

footer.site {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  text-align: center; color: var(--muted); font-size: 0.85rem;
  padding: 0.55rem 1rem; border-top: 1px solid var(--line);
  background: var(--side);
}
footer.site p { margin: 0.15rem 0 0; }
footer.site a { color: var(--muted); }
.site-version { font-size: 0.78rem; }

.steps { display: grid; gap: 0.75rem; margin-top: 1rem; }
.step {
  display: grid; grid-template-columns: auto 1fr; gap: 0.75rem;
  background: var(--side); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.step-n {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.step strong { display: block; }
.step span { color: var(--muted); font-size: 0.92rem; }

@media (max-width: 520px) {
  .top { flex-direction: column; gap: 0.6rem; align-items: flex-start; }
  .auth-tabs { grid-template-columns: 1fr; }
}

/* Portal promotor (Fase 2) */
.status-pill {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700;
  background: var(--line); color: var(--ink); border: 1px solid var(--line-strong);
}
.status-pill.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.status-pill.warn { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.status-pill.muted-pill { background: var(--line); color: var(--muted); border-color: var(--line-strong); }
.portal-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1rem; align-items: start;
}
@media (max-width: 640px) {
  .portal-grid { grid-template-columns: 1fr; }
}
