/* ============================================================
   RabbitSeo — единый стиль личного кабинета (сайдбар + дашборд)
   ============================================================ */

:root {
    --brand: #7C3AED;
    --brand-dark: #6D28D9;
    --brand-light: #F1ECFE;
    --brand-tint: #FAF8FF;
    --bg: #F6F6FA;
    --card: #FFFFFF;
    --text: #1E1B2E;
    --text-muted: #8A8AA3;
    --border: #ECECF3;
    --green: #16A34A;
    --green-bg: #E7F8EE;
    --red: #DC2626;
    --red-bg: #FDECEC;
    --orange: #D97706;
    --orange-bg: #FEF3E2;
    --blue: #2563EB;
    --blue-bg: #E8EFFD;
    --sidebar-w: 256px;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(30, 27, 46, 0.04), 0 6px 24px rgba(30, 27, 46, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

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

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 16px;
}
.sidebar-logo img { height: 30px; }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 14px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 6px;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}
.sidebar-label:first-child { margin-top: 0; border-top: 0; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    /* сброс для пунктов-кнопок (<button class="sidebar-item">), чтобы не было дефолтной рамки/фона */
    background: none;
    border: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.sidebar-item:hover { background: var(--brand-tint); color: var(--text); }
.sidebar-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.sidebar-item:focus { outline: none; }
.sidebar-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item .soon {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--brand-light);
    color: var(--brand);
    padding: 2px 6px;
    border-radius: 6px;
}

.sidebar-spacer { flex: 1; min-height: 20px; }

.sidebar-balance {
    background: var(--brand-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
}
.sidebar-balance-label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
}
.sidebar-balance-amount { font-size: 22px; font-weight: 700; color: var(--text); }
.sidebar-balance-note { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.sidebar-balance-bonus {
    font-size: 12px;
    color: var(--brand);
    font-weight: 600;
    margin: 2px 0 12px;
    display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.sidebar-balance-bonus .muted { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.sidebar-balance .btn { width: 100%; justify-content: center; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: background 0.15s;
}
.sidebar-user:hover { background: var(--brand-tint); }
.sidebar-user.active { background: var(--brand-light); }
.sidebar-user-avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name {
    font-size: 14px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-link { font-size: 12px; color: var(--text-muted); }

/* ===== CONTENT ===== */
.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0; /* без этого широкая таблица распирает колонку шире вьюпорта и страница уезжает */
    padding: 32px 40px;
    max-width: 1320px;
}

/* ===== PAGE HEAD ===== */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ===== STYLED SELECTS ===== */
.select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8AA3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 36px 9px 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.select:hover { border-color: #D9D2F5; }
.select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

/* project picker — то же оформление + иконка глобуса слева */
.project-select {
    display: inline-flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding-left: 13px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.project-select:hover { border-color: #D9D2F5; }
.project-select:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.project-select .globe { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.project-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 0;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8AA3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    outline: none;
    padding: 10px 36px 10px 8px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}
.card + .card { margin-top: 20px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; }

/* ===== METRIC GRID ===== */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
.metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
}
.metric-card.accent {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    border-color: transparent;
    color: #fff;
}
.metric-label { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.metric-card.accent .metric-label { color: rgba(255, 255, 255, 0.82); }
.metric-value-row { display: flex; align-items: baseline; gap: 10px; }
.metric-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.metric-delta {
    font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 2px;
    color: var(--green);
}
.metric-card.accent .metric-delta { color: #C9F7D8; }
.metric-delta.down { color: var(--red); }
.metric-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.metric-card.accent .metric-note { color: rgba(255, 255, 255, 0.7); }
.metric-spark {
    position: absolute; right: 14px; top: 16px;
    width: 64px; height: 30px; opacity: 0.55;
}

/* ===== CHART ===== */
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.chart-box { position: relative; height: 300px; }

/* Кликабельная легенда (toggle линий, как в Яндекс.Метрике) */
.chart-legend span[data-series],
.chart-legend-rich span[data-series] { cursor: pointer; user-select: none; transition: opacity 0.15s; }
.chart-legend span[data-series].is-off,
.chart-legend-rich span[data-series].is-off { opacity: 0.4; }


/* ===== TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    font-size: 14px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--brand-tint); }
.table-link { color: var(--brand); font-weight: 600; }
.table-link:hover { color: var(--brand-dark); text-decoration: underline; }
.table-scroll { overflow-x: auto; }

/* AJAX-подмена таблицы запросов: лёгкая индикация загрузки */
#keywordsTableWrap.is-loading { opacity: 0.5; pointer-events: none; transition: opacity 0.1s; }

/* ===== PROJECTS LIST ===== */
.projects-toolbar { margin-bottom: 16px; }
.search-field { position: relative; max-width: 340px; }
.search-field svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.search-field .form-input { padding-left: 38px; }

/* Стабильная раскладка: фиксируем ширины колонок и режем длинные значения «…» */
.projects-table { min-width: 640px; }
.projects-table td { white-space: nowrap; } /* строки в одну линию; длинное — скроллится внутри .table-scroll */
.projects-table .col-name { width: 300px; }
.projects-table .col-region { width: 150px; }

.project-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.project-cell-main { min-width: 0; }
.project-cell-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-cell-top .pill-paused, .project-cell-top .pill-ready { margin-left: 0; }
.project-name {
    min-width: 0; max-width: 220px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Домен — подпись под названием (как тариф под бюджетом) */
.project-subline {
    display: block; margin-top: 2px; max-width: 260px;
    font-size: 12px; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-subline:hover { color: var(--brand); text-decoration: underline; }

.status-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.is-active { background: var(--green); }
/* Настроен, но не запущен: не зелёный, чтобы не путать с работающим */
.status-dot.is-preparing { background: var(--blue); }
.status-dot.is-paused { background: var(--text-muted); }

/* Мелкая подпись под значением в ячейке (напр. тариф под бюджетом) */
.cell-subnote { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-muted { background: var(--bg); color: var(--text-muted); }

/* Рост позиции относительно начальной — в углу обводки бейджа, чтобы сам бейдж
   оставался по центру колонки независимо от наличия роста. */
.pos-badge { position: relative; overflow: visible; }
.pos-growth {
    position: absolute;
    top: -7px;
    right: -13px;
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }

/* ===== KEYWORDS TABS (Активные / Приостановленные) ===== */
.kw-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: 0 0 16px;
}
.kw-tab {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.kw-tab:hover { color: var(--text); }
.kw-tab.is-active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.kw-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: var(--bg);
    color: var(--text-muted);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.kw-tab.is-active .kw-tab-badge { background: var(--brand-tint); color: var(--brand); }

.kw-tab-hint {
    background: var(--orange-bg);
    color: #8a4b00;
    border: 1px solid #f0d49c;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 0 0 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.kw-tab-hint svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: #c97a00; }
.kw-tab-hint strong { display: block; margin-bottom: 2px; color: #6b3a00; }

/* ===== KEYWORD FREQUENCY PREP BANNER ===== */
.prep-banner {
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 0 0 16px;
    color: var(--text);
}
.prep-banner.is-hidden { display: none; }
.prep-banner-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px;
}
.prep-text { line-height: 1.4; }
.prep-spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--brand-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: prep-spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes prep-spin { to { transform: rotate(360deg); } }
.prep-progress {
    margin-top: 10px;
    height: 6px;
    background: var(--brand-light);
    border-radius: 999px;
    overflow: hidden;
}
.prep-progress-fill {
    height: 100%;
    background: var(--brand);
    transition: width 0.4s ease;
    border-radius: 999px;
}

.prep-percent { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.prep-percent strong { color: var(--text); font-weight: 600; }

.cell-loader {
    display: inline-block;
    animation: prep-blink 1.2s ease-in-out infinite;
}
@keyframes prep-blink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ===== REGION MULTISELECT ===== */
.region-multiselect {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    overflow: hidden;
}
.region-multiselect-head {
    display: flex; gap: 6px; align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.region-multiselect-head .region-search { flex: 1; height: 34px; padding: 6px 10px; font-size: 13px; }
.region-multiselect-summary { padding: 6px 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.region-multiselect-list {
    max-height: 260px;
    overflow-y: auto;
}
.region-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 12px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.region-item:hover { background: var(--brand-tint); }
.region-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* ===== INLINE HELP TOOLTIP (e.g. column header hints) ===== */
.col-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
}

/* Floating tooltip lives at body level and is positioned via JS (escapes overflow-clipping parents). */
.floating-tooltip {
    position: fixed;
    background: var(--text);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    padding: 8px 11px;
    border-radius: 8px;
    max-width: 280px;
    text-align: left;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s;
    white-space: normal;
}
.floating-tooltip.is-visible { opacity: 1; transform: translateY(0); }
.floating-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -5px;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text);
    border-bottom: 0;
}

/* ===== TARIFF PAGE ===== */
.tariff-factors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 900px) {
    .tariff-factors { grid-template-columns: 1fr; }
}
.tariff-factors > .card { margin-top: 0; }
.tariff-factor {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.tariff-factor-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.tariff-factor-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
}
.tariff-bands {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: auto;
}
@media (max-width: 560px) {
    .tariff-bands { grid-template-columns: 1fr; }
}
.tariff-band { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tariff-band-note { font-size: 13px; color: var(--text-muted); line-height: 1.35; }

.tariff-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.tariff-pill-low { background: var(--green-bg); color: var(--green); }
.tariff-pill-mid { background: var(--brand-light); color: var(--brand); }
.tariff-pill-high { background: var(--red-bg); color: var(--red); }

.tariff-matrix td, .tariff-matrix th { padding-top: 14px; padding-bottom: 14px; }
.tariff-price { font-weight: 700; font-size: 15px; color: var(--text); }

/* 2D-матрица: строки — частотность, столбцы — конкурентность */
.tariff-matrix-2d { min-width: 560px; }
.tariff-matrix-2d th {
    text-transform: none; letter-spacing: 0; text-align: center;
    font-size: 13px; font-weight: 600; color: var(--text);
}
.tariff-matrix-2d .tariff-corner {
    text-align: left; white-space: nowrap;
    font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.tariff-matrix-2d .tariff-row-head { text-align: left; white-space: nowrap; }
.tariff-th-note { display: block; margin-top: 4px; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.tariff-matrix-foot { margin: 12px 2px 0; font-size: 13px; }

/* Карточки режимов на странице тарифов — нефокусируемые (не кликабельны) */
.tariff-plans .plan-card { cursor: default; }
.tariff-plans .plan-card:hover { transform: none; border-color: var(--border); }
.tariff-plans .plan-card.is-selected:hover { border-color: var(--brand); }
.plan-card .plan-mult { color: var(--brand); }
.plan-card.is-selected .plan-mult { color: var(--brand-dark); }
.tariff-example { margin: 4px 2px 24px; font-size: 13px; line-height: 1.5; }

/* Блок-формула «как формируется бюджет» */
.tariff-callout {
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
}
.tariff-callout-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.tariff-formula { margin: 0 0 10px; padding-left: 18px; }
.tariff-formula li { font-size: 14px; line-height: 1.6; color: var(--text); }
.tariff-callout-ex { font-size: 13px; }

/* Карточки-механики «как это работает» */
.tariff-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}
@media (max-width: 900px) { .tariff-info-grid { grid-template-columns: 1fr; } }
.tariff-info-grid > .card { margin-top: 0; }
.tariff-info-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.tariff-info p { font-size: 13.5px; line-height: 1.55; color: var(--text); margin: 0 0 6px; }
.tariff-info p.muted { color: var(--text-muted); margin-bottom: 0; }

/* ===== TABLE SORT LINKS ===== */
.sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
    cursor: pointer;
    user-select: none;
}
.sort-link:hover { color: var(--brand); }
.sort-link.active { color: var(--brand); }
.sort-arrow { font-size: 9px; line-height: 1; }
.sort-arrow-idle { color: var(--border); }

/* ===== KEYWORDS TABLE: sticky first two columns ===== */
.table-scroll.sticky-cols-2 { overflow-x: auto; position: relative; }
.keywords-table th,
.keywords-table td { text-align: center; vertical-align: middle; }
.keywords-table th.sticky-col,
.keywords-table td.sticky-col {
    position: sticky;
    background: var(--card);
    z-index: 1;
}
.keywords-table thead th.sticky-col { z-index: 2; background: var(--card); }
.keywords-table tbody tr:hover td.sticky-col { background: var(--brand-tint); }
.keywords-table .sticky-col-0 { left: 0; width: 40px; min-width: 40px; padding-left: 14px; padding-right: 6px; }
.keywords-table .sticky-col-1 { left: 40px; width: 90px; min-width: 90px; }
.keywords-table .sticky-col-2 {
    left: 130px;
    min-width: 200px;
    text-align: left;
    box-shadow: 6px 0 8px -6px rgba(0,0,0,0.08);
}
.keywords-table .bulk-check {
    width: 16px; height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
    vertical-align: middle;
}

/* type pills (НЧ/СЧ/ВЧ + НК/СК/ВК) */
.pill-type {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-right: 4px;
}
.pill-freq-low,
.pill-comp-low { background: var(--red-bg); color: var(--red); }
.pill-freq-mid,
.pill-comp-mid { background: var(--orange-bg); color: var(--orange); }
.pill-freq-high,
.pill-comp-high { background: var(--green-bg); color: var(--green); }

/* ===== FLOATING BULK ACTION BAR ===== */
.bulk-bar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 20px 50px -12px rgba(0,0,0,0.22), 0 6px 18px rgba(0,0,0,0.10);
    padding: 12px 14px 12px 24px;
    display: flex; align-items: center; gap: 12px;
    z-index: 900;
    transition: opacity 0.2s, transform 0.2s;
    max-width: calc(100vw - 32px);
    flex-wrap: nowrap;
}
.bulk-bar.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(16px);
}
.bulk-bar-counter { font-size: 15px; font-weight: 500; white-space: nowrap; }
.bulk-bar-counter strong { color: var(--brand); font-weight: 700; }
.bulk-bar-divider {
    display: inline-block;
    width: 1px; height: 28px;
    background: var(--border);
    margin: 0 4px;
}
.bulk-bar .btn { white-space: nowrap; border-radius: 999px; }
.bulk-bar-allpages {
    background: var(--brand-tint);
    border: 1px dashed var(--brand);
    color: var(--brand);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.bulk-bar-allpages:hover { background: var(--brand); color: #fff; }
.bulk-bar-allpages.is-hidden { display: none; }

/* Крупная «корзинная» панель — только вкладка «Рекомендуем использовать»: там клиент
   набирает запросы и должен сразу видеть, во что это обойдётся. На остальных вкладках
   панель остаётся прежней «пилюлей». */
.bulk-bar.is-cart {
    border-radius: 18px;
    padding: 16px 20px;
    gap: 18px;
    width: min(880px, calc(100vw - 32px));
    max-width: none;
    align-items: stretch;
    box-shadow: 0 24px 60px -14px rgba(0,0,0,0.26), 0 8px 22px rgba(0,0,0,0.12);
}
.bulk-cart-left {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    min-width: 132px;
}
.bulk-bar.is-cart .bulk-bar-counter { font-size: 16px; }
.bulk-bar.is-cart .bulk-bar-allpages { align-self: flex-start; padding: 4px 10px; font-size: 12px; }
.bulk-cart-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }
.bulk-cart-note.is-hidden { display: none; }
.bulk-cart-sums {
    display: flex; align-items: center; gap: 14px;
    padding-left: 18px;
    border-left: 1px solid var(--border);
    flex: 1; min-width: 0;
}
/* Цена не сжимается никогда, бюджет забирает остаток и переносится: иначе обе колонки
   ужимались ниже своих подписей, а nowrap-подпись вылезала на соседнюю. */
.bulk-cart-item { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; min-width: 0; }
.bulk-cart-item.is-new { flex: 1 1 auto; }
.bulk-cart-item .lbl {
    font-size: 11.5px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Перенос по словам обязателен: «125 860 ₽ → 131 175 ₽» в одну строку не влезает и при
   nowrap уезжает под кнопку. Внутри самих сумм стоят неразрывные пробелы (см. money() в
   show.blade.php), поэтому строка ломается только по стрелке. */
.bulk-cart-item .val {
    font-size: 17px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2;
    font-variant-numeric: tabular-nums; white-space: normal;
}
.bulk-cart-item.is-new .val { color: var(--brand-dark, var(--brand)); font-size: 19px; }
/* Три состояния из пяти (не запущен / на паузе / ручной бюджет) вместо суммы дают фразу.
   Крупным нерасторжимым набором она вылезала из колонки и уезжала под кнопку — здесь
   значение становится обычным текстом и переносится по словам. */
.bulk-cart-item .val.is-text,
.bulk-cart-item.is-new .val.is-text {
    font-size: 13px; font-weight: 600; line-height: 1.25; letter-spacing: 0;
    white-space: normal; color: var(--text-muted);
}
.bulk-cart-arrow { color: var(--text-muted); display: flex; align-items: center; flex: none; }
.bulk-cart-arrow.is-hidden { display: none; }
/* Кнопка не сжимается и не перекрывается: суммы ужимаются, действие — никогда. */
.bulk-bar.is-cart .btn-primary { padding: 12px 20px; font-size: 15px; flex: none; }

/* Поиск над таблицей запросов. */
.kw-search-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.kw-search-field { flex: 1; max-width: 420px; }

/* ===== TABLE PAGER ===== */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px 2px;
    flex-wrap: wrap;
    gap: 12px;
}
.pager-info { font-size: 13px; }
.pager-links { display: inline-flex; gap: 4px; align-items: center; }
.pager-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pager-link:hover { border-color: var(--brand); color: var(--brand); }
.pager-link.is-current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    cursor: default;
}
.pager-link.is-disabled {
    color: var(--text-muted);
    background: var(--bg);
    cursor: not-allowed;
    opacity: 0.5;
}
.bulk-bar-close {
    width: 36px; height: 36px;
    margin-left: 4px;
    background: var(--bg);
    border: 0;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.bulk-bar-close:hover { color: var(--text); background: var(--border); }

/* on/off toggle switch */
.toggle-switch {
    position: relative;
    width: 38px; height: 22px;
    border-radius: 999px;
    background: var(--border);
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: background 0.18s;
    display: inline-block;
    vertical-align: middle;
}
.toggle-switch.on { background: var(--brand); }
.toggle-switch .toggle-knob {
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.18s;
}
.toggle-switch.on .toggle-knob { transform: translateX(16px); }
/* auto-disabled (below top-30) — locked off, the user can't switch it on */
.toggle-switch.is-locked {
    background: var(--orange-bg);
    cursor: not-allowed;
}
.toggle-switch.is-locked .toggle-knob {
    background: var(--orange);
    box-shadow: none;
}
.delta-zero { color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--brand-tint); border-color: var(--brand-light); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #f9d8d8; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORMS ===== */
.form-row { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--card);
    outline: none;
    transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--brand); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-input:disabled { background: var(--bg); color: var(--text-muted); }
.form-error { color: var(--red); font-size: 12px; margin-top: 5px; }
.form-input.is-invalid, .form-textarea.is-invalid, .form-select.is-invalid {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 5px; }

/* locked field + hover tooltip */
.locked-field { position: relative; }
.locked-field .form-input { cursor: not-allowed; padding-right: 38px; }
.locked-field::before {
    content: '';
    position: absolute;
    right: 13px; top: 36px;
    width: 14px; height: 14px;
    background: no-repeat center / contain
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8AA3' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
    pointer-events: none;
}
.locked-field::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0; top: calc(100% + 6px);
    background: var(--text);
    color: #fff;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 0.15s, transform 0.15s;
    z-index: 20;
}
.locked-field:hover::after { opacity: 1; transform: translateY(0); }

/* ===== FLASH ===== */
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    border: 0;
}
.flash-content { flex: 1 1 240px; line-height: 1.45; }
.flash-success { background: var(--green-bg); color: #0f5132; }
.flash-error { background: var(--red-bg); color: #842029; }
.flash-warning { background: var(--orange-bg); color: #8a4b00; border: 1px solid #f0d49c; }
.flash-brand { background: var(--brand-tint); color: var(--text); border: 1px solid var(--brand-light); }
.flash-brand strong { color: var(--brand); }

/* ===== BALANCE-OPTION (project launch modal) — redesign 1-1 with demo ===== */
.balance-option {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 7px;
    transition: border-color 0.15s, background 0.15s;
}
.balance-option:hover { border-color: var(--brand-light); }
.balance-option input[type="radio"] { accent-color: var(--brand); flex-shrink: 0; }
.balance-option:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.balance-option.is-disabled { opacity: 0.55; cursor: not-allowed; }
.balance-option.is-disabled:hover { border-color: var(--border); }
.balance-option-title {
    font-weight: 600;
    display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
}
.balance-option-amount { color: var(--brand); font-size: 16px; }
.balance-option-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.balance-option-check {
    font-size: 12px; color: var(--green); font-weight: 600; margin-top: 3px;
    display: inline-flex; align-items: center; gap: 4px;
}
.balance-option-check svg { width: 13px; height: 13px; }
.balance-line { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.balance-name { font-weight: 600; font-size: 14px; color: var(--text); }
.balance-name i { font-style: normal; font-weight: 500; font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.balance-option:has(input:checked) .balance-name i { color: var(--green); }
.balance-option.is-disabled .balance-name { color: var(--text-muted); }
.balance-pick-label { font-size: 13px; font-weight: 700; color: var(--text); margin: 0 0 8px; }

/* reactivation popup list */
.reactivation-list {
    display: flex; flex-direction: column;
    max-height: 320px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.reactivation-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 9px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.reactivation-item:last-child { border-bottom: 0; }
.reactivation-item .muted { font-size: 12px; }

/* ===== EMPTY STATE ===== */
.empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty svg { width: 52px; height: 52px; color: #C9C9D8; margin-bottom: 14px; }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; }

/* большой empty-state с иллюстрацией */
.empty-hero { padding: 64px 24px; }
.empty-hero .empty-illustration { width: 220px; height: 170px; margin: 0 auto 8px; }
.empty-hero h3 { font-size: 20px; }
.empty-hero p { font-size: 14px; max-width: 420px; margin: 6px auto 0; }
.empty-hero .btn { margin-top: 22px; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(30, 27, 46, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    position: relative;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 20px; }
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 30px; height: 30px;
    border: 0; background: var(--bg); border-radius: 8px;
    font-size: 18px; color: var(--text-muted); line-height: 1;
}
.modal-close:hover { background: var(--border); }

/* Bump-budget confirm — карточка статистики перед подтверждением */
.bump-confirm-stats { display: flex; flex-direction: column; gap: 10px; background: var(--brand-tint); border: 1px solid var(--brand-light); border-radius: var(--radius-sm); padding: 14px 16px; }
.bump-stat { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.bump-stat-label { color: var(--text-muted); }
.bump-stat-value { color: var(--text); font-weight: 600; }

/* ===== ROW ACTIONS (3-dots menu) ===== */
.actions-menu { position: relative; display: inline-block; }
.actions-menu-btn {
    width: 32px; height: 32px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.actions-menu-btn:hover { background: var(--brand-tint); color: var(--text); border-color: var(--border); }
.actions-menu-btn svg { width: 18px; height: 18px; }
.actions-menu-pop {
    position: fixed;
    min-width: 180px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(30, 27, 46, 0.10);
    padding: 6px;
    display: none;
    z-index: 1000;
}
.actions-menu.open .actions-menu-pop { display: block; }
.actions-menu-item {
    display: flex; align-items: center; gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: 0;
    background: none;
    text-align: left;
    font: inherit; font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.actions-menu-item:hover { background: var(--brand-tint); }
.actions-menu-item svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.actions-menu-item.danger { color: var(--red); }
.actions-menu-item.danger:hover { background: var(--red-bg); }
.actions-menu-item.danger svg { color: var(--red); }

/* ===== PROJECT HEADER BAR ===== */
.project-header-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.project-header-bar .back-btn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.project-header-bar .back-btn:hover { background: var(--brand-tint); color: var(--text); }
.project-header-bar .back-btn svg { width: 20px; height: 20px; }
.project-header-bar h1 { font-size: 22px; font-weight: 700; }
.project-header-bar .spacer { flex: 1; }
.project-header-actions { display: flex; gap: 10px; }

/* ===== TWO-COLUMN PROJECT LAYOUT ===== */
.project-two-col {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}
.project-two-col > .card {
    margin-top: 0;
    display: flex;
    flex-direction: column;
}
.project-two-col > .card > .info-list { flex: 1; }
.project-two-col > .card > .chart-empty { flex: 1; }
@media (max-width: 1024px) {
    .project-two-col { grid-template-columns: 1fr; }
}

/* INFO LIST (label/value rows in project info card) */
.info-list { display: flex; flex-direction: column; }
.info-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    font-size: 14px;
    gap: 12px;
}
.info-row:first-child { border-top: 0; padding-top: 4px; }
.info-row:last-child { padding-bottom: 0; }
.info-label {
    display: inline-flex; align-items: center; gap: 9px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.info-label svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.info-value { font-weight: 600; color: var(--text); text-align: right; }
.info-value a { color: var(--brand); }

/* Текстовая «ссылка-кнопка» внутри info-row — для невязкого действия «Изменить тариф» и т.п. */
.link-action {
    background: none; border: 0; padding: 0;
    color: var(--brand); font-size: 13px; font-weight: 500;
    cursor: pointer; text-align: right;
}
.link-action:hover { text-decoration: underline; }

/* small icon button (share/edit on cards) */
.icon-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-tint);
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--brand);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--brand-light); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn-group { display: inline-flex; gap: 6px; }

/* CHART CARD TABS */
.chart-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: -22px -24px 18px;
    padding: 0 16px;
}
.chart-tab {
    padding: 14px 14px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px;
}
.chart-tab:hover { color: var(--text); }
.chart-tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.chart-tab svg { width: 12px; height: 12px; }

/* CHART INFO HINT (i icon + text) */
.chart-hint {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
}
.chart-hint svg { width: 14px; height: 14px; flex-shrink: 0; }

/* CHART RICH LEGEND (multiple TOP dots) */
.chart-legend-rich {
    display: flex; flex-wrap: wrap; gap: 14px;
    margin: 14px 0 8px;
}
.chart-legend-rich span {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}
.chart-legend-rich .dot { width: 8px; height: 8px; border-radius: 50%; }

/* CHART EMPTY STATE */
.chart-empty {
    min-height: 280px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 15px;
    text-align: center;
    padding: 24px;
}

/* paused state pill */
.pill-paused, .pill-ready {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--orange);
    background: var(--orange-bg);
    padding: 2px 8px; border-radius: 6px;
    margin-left: 8px;
    white-space: nowrap;
}
/* configured, not launched yet */
.pill-ready { color: var(--blue); background: var(--blue-bg); }

/* «Запустить» прямо в строке списка (не только в меню «три точки») */
.btn-launch { padding: 6px 12px; font-size: 13px; margin-right: 8px; vertical-align: middle; }
.btn-launch svg { width: 12px; height: 12px; }
.launch-hint { font-size: 12px; color: var(--text-muted); margin-right: 8px; vertical-align: middle; white-space: nowrap; }

/* ===== STATUS DOT / PILL ===== */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600;
    padding: 4px 11px; border-radius: 20px;
}
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--green-bg); color: var(--green); }
.status-idle { background: var(--bg); color: var(--text-muted); }

/* ===== MISC ===== */
.section-gap { margin-top: 20px; }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 18px;
}
.stat-grid .s-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-grid .s-value { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* pagination (Laravel default) */
.content nav[role="navigation"] { margin-top: 18px; }
.content nav[role="navigation"] span, .content nav[role="navigation"] a {
    font-size: 13px;
}

/* ===== RESPONSIVE ===== */
.sidebar-toggle {
    display: none;
    position: fixed; top: 16px; left: 16px; z-index: 210;
    width: 40px; height: 40px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
}

@media (max-width: 1024px) {
    .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
        z-index: 220;
        box-shadow: 0 0 40px rgba(0,0,0,0.15);
    }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; padding: 72px 20px 32px; }
    .sidebar-toggle { display: flex; }
}

/* ===== PLAN MODAL — redesign 1-1 with demo ===== */
.launch-plan-modal { max-width: 780px; padding: 22px 24px; }
.launch-plan-modal h2 { margin-bottom: 14px; }
.plan-modal-summary {
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: 14px;
    padding: 12px 14px;
    margin: -4px 0 16px;
}
.plan-modal-summary strong { display: block; font-size: 14px; margin-bottom: 2px; }
.plan-modal-summary span { display: block; color: var(--text-muted); font-size: 13px; }

/* launch modal — hero summary with ready-count */
.plan-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: 14px;
    padding: 14px 16px;
    margin: -2px 0 12px;
}
.plan-hero-eyebrow {
    color: var(--brand);
    font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
    margin-bottom: 4px;
}
.plan-hero h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.2; color: var(--text); }
.plan-hero p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.plan-hero p .rec { color: var(--green); font-weight: 700; }
.plan-hero-stat {
    flex-shrink: 0;
    min-width: 96px;
    background: var(--card);
    border: 1px solid var(--brand-light);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
}
.plan-hero-stat b { display: block; font-size: 30px; line-height: 1; font-weight: 800; color: var(--brand); }
.plan-hero-stat span { display: block; margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.plan-grid, .plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.plan-card {
    position: relative;
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
.plan-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.plan-card.is-selected {
    border-color: var(--brand);
    background: var(--brand-tint);
    box-shadow: 0 0 0 3px var(--brand-light);
}
.plan-card .plan-name { display: block; font-weight: 800; margin-bottom: 8px; font-size: 15px; }
.plan-card strong, .plan-card .plan-price { display: block; color: var(--text); font-size: 24px; line-height: 1; margin-bottom: 4px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.plan-card .plan-day { display: block; color: var(--brand-dark); font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.plan-card small { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 10px; }
.plan-card em, .plan-card .plan-hint { display: block; color: var(--text-muted); font-size: 12.5px; line-height: 1.35; font-style: normal; }
.plan-card.is-selected strong, .plan-card.is-selected .plan-price { color: var(--brand-dark); }
.plan-badge, .plan-card .plan-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}
.plan-reserve-note {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
}
.balance-mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 14px;
}
.balance-mini-row strong { color: var(--text); font-size: 16px; }

/* launch modal — footer (balance + submit) */
.plan-modal-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-top: 4px;
}
.plan-modal-footer .balance-label { font-size: 14px; color: var(--text-muted); }
.plan-modal-footer .balance-label strong { color: var(--text); font-weight: 700; }
.plan-modal-footer .btn { flex-shrink: 0; }

/* launch modal — pay-now reserve summary */
.pay-now {
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: 12px;
    padding: 11px 14px;
    margin-bottom: 12px;
}
.pay-now-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.pay-now-row .lbl { font-size: 14px; color: var(--text); font-weight: 600; }
.pay-now-row .amt { font-size: 20px; font-weight: 800; color: var(--brand-dark); letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.pay-now-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.pay-now-sub b { color: var(--text); font-weight: 600; }
.plan-submit-btn { flex-direction: column; gap: 1px; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; }
.plan-submit-main { display: block; font-size: 15px; font-weight: 700; }
.plan-submit-main b { font-weight: 800; }
.plan-submit-sub { display: block; font-size: 11.5px; font-weight: 500; opacity: .85; }

@media (max-width: 760px) {
    .plan-grid, .plan-cards { grid-template-columns: 1fr; }
}

/* ===== PROJECT CARD — tariff inline value + CTA (1-1 with demo) ===== */
.plan-inline-value {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}
.plan-inline-value strong { font-size: 14px; }
.plan-inline-value span { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.plan-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.plan-need-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--orange-bg);
    color: var(--orange);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.plan-cta { margin-top: 16px; }
.plan-cta-btn {
    width: 100%;
    justify-content: center;
    gap: 8px;
}
.plan-cta-btn svg { width: 15px; height: 15px; }

/* ===== EVENTS-PANEL (sidebar bell) ===== */
.events-toggle { position: relative; }
.events-count {
    margin-left: auto;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 99px; background: var(--brand); color: #fff;
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.events-toggle.is-empty .events-count { display: none; }
.events-panel {
    position: fixed; left: calc(var(--sidebar-w) + 8px); bottom: 80px;
    width: 360px; max-height: 70vh; overflow: hidden;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    display: none; flex-direction: column; z-index: 250;
}
.events-panel.open { display: flex; }
.events-panel-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.events-panel-title { font-weight: 600; }
.events-readall { font-size: 12px; color: var(--brand); background: none; border: 0; cursor: pointer; padding: 0; }
.events-panel-body { overflow-y: auto; flex: 1; }
.event-item {
    display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border);
    text-decoration: none; color: inherit;
}
.event-item:hover { background: var(--brand-tint); }
.event-ico { width: 22px; height: 22px; color: var(--text-muted); flex-shrink: 0; }
.event-item.event-warning .event-ico { color: #E08C2A; }
.event-item.event-danger .event-ico { color: #DC2A4E; }
.event-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.event-title { font-weight: 600; font-size: 13px; }
.event-desc { font-size: 12px; color: var(--text-muted); }
.event-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.event-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== GROWTH-PANEL — redesign 1-1 with demo ===== */
.growth-panel {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 26px 22px;
    margin: 0 0 20px;
    overflow: hidden;
}
.growth-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--orange) 0%, var(--brand) 100%);
}
.growth-panel.is-hidden { display: none; }

.growth-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.growth-badge {
    flex-shrink: 0;
    height: 38px;
    min-width: 46px;
    padding: 0 12px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--orange-bg);
    color: var(--orange);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.3px;
}
.growth-head-text h3 {
    margin: 1px 0 3px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -.2px;
}
.growth-head-text p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.4; }

.growth-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.growth-table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    padding: 0 0 10px;
    border-bottom: 1px solid var(--border);
}
.growth-table th.num, .growth-table td.num { text-align: right; }
.growth-table th.pos, .growth-table td.pos { text-align: center; }
.growth-table tbody tr { transition: background .12s ease; }
.growth-table tbody tr:hover { background: var(--brand-tint); }
.growth-table td {
    padding: 12px 0;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.growth-table tbody tr:last-child td { border-bottom: 0; }
.growth-table td:first-child { padding-left: 10px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.growth-table td:last-child { padding-right: 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.growth-table .kw { font-weight: 600; letter-spacing: -.1px; }
.growth-num { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.growth-price { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* Позиция в блоке роста рисуется общим .badge + .pos-badge — как в таблице запросов,
   чтобы одно и то же число не выглядело в двух местах по-разному. Собственных стилей
   у колонки больше нет. */

.growth-sum {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1.1fr;
    align-items: center;
    gap: 0;
    background: var(--brand-tint);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.growth-sum-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.growth-sum-item .lbl { font-size: 11.5px; color: var(--text-muted); font-weight: 600; letter-spacing: .2px; }
.growth-sum-item .val { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.growth-sum-item .val span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.growth-sum-item .sub { font-size: 11px; color: var(--text-muted); }
.growth-sum-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: #C7BEEA;
}
.growth-sum-arrow svg { width: 20px; height: 20px; }
.growth-sum-pay {
    padding-left: 20px;
    border-left: 1px dashed #D6CEF2;
}
.growth-sum-pay .lbl { color: var(--brand-dark); }
.growth-sum-pay .val { color: var(--brand-dark); font-size: 22px; }

.growth-note {
    display: flex;
    gap: 9px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
    padding: 0 2px;
}
.growth-note svg { flex-shrink: 0; margin-top: 1px; color: var(--orange); }
.growth-note strong { color: var(--text); font-weight: 600; }

.growth-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.growth-actions .btn-primary { padding-left: 22px; padding-right: 22px; }
.growth-actions .growth-skip,
.growth-skip {
    background: none;
    border: 0;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 6px;
    cursor: pointer;
    transition: color .12s ease;
}
.growth-skip:hover { color: var(--text); }

@media (max-width: 860px) {
    .growth-sum { grid-template-columns: 1fr 1fr; gap: 16px 12px; }
    .growth-sum-arrow { display: none; }
    .growth-sum-pay {
        grid-column: 1 / -1;
        padding: 14px 0 0;
        margin-top: 2px;
        border-left: 0;
        border-top: 1px dashed #D6CEF2;
    }
}

/* ===== TG-BONUS HERO BANNER (билинг/профиль) ===== */
.tg-hero {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--brand), #6B5BFF);
    color: #fff;
    border-radius: var(--radius);
    margin: 8px 0 20px;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}
.tg-hero-ico {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 99px; background: rgba(255,255,255,0.18);
    display: inline-flex; align-items: center; justify-content: center;
}
.tg-hero-ico svg { width: 22px; height: 22px; color: #fff; }
.tg-hero-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tg-hero-text strong { font-size: 16px; line-height: 1.3; }
.tg-hero-text span { font-size: 13px; opacity: 0.92; }
.tg-hero .btn-primary {
    background: #fff; color: var(--brand); border-color: #fff;
    flex-shrink: 0;
}
.tg-hero .btn-primary:hover { background: rgba(255,255,255,0.92); color: var(--brand-dark); }
@media (max-width: 640px) {
    .tg-hero { flex-direction: column; align-items: flex-start; }
    .tg-hero .btn-primary { width: 100%; justify-content: center; }
}

/* =====================================================================
   RESPONSIVE REFINEMENTS — сквозной адаптив панели (360px → desktop).
   Блок в конце файла: переопределяет базовые правила по каскаду.
   ===================================================================== */

/* Затемнение под выдвинутым сайдбаром (только мобайл, см. @media ≤860). */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(30, 27, 46, 0.45); z-index: 219;
}

/* Длинные таблицы — инерционный скролл на тач-устройствах. */
.table-scroll, .table-scroll.sticky-cols-2 { -webkit-overflow-scrolling: touch; }

/* Планшет-ландшафт: метрики 3 → 2 в ряд. */
@media (max-width: 1024px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Планшет-портрет / крупный телефон. */
@media (max-width: 768px) {
    .page-title { font-size: 22px; }
    .chart-box { height: 240px; }
    .chart-legend, .chart-legend-rich { gap: 10px 14px; }
    .chart-tabs { flex-wrap: wrap; }
    .kw-tabs { flex-wrap: wrap; }
}

/* Телефон. */
@media (max-width: 640px) {
    .metric-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 20px; }
    .page-head { gap: 12px; }
    .card { padding: 16px; }
    .modal { padding: 20px; }
    .modal-overlay { padding: 12px; }
    .search-field { max-width: none; }
    .data-table th, .data-table td { padding-left: 10px; padding-right: 10px; }
    /* Плавающая панель массовых действий: разрешаем перенос, не давим за экран. */
    .bulk-bar {
        left: 8px; right: 8px; transform: none; max-width: none;
        flex-wrap: wrap; justify-content: center;
        gap: 8px; border-radius: 16px; padding: 12px 14px;
    }
    .bulk-bar.is-hidden { transform: translateY(16px); }
    /* Корзина на телефоне — колонкой: суммы под счётчиком, кнопка во всю ширину. */
    .bulk-bar.is-cart {
        width: auto; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px;
    }
    .bulk-bar.is-cart .bulk-cart-sums {
        padding-left: 0; border-left: 0;
        border-top: 1px solid var(--border); padding-top: 10px;
        justify-content: space-between;
    }
    .bulk-bar.is-cart .btn-primary { width: 100%; justify-content: center; }
    /* В колонку крестик занимал бы отдельную строку под кнопкой — уводим его в угол панели. */
    .bulk-bar.is-cart .bulk-bar-close { position: absolute; top: 8px; right: 8px; }
    .bulk-bar.is-cart .bulk-cart-left { padding-right: 36px; }
    .kw-search-field { max-width: none; }
}

/* Узкие экраны. */
@media (max-width: 400px) {
    .content { padding-left: 14px; padding-right: 14px; }
    .card { padding: 14px; }
}

/* ≤860: сайдбар уже скрыт в бургер — панель событий и backdrop под мобайл. */
@media (max-width: 860px) {
    .events-panel {
        left: 8px; right: 8px; width: auto;
        bottom: 12px; max-height: 70vh;
    }
    .sidebar-backdrop.show { display: block; }
}

/* ===== ОПРОСЫ (NPS) ===== */

/* Баннер опроса скрыт, пока открыт попап. Атрибут hidden без !important бессилен:
   у .flash задан display:flex, и он перебивает браузерное [hidden]{display:none}. */
.flash[hidden] { display: none !important; }

/* Заголовок попапа не должен заезжать под крестик закрытия. */
#surveyModal .modal h2 { padding-right: 34px; }

/* Скрытый инпут шкалы: clip-path, а не display:none — иначе элемент выпадает из tab-order,
   и оценку нельзя выбрать с клавиатуры. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.survey-hero {
    display: flex; align-items: center; gap: 16px; padding: 18px 20px;
    background: linear-gradient(135deg, var(--brand), #6B5BFF);
    color: #fff; border-radius: var(--radius); margin: 8px 0 20px;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}
.survey-hero-ico {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 99px;
    background: rgba(255,255,255,0.18); display: inline-flex; align-items: center; justify-content: center;
}
.survey-hero-ico svg { width: 22px; height: 22px; color: #fff; }
.survey-hero-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.survey-hero-text strong { font-size: 16px; line-height: 1.3; }
.survey-hero-text span { font-size: 13px; opacity: 0.92; }

.survey-q + .survey-q { margin-top: 16px; }
.survey-q.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,0.12); }
.survey-q-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.survey-q-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex: none; border-radius: 9px;
    background: var(--brand-light); color: var(--brand); font-size: 12px; font-weight: 700;
}
.survey-q-title { font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; max-width: 68ch; }
.survey-q-req { color: var(--red); margin-left: 4px; }
.survey-q-hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Шкала 1–5: подписи есть не у всех делений, min-height держит ряд ровным. */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.scale-item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card); cursor: pointer; text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.scale-item:hover { border-color: var(--brand-light); background: var(--brand-tint); }
.scale-num {
    width: 40px; height: 40px; border-radius: 999px; flex: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
    background: var(--bg); color: var(--text); transition: background 0.15s, color 0.15s;
}
.scale-cap { font-size: 12px; line-height: 1.35; color: var(--text-muted); min-height: 2.7em; overflow-wrap: anywhere; }
.scale-item input:checked ~ .scale-num { background: var(--brand); color: #fff; }
.scale-item input:checked ~ .scale-cap { color: var(--text); }
.scale-item:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.scale-item:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.survey-opt {
    display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.survey-opt + .survey-opt { margin-top: 8px; }
.survey-opt:hover { border-color: var(--brand-light); background: var(--brand-tint); }
.survey-opt input { accent-color: var(--brand); flex: none; width: 18px; height: 18px; margin-top: 1px; }
.survey-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.survey-opt-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }

.survey-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.survey-note { font-size: 13px; color: var(--text-muted); }

.survey-done { text-align: center; padding: 48px 24px; }
.survey-done-ico {
    width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 999px;
    background: var(--green-bg); color: var(--green);
    display: flex; align-items: center; justify-content: center;
}
.survey-done-ico svg { width: 30px; height: 30px; }
.survey-done h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.survey-done p { color: var(--text-muted); max-width: 46ch; margin: 0 auto 20px; }

@media (max-width: 640px) {
    /* Пять колонок с подписями на узком экране нечитаемы — разворачиваем в строки. */
    .scale { grid-template-columns: 1fr; gap: 8px; }
    .scale-item { flex-direction: row; align-items: center; text-align: left; gap: 12px; padding: 10px 12px; min-height: 56px; }
    .scale-num { width: 34px; height: 34px; font-size: 15px; }
    .scale-cap { min-height: 0; font-size: 13.5px; }
    .survey-hero { flex-direction: column; align-items: flex-start; }
    .survey-actions .btn { flex: 1; justify-content: center; }
}

/* ===== Аналитика проекта (отчёт топВышки, 19.10.2026) ===== */
.an-tabs { margin: -4px 0 20px; }
.an-domain { color: var(--text-muted); font-size: 14px; }
.an { display: flex; flex-direction: column; gap: 20px; --an-accent: #7C3AED; --an-accent-2: #16A34A; }
.an [hidden] { display: none !important; }
.an .card + .card { margin-top: 0; }
.an-filters { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-end; padding: 16px 20px; }
.an-filter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.an-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chip { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: var(--radius-sm); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.an-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.an-select { min-width: 110px; }
.an-dates { display: flex; gap: 8px; flex-wrap: wrap; }
.an-dates .form-input { width: 150px; }
.an-state { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; color: var(--text-muted); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.an-body { display: flex; flex-direction: column; gap: 20px; }
.an-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.an-head h2, .an-section-title { font-size: 20px; font-weight: 700; margin: 4px 0 0; }
.an-grid-top { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; }
.an-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.an-stack { display: flex; flex-direction: column; gap: 20px; }
.an-card { min-width: 0; }
.an-chart { position: relative; height: 280px; }
.an-chart-tall { height: 320px; }
.an-chart-tabs { margin: 0; }
.an-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.an-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.an-tile-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.an-tile-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.an-tile-sub { font-size: 13px; color: var(--text-muted); }
.an-table td.num, .an-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-table th.an-sortable { cursor: pointer; user-select: none; }
.an-table tr.an-own td { background: var(--brand-tint); font-weight: 600; }
.an-table td:first-child { min-width: 180px; }
.an-url { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.an-more { margin-top: 12px; }
.an-up { color: var(--green); font-weight: 600; }
.an-down { color: var(--red); font-weight: 600; }
.an-flat { color: var(--text-muted); }
.an-muted { color: var(--text-muted); font-size: 13px; }
.an-strong { font-weight: 600; }
.an-list { display: flex; flex-direction: column; }
.an-list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.an-list-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.an-list-row:last-child { border-bottom: none; }
.an-vol-value { font-size: 32px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.an-vol-bar { height: 6px; border-radius: 3px; background: var(--brand-light); margin: 10px 0 16px; overflow: hidden; }
.an-vol-bar span { display: block; height: 100%; background: var(--brand); }
.an-vol-lists { gap: 16px; }
@media (max-width: 1100px) {
    .an-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .an-grid-top, .an-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .an-tiles { grid-template-columns: minmax(0, 1fr); }
    .an-dates .form-input { width: 100%; }
}

/* Аналитика, 20.10.2026: «Сбросить» у фильтров, подписи «с» и «по», даты на плитках обзора. */
.an-filters .an-reset { margin-left: auto; align-self: flex-end; }
.an-date { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.an-tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.an-tile-date { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) { .an-date { flex: 1 1 100%; } .an-filters .an-reset { margin-left: 0; } }
.an-date > span { min-width: 18px; }

/* ===== Вкладка «Позиции» (21.10.2026): разметка и классы «Аналитики» (.an), здесь только таблица съёма.
   Таблицу рисует resources/js/positions/positions-tab.js (общий с Click). ===== */
.ptab { --pt-t1: #D3F1DE; --pt-t2: #EAF8EF; --pt-t3: #FEF3E2; }
.ptab .pt-status { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; align-self: center; color: var(--text-muted); font-size: 13px; }
.ptab .pt-spin { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: pt-spin .8s linear infinite; }
@keyframes pt-spin { to { transform: rotate(360deg); } }
.ptab .card-head .an-muted { margin-right: auto; }
.ptab .an-chip [data-pt-c] { opacity: .7; margin-left: 2px; }
.ptab .pt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.ptab .pt-toolbar .kw-search-field { flex: 1 1 220px; max-width: 320px; }
.ptab .pt-tint { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.ptab .pt-tint input { position: absolute; opacity: 0; pointer-events: none; }
.ptab .pt-tint input:checked + .toggle-switch { background: var(--brand); }
.ptab .pt-tint input:checked + .toggle-switch .toggle-knob { transform: translateX(16px); }
.ptab .pt-tint input:focus-visible + .toggle-switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.ptab .pt-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px; }
.ptab .pt-sw { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-weight: 600; }
.ptab .pt-sw small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.ptab .pt-sw.t1 { background: var(--pt-t1); border-color: var(--pt-t1); }
.ptab .pt-sw.t2 { background: var(--pt-t2); border-color: var(--pt-t2); }
.ptab .pt-sw.t3 { background: var(--pt-t3); border-color: var(--pt-t3); }
.ptab .pt-wrap { max-height: min(640px, 72vh); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ptab .pt { border-collapse: separate; border-spacing: 0; width: auto; font-variant-numeric: tabular-nums; } /* по содержимому: столбцы - только дни со съёмом */
.ptab .pt th, .ptab .pt td { padding: 9px 10px; font-size: 13px; white-space: nowrap; background: var(--card); }
.ptab .pt thead th { position: sticky; top: 0; z-index: 2; }
.ptab .pt .c-q { position: sticky; left: 0; z-index: 1; min-width: 220px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; text-align: left; box-shadow: inset -1px 0 0 var(--border); }
.ptab .pt thead .c-q { z-index: 3; }
.ptab .pt .c-num { text-align: right; }
.ptab .pt .c-delta { box-shadow: inset -1px 0 0 var(--border); }
.ptab .pt .c-d { min-width: 56px; text-align: center; }
.ptab .pt .c-d.wide { min-width: 84px; }
.ptab .pt td.t1 { background: var(--pt-t1); }
.ptab .pt td.t2 { background: var(--pt-t2); }
.ptab .pt td.t3 { background: var(--pt-t3); }
.ptab .pt.no-tint td.t1, .ptab .pt.no-tint td.t2, .ptab .pt.no-tint td.t3 { background: var(--card); }
.ptab .pt tbody tr:hover td { box-shadow: inset 0 0 0 999px rgba(124, 58, 237, .04); }
.ptab .pt .pv { font-weight: 600; }
.ptab .pt .pv.none { color: var(--text-muted); font-weight: 400; }
.ptab .pt .pd { display: block; font-size: 11px; font-weight: 600; line-height: 1.1; }
.ptab .pt .c-delta .pd { display: inline; font-size: 13px; }
.ptab .pd.up { color: var(--green); }
.ptab .pd.down { color: var(--red); }
.ptab .th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.ptab .th-sort svg { width: 12px; height: 12px; opacity: .45; }
.ptab .th-sort[data-dir] { color: var(--text); }
.ptab .th-sort[data-dir] svg { opacity: 1; color: var(--brand); }
.ptab .pt .th-d > span { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.ptab .pt .th-d small { font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.ptab .pt tfoot th, .ptab .pt tfoot td { background: var(--bg); color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.ptab .pt tfoot td.c-d { color: var(--text); font-weight: 600; }
.ptab .pt tfoot tr:first-child > * { border-top: 1px solid var(--border); }
.ptab .pager-links { gap: 8px; }
.ptab .pager-link { cursor: pointer; font: inherit; }
.ptab .pager-link[disabled] { opacity: .4; cursor: not-allowed; }
@media (max-width: 640px) {
    .ptab .pt .c-q { min-width: 140px; max-width: 170px; }
    .ptab .pt-tint, .ptab .pt-status { margin-left: 0; }
    .ptab .pt-toolbar .kw-search-field { max-width: none; }
}
.ptab .pt-wrap { width: fit-content; max-width: 100%; }
