:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1b25);
  --hint: var(--tg-theme-hint-color, #6b7280);
  --link: var(--tg-theme-link-color, #635bff);
  --button: var(--tg-theme-button-color, #635bff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #f4f5f9);
  --ok: #15803d;
  --bad: #dc2626;
  --warn: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) { --bg: #14151c; --text: #f3f4f6; --hint: #9ca3af; --card: #1f2029; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
main { max-width: 480px; margin: 0 auto; padding: 16px 16px 32px; }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.hello { font-weight: 600; margin-bottom: 12px; }
.balance-card { background: var(--card); border-radius: 16px; padding: 18px; }
.balance { font-size: 34px; font-weight: 700; margin: 4px 0; letter-spacing: -0.02em; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border: 0;
  border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; }
.action .icon { width: 36px; height: 36px; border-radius: 50%; background: var(--button); color: var(--button-text);
  display: grid; place-items: center; font-size: 18px; }
label { display: block; margin: 12px 0; color: var(--hint); font-size: 13px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--hint) 35%, transparent); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; }
textarea { resize: vertical; word-break: break-all; }
button { cursor: pointer; }
.primary, .secondary { display: block; width: 100%; margin-top: 12px; padding: 14px; border: 0; border-radius: 12px;
  font: inherit; font-weight: 600; }
.primary { background: var(--button); color: var(--button-text); }
.secondary { background: var(--card); color: var(--link); }
.primary:disabled { opacity: 0.5; }
.chips { display: flex; gap: 8px; }
.chip { flex: 1; padding: 8px; border-radius: 10px; border: 0; background: var(--card); color: var(--text); font: inherit; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 8px; padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); }
.list .title { font-weight: 600; }
.list .right { text-align: right; white-space: nowrap; }
.badge { font-size: 12px; font-weight: 600; }
.badge.succeeded { color: var(--ok); } .badge.failed { color: var(--bad); }
.badge.processing, .badge.pending { color: var(--link); } .badge.unknown { color: var(--warn); }
.kv { background: var(--card); border-radius: 14px; padding: 4px 14px; margin: 12px 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hint) 15%, transparent); }
.kv div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--hint); }
.kv span:last-child { text-align: right; word-break: break-all; }
.status-head { text-align: center; margin: 24px 0 8px; }
.status-icon { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; background: var(--card); }
.status-icon.succeeded { background: var(--ok); color: #fff; } .status-icon.failed { background: var(--bad); color: #fff; }
.amount { font-size: 28px; font-weight: 700; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 24px; max-width: 448px; margin: 0 auto; padding: 12px 14px;
  border-radius: 12px; background: #1a1b25; color: #fff; font-size: 14px; }
.denied { text-align: center; margin-top: 30vh; }
