/* ============================================================
   Kappino — Auth pages (Login · Signup · Forgot password)
   Light-mode split layout
   ============================================================ */

/* Override the dashboard SPA's `html, body { overflow: hidden }` from
   styles.css. Auth pages (especially signup) can be taller than the
   viewport, so the page itself needs to scroll. */
html, body {
  height: auto;
  overflow: auto;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  min-height: 100vh;
}

/* ============================================================
   LEFT — Brand panel
   ============================================================ */
.auth-side {
  position: relative;
  overflow: hidden;
  padding: 40px 48px 48px;
  display: flex;
  flex-direction: column;
  background: #f6fbf8;
}
.auth-side::before {
  content: "";
  position: absolute;
  inset: -40px -40px -40px -40px;
  background:
    radial-gradient(circle at 12% 18%, rgba(16, 185, 129, .35), transparent 38%),
    radial-gradient(circle at 88% 12%, rgba(139, 92, 246, .28), transparent 40%),
    radial-gradient(circle at 78% 92%, rgba(245, 158, 11, .25), transparent 40%),
    radial-gradient(circle at 18% 92%, rgba(16, 185, 129, .2), transparent 40%);
  filter: blur(0.5px);
  pointer-events: none;
}
.auth-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='20' cy='20' r='1' fill='%2310b981' fill-opacity='0.05'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-side-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 40px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px -6px rgba(16, 185, 129, 0.55);
  overflow: hidden;
}
/* Same swap rules as styles.css — auth pages render at 42×42 so the
   uploaded logo.png shows slightly larger than in the sidebar. */
.auth-brand .brand-mark.has-custom-logo {
  background: transparent;
  box-shadow: none;
}
.auth-brand .brand-mark.has-custom-logo > svg { display: none; }

/* Wordmark / lockup mode on auth pages. The auth headers have more
   room than the sidebar, so the cap is a little taller. */
.auth-brand.lockup-logo .brand-mark,
.auth-brand.lockup-logo .brand-text { display: none; }
.auth-brand.lockup-logo .brand-lockup-img {
  max-width: 260px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.auth-brand .brand-name {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-brand .brand-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  letter-spacing: .02em;
}

.auth-hero { max-width: 460px; margin-top: 12px; }
.auth-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--violet-100);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--violet-600);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.auth-hero-eyebrow .ai-spark {
  width: 7px;
  height: 7px;
  background: var(--violet-500);
  border-radius: 50%;
  box-shadow: 0 0 8px 1px rgba(139, 92, 246, .4);
}
.auth-hero h1 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 14px;
}
.auth-hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, #8b5cf6, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-hero p {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
  max-width: 420px;
}

/* Floating "preview" cards */
.float-cards {
  position: relative;
  flex: 1;
  min-height: 260px;
}
.float-card {
  position: absolute;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -16px rgba(15, 26, 21, 0.18), 0 4px 8px -2px rgba(15, 26, 21, 0.04);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: floatY 6s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.fc-kpi {
  top: 10%;
  left: 4%;
  width: 240px;
  flex-direction: column;
  align-items: stretch;
  animation-delay: 0s;
}
.fc-kpi .fc-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
}
.fc-kpi .fc-value {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}
.fc-kpi .fc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}
.fc-spark {
  display: block;
  margin-top: 8px;
  width: 100%;
  height: 28px;
}

.fc-ai {
  top: 38%;
  right: 4%;
  width: 280px;
  flex-direction: column;
  align-items: stretch;
  animation-delay: -2s;
  background: linear-gradient(160deg, #fff 60%, #faf5ff 100%);
  border-color: var(--violet-100);
}
.fc-ai-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--violet-600);
}
.fc-ai-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  margin-top: 6px;
}
.fc-ai-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.5;
}

.fc-toast {
  bottom: 10%;
  left: 14%;
  background: #0f1a15;
  color: #fff;
  border: 0;
  animation-delay: -4s;
}
.fc-toast .toast-ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--emerald-500);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Trust strip */
.auth-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(15, 26, 21, .08);
}
.trust-item .ti-val {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.trust-item .ti-lbl {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ============================================================
   RIGHT — Form panel
   ============================================================ */
.auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 24px 32px;
  min-height: 100vh;
}

.auth-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all var(--dur) var(--tx);
}
.back-link:hover { background: var(--surface-2); color: var(--text); }

.auth-top-cta {
  font-size: 13px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.auth-top-cta a {
  color: var(--emerald-600);
  font-weight: 600;
  margin-left: 6px;
  transition: color var(--dur) var(--tx);
}
.auth-top-cta a:hover { color: var(--emerald-700); text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   Language picker — modern custom dropdown (auth pages)
   ------------------------------------------------------------
   The native <select> was replaced with a button + popover list
   so we can deliver a polished, app-consistent UI instead of the
   OS-native dropdown (which on most platforms looks dated next
   to the rest of the form). Accessibility preserved via:
     • aria-haspopup + aria-expanded on the trigger
     • role="listbox" / role="option" on the menu items
     • full keyboard nav (Esc to close, ↑/↓/Home/End to move,
       Enter or Space to select) wired in auth.js
     • a hidden #authLangPicker input mirrors the chosen value
       so existing handlers continue working unchanged.
   ============================================================ */
.auth-lang {
  position: relative;
  display: inline-block;
}
.auth-lang-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 50%;
  color: var(--text-2, #6b7280);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.auth-lang-trigger:hover {
  color: var(--emerald-600, #059669);
  border-color: var(--emerald-500, #10b981);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .08);
}
.auth-lang-trigger:focus-visible {
  outline: none;
  color: var(--emerald-600, #059669);
  border-color: var(--emerald-500, #10b981);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .14);
}
.auth-lang.open .auth-lang-trigger {
  color: var(--emerald-600, #059669);
  border-color: var(--emerald-500, #10b981);
  background: rgba(16, 185, 129, .06);
  transform: scale(0.97);
}

/* The popover list — anchored to the right edge of the trigger so it
   never overflows the viewport on narrow screens. We toggle visibility
   with the `.open` class on the parent (NOT the HTML `hidden` attribute)
   so the transition runs both ways smoothly and there's no risk of a
   `display:none ↔ block` flicker eating the focus state. */
.auth-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  box-shadow:
    0 12px 32px -8px rgba(15, 23, 42, .18),
    0 4px 12px -4px rgba(15, 23, 42, .08);
  z-index: 50;
  /* Hidden by default — opacity + transform for smooth entry, plus
     pointer-events:none so the invisible menu can't intercept clicks. */
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  pointer-events: none;
  transition:
    opacity 160ms cubic-bezier(.16, 1, .3, 1),
    transform 180ms cubic-bezier(.16, 1, .3, 1);
}
.auth-lang.open .auth-lang-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Individual language row */
.auth-lang-menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #111827);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
  user-select: none;
}
.auth-lang-menu li:hover,
.auth-lang-menu li:focus-visible,
.auth-lang-menu li[data-highlight] {
  background: rgba(16, 185, 129, .08);
  color: var(--emerald-700, #047857);
  outline: none;
}
.auth-lang-flag {
  font-size: 18px;
  line-height: 1;
  width: 22px;
  display: inline-flex;
  justify-content: center;
}
.auth-lang-name {
  flex: 1;
  letter-spacing: -0.005em;
}
/* Checkmark — invisible by default, shown only on the active language */
.auth-lang-check {
  color: var(--emerald-600, #059669);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 140ms ease, transform 140ms ease;
}
.auth-lang-menu li[aria-selected="true"] .auth-lang-check {
  opacity: 1;
  transform: scale(1);
}
.auth-lang-menu li[aria-selected="true"] {
  background: rgba(16, 185, 129, .06);
  color: var(--emerald-700, #047857);
  font-weight: 600;
}
@media (max-width: 640px) {
  .auth-top-cta { flex-wrap: wrap; justify-content: flex-end; }
}

.auth-card-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  animation: cardIn .5s var(--tx);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0 0 8px;
}
.auth-sub {
  font-size: 14.5px;
  color: var(--text-3);
  margin: 0 0 28px;
  line-height: 1.55;
}
.auth-sub a { color: var(--emerald-600); font-weight: 600; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 22px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { white-space: nowrap; }

/* Auth form */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .field { display: flex; flex-direction: column; gap: 6px; }
.auth-form label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.auth-form input,
.auth-form select {
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  outline: 0;
  transition: border-color var(--dur) var(--tx), box-shadow var(--dur) var(--tx);
  font-family: inherit;
}
.auth-form input::placeholder { color: var(--text-muted); }
.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .12);
}
.auth-form input.invalid {
  border-color: var(--rose-500);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, .1);
}
.auth-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-form .pwd-input { width: 100%; }
.auth-form .pwd-input input { width: 100%; padding-right: 44px; }
.auth-form .hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.auth-form .hint.ok { color: var(--emerald-600); font-weight: 600; }
.auth-form .hint.bad { color: var(--rose-500); font-weight: 600; }

/* Form row (remember + forgot) */
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 8px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkbox input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all var(--dur) var(--tx);
}
.checkbox input:checked {
  background: var(--emerald-500);
  border-color: var(--emerald-500);
}
.checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.btn.full {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 14.5px;
}
.btn.full svg { transition: transform var(--dur) var(--tx); }
.btn.full:hover svg { transform: translateX(2px); }
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
  margin-left: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer text */
.auth-foot {
  text-align: center;
  margin-top: 24px;
  font-size: 13.5px;
  color: var(--text-3);
}
.auth-foot a {
  color: var(--emerald-600);
  font-weight: 600;
  margin-left: 4px;
  transition: color var(--dur) var(--tx);
}
.auth-foot a:hover { color: var(--emerald-700); text-decoration: underline; text-underline-offset: 3px; }
.auth-foot a.disabled,
.auth-foot a.link-btn.disabled {
  pointer-events: none;
  color: var(--text-3);
  text-decoration: none;
}

/* ============================================================
   OTP — 6-digit verification code (signup step 2)
   ============================================================ */
.verify-icon {
  font-size: 32px;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--emerald-50);
  border-radius: 14px;
  margin-bottom: 18px;
}

.otp-row {
  display: grid;
  /* `minmax(0, 1fr)` lets cells shrink past their min-content size — without
     this the row overflows the card on narrow phones (≤360 px). */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
  width: 100%;
}
.otp-cell {
  /* `min-width: 0` is the second half of the shrink fix — without it,
     the input element's intrinsic content-width wins over the grid track. */
  min-width: 0;
  width: 100%;
  height: 56px;
  padding: 0;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  color: var(--text);
  caret-color: var(--emerald-500);
  box-sizing: border-box;
  transition: border-color var(--dur) var(--tx), box-shadow var(--dur) var(--tx), transform var(--dur) var(--tx);
}
.otp-cell:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .14);
}
.otp-cell:not(:placeholder-shown),
.otp-cell:valid:not(:empty) {
  border-color: var(--emerald-500);
  background: var(--emerald-50);
}
.otp-cell.invalid {
  border-color: var(--rose-500);
  animation: otpShake .35s var(--tx);
}
@keyframes otpShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

/* The verify card hosts a long email in `.auth-sub` — without these
   wrap rules, addresses like  some.long.email@some-org.com  push the
   layout wider than the viewport on tiny phones. */
#signupStepVerify .auth-sub,
#signupStepVerify .auth-sub b {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* iPhone-SE / small-Android responsiveness ---------------------- */
@media (max-width: 480px) {
  .otp-row { gap: 8px; }
  .otp-cell { height: 50px; font-size: 22px; }
  .verify-icon {
    width: 48px; height: 48px;
    font-size: 26px;
    border-radius: 12px;
    margin-bottom: 14px;
  }
}
@media (max-width: 380px) {
  /* Reclaim every pixel — narrow auth-main padding so the card spans full-width */
  .auth-main { padding: 16px 14px; }
  .otp-row { gap: 6px; }
  .otp-cell { height: 46px; font-size: 19px; border-radius: 8px; border-width: 1px; }
}
@media (max-width: 320px) {
  /* Edge-case safety net: tiny embedded webviews etc. */
  .otp-row { gap: 4px; }
  .otp-cell { height: 42px; font-size: 17px; }
  .verify-icon { width: 44px; height: 44px; font-size: 22px; }
  .auth-title { font-size: 22px; }
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 8px;
}
.auth-footer nav { display: flex; gap: 18px; }
.auth-footer a {
  color: var(--text-3);
  transition: color var(--dur) var(--tx);
}
.auth-footer a:hover { color: var(--text); }

/* ============================================================
   Step progress (3-dot indicator on the signup card)
   Shown on the signup card to make the 2-step + verification
   flow obvious without burying the user in form fields up-front.
   ============================================================ */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 4px 0 22px;
}
.step-progress .step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.step-progress .step-dot .dot-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, #f4f6f8);
  border: 1.5px solid var(--border, #e5e7eb);
  color: var(--text-3, #94a3b8);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
  transition: background var(--dur, .18s) ease, border-color var(--dur, .18s) ease,
              color var(--dur, .18s) ease, transform var(--dur, .18s) ease;
}
.step-progress .step-dot .dot-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3, #94a3b8);
}
.step-progress .step-dot.active .dot-num {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
  border-color: var(--emerald-500);
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 4px 12px -4px rgba(16, 185, 129, .55);
}
.step-progress .step-dot.active .dot-label {
  color: var(--emerald-700, #047857);
}
.step-progress .step-dot.done .dot-num {
  background: var(--emerald-500);
  border-color: var(--emerald-500);
  color: #fff;
}
.step-progress .step-dot.done .dot-label { color: var(--text-2, #475569); }
.step-progress .step-line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--border, #e5e7eb);
  border-radius: 999px;
  margin-bottom: 18px;     /* align with the dot's vertical centre, not labels */
  transition: background var(--dur, .18s) ease;
}
.step-progress .step-line.full { background: var(--emerald-500); }

/* On very narrow phones, hide the labels — keeps the dots aligned */
@media (max-width: 380px) {
  .step-progress .step-dot .dot-label { display: none; }
  .step-progress .step-line { margin-bottom: 0; }
}

/* ============================================================
   Signup sub-step animation (Step 1 → Step 2)
   When the user clicks "Continue", we hide the identity sub-step
   and reveal the credentials sub-step in the same card. A subtle
   slide-in keeps the transition feeling intentional.
   ============================================================ */
.signup-substep {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: substep-in .26s ease both;
}
.signup-substep[hidden] { display: none; }

@keyframes substep-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.signup-substep-back {
  align-self: flex-start;
  margin-bottom: 4px;
  margin-left: -4px;
  padding: 6px 10px 6px 6px;
  border-radius: 8px;
  transition: background var(--dur, .18s) ease;
}
.signup-substep-back:hover { background: var(--surface-2, #f4f6f8); }

/* ============================================================
   Form section title (signup)
   ============================================================ */
.form-section-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
  margin-bottom: 0;
}
.form-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* ============================================================
   Phone input (country code + number)
   ============================================================ */
.phone-input {
  display: flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--dur) var(--tx), box-shadow var(--dur) var(--tx);
}
.phone-input:focus-within {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .12);
}
.phone-input.invalid {
  border-color: var(--rose-500);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, .1);
}
.phone-cc {
  border: 0 !important;
  border-right: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: var(--surface-2) !important;
  padding: 11px 12px !important;
  font-size: 14px !important;
  width: auto;
  min-width: 92px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 12px !important;
  padding-right: 24px !important;
}
.phone-cc:focus { box-shadow: none !important; outline: 0; }
.phone-input input {
  border: 0 !important;
  flex: 1;
  padding: 11px 14px !important;
  outline: 0;
  font-size: 14px !important;
  border-radius: 0 !important;
  min-width: 0;
}
.phone-input input:focus { box-shadow: none !important; }

/* ============================================================
   Plan picker (signup)
   ============================================================ */
.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.plan-card {
  position: relative;
  padding: 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all var(--dur) var(--tx);
}
.plan-card:hover { border-color: var(--border-strong); }
.plan-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card .plan-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
}
.plan-card .plan-price {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.plan-card .plan-price small {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.plan-card .plan-tag {
  position: absolute;
  top: -8px;
  right: 10px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 20px;
}
.plan-card.selected {
  border-color: var(--emerald-500);
  background: var(--emerald-50);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .1);
}
.plan-card.selected::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--emerald-500);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 11px;
  background-position: center;
  background-repeat: no-repeat;
}

/* ============================================================
   Forgot-password success state
   ============================================================ */
.success-state {
  text-align: center;
  padding: 12px 0;
  animation: cardIn .35s var(--tx);
}
.success-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: #fff;
  box-shadow: 0 12px 30px -8px rgba(16, 185, 129, .5);
  animation: popIn .5s var(--tx);
}
@keyframes popIn {
  0% { transform: scale(.6); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
.success-state .auth-title { font-size: 26px; }
.success-state .email-mark {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 14px;
}
.success-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============================================================
   Toast container (auth pages reuse)
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  align-items: center;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { padding: 20px; }
  .auth-card { max-width: 460px; }
  .auth-title { font-size: 26px; }
  .plans { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .auth-form .field-row { grid-template-columns: 1fr; }
  .auth-footer { flex-direction: column; align-items: flex-start; }
  .auth-footer nav { flex-wrap: wrap; }
}
