:root {
  --bg-deep: #14100A;
  --bg-secondary: #1C160C;
  --card: #201908;
  --card-elevated: #2A2110;
  --border: #4A3A18;
  --text-primary: #FFFFFF;
  --text-secondary: #C9BC97;
  --green: #22E27A;
  --green-deep: #16A34A;
  --gold: #F2B705;
  --gold-soft: #FFD873;
  --coral: #FF5470;
  --radius: 16px;
}

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

html, body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body { display: flex; justify-content: center; min-height: 100vh; }

.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(120% 60% at 50% 0%, #241A08 0%, var(--bg-deep) 55%);
}

.auth-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 24px;
}

header { padding: 20px 20px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand-mark { display: flex; align-items: center; gap: 8px; }
.brand-mark .logo-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--gold)); box-shadow: 0 0 12px rgba(34,226,122,0.6); }
.brand-mark span { font-weight: 800; font-size: 16px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--card-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--gold); }

main { flex: 1; overflow-y: auto; padding: 4px 20px 100px; }

h1.screen-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; color: var(--green); }
.screen-sub { color: var(--text-secondary); font-size: 13px; font-weight: 500; margin-bottom: 20px; }
.gradient-text { background: linear-gradient(135deg, var(--green), var(--gold-soft)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.glow { box-shadow: 0 0 0 1px rgba(34,226,122,0.08), 0 8px 24px -8px rgba(34,226,122,0.2); }

.hero-balance { background: linear-gradient(160deg, #241A08 0%, #1A1306 100%); border: 1px solid var(--border); border-radius: 20px; padding: 22px; margin-bottom: 16px; }
.hero-balance .label { color: var(--text-secondary); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.hero-balance .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.hero-balance .amount small { font-size: 16px; font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill.green { background: rgba(34,226,122,0.12); color: var(--green); }
.pill.gold { background: rgba(242,183,5,0.14); color: var(--gold); }

.barrel-card { display: flex; flex-direction: column; gap: 10px; padding: 0; overflow: hidden; }
.barrel-image { height: 120px; width: 100%; background: radial-gradient(60% 100% at 30% 20%, rgba(242,183,5,0.25), transparent 60%), linear-gradient(160deg, #2A2110 0%, #1A1306 100%); display: flex; align-items: center; justify-content: center; font-size: 40px; border-bottom: 1px solid var(--border); }
.barrel-body { padding: 16px 18px 18px; }
.barrel-top { display: flex; justify-content: space-between; align-items: flex-start; }
.barrel-name { font-size: 15px; font-weight: 700; }
.barrel-meta { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

.progress-track { height: 7px; background: var(--card-elevated); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green-deep), var(--green)); }
.progress-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); font-weight: 600; margin-top: 6px; }

.barrel-figures { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--border); }
.fig .fig-label { font-size: 10px; color: var(--text-secondary); font-weight: 600; }
.fig .fig-value { font-size: 14px; font-weight: 700; margin-top: 2px; }
.fig .fig-value.up { color: var(--green); }

.btn { display: block; width: 100%; text-align: center; padding: 15px; border-radius: 14px; font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 14px; border: none; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, var(--green-deep), var(--green)); color: #0A1006; }
.btn-secondary { background: var(--card-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-row { display: flex; gap: 10px; margin-bottom: 18px; }
.btn-row .btn { flex: 1; }

.section-label { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 22px 0 10px; }

.row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row-left { display: flex; align-items: center; gap: 12px; }
.row-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--card-elevated); flex-shrink: 0; }
.row-title { font-size: 14px; font-weight: 700; }
.row-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.row-amount { font-size: 14px; font-weight: 700; }
.row-amount.credit { color: var(--green); }
.row-amount.debit { color: var(--text-primary); }

label.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
input, select { width: 100%; background: var(--card-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: var(--text-primary); font-family: 'Manrope', sans-serif; font-size: 15px; font-weight: 600; margin-bottom: 16px; }
input:focus, select:focus { outline: none; border-color: var(--green); }

.fee-note { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); padding: 10px 0; border-top: 1px dashed var(--border); margin-top: 4px; }
.fee-note strong { color: var(--text-primary); }

.rank-badge { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, rgba(34,226,122,0.16), rgba(242,183,5,0.18)); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.rank-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-row.locked { opacity: 0.45; }
.rank-row-name { font-size: 13px; font-weight: 700; }
.rank-row-req { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }
.rank-row-value { font-size: 13px; font-weight: 700; color: var(--gold); }

.tgv-wrap { margin: 16px 0 22px; }
.tgv-labels { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.tgv-labels .to-next { color: var(--gold); }
.tgv-track { position: relative; height: 34px; background: var(--card-elevated); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.tgv-rail { position: absolute; top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 6px, transparent 6px 14px); background-size: 200% 100%; animation: railMove 1.1s linear infinite; }
@keyframes railMove { from { background-position: 0 0; } to { background-position: -28px 0; } }
.tgv-fill { position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, var(--green-deep), var(--green)); border-radius: 999px; transition: width 0.8s ease; }
.tgv-train { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 20px; left: 0%; animation: chug 0.5s ease-in-out infinite alternate; filter: drop-shadow(0 0 6px rgba(34,226,122,0.8)); transition: left 0.8s ease; }
@keyframes chug { from { transform: translate(-50%, -50%) rotate(-3deg) translateX(-1px); } to { transform: translate(-50%, -50%) rotate(3deg) translateX(1px); } }
.tgv-trail { position: absolute; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; }
.tgv-trail span { width: 8px; height: 2px; border-radius: 2px; background: var(--gold-soft); animation: trailFade 0.7s infinite; }
.tgv-trail span:nth-child(1) { animation-delay: 0s; }
.tgv-trail span:nth-child(2) { animation-delay: 0.12s; }
.tgv-trail span:nth-child(3) { animation-delay: 0.24s; }
@keyframes trailFade { 0% { opacity: 0.85; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(0.3) translateX(-6px); } }

.referral-box { background: var(--card-elevated); border: 1px dashed var(--border); border-radius: 14px; padding: 14px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.referral-code { font-weight: 800; font-size: 15px; letter-spacing: 0.03em; }
.copy-btn { background: var(--green); color: #0A1006; border: none; border-radius: 8px; padding: 8px 12px; font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 12px; cursor: pointer; }

.tree-wrap { display: flex; justify-content: center; gap: 32px; margin: 14px 0 6px; }
.tree-side { text-align: center; flex: 1; }
.tree-side .tree-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; margin-bottom: 6px; }
.tree-side .tree-value { font-size: 20px; font-weight: 800; }
.tree-side .tree-points { font-size: 11px; color: var(--green); font-weight: 700; margin-top: 2px; }

.locked-banner { background: rgba(242,183,5,0.08); border: 1px solid rgba(242,183,5,0.25); border-radius: 12px; padding: 12px 14px; font-size: 12px; color: var(--gold); font-weight: 600; margin-bottom: 16px; line-height: 1.5; }

.alert-error { background: rgba(255,84,112,0.1); border: 1px solid rgba(255,84,112,0.3); color: var(--coral); padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alert-success { background: rgba(34,226,122,0.1); border: 1px solid rgba(34,226,122,0.3); color: var(--green); padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }

nav.bottom-nav { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(20,16,10,0.92); backdrop-filter: blur(12px); border-top: 1px solid var(--border); display: flex; padding: 10px 6px calc(10px + env(safe-area-inset-bottom)); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--text-secondary); font-family: 'Manrope', sans-serif; font-size: 10px; font-weight: 700; padding: 6px 2px; }
.nav-item span { font-size: 10px; }
.nav-item.active { color: var(--green); }

/* Admin panel */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 30px 24px 60px; }
table.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.admin-table th, table.admin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
table.admin-table th { color: var(--text-secondary); font-weight: 700; background: var(--card-elevated); }
table.admin-table img.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.admin-actions a { color: var(--gold); font-weight: 700; font-size: 12px; text-decoration: none; margin-right: 10px; }
.admin-actions a.danger { color: var(--coral); }

/* ---------- Admin shell (sidebar layout) ---------- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.admin-sidebar .brand-mark { padding: 0 20px 20px; }

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border-left: 3px solid transparent;
}

.admin-nav-link.active {
  color: var(--green);
  background: rgba(34,226,122,0.06);
  border-left-color: var(--green);
}

.admin-nav-link.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.admin-nav-section {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 16px 20px 6px;
  opacity: 0.6;
}

.admin-content { flex: 1; padding: 30px 34px 60px; max-width: 1100px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 30px; }
.stat-card .stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; }

.badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.pending { background: rgba(255,200,87,0.14); color: var(--gold-soft); }
.badge.confirmed, .badge.completed, .badge.active { background: rgba(34,226,122,0.14); color: var(--green); }
.badge.rejected, .badge.cancelled, .badge.suspended { background: rgba(255,84,112,0.14); color: var(--coral); }
.badge.processing { background: rgba(75,124,255,0.14); color: #7FA6FF; }

.inline-form { display: inline; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.icon-btn.approve { color: var(--green); }
.icon-btn.reject { color: var(--coral); }
