/* v3 signed-out pages (ADMIN_DESIGN_REFERENCE.md §6, admin redesign plan §11
   decision 185): sign-in, two-step verification, "already signed in", account
   set-up / reset, sign-out, the gateway. Brand panel + one card on --page
   (decision 278), honours the theme. Fields come from field.css, buttons from
   button.css, banners from banner.css. Role tokens only. */

.lg-auth { margin: 0; }

/* Ink panel + form (decisions 278, 279). The panel is the same deep navy in
   both themes (--ink); its dashed edge is the ticket-stub perforation of the
   date-stub signature. Phones: an ink band with the logo, the form right under
   it with no frame. From 64em: the panel on the left, the form centred. */
.lg-auth__split { min-height: 100dvh; display: flex; flex-direction: column; }
.lg-auth__side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: calc(var(--space-8) + env(safe-area-inset-top)) var(--space-6) var(--space-8);
  background: var(--ink);
  color: var(--on-ink);
}
.lg-auth__side::after {
  content: "";
  position: absolute;
  inset-inline: var(--space-6);
  inset-block-end: var(--space-3);
  border-block-end: 2px dashed var(--ink-line);
}
.lg-auth__side .lg-auth__logo { inline-size: 13rem; max-inline-size: 100%; }
.lg-auth__pitch { display: none; }
.lg-auth__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom));
}
/* Sign-in fields and button: the phone control height on every screen, 1rem text. */
.lg-auth__form .lg-field__input,
.lg-auth__form .lg-btn { min-block-size: var(--control-height-touch); font-size: 1rem; }
.lg-auth__form .lg-field__label { font-size: var(--size-body); font-weight: 500; }

@media (min-width: 64em) {
  .lg-auth__split { flex-direction: row; }
  .lg-auth__side {
    flex: 0 0 clamp(28rem, 42%, 38rem);
    padding: var(--space-12);
  }
  .lg-auth__side::after {
    inset-inline: auto var(--space-3);
    inset-block: var(--space-6);
    border-block-end: 0;
    border-inline-end: 2px dashed var(--ink-line);
  }
  .lg-auth__side .lg-auth__logo { inline-size: 17rem; }
  /* Logo at the top; the pitch is one block in the middle of what is left. */
  .lg-auth__pitch { display: grid; gap: var(--space-5); max-inline-size: 28rem; margin-block: auto; }
  .lg-auth__main { justify-content: center; padding: var(--space-12) var(--space-8); }
}
.lg-auth__pitch-title {
  margin: 0;
  font-size: 2.25rem;
  line-height: 2.75rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--on-ink);
}
.lg-auth__pitch-lead { margin: 0; font-size: 1rem; line-height: 1.5rem; color: var(--on-ink-muted); }
.lg-auth__features { margin: var(--space-3) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-5); }
.lg-auth__features li { display: flex; align-items: flex-start; gap: var(--space-4); }
.lg-auth__features strong {
  display: block;
  font-size: var(--size-card-title);
  line-height: var(--leading-card-title);
  font-weight: 600;
  color: var(--on-ink);
}
.lg-auth__features li > span:last-child { font-size: var(--size-body); line-height: var(--leading-body); color: var(--on-ink-muted); }
.lg-auth__feature-icon {
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-control);
  color: var(--on-ink);
}

/* The form card: lifted off the page by a soft two-layer shadow (light: no
   border; dark: --raised-border + the deep shadow), decision 279. */
.lg-auth__card {
  inline-size: 100%;
  max-inline-size: 27rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-8);
  border: 1px solid var(--raised-border);
  border-radius: var(--radius-sheet);
  background: var(--surface);
  box-shadow: var(--shadow-raised), var(--shadow-sheet);
}
.lg-auth__card--wide { max-inline-size: 34rem; }
.lg-auth__card a:not(.lg-btn) { color: var(--primary); }
.lg-auth__title {
  margin: 0;
  font-size: 1.75rem;
  line-height: 2.25rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.lg-auth__lead { margin: calc(var(--space-4) * -1) 0 0; font-size: 1rem; line-height: 1.5rem; color: var(--text-muted); }
.lg-auth__org { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--page); }
.lg-auth__org img { inline-size: 2.5rem; block-size: 2.5rem; object-fit: contain; border-radius: var(--radius-pill); }
.lg-auth__org-initial { display: grid; place-items: center; inline-size: 2.5rem; block-size: 2.5rem;
  border-radius: var(--radius-pill); background: var(--neutral-tint); font-weight: 600; }
.lg-auth__org-name { display: block; font-weight: 600; line-height: var(--leading-card-title); }
.lg-auth__org-sub { display: block; color: var(--text-muted); font-size: var(--size-caption); }
.lg-auth__form { display: flex; flex-direction: column; gap: var(--space-5); }
.lg-auth__form .lg-btn--primary { inline-size: 100%; justify-content: center; margin-block-start: var(--space-1); }
.lg-auth__alt { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.lg-auth__alt form { margin: 0; }
.lg-auth__note { margin: 0; color: var(--text-muted); font-size: var(--size-caption); line-height: var(--leading-caption); }
.lg-auth__note--box { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3);
  border-radius: var(--radius-control); background: var(--neutral-tint); }
.lg-auth__note--box svg { flex: none; margin-top: 0.0625rem; }
/* "Powered by" (decision 348): a hairline, then the label and the AImpact
   logo at full contrast, 2rem, under the card on every signed-out step.
   The artwork is white: drawn dark on the light theme, as is on dark. */
.lg-auth__foot { margin: 0; inline-size: 100%; max-inline-size: 27rem; display: flex; align-items: center;
  justify-content: center; gap: var(--space-3); padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--border); color: var(--text-muted); font-size: var(--size-label); }
.lg-auth__foot img { block-size: 2rem; inline-size: auto; filter: brightness(0); }
[data-theme="dark"] .lg-auth__foot img { filter: none; }

/* Card header (decision 347): the organiser's mark (logo or initial on the
   soft blue tint) or the platform emblem on ink, beside the title + lead. */
.lg-auth__head { display: flex; align-items: center; gap: var(--space-4); }
.lg-auth__head-text { display: flex; flex-direction: column; gap: var(--space-1); min-inline-size: 0; }
.lg-auth__head .lg-auth__lead { margin: 0; }
/* The organiser's name leads the line, bold in the full text colour (owner, 357). */
.lg-auth__lead-name { color: var(--text); font-weight: 650; }
.lg-auth__head .lg-auth__title { overflow-wrap: anywhere; text-wrap: balance; }
.lg-auth__mark { flex: none; display: grid; place-items: center; inline-size: 3.5rem; block-size: 3.5rem;
  border-radius: var(--radius-card); background: var(--primary-tint); color: var(--primary-ink);
  font-size: 1.375rem; font-weight: 700; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.lg-auth__mark--logo { background: var(--qr-surface); }
.lg-auth__mark--logo img { inline-size: 100%; block-size: 100%; object-fit: contain; padding: var(--space-1); }
/* Platform card (decision 357): no mark; a highlighted "recorded" box instead. */
.lg-auth__note--team { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3);
  border-radius: var(--radius-control); background: var(--primary-tint); color: var(--primary-ink);
  font-size: var(--size-label); line-height: var(--leading-label); }
.lg-auth__note--team svg { flex: none; margin-top: 0.125rem; }
.lg-auth__note--team strong { font-weight: 600; }
.lg-auth__as { margin: calc(var(--space-3) * -1) 0 0; color: var(--text-muted); font-size: var(--size-label); overflow-wrap: anywhere; }
.lg-auth__as strong { color: var(--text); font-weight: 600; }
.lg-auth__head + .lg-auth__as + .lg-auth__lead { margin-block-start: calc(var(--space-3) * -1); }
.lg-auth__forgot { margin: calc(var(--space-2) * -1) 0 0; color: var(--text-muted); font-size: var(--size-label);
  text-align: center; text-wrap: balance; }

/* Step bar (decision 350): thin parts, done ones in --primary; the part just
   finished fills on arrival (motion 349). No text, read out as "Step n of m". */
.lg-auth__stepbar { display: flex; gap: var(--space-1); margin-block-end: calc(var(--space-1) * -1); }
.lg-auth__stepbar-part { position: relative; flex: 1; block-size: 0.25rem; border-radius: 999px;
  background: var(--neutral-tint); overflow: hidden; }
.lg-auth__stepbar-part::after { content: ""; position: absolute; inset: 0; background: var(--primary);
  transform: scaleX(0); transform-origin: left; }
.lg-auth__stepbar-part.is-done::after { transform: none; }
.lg-auth__stepbar-part.is-new::after { animation: lg-auth-fill 360ms var(--ease) 80ms both; }

/* Motion (decision 349), signed-out pages only. First load (html without
   data-lg-auth-seen, set by js/v3/auth-motion.js): the card's parts rise in
   (8px + fade, 200ms, 40ms apart), the panel's pitch follows, the ticket
   perforation draws once. Later steps (the forms swap <body>): the content
   slides in from the right; a failed attempt nudges the card once. */
@keyframes lg-auth-rise { from { opacity: 0; transform: translateY(0.5rem); } }
@keyframes lg-auth-in { from { opacity: 0; transform: translateX(1.25rem); } }
@keyframes lg-auth-fade { from { opacity: 0; } }
@keyframes lg-auth-fill { from { transform: scaleX(0); } }
@keyframes lg-auth-tear-y { from { transform: scaleY(0); } }
@keyframes lg-auth-tear-x { from { transform: scaleX(0); } }
@keyframes lg-auth-nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
:root:not([data-lg-auth-seen]) .lg-auth__card > * { animation: lg-auth-rise var(--dur-enter) var(--ease) both; }
:root:not([data-lg-auth-seen]) .lg-auth__card > :nth-child(2) { animation-delay: 40ms; }
:root:not([data-lg-auth-seen]) .lg-auth__card > :nth-child(3) { animation-delay: 80ms; }
:root:not([data-lg-auth-seen]) .lg-auth__card > :nth-child(4) { animation-delay: 120ms; }
:root:not([data-lg-auth-seen]) .lg-auth__card > :nth-child(5) { animation-delay: 160ms; }
:root:not([data-lg-auth-seen]) .lg-auth__card > :nth-child(n + 6) { animation-delay: 200ms; }
:root:not([data-lg-auth-seen]) .lg-auth__pitch > * { animation: lg-auth-rise 320ms var(--ease) 120ms both; }
:root:not([data-lg-auth-seen]) .lg-auth__features li { animation: lg-auth-rise 320ms var(--ease) both; }
:root:not([data-lg-auth-seen]) .lg-auth__features li:nth-child(1) { animation-delay: 220ms; }
:root:not([data-lg-auth-seen]) .lg-auth__features li:nth-child(2) { animation-delay: 300ms; }
:root:not([data-lg-auth-seen]) .lg-auth__features li:nth-child(3) { animation-delay: 380ms; }
:root:not([data-lg-auth-seen]) .lg-auth__side::after { animation: lg-auth-tear-x 700ms cubic-bezier(0.65, 0, 0.35, 1) 120ms both; transform-origin: left; }
:root:not([data-lg-auth-seen]) .lg-auth__foot { animation: lg-auth-fade 400ms var(--ease) 260ms both; }
:root[data-lg-auth-seen] .lg-auth__card:not(:has(.lg-banner--error, .lg-field__error:not([hidden]))) > :not(.lg-auth__stepbar) {
  animation: lg-auth-in var(--dur-enter) var(--ease) both; }
:root[data-lg-auth-seen] .lg-auth__card:has(.lg-banner--error, .lg-field__error:not([hidden])) {
  animation: lg-auth-nudge 240ms var(--ease) 1; }
@media (min-width: 64em) {
  :root:not([data-lg-auth-seen]) .lg-auth__side::after { animation-name: lg-auth-tear-y; transform-origin: top; }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-lg-auth-seen]) .lg-auth__card > *, :root:not([data-lg-auth-seen]) .lg-auth__pitch > *,
  :root:not([data-lg-auth-seen]) .lg-auth__features li, :root:not([data-lg-auth-seen]) .lg-auth__foot,
  :root[data-lg-auth-seen] .lg-auth__card:not(:has(.lg-banner--error, .lg-field__error:not([hidden]))) > :not(.lg-auth__stepbar) {
    animation: lg-auth-fade 100ms linear both; animation-delay: 0s; }
  :root:not([data-lg-auth-seen]) .lg-auth__side::after, :root[data-lg-auth-seen] .lg-auth__card,
  .lg-auth__stepbar-part.is-new::after { animation: none; }
}
/* Success (motion 349): the pressed button turns green "Signed in" with a check. */
@keyframes lg-auth-pop { from { opacity: 0; transform: scale(0.6); } }
.lg-btn.lg-auth__done { background: var(--success); color: var(--on-primary); }
.lg-btn.lg-auth__done svg { animation: lg-auth-pop 260ms var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .lg-btn.lg-auth__done svg { animation: none; } }

/* Password box with a show / hide button inside. */
.lg-auth__pw { position: relative; }
.lg-auth__pw .lg-field__input { padding-inline-end: 4.5rem; }
.lg-auth__pw-toggle {
  position: absolute; inset-block: 0; inset-inline-end: 0;
  min-inline-size: var(--touch-target); padding: 0 var(--space-3);
  border: 0; background: none; color: var(--primary); font: inherit; font-weight: 500; cursor: pointer;
}

/* 2FA code box (decision 204): as wide and as tall as the button below it
   (same min-height token), large centred spaced digits. */
.lg-auth__form .lg-auth__code { inline-size: 100%; padding-block: 0; text-align: center; font-size: 1.25rem; line-height: 1; }
.lg-auth__switch { margin: var(--space-2) 0 0; font-size: var(--size-caption); }

/* Two-step verification set-up. */
.lg-auth__steps { margin: 0; padding-inline-start: 1.25rem; display: grid; gap: var(--space-2); }
.lg-auth__qr { display: grid; place-items: center; padding: var(--space-4); border: 1px solid var(--border);
  border-radius: var(--radius-control); background: var(--qr-surface); }
.lg-auth__qr svg { inline-size: 11rem; block-size: 11rem; }
.lg-auth__secret { display: grid; gap: var(--space-1); padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-control); }
.lg-auth__secret-label { color: var(--text-muted); font-size: var(--size-label); }
.lg-auth__secret-value { font-family: var(--font-mono); font-size: var(--size-card-title); letter-spacing: 0.08em;
  overflow-wrap: anywhere; }
.lg-auth__secret-value span { white-space: nowrap; }
/* By hand (decision 359): numbered steps; the name and the key each with a Copy button. */
.lg-auth__manual { margin: 0; padding-inline-start: 1.25rem; display: grid; gap: var(--space-3); }
.lg-auth__manual-row { display: grid; gap: var(--space-1); }
.lg-auth__manual-key { color: var(--text-muted); font-size: var(--size-label); }
.lg-auth__manual-value { font-weight: 600; overflow-wrap: anywhere; }
.lg-auth__ios { margin: 0; color: var(--text-muted); font-size: var(--size-label); }
/* Phones vs desktop (decision 302): phones open the app by link (they can't
   scan their own screen), desktop scans the QR. */
.lg-auth__phone, .lg-btn.lg-auth__phone { display: none; }
.lg-auth__copy { justify-self: start; margin-block-start: var(--space-1); }
.lg-auth__other-toggle { color: var(--primary); cursor: pointer; font-size: var(--size-label); }
.lg-auth__other[open] .lg-auth__qr { margin-block-start: var(--space-3); }
@media (max-width: 39.99em) {
  .lg-auth__desk { display: none; }
  li.lg-auth__phone { display: list-item; }
  .lg-auth__secret-label.lg-auth__phone { display: block; }
  .lg-btn.lg-auth__applink.lg-auth__phone { display: inline-flex; inline-size: 100%; justify-content: center; }
  .lg-auth__other.lg-auth__phone { display: block; }
  .lg-auth__ios.lg-auth__phone:not([hidden]) { display: block; }
  .lg-auth__other-toggle { display: flex; align-items: center; min-block-size: var(--touch-target); }
}
.lg-auth__codes { margin: 0; padding: var(--space-3); list-style: none; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-control); font-family: var(--font-mono); }

/* "Already signed in": the other devices. */
.lg-auth__sessions { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-3); }
.lg-auth__session { display: grid; gap: var(--space-2); padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-control); }
.lg-auth__session dl { margin: 0; display: grid; gap: var(--space-1); }
.lg-auth__session dl div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: var(--space-2); }
.lg-auth__session dt { color: var(--text-muted); font-size: var(--size-label); }
.lg-auth__session dd { margin: 0; overflow-wrap: anywhere; }
.lg-auth__danger { border-top: 1px solid var(--border); padding-top: var(--space-3); }
.lg-auth__danger summary { cursor: pointer; color: var(--danger); min-block-size: var(--touch-target);
  display: flex; align-items: center; }
.lg-auth__danger p { margin: var(--space-2) 0; color: var(--text-muted); }

@media (max-width: 39.99em) {
  .lg-auth__side { align-items: center; padding-block: calc(var(--space-6) + env(safe-area-inset-top)) var(--space-8); }
  .lg-auth__card { padding: var(--space-6) var(--space-5); }
  .lg-auth__title { font-size: 1.5rem; line-height: 2rem; }
  .lg-auth__codes { grid-template-columns: 1fr; }
  .lg-auth__session dl div { grid-template-columns: 1fr; gap: 0; }
}
