/* ══ Plantilla genérica de afiliados — mobile-first ══ */
:root {
  --primary: #00271b;      /* sobreescrito por branding del programa */
  --accent: #c0b840;       /* sobreescrito por branding del programa */
  --bg: #ffffff;
  --bg-soft: #f6f7f6;
  --ink: #1a1d1b;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
  --maxw: 640px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px; /* iOS: evita auto-zoom en inputs */
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.view { padding: 0 20px 32px; }
#app.loading .view { display: none; }
#app.loading #view-loading { display: block; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-logo { height: 32px; width: auto; border-radius: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-btn {
  border: 0; background: transparent; padding: 7px 12px; font-size: 13px; font-weight: 700;
  color: var(--muted); cursor: pointer; min-height: 36px;
}
.lang-btn.active { background: var(--primary); color: #fff; }

/* ── Botones ── */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 16px; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
  min-height: 48px; transition: transform .06s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-ghost { background: transparent; color: var(--primary); padding: 8px 14px; min-height: 36px; }
.btn-lg { font-size: 17px; padding: 15px 28px; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-sm { padding: 8px 14px; font-size: 14px; min-height: 40px; }

/* ── Hero ── */
.hero { text-align: center; padding: 40px 0 28px; }
.badge {
  display: inline-block; background: var(--accent); color: #1a1d1b;
  font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { font-size: 32px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.01em; }
.lede { font-size: 17px; color: var(--muted); margin: 0 0 24px; }
.hero-cta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
@media (min-width: 480px) { .hero-cta { flex-direction: row; justify-content: center; } }
.commission-card {
  background: var(--primary); color: #fff; border-radius: var(--radius);
  padding: 22px; display: inline-block; min-width: 240px;
}
.commission-amount { font-size: 44px; font-weight: 800; line-height: 1; }
.commission-label { font-size: 14px; opacity: .85; margin-top: 6px; }

/* ── Secciones ── */
.section { margin-top: 8px; }
.section h2 { font-size: 24px; margin: 28px 0 16px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li {
  counter-increment: step; background: var(--bg-soft); border-radius: var(--radius);
  padding: 16px 16px 16px 58px; position: relative;
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff;
  font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.steps li strong { display: block; margin-bottom: 2px; }
.steps li p { margin: 0; color: var(--muted); font-size: 15px; }

/* ── Cards & forms ── */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 18px; margin-top: 16px;
}
.tabs { display: flex; gap: 8px; margin: 24px 0 4px; }
.tab {
  flex: 1; padding: 12px; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 10px; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer; min-height: 48px;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.form label { display: block; margin: 14px 0; font-size: 14px; font-weight: 600; }
.form input, .form select {
  width: 100%; margin-top: 6px; padding: 13px 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.form input:focus, .form select:focus { outline: 2px solid var(--accent); border-color: var(--primary); }
.form h3 { margin: 0 0 4px; font-size: 20px; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; }
.success-card { border-color: var(--ok); }
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 800;
  letter-spacing: .08em; background: var(--bg-soft); border: 2px dashed var(--primary);
  border-radius: 10px; padding: 14px; text-align: center; margin: 12px 0; word-break: break-all;
}
.code-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.link-row { display: flex; gap: 8px; margin-top: 10px; }
.link-row input {
  flex: 1; min-width: 0; padding: 10px 12px; font-size: 13px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--muted);
}

/* ── Panel ── */
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--bg-soft); border-radius: 12px; padding: 14px 6px; text-align: center; }
.stat-num { font-size: 19px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.pill {
  display: inline-block; margin-top: 12px; padding: 8px 16px; border-radius: 999px;
  background: var(--accent); color: #1a1d1b; font-weight: 700; font-size: 14px;
}
.pill-ok { background: #dcfce7; color: var(--ok); }
.kyc-card { border: 2px solid var(--accent); }
.kyc-card h3 { margin-top: 0; }
.qr-card { text-align: center; }
.qr-img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); margin: 8px auto; display: block; }
.comm-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.comm-list li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.comm-amt { font-weight: 800; }
.comm-status { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.comm-status.pending { color: #b45309; }
.comm-status.paid { color: var(--ok); }
.kit-card { background: var(--bg-soft); }
.error-card { text-align: center; margin-top: 40px; }

/* ── Loading ── */
#view-loading { text-align: center; padding: 80px 20px; color: var(--muted); }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer {
  margin-top: auto; padding: 24px 20px 40px; text-align: center; font-size: 14px;
  border-top: 1px solid var(--line); color: var(--muted);
}
.footer a { color: var(--primary); font-weight: 600; }
.footer .dot { margin: 0 8px; }
.footer p { margin: 10px 0 0; }
