/* ═══════════════════════════════════════════════════════════════
   SIGN IN — aligned to landing.html / brand.css
   ═══════════════════════════════════════════════════════════════ */
html, body { height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── ambient: same warm-gold wash as the landing hero ─── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 520px at 18% 32%, rgba(241,176,40,0.10), transparent 65%),
    radial-gradient(ellipse 720px 540px at 92% 88%, rgba(63,196,212,0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── top bar (matches landing nav) ─── */
.nav {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid var(--hairline);
  background: rgba(13,11,8,0.78);
  backdrop-filter: blur(16px) saturate(140%);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
}
.nav-brand .nb-egg { width: 26px; height: 32px; }
.nav-brand .nb-egg svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 2px 8px rgba(241,176,40,0.4));
}
.nav-brand .nb-mark {
  font-family: var(--f-display);
  font-weight: var(--w-black);
  font-size: 19px;
  letter-spacing: -0.025em;
}
.nav-brand .nb-mark span { color: var(--gold); }
.nav-brand .nb-tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  margin-left: 4px;
  border-radius: 100px;
  border: 1px solid var(--hairline-2);
  background: var(--surface-2);
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.nav-aux {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.nav-aux a {
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.nav-aux a:hover { color: var(--gold); }
.nav-aux .status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(93,184,104,0.30);
  background: var(--up-soft);
  color: var(--up);
  text-transform: uppercase;
}
.nav-aux .status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 8px var(--up);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(93,184,104,0.55); }
  60%  { box-shadow: 0 0 0 6px rgba(93,184,104,0); }
  100% { box-shadow: 0 0 0 0 rgba(93,184,104,0); }
}

/* ═══════════════════════════════════════════════════
   PAGE LAYOUT
   ═══════════════════════════════════════════════════ */
.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  max-width: 1280px;
  width: 100%;
  margin-block: auto;
  margin-inline: auto;
  padding: 28px 32px;
  gap: 60px;
  align-items: end;
}

/* ─── Left: brand moment ─── */
.brand-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}
.brand-eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}
.brand-egg {
  width: 92px; height: 116px;
  filter: drop-shadow(0 18px 36px rgba(241,176,40,0.45));
}
.brand-egg svg { width: 100%; height: 100%; }
/* Goose mascot (replaces big egg in brand-side per Eli s62 review).
   24x24 line-art viewBox; sized large for hero placement; uses currentColor
   so the gold tone is driven by the wrapper. */
.brand-goose {
  height: 100%; width: auto;
  min-width: calc(clamp(48px, 5.2vw, 72px) * 1.92);
  color: var(--gold);
  filter: drop-shadow(0 18px 36px rgba(241,176,40,0.45));
}
.brand-goose svg {
  height: 100%; width: auto;
  stroke-width: 1.4;
}
/* goose sits beside the heading — stretch so goose spans full heading height */
.brand-hero-row {
  display: flex;
  align-items: stretch;
  gap: 18px;
}
.brand-h {
  font-family: var(--f-display);
  font-weight: var(--w-extra);
  font-size: clamp(48px, 5.2vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  color: var(--ink);
  max-width: 14ch;
}
.brand-h em {
  font-style: normal;
  color: var(--gold);
  font-weight: 900;
}
.brand-sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46ch;
}
.brand-sub strong { color: var(--ink); font-weight: 600; }

/* ─── regime micro-card (decorative, gives the page a product moment) ─── */
.regime-card {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.32);
}
.rc-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}
.rc-head .lbl {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.rc-head .now {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--regime-calm);
  display: inline-flex; align-items: center; gap: 6px;
}
.rc-head .now .pip {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--regime-calm);
  box-shadow: 0 0 8px var(--regime-calm);
}
.rc-bar {
  position: relative;
  display: flex; height: 22px; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--hairline);
}
.rc-bar span { display: block; }
.rc-bar .seg-calm  { background: var(--regime-calm);  flex: 50; }
.rc-bar .seg-rough { background: var(--regime-rough); flex: 50; }
.rc-bar .marker {
  position: absolute; top: -6px;
  left: 70%;
  width: 2px; height: 34px;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--surface), 0 0 10px var(--gold);
}
.rc-bar .marker::before {
  content: "";
  position: absolute; left: -4px; top: -3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--surface);
}
.rc-foot {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.rc-foot span.cal { color: var(--regime-calm); }
.rc-foot span.rgh { color: var(--regime-rough); }
/* Pending / failed states. The bar's 50-50 flex defaults are a layout
   placeholder, not data, so they must not read as a measurement until
   signin.js has written real weights from /api/public/regime-summary. */
.regime-card[data-state="loading"] .rc-bar,
.regime-card[data-state="error"]   .rc-bar { opacity: .35; }
.regime-card[data-state="error"]   .rc-head .lbl { color: var(--down); }

/* ═══════════════════════════════════════════════════
   Right: SIGN IN CARD
   ═══════════════════════════════════════════════════ */
.form-side {
  display: flex;
  justify-content: flex-end;
}
.signin {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 16px;
  padding: 36px 36px 32px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 24px 64px rgba(0,0,0,0.5),
    0 0 0 1px rgba(241,176,40,0.08);
  position: relative;
}
.signin::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 16px;
  background: radial-gradient(circle 320px at 100% 0%, rgba(241,176,40,0.06), transparent 60%);
  pointer-events: none;
}
.signin > * { position: relative; }

.signin-head {
  display: flex; align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}
.signin-h {
  font-family: var(--f-display);
  font-weight: var(--w-bold);
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* ─── Google SSO button (primary-weight control above the email field) ─── */
.sso-google {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  color: var(--ink);
  font: 600 14px var(--f-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.sso-google:hover {
  border-color: var(--gold-line);
  background: var(--surface-3);
}
.sso-google svg { width: 16px; height: 16px; stroke-width: 1.8; }

/* ─── "or use your email" divider between the two equal-weight routes ─── */
.sso-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.sso-divider::before,
.sso-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--hairline);
}

/* ─── form ─── */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
/* CSS display:flex overrides the HTML [hidden] attribute -- restore it, the
   same repair brand.css already makes for .notif-panel and .ggx-menu.
   #reset-invalid-panel carries class="field", so its `hidden` attribute did
   nothing: the "This reset link is invalid or has expired." panel rendered
   next to a perfectly good form on EVERY reset link, valid ones included,
   and reset-password.js's showInvalidPanel() had no un-shown state to
   reveal. Observed in the product at /reset-password?token=<any>. */
.field[hidden] { display: none; }
.field-row {
  display: flex; align-items: baseline; justify-content: space-between;
}
.field label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
/* Not `.field .field-link`: forgot-password.html's "Back to sign in" sits in a
   bare <p class="field-hint">, with no .field ancestor, so the descendant form
   of this rule never matched it and the anchor fell back to the UA default --
   rgb(0,0,238) underlined browser-blue on a dark page, measured in the product.
   The class alone is the contract; every .field-link is styled wherever it sits.

   The BASE size is the standalone one, and the 10px is now the exception, which
   is the inversion this rule needed. .field-link has two jobs in the product and
   they are not the same job:

     1. A utility link sitting on a label row -- signin.html's "Forgot
        password?", the only .field-link inside a .field-row anywhere in
        landing/ (`grep -rn "field-row" landing/` returns signin.html and this
        file, nothing else). It is optically paired with the uppercase 10px mono
        <label> beside it and has to stay 10px or the row stops lining up.

     2. A standalone escape route -- forgot-password.html's "Back to sign in"
        and reset-password.html's "Request a new link" / "Back to sign in". On
        /forgot-password that anchor is the page's ONLY way out, and on
        reset-password's invalid panel the two of them are the whole of the
        user's options because the form is hidden by then. At 10px they read as
        a footnote to the thing they are the alternative to.

   Both are matched by class alone, so the split is done with a .field-row
   override rather than a new class: forgot-password.html and reset-password.html
   are owned elsewhere this round and cannot be given one. */
.field-link {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  /* Escape routes are pointer targets, not running text. inline-block + padding
     gives the anchor a hit area instead of a 13px-tall text box, and separates
     reset-password.html's two stacked exits, which are bare adjacent siblings
     with nothing but a whitespace node between them. */
  display: inline-block;
  padding: 6px 2px;
}
/* The label-row exception (case 1 above). Specificity 0,2,0 beats the 0,1,0
   base, so nothing here depends on source order. */
.field-row .field-link {
  font-size: 10px;
  letter-spacing: 0.10em;
  display: inline;
  padding: 0;
}
.field-link:hover { color: var(--gold-bright); }
.field .input-wrap {
  position: relative;
  display: flex; align-items: center;
}
.field .input-wrap svg.ico {
  position: absolute;
  left: 14px;
  width: 15px; height: 15px;
  color: var(--ink-4);
  stroke-width: 1.8;
  pointer-events: none;
}
.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 13px 14px 13px 40px;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 15px;
  letter-spacing: -0.005em;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus {
  border-color: var(--gold-line);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(241,176,40,0.10);
}
.field .toggle-pw {
  position: absolute;
  right: 10px;
  background: transparent;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px;
  display: grid; place-items: center;
  border-radius: 6px;
}
.field .toggle-pw:hover { color: var(--ink); background: var(--surface-3); }
.field .toggle-pw svg { width: 15px; height: 15px; stroke-width: 1.8; }
.field-hint {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* ─── remember / mfa row ─── */
.remember {
  display: flex; align-items: center; justify-content: space-between;
  margin: 6px 0 22px;
}
.check {
  display: inline-flex; align-items: center; gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--hairline-2);
  background: var(--surface-2);
  display: grid; place-items: center;
  transition: all .15s;
}
.check .box svg {
  width: 11px; height: 11px;
  stroke-width: 3;
  color: var(--gold-ink);
  opacity: 0;
  transition: opacity .15s;
}
.check input:checked + .box {
  background: var(--gold);
  border-color: var(--gold);
}
.check input:checked + .box svg { opacity: 1; }

/* age attestation: wraps to two lines, so the box pins to the first line */
.age-attest { margin-top: -10px; }
.age-attest .check { align-items: flex-start; line-height: 1.45; }
.age-attest .check .box { flex: none; margin-top: 2px; }
.age-attest a { color: var(--gold); text-decoration: none; }
.age-attest a:hover { text-decoration: underline; }
.age-attest input:focus-visible + .box { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ─── primary CTA (same recipe as landing .btn-primary) ─── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 22px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 65%, var(--gold-deep) 100%);
  color: var(--gold-ink);
  font: 600 15px var(--f-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.15),
    0 6px 18px rgba(241,176,40,0.18),
    0 1px 0 var(--gold-deep);
  transition: all .15s;
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-primary svg { width: 16px; height: 16px; stroke-width: 2; }

/* Bouncing-egg loader — appears when btn-primary becomes :disabled. */
.btn-primary .btn-egg-loader { display: none; }
.btn-primary:disabled { cursor: wait; opacity: 1; }
.btn-primary:disabled .btn-label,
.btn-primary:disabled > svg { display: none; }
.btn-primary:disabled .btn-egg-loader {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 28px;
  animation: gg-egg-bounce 0.85s ease-in-out infinite;
}
.btn-primary:disabled .btn-egg-loader svg { width: 100%; height: 100%; }
@keyframes gg-egg-bounce {
  0%, 100% { transform: translateY(0)    rotate(-6deg); }
  50%      { transform: translateY(-9px) rotate( 6deg); }
}
.sso-google .btn-egg-loader { display: none; }
.sso-google:disabled { cursor: wait; opacity: 1; }
.sso-google:disabled > svg,
.sso-google:disabled .btn-label { display: none; }
.sso-google:disabled .btn-egg-loader {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 22px;
  animation: gg-egg-bounce 0.85s ease-in-out infinite;
}
.sso-google:disabled .btn-egg-loader svg { width: 100%; height: 100%; }


/* ═══════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════ */
.foot {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--hairline);
  background: rgba(13,11,8,0.6);
  padding: 18px 0;
}
.foot-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
}
.foot-inner .links { display: flex; gap: 18px; }
.foot-inner .links a {
  color: var(--ink-3);
  text-decoration: none;
}
.foot-inner .links a:hover { color: var(--gold); }
.foot-inner .disclaim {
  max-width: 56ch;
  color: var(--ink-4);
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   responsive
   ═══════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .page {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 40px 24px;
  }
  .form-side { justify-content: center; }
  .brand-h { font-size: 44px; }
  .regime-card { max-width: 100%; }
}
@media (max-width: 560px) {
  .nav-aux .nav-link-text { display: none; }
  .signin { padding: 28px 24px 24px; border-radius: 14px; }
  .sso { grid-template-columns: 1fr; }
  .foot-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
  .foot-inner .disclaim { text-align: left; }
}

/* ═══════════════════════════════════════════════════
   MOBILE (≤720px) — Eli signin mobile pass
   ═══════════════════════════════════════════════════ */
@media (max-width: 720px) {
  /* Reorder: brand hero → signin form → sub paragraph → regime mix.
     display:contents flattens .brand-side + .form-side children into .page. */
  .page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
  }
  .brand-side, .form-side { display: contents; }
  .brand-hero-row { order: 1; }
  .signin        { order: 2; }
  .brand-sub     { order: 3; }
  .regime-card   { order: 4; }

  /* H1 hero: line 1 "Welcome back" all white; line 2 "trader" gold; drop punctuation. */
  .brand-h { line-height: 1.0; max-width: none; }
  .brand-h .bh-back   { color: var(--ink); font-weight: 800; }
  .brand-h .bh-trader {
    display: block;
    color: var(--gold);
    font-weight: 900;
    margin-top: 4px;
  }
  .brand-h .bh-comma,
  .brand-h .bh-period { display: none; }

  /* H2 signin heading: "Sign up or in" (drop " Sign"). The Google button is no
     longer a second child of .signin-head — it is a full-width control below
     the heading at every width — so the space-between and shrink overrides
     that used to live here are gone. */
  .signin-h .sh-skip { display: none; }
  .signin-h { font-size: 22px; white-space: nowrap; }
}


/* -- Invalid / expired reset link: the dead end IS the whole page -------------
   reset-password.js::showInvalidPanel hides the form and reveals
   #reset-invalid-panel, which is a bare `.field` div in reset-password.html
   (immutable), so the state rendered as three lines of 11px mono floating in an
   otherwise empty page -- observed at /reset-password with no token. It is the
   only thing on screen at that point, and it is a credential-recovery dead end,
   so it gets the same card the form has. `:not([hidden])` leaves every normal
   load untouched. Mirrors .signin above; keep the two in step. */
#reset-invalid-panel:not([hidden]) {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 16px;
  padding: 36px 36px 32px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 24px 64px rgba(0,0,0,0.5),
    0 0 0 1px rgba(241,176,40,0.08);
  gap: 14px;
  margin-bottom: 0;
}
#reset-invalid-panel:not([hidden]) #reset-invalid-message {
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  margin-top: 0;
}
@media (max-width: 720px) {
  /* .form-side is display:contents here, so the panel is a direct child of
     .page and needs the same order .signin is given. */
  #reset-invalid-panel:not([hidden]) { order: 2; }
}
@media (max-width: 560px) {
  #reset-invalid-panel:not([hidden]) { padding: 28px 24px 24px; border-radius: 14px; }
}

/* The Nest-only site (nest.regimetrader.ai, App/backend/routes/main_static.py
   ::NEST_HOST). Google sign-in cannot finish there: Google returns to the one
   registered callback on the main host, where this host's state cookie does
   not exist. So the host shows only what works on it -- the email form.
   data-gg-site is stamped per request by main_static.py's /signin route. */
html[data-gg-site="nest"] .sso-google,
html[data-gg-site="nest"] .sso-divider,
html[data-gg-site="nest"] .sso-google-hint { display: none; }
/* People who signed up with Google are pointed at the main host instead. */
.sso-nest-only { display: none; }
html[data-gg-site="nest"] .sso-nest-only { display: block; }
