:root {
  --auth-ink: #f8fafc;
  --auth-muted: #a3b0c5;
  --auth-mode-slot-height: 87px;
}

/* Keep width: 100% controls inside the auth card instead of adding padding on top. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 470px);
  gap: clamp(40px, 8vw, 128px);
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
}

.auth-story {
  display: flex;
  flex-direction: column;
  min-height: 670px;
  padding: 10px 0;
}

.auth-brand-bar {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: transform .22s var(--noah-ease);
}

.auth-brand-bar.noah-brand-pill {
  padding: 0;
}

.auth-brand-bar::after {
  display: none;
}

.auth-brand-bar:hover {
  transform: translate3d(0, -2px, 0);
}

.auth-brand-bar:hover::after {
  display: none;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--auth-ink);
  font-family: var(--noah-font-sans);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -.04em;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px 10px 10px 4px;
  color: #111;
  background: var(--noah-lime);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  transform: rotate(-8deg);
  box-shadow: 0 0 28px rgba(215, 243, 107, .25);
}

.auth-brand-mark.noah-brand-mark {
  width: 31px;
  height: 31px;
  border-radius: 10px 10px 10px 4px;
  color: #111;
  background: var(--noah-lime);
  font: 700 14px/1 var(--noah-font-mono);
  transform: rotate(-8deg);
}

.auth-brand > span:last-child {
  font-size: 17px;
}

.auth-story-copy {
  max-width: 650px;
  margin: auto 0 46px;
}

.auth-story-copy .noah-kicker {
  margin-bottom: 18px;
}

.noah-kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--noah-lime);
  box-shadow: 0 0 14px var(--noah-lime);
}

/* A continuously animated child inside a backdrop-filter card can invalidate the
   blurred surface on every frame. Keep the secure status affordance static. */
.live-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--noah-lime);
  box-shadow: 0 0 14px var(--noah-lime);
}

.auth-story-copy h1 {
  margin: 0;
  color: var(--auth-ink);
  font: 700 clamp(45px, 6vw, 82px) / .96 var(--noah-font-mono);
  letter-spacing: -.09em;
}

.auth-story-copy h1 em {
  color: var(--noah-cyan);
  font-style: normal;
}

.auth-story-copy p {
  max-width: 530px;
  margin: 24px 0 0;
  color: var(--auth-muted);
  font-size: 17px;
  line-height: 1.75;
}

.auth-story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 590px;
}

.story-chip {
  display: grid;
  gap: 6px;
  padding: 17px;
}

.story-chip strong {
  color: var(--noah-lime);
  font: 700 23px var(--noah-font-mono);
}

.story-chip span {
  color: var(--auth-muted);
  font: 11px var(--noah-font-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.auth-quote {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 590px;
  margin-top: 14px;
  padding: 18px;
}

.quote-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #10120b;
  background: var(--noah-amber);
  font: 700 14px var(--noah-font-mono);
}

.auth-quote p {
  margin: 0 0 7px;
  color: var(--auth-ink);
  font-size: 13px;
  line-height: 1.5;
}

.auth-quote span {
  color: var(--noah-soft);
  font: 10px var(--noah-font-mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.auth-card {
  width: 100%;
  min-width: 0;
  padding: clamp(24px, 4vw, 38px);
}

.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.auth-card-head > div {
  min-height: 129px;
}

.auth-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--noah-lime);
  font: 600 11px var(--noah-font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 0;
  color: var(--auth-ink);
  font: 700 28px / 1.05 var(--noah-font-mono);
  letter-spacing: -.07em;
}

.auth-card-head p {
  margin: 10px 0 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.5;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid rgba(34, 197, 94, .25);
  border-radius: 999px;
  color: #b8ffcf;
  background: rgba(34, 197, 94, .08);
  font: 600 10px var(--noah-font-mono);
  text-transform: uppercase;
}

.auth-tabs {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--noah-border);
  border-radius: 14px;
  background: rgba(0, 0, 0, .14);
}

.auth-tab-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 12px) / 2);
  border: 1px solid rgba(215, 243, 107, .18);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--noah-lime), var(--noah-cyan));
  box-shadow: 0 7px 20px rgba(34, 197, 94, .14), inset 0 1px 0 rgba(255, 255, 255, .28);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}

.auth-tabs[data-active-mode="signup"] .auth-tab-indicator {
  transform: translate3d(calc(100% + 4px), 0, 0);
}

.auth-tab {
  min-height: 38px;
  position: relative;
  z-index: 1;
  padding: 8px 6px;
  border: 0;
  border-radius: 10px;
  color: var(--noah-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  transition: color .2s var(--noah-ease), background .2s var(--noah-ease), transform .2s var(--noah-ease);
}

.auth-tab:hover {
  color: var(--auth-ink);
}

.auth-tab.active {
  color: #08120d;
  background: transparent;
  box-shadow: none;
}

.auth-tab:focus-visible {
  outline: 2px solid var(--noah-cyan);
  outline-offset: -2px;
}

.auth-message {
  padding: 11px 13px;
  margin: 0 0 16px;
  border: 1px solid var(--noah-border);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.auth-message.danger {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, .3);
  background: rgba(251, 113, 133, .10);
}

.auth-message.success {
  color: #b8ffcf;
  border-color: rgba(34, 197, 94, .3);
  background: rgba(34, 197, 94, .10);
}

.form-field {
  margin-bottom: 16px;
}

.auth-mode-slot {
  position: relative;
  height: var(--auth-mode-slot-height);
}

#name-field {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translate3d(0, -9px, 0);
  transition: opacity .24s ease, transform .32s cubic-bezier(.4, 0, .2, 1);
  will-change: opacity, transform;
}

#name-field.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.signin-mode-note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 2px;
  color: var(--noah-soft);
  font: 500 11px / 1.55 var(--noah-font-mono);
  pointer-events: none;
  transform: translate3d(0, -6px, 0);
  opacity: 0;
  transition: opacity .24s ease, transform .32s cubic-bezier(.4, 0, .2, 1);
  will-change: opacity, transform;
}

.signin-mode-note::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  margin-right: 9px;
  border: 1px solid rgba(134, 232, 220, .20);
  border-radius: 8px;
  color: var(--noah-cyan);
  background: rgba(134, 232, 220, .06);
  font: 600 16px / 1 var(--noah-font-mono);
}

.auth-card[data-auth-mode="signin"] .signin-mode-note {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--auth-ink);
  font-size: 12px;
  font-weight: 700;
}

.optional {
  color: var(--noah-soft);
  font-weight: 500;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-label-row label {
  margin: 0;
}

.field-label-row a,
.field-label-row button {
  margin: 0;
  border: 0;
  padding: 0;
  color: var(--noah-cyan);
  font-size: 11px;
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.field-label-row a:hover,
.field-label-row button:hover {
  color: var(--noah-lime);
}

.forgot-link[hidden] {
  display: none;
}

.password-wrap {
  position: relative;
}

.password-wrap .noah-input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  padding: 5px;
  border: 0;
  color: var(--noah-cyan);
  background: transparent;
  font: 600 11px var(--noah-font-mono);
}

.field-help {
  display: block;
  margin-top: 7px;
  color: var(--noah-soft);
  font-size: 10px;
  line-height: 1.5;
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
}

.auth-submit[disabled] {
  cursor: wait;
  opacity: .62;
  transform: none;
}

.auth-submit-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(8, 18, 13, .28);
  border-top-color: #08120d;
  border-radius: 50%;
}

.auth-submit.loading .auth-submit-spinner {
  display: block;
  animation: authSpin .7s linear infinite;
}

/* A temporary composited veil avoids a layout-changing spinner and keeps focus clear. */
.auth-card.is-submitting {
  position: relative;
}

.auth-card.is-submitting::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  content: "";
  border-radius: inherit;
  background: rgba(5, 9, 14, .14);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  animation: authVeilIn .16s ease both;
}

.auth-shell.is-submitting::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background: rgba(2, 6, 12, .12);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  animation: authVeilIn .16s ease both;
}

/* The form keeps a stable footprint; mode-specific content cross-fades in place. */
.auth-form-region {
  height: auto;
  overflow: hidden;
}

.auth-form-region > form {
  min-width: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 23px 0 15px;
  color: var(--noah-soft);
  font: 10px var(--noah-font-mono);
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--noah-border);
}

.support-link {
  width: 100%;
}

.auth-footnote {
  margin: 18px 0 0;
  color: var(--noah-soft);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

/* The reset flow stays in context instead of sending users to support. */
body.reset-open {
  overflow: hidden;
}

.reset-modal {
  position: fixed;
  /* Keep recovery controls above global toast notifications on short phones. */
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.reset-modal[hidden],
.reset-panel[hidden],
.reset-mock-code[hidden] {
  display: none;
}

.reset-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 16, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: resetFadeIn .2s ease both;
}

.reset-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(760px, calc(100dvh - 32px));
  overflow: auto;
  padding: 32px;
  animation: resetDialogIn .34s var(--noah-ease) both;
}

.reset-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--noah-border);
  border-radius: 10px;
  color: var(--noah-muted);
  background: rgba(255, 255, 255, .04);
  transition: color .2s var(--noah-ease), border-color .2s var(--noah-ease), transform .2s var(--noah-ease), background .2s var(--noah-ease);
}

.reset-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.reset-close:hover {
  color: var(--noah-text);
  border-color: rgba(134, 232, 220, .42);
  background: rgba(255, 255, 255, .08);
  transform: rotate(6deg);
}

.reset-dialog-head {
  max-width: 365px;
  padding-right: 35px;
}

.reset-dialog-head .auth-eyebrow {
  margin-bottom: 10px;
}

.reset-dialog h2 {
  margin: 0;
  color: var(--auth-ink);
  font: 700 28px / 1.05 var(--noah-font-mono);
  letter-spacing: -.07em;
}

.reset-dialog-head p {
  margin: 11px 0 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.55;
}

.reset-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 26px 0 22px;
}

.reset-step {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid var(--noah-border);
  border-radius: 12px;
  color: var(--noah-soft);
  background: rgba(255, 255, 255, .025);
  transition: color .2s var(--noah-ease), border-color .2s var(--noah-ease), background .2s var(--noah-ease), transform .2s var(--noah-ease);
}

.reset-step span {
  font: 700 11px var(--noah-font-mono);
}

.reset-step small {
  overflow: hidden;
  font: 10px var(--noah-font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reset-step.active {
  color: var(--noah-lime);
  border-color: rgba(34, 197, 94, .38);
  background: rgba(34, 197, 94, .08);
  transform: translateY(-1px);
}

.reset-step.complete {
  color: var(--noah-cyan);
  border-color: rgba(134, 232, 220, .3);
  background: rgba(134, 232, 220, .06);
}

.reset-dialog .auth-message {
  margin-bottom: 16px;
}

.reset-panel .form-field {
  margin-bottom: 17px;
}

.reset-code-input {
  font: 700 22px var(--noah-font-mono);
  letter-spacing: .18em;
  text-align: center;
}

.reset-mock-code {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  margin: -2px 0 18px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 157, 103, .28);
  border-radius: 13px;
  background: rgba(255, 157, 103, .08);
}

.reset-mock-code-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ffd1af;
  font: 600 10px var(--noah-font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.reset-mock-code-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--noah-amber);
  box-shadow: 0 0 12px var(--noah-amber);
}

.reset-mock-code strong {
  color: var(--auth-ink);
  font: 700 21px var(--noah-font-mono);
  letter-spacing: .15em;
}

.reset-mock-code button {
  grid-row: span 2;
  padding: 7px 9px;
  border: 1px solid rgba(255, 157, 103, .34);
  border-radius: 9px;
  color: #ffd1af;
  background: rgba(255, 157, 103, .1);
  font: 600 10px var(--noah-font-mono);
}

.reset-mock-code button:hover {
  color: var(--auth-ink);
  background: rgba(255, 157, 103, .18);
}

.reset-mock-code small {
  grid-column: 1 / -1;
  color: var(--noah-soft);
  font-size: 10px;
  line-height: 1.45;
}

.reset-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.reset-actions .reset-submit {
  width: 100%;
}

.reset-submit.loading svg {
  animation: authSpin .7s linear infinite;
}

.reset-resend {
  display: block;
  margin: 16px auto 0;
  padding: 0;
  border: 0;
  color: var(--noah-cyan);
  background: transparent;
  font: 600 11px var(--noah-font-mono);
}

.reset-resend:hover {
  color: var(--noah-lime);
}

.reset-complete {
  text-align: center;
}

.reset-complete-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 17px;
  border-radius: 15px 15px 15px 5px;
  color: #07111d;
  background: linear-gradient(135deg, var(--noah-lime), var(--noah-cyan));
  box-shadow: 0 0 32px rgba(34, 197, 94, .24);
  font: 700 18px var(--noah-font-mono);
  transform: rotate(-8deg);
}

.reset-complete h3 {
  margin: 0;
  color: var(--auth-ink);
  font: 700 20px var(--noah-font-mono);
  letter-spacing: -.05em;
}

.reset-complete p {
  margin: 11px auto 22px;
  max-width: 340px;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.55;
}

.reset-complete .noah-button {
  width: 100%;
}

@keyframes resetFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes resetDialogIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

@keyframes authVeilIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(560px, calc(100% - 36px));
    min-width: 0;
    padding: 28px 0;
  }

  .auth-story {
    min-height: auto;
    padding: 0;
  }

  /* On stacked tablet/mobile layouts, keep the brand but make the auth card the only story. */
  .auth-story-copy,
  .auth-story-grid,
  .auth-quote {
    display: none;
  }

}

@media (max-width: 700px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    width: min(470px, calc(100% - 24px));
    min-height: 100dvh;
    padding: 18px 0 max(26px, env(safe-area-inset-bottom));
  }

  /* Keep the compact landing-style logo, but remove the marketing story on phones. */
  .auth-story {
    min-height: 0;
    padding: 0;
  }

  .auth-card {
    width: 100%;
    max-width: 470px;
    margin: 0 auto;
  }

  .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-tab {
    min-width: 0;
    padding-inline: 2px;
    font-size: clamp(10px, 2.8vw, 12px);
    letter-spacing: -.02em;
    white-space: nowrap;
  }

}

@media (max-width: 520px) {
  :root {
    --auth-mode-slot-height: 75px;
  }

  .auth-shell {
    width: min(100% - 24px, 470px);
    padding: 16px 0 max(16px, env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 18px 17px;
  }

  .auth-tabs {
    margin-bottom: 18px;
  }

  .form-field {
    margin-bottom: 14px;
  }

  .auth-divider {
    margin: 18px 0 12px;
  }

  .auth-footnote {
    margin-top: 14px;
  }

  .auth-card-head {
    display: block;
    margin-bottom: 14px;
  }

  .live-dot {
    display: none;
  }

  .support-link {
    gap: 7px;
    padding-inline: 8px;
    color: var(--noah-muted);
    font-size: 11px;
    white-space: nowrap;
  }

  .auth-footnote {
    display: none;
  }

  .reset-modal {
    padding: 12px;
  }

  .reset-dialog {
    max-height: calc(100dvh - 24px);
    padding: 24px 18px 20px;
    border-radius: 19px;
  }

  .reset-close {
    top: 13px;
    right: 13px;
  }

  .reset-dialog h2 {
    font-size: 24px;
  }

  .reset-dialog-head {
    padding-right: 30px;
  }

  .reset-steps {
    gap: 5px;
    margin: 21px 0 17px;
  }

  .reset-step {
    padding: 9px 8px;
  }

  .reset-step small {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand-bar,
  .auth-brand-bar::after,
  .auth-tab-indicator,
  #name-field,
  .signin-mode-note {
    transition: none;
  }
}
