/* DAVID CLOUD · hoja de estilos */
@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Syne"; src: url("/fonts/syne-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Syne"; src: url("/fonts/syne-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #0a0a0b;
  --red: #c1000f;
  --red-hi: #e0141f;
  --violet: #2a0f3d;
  --text: #f4f4f5;
  --muted: #a3a3ad;
  --faint: #8b8b95;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(18, 18, 21, 0.58);
  --field: rgba(255, 255, 255, 0.04);
  --focus: #ff5c68;
  --ok: #34d399;
  --bad: #ff6b75;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --radius: 22px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- fondo: aurora + grano ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.a1 { width: 70vmax; height: 55vmax; left: -20vmax; top: -25vmax; background: radial-gradient(closest-side, rgba(193, 0, 15, 0.34), transparent 72%); animation: drift1 38s ease-in-out infinite alternate; }
.a2 { width: 65vmax; height: 60vmax; right: -25vmax; bottom: -30vmax; background: radial-gradient(closest-side, rgba(58, 16, 84, 0.5), transparent 70%); animation: drift2 46s ease-in-out infinite alternate; }
.a3 { width: 40vmax; height: 32vmax; left: 30%; top: 55%; background: radial-gradient(closest-side, rgba(120, 0, 20, 0.2), transparent 70%); animation: drift3 54s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate3d(12vmax, 8vmax, 0) rotate(18deg) scale(1.08); } }
@keyframes drift2 { to { transform: translate3d(-10vmax, -9vmax, 0) rotate(-14deg) scale(1.12); } }
@keyframes drift3 { to { transform: translate3d(-14vmax, -12vmax, 0) scale(0.9); } }
.grain {
  position: absolute; inset: -50%;
  opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::after { /* viñeta */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55));
}

/* ---------- estructura ---------- */
.shell {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  width: 100%; max-width: 440px; margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
}
.shell.wide { max-width: 720px; }

.brand { display: flex; align-items: center; justify-content: center; gap: 14px; animation: enter 300ms var(--ease) both; }
.mono { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 8px 22px rgba(193, 0, 15, 0.28)); }
.wordmark { font: 700 15px/1 "Syne", "Geist", sans-serif; letter-spacing: 0.34em; margin-right: -0.34em; text-transform: uppercase; color: var(--text); }

.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px 26px;
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: enter 300ms var(--ease) 40ms both;
}
.card::before { /* borde de luz superior */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 38%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card.shake { animation: enter 300ms var(--ease) both, shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97) 120ms both; }
@keyframes shake {
  15% { transform: translateX(-7px); } 35% { transform: translateX(6px); }
  55% { transform: translateX(-4px); } 75% { transform: translateX(2px); } 100% { transform: none; }
}

.foot { text-align: center; color: var(--faint); font-size: 12.5px; letter-spacing: 0.04em; animation: enter 300ms var(--ease) 80ms both; }

/* ---------- tipografía ---------- */
h1 { font: 600 24px/1.2 "Geist", sans-serif; letter-spacing: -0.02em; margin: 0 0 6px; text-wrap: balance; }
h2 { font: 600 16px/1.3 "Geist", sans-serif; letter-spacing: -0.01em; margin: 0 0 4px; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--faint); font-size: 13px; margin-top: 8px; }
.eyebrow { display: inline-block; font-size: 11.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: #ff8a92; margin-bottom: 10px; }
.card-head { margin-bottom: 22px; }
.card-head.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
a:hover { text-decoration-color: currentColor; }
b { font-weight: 600; color: var(--text); }

/* ---------- foco visible ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 10px; }

/* ---------- formularios ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: #d4d4d8; margin-bottom: 7px; }
input[type="text"], input[type="password"] {
  width: 100%; height: 48px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input[type="text"]:hover, input[type="password"]:hover { border-color: rgba(255, 255, 255, 0.24); }
input[type="text"]:focus-visible, input[type="password"]:focus-visible {
  outline: none; border-color: var(--focus); background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(255, 92, 104, 0.18);
}
input[aria-invalid="true"] { border-color: rgba(255, 107, 117, 0.6); }
.mono-input { font-family: ui-monospace, "SF Mono", Menlo, monospace !important; letter-spacing: 0.12em; text-transform: uppercase; }

.pw { position: relative; }
.pw input { padding-right: 86px; }
.pw-toggle {
  position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 12px;
  font: 500 13px "Geist", sans-serif; color: var(--muted);
  background: transparent; border: 0; border-radius: 9px; cursor: pointer;
  transition: color 140ms, background-color 140ms;
}
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.check { display: flex; align-items: center; gap: 11px; font-size: 14px; color: #d4d4d8; cursor: pointer; user-select: none; position: relative; }
.check input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.check-box {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--field);
  display: grid; place-items: center;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.check-box::after {
  content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg) scale(0.6); opacity: 0;
  transition: opacity 140ms var(--ease), transform 200ms var(--ease);
}
.check input:checked + .check-box { background: var(--red); border-color: var(--red-hi); }
.check input:checked + .check-box::after { opacity: 1; transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- botones ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 50px; padding: 0 20px; margin-top: 4px;
  font: 600 15px "Geist", sans-serif; letter-spacing: -0.005em; color: #fff; text-decoration: none;
  background: linear-gradient(180deg, #d90a19 0%, var(--red) 100%);
  border: 1px solid rgba(255, 120, 130, 0.35);
  border-radius: 14px; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 10px 28px -10px rgba(193, 0, 15, 0.75);
  transition: transform 120ms var(--ease), filter 160ms var(--ease), box-shadow 200ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--line-strong); box-shadow: none; color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.09); filter: none; }
.btn.small { width: auto; height: 40px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; margin: 0; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spinner {
  display: none; width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 700ms linear infinite;
}
.btn.is-loading { cursor: progress; filter: saturate(0.85); }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px; font-size: 13.5px; color: var(--muted); }
.links a { color: var(--muted); }
.links a:hover { color: var(--text); }
.inline { display: inline; margin: 0; }
.link-btn { font: inherit; color: var(--muted); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
.link-btn:hover { color: var(--text); }

/* ---------- avisos ---------- */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 18px;
  font-size: 14px; color: #ffd6d9;
  background: rgba(193, 0, 15, 0.14); border: 1px solid rgba(255, 107, 117, 0.32); border-radius: 13px;
}
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; fill: none; stroke: var(--bad); stroke-width: 1.8; stroke-linecap: round; }
.alert-sub { color: #f3b4b9; font-size: 13px; margin-top: 2px; }
.notice { padding: 11px 14px; margin-bottom: 18px; font-size: 14px; color: #c7f5df; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.28); border-radius: 13px; }

.state-icon { width: 56px; height: 56px; margin: 2px auto 18px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-strong); }
.state-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--text); stroke-width: 1.7; stroke-linecap: round; }
.state-icon.danger { background: rgba(193, 0, 15, 0.16); border-color: rgba(255, 107, 117, 0.35); }
.state-icon.danger svg { stroke: var(--bad); }

/* ---------- OTP ---------- */
.otp-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-box {
  width: 100%; min-width: 0; height: 58px; padding: 0;
  text-align: center; font: 600 24px/1 "Geist", sans-serif; font-variant-numeric: tabular-nums; color: var(--text);
  background: var(--field); border: 1px solid var(--line-strong); border-radius: 13px; caret-color: var(--focus);
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.otp-box:nth-child(3) { margin-right: 6px; }
.otp-box:focus-visible { outline: none; border-color: var(--focus); background: rgba(255, 255, 255, 0.07); box-shadow: 0 0 0 4px rgba(255, 92, 104, 0.18); transform: translateY(-1px); }
.otp-box.filled { border-color: rgba(255, 255, 255, 0.3); }

/* ---------- configurar 2FA ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 4px; }
.step-n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font: 600 13px "Geist", sans-serif; color: #ffd6d9; background: rgba(193, 0, 15, 0.18); border: 1px solid rgba(255, 107, 117, 0.3); }
.step-body { min-width: 0; }
.step-body > .muted { margin-bottom: 14px; }
.qr-wrap { display: flex; }
.qr { width: 196px; max-width: 100%; padding: 10px; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.8); }
.qr svg { display: block; width: 100%; height: auto; }
.manual { margin-top: 14px; font-size: 14px; }
.manual summary { cursor: pointer; color: var(--muted); width: fit-content; border-radius: 6px; }
.manual summary:hover { color: var(--text); }
.secret-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.secret { font: 500 14px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.06em; padding: 8px 11px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); word-break: break-all; }
.codes { list-style: none; margin: 0 0 12px; padding: 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 14px; }
.codes code { font: 500 14px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.08em; color: #e4e4e7; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 12px; font: 500 13px "Geist", sans-serif; color: var(--text);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer;
  transition: background-color 140ms, transform 120ms var(--ease);
}
.chip:hover { background: rgba(255, 255, 255, 0.1); }
.chip:active { transform: scale(0.97); }
.chip.done { color: #c7f5df; border-color: rgba(52, 211, 153, 0.4); }

/* ---------- hub ---------- */
.hub-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.services { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.services li { animation: enter 300ms var(--ease) both; }
.services li:nth-child(1) { animation-delay: 90ms; }
.services li:nth-child(2) { animation-delay: 130ms; }
.services li:nth-child(3) { animation-delay: 170ms; }
.service {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  padding: 16px; text-decoration: none; color: var(--text);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 17px;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 120ms var(--ease);
}
.service:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.service:active { transform: scale(0.985); }
.service:focus-visible { border-radius: 17px; }
.svc-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(160deg, rgba(193, 0, 15, 0.28), rgba(42, 15, 61, 0.35)); border: 1px solid rgba(255, 255, 255, 0.1); }
.svc-icon svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.svc-text { display: flex; flex-direction: column; min-width: 0; }
.svc-name { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.svc-desc { color: var(--muted); font-size: 13.5px; }
.svc-host { color: var(--faint); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b6b75; }
.svc-status[data-state="checking"] .dot { animation: pulse 1.2s ease-in-out infinite; }
.svc-status[data-state="up"] { color: #b7f0d6; border-color: rgba(52, 211, 153, 0.3); }
.svc-status[data-state="up"] .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.svc-status[data-state="down"] { color: #ffc2c7; border-color: rgba(255, 107, 117, 0.32); }
.svc-status[data-state="down"] .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }
.svc-arrow svg { width: 18px; height: 18px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; transition: transform 200ms var(--ease), stroke 200ms; }
.service:hover .svc-arrow svg { stroke: var(--text); transform: translate(2px, -2px); }

/* ---------- celular ---------- */
@media (max-width: 480px) {
  .shell { gap: 22px; }
  .card { padding: 24px 18px 20px; border-radius: 20px; }
  h1 { font-size: 22px; }
  .otp { gap: 6px; }
  .otp-box { height: 52px; font-size: 22px; border-radius: 12px; }
  .otp-box:nth-child(3) { margin-right: 4px; }
  .step { grid-template-columns: 1fr; gap: 10px; }
  .hub-head { flex-direction: column-reverse; gap: 14px; }
  .hub-head form { align-self: flex-end; }
  .service { grid-template-columns: auto 1fr auto; gap: 12px; padding: 14px; }
  .svc-arrow { display: none; }
  .svc-status .status-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .svc-status { padding: 8px; }
  .codes { grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; }
  .codes code { font-size: 13px; }
}

/* ---------- menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .aurora { animation: none !important; }
  .card.shake { animation: none !important; }
  .btn:active, .chip:active, .service:active { transform: none; }
  .spinner { animation: spin 1.4s linear infinite !important; }
}
