:root {
  --bg: #0e0f13;
  --ink: #f3f4f6;
  --muted: #8b8f9a;
  --faint: #5d616c;
  --line: #1e2027;
  --pill: #1a1c23;
  --up: #3ddc97;
  --down: #ff6b7d;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabs-h: 58px;
  color-scheme: dark;
}

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

html, body { margin: 0; background: var(--bg); color: var(--ink); }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}

[hidden] { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 24px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 40px);
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 8px;
}

/* top */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.who { display: flex; flex-direction: column; min-width: 0; }
.addr { font-weight: 600; font-size: 15px; }
.updated { color: var(--muted); font-size: 13px; }
.unit {
  border: 0;
  background: var(--pill);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 38px;
  font-weight: 600;
  font-size: 14px;
}

/* overview */
.hero { padding: 36px 0 4px; }
.hero-num {
  margin: 0;
  font-size: clamp(48px, 16vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.hero-num.up { color: var(--up); }
.hero-num.down { color: var(--down); }
.hero-sub { margin: 10px 0 0; color: var(--muted); font-size: 15px; min-height: 1.4em; }

.chart { margin: 20px -24px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .zero { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.1; }
.chart .cross { stroke: var(--faint); stroke-width: 1; }
.chart .dot { stroke: var(--bg); stroke-width: 2; }

.ranges { display: flex; justify-content: space-between; margin-top: 10px; }
.ranges button {
  min-width: 64px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.ranges button[aria-pressed="true"] { background: var(--pill); color: var(--ink); }

.details { margin: 32px 0 0; }
.details > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }

/* alerts */
.alerts { margin-top: 8px; padding: 20px 0 4px; border-top: 1px solid var(--line); }
.alerts h2 { margin: 0; font-size: 16px; font-weight: 600; }
.alerts p { margin: 4px 0 14px; color: var(--muted); font-size: 15px; max-width: 40ch; }
.alerts .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
}
.btn.ghost { background: var(--pill); color: var(--ink); font-weight: 600; }
.btn.danger { background: var(--down); color: #2a0b13; }
.btn[disabled] { opacity: 0.55; }

.link {
  display: block;
  margin: 20px auto 0;
  border: 0;
  background: none;
  color: var(--faint);
  min-height: 44px;
  font-size: 14px;
}

/* transactions */
.page-title { margin: 28px 0 8px; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.rows a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  min-height: 68px;
  color: inherit;
  text-decoration: none;
}
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 600; }
.row-time { color: var(--muted); font-size: 14px; }
.row-amt { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.row-sol { font-weight: 600; }
.row-sol.up { color: var(--up); }
.row-sol.down { color: var(--down); }
.row-sol.flat { color: var(--muted); }
.row-usd { color: var(--muted); font-size: 14px; }

.empty, .note { color: var(--muted); margin: 24px 0; max-width: 34ch; font-size: 15px; }
.note { text-align: center; margin-left: auto; margin-right: auto; font-size: 14px; color: var(--faint); }

/* tab bar */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(14, 15, 19, 0.97);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabs button {
  flex: 1;
  max-width: 240px;
  height: var(--tabs-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs svg circle { fill: currentColor; }

/* dialogs */
.dlg {
  width: min(92vw, 380px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #16181e;
  color: var(--ink);
  padding: 24px;
}
.dlg::backdrop { background: rgba(5, 6, 9, 0.75); }
.dlg h2 { margin: 0 0 6px; font-size: 19px; }
.dlg-msg { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.dlg input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.dlg .btn { width: 100%; }
.dlg-row { display: flex; gap: 10px; }
.dlg-row .btn { flex: 1; }
