:root {
  --bg: #0b0d12;
  --card: #12161f;
  --line: #1e2430;
  --fg: #e6e9ef;
  --muted: #7d8696;
  --up: #3ddc97;
  --down: #ff5c6c;
  --ada: #5b9dff;
  --token: #b18cff;
  --rest: #ffb547;
  --radius: 10px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8;
    --card: #ffffff;
    --line: #e6e9ef;
    --fg: #141821;
    --muted: #6b7381;
    --up: #0f9d63;
    --down: #e0364a;
    color-scheme: light;
  }
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.zero { color: var(--muted); }

/* header */
.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 650; letter-spacing: .2px; }
.status { margin-left: auto; background: none; border: 0; padding: 2px 4px; font-size: 12px; color: var(--muted); }
.status.err { color: var(--down); }
.ghost { background: none; border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 12px; color: var(--muted); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 8px max(12px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 13px; font-weight: 600; }
.card-head .muted { font-size: 12px; }

/* hero */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.hero .label { font-size: 12px; color: var(--muted); }
.hero .big { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.hero .side { text-align: right; display: grid; gap: 2px; align-content: start; font-size: 13px; }
.hero .side b { font-weight: 600; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; }
.chip .muted { margin-left: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ada { background: var(--ada); }
.dot.token { background: var(--token); }
.dot.rest { background: var(--rest); }

/* daily table */
.days { width: 100%; border-collapse: collapse; font-size: 13px; }
.days th, .days td { padding: 4px 10px; text-align: right; white-space: nowrap; }
.days th { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.days th:first-child, .days td:first-child { text-align: left; }
.days tr + tr td { border-top: 1px solid var(--line); }
.days td.total { font-weight: 600; position: relative; width: 30%; }
.days .bar-fill { position: absolute; top: 5px; bottom: 5px; right: 0; border-radius: 3px; opacity: .14; background: var(--up); }
.days .bar-fill.down { background: var(--down); }
.days td.total span { position: relative; }
.days .today td { background: color-mix(in srgb, var(--fg) 4%, transparent); }

/* segmented controls */
.tabs { flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 3px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.seg.small button { padding: 2px 8px; font-size: 12px; }
.seg button.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / .25); }

/* lists */
.row { display: grid; grid-template-columns: 8px 1fr auto; gap: 1px 8px; align-items: center; padding: 6px 10px; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.row .dot { grid-row: 1 / 3; align-self: center; }
.row .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amount { text-align: right; font-weight: 600; white-space: nowrap; }
.row .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .when { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }
.tag.fail { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.more { display: block; width: 100%; padding: 8px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font-size: 13px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(320px, 100%); padding: 16px; display: grid; gap: 10px; }
.login-card .brand { font-size: 16px; margin-bottom: 2px; }
.login-card input { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
.login-card input:focus { border-color: var(--ada); }
.login-card button { border: 0; border-radius: 8px; padding: 8px; background: var(--fg); color: var(--bg); font-weight: 600; }
.login-card .error { color: var(--down); font-size: 13px; min-height: 1em; }
.login-card .error:empty { display: none; }

@media (min-width: 640px) {
  main { padding-top: 12px; gap: 10px; }
  .hero .big { font-size: 32px; }
}

.summary { display: grid; gap: 8px; align-content: start; }

@media (min-width: 1000px) {
  main { max-width: 1180px; grid-template-columns: 440px 1fr; align-items: start; }
  .summary { position: sticky; top: 56px; gap: 10px; }
}
