/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #fff5f7;
  --bg2:         #ffffff;
  --bg3:         #fce8ee;
  --glass:       rgba(255,255,255,0.7);
  --glass-hover: rgba(255,255,255,0.9);
  --border:      rgba(236,72,153,0.12);
  --border2:     rgba(236,72,153,0.22);
  --accent:      #ec4899;
  --accent2:     #f472b6;
  --accent3:     #db2777;
  --accent-grad: linear-gradient(135deg, #ec4899 0%, #f9a8d4 100%);
  --green:       #10b981;
  --red:         #ef4444;
  --yellow:      #f59e0b;
  --text:        #1e1b4b;
  --text2:       #6b7280;
  --text3:       #9ca3af;
  --radius:      16px;
  --radius-sm:   10px;
  --nav-h:       68px;
  --header-h:    0px;
  --shadow:      0 4px 20px rgba(236,72,153,0.12);
  --shadow-lg:   0 8px 40px rgba(236,72,153,0.2);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.hidden { display: none !important; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 4px; }

/* ── Loading Screen ────────────────────────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; background: var(--bg); z-index: 1000;
}
.loader-logo { position: relative; display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; }
.loader-icon { font-size: 36px; z-index: 1; }
.loader-ring {
  position: absolute; inset: 0;
  border: 2.5px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent2);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { color: var(--text2); font-size: 13px; }

/* ── Auth Page ─────────────────────────────────────────────────────────────── */
.auth-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 32px 24px; min-height: 100vh; gap: 12px;
}
.auth-icon { font-size: 64px; margin-bottom: 8px; }
.auth-container h2 { font-size: 22px; font-weight: 700; }
.auth-container p  { color: var(--text2); line-height: 1.6; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.status-badge.pending { background: rgba(245,158,11,0.1); color: var(--yellow); border: 1px solid rgba(245,158,11,0.3); }
.hint { font-size: 12px; color: var(--text3); margin-top: 6px; }

/* ── App Layout ────────────────────────────────────────────────────────────── */
#app {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

.main-content {
  flex: 1; overflow: hidden; position: relative;
}

.page-section {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + 8px);
}

/* ── Bottom Nav ────────────────────────────────────────────────────────────── */
.bottom-nav {
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--nav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(236,72,153,0.08);
  flex-shrink: 0;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: none; background: none; cursor: pointer;
  padding: 8px 4px; transition: all 0.2s;
  color: var(--text3);
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-label { font-size: 10px; font-weight: 600; }

/* ── HOME PAGE ─────────────────────────────────────────────────────────────── */
.home-header-card {
  background: var(--accent-grad);
  margin: 12px;
  border-radius: 20px;
  padding: 20px;
  color: white;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.home-header-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.home-header-card::after {
  content: '';
  position: absolute;
  bottom: -20px; right: 40px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.home-user-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.home-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.home-user-name { font-weight: 700; font-size: 16px; }
.home-user-label { font-size: 11px; opacity: 0.8; }
.balance-label-top { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.balance-big {
  font-size: 34px; font-weight: 800; letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.balance-row {
  display: flex; gap: 10px; align-items: stretch;
}
.balance-stat-box {
  flex: 1; background: rgba(255,255,255,0.18);
  border-radius: 12px; padding: 10px 12px;
  backdrop-filter: blur(8px);
}
.balance-stat-label { font-size: 10px; opacity: 0.8; margin-bottom: 2px; }
.balance-stat-value { font-size: 14px; font-weight: 700; }

/* ── Quick Action Buttons ─────────────────────────────────────────────────── */
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 0 12px 12px;
}
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 6px; cursor: pointer;
  transition: all 0.2s; box-shadow: var(--shadow);
}
.quick-btn:active { transform: scale(0.95); }
.quick-btn-icon { font-size: 22px; }
.quick-btn-label { font-size: 10px; font-weight: 600; color: var(--text2); text-align: center; line-height: 1.3; }

/* ── Create VA Card (Home) ────────────────────────────────────────────────── */
.home-section {
  margin: 0 12px 12px;
  background: var(--bg2);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.home-section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
}
.home-section-sub { font-size: 12px; color: var(--text2); margin-bottom: 14px; }

/* Bulk VA textarea */
.bulk-va-wrap {
  display: flex; gap: 10px; align-items: flex-start;
}
.bulk-va-textarea {
  flex: 1; border: 1.5px solid var(--border2);
  border-radius: 12px; padding: 12px;
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 13.5px;
  resize: none; min-height: 90px; max-height: 150px;
  outline: none; transition: border 0.2s;
  line-height: 1.6;
}
.bulk-va-textarea:focus { border-color: var(--accent); }
.bulk-va-textarea::placeholder { color: var(--text3); }
.bulk-va-count {
  position: absolute; bottom: 10px; right: 12px;
  font-size: 11px; color: var(--text3);
}
.bulk-va-wrap-inner { position: relative; flex: 1; }
.btn-bulk-create {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent-grad); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0; margin-top: 4px;
  color: white;
}
.btn-bulk-create:active { transform: scale(0.92); }
.btn-bulk-create:disabled { opacity: 0.5; cursor: not-allowed; }

/* VA Batch results */
.batch-results {
  margin-top: 12px;
  background: var(--bg3); border-radius: 12px;
  padding: 12px; border: 1px solid var(--border2);
}
.batch-results-title { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.batch-result-item {
  font-size: 12px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.batch-result-item:last-child { border-bottom: none; }
.batch-result-item.ok { color: var(--text); }
.batch-result-item.pending { color: var(--yellow); }
.batch-result-item.err { color: var(--red); }
.btn-copy-all {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 10px;
  background: var(--accent); color: white;
  border: none; border-radius: 10px; padding: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-copy-all:active { opacity: 0.8; }

/* ── Recent Transactions ──────────────────────────────────────────────────── */
.recent-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 12px 8px;
}
.recent-title { font-size: 14px; font-weight: 700; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }

/* ── TX Items ─────────────────────────────────────────────────────────────── */
.tx-list { margin: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border-radius: 14px;
  padding: 12px 14px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.tx-icon { font-size: 28px; flex-shrink: 0; }
.tx-body { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.tx-amount { font-weight: 700; font-size: 14px; text-align: right; white-space: nowrap; }
.tx-amount.income { color: var(--green); }
.tx-amount.withdraw { color: var(--red); }
.tx-status { font-size: 10px; text-align: right; margin-top: 2px; }
.tx-status.pending   { color: var(--yellow); }
.tx-status.approved  { color: var(--green); }
.tx-status.credited  { color: var(--green); }
.tx-status.cancelled { color: var(--red); }

/* ── Page Header (for non-home pages) ────────────────────────────────────── */
.page-header {
  padding: 16px 16px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.page-title { font-size: 18px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── Filter Tabs ────────────────────────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; }
.filter-tab {
  flex-shrink: 0; padding: 6px 16px;
  border-radius: 20px; border: 1.5px solid var(--border2);
  background: var(--bg2); color: var(--text2);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.cards-list { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.card-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.card-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-item-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.card-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.card-badge.active  { background: rgba(16,185,129,0.12); color: var(--green); }
.card-badge.pending { background: rgba(245,158,11,0.12); color: var(--yellow); }
.card-detail { display: flex; flex-direction: column; gap: 6px; color: var(--text2); font-size: 13px; }
.card-detail b { color: var(--text); }
.card-detail code { font-family: monospace; font-size: 12px; color: var(--accent); background: var(--bg3); padding: 2px 6px; border-radius: 6px; }
.card-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 12px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.18s; white-space: nowrap;
}
.btn-primary { background: var(--accent-grad); color: white; box-shadow: 0 4px 14px rgba(236,72,153,0.35); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.w-full { width: 100%; }
.mt-4 { margin-top: 16px; }
.btn-icon { width: 36px; height: 36px; border-radius: 10px; border: none; background: var(--bg3); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.btn-copy { background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; color: var(--accent); transition: all 0.15s; flex-shrink: 0; }
.btn-copy:active { background: var(--accent); color: white; }

/* ── Input ──────────────────────────────────────────────────────────────────── */
.input, .select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border2); background: var(--bg);
  color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: border 0.2s;
}
.input:focus, .select:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text3); }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 13px; font-weight: 600; color: var(--text2); }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.modal.hidden { display: none !important; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-box {
  position: relative; width: 100%; z-index: 1;
  background: var(--bg2); border-radius: 24px 24px 0 0;
  padding: 24px 20px; display: flex; flex-direction: column; gap: 14px;
  max-height: 85vh; overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-box h3 { font-size: 17px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
.error-text { color: var(--red); font-size: 12px; margin-top: -8px; }

/* ── Withdraw Page ──────────────────────────────────────────────────────────── */
.withdraw-balance-box {
  margin: 12px; background: var(--accent-grad);
  border-radius: 16px; padding: 20px; color: white;
  box-shadow: var(--shadow-lg);
}
.withdraw-balance-label { font-size: 12px; opacity: 0.85; margin-bottom: 6px; }
.withdraw-balance-amount { font-size: 28px; font-weight: 800; }
.withdraw-form { margin: 0 12px; display: flex; flex-direction: column; gap: 14px; }
.fee-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); }
.fee-value { font-weight: 600; color: var(--red); }
.net-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
.pending-notice {
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 12px; padding: 12px; font-size: 13px; color: var(--yellow);
}

/* ── History page ─────────────────────────────────────────────────────────── */
.history-container { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.pagination { display: flex; justify-content: center; gap: 6px; padding: 12px; }
.page-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border2); background: var(--bg2); color: var(--text2); font-size: 13px; font-weight: 600; cursor: pointer; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty & Skeleton ────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; gap: 10px; }
.empty-icon { font-size: 48px; }
.empty-text { color: var(--text3); font-size: 13px; text-align: center; }
.skeleton-list { display: flex; flex-direction: column; gap: 10px; }
.skeleton-item { background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 14px; height: 72px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
  z-index: 500; white-space: nowrap; max-width: 85vw; overflow: hidden;
  text-overflow: ellipsis; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ── Progress bar for batch ──────────────────────────────────────────────── */
.batch-progress {
  height: 4px; border-radius: 4px; background: var(--border2);
  overflow: hidden; margin-top: 8px;
}
.batch-progress-bar {
  height: 100%; background: var(--accent-grad);
  transition: width 0.4s ease; border-radius: 4px;
}