/* KNOX BANK — sign in and registration.
 *
 * Scoped to .auth-page, and deliberately small: the form controls, the button
 * and the panel all come from components.css. What is here is the centred
 * page, the field error state, the in-flight button, and the panel that
 * explains a new account is not switched on yet.
 *
 * Every colour is an existing token. No shadow: nothing on this screen floats.
 */

.auth-page {
  display: flex;
  min-height: 100dvh;
  padding: clamp(24px, 7vh, 72px) 20px;
  background: var(--canvas);
}

/* Mounted inside the app shell rather than as the whole page. */
.auth-page.auth-embedded {
  min-height: 0;
  padding-block: 8px;
}

/* Centred with auto margins rather than align-items, which clips the top of
   anything taller than the viewport on a short screen. */
.auth-column {
  width: 100%;
  max-width: 410px;
  margin: auto;
}

/* Brand, above the card rather than inside it. */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}
.auth-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
}
.auth-brand > span { display: grid; gap: 1px; }
.auth-brand strong { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.1em; }
.auth-brand-sub { color: var(--text-muted); font-size: 0.76rem; }

.auth-card {
  background: var(--surface-solid);
  padding: 26px;
}

.auth-page .auth-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.auth-lede {
  max-width: 48ch;
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* Form ------------------------------------------------------------------- */

.auth-form { margin: 0; }
.auth-field { margin-bottom: 14px; }
.auth-field:last-of-type { margin-bottom: 18px; }

.auth-optional {
  margin-left: 7px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.auth-hint,
.auth-field-error {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  line-height: 1.45;
}
.auth-hint { color: var(--text-faint); }
.auth-field-error { color: var(--danger); font-weight: 600; }

/* Error state on an input: the stroke changes, nothing glows. */
.auth-page .in[aria-invalid="true"] { border-color: var(--danger); }
.auth-page .in[aria-invalid="true"]:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 18%, transparent);
}

/* The form-level refusal. Icon plus wording, so it survives greyscale. */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--danger) 45%, transparent);
  border-radius: var(--r-md);
  background: color-mix(in oklab, var(--danger) var(--tint), var(--surface-solid));
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.5;
}
.auth-alert-icon { flex: none; margin-top: 2px; color: var(--danger); }

/* Submit button in flight. Width is pinned in JS so the label swap is silent. */
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}
.auth-spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid color-mix(in oklab, var(--on-accent) 40%, transparent);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: authSpin 700ms linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  /* The word next to it carries the meaning, so a still ring is enough. */
  .auth-spinner { animation: none; }
}

/* Numbered explanation, shared by the register form and the pending panel. */
.auth-next {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.auth-next-head { margin-bottom: 8px; }
.auth-next-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-next-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.auth-next-list li > .d {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  padding-top: 2px;
}

/* Switch between the two screens. */
.auth-switch {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.auth-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-link:hover { color: var(--accent-hover); }

.auth-foot {
  max-width: 44ch;
  margin: 16px auto 0;
  color: var(--text-faint);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

/* After registering ------------------------------------------------------- */

.auth-pending-status { margin: 0 0 12px; }
.auth-pending-email {
  font-family: var(--f-data);
  font-size: 0.8125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.auth-page .auth-back { margin-top: 4px; }

@media (max-width: 600px) {
  .auth-page { padding: 20px 12px 32px; }
  .auth-card { padding: 18px; }
  .auth-page .auth-title { font-size: 1.35rem; }
}
