* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  line-height: var(--line-height-base);
  background-color: var(--color-brand-neutral);
  background-image:
    radial-gradient(
      ellipse at top left,
      rgba(255, 255, 255, 0.55) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at bottom right,
      rgba(3, 53, 114, 0.06) 0%,
      transparent 60%
    );
  color: var(--color-text-primary);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}

.auth-card {
  position: relative;
  width: min(var(--auth-card-max-width), 100%);
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  padding: var(--space-7);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* La franja amarilla brand ahora vive como border-bottom del panel navy
   (.auth-brand), separando el área del logo del formulario. */

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--color-brand-blue-dark);
  /* Sangra el panel azul a los bordes y la parte superior de la card */
  margin: calc(var(--space-7) * -1) calc(var(--space-7) * -1) var(--space-5);
  padding: var(--space-6) var(--space-4);
  min-height: 132px;
  border-bottom: 4px solid var(--color-brand-yellow);
}

.auth-brand .auth-logo {
  display: block;
  margin: 0 auto;
  max-width: min(240px, 100%);
  height: auto;
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.auth-brand .auth-logo[hidden] {
  display: none !important;
}

/* Fallback textual cuando aún no hay site_logo: se ve sobre el panel navy */
.auth-brand h1 {
  margin: 0;
  color: #ffffff;
  font-family: var(--font-family-heading);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
}

.auth-card.has-site-logo .auth-brand h1 {
  display: none;
}

h1 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-brand-blue-dark);
}

.subtitle {
  margin: 0 0 var(--space-5);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.tab {
  border: 1px solid var(--color-border-default);
  background: var(--color-surface-muted);
  color: var(--color-brand-blue);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.tab:hover:not(.is-active) {
  background: #ffffff;
  border-color: var(--color-brand-blue);
}

.tab.is-active {
  background: var(--color-action-primary);
  border-color: transparent;
  color: var(--color-action-primary-text);
  font-weight: 700;
}

.tab:active {
  border-color: transparent;
}

.alerts {
  min-height: var(--space-6);
  margin-bottom: var(--space-3);
  font-size: var(--font-size-sm);
}

/* Checkbox de consentimiento de datos en el registro */
.form-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--font-size-xs);
  line-height: 1.45;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.form-consent input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--color-brand-blue);
  cursor: pointer;
}

.form-consent a {
  color: var(--color-brand-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.alerts.is-error {
  color: var(--color-text-error);
}

.alerts.is-success {
  color: var(--color-text-success);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.is-hidden {
  display: none !important;
}

.site-footer {
  margin-top: auto;
  padding: var(--space-4) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.site-footer p {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
}

.site-footer a {
  color: var(--color-brand-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--color-brand-blue-dark, var(--color-brand-blue));
}

/*
 * En el HUD el footer va sobre el fondo amarillo y necesita más contraste.
 * Lo dejamos sobre una banda blanca translúcida para que se lea sin estridencia.
 */
.site-footer--hud {
  background: rgba(255, 255, 255, 0.78);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.form-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.form label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.form input {
  width: 100%;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: 10px var(--space-3);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  background: #ffffff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form input:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 3px var(--color-action-primary-soft);
}

.form button.btn,
.auth-card button.btn {
  margin-top: var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
  padding: 12px 14px;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transform-origin: center center;
  box-shadow: var(--shadow-button);
  will-change: transform, box-shadow;
  transition: background 0.18s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.form button.btn:hover:not(:disabled),
.auth-card button.btn:hover:not(:disabled) {
  background: var(--color-brand-yellow);
  box-shadow:
    0 0 0 4px var(--color-action-primary-soft),
    var(--shadow-button-hover);
  transform: translateY(-1px);
}

.form button.btn:active,
.auth-card button.btn:active {
  border-color: transparent;
}

.form button.btn:disabled,
.auth-card button.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form button.btn-secondary {
  margin-top: var(--space-2);
  border: 1px solid var(--color-brand-blue);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--color-brand-blue-dark);
  padding: 10px 14px;
  font-size: var(--font-size-md);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transform-origin: center center;
  box-shadow: none;
  will-change: transform;
  transition: background 0.15s ease;
}

.form button.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-muted);
}

.form button.btn-secondary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form button.btn-secondary:active {
  border-color: transparent;
}

.helper-link {
  margin-top: var(--space-4);
}

.helper-link a {
  color: var(--color-brand-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.helper-link a:hover {
  color: var(--color-brand-blue-dark);
}
