/* =====================================================================
   TGRank — «Table Pro» (02.11.2026): новая цветовая гамма таблиц каналов
   (главная, каталог, кабинет/избранное). Размеры и отступы НЕ меняются — только цвета,
   шапка, наведение, тарифные и ТОП-строки. Подключается последним (layout_assets.php, index.php).
   ===================================================================== */
:root {
    --tp-ink: #0b1626;
    --tp-mint: #10b981;
    --tp-cyan: #22d3ee;
    --tp-line: #edf1f6;
}

@media (min-width: 993px) {
    /* ---------- Шапка: «северное сияние» — фирменный перелив (фиолет → лагуна → изумруд → лайм),
       медленно течёт; поверх — созвездия (mesh), стеклянный блик и светящаяся кромка ---------- */
    html body:not(#tpx) .tbl-head, html body:not(#tpx) .tbl-head.grid-all,
    html:not([data-theme="dark"]) body:not(#tpx) .tbl-head, html[data-theme="dark"] body:not(#tpx) .tbl-head {
        position: relative;
        background-image:
            var(--tg-cosmic-mesh, linear-gradient(transparent, transparent)),
            linear-gradient(180deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.04) 48%, rgba(0,0,0,.06) 100%),
            radial-gradient(60% 160% at 12% 0%, rgba(255,255,255,.22) 0%, transparent 60%),
            linear-gradient(100deg, #4a12c9 0%, #2b46d6 14%, #0b86b8 30%, #08a39a 46%, #02b67a 62%, #2bd86a 78%, #7cff5a 90%, #2bd86a 100%) !important;
        background-size: 190px 180px, 100% 100%, 100% 100%, 260% 100% !important;
        background-repeat: repeat, no-repeat, no-repeat, no-repeat !important;
        animation: tpAurora 16s ease-in-out infinite alternate;
        color: #ffffff !important;
        font-weight: 800 !important;
        letter-spacing: .05em !important; white-space: nowrap;
        text-shadow: 0 1px 2px rgba(4,30,45,.35) !important;
        border-bottom: 0 !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -1px 0 rgba(255,255,255,.12), 0 12px 26px -16px rgba(8,120,110,.55) !important;
    }
    @keyframes tpAurora {
        0%   { background-position: 0 0, 0 0, 0 0, 0% 50%; }
        100% { background-position: 0 0, 0 0, 0 0, 100% 50%; }
    }
    html body:not(#tpx) .tbl-head::after {
        content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
        background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.9) 30%, #b9fff0 60%, transparent 100%);
        box-shadow: 0 0 12px rgba(185,255,240,.8);
        opacity: .85;
    }
    html body:not(#tpx) .tbl-head a, html body:not(#tpx) .tbl-head .sort-link { color: #ffffff !important; transition: opacity .18s, background .18s; }
    html body:not(#tpx) .tbl-head .sort-link:hover { opacity: .85; }
    html body:not(#tpx) .tbl-head .sort-arrow-default { opacity: 0 !important; transition: opacity .18s; }
    html body:not(#tpx) .tbl-head span:hover .sort-arrow-default { opacity: .8 !important; }
    html body:not(#tpx) .tbl-head .sort-link:has(.sort-arrow-active) {
        background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 8px; margin: -3px -8px;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
    }
    html body:not(#tpx) .tbl-head .sort-arrow-active { color: #ffffff !important; opacity: 1 !important; }
    html body:not(#tpx) .tbl-head span, html body:not(#tpx) .tbl-head a { white-space: nowrap; }

    /* ---------- Строки: волосяные разделители, ровные цифры ---------- */
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row { position: relative; }
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row {
        border-color: var(--tp-line) !important;
    }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-row { font-variant-numeric: tabular-nums; }
    /* фон строки рисует обёртка — иначе подсветка при наведении прячется под белой подложкой */
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row > .ch-row { background: transparent !important; }

    /* ---------- «Чистая» таблица: все строки белые. Тариф и ТОП отмечаются не заливкой, а тонкой
       цветной линией слева, кольцом аватарки и цветом @юзернейма — без «грязных» градиентов ---------- */
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row,
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row:hover {
        background: #ffffff !important; border-left: 2px solid transparent !important;
    }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row { --tp-mk: 16,185,129; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.tariff-business-yellow { --tp-mk: 224,170,20; border-left: 2px solid #e5b52a !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.tariff-premium-purple { --tp-mk: 139,92,246; border-left: 2px solid #8b5cf6 !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.js-top-ch-card { --tp-mk: 16,185,129; border-left: 2px solid #10b981 !important; }
    /* отступ между фильтром категорий и шапкой таблицы (кабинет, каталог) */
    html body:not(#tpx) .cat-filter-row + .table-responsive, html body:not(#tpx) .cat-filter-row ~ .table-responsive { margin-top: 16px !important; }

    /* ---------- Наведение: нейтральный светлый тон + тонкая линия цвета строки ---------- */
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row::after {
        content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0;
        background: linear-gradient(90deg, rgba(var(--tp-mk), .06) 0%, rgba(248,250,252,.9) 35%, rgba(248,250,252,.9) 100%) !important;
        box-shadow: inset 2px 0 0 rgb(var(--tp-mk)) !important;
        transition: opacity .2s ease;
    }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row:hover::after { opacity: 1; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row > .ch-row { position: relative; z-index: 1; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row:hover { box-shadow: none !important; z-index: 2; }

    /* ---------- Аватарки: обводка тоньше (было до 3.6px), размер прежний. Статус — цвет кольца и мягкое свечение ---------- */
    html body:not(#tpx) :is(.channels-list, .channels-list-2) :is(.avatar-wrap .ch-avatar, .ch-avatar-wrap .ch-avatar-img) { border-width: 2px !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) :is(.avatar-wrap.verified .ch-avatar, .ch-avatar-wrap.verified .ch-avatar-img) { border-color: #34d27a !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .tariff-business-yellow :is(.avatar-wrap .ch-avatar, .ch-avatar-wrap .ch-avatar-img) {
        border-color: #f0b90b !important; box-shadow: 0 0 0 3px rgba(240,185,11,.16), 0 6px 14px -6px rgba(240,185,11,.65) !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .tariff-premium-purple :is(.avatar-wrap .ch-avatar, .ch-avatar-wrap .ch-avatar-img) {
        border-color: #8b5cf6 !important; box-shadow: 0 0 0 3px rgba(139,92,246,.15), 0 6px 14px -6px rgba(139,92,246,.6) !important; }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .js-top-ch-card :is(.avatar-wrap .ch-avatar, .ch-avatar-wrap .ch-avatar-img) {
        border-color: #10b981 !important; box-shadow: 0 0 0 3px rgba(16,185,129,.15), 0 6px 14px -6px rgba(16,185,129,.6) !important; }

    /* ---------- Значок статуса перед названием: корона — «Бизнес», бриллиант — «Премиум», звезда — ТОП ---------- */
    html body:not(#tpx) :is(.channels-list, .channels-list-2) :is(.tariff-business-yellow, .tariff-premium-purple, .js-top-ch-card) .ch-row .ch-title::before {
        content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px;
        -webkit-mask: var(--tp-ic) center / contain no-repeat; mask: var(--tp-ic) center / contain no-repeat; background: var(--tp-icc);
    }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .tariff-business-yellow { --tp-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18l1.2-10.5-5.7 4-4.5-7.5-4.5 7.5-5.7-4z'/%3E%3C/svg%3E"); --tp-icc: linear-gradient(135deg, #fcd34d, #d99a00); }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .tariff-premium-purple { --tp-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 3h12l4 6-10 12L2 9z'/%3E%3C/svg%3E"); --tp-icc: linear-gradient(135deg, #c4b5fd, #7c3aed); }
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .js-top-ch-card { --tp-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3 6.5 7 .8-5.2 4.8 1.5 7-6.3-3.6-6.3 3.6 1.5-7L2 9.3l7-.8z'/%3E%3C/svg%3E"); --tp-icc: linear-gradient(135deg, #34d399, #0891b2); }

    /* ---------- Названия: везде тёмные и чёткие; цвет статуса — только у @юзернейма ---------- */
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper .ch-row :is(.ch-title, .ch-title .ch-title-link) {
        background: none !important; -webkit-text-fill-color: currentColor !important; color: #0f172a !important;
    }
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper:not(.tariff-business-yellow):not(.tariff-premium-purple):not(.js-top-ch-card) .ch-user { color: #64748b !important; }
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper.tariff-business-yellow .ch-user { color: #b8860b !important; }
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper.tariff-premium-purple .ch-user { color: #7c3aed !important; }
    html:not([data-theme="dark"]) body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper.js-top-ch-card .ch-user { color: #059669 !important; }
    html[data-theme="dark"] body:not(#tpx) :is(.channels-list, .channels-list-2) .ch-wrapper .ch-row :is(.ch-title, .ch-title .ch-title-link) { background: none !important; -webkit-text-fill-color: currentColor !important; color: #e6edf7 !important; }

    /* ---------- ТОП: бейдж в фирменном градиенте ---------- */
    html body:not(#tpx) :is(.channels-list, .channels-list-2) .js-top-ch-card .pinned-badge {
        background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%) !important; color: #fff !important;
        letter-spacing: .08em; font-weight: 800 !important; border-radius: 6px !important;
        box-shadow: 0 4px 12px -4px rgba(16,185,129,.7), inset 0 1px 0 rgba(255,255,255,.35) !important;
    }

    /* ---------- «Написать»: фирменный градиент + мягкое свечение (обе таблицы) ---------- */
    html body:not(#tpx) .ch-row .btn-write-wrap .btn-write {
        color: #ffffff !important; border-color: transparent !important; font-weight: 700 !important;
        background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%) !important;
        box-shadow: 0 4px 12px -5px rgba(6,182,212,.6), inset 0 1px 0 rgba(255,255,255,.25) !important;
        transition: transform .16s, box-shadow .2s, filter .2s !important;
    }
    html body:not(#tpx) .ch-row .btn-write-wrap .btn-write svg { stroke: currentColor; }
    html body:not(#tpx) .ch-row .btn-write-wrap .btn-write:hover {
        transform: translateY(-1px); filter: saturate(1.15) brightness(1.04);
        box-shadow: 0 8px 18px -6px rgba(16,185,129,.7), inset 0 1px 0 rgba(255,255,255,.3) !important;
    }

    /* ---------- Места 1–3: аккуратные «чипы» в тон метрикам — градиентная цифра, тонкая рамка, мягкое свечение ---------- */
    html body:not(#tpx) .ch-num.tp-medal { overflow: visible !important; display: flex !important; align-items: center; justify-content: center; }
    html body:not(#tpx) .ch-num.tp-medal > .tp-m {
        display: inline-flex; align-items: center; justify-content: center; height: 19px; min-width: 22px; padding: 0 3px; box-sizing: border-box; margin-left: 2px;
        border-radius: 6px; font: 800 10.5px/1 Inter, sans-serif; letter-spacing: -.02em;
        border: 1px solid rgba(var(--tp-r), .38); background: linear-gradient(180deg, rgba(var(--tp-r), .16), rgba(var(--tp-r), .05));
        box-shadow: 0 4px 12px -6px rgba(var(--tp-r), .9);
    }
    html body:not(#tpx) .ch-num.tp-medal > .tp-m > b {
        font-weight: 800; background: var(--tp-g); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: rgb(var(--tp-r));
    }
    html body:not(#tpx) .ch-num.tp-m1 { --tp-r: 217,160,0;   --tp-g: linear-gradient(135deg, #f5c400, #b37800); }
    html body:not(#tpx) .ch-num.tp-m2 { --tp-r: 100,116,139; --tp-g: linear-gradient(135deg, #94a3b8, #475569); }
    html body:not(#tpx) .ch-num.tp-m3 { --tp-r: 194,110,52;  --tp-g: linear-gradient(135deg, #e0894a, #9a4f1c); }
    html[data-theme="dark"] body:not(#tpx) .ch-num.tp-m1 { --tp-g: linear-gradient(135deg, #ffe27a, #f5b301); }
    html[data-theme="dark"] body:not(#tpx) .ch-num.tp-m2 { --tp-r: 148,163,184; --tp-g: linear-gradient(135deg, #f1f5f9, #94a3b8); }
    html[data-theme="dark"] body:not(#tpx) .ch-num.tp-m3 { --tp-g: linear-gradient(135deg, #ffc08a, #e0894a); }

    /* ---------- Таблица целиком: мягкая глубокая тень ---------- */
    html:not([data-theme="dark"]) body:not(#tpx) .table-responsive { filter: drop-shadow(0 18px 30px rgba(15,23,42,.07)); }

    /* ================= Тёмная тема ================= */
    html[data-theme="dark"] body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row::after {
        background: linear-gradient(90deg, rgba(var(--tp-mk), .10) 0%, rgba(255,255,255,.03) 35%, rgba(255,255,255,.03) 100%) !important;
    }
    html[data-theme="dark"] body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.js-top-ch-card,
    html[data-theme="dark"] body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.tariff-business-yellow,
    html[data-theme="dark"] body:not(#tpx) :is(.channels-list, .channels-list-2) > .ch-wrapper.js-channel-row.tariff-premium-purple {
        background: linear-gradient(90deg, rgba(var(--tp-mk), .08) 0%, transparent 30%) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
}
