@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --cream: #8FA8BD;
  --cream-dark: #7A96AD;
  --green: #5A9E80;
  --green-dark: #3F7A62;
  --green-light: #6DB898;
  --green-bg: #EBF4EF;
  --text: #1E2D3D;
  --text-muted: #6B7C8D;
  --border: #E8DDD5;
  --border-soft: #E8DDD5;
  --field-bg: #f0f7f3;
  --error: #b3261e;
  --white: #ffffff;
  --black: #111111;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Defensive: never allow horizontal page scroll. If a child element gets wider than
     the viewport, clip it instead of breaking the whole layout. */
  overflow-x: hidden;
  max-width: 100vw;
}

/* Belt-and-suspenders for narrow phones — most layouts are box-sizing:border-box already
   but make sure inputs/buttons/images never blow past their parents. */
input, select, textarea, button, img { max-width: 100%; }

/* CSS Grid default 1fr is actually minmax(auto, 1fr) — the auto min lets columns expand
   past their share if content can't shrink (long words, fixed-width inputs, SVGs).
   These shorthand fixes prevent that on the main grids used in signup + auth pages. */
.split, .hero-row, .row {
  min-width: 0;
}
.split > *, .hero-row > *, .row > * {
  min-width: 0;
}

.page {
  min-height: 100vh;
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 480px) {
  .page { padding: 24px 12px; }
}

.split {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; }
}

/* LEFT — form card */

.form-card {
  background: var(--white);
  border-radius: 18px;
  padding: 48px 40px 40px;
  position: relative;
  box-shadow: 0 4px 32px rgba(30,45,61,0.12), 0 1px 0 rgba(255,255,255,0.08);
}

@media (max-width: 480px) {
  .form-card { padding: 36px 24px 28px; }
}

.product-strip {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: -110px auto 14px;
  height: 180px;
  padding: 0 12px;
}

.product-strip .bottle {
  height: 180px;
  width: auto;
  max-width: 70%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(30,92,58,0.22));
  transition: transform 0.4s ease;
  animation: bottle-float 4s ease-in-out infinite;
}

@keyframes bottle-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.product-strip .bottle.missing { display: none; }

.product-strip:has(.bottle.missing:nth-child(1)) { display: none; }

@media (max-width: 480px) {
  .product-strip {
    height: 140px;
    margin-top: -100px;
  }
  .product-strip .bottle { height: 140px; }
}

.brand-head {
  text-align: center;
  margin-bottom: 22px;
}

.brand-name {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 2.5px;
  color: var(--green);
  margin: 0;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.hero-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

/* Narrow phones — tighten the cap text so 3 columns fit cleanly */
@media (max-width: 480px) {
  .hero-row { gap: 8px; }
  .hero-row .pip .cap { font-size: 10.5px; line-height: 1.25; }
  .hero-row .pip .ic { width: 36px; height: 36px; }
  .hero-row .pip .ic svg { width: 16px; height: 16px; }
}
/* Below 360px — last pip can clip; let it wrap to a 2-then-1 layout */
@media (max-width: 360px) {
  .hero-row { grid-template-columns: repeat(2, 1fr); }
  .hero-row .pip:last-child { grid-column: 1 / -1; }
}

.hero-row .pip {
  text-align: center;
}

.hero-row .pip .ic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--border-soft);
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
}

.hero-row .pip .cap {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

h1.page-title {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 1px;
  text-align: center;
  margin: 6px 0 4px;
  color: var(--text);
}

.page-tag {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 22px;
}

.lede {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 22px;
  line-height: 1.55;
  text-align: center;
}

.track {
  background: var(--cream);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 22px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.track input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.track-label {
  flex: 1;
  cursor: pointer;
  user-select: none;
}

.track-label .title {
  font-size: 14px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.track-label .sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: 0.2px;
}

.field .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--green);
  background: var(--white);
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: var(--error);
  background: #fff5f4;
}

.field-error {
  display: none;
  font-size: 11px;
  color: var(--error);
  margin-top: 5px;
  font-weight: 600;
}

.field.has-error .field-error { display: block; }
.field.has-error .hint { display: none; }

/* Live referral-code status pill (signup) */
.referral-status {
  display: none;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  align-items: center;
  gap: 6px;
}
.referral-status.show { display: inline-flex; }
.referral-status .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.referral-status.checking {
  background: #f1f3f5; color: var(--text-muted);
}
.referral-status.checking .dot { background: #adb5bd; }
.referral-status.valid {
  background: #e6f4ea; color: #1e5c3a;
}
.referral-status.valid .dot { background: #1e5c3a; }
.referral-status.invalid {
  background: #fdecea; color: var(--error);
}
.referral-status.invalid .dot { background: var(--error); }
/* When the input is valid, give it a subtle green border without using the error style */
.field.referral-valid input { border-color: #1e5c3a; background: #f4f9f5; }
.field.referral-invalid input { border-color: var(--error); background: #fff5f4; }

.req {
  color: var(--error);
  margin-left: 2px;
  font-weight: 700;
}

.field .input-prefix-wrap {
  position: relative;
}

.field .input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.field .input-prefix-wrap input {
  padding-left: 80px;
}

.phone-wrap {
  display: flex;
  background: var(--field-bg);
  border: 1px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.phone-wrap:focus-within {
  border-color: var(--green);
  background: var(--white);
}

.field.has-error .phone-wrap {
  border-color: var(--error);
  background: #fff5f4;
}

.phone-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>")
    right 10px center / 10px no-repeat;
  border: 0;
  border-right: 1px solid var(--border-soft);
  padding: 12px 28px 12px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  outline: none;
  max-width: 130px;
  flex-shrink: 0;
  font-weight: 600;
}

.phone-wrap input[type="tel"] {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  min-width: 0;
}

@media (max-width: 400px) {
  .phone-wrap select { max-width: 100px; padding-left: 10px; padding-right: 24px; font-size: 13px; }
  .phone-wrap input[type="tel"] { padding-left: 10px; }
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

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

@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; gap: 0; }
}

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
}

.creator-block {
  display: none;
  border-top: 1px solid var(--border-soft);
  margin-top: 20px;
  padding-top: 20px;
}
.creator-block.show { display: block; }
.creator-block h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--green);
}
.creator-block .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0 18px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.consent input {
  margin-top: 2px;
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}
.consent a { color: var(--green); text-decoration: underline; }

.row-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin: -4px 0 18px;
}
.row-actions label {
  display: flex; gap: 6px; align-items: center;
  color: var(--text-muted);
  cursor: pointer;
}
.row-actions label input {
  width: 14px; height: 14px; accent-color: var(--green);
}
.row-actions a {
  color: var(--green);
  text-decoration: underline;
}

button.submit {
  width: 100%;
  padding: 14px 16px;
  background: var(--green);
  color: var(--white);
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button.submit:hover { background: var(--green-dark); }
button.submit:active { transform: translateY(1px); }
button.submit:disabled { opacity: 0.6; cursor: not-allowed; }

.cross-link {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin: 18px 0 0;
}
.cross-link a {
  color: var(--green);
  text-decoration: underline;
  font-weight: 600;
}

.legal {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 18px;
}
.legal a { color: var(--text-muted); text-decoration: underline; margin: 0 4px; }

.error {
  background: #fdecea;
  color: var(--error);
  border: 1px solid #f5c6c2;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.error.show { display: block; }

.success {
  background: #e8f5ed;
  color: #1e5c3a;
  border: 1px solid #b9dec7;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.success.show { display: block; }

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* RIGHT — benefits panel */

.benefits {
  background: linear-gradient(140deg, #173f2a 0%, #0c2318 100%);
  color: var(--white);
  border-radius: 18px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(8,24,14,0.28);
}

@media (max-width: 480px) {
  .benefits { padding: 32px 24px; }
}

.benefits h2 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 1px;
  margin: 0 0 24px;
  line-height: 1.2;
}

.benefit {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.benefit:last-of-type { margin-bottom: 24px; }

.benefit .icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  flex-shrink: 0;
}

.benefit .body h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0 4px;
}

.benefit .body p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.benefits .panel-cta {
  background: var(--black);
  color: var(--white);
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: opacity 0.15s;
  margin-top: auto;
}
.benefits .panel-cta:hover { opacity: 0.9; }

/* THANKS page */

.thanks-card {
  background: var(--white);
  border-radius: 16px;
  padding: 56px 40px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 12px 32px rgba(30, 92, 58, 0.06);
}

.thanks-card .check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 20px;
}

.thanks-card h1 { margin: 0 0 12px; font-size: 24px; }
.thanks-card p { color: var(--text-muted); line-height: 1.6; margin: 8px 0; }

/* ============================================================
   MOBILE POLISH — auth pages (signup, login, forgot, reset, setup, verify-email)
   Applied at the END so it wins the cascade.
   ============================================================ */
@media (max-width: 600px) {

  /* PAGE — give content more horizontal room */
  .page { padding: 16px 12px; align-items: flex-start; }

  /* SPLIT — already stacks; tighten gap */
  .split { gap: 14px; }

  /* FORM CARD — denser padding, smaller corner radius */
  .form-card {
    padding: 28px 20px 22px;
    border-radius: 14px;
    box-shadow: 0 1px 0 var(--border-soft), 0 6px 18px rgba(30, 92, 58, 0.05);
  }

  /* PRODUCT STRIP (Revive jar hero) — smaller, less negative margin */
  .product-strip { height: 130px; margin: -90px auto 8px; }
  .product-strip .bottle { height: 130px; }

  /* BRAND HEAD */
  .brand-head { margin-bottom: 14px; }
  .brand-head .brand-name { font-size: 11px; letter-spacing: 2px; }
  .brand-head .brand-sub { font-size: 12px; }

  /* HERO ROW (Get your code · Earn 40% · Bring friends 20%) */
  .hero-row { gap: 6px; margin-bottom: 14px; }
  .hero-row .pip .ic { width: 36px; height: 36px; }
  .hero-row .pip .ic svg { width: 16px; height: 16px; }
  .hero-row .pip .cap { font-size: 10.5px; line-height: 1.3; }

  /* PAGE TITLE (Sign up, Sign in, etc.) — bigger, tighter */
  h1.page-title { font-size: 24px; margin: 4px 0 2px; letter-spacing: -0.3px; }
  .page-tag { font-size: 13px; margin: 2px 0 18px; }

  /* FIELDS — tighter labels, bigger inputs for touch */
  .field { margin-bottom: 14px; }
  .field label { font-size: 11px; letter-spacing: 0.5px; margin-bottom: 4px; }
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="tel"],
  .field input[type="number"],
  .field input[type="url"],
  .field textarea,
  .field select {
    padding: 12px 14px;
    font-size: 16px; /* 16px prevents iOS zoom-on-focus */
    border-radius: 10px;
  }
  .field .hint { font-size: 11.5px; margin-top: 4px; line-height: 1.4; }
  .field-error { font-size: 11.5px; margin-top: 4px; }

  /* PASSWORD WRAPPER + show/hide toggle */
  .pw-toggle { padding: 6px; min-width: 36px; min-height: 36px; }
  .pw-toggle svg { width: 18px; height: 18px; }

  /* ROW (first name / last name 2-up → stacked on mobile, already handled) */
  .row { gap: 0; }

  /* CONSENT checkbox — bigger touch target */
  .consent { font-size: 12.5px; line-height: 1.45; align-items: flex-start; gap: 10px; margin: 6px 0 14px; }
  .consent input[type="checkbox"] { width: 20px; height: 20px; min-width: 20px; flex-shrink: 0; margin-top: 1px; }

  /* SUBMIT — bigger, more thumb-friendly */
  button.submit {
    padding: 15px 18px;
    font-size: 15.5px;
    min-height: 48px;
    border-radius: 11px;
  }

  /* CROSS-LINK (Already have an account? · Forgot password) */
  .cross-link { font-size: 12.5px; margin-top: 14px; line-height: 1.5; }

  /* LEGAL FOOTER */
  .legal { font-size: 10.5px; margin-top: 14px; line-height: 1.5; }

  /* REFERRAL VALIDATION STATUS pill */
  .referral-status { font-size: 11.5px; padding: 6px 9px; margin-top: 6px; }

  /* BENEFITS PANEL — moved ABOVE the form on mobile so the value prop is the first thing
     visitors see. Mobile users won't scroll past a form to find out why they should sign up. */
  .split { display: grid; }
  .benefits { order: -1; }
  /* The 3-pip hero row inside the form-card becomes redundant with the panel above — hide it
     on mobile to remove the duplication and recover vertical space. */
  .form-card .hero-row { display: none; }

  .benefits {
    padding: 22px 20px 18px;
    border-radius: 14px;
    background: var(--green);
    color: var(--white);
    /* Subtle shadow to anchor it visually as the hero element */
    box-shadow: 0 10px 28px rgba(30, 92, 58, 0.18);
  }
  .benefits h2 {
    font-size: 18px;
    margin: 0 0 14px;
    letter-spacing: -0.3px;
    line-height: 1.2;
  }
  .benefit { margin-bottom: 14px; gap: 12px; }
  .benefit:last-of-type { margin-bottom: 4px; }
  .benefit .icon {
    width: 34px; height: 34px;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    border-radius: 10px;
  }
  .benefit .icon svg { width: 17px; height: 17px; }
  .benefit .body h3 {
    font-size: 13px;
    margin-bottom: 1px;
    line-height: 1.25;
    letter-spacing: -0.1px;
  }
  .benefit .body p {
    font-size: 12px;
    line-height: 1.45;
    opacity: 0.88;
    margin: 0;
  }
  .benefits .panel-cta {
    display: none; /* "Already have an account? Sign in" is already in form's cross-link below — no need to duplicate */
  }

  /* THANKS / SUCCESS CARDS */
  .thanks-card {
    padding: 32px 22px;
    border-radius: 14px;
  }
  .thanks-card h1 { font-size: 20px; }
  .thanks-card p { font-size: 13.5px; line-height: 1.55; }

  /* ALERT BOXES (error, success) */
  .error, .success {
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.5;
    border-radius: 8px;
  }
}

/* Very narrow phones (< 380px) — tighten further */
@media (max-width: 380px) {
  .page { padding: 12px 10px; }
  .form-card { padding: 24px 16px 18px; }
  h1.page-title { font-size: 22px; }
  .product-strip { height: 110px; margin-top: -76px; }
  .product-strip .bottle { height: 110px; }
  .field input, .field textarea, .field select { padding: 11px 12px; }
  button.submit { padding: 14px 16px; font-size: 15px; }
}
.thanks-card a { color: var(--green); text-decoration: underline; }
