/* wallet-v1 — forked from profile-v1.
   Self-contained per prototype principle. */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 680px) 320px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px;
  color: var(--text-soft);
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.new-post {
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700;
  padding: 14px 22px;
  font-size: 16px;
}

/* ============ MAIN COLUMN ============ */
.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  min-height: 44px;
}
.topbar h1 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* ============ WALLET HERO (the one place full purple is allowed) ============ */
.wallet-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-md);
  padding: 28px 24px 24px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.wallet-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}
.wallet-hero .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.wallet-hero .eye {
  color: rgba(255,255,255,0.78);
  padding: 4px;
  border-radius: 999px;
  line-height: 1;
}
.wallet-hero .eye:hover { background: rgba(255,255,255,0.12); }
.wallet-hero .balance {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.wallet-hero .balance small { font-size: 16px; font-weight: 700; opacity: 0.85; margin-left: 6px; }
.wallet-hero .usd {
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  margin-top: 6px;
}
.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 22px;
}
.hero-actions .act {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: white;
  font-weight: 600;
  font-size: 13px;
}
.hero-actions .act .ic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: background 0.15s;
}
.hero-actions .act:hover .ic { background: rgba(255,255,255,0.26); }

/* ============ TABS ============ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.tabs .tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--text); }
.tabs .tab:hover:not(.active) { color: var(--text); background: var(--surface-soft); }

/* ============ TRANSACTION LIST ============ */
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
}
.tx-list li:last-child { border-bottom: 0; }
.tx-list .ic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--surface-soft);
}
.tx-list .ic.earned { background: rgba(16,185,129,0.12); }
.tx-list .ic.spent  { background: rgba(107,114,128,0.12); }
.tx-list .ic.topup  { background: rgba(59,130,246,0.12); }
.tx-list .meta { flex: 1; min-width: 0; }
.tx-list .meta b { display: block; font-weight: 700; font-size: 14px; line-height: 1.4; }
.tx-list .meta .note {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-list .meta .time { color: var(--text-muted); font-size: 12px; margin-top: 2px; display: block; }
.tx-list .amt {
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tx-list .amt.earned { color: var(--success); }
.tx-list .amt.spent  { color: var(--text); }
.tx-list .amt.topup  { color: var(--secondary); }
.tx-list .amt .unit { font-size: 11px; font-weight: 600; opacity: 0.7; margin-left: 4px; }

/* ============ RIGHT PANEL ============ */
.right-panel { display: flex; flex-direction: column; gap: 18px; }
.right-panel .card { padding: 20px; }
.right-panel h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; }

/* Month stats */
.month-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.month-stats .cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.month-stats .cell .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-soft);
}
.month-stats .cell.earned .k { color: var(--success); }
.month-stats .cell .v {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.month-stats .cell .unit { font-size: 11px; font-weight: 600; opacity: 0.6; margin-left: 3px; }

/* Sources stacked bar */
.sources-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-soft);
  margin-bottom: 12px;
}
.sources-bar .seg { height: 100%; }
.sources-list { list-style: none; padding: 0; margin: 0; }
.sources-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.sources-list .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sources-list .lbl { flex: 1; color: var(--text-soft); }
.sources-list .val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Token rate card */
.rate-card { text-align: left; }
.rate-card .rate {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.rate-card .rate small { font-size: 13px; font-weight: 600; color: var(--text-soft); margin-left: 4px; }
.rate-card .desc { color: var(--text-soft); font-size: 13px; margin-top: 4px; line-height: 1.5; }
.rate-card .buy {
  margin-top: 14px;
  width: 100%;
  padding: 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  font-size: 13px;
}

/* Quick send (contacts) */
.contacts { display: flex; gap: 14px; }
.contacts .c {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
}
.contacts .avatar { width: 44px; height: 44px; font-size: 16px; }

/* ============ AVATAR ============ */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; flex-shrink: 0; user-select: none; }
.avatar.g1 { background: linear-gradient(135deg, var(--primary), var(--ai)); }
.avatar.g2 { background: linear-gradient(135deg, var(--ai), var(--info)); }
.avatar.g3 { background: linear-gradient(135deg, var(--success), var(--ai)); }
.avatar.g4 { background: linear-gradient(135deg, var(--accent), var(--accent-warm)); }
.avatar.g5 { background: linear-gradient(135deg, var(--primary), var(--accent)); }

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 96px;
    gap: 12px;
  }
  .sidebar,
  .right-panel { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 4px;
    margin: 0 0 12px;
  }
  .topbar h1 { display: none; }
  .topbar-brand { display: inline-flex; }

  .wallet-hero .balance { font-size: 32px; }

  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
  }
  .mobile-nav a {
    text-align: center;
    font-size: 12px;
    color: var(--text-soft);
    padding: 8px 4px;
  }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px;
    height: 46px;
    margin: auto;
    padding: 0;
    border-radius: 50%;
    background: var(--cta-bg);
    color: var(--cta-text);
    display: grid;
    place-items: center;
    line-height: 1;
  }
}
