:root {
  --bg: #0c0f13;
  --card-bg: #14171d;
  --card-bg-2: #14171d;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-selected: #b1ef62;
  --text-primary: #ffffff;
  --text-secondary: #8e929c;
  --text-tertiary: #5f636c;
  --positive: #b1ef62;
  --negative: #ff9293;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --font: -apple-system, "SF Pro Rounded", "SF Pro Text", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  height: 100%;
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 96px;
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
  position: relative;
}

.screen { padding: max(28px, calc(env(safe-area-inset-top) + 14px)) 16px 8px; animation: fadein 0.15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Header */
.header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; gap: 10px; flex-wrap: wrap; }
.header-row > div:first-child { min-width: 0; flex: 1 1 auto; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-secondary); text-transform: uppercase; }
.page-title { font-size: 34px; font-weight: 800; margin: 2px 0 0; letter-spacing: -0.02em; overflow-wrap: break-word; }
.back-link { font-size: 15px; color: var(--text-secondary); font-weight: 600; background: none; border: none; padding: 0; margin-bottom: 6px; }

.docs-btn {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  background: var(--card-bg); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); padding: 10px 16px;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap;
}

.verified-row { text-align: center; color: var(--text-secondary); font-size: 14px; margin: 14px 0; }
.verified-row b { color: var(--text-primary); font-weight: 700; }

/* Period selector */
.period-row {
  display: flex; justify-content: space-between; background: var(--card-bg);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  padding: 6px; margin-bottom: 16px;
}
.period-pill {
  flex: 1; text-align: center; padding: 10px 0; font-size: 14px; font-weight: 700;
  color: var(--text-secondary); border-radius: var(--radius-pill); border: 1px solid transparent;
  background: none;
}
.period-pill.active { color: var(--positive); border-color: var(--border-selected); }

/* Cards */
.card {
  background: var(--card-bg); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: 14px;
}
.card.selectable { transition: border-color 0.15s; }
.card.selectable:active { border-color: var(--border-selected); }

.card-total { text-align: center; }
.card-total .label { font-size: 15px; color: var(--text-secondary); font-weight: 500; }
.card-total .amount { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; margin: 10px 0 6px; }
.card-total .pct { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.card-total .sub { font-size: 14px; color: var(--text-secondary); }
.card-total .sub b { color: var(--text-primary); font-weight: 700; }

.card-metric { text-align: center; }
.card-metric .title { font-size: 15px; color: var(--text-secondary); font-weight: 600; margin-bottom: 10px; }
.card-metric .title span { color: var(--text-tertiary); font-weight: 500; }
.card-metric .value { font-size: 30px; font-weight: 800; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.pos { color: var(--positive); }
.neg { color: var(--negative); }

/* Section header */
.section-title { font-size: 20px; font-weight: 800; margin: 4px 0 12px; }
.section-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 6px; }

.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 4px; border-bottom: 1px solid var(--border-subtle);
}
.list-row:last-child { border-bottom: none; }
.list-row .name { font-weight: 700; font-size: 16px; }
.list-row .meta { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.list-row .amount { font-weight: 700; font-size: 16px; text-align: right; }

.link-row { color: var(--positive); font-weight: 700; text-align: center; padding: 14px 0 2px; display: flex; justify-content: space-between; align-items: center; }

/* Chart card */
.chart-card { padding: 18px 16px 14px; }
.chart-card .cap { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; }
.chart-footer { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-top: 6px; padding: 0 4px; }
.chart-note { font-size: 13px; color: var(--text-secondary); text-align: center; padding: 10px 8px 2px; line-height: 1.4; }

/* Bottom nav */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  background: rgba(12, 15, 19, 0.92); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex; padding: 10px 0 26px;
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: var(--text-tertiary); font-size: 12px; font-weight: 600;
}
.tab-btn.active { color: var(--positive); }
.tab-btn svg { width: 24px; height: 24px; }

.hidden { display: none !important; }
.dim { color: var(--text-secondary); }
.not-available { color: var(--text-tertiary); font-style: italic; }

svg { flex-shrink: 0; }
