:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f4f6);
  --fg: var(--tg-theme-text-color, #14202b);
  --muted: var(--tg-theme-hint-color, #6b7782);
  --accent: var(--tg-theme-button-color, #00897a);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #00897a);
  --line: color-mix(in srgb, var(--fg) 12%, transparent);
  --ok: #1f9d55;
  --warn: #d9480f;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 760px; margin: 0 auto; padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; padding: 40px 0; }
.card { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
button { font: inherit; border: 0; border-radius: 12px; padding: 12px 14px; background: var(--bg2); color: var(--fg); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
button.big { width: 100%; padding: 18px; font-size: 19px; font-weight: 700; border-radius: 16px; }
button.huge { width: 100%; padding: 34px 16px; font-size: 24px; font-weight: 800; border-radius: 22px; }
button.ghost { background: transparent; color: var(--link); padding: 10px 6px; }
button.danger { color: var(--warn); }
button:disabled { opacity: .45; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 14px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); }
.chips.ages { display: grid; grid-template-columns: repeat(7, 1fr); }
.chips.ages .chip { padding: 10px 0; text-align: center; }
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -14px 10px; padding-inline: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; padding: 9px 14px; border-radius: 999px; background: var(--bg); }
.tab.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.stat { font-size: 30px; font-weight: 800; line-height: 1.1; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; }
.tile .stat { font-size: 26px; }
.big-num { font-size: 44px; font-weight: 800; text-align: center; letter-spacing: 1px; min-height: 60px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.keypad button { padding: 16px 0; font-size: 22px; font-weight: 600; background: var(--bg); }
.list .item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg2); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 10; max-width: 92%; text-align: center; }
.bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 130px; margin-top: 8px; }
.bars .col { display: flex; flex-direction: column; justify-content: end; align-items: stretch; gap: 2px; height: 100%; }
.bars .col i { display: block; border-radius: 4px 4px 0 0; }
.legend { display: flex; gap: 12px; font-size: 12px; margin-top: 6px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; background: var(--c); }
input, select, textarea { font: inherit; width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--bg); border-radius: var(--radius); }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input { padding: 6px 8px; width: 82px; text-align: right; }
pre { white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, monospace; margin: 0; }
.lang { position: absolute; right: 14px; top: 12px; }
