:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --line: #eceef1;
  --text: #0a0b0d;
  --muted: #5b616e;
  --faint: #8a919e;
  --brand: #e3262f;
  --brand-ink: #b3141c;
  --brand-soft: #fdecec;
  --up: #098551;
  --down: #cf202f;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }

.shell { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }
.view { padding: calc(env(safe-area-inset-top) + 12px) 16px calc(96px + env(safe-area-inset-bottom)); }

/* topo */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.topbar .avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  background: var(--surface); border-radius: 999px; color: var(--faint); font-size: 15px;
}
.search input { border: 0; outline: 0; background: none; font: inherit; color: var(--text); width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.icon-btn:active { background: var(--surface); }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

h1.page { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 16px; }

/* saldo / número grande */
.hero-label { color: var(--muted); font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.hero-number { font-size: clamp(30px, 10vw, 40px); font-weight: 800; letter-spacing: -.03em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 15px; font-weight: 600; color: var(--up); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px rgba(9,133,81,.15); }

/* ações rápidas */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 24px 0 28px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.action .circle { width: 52px; height: 52px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; }
.action .circle .ico { width: 22px; height: 22px; }
.action:active .circle { background: var(--brand-ink); }

/* cartões */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.card-live { background: var(--text); color: #fff; display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.card-live .meta { flex: 1; min-width: 0; }
.card-live .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #ff8a8f; display: flex; align-items: center; gap: 6px; }
.card-live .t { font-size: 17px; font-weight: 700; margin: 4px 0 2px; }
.card-live .s { font-size: 14px; color: #b9bec8; font-variant-numeric: tabular-nums; }
.pill { height: 36px; padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.pill-brand { background: var(--brand); color: #fff; }
.pill-light { background: #fff; color: var(--text); }
.pill-ghost { background: var(--surface); color: var(--text); }
.btn-block { width: 100%; height: 52px; border-radius: 999px; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 6px; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.section-head a { color: var(--brand); font-weight: 700; font-size: 14px; }
.section { margin-bottom: 28px; }

/* linhas de ativos */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.coin { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 13px; overflow: hidden; }
.coin img { width: 100%; height: 100%; }
.row .name { flex: 1; min-width: 0; }
.row .name b { display: block; font-weight: 700; font-size: 16px; }
.row .name span { color: var(--muted); font-size: 14px; }
.row .spark { width: 64px; height: 28px; flex: none; }
.row .price { text-align: right; font-variant-numeric: tabular-nums; min-width: 92px; }
.row .price b { display: block; font-weight: 700; font-size: 16px; }
.up { color: var(--up); } .down { color: var(--down); }
.skel { background: linear-gradient(90deg, var(--surface), #eceef1, var(--surface)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 16px; border-radius: 999px; background: var(--surface); font-weight: 700; font-size: 14px; white-space: nowrap; flex: none; }
.chip.on { background: var(--text); color: #fff; }

/* calls (cartões horizontais) */
.hscroll { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 0; padding: 0 16px 4px; scroll-snap-type: x mandatory; }
.hscroll::-webkit-scrollbar { display: none; }
.call { flex: none; width: 240px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.call-top { display: flex; align-items: center; gap: 10px; }
.call-top b { font-size: 16px; }
.call-top .tag { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); padding: 4px 8px; border-radius: 999px; }
.call p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 10px 0 12px; }
.call .by { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.call .by i { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-style: normal; font-weight: 800; font-size: 11px; display: grid; place-items: center; }

/* listas genéricas */
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.tile .ico { width: 22px; height: 22px; }
.list-item .txt { flex: 1; min-width: 0; }
.list-item .txt b { display: block; font-size: 16px; font-weight: 700; }
.list-item .txt span { color: var(--muted); font-size: 14px; }
.list-item .end { color: var(--faint); font-size: 14px; font-weight: 600; text-align: right; }
.progress { height: 4px; background: var(--line); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* agenda */
.day { margin-bottom: 20px; }
.day h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; margin-bottom: 4px; }
.day h3.today { color: var(--brand); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.badge.live { background: var(--brand); color: #fff; }

/* perfil */
.profile { text-align: center; padding: 8px 0 24px; }
.profile img { width: 88px; height: 88px; border-radius: 50%; margin-bottom: 12px; }
.profile h2 { font-size: 24px; font-weight: 800; }
.profile p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 6px auto 0; max-width: 340px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; }
.stats .card { text-align: center; padding: 14px 8px; }
.stats b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }
.note { color: var(--faint); font-size: 12px; line-height: 1.5; text-align: center; margin-top: 24px; }

/* tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255,255,255,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 0; }
.tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--text); }
.tabbar a.on:not(.tab-live) svg { stroke-width: 2.4; }
.live-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; }
.tabbar .live-btn svg { width: 20px; height: 20px; fill: #fff; stroke: none; }

/* folha (detalhe do ativo) */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10,11,13,.4); animation: fade .2s ease; }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px;
  max-height: 92%; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.22,1,.36,1);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translate(-50%, 100%); } }

.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.detail-head b { font-size: 18px; }
.detail-head span { color: var(--muted); }
.chart { height: 200px; margin: 12px -16px 8px; position: relative; }
.chart svg { width: 100%; height: 100%; }
.ranges { display: flex; justify-content: space-between; margin-bottom: 20px; }
.ranges button { height: 32px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--muted); }
.ranges button.on { background: var(--brand-soft); color: var(--brand); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-bottom: 20px; }
.kv div { padding: 12px 0; border-top: 1px solid var(--line); }
.kv span { display: block; color: var(--muted); font-size: 13px; }
.kv b { font-size: 15px; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
