:root {
    --bg: #050308;
    --bg-card: #120e1c;
    --bg-card-hover: #1a1428;
    --border: #2a2140;
    --text: #f0edf7;
    --text-dim: #9791ae;
    --accent: #9d5cff;
    --accent-hover: #b47bff;
    --accent-glow: rgba(157, 92, 255, 0.45);
    --green: #2ecc71;
    --red: #e74c3c;
    --yellow: #f1c40f;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    background: var(--bg);
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

#bg-fx {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    display: block;
}

.topbar, .landing-topbar, .container {
    position: relative;
    z-index: 1;
}

a { color: inherit; text-decoration: none; }

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 100px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.topbar .brand {
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .logout {
    color: var(--text-dim);
    font-size: 14px;
}

/* --- Нижняя нав-панель (мобильное приложение) --- */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 640px;
    margin: 0 auto;
    background: rgba(10, 7, 16, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 4px 2px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.bottom-nav-item .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.bottom-nav-item.active { color: var(--text); }

.bottom-nav-item.active .nav-icon {
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
    color: #fff;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: rgba(157, 92, 255, 0.35);
    box-shadow: 0 0 26px rgba(157, 92, 255, 0.10);
}

.card h2, .card h3 {
    margin-top: 0;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}

.stat .stat-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(157, 92, 255, 0.15);
    color: var(--accent-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.stat .label {
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat .value {
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 16px var(--accent-glow);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 26px var(--accent-glow);
    transform: translateY(-1px);
}

.btn.secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
}

.btn.secondary:hover {
    border-color: rgba(157, 92, 255, 0.5);
    box-shadow: 0 0 16px rgba(157, 92, 255, 0.18);
}

.btn.danger {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    box-shadow: none;
}

.btn.danger:hover {
    background: rgba(231, 76, 60, 0.1);
    box-shadow: 0 0 16px rgba(231, 76, 60, 0.25);
}

.btn-row { display: flex; flex-direction: column; gap: 10px; }
.btn-row.horizontal { flex-direction: row; align-items: center; }
.btn-row.horizontal input { flex: 1; margin-bottom: 0; }

.tariff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.tariff-option {
    display: block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tariff-option input { display: none; }

.tariff-option.selected, .tariff-option:has(input:checked) {
    border-color: var(--accent);
    background: rgba(157, 92, 255, 0.12);
    box-shadow: 0 0 18px rgba(157, 92, 255, 0.22);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge.ok { background: rgba(46, 204, 113, 0.15); color: var(--green); }
.badge.warn { background: rgba(231, 76, 60, 0.15); color: var(--red); }

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.device-item:last-child { border-bottom: none; }

.device-item .meta { color: var(--text-dim); font-size: 13px; }

select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    margin-bottom: 14px;
}

input[type=text], input[type=number], input[type=password], textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    margin-bottom: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { min-height: 90px; resize: vertical; }

select:focus,
input[type=text]:focus,
input[type=number]:focus,
input[type=password]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(157, 92, 255, 0.18);
}

.muted { color: var(--text-dim); font-size: 13px; }

.telegram-login-wrap {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

/* --- Страницы входа / регистрации --- */
.auth-wrap {
    max-width: 440px;
    margin: 40px auto 0;
}

.auth-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 34px 30px;
    text-align: left;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: -70px;
    right: -70px;
    width: 220px;
    height: 220px;
    background: radial-gradient(closest-side, rgba(157, 92, 255, 0.20), transparent 70%);
    pointer-events: none;
}

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 18px;
}

.auth-card h2 { margin: 0 0 8px; font-size: 23px; }
.auth-card > p.muted { margin: 0 0 26px; }

.auth-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.auth-checklist li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13.5px;
    color: var(--text-dim);
}

.auth-checklist .check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(46, 204, 113, 0.15);
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-checklist b { color: var(--text); }

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.field input { margin-bottom: 0; }

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
}
.remember-row input { width: auto; margin: 0; }

.btn-arrow { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.auth-switch { text-align: center; margin: 18px 0 0; }
.auth-switch a { color: var(--accent-hover); font-weight: 600; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 26px 0 4px;
    color: var(--text-dim);
    font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash.error { background: rgba(231, 76, 60, 0.15); color: var(--red); }
.flash.success { background: rgba(46, 204, 113, 0.15); color: var(--green); }

.nav-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.nav-tabs a {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 14px;
    white-space: nowrap;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.nav-tabs a.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }

code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 13px;
    word-break: break-all;
}

/* --- Лендинг --- */
.landing-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.landing-topbar .brand {
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.landing-topbar .nav-actions { display: flex; gap: 10px; }
.landing-topbar .nav-actions a.btn { width: auto; padding: 9px 16px; font-size: 14px; }

.landing-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.hero {
    text-align: center;
    padding: 60px 16px 40px;
}

.hero h1 {
    font-size: 40px;
    margin: 0 0 16px;
    line-height: 1.2;
}

.hero p {
    color: var(--text-dim);
    font-size: 17px;
    max-width: 560px;
    margin: 0 auto 28px;
}

.hero .btn { width: auto; padding: 14px 32px; font-size: 16px; display: inline-flex; }

.section-title {
    text-align: center;
    font-size: 26px;
    margin: 60px 0 28px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
}

.feature-card .icon { font-size: 28px; margin-bottom: 10px; }
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { color: var(--text-dim); font-size: 14px; margin: 0; }
.feature-card { transition: transform 0.15s ease, border-color 0.15s ease; }
.feature-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 14px;
}
.icon-badge.badge-yellow { background: rgba(241, 196, 15, 0.15); }
.icon-badge.badge-green  { background: rgba(46, 204, 113, 0.15); }
.icon-badge.badge-purple { background: rgba(157, 92, 255, 0.15); }

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pricing-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.pricing-card:hover { transform: translateY(-4px); }

.pricing-card.featured {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(157, 92, 255, 0.12), var(--bg-card) 60%);
    box-shadow: 0 0 30px rgba(157, 92, 255, 0.18);
}

.pricing-card.featured::before {
    content: "★ Популярный выбор";
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.pricing-card h3 { margin: 0 0 4px; font-size: 20px; }
.pricing-card .price { font-size: 32px; font-weight: 700; margin: 12px 0 2px; }
.pricing-card .price span { font-size: 14px; color: var(--text-dim); font-weight: 400; }
.pricing-card .from { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }

/* --- Hero: бейдж, свечение, градиентный акцент --- */
.hero { position: relative; overflow: visible; }

.hero::before {
    content: "";
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 620px;
    height: 420px;
    max-width: 100vw;
    background: radial-gradient(closest-side, rgba(157, 92, 255, 0.28), transparent 72%);
    z-index: -1;
    pointer-events: none;
}

.hero h1 .accent-text {
    background: linear-gradient(135deg, var(--accent-hover), #a78bfa 60%, #d6cbfb);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-cta-pill {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 8px 8px 8px 20px;
    border-radius: 999px;
    background: rgba(157, 92, 255, 0.12);
    border: 1px solid rgba(157, 92, 255, 0.4);
    margin-top: 8px;
}

.hero-cta-pill .gift-text {
    color: #b3a6f7;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.hero-cta-pill .btn {
    width: auto;
    padding: 10px 22px;
    font-size: 14px;
}

.telegram-section {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

/* --- Плавающие декоративные кристаллы (SVG, без картинок) --- */
.crystal {
    position: absolute;
    pointer-events: none;
    filter: drop-shadow(0 0 14px rgba(157, 92, 255, 0.35));
    z-index: 0;
}

.hero, .telegram-section { isolation: isolate; }
.hero > *:not(.crystal), .telegram-section > *:not(.crystal) { position: relative; z-index: 1; }

.crystal-a { width: 44px; height: 44px; top: -6px; left: 2%; opacity: 0.45; }
.crystal-b { width: 128px; height: 128px; top: -34px; right: -10px; opacity: 0.9; }
.crystal-c { width: 150px; height: 150px; bottom: -50px; left: -60px; opacity: 0.55; }
.crystal-sparkle { width: 22px; height: 22px; bottom: 6px; right: 8%; opacity: 0.8; }

@media (prefers-reduced-motion: no-preference) {
    .crystal-a { animation: crystal-float 8s ease-in-out infinite; }
    .crystal-b { animation: crystal-float 9.5s ease-in-out infinite 0.4s; }
    .crystal-c { animation: crystal-float 11s ease-in-out infinite 0.8s; }
    .crystal-sparkle { animation: sparkle-pulse 2.6s ease-in-out infinite; }
}

@keyframes crystal-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-16px) rotate(5deg); }
}

@keyframes sparkle-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.15) rotate(12deg); }
}

@media (max-width: 720px) {
    .crystal-b { width: 80px; height: 80px; top: -20px; right: -14px; }
    .crystal-c { width: 100px; height: 100px; bottom: -30px; left: -36px; }
    .crystal-a { display: none; }
}

/* --- Карточка "Мы в Telegram" --- */
.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(42, 171, 238, 0.12), var(--bg-card) 70%);
    border: 1px solid rgba(42, 171, 238, 0.35);
    border-radius: var(--radius);
    padding: 16px 20px;
    max-width: 380px;
    width: 100%;
    text-align: left;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.contact-card:hover {
    transform: translateY(-2px);
    border-color: rgba(42, 171, 238, 0.7);
}
.contact-card .contact-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2AABEE, #229ED9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
}
.contact-card .contact-text { flex: 1; }
.contact-card .contact-text .title { font-weight: 700; font-size: 15px; }
.contact-card .contact-text .subtitle { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.contact-card .contact-arrow { color: var(--text-dim); font-size: 20px; }

.landing-topbar {
    border-bottom: 1px solid var(--border);
}

.landing-footer {
    margin-top: 70px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

.landing-footer .footer-links { margin-bottom: 10px; }
.landing-footer .footer-links a { margin: 0 8px; color: var(--text); }

@media (max-width: 480px) {
    .hero-cta-pill {
        flex-direction: column;
        gap: 10px;
        padding: 16px 20px;
        border-radius: var(--radius);
    }
    .hero-cta-pill .btn { width: 100%; }
}

@media (max-width: 720px) {
    .hero h1 { font-size: 28px; }
    .features-grid, .pricing-grid { grid-template-columns: 1fr; }
    .landing-topbar .nav-actions .btn span { display: none; }
}
