/* static/style.css | 2026-03-25-5 */

/* ============================================================
   ПЕРЕМЕННЫЕ — СВЕТЛАЯ ТЕМА (по умолчанию)
   ============================================================ */
:root {
    /* Акцент */
    --primary:            #7F42E1;
    --primary-light:      rgba(127, 66, 225, 0.10);
    --primary-background: rgba(127, 66, 225, 0.10); /* алиас */
    --primary-hover:      #6b33c5;
    --primary-active:     #5920a8;
    --primary-shadow:     rgba(127, 66, 225, 0.20);
    --primary-shadow-lg:  rgba(127, 66, 225, 0.30);

    /* Фон */
    --background:   #F3F0FF;
    --surface:      #ffffff;
    --elevated:     #f8f6ff;

    /* Текст */
    --black:             #191919;
    --white:             #ffffff;
    --text-secondary:    #6F7573;
    --text-placeholder:  #B0B0B0;

    /* Границы */
    --border-default: #CCCCCC;
    --border-subtle:  rgba(127, 66, 225, 0.08);
    --border-focus:   #7F42E1;

    /* Статусы задач */
    --status-yellow: #FACC15;
    --status-green:  #4ADE80;
    --status-blue:   #22D3EE;
    --status-pink:   #F472B6;
    --status-grey:   #E2E8F0;

    /* Семантика */
    --danger:       #961D1D;
    --danger-light: rgba(150, 29, 29, 0.10);
    --success:      #22c55e;
    --warning:      #f59e0b;

    /* Прочее */
    --bg-elevated: rgba(127, 66, 225, 0.10);
    --scrollbar-thumb: #E2E8F0;
    --font-main: 'Onest', sans-serif;

    /* Типографика — размерная шкала */
    --text-xs:   12px;
    --text-sm:   14px;
    --text-base: 16px;
    --text-lg:   18px;
    --text-xl:   20px;
    --text-2xl:  24px;
    --text-3xl:  30px;
    --text-4xl:  36px;
    --text-5xl:  48px;

    /* Межстрочный интервал */
    --lh-heading: 1.2;
    --lh-body:    1.65;
    --lh-ui:      1.4;
    --lh-acc:     1.7;
}

/* ============================================================
   ПЕРЕМЕННЫЕ — ТЁМНАЯ ТЕМА
   ============================================================ */
[data-theme="dark"] {
    --primary:            #9b6ff5;
    --primary-light:      rgba(155, 111, 245, 0.15);
    --primary-background: rgba(155, 111, 245, 0.15);
    --primary-hover:      #b08ffb;
    --primary-active:     #7F42E1;
    --primary-shadow:     rgba(155, 111, 245, 0.25);
    --primary-shadow-lg:  rgba(155, 111, 245, 0.40);

    --background:   #0f0d17;
    --surface:      #17132a;
    --elevated:     #1f1840;

    --black:            #f0ecff;
    --white:            #17132a;
    --text-secondary:   #9d8fc2;
    --text-placeholder: #4d4670;

    --border-default: #2d2450;
    --border-subtle:  rgba(155, 111, 245, 0.12);
    --border-focus:   #9b6ff5;

    --status-yellow: #ca9a0a;
    --status-green:  #22a256;
    --status-blue:   #0e9ab5;
    --status-pink:   #d4518f;
    --status-grey:   #2a2a3a;

    --danger:       #f87171;
    --danger-light: rgba(248, 113, 113, 0.12);
    --success:      #4ade80;
    --warning:      #fbbf24;

    --bg-elevated:  #1f1840;
    --scrollbar-thumb: #2d2450;
}

/* ============================================================
   ОБЩИЕ — Сброс
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--black);
}

/* ============================================================
   ОБЩИЕ — Типографика
   ============================================================ */
.text-main  { color: var(--black); }
.text-muted { color: var(--text-secondary); }

ul li::marker { color: var(--primary); }
ol li::marker { color: var(--primary); }

/* ============================================================
   ОБЩИЕ — Анимации
   ============================================================ */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   ОБЩИЕ — Скроллбар
   ============================================================ */
.custom-scrollbar::-webkit-scrollbar       { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }

/* ============================================================
   ОБЩИЕ — Заголовок страницы
   ============================================================ */
.zn-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-shrink: 0;
    padding-left: 36px;
}
.zn-page-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--black);
    margin: 0;
    line-height: var(--lh-heading);
}
.zn-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-more {
    width: 44px;
    height: 44px;
    display: none; /* Кнопку временно скрыл. Потом скажу, надо будет свойство display удалить. */
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-more:hover {
    background: var(--bg-elevated);
    color: var(--black);
}

/* ============================================================
   ОБЩИЕ — Кнопки
   ============================================================ */
.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    transition: all 0.3s ease;
    border-radius: 50px;
    font-weight: 400;
    display: none; /* Кнопку временно скрыл. Потом скажу, надо будет свойство display удалить. */
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    padding: 12px 24px;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 15px var(--primary-shadow);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   ОБЩИЕ — Строка ввода
   ============================================================ */
.zn-input-bar {
    height: 60px;
    background: var(--surface);
    border: 1px solid var(--border-default);
    border-radius: 30px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    transition: border-color 0.2s ease;
}
.zn-input-bar:focus-within { border-color: var(--border-focus); }
.zn-input-bar input {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--black);
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 500;
}
.zn-input-bar input::placeholder { color: var(--text-placeholder); }

/* Кнопка-отправитель (самолётик) */
#send-btn { color: var(--status-grey); transition: color 0.3s ease; margin-left: 12px; display: flex; align-items: center; cursor: pointer; background: none; border: none; }
#send-btn.active { color: var(--primary); }

/* ============================================================
   ОБЩИЕ — Карточки
   ============================================================ */
.zn-card {
    background: var(--surface);
    border-radius: 2.5rem;
    box-shadow: 0 20px 40px -15px var(--primary-shadow);
}

/* ============================================================
   ОБЩИЕ — Dropdown-элементы (используются в нескольких разделах)
   ============================================================ */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 9px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--black);
    font-family: var(--font-main);
    transition: background 0.12s;
    white-space: nowrap;
}
.dropdown-item:hover         { background: var(--elevated); }
.dropdown-item.danger        { color: var(--danger); }
.dropdown-item.danger:hover  { background: var(--danger-light); }
.dropdown-item:disabled      { opacity: 0.55; cursor: default; }
.dropdown-item:disabled:hover { background: none; }

/* Кнопка «три точки» — универсальная */
.dots-menu-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #94A3B8;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.dots-menu-btn:hover { color: var(--black); background: rgba(0, 0, 0, 0.05); }

/* ============================================================
   LAYOUT — Основной контейнер страницы
   ============================================================ */
.dashboard-main-container {
    background: var(--surface);
    border-radius: 24px;
    /* box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02); */
    display: flex;
    flex-direction: column;
    padding: 36px;
    position: relative;
}

/* ============================================================
   SIDEBAR — Плавающая карточка
   ============================================================ */
.zn-sidebar {
    width: 240px;
    flex-shrink: 0;
    margin: 20px 0 20px 20px;
    background: var(--surface);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: calc(100vh - 40px);
    position: relative;
    z-index: 40;
}

/* Шапка: лого + иконка темы */
.zn-sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.zn-sb-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

/* Универсальная иконка-кнопка */
.zn-sb-icon-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 58px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
    flex-shrink: 0;
    padding: 0;
}
.zn-sb-icon-btn:hover { color: var(--black); background: var(--primary-light); }

/* Строка баланса */
.zn-sb-balance-row {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
}
.zn-sb-balance-pill {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--background);
    border-radius: 9999px;
    padding: 4px 4px 4px 18px;
    flex: 1;
    min-width: 0;
}
.zn-sb-balance-amount {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--black);
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.zn-sb-topup-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.15s;
    margin-left: 6px;
}
.zn-sb-topup-btn:hover { background: var(--primary-hover); }

/* Навигация */
.zn-sb-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}
.zn-sb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    font-weight: 400;
    transition: color 0.15s, background 0.15s;
}
.zn-sb-item:hover { color: var(--black); background: var(--primary-light); }
.zn-sb-item.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.zn-sb-item.hidden { display: none; }
.zn-sb-item-icon { display: flex; align-items: center; flex-shrink: 0; }

/* Подвал: пользователь + выход */
.zn-sb-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}
.zn-sb-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 0;
    flex: 1;
}
.zn-sb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--primary);
}
.zn-sb-avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}
.zn-sb-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--black);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.zn-sb-logout-btn { color: var(--text-secondary); }
.zn-sb-logout-btn:hover { color: var(--danger); background: var(--danger-light); }

/* ============================================================
   УВЕДОМЛЕНИЯ — Колокольчик
   ============================================================ */
.notif-bell { cursor: pointer; transition: all 0.3s ease; color: #CBD5E1; background: none; border: none; }
.notif-bell.has-unread { color: var(--primary); }

#notif-popup {
    position: absolute;
    right: 0; top: 100%;
    margin-top: 1rem;
    width: 300px;
    background: var(--surface);
    border-radius: 1.5rem;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.10);
    border: 1px solid var(--border-subtle);
    z-index: 100;
    transform-origin: top right;
}

/* ============================================================
   НАВИГАЦИЯ — Сайдбар
   ============================================================ */
.sidebar-item {
    transition: all 0.2s ease;
    color: var(--black);
    opacity: 0.6;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 0;
    display: block;
    text-decoration: none;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}
.sidebar-item:hover  { opacity: 1; }
.sidebar-item.active { color: var(--primary); opacity: 1; font-weight: 600; }

/* ============================================================
   БЕЙДЖ ПОЛЬЗОВАТЕЛЯ
   ============================================================ */
.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 4px 12px 4px 4px;
    border-radius: 1.25rem;
    border: 1px solid var(--border-subtle);
}

/* ============================================================
   КАРТОЧКА АВТОРИЗАЦИИ / PAYWALL
   ============================================================ */
.auth-card {
    background-color: var(--primary-background);
    border-radius: 2.5rem;
    max-width: 420px;
    width: 100%;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #475569;
    text-align: left;
}
.feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* ============================================================
   АККОРДЕОН
   ============================================================ */
.acc-item    { background: var(--surface); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.acc-btn     { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; text-align: left; font-weight: 600; font-size: 14px; color: var(--black); background: none; border: none; cursor: pointer; }
.acc-btn:hover { color: var(--primary); }
.acc-arrow   { transition: transform 0.2s ease; flex-shrink: 0; }
.acc-content { padding: 0 24px 14px; font-size: 14px; color: #374151; line-height: 1.7; }

/* ============================================================
   БОКОВАЯ ВЫЕЗЖАЮЩАЯ ПАНЕЛЬ (Drawer)
   ============================================================ */
#drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 580px;
    background: var(--background);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
#drawer.open { transform: translateX(0); }

.drawer-header {
    padding: 48px 48px 28px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#drawer-title {
    font-family: var(--font-main);
    font-size: 32px;
    font-weight: 500;
    color: var(--black);
    line-height: 1.2;
}
.drawer-body { padding: 0 48px 48px 48px; overflow-y: auto; flex: 1; }

.drawer-action-btn {
    width: 40px; height: 40px;
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #9CA3AF; border-radius: 8px; padding: 0;
    transition: color 0.2s ease;
}
.drawer-action-btn:hover { color: var(--black); }

/* ============================================================
   ВИДЕО — Сетка карточек
   ============================================================ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--primary-light);
    border-radius: 20px;
    padding: 10px;
    transition: box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
}
.video-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07); }

/* ===== Обложка ===== */
.thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--status-grey);
}
.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Оверлей прогресса скачивания ===== */
.dl-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 28, 0.72);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s;
}
.dl-overlay.visible { opacity: 1; }

.dl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
.dl-percent {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.dl-bar-wrap {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}
.dl-bar-fill {
    height: 100%;
    background: #fff;
    border-radius: 0 2px 2px 0;
    transition: width 0.6s ease;
    width: 0%;
}

/* Спиннер внутри кнопки скачивания */
.dl-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

/* ===== Футер карточки ===== */
.video-card-footer {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 4px 4px;
}
.video-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--black);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
    min-height: 2.6em;
}

/* ===== Кнопка меню карточки ===== */
.video-menu-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #94A3B8;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.video-menu-btn:hover { color: var(--black); background: rgba(0, 0, 0, 0.05); }

/* ===== Dropdown карточки видео ===== */
.card-dropdown {
    position: absolute;
    right: 10px;
    bottom: 36px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
    padding: 6px;
    z-index: 200;
    min-width: 150px;
    display: none;
}
.card-dropdown.open { display: block; }

/* ============================================================
   ВИДЕО — Кнопки-пилюли статусов (action-btn)
   ============================================================ */
.action-btn {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: var(--status-grey);
    color: #94A3B8;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn.done-download      { background: var(--status-yellow); color: #854D0E; }
.action-btn.done-transcription { background: var(--status-green);  color: #065F46; }
.action-btn.done-analysis      { background: var(--status-blue);   color: #164E63; }
.action-btn.done-seo_description { background: var(--status-pink); color: #831843; }
.action-btn.pulse              { animation: pulse 1.5s infinite; cursor: wait; }

/* ============================================================
   КАНАЛЫ — Сетка и карточки
   ============================================================ */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.channel-card {
    background: var(--primary-light);
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: 1px solid transparent;
    transition: box-shadow 0.3s ease;
}
.channel-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); }

.ch-avatar  { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--elevated); }
.ch-name    { font-size: 14px; font-weight: 700; color: var(--black); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.ch-meta-line { font-size: 12px; color: var(--text-secondary); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Сетка статистики */
.ch-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.ch-stat {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 12px;
}
.ch-stat-label { font-size: 11px; color: #94A3B8; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
.ch-stat-value { font-size: 13px; font-weight: 700; color: var(--black); line-height: 1.3; }

/* Плашка «анализируется» */
.ch-processing {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: #CBD5E1;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Кнопка три точки (канал) */
.ch-menu-btn {
    flex-shrink: 0;
    width: 28px; height: 28px;
    background: none; border: none;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #94A3B8;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}
.ch-menu-btn:hover { color: var(--black); background: rgba(0, 0, 0, 0.05); }

/* Dropdown канала */
.ch-dropdown {
    position: absolute;
    top: calc(100% + 4px); right: 0;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
    padding: 6px;
    z-index: 200;
    min-width: 160px;
    display: none;
}
.ch-dropdown.open { display: block; }
.ch-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; font-size: 13px; font-weight: 500;
    border-radius: 9px; cursor: pointer; border: none;
    background: none; width: 100%; text-align: left;
    color: var(--black); transition: background 0.12s;
    font-family: var(--font-main); white-space: nowrap;
}
.ch-dropdown-item:hover         { background: var(--elevated); }
.ch-dropdown-item.danger        { color: var(--danger); }
.ch-dropdown-item.danger:hover  { background: var(--danger-light); }

/* Спиннер канала */
.ch-spinner { animation: spin 1.5s linear infinite; }

/* Таблица истории */
.zn-table { width: 100%; border-collapse: collapse; }
.zn-table thead { border-bottom: 1px solid var(--border-subtle); }
.zn-table th {
    padding: 12px 24px; text-align: left; font-size: 10px;
    font-weight: 800; color: #999; text-transform: uppercase; letter-spacing: 0.05em;
}
.zn-table td { padding: 18px 24px; border-bottom: 1px solid var(--elevated); vertical-align: middle; }

/* Пилюли статусов (таблица каналов) */
.status-pill {
    font-size: 10px; font-weight: 800; text-transform: uppercase;
    padding: 6px 14px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; border: none;
}
.status-completed  { background: #E0F2FE; color: #0369A1; transition: opacity 0.2s; }
.status-processing { background: var(--status-grey); color: #94A3B8; cursor: wait; animation: pulse 1.5s infinite; }

/* ============================================================
   НИША — Форма
   ============================================================ */
.niche-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 0 32px 0;
    width: 100%;
}
.niche-form-top-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}
.niche-form-top-row .zn-input-bar.niche-input { flex: 1 1 0; min-width: 0; }

/* Колонка конкурентов */
.comp-column {
    flex: 0 0 32%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.competitor-extra-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.competitor-extra-row .zn-input-bar { flex: 1 1 0; min-width: 0; }

.btn-remove-comp {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: var(--primary); flex-shrink: 0; display: flex; align-items: center;
    opacity: 0.7; transition: opacity 0.15s;
}
.btn-remove-comp:hover { opacity: 1; }

#competitors-extra { display: flex; flex-direction: column; gap: 12px; }

/* Ссылка «Добавить поле» */
.add-comp-link { display: flex; justify-content: center; margin-top: 2px; }
.add-comp-link button {
    background: none; border: none; cursor: pointer;
    color: var(--primary); font-family: var(--font-main);
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 6px; padding: 0;
    transition: opacity 0.15s;
}
.add-comp-link button:hover    { opacity: 0.75; }
.add-comp-link button:disabled { opacity: 0.35; cursor: default; }

/* Дропдаун региона */
.region-select-wrap { flex: 0 0 auto; position: relative; }
.region-select {
    appearance: none;
    -webkit-appearance: none;
    height: 60px;
    background: var(--surface);
    border: 1px solid var(--border-default);
    border-radius: 30px;
    padding: 0 44px 0 20px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    color: var(--black);
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    transition: border-color 0.2s ease;
    line-height: 60px;
}
.region-select:focus,
.region-select:hover { border-color: var(--primary); }
.region-select-chevron {
    pointer-events: none;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--black);
}

/* Кнопка запуска анализа */
.btn-run-niche {
    background: var(--primary);
    color: var(--surface);
    height: 60px;
    padding: 0 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 10px 20px -5px var(--primary-shadow-lg);
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-run-niche:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 15px 25px -5px var(--primary-shadow-lg);
}
.btn-run-niche:disabled {
    background: var(--status-grey);
    color: #9CA3AF;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================================
   НИША — Сетка карточек результатов
   ============================================================ */
.niche-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 2px;
}
.niche-card {
    background: var(--primary-light);
    border: none;
    border-radius: 24px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.niche-card.clickable { cursor: pointer; }
.niche-card.clickable:hover {
    box-shadow: 0 4px 20px var(--primary-shadow);
    transform: translateY(-1px);
}

.niche-score-badge {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}
.niche-score-verdict {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.2;
    margin-top: 12px;
}

.niche-card-body  { flex: 1; min-width: 0; }
.niche-card-name  {
    font-size: 14px; font-weight: 600; color: var(--black);
    line-height: 1.4; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}
.niche-card-date  { font-size: 12px; color: #9CA3AF; }

/* Пилюли статусов (ниша) */
.nt-status-pill {
    font-size: 10px; font-weight: 800; text-transform: uppercase;
    padding: 4px 10px; border-radius: 6px;
    display: inline-flex; align-items: center; gap: 6px;
    border: none; margin-top: 6px;
}
.nt-processing { background: var(--status-grey); color: #94A3B8; cursor: wait; animation: pulse 1.5s infinite; }
.nt-error      { background: #FEE2E2; color: #DC2626; cursor: default; }

/* Кнопка три точки (ниша) */
.nt-dots-btn {
    width: 28px; min-width: 28px; height: 28px;
    background: none; border: none; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #C4C4C4;
    transition: color 0.15s, background 0.15s;
}
.nt-dots-btn:hover { color: #6B7280; background: var(--elevated); }
.nt-menu-wrap { position: relative; }

/* Dropdown ниши */
.nt-dropdown {
    position: absolute;
    top: 32px; right: 0;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    z-index: 200;
    display: none;
    min-width: 170px;
}
.nt-dropdown.open { display: block; }
.nt-dropdown-item {
    padding: 8px 12px; border-radius: 8px;
    font-size: 13px; cursor: pointer; white-space: nowrap;
    display: flex; align-items: center; gap: 8px;
    color: var(--black); transition: background 0.12s;
}
.nt-dropdown-item:hover          { background: var(--elevated); }
.nt-dropdown-item.danger         { color: #DC2626; }
.nt-dropdown-item.danger:hover   { background: #FEF2F2; }

/* Список конкурентов */
.competitors-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.competitor-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border-default);
    border-radius: 20px; padding: 6px 14px;
    font-size: 13px; font-weight: 500; color: var(--black);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    max-width: 260px;
}
.competitor-chip:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-shadow);
}
.competitor-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.competitor-chip .chip-subs { font-size: 11px; color: #9CA3AF; flex-shrink: 0; }

/* ============================================================
   НИША — Детальный вид
   ============================================================ */
#niche-detail { display: none; }
#niche-detail.visible { display: flex; flex-direction: column; /* overflow: hidden; */ }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-default);
    border-radius: 20px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    color: var(--black);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    align-self: flex-start;
    margin-bottom: 20px;
}
.btn-back:hover { border-color: var(--border-focus); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }

.niche-detail-summary {
    background: var(--primary-light);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
}
.niche-detail-info { flex: 1; min-width: 0; }
.niche-detail-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.niche-detail-name { font-size: 24px; font-weight: 600; color: var(--black); line-height: 1.5; }

/* Тултип дохода */
.earnings-badge {
    display: inline-block;
    position: relative;
    cursor: help;
    border-bottom: 1px dashed currentColor;
}
.earnings-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: #F9FAFB;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
}
.earnings-badge:hover::after { opacity: 1; }

/* Табы */
.tabs-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.tab-btn {
    height: 34px; border-radius: 8px; border: none; cursor: pointer;
    font-family: var(--font-main); font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 6px; padding: 0 14px;
    transition: all 0.15s;
}
.tab-btn.active   { background: var(--primary); color: #fff; }
.tab-btn.inactive { background: var(--primary-light); color: var(--text-secondary); }

/* Карточки анализа */
#tab-content-analysis { }
.analysis-grid {
    columns: 2;
    column-gap: 16px;
}
.analysis-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border-subtle);
    break-inside: avoid;
    margin-bottom: 16px;
}
.analysis-card-title { font-size: 15px; font-weight: 700; color: var(--black); margin-bottom: 14px; }
.analysis-card-body  { font-size: 16px; color: var(--black); line-height: 1.5; }
.analysis-card-body b { font-weight: 700; color: var(--black); }
.analysis-card-body p { margin: 0 0 8px; }

/* Таймлайн недель */
.week-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.week-badge {
    background: var(--primary-light); color: var(--primary);
    font-size: 11px; font-weight: 700; border-radius: 6px;
    padding: 3px 8px; white-space: nowrap; flex-shrink: 0; margin-top: 2px;
}

/* ============================================================
   ПРОФИЛЬ
   ============================================================ */
.profile-tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    padding-left: 36px;
}
.profile-tab-btn {
    padding: 8px 20px;
    border-radius: 50px;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}
.profile-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}
.profile-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: 20px;
    align-items: start;
}
.profile-block-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--black);
    margin: 0 0 24px;
}
.profile-user-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--primary);
}
.profile-user-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--black);
}
.profile-user-since {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}
.profile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.profile-stat-card {
    background: var(--background);
    border-radius: 16px;
    padding: 20px;
}
.profile-stat-value {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--black);
    line-height: 1;
    margin-bottom: 8px;
}
.profile-stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.balance-amount {
    font-size: var(--text-5xl);
    font-weight: 700;
    color: var(--black);
    margin: 8px 0 32px;
    line-height: 1;
}
.balance-topup-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.balance-preset-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.balance-preset-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1.5px solid var(--border-subtle);
    background: transparent;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}
.balance-preset-btn:hover,
.balance-preset-btn.selected {
    border-color: var(--primary);
    color: var(--primary);
}
.balance-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 8px;
}
.balance-topup-note {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: 12px;
}
.tx-table {
    width: 100%;
    border-collapse: collapse;
}
.tx-table thead tr {
    background: var(--background);
}
.tx-table th {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 12px;
}
.tx-table th:last-child { text-align: right; }
.tx-table td {
    padding: 12px 12px;
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.tx-table td:last-child {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}
.tx-table td:first-child {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    white-space: nowrap;
}
.tx-table tr:last-child td { border-bottom: none; }
.tx-plus { color: var(--success); }
.tx-minus { color: var(--danger); }
