/* ------------------------------------------------------------------
   Pantalla de ingreso — minimal oscuro.
   Se carga sólo en /login, después de app.css. Hereda la paleta de la app
   (--bg, --panel, --line, --ink, --mut, --accent) para que el login y el
   dashboard se sientan el mismo producto. Scope: body.auth-body.
   ------------------------------------------------------------------ */

body.auth-body {
  --a-ink:      var(--ink);
  --a-mut:      var(--mut);
  --a-line:     var(--line);
  --a-line-str: #3d4c62;   /* línea del input en reposo: visible sin gritar */
  --a-accent:   var(--accent);
  --a-danger:   #f87171;
  --a-ok:       #4ade80;

  min-height: 100vh;
  /* Halo frío detrás del formulario: da profundidad sin dibujar una card. */
  background-image: radial-gradient(58rem 30rem at 50% -8%, #17202c 0%, var(--bg) 68%);
  -webkit-font-smoothing: antialiased;
}

body.auth-body main.centered {
  min-height: 100vh;
  padding: 32px 20px;
}

.auth {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

/* ---- Encabezado -------------------------------------------------- */

.auth-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  border: 1px solid var(--a-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #1e2836 0%, #182130 100%);
  color: var(--a-accent);
  box-shadow: 0 1px 0 0 rgb(255 255 255 / .04) inset,
              0 6px 18px -8px rgb(0 0 0 / .6);
}

.auth-title {
  margin: 0 0 26px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--a-ink);
}
/* Si algún día vuelve a haber subtítulo, el aire lo aporta él. */
.auth-title:has(+ .auth-sub) { margin-bottom: 6px; }

.auth-sub {
  margin: 0 0 28px;
  font-size: 13.5px;
  color: var(--a-mut);
}

/* ---- Alertas ----------------------------------------------------- */

.auth-alert {
  margin-bottom: 18px;
  padding: 9px 12px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}
.auth-alert-error { background: #2a1313; border-color: #5e1d1d; color: #fecaca; }
.auth-alert-info  { background: #13243b; border-color: #284b7a; color: #cddffa; }
.auth-alert-ok    { background: #0f2a1a; border-color: #1d5e38; color: #bbf7d0; }

/* ---- Campos ------------------------------------------------------ */

.auth-form { text-align: left; }

.field { position: relative; margin-bottom: 6px; }

/* Input sin caja: sólo una línea inferior. */
.auth-form .field-input {
  width: 100%;
  margin: 0;
  padding: 22px 0 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--a-line-str);
  border-radius: 0;
  color: var(--a-ink);
  font-size: 15px;
  transition: border-color .15s ease;
}
.auth-form .field-input:hover { border-bottom-color: var(--a-mut); }
.auth-form .field-input:focus {
  outline: 0;
  border-bottom-color: var(--a-accent);
  box-shadow: 0 1px 0 0 var(--a-accent);  /* engrosa la línea sin mover el layout */
}
/* Deja lugar al ojo de mostrar/ocultar. */
#password.field-input { padding-right: 34px; }

/* Label flotante: descansa sobre el placeholder vacío y sube al escribir/enfocar. */
.auth-form .field-label {
  position: absolute;
  left: 0;
  top: 22px;
  margin: 0;
  color: var(--a-mut);
  font-size: 15px;
  pointer-events: none;
  transition: top .15s ease, font-size .15s ease, color .15s ease;
}
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label {
  top: 2px;
  font-size: 11.5px;
  letter-spacing: .02em;
  color: var(--a-mut);
}
.field-input:focus + .field-label { color: var(--a-accent); }

/* Autofill de Chrome: pinta un fondo blanco que rompe el tema oscuro.
   El box-shadow interno lo tapa y -webkit-text-fill-color arregla el texto. */
.auth-form .field-input:-webkit-autofill,
.auth-form .field-input:-webkit-autofill:hover,
.auth-form .field-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--a-ink);
  -webkit-box-shadow: 0 0 0 100px #141c27 inset;
  caret-color: var(--a-ink);
  transition: background-color 9999s;
}

.field-toggle {
  position: absolute;
  right: 0;
  bottom: 4px;
  display: flex;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--a-mut);
  cursor: pointer;
}
.field-toggle:hover { color: var(--a-ink); }
.field-toggle:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 1px; }

.caps-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--warn);
}

/* ---- Botón ------------------------------------------------------- */

.auth-submit {
  width: 100%;
  margin-top: 26px;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--a-accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: filter .15s ease, transform .06s ease;
}
.auth-submit:hover { filter: brightness(1.1); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }

/* Estado enviando: bloquea el doble submit y lo comunica. */
.auth-submit[aria-busy="true"] { filter: saturate(.5) brightness(.85); cursor: progress; }
.auth-submit[aria-busy="true"] .label::after {
  content: "";
  display: inline-block;
  width: 11px; height: 11px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid rgb(255 255 255 / .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .6s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-foot {
  margin: 30px 0 0;
  font-size: 11.5px;
  color: var(--a-mut);
}

@media (prefers-reduced-motion: reduce) {
  body.auth-body * { transition: none !important; animation: none !important; }
}
