/* NEXChain - Mobile First Styles */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
:root {
  --primary:#3a9df5; --primary-dark:#2b7fd1; --primary-deep:#1e5fa8;
  --accent:#ffa726; --accent-dark:#f59000; --green:#2ecc71; --red:#e74c3c;
  --bg:#eaf4fd; --card:#ffffff; --text:#1a2b45; --muted:#7a8ba3; --border:#e3edf7;
}
html,body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif; background:var(--bg); color:var(--text); font-size:15px; line-height:1.5; }
body { padding-bottom:80px; min-height:100vh; }
a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }

.app-header {
  background:linear-gradient(135deg,#4aa8f7 0%,#2b7fd1 100%);
  color:#fff; padding:16px 18px 22px; border-radius:0 0 24px 24px;
  position:relative; overflow:hidden;
}
.app-header::before { content:''; position:absolute; top:-40px; right:-30px; width:140px; height:140px; background:rgba(255,255,255,.08); border-radius:50%; }
.app-header::after { content:''; position:absolute; bottom:-50px; left:-20px; width:120px; height:120px; background:rgba(255,255,255,.06); border-radius:50%; }
.header-top { display:flex; justify-content:space-between; align-items:center; position:relative; z-index:1; }
.header-title { font-size:18px; font-weight:700; }
.icon-btn { width:38px; height:38px; border-radius:50%; background:rgba(255,255,255,.18); display:flex; align-items:center; justify-content:center; color:#fff; border:none; cursor:pointer; position:relative; }
.icon-btn .badge { position:absolute; top:-2px; right:-2px; background:var(--red); color:#fff; font-size:10px; min-width:16px; height:16px; border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 4px; }

.container { padding:0 16px; margin-top:-12px; position:relative; z-index:2; }

.card { background:var(--card); border-radius:16px; padding:16px; margin-bottom:14px; box-shadow:0 4px 18px rgba(43,127,209,.08); }
.card-title { font-size:15px; font-weight:700; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center; }
.card-title .link { color:var(--primary); font-size:13px; font-weight:600; }

/* Balance card */
.balance-card { background:linear-gradient(135deg,#4aa8f7,#2b7fd1); color:#fff; border-radius:18px; padding:18px; margin-bottom:14px; position:relative; overflow:hidden; }
.balance-label { font-size:13px; opacity:.85; }
.balance-value { font-size:30px; font-weight:800; margin:4px 0 12px; letter-spacing:.5px; }
.balance-actions { display:flex; gap:10px; }
.btn-outline-light { flex:1; background:rgba(255,255,255,.2); border:1px solid rgba(255,255,255,.4); color:#fff; padding:10px; border-radius:12px; font-weight:600; text-align:center; font-size:14px; }

/* Stats row */
.stats-row { display:flex; gap:10px; margin-bottom:14px; }
.stat-box { flex:1; background:var(--card); border-radius:14px; padding:12px 8px; text-align:center; box-shadow:0 2px 10px rgba(43,127,209,.06); }
.stat-box .label { font-size:11px; color:var(--muted); margin-bottom:4px; }
.stat-box .value { font-size:15px; font-weight:700; color:var(--primary-dark); }

/* Grid menu */
.menu-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.menu-item { background:var(--card); border-radius:14px; padding:14px 10px; display:flex; align-items:center; gap:10px; box-shadow:0 2px 10px rgba(43,127,209,.06); cursor:pointer; transition:transform .15s; }
.menu-item:active { transform:scale(.97); }
.menu-icon { width:40px; height:40px; border-radius:12px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:18px; flex-shrink:0; }
.menu-label { font-size:13px; font-weight:600; }

/* Banner */
.banner { border-radius:16px; overflow:hidden; margin-bottom:14px; position:relative; min-height:120px; background:linear-gradient(135deg,#0a2540,#1e5fa8); display:flex; align-items:center; padding:18px; color:#fff; }
.banner h3 { font-size:20px; font-weight:800; margin-bottom:4px; }
.banner p { font-size:12px; opacity:.85; }
.banner .tag { display:inline-block; background:var(--green); color:#fff; font-size:11px; padding:3px 10px; border-radius:20px; margin-top:8px; font-weight:600; }

/* Marquee */
.marquee { background:#fff3e0; border-left:4px solid var(--accent); padding:10px 14px; border-radius:10px; margin-bottom:14px; font-size:13px; color:#e65100; font-weight:600; display:flex; align-items:center; gap:8px; overflow:hidden; }
.marquee .scroll { white-space:nowrap; animation:scroll 15s linear infinite; }
@keyframes scroll { 0%{transform:translateX(100%);} 100%{transform:translateX(-100%);} }

/* News */
.news-item { display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.news-item:last-child { border-bottom:none; }
.news-thumb { width:70px; height:70px; border-radius:10px; background:linear-gradient(135deg,#1e5fa8,#4aa8f7); flex-shrink:0; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800; font-size:20px; }
.news-body { flex:1; min-width:0; }
.news-body h4 { font-size:14px; font-weight:600; margin-bottom:4px; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.news-body .date { font-size:11px; color:var(--muted); }

/* Product card */
.product-card { background:var(--card); border-radius:16px; overflow:hidden; margin-bottom:14px; box-shadow:0 4px 18px rgba(43,127,209,.08); }
.product-banner { background:linear-gradient(135deg,#0a2540,#1e5fa8); padding:18px; color:#fff; position:relative; overflow:hidden; min-height:110px; display:flex; flex-direction:column; justify-content:center; }
.product-banner::after { content:'NEX'; position:absolute; right:-10px; bottom:-20px; font-size:90px; font-weight:900; opacity:.08; }
.product-banner .inv-label { font-size:13px; opacity:.8; }
.product-banner .inv-value { font-size:24px; font-weight:800; color:#ffd54f; }
.product-banner .cycle { font-size:13px; margin-top:4px; }
.product-banner .cycle b { color:#ffd54f; }
.product-info { padding:14px 16px; }
.product-name { font-size:16px; font-weight:700; margin-bottom:10px; }
.product-meta { display:flex; text-align:center; margin-bottom:12px; }
.product-meta > div { flex:1; }
.product-meta .v { font-size:16px; font-weight:700; color:var(--red); }
.product-meta .l { font-size:11px; color:var(--muted); margin-top:2px; }
.product-meta .v.green { color:var(--green); }

/* Buttons */
.btn { display:block; width:100%; padding:13px; border-radius:12px; border:none; font-size:15px; font-weight:700; cursor:pointer; text-align:center; transition:opacity .15s; }
.btn:active { opacity:.85; }
.btn-primary { background:linear-gradient(135deg,#4aa8f7,#2b7fd1); color:#fff; }
.btn-accent { background:linear-gradient(135deg,#ffb74d,#f59000); color:#fff; }
.btn-success { background:linear-gradient(135deg,#66bb6a,#2e7d32); color:#fff; }
.btn-danger { background:linear-gradient(135deg,#ef5350,#c62828); color:#fff; }
.btn-disabled { background:#cfd8dc; color:#90a4ae; cursor:not-allowed; }
.btn-sm { padding:8px 14px; font-size:13px; width:auto; display:inline-block; border-radius:10px; }

/* Tabs */
.tabs { display:flex; background:var(--card); border-radius:14px; padding:4px; margin-bottom:14px; box-shadow:0 2px 10px rgba(43,127,209,.06); }
.tab { flex:1; text-align:center; padding:10px; font-size:13px; font-weight:600; color:var(--muted); border-radius:10px; cursor:pointer; }
.tab.active { background:linear-gradient(135deg,#4aa8f7,#2b7fd1); color:#fff; }

/* Order / investment card */
.order-card { background:var(--card); border-radius:16px; padding:16px; margin-bottom:14px; box-shadow:0 4px 18px rgba(43,127,209,.08); }
.order-head { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.order-icon { width:46px; height:46px; border-radius:12px; background:linear-gradient(135deg,#0a2540,#1e5fa8); display:flex; align-items:center; justify-content:center; color:#ffd54f; font-weight:800; flex-shrink:0; }
.order-title { flex:1; }
.order-title h4 { font-size:15px; font-weight:700; }
.order-title .sub { font-size:11px; color:var(--muted); }
.status-badge { font-size:11px; padding:4px 10px; border-radius:20px; font-weight:600; }
.status-active { background:#e8f5e9; color:#2e7d32; }
.status-finished { background:#eceff1; color:#607d8b; }
.progress-wrap { margin:10px 0; }
.progress-bar { height:8px; background:#e3edf7; border-radius:4px; overflow:hidden; }
.progress-fill { height:100%; background:linear-gradient(90deg,#4aa8f7,#2b7fd1); border-radius:4px; transition:width .5s; }
.progress-text { display:flex; justify-content:space-between; font-size:11px; color:var(--muted); margin-top:5px; }
.order-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:10px 0; }
.order-grid .cell { background:#f5f9fd; border-radius:10px; padding:10px; }
.order-grid .cell .l { font-size:11px; color:var(--muted); }
.order-grid .cell .v { font-size:15px; font-weight:700; margin-top:2px; }
.order-grid .cell .v.green { color:var(--green); }
.next-payout { display:flex; justify-content:space-between; align-items:center; background:#fff8e1; border-radius:10px; padding:10px 12px; margin-top:10px; font-size:13px; }
.next-payout .time { font-weight:700; color:#f57c00; font-family:monospace; }

/* Bottom nav */
.bottom-nav { position:fixed; bottom:0; left:0; right:0; background:#fff; display:flex; padding:8px 0 calc(8px + env(safe-area-inset-bottom)); box-shadow:0 -4px 20px rgba(0,0,0,.08); z-index:100; }
.nav-item { flex:1; text-align:center; color:var(--muted); font-size:10px; font-weight:600; cursor:pointer; position:relative; padding-top:4px; }
.nav-item svg { width:22px; height:22px; margin:0 auto 2px; display:block; fill:currentColor; }
.nav-item.active { color:var(--primary-dark); }
.nav-gift { position:relative; top:-18px; }
.nav-gift .gift-circle { width:52px; height:52px; border-radius:50%; background:linear-gradient(135deg,#ffb74d,#f59000); display:flex; align-items:center; justify-content:center; margin:0 auto; box-shadow:0 6px 16px rgba(245,144,0,.4); color:#fff; }
.nav-gift .gift-circle svg { width:26px; height:26px; fill:#fff; }
.nav-gift span { display:block; margin-top:2px; }

/* Auth pages */
.auth-wrap { min-height:100vh; background:linear-gradient(160deg,#4aa8f7 0%,#2b7fd1 45%,#eaf4fd 45%,#eaf4fd 100%); display:flex; flex-direction:column; align-items:center; padding:40px 24px; }
.auth-logo { width:90px; height:90px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; margin-bottom:20px; box-shadow:0 8px 24px rgba(0,0,0,.15); font-size:40px; font-weight:900; color:var(--primary-dark); }
.auth-card { width:100%; max-width:400px; background:#fff; border-radius:20px; padding:24px; box-shadow:0 10px 40px rgba(43,127,209,.15); }
.auth-card h2 { text-align:center; margin-bottom:6px; font-size:22px; }
.auth-card .sub { text-align:center; color:var(--muted); font-size:13px; margin-bottom:20px; }
.form-group { margin-bottom:14px; position:relative; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--muted); margin-bottom:6px; }
.input-wrap { display:flex; align-items:center; background:#f5f9fd; border:1.5px solid transparent; border-radius:12px; padding:0 12px; transition:border-color .2s; }
.input-wrap:focus-within { border-color:var(--primary); }
.input-wrap .prefix { color:var(--muted); font-size:14px; padding-right:8px; border-right:1px solid var(--border); margin-right:8px; font-weight:600; }
.input-wrap input { flex:1; border:none; background:transparent; padding:13px 0; font-size:15px; outline:none; color:var(--text); }
.input-wrap .eye { cursor:pointer; color:var(--muted); padding:0 4px; }
.form-link { text-align:center; font-size:13px; color:var(--muted); margin-top:14px; }
.form-link a { color:var(--primary-dark); font-weight:700; }
.alert { padding:12px 14px; border-radius:10px; font-size:13px; margin-bottom:14px; font-weight:600; }
.alert-error { background:#ffebee; color:#c62828; }
.alert-success { background:#e8f5e9; color:#2e7d32; }
.alert-info { background:#e3f2fd; color:#1565c0; }

/* Rewards page */
.reward-hero { text-align:center; padding:20px 0 10px; color:#fff; position:relative; z-index:1; }
.reward-hero .gift-icon { width:70px; height:70px; border-radius:20px; background:linear-gradient(135deg,#ffb74d,#f59000); display:flex; align-items:center; justify-content:center; margin:0 auto 12px; box-shadow:0 8px 20px rgba(245,144,0,.4); }
.reward-hero h2 { font-size:22px; font-weight:800; }
.reward-hero p { font-size:13px; opacity:.85; margin-top:4px; }
.reward-item { display:flex; align-items:center; gap:14px; background:#fff; border-radius:16px; padding:16px; margin-bottom:12px; box-shadow:0 4px 14px rgba(43,127,209,.08); cursor:pointer; }
.reward-icon { width:52px; height:52px; border-radius:14px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:24px; flex-shrink:0; }
.reward-body { flex:1; }
.reward-body h4 { font-size:15px; font-weight:700; }
.reward-body p { font-size:12px; color:var(--muted); margin-top:2px; }
.reward-body .tag { display:inline-block; background:#e3f2fd; color:#1565c0; font-size:11px; padding:2px 8px; border-radius:10px; margin-top:6px; font-weight:600; }
.reward-arrow { color:#cfd8dc; font-size:20px; }
.salary-box { background:#f5f9fd; border-radius:12px; padding:12px; margin-top:10px; }
.salary-box .label { font-size:12px; color:var(--muted); }
.salary-box .amount { font-size:22px; font-weight:800; color:var(--green); margin:4px 0; }

/* Lucky wheel */
.wheel-wrap { text-align:center; padding:10px 0; }
.wheel-stats { display:flex; gap:10px; margin-bottom:20px; }
.wheel-stat { flex:1; background:rgba(255,255,255,.15); border-radius:12px; padding:10px; color:#fff; }
.wheel-stat .l { font-size:11px; opacity:.85; }
.wheel-stat .v { font-size:18px; font-weight:800; margin-top:2px; }
.wheel-container { position:relative; width:280px; height:280px; margin:0 auto; }
.wheel-pointer { position:absolute; top:-8px; left:50%; transform:translateX(-50%); z-index:5; width:0; height:0; border-left:14px solid transparent; border-right:14px solid transparent; border-top:26px solid #ff5252; filter:drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.wheel-pointer::after { content:''; position:absolute; top:-30px; left:-8px; width:16px; height:16px; background:#fff; border-radius:50%; }
#wheelCanvas { width:280px; height:280px; transition:transform 4s cubic-bezier(.17,.67,.12,.99); }
.wheel-center { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:80px; height:80px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; color:var(--primary-dark); box-shadow:0 4px 12px rgba(0,0,0,.2); cursor:pointer; z-index:4; text-align:center; font-size:13px; line-height:1.2; border:4px solid #ffd54f; }
.wheel-center.disabled { background:#eceff1; color:#90a4ae; cursor:not-allowed; }
.how-to { background:rgba(255,255,255,.1); border-radius:14px; padding:14px; margin-top:20px; color:#fff; text-align:left; }
.how-to h4 { font-size:14px; margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.how-to p { font-size:12px; opacity:.9; line-height:1.6; }
.how-to .stats-row-inline { display:flex; justify-content:space-between; align-items:center; margin-top:12px; font-size:12px; }

/* Profile */
.profile-head { display:flex; align-items:center; gap:14px; position:relative; z-index:1; }
.avatar { width:56px; height:56px; border-radius:50%; background:rgba(255,255,255,.25); display:flex; align-items:center; justify-content:center; font-size:24px; color:#fff; flex-shrink:0; border:2px solid rgba(255,255,255,.5); }
.profile-info { flex:1; color:#fff; }
.profile-info .phone { font-size:18px; font-weight:800; }
.profile-info .ref { font-size:12px; opacity:.9; margin-top:2px; }
.profile-info .code { display:inline-block; background:rgba(255,255,255,.25); padding:2px 8px; border-radius:8px; font-weight:700; margin-left:6px; }
.profile-stats { display:flex; gap:8px; margin:16px 0 0; position:relative; z-index:1; }
.profile-stat { flex:1; background:rgba(255,255,255,.15); border-radius:12px; padding:10px 6px; text-align:center; color:#fff; }
.profile-stat .l { font-size:10px; opacity:.85; }
.profile-stat .v { font-size:14px; font-weight:800; margin-top:2px; }
.quick-actions { display:flex; gap:8px; background:#fff; border-radius:14px; padding:12px; margin-bottom:14px; box-shadow:0 4px 14px rgba(43,127,209,.08); }
.quick-action { flex:1; text-align:center; font-size:11px; color:var(--muted); font-weight:600; cursor:pointer; }
.quick-action .ico { width:36px; height:36px; border-radius:50%; background:#e3f2fd; display:flex; align-items:center; justify-content:center; margin:0 auto 4px; color:var(--primary-dark); font-size:16px; }
.list-menu { background:#fff; border-radius:16px; overflow:hidden; box-shadow:0 4px 14px rgba(43,127,209,.08); margin-bottom:14px; }
.list-item { display:flex; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--border); cursor:pointer; }
.list-item:last-child { border-bottom:none; }
.list-item .ico { width:32px; height:32px; border-radius:10px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:14px; flex-shrink:0; }
.list-item .label { flex:1; font-size:14px; font-weight:600; }
.list-item .arrow { color:#cfd8dc; }

/* Tables / records */
.record-item { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--border); }
.record-item:last-child { border-bottom:none; }
.record-left .t { font-size:14px; font-weight:600; }
.record-left .d { font-size:11px; color:var(--muted); margin-top:2px; }
.record-right { text-align:right; }
.record-right .amt { font-size:15px; font-weight:700; }
.record-right .amt.plus { color:var(--green); }
.record-right .amt.minus { color:var(--red); }
.record-right .st { font-size:11px; margin-top:2px; }
.st-pending { color:#f57c00; }
.st-approved { color:var(--green); }
.st-rejected { color:var(--red); }

/* Team tree */
.team-node { background:#fff; border-radius:12px; padding:12px; margin-bottom:8px; border-left:4px solid var(--primary); }
.team-node .name { font-weight:700; font-size:14px; }
.team-node .meta { font-size:11px; color:var(--muted); margin-top:2px; }
.team-children { margin-left:16px; margin-top:6px; border-left:2px dashed var(--border); padding-left:10px; }

/* Modal */
.modal-overlay { position:fixed; inset:0; background:rgba(10,37,64,.6); z-index:200; display:none; align-items:flex-end; justify-content:center; }
.modal-overlay.show { display:flex; }
.modal { background:#fff; width:100%; max-width:480px; border-radius:20px 20px 0 0; padding:20px; max-height:85vh; overflow-y:auto; animation:slideUp .3s ease; }
@keyframes slideUp { from{transform:translateY(100%);} to{transform:translateY(0);} }
.modal h3 { font-size:18px; margin-bottom:14px; display:flex; justify-content:space-between; align-items:center; }
.modal-close { background:#eceff1; border:none; width:30px; height:30px; border-radius:50%; cursor:pointer; font-size:16px; color:var(--muted); }

/* Toast */
.toast { position:fixed; top:20px; left:50%; transform:translateX(-50%); background:#1a2b45; color:#fff; padding:12px 20px; border-radius:12px; font-size:14px; z-index:300; box-shadow:0 8px 24px rgba(0,0,0,.2); display:none; max-width:90%; text-align:center; }
.toast.show { display:block; animation:fadeIn .3s; }
@keyframes fadeIn { from{opacity:0; transform:translate(-50%,-10px);} to{opacity:1; transform:translate(-50%,0);} }

.empty { text-align:center; padding:40px 20px; color:var(--muted); }
.empty .ico { font-size:48px; margin-bottom:10px; opacity:.4; }

/* Desktop */
@media (min-width:768px) {
  body { max-width:480px; margin:0 auto; box-shadow:0 0 40px rgba(0,0,0,.08); background:#fff; }
  .bottom-nav { max-width:480px; margin:0 auto; left:50%; transform:translateX(-50%); }
}
