/* ── reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0c0e14;
    --surface: #151821;
    --surface-hover: #1c2030;
    --border: #252a3a;
    --text: #e4e6f0;
    --text-muted: #7b809a;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --green: #00d68f;
    --red: #ff5c72;
    --radius: 14px;
    --radius-sm: 10px;
}

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ── layout ────────────────────────────────────────────── */
.container {
    max-width: 440px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.header {
    text-align: center;
    padding: 8px 0 24px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.logo-text span {
    color: var(--accent);
}
.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

/* ── cards ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

/* ── info card ─────────────────────────────────────────── */
.info-card { position: relative; }

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-badge.active { background: rgba(0,214,143,0.15); color: var(--green); }
.status-badge.expired { background: rgba(255,92,114,0.15); color: var(--red); }

.sub-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 12px 0 16px;
    word-break: break-all;
}

.sub-details { display: flex; flex-direction: column; gap: 8px; }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label { color: var(--text-muted); font-size: 0.9rem; }
.detail-value { font-weight: 500; font-size: 0.9rem; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ── section title ─────────────────────────────────────── */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.section-head .section-title {
    margin-bottom: 0;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(123, 128, 154, 0.18);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.section-badge-accent {
    background: rgba(108,92,231,0.16);
    color: #b4aaff;
}

.section-note {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
    margin-bottom: 14px;
}

.section-note-warning {
    color: #f2b36c;
    margin-bottom: 0;
}

.section-note-warning + .btn-pay {
    margin-top: 14px;
}

/* ── tariffs ───────────────────────────────────────────── */
.tariffs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tariff-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 8px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    font-family: inherit;
}
.tariff-btn:hover { background: var(--surface-hover); }
.tariff-btn.selected {
    border-color: var(--accent);
    background: rgba(108,92,231,0.08);
}

.tariff-period { font-size: 0.85rem; color: var(--text-muted); }
.tariff-price { font-size: 1.2rem; font-weight: 700; }
.tariff-old-price {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 4px;
}

.tariff-savings {
    position: absolute;
    top: -8px;
    right: -6px;
    background: var(--green);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
}

/* ── WL options ───────────────────────────────────────── */
.option-grid {
    display: grid;
    gap: 10px;
}

.wl-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    -webkit-user-select: none;
    user-select: none;
    font-family: inherit;
    text-align: left;
}
.wl-option-btn:hover { background: var(--surface-hover); }
.wl-option-btn.selected {
    border-color: var(--accent);
    background: rgba(108,92,231,0.08);
}
.wl-icon { font-size: 1.25rem; flex-shrink: 0; }
.wl-option-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wl-title { font-weight: 600; font-size: 0.85rem; }
.wl-desc { font-size: 0.75rem; color: var(--text-muted); }
.wl-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-disabled {
    opacity: 0.72;
}

.card-disabled .wl-option-btn {
    cursor: not-allowed;
    opacity: 0.6;
}

.card-disabled .wl-option-btn:hover {
    background: var(--bg);
    border-color: var(--border);
}

/* ── providers ─────────────────────────────────────────── */
.providers-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.provider-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    font-family: inherit;
    font-size: 0.95rem;
}
.provider-btn:hover { background: var(--surface-hover); }
.provider-btn.selected {
    border-color: var(--accent);
    background: rgba(108,92,231,0.08);
}

.provider-icon { font-size: 1.3rem; }
.provider-label { font-weight: 500; }

.provider-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ── confirm ───────────────────────────────────────────── */
.confirm-summary {
    text-align: center;
    margin-bottom: 14px;
    font-size: 1rem;
    color: var(--text-muted);
}
.confirm-summary strong { color: var(--text); }

.confirm-title {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 4px;
}

.confirm-details {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.btn-pay {
    display: block;
    width: 100%;
    text-align: center;
    padding: 16px;
    background: var(--accent);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, opacity .2s;
    font-family: inherit;
}
.btn-pay:hover:not(:disabled) { background: var(--accent-hover); }
.btn-pay:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    background: var(--surface-hover);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background .2s;
    margin-top: 12px;
}
.btn-secondary:hover { background: var(--border); }

.error-msg {
    margin-top: 10px;
    color: var(--red);
    font-size: 0.85rem;
    text-align: center;
}

/* ── waiting page ──────────────────────────────────────── */
.waiting-card { text-align: center; padding: 32px 20px; }
.waiting-card h2 { margin: 16px 0 8px; }
.waiting-details { color: var(--text-muted); font-size: 0.95rem; }
.waiting-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 16px; }

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width .4s ease;
}

/* ── success page ──────────────────────────────────────── */
.success-card { text-align: center; padding: 32px 20px; }
.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0,214,143,0.15);
    color: var(--green);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.success-card h2 { margin-bottom: 12px; }
.success-details { color: var(--text-muted); line-height: 1.6; }
.success-details strong { color: var(--text); }
.success-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 16px; }

/* ── footer ────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 24px 0 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}
.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color .2s;
}
.footer-links a:hover {
    color: var(--accent);
}

/* ── utility ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── onboarding / account ──────────────────────────────── */
.landing-body {
    background:
        radial-gradient(circle at top, rgba(108,92,231,0.18), transparent 28%),
        var(--bg);
}

.page-shell {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 56px;
}

.account-hero {
    background: linear-gradient(180deg, rgba(21,24,33,0.96), rgba(13,15,22,0.98));
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero-top {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.hero-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    flex-shrink: 0;
}

.eyebrow {
    color: #b4aaff;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.account-hero h1 {
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 10px;
}

.hero-subtitle {
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 720px;
}

.auth-form,
.logout-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.text-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(12,14,20,0.9);
    color: var(--text);
    font: inherit;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.16);
}

.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.primary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.primary-btn-wide {
    width: 100%;
}

.secondary-link {
    color: var(--text-muted);
    text-decoration: none;
}

.secondary-link:hover {
    color: var(--text);
}

.secondary-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.feature-card,
.card-block,
.summary-card,
.plan-section {
    background: rgba(12,14,20,0.72);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.feature-card h3,
.card-block h3,
.summary-card h3 {
    margin-bottom: 8px;
}

.feature-card p,
.card-block p {
    color: var(--text-muted);
    line-height: 1.5;
}

.summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.summary-total {
    font-size: 1.6rem;
    font-weight: 700;
    white-space: nowrap;
}

.summary-note {
    color: var(--text-muted);
    line-height: 1.5;
}

.providers-list {
    display: grid;
    gap: 10px;
}

.provider-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(12,14,20,0.72);
    border: 1px solid var(--border);
    cursor: pointer;
}

.provider-item input {
    accent-color: var(--accent);
}

.form-note {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.form-note-error {
    background: rgba(255,92,114,0.14);
    color: #ffc2cb;
}

.form-note-success {
    background: rgba(0,214,143,0.14);
    color: #8ff2cb;
}

.onboarding-input-note {
    margin-top: 10px;
    margin-bottom: 0;
}

.onboarding-home-error {
    margin-top: 12px;
}

.onboarding-top-warning {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(242, 179, 108, 0.12);
    border: 1px solid rgba(242, 179, 108, 0.24);
}

.telegram-bind-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(12,14,20,0.72);
    border: 1px solid var(--border);
}

.telegram-bind-status {
    margin-top: 4px;
    font-weight: 700;
}

.telegram-bind-status.is-bound {
    color: var(--green);
}

.telegram-bind-status.is-unbound {
    color: #f2b36c;
}

.telegram-bind-btn {
    width: auto;
    min-width: 172px;
    margin-top: 0;
    white-space: nowrap;
}

.setup-card {
    border-color: rgba(108,92,231,0.42);
    background:
        linear-gradient(180deg, rgba(108,92,231,0.13), rgba(21,24,33,0.98)),
        var(--surface);
    box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}

.setup-card .section-title {
    font-size: 1.1rem;
}

.setup-card .section-note {
    color: #b8bdd4;
}

.tariff-btn.is-active,
.wl-option-btn.is-active {
    border-color: var(--accent);
    background: rgba(108,92,231,0.08);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-all;
}

@media (max-width: 720px) {
    .account-hero {
        padding: 20px;
        border-radius: 18px;
    }

    .hero-top {
        flex-direction: column;
    }

    .account-hero h1 {
        font-size: 1.6rem;
    }

    .summary-card {
        flex-direction: column;
        align-items: flex-start;
    }
}
