/* ============================================================
   SIGN IN, SIGN UP, RECOVERY AND CONFIRMATION. Loaded only by
   templates/auth/_shell.html, in place of app.css, so nothing here reaches any
   other page and nothing in app.css reaches these. Every rule is scoped under
   `.rw-auth`.

   SOURCE. Figma page "Rankedwire / 01 Authentication" (2061:171), AUTH-01 to
   AUTH-15, desktop and mobile, with the tokens of the "Rankedwire / SaaS"
   collection (Light mode).

   DESIGN BATCH 2: NAVY, NIGHT BY DEFAULT, WITH THE MODE SWITCH. The doors now
   wear the first page's shell (DESIGN_SPEC_WORKSPACE.md section 9 of the brief:
   a centred 440px card with the mark, an uppercase H1, the gradient primary).
   The saved `nr-theme` applies before paint through base.html, and
   `[data-theme="light"]` swaps the tokens, as on the first page.
   ============================================================ */

@font-face {
  font-family: "Jost";
  src: url("../fonts/Jost-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens: the first page's Navy (design batch 2) ----------
   The body carries `lp-body rw-auth`, so `css/landing-tokens.css` (loaded
   before this sheet) supplies every colour, night by default and day under
   `[data-theme="light"]`. No colour literal lives here any more. */
.rw-auth {
  --au-page:   var(--lp-page);
  --au-panel:  var(--lp-panel);
  --au-ink:    var(--lp-ink);
  --au-text:   var(--lp-text);
  --au-muted:  var(--lp-muted);
  --au-border: var(--lp-border);
  --au-danger: var(--lp-danger);
  --au-gradient: var(--lp-gradient-live);
  --au-pw-weak: var(--lp-danger); --au-pw-fair: var(--lp-warn); --au-pw-good: var(--lp-ok); --au-pw-strong: var(--lp-ok);
  --au-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --au-brand: "Jost", Arial, sans-serif;
  --au-ease: cubic-bezier(0, 0, 0.2, 1);

  color-scheme: dark;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--au-page);
  color: var(--au-text);
  font-family: var(--au-font);
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
.rw-auth,
.rw-auth *,
.rw-auth *::before,
.rw-auth *::after { box-sizing: border-box; }
.rw-auth p { margin: 0; }
.rw-auth a { color: inherit; }
.rw-auth [hidden] { display: none !important; }
.rw-auth .au-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.rw-auth a:focus-visible,
.rw-auth button:focus-visible,
.rw-auth input:focus-visible,
.rw-auth select:focus-visible {
  outline: 2px solid var(--au-ink);
  outline-offset: 2px;
}
.rw-auth .au-skip {
  position: absolute; left: 16px; top: -60px; z-index: 10; padding: 10px 16px;
  background: var(--au-panel); color: var(--au-ink); border: 1px solid var(--au-border);
  border-radius: 8px; font-weight: 500; text-decoration: none;
}
.rw-auth .au-skip:focus { top: 12px; }

/* ---------- Header (2063:200): the lockup and the three doors ---------- */
.rw-auth .au-header {
  display: flex; align-items: center; gap: 16px;
  padding: 32px; background: var(--au-panel);
}
.rw-auth .au-logo { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 250px; text-decoration: none; }
.rw-auth .au-logo-mark { display: block; width: 48px; height: 19px; }
.rw-auth .au-logo-word {
  font-family: var(--au-brand); font-weight: 500; font-size: 18px; line-height: 24px;
  text-transform: uppercase; color: var(--au-ink); white-space: nowrap;
}
.rw-auth .au-doors { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .au-doors a { color: var(--au-muted); text-decoration: none; }
.rw-auth .au-doors a:hover { color: var(--au-ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- The card (2063:206) ---------- */
/* The main area does not grow, so the brand line sits 24px under the card as
   the frames draw it, not at the foot of a tall window. */
.rw-auth .au-main {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 24px;
  padding: 48px 24px 24px;
}
.rw-auth .au-card {
  display: flex; flex-direction: column; gap: 24px;
  width: 100%; max-width: 504px; padding: 32px;
  background: var(--au-panel); border: 1px solid var(--au-border); border-radius: 12px;
}
.rw-auth .au-heading { display: flex; flex-direction: column; gap: 8px; }
.rw-auth .au-eyebrow { font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .au-title { margin: 0; font-size: 28px; line-height: 36px; font-weight: 600; color: var(--au-text); }
/* Sentences stack one to a line, as the frames set them; inline words inside a
   sentence (a bold account name) stay inline. */
.rw-auth .au-lede,
.rw-auth .au-body,
.rw-auth .au-success { display: block; font-size: 14px; line-height: 22px; color: var(--au-muted); }
.rw-auth .au-lede > span,
.rw-auth .au-body > span,
.rw-auth .au-success > span { display: block; }
.rw-auth .au-gap { height: 22px; }
.rw-auth .au-caption { font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .au-strong { color: var(--au-text); font-weight: 600; }
.rw-auth .au-divider { height: 1px; margin: 0; border: 0; background: var(--au-border); }

/* ---------- Forms: the Field component (2062:192) ---------- */
.rw-auth .au-form { display: flex; flex-direction: column; gap: 24px; margin: 0; }
.rw-auth .au-fields { display: flex; flex-direction: column; gap: 20px; }
.rw-auth .au-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rw-auth .au-label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--au-text); }
.rw-auth .au-help { font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .au-input,
.rw-auth .au-select {
  display: block; width: 100%; height: 44px; margin: 0; padding: 0 12px;
  border: 1px solid var(--au-border); border-radius: 8px;
  background: var(--au-panel); color: var(--au-text);
  font-family: var(--au-font); font-size: 16px; line-height: 24px;
  transition: border-color 200ms var(--au-ease);
}
.rw-auth .au-input::placeholder { color: var(--au-muted); opacity: 1; }
.rw-auth .au-input:focus-visible,
.rw-auth .au-select:focus-visible { outline: none; border-color: var(--au-text); box-shadow: inset 0 0 0 1px var(--au-text); }
.rw-auth .au-input[aria-invalid="true"] { border-color: var(--au-danger); }
.rw-auth .au-select-wrap { position: relative; width: 100%; min-width: 0; }
.rw-auth .au-select { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; text-overflow: ellipsis; }
.rw-auth .au-select-wrap::after {
  content: ""; position: absolute; right: 12px; top: 12px; width: 20px; height: 20px; pointer-events: none;
  background: var(--au-muted);
  -webkit-mask: url("../cust-saas/icon-chevron.svg") center / 20px 20px no-repeat;
          mask: url("../cust-saas/icon-chevron.svg") center / 20px 20px no-repeat;
}
/* THE PHONE, AS ONE CONTROL (2063:178): the country code and the number sit
   inside one bordered box, divided by a hairline, as the frame draws a single
   field. They stay two real fields, `phone_dial` and `phone_number`, each with
   its own accessible name, and the box takes the focus ring of whichever one is
   focused. */
.rw-auth .au-phone {
  display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 14fr); align-items: stretch;
  height: 44px; border: 1px solid var(--au-border); border-radius: 8px; background: var(--au-panel);
  transition: border-color 200ms var(--au-ease);
}
.rw-auth .au-phone .au-select-wrap { border-right: 1px solid var(--au-border); }
.rw-auth .au-phone .au-select,
.rw-auth .au-phone .au-input { height: 42px; border: 0; border-radius: 0; background: transparent; }
.rw-auth .au-phone .au-select { border-radius: 8px 0 0 8px; }
.rw-auth .au-phone .au-input { border-radius: 0 8px 8px 0; }
.rw-auth .au-phone .au-select-wrap::after { top: 11px; }
.rw-auth .au-phone:focus-within { border-color: var(--au-text); box-shadow: inset 0 0 0 1px var(--au-text); }
.rw-auth .au-phone .au-select:focus-visible,
.rw-auth .au-phone .au-input:focus-visible { box-shadow: none; outline: none; background: var(--au-page); }

/* The consent box: 16px, never pre-ticked, its own label. */
.rw-auth .au-check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 14px; line-height: 22px; color: var(--au-text); }
.rw-auth .au-check input { flex-shrink: 0; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--au-text); cursor: pointer; }
.rw-auth .au-check a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Buttons and links ---------- */
.rw-auth .au-button {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px;
  padding: 10px 16px; border: 1px solid var(--au-border); border-radius: 8px;
  background: var(--au-panel); color: var(--au-text);
  font-family: var(--au-font); font-size: 14px; line-height: 20px; font-weight: 500;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: transform 120ms var(--au-ease), filter 120ms var(--au-ease), background-color 200ms var(--au-ease);
}
.rw-auth .au-button:hover { background: var(--au-page); }
.rw-auth .au-button:active { transform: scale(0.985); }
.rw-auth .au-button-primary { border: 0; background: var(--au-gradient); color: var(--au-panel); }
.rw-auth .au-button-primary:hover { background: var(--au-gradient); filter: brightness(1.05); }
.rw-auth .au-choices { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.rw-auth .au-recover { text-align: right; font-size: 14px; line-height: 20px; font-weight: 500; }
.rw-auth .au-recover a,
.rw-auth .au-links a { color: var(--au-text); text-decoration: none; }
.rw-auth .au-recover a:hover,
.rw-auth .au-links a:hover { color: var(--au-ink); text-decoration: underline; text-underline-offset: 3px; }
.rw-auth .au-links { display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--au-text); }

/* ---------- Notices: errors, expired links, unavailable service ---------- */
.rw-auth .au-notice {
  padding: 12px 16px; border: 1px solid var(--au-border); border-radius: 8px;
  background: var(--au-panel); font-size: 14px; line-height: 22px; color: var(--au-muted);
}
.rw-auth .au-notice.is-error { border-color: var(--au-danger); }
.rw-auth .au-notice a { color: var(--au-text); font-weight: 500; }
.rw-auth .au-notice.is-dev { word-break: break-all; border-style: dashed; }


/* ---------- Shared partials, drawn in this language ---------- */
/* partials/door_signpost.html */
/* One sentence to a line, as AUTH-01 to AUTH-03 set them (2063:228). */
.rw-auth .door-signpost { display: flex; flex-direction: column; gap: 0; font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .door-signpost p { margin: 0; }
.rw-auth .door-signpost .door-line { display: block; }
.rw-auth .door-signpost small { font-size: inherit; }
.rw-auth .door-signpost a { color: var(--au-text); text-decoration: underline; text-underline-offset: 2px; }
/* partials/signed_in_elsewhere.html */
.rw-auth .switch-warning {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 16px;
  border: 1px solid var(--au-border); border-radius: 8px; background: var(--au-page);
  font-size: 14px; line-height: 22px; color: var(--au-text);
}
.rw-auth .switch-warning .path-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rw-auth .switch-warning .button-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--au-border); border-radius: 8px; background: var(--au-panel);
  color: var(--au-text); font-weight: 500; text-decoration: none;
}
/* partials/password_meter.html, upgraded by password-meter.js */
/* The strength meter is kept (it is useful) and set in the field's own rhythm:
   the bar runs flush under the control, the strength word and the help and
   rules follow as captions, so the field reads as the frame's Field with its
   help text, plus a thin live bar. */
.rw-auth .pw-meter { display: flex; flex-direction: column; gap: 6px; margin-top: -2px; }
.rw-auth .pw-meter small { font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .pw-meter .pw-bar { display: block; width: 100%; height: 3px; overflow: hidden; background: var(--au-border); border-radius: 999px; }
.rw-auth .pw-meter .pw-bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--au-pw-weak); transition: width 140ms ease, background-color 140ms ease; }
.rw-auth .pw-bar.is-weak   .pw-bar-fill { background: var(--au-pw-weak); }
.rw-auth .pw-bar.is-fair   .pw-bar-fill { background: var(--au-pw-fair); }
.rw-auth .pw-bar.is-good   .pw-bar-fill { background: var(--au-pw-good); }
.rw-auth .pw-bar.is-strong .pw-bar-fill { background: var(--au-pw-strong); }
.rw-auth .pw-meter .pw-strength-label { display: block; min-height: 18px; font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .password-rules { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .password-rules li::before { content: "\25CB"; display: inline-block; width: 16px; }
.rw-auth .pw-meter.is-live .password-rules li.is-met { color: var(--au-text); }
.rw-auth .pw-meter.is-live .password-rules li.is-met::before { content: "\2713"; color: var(--au-pw-good); }
/* The parent brand line, under the card (2063:229). */
.rw-auth .app-footer,
.rw-auth .au-footer { padding: 0 24px 48px; margin-top: 0; text-align: center; font-size: 12px; line-height: 18px; color: var(--au-muted); }
.rw-auth .app-footer p, .rw-auth .au-footer p { margin: 0; }
.rw-auth .app-footer a, .rw-auth .au-footer a { color: var(--au-muted); }

/* ---------- Phone (2063:171): one white page, no card frame ---------- */
@media (max-width: 599px) {
  .rw-auth { background: var(--au-panel); }
  .rw-auth .au-header { padding: 24px; }
  .rw-auth .au-logo { flex: 0 0 auto; }
  .rw-auth .au-doors { display: none; }
  .rw-auth .au-main { padding: 24px 24px 24px; }
  .rw-auth .au-card { max-width: none; padding: 24px 0 0; border: 0; border-radius: 0; }
  .rw-auth .au-phone { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rw-auth .app-footer, .rw-auth .au-footer { padding-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .rw-auth *, .rw-auth *::before, .rw-auth *::after { transition: none !important; animation: none !important; }
  .rw-auth .au-button:active { transform: none; }
}
.rw-auth .au-lede strong,
.rw-auth .au-body strong { color: var(--au-text); font-weight: 600; }


/* ============================================================
   DESIGN BATCH 2: THE NAVY DOORS (sign in, sign up and every auth page)
   ============================================================ */
[data-theme="light"] .rw-auth { color-scheme: light; }
.rw-auth { background: var(--lp-page); }
.rw-auth::before {
  content: ""; position: fixed; inset: -20% -10% auto auto; width: 70vw; height: 70vh; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, var(--lp-aurora-violet), transparent), radial-gradient(closest-side at 30% 70%, var(--lp-aurora-coral), transparent);
  filter: blur(30px); opacity: 0.55;
}
.rw-auth .au-header, .rw-auth .au-main, .rw-auth .app-footer, .rw-auth .au-footer { position: relative; z-index: 1; }
.rw-auth .au-header { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--lp-header-line); background: transparent; }
.rw-auth .au-logo { display: inline-flex; align-items: center; gap: 10px; }
.rw-auth .au-logo-mark { width: 44px; height: 17px; }
.rw-auth .au-logo-word { font-family: var(--au-brand); font-size: 15px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lp-ink); }
.rw-auth .au-doors { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--lp-muted); }
.rw-auth .au-doors a { color: var(--lp-soft); }
.rw-auth .au-doors a:hover { color: var(--lp-ink); }
.rw-auth .au-mode {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--lp-border); border-radius: 50%; background: var(--lp-panel); color: var(--lp-ink); cursor: pointer;
}
.rw-auth .au-mode span { display: inline-flex; }
.rw-auth .au-mode .ws-icon-moon { display: none; }
[data-theme="light"] .rw-auth .au-mode .ws-icon-sun { display: none; }
[data-theme="light"] .rw-auth .au-mode .ws-icon-moon { display: inline-flex; }
.rw-auth .au-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; padding: 56px 16px 40px; }
.rw-auth .au-card {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 32px 30px;
  background: var(--lp-panel); border: 1px solid var(--lp-border); border-radius: 20px;
  box-shadow: 0 30px 60px -30px var(--lp-shadow);
  animation: au-rise 600ms cubic-bezier(.2, .7, .2, 1) both;
}
.rw-auth .au-card-mark { display: block; width: 56px; height: 22px; }
.rw-auth .au-heading { display: flex; flex-direction: column; gap: 6px; }
.rw-auth .au-eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.18em; font-weight: 600; text-transform: uppercase; color: var(--lp-accent-text); }
.rw-auth .au-title { margin: 0; font-family: var(--au-brand); font-size: 32px; line-height: 1.05; font-weight: 600; letter-spacing: -0.01em; text-transform: uppercase; color: var(--lp-ink); }
.rw-auth .au-lede, .rw-auth .au-body { margin: 0; color: var(--lp-soft); }
.rw-auth .au-label { font-size: 11px; letter-spacing: 0.14em; font-weight: 600; text-transform: uppercase; color: var(--lp-muted); }
.rw-auth .au-input, .rw-auth .au-select { background: var(--lp-page); border: 1px solid var(--lp-border); border-radius: 10px; color: var(--lp-ink); min-height: 46px; }
.rw-auth .au-input:focus, .rw-auth .au-select:focus { border-color: var(--lp-magenta); outline: none; box-shadow: 0 0 0 3px var(--lp-glow-faint); }
.rw-auth .au-button { border-radius: 999px; min-height: 48px; font-weight: 600; border: 1px solid var(--lp-line); background: transparent; color: var(--lp-ink); }
.rw-auth .au-button-primary { border: 0; color: var(--lp-on-gradient); background: var(--lp-gradient-live); background-size: 200% 100%; animation: au-shift 6s linear infinite; }
.rw-auth .au-button-primary:hover { filter: brightness(1.12); }
.rw-auth .au-links a, .rw-auth .au-recover a, .rw-auth .au-check a, .rw-auth .door-signpost a, .rw-auth .au-notice a { color: var(--lp-accent-text); }
.rw-auth .au-notice { border-radius: 12px; border: 1px solid var(--lp-line); background: var(--lp-page); color: var(--lp-text); }
.rw-auth .au-notice.is-error { border-color: var(--lp-danger); color: var(--lp-ink); }
.rw-auth .au-saved { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--lp-tint-line); border-radius: 12px; background: var(--lp-tint); color: var(--lp-ink); font-size: 13px; }
.rw-auth .au-saved::before { content: ""; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--lp-magenta); }
.rw-auth .au-check input { accent-color: var(--lp-magenta); width: 18px; height: 18px; }
.rw-auth .au-divider { border: 0; height: 1px; background: var(--lp-border); }
.rw-auth .app-footer, .rw-auth .app-footer p, .rw-auth .app-footer a,
.rw-auth .au-footer, .rw-auth .au-footer p, .rw-auth .au-footer a { color: var(--lp-muted); }
.rw-auth a:focus-visible, .rw-auth button:focus-visible, .rw-auth input:focus-visible, .rw-auth select:focus-visible { outline: 2px solid var(--lp-ink); outline-offset: 2px; }
@keyframes au-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes au-shift { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@media (max-width: 619px) {
  .rw-auth .au-header { padding: 14px 16px; flex-wrap: wrap; }
  .rw-auth .au-doors { order: 3; width: 100%; margin-left: 0; }
  .rw-auth .au-mode { margin-left: auto; }
  .rw-auth .au-main { padding: 24px 16px 32px; }
  .rw-auth .au-card { padding: 24px 20px; }
  .rw-auth .au-title { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .rw-auth *, .rw-auth *::before, .rw-auth *::after { animation: none !important; transition: none !important; }
}

/* The error card (batch 2b): 404, 500, a form that could not be read, an
   expired form. Same body type as the other doors. */
.rw-auth .au-error { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 22px; color: var(--au-text); }
.rw-auth .au-error p { margin: 0; }
.rw-auth .au-error a { color: var(--au-ink); }
.rw-auth .au-error .form-error-fields { margin: 0; padding-left: 18px; }
/* A page with no doors line (the missing partner record) keeps the mode switch
   at the right of the header (design batch 3). */
.rw-auth .au-logo + .au-mode { margin-left: auto; }
/* The staff door's card is the narrower one (design batch 4, DESIGN_SPEC_STAFF.md: 440px). */
.rw-auth .au-card:has(#staff-username) { max-width: 440px; }
