/* income-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, 720px);
  gap: 24px;
  max-width: 1100px;
  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 ============ */
.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  min-height: 44px;
  gap: 12px;
}
.topbar .back {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--text);
}
.topbar h1 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.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);
}

/* ============ STATS ============ */
.stats-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.stat-card.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
}
.stat-card small {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.stat-card.primary small { color: rgba(255,255,255,0.78); }
.stat-card b {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-card.primary b { color: white; font-size: 24px; }
.stat-card .unit { font-size: 11px; font-weight: 600; color: var(--text-soft); }
.stat-card.primary .unit { color: rgba(255,255,255,0.82); }
.stat-card.primary b.alt { font-size: 16px; margin-top: 2px; opacity: 0.95; }
.stat-card .usd-hint {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.82);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat-card .usd-sub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ============ PANE NAV ============ */
.pane-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  padding: 4px;
  margin-bottom: 14px;
}
.pane-nav button {
  padding: 9px 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.pane-nav button.on {
  background: var(--cta-bg);
  color: var(--cta-text);
}
.list-section[hidden] { display: none !important; }

/* ============ LIST SECTIONS ============ */
.list-section { padding: 0; overflow: hidden; margin-bottom: 14px; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.list-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.sort-note { font-size: 11px; color: var(--text-soft); font-weight: 600; }

.cat-list,
.day-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.day-list {
  max-height: min(520px, 64vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cat-list li,
.day-list li { border-bottom: 1px solid var(--line); }
.cat-list li:last-child,
.day-list li:last-child { border-bottom: 0; }

/* 途徑累計行 */
.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  transition: background 0.15s;
}
.cat-row:hover { background: var(--surface-soft); }
.cat-row .cicon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex-shrink: 0;
}
.cat-row .info { flex: 1; min-width: 0; }
.cat-row .info b { display: block; font-size: 14px; font-weight: 700; }
.cat-row .info small { display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cat-row .earned { text-align: right; flex-shrink: 0; }
.cat-row .earned b,
.day-row .earned b {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.cat-row .earned b i,
.day-row .earned b i,
.dd-row b i { font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-muted); }
.cat-row .earned .u {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #2775ca;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.cat-row .earned .u i { font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-muted); }

/* 每日行（accordion） */
.day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 18px;
  transition: background 0.15s;
}
.day-row:hover { background: var(--surface-soft); }
.day-row .info { flex: 1; min-width: 0; }
.day-row .info b { display: block; font-size: 14px; font-weight: 700; }
.day-row .info small { display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.day-row .earned { text-align: right; flex-shrink: 0; }
.day-row .earned .usd {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.day-row .chev { flex-shrink: 0; color: var(--text-muted); transition: transform 0.18s; }
.day-row.open .chev { transform: rotate(180deg); }

.day-detail { padding: 2px 18px 12px 68px; display: grid; gap: 7px; }
.day-detail[hidden] { display: none !important; }
.dd-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dd-row .dd-ic { color: var(--text-muted); display: grid; place-items: center; }
.dd-row .dd-ic svg { width: 14px; height: 14px; }
.dd-row .dd-name { flex: 1; min-width: 0; color: var(--text-soft); font-weight: 600; }
.dd-row b { font-weight: 800; color: var(--success); font-variant-numeric: tabular-nums; }
.dd-none { font-size: 12px; color: var(--text-muted); }

.info-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.6;
  text-align: center;
}
.info-note a { color: var(--primary-dark); font-weight: 600; }

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

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); padding: 16px; gap: 18px; }
}

@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .sidebar { display: none; }
  .main { padding: 14px 16px 90px; }
  .topbar { padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .topbar .back { display: inline-flex; }
  .topbar h1 { font-size: 18px; text-align: center; }
  .topbar-brand { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-card.primary { grid-column: 1 / -1; }
  .day-detail { padding-left: 18px; }

  .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;
  }
}

/* ============ 收入結餘卡（入口 → income-transfer-v1） ============ */
.bal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.bal-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-float); }
.bal-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.bal-info b { font-size: 15px; }
.bal-info small { font-size: 12px; color: var(--text-soft); }
.bal-nums { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.bal-nums b {
  font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: baseline; gap: 5px;
}
.bal-nums b i { font-size: 11px; font-weight: 700; font-style: normal; color: var(--text-soft); }
.bn-pulse { color: #047857; }
.bn-usdc { color: #2775ca; }
.bal-chev { color: var(--text-soft); flex: none; }

/* AirDrop 累積卡（入口 → airdrop-v2） */
.air-ic {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft, #eef2ff); color: var(--primary);
}
