/* ── Apple-inspired Glossy UI ───────────────────────────── */
:root {
  --font-ui: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-rounded: "SF Pro Rounded", "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --bg:         #e8e8ed;
  --glass:      rgba(255, 255, 255, 0.72);
  --glass-dark: rgba(255, 255, 255, 0.45);
  --border:     rgba(255, 255, 255, 0.85);
  --border-sub: rgba(200, 200, 210, 0.5);
  --ink:        #1c1c1e;
  --ink-2:      #3a3a3c;
  --muted:      #8e8e93;
  --accent:     #5e5ce6;
  --accent-2:   #7c3aed;
  --positive:   #30d158;
  --btn-primary-bg: linear-gradient(135deg, #667eea 0%, #7c6cf0 50%, #f472b6 100%);
  --btn-primary-shadow: 0 14px 28px rgba(110,108,240,0.28), 0 1px 0 rgba(255,255,255,0.28) inset;
  --btn-secondary-bg: linear-gradient(135deg, #2f3648 0%, #49566f 100%);
  --btn-secondary-shadow: 0 14px 28px rgba(47,54,72,0.22), 0 1px 0 rgba(255,255,255,0.14) inset;
  --btn-soft-bg: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(243,236,255,0.94) 55%, rgba(255,239,246,0.94) 100%);
  --btn-soft-border: rgba(141,119,255,0.16);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.16);
  --radius-sm:  14px;
  --radius-md:  20px;
  --radius-lg:  28px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: #0b1020;
  min-height: 100%;
}

html, body {
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  /* Subtle noise-like gradient background */
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(120,100,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(100,180,255,0.10) 0%, transparent 50%),
    linear-gradient(160deg, #dfe0ea 0%, #e8e8ed 50%, #dde4f0 100%);
  /* Prevent pull-to-refresh in PWA */
  overscroll-behavior-y: contain;
  /* Smooth scrolling for PWA */
  scroll-behavior: smooth;
}

.desktop-layout {
  padding:
    var(--safe-area-top)
    var(--safe-area-right)
    var(--safe-area-bottom)
    var(--safe-area-left);
}

button,
input,
select,
textarea {
  font: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  font-size: max(16px, 1rem);
}

@supports (-webkit-touch-callout: none) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ── Keyboard open: pin everything to visual viewport ──── */
body.ios-keyboard-open {
  height: var(--app-visual-height, 100dvh) !important;
  min-height: var(--app-visual-height, 100dvh) !important;
  max-height: var(--app-visual-height, 100dvh) !important;
  overflow: hidden;
  padding: 0 !important;
}

html.ios-keyboard-open {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(120,100,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(100,180,255,0.10) 0%, transparent 50%),
    linear-gradient(160deg, #dfe0ea 0%, #e8e8ed 50%, #dde4f0 100%);
}

body.ios-keyboard-open .desktop-layout {
  height: var(--app-visual-height, 100dvh);
  min-height: var(--app-visual-height, 100dvh);
  max-height: var(--app-visual-height, 100dvh);
  overflow: hidden;
  padding: 0;
  grid-template-columns: 1fr;
}

body.ios-keyboard-open .left-panel {
  display: none;
}

body.ios-keyboard-open .right-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: var(--app-visual-height, 100dvh);
  min-height: var(--app-visual-height, 100dvh);
  max-height: var(--app-visual-height, 100dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120,100,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(100,180,255,0.10) 0%, transparent 50%),
    linear-gradient(160deg, #dfe0ea 0%, #e8e8ed 50%, #dde4f0 100%);
}

body.ios-keyboard-open .right-panel .card,
body.ios-keyboard-open .card {
  flex: 0 1 auto;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  transform: none;
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

body.ios-keyboard-open .card-login {
  background:
    radial-gradient(ellipse at 85% 0%, rgba(245,184,216,0.20) 0%, transparent 50%),
    var(--glass);
}

body.ios-keyboard-open .brand {
  display: none;
}

.brand-large,
.title,
.form-title {
  font-family: var(--font-display);
}

.cta-btn,
.footer-copy,
.link-accent,
.field-label {
  font-family: var(--font-ui);
}

/* ── Desktop two-column layout ──────────────────────────── */
.desktop-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ════════════════════════════════════════════════════════════
   LEFT PANEL
   ════════════════════════════════════════════════════════════ */
.left-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 72px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(120,100,255,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(100,180,255,0.14) 0%, transparent 55%),
    linear-gradient(160deg, #dfe0ea 0%, #e4e4ef 100%);
}

.brand-large {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.brand-tagline {
  margin-top: 18px;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--muted);
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
}

/* ── Animated orbs ──────────────────────────────────────── */
@keyframes float-a {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(18px,-22px) scale(1.06); }
  66%  { transform: translate(-14px,12px) scale(0.96); }
  100% { transform: translate(0,0) scale(1); }
}
@keyframes float-b {
  0%   { transform: translate(0,0) scale(1); }
  40%  { transform: translate(-20px,16px) scale(1.08); }
  75%  { transform: translate(12px,-18px) scale(0.94); }
  100% { transform: translate(0,0) scale(1); }
}
@keyframes float-c {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(22px,20px) scale(1.05); }
  100% { transform: translate(0,0) scale(1); }
}

.left-orbs { position: absolute; inset: 0; pointer-events: none; }

.lo {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.lo-1 {
  width: 360px; height: 360px;
  top: 8%; left: 10%;
  background: radial-gradient(circle at 38% 38%,
    rgba(245,184,216,0.65), rgba(197,202,255,0.50));
  animation: float-a 9s ease-in-out infinite;
}
.lo-2 {
  width: 200px; height: 200px;
  top: 5%; left: 46%;
  background: rgba(197,202,255,0.60);
  animation: float-b 7s ease-in-out infinite;
  animation-delay: -2s;
}
.lo-3 {
  width: 260px; height: 260px;
  top: 34%; left: 24%;
  background: rgba(168,237,204,0.40);
  animation: float-c 11s ease-in-out infinite;
  animation-delay: -4s;
}
.lo-4 {
  width: 130px; height: 130px;
  bottom: 14%; right: 8%;
  background: rgba(251,191,36,0.25);
  animation: float-a 8s ease-in-out infinite;
  animation-delay: -1s;
}
.lo-5 {
  width: 80px; height: 80px;
  bottom: 28%; left: 6%;
  background: rgba(94,92,230,0.18);
  animation: float-b 6s ease-in-out infinite;
  animation-delay: -3s;
}

/* ════════════════════════════════════════════════════════════
   RIGHT PANEL
   ════════════════════════════════════════════════════════════ */
.right-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: transparent;
}

/* ── Glass card ─────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 400px;
  background: var(--glass);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  box-shadow:
    0 1px 0 var(--border) inset,
    0 -1px 0 rgba(0,0,0,0.04) inset,
    var(--shadow-lg);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  display: flex;
  flex-direction: column;
}

.card-form {
  position: relative;
}

.card-form::before {
  content: "";
  display: none;
  width: 42px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #667eea, #f472b6);
  opacity: 0.72;
}

/* ── Brand ──────────────────────────────────────────────── */
.brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 4px;
}

/* ── Hero art (onboarding) ──────────────────────────────── */
.hero-art {
  position: relative;
  height: 190px;
  margin: 16px 0 22px;
}

.orb {
  position: absolute;
  border-radius: 50%;
}

.orb-large {
  width: 150px; height: 150px;
  left: 28px; top: 18px;
  background: radial-gradient(circle at 38% 38%,
    rgba(245,184,216,0.92), rgba(245,140,210,0.80));
  animation: float-a 8s ease-in-out infinite;
  filter: blur(0.5px);
}
.orb-top {
  width: 66px; height: 66px;
  right: 78px; top: 8px;
  background: rgba(197,202,255,0.85);
  animation: float-b 6s ease-in-out infinite;
  animation-delay: -1.5s;
}
.orb-left {
  width: 105px; height: 105px;
  left: 58px; bottom: 8px;
  background: rgba(197,202,255,0.62);
  animation: float-c 10s ease-in-out infinite;
  animation-delay: -3s;
}
.orb-right {
  width: 102px; height: 102px;
  right: 38px; bottom: 4px;
  background: rgba(182,168,245,0.65);
  animation: float-a 7s ease-in-out infinite;
  animation-delay: -5s;
}

/* ── Onboarding text ────────────────────────────────────── */
.eyebrow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-title {
  text-align: center;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.05em;
  margin-bottom: 12px;
  color: var(--ink);
}

.accent { color: var(--accent); }

.subcopy {
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 26px;
  font-weight: 400;
}

/* ── CTA button ─────────────────────────────────────────── */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: var(--radius-sm);
  background: var(--btn-primary-bg);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
  box-shadow: var(--btn-primary-shadow);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(110,108,240,0.32), 0 1px 0 rgba(255,255,255,0.3) inset;
}

.link-button {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: -2px;
  padding: 4px 8px;
}

.link-button:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.cta-dark {
  background: var(--btn-secondary-bg);
  box-shadow: var(--btn-secondary-shadow);
  margin-top: 0;
}

.cta-soft {
  background: var(--btn-soft-bg);
  color: var(--accent);
  box-shadow: 0 10px 22px rgba(138,122,255,0.10), 0 1px 0 rgba(255,255,255,0.76) inset;
}

/* ── Footer copy ────────────────────────────────────────── */
.footer-copy {
  margin-top: 16px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 400;
}

.footer-copy.center { text-align: center; }
.footer-copy.muted  { color: var(--muted); }

.auth-secondary-action {
  margin-top: 12px;
}

.auth-switch-copy {
  padding: 10px 12px;
  border: 1px solid rgba(200,200,210,0.45);
  border-radius: 14px;
  background: rgba(255,255,255,0.36);
}

.link-accent {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.link-accent:hover { text-decoration: underline; }

/* ── Form card ──────────────────────────────────────────── */
.card-form { gap: 0; }

.card-login {
  background:
    radial-gradient(ellipse at 85% 0%, rgba(245,184,216,0.20) 0%, transparent 50%),
    var(--glass);
}

.form-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  margin-top: 18px;
  margin-bottom: 5px;
  color: var(--ink);
}

.form-sub {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 26px;
}

.form-sub strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Form fields ────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.60);
  border: 1px solid rgba(200,200,210,0.60);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 52px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  backdrop-filter: blur(8px);
}

.field-group:focus-within {
  border-color: var(--accent);
  background: rgba(255,255,255,0.80);
  box-shadow: 0 0 0 3px rgba(94,92,230,0.12);
}

.field-icon {
  width: 18px; height: 18px;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 12px;
  display: grid;
  place-items: center;
}
.field-icon svg { width: 16px; height: 16px; }

.field-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink);
  outline: none;
  letter-spacing: -0.01em;
}
.field-input::placeholder { color: var(--muted); }

.currency-choice {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  cursor: pointer;
  background: rgba(255,255,255,0.60);
  border: 1px solid rgba(200,200,210,0.60);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  backdrop-filter: blur(8px);
}

.currency-choice:focus-within {
  border-color: var(--accent);
  background: rgba(255,255,255,0.80);
  box-shadow: 0 0 0 3px rgba(94,92,230,0.12);
}

.currency-choice .field-label {
  margin: 0 12px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.currency-select {
  width: 100%;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  padding: 0 24px 0 0;
}

.currency-chevron {
  position: absolute;
  right: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: rotate(45deg) translateY(-3px);
}

/* ── Terms ──────────────────────────────────────────────── */
.terms-copy {
  margin-top: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Divider ────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid rgba(200,200,210,0.45);
  margin: 18px 0 14px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

/* ── Tablet (≤1024px) ───────────────────────────────────── */
@media (max-width: 1024px) {
  .desktop-layout {
    grid-template-columns: 1fr;
  }

  .left-panel {
    display: none;
  }

  .right-panel {
    padding: 40px 32px;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(120,100,255,0.12) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 90%, rgba(100,180,255,0.10) 0%, transparent 50%),
      linear-gradient(160deg, #dfe0ea 0%, #e8e8ed 50%, #dde4f0 100%);
  }

  .card {
    max-width: 480px;
  }
}

/* ── Mobile (≤640px) ────────────────────────────────────── */
@media (max-width: 640px) {
  body {
    min-height: 100svh;
  }

  .desktop-layout {
    min-height: 100svh;
    padding-top: 0;
  }

  .right-panel {
    justify-content: flex-start;
    min-height: 100svh;
    padding: max(14px, env(safe-area-inset-top, 0px)) 14px max(14px, env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }

  .card {
    max-width: 100%;
    border-radius: var(--radius-md);
    padding: 22px 20px 20px;
    overflow: visible;
  }

  .card-form {
    min-height: 0;
    box-shadow:
      0 1px 0 var(--border) inset,
      0 18px 48px rgba(75, 86, 130, 0.16);
  }

  .card-form::before {
    display: block;
  }

  .brand {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .brand-large {
    font-size: 2.2rem;
  }

  .hero-art {
    height: 220px;
    margin: 14px 0 20px;
    overflow: visible;
  }

  .orb-large { width: 200px; height: 200px; left: 10px; top: 10px; }
  .orb-top   { width: 90px;  height: 90px;  right: 30px; top: 5px; }
  .orb-left  { width: 150px; height: 150px; left: 40px; bottom: 0; }
  .orb-right { width: 140px; height: 140px; right: 10px; bottom: 0; }
  .orb-right { width: 84px;  height: 84px; }

  .hero-title {
    font-size: 1.55rem;
  }

  .subcopy {
    font-size: 0.86rem;
    margin-bottom: 20px;
  }

  .cta-btn {
    height: 48px;
    font-size: 0.95rem;
  }

  .form-title {
    font-size: 1.82rem;
    line-height: 1.05;
    margin-top: 6px;
    margin-bottom: 7px;
  }

  .form-sub {
    font-size: 0.88rem;
    line-height: 1.42;
    margin-bottom: 18px;
  }

  .auth-form {
    gap: 10px;
  }

  .field-group {
    height: 50px;
    border-radius: 16px;
    background: rgba(255,255,255,0.78);
  }

  .footer-copy {
    margin-top: 12px;
  }

  .auth-switch-copy {
    margin-top: 14px;
    font-size: 0.82rem;
  }

  /* ── Mobile keyboard-open overrides ────────────────────── */
  body.ios-keyboard-open .right-panel {
    justify-content: flex-start;
    align-items: stretch;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    padding-left: 14px;
    padding-right: 14px;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(120,100,255,0.12) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 90%, rgba(100,180,255,0.10) 0%, transparent 50%),
      linear-gradient(160deg, #dfe0ea 0%, #e8e8ed 50%, #dde4f0 100%);
  }

  body.ios-keyboard-open .card {
    border-radius: 18px;
    padding: 10px 14px 12px;
    flex: 0 0 auto;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  body.ios-keyboard-open .card-form::before,
  body.ios-keyboard-open .brand {
    display: none;
  }

  body.ios-keyboard-open .form-title {
    font-size: 1.18rem;
    margin-top: 0;
    margin-bottom: 2px;
  }

  body.ios-keyboard-open .form-sub {
    display: none;
  }

  body.ios-keyboard-open .auth-form {
    gap: 6px;
  }

  body.ios-keyboard-open .field-group {
    height: 48px;
    min-height: 48px;
    border-radius: 14px;
    padding: 0 14px;
  }

  body.ios-keyboard-open .field-icon {
    margin-right: 10px;
  }

  body.ios-keyboard-open .field-input {
    font-size: 16px;
  }

  body.ios-keyboard-open .cta-btn {
    height: 48px;
    min-height: 48px;
    margin-top: 4px;
  }

  body.ios-keyboard-open .link-button {
    padding: 6px 8px;
    min-height: 36px;
  }

  body.ios-keyboard-open .divider {
    margin: 8px 0 6px;
  }

  body.ios-keyboard-open .footer-copy,
  body.ios-keyboard-open .terms-copy {
    display: none;
  }
}

/* ── Small mobile (≤390px) ──────────────────────────────── */
@media (max-width: 390px) {
  .right-panel {
    padding: 16px 12px;
  }

  .card {
    padding: 22px 16px 20px;
    border-radius: 18px;
  }

  .hero-title { font-size: 1.35rem; }
  .form-title { font-size: 1.4rem; }
}

/* ════════════════════════════════════════════════════════════
   PWA STANDALONE MODE
   ════════════════════════════════════════════════════════════ */

/* When running as installed PWA (standalone mode) */
@media (display-mode: standalone) {
  body {
    padding-top: 0;
    min-height: 100svh;
  }

  .desktop-layout {
    min-height: 100svh;
    /* Prevent overscroll bounce in PWA */
    overscroll-behavior: none;
  }

  .right-panel {
    /* More padding for PWA status bar */
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .card {
    /* Slightly more compact for PWA */
    max-width: 100%;
    border-radius: var(--radius-md);
  }

  /* Ensure touch targets are at least 44px for PWA */
  .field-group {
    min-height: 48px;
  }

  .cta-btn {
    min-height: 52px;
  }

  /* Better spacing for PWA on mobile */
  @media (max-width: 640px) {
    .right-panel {
      justify-content: flex-start;
      min-height: 100svh;
      padding: max(12px, env(safe-area-inset-top, 0px)) 14px max(10px, env(safe-area-inset-bottom, 0px));
    }

    .card {
      padding: 20px 18px 18px;
    }

    .field-group {
      height: 48px;
      padding: 0 14px;
    }

    .cta-btn {
      height: 50px;
    }
  }
}

/* PWA on iOS with notch (iPhone X and later) */
@supports (padding: env(safe-area-inset-top)) {
  .desktop-layout {
    padding-top: 0;
  }

  .right-panel {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* PWA landscape mode handling */
@media (display-mode: standalone) and (orientation: landscape) and (max-height: 500px) {
  .right-panel {
    padding: 8px 24px;
  }

  .card {
    padding: 16px 24px 14px;
    max-height: 90dvh;
    overflow-y: auto;
  }

  .form-title {
    font-size: 1.4rem;
    margin-top: 8px;
  }

  .form-sub {
    font-size: 0.82rem;
    margin-bottom: 16px;
  }

  .field-group {
    height: 44px;
  }

  .cta-btn {
    height: 46px;
    margin-top: 4px;
  }
}

/* ── Alerts & field errors ──────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.alert-error {
  background: rgba(255,69,58,0.10);
  border: 1px solid rgba(255,69,58,0.25);
  color: #c0392b;
}

.alert-success {
  background: rgba(48,209,88,0.10);
  border: 1px solid rgba(48,209,88,0.22);
  color: #1d8348;
}

.field-error {
  border-color: rgba(255,69,58,0.50) !important;
}

.field-error:focus-within {
  border-color: rgba(255,69,58,0.70) !important;
  box-shadow: 0 0 0 3px rgba(255,69,58,0.10) !important;
}

.field-msg {
  font-size: 0.76rem;
  color: #c0392b;
  margin-top: -6px;
  margin-bottom: 4px;
  padding-left: 4px;
  font-weight: 500;
  min-height: 0;
  overflow: hidden;
  transition: min-height 0.2s, opacity 0.2s;
}

.field-msg:empty {
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
}

/* ════════════════════════════════════════════════════════════
   SIGNUP – 2-STEP FLOW
   ════════════════════════════════════════════════════════════ */

/* ── Progress bar ─────────────────────────────────────── */
.su-progress {
  margin-bottom: 18px;
}

.su-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(200,200,210,0.45);
  overflow: hidden;
}

.su-progress-fill {
  width: 50%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #667eea, #f472b6);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.su-steps {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-top: 6px;
}

.su-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(200,200,210,0.5);
  transition: background 0.3s, transform 0.3s;
}

.su-step-dot.active {
  background: linear-gradient(135deg, #667eea, #f472b6);
  transform: scale(1.25);
}

/* ── Step panels ──────────────────────────────────────── */
.su-step {
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: suSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.su-step-active {
  display: flex;
}

@keyframes suSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Back button ──────────────────────────────────────── */
.su-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  margin-bottom: 4px;
  align-self: flex-start;
  transition: color 0.2s;
}

.su-back-btn:hover {
  color: var(--ink);
}

/* ── Password strength ────────────────────────────────── */
.su-strength {
  display: flex;
  align-items: center;
  gap: 10px;
}

.su-strength-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(200,200,210,0.4);
  overflow: hidden;
}

.su-strength-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: #ff3b30;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.35s;
}

.su-strength-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-width: 40px;
  text-align: right;
}

/* ── Requirements checklist ───────────────────────────── */
.su-reqs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
  background: rgba(200,200,210,0.15);
  border-radius: 10px;
  border: 1px solid rgba(200,200,210,0.2);
}

.su-req {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
  transition: color 0.25s;
}

.su-req-met {
  color: #34c759;
}

.su-req-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(200,200,210,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}

.su-req-met .su-req-icon {
  border-color: #34c759;
  background: #34c759;
  color: #fff;
}

/* ── Password toggle ──────────────────────────────────── */
.su-toggle-pw {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.su-toggle-pw:hover {
  color: var(--ink);
  background: rgba(200,200,210,0.2);
}

/* ── Continue button (step 1) ─────────────────────────── */
.su-next-btn {
  margin-top: 16px;
}

/* ── Disabled button ──────────────────────────────────── */
.su-btn-disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.3);
}

/* ── Field validation states ──────────────────────────── */
.su-fg-validate {
  position: relative;
}

.su-fg-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.25s;
}

.su-fg-ok .su-fg-status,
.su-fg-err .su-fg-status {
  opacity: 1;
}

.su-fg-ok .su-fg-status {
  color: #34c759;
}

.su-fg-err .su-fg-status {
  color: #ff3b30;
}

.su-fg-ok {
  border-color: #34c759 !important;
  background: rgba(52,199,89,0.06) !important;
}

.su-fg-ok:focus-within {
  box-shadow: 0 0 0 3px rgba(52,199,89,0.12) !important;
}

.su-fg-err {
  border-color: rgba(255,59,48,0.50) !important;
}

.su-fg-err:focus-within {
  border-color: rgba(255,59,48,0.70) !important;
  box-shadow: 0 0 0 3px rgba(255,59,48,0.10) !important;
}

/* Hide status icon when there's a toggle button */
.su-fg-ok .su-toggle-pw ~ .su-fg-status,
.su-fg-err .su-toggle-pw ~ .su-fg-status {
  right: 44px;
}

/* ════════════════════════════════════════════════════════════
   SIGNUP RESPONSIVE – MOBILE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* Progress bar compact */
  .su-progress {
    margin-bottom: 14px;
  }

  .su-progress-track {
    height: 3px;
  }

  .su-step-dot {
    width: 6px;
    height: 6px;
  }

  .su-steps {
    margin-top: 4px;
  }

  /* Step panels */
  .su-step {
    gap: 10px;
  }

  /* Back button touch-friendly */
  .su-back-btn {
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 8px;
    min-height: 36px;
  }

  /* Strength meter */
  .su-strength {
    gap: 8px;
  }

  .su-strength-track {
    height: 4px;
  }

  .su-strength-label {
    font-size: 0.68rem;
    min-width: 36px;
  }

  /* Requirements compact */
  .su-reqs {
    padding: 6px 10px;
    gap: 4px;
  }

  .su-req {
    font-size: 0.7rem;
    gap: 6px;
  }

  .su-req-icon {
    width: 14px;
    height: 14px;
    font-size: 0.55rem;
  }

  /* Toggle button touch target — no animation */
  .su-toggle-pw {
    width: 44px;
    height: 44px;
    transition: none;
  }

  /* Validation status icons */
  .su-fg-status {
    width: 18px;
    height: 18px;
  }

  .su-fg-ok .su-toggle-pw ~ .su-fg-status,
  .su-fg-err .su-toggle-pw ~ .su-fg-status {
    right: 48px;
  }

  /* Continue button */
  .su-next-btn {
    margin-top: 12px;
  }
}

/* ── Small mobile (≤390px) ────────────────────────────── */
@media (max-width: 390px) {
  .su-progress {
    margin-bottom: 10px;
  }

  .su-step {
    gap: 8px;
  }

  .su-reqs {
    padding: 5px 8px;
    gap: 3px;
  }

  .su-req {
    font-size: 0.66rem;
  }

  .su-strength-label {
    font-size: 0.64rem;
  }
}

/* ════════════════════════════════════════════════════════════
   SIGNUP PWA STANDALONE MODE
   ════════════════════════════════════════════════════════════ */

@media (display-mode: standalone) {
  /* Progress bar */
  .su-progress {
    margin-bottom: 14px;
  }

  /* Field groups: 44px min touch target */
  .su-step-active .field-group {
    min-height: 48px;
  }

  /* Toggle buttons: 44px touch target, no animation */
  .su-toggle-pw {
    min-width: 44px;
    min-height: 44px;
    transition: none;
  }

  /* CTA buttons: 48px min */
  .su-step-active .cta-btn,
  .su-step-active .su-next-btn {
    min-height: 50px;
  }

  /* Back button: 44px touch */
  .su-back-btn {
    min-height: 44px;
    padding: 8px 10px;
  }
}

/* PWA standalone + mobile */
@media (display-mode: standalone) and (max-width: 640px) {
  .su-progress {
    margin-bottom: 12px;
  }

  .su-step-active .field-group {
    min-height: 48px;
    height: 50px;
  }

  .su-step-active .cta-btn,
  .su-step-active .su-next-btn {
    min-height: 48px;
    height: 48px;
  }

  .su-toggle-pw {
    width: 44px;
    height: 44px;
    transition: none;
  }

  .su-reqs {
    padding: 6px 10px;
  }
}

/* PWA landscape (short viewports) */
@media (display-mode: standalone) and (orientation: landscape) and (max-height: 500px) {
  .su-progress {
    margin-bottom: 6px;
  }

  .su-progress-track {
    height: 2px;
  }

  .su-steps {
    display: none;
  }

  .su-step {
    gap: 4px;
  }

  .su-step-active .field-group {
    height: 38px;
    min-height: 38px;
  }

  .su-back-btn {
    margin-bottom: 0;
    padding: 2px 4px;
  }

  .su-reqs {
    padding: 3px 8px;
    gap: 1px;
  }

  .su-req {
    font-size: 0.62rem;
  }

  .su-strength {
    gap: 6px;
  }

  .su-strength-track {
    height: 3px;
  }

  .su-strength-label {
    font-size: 0.6rem;
  }

  .su-step-active .cta-btn,
  .su-step-active .su-next-btn {
    height: 40px;
    min-height: 40px;
    margin-top: 2px;
  }
}

/* ════════════════════════════════════════════════════════════
   SIGNUP KEYBOARD OPEN – EXTRA OVERRIDES
   ════════════════════════════════════════════════════════════ */

body.ios-keyboard-open .su-step-active .su-strength {
  display: flex !important;
}

body.ios-keyboard-open .su-step-active .su-reqs {
  padding: 5px 10px;
  gap: 2px;
}

body.ios-keyboard-open .su-step-active .su-req {
  font-size: 0.68rem;
}

body.ios-keyboard-open .su-step-active .su-back-btn {
  display: none;
}

body.ios-keyboard-open .su-step-active .su-toggle-pw {
  width: 44px;
  height: 44px;
  transition: none;
}

body.ios-keyboard-open .su-progress {
  margin-bottom: 8px;
}

body.ios-keyboard-open .su-progress-track {
  height: 3px;
}

body.ios-keyboard-open .su-steps {
  margin-top: 3px;
}

body.ios-keyboard-open .su-step-dot {
  width: 5px;
  height: 5px;
}

body.ios-keyboard-open .su-step {
  gap: 6px;
}

/* ════════════════════════════════════════════════════════════
   SIGNUP NOTCH / SAFE AREAS
   ════════════════════════════════════════════════════════════ */

@supports (padding: env(safe-area-inset-top)) {
  .card-form .su-progress {
    padding-top: env(safe-area-inset-top, 0px);
  }
}

/* ════════════════════════════════════════════════════════════
   SIGNUP DARK MODE
   ════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .su-reqs {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.08);
  }

  .su-req-icon {
    border-color: rgba(255,255,255,0.15);
  }

  .su-toggle-pw {
    color: rgba(255,255,255,0.4);
  }

  .su-toggle-pw:hover {
    background: rgba(255,255,255,0.08);
  }
}

/* ════════════════════════════════════════════════════════════
   FORGOT / RESET PASSWORD / OTP — KEYBOARD OPEN
   ════════════════════════════════════════════════════════════ */

/* Reset password has many elements — compact them when keyboard opens */
body.ios-keyboard-open .su-reqs {
  padding: 4px 8px;
  gap: 2px;
}

body.ios-keyboard-open .su-req {
  font-size: 0.66rem;
}

body.ios-keyboard-open .su-strength {
  gap: 6px;
}

body.ios-keyboard-open .su-strength-track {
  height: 3px;
}

body.ios-keyboard-open .su-strength-label {
  font-size: 0.62rem;
  min-width: 32px;
}

/* Hide footer on keyboard open for all auth pages */
body.ios-keyboard-open .footer-copy {
  display: none;
}

/* Hide link-button (resend OTP) when keyboard is open */
body.ios-keyboard-open .link-button {
  display: none;
}

/* Auth form gap compact when keyboard open */
body.ios-keyboard-open .auth-form {
  gap: 6px;
}

/* Reset password specific — compact the requirements box */
body.ios-keyboard-open #rpReqs {
  padding: 3px 8px;
  gap: 1px;
}

body.ios-keyboard-open #rpReqs .su-req {
  font-size: 0.64rem;
  gap: 4px;
}

body.ios-keyboard-open #rpReqs .su-req-icon {
  width: 12px;
  height: 12px;
  font-size: 0.5rem;
}

/* Reset password toggle buttons compact */
body.ios-keyboard-open .su-toggle-pw {
  width: 40px;
  height: 40px;
  transition: none;
}

body.ios-keyboard-open .su-toggle-pw svg {
  width: 16px;
  height: 16px;
}

/* PWA standalone + keyboard open */
@media (display-mode: standalone) {
  body.ios-keyboard-open .field-group {
    height: 48px;
    min-height: 48px;
  }

  body.ios-keyboard-open .cta-btn {
    height: 48px;
    min-height: 48px;
  }

  body.ios-keyboard-open .su-reqs {
    padding: 3px 8px;
  }

  body.ios-keyboard-open .su-req {
    font-size: 0.64rem;
  }

  body.ios-keyboard-open .su-strength-track {
    height: 3px;
  }
}

/* PWA landscape keyboard open */
@media (display-mode: standalone) and (orientation: landscape) and (max-height: 500px) {
  body.ios-keyboard-open .su-reqs {
    padding: 2px 6px;
  }

  body.ios-keyboard-open .su-req {
    font-size: 0.58rem;
  }

  body.ios-keyboard-open .su-strength-track {
    height: 2px;
  }

  body.ios-keyboard-open .field-group {
    height: 40px;
    min-height: 40px;
  }

  body.ios-keyboard-open .cta-btn {
    height: 40px;
    min-height: 40px;
  }
}
