/* Auth — sign in, sign up and password pages for staff (User) and doctors.
   A split screen: a dark brand panel with the live pipeline on the left,
   the form on the light canvas on the right. Below 1025px the panel folds
   into a compact header band and the form rises over it as a sheet. */

:root {
  /* Legacy aliases onto the foundation tokens. */
  --auth-bg: var(--ah-bg);
  --auth-surface: var(--ah-surface);
  --auth-surface-2: var(--ah-surface-2);
  --auth-border: var(--ah-border);
  --auth-border-strong: var(--ah-border-strong);
  --auth-text: var(--ah-ink);
  --auth-text-soft: var(--ah-ink-2);
  --auth-text-muted: var(--ah-ink-3);
  --auth-mint: var(--ah-accent);
  --auth-mint-strong: var(--ah-accent-hover);
  --auth-radius: var(--ah-radius-lg);
  --auth-radius-sm: var(--ah-radius-sm);
  --auth-glow: var(--ah-focus-ring);
  --auth-font: var(--ah-font);

  /* Pipeline animation: one step per stage, then a rest before it loops. */
  --auth-flow-step: 0.8s;
  --auth-flow-period: 9s;
  --auth-flow-row: 2.5rem;
}

/* ── Page frame ──────────────────────────────────────────── */

.auth-page {
  display: grid;
  grid-template-columns: minmax(26rem, 45fr) minmax(0, 55fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ah-bg);
}

/* ── Brand panel (left) ──────────────────────────────────── */

.auth-panel {
  position: sticky;
  top: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-self: start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2.25rem clamp(2rem, 4vw, 3.5rem) 2.5rem;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--ah-nav-bg);
  color: var(--ah-nav-text);
}

/* Layered light: a teal bloom top-left, a cool blue one bottom-right,
   and a faint dot lattice that fades out toward the edges. */
.auth-panel__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38rem 26rem at 8% -6%, rgba(45, 212, 191, 0.22), transparent 62%),
    radial-gradient(30rem 24rem at 108% 104%, rgba(61, 111, 214, 0.2), transparent 64%),
    radial-gradient(22rem 16rem at 78% 44%, rgba(45, 212, 191, 0.07), transparent 70%),
    linear-gradient(180deg, var(--ah-nav-bg) 0%, var(--ah-nav-bg-2) 100%);
}

.auth-panel__glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(70% 60% at 30% 35%, #000 0%, transparent 80%);
  mask-image: radial-gradient(70% 60% at 30% 35%, #000 0%, transparent 80%);
}

.auth-panel__brand {
  display: flex;
  align-items: center;
  color: var(--ah-nav-text-strong);
  animation: ah-fade var(--ah-dur-4) var(--ah-ease-out) both;
}

/* Only the compact band shows the one-liner. */
.auth-panel__short {
  display: none;
}

.auth-panel__body {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: 100%;
  max-width: 30rem;
  margin-block: auto;
  padding-top: 2.5rem;
}

.auth-panel__intro {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: ah-rise var(--ah-dur-4) var(--ah-ease-spring) 80ms both;
}

.auth-panel__headline {
  margin: 0;
  max-width: 14ch;
  color: var(--ah-nav-text-strong);
  font-size: clamp(2rem, 2.9vw, 2.75rem);
  font-weight: var(--ah-weight-semibold);
  line-height: 1.06;
  letter-spacing: -0.038em;
}

.auth-panel__lede {
  margin: 0;
  max-width: 27rem;
  color: var(--ah-nav-text);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ── The pipeline: eight stages on a track, a pulse walking it ── */

.auth-flow {
  position: relative;
  padding: 0.5rem;
  border-radius: var(--ah-radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow:
    inset 0 0 0 1px var(--ah-nav-line),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 24px 60px -24px rgba(0, 0, 0, 0.55);
  animation: ah-rise var(--ah-dur-4) var(--ah-ease-spring) 180ms both;
}

.auth-flow__list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The rail runs from the first dot's centre to the last one's. */
.auth-flow__track {
  position: absolute;
  z-index: 0;
  top: calc(0.5rem + var(--auth-flow-row) / 2);
  bottom: calc(0.5rem + var(--auth-flow-row) / 2);
  left: calc(0.5rem + 0.875rem + 0.3125rem - 1px);
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-flow__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.1), var(--ah-accent-bright));
  transform-origin: top;
  transform: scaleY(0);
  opacity: 0;
  animation: auth-flow-fill var(--auth-flow-period) linear infinite;
}

.auth-flow__runner {
  position: absolute;
  inset: 0;
  animation: auth-flow-run var(--auth-flow-period) linear infinite;
}

.auth-flow__pulse {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: #eafffb;
  box-shadow:
    0 0 0 3px rgba(45, 212, 191, 0.35),
    0 0 14px 4px var(--ah-accent-glow),
    0 0 36px 8px rgba(45, 212, 191, 0.25);
  transform: translate(-50%, -50%);
}

/* Travel ends as the last stage lights (7 steps of the 9s period). */
@keyframes auth-flow-run {
  0% { transform: translateY(0); opacity: 0; }
  2% { opacity: 1; }
  62.2% { transform: translateY(100%); opacity: 1; }
  72%, 100% { transform: translateY(100%); opacity: 0; }
}

@keyframes auth-flow-fill {
  0% { transform: scaleY(0); opacity: 1; }
  62.2% { transform: scaleY(1); opacity: 1; }
  80%, 100% { transform: scaleY(1); opacity: 0; }
}

.auth-flow__node {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 0.625rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.875rem;
  height: var(--auth-flow-row);
  padding: 0 0.875rem;
  border-radius: calc(var(--ah-radius-xl) - 0.5rem);
}

/* A wash in the stage's own hue sweeps each row as the pulse passes. */
.auth-flow__node::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent), color-mix(in srgb, var(--c) 4%, transparent) 70%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
  opacity: 0;
  animation: auth-node-wash var(--auth-flow-period) var(--ah-ease-out) infinite;
  animation-delay: calc(var(--i) * var(--auth-flow-step));
}

.auth-flow__dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px var(--ah-nav-bg), 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent);
  animation: auth-node-dot var(--auth-flow-period) var(--ah-ease-out) infinite;
  animation-delay: calc(var(--i) * var(--auth-flow-step));
}

.auth-flow__label {
  min-width: 0;
  overflow: hidden;
  color: var(--ah-nav-text);
  font-size: var(--ah-text-base);
  font-weight: var(--ah-weight-medium);
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-overflow: ellipsis;
  animation: auth-node-label var(--auth-flow-period) var(--ah-ease-out) infinite;
  animation-delay: calc(var(--i) * var(--auth-flow-step));
}

.auth-flow__note {
  display: none;
}

.auth-flow__index {
  color: var(--ah-nav-muted);
  font-family: var(--ah-mono);
  font-size: var(--ah-text-2xs);
  font-variant-numeric: tabular-nums;
}

/* Modification is a loop back, not a step forward: a hollow dot and a note. */
.auth-flow__node--branch {
  grid-template-columns: 0.625rem auto minmax(0, 1fr) auto;
}

.auth-flow__node--branch .auth-flow__dot {
  background: var(--ah-nav-bg);
  box-shadow: inset 0 0 0 2px var(--c), 0 0 0 3px var(--ah-nav-bg);
}

.auth-flow__node--branch .auth-flow__note {
  display: block;
  min-width: 0;
  margin-left: 0.5rem;
  overflow: hidden;
  color: var(--ah-nav-muted);
  font-size: var(--ah-text-xs);
  white-space: nowrap;
  text-overflow: ellipsis;
}

@keyframes auth-node-wash {
  0% { opacity: 0; }
  4% { opacity: 1; }
  18% { opacity: 0.55; }
  34%, 100% { opacity: 0; }
}

@keyframes auth-node-dot {
  0% { transform: scale(1); }
  4% {
    transform: scale(1.3);
    box-shadow: 0 0 0 3px var(--ah-nav-bg), 0 0 0 5px color-mix(in srgb, var(--c) 55%, transparent), 0 0 18px 3px var(--c);
  }
  30%, 100% { transform: scale(1); }
}

@keyframes auth-node-label {
  0%, 34%, 100% { color: var(--ah-nav-text); }
  4%, 16% { color: var(--ah-nav-text-strong); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-flow__fill,
  .auth-flow__runner,
  .auth-flow__node::before,
  .auth-flow__dot,
  .auth-flow__label {
    animation: none !important;
  }

  .auth-flow__runner {
    opacity: 0;
  }
}

/* Short laptop screens: tighten the rows so the panel still fits. */
@media (min-width: 1025px) and (max-height: 820px) {
  :root { --auth-flow-row: 2.125rem; }

  .auth-panel__body {
    gap: 1.75rem;
    padding-top: 1.5rem;
  }
}

/* ── Form side (right) ───────────────────────────────────── */

.auth-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 3.5rem clamp(1.5rem, 5vw, 4rem);
  box-sizing: border-box;
  background:
    radial-gradient(36rem 22rem at 100% 0%, rgba(20, 162, 145, 0.07), transparent 70%),
    var(--ah-bg);
}

.auth-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 25rem;
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

/* Header, switcher and form rise in one after another. */
.auth-card > *,
.auth-shell > .auth-links {
  animation: ah-rise var(--ah-dur-4) var(--ah-ease-spring) both;
}

.auth-card > *:nth-child(2) { animation-delay: 60ms; }
.auth-card > *:nth-child(3) { animation-delay: 120ms; }
.auth-card > *:nth-child(n+4) { animation-delay: 170ms; }
.auth-shell > .auth-links { animation-delay: 220ms; }

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-title {
  margin: 0;
  color: var(--ah-ink);
  font-size: var(--ah-text-display);
  font-weight: var(--ah-weight-semibold);
  line-height: 1.12;
  letter-spacing: -0.034em;
}

.auth-subtitle {
  margin: 0;
  color: var(--ah-ink-3);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ── Staff / Doctor segmented switcher ───────────────────── */

.auth-switcher {
  --pad: 4px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: var(--pad);
  border-radius: 12px;
  background: var(--ah-surface-3);
  box-shadow: inset 0 1px 2px rgba(10, 26, 28, 0.07), inset 0 0 0 1px rgba(10, 26, 28, 0.04);
}

/* Thumb and its luminous underline slide together under the active tab. */
.auth-switcher::before,
.auth-switcher::after {
  content: "";
  position: absolute;
  top: var(--pad);
  bottom: var(--pad);
  left: var(--pad);
  width: calc(50% - var(--pad));
  pointer-events: none;
  transition: transform var(--ah-dur-4) var(--ah-ease-spring);
}

.auth-switcher::before {
  z-index: -1;
  border-radius: calc(12px - var(--pad));
  background: var(--ah-surface);
  box-shadow:
    0 0 0 1px rgba(13, 122, 112, 0.16),
    0 1px 2px rgba(10, 26, 28, 0.08),
    0 8px 20px -8px rgba(20, 162, 145, 0.5),
    var(--ah-inner-highlight);
}

.auth-switcher::after {
  z-index: 1;
  background: linear-gradient(90deg, transparent, var(--ah-accent-bright), transparent) center bottom / 2.5rem 2px no-repeat;
  filter: drop-shadow(0 0 4px var(--ah-accent-glow));
}

.auth-switcher:has(.auth-switcher__tab:last-child.is-active)::before,
.auth-switcher:has(.auth-switcher__tab:last-child.is-active)::after,
.auth-switcher:has(.auth-switcher__tab:last-child:focus)::before,
.auth-switcher:has(.auth-switcher__tab:last-child:focus)::after {
  transform: translateX(100%);
}

/* A click moves the thumb at once, before the next page arrives. */
.auth-switcher:has(.auth-switcher__tab:first-child:focus)::before,
.auth-switcher:has(.auth-switcher__tab:first-child:focus)::after {
  transform: translateX(0);
}

.auth-switcher__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: calc(12px - var(--pad));
  color: var(--ah-ink-3);
  font-size: var(--ah-text-base);
  font-weight: var(--ah-weight-medium);
  text-decoration: none;
  transition: color var(--ah-dur-2), transform var(--ah-dur-2) var(--ah-ease-spring);
  -webkit-user-select: none;
  user-select: none;
}

.auth-switcher__icon {
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity var(--ah-dur-2), color var(--ah-dur-2);
}

.auth-switcher__tab:hover {
  color: var(--ah-ink);
  text-decoration: none;
}

.auth-switcher__tab:active {
  transform: scale(0.97);
}

.auth-switcher__tab.is-active {
  color: var(--ah-ink);
  cursor: default;
}

.auth-switcher__tab.is-active .auth-switcher__icon {
  color: var(--ah-accent);
  opacity: 1;
}

.auth-switcher__tab:focus-visible {
  outline: none;
  box-shadow: var(--ah-focus-ring);
}

/* ── Form ────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  margin: 0;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  min-width: 0;
}

.auth-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.auth-field label {
  color: var(--ah-ink-2);
  font-size: var(--ah-text-sm);
  font-weight: var(--ah-weight-medium);
}

.auth-field input:is([type="email"], [type="password"], [type="text"], [type="tel"]),
.auth-field select {
  width: 100%;
  height: 2.75rem;
  box-sizing: border-box;
  padding: 0 0.875rem;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-md);
  background: var(--ah-surface);
  box-shadow: 0 1px 2px rgba(10, 26, 28, 0.05), var(--ah-inner-highlight);
  color: var(--ah-ink);
  font-size: var(--ah-text-base);
  font-weight: var(--ah-weight-regular);
  transition: border-color var(--ah-dur-1), box-shadow var(--ah-dur-2) var(--ah-ease-out);
}

.auth-field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ah-ink-3) 50%),
    linear-gradient(135deg, var(--ah-ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 1.1rem) calc(50% - 0.15rem),
    calc(100% - 0.7rem) calc(50% - 0.15rem);
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
}

.auth-field input:is([type="email"], [type="password"], [type="text"], [type="tel"]):hover,
.auth-field select:hover {
  border-color: var(--ah-border-strong);
}

.auth-field input:is([type="email"], [type="password"], [type="text"], [type="tel"]):focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--ah-accent);
  box-shadow: var(--ah-focus-ring), 0 6px 18px -10px rgba(20, 162, 145, 0.55);
}

.auth-field input:disabled,
.auth-field select:disabled {
  background: var(--ah-surface-2);
  color: var(--ah-ink-3);
  cursor: not-allowed;
}

.auth-hint {
  margin: 0;
  color: var(--ah-ink-3);
  font-size: var(--ah-text-xs);
  line-height: 1.45;
}

.auth-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;
  min-height: 1.75rem;
}

.auth-field--checkbox input[type="checkbox"] {
  width: 1.0625rem;
  height: 1.0625rem;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.auth-field--checkbox label {
  margin: 0;
  color: var(--ah-ink-2);
  font-weight: var(--ah-weight-regular);
  cursor: pointer;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--ah-space-3);
  margin-top: 0.375rem;
}

/* ── Primary submit with its arrow island ────────────────── */

.auth-submit {
  position: relative;
  display: block;
  transition: transform var(--ah-dur-2) var(--ah-ease-spring);
}

.auth-submit:has(.auth-btn:active:not(:disabled)) {
  transform: scale(0.98);
}

.auth-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.875rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--ah-radius-md);
  background: var(--ah-accent-grad);
  color: #fff;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: var(--ah-weight-medium);
  line-height: 1;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(8, 90, 82, 0.9),
    0 8px 22px -8px rgba(13, 122, 112, 0.6);
  transition:
    background var(--ah-dur-1),
    box-shadow var(--ah-dur-2) var(--ah-ease-out),
    filter var(--ah-dur-2),
    transform var(--ah-dur-2) var(--ah-ease-spring);
  -webkit-user-select: none;
  user-select: none;
}

.auth-submit .auth-btn {
  padding: 0 3.25rem;
}

.auth-btn:hover {
  background: var(--ah-accent-grad-hover);
  color: #fff;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(8, 90, 82, 0.9),
    0 14px 30px -10px rgba(13, 122, 112, 0.7);
}

.auth-btn:active:not(:disabled) {
  filter: brightness(0.95);
}

.auth-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ah-bg), 0 0 0 4px var(--ah-accent);
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-submit__island {
  position: absolute;
  top: 50%;
  right: 0.4375rem;
  display: grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  pointer-events: none;
  transform: translateY(-50%);
  transition: transform var(--ah-dur-3) var(--ah-ease-spring), background var(--ah-dur-2);
}

.auth-submit__island svg {
  transition: transform var(--ah-dur-3) var(--ah-ease-spring);
}

.auth-submit:hover .auth-submit__island {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.05);
}

.auth-submit:hover .auth-submit__island svg {
  transform: translateX(2px);
}

.auth-submit:has(.auth-btn:disabled) .auth-submit__island {
  opacity: 0.5;
}

/* While Turbo submits, the island becomes a spinner. */
form[aria-busy="true"] .auth-submit__island svg {
  opacity: 0;
}

form[aria-busy="true"] .auth-submit__island::after {
  content: "";
  position: absolute;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: ah-spin 0.7s linear infinite;
}

/* Secondary and destructive buttons (account settings). */
.auth-btn--secondary,
.auth-btn--danger {
  height: 2.75rem;
  background: var(--ah-surface);
  color: var(--ah-ink);
  box-shadow: 0 0 0 1px var(--ah-border), 0 1px 2px rgba(10, 26, 28, 0.06), var(--ah-inner-highlight);
}

.auth-btn--secondary:hover {
  background: var(--ah-surface);
  color: var(--ah-ink);
  box-shadow: 0 0 0 1px var(--ah-border-strong), 0 4px 12px -4px rgba(10, 26, 28, 0.14), var(--ah-inner-highlight);
}

.auth-btn--danger {
  color: var(--ah-danger);
}

.auth-btn--danger:hover {
  background: var(--ah-danger-soft);
  color: var(--ah-danger-ink);
  box-shadow: 0 0 0 1px var(--ah-danger-border), 0 4px 12px -4px rgba(192, 54, 44, 0.2);
}

.auth-btn--secondary:active:not(:disabled),
.auth-btn--danger:active:not(:disabled) {
  transform: scale(0.98);
  filter: none;
}

/* Account settings: the destructive zone below the form. */
.auth-danger {
  display: flex;
  flex-direction: column;
  gap: var(--ah-space-3);
  padding: 1rem 1.125rem 1.125rem;
  border-radius: var(--ah-radius-lg);
  background: var(--ah-surface);
  box-shadow: 0 0 0 1px var(--ah-danger-border), var(--ah-shadow-xs);
}

.auth-danger form {
  margin: 0;
}

.auth-danger__title {
  margin: 0 0 0.125rem;
  color: var(--ah-ink);
  font-size: var(--ah-text-base);
  font-weight: var(--ah-weight-semibold);
}

/* ── Secondary links ─────────────────────────────────────── */

.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ah-border);
}

.auth-links:empty {
  display: none;
}

.auth-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
  margin: 0 -0.375rem;
  padding: 0 0.375rem;
  border-radius: var(--ah-radius-sm);
  color: var(--ah-ink-3);
  font-size: var(--ah-text-sm);
  font-weight: var(--ah-weight-medium);
  text-decoration: none;
  transition: color var(--ah-dur-1), background var(--ah-dur-1);
}

.auth-links a:hover {
  color: var(--ah-accent);
  background: var(--ah-accent-soft);
  text-decoration: none;
}

.auth-links a:active {
  color: var(--ah-accent-active);
}

.auth-links a:focus-visible {
  outline: none;
  box-shadow: var(--ah-focus-ring);
}

/* ── Errors ──────────────────────────────────────────────── */

.auth-errors {
  position: relative;
  padding: 0.75rem 0.875rem 0.75rem 1.125rem;
  border-radius: var(--ah-radius-md);
  background: var(--ah-danger-soft);
  box-shadow: inset 0 0 0 1px var(--ah-danger-border);
  color: var(--ah-danger-ink);
  font-size: var(--ah-text-sm);
  line-height: 1.5;
  animation: ah-rise var(--ah-dur-3) var(--ah-ease-spring) both;
}

.auth-errors h2 {
  margin: 0;
  font-size: var(--ah-text-sm);
  font-weight: var(--ah-weight-semibold);
  letter-spacing: 0;
}

.auth-errors ul {
  margin: 0.25rem 0 0;
  padding-left: 1.125rem;
}

.auth-errors li + li {
  margin-top: 0.125rem;
}

/* ── Inside the signed-in shell (account settings, password change) ── */

.app-main .auth-page {
  max-width: 84rem;
  min-height: 0;
  margin: 0 auto;
  padding: var(--ah-gutter);
  box-sizing: border-box;
  grid-template-columns: minmax(22rem, 42fr) minmax(0, 58fr);
  background: transparent;
}

.app-main .auth-panel {
  top: var(--ah-gutter);
  min-height: calc(100dvh - 2 * var(--ah-gutter));
  border-radius: var(--ah-radius-xl);
  box-shadow: var(--ah-shadow-card);
}

.app-main .auth-stage {
  background: transparent;
}

/* ── Tablet and phone: the panel folds into a header band ── */

@media (max-width: 1024px) {
  .auth-page,
  .app-main .auth-page {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .auth-panel,
  .app-main .auth-panel {
    position: relative;
    top: auto;
    min-height: 0;
    padding: 1.5rem var(--ah-gutter) 3.25rem;
    padding-top: max(1.5rem, env(safe-area-inset-top));
  }

  .auth-panel__glow {
    background:
      radial-gradient(26rem 14rem at 0% 0%, rgba(45, 212, 191, 0.24), transparent 65%),
      radial-gradient(22rem 14rem at 100% 120%, rgba(61, 111, 214, 0.22), transparent 65%),
      var(--ah-nav-bg);
  }

  .auth-panel__body {
    display: none;
  }

  .auth-panel__short {
    display: block;
    margin: 0.875rem 0 0;
    color: var(--ah-nav-text);
    font-size: var(--ah-text-base);
    line-height: 1.5;
    animation: ah-fade var(--ah-dur-4) var(--ah-ease-out) 80ms both;
  }

  /* The form rises over the band as a sheet. */
  .auth-stage {
    align-items: flex-start;
    margin-top: -1.5rem;
    padding: 2.25rem var(--ah-gutter) 3rem;
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: var(--ah-bg);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.6), 0 -12px 32px -16px rgba(0, 0, 0, 0.35);
  }

  .auth-shell {
    max-width: 30rem;
  }

  .app-main .auth-page {
    padding: var(--ah-gutter);
  }

  .app-main .auth-stage {
    background: var(--ah-bg);
  }
}

@media (max-width: 480px) {
  .auth-title {
    font-size: 1.625rem;
  }

  .auth-card {
    gap: 1.25rem;
  }

  .auth-switcher__tab {
    min-height: 2.75rem;
  }

  .auth-field-row {
    grid-template-columns: 1fr;
    gap: 1.125rem;
  }

  .auth-field--checkbox {
    min-height: 2.75rem;
  }

  .auth-btn {
    height: 3rem;
  }

  .auth-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .auth-links a {
    min-height: 2.75rem;
  }
}
