/* Acorns Early — Join Account
   Brand tokens aligned to Acorns green experience */

:root {
  --acorns-green: #74C947;
  --acorns-green-dark: #5FB832;
  --acorns-green-darker: #4FA028;
  --acorns-green-soft: #E8F5E0;
  --acorns-green-tint: #F0F9EB;
  --text: #1A1A1A;
  --text-secondary: #5A5A5A;
  --text-muted: #8A8A8A;
  --bg: #F5F7F5;
  --bg-warm: #FAFBFA;
  --card: #FFFFFF;
  --border: #E2E5E2;
  --border-focus: #74C947;
  --error: #D64545;
  --error-bg: #FDF2F2;
  --shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 16px rgba(26, 26, 26, 0.06);
  --radius-btn: 28px;
  --radius-input: 14px;
  --radius-card: 18px;
  --phone-width: 390px;
  --content-max: 420px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font-family: inherit;
}

/* ── App shell (no device chrome) ── */
.app-shell {
  width: 100%;
  max-width: var(--content-max);
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (min-width: 480px) {
  body {
    align-items: center;
    padding: 0;
  }

  .app-shell {
    min-height: 100dvh;
    /* clean centered column — no bezel, notch, or fixed device height */
  }
}

/* ── Screen stack ── */
.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 56px 24px 24px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(24px);
  transition:
    opacity var(--transition),
    transform var(--transition),
    visibility var(--transition);
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  position: relative;
  flex: 1;
}

.screen.exit-left {
  opacity: 0;
  transform: translateX(-24px);
}

.screen.enter-from-left {
  transform: translateX(-24px);
}

/* ── Header / nav ── */
.screen-header {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 8px;
  flex-shrink: 0;
  position: relative;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: -8px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  transition: background 150ms ease;
}

.btn-back:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-back:focus-visible {
  outline: 2px solid var(--acorns-green);
  outline-offset: 2px;
}

.btn-back svg {
  width: 22px;
  height: 22px;
}

/* ── Progress ── */
.progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 4px 0 16px;
  flex-shrink: 0;
}

.progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: background 200ms ease, transform 200ms ease;
}

.progress-dot.active {
  background: var(--acorns-green);
  transform: scale(1.15);
}

.progress-dot.done {
  background: var(--acorns-green-dark);
}

/* ── Typography ── */
.logo {
  display: block;
  height: 32px;
  width: auto;
  margin: 8px auto 28px;
}

.logo-mark {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
}

#screen-child h1,
#screen-parent h1,
#screen-account h1 {
  margin-bottom: 28px;
}

#screen-approval h1 {
  margin-bottom: 12px;
  text-align: center;
}

.subtitle {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

.illustration {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 8px auto 32px;
}

/* ── Content areas ── */
.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen-footer {
  flex-shrink: 0;
  padding-top: 16px;
  padding-bottom: max(8px, var(--safe-bottom));
}

/* ── Forms ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.form-group input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:hover {
  border-color: #C8CDC8;
}

.form-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(116, 201, 71, 0.2);
}

.form-group input.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.form-group input.error:focus {
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.15);
}

.field-error {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  margin-top: 6px;
}

.field-error.visible {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Date of birth row */
.dob-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr;
  gap: 10px;
}

.dob-row .form-group {
  margin-bottom: 0;
}

/* Password / passcode field with show/hide */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 52px;
}

.btn-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.btn-password-toggle:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.btn-password-toggle:focus-visible {
  outline: 2px solid var(--acorns-green);
  outline-offset: 1px;
}

.btn-password-toggle svg {
  width: 22px;
  height: 22px;
}

.btn-password-toggle[aria-pressed="true"] {
  color: var(--acorns-green-dark);
}

/* ── Buttons ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  padding: 0 24px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: #fff;
  background: var(--acorns-green);
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  box-shadow: 0 2px 8px rgba(116, 201, 71, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
  background: var(--acorns-green-dark);
}

.btn-primary:active {
  background: var(--acorns-green-darker);
  transform: scale(0.985);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--acorns-green-dark);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ── Welcome screen ── */
#screen-welcome {
  text-align: center;
  padding-top: 72px;
}

#screen-welcome .screen-body {
  justify-content: center;
  padding-bottom: 24px;
}

#screen-welcome h1 {
  font-size: 30px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

#screen-welcome .subtitle {
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  font-size: 15.5px;
}


/* ── Approval / OTP ── */
#screen-approval {
  text-align: center;
}

#screen-approval .screen-header {
  justify-content: center;
}

#screen-approval .screen-header .brand-lockup {
  position: static;
  transform: none;
  margin: 0 auto 8px;
  pointer-events: none;
}

#screen-approval .subtitle {
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 32px;
}

.otp-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 8px;
  max-width: 340px;
}

.otp-digit {
  width: 48px;
  height: 56px;
  padding: 0;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  appearance: none;
  -webkit-appearance: none;
  caret-color: var(--acorns-green);
}

.otp-digit:hover {
  border-color: #C8CDC8;
}

.otp-digit:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(116, 201, 71, 0.2);
}

.otp-digit.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.otp-error {
  text-align: center;
  margin-top: 12px;
}

@media (max-width: 380px) {
  .otp-group {
    gap: 6px;
  }
  .otp-digit {
    width: 42px;
    height: 52px;
    font-size: 20px;
  }
}

/* ── Success ── */
#screen-success {
  text-align: center;
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 24px auto 28px;
  border-radius: 50%;
  background: var(--acorns-green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: successPop 480ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.success-icon svg {
  width: 36px;
  height: 36px;
  color: var(--acorns-green-dark);
}

@keyframes successPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  text-align: left;
  margin: 8px 0 24px;
  box-shadow: var(--shadow-sm);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  gap: 16px;
}

.summary-row + .summary-row {
  border-top: 1px solid var(--border);
}

.summary-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.summary-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}


.finish-error {
  font-size: 13px;
  color: #c0392b;
  margin-top: 12px;
  min-height: 0;
  opacity: 0;
  transition: opacity 200ms ease;
}

.finish-error.visible {
  opacity: 1;
}

.finished-note {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 16px;
  opacity: 0;
  transition: opacity 300ms ease;
}

.finished-note.visible {
  opacity: 1;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .screen,
  .btn-primary,
  .success-icon {
    transition: none;
    animation: none;
  }
}

/* ── Official brand lockup (icon + wordmark) ── */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px auto 28px;
}

.brand-lockup--center {
  display: flex;
  justify-content: center;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.08);
}

.brand-icon--lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.brand-wordmark {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  color: var(--acorns-green);
  line-height: 1;
}

.brand-wordmark--dark {
  color: var(--text);
}

.logo-img {
  display: block;
  height: 28px;
  width: auto;
  margin: 4px auto 24px;
}

.logo-img--welcome {
  height: 32px;
  margin-bottom: 8px;
}

/* Screen top logo row when back button present */
.screen-header .brand-lockup {
  margin: 0 auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.screen-header .brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.screen-header .brand-wordmark {
  font-size: 18px;
}
