:root {
  --purple: #5f259f;
  --purple-dark: #4a1c7d;
  --purple-light: #f3ecfa;
  --purple-mid: #8a4fc9;
  --green: #17a672;
  --green-bg: #e7f8f1;
  --red: #e4483c;
  --red-bg: #fdeceb;
  --gray-text: #6b6b76;
  --dark-text: #1b1b23;
  --border: #ececf2;
  --white: #ffffff;
  --bg: #f7f5fb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(95,37,159,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--dark-text);
  padding-bottom: 76px; /* space for bottom nav */
}

a { text-decoration: none; color: inherit; }

.app-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

/* ---------- TOP HEADER ---------- */
.topbar {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-mid) 100%);
  color: #fff;
  padding: 20px 18px 28px;
  border-radius: 0 0 24px 24px;
}
.topbar-row { display: flex; justify-content: space-between; align-items: center; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.wallet-card {
  margin-top: 18px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(4px);
}
.wallet-card .label { font-size: 12px; opacity: 0.85; }
.wallet-card .amount { font-size: 26px; font-weight: 700; margin-top: 4px; }
.wallet-card .subrow { display:flex; justify-content: space-between; margin-top: 10px; font-size: 12px; opacity: 0.9;}

/* ---------- CONTAINER ---------- */
.container { padding: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; color: var(--dark-text); }
.section-title.row { display:flex; justify-content:space-between; align-items:center; }
.section-title.row a { font-size: 12px; color: var(--purple); font-weight: 600; }

/* ---------- CARDS ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.stock-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.stock-row .left { display: flex; align-items: center; gap: 10px; }
.stock-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--purple-light); color: var(--purple);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size: 13px;
}
.stock-name { font-weight: 600; font-size: 14px; }
.stock-sub { font-size: 12px; color: var(--gray-text); margin-top: 2px; }
.stock-right { text-align: right; }
.stock-price { font-weight: 700; font-size: 14px; }
.pill { display:inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-top: 3px; }
.pill.up { background: var(--green-bg); color: var(--green); }
.pill.down { background: var(--red-bg); color: var(--red); }

/* horizontal scroll chips */
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex: 0 0 auto; background: var(--white); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--purple);
  white-space: nowrap;
}
.chip.active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 14px; }
.form-group label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; color: var(--dark-text); }
.form-control {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 14px; background: var(--white);
}
.form-control:focus { outline: none; border-color: var(--purple); }
.btn {
  display: inline-block; width: 100%; text-align: center;
  padding: 13px; border-radius: 30px; font-weight: 700; font-size: 14px;
  border: none; cursor: pointer;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-buy { background: var(--green); color: #fff; }
.btn-sell { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border: 1.5px solid var(--purple); color: var(--purple); }
.btn-half { width: 48%; }
.btn-row { display: flex; justify-content: space-between; gap: 8px; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border-radius: 30px; padding: 10px 16px;
  box-shadow: var(--shadow);
}
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; background: transparent; }

/* ---------- AUTH PAGES ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--purple) 0%, var(--purple-dark) 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 22px; padding: 30px 26px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.auth-logo { text-align: center; margin-bottom: 6px; font-size: 26px; font-weight: 800; color: var(--purple); }
.auth-tagline { text-align: center; color: var(--gray-text); font-size: 13px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--gray-text); }
.auth-switch a { color: var(--purple); font-weight: 700; }

/* ---------- BOTTOM NAV (PhonePe style) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 8px 0 10px;
  box-shadow: 0 -2px 14px rgba(0,0,0,0.06);
  z-index: 100;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--gray-text); font-weight: 600; }
.nav-item.active { color: var(--purple); }
.nav-icon { font-size: 20px; line-height: 1; }

/* ---------- FLASH ---------- */
.flash { padding: 12px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; font-weight: 600; }
.flash.success { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }

/* ---------- LEADERBOARD ---------- */
.lb-row { display:flex; align-items:center; gap: 12px; padding: 12px 14px; background: #fff; border-radius: var(--radius-sm); margin-bottom: 8px; box-shadow: var(--shadow); }
.lb-rank { width: 26px; height: 26px; border-radius: 50%; background: var(--purple-light); color: var(--purple); font-weight:700; font-size:12px; display:flex; align-items:center; justify-content:center; }
.lb-rank.gold { background: #fdf1cf; color: #b8860b; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-text); font-size: 13px; }
.text-green { color: var(--green); } .text-red { color: var(--red); }
.muted { color: var(--gray-text); font-size: 12px; }

/* ---------------- PREMIUM / UPSELL ---------------- */
.pro-badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.3px;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px;
  background: linear-gradient(135deg, #f6c453, #e8a52c); color: #5a3d00;
}
.upsell-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff; border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px;
}
.upsell-banner .txt { font-size: 13px; font-weight: 600; line-height: 1.4; }
.upsell-banner .txt small { display:block; font-weight: 400; opacity: 0.85; margin-top: 2px; }
.upsell-banner .btn-mini {
  background: #fff; color: var(--purple); font-weight: 700; font-size: 12px;
  padding: 8px 14px; border-radius: 30px; white-space: nowrap; text-decoration: none;
}
.affiliate-banner {
  background: #fff7e6; border: 1px solid #ffe4a3; border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 16px; font-size: 13px; color: var(--dark-text);
}
.affiliate-banner strong { display:block; margin-bottom: 4px; }
.affiliate-banner .btn-row { margin-top: 10px; gap: 6px; }
.affiliate-banner .btn-outline { padding: 8px 0; font-size: 12px; }

.pricing-wrap { display: flex; gap: 10px; margin: 16px 0; }
.price-card {
  flex: 1; background: #fff; border-radius: var(--radius-sm); padding: 18px 14px;
  box-shadow: var(--shadow); border: 2px solid transparent; text-align: center;
}
.price-card.highlight { border-color: var(--purple); position: relative; }
.price-card.highlight::before {
  content: 'RECOMMENDED'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--purple); color: #fff; font-size: 9px; font-weight: 800; padding: 3px 10px; border-radius: 20px;
}
.price-card .plan-name { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.price-card .plan-price { font-size: 22px; font-weight: 800; color: var(--purple); margin-bottom: 12px; }
.price-card .plan-price span { font-size: 12px; font-weight: 500; color: var(--gray-text); }
.feature-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.feature-table td { padding: 10px 4px; border-top: 0.5px solid var(--border); }
.feature-table td:first-child { color: var(--gray-text); }
.feature-table td:not(:first-child) { text-align: center; font-weight: 600; }
