/* Auth pages — Giana design system */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
  box-sizing: border-box;
  background: var(--bg-page);
  font-family: var(--font-ui);
  color: var(--ink);
}

.auth-page__inner {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-6);
}

.auth-page__brand {
  display: flex;
  justify-content: center;
}

.auth-page__logo {
  display: block;
  height: 48px;
  width: auto;
}

.auth-page__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.auth-page__heading {
  text-align: center;
}

.auth-page__heading .giana-form-section__title {
  margin: 0;
}

.auth-page__heading .giana-form-section__description {
  margin: 6px 0 0;
}

.auth-page__heading .giana-form-section__description + .giana-form-section__description {
  margin-top: 4px;
}

.auth-page__company {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  margin-top: 14px;
  padding: 10px 14px;
  box-sizing: border-box;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  text-align: center;
}

.auth-page__company-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-plate);
  background: transparent;
  border: none;
  color: var(--ink-muted);
}

.auth-page__company-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-page__company-fallback {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1;
  color: var(--ink-muted);
}

.auth-page__company-name {
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-page__fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-page__fields .giana-field:last-child {
  margin-bottom: 0;
}

.auth-page__fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.auth-page__fields-row .giana-field {
  min-width: 0;
  margin-bottom: var(--space-5);
}

.auth-page__fields-row:last-child .giana-field {
  margin-bottom: 0;
}

.auth-page__consents {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
}

/* Signup: denser form content only — logo/card chrome match login */
.auth-page--signup .auth-page__card {
  gap: var(--space-3);
}

.auth-page--signup .auth-page__fields .giana-field,
.auth-page--signup .auth-page__fields-row .giana-field {
  margin-bottom: var(--space-2);
}

.auth-page--signup .auth-page__fields .giana-field:last-child,
.auth-page--signup .auth-page__fields-row:last-child .giana-field {
  margin-bottom: 0;
}

.auth-page--signup .auth-page__fields .giana-label {
  margin-bottom: var(--space-1);
}

.auth-page--signup .auth-page__consents {
  gap: 10px;
  margin: 0;
}

.auth-page--signup .auth-page__consent .giana-checkbox__label {
  line-height: 1.3;
}

.auth-page--signup .auth-page__actions {
  gap: var(--space-2);
}

.auth-page--signup .auth-page__footer {
  gap: 0;
}

.auth-page__consent {
  align-items: flex-start;
}

.auth-page__consent .giana-checkbox__box {
  margin-top: -1px;
}

.auth-page__consent .giana-checkbox__label {
  font-size: var(--text-caption);
  line-height: 1.45;
}

.auth-page__consent .giana-checkbox__label a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-page__consent .giana-checkbox__label a:hover {
  color: var(--primary-hover, var(--primary));
}

.auth-page__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-page__divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-group);
}

.auth-page__divider::before,
.auth-page__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-page__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}

.auth-page__footer-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--ink-muted);
}

.auth-page__switch {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-page__switch-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-plate);
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  text-align: center;
}

.auth-page__switch-current {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-caption);
  color: var(--ink-muted);
  text-align: center;
  line-height: var(--leading-body);
}

.auth-page__switch-current strong {
  color: var(--ink);
  font-weight: 600;
}

.auth-page__fatal {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-5);
  text-align: center;
}

.auth-page__fatal-message {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-plate);
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  text-align: center;
}

.auth-page__card--fatal {
  gap: var(--space-4);
}

.auth-page__card--fatal .auth-page__heading .giana-form-section__description {
  margin-top: 8px;
}

.auth-page__meta {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

/* Password field with reveal toggle */
.auth-password-field {
  position: relative;
}

.auth-password-field .giana-input {
  padding-right: 48px;
}

.auth-password-field__toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-plate);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.auth-password-field__toggle:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.auth-password-field__toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.auth-password-field__toggle.is-revealed {
  color: var(--ink);
}

/* Google button */
.auth-google-btn {
  gap: 12px;
}

.auth-google-btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* OTP / 2FA digits */
.auth-otp {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.auth-otp__digit {
  width: 52px;
  height: 52px;
  padding: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 700;
  letter-spacing: 0;
}

.auth-otp__digit:disabled {
  background: var(--surface-alt);
  opacity: 0.7;
}

/* Login-as transient state */
.auth-page--transient .auth-page__card {
  align-items: center;
  text-align: center;
}

.auth-page__spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .auth-page {
    padding: var(--space-6) var(--space-4);
  }

  .auth-page__card {
    padding: var(--space-5);
  }

  .auth-page--signup .auth-page__fields-row {
    gap: var(--space-2);
  }

  .auth-otp__digit {
    width: 46px;
    height: 46px;
    font-size: var(--text-lg);
  }
}
