.auth { min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto; padding: var(--space-24) var(--space-24) var(--space-32); display: flex; flex-direction: column; }
.auth-view { flex: 1; display: flex; flex-direction: column; }
.auth-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-32); padding: var(--space-32) 0; }
.auth-mid h2 { margin: 0 0 var(--space-8); font-size: 32px; line-height: 1.25; font-weight: 700; text-align: center; }
.auth-mid p { margin: 0; text-align: center; color: var(--color-text-muted); }
.auth-form { display: flex; flex-direction: column; gap: var(--space-16); margin-top: var(--space-16); }
.auth-form h2 { margin: 0; font-size: 28px; line-height: 1.25; font-weight: 700; text-align: center; }
.auth-sub { margin: calc(var(--space-8) * -1) 0 0; text-align: center; color: var(--color-text-muted); }
.auth-form .field { margin-bottom: 0; }
.swap { margin: 0; text-align: center; }
/* Welcome: goals mosaic */
.welcome { justify-content: flex-start; gap: 0; }
.welcome-mid { flex: 1; justify-content: space-evenly; gap: var(--space-16); padding: var(--space-8) 0; }
.welcome-divider { margin: var(--space-8) 0 var(--space-16); width: 48px; height: 4px; border-radius: var(--radius-pill); background: var(--color-border); align-self: center; flex: none; }
.welcome-logo { display: block; width: min(190px, 58%); height: auto; margin: var(--space-8) auto 0; flex: none; }
.mosaic { container-type: inline-size; position: relative; width: min(100%, calc(44svh * 1.135)); margin-inline: auto; aspect-ratio: 1.135; flex: none; }
.mosaic-stage { --u: calc(98cqw / 278); position: absolute; left: calc(1cqw + 6 * var(--u)); top: calc(14 * var(--u)); width: calc(262 * var(--u)); height: calc(236 * var(--u)); }
.mc { position: absolute; display: block; height: auto; aspect-ratio: 1; object-fit: cover; border: 3px solid #f4efe6; border-bottom-width: 10px; border-radius: 3px; background: #2a3646; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4); }
.mc-center { z-index: 9; border-width: 4px; border-bottom-width: 12px; }
@media (max-height: 720px) {
  .mosaic { width: min(100%, calc(32svh * 1.135)); }
  .welcome .auth-mid h2 { font-size: 28px; }
}
/* Form view: picture header with the form sheet rising over it */
.auth-form-view { margin: calc(var(--space-24) * -1) calc(var(--space-24) * -1) calc(var(--space-32) * -1); }
.auth-hero { position: relative; overflow: hidden; min-height: 270px; padding: var(--space-16) var(--space-24); display: flex; flex-direction: column; gap: var(--space-8); }
/* overlapping tilted picture cards fill the whole banner; --u scales the 300-unit design with the screen (capped), the stage is centered and spills over both sides */
.auth-hero { container-type: inline-size; }
.auth-collage { --u: min(0.3333cqw, 1.15px); position: absolute; inset: 0; z-index: 0; }
.ac-stage { position: absolute; left: 50%; top: 0; width: calc(300 * var(--u)); height: 100%; margin-left: calc(-150 * var(--u)); }
.ac-card { position: absolute; display: block; width: calc(124 * var(--u)); aspect-ratio: 1; object-fit: cover; border: 3px solid #f4efe6; border-bottom-width: 11px; border-radius: 3px; background: #2a3646; }
.ac-card.ac-center { left: calc(88 * var(--u)); top: calc(56 * var(--u)); border-width: 5px; border-bottom-width: 16px; transform: rotate(-2deg); z-index: 9; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.auth-hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: color-mix(in srgb, var(--bg-app) 30%, transparent); }
.auth-sheet > .auth-back { position: absolute; z-index: 2; top: var(--space-16); inset-inline-end: var(--space-16); }
.auth-hero > .auth-hero-logo { --u: min(0.3333cqw, 1.15px); position: absolute; z-index: 2; left: 50%; top: calc(118 * var(--u)); transform: translate(-50%, -50%); display: block; width: calc(104 * var(--u)); height: auto; margin: 0; }
.auth-sheet { position: relative; flex: 1; margin-top: calc(var(--space-32) * -1); padding: var(--space-24) var(--space-24) var(--space-32); background: var(--color-canvas); border-top: 1px solid var(--color-border); border-radius: calc(var(--radius-card) + 10px) calc(var(--radius-card) + 10px) 0 0; display: flex; flex-direction: column; }
.auth-handle { width: 48px; height: 4px; border-radius: var(--radius-pill); background: var(--color-primary); align-self: center; }
@media (min-width: 520px) { .auth-form-view { margin: 0; border-radius: calc(var(--radius-card) + 10px); overflow: hidden; border: 1px solid var(--color-border); } }

/* Phones and short windows (laptops too): a tighter login / sign-up sheet so the whole form fits one screen without scrolling (short hero, smaller title, no sub line, lower fields). */
@media (max-width: 519px), (max-height: 980px) {
  /* the picture banner takes whatever height the form leaves, so the sheet always ends at the bottom edge: no dead space on tall phones */
  .auth-form-view .auth-hero { flex: 1 0 118px; min-height: 118px; }
  .auth-form-view .auth-hero > .auth-hero-logo { top: min(50%, calc(118 * var(--u))); width: 92px; }
  .auth-form-view .auth-sheet { flex: none; padding: 16px 22px 18px; margin-top: -22px; }
  .auth-form-view .auth-form { gap: 8px; margin-top: 6px; }
  .auth-form-view .auth-form .btn { min-height: 44px; }
  .auth-form-view .auth-form h2 { font-size: 22px; }
  .auth-form-view .auth-sub { display: none; }
  .auth-form-view .field { gap: 4px; }
  .auth-form-view .field > label { font-size: 13px; }
  .auth-form-view .input { min-height: 44px; height: 44px; }
  .auth-form-view .hint { display: none; }
  .auth-form-view .divider-or { margin: 0; }
  .auth-form-view .fine { font-size: 11px; margin: 0; }
  .auth-form-view .swap { margin: 0; }
}

/* very short screens: a little tighter still, so sign-up fits too */
@media (max-height: 700px) {
  .auth-form-view .auth-hero { flex-basis: 84px; min-height: 84px; }
  .auth-form-view .auth-form { gap: 6px; }
  .auth-form-view .auth-form .btn { min-height: 40px; }
  .auth-form-view .input { min-height: 40px; height: 40px; }
  .auth-form-view .auth-sheet { padding-top: 12px; padding-bottom: 12px; }
}

/* Forgot password: link under the password field, reset / check-email / new-password views */
.auth-form .auth-forgot { align-self: flex-end; width: auto; margin-top: calc(var(--space-8) * -1); font-size: 13px; color: var(--accent-mint-strong); text-decoration: none; font-weight: 500; }
.auth-form .auth-forgot[hidden] { display: none; }
.auth-sent-ic { align-self: center; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-mint-strong); background: color-mix(in srgb, var(--accent-mint-strong) 14%, transparent); }
.auth-sent-ic[hidden], .auth-sent-text[hidden] { display: none; }
.auth-sent-ic svg { width: 26px; height: 26px; }
.auth-sent-text { margin: 0; text-align: center; color: var(--color-text-muted); line-height: 1.5; }
.auth-sent-text { overflow-wrap: anywhere; }
.auth-form-view[data-mode="reset"] .auth-sub, .auth-form-view[data-mode="newpw"] .auth-sub { display: block; }
.auth-form-view[data-mode="sent"] .auth-form, .auth-form-view[data-mode="reset"] .auth-form { justify-content: flex-start; }
.auth-sent-signup[hidden] { display: none; }
