:root {
  --bg: #020617;
  --panel-dark: #0f172a;
  --panel-dark-2: #1e293b;
  --panel-light: #f1f5f9;
  --ink: #1e293b;
  --ink-soft: #475569;
  --cream: #f8fafc;
  --cream-soft: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bright: #60a5fa;
  --accent-tint: #eff6ff;
  --line: #e2e8f0;
  --error-bg: #fff1f2;
  --error-ink: #be123c;
  --ok-bg: #ecfdf5;
  --ok-ink: #047857;
  --info-bg: #f1f5f9;
  --info-ink: #334155;
  --radius: 22px;

  /* Espaciados fluidos: crecen con el ancho de la pantalla entre un minimo y un maximo */
  --pad-x: clamp(24px, 5vw, 62px);
  /* En vertical se escala con el ALTO de la ventana para que la tarjeta quepa sin scroll */
  --pad-y: clamp(24px, 6vh, 70px);
  --pad-y-end: clamp(20px, 5vh, 56px);
  --body-pad-y: clamp(12px, 3.5vh, 32px);
  --field-h: clamp(46px, 7vh, 56px);
  --field-gap: clamp(12px, 2.6vh, 24px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(var(--body-pad-y), env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(var(--body-pad-y), env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: var(--bg);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.card {
  width: 100%;
  max-width: 1250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

/* ---------- Panel izquierdo ---------- */
.brand {
  background: linear-gradient(160deg, var(--panel-dark) 0%, var(--panel-dark-2) 100%);
  color: var(--cream);
  padding: var(--pad-y) var(--pad-x) var(--pad-y-end);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.logo-wrap { align-self: center; text-align: center; margin-bottom: clamp(14px, 3.5vh, 34px); }

.logo-halo {
  width: clamp(64px, 11vh, 110px); height: clamp(64px, 11vh, 110px);
  margin: 0 auto clamp(8px, 2vh, 18px);
  border-radius: 50%;
  background: #1e293b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
  display: grid; place-items: center;
}

.logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(45deg, #2563eb, #6366f1);
  box-shadow: 0 8px 20px rgba(59, 130, 246, .35);
  display: grid; place-items: center;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 20px;
}

.company { font-family: "Inter", system-ui, sans-serif; font-weight: 700; font-size: 22px; }

h1 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, min(3.4vw, 5.6vh), 46px);
  line-height: 1.1;
  margin: 0 0 clamp(12px, 2.5vh, 22px);
  text-wrap: balance;
}
h1 span { color: var(--accent-bright); }

.pitch { color: var(--cream-soft); font-size: clamp(15px, 1.3vw, 17px); line-height: 1.65; margin: 0 0 clamp(14px, 3vh, 30px); }

.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: #94a3b8; margin-bottom: 12px;
}

.panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.4vh, 12px);
  margin-bottom: clamp(16px, 3.5vh, 34px);
}

.panel-chip {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border: 1px dashed #334155;
  border-radius: 12px;
  background: rgba(0, 0, 0, .15);
}
.panel-chip svg { flex: none; color: #94a3b8; }
.panel-chip div { min-width: 0; }
.panel-chip strong { display: block; font-size: 15px; font-weight: 600; color: #cbd5e1; }
.panel-chip small { display: block; font-size: 13px; color: #94a3b8; }

.copy { margin-top: auto; color: var(--cream-soft); font-size: 16px; }
.copy-mobile { display: none; }

/* ---------- Panel derecho ---------- */
.form-side {
  background: var(--panel-light);
  padding: var(--pad-y) var(--pad-x) var(--pad-y-end);
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0;
}

h2 { font-family: "Inter", system-ui, sans-serif; font-weight: 700; font-size: clamp(26px, min(2.6vw, 5vh), 36px); line-height: 1.15; margin: 0 0 clamp(6px, 1.4vh, 12px); overflow-wrap: anywhere; }
.lead { color: var(--ink-soft); font-size: clamp(15px, 1.3vw, 17px); line-height: 1.5; margin: 0 0 clamp(16px, 3.5vh, 32px); }

label { display: block; font-weight: 600; font-size: 16px; margin-bottom: clamp(6px, 1.2vh, 10px); color: #334155; }

.field { position: relative; margin-bottom: var(--field-gap); }
.field svg.icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #64748b; pointer-events: none; }

.field input {
  width: 100%;
  height: var(--field-h);
  padding: 0 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  /* >= 16px evita que iOS haga zoom al enfocar */
  font: inherit; font-size: 17px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.field input::placeholder { color: #94a3b8; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.field input[readonly] { background: #f8fafc; color: var(--ink-soft); }
.field input.invalid { border-color: var(--error-ink); }

.hint { margin: calc(var(--field-gap) * -.6) 0 var(--field-gap); font-size: 14px; color: var(--ink-soft); }
.field-error { margin: -16px 0 20px; font-size: 14px; color: var(--error-ink); }

/* Area tactil de 44px (recomendacion de accesibilidad para moviles) */
.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border: 0; background: none; border-radius: 8px;
  color: #64748b; cursor: pointer; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.toggle-pass:hover { background: #f1f5f9; }
.toggle-pass:focus-visible { outline: 2px solid var(--accent); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 clamp(14px, 3.5vh, 34px); flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; color: #334155; cursor: pointer; font-weight: 400; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }

a.link { color: var(--accent-bright); font-size: 16px; display: inline-flex; align-items: center; min-height: 44px; }
a.link:hover { color: var(--accent); }

/* Botones con aspecto de enlace (acciones del paso de verificacion) */
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent-bright); font: inherit; font-size: 16px; text-decoration: underline;
  display: inline-flex; align-items: center; min-height: 44px;
}
.link-btn:hover { color: var(--accent); }
.link-btn:disabled { color: var(--ink-soft); text-decoration: none; cursor: default; }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Codigo de 6 digitos */
.field input.code-input {
  padding: 0 16px;
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 26px;
  letter-spacing: .45em;
  text-indent: .45em; /* compensa el espacio tras el ultimo digito para centrar */
}
.field input.code-input::placeholder { color: #cbd5e1; }
.code-actions { margin-top: clamp(10px, 2vh, 18px); margin-bottom: 0; }

.btn {
  width: 100%; min-height: clamp(46px, 7vh, 54px);
  padding: 10px 20px;
  border: 0; border-radius: 12px;
  background: var(--accent);
  color: #fff; font: inherit; font-size: 18px; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .4); outline-offset: 2px; }

.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-tint); }

.btn-sm { width: auto; min-height: 44px; padding: 8px 18px; font-size: 15px; }

.spinner { flex: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn-outline .spinner { border-color: rgba(37, 99, 235, .3); border-top-color: var(--accent); }
.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  margin-bottom: 22px; padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px; line-height: 1.45;
  overflow-wrap: anywhere;
  background: var(--error-bg); color: var(--error-ink);
}
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.info { background: var(--info-bg); color: var(--info-ink); }

.back { margin-top: clamp(4px, 1.5vh, 18px); text-align: center; }

.secure { margin-top: clamp(16px, 4vh, 42px); display: flex; justify-content: center; align-items: center; gap: 10px; color: #475569; font-size: 15px; text-align: center; }
.secure svg { flex: none; }

/* ---------- Inicio (selector de paneles) ---------- */
.user-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: clamp(-18px, -1.6vh, -8px) 0 clamp(14px, 3vh, 28px); color: var(--ink-soft); overflow-wrap: anywhere; }
.tag { padding: 4px 12px; border-radius: 999px; background: var(--accent-tint); color: #1d4ed8; font-size: 14px; font-weight: 500; }

.panel-wrap { container-type: inline-size; }
.panel-list { display: grid; gap: clamp(8px, 1.3vh, 12px); margin-bottom: clamp(14px, 3vh, 28px); }

.panel-item {
  display: flex; align-items: center; gap: 16px;
  padding: clamp(10px, 1.8vh, 18px) 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
a.panel-item:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(37, 99, 235, .12); transform: translateY(-1px); }
a.panel-item:focus-visible { outline: 3px solid rgba(37, 99, 235, .4); outline-offset: 2px; }
.panel-item .ico { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); display: grid; place-items: center; }
.panel-item .text { min-width: 0; flex: 1; }
.panel-item strong { display: block; font-size: 17px; }
.panel-item small { display: block; color: var(--ink-soft); font-size: 14px; }
.panel-item .go { margin-left: auto; color: var(--accent); font-weight: 600; white-space: nowrap; }
.panel-item.soon { opacity: .65; }
.panel-item.soon .go { color: var(--ink-soft); font-weight: 400; font-size: 14px; }

/* Si la lista es estrecha (movil o columna de tablet), el estado baja bajo el texto */
@container (max-width: 440px) {
  .panel-item { flex-wrap: wrap; row-gap: 6px; }
  .panel-item .text { flex: 1 1 calc(100% - 60px); }
  .panel-item .go { margin-left: 60px; font-size: 14px; }
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; white-space: nowrap; padding-inline: 14px; }

.skeleton { height: clamp(62px, 9vh, 82px); border-radius: 14px; background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =================== Puntos de corte =================== */

/* Pantallas muy grandes (>= 1800px): tarjeta y tipografia algo mayores */
@media (min-width: 1800px) {
  .card { max-width: 1440px; }
}

/* Portatiles pequenos / tablet horizontal: menos aire en la columna izquierda */
@media (max-width: 1100px) {
  .logo-halo { width: clamp(64px, 11vh, 92px); height: clamp(64px, 11vh, 92px); }
  .panels { grid-template-columns: 1fr 1fr; }
  .panel-chip { padding: 10px 12px; }
}

/* Tablets en vertical anchas (iPad Air/Pro): columna izquierda estrecha, paneles en una columna */
@media (max-width: 1000px) {
  .panels { grid-template-columns: 1fr; gap: 8px; }
}

/* Tablet vertical (<= 820px, iPad incluido) y menores: una columna. La marca pasa a ser una cabecera compacta */
@media (max-width: 820px) {
  body { align-items: flex-start; }
  .card { grid-template-columns: 1fr; max-width: 640px; }

  .brand { padding: 32px var(--pad-x) 28px; }
  .logo-wrap { display: flex; align-items: center; gap: 14px; align-self: flex-start; text-align: left; margin-bottom: 22px; }
  .logo-halo { width: 60px; height: 60px; margin: 0; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
  .logo { width: 38px; height: 38px; font-size: 17px; }
  .company { font-size: 20px; }

  .copy, .eyebrow, .panels { display: none; }
  .pitch { margin-bottom: 0; max-width: 60ch; }
  .copy-mobile { display: block; margin-top: 14px; text-align: center; color: #64748b; font-size: 14px; }

  .form-side { padding: 36px var(--pad-x) 32px; }
}

/* Moviles: la tarjeta ocupa toda la pantalla y solo se deja titulo + formulario */
@media (max-width: 600px) {
  body { padding: 0; background: var(--panel-light); display: block; }
  .card { max-width: none; min-height: 100vh; min-height: 100dvh; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; }

  .brand {
    padding:
      max(24px, env(safe-area-inset-top))
      max(20px, env(safe-area-inset-right))
      24px
      max(20px, env(safe-area-inset-left));
  }
  .logo-wrap { margin-bottom: 16px; }
  .logo-halo { width: 48px; height: 48px; }
  .logo { width: 32px; height: 32px; font-size: 15px; border-width: 1.5px; }
  .company { font-size: 18px; }
  h1 { margin: 0; }
  .pitch, .eyebrow, .panels { display: none; }

  .form-side {
    flex: 1;
    justify-content: flex-start;
    padding:
      28px
      max(20px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(20px, env(safe-area-inset-left));
  }
  .lead { margin-bottom: 24px; }
  .user-line { margin: -12px 0 22px; }
  .secure { margin-top: auto; padding-top: 28px; font-size: 14px; }
  .actions .btn { flex-basis: 100%; }
  .panel-item { padding: 14px 16px; gap: 14px; }
}

/* Moviles bajos (iPhone SE, Android pequenos): compactar para que el boton quepa sin scroll */
@media (max-width: 600px) and (max-height: 700px) {
  :root { --field-h: 50px; }
  .brand { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 14px; }
  .logo-wrap { margin-bottom: 8px; }
  .logo-halo { width: 40px; height: 40px; box-shadow: none; }
  .logo { width: 30px; height: 30px; font-size: 14px; }
  h1 { font-size: 22px; }
  .form-side { padding-top: 20px; }
  h2 { font-size: 24px; margin-bottom: 6px; }
  .lead { margin-bottom: 16px; font-size: 15px; }
  label { margin-bottom: 6px; font-size: 15px; }
  .field { margin-bottom: 14px; }
  .hint { margin: -8px 0 14px; }
  .row { margin: 0 0 14px; }
  .check, a.link { min-height: 40px; font-size: 15px; }
  .alert { margin-bottom: 14px; padding: 10px 14px; }
  .secure { padding-top: 18px; }
}

/* Moviles estrechos (<= 380px, p. ej. iPhone SE 1a gen, Galaxy Fold cerrado) */
@media (max-width: 380px) {
  :root { --field-h: 52px; }
  h1 { font-size: 24px; }
  h2 { font-size: 25px; }
  .field input { padding: 0 44px; font-size: 16px; }
  .field svg.icon { left: 14px; }
  .row { flex-direction: column; align-items: flex-start; gap: 0; }
  .btn { font-size: 17px; }
  .secure { font-size: 13px; }
}

/* Movil en horizontal o pantallas muy bajas: recortar alturas */
@media (max-height: 520px) and (orientation: landscape) {
  body { padding-top: 16px; padding-bottom: 16px; align-items: flex-start; }
  .brand { padding-top: 22px; padding-bottom: 20px; }
  .logo-wrap { margin-bottom: 12px; }
  .pitch, .eyebrow, .panels { display: none; }
  .form-side { padding-top: 24px; padding-bottom: 24px; justify-content: flex-start; }
  .lead { margin-bottom: 18px; }
  .secure { margin-top: 20px; }
}

/* Escritorio con poca altura (portatil 1366x768 con barras, ventanas reducidas) */
@media (min-width: 821px) and (max-height: 700px) {
  .panel-item .ico { width: 38px; height: 38px; }
  .panel-item strong { font-size: 16px; }

  /* Lista ancha: paneles de /inicio en cuadricula 2x2 (la mitad de alto) */
  @container (min-width: 520px) {
    .panel-list { grid-template-columns: 1fr 1fr; }
    .panel-item { flex-wrap: wrap; row-gap: 4px; padding: 12px 14px; gap: 12px; }
    .panel-item .text { flex: 1 1 calc(100% - 50px); }
    .panel-item small { font-size: 13px; }
    .panel-item .go { margin-left: 50px; font-size: 13px; }
  }

  /* Lista estrecha: una columna compacta, sin la descripcion y con el estado a la derecha */
  @container (max-width: 519px) {
    .panel-item { flex-wrap: nowrap; padding: 8px 14px; gap: 12px; }
    .panel-item .text { flex: 1 1 auto; }
    .panel-item small { display: none; }
    .panel-item .go { margin-left: auto; font-size: 13px; }
  }

  .actions .btn { font-size: 14px; min-height: 40px; }
}

/* Con raton no hace falta el area tactil de 44px en enlaces y casilla */
@media (pointer: fine) {
  a.link, .link-btn, .check { min-height: 0; }
  .row { padding: 4px 0; }
}

/* Escritorio con poca altura: la pista de contrasena pasa al placeholder */
@media (min-width: 821px) and (max-height: 760px) {
  :root { --body-pad-y: 12px; }
  .hint { display: none; }
}

/* Escritorio muy bajo (ventana reducida, zoom alto): se quita lo decorativo de la columna izquierda */
@media (min-width: 821px) and (max-height: 600px) {
  .eyebrow, .panels { display: none; }
  .pitch { margin-bottom: 0; }
  .lead { margin-bottom: 12px; }
  .secure { margin-top: 12px; }
}

/* Usuarios que piden menos animacion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
