/* Sign In, Create Account and OTP Verification (AuthStyle.swift): Inter, grey rounded fields, the dark pill button.
   White and 420px wide on phones; a white card on a grey ground on wider screens. */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--auth-ink);
  background: var(--surface);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 720px) {
  body.is-bare {
    background: var(--auth-backdrop);
  }
  .auth-page {
    background: var(--auth-backdrop);
  }
  .auth-card {
    max-width: 480px;
    padding: 52px 48px;
    border-radius: 28px;
    background: var(--surface);
    box-shadow: 0 18px 48px var(--auth-card-shadow);
  }
}

/* Back chevron */
.auth-back-row {
  padding-bottom: 44px;
}
/* Create Account: the Back button stays at the top while the form scrolls under it. */
.auth-back-row.is-pinned {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -48px -24px 44px;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 24px 4px;
  background: var(--surface);
}
@media (min-width: 720px) {
  .auth-back-row.is-pinned {
    margin: -52px -48px 44px;
    padding: 16px 48px 4px;
    border-radius: 28px 28px 0 0;
  }
}
.auth-back {
  width: 44px;
  height: 44px;
  margin-left: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--auth-ink);
}

/* Heading */
.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 36px;
  text-align: center;
}
.is-register .auth-header {
  padding-bottom: 32px;
}
.auth-title {
  font-size: 32px;
  font-weight: 500;
  text-wrap: balance;
}
.auth-subtitle {
  font-size: 15px;
  line-height: 1.4;
  color: var(--auth-muted);
}
.auth-subtitle.is-narrow {
  max-width: 265px;
}

.auth-notice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--auth-ok);
  background: var(--auth-ok-soft);
}
.auth-notice.is-error {
  color: var(--auth-error);
  background: var(--auth-error-soft);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

/* Fields */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}
.auth-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--auth-label);
}
.auth-box {
  height: 54px;
  padding: 0 20px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  border: 1.5px solid transparent;
  background: var(--auth-field);
  transition: background-color 0.15s, border-color 0.15s;
}
.auth-box:focus-within {
  background: var(--surface);
  border-color: var(--auth-link);
}
.auth-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--auth-ink);
}
.auth-input::placeholder {
  color: var(--auth-muted);
}
.auth-password {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-eye {
  width: 44px;
  height: 44px;
  margin-right: -12px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: var(--auth-ink);
}

/* Remember me · Forgot Password? */
.auth-options {
  margin: -14px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Checkbox: a real one, drawn over. */
.auth-checkbox {
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--auth-muted);
}
.auth-checkbox-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.auth-checkbox-mark {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 4px;
  border: 1.5px solid var(--auth-checkbox);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: transparent;
  transition: background-color 0.15s, border-color 0.15s;
}
.auth-checkbox-input:checked + .auth-checkbox-mark {
  border-color: var(--auth-button);
  background: var(--auth-button);
  color: #fff;
}
.auth-checkbox-input:focus-visible + .auth-checkbox-mark {
  outline: 2px solid var(--auth-link);
  outline-offset: 2px;
}
.auth-checkbox.is-large {
  gap: 12px;
  font-size: 15px;
  color: var(--auth-ink);
}
.auth-checkbox.is-large .auth-checkbox-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 13px;
}

/* Underlined links */
.auth-link {
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--auth-link);
}
.auth-link.is-large {
  font-size: 15px;
}

/* Referral code */
.referral-field {
  margin: -16px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.referral-box {
  align-self: stretch;
}
.referral-input {
  width: 100%;
  height: 54px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--auth-field);
  text-transform: uppercase;
}
.referral-input:focus {
  background: var(--surface);
  border-color: var(--auth-link);
}
.referral-input::placeholder {
  text-transform: none;
}

/* Agree with Terms & Conditions · Read our Privacy Policy */
.auth-terms {
  padding-bottom: 26px;
}
.auth-terms-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 15px;
}
.auth-terms-row.is-small {
  font-size: 14px;
  color: var(--auth-muted);
}

/* The dark pill */
.auth-button {
  height: 56px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--auth-button);
  transition: transform 0.1s, opacity 0.1s;
}
.auth-button:active {
  transform: scale(0.99);
  opacity: 0.9;
}
.auth-button:disabled {
  cursor: default;
  opacity: 0.85;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Don't have an account? Sign Up */
.auth-switch {
  padding-top: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 15px;
}

/* OTP Verification */
.otp-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
  text-align: center;
}
.otp-title {
  padding-bottom: 14px;
  font-size: 26px;
  font-weight: 600;
}
.otp-lead {
  padding-bottom: 10px;
  font-size: 15px;
  color: var(--auth-label);
}
.otp-email {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  color: var(--auth-link);
}

.code-entry {
  position: relative;
  margin-bottom: 44px;
}
.code-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.code-box {
  flex: 0 1 52px;
  min-width: 0;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--auth-ink);
  background: var(--surface);
  border: 1px solid var(--auth-line);
  box-shadow: 0 4px 12px var(--code-shadow);
  transition: border-color 0.15s;
}
.code-box.is-current {
  border: 1.5px solid var(--auth-link);
}
.code-entry.has-error .code-box {
  border: 1.5px solid var(--auth-error);
}
/* The real field covers the boxes, invisibly, so tapping anywhere on them types into it. */
.code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  opacity: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}

.resend {
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.resend-countdown {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--auth-label);
}
.resend-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  font-size: 15px;
  color: var(--auth-muted);
}
.resend-action {
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--auth-link);
}
.resend-action:disabled {
  cursor: default;
  text-decoration: none;
  color: var(--auth-muted);
  opacity: 0.7;
}
.resend-tip {
  font-size: 13px;
  color: var(--auth-muted);
}

/* Forgot Password / Reset Password: the last field sits closer to the button, and the code boxes to the fields. */
.auth-field.is-last {
  padding-bottom: 8px;
}
.code-entry.is-compact {
  margin-bottom: 32px;
}
