/* ==========================================================================
   VIP DATA HUB — единая тема в языке бренда N1 Partners (референс: https://n1.partners/).

   Всё ниже снято с CSS сайта бренда, а не выдумано:
     • шрифты — Druk Wide Cy (заголовки: 900/700, ЗАГЛАВНЫЕ, letter-spacing 0) и Exo 2 (текст);
     • палитра — красно-оранжевый #ff230a, фон #151515, белый, светло-серый #f4f4f4, приглушённый #808191;
     • кнопки — прямоугольники без скруглений: контурная белая (заливается #ff230a при наведении)
       и сплошная #ff230a; в меню — короткие красные подчёркивания; в макете — косые красные полосы.
   Отсюда и общий язык: ПРЯМЫЕ углы, плоские заливки, тонкие разделители, жирные заглавные заголовки.
   Осознанно нет скруглённых карточек-пилюль, градиентных плиток, свечений и пастельных тинтов.

   Страницы хаба подключают этот файл через _dh_head.html и собираются из компонентов ниже
   (dh-card, dh-kpi, dh-seg, dh-table …) макросами из _dh_ui.html. Цвета живут ТОЛЬКО в переменных
   --dh-*. Тема одна — светлая (тёмную по решению заказчика убрали); сайдбар остаётся тёмным —
   это фирменный якорь макета, как шапка сайта бренда.
   ========================================================================== */

@font-face { font-family: 'Druk Wide Cy'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/Druk-Wide-Medium-Web.woff2') format('woff2'); }
@font-face { font-family: 'Druk Wide Cy'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/Druk-Wide-Super-Web.woff2') format('woff2'); }
@font-face { font-family: 'Druk Wide Cy'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/Druk-Wide-Bold-Web.woff2') format('woff2'); }
@font-face { font-family: 'Druk Wide Cy'; font-weight: 900; font-style: normal; font-display: swap; src: url('../fonts/Druk-Wide-Heavy-Web.woff2') format('woff2'); }

:root {
    color-scheme: light;

    --dh-font: 'Exo 2', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Golos Text', 'Inter', system-ui, sans-serif;
    --dh-display: 'Druk Wide Cy', 'Exo 2', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    /* поверхности (светло-серый фон сайта бренда — #f4f4f4) */
    --dh-bg: #f4f4f4;
    --dh-surface: #ffffff;
    --dh-surface-2: #f8f8f8;
    --dh-surface-3: #e9e9e9;
    --dh-hover: rgba(21, 21, 21, 0.045);
    --dh-line: rgba(21, 21, 21, 0.12);
    --dh-line-2: rgba(21, 21, 21, 0.22);
    --dh-btn-line: #151515;                       /* контур кнопок: фирменный #151515 */
    --dh-shadow-pop: 0 16px 36px -12px rgba(21, 21, 21, 0.3);

    /* текст */
    --dh-ink: #151515;
    --dh-ink-2: #4e4e50;
    --dh-ink-3: #6b6d7c;                          /* приглушённый #808191 бренда, затемнён до контраста 4.5:1 на белом */

    /* бренд */
    --dh-brand: #ff230a;                          /* заливки и метки; белый на нём — для жирного/крупного текста */
    --dh-brand-hi: #ff4a33;
    --dh-brand-ink: #d81a03;                      /* акцентный ТЕКСТ на светлой поверхности (контраст 5.2:1) */
    --dh-brand-soft: rgba(255, 35, 10, 0.08);
    --dh-brand-line: rgba(255, 35, 10, 0.45);

    /* статусы (значение всегда дублируется иконкой/подписью) */
    --dh-ok-ink: #006300;
    --dh-ok-soft: rgba(12, 163, 12, 0.11);
    --dh-warn-ink: #8a5a00;
    --dh-warn-soft: rgba(250, 178, 25, 0.17);
    --dh-bad-ink: #b42323;
    --dh-bad-soft: rgba(208, 59, 59, 0.10);

    /* категориальная палитра графиков (слоты 1–7, порядок фиксирован — проверено validate_palette) */
    --dh-s1: #ff230a;
    --dh-s2: #2a78d6;
    --dh-s3: #1baf7a;
    --dh-s4: #eda100;
    --dh-s5: #e87ba4;
    --dh-s6: #008300;
    --dh-s7: #4a3aa7;
    --dh-other: #c3c2b7;

    /* оформление графиков */
    --dh-grid: #e6e6e6;
    --dh-axis: #cfcfcf;
    --dh-tip-bg: #ffffff;

    /* сайдбар (тёмный — фирменный якорь макета) */
    --dh-side-bg: #101010;
    --dh-side-line: rgba(255, 255, 255, 0.08);
    --dh-side-ink: #a4a4a4;
    --dh-side-ink-hi: #ffffff;
    --dh-side-hover: rgba(255, 255, 255, 0.06);
    --dh-side-active: rgba(255, 255, 255, 0.07);
    --dh-side-brand-ink: #ff4a33;                 /* красный текст/иконки на тёмном сайдбаре */
    --dh-side-brand-soft: rgba(255, 35, 10, 0.18);
}

/* ---------- база ---------- */
html { background: var(--dh-bg); }
body.dh {
    background: var(--dh-bg);
    color: var(--dh-ink);
    font-family: var(--dh-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: opacity 0.16s ease, transform 0.16s ease;
}
/* Переход на другую страницу. Класс page-leaving вешают ссылки/формы (см. data_hub.js, nav_loading.js и inline-скрипты
   QC-страниц). Страницу НЕ гасим до пустого фона — пока сервер собирает следующую (запросы в BigQuery — секунды),
   вместо пустоты видны: красная полоса прогресса сверху, «дышащий» контент и плашка внизу. */
body.dh.page-leaving { opacity: 1; transform: none; }
body.dh::before {
    content: ''; position: fixed; z-index: 300; top: 0; left: 0; right: 0; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent) -160px 0 / 160px 100% no-repeat, var(--dh-brand);
    transform: scaleX(0); transform-origin: left; opacity: 0;
}
body.dh.page-leaving::before {
    opacity: 1; animation: dhProgress 9s cubic-bezier(0.1, 0.7, 0.2, 1) forwards, dhSheen 1.1s linear infinite;
}
body.dh.page-leaving main { animation: dhBreathe 1.1s ease-in-out infinite alternate !important; pointer-events: none; }
body.dh.page-leaving::after {
    content: 'Загружаем данные'; position: fixed; z-index: 300; left: calc(50% + 128px); bottom: 36px; transform: translateX(-50%);
    padding: 15px 30px 17px; white-space: nowrap;
    font-family: var(--dh-display); font-size: 11px; font-weight: 700; line-height: 1.4; text-transform: uppercase; color: #fff;
    background: linear-gradient(90deg, transparent, var(--dh-brand), transparent) -120px 100% / 120px 3px no-repeat, #151515;
    border-left: 4px solid var(--dh-brand); box-shadow: var(--dh-shadow-pop);
    animation: dhToastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both, dhSweep 1.1s linear infinite;
}
@keyframes dhProgress { from { transform: scaleX(0.02); } to { transform: scaleX(0.94); } }
@keyframes dhSheen { from { background-position: -160px 0, 0 0; } to { background-position: 110vw 0, 0 0; } }
@keyframes dhBreathe { from { opacity: 0.6; } to { opacity: 0.26; } }
@keyframes dhToastIn { from { opacity: 0; margin-bottom: -14px; } to { opacity: 1; margin-bottom: 0; } }
@keyframes dhSweep { from { background-position: -120px 100%, 0 0; } to { background-position: 300px 100%, 0 0; } }
@media (prefers-reduced-motion: reduce) {
    body.dh.page-leaving main { animation: none !important; opacity: 0.5; }
    body.dh.page-leaving::before, body.dh.page-leaving::after { animation: none; }
    body.dh.page-leaving::before { transform: scaleX(0.5); }
}
body.dh ::selection { background: var(--dh-brand); color: #fff; }
body.dh ::-webkit-scrollbar { width: 8px; height: 8px; }
body.dh ::-webkit-scrollbar-track { background: transparent; }
body.dh ::-webkit-scrollbar-thumb { background: var(--dh-surface-3); }
body.dh ::-webkit-scrollbar-thumb:hover { background: var(--dh-ink-3); }

/* ---------- анимации ---------- */
@keyframes dhRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dhSpin { to { transform: rotate(360deg); } }
@keyframes dhGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dhDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dhFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dhPop { from { opacity: 0; transform: scale(0.86) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes dhSlash { from { transform: translateX(-30px) skewX(-20deg); opacity: 0; } to { transform: translateX(0) skewX(-20deg); opacity: 1; } }
@keyframes dhPulse {
    0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(62, 207, 142, 0); }
    100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); }
}

.dh-spin { animation: dhSpin 0.8s linear infinite; }
/* Появление блоков. fill-mode backwards (не both): после анимации transform снова свободен для :hover. */
.dh-rise { animation: dhRise 0.65s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.dh-rise:nth-child(2) { animation-delay: 0.05s; }
.dh-rise:nth-child(3) { animation-delay: 0.1s; }
.dh-rise:nth-child(4) { animation-delay: 0.15s; }
.dh-rise:nth-child(5) { animation-delay: 0.2s; }
.dh-head, .dh-toolbar { animation: dhRise 0.65s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.dh-toolbar { animation-delay: 0.07s; }
.dh-rise .dh-kpi-slash { animation: dhSlash 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards; }
/* графики рисуются только вместе с первым появлением блока (при автообновлении .dh-rise снимается) */
.dh-rise .dh-fill { transform-origin: left center; animation: dhGrow 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s backwards; }
.dh-rise .viz-slice { transform-box: view-box; transform-origin: 50% 50%; animation: dhPop 0.9s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.dh-rise .viz-slice:nth-child(2) { animation-delay: 0.08s; }
.dh-rise .viz-slice:nth-child(3) { animation-delay: 0.16s; }
.dh-rise .viz-slice:nth-child(4) { animation-delay: 0.24s; }
.dh-rise .viz-slice:nth-child(5) { animation-delay: 0.32s; }
.dh-rise .viz-slice:nth-child(6) { animation-delay: 0.4s; }
.dh-rise .viz-slice:nth-child(7) { animation-delay: 0.48s; }
.dh-rise .viz-line { stroke-dasharray: 1; animation: dhDraw 1.6s cubic-bezier(0.45, 0, 0.2, 1) 0.2s backwards; }
.dh-rise .viz-area { animation: dhFade 1.2s ease 0.6s backwards; }
@media (prefers-reduced-motion: reduce) {
    .dh-rise, .dh-head, .dh-toolbar, .dh-spin, .dh-rise .dh-fill, .dh-rise .viz-slice, .dh-rise .viz-line, .dh-rise .viz-area,
    .dh-rise .dh-kpi-slash, .dh-status.is-live::before { animation: none !important; }
}
/* ---------- каркас ---------- */
.dh-main { min-height: 100vh; }
.dh-content { padding: 28px 40px 80px; width: 100%; }
.dh-section-label {
    display: flex; align-items: center; gap: 12px; margin: 36px 0 14px;
    font-family: var(--dh-display); font-size: 12px; font-weight: 700; line-height: 1.4; text-transform: uppercase; color: var(--dh-ink-2);
}
.dh-section-label:first-child { margin-top: 0; }
/* косая красная метка — отсылка к косым полосам макета сайта; ставится перед заголовками секций и панелей */
.dh-section-label::before, .dh-card-title::before {
    content: ''; flex-shrink: 0; width: 6px; height: 16px; background: var(--dh-brand); transform: skewX(-20deg);
}

/* ---------- шапка страницы ---------- */
.dh-head {
    padding: 36px 40px 0;
    display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px 28px;
}
.dh-title {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.42em;
    font-family: var(--dh-display); font-size: 28px; line-height: 1.3; font-weight: 900; letter-spacing: 0; text-transform: uppercase; color: var(--dh-ink);
}
.dh-title em { font-style: normal; color: var(--dh-brand); }
.dh-sub { margin-top: 10px; font-size: 15px; color: var(--dh-ink-3); }
.dh-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

/* ---------- кнопки, поля ---------- */
/* Кнопки бренда: прямоугольник без скруглений. Основная — контурная (заливается красным при наведении,
   как .btn-custom--border на сайте), главное действие — сплошная красная (.btn-custom--red). */
.dh-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 44px; padding: 0 24px; border-radius: 0;
    border: 1px solid var(--dh-btn-line); background: transparent; color: var(--dh-ink);
    font: inherit; font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.15s;
}
.dh-btn svg { flex-shrink: 0; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.dh-btn:hover { background: var(--dh-brand); border-color: var(--dh-brand); color: #fff; }
.dh-btn:hover svg { transform: rotate(90deg); }
.dh-btn:active { transform: translateY(1px); }
.dh-btn:focus-visible, .dh-seg > a:focus-visible, .dh-seg > button:focus-visible { outline: 2px solid var(--dh-brand); outline-offset: 3px; }
.dh-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dh-btn:disabled:hover { background: transparent; border-color: var(--dh-btn-line); color: var(--dh-ink); }

.dh-btn-primary { background: var(--dh-brand); border-color: var(--dh-brand); color: #fff; }
.dh-btn-primary:hover { background: var(--dh-brand-hi); border-color: var(--dh-brand-hi); }

.dh-btn-ghost { border-color: transparent; color: var(--dh-ink-2); padding: 0 14px; }
.dh-btn-ghost:hover { background: transparent; border-color: transparent; color: var(--dh-brand-ink); }
.dh-btn-ghost:hover svg { transform: translate(2px, -2px); }

.dh-btn-danger { color: var(--dh-bad-ink); border-color: var(--dh-bad-ink); }
.dh-btn-danger:hover { background: var(--dh-bad-ink); border-color: var(--dh-bad-ink); color: var(--dh-bg); }
.dh-btn.hidden { display: none; }

.dh-input {
    height: 44px; padding: 0 14px; border-radius: 0;
    border: 1px solid var(--dh-line-2); background: var(--dh-surface); color: var(--dh-ink);
    font: inherit; font-size: 15px; font-variant-numeric: tabular-nums;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.dh-input:hover { border-color: var(--dh-ink-3); }
.dh-input:focus { outline: none; border-color: var(--dh-brand); box-shadow: 0 0 0 3px var(--dh-brand-soft); }

.dh-link {
    display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; color: var(--dh-ink-3);
    text-decoration: underline dotted; text-underline-offset: 4px; transition: color 0.2s;
}
.dh-link:hover { color: var(--dh-brand-ink); }

/* индикатор свежести данных */
.dh-status { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--dh-ink-3); margin-right: 8px; }
.dh-status::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--dh-ink-3); opacity: 0.6; }
.dh-status.is-live { color: var(--dh-ink-2); }
.dh-status.is-live::before { background: var(--dh-ok-ink); opacity: 1; animation: dhPulse 2.4s ease-out infinite; }
.dh-status.is-error { color: var(--dh-warn-ink); }
.dh-status.is-error::before { background: var(--dh-warn-ink); opacity: 1; }

/* ---------- панель фильтров ---------- */
.dh-toolbar { padding: 28px 40px 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px 32px; }
/* Период + Быстрый выбор всегда в одну строку; если не помещаются — не переносятся на новую
   строку, а прокручиваются по горизонтали (узкие экраны), чтобы обе группы оставались рядом. */
.dh-toolbar-row { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 20px 32px; max-width: 100%; overflow-x: auto; padding-bottom: 2px; }
.dh-toolbar-row .dh-group { flex: 0 0 auto; }
.dh-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dh-group-label { font-family: var(--dh-display); font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--dh-ink-3); }
.dh-daterange { display: flex; align-items: center; gap: 8px; }
.dh-daterange .dh-dash { color: var(--dh-ink-3); }
/* Табы: ряд ячеек с тонкими разделителями; активная — с красной чертой снизу, как пункты меню сайта бренда */
.dh-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--dh-line-2); background: var(--dh-surface); }
.dh-seg > a, .dh-seg > button {
    position: relative; display: inline-flex; align-items: center; height: 42px; padding: 0 18px;
    font: inherit; font-size: 15px; font-weight: 600; color: var(--dh-ink-3); background: transparent; border: 0;
    border-left: 1px solid var(--dh-line); cursor: pointer; white-space: nowrap; transition: background-color 0.25s, color 0.25s;
}
.dh-seg > a:first-child, .dh-seg > button:first-child { border-left: 0; }
.dh-seg > a::after, .dh-seg > button::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--dh-brand);
    transform: scaleX(0); transform-origin: left; transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.dh-seg > a:hover, .dh-seg > button:hover { background: var(--dh-hover); color: var(--dh-ink); }
.dh-seg > a:hover::after, .dh-seg > button:hover::after { transform: scaleX(0.4); }
.dh-seg > .is-active, .dh-seg > .is-active:hover { color: var(--dh-ink); background: var(--dh-surface-2); }
.dh-seg > .is-active::after, .dh-seg > .is-active:hover::after { transform: scaleX(1); }

/* ---------- сетки ---------- */
.dh-grid { display: grid; gap: 20px; align-items: stretch; }
.dh-mt { margin-top: 20px; }
/* Брейкпоинты считаются с поправкой на сайдбар (256px): контент уже окна примерно на 340px. */
.dh-cols-2, .dh-cols-3, .dh-cols-4 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
    .dh-cols-2, .dh-cols-3, .dh-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dh-cols-3 > .span-2, .dh-cols-3 > .span-3 { grid-column: 1 / -1; }
}
@media (min-width: 1360px) {
    .dh-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dh-cols-3 > .span-2 { grid-column: span 2; }
    .dh-cols-3 > .span-3 { grid-column: 1 / -1; }
    .dh-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- KPI: одна панель с тонкими разделителями (без «карточек в сетке») ---------- */
.dh-kpis {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; align-items: stretch;
    background: var(--dh-surface); border-top: 1px solid var(--dh-line-2); border-left: 1px solid var(--dh-line-2);
}
@media (min-width: 900px) {
    .dh-kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dh-kpis.k5, .dh-kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) { .dh-kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1360px) {
    .dh-kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .dh-kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.dh-kpi {
    position: relative; overflow: hidden; min-width: 0; padding: 26px 28px 28px; display: flex; flex-direction: column;
    border-right: 1px solid var(--dh-line-2); border-bottom: 1px solid var(--dh-line-2);
    transition: background-color 0.25s;
}
.dh-kpi:hover { background: var(--dh-hover); }
.dh-kpi-label { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--dh-ink-2); }
.dh-kpi-value {
    margin-top: auto; padding-top: 16px; font-family: var(--dh-display); font-size: clamp(20px, 2.1vw, 30px); line-height: 1.15; white-space: nowrap; font-weight: 900; letter-spacing: 0;
    color: var(--dh-ink);  /* без uppercase: единицы времени — строчные (33s, 8m 25s), как отдаёт _format_duration_seconds */
}
.dh-kpi-value small { font-size: 0.5em; font-weight: 700; color: var(--dh-ink-3); }
.dh-kpi-hint { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--dh-ink-3); }
.dh-kpi.tone-bad .dh-kpi-value { color: var(--dh-bad-ink); }
.dh-kpi.tone-muted .dh-kpi-value { color: var(--dh-ink-3); }
/* главная ячейка: плоская заливка #ff230a с косой полосой — как красный блок на сайте бренда */
.dh-kpi.is-hero, .dh-kpi.is-hero:hover { background: var(--dh-brand); }
.dh-kpi.is-hero .dh-kpi-slash {
    position: absolute; top: -12px; bottom: -12px; right: -38px; width: 120px;
    background: rgba(0, 0, 0, 0.16); transform: skewX(-20deg); pointer-events: none;
}
.dh-kpi.is-hero .dh-kpi-label, .dh-kpi.is-hero .dh-kpi-hint { position: relative; color: #fff; }
.dh-kpi.is-hero .dh-kpi-value { position: relative; color: #fff; font-size: clamp(24px, 2.7vw, 38px); }

/* ---------- панели ---------- */
.dh-card { background: var(--dh-surface); border: 1px solid var(--dh-line-2); min-width: 0; }
.dh-card-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
    padding: 18px 26px; border-bottom: 1px solid var(--dh-line);
}
.dh-card-title { min-width: 0; display: flex; align-items: center; gap: 12px; font-family: var(--dh-display); font-size: 12px; font-weight: 700; line-height: 1.4; text-transform: uppercase; color: var(--dh-ink); }
.dh-card-note { flex-shrink: 1; max-width: 100%; font-size: 13.5px; line-height: 1.35; color: var(--dh-ink-3); text-align: right; }
.dh-card-body { padding: 26px; }
.dh-card.flush { overflow: hidden; }
.dh-card.flush > .dh-card-body { padding: 0; }
.dh-muted { font-size: 15px; color: var(--dh-ink-3); }
.dh-fine { font-size: 13.5px; color: var(--dh-ink-3); line-height: 1.5; }

/* крупная цифра внутри панели (например, Overall CSAT рядом с графиком тренда) */
.dh-stat { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 32px; margin: 0 0 24px; }
.dh-stat-label { font-size: 14px; font-weight: 600; color: var(--dh-ink-2); }
.dh-stat-value { margin-top: 10px; font-family: var(--dh-display); font-size: 40px; line-height: 1.1; font-weight: 900; letter-spacing: 0; color: var(--dh-ink); }
.dh-stat-hint { padding-bottom: 6px; font-size: 13.5px; line-height: 1.6; color: var(--dh-ink-3); }

/* ---------- полосы-рейтинги ---------- */
.dh-bars { display: grid; gap: 18px; }
.dh-bars.cols { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 44px; }
.dh-bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 8px; font-size: 15px; }
.dh-bar-top .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dh-ink-2); }
.dh-bar-top .v { flex-shrink: 0; color: var(--dh-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.dh-bar-top .v .x { font-weight: 500; color: var(--dh-ink-3); }
.dh-track { height: 6px; background: var(--dh-surface-3); overflow: hidden; }
.dh-fill { height: 100%; background: var(--dh-brand); }

/* ---------- донаты, легенды ---------- */
.dh-donut-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.dh-donut-row svg { width: 164px; height: 164px; flex-shrink: 0; }
.dh-donut-row.stack { flex-direction: column; align-items: stretch; }
.dh-donut-row.stack svg { align-self: center; }
.dh-legend { flex: 1; min-width: 200px; display: grid; gap: 0; font-size: 14.5px; }
.dh-legend li { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 10px 0; border-top: 1px solid var(--dh-line); }
.dh-legend li:first-child { border-top: 0; }
.dh-swatch { width: 11px; height: 11px; flex-shrink: 0; }
.dh-legend .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dh-ink-2); }
.dh-legend .n { margin-left: auto; color: var(--dh-ink); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dh-legend .p { width: 62px; text-align: right; color: var(--dh-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- таблицы ---------- */
.dh-table-wrap { overflow: auto; }
.dh-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.dh-table th {
    padding: 15px 20px; text-align: left; white-space: nowrap;
    font-family: var(--dh-display); font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--dh-ink-3);
    background: var(--dh-surface-2); border-bottom: 1px solid var(--dh-line-2);
}
.dh-table td { padding: 13px 20px; color: var(--dh-ink-2); border-bottom: 1px solid var(--dh-line); transition: background-color 0.2s; }
.dh-table tbody tr:last-child td { border-bottom: 0; }
.dh-table tbody tr:hover td { background: var(--dh-hover); }
.dh-table .num { text-align: right; }
.dh-table .ctr { text-align: center; }
.dh-table .nowrap { white-space: nowrap; }
.dh-table td.strong, .dh-table td.strong a { color: var(--dh-ink); font-weight: 700; }
.dh-table tr.is-total td { background: var(--dh-surface-2); color: var(--dh-ink); font-weight: 800; }
.dh-table tr.is-grand td { background: var(--dh-brand-soft); color: var(--dh-ink); font-weight: 800; border-top: 1px solid var(--dh-brand-line); }
.dh-table td.dim { color: var(--dh-surface-3); }
.dh-table.tight td, .dh-table.tight th { padding: 10px 16px; }
.dh-table .divider { border-left: 1px solid var(--dh-line); }
.dh-table th.sub { font-size: 9.5px; }
/* матрица "тема × команда": первая и последняя колонки прилипают */
.dh-table .stick-l { position: sticky; left: 0; z-index: 2; background: var(--dh-surface); border-right: 1px solid var(--dh-line-2); }
.dh-table .stick-r { position: sticky; right: 0; z-index: 2; background: var(--dh-surface-2); border-left: 1px solid var(--dh-line-2); color: var(--dh-ink); font-weight: 800; }
.dh-table th.stick-l, .dh-table th.stick-r { background: var(--dh-surface-2); z-index: 3; }
.dh-table tfoot td { background: var(--dh-surface-2); color: var(--dh-ink); font-weight: 800; border-top: 1px solid var(--dh-line-2); border-bottom: 0; }
.dh-table tfoot td.stick-l, .dh-table tfoot td.stick-r { z-index: 3; }
.dh-scroll-y { max-height: 380px; overflow-y: auto; }
.dh-scroll-y .dh-table th { position: sticky; top: 0; z-index: 1; }

.dh-table.nowrap td, .dh-table.nowrap th { white-space: nowrap; }
/* переключатель строки с разбивкой (▶ красный, поворачивается при раскрытии) */
.dh-row-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 6px 0 -4px; padding: 0;
    background: none; border: 0; cursor: pointer; vertical-align: middle; transition: transform 0.2s;
}
.dh-row-toggle::before { content: ''; border-left: 7px solid var(--dh-brand); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.dh-row-toggle.is-open { transform: rotate(90deg); }

details.dh-more { margin-top: 20px; font-size: 14.5px; }
details.dh-more > summary { cursor: pointer; user-select: none; font-size: 14px; font-weight: 600; color: var(--dh-ink-3); list-style: none; }
details.dh-more > summary::-webkit-details-marker { display: none; }
details.dh-more > summary::before { content: ''; display: inline-block; width: 0; height: 0; margin-right: 10px; border-left: 6px solid var(--dh-brand); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.2s; }
details.dh-more[open] > summary::before { transform: rotate(90deg); }
details.dh-more > summary:hover { color: var(--dh-ink); }

/* ---------- бейджи, уведомления, пустые состояния ---------- */
.dh-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
    font-size: 13px; font-weight: 700; line-height: 1.5; white-space: nowrap;
    background: var(--dh-surface-3); color: var(--dh-ink-2);
}
.dh-badge.ok { background: var(--dh-ok-soft); color: var(--dh-ok-ink); }
.dh-badge.bad { background: var(--dh-bad-soft); color: var(--dh-bad-ink); }
.dh-badge.warn { background: var(--dh-warn-soft); color: var(--dh-warn-ink); }
.dh-badge.brand { background: var(--dh-brand-soft); color: var(--dh-brand-ink); }

.dh-alert {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; padding: 15px 20px;
    border: 1px solid var(--dh-line); border-left: 4px solid var(--dh-warn-ink);
    font-size: 14.5px; line-height: 1.5; background: var(--dh-warn-soft); color: var(--dh-warn-ink);
}
.dh-alert.info { background: var(--dh-surface); color: var(--dh-ink-2); border-left-color: var(--dh-ink-3); }
.dh-alert.hidden { display: none; }
.dh-alert svg { flex-shrink: 0; margin-top: 2px; }
.dh-alert b { font-weight: 800; }

.dh-empty {
    display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
    padding: 80px 28px; border: 1px dashed var(--dh-line-2); background: var(--dh-surface);
}
.dh-empty-ico {
    display: flex; align-items: center; justify-content: center; width: 60px; height: 60px;
    background: var(--dh-brand); color: #fff; transform: skewX(-8deg);
}
.dh-empty-ico svg { transform: skewX(8deg); }
.dh-empty.bad .dh-empty-ico { background: var(--dh-bad-ink); color: var(--dh-bg); }
.dh-empty h2 { font-family: var(--dh-display); font-size: 22px; line-height: 1.35; font-weight: 900; letter-spacing: 0; text-transform: uppercase; color: var(--dh-ink); }
.dh-empty p { max-width: 600px; font-size: 15.5px; color: var(--dh-ink-3); }

/* ---------- графики ---------- */
.viz-tip {
    position: fixed; z-index: 90; pointer-events: none; min-width: 150px; padding: 12px 15px;
    background: var(--dh-tip-bg); color: var(--dh-ink); border: 1px solid var(--dh-line-2); border-left: 3px solid var(--dh-brand); box-shadow: var(--dh-shadow-pop);
}
.viz-tip[hidden] { display: none; }
.viz-tip-value { display: flex; align-items: center; gap: 9px; font-family: var(--dh-display); font-size: 15px; font-weight: 900; }
.viz-tip-key { display: inline-block; width: 10px; height: 10px; }
.viz-tip-title { margin-top: 5px; font-size: 13.5px; color: var(--dh-ink-2); }
.viz-tip-sub { font-size: 13px; color: var(--dh-ink-3); }
.viz-hit { outline: none; }
.viz-slice { transition: opacity 0.12s ease; }
.viz-slice:hover, .viz-slice:focus { opacity: 0.8; }
.viz-band:focus-visible { outline: 2px solid var(--dh-ink); outline-offset: -2px; }
.viz-grid { stroke: var(--dh-grid); stroke-width: 1; }
.viz-axis { stroke: var(--dh-axis); stroke-width: 1; }
.viz-tick { fill: var(--dh-ink-3); }
.viz-value { fill: var(--dh-ink); font-weight: 700; }
.viz-cross { stroke: var(--dh-ink-3); stroke-width: 1; }
.viz-ring { stroke: var(--dh-surface); stroke-width: 2; }
.viz-chart { width: 100%; height: auto; display: block; }

/* ==========================================================================
   Сайдбар (тёмный)
   ========================================================================== */
.dh-sidebar { background: var(--dh-side-bg); border-right: 1px solid var(--dh-side-line); color: var(--dh-side-ink); }
/* Меню длиннее экрана (раскрытые группы): прокручивается только блок с пунктами, «Выйти» остаётся внизу */
.dh-sidebar { overflow: hidden; }
.dh-sidebar > div:first-child { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.dh-sidebar > div:first-child::-webkit-scrollbar { width: 6px; }
.dh-sidebar > div:first-child::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); }
.dh-side-brand {
    display: flex; align-items: center; gap: 14px; padding: 24px 20px; cursor: pointer; list-style: none;
    border-bottom: 1px solid var(--dh-side-line); transition: background-color 0.2s;
}
.dh-side-brand::-webkit-details-marker { display: none; }
.dh-side-brand:hover { background: var(--dh-side-hover); }
.dh-side-logo { width: 44px; height: 44px; overflow: hidden; flex-shrink: 0; background: #151515; }
.dh-side-logo img { width: 100%; height: 100%; object-fit: cover; }
.dh-side-name { font-family: var(--dh-display); font-size: 11.5px; font-weight: 900; line-height: 1.3; white-space: nowrap; text-transform: uppercase; color: #fff; }
.dh-side-name em { font-style: normal; color: var(--dh-brand); }
.dh-side-caption { margin-top: 3px; font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dh-side-ink); opacity: 0.7; }
.dh-side-chev { margin-left: auto; font-size: 10px; color: var(--dh-side-ink); opacity: 0.6; }
/* fixed, а не absolute: панель выходит за пределы сайдбара (в свёрнутом виде он всего 72px) и не обрезается блоком с
   прокруткой; в свёрнутом сайдбаре она выплывает справа от него */
.dh-side-menu {
    position: fixed; left: 12px; width: 232px; top: 86px; z-index: 60; padding: 6px;
    background: #171717; border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: var(--dh-shadow-pop);
}
body.sidebar-collapsed .dh-side-menu { left: calc(4.5rem + 18px); top: 14px; width: 244px; }
.dh-side-brand:focus-visible { outline: 2px solid var(--dh-brand); outline-offset: -3px; }
.dh-side-menu a {
    display: flex; align-items: center; gap: 11px; padding: 12px 13px;
    font-size: 15px; font-weight: 600; color: var(--dh-side-ink); transition: background-color 0.2s, color 0.2s;
}
.dh-side-menu a:hover { background: var(--dh-side-hover); color: #fff; }
.dh-side-menu a.is-active { background: var(--dh-side-brand-soft); color: #fff; }
.dh-side-menu em { font-style: normal; color: var(--dh-side-brand-ink); }

.dh-nav { padding: 18px 12px; display: grid; gap: 2px; }
.dh-nav-label { padding: 8px 14px 12px; font-family: var(--dh-display); font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--dh-side-ink); opacity: 0.55; }
.dh-nav a, .dh-nav summary {
    position: relative; display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px;
    font-size: 15.5px; font-weight: 500; color: var(--dh-side-ink); cursor: pointer; list-style: none; user-select: none;
    transition: background-color 0.2s, color 0.2s;
}
.dh-nav summary::-webkit-details-marker { display: none; }
.dh-nav a svg, .dh-nav summary svg { transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s; }
.dh-nav a:hover, .dh-nav summary:hover { background: var(--dh-side-hover); color: var(--dh-side-ink-hi); }
.dh-nav a:hover svg, .dh-nav summary:hover svg { transform: translateX(3px); }
.dh-nav a.is-active { background: var(--dh-side-active); color: var(--dh-side-ink-hi); font-weight: 700; }
.dh-nav a.is-active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dh-brand); }
.dh-nav a.is-active svg { color: var(--dh-side-brand-ink); }
.dh-nav summary.is-active { color: var(--dh-side-ink-hi); font-weight: 700; }
.dh-nav summary.is-active svg { color: var(--dh-side-brand-ink); }
/* красная точка и цвет пункта «Интеграции» при сбое источников (переключает /static/js/integrations_status.js) */
.dh-nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--dh-brand); animation: dhPulseRed 1.8s ease-out infinite; }
.dh-nav-dot.hidden { display: none; }
.dh-nav a.has-problem:not(.is-active) { color: var(--dh-side-brand-ink); }
@keyframes dhPulseRed { 0% { box-shadow: 0 0 0 0 rgba(255, 35, 10, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(255, 35, 10, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 35, 10, 0); } }
.dh-nav .caret { margin-left: auto; font-size: 9px; opacity: 0.55; transition: transform 0.2s; }
.dh-nav details[open] > summary .caret { transform: rotate(90deg); }
.dh-nav .sub { margin: 2px 0 6px 25px; padding-left: 10px; border-left: 1px solid var(--dh-side-line); display: grid; gap: 2px; }
.dh-nav .sub a { height: 40px; font-size: 15px; }

.dh-side-foot { padding: 12px; border-top: 1px solid var(--dh-side-line); display: grid; gap: 4px; }
.dh-side-user { padding: 4px 14px 10px; min-width: 0; }
.dh-side-user b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: #ececea; }
.dh-side-user span { font-size: 12px; color: var(--dh-side-ink); opacity: 0.7; }
.dh-side-btn {
    display: flex; align-items: center; gap: 14px; width: 100%; height: 40px; padding: 0 14px; border: 0;
    background: transparent; font: inherit; font-size: 15px; font-weight: 500; color: var(--dh-side-ink); cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.dh-side-btn:hover { background: var(--dh-side-hover); color: #fff; }
.dh-side-btn.danger:hover { background: var(--dh-bad-soft); color: var(--dh-bad-ink); }
.dh-side-btn.is-active { background: var(--dh-side-active); color: var(--dh-side-ink-hi); font-weight: 700; }

/* кнопка сворачивания меню (стили самой кнопки лежат в _sidebar_toggle.html — здесь только тема) */
body.dh .sidebar-toggle-btn { background: #171717; border-color: rgba(255, 255, 255, 0.2); color: var(--dh-side-ink); box-shadow: none; border-radius: 0; }
body.dh .sidebar-toggle-btn:hover { color: #fff; border-color: var(--dh-brand); background: var(--dh-brand); }

/* ---------- VIP Topics: алерты о всплесках тем и разбор причин ---------- */
.ta-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 26px; border-bottom: 1px solid var(--dh-line); }
.ta-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ta-table td { vertical-align: middle; }
.ta-table tr.is-new td:first-child { box-shadow: inset 4px 0 0 var(--dh-brand); }
.ta-pair { display: flex; align-items: flex-start; gap: 12px; min-width: 240px; }
.ta-folder { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--dh-ink-3); }
.ta-topic { font-size: 15px; font-weight: 700; color: var(--dh-ink); }
.ta-ratio { color: var(--dh-brand-ink) !important; }
.ta-over { color: var(--dh-ok-ink); font-weight: 700; }
.ta-select, .ta-field { height: 36px; padding: 0 10px; font-size: 14px; }
.ta-field { width: 160px; }
.ta-field.ta-wide { width: 240px; }
.ta-select.is-saved, .ta-field.is-saved { border-color: var(--dh-ok-ink); }
.ta-select.is-error, .ta-field.is-error { border-color: var(--dh-bad-ink); }
.ta-empty { display: flex; align-items: center; gap: 16px; padding: 22px 26px; }
.ta-empty b { font-size: 15.5px; color: var(--dh-ink); }
.ta-resolved { border-top: 1px solid var(--dh-line); }
.ta-resolved > summary { padding: 14px 26px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--dh-ink-2); }
.ta-resolved > summary:hover { color: var(--dh-brand-ink); }

.ta-reasons { display: grid; gap: 18px; }
.ta-reason-card { padding: 20px 22px; border: 1px solid var(--dh-line); border-left: 4px solid var(--dh-brand); background: var(--dh-surface); scroll-margin-top: 24px; }
.ta-reason-card:target { box-shadow: 0 0 0 3px var(--dh-brand-soft); }
.ta-reason-card > header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ta-small { height: 36px; padding: 0 14px; font-size: 13.5px; }
.ta-summary { font-size: 15.5px; line-height: 1.55; color: var(--dh-ink); margin-bottom: 14px; }
.ta-causes { display: grid; gap: 14px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: cause; }
.ta-causes > li { position: relative; padding: 0 0 14px 34px; border-bottom: 1px solid var(--dh-line); counter-increment: cause; font-size: 14.5px; line-height: 1.55; color: var(--dh-ink-2); }
.ta-causes > li:last-child { border-bottom: 0; padding-bottom: 0; }
.ta-causes > li::before { content: counter(cause); position: absolute; left: 0; top: 0; width: 22px; height: 22px; display: grid; place-items: center; background: var(--dh-ink); color: #fff; font-size: 12px; font-weight: 800; }
.ta-cause-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.ta-cause-head b { font-size: 15px; color: var(--dh-ink); }
.ta-action { margin-top: 6px; color: var(--dh-ink); }
.ta-action > span:first-child, .ta-note > span:first-child { font-weight: 800; }
.ta-convs { margin-top: 6px; }
.ta-note { margin: 0 0 10px; padding: 10px 14px; background: var(--dh-surface-2); font-size: 14px; line-height: 1.5; color: var(--dh-ink-2); }
.ta-note.warn { background: var(--dh-warn-soft); color: var(--dh-warn-ink); }
.ta-pending { display: flex; align-items: center; gap: 10px; }

.dh-table td.ta-hit { background: var(--dh-brand-soft); box-shadow: inset 0 0 0 1px var(--dh-brand-line); }
.dh-table td.ta-hit a { color: var(--dh-brand-ink); font-weight: 800; }

.ta-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 32px 48px; }
.ta-h3 { margin: 0 0 12px; font-family: var(--dh-display); font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--dh-ink); }
.ta-h3 + * { margin-top: 0; }
.ta-rules + .ta-h3 { margin-top: 22px; }
.ta-recipients { margin: 0 0 14px; padding: 0; list-style: none; border-top: 1px solid var(--dh-line); }
.ta-recipients li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--dh-line); font-size: 15px; color: var(--dh-ink); }
.ta-x { display: inline-flex; padding: 4px; color: var(--dh-ink-3); background: none; border: 0; cursor: pointer; }
.ta-x:hover { color: var(--dh-bad-ink); }
.ta-add { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.ta-add .dh-input { flex: 1 1 220px; min-width: 0; }
.ta-rules { margin: 0; padding-left: 18px; list-style: square; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.55; color: var(--dh-ink-2); }
.ta-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.ta-reason-card .ta-h3 { margin-top: 18px; }
.ta-reason-card > header + .ta-h3 { margin-top: 4px; }
.ta-sub { margin-bottom: 4px; }
.ta-reason-card .dh-table-wrap.ta-sub { border: 1px solid var(--dh-line); }
.ta-convs a { margin: 0 1px; }
.ta-examples { margin-top: 16px; }
.ta-examples > summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--dh-ink-2); }
.ta-examples > summary:hover { color: var(--dh-brand-ink); }
.ta-examples ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ta-examples li { padding: 10px 14px; background: var(--dh-surface-2); font-size: 14px; line-height: 1.5; color: var(--dh-ink-2); }
.ta-examples li p { margin: 0 0 4px; }
.ta-reason-card > .dh-fine:last-child { margin-top: 14px; }
