:root {
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    --bg: #101720;
    --card: rgba(23, 30, 40, .94);
    --text: #f1f5f9;
    --hint: #8f9aaa;
    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, .12);
    --border: rgba(143, 154, 170, .2);
    --shadow: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        linear-gradient(rgba(125, 151, 181, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 151, 181, .07) 1px, transparent 1px),
        linear-gradient(180deg, rgba(16, 23, 32, .2), #101720 75%);
    background-size: 64px 64px, 64px 64px, 100% 100%;
    background-attachment: fixed;
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
button, a, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(34, 211, 238, .45); outline-offset: 3px; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.app-shell {
    width: min(100%, 680px);
    min-height: 100vh;
    margin: auto;
    padding: calc(20px + env(safe-area-inset-top)) 18px calc(116px + env(safe-area-inset-bottom));
}
.app-header, .status-row, .section-heading, .traffic-label, .info-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header { margin-bottom: 34px; }
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-actions { display: flex; align-items: center; gap: 9px; }
.telegram-login { min-height: 28px; color: var(--hint); font-size: 12px; white-space: nowrap; }
.telegram-login iframe { display: block; }
.brand-logo {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #171e28;
    box-shadow: none;
    object-fit: contain;
}
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .1em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(19px, 5vw, 24px); letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 19px; letter-spacing: -.025em; }
.muted, small { color: var(--hint); }
.muted { margin-bottom: 0; }
.avatar, .profile-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(34, 211, 238, .38);
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 750;
    box-shadow: none;
}
.avatar { width: 42px; height: 42px; }
.profile-avatar { width: 58px; height: 58px; font-size: 21px; }

.welcome-block { margin: 8px 0 24px; }
.welcome-block h2 {
    max-width: 100%;
    margin-bottom: 0;
    font-size: clamp(40px, 11vw, 64px);
    font-weight: 780;
    line-height: .94;
    letter-spacing: -.065em;
}

.benefit-banner, .subscription-card, .profile-card, .plan-card, details, .payment-note {
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
}
.benefit-banner {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px;
    margin-bottom: 32px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(23, 30, 40, .98), rgba(20, 45, 53, .88));
}
.banner-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 15px;
    border: 1px solid rgba(34, 211, 238, .35);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 21px;
    box-shadow: none;
}
.benefit-banner div { display: grid; gap: 2px; }
.benefit-banner span:last-child { color: var(--hint); font-size: 13px; }
.content-section { margin-top: 30px; }
.section-heading { margin-bottom: 13px; }
.section-heading h2 { margin: 0; }

.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plan-limit { margin: 10px 2px 0; font-size: 13px; }
.plan-card {
    position: relative;
    display: grid;
    gap: 8px;
    min-height: 138px;
    padding: 16px 13px;
    overflow: hidden;
    border-radius: 24px;
    text-align: left;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.plan-card strong { font-size: 20px; letter-spacing: -.04em; }
.plan-card small { z-index: 1; font-size: 12px; }
.plan-card.selected { border-color: rgba(34, 211, 238, .72); background: var(--accent-soft); box-shadow: 0 0 0 1px rgba(34, 211, 238, .35); transform: translateY(-2px); }
.plan-card:active, button:active { transform: scale(.98); }
.discount { color: var(--accent); }
.hit-badge {
    position: absolute;
    top: 10px;
    right: 9px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #071116;
    font-size: 10px;
}
.promo-box { margin-top: 20px; }
.promo-box > label { display: block; margin-bottom: 7px; font-weight: 650; }
.promo-row { display: flex; gap: 8px; }
.promo-row input {
    min-width: 0;
    flex: 1;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow);
}
.promo-row .secondary-action { width: auto; }
.promo-box #promoStatus { min-height: 20px; margin: 7px 2px 0; color: var(--accent); font-size: 13px; }

.payment-note { padding: 18px; border-radius: 26px; }
.payment-note .section-heading { margin: 22px 0 16px; }
.sbp-qr-wrap { margin-bottom: 22px; text-align: center; }
.sbp-qr-wrap .qr-placeholder { margin-bottom: 10px; }
.qr-unavailable { margin-bottom: 18px; padding: 13px; border: 1px solid var(--border); border-radius: 18px; background: rgba(143, 154, 170, .08); text-align: center; }
.payment-details { display: grid; gap: 8px; margin-bottom: 12px; }
.payment-details span { display: flex; justify-content: space-between; gap: 12px; }
.payment-details strong { text-align: right; }
.payment-instruction { margin-top: 18px; }
.receipt-field { display: grid; gap: 7px; margin: 16px 0 10px; font-weight: 650; }
.receipt-field input { width: 100%; padding: 11px; border: 1px solid var(--border); border-radius: 16px; background: rgba(143, 154, 170, .08); color: var(--text); }
.upload-receipt, .sbp-action {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 18px;
    background: var(--accent);
    color: #071116;
    font-weight: 700;
    box-shadow: none;
}
.sbp-action { margin-top: 16px; }
.secondary-action, .back-button { min-height: 42px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 15px; background: rgba(143, 154, 170, .08); color: var(--text); }
.secondary-action { width: 100%; }
.back-button { color: var(--hint); }
.upload-receipt:disabled { opacity: .55; cursor: wait; }

.bottom-nav {
    position: fixed;
    z-index: 4;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    display: flex;
    justify-content: center;
    gap: 4px;
    width: min(calc(100% - 24px), 520px);
    margin: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 34px;
    background: rgba(16, 23, 32, .9);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .3);
    -webkit-backdrop-filter: blur(30px) saturate(1.15);
    backdrop-filter: blur(30px) saturate(1.15);
}
.nav-item {
    display: grid;
    justify-items: center;
    gap: 3px;
    width: 33.333%;
    min-width: 0;
    padding: 7px 5px;
    border: 0;
    border-radius: 26px;
    background: transparent;
    color: var(--hint);
    font-size: 11px;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-item span { display: grid; place-items: center; font-size: 21px; line-height: 1; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.subscription-card, .profile-card { padding: 19px; border-radius: 28px; }
.subscription-card h2 { margin-top: 20px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 700; }
.status-badge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.traffic-label { margin-top: 22px; font-size: 13px; }
.progress-track { height: 7px; margin: 8px 0 18px; overflow: hidden; border-radius: 999px; background: rgba(143, 154, 170, .16); }
.progress-track span { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--accent); }
.quick-actions { display: grid; gap: 9px; }
.quick-actions button, .support-button {
    min-height: 47px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: rgba(143, 154, 170, .08);
    color: var(--accent);
    text-align: center;
    text-decoration: none;
}
.quick-actions .primary-action, .support-button { border-color: transparent; background: var(--accent); color: #071116; font-weight: 700; }
.profile-card { display: flex; align-items: center; gap: 14px; }
.profile-card h2 { margin: 0; }
.info-list { display: grid; gap: 15px; padding: 14px 0; }
.info-list strong { font-size: 14px; }
.support-button { display: block; margin-top: 18px; }
details { margin-bottom: 9px; padding: 15px 17px; border-radius: 20px; }
summary { cursor: pointer; font-weight: 650; }
details p { margin: 10px 0 0; font-size: 13px; }
.instructions ol { margin: 12px 0 0; padding-left: 20px; }
.instructions li + li { margin-top: 8px; }
.subscription-warning { margin-top: 12px; padding: 13px 15px; border: 1px solid rgba(250, 204, 21, .28); border-radius: 16px; background: rgba(250, 204, 21, .06); }
.empty-state { padding: 54px 20px; text-align: center; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: var(--card);
    color: var(--text);
    font-size: 40px;
    box-shadow: var(--shadow);
}
.empty-state p { max-width: 280px; margin: auto; }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3, 7, 12, .72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.modal {
    position: relative;
    width: min(100%, 340px);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: rgba(23, 30, 40, .96);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    text-align: center;
    -webkit-backdrop-filter: blur(30px) saturate(1.15);
    backdrop-filter: blur(30px) saturate(1.15);
}
.modal-close { position: absolute; top: 9px; right: 12px; border: 0; background: none; color: var(--hint); font-size: 28px; }
.qr-placeholder { display: grid; place-items: center; width: 190px; min-height: 190px; margin: 18px auto; padding: 10px; border-radius: 22px; background: #fff; }
.qr-placeholder img { display: block; width: 170px; height: 170px; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media (max-width: 420px) {
    .brand-block > div { display: none; }
    .brand-logo { width: 48px; height: 48px; border-radius: 15px; }
    .account-actions { min-width: 0; }
    .plans-grid { grid-template-columns: 1fr; }
    .plan-card { min-height: 92px; grid-template-columns: 1fr auto; align-items: center; }
    .plan-card small { grid-column: 1 / -1; }
    .hit-badge { top: 12px; }
}
