/* =====================================================================
   auth.css -- the public authentication pages
   ---------------------------------------------------------------------
   Sign in (index.php), the emailed sign-in code (verify-login.php),
   forgot password, reset password (code, then new password) and account
   setup. Markup: app/includes/partials/auth_layout_start.php and
   auth_layout_end.php. Loaded after base.css.

   The card and everything in it reproduce the Nama Sewage Network V2
   sign-in (its base.css components and auth.css, values unchanged): the
   colour Nama lockup at the top of a white 420px card with a short
   signature bar on its top edge, 48px fields with leading icons, the
   Show/Hide toggle, the live password checklist, the alerts, the code row
   (Verify + an icon-only Resend), the busy states and the entrance motion.
   The page AROUND the card is deliberately NOT V2's: Nama Asset keeps its
   own light background (V2's dark teal page and line drawing are left
   out), so the only values adapted here are the ones that sat on that dark
   page -- the card's outer shadow and the footer's text colours.

   Scoping: every rule is prefixed with .auth-body (the <body> class of the
   auth layout only). Each V2 selector therefore gains exactly one class,
   which keeps V2's own specificity order between its rules and lets them
   win over base.css's shared components -- without changing a single
   signed-in page. The tokens are pinned here too, always light: these
   pages never follow base.css's dark-mode overrides.

   ONE responsive layout, no separate desktop and mobile versions. The
   card is min(100%, 420px) inside a clamp()ed side gutter (16px on a
   320px phone, 32px from ~800px); logo, padding and gaps scale with
   clamp(); the column is centred with auto margins that collapse on a
   short window, so the page scrolls instead of clipping (phone with the
   keyboard open). Large displays draw the column larger as one unit.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Tokens (V2 values) and the page
   --------------------------------------------------------------------- */
.auth-body {
  color-scheme: light;

  --color-primary: #11464e;
  --color-primary-fill: #11464e;
  --color-primary-dark: #0a2e33;
  --color-primary-deep: #072226;
  --color-primary-light: #e6edec;
  --color-primary-hover: #0d3a41;
  --color-accent: #1c6f66;

  --color-signature: #1f9e89;
  --color-signature-strong: #137565;
  --color-signature-soft: #dcf2ec;

  --color-text: #17292c;
  --color-text-muted: #4b5a5d;
  --color-text-subtle: #627274;
  --color-text-inverse: #ffffff;

  --color-surface: #ffffff;
  --color-surface-muted: #f5f7f7;
  --color-surface-sunken: #eef2f1;

  --color-border-soft: #e1e7e6;
  --color-border: #d3dddb;
  --color-border-strong: #b7c8c3;
  --color-border-emphasis: #9db3ac;
  --color-border-field: #768c87;

  --color-success: #146c42;
  --color-success-bg: #dcf3e7;
  --color-success-border: #a6dcbf;
  --color-danger: #a3251e;
  --color-danger-hover: #841e18;
  --color-danger-bg: #fbeceb;
  --color-danger-border: #eab5b1;
  --color-warning: #8a5c00;
  --color-warning-bg: #faecc8;
  --color-warning-border: #e9cd8c;
  --color-info: #1c5d8a;
  --color-info-bg: #e8f2fa;
  --color-info-border: #b7d7ea;

  --font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;

  --focus-ring: 0 0 0 3px rgba(28, 111, 102, 0.24);
  --transition-fast: 0.15s ease;

  min-height: 100vh;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  /* Nama Asset's own sign-in background, unchanged. */
  background:
    radial-gradient(circle at top, rgba(17, 70, 78, 0.06), transparent 40%),
    linear-gradient(135deg, #eef3f2, #f7faf9);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.auth-body h1 {
  font-family: var(--font-family-display);
  font-weight: 650;
  line-height: 1.25;
  color: var(--color-primary-dark);
}

.auth-body a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.auth-body a:hover {
  color: var(--color-primary-dark);
}

.auth-body svg {
  max-width: 100%;
}

.auth-body strong {
  font-weight: 650;
}

.auth-body ::selection {
  background: var(--color-signature-soft);
  color: var(--color-primary-dark);
}

.auth-body :focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.auth-body [hidden] {
  display: none !important;
}

.auth-body .visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.auth-body .skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
}

.auth-body .skip-link:focus {
  transform: translateY(0);
  color: var(--color-text-inverse);
}

/* Inline stroke icons (nav_icon_svg) -- 24px grid, 1.8 stroke. */
.auth-body .icon-stroke {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.auth-body .icon-stroke svg {
  width: 18px;
  height: 18px;
}

.auth-body .icon-stroke svg path,
.auth-body .icon-stroke svg circle,
.auth-body .icon-stroke svg rect,
.auth-body .icon-stroke svg line,
.auth-body .icon-stroke svg polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------------
   Buttons (V2 base.css)
   --------------------------------------------------------------------- */
.auth-body .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 42px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform 0.1s ease;
}

.auth-body .btn:active:not(:disabled) {
  transform: translateY(1px);
}

.auth-body .btn:disabled,
.auth-body .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.auth-body .btn .icon-stroke svg {
  width: 16px;
  height: 16px;
}

.auth-body .btn-primary {
  background: var(--color-primary-fill);
  color: var(--color-text-inverse);
  box-shadow: 0 1px 2px rgba(10, 46, 51, 0.15);
}

.auth-body .btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
  box-shadow: 0 4px 12px rgba(10, 46, 51, 0.24);
}

.auth-body .btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-emphasis);
  color: var(--color-primary-dark);
  font-weight: 650;
}

.auth-body .btn-secondary:hover:not(:disabled) {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.auth-body .btn-block {
  display: flex;
  width: 100%;
}

/* Busy state: aria-busy="true" (auth.js) -- the label stays visible. */
.auth-body .btn[aria-busy="true"] {
  cursor: progress;
}

.auth-body .btn[aria-busy="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

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

/* ---------------------------------------------------------------------
   Form controls (V2 base.css)
   --------------------------------------------------------------------- */
.auth-body .form-group {
  margin-bottom: var(--space-4);
}

.auth-body .form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.auth-body .form-control {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  /* Field boundary meets WCAG 1.4.11 (>= 3:1 against white and its fill). */
  border: 1px solid var(--color-border-field);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: 1.4;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.auth-body .form-control::placeholder {
  color: var(--color-text-subtle);
}

.auth-body .form-control:hover:not(:disabled):not([readonly]) {
  border-color: #566b66;
}

/* base.css's own hover rule would otherwise reach a read-only field. */
.auth-body .form-control[readonly]:hover {
  border-color: var(--color-border-field);
}

.auth-body .form-control:focus {
  outline: none;
  background-color: var(--color-surface);
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.auth-body .form-control[aria-invalid="true"] {
  border-color: var(--color-danger);
  background-color: #fffafa;
}

.auth-body .form-control[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(163, 37, 30, 0.18);
}

.auth-body .form-control:disabled,
.auth-body .form-control[readonly] {
  background-color: var(--color-surface-sunken);
  color: var(--color-text-muted);
  cursor: default;
}

.auth-body .form-control:disabled {
  opacity: 0.75;
}

.auth-body .form-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.auth-body .form-hint:empty {
  display: none;
}

/* Password show/hide (auth.js: [data-password-toggle]). */
.auth-body .password-field-wrap {
  position: relative;
}

.auth-body .password-field-wrap .form-control {
  padding-right: 72px;
}

/* Edge draws its own reveal "eye" inside a password field while typing;
   these fields already have the Show/Hide toggle, so that second control
   is hidden. */
.auth-body .password-field-wrap input::-ms-reveal,
.auth-body .password-field-wrap input::-ms-clear {
  display: none;
}

.auth-body .password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-width: 56px;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-family: inherit;
  font-size: var(--font-size-xs);
  font-weight: 650;
  cursor: pointer;
}

.auth-body .password-toggle-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  text-decoration: none;
}

/* Live password-policy checklist (auth.js toggles .is-met on each
   <li data-rule="...">; the server re-validates every rule). */
.auth-body .password-rules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

@media (min-width: 480px) {
  .auth-body .password-rules {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-body .password-rules li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.auth-body .password-rules li::before {
  content: "";
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--color-border-emphasis);
  border-radius: 50%;
  background: var(--color-surface);
}

.auth-body .password-rules li.is-met {
  color: var(--color-success);
  font-weight: 600;
}

.auth-body .password-rules li.is-met::before {
  border-color: var(--color-success);
  background: var(--color-success) url("../images/check-white.svg") center / 10px 10px no-repeat;
}

/* ---------------------------------------------------------------------
   Alerts (V2 base.css)
   --------------------------------------------------------------------- */
.auth-body .alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: 1.45;
}

.auth-body .alert > .icon-stroke {
  margin-top: 1px;
}

.auth-body .alert-body {
  flex: 1;
  min-width: 0;
}

.auth-body .alert-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

.auth-body .alert-danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.auth-body .alert-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.auth-body .alert-info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: var(--color-info);
}

/* ---------------------------------------------------------------------
   Page frame (V2 auth.css, on Nama Asset's light background)
   --------------------------------------------------------------------- */
.auth-body .auth-layout {
  --auth-gutter: clamp(16px, 4vw, 32px);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--color-text);
}

/* The centred column. Centred while the window has room to spare; the
   auto margins collapse to zero when it has not, so the top is never cut
   off. */
.auth-body .auth-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-block: auto;
  padding: clamp(20px, 4vh, 56px) var(--auth-gutter) clamp(16px, 3vh, 40px);
}

.auth-body .auth-main {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Target of the skip link (tabindex="-1"): no ring around the region. */
.auth-body .auth-main:focus {
  outline: none;
}

/* ---------------------------------------------------------------------
   The card: pure white with a short signature bar centred on its top
   edge. V2 lifts it off a DARK page with a faint light rim and a deep
   shadow; on this light page the same three layers are drawn in the
   brand's dark teal at low strength (rim, contact shadow, soft lift), so
   the card keeps a clear edge without a heavy grey halo.
   --------------------------------------------------------------------- */
.auth-body .auth-card {
  --card-pad-x: clamp(20px, 5.5vw, 40px);
  position: relative;
  width: min(100%, 420px);
  padding: clamp(28px, 4vh, 40px) var(--card-pad-x) clamp(24px, 3.4vh, 36px);
  /* Transparent border: invisible here, drawn in forced-colours mode. */
  border: 1px solid transparent;
  border-radius: clamp(14px, 3vw, var(--radius-xl));
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow:
    0 0 0 1px rgba(10, 46, 51, 0.08),
    0 2px 6px rgba(10, 46, 51, 0.07),
    0 30px 70px rgba(10, 46, 51, 0.14);
}

.auth-body .auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: clamp(64px, 26%, 104px);
  height: 4px;
  transform: translateX(-50%);
  border-radius: 0 0 4px 4px;
  background: var(--color-signature);
}

/* The colour Nama lockup at the top of the card on every screen size,
   scaled with the viewport -- 156px on a phone, about 189 at 768, 210 at
   1024 and 230 from 1280 -- with trimmed gaps so the card stays compact. */
.auth-body .auth-card--brand {
  padding-top: clamp(28px, 3.6vh, 36px);
}

.auth-body .auth-card-brand {
  display: flex;
  justify-content: center;
  margin-bottom: clamp(20px, 2.8vh, 28px);
}

.auth-body .auth-card-logo {
  display: block;
  width: clamp(156px, 8vw + 128px, 230px);
  height: auto;
}

.auth-body .auth-card--centered {
  text-align: center;
}

/* Alerts, hints and forms keep left-aligned text inside a centred card. */
.auth-body .auth-card--centered .alert,
.auth-body .auth-card--centered .auth-hint,
.auth-body .auth-card--centered .auth-form {
  text-align: left;
}

.auth-body .auth-card-header {
  margin-bottom: clamp(16px, 2.6vh, 24px);
}

.auth-body .auth-title {
  margin: 0;
  font-size: clamp(1.5rem, 1.3rem + 0.75vw, 1.75rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--color-primary-dark);
  overflow-wrap: break-word;
}

.auth-body .auth-lead {
  margin: var(--space-2) 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

/* Status icon above the heading, with a soft halo. */
.auth-body .auth-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(48px, 4vw + 36px, 54px);
  height: clamp(48px, 4vw + 36px, 54px);
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--color-signature-soft);
  color: var(--color-signature-strong);
  box-shadow: 0 0 0 7px rgba(220, 242, 236, 0.5);
}

.auth-body .auth-card-icon .icon-stroke svg {
  width: 25px;
  height: 25px;
}

.auth-body .auth-card-icon--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  box-shadow: 0 0 0 7px rgba(250, 236, 200, 0.5);
}

.auth-body .auth-card-icon--danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  box-shadow: 0 0 0 7px rgba(251, 236, 235, 0.6);
}

/* Messages always wrap inside the card, whatever they contain. */
.auth-body .auth-card .alert {
  overflow-wrap: anywhere;
}

/* Last block of the card: the back link. */
.auth-body .auth-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: clamp(16px, 2.6vh, 24px);
  padding-top: clamp(12px, 1.8vh, 16px);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

/* ---------------------------------------------------------------------
   Card content
   --------------------------------------------------------------------- */
.auth-body .auth-form .form-group {
  margin-bottom: clamp(16px, 2.2vh, 20px);
}

.auth-body .auth-card .form-control {
  height: 48px;
}

.auth-body .auth-card .password-field-wrap .form-control {
  padding-right: 76px;
}

.auth-body .auth-card .password-toggle-btn {
  right: 4px;
  min-height: 40px;
  font-size: var(--font-size-sm);
}

/* A field with a leading icon (sign in: mail, lock). The icon is
   decorative (aria-hidden) and never takes a click; the text starts after
   it, and the Show button keeps its own space on the right. */
.auth-body .auth-input {
  position: relative;
}

.auth-body .auth-input .form-control {
  padding-left: 44px;
}

.auth-body .auth-input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.auth-body .auth-input:focus-within .auth-input-icon {
  color: var(--color-accent);
}

/* Field hints and the password checklist stay readable on a phone. */
.auth-body .auth-card .form-hint {
  font-size: var(--font-size-sm);
  line-height: 1.45;
}

/* Slightly tighter insets, so the longest rule ("Both passwords match")
   stays on one line in each of the two columns of the 420px card. */
.auth-body .auth-card .password-rules {
  padding-inline: var(--space-3);
  font-size: 0.8125rem;
}

.auth-body .auth-card .password-rules li {
  gap: 6px;
}

/* Grows the toggle's hit area to the input's full 48px height without
   changing how it looks. */
.auth-body .auth-card .password-toggle-btn::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.auth-body .auth-card .password-toggle-btn:focus-visible {
  outline-offset: 0;
}

/* 12px apart from the field above: the link's 44px tap area (below) then
   starts where the input ends instead of overlapping it. */
.auth-body .auth-field-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-3);
}

/* Text links in the card. The padding/negative-margin pair gives a 44px
   tap target without adding space to the layout. */
.auth-body .auth-link {
  display: inline-block;
  margin: -12px 0;
  padding: 12px 0;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 20px;
  color: var(--color-primary);
  text-decoration: none;
}

.auth-body .auth-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* The same link look on a button: account setup's "Resend code", which
   submits its own small form. Disabled during the resend cooldown. */
.auth-body button.auth-link {
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.auth-body button.auth-link:disabled {
  color: var(--color-text-subtle);
  text-decoration: none;
  cursor: not-allowed;
}

.auth-body .auth-submit {
  min-height: 48px;
  font-size: 0.9375rem;
}

.auth-body .auth-form .auth-submit {
  margin-top: var(--space-2);
}

/* Sign in (index.php): the primary button, 48px tall, full width. */
.auth-body .auth-signin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: clamp(20px, 3vh, 28px);
}

.auth-body .auth-form .auth-signin-actions .auth-submit {
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
}

/* The arrow is drawn by CSS so auth.js can swap the button's text
   (data-busy-label) without losing it; hidden while signing in. */
.auth-body .auth-signin-actions .auth-submit::after {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.auth-body .auth-signin-actions .auth-submit[aria-busy="true"]::after {
  display: none;
}

/* .passkey-signin is the [data-passkey-login] block of passkey.js;
   display: contents lets its button and message join the Sign in row, and
   when passkey.js hides the block ([hidden] wins) Sign in takes the full
   width. 48px tall on every screen; Sign in keeps at least ~180px beside
   the 52px passkey button even on a 320px phone. */
.auth-body .passkey-signin {
  display: contents;
}

/* The compact icon-only action beside a primary button: the passkey (sign
   in) and Resend code (the code pages). Each is named by a visually hidden
   label (passkey.js swaps the passkey's to "Waiting for passkey..." while
   busy) and its title gives mouse users the same words. */
.auth-body .auth-passkey-btn,
.auth-body .auth-resend-btn {
  flex: 0 0 auto;
  width: 52px;
  min-height: 48px;
  padding: 0;
  color: var(--color-primary);
}

.auth-body .auth-passkey-btn .icon-stroke svg,
.auth-body .auth-resend-btn .icon-stroke svg {
  width: 24px;
  height: 24px;
}

.auth-body .passkey-signin .alert {
  flex: 1 0 100%;
  margin: 0;
}

@keyframes auth-resend-busy {
  50% {
    opacity: 0.35;
  }
}

/* Caps Lock notice under a password field (filled in by auth.js). */
.auth-body .auth-capslock {
  margin: 6px 0 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-warning);
}

.auth-body .auth-capslock:empty {
  display: none;
}

.auth-body .auth-text {
  margin: 0 0 var(--space-4);
  line-height: 1.6;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.auth-body .auth-text-small {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* Quiet information panel. */
.auth-body .auth-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-4);
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.auth-body .auth-hint p {
  margin: 0;
}

.auth-body .auth-hint .icon-stroke {
  margin-top: 1px;
  color: var(--color-signature-strong);
}

/* The (masked) address a code was sent to. */
.auth-body .auth-email-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  margin: 0 0 var(--space-5);
  padding: 9px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  font-weight: 600;
  color: var(--color-primary-dark);
  overflow-wrap: anywhere;
}

/* As the last line of the card's introduction: the introduction's own
   bottom margin follows it. */
.auth-body .auth-card-header .auth-email-chip {
  margin: var(--space-4) 0 0;
}

.auth-body .auth-email-chip .icon-stroke {
  color: var(--color-signature-strong);
}

.auth-body .auth-actions {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.auth-body .auth-actions form {
  margin: 0;
}

.auth-body .auth-card-header + .auth-actions {
  margin-top: 0;
}

/* Verification codes: large, spaced digits. */
.auth-body .auth-code-input {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-align: center;
}

/* The code field, then Verify with the compact Resend button beside it.
   Verify and Resend stay in their own forms (separate POST actions);
   display: contents lays both forms out as this one grid. */
.auth-body .auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-3);
}

.auth-body .auth-code-row > form {
  display: contents;
}

.auth-body .auth-code-row .form-group {
  grid-column: 1 / -1;
}

/* After .auth-form .auth-submit, so the Verify button lines up with Resend. */
.auth-body .auth-code-row .auth-submit {
  margin-top: 0;
}

/* The invited address on the account setup form: shown, never editable. */
.auth-body .auth-readonly-field .form-control[readonly] {
  background: var(--color-surface-muted);
  color: var(--color-text);
  cursor: default;
}

/* "Back to sign in" */
.auth-body .auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.auth-body .auth-back-link:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  text-decoration: none;
}

.auth-body .auth-back-link .icon-stroke svg {
  width: 16px;
  height: 16px;
}

/* ---------------------------------------------------------------------
   Footer: the access notice and the partnership line -- stacked on a
   phone, one line with a quiet divider from 480px. Dark text, as the
   page behind it is light.
   --------------------------------------------------------------------- */
.auth-body .auth-footer {
  padding: 0 var(--auth-gutter) clamp(14px, 2.6vh, 28px);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
  color: var(--color-text-muted);
}

.auth-body .auth-footer-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
}

.auth-body .auth-footer-sep {
  display: none;
  color: var(--color-border-emphasis);
}

@media (min-width: 480px) {
  .auth-body .auth-footer-line {
    flex-direction: row;
    justify-content: center;
    gap: 0 12px;
  }

  .auth-body .auth-footer-sep {
    display: inline;
  }
}

/* ---------------------------------------------------------------------
   Large displays: the card, its fields and its buttons drawn larger as
   one unit (CSS zoom on the centred column; nothing is stretched on its
   own). Laptop sizes (1366 / 1536 wide) are unchanged.
   --------------------------------------------------------------------- */
@media (min-width: 1800px) and (min-height: 820px) {
  .auth-body .auth-stage {
    zoom: 1.12;
  }
}

@media (min-width: 2200px) and (min-height: 950px) {
  .auth-body .auth-stage {
    zoom: 1.3;
  }
}

@media (min-width: 3000px) and (min-height: 1400px) {
  .auth-body .auth-stage {
    zoom: 1.6;
  }
}

/* ---------------------------------------------------------------------
   Motion (skipped under prefers-reduced-motion): the card entrance and
   the Resend button's pulse while busy.
   --------------------------------------------------------------------- */
@keyframes auth-card-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-body .auth-card {
    animation: auth-card-enter 0.24s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .auth-body .auth-passkey-btn[aria-busy="true"] .icon-stroke,
  .auth-body .auth-resend-btn[aria-busy="true"] .icon-stroke {
    animation: auth-resend-busy 1.2s ease-in-out infinite;
  }
}

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

/* ---------------------------------------------------------------------
   Windows high contrast / forced colours: drop the decorative bar and keep
   the colour logo on its own light plate (a dark high-contrast theme would
   otherwise put its dark wordmark on black).
   --------------------------------------------------------------------- */
@media (forced-colors: active) {
  .auth-body .auth-card::before {
    display: none;
  }

  .auth-body .auth-card-logo {
    forced-color-adjust: none;
    box-sizing: content-box;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: #ffffff;
  }

  /* The CSS-drawn arrow would become a solid block. */
  .auth-body .auth-signin-actions .auth-submit::after {
    display: none;
  }
}
