:root {
  --bg: var(--tg-theme-bg-color, #fff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --ok: #2ea043; --warn: #d4a017; --bad: #e5484d;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, Roboto, sans-serif; background: var(--bg2); color: var(--text); font-size: 15px; }
#app { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 16px 0 8px; }
.muted { color: var(--hint); font-size: 13px; }
.center { text-align: center; padding: 24px; }
.card { background: var(--bg); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.list .item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--bg2); cursor: pointer; }
.list .item:last-child { border-bottom: none; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bg2); color: var(--hint); white-space: nowrap; }
.badge.ok { background: #2ea04322; color: var(--ok); }
.badge.warn { background: #d4a01722; color: var(--warn); }
.badge.bad { background: #e5484d22; color: var(--bad); }
button, .btn { font: inherit; border: none; border-radius: 10px; padding: 10px 14px; background: var(--btn); color: var(--btn-text); cursor: pointer; }
button.secondary { background: var(--bg2); color: var(--text); }
button.danger { background: #e5484d22; color: var(--bad); }
button.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.actions button { flex: 1; }
input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--bg2); border-radius: 10px; background: var(--bg); color: var(--text); }
label { display: block; margin-bottom: 8px; }
label span { display: block; font-size: 12px; color: var(--hint); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.tabs button { flex: 1; background: transparent; color: var(--hint); padding: 8px; }
.tabs button.active { background: var(--bg2); color: var(--text); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--bg2); }
th { color: var(--hint); font-weight: 500; }
td.num, th.num { text-align: right; }
.bar { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--btn); }
.report { white-space: pre-line; line-height: 1.5; }
.report.ok { border-left: 4px solid var(--ok); padding-left: 10px; }
.report.warn { border-left: 4px solid var(--warn); padding-left: 10px; }
.report.bad { border-left: 4px solid var(--bad); padding-left: 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bg2); }
.check input { width: 22px; height: 22px; }
canvas { width: 100% !important; max-height: 260px; }
.back { color: var(--link); cursor: pointer; margin-bottom: 8px; display: inline-block; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; font-size: 14px; max-width: 90%; }
#toast.show { opacity: 1; }
.stat { text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--hint); }
