:root{
  --color-bg:#f5f3fb;
  --color-dark:#1e1b4b;
  --color-primary:#6d28d9;
  --color-primary-hover:#5b21b6;
  --color-accent:#06b6d4;
  --color-text:#1e1b4b;
  --color-muted:#6b7280;
  --color-border:#ddd6fe;
  --color-success:#16a34a;
  --color-gold:#b45309;
  --color-gold-light:#fcd34d;
  --color-green:#16a34a;
  --color-blue:#2563eb;
  --color-pink:#db2777;
  --color-purple:#7c3aed;
  --bottom-nav-height:74px;
}

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

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  background:var(--color-bg);
  color:var(--color-text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  padding-bottom:calc(
    var(--bottom-nav-height) + env(safe-area-inset-bottom)
  );
}

button,
input,
a{
  -webkit-tap-highlight-color:transparent;
}

/* -------------------------------------------------
   TOP BAR
   ------------------------------------------------- */
.topbar{
  background:#fff;
  border-bottom:1px solid var(--color-border);
  position:sticky;
  top:0;
  z-index:50;
}

.topbar-inner{
  height:68px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  max-width:900px;
  margin:auto;
  padding:0 16px;
}

.topbar h1{
  margin:0;
  color:var(--color-dark);
  font-size:18px;
  font-weight:900;
  letter-spacing:-.02em;
}

.back-btn{
  width:44px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--color-dark);
  text-decoration:none;
  border-radius:50%;
  background:#f5f3fb;
}

.top-action{
  color:var(--color-primary);
  font-size:12px;
  font-weight:800;
  text-decoration:none;
  display:flex;
  align-items:center;
  gap:6px;
  margin-left:auto;
}

.top-action svg{
  width:16px;
  height:16px;
  stroke-width:1.8;
}

/* -------------------------------------------------
   HERO
   ------------------------------------------------- */
.hero{
  margin-top:20px;
  padding:0 4px;
}

.hero-wrap{
  position:relative;
  padding:24px 20px 28px;
  border-radius:26px;
  background:linear-gradient(135deg,#5b21b6 0%,#4c1d95 55%,#312e81 100%);
  color:#fff;
  overflow:hidden;
  box-shadow:0 20px 40px -10px rgba(79,70,229,.35);
}

.hero-wrap::before{
  content:"";
  position:absolute;
  inset:-10%;
  background:radial-gradient(circle at 80% -10%, rgba(245,158,11,.35) 0%, transparent 55%),
            radial-gradient(circle at -10% 110%, rgba(16,185,129,.18) 0%, transparent 45%);
  pointer-events:none;
}

.hero-icon{
  width:52px;
  height:52px;
  flex-shrink:0;
  border-radius:16px;
  background:rgba(255,255,255,.14);
  backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.22);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fcd34d;
  z-index:2;
}

.hero-icon svg{
  width:30px;
  height:30px;
  stroke:#fcd34d;
}

.hero-text{
  flex:1;
  min-width:0;
  z-index:2;
  position:relative;
}

.hero-eyebrow{
  margin:0 0 6px;
  color:#c7d2fe;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.hero-title{
  margin:0 0 8px;
  font-size:23px;
  font-weight:900;
  line-height:1.15;
  color:#fff;
}

.hero-sub{
  margin:0;
  color:#e0e7ff;
  font-size:12px;
  line-height:1.5;
  opacity:.9;
}

.hero-gift{
  position:absolute;
  right:-14px;
  bottom:-12px;
  width:92px;
  height:92px;
  opacity:.55;
  pointer-events:none;
  z-index:1;
}

.hero-gift svg{
  width:100%;
  height:100%;
  stroke:#fcd34d;
}

/* -------------------------------------------------
   PROFILE CARD
   ------------------------------------------------- */
.profile-card{
  margin-top:16px;
  padding:18px 20px;
  background:#fff;
  border:1px solid var(--color-border);
  border-radius:22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  box-shadow:0 8px 24px -8px rgba(30,27,75,.08);
}

.profile-avatar{
  width:56px;
  height:56px;
  flex-shrink:0;
  border-radius:18px;
  background:#f5f3ff;
  color:var(--color-primary);
  display:flex;
  align-items:center;
  justify-content:center;
  border:2px solid rgba(109,40,217,.18);
  overflow:hidden;
}

.profile-avatar-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  border-radius:16px;
}

.profile-avatar svg{
  width:26px;
  height:26px;
  stroke-width:2.2;
}

/* Gender-tinted default avatars (same logic as product reviews). */
.profile-avatar-m{ color:#2563eb; background:#eff6ff; border-color:rgba(37,99,235,.18); }
.profile-avatar-f{ color:#db2777; background:#fdf2f8; border-color:rgba(219,39,119,.18); }
.profile-avatar-n{ color:#6b7280; background:#f1f5f9; border-color:rgba(107,114,128,.18); }

.profile-info{
  min-width:0;
}

.profile-name{
  margin:0;
  color:var(--color-dark);
  font-size:17px;
  font-weight:900;
  letter-spacing:-.02em;
}

.profile-level{
  margin:3px 0 0;
  color:var(--color-primary);
  font-size:12px;
  font-weight:800;
}

.profile-balance{
  text-align:right;
}

.profile-balance span{
  display:block;
  color:var(--color-muted);
  font-size:11px;
  font-weight:700;
}

.profile-balance strong{
  display:block;
  color:var(--color-dark);
  font-size:16px;
  font-weight:900;
}

.profile-arrow{
  width:34px;
  height:34px;
  flex-shrink:0;
  border-radius:12px;
  background:#f5f3ff;
  color:var(--color-primary);
  display:flex;
  align-items:center;
  justify-content:center;
}

.profile-arrow svg{
  width:16px;
  height:16px;
  stroke-width:2.2;
}

/* -------------------------------------------------
   STATISTIC CARDS
   ------------------------------------------------- */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
  margin-top:16px;
}

.stat-card{
  height:90px;
  padding:14px 16px;
  border-radius:20px;
  border:1px solid var(--color-border);
  display:flex;
  align-items:flex-start;
  gap:12px;
  position:relative;
  overflow:hidden;
  box-shadow:0 6px 18px -6px rgba(30,27,75,.07);
}

.stat-card::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  width:4px;
  background:rgba(255,255,255,.55);
  border-radius:0 20px 20px 0;
  pointer-events:none;
}

.stat-icon{
  width:40px;
  height:40px;
  flex-shrink:0;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.stat-icon svg{
  width:22px;
  height:22px;
  stroke-width:2.2;
}

.stat-body{
  flex:1;
  min-width:0;
}

.stat-body span{
  display:block;
  color:var(--color-muted);
  font-size:10px;
  font-weight:800;
  margin-bottom:4px;
}

.stat-body strong{
  display:block;
  color:var(--color-dark);
  font-size:16px;
  font-weight:900;
  line-height:1.1;
}

.stat-mark{
  width:22px;
  height:22px;
  flex-shrink:0;
  border-radius:8px;
  background:rgba(255,255,255,.6);
  color:var(--color-muted);
  font-size:13px;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:center;
}

.stat-green{
  background:#f0fdf4;
}
.stat-green .stat-icon{
  background:#dcfce7;
  color:var(--color-green);
}
.stat-green .stat-mark{color:var(--color-green);}

.stat-amber{
  background:#fefbeb;
}
.stat-amber .stat-icon{
  background:#fef3c7;
  color:var(--color-gold);
}
.stat-amber .stat-mark{color:var(--color-gold);}

.stat-blue{
  background:#eff6ff;
}
.stat-blue .stat-icon{
  background:#dbeafe;
  color:var(--color-blue);
}
.stat-blue .stat-mark{color:var(--color-blue);}

.stat-pink{
  background:#fdf2f8;
}
.stat-pink .stat-icon{
  background:#fce7f3;
  color:var(--color-pink);
}
.stat-pink .stat-mark{color:var(--color-pink);}

/* -------------------------------------------------
   PANEL (base)
   ------------------------------------------------- */
.panel{
  padding:20px;
  background:#fff;
  border:1px solid var(--color-border);
  border-radius:22px;
  margin-top:16px;
  box-shadow:0 8px 24px -8px rgba(30,27,75,.07);
}

.eyebrow{
  margin:0;
  color:var(--color-muted);
  font-size:10px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.panel-title{
  margin:6px 0 14px;
  color:var(--color-dark);
  font-size:18px;
  font-weight:900;
}

.ref-label-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.ref-help{
  color:var(--color-primary);
  font-size:12px;
  font-weight:800;
  text-decoration:none;
}

.ref-sub{
  margin:6px 0 14px;
  color:var(--color-muted);
  font-size:13px;
  line-height:1.5;
}

/* -------------------------------------------------
   LEVEL PROGRESS CARD
   ------------------------------------------------- */
.level-panel{
  padding:24px 22px;
  background:linear-gradient(135deg,#4c1d95 0%,#312e81 65%,#1e1b4b 100%);
  color:#fff;
  border:none;
  position:relative;
  overflow:hidden;
  box-shadow:0 24px 48px -12px rgba(79,70,229,.45);
}

.level-panel::before{
  content:"";
  position:absolute;
  inset:-10%;
  background:radial-gradient(circle at 75% -5%, rgba(245,158,11,.25) 0%, transparent 50%),
            radial-gradient(circle at 0% 100%, rgba(16,185,129,.12) 0%, transparent 40%);
  pointer-events:none;
}

.level-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  position:relative;
  z-index:2;
}

.level-badge{
  width:52px;
  height:52px;
  flex-shrink:0;
  border-radius:16px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.22);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fcd34d;
}

.level-badge svg{
  width:28px;
  height:28px;
  stroke:#fcd34d;
  stroke-width:2;
}

.level-info-center{
  min-width:0;
}

.level-header .eyebrow{
  color:#c7d2fe;
}

.level-title{
  margin:2px 0 4px;
  color:#fff;
  font-size:20px;
  font-weight:900;
  letter-spacing:-.02em;
}

.level-sub{
  color:#a5b4fc;
  font-size:12px;
  font-weight:700;
}

.rate-badge{
  min-width:78px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.18);
  color:#fcd34d;
  text-align:center;
  flex-shrink:0;
}

.rate-badge strong{
  display:block;
  font-size:22px;
  line-height:1;
}

.rate-badge span{
  display:block;
  margin-top:4px;
  font-size:9px;
  font-weight:800;
  opacity:.85;
}

.level-metrics{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:18px;
  position:relative;
  z-index:2;
}

.level-metric{
  flex:1;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
}

.level-metric span{
  display:block;
  color:#c7d2fe;
  font-size:10px;
  font-weight:700;
}

.level-metric strong{
  display:block;
  margin-top:4px;
  color:#fff;
  font-size:14px;
  font-weight:900;
}

.level-metric-next{
  text-align:right;
}

.level-progress-row{
  margin-top:16px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  position:relative;
  z-index:2;
}

.progress-label{
  color:#c7d2fe;
  font-size:11px;
  font-weight:700;
}

.progress-value{
  color:#fcd34d;
  font-size:11px;
  font-weight:800;
}

.progress-track{
  width:100%;
  height:10px;
  margin-top:10px;
  overflow:hidden;
  background:rgba(255,255,255,.12);
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
}

.progress-fill{
  width:0;
  height:100%;
  background:linear-gradient(90deg,#fcd34d,#f59e0b);
  border-radius:999px;
  transition:width .5s ease;
}

.level-note{
  margin:14px 0 0;
  color:#c7d2fe;
  font-size:12px;
  line-height:1.55;
  position:relative;
  z-index:2;
}

/* -------------------------------------------------
   REFERRAL LINK
   ------------------------------------------------- */
.link-panel{
  padding:22px 20px;
}

.ref-input-wrap{
  position:relative;
  margin-top:12px;
  display:flex;
  align-items:center;
}

.link-icon{
  position:absolute;
  left:14px;
  color:var(--color-primary);
}

.link-icon svg{
  width:18px;
  height:18px;
}

.ref-input-wrap input{
  width:100%;
  min-width:0;
  height:48px;
  padding:0 46px 0 52px;
  border:1px solid var(--color-border);
  border-radius:14px;
  background:#f8fafc;
  color:var(--color-dark);
  font-size:13px;
  outline:none;
}

.ref-input-wrap input::placeholder{
  color:var(--color-muted);
}

.ref-btns{
  display:flex;
  gap:10px;
  margin-top:12px;
}

.ref-btns button{
  flex:1;
  min-height:44px;
  border:0;
  border-radius:12px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}

.btn-copy{
  background:var(--color-primary);
  color:#fff;
}

.btn-copy:active{
  background:var(--color-primary-hover);
}

.btn-share{
  background:#f8fafc;
  color:var(--color-dark);
  border:1px solid var(--color-border);
}

.btn-share:active{
  background:#f1f5f9;
}

.btn-share svg{
  width:18px;
  height:18px;
  margin-right:8px;
  stroke-width:1.8;
}

.copy-message{
  min-height:16px;
  margin:9px 0 0;
  color:var(--color-success);
  font-size:11px;
  font-weight:800;
}

/* -------------------------------------------------
   NETWORK STATS
   ------------------------------------------------- */
.network-panel{
  padding:22px 20px;
}

.network-body{
  display:flex;
  gap:12px;
  margin-top:14px;
}

.network-box{
  flex:1;
  padding:16px 14px;
  border-radius:18px;
  border:1px solid var(--color-border);
  display:flex;
  align-items:center;
  gap:14px;
  position:relative;
  overflow:hidden;
}

.network-users{
  background:#f0fdf4;
  border-color:#bbf7d0;
}

.network-buyers{
  background:#fefbeb;
  border-color:#fde68a;
}

.network-box .icon{
  width:44px;
  height:44px;
  flex-shrink:0;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.network-users .icon{
  background:#bbf7d0;
  color:var(--color-green);
}

.network-buyers .icon{
  background:#fde68a;
  color:var(--color-gold);
}

.network-box .icon svg{
  width:24px;
  height:24px;
  stroke-width:2.2;
}

.network-box .text{
  flex:1;
  min-width:0;
}

.network-box .text span{
  display:block;
  color:var(--color-muted);
  font-size:10px;
  font-weight:700;
}

.network-box .text strong{
  display:block;
  margin-top:4px;
  color:var(--color-dark);
  font-size:20px;
  font-weight:900;
}

.network-box .count-icon{
  width:22px;
  height:22px;
  flex-shrink:0;
  border-radius:8px;
  background:rgba(255,255,255,.7);
  color:var(--color-muted);
  font-size:12px;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:center;
}

.privacy-note{
  margin:12px 0 0;
  color:var(--color-muted);
  font-size:10px;
  line-height:1.55;
}

/* -------------------------------------------------
   WITHDRAWAL
   ------------------------------------------------- */
.withdraw-panel{
  padding:22px 20px;
}

.withdraw-balance-badge{
  margin-left:auto;
  font-size:12px;
  font-weight:800;
  color:var(--color-primary);
}

.balance-box{
  margin-top:14px;
  padding:14px 16px;
  background:#f8fafc;
  border:1px solid var(--color-border);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.balance-box span{
  color:var(--color-primary);
  font-size:15px;
  font-weight:700;
}

.balance-box strong{
  color:var(--color-dark);
  font-size:15px;
  font-weight:900;
}

.wallet-icon{
  width:24px;
  height:24px;
  flex-shrink:0;
  color:var(--color-primary);
}

.wallet-icon svg{
  width:22px;
  height:22px;
}

#withdrawForm label{
  display:block;
  margin:14px 0 7px;
  color:var(--color-dark);
  font-size:11px;
  font-weight:800;
}

.form-input{
  width:100%;
  height:48px;
  padding:0 14px;
  border:1px solid var(--color-border);
  border-radius:12px;
  background:#fff;
  color:var(--color-dark);
  font-size:13px;
  outline:none;
}

.form-input:focus{
  border-color:var(--color-primary);
  box-shadow:0 0 0 3px rgba(109,40,217,.08);
}

.withdraw-note{
  margin:10px 0 0;
  color:var(--color-muted);
  font-size:10px;
  line-height:1.55;
}

.withdraw-btn{
  width:100%;
  min-height:48px;
  margin-top:14px;
  border:0;
  border-radius:14px;
  background:linear-gradient(135deg,#6d28d9,#5b21b6);
  color:#fff;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 10px 20px -6px rgba(109,40,217,.35);
}

.withdraw-btn:active{
  background:linear-gradient(135deg,#5b21b6,#4c1d95);
}

.form-message{
  min-height:16px;
  margin:9px 0 0;
  font-size:11px;
  font-weight:800;
}

.form-message.success{color:var(--color-success);}
.form-message.error{color:#dc2626;}

/* -------------------------------------------------
   WITHDRAWAL HISTORY
   ------------------------------------------------- */
.history-panel{
  padding:22px 20px;
}

.view-all{
  color:var(--color-primary);
  font-size:12px;
  font-weight:800;
  text-decoration:none;
}

.history-box{
  margin-top:12px;
}

.empty-history{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:22px 14px;
  text-align:center;
  color:var(--color-muted);
  font-size:11px;
  line-height:1.5;
  border:1px solid var(--color-border);
  border-radius:16px;
  background:#fff;
}

.empty-history svg{
  width:20px;
  height:20px;
  opacity:.6;
}

.withdraw-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 0;
  border-bottom:1px solid var(--color-border);
  font-size:12.5px;
  font-weight:700;
  color:var(--color-dark);
}

.withdraw-row:last-child{border-bottom:0}

.withdraw-date{
  color:var(--color-muted);
  font-size:11px;
  font-weight:600;
}

.withdraw-status{
  font-size:10px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.withdraw-status.ok{color:#15803d;}
.withdraw-status.bad{color:#b91c1c;}
.withdraw-status.pending{color:#92400e;}

/* -------------------------------------------------
   HOW IT WORKS
   ------------------------------------------------- */
.how-panel{
  padding:22px 20px;
}

.steps-note{
  color:var(--color-muted);
  font-size:11px;
  font-weight:700;
}

.steps{
  margin-top:14px;
  display:grid;
  gap:12px;
}

.step{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.step-number{
  width:28px;
  height:28px;
  flex-shrink:0;
  border-radius:50%;
  background:linear-gradient(135deg,#6d28d9,#5b21b6);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:900;
  box-shadow:0 8px 16px -6px rgba(109,40,217,.35);
}

.step h3{
  margin:0;
  color:var(--color-dark);
  font-size:13px;
  font-weight:800;
}

.step p{
  margin:3px 0 0;
  color:var(--color-muted);
  font-size:11px;
  line-height:1.5;
}

/* -------------------------------------------------
   BRAND FOOTER
   ------------------------------------------------- */
.brand-footer{
  margin:32px 0 14px;
  text-align:center;
}

.brand-footer div{
  color:var(--color-dark);
  font-size:18px;
  font-weight:900;
  letter-spacing:-.02em;
}

.brand-footer div span{
  color:var(--color-primary);
}

.brand-footer p{
  margin:5px 0 0;
  color:var(--color-muted);
  font-size:11px;
}

/* -------------------------------------------------
   BOTTOM NAV
   ------------------------------------------------- */
.bottom{
  position:fixed;
  z-index:100;
  left:0;
  right:0;
  bottom:0;
  height:var(--bottom-nav-height);
  padding-bottom:env(safe-area-inset-bottom);
  background:rgba(255,255,255,.97);
  border-top:1px solid var(--color-border);
  box-shadow:0 -8px 24px -8px rgba(30,27,75,.08);
  backdrop-filter:blur(14px);
}

.bottom-inner{
  height:100%;
  display:grid;
  grid-template-columns:repeat(5,1fr);
}

.nav-item{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  color:var(--color-muted);
  text-decoration:none;
  font-size:10px;
  font-weight:700;
}

.nav-item.active{
  color:var(--color-primary);
}

.nav-icon{
  width:23px;
  height:23px;
}

/* -------------------------------------------------
   DESKTOP
   ------------------------------------------------- */
@media(min-width:768px){
  .container{max-width:880px;}
  .panel{padding:26px 28px;}
  .hero{margin-top:32px;}
  .hero-wrap{padding:32px 32px 36px;}
  .hero-title{font-size:28px;}
  .profile-card{padding:22px 28px;}
  .stats-grid{grid-template-columns:repeat(4,1fr);}
  .stat-card{height:128px;}
  .level-panel{padding:32px 28px;}
  .level-title{font-size:24px;}
  .link-panel,.network-panel,.withdraw-panel,.history-panel,.how-panel{
    padding:26px 28px;
  }
}

@media(min-width:1200px){
  .container{max-width:900px;}
}

/* -------------------------------------------------
   REAL WITHDRAWAL HISTORY rows (JS-injected)
   ------------------------------------------------- */
.referral-empty{
  margin:0;
  color:var(--color-muted);
  font-size:12px;
  line-height:1.6;
}
