.app-auth-page {
  overflow-x: hidden;
}

.auth-page {
  position: relative;
  width: min(calc(100% - 2.5rem), 72rem);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: stretch;
  gap: clamp(1rem, 2.5vw, 1.5rem);
}

.auth-shell--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 38rem;
  margin-inline: auto;
}

.auth-form-panel--standalone {
  min-width: 0;
}

.auth-field__link {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-story,
.auth-form-panel {
  min-width: 0;
  height: 100%;
}

.auth-shell > .app-surface + .app-surface {
  margin-top: 0;
}

.auth-story {
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--app-primary-50) 95%, transparent), color-mix(in srgb, var(--app-surface) 98%, transparent) 58%),
    var(--app-surface);
}

.auth-story__body,
.auth-form-panel__body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.4rem);
}

.auth-story__intro h1,
.auth-form-panel__header h2 {
  margin: 0;
  color: var(--app-ink-950);
  font-family: var(--type-page-title-family);
  font-size: var(--type-page-title-size);
  font-weight: var(--type-page-title-weight);
  line-height: var(--type-page-title-line-height);
  letter-spacing: var(--type-page-title-letter-spacing);
  text-transform: var(--type-page-title-transform);
}

.auth-story__intro h1 {
  max-width: 13ch;
}

.auth-story__lede,
.auth-form-panel__header > p:last-child {
  margin: 0.8rem 0 0;
  color: var(--app-ink-600);
  font-family: var(--type-lead-family);
  font-size: var(--type-lead-size);
  font-weight: var(--type-lead-weight);
  line-height: var(--type-lead-line-height);
  letter-spacing: var(--type-lead-letter-spacing);
  text-transform: var(--type-lead-transform);
}

.auth-form-panel__header > p:last-child {
  max-width: 38rem;
}

.auth-product-visual {
  width: min(100%, 22rem);
  max-width: 100%;
  margin-block: clamp(1.5rem, 4vw, 2.25rem);
  overflow: hidden;
  border: 1px solid rgba(47, 120, 189, 0.24);
  border-radius: 1rem;
  background: var(--app-surface);
  box-shadow: 0 18px 45px rgba(11, 31, 51, 0.13);
}

.auth-product-visual__frame {
  min-width: 0;
}

.auth-product-visual__bar {
  min-width: 0;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  color: #e5f0fa;
  background: var(--app-primary-700);
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-line-height);
  letter-spacing: var(--type-caption-letter-spacing);
  text-transform: var(--type-caption-transform);
}

.auth-product-visual__brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.auth-product-visual__brand-mark,
.auth-product-visual__qr {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.auth-product-visual__brand-mark {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  gap: 0.08rem;
  padding: 0.22rem;
  border-radius: 0.35rem;
  color: var(--app-ink-950);
  background: var(--app-primary-100);
}

.auth-product-visual__brand-mark span,
.auth-product-visual__qr span {
  border-radius: 1px;
  background: currentColor;
}

.auth-product-visual__brand-mark span:nth-child(2),
.auth-product-visual__brand-mark span:nth-child(4),
.auth-product-visual__brand-mark span:nth-child(8),
.auth-product-visual__qr span:nth-child(2),
.auth-product-visual__qr span:nth-child(6),
.auth-product-visual__qr span:nth-child(8) {
  opacity: 0;
}

.auth-product-visual__location {
  min-width: 0;
  overflow: hidden;
  color: #cfe4f7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-product-visual__item {
  min-width: 0;
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.auth-product-visual__qr {
  width: 3.35rem;
  height: 3.35rem;
  gap: 0.17rem;
  padding: 0.45rem;
  border: 1px solid var(--app-line);
  border-radius: 0.65rem;
  color: var(--app-ink-950);
  background: var(--app-surface-muted);
}

.auth-product-visual__item-copy,
.auth-product-visual__count {
  min-width: 0;
  display: grid;
}

.auth-product-visual__item-copy {
  gap: 0.12rem;
}

.auth-product-visual__item-copy small,
.auth-product-visual__count small {
  color: var(--app-ink-600);
  font-family: var(--type-label-family);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  line-height: var(--type-label-line-height);
  letter-spacing: var(--type-label-letter-spacing);
  text-transform: var(--type-label-transform);
}

.auth-product-visual__item-copy strong {
  overflow: hidden;
  color: var(--app-ink-950);
  font-family: var(--type-card-title-family);
  font-size: var(--type-card-title-size);
  font-weight: var(--type-card-title-weight);
  line-height: var(--type-card-title-line-height);
  letter-spacing: var(--type-card-title-letter-spacing);
  text-transform: var(--type-card-title-transform);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-product-visual__item-copy > span:last-child {
  overflow: hidden;
  color: var(--app-ink-600);
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-line-height);
  letter-spacing: var(--type-caption-letter-spacing);
  text-transform: var(--type-caption-transform);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-product-visual__count {
  justify-items: end;
  gap: 0.1rem;
  padding-left: 0.65rem;
  border-left: 1px solid var(--app-line);
}

.auth-product-visual__count strong {
  color: var(--app-primary-800);
  font-family: var(--type-stat-family);
  font-size: var(--type-stat-size);
  font-weight: var(--type-stat-weight);
  line-height: var(--type-stat-line-height);
  letter-spacing: var(--type-stat-letter-spacing);
  text-transform: var(--type-stat-transform);
  font-variant-numeric: tabular-nums;
}

.auth-story__note {
  margin: auto 0 0;
  padding-top: 0.25rem;
  color: var(--app-ink-600);
  font-family: var(--type-supporting-family);
  font-size: var(--type-supporting-size);
  font-weight: var(--type-supporting-weight);
  line-height: var(--type-supporting-line-height);
  letter-spacing: var(--type-supporting-letter-spacing);
  text-transform: var(--type-supporting-transform);
}

.auth-story-steps {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-story-steps li {
  min-width: 0;
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
}

.auth-story-steps__number {
  width: 1.8rem;
  height: 1.8rem;
  display: inline-grid;
  place-items: center;
  border-radius: 0.55rem;
  color: #fff;
  background: var(--app-primary-700);
  font-family: var(--type-count-family);
  font-size: var(--type-count-size);
  font-weight: var(--type-count-weight);
  line-height: var(--type-count-line-height);
  letter-spacing: var(--type-count-letter-spacing);
  text-transform: var(--type-count-transform);
  font-variant-numeric: tabular-nums;
}

.auth-story-steps strong {
  display: block;
  color: var(--app-ink-900);
  font-family: var(--type-card-title-family);
  font-size: var(--type-card-title-size);
  font-weight: var(--type-card-title-weight);
  line-height: var(--type-card-title-line-height);
  letter-spacing: var(--type-card-title-letter-spacing);
  text-transform: var(--type-card-title-transform);
}

.auth-story-steps p {
  margin: 0.2rem 0 0;
  color: var(--app-ink-600);
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-line-height);
  letter-spacing: var(--type-caption-letter-spacing);
  text-transform: var(--type-caption-transform);
}

.auth-form-panel {
  background: color-mix(in srgb, var(--app-surface) 98%, transparent);
}

[data-bs-theme="dark"] .auth-product-visual {
  box-shadow: var(--app-shadow-md);
}

.auth-form-panel .app-feedback {
  margin: 1.25rem 0 0;
}

.auth-form {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 1.5rem;
}

.auth-form__fields {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.35rem);
}

.auth-field {
  min-width: 0;
  display: grid;
  gap: 0.42rem;
}

.auth-field .form-label,
.auth-field .form-text {
  margin: 0;
}

.auth-field .form-text {
  color: var(--app-ink-600);
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-line-height);
  letter-spacing: var(--type-caption-letter-spacing);
  text-transform: var(--type-caption-transform);
}

.auth-field .form-control::placeholder {
  color: var(--app-ink-600);
  opacity: 1;
}

.auth-remember {
  min-height: 0;
  margin: 0;
  padding-top: 0.1rem;
}

.auth-remember .form-check-input {
  margin-top: 0.2rem;
}

.auth-remember .form-check-label {
  color: var(--app-ink-700);
  font-family: var(--type-supporting-family);
  font-size: var(--type-supporting-size);
  font-weight: var(--type-supporting-weight);
  line-height: var(--type-supporting-line-height);
  letter-spacing: var(--type-supporting-letter-spacing);
  text-transform: var(--type-supporting-transform);
}

.auth-scanner-context {
  margin: -0.1rem 0 0 1.5rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--app-warning-700);
  border-radius: 0 0.65rem 0.65rem 0;
  background: var(--app-warning-50);
  color: var(--app-warning-text);
  font-family: var(--type-supporting-family);
  font-size: var(--type-supporting-size);
  line-height: 1.45;
}

.auth-name-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-form-actions {
  align-items: center;
  margin-top: auto;
  padding-top: 1.35rem;
}

.auth-form-actions__note {
  min-width: 0;
  margin: 0 auto 0 0;
  color: var(--app-ink-600);
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-line-height);
  letter-spacing: var(--type-caption-letter-spacing);
  text-transform: var(--type-caption-transform);
}

.auth-form-actions__note a {
  font-weight: var(--type-control-weight);
}

.auth-page :is(a, button, input):focus-visible {
  outline-color: var(--app-primary-600);
}

@media (max-width: 760px) {
  .auth-page {
    width: min(calc(100% - 1.25rem), 100%);
  }

  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-form-panel {
    order: -1;
  }

  .auth-story__body {
    gap: 1rem;
  }

  .auth-story .auth-product-visual {
    display: none;
  }

  .auth-story__body,
  .auth-form-panel__body {
    padding: clamp(1.1rem, 5vw, 1.5rem);
  }

  .auth-story__intro h1 {
    max-width: 16ch;
  }

  .auth-product-visual {
    width: min(100%, 30rem);
    margin-inline: auto;
  }

  .auth-name-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-page .app-form-actions {
    width: 100%;
    align-items: stretch;
  }

  .auth-page .app-form-actions .btn {
    width: 100%;
  }

  .auth-form-actions__note {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .auth-product-visual__location,
  .auth-product-visual__item-copy > span:last-child {
    display: none;
  }

  .auth-product-visual__item {
    grid-template-columns: 2.9rem minmax(0, 1fr) auto;
    gap: 0.6rem;
    padding: 0.8rem;
  }

  .auth-product-visual__qr {
    width: 2.9rem;
    height: 2.9rem;
    padding: 0.38rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-page *,
  .auth-page *::before,
  .auth-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Federated sign-in ---------------------------------------------------------------- */

.auth-providers {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

/* Full-width filled rows rather than outlined buttons: these sit below the credential
   form as the alternative path, so they should read as one calm stack rather than
   competing with the primary submit above them. */
/* Scoped through the container so it outranks `.app-authenticated a`, which would
   otherwise paint these link-blue. */
.auth-providers .auth-providers__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  background: var(--app-surface-muted);
  color: var(--app-ink-950);
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease;
}

.auth-providers .auth-providers__button:hover,
.auth-providers .auth-providers__button:focus-visible {
  background: var(--app-control-hover-bg);
  border-color: var(--app-line-strong);
  color: var(--app-ink-950);
  text-decoration: none;
}

.auth-providers .auth-providers__button:focus-visible {
  outline: 2px solid var(--app-focus-color);
  outline-offset: 2px;
}

.auth-providers__mark {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.auth-providers__mark--business {
  color: var(--app-primary-700, #24557a);
}

.auth-sso-explainer {
  display: grid;
  gap: 0.85rem;
}

.auth-sso-explainer > div {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.auth-sso-explainer > div > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--app-primary-100);
  color: var(--app-accent-text);
  font-weight: 800;
}

.auth-sso-explainer p,
.auth-sso-explainer small {
  display: block;
  margin: 0;
}

.auth-sso-explainer small {
  margin-top: 0.15rem;
  color: var(--bs-secondary-color);
  line-height: 1.45;
}

/* Divider between the provider buttons and the password form. */
.auth-providers__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.35rem 0 18px;
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-providers__divider::before,
.auth-providers__divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--bs-border-color);
}
