@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

/* ══════════════════════════════════════════════
   CASHWALLET UI v2 — Fully Responsive
   ══════════════════════════════════════════════ */

:root {
  --brand:     #10b981;
  --brand-dk:  #059669;
  --brand-lt:  #d1fae5;
  --brand-2:   #34d399;
  --accent:    #6366f1;
  --accent-lt: #eef2ff;
  --danger:    #ef4444;
  --warn:      #f59e0b;
  --info:      #3b82f6;
  --purple:    #8b5cf6;

  --white:  #ffffff;
  --bg:     #f8fafc;
  --bg2:    #f1f5f9;
  --border: #e2e8f0;
  --muted:  #94a3b8;
  --body:   #475569;
  --head:   #0f172a;

  --card:    #ffffff;
  --sidebar: #0f172a;
  --sb-lt:   #1e293b;

  --sh-sm:  0 1px 4px rgba(0,0,0,.06);
  --sh:     0 4px 16px rgba(0,0,0,.08);
  --sh-lg:  0 8px 32px rgba(0,0,0,.12);

  --r:  12px;
  --r2:  8px;
  --r3:  6px;
  --r-full: 999px;

  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --mono: 'Space Mono', monospace;

  --sb-width: 240px;
  --topbar-h: 60px;
  --bottom-nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--body); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

/* ══ LAYOUT ════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* ══ SIDEBAR (desktop) ════════════════════════ */
.sidebar {
  width: var(--sb-width);
  background: var(--sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.sb-logo {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.sb-logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg,var(--brand),var(--brand-2));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.sb-logo-text { font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.sb-logo-sub  { font-size: 10px; color: rgba(255,255,255,.35); letter-spacing: .8px; text-transform: uppercase; }

.sb-user {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-user-wallet { font-family: var(--mono); font-size: 10px; color: var(--brand); letter-spacing: 1px; margin-bottom: 2px; }
.sb-user-name   { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.88); }

.sb-nav { padding: 10px 8px; flex: 1; }
.sb-section { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.2); text-transform: uppercase; letter-spacing: 1.4px; padding: 12px 10px 5px; }

.sb-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r2);
  color: rgba(255,255,255,.5);
  text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all .15s; margin-bottom: 1px;
}
.sb-link:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.88); }
.sb-link.active { background: rgba(16,185,129,.15); color: var(--brand); }
.sb-link .ico { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.sb-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; backdrop-filter: blur(2px); }
.sb-overlay.show { display: block; }

/* ══ MAIN CONTENT ══════════════════════════════ */
.main { flex: 1; margin-left: var(--sb-width); min-height: 100vh; display: flex; flex-direction: column; }

/* ══ TOPBAR ════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  gap: 12px;
}

.topbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.balance-chip {
  background: var(--brand-lt);
  color: var(--brand-dk);
  font-family: var(--mono);
  font-size: 13px; font-weight: 700;
  padding: 5px 13px;
  border-radius: var(--r-full);
  border: 1px solid rgba(16,185,129,.3);
  white-space: nowrap;
}

.menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--head); padding: 4px;
  border-radius: var(--r2); transition: background .15s;
}
.menu-btn:hover { background: var(--bg2); }

/* ══ PAGE ══════════════════════════════════════ */
.page { padding: 20px 24px; flex: 1; }
.page-sm { max-width: 560px; }
.page-md { max-width: 920px; }

.page-header { margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 800; color: var(--head); }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ══ CARDS ═════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sh-sm);
}

.card-head  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--head); }
.card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ══ STAT GRID ═════════════════════════════════ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px;
  box-shadow: var(--sh-sm);
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.stat::after { content:''; position:absolute; bottom:0;left:0;right:0;height:3px; background: var(--bar, var(--brand)); }

.stat-icon { font-size: 22px; margin-bottom: 10px; display: block; }
.stat-val  { font-size: 24px; font-weight: 800; color: var(--head); line-height: 1; font-family: var(--mono); }
.stat-lbl  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; margin-top: 4px; }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ══ BALANCE HERO ══════════════════════════════ */
.bal-hero {
  background: linear-gradient(135deg,#0f172a 0%,#1e293b 100%);
  border-radius: var(--r);
  padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 20px; position: relative; overflow: hidden;
}
.bal-hero::before {
  content: ''; position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(16,185,129,.2), transparent 70%);
  top: -60px; right: 60px; pointer-events: none;
}
.bal-label  { font-size: 10px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; margin-bottom: 5px; }
.bal-amount { font-size: 40px; font-weight: 800; color: #fff; font-family: var(--mono); line-height: 1; }
.bal-wallet { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 7px; font-family: var(--mono); }
.bal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ══ FORMS ═════════════════════════════════════ */
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-group   { margin-bottom: 14px; }
.form-full    { grid-column: 1/-1; }

.label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--body); text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px;
}
.label .req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--r2);
  color: var(--head); padding: 10px 13px;
  font-size: 14px; font-family: var(--font);
  transition: border .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); background: var(--white);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}
.input::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 80px; }
.select { cursor: pointer; }

.input-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
.input-wrap .input { padding-left: 36px; }

.input-hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.input-err  { font-size: 11px; color: var(--danger); margin-top: 5px; }

/* ══ BUTTONS ═══════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r2);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .18s; white-space: nowrap; letter-spacing: .2px;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.25); }
.btn-primary:hover { background: var(--brand-dk); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,185,129,.35); }

.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.2); }
.btn-accent:hover { background: #4f46e5; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-warn { background: var(--warn); color: #fff; }
.btn-warn:hover { background: #d97706; transform: translateY(-1px); }

.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--body); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lt); }

.btn-dark { background: var(--head); color: #fff; }
.btn-dark:hover { background: #1e293b; }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-xl  { padding: 14px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ══ BADGES ════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-amber  { background: #fef3c7; color: #d97706; }
.badge-blue   { background: #dbeafe; color: #2563eb; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-gray   { background: var(--bg2); color: var(--muted); }

/* ══ ALERTS ════════════════════════════════════ */
.alert { padding: 11px 14px; border-radius: var(--r2); font-size: 13px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px; }
.alert-ok   { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-err  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ══ TABLE ═════════════════════════════════════ */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-sm); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.tbl thead tr { background: var(--bg2); border-bottom: 1px solid var(--border); }
.tbl th { padding: 11px 14px; text-align: left; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }
.tbl tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg); }
.tbl td { padding: 11px 14px; color: var(--body); vertical-align: middle; }
.tbl td.bold  { color: var(--head); font-weight: 600; }
.tbl td.mono  { font-family: var(--mono); font-size: 12px; }
.tbl td.green { color: var(--brand-dk); font-weight: 700; }
.tbl td.red   { color: var(--danger); font-weight: 700; }

/* ══ METHOD TABS ═══════════════════════════════ */
.method-tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.m-tab { flex: 1; padding: 13px; border-radius: var(--r); border: 2px solid var(--border); cursor: pointer; text-align: center; font-size: 14px; font-weight: 600; color: var(--body); background: var(--bg); transition: all .18s; }
.m-tab.active { border-color: var(--brand); background: var(--brand-lt); color: var(--brand-dk); }

/* ══ PROFILE ROWS ══════════════════════════════ */
.info-row { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-key { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; min-width: 130px; padding-top: 2px; }
.info-val { font-size: 13px; color: var(--head); font-weight: 500; text-align: right; word-break: break-all; }
.info-val.mono { font-family: var(--mono); font-size: 12px; }

/* ══ PAGINATION ════════════════════════════════ */
.pagination { display: flex; gap: 5px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.pagination a { min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: var(--r2); border: 1.5px solid var(--border); font-size: 13px; font-weight: 600; color: var(--body); text-decoration: none; transition: all .15s; }
.pagination a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination a:hover:not(.active) { border-color: var(--brand); color: var(--brand); }

/* ══ SLIDE PANEL ═══════════════════════════════ */
.panel-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 400; backdrop-filter: blur(2px); }
.panel-overlay.show { display: block; }
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; background: var(--white); z-index: 410; transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1); overflow-y: auto; box-shadow: -8px 0 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.side-panel.open { transform: translateX(0); }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--white); z-index: 1; flex-shrink: 0; }
.panel-title { font-size: 15px; font-weight: 700; color: var(--head); }
.panel-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--muted); padding: 4px; border-radius: var(--r2); transition: all .15s; }
.panel-close:hover { background: var(--bg2); color: var(--danger); }
.panel-body { padding: 20px; flex: 1; }

/* ══ AUTH PAGES ════════════════════════════════ */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-left {
  flex: 1; background: var(--sidebar);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px; position: relative; overflow: hidden;
}
.auth-left::before { content:''; position:absolute; width:350px;height:350px; background:radial-gradient(circle,rgba(16,185,129,.12),transparent 70%); top:-80px;right:-80px; }
.auth-left::after  { content:''; position:absolute; width:250px;height:250px; background:radial-gradient(circle,rgba(99,102,241,.08),transparent 70%); bottom:-60px;left:-60px; }
.auth-inner { position: relative; z-index: 1; text-align: center; max-width: 320px; }
.auth-logo-big { font-size: 64px; display: block; margin-bottom: 14px; }
.auth-brand    { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.auth-tagline  { color: rgba(255,255,255,.45); font-size: 14px; line-height: 1.7; }
.auth-features { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.auth-feature  { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(255,255,255,.05); border-radius: var(--r2); border: 1px solid rgba(255,255,255,.08); font-size: 13px; color: rgba(255,255,255,.65); text-align: left; }

.auth-right { width: 480px; display: flex; align-items: center; justify-content: center; padding: 40px 48px; overflow-y: auto; }
.auth-card  { width: 100%; }
.auth-title { font-size: 22px; font-weight: 800; color: var(--head); margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

.tg-setup-box {
  background: linear-gradient(135deg,rgba(35,158,212,.08),rgba(35,158,212,.04));
  border: 1.5px solid rgba(35,158,212,.2);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
}
.tg-setup-title { font-size: 12px; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
.tg-step { font-size: 12px; color: var(--body); padding: 3px 0; }

/* ══ BOTTOM NAV (mobile only) ══════════════════ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 150;
  height: var(--bottom-nav-h);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.bottom-nav-inner { display: flex; height: 100%; }
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
  transition: color .15s; padding: 6px 4px; cursor: pointer; background: none; border: none; font-family: var(--font);
}
.bn-item.active { color: var(--brand); }
.bn-item .bn-ico { font-size: 20px; line-height: 1; }
.bn-item .bn-lbl { font-size: 10px; }

/* ══ RESPONSIVE ════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sb-width: 220px; }
}

@media (max-width: 768px) {
  /* Sidebar becomes overlay drawer */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }

  /* Show bottom nav */
  .bottom-nav { display: block; }
  .page { padding: 14px 14px calc(var(--bottom-nav-h) + 14px); }

  /* Auth: hide left panel */
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 24px 20px; }

  /* Forms: single column */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }

  /* Stats: 2 cols */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Balance hero */
  .bal-hero { padding: 18px 16px; }
  .bal-amount { font-size: 30px; }

  /* Side panel full width */
  .side-panel { width: 100%; }

  /* Topbar */
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: 15px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .bal-amount { font-size: 26px; }
  .bal-hero { flex-direction: column; align-items: flex-start; }
  .bal-actions { width: 100%; }
  .bal-actions .btn { flex: 1; justify-content: center; }

  .method-tabs { flex-direction: row; }
  .m-tab { font-size: 13px; padding: 11px 8px; }

  .auth-right { padding: 20px 16px; }

  .card { padding: 16px; }
  .tbl { min-width: 480px; }
}

/* ══ UTILITIES ═════════════════════════════════ */
.flex  { display: flex; }
.grid  { display: grid; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--muted); }
.text-head  { color: var(--head); }
.text-green { color: var(--brand-dk); }
.text-red   { color: var(--danger); }
.text-accent { color: var(--accent); }
.font-bold  { font-weight: 700; }
.font-mono  { font-family: var(--mono); }
.w-full  { width: 100%; }
.hidden  { display: none !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
