:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #d93025);
  --line: rgba(127, 127, 127, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       -webkit-text-size-adjust: 100%; overflow-x: hidden; }
#app { padding: 12px 12px 76px; max-width: 480px; margin: 0 auto; }
.card { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin: 0 0 8px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stamp { font-size: 12px; color: var(--hint); white-space: nowrap; }
.muted { color: var(--hint); }
.err { color: var(--danger); }
h1 { font-size: 20px; margin: 0 0 6px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.grid th { font-weight: 500; color: var(--hint); text-align: right; padding: 4px 2px; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid td { text-align: right; padding: 5px 2px; border-top: 1px solid var(--line); }
table.grid tr.total td { font-weight: 600; }
td.bad { color: var(--danger); font-weight: 600; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { padding: 7px 0; border-top: 1px solid var(--line); }
ul.list li:first-child { border-top: 0; }
.row { display: flex; justify-content: space-between; gap: 8px; }
.row .main { min-width: 0; overflow-wrap: anywhere; }
.row .side { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub { font-size: 13px; color: var(--hint); overflow-wrap: anywhere; }
.day { font-size: 13px; color: var(--hint); margin: 8px 0 2px; }
.chart-box { position: relative; height: 200px; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex;
        background: var(--bg); border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; border: 0; background: none; color: var(--hint);
               font: inherit; font-size: 14px; padding: 12px 0; }
#tabs button.on { color: var(--accent); font-weight: 600; }
