.page-auth {
  min-height: var(--vh);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page-auth #main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page-auth .site-footer {
  display: none;
}

.auth-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: var(--sp-3) var(--container-pad) var(--sp-4);
  padding-bottom: calc(var(--sp-4) + var(--safe-bottom));
}

.auth-page--top {
  justify-content: flex-start;
}

.auth-page--center {
  justify-content: center;
}

.auth-page > .breadcrumbs {
  width: 100%;
  max-width: 26rem;
  padding-top: 0;
  padding-bottom: var(--sp-3);
  justify-content: center;
  text-align: center;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: var(--sp-5) var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

.auth-card--wide {
  max-width: 26rem;
}

.auth-card__header {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.auth-card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--c-brand-bg);
  color: var(--c-brand-dark);
}

.auth-card__icon svg {
  width: 22px;
  height: 22px;
}

.auth-card__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

@media (max-width: 1023px) {
  .auth-card__title {
    font-size: var(--fs-page-title);
  }
}

.auth-card__lead {
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
  line-height: 1.45;
  max-width: 34ch;
  margin: 0;
}

.auth-form {
  display: grid;
  gap: var(--sp-3);
}

.auth-form .field {
  gap: var(--sp-1);
}

.auth-form .field__label {
  font-size: var(--fs-xs);
  line-height: 1.3;
}

.auth-form .field__input {
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  font-size: 16px;
  border-radius: var(--r-sm);
}

.auth-form .btn {
  margin-top: var(--sp-2);
  min-height: 48px;
  text-transform: none;
  letter-spacing: 0.02em;
}

.auth-form .field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

.auth-form .field--checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--c-brand-dark);
}

.auth-form .field--checkbox .field__label {
  font-weight: 400;
  line-height: 1.35;
}

.auth-card__footer {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}

.auth-card__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
}

.auth-card__links a {
  color: var(--c-brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t-fast);
}

.auth-card__links a:hover {
  color: var(--c-brand);
}

.auth-card__sep {
  color: var(--c-border-strong);
  user-select: none;
}

.auth-card__message {
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
  line-height: 1.45;
  text-align: center;
  margin: 0;
}

/* —— Mobile —— */
@media (max-width: 767px) {
  .page-auth .auth-page {
    padding: var(--sp-3) var(--container-pad) calc(var(--sp-4) + var(--bottom-nav-h) + var(--safe-bottom));
  }

  .page-auth .auth-page--center {
    justify-content: center;
  }

  .page-auth .auth-page--top {
    justify-content: flex-start;
    padding-top: var(--sp-3);
  }

  .page-auth .auth-page > .breadcrumbs {
    padding-bottom: var(--sp-3);
  }

  .page-auth .auth-card {
    max-width: none;
    width: 100%;
    padding: var(--sp-5) var(--sp-4);
    border-radius: var(--r-md);
  }

  .page-auth .auth-card__header {
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
  }

  .page-auth .auth-card__lead {
    max-width: none;
    padding-inline: var(--sp-1);
  }

  .page-auth .auth-form {
    gap: var(--sp-3);
  }

  .page-auth .auth-form .field__input {
    min-height: 44px;
    /* iOS Safari: prevents auto-zoom on focus */
    font-size: 16px;
  }

  .page-auth .auth-form .btn {
    min-height: 48px;
    margin-top: var(--sp-2);
  }

  .page-auth .auth-card__footer {
    margin-top: var(--sp-4);
    padding-top: var(--sp-3);
  }
}

/* —— Tablet —— */
@media (min-width: 768px) and (max-width: 1023px) {
  .auth-page {
    padding: var(--sp-4) var(--container-pad) calc(var(--sp-4) + var(--bottom-nav-h) + var(--safe-bottom));
  }

  .auth-card {
    padding: var(--sp-5) var(--sp-5);
  }

  .auth-card__header {
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
  }
}

/* —— Desktop —— */
@media (min-width: 1024px) {
  .auth-page {
    padding: var(--sp-4) var(--container-pad);
  }

  .auth-card {
    padding: var(--sp-6) var(--sp-5);
  }
}

/* Short tablet/desktop viewports only — do not crush mobile portrait */
@media (max-height: 820px) and (min-width: 768px) {
  .auth-page > .breadcrumbs {
    padding-bottom: var(--sp-2);
  }

  .auth-card__header {
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
  }

  .auth-form {
    gap: var(--sp-2);
  }

  .auth-form .field__input {
    min-height: 40px;
  }

  .auth-form .btn {
    min-height: 44px;
    margin-top: var(--sp-1);
  }

  .auth-card__footer {
    margin-top: var(--sp-3);
    padding-top: var(--sp-2);
  }
}

/* Very short mobile landscape: mild tighten, keep icon + lead */
@media (max-height: 500px) and (max-width: 767px) {
  .page-auth .auth-page {
    justify-content: flex-start;
    padding-block: var(--sp-2);
  }

  .page-auth .auth-card {
    padding: var(--sp-4) var(--sp-3);
  }

  .page-auth .auth-card__header {
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
  }

  .page-auth .auth-card__icon {
    width: 36px;
    height: 36px;
  }

  .page-auth .auth-card__icon svg {
    width: 18px;
    height: 18px;
  }

  .page-auth .auth-form {
    gap: var(--sp-2);
  }

  .page-auth .auth-form .field__input {
    min-height: 40px;
  }

  .page-auth .auth-form .btn {
    min-height: 44px;
  }
}

.field--password .field__password-wrap {
  position: relative;
  display: block;
}

.field--password .field__input {
  padding-right: 2.75rem;
  width: 100%;
}

.field__password-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--c-text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.field__password-toggle:hover,
.field__password-toggle:focus-visible {
  color: var(--c-brand);
}

.field__hint {
  margin-top: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
  line-height: 1.4;
}
