/* Auth screens + elevated landing modals. Safe to load on index.html:
   page-only chrome is under body.auth-page; form widgets are under .auth-card. */

.auth-overlay {
  --cream: #f4efe6;
  --cream-2: #ebe4d8;
  --paper: #fffdf8;
  --ink: #14161f;
  --muted: #5c5866;
  --navy: #0c1220;
  --navy-2: #151c2e;
  --purple: #6d28d9;
  --violet: #7c3aed;
  --lilac: #ece4ff;
  --line: rgba(20, 22, 31, 0.1);
  --danger: #b42318;
  --ok: #067647;
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px clamp(16px, 3vw, 40px);
  background: rgba(12, 18, 32, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.auth-overlay.is-open { display: flex; }
.auth-overlay[hidden] { display: none !important; }

.auth-stage {
  position: relative;
  align-self: center;
  width: min(1080px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 32px;
  background: var(--paper, #fffdf8);
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1));
  box-shadow:
    0 8px 24px rgba(12, 18, 32, 0.12),
    0 40px 90px rgba(12, 18, 32, 0.34);
}
.auth-stage.is-switching {
  transition: height 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

html.auth-modal-open,
html.auth-modal-open body {
  overflow: hidden !important;
}

.auth-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  background: var(--paper, #fffdf8);
  color: var(--ink, #14161f);
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1));
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(12, 18, 32, 0.18);
  min-height: 0;
}

.auth-overlay .auth-card {
  width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--paper, #fffdf8);
}
.auth-overlay .auth-card[hidden] { display: none !important; }
.auth-stage.is-switching .auth-card.is-swap-out,
.auth-stage.is-switching .auth-card.is-swap-in {
  display: grid !important;
}
.auth-stage .auth-card.is-swap-out {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
}
.auth-stage .auth-card.is-swap-in {
  position: relative;
  z-index: 2;
  opacity: 0;
}
.auth-stage.is-ready .auth-card.is-swap-out {
  opacity: 0;
  transition: opacity 0.28s ease;
}
.auth-stage.is-ready .auth-card.is-swap-in {
  opacity: 1;
  transition: opacity 0.36s ease 0.04s;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.auth-close:hover { background: rgba(255, 255, 255, 0.22); }

.auth-form-pane,
.auth-side {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.auth-overlay .auth-form-pane,
.auth-overlay .auth-side {
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
}

.auth-form-pane {
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
}
.auth-card .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--purple, #6d28d9); margin-bottom: 14px;
}
.auth-card .kicker i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--violet, #7c3aed);
}
.auth-form-pane h1 {
  font-family: "Bricolage Grotesque", Manrope, sans-serif;
  letter-spacing: -0.05em;
  line-height: 0.92;
  font-weight: 800;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin-bottom: 8px;
}
.auth-form-pane .lede {
  color: var(--muted, #5c5866);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 22px;
}

.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card .field { display: flex; flex-direction: column; gap: 6px; }
.auth-card .field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-card label, .auth-card .label {
  font-size: 13px; font-weight: 700; color: var(--ink, #14161f);
}
.auth-card .req { color: var(--violet, #7c3aed); }
.auth-card .hint { font-size: 12px; color: var(--muted, #5c5866); font-weight: 500; }
.auth-card input,
.auth-card select,
.auth-card textarea {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1));
  background: #fff;
  padding: 0 14px;
  font: inherit;
  color: var(--ink, #14161f);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-card textarea { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; }
.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
  border-color: var(--violet, #7c3aed);
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.14);
}
.auth-card input[aria-invalid="true"],
.auth-card select[aria-invalid="true"],
.auth-card textarea[aria-invalid="true"] {
  border-color: var(--danger, #b42318);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.1);
}
.auth-card input:disabled {
  background: var(--cream-2, #ebe4d8);
  color: var(--muted, #5c5866);
  cursor: not-allowed;
}
.auth-card .pw-wrap { position: relative; }
.auth-card .pw-wrap input { padding-right: 48px; }
.auth-card .pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; color: var(--muted, #5c5866);
  display: grid; place-items: center;
}
.auth-card .pw-toggle svg { width: 20px; height: 20px; display: block; }
.auth-card .pw-toggle:hover { background: var(--lilac, #ece4ff); color: var(--ink, #14161f); }
.auth-card [hidden] { display: none !important; }

.auth-card .phone-row { display: flex; gap: 8px; }
.auth-card .phone-code {
  display: flex; align-items: center; justify-content: center;
  min-width: 72px; height: 48px; border-radius: 14px;
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1)); background: var(--cream-2, #ebe4d8);
  font-size: 13px; font-weight: 700; color: var(--muted, #5c5866);
}
.auth-card .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.auth-card .alert {
  border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45;
}
.auth-card .alert-error {
  background: #fef3f2; color: var(--danger, #b42318); border: 1px solid rgba(180, 35, 24, 0.2);
}
.auth-card .alert-ok {
  background: #ecfdf3; color: var(--ok, #067647); border: 1px solid rgba(6, 118, 71, 0.18);
}
.auth-card .field-error { font-size: 12px; color: var(--danger, #b42318); min-height: 0; }

.auth-card .otp-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.auth-card .otp-row input { width: 140px; }

.auth-card .auth-steps {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin: 0; padding: 0;
  background: none; min-height: 0;
}
.auth-card .step-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1)); color: var(--muted, #5c5866);
  background: #fff;
}
.auth-card .step-dot.is-on { border-color: var(--violet, #7c3aed); color: var(--violet, #7c3aed); }
.auth-card .step-dot.is-done { background: var(--violet, #7c3aed); border-color: var(--violet, #7c3aed); color: #fff; }
.auth-card .step-line { flex: 1; height: 1px; background: var(--line, rgba(20, 22, 31, 0.1)); }
.auth-card .step-line.is-done { background: var(--violet, #7c3aed); }

.auth-card .strength { height: 6px; border-radius: 99px; background: var(--cream-2, #ebe4d8); overflow: hidden; }
.auth-card .strength > span { display: block; height: 100%; border-radius: 99px; width: 0; transition: width .2s; }
.auth-card .form-actions { display: flex; gap: 10px; margin-top: 8px; }
.auth-card .form-actions .btn { flex: 1; }
.auth-card form.is-last-step #trialNext { display: none !important; }
.auth-card .auth-switch { font-size: 13px; color: var(--muted, #5c5866); margin-top: 4px; }
.auth-card .auth-switch a { color: var(--violet, #7c3aed); font-weight: 700; }

.auth-card .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: 14px;
  font-family: "Bricolage Grotesque", Manrope, sans-serif;
  letter-spacing: -0.03em;
  transition: transform .25s cubic-bezier(.2,1.4,.3,1), background .2s, color .2s, opacity .2s;
}
.auth-card .btn:hover { transform: translateY(-2px) scale(1.03); }
.auth-card .btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.auth-card .btn-violet { background: var(--violet, #7c3aed); color: #fff; box-shadow: 0 12px 30px rgba(109, 40, 217, 0.28); }
.auth-card .btn-outline {
  border: 1px solid var(--line, rgba(20, 22, 31, 0.1));
  background: #fff;
  color: var(--ink, #14161f);
}
.auth-card .btn-block { width: 100%; height: 48px; font-size: 15px; }

.auth-side {
  background:
    radial-gradient(600px 320px at 80% 0%, rgba(124, 58, 237, 0.35), transparent 60%),
    var(--navy, #0c1220);
  color: #fff;
  padding: clamp(32px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}
.auth-side h2 {
  font-family: "Bricolage Grotesque", Manrope, sans-serif;
  letter-spacing: -0.05em;
  line-height: 0.92;
  font-weight: 800;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}
.auth-side p { color: #b7b3c4; line-height: 1.5; }
.auth-side .feature { display: flex; gap: 14px; align-items: flex-start; }
.auth-side .feature-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(124, 58, 237, 0.25); color: #d8c8ff;
  font-weight: 800; font-size: 13px;
}
.auth-side .feature b { display: block; font-size: 15px; margin-bottom: 4px; }
.auth-side .feature span { color: #b7b3c4; font-size: 13px; line-height: 1.4; }
.auth-side .side-note { font-size: 13px; color: #9d98ae; }

@media (max-width: 860px) {
  .auth-overlay { padding: 12px; align-items: stretch; }
  .auth-stage {
    width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 24px;
  }
  .auth-overlay .auth-card {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 0;
  }
  .auth-overlay .auth-form-pane,
  .auth-overlay .auth-side {
    max-height: none;
  }
  .auth-overlay .auth-form-pane {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .auth-side { display: none; }
  .auth-card .grid-2 { grid-template-columns: 1fr; }
  .auth-close {
    color: var(--ink, #14161f);
    background: var(--cream-2, #ebe4d8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card .btn { transition: none; }
  .auth-stage.is-switching,
  .auth-stage.is-ready .auth-card.is-swap-out,
  .auth-stage.is-ready .auth-card.is-swap-in { transition: none; }
}
