/* ═══════════════════════════════════════════════════════════════
   LIFESAVER — Ambassador Program design system
   Palette is the existing brand: navy / blue / cyan + lime.
   Rule of the system: lime is money. Every Rand amount, earning
   figure and progress count is lime — nothing else is.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --navy-950: #001d36;
  --navy: #002a4e;
  --navy-panel: #003366;
  --navy-panel-2: #00437e;
  --blue: #0077b6;
  --cyan: #00b4d8;
  --cyan-bright: #00eaff;
  --lime: #a7f736;
  --lime-deep: #6bbf2f;
  --white: #ffffff;
  --mist: rgba(224, 248, 255, 0.82);      /* body text on navy */
  --mist-dim: rgba(224, 248, 255, 0.55);
  --line: rgba(0, 234, 255, 0.16);        /* panel borders */
  --danger: #ff6b6b;
  --font-display: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
}

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

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

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--mist);
  background-color: var(--navy);
  -webkit-font-smoothing: antialiased;
}
/* The "open water" backdrop lives on a fixed layer, not on background-attachment
   (which mobile Safari ignores and which stops painting past the first viewport). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(0, 180, 216, 0.34) 0%, transparent 60%),
    radial-gradient(700px 500px at -20% 108%, rgba(0, 119, 182, 0.45) 0%, transparent 55%),
    linear-gradient(168deg, var(--navy-950) 0%, var(--navy) 46%, #004b7c 100%);
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--cyan-bright); }

:focus-visible {
  outline: 3px solid var(--cyan-bright);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── App bar ────────────────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(0, 29, 54, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.appbar-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 51, 102, 0.55);
  color: var(--white);
  font-size: 20px;
  text-decoration: none;
  line-height: 1;
}
.appbar-back:active { transform: translateY(1px); }
.appbar-titles { min-width: 0; }
.appbar-eyebrow {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--cyan-bright);
}
.appbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-ring { margin-left: auto; flex: none; width: 30px; height: 30px; opacity: 0.9; }

/* ── Layout ─────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 448px;
  margin: 0 auto;
  padding: 22px 16px 56px;
}
.wrap-wide { max-width: 800px; }

/* ── Lifebuoy ring (brand signature) ────────────────────────── */
.buoy { display: block; }
.buoy .buoy-base { fill: none; stroke: var(--cyan-bright); }
.buoy .buoy-seg  { fill: none; stroke: var(--navy); }

/* ── Hero (Welcome) ─────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 40px 8px 28px;
}
.hero-buoy {
  width: 86px;
  height: 86px;
  margin: 0 auto 22px;
  filter: drop-shadow(0 10px 28px rgba(0, 234, 255, 0.35));
  animation: buoy-drift 7s ease-in-out infinite;
}
@keyframes buoy-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(8deg); }
}
.hero-eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cyan-bright);
  margin-bottom: 10px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 8.6vw, 38px);
  font-weight: 800;
  line-height: 1.12;
  color: var(--white);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.hero h1 .accent { color: var(--cyan-bright); }
.hero-sub {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--mist);
  max-width: 340px;
  margin: 0 auto 26px;
}
.hero-script {
  font-family: var(--font-display);
  color: var(--lime);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: lowercase;
  margin-bottom: 6px;
}

/* ── Panels ─────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, rgba(0, 60, 110, 0.72), rgba(0, 42, 78, 0.72));
  border: 1px solid var(--line);
  border-top-color: rgba(0, 234, 255, 0.32);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 14px 34px rgba(0, 12, 24, 0.35);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
}
.panel p { margin-bottom: 12px; }
.panel p:last-child { margin-bottom: 0; }

/* ── Money — the lime rule ──────────────────────────────────── */
.money {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.earn-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, rgba(0, 60, 110, 0.72), rgba(0, 42, 78, 0.72));
  border: 1px solid var(--line);
  border-top-color: rgba(0, 234, 255, 0.32);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  text-align: left;
  box-shadow: 0 14px 34px rgba(0, 12, 24, 0.35);
}
.earn-amount {
  flex: none;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--lime);
  line-height: 1;
  min-width: 96px;
}
.earn-amount small {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--mist-dim);
  margin-top: 6px;
}
.earn-text { font-size: 14.5px; line-height: 1.5; color: var(--mist); }
.earn-text strong { color: var(--white); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 14px 26px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
  color: var(--navy-950);
  background: linear-gradient(180deg, var(--cyan-bright) 0%, var(--cyan) 100%);
  box-shadow: 0 10px 26px rgba(0, 234, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 5px 14px rgba(0, 234, 255, 0.22); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-block { display: flex; width: 100%; }
.btn-outline {
  background: rgba(0, 51, 102, 0.4);
  color: var(--white);
  border: 1.5px solid rgba(0, 234, 255, 0.45);
  box-shadow: none;
}
.btn-outline:hover { background: rgba(0, 234, 255, 0.12); filter: none; }
.btn-lime {
  background: linear-gradient(180deg, var(--lime) 0%, var(--lime-deep) 100%);
  box-shadow: 0 10px 26px rgba(167, 247, 54, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; padding-inline: 12px; }

/* ── Forms ──────────────────────────────────────────────────── */
.field { margin-bottom: 16px; text-align: left; }
.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
  margin-bottom: 7px;
}
.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.97);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 16px;      /* ≥16px stops iOS zoom-on-focus */
  font-weight: 500;
}
.field input::placeholder { color: #8aa0b5; font-weight: 400; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--cyan-bright);
  box-shadow: 0 0 0 4px rgba(0, 234, 255, 0.22);
  background: #fff;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230077b6' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}
.field-hint { font-size: 12.5px; color: var(--mist-dim); margin-top: 6px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  margin: 22px 0;
  font-size: 14.5px;
  line-height: 1.5;
}
.check-row input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  accent-color: var(--lime);
}
.check-row strong { color: var(--white); }

.error-input {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.18) !important;
}
.error-msg {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.14);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffd2d2;
  font-size: 12.5px;
  line-height: 1.45;
}

/* ── Menu list ──────────────────────────────────────────────── */
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0, 60, 110, 0.72), rgba(0, 42, 78, 0.72));
  border: 1px solid var(--line);
  border-top-color: rgba(0, 234, 255, 0.32);
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(0, 12, 24, 0.3);
  transition: transform 0.12s ease, border-color 0.15s;
}
.menu-item:active { transform: scale(0.985); }
.menu-item:hover { border-color: rgba(0, 234, 255, 0.45); }
.menu-ico {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0, 234, 255, 0.12);
  border: 1px solid rgba(0, 234, 255, 0.22);
  font-size: 20px;
}
.menu-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}
.menu-sub { font-size: 12.5px; color: var(--mist-dim); margin-top: 2px; }
.menu-chev { margin-left: auto; color: var(--cyan-bright); font-size: 18px; opacity: 0.8; }

.menu-greet {
  text-align: center;
  margin-bottom: 20px;
}
.menu-greet .hello {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--white);
}
.menu-greet .hello .name { color: var(--cyan-bright); }
.menu-greet p { font-size: 14px; color: var(--mist-dim); margin-top: 4px; }

.logout-link {
  display: block;
  margin: 26px auto 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--mist-dim);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
}
.logout-link:hover { color: var(--danger); }

/* ── Plan cards (Benefits) ──────────────────────────────────── */
.plan-card {
  background: linear-gradient(180deg, rgba(0, 60, 110, 0.78), rgba(0, 42, 78, 0.78));
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan-bright);
  border-radius: var(--radius);
  padding: 0 0 8px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 12, 24, 0.35);
}
.plan-card.plus { border-top-color: var(--lime); }
.plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.plan-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.plan-price {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--lime);
  white-space: nowrap;
}
.plan-price small { font-size: 11px; font-weight: 600; color: var(--mist-dim); display: block; text-align: right; }
.benefit-list { list-style: none; padding: 6px 18px; }
.benefit-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 234, 255, 0.12);
  font-size: 14px;
}
.benefit-list li:last-child { border-bottom: none; }
.benefit-name { color: var(--mist); }
.benefit-value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--lime);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Referral entry cards ───────────────────────────────────── */
.ref-card {
  background: linear-gradient(180deg, rgba(0, 60, 110, 0.72), rgba(0, 42, 78, 0.72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 22px rgba(0, 12, 24, 0.28);
}
.ref-card.done { border-color: rgba(167, 247, 54, 0.5); }
.ref-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--cyan-bright);
  margin-bottom: 10px;
}
.ref-card.done .ref-label { color: var(--lime); }
.ref-card.done .ref-label::after { content: "✓"; font-size: 13px; }
.ref-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ref-row:last-of-type { margin-bottom: 0; }
.ref-row input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  font-size: 16px;
  font-weight: 500;
}
.ref-row input::placeholder { color: #8aa0b5; font-weight: 400; }
.ref-row input:focus {
  outline: none;
  border-color: var(--cyan-bright);
  box-shadow: 0 0 0 4px rgba(0, 234, 255, 0.2);
}

/* Sticky progress dock (Submit Referrals) */
.progress-dock {
  position: sticky;
  bottom: 0;
  z-index: 40;
  margin: 18px -16px 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(0, 29, 54, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}
.progress-ring { position: relative; flex: none; width: 58px; height: 58px; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .track { fill: none; stroke: rgba(0, 234, 255, 0.18); stroke-width: 5; }
.progress-ring .fill {
  fill: none;
  stroke: var(--lime);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}
.progress-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--lime);
}
.progress-meta { min-width: 0; flex: 1; }
.counter {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}
.progress-note { font-size: 11.5px; color: var(--mist-dim); margin-top: 2px; }
.progress-dock .btn { flex: none; min-height: 48px; padding: 10px 22px; }

/* ── Dashboard table ────────────────────────────────────────── */
.stat-hero {
  text-align: center;
  padding: 22px 18px 24px;
  margin-bottom: 16px;
}
.stat-hero .stat-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--mist-dim);
}
.stat-hero .stat-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  color: var(--lime);
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-hero .stat-sub { font-size: 13px; color: var(--mist-dim); margin-top: 6px; }

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(0, 42, 78, 0.72);
  box-shadow: 0 14px 34px rgba(0, 12, 24, 0.35);
}
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--navy-panel-2);
  color: var(--cyan-bright);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.3;
  padding: 12px 8px;
  text-align: center;
  border-bottom: 2px solid rgba(0, 234, 255, 0.35);
}
.data-table thead th:first-child,
.data-table tbody td.month,
.data-table tfoot td:first-child { position: sticky; left: 0; }
.data-table thead th:first-child { z-index: 11; }
.data-table tbody td {
  padding: 11px 8px;
  text-align: center;
  font-size: 13.5px;
  color: var(--white);
  background: transparent;
  border-bottom: 1px solid rgba(0, 234, 255, 0.08);
  font-variant-numeric: tabular-nums;
}
.data-table tbody td.month {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--cyan-bright);
  background: var(--navy-panel);
  z-index: 5;
  min-width: 68px;
}
.data-table tbody td.zero { color: var(--mist-dim); }
.data-table tbody td.bonus-hit { color: var(--lime); font-weight: 700; }
.data-table tbody tr.has-activity td { background: rgba(0, 234, 255, 0.06); }
.data-table tbody tr.has-activity td.month { background: var(--navy-panel-2); }
.data-table tfoot td {
  background: var(--navy-panel-2);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--lime);
  font-size: 16px;
  padding: 14px 8px;
  border-top: 2px solid rgba(167, 247, 54, 0.55);
  text-align: center;
}
.data-table tfoot td:first-child {
  text-align: left;
  color: var(--cyan-bright);
  font-size: 13px;
  padding-left: 14px;
  background: var(--navy-panel-2);
  z-index: 5;
}

.formulas {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(0, 29, 54, 0.55);
  border: 1px solid var(--line);
  border-left: 3px solid var(--lime);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.7;
  color: var(--mist);
}
.formulas strong { color: var(--lime); font-weight: 700; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 12, 24, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: linear-gradient(180deg, var(--navy-panel-2), var(--navy-panel));
  border: 1px solid rgba(0, 234, 255, 0.35);
  border-radius: var(--radius);
  padding: 26px 22px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--lime);
  margin-bottom: 10px;
}
.modal-text { font-size: 14.5px; line-height: 1.5; color: var(--white); margin-bottom: 20px; }

/* ── Bits ───────────────────────────────────────────────────── */
.center { text-align: center; }
.status-note {
  text-align: center;
  padding: 30px 16px;
  color: var(--mist);
  font-size: 15px;
}
.divider-note {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mist-dim);
  text-align: center;
  margin: 26px 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.divider-note::before, .divider-note::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

@media (min-width: 640px) {
  .hero { padding-top: 56px; }
  .wrap { padding-top: 30px; }
}
