:root {
  --bg: var(--tg-theme-bg-color, #0d0f12);
  --surface: var(--tg-theme-secondary-bg-color, #171a1f);
  --surface-2: color-mix(in srgb, var(--surface), white 4%);
  --text: var(--tg-theme-text-color, #f4f6f8);
  --muted: var(--tg-theme-hint-color, #8c939d);
  --accent: var(--tg-theme-button-color, #ff7a1a);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --line: color-mix(in srgb, var(--muted), transparent 68%);
  --good: #35c86f;
  --danger: #ff5c68;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
button { font: inherit; }
.shell { width: min(100%, 720px); margin: 0 auto; padding: 18px 16px 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { display: block; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; margin-bottom: 5px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
h2 { font-size: 20px; letter-spacing: -.018em; }
.balance-chip { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 750; font-variant-numeric: tabular-nums; }
.notice { margin-bottom: 14px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--accent), transparent 55%); border-radius: 13px; background: color-mix(in srgb, var(--accent), transparent 88%); font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-heading.compact { margin-top: 26px; }
.section-heading p { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 5px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface); margin-bottom: 14px; }
.segmented button { border: 0; border-radius: 11px; padding: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.segmented button.active { color: var(--text); background: var(--surface-2); box-shadow: 0 2px 10px rgba(0,0,0,.14); }
.model-list, .ledger-list { display: grid; gap: 10px; }
.model-card { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; }
.model-card.selected { border-color: color-mix(in srgb, var(--accent), white 8%); background: color-mix(in srgb, var(--accent), var(--surface) 90%); }
.model-logo { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); font-weight: 900; color: var(--accent); }
.model-copy { min-width: 0; }
.model-copy strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-meta { text-align: right; }
.model-meta strong { display: block; font-size: 13px; }
.model-meta span { display: block; color: var(--good); font-size: 16px; height: 18px; margin-top: 4px; }
.hero-card { padding: 24px; border-radius: 24px; background: linear-gradient(145deg, color-mix(in srgb, var(--accent), #111 72%), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent), transparent 55%); }
.hero-card > span { color: color-mix(in srgb, var(--text), transparent 25%); font-size: 13px; }
.hero-card strong { display: block; margin: 8px 0; font-size: 42px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hero-card p { max-width: 420px; color: color-mix(in srgb, var(--text), transparent 25%); font-size: 13px; line-height: 1.45; }
.topup-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.topup-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; }
.topup-card strong { display: block; font-size: 20px; }
.topup-card span { display: block; color: var(--muted); margin-top: 5px; font-size: 12px; }
.fineprint { color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 16px; }
.fineprint a, .terms-check a { color: var(--accent); }
.ledger-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border-bottom: 1px solid var(--line); }
.ledger-row:first-child { border-top: 1px solid var(--line); }
.ledger-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--surface); }
.ledger-copy strong { display: block; font-size: 14px; }
.ledger-copy span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.ledger-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.ledger-amount.positive { color: var(--good); }
.ledger-amount.negative { color: var(--text); }
.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3,1fr); width: min(100%,720px); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg), transparent 4%); backdrop-filter: blur(18px); }
.bottom-nav button { border: 0; background: transparent; color: var(--muted); padding: 5px; font-size: 11px; font-weight: 650; }
.bottom-nav button span { display: block; font-size: 21px; line-height: 1.1; margin-bottom: 3px; }
.bottom-nav button.active { color: var(--accent); }
.page { display: none; }
.page.active { display: block; animation: appear .18s ease-out; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 20px; }
.empty { padding: 34px 18px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; font-size: 13px; }
.skeleton { height: 86px; border-radius: var(--radius); background: linear-gradient(90deg,var(--surface),var(--surface-2),var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton.tall { height: 180px; }
.modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: end center; padding: 16px; background: rgba(0,0,0,.52); }
.modal-card { width: min(100%, 480px); padding: 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.modal-icon { display: block; font-size: 34px; margin-bottom: 12px; }
.modal-card p { color: var(--muted); margin: 8px 0 20px; line-height: 1.45; }
.terms-check { display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: 9px; margin: -4px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.terms-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; }
.modal-actions button { border: 0; border-radius: 13px; padding: 12px; font-weight: 750; }
.modal-actions .secondary { color: var(--text); background: var(--surface-2); }
.modal-actions .primary { color: var(--accent-text); background: var(--accent); }
.modal-actions button:disabled { opacity: .45; }
.hidden { display: none !important; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (min-width: 600px) { .topup-grid { grid-template-columns: repeat(4,1fr); } .shell { padding-top: 28px; } }
