/* ============================================================
   MEHNAT — User App Styles v3.0
   Dark theme, Telegram Mini App optimized
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
  --bg:        #0a101e;
  --bg2:       #0f172a;
  --card:      #111827;
  --card2:     #1a2438;
  --border:    #1e2d3d;
  --border2:   #243447;
  --accent:    #4ade80;
  --accent2:   #22c55e;
  --blue:      #60a5fa;
  --orange:    #f97316;
  --purple:    #a855f7;
  --gold:      #fbbf24;
  --red:       #ef4444;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #475569;
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-h:  60px;
  --tabbar-h:  64px;
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; }

/* --- Splash ----------------------------------------------- */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 32px;
  transition: opacity .4s, transform .4s;
}
#splash.hidden { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash-logo { text-align: center; }
.splash-icon { font-size: 4rem; margin-bottom: 12px;
  animation: splashPulse 1.4s ease-in-out infinite alternate; }
.splash-name { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.splash-bar { width: 140px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.splash-progress {
  height: 100%; width: 0; background: var(--accent); border-radius: 2px;
  animation: splashLoad 1.5s ease-in-out forwards;
}
@keyframes splashPulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes splashLoad { 0%{width:0} 60%{width:70%} 100%{width:100%} }

/* --- No-Telegram screen ----------------------------------- */
#no-tg {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.no-tg-inner { text-align: center; max-width: 320px; }
.no-tg-inner h2 { font-size: 1.3rem; margin: 16px 0 8px; }
.no-tg-inner p { color: var(--text2); margin-bottom: 24px; }

/* --- App layout ------------------------------------------ */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* --- Topbar ---------------------------------------------- */
#topbar {
  flex-shrink: 0;
  height: var(--topbar-h);
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 10;
}
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card2);
  overflow: hidden; flex-shrink: 0;
  position: relative; display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--accent);
}
.topbar-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.topbar-center { flex: 1; min-width: 0; }
.topbar-center > span:first-child {
  display: block; font-size: .95rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.level-badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #0a101e; padding: 1px 7px; border-radius: 20px; margin-top: 2px;
}
.topbar-right { display: flex; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: background .2s, color .2s;
  position: relative;
}
.icon-btn:hover, .icon-btn:active { background: var(--card2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 700; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* --- Screen ---------------------------------------------- */
#screen {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 0 calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
#screen::-webkit-scrollbar { display: none; }

/* --- Tabbar ---------------------------------------------- */
#tabbar {
  flex-shrink: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  position: relative; z-index: 10;
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text3); transition: color .2s;
  font-size: .65rem; font-weight: 500;
  padding: 6px 0;
}
.tab svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tab.active { color: var(--accent); }
.tab.active svg { stroke-width: 2.2; }

/* --- Section Header -------------------------------------- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.section-title { font-size: 1rem; font-weight: 700; }
.section-action { font-size: .82rem; color: var(--accent); }

/* --- Cards ----------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin: 0 16px 12px;
}

/* --- Balance Hero ---------------------------------------- */
.balance-hero {
  background: linear-gradient(135deg, #0d2218 0%, #0a1628 60%, #0d1a2e 100%);
  border: 1px solid rgba(74,222,128,.18);
  border-radius: var(--radius); padding: 20px;
  margin: 12px 16px;
  position: relative; overflow: hidden;
}
.balance-hero::before {
  content: ''; position: absolute;
  top: -50px; right: -50px; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(74,222,128,.12) 0%, transparent 70%);
  pointer-events: none;
}
.balance-hero::after {
  content: ''; position: absolute;
  bottom: -30px; left: -30px; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(96,165,250,.06) 0%, transparent 70%);
  pointer-events: none;
}
.balance-label { font-size: .72rem; color: rgba(255,255,255,.5); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .1em; }
.balance-amount {
  font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em;
  /* Gradient text with solid fallback for old WebViews */
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Fallback: if background-clip unsupported, color shows */
}
.balance-pts { font-size: .88rem; color: rgba(255,255,255,.55); margin-top: 6px; }
.balance-pts strong { color: var(--gold); font-weight: 700; }
.balance-row { display: flex; gap: 10px; margin-top: 14px; }
.balance-stat {
  flex: 1; background: rgba(255,255,255,.055);
  border-radius: 10px; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.06);
}
.balance-stat-label { font-size: .68rem; color: rgba(255,255,255,.45); margin-bottom: 3px; }
.balance-stat-value { font-size: .92rem; font-weight: 700; color: var(--text); }

/* --- Greeting -------------------------------------------- */
.greeting { padding: 16px 16px 8px; }
.greeting-text { font-size: 1.1rem; font-weight: 700; }
.greeting-sub { font-size: .85rem; color: var(--text2); margin-top: 3px; }

/* --- Streak Card ----------------------------------------- */
.streak-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin: 10px 16px 12px;
}
.streak-fire { font-size: 1.8rem; }
.streak-info { flex: 1; }
.streak-days { font-size: 1.1rem; font-weight: 700; }
.streak-label { font-size: .78rem; color: var(--text2); }
.checkin-btn {
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--accent); color: #0a101e;
  font-weight: 700; font-size: .85rem; transition: opacity .2s;
  white-space: nowrap;
}
.checkin-btn:hover { opacity: .85; }
.checkin-btn:disabled { background: var(--border); color: var(--text3); }
.checked-in-tag { font-size: .8rem; color: var(--accent); font-weight: 600; }

/* --- Task Row -------------------------------------------- */
.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.task-row:last-child { border-bottom: none; }
.task-row:active { background: var(--card2); }
.task-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-sub { font-size: .77rem; color: var(--text2); margin-top: 2px; }
.task-reward { text-align: right; flex-shrink: 0; }
.task-pts { font-size: .9rem; font-weight: 700; color: var(--gold); }
.task-money { font-size: .75rem; color: var(--accent); }
.task-state-badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: .7rem; font-weight: 600;
}
.state-ready    { background: rgba(74,222,128,.15); color: var(--accent); }
.state-done     { background: rgba(74,222,128,.1);  color: var(--accent2); }
.state-pending  { background: rgba(251,191,36,.12); color: var(--gold); }
.state-cooldown { background: rgba(96,165,250,.12); color: var(--blue); }
.state-limit    { background: rgba(71,85,105,.3);   color: var(--text3); }
.state-read     { background: rgba(168,85,247,.12); color: var(--purple); }
.state-timer    { background: rgba(249,115,22,.12); color: var(--orange); }
.state-open     { background: rgba(96,165,250,.15); color: var(--blue); }

/* --- Filter Chips ---------------------------------------- */
.chip-bar { display: flex; gap: 8px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.chip-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px;
  font-size: .8rem; font-weight: 600; border: 1.5px solid var(--border);
  color: var(--text2); background: var(--card); transition: all .2s; white-space: nowrap;
}
.chip.active { border-color: var(--accent); color: var(--accent); background: rgba(74,222,128,.08); }

/* --- Tariff Grid ----------------------------------------- */
.tariff-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 4px 16px 12px;
}
.tariff-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: border-color .2s, transform .15s;
  position: relative; overflow: hidden;
}
.tariff-card:active { transform: scale(.97); }
/* Disabled state — shown when user already has an active tariff */
.tariff-card.disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}
.tariff-card.disabled::after {
  content: '🔒'; position: absolute; top: 8px; right: 8px;
  font-size: .85rem;
}
.tariff-icon { font-size: 1.6rem; }
.tariff-name { font-size: .85rem; font-weight: 700; }
.tariff-pts { font-size: .75rem; color: var(--text2); }
.tariff-income {
  font-size: .95rem; font-weight: 800;
  margin-top: 4px;
}
.tariff-dur { font-size: .72rem; color: var(--text3); }
.tariff-card .corner-tag {
  position: absolute; top: 8px; right: 8px;
  font-size: .65rem; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; background: rgba(255,255,255,.07);
}

/* --- Active Tariff --------------------------------------- */
.active-tariff {
  background: linear-gradient(135deg, #0f1f2e, #0a1628);
  border: 1.5px solid var(--blue);
  border-radius: var(--radius); padding: 16px;
  margin: 0 16px 12px;
}
.at-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.at-icon { font-size: 1.5rem; }
.at-name { font-size: 1rem; font-weight: 700; }
.at-badge { font-size: .72rem; color: var(--blue); background: rgba(96,165,250,.12); padding: 2px 8px; border-radius: 10px; }
.at-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.at-progress-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width .6s ease; }
.at-row { display: flex; justify-content: space-between; font-size: .83rem; }
.at-row span:last-child { font-weight: 600; }

/* --- Invest Plans ---------------------------------------- */
.plan-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin: 0 16px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .2s;
}
.plan-card:active { background: var(--card2); }
.plan-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.plan-body { flex: 1; min-width: 0; }
.plan-name { font-size: .95rem; font-weight: 700; }
.plan-desc { font-size: .78rem; color: var(--text2); margin-top: 2px; }
.plan-badge {
  font-size: .9rem; font-weight: 800; text-align: right;
}
.plan-dur { font-size: .72rem; color: var(--text3); text-align: right; margin-top: 2px; }

/* --- Wallet ---------------------------------------------- */
.wallet-tabs {
  display: flex; gap: 4px; margin: 12px 16px;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 4px;
}
.wallet-tab {
  flex: 1; padding: 8px; border-radius: 8px;
  font-size: .8rem; font-weight: 600; color: var(--text2);
  transition: all .2s; text-align: center;
}
.wallet-tab.active { background: var(--card2); color: var(--text); }

/* --- Transaction Row ------------------------------------- */
.tx-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: .88rem; font-weight: 500; }
.tx-date { font-size: .72rem; color: var(--text2); margin-top: 2px; }
.tx-amount { font-size: .9rem; font-weight: 700; text-align: right; flex-shrink: 0; }
.tx-amount.pos { color: var(--accent); }
.tx-amount.neg { color: var(--red); }

/* --- Withdrawal Row -------------------------------------- */
.wd-row {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.wd-row:last-child { border-bottom: none; }
.wd-body { flex: 1; }
.wd-amount { font-size: .95rem; font-weight: 700; }
.wd-card { font-size: .78rem; color: var(--text2); margin-top: 2px; }
.wd-status {
  font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 10px;
  white-space: nowrap;
}
.status-pending  { background: rgba(251,191,36,.12);  color: var(--gold); }
.status-paid     { background: rgba(74,222,128,.12);  color: var(--accent); }
.status-rejected { background: rgba(239,68,68,.12);   color: var(--red); }
.status-active   { background: rgba(96,165,250,.12);  color: var(--blue); }
.status-finished { background: rgba(74,222,128,.1);   color: var(--accent2); }
.status-cancelled{ background: rgba(71,85,105,.2);    color: var(--text3); }

/* --- Investment Detail ----------------------------------- */
.invest-row {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.invest-row:last-child { border-bottom: none; }
.invest-row:active { background: var(--card2); }
.invest-header { display: flex; justify-content: space-between; align-items: center; }
.invest-plan { font-size: .9rem; font-weight: 600; }
.invest-amount { font-size: .95rem; font-weight: 700; color: var(--accent); }
.invest-prog { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 8px 0 4px; }
.invest-prog-bar { height: 100%; border-radius: 2px; background: var(--blue); transition: width .5s; }
.invest-footer { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text2); }

/* --- Profile --------------------------------------------- */
.profile-header {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 16px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--card2); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: var(--accent);
  border: 3px solid var(--accent);
}
.profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.15rem; font-weight: 700; margin-top: 12px; }
.profile-username { font-size: .83rem; color: var(--text2); margin-top: 3px; }
.profile-level { margin-top: 8px; }

/* --- XP Bar --------------------------------------------- */
.xp-bar-wrap { padding: 0 16px 12px; }
.xp-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text2); margin-bottom: 6px; }
.xp-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.xp-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width .8s ease; }

/* --- Stats Grid ------------------------------------------ */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin: 8px 16px;
}
.stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
}
.stat-val { font-size: 1.1rem; font-weight: 800; }
.stat-lbl { font-size: .68rem; color: var(--text2); margin-top: 3px; }

/* --- Achievements ---------------------------------------- */
.ach-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; padding: 4px 16px 12px;
}
.ach-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; opacity: .4; transition: opacity .3s;
}
.ach-item.unlocked { opacity: 1; }
.ach-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem;
  border: 1.5px solid var(--border);
}
.ach-item.unlocked .ach-icon { border-color: var(--gold); background: rgba(251,191,36,.08); }
.ach-name { font-size: .65rem; color: var(--text2); text-align: center; }

/* --- Mission Row ----------------------------------------- */
.mission-row {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.mission-row:last-child { border-bottom: none; }
.mission-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mission-left { display: flex; align-items: center; gap: 10px; }
.mission-icon { font-size: 1.2rem; }
.mission-name { font-size: .9rem; font-weight: 600; }
.mission-reward { font-size: .78rem; color: var(--gold); }
.mission-prog { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.mission-prog-bar { height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s; }
.mission-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.mission-count { font-size: .75rem; color: var(--text2); }
.claim-btn {
  padding: 6px 14px; border-radius: 8px; font-size: .78rem; font-weight: 700;
  background: var(--accent); color: #0a101e; transition: opacity .2s;
}
.claim-btn:disabled { background: var(--border); color: var(--text3); }

/* --- Referral Card --------------------------------------- */
.ref-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 0 16px 12px;
}
.ref-link {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-top: 10px;
}
.ref-link-text { flex: 1; font-size: .8rem; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn {
  flex-shrink: 0; padding: 6px 12px; border-radius: 8px;
  background: var(--accent); color: #0a101e; font-size: .78rem; font-weight: 700;
}

/* --- Leaderboard ----------------------------------------- */
.board-tabs { display: flex; gap: 8px; padding: 12px 16px 4px; }
.board-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.board-row:last-child { border-bottom: none; }
.board-rank {
  width: 28px; text-align: center; font-size: .85rem;
  font-weight: 800; color: var(--text3); flex-shrink: 0;
}
.board-rank.r1 { color: var(--gold); font-size: 1rem; }
.board-rank.r2 { color: var(--text2); }
.board-rank.r3 { color: var(--orange); }
.board-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--accent);
  overflow: hidden; position: relative; flex-shrink: 0;
}
.board-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.board-name { flex: 1; font-size: .9rem; font-weight: 500; }
.board-xp { font-size: .85rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.board-you { background: rgba(74,222,128,.05); }

/* --- Article Card ---------------------------------------- */
.article-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  cursor: pointer; transition: background .15s;
  display: flex; align-items: flex-start; gap: 12px;
}
.article-card:active { background: var(--card2); }
.article-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.article-card-body { flex: 1; min-width: 0; }
.article-card-title { font-size: .9rem; font-weight: 600; line-height: 1.3; }
.article-card-cat { font-size: .72rem; color: var(--text2); margin-top: 4px; text-transform: capitalize; }
.articles-grid { display: flex; flex-direction: column; gap: 8px; padding: 4px 16px 12px; }

/* --- Article Detail View --------------------------------- */
.article-view { padding: 16px; }
.article-view h1 { font-size: 1.2rem; font-weight: 800; margin-bottom: 12px; }
.article-view p  { color: var(--text2); line-height: 1.65; }
.article-view .claim-row { margin-top: 20px; }

/* --- Support Chat ---------------------------------------- */
.chat-messages {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px; max-height: 320px; overflow-y: auto;
}
.chat-messages::-webkit-scrollbar { display: none; }
.bubble {
  max-width: 80%; padding: 10px 14px;
  border-radius: 14px; font-size: .88rem; line-height: 1.45;
}
.bubble-user { align-self: flex-end; background: rgba(74,222,128,.15); border-bottom-right-radius: 4px; }
.bubble-admin { align-self: flex-start; background: var(--card2); border-bottom-left-radius: 4px; }
.bubble-time { font-size: .65rem; color: var(--text3); margin-top: 4px; text-align: right; }
.chat-input-row {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 22px; padding: 10px 16px; color: var(--text);
  resize: none; outline: none; font-size: .88rem; max-height: 100px;
  transition: border .2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: #0a101e;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .2s;
}
.chat-send:hover { opacity: .85; }
.chat-send svg { width: 18px; height: 18px; }

/* --- Goal Card ------------------------------------------- */
.goal-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin: 0 16px 12px;
}
.goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.goal-title { font-size: .9rem; font-weight: 700; }
.goal-edit { font-size: .78rem; color: var(--accent); }
.goal-prog { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.goal-prog-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width .6s; }
.goal-amounts { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text2); }

/* --- Sheet ----------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .3s; backdrop-filter: blur(3px);
}
.sheet-backdrop.open { opacity: 1; pointer-events: all; }
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 101;
  background: var(--card); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  transform: translateY(100%); transition: transform .35s cubic-bezier(.32,.72,0,1);
  max-height: 92dvh; display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border2); margin: 10px auto 4px; flex-shrink: 0;
}
#sheet-body { overflow-y: auto; padding-bottom: calc(16px + var(--safe-bottom)); flex: 1; }
#sheet-body::-webkit-scrollbar { display: none; }

/* Sheet content helpers */
.sheet-header { padding: 8px 16px 16px; }
.sheet-title { font-size: 1.1rem; font-weight: 800; }
.sheet-sub { font-size: .85rem; color: var(--text2); margin-top: 4px; }

/* --- Forms in sheet -------------------------------------- */
.form-group { margin: 0 16px 14px; }
.form-label { font-size: .78rem; color: var(--text2); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: .04em; }
.form-input {
  width: 100%; background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); padding: 12px 14px;
  font-size: .95rem; outline: none; transition: border .2s;
}
.form-input:focus { border-color: var(--accent); }
.form-note { font-size: .78rem; color: var(--text2); margin-top: 6px; }
.form-error { font-size: .8rem; color: var(--red); margin-top: 6px; }

/* --- Buttons --------------------------------------------- */
.btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: calc(100% - 32px); margin: 8px 16px; padding: 14px;
  background: var(--accent); color: #0a101e;
  border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
  transition: opacity .2s; gap: 8px;
}
.btn-primary:hover { opacity: .87; }
.btn-primary:disabled { background: var(--border); color: var(--text3); }
.btn-outline {
  display: flex; align-items: center; justify-content: center;
  width: calc(100% - 32px); margin: 4px 16px; padding: 13px;
  border: 1.5px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); font-size: .92rem; font-weight: 600;
  transition: border-color .2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* --- Card row (fee calc, etc.) --------------------------- */
.calc-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 16px 12px;
}
.calc-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 3px 0; }
.calc-row.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; font-weight: 700; }

/* --- Podium ---------------------------------------------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; padding: 8px 16px 0; }
.podium-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium-item:nth-child(1) { order: 2; }
.podium-item:nth-child(2) { order: 1; }
.podium-item:nth-child(3) { order: 3; }
.podium-avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--accent);
  overflow: hidden; position: relative;
  border: 2px solid var(--border);
}
.podium-item:nth-child(1) .podium-avatar { width: 52px; height: 52px; border-color: var(--gold); }
.podium-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.podium-name { font-size: .7rem; font-weight: 600; max-width: 70px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-xp { font-size: .68rem; color: var(--text2); }
.podium-base {
  width: 70px; border-radius: 6px 6px 0 0; display: flex; align-items: center;
  justify-content: center; font-size: .9rem; font-weight: 800;
  color: var(--bg);
}
.podium-item:nth-child(1) .podium-base { height: 52px; background: var(--gold); }
.podium-item:nth-child(2) .podium-base { height: 38px; background: var(--text2); }
.podium-item:nth-child(3) .podium-base { height: 30px; background: var(--orange); }

/* --- Menu rows (profile) --------------------------------- */
.menu-section { padding: 0 16px 12px; }
.menu-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: color .15s;
}
.menu-row:last-child { border-bottom: none; }
.menu-icon { font-size: 1.2rem; width: 28px; text-align: center; }
.menu-label { flex: 1; font-size: .92rem; }
.menu-arrow { color: var(--text3); }
.menu-arrow svg { width: 16px; height: 16px; }

/* --- Subscription overlay -------------------------------- */
.sub-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(5,10,20,.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(8px);
  animation: subOverlayIn .35s ease;
}
.sub-overlay-hide { animation: subOverlayOut .35s ease forwards; }
@keyframes subOverlayIn  { from { opacity:0; transform:scale(1.04); } to { opacity:1; transform:scale(1); } }
@keyframes subOverlayOut { to   { opacity:0; transform:scale(.97); } }

.sub-overlay-box {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center;
  gap: 0;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.sub-overlay-icon { font-size: 3.2rem; margin-bottom: 14px; }
.sub-overlay-box h2 { font-size: 1.15rem; font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--text); }
.sub-overlay-box p  { font-size: .85rem; color: var(--text2); text-align: center; margin-bottom: 20px; line-height: 1.55; }

/* Sub overlay buttons — standalone, not reusing .btn-primary which needs DOM context */
.sub-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 20px;
  border-radius: var(--radius-sm); border: none;
  font-size: .9rem; font-weight: 700; cursor: pointer;
  transition: opacity .2s, transform .1s;
  font-family: inherit;
}
.sub-btn:active { transform: scale(.97); }
.sub-btn:disabled { opacity: .5; cursor: not-allowed; }
.sub-btn-primary {
  background: var(--accent); color: #0a101e;
  margin-bottom: 10px;
}
.sub-btn-primary:hover { opacity: .88; }
.sub-btn-outline {
  background: transparent;
  border: 1.5px solid var(--border2) !important;
  color: var(--text2);
}
.sub-btn-outline:hover { border-color: var(--accent) !important; color: var(--accent); }

/* --- Toast ----------------------------------------------- */
.toast {
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 12px 16px;
  font-size: .88rem; box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: toastIn .3s ease, toastOut .3s ease 2.9s forwards;
  pointer-events: none; max-width: 320px;
}
.toast.success { border-color: var(--accent); }
.toast.error   { border-color: var(--red); }
#toasts {
  position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  left: 50%; transform: translateX(-50%);
  z-index: 9500; display: flex; flex-direction: column-reverse;
  gap: 8px; align-items: center; pointer-events: none;
}
@keyframes toastIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(10px); } }

/* --- FX (confetti / fly) --------------------------------- */
#fx { position: fixed; inset: 0; z-index: 9100; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -10px; width: 8px; height: 12px;
  border-radius: 2px; animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
.fly-reward {
  position: fixed; font-size: 1.1rem; font-weight: 800; color: var(--gold);
  pointer-events: none; z-index: 9200; white-space: nowrap;
  animation: flyUp .9s ease forwards;
}
@keyframes flyUp {
  0%   { opacity:1; transform:translateY(0) scale(1); }
  60%  { opacity:1; transform:translateY(-60px) scale(1.15); }
  100% { opacity:0; transform:translateY(-120px) scale(.8); }
}

/* --- Skeleton loader ------------------------------------- */
.skel {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes skelShimmer { to { background-position: -200% 0; } }

/* --- Team ------------------------------------------------ */
.team-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.team-member-row:last-child { border-bottom: none; }
.team-role-badge {
  font-size: .65rem; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; background: rgba(74,222,128,.12); color: var(--accent);
}

/* --- Utility --------------------------------------------- */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text2);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .88rem; }
.divider { height: 1px; background: var(--border); margin: 4px 16px; }
.section-pad { padding: 0 16px; }
.text-center { text-align: center; }
.mt4 { margin-top: 4px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.text-accent { color: var(--accent); }
.text-gold   { color: var(--gold); }
.text-blue   { color: var(--blue); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text2); }
.font-bold   { font-weight: 700; }
.font-xl     { font-size: 1.1rem; }

/* --- Greeting (spacing fix) — merged into base definition above */

/* --- Card bottom spacing fix ----------------------------- */
.card + .section-header { margin-top: 4px; }

/* --- Balance hero responsive ----------------------------- */
@media (max-width: 360px) {
  .balance-amount { font-size: 1.6rem; }
  .balance-row { flex-direction: column; gap: 6px; }
  .balance-stat { padding: 8px 10px; }
}

/* --- Podium responsive ----------------------------------- */
@media (max-width: 360px) {
  .podium-base { width: 56px; }
  .podium-avatar { width: 38px; height: 38px; }
  .podium-item:nth-child(1) .podium-avatar { width: 46px; height: 46px; }
}

/* --- FX/fly-reward z-index — merged into base definitions above */

/* --- Menu row active state ------------------------------- */
.menu-row:active { background: var(--card2); border-radius: 8px; }

/* --- Profile header spacing ------------------------------ */
.profile-header { padding: 20px 16px 12px; }

/* --- Wallet tabs ----------------------------------------- */
.wallet-tabs { margin: 8px 16px 0; }

/* --- Screen top padding for wallet ----------------------- */
.balance-hero[style*="margin-top"] { margin-top: 12px !important; }

/* --- Checkin button active state ------------------------- */
.checkin-btn:active { opacity: .75; transform: scale(.96); }

/* --- Sheet handle larger tap area ----------------------- */
.sheet-handle { margin: 12px auto 0; padding: 6px 0; }

/* --- Notif badge above sub-overlay ---------------------- */
#toasts { z-index: 9500; }

/* --- Back to top button (screen scroll) ----------------- */
#screen { scroll-padding-top: 8px; }

/* --- FAQ item styling (JS accordion) -------------------- */
.faq-item { transition: background .15s; }
.faq-item:last-child { border-bottom: none !important; }
.faq-q:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }

/* --- Topbar z-index above content ----------------------- */
#topbar { z-index: 20; }
#tabbar { z-index: 20; }

/* --- Responsive: very small phones ---------------------- */
@media (max-width: 320px) {
  .tariff-grid { grid-template-columns: 1fr; }
  .ach-grid { grid-template-columns: repeat(3,1fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}

/* --- Admin menu row (profile da ko'rinadigan maxsus tugma) --- */
.menu-row-admin {
  background: linear-gradient(135deg, rgba(74,222,128,.06), rgba(96,165,250,.04));
  border: 1px solid rgba(74,222,128,.2);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.menu-row-admin:active { background: rgba(74,222,128,.12); }

/* --- Bajarilgan vazifa qatori ----------------------------- */
.task-row-done {
  opacity: .65;
  cursor: default;
}
.task-row-done:active { background: transparent; }
.task-row-done .task-title {
  text-decoration: line-through;
  color: var(--text3);
}
/* Bajarilgan mukofot — kulrang */
.task-reward-done .task-pts  { color: var(--text3); }
.task-reward-done .task-money { color: var(--text3); }
