/* ============================================================
   vynexONE web — palette из TMA, layout: mobile + desktop sidebar.
   ============================================================ */
:root {
    --gradient: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --bg: #0f1015;
    --text: #ffffff;
    --muted: rgba(255,255,255,0.6);
    --hint: rgba(255,255,255,0.4);
    --dim: rgba(255,255,255,0.25);
    --accent: #00d2ff;
    --accent-2: #3a7bd5;
    --success: #2dd4bf;
    --warn: #ff4b2b;
    --gold: #ffc300;
    --purple: #966eff;

    --glass-bg: rgba(255,255,255,0.055);
    --glass-border: rgba(255,255,255,0.1);
    --glass-highlight: rgba(255,255,255,0.09);
    --glass-hover-border: rgba(0,210,255,0.45);

    --bridge-bg: linear-gradient(135deg, rgba(0,210,255,0.28) 0%, rgba(58,123,213,0.22) 100%);
    --bridge-border: rgba(0,210,255,0.35);
    --bridge-shadow: rgba(0,210,255,0.2);
    --bridge-blob: rgba(255,255,255,0.14);

    --sidebar-w: 260px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #dce8f5;
        --text: #0f1015;
        --muted: rgba(15,16,21,0.55);
        --hint: rgba(15,16,21,0.4);
        --dim: rgba(15,16,21,0.3);
        --accent: #0077bb;
        --accent-2: #2255bb;
        --glass-bg: rgba(255,255,255,0.6);
        --glass-border: rgba(0,100,180,0.14);
        --glass-highlight: rgba(255,255,255,0.7);
        --bridge-bg: linear-gradient(135deg, #0099cc 0%, #2255bb 100%);
        --bridge-border: rgba(0,120,180,0.6);
        --bridge-shadow: rgba(0,100,160,0.3);
        --bridge-blob: rgba(255,255,255,0.2);
    }
}

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

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* После привязки TG — скрываем все ссылки на sync. */
body.tg-linked [data-route="sync"] { display: none !important; }

/* Админский пункт меню — только для админов.
   Используем !important: .nav-item / .bt-item в этом же файле задают display:flex
   с равной специфичностью, и без !important они выигрывают по source-order. */
.nav-admin { display: none !important; }
body.is-admin .nav-admin { display: flex !important; }
.bt-admin { display: none !important; }
body.is-admin .bt-admin { display: flex !important; }

/* ═══ Layout: sidebar + main + bottom tabs (mobile) ═══ */
.layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100dvh;
    transition: grid-template-columns 0.22s ease;
}
body.sidebar-collapsed .layout { grid-template-columns: 64px 1fr; }
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .sidebar-footer { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 12px 8px; }
body.sidebar-collapsed .logo { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar { padding: 28px 8px 20px; }

.sidebar-toggle {
    position: absolute; top: 18px; right: -12px;
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--bg, #0f1015); color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; z-index: 5;
    transition: transform 0.18s;
}
.sidebar-toggle svg { width: 12px; height: 12px; }
body.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 28px 16px 20px;
    background: rgba(15,16,21,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 24px;
}
@media (prefers-color-scheme: light) {
    .sidebar { background: rgba(245, 248, 252, 0.85); border-right-color: rgba(0,100,180,0.18); }
}
body.theme-light .sidebar { background: rgba(245, 248, 252, 0.85); border-right-color: rgba(0,100,180,0.18); }

.logo { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 700; cursor: pointer; padding: 0 8px; }
.logo svg { width: 28px; height: 28px; color: var(--accent); }
.logo-text { letter-spacing: -0.5px; }
.logo-text span { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    color: var(--muted); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--glass-bg); color: var(--text); }
.nav-item.active { background: var(--glass-bg); color: var(--accent); border: 1px solid var(--glass-hover-border); }
/* Сплошной цвет + opacity на svg — иначе пересечения штрихов темнеют (альфа в --muted). */
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text); opacity: 0.6; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-logout { margin-top: auto; color: var(--hint); }
.nav-logout:hover { color: var(--warn); }

.sidebar-footer { padding: 12px 8px 0; border-top: 1px solid var(--glass-border); font-size: 11px; color: var(--hint); word-break: break-all; }

.main {
    padding: 32px 40px;
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
    display: flex; flex-direction: column; gap: 18px;
}

/* ═══ Bottom tabs — mobile only ═══
   Floating glass-pill в стиле TMA (.tma-bottom-tabs): контейнер плавает над
   контентом с маржинами от краёв, активный таб — glass-highlight подложка. */
.bottom-tabs {
    display: none;
    position: fixed; left: 12px; right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    gap: 4px;
    padding: 4px;
    background: rgba(15,16,21,0.85); backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateZ(0);
}
@media (prefers-color-scheme: light) {
    .bottom-tabs {
        background: rgba(220, 232, 245, 0.92);
        border: 1px solid rgba(0, 100, 180, 0.18);
    }
}
.bt-item {
    flex: 1;
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px;
    border-radius: 16px;
    color: var(--hint); font-size: 10px; font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, background 0.15s;
}
/* Сплошной цвет + opacity на svg — иначе пересечения штрихов темнеют (как в TMA). */
.bt-item svg { width: 20px; height: 20px; color: var(--text); opacity: 0.4; transition: opacity 0.15s; }
.bt-item.active {
    color: var(--text);
    background: var(--glass-highlight);
    box-shadow: inset 0 0 0 1px var(--glass-hover-border);
}
.bt-item.active svg { opacity: 1; }
.bt-logout { color: var(--hint); }
.bt-logout:active { color: var(--warn); }
.bt-more { background: none; border: none; }

/* Кнопка «Ещё» и шит — только на мобиле. На десктопе sidebar заменяет это. */
.bt-more, .bt-sheet { display: none; }

/* На мобиле прячем вторичные пункты (TG, Инфо, Админ, Выйти) из главной полосы —
   они переезжают в bt-sheet, который открывается кнопкой ⋯ Ещё. */
@media (max-width: 880px) {
    .bottom-tabs .bt-secondary { display: none !important; }
    .bt-more { display: flex; }
}

/* ═══ Bottom sheet (mobile overflow menu) ═══ */
.bt-sheet {
    position: fixed; inset: 0; z-index: 60;
    pointer-events: none; opacity: 0;
    transition: opacity 0.18s ease;
}
.bt-sheet.is-open { pointer-events: auto; opacity: 1; display: block; }
.bt-sheet-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.bt-sheet-card {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(15,16,21,0.96);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 18px 18px 0 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bt-sheet.is-open .bt-sheet-card { transform: translateY(0); }
@media (prefers-color-scheme: light) {
    .bt-sheet-card {
        background: rgba(220, 232, 245, 0.97);
        border-top: 1px solid rgba(0, 100, 180, 0.18);
    }
}
/* Хэндл — увеличиваем «hit zone» через padding, чтобы перетаскивать удобнее. */
.bt-sheet-handle {
    width: 100%;
    padding: 12px 0;
    cursor: grab;
    touch-action: none; /* отключаем браузерный pan, ловим pointer-события сами */
    -webkit-user-select: none; user-select: none;
}
.bt-sheet-handle::before {
    content: ""; display: block;
    width: 36px; height: 4px; border-radius: 2px;
    background: var(--glass-border);
    margin: 0 auto 6px;
}
.bt-sheet-handle:active { cursor: grabbing; }
/* Body scroll lock когда шит открыт — иначе фон скроллится за шторкой. */
body.sheet-open { overflow: hidden; }
.bt-sheet-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: 12px;
    color: var(--text); font-size: 15px; font-weight: 500;
    cursor: pointer;
}
.bt-sheet-item:active { background: var(--glass-highlight); }
.bt-sheet-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.bt-sheet-item.bt-logout { color: var(--hint); }
.bt-sheet-item.bt-logout:active { color: var(--warn); }
/* Админ-пункт в шите тоже скрыт для не-админа. */
.bt-sheet-item.bt-admin { display: none; }
body.is-admin .bt-sheet-item.bt-admin { display: flex; }

/* ═══ Mobile breakpoint ═══ */
@media (max-width: 880px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    /* Пилюля-нав плавает (≈64px) + 10px отступ снизу — пуш контента как в TMA. */
    .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 520px; }
    .bottom-tabs { display: flex; }
    /* На мобиле в auth-режиме tabs прячутся, чтоб не мешали кнопке submit. */
    body.auth-mode .bottom-tabs { display: none; }
}

body.auth-mode .layout { grid-template-columns: 1fr; }
body.auth-mode .sidebar { display: none; }
body.auth-mode .main { padding: 32px 20px; max-width: 440px; min-height: 100dvh; justify-content: center; }
body.auth-mode .bottom-tabs { display: none; }

/* ═══ Components ═══ */
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }
.page-subtitle { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    padding: 22px 20px;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: 22px;
    background: linear-gradient(160deg, var(--glass-highlight) 0%, transparent 55%);
    pointer-events: none;
}
.card > * { position: relative; z-index: 1; }

.sub-card {
    background: var(--bridge-bg);
    border-color: var(--bridge-border);
    box-shadow: 0 8px 32px var(--bridge-shadow), inset 0 1px 0 rgba(255,255,255,0.18);
    color: #fff;
}
.sub-card .label {
    font-size: 11px; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(255,255,255,0.75);
}
.sub-card .big { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.sub-card .big .num { font-size: 56px; font-weight: 700; letter-spacing: -2px; line-height: 1; }
.sub-card .big .unit { font-size: 14px; font-weight: 600; opacity: 0.9; }
.sub-card .meta { margin-top: 10px; font-size: 12px; color: rgba(255,255,255,0.7); }

.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-row + .card-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.card-row .k { font-size: 13px; color: var(--muted); }
.card-row .v { font-size: 14px; font-weight: 600; }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 18px; border: 0; border-radius: 16px;
    background: var(--gradient); color: #fff; font-size: 15px; font-weight: 700;
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 6px 24px rgba(0,210,255,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,210,255,0.32); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 16px; border: 1px solid var(--glass-border);
    border-radius: 14px; background: var(--glass-bg); color: var(--text);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--glass-hover-border); }

.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.input-group label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.input-group input {
    padding: 13px 14px; border: 1px solid var(--glass-border); border-radius: 12px;
    background: var(--glass-bg); color: var(--text); font-size: 14px; font-family: inherit;
    transition: border-color 0.15s;
}
.input-group input:focus { outline: none; border-color: var(--glass-hover-border); }
.input-group .hint { font-size: 11px; color: var(--hint); margin-top: 2px; }

.checkbox-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px; border: 1px solid var(--glass-border); border-radius: 12px;
    background: var(--glass-bg); margin: 14px 0;
}
.checkbox-row input { margin-top: 3px; flex-shrink: 0; }
.checkbox-row label { font-size: 13px; color: var(--muted); line-height: 1.5; }

.alert {
    padding: 12px 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.5;
    margin-bottom: 14px;
}
.alert.info { background: rgba(0,210,255,0.08); border: 1px solid rgba(0,210,255,0.25); color: var(--accent); }
.alert.warn { background: rgba(255,75,43,0.08); border: 1px solid rgba(255,75,43,0.3); color: var(--warn); }
.alert.success { background: rgba(45,212,191,0.08); border: 1px solid rgba(45,212,191,0.3); color: var(--success); }
.alert.gold { background: rgba(255,195,0,0.08); border: 1px solid rgba(255,195,0,0.3); color: var(--gold); }

.copy-box {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px; border: 1px solid var(--glass-border); border-radius: 12px;
    background: rgba(0,0,0,0.25); font-family: 'SF Mono', Menlo, monospace; font-size: 12px;
    word-break: break-all; cursor: pointer; transition: border-color 0.15s;
}
.copy-box:hover { border-color: var(--glass-hover-border); }
.copy-box .ic { flex-shrink: 0; opacity: 0.6; }

.qr-wrap {
    display: flex; align-items: center; justify-content: center;
    padding: 18px; background: #fff; border-radius: 16px; margin: 0 auto;
    width: fit-content;
}
.qr-wrap canvas, .qr-wrap img { display: block; }

.code-display {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 22px; font-weight: 700; letter-spacing: 4px;
    text-align: center; padding: 16px;
    background: rgba(0,0,0,0.3); border: 1px dashed var(--glass-hover-border);
    border-radius: 14px; color: var(--accent);
}

.aux-link { font-size: 13px; color: var(--accent); cursor: pointer; }
.aux-link:hover { text-decoration: underline; }

.text-center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }
.hint-text { color: var(--hint); font-size: 12px; line-height: 1.5; }

.spinner {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.06) 100%);
    background-size: 200% 100%;
    animation: sk 1.4s linear infinite;
    border-radius: 8px;
    color: transparent !important;
}
@keyframes sk { 0% { background-position: -100% 0; } 100% { background-position: 100% 0; } }

/* ═══ Toasts ═══ */
.toast-host {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 100; display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 18px; border-radius: 12px;
    background: rgba(15,16,21,0.95); border: 1px solid var(--glass-border);
    color: var(--text); font-size: 13px; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    animation: toast-in 0.25s ease-out;
}
.toast.error { border-color: rgba(255,75,43,0.4); color: var(--warn); }
.toast.success { border-color: rgba(45,212,191,0.4); color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ Auth view ═══ */
.auth-card { padding: 28px 24px; }
.auth-card h1 { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.5px; }
.auth-card .sub { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.auth-switch { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--accent); cursor: pointer; }

/* ═══ Trial banner ═══ */
.trial-banner {
    padding: 16px 18px; border-radius: 16px;
    background: rgba(255,195,0,0.08); border: 1px solid rgba(255,195,0,0.25);
    display: flex; align-items: center; gap: 14px;
}
.trial-banner .ic { color: var(--gold); flex-shrink: 0; }
.trial-banner .ic svg { width: 28px; height: 28px; }
.trial-banner .body { flex: 1; }
.trial-banner .h { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.trial-banner .s { font-size: 12px; color: var(--muted); line-height: 1.4; }

.kill-banner {
    padding: 16px 18px; border-radius: 16px;
    background: rgba(255,75,43,0.1); border: 1px solid rgba(255,75,43,0.4);
}
.kill-banner .h { font-size: 15px; font-weight: 700; color: var(--warn); margin-bottom: 4px; }
.kill-banner .s { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ═══ Announcement banner (admin-published) ═══ */
.announcement {
    padding: 14px 16px; border-radius: 16px;
    background: linear-gradient(135deg, rgba(0,210,255,0.10), rgba(0,210,255,0.04));
    border: 1px solid rgba(0,210,255,0.28);
    display: flex; align-items: flex-start; gap: 12px;
    position: relative;
}
.announcement .ann-body { flex: 1; min-width: 0; }
.announcement .ann-text {
    font-size: 13px; line-height: 1.5; color: var(--text, #fff);
    white-space: pre-wrap; word-break: break-word;
}
.announcement .ann-link {
    display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600;
    color: var(--accent); text-decoration: none;
    padding: 6px 12px; border-radius: 10px;
    background: rgba(0,210,255,0.12); border: 1px solid rgba(0,210,255,0.3);
}
.announcement .ann-link:hover { background: rgba(0,210,255,0.18); }
.announcement .ann-close {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
    border: none; background: rgba(255,255,255,0.06); color: var(--muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background 0.15s, color 0.15s;
}
.announcement .ann-close:hover { background: rgba(255,255,255,0.12); color: var(--text, #fff); }
.announcement .ann-close svg { width: 14px; height: 14px; stroke-width: 2.4; }

/* ═══ Balance card ═══ */
.balance-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.balance-card .label {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--muted);
}
.balance-card .amount { font-size: 30px; font-weight: 700; letter-spacing: -1px; margin-top: 6px; }
.balance-card .topup-mini {
    width: auto; padding: 10px 16px; font-size: 13px;
}

/* ═══ Tile grid (dashboard / TMA-style) ═══ */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.tile {
    display: flex; flex-direction: column; gap: 6px;
    padding: 18px 16px; border-radius: 18px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    cursor: pointer; transition: border-color 0.15s, transform 0.15s;
    color: inherit;
}
.tile:hover { border-color: var(--glass-hover-border); transform: translateY(-1px); }
.tile.disabled { opacity: 0.5; cursor: not-allowed; }
.tile.disabled:hover { border-color: var(--glass-border); transform: none; }
.tile .ic { width: 26px; height: 26px; color: var(--accent); }
.tile .t { font-size: 14px; font-weight: 700; }
.tile .s { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ═══ Plan cards ═══ */
.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan-card {
    padding: 18px 18px 16px;
    border-radius: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.plan-card.popular { border-color: var(--bridge-border); box-shadow: 0 6px 24px var(--bridge-shadow); }
.plan-card .info .name { font-size: 15px; font-weight: 700; }
.plan-card .info .price { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin-top: 2px; }
.plan-card .info .save { font-size: 11px; color: var(--success); font-weight: 700; margin-top: 2px; }
.plan-card .buy-btn {
    width: auto; padding: 12px 18px; font-size: 13px; flex-shrink: 0;
}

/* ═══ Topup amount picker ═══ */
.amount-pick {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 14px;
}
.amount-pick button {
    padding: 12px 8px; border-radius: 12px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    color: var(--text); font-size: 14px; font-weight: 700;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.amount-pick button:hover { border-color: var(--glass-hover-border); }
.amount-pick button.active { border-color: var(--accent); background: rgba(0,210,255,0.12); }

/* ═══ History list ═══ */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.history-row .l .a { font-size: 15px; font-weight: 700; }
/* Цвет суммы зависит от статуса: paid — зелёный, отменённый — серый, ожидающий — золотой. */
.history-row.s-paid .l .a     { color: var(--success); }
.history-row.s-canceled .l .a { color: var(--hint); text-decoration: line-through; }
.history-row.s-pending .l .a  { color: #ffb300; }
.history-row .l .m { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.history-row .r { font-size: 12px; color: var(--muted); }
.history-row.clickable { cursor: pointer; transition: border-color .15s, transform .1s; }
.history-row.clickable:hover { border-color: var(--accent); }
.history-row.clickable:active { transform: scale(0.99); }

.pay-status {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.pay-status.s-paid { background: rgba(86,196,106,0.18); color: #56C46A; }
.pay-status.s-pending { background: rgba(255,179,0,0.18); color: #ffb300; }
.pay-status.s-canceled { background: rgba(180,180,180,0.15); color: #b4b4b4; }

/* Chip-row для пользовательской истории платежей — стиль как в админских чипах. */
.history-row .chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.history-row .chip {
    padding: 3px 8px;
    border-radius: 50px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    display: inline-flex; align-items: center;
}
.history-row .chip.active  { background: rgba(45,212,191,0.15); color: var(--success); border: 1px solid rgba(45,212,191,0.3); }
.history-row .chip.gold    { background: rgba(212,161,58,0.18); color: #d4a13a;        border: 1px solid rgba(212,161,58,0.3); }
.history-row .chip.expired { background: rgba(255,75,43,0.12);  color: var(--warn);    border: 1px solid rgba(255,75,43,0.3); }
.history-row.s-debit .l .a { color: #ff7878; }
/* В payment detail модалке тот же чип, но крупнее. */
.pd-status .chip { padding: 4px 10px; font-size: 10px; }

.pending-pay-card {
    margin-bottom: 14px; padding: 14px 16px; border-radius: 14px;
    background: rgba(255,179,0,0.08); border: 1px solid rgba(255,179,0,0.25);
}
.pp-head {
    display:flex; align-items:center; gap:8px;
    color:#ffb300; font-weight:700; font-size:12px; letter-spacing:0.5px;
    text-transform:uppercase; margin-bottom:10px;
}
.pp-row {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:8px 0; cursor:pointer;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.pp-row:first-of-type { border-top: 0; }
.pp-info .pp-amt { font-size:15px; font-weight:700; }
.pp-info .pp-date { font-size:11px; color: var(--muted); margin-top:2px; }
.pp-btn {
    padding:8px 14px; border-radius:10px; border:0;
    background: var(--accent); color:#fff; font-weight:700; cursor:pointer;
    font-size: 13px;
}

/* Light theme: pending payment card — увеличенная контрастность. */
@media (prefers-color-scheme: light) {
    .pending-pay-card {
        background: rgba(255,160,0,0.18);
        border-color: rgba(200,100,0,0.55);
        box-shadow: 0 1px 4px rgba(180,90,0,0.12);
    }
    .pp-head { color: #8a4a00; }
    .pp-info .pp-amt { color: #2a1a00; }
    .pp-info .pp-date { color: rgba(70,40,0,0.7); }
    .pp-row { border-top-color: rgba(180,100,0,0.18); }
}
.theme-light .pending-pay-card {
    background: rgba(255,160,0,0.18);
    border-color: rgba(200,100,0,0.55);
    box-shadow: 0 1px 4px rgba(180,90,0,0.12);
}
.theme-light .pp-head { color: #8a4a00; }
.theme-light .pp-info .pp-amt { color: #2a1a00; }
.theme-light .pp-info .pp-date { color: rgba(70,40,0,0.7); }
.theme-light .pp-row { border-top-color: rgba(180,100,0,0.18); }

body.pay-detail-lock { overflow: hidden; touch-action: none; }
.pay-detail-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
    display: flex; align-items: flex-end; justify-content: center;
    overscroll-behavior: contain;
    animation: fadeIn 0.18s ease-out;
}
@media (min-width: 700px) {
    .pay-detail-overlay { align-items: center; }
}
.pay-detail-card {
    width: 100%; max-width: 480px;
    background: var(--bg, #131622); color: var(--text, #fff);
    border: 1px solid var(--glass-border);
    border-radius: 18px 18px 0 0;
    padding: 20px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.22s ease-out;
}
@media (min-width: 700px) {
    .pay-detail-card { border-radius: 18px; }
}
.pd-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.pd-title { font-weight: 700; font-size: 15px; }
.pd-close {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
}
.pd-close svg { width: 16px; height: 16px; display:block; }
.pd-amt { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.pd-status { margin-bottom: 16px; }
.pd-rows { display:flex; flex-direction:column; gap:8px; margin-bottom:18px; }
.pd-row { display:flex; justify-content:space-between; gap:12px; font-size:13px; }
.pd-row .k { color: var(--muted); }
.pd-row .v { text-align: right; max-width: 60%; }
.pd-actions { display:flex; flex-direction:column; gap:8px; }
.pd-actions button { width: 100%; }
.pd-cancel { color: #ff6b6b; border-color: rgba(255,107,107,0.4); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.empty {
    padding: 28px 16px; text-align: center;
    color: var(--muted); font-size: 13px;
}

/* Базовый .bt-item уже компактный (как TMA .tbt-item) — отдельный
   мобильный override больше не нужен. */

/* ═══ Admin ═══ */
.admin-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 4px; background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 14px;
}
.admin-tab {
    flex: 1; min-width: 100px;
    padding: 10px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { background: var(--gradient); color: #fff; }

.tile.t-num { padding: 16px 14px; }
.tile .t { font-size: 18px; font-weight: 700; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    cursor: pointer; transition: border-color 0.15s;
}
.user-row:hover { border-color: var(--glass-hover-border); }
.user-row .name { font-size: 14px; font-weight: 700; }
.user-row .m { font-size: 11px; color: var(--muted); margin-top: 2px; }
.user-row .r { font-size: 14px; font-weight: 700; }

.kv {
    display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
    margin: 10px 0 14px;
    font-size: 13px;
}
.kv span { color: var(--muted); }
.kv strong { font-weight: 700; }

.adm-actions { display: flex; flex-direction: column; gap: 10px; }
.adm-row { display: flex; gap: 8px; align-items: stretch; }
.adm-row input {
    flex: 1; padding: 10px 12px; border: 1px solid var(--glass-border); border-radius: 10px;
    background: var(--glass-bg); color: var(--text); font-size: 13px; font-family: inherit;
}
.adm-row input:focus { outline: none; border-color: var(--glass-hover-border); }
.adm-row .btn-ghost { width: auto; padding: 10px 14px; font-size: 13px; flex-shrink: 0; }

.rev-list { display: flex; flex-direction: column; gap: 6px; }
.rev-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--glass-border); font-size: 13px; }
.rev-row:last-child { border-bottom: 0; }
.rev-row .d { color: var(--muted); }
.rev-row .a { font-weight: 700; }

/* ═══ Happ card ═══ */
.happ-card .happ-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.happ-card .happ-ic { width: 26px; height: 26px; color: var(--accent); }
.happ-card .happ-title { font-size: 15px; font-weight: 700; }
.setup-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.setup-steps li { display: flex; gap: 12px; align-items: flex-start; }
.setup-steps .step-num {
    flex-shrink: 0; width: 26px; height: 26px;
    border-radius: 50%; background: var(--gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.setup-steps .step-body { flex: 1; font-size: 13px; }
.setup-steps .step-body strong { font-weight: 700; font-size: 14px; }
.setup-steps .step-desc { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 4px; }
.os-row { display: flex; gap: 8px; margin: 10px 0 6px; align-items: center; }
.os-row select {
    flex: 1; padding: 10px 12px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 10px; color: var(--text); font-size: 13px; font-family: inherit;
}
.os-row select:focus { outline: none; border-color: var(--glass-hover-border); }

/* ═══ Trial highlight (зелёная плитка для тех, кто ещё не брал пробный период) ═══ */
.tile.tile-trial {
    background: linear-gradient(135deg, rgba(45,212,191,0.18), rgba(0,210,255,0.10));
    border-color: rgba(45,212,191,0.45);
    box-shadow: 0 8px 24px rgba(45,212,191,0.18);
    position: relative;
    animation: trial-pulse 2.4s ease-in-out infinite;
}
.tile.tile-trial .ic { color: var(--success); }
.tile.tile-trial .t { color: var(--success); }
.tile.tile-trial .s { color: var(--text); font-weight: 700; }
.tile.tile-trial::after {
    content: '7 дней';
    position: absolute; top: 8px; right: 8px;
    background: var(--success); color: #07140f;
    font-size: 10px; font-weight: 800;
    padding: 3px 8px; border-radius: 50px; letter-spacing: 0.4px;
}
@keyframes trial-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(45,212,191,0.18); }
    50%      { box-shadow: 0 8px 32px rgba(45,212,191,0.45); }
}
@media (prefers-color-scheme: light) {
    .tile.tile-trial {
        background: linear-gradient(135deg, #1aaa92 0%, #0e7a6a 100%);
        border-color: #0e7a6a;
        box-shadow: 0 8px 24px rgba(14,122,106,0.35);
    }
    .tile.tile-trial .ic, .tile.tile-trial .t, .tile.tile-trial .s { color: #fff; }
    .tile.tile-trial::after { background: #fff; color: #0e7a6a; }
}

/* Отдельная зелёная CTA-кнопка пробного периода (на дашборде / в тарифах). */
.btn-trial-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 18px; border: 0; border-radius: 14px;
    background: linear-gradient(135deg, #2dd4bf 0%, #0e9485 100%);
    color: #fff; font-size: 14px; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 6px 22px rgba(45,212,191,0.3);
}
.btn-trial-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(45,212,191,0.42); }
.btn-trial-cta:active { transform: translateY(0); }
.btn-trial-cta:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Кнопка вывода партнёрам — мягкий зелёный outline стиль (как в TMA). */
.btn-primary.btn-trial-style {
    background: var(--glass-bg);
    color: var(--success);
    border: 1px solid var(--success);
    box-shadow: 0 4px 16px rgba(45,212,191,0.12);
}
.btn-primary.btn-trial-style:hover {
    background: rgba(45,212,191,0.16);
    box-shadow: 0 8px 28px rgba(45,212,191,0.22);
}

/* Карточка-CTA для пробного периода на странице тарифов. */
.trial-cta-card {
    border-color: rgba(45,212,191,0.4);
    background: linear-gradient(135deg, rgba(45,212,191,0.12), rgba(0,210,255,0.06));
    position: relative;
}
.trial-cta-badge {
    position: absolute; top: 14px; right: 16px;
    background: var(--success); color: #07140f;
    font-size: 10px; font-weight: 800;
    padding: 4px 10px; border-radius: 50px; letter-spacing: 0.5px;
    z-index: 2;
}

/* ═══ Payout view ═══ */
.payout-row .payout-status { font-size: 12px; font-weight: 700; }
.payout-status.s-pending  { color: var(--gold); }
.payout-status.s-paid     { color: var(--success); }
.payout-status.s-rejected { color: var(--warn); }

/* ═══ Onboarding modal ═══ */
body.onb-lock { overflow: hidden; touch-action: none; }
.onb-overlay {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; overflow-y: auto;
    overscroll-behavior: contain;
    animation: onb-in 0.2s ease-out;
}
@keyframes onb-in { from { opacity: 0; } to { opacity: 1; } }
.onb-card {
    width: 100%; max-width: 480px;
    background: var(--bg); border: 1px solid var(--glass-border);
    border-radius: 22px; padding: 24px 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    max-height: calc(100dvh - 40px); overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.onb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.onb-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.onb-close {
    width: 32px; height: 32px; padding: 0; border-radius: 50%;
    border: 1px solid var(--glass-border); background: var(--glass-bg);
    color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
}
.onb-close svg { width: 14px; height: 14px; display: block; }
.onb-close:hover { border-color: var(--glass-hover-border); }
.onb-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.onb-steps li { display: flex; gap: 12px; align-items: flex-start; }
.onb-num {
    flex-shrink: 0; width: 28px; height: 28px;
    border-radius: 50%; background: var(--gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.onb-steps strong { font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.onb-check { width: 14px; height: 14px; color: var(--success); flex-shrink: 0; }
.onb-d { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 3px; }
.onb-actions { display: flex; gap: 10px; margin-top: 18px; }
.onb-actions > * { flex: 1; }

/* Реф-программа: код, ссылки, статсы, список рефералов. */
.ref-code-row, .ref-link-row {
    display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
.ref-code {
    display: inline-block; padding: 8px 14px;
    background: rgba(0,210,255,0.10); border: 1px solid rgba(0,210,255,0.25);
    border-radius: 10px; font-size: 18px; font-weight: 700;
    letter-spacing: 1px; color: var(--accent); flex: 1; text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ref-link {
    flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    color: inherit; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-overflow: ellipsis;
}
.ref-copy-icon {
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--accent);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.ref-copy-icon:hover { background: rgba(0,210,255,0.10); border-color: var(--glass-hover-border); }
.ref-copy-icon:active { transform: scale(0.95); }
.ref-copy-icon svg { width: 18px; height: 18px; }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.ref-stats .stat .big { font-size: 24px; font-weight: 700; }
.ref-stats .stat .unit { font-size: 14px; color: var(--muted); margin-left: 4px; }
.ref-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ref-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-radius: 10px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.ref-label { font-size: 13px; }
.ref-earn { font-weight: 700; color: var(--success); }

/* ═══ VPN: ряд селекторов (приложение + ОС) + лого в кнопке подключения ═══ */
.os-row { flex-wrap: wrap; }
.os-row select { flex: 1 1 40%; min-width: 0; }
.vpn-conn-ic { display: inline-flex; align-items: center; justify-content: center; }
.vpn-conn-ic svg { height: 18px; width: auto; max-width: 62px; display: block; }

/* ═══ Referral withdrawal progress ═══ */
.ref-progress { padding: 11px 13px; }
.ref-progress .rp-head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:6px; }
.ref-progress .rp-title { font-size:12px; color:var(--hint, #8e93a3); }
.ref-progress .rp-text { font-weight:700; font-size:13px; font-variant-numeric:tabular-nums; }
.ref-progress .rp-bar { height:6px; border-radius:5px; background:rgba(255,255,255,.08); overflow:hidden; }
.ref-progress .rp-fill { height:100%; border-radius:5px; width:0; background:linear-gradient(90deg,#6c8cff,#00d2ff); transition:width .45s ease; }
.ref-progress .rp-fill.full { background:linear-gradient(90deg,#22c55e,#16a34a); }
.ref-progress .rp-hint { margin-top:6px; font-size:11px; color:var(--hint, #8e93a3); line-height:1.45; }
