*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f13;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px 16px 60px;
}

.container {
    max-width: 680px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0 32px;
}
.logo {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}
.subtitle {
    color: #888;
    margin-top: 6px;
    font-size: 0.95rem;
}

/* Plans */
.plans-section h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #fff;
}
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.plan-card {
    background: #1a1a24;
    border: 2px solid #2a2a38;
    border-radius: 14px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .18s, transform .18s;
}
.plan-card:hover {
    border-color: #5b6af0;
    transform: translateY(-2px);
}
.plan-card.selected {
    border-color: #5b6af0;
    background: #1e1e30;
}
.plan-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
}
.plan-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #5b6af0;
    margin-bottom: 4px;
}
.plan-duration {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 6px;
}
.plan-protocol {
    display: inline-block;
    font-size: 0.7rem;
    background: #2a2a38;
    color: #888;
    border-radius: 4px;
    padding: 2px 8px;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn-buy {
    background: #5b6af0;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, transform .18s;
}
.btn-buy:hover { background: #4a59df; transform: translateY(-1px); }
.btn-buy:active { transform: translateY(0); }
.btn-buy:disabled { background: #444; cursor: default; transform: none; }

.btn-copy {
    margin-top: 12px;
    background: #2a2a38;
    color: #c0c0d0;
    border: 1px solid #3a3a50;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background .15s;
    width: 100%;
}
.btn-copy:hover { background: #35354a; }

.btn-tg {
    display: inline-block;
    margin-top: 16px;
    background: #229ed9;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    padding: 12px 28px;
    font-weight: 600;
    transition: background .18s;
}
.btn-tg:hover { background: #1a8bbf; }

.btn-back {
    display: inline-block;
    margin-top: 16px;
    color: #5b6af0;
    text-decoration: none;
    font-size: 0.95rem;
}

/* Order block */
.order-block {
    background: #1a1a24;
    border: 1px solid #2a2a38;
    border-radius: 16px;
    padding: 36px 28px;
    text-align: center;
}

/* Success */
.status-done .status-icon { font-size: 3rem; margin-bottom: 12px; }
.status-done h2 { font-size: 1.5rem; color: #fff; margin-bottom: 8px; }
.expires { color: #aaa; margin-bottom: 20px; font-size: 0.9rem; }

.config-box {
    background: #0f0f18;
    border: 1px solid #2a2a38;
    border-radius: 10px;
    padding: 16px;
    text-align: left;
    margin-bottom: 20px;
}
.config-box pre {
    font-size: 0.78rem;
    color: #a0f0c0;
    word-break: break-all;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}
.tg-link p { color: #aaa; font-size: 0.9rem; }

/* Waiting */
.status-waiting { padding: 20px 0; }
.status-waiting h2 { color: #fff; font-size: 1.3rem; margin: 20px 0 8px; }
.status-waiting p { color: #888; font-size: 0.9rem; margin-bottom: 6px; }
.token-hint { margin-top: 16px !important; font-size: 0.8rem !important; }
.token-hint code {
    background: #2a2a38;
    padding: 2px 8px;
    border-radius: 4px;
    color: #c0c0d0;
}

.spinner {
    width: 48px; height: 48px;
    border: 4px solid #2a2a38;
    border-top-color: #5b6af0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.status-error .status-icon { font-size: 3rem; margin-bottom: 12px; }
.status-error h2 { color: #fff; margin-bottom: 8px; }
.status-error p { color: #aaa; font-size: 0.9rem; margin-bottom: 4px; }

/* Misc */
.no-plans { text-align: center; color: #666; margin-top: 20px; }
.error-msg {
    color: #e06060;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    background: #2a1a1a;
    border-radius: 8px;
}

/* ── Auth styles ─────────────────────────────────────────────────────────── */
.auth-form { background: #1a1a24; border: 1px solid #2a2a38; border-radius: 16px; padding: 36px 28px; max-width: 420px; margin: 0 auto; }
.auth-form h2 { color: #fff; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; color: #aaa; font-size: 0.9rem; margin-bottom: 6px; }
.form-group input { width: 100%; background: #0f0f18; border: 1px solid #2a2a38; border-radius: 8px; padding: 12px 14px; color: #e0e0e0; font-size: 0.95rem; outline: none; transition: border-color .15s; }
.form-group input:focus { border-color: #5b6af0; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.9rem; color: #888; }
.auth-links a { color: #5b6af0; text-decoration: none; }
.flash-error { background: #2a1a1a; border: 1px solid #5a2a2a; color: #e06060; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.flash-success { background: #1a2a1a; border: 1px solid #2a5a2a; color: #60e060; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.auth-header { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0; font-size: 0.9rem; }
.auth-header a { color: #5b6af0; text-decoration: none; }
.auth-header span { color: #888; }
.user-orders { margin-top: 40px; }
.user-orders h3 { color: #fff; font-size: 1.1rem; margin-bottom: 14px; }
.order-row { background: #1a1a24; border: 1px solid #2a2a38; border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.order-row a { color: #5b6af0; text-decoration: none; font-size: 0.9rem; }

.auth-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    padding: 10px 0 0;
    font-size: 0.82rem;
}
.auth-header a { color: #5b6af0; text-decoration: none; }
.auth-header a:hover { text-decoration: underline; }
.auth-email { color: #666; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }