/* МВидео — витрина. Токены и компоненты по дизайн-системе Dataforce (PrimeOne/Aura, Inter 14/20).
   Геометрия навбара: 250/68 px, пункт 36 px, иконка 16 px, radius 6 — по UI-kit «Отступы». */
:root{
  --surface-0:#fff;--surface-50:#f8fafc;--surface-100:#f1f5f9;--surface-200:#e2e8f0;--surface-300:#cbd5e1;
  --surface-400:#94a3b8;--surface-500:#64748b;--surface-600:#475569;--surface-700:#334155;--surface-800:#1e293b;--surface-900:#0f172a;
  --primary-50:#eff6ff;--primary-100:#dbeafe;--primary-500:#3b82f6;--primary-600:#2563eb;--primary-700:#1d4ed8;
  --success-50:#ecfdf5;--success-700:#047857;--warn-50:#fffbeb;--warn-700:#b45309;--danger-50:#fef2f2;--danger-600:#dc2626;--danger-700:#b91c1c;
  --series-1:#2563eb;--series-2:#9268ea;--series-3:#0e9f6e;
  --radius-sm:4px;--radius:6px;--radius-md:8px;--radius-lg:12px;--radius-xxl:16px;
  --shadow-1:0 1px 2px 0 rgba(18,18,23,.05);--shadow-dialog:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);
  --nav-w:250px;--nav-w-c:68px;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--surface-100);color:var(--surface-700);font-size:14px;line-height:20px;-webkit-font-smoothing:antialiased}
a{color:var(--primary-600)}
button{font-family:inherit}
code,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.muted{color:var(--surface-500);font-size:13px;line-height:18px}
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt16{margin-top:16px}.w100{width:100%}
.h1{font:600 24px/28px Inter;color:var(--surface-900)}
.h2{font:600 16px/22px Inter;color:var(--surface-900)}
[hidden]{display:none!important}

/* ---------- shell ---------- */
.app{display:flex;min-height:100vh}
.navbar{width:var(--nav-w);flex:0 0 var(--nav-w);background:var(--surface-100);padding:8px 16px 20px;display:flex;flex-direction:column;gap:8px;position:sticky;top:0;height:100vh;transition:width .18s,flex-basis .18s,padding .18s}
.logo{display:flex;align-items:center;height:36px;padding:0 10px;text-decoration:none;gap:8px}
.logo-lockup{display:flex;align-items:center;gap:6px}
.logo-wm svg{height:14px;width:auto;display:block}
.logo-suffix{font:500 14px/15px Inter;color:var(--primary-600);letter-spacing:.2px;text-transform:uppercase}
.logo-badge{display:none;width:36px;height:36px;border-radius:8px;background:var(--primary-600);color:#fff;font:600 16px/36px Inter;text-align:center}
.nav-section{display:flex;flex-direction:column;gap:2px;margin-top:12px}
.nav-label{font:500 12px/16px Inter;color:var(--surface-400);padding:8px 10px;text-transform:uppercase;letter-spacing:.02em;white-space:nowrap}
.nav-items{display:flex;flex-direction:column;gap:2px}
.nav-item{display:flex;align-items:center;gap:12px;padding:10px;border-radius:var(--radius);min-height:36px;font:400 14px/16px Inter;color:var(--surface-700);cursor:pointer;text-decoration:none;white-space:nowrap}
.nav-item:hover{background:var(--surface-50)}
.nav-item.active{background:var(--primary-50);color:var(--primary-700)}
.nav-item .ic{width:16px;height:16px;font-size:15px;line-height:16px;color:var(--surface-500);flex:0 0 16px;text-align:center}
.nav-item.active .ic{color:var(--primary-600)}
.nav-spacer{flex:1}
.nav-footer{display:flex;flex-direction:column;gap:2px;padding-top:8px;border-top:1px solid var(--surface-200)}
.nav-text{transition:opacity .12s}
html.nav-collapsed .navbar{width:var(--nav-w-c);flex-basis:var(--nav-w-c);padding:8px 4px 20px;align-items:center}
html.nav-collapsed .nav-section,html.nav-collapsed .nav-footer{width:100%;align-items:center}
html.nav-collapsed .nav-text,html.nav-collapsed .nav-label,html.nav-collapsed .logo-lockup{display:none}
html.nav-collapsed .logo{width:36px;padding:0;justify-content:center}
html.nav-collapsed .logo-badge{display:block}
html.nav-collapsed .nav-item{width:36px;justify-content:center;padding:10px 0;gap:0}
html.nav-collapsed #collapseIcon{transform:rotate(180deg)}
.content{flex:1;display:flex;flex-direction:column;min-width:0}
.topbar{height:56px;flex:0 0 56px;display:flex;align-items:center;justify-content:space-between;padding:0 24px;gap:16px}
.tb-left,.tb-right{display:flex;align-items:center;gap:10px;min-width:0}
.tb-space-label{font:400 14px/16px Inter;color:var(--surface-500)}
.tb-proj{display:flex;align-items:center;gap:8px;height:32px;padding:6px 10px;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius);box-shadow:var(--shadow-1)}
.tb-proj .fav{width:14px;height:14px;border-radius:3px;background:var(--primary-600);color:#fff;font:700 9px/14px Inter;text-align:center}
.tb-proj .pname{font:500 14px/20px Inter;color:var(--surface-700)}
.tb-meta{color:var(--surface-500);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-burger{display:none;width:32px;height:32px;border:0;background:transparent;border-radius:6px;color:var(--surface-600);cursor:pointer;font-size:16px}
.tb-profile{position:relative;display:flex;align-items:center;gap:4px;cursor:pointer;outline:none;border-radius:6px;padding:2px}
.tb-profile:focus-visible{box-shadow:0 0 0 2px var(--primary-100)}
.tb-avatar{width:28px;height:28px;border-radius:14px;background:var(--surface-400);color:#fff;display:flex;align-items:center;justify-content:center;font:500 14px/1 Inter}
.tb-profile .pi-angle-down{font-size:12px;color:var(--surface-500)}
.popover{position:absolute;top:calc(100% + 6px);right:0;min-width:200px;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:6px;z-index:40;cursor:default}
.pop-name{font:600 14px/18px Inter;color:var(--surface-900);padding:8px 10px 0}
.pop-sub{font:400 12px/16px Inter;color:var(--surface-500);padding:0 10px 8px;border-bottom:1px solid var(--surface-100);margin-bottom:4px}
.pop-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:6px;color:var(--surface-700);text-decoration:none}
.pop-item:hover{background:var(--surface-50)}
.page{padding:4px 24px 24px;display:flex;flex-direction:column;gap:16px;max-width:1240px;width:100%}
.scrim{position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:55;display:none}
.scrim.open{display:block}

/* ---------- card & типографика ---------- */
.card{background:#fff;border-radius:var(--radius-md);padding:24px 28px}
.card.weld-top{border-radius:8px 8px 0 0;border-bottom:1px solid var(--surface-200);margin-bottom:-16px}
.card.weld-bottom{border-radius:0 0 8px 8px}
.card-success{border:1px solid #bbf7d0;background:var(--success-50)}
.card-danger{border:1px solid #fecaca;background:var(--danger-50);color:var(--danger-700);display:flex;gap:8px;align-items:center}
.tcard{padding:0;overflow:hidden}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px 16px;min-height:80px;padding:20px 28px;border-bottom:1px solid var(--surface-200);flex-wrap:wrap}
/* заголовок с описанием занимает строку целиком и переносится сам; кнопки справа, если не влезли — строкой ниже.
   Без этого «нерезиновая» правая группа (числа с nowrap и кнопки) выжимала описание в колонку в пару слов. */
.card-head>:first-child{flex:1 1 360px;min-width:0}
.rep-header{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rep-header>:first-child{flex:1 1 360px;min-width:0}
.rep-actions{display:flex;gap:8px;margin-left:auto;align-items:center;flex-wrap:wrap}
.filters-panel{display:flex;flex-direction:column;gap:16px}
.total-pill{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid var(--surface-300);border-radius:var(--radius);background:#fff;color:var(--surface-700);font:500 14px/20px Inter}
.total-pill .pi{font-size:14px;color:var(--surface-500)}
.total-pill .muted{margin-left:2px}
.filter-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.filter-note{margin-left:auto}
.empty-card{display:flex;flex-direction:column;align-items:flex-start;gap:10px;max-width:520px}
.empty-icon{width:40px;height:40px;border-radius:10px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:18px}
.steps-list{padding-left:20px;margin-top:8px;display:flex;flex-direction:column;gap:6px}
.steps-list .done{color:var(--surface-400);text-decoration:line-through}

/* ---------- buttons ---------- */
.btn{height:32px;padding:7px 11px;border-radius:var(--radius);border:none;font:500 14px/18px Inter;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:disabled{opacity:.5;cursor:default}
.btn-lg{height:38px;font-size:15px}
.btn-primary{background:var(--primary-600);color:#fff}.btn-primary:hover:not(:disabled){background:var(--primary-700)}
.btn-secondary{background:var(--surface-100);color:var(--surface-600)}.btn-secondary:hover:not(:disabled){background:var(--surface-200)}
.btn-outlined{background:transparent;color:var(--surface-700);border:1px solid var(--surface-300)}.btn-outlined:hover:not(:disabled){background:var(--surface-50)}
.btn-icon{width:32px;height:32px;border:1px solid var(--surface-200);border-radius:var(--radius);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--surface-600);flex:0 0 32px}
.btn-icon:hover{background:var(--surface-50);color:var(--primary-600)}
.btn-icon .pi{font-size:14px}
.btn-send{width:32px;padding:0;flex:0 0 32px}
.linkbtn{border:0;background:none;color:var(--primary-600);font:500 13px Inter;cursor:pointer;padding:0}
.linkbtn.danger{color:var(--danger-600)}
.inline{display:inline}

/* ---------- inputs ---------- */
.input{height:32px;padding:6px 11px;border:1px solid var(--surface-300);border-radius:var(--radius);box-shadow:var(--shadow-1);font:400 14px Inter;color:var(--surface-700);background:#fff;min-width:0}
.input:focus{outline:none;border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.input.select{padding-right:28px;appearance:none;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center}
.input.sm{height:28px;font-size:13px;padding:3px 26px 3px 8px}
.inline-form{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.inline-form.compact{display:inline-flex}
.field{display:block;margin-top:14px}
.field-label{display:block;font:500 13px/16px Inter;color:var(--surface-700);margin-bottom:6px}
.input-wrap{position:relative;display:block}
.input-wrap .input{padding-right:36px}
.input-eye{position:absolute;right:4px;top:4px;width:24px;height:24px;border:0;background:transparent;color:var(--surface-500);cursor:pointer;border-radius:4px}
.input-eye:hover{color:var(--primary-600)}
.form-error{color:var(--danger-700);font-size:13px;min-height:18px;margin-top:10px}

/* filter select (UI-kit: 32px, radius 6, border #CBD5E1/#94A3B8/#2563EB, chevron zone 36) */
.filter-select{position:relative;display:flex;align-items:center;height:32px;background:#fff;border:1px solid var(--surface-300);border-radius:var(--radius);cursor:pointer;user-select:none}
.filter-select:hover{border-color:var(--surface-400)}
.filter-select.open{border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.filter-select .fs-content{display:flex;align-items:center;gap:4px;padding:0 0 0 10px;height:30px;white-space:nowrap}
.filter-select .fs-label{font:400 14px Inter;color:var(--surface-500)}
.filter-select .fs-value{font:400 14px Inter;color:var(--surface-700)}
.filter-select.has-value .fs-value{color:var(--primary-700);font-weight:500}
.filter-select .fs-drop{width:36px;display:flex;align-items:center;justify-content:center;align-self:stretch}
.filter-select .fs-drop .pi{font-size:12px;color:var(--surface-500)}
.fs-menu{display:none;position:absolute;top:calc(100% + 4px);left:0;min-width:100%;z-index:40;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:4px;white-space:nowrap}
.filter-select.open .fs-menu{display:block}
.fs-opt{padding:7px 10px;border-radius:6px;font:400 14px/18px Inter;color:var(--surface-700);cursor:pointer}
.fs-opt:hover{background:var(--surface-50)}
.fs-opt.sel{color:var(--primary-700);background:var(--primary-50)}
.fs-opt.disabled{color:var(--surface-300);cursor:not-allowed}
.fs-opt.disabled:hover{background:transparent}

/* segmented */
.segmented{display:inline-flex;background:var(--surface-100);border-radius:8px;height:32px;padding:3px;gap:2px}
.segmented button{border:none;background:transparent;font:500 14px/18px Inter;color:var(--surface-500);padding:4px 10px;cursor:pointer;border-radius:6px;white-space:nowrap}
.segmented button.active{background:#fff;color:var(--surface-900);box-shadow:var(--shadow-1)}
.segmented button:disabled{opacity:.38;cursor:default}
.seg-metrics{flex-wrap:wrap;height:auto;min-height:32px}

/* tags */
.tag{display:inline-flex;align-items:center;gap:4px;min-height:22px;padding:2px 8px;border-radius:6px;font:500 12px/16px Inter;white-space:nowrap}
.tag .pi{font-size:11px}
.tag-success{background:var(--success-50);color:var(--success-700)}
.tag-info{background:var(--primary-50);color:var(--primary-700)}
.tag-warn{background:var(--warn-50);color:var(--warn-700)}
.tag-danger{background:var(--danger-50);color:var(--danger-700)}
.tag-neutral{background:var(--surface-100);color:var(--surface-500)}
.delta{font:500 13px/18px Inter;font-variant-numeric:tabular-nums}
.delta.up{color:var(--success-700)}.delta.down{color:var(--danger-600)}

/* ---------- tables ---------- */
.tscroll{overflow-x:auto}
table.dt{width:100%;border-collapse:separate;border-spacing:0}
table.dt th,table.dt td{border-bottom:1px solid var(--surface-200);border-right:1px solid var(--surface-200);height:40px;padding:8px 14px;text-align:left;vertical-align:middle}
table.dt th:last-child,table.dt td:last-child{border-right:0}
table.dt tr:last-child td{border-bottom:0}
table.dt th{font:600 13px/18px Inter;color:var(--surface-500);background:var(--surface-50);white-space:nowrap}
table.dt td{font:500 14px/18px Inter;color:var(--surface-700)}
table.dt th:first-child,table.dt td:first-child{padding-left:28px}
table.dt th:last-child,table.dt td:last-child{padding-right:28px}
table.dt td.num,table.dt th.num{text-align:right;font-variant-numeric:tabular-nums}
/* квадрант «органика против рекламы» на «Ассортименте» */
.quad-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0 4px}
.quad-wrap{width:100%;overflow-x:auto}
#quadSvg{width:100%;min-width:640px;height:auto;display:block}
#quadSvg .q-axis{stroke:var(--surface-300);stroke-width:1}
#quadSvg .q-med{stroke:var(--surface-400);stroke-width:1;stroke-dasharray:4 4}
#quadSvg .q-lbl{font:500 11px/14px Inter;fill:var(--surface-500)}
#quadSvg .q-end{text-anchor:end}
#quadSvg .q-name{font:500 11px/14px Inter;fill:var(--surface-600);pointer-events:none}
#quadSvg .q-pt circle{fill:rgba(37,99,235,.42);stroke:#2563eb;stroke-width:1;cursor:pointer}
#quadSvg .q-pt:hover circle,#quadSvg .q-pt:focus circle{fill:rgba(37,99,235,.7);outline:none}
/* Легенда стоит так же, как плоскость: слева — низкий %PTraf, сверху — высокий SOI.
   Порядок из таблицы ТЗ (строки — %PTraf, столбцы — SOI) на экране читался бы наоборот. */
.quad-legend{display:grid;grid-template-columns:repeat(2,minmax(220px,1fr));gap:8px 16px;margin-top:12px}
.quad-legend div{display:flex;flex-direction:column;padding:8px 12px;border-left:2px solid var(--surface-300)}
.quad-legend b{font:600 13px/18px Inter}
.quad-legend span{font:500 12px/16px Inter;color:var(--surface-500)}
table.dt tr.row-pick>td{background:rgba(37,99,235,.10)}
table.dt tr.row-open>td{background:var(--surface-50)}
table.dt tr.row-panel>td{background:var(--surface-50);padding:0}
/* Таблица категорий шире экрана, и панель на все её колонки оставляла содержимое за краем прокрутки.
   Липкая позиция держит его в поле зрения, куда бы ни уехала таблица. */
.ads-panel{position:sticky;left:0;width:min(520px,92vw);padding:12px 28px}
/* Разворот строки категории: спрос, Яндекс, Google, деньги и реклама сразу вместе, а не один
   список рекламодателей (замечание 27.09.2026). Панель липкая по той же причине, что и .ads-panel:
   таблица шире экрана, и без этого содержимое уезжает за край прокрутки. */
.cat-panel{position:sticky;left:0;width:min(1100px,94vw);max-width:100%;padding:14px 28px 16px}
.cp-head{margin-bottom:10px}
.cp-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px 16px}
.cp-b{border-left:2px solid var(--surface-300);padding:2px 0 2px 12px}
.cp-t{font:600 12px/16px Inter;color:var(--surface-500);text-transform:uppercase;letter-spacing:.04em;margin-bottom:6px}
.cp-v{display:flex;justify-content:space-between;gap:12px;font:400 13px/20px Inter;color:var(--surface-600)}
.cp-v b{font:600 13px/20px Inter;color:var(--surface-900)}
.cp-ads{margin-top:14px;max-width:560px}
.cp-ads .cp-t{text-transform:none;letter-spacing:0;font:600 13px/18px Inter;color:var(--surface-700)}
.cp-ads table.dt{width:100%}
.cp-ads table.dt th,.cp-ads table.dt td{height:30px;padding:4px 10px}
.cp-ads table.dt td:first-child{padding-left:0;position:static}
table.dt tr.row-own>td{font-weight:600}
.ads-panel table.dt{width:100%}
.ads-panel table.dt th,.ads-panel table.dt td{height:32px;padding:4px 10px}
.ads-panel table.dt td:first-child,.ads-panel table.dt th:first-child{padding-left:10px}
.ads-panel table.dt td:last-child,.ads-panel table.dt th:last-child{padding-right:10px}
/* Сортируемая колонка видна до клика: бледная стрелка-вилка стоит в каждой шапке, активная
   становится чёрной. Раньше значок появлялся только после первого клика, и о сортировке
   надо было догадаться (замечание 27.09.2026). */
table.dt.sortable th[data-sort]{cursor:pointer;user-select:none;white-space:nowrap}
table.dt.sortable th[data-sort]:hover{color:var(--surface-700)}
table.dt.sortable th[data-sort]::after{content:" \21C5";color:var(--surface-300);font-weight:400}
table.dt.sortable th[data-sort]:hover::after{color:var(--surface-500)}
table.dt.sortable th.sort-up::after,table.dt.sortable th.sort-dn::after{color:var(--primary-600)}
table.dt.sortable th.sort-up::after{content:" \2191"}
table.dt.sortable th.sort-dn::after{content:" \2193"}
/* начало смысловой группы колонок: каталог слева, витрина справа */
table.dt th.col-grp,table.dt td.col-grp{border-left:2px solid var(--surface-300)}
/* Верхний этаж шапки: имена групп колонок. Колонок в «Категориях клиента» два десятка, и без
   деления на блоки шапка читается как список без начала и конца. */
table.dt tr.grp-row th{height:32px;font:600 12px/16px Inter;color:var(--surface-500);
  text-transform:uppercase;letter-spacing:.04em;background:var(--surface-100);text-align:left}
table.dt tr.grp-row th.grp-b{border-left:2px solid var(--surface-300)}
/* Первая колонка не уезжает при горизонтальной прокрутке: без неё на середине таблицы уже не
   видно, чья это строка. Фон обязателен — иначе сквозь липкую ячейку просвечивают соседние. */
#catTable th:first-child,#catTable td:first-child{position:sticky;left:0;z-index:2;background:#fff}
#catTable thead th:first-child{z-index:3;background:var(--surface-50)}
/* Верхний этаж: липкой остаётся только узкая ячейка над «Категорией». Широкий заголовок группы
   с colspan липким быть не может — он ехал вместе с прокруткой и наезжал на соседние блоки,
   отчего колонки читались как сшибленные (правка 27.09.2026). */
#catTable tr.grp-row th:first-child{background:var(--surface-100)}
#catTable tr.grp-row th.grp:not(.grp-cat){position:static}
#catTable tbody tr:hover td:first-child{background:var(--surface-50)}
/* подсветка выбранной строки полупрозрачная, а липкой ячейке нужен непрозрачный тон того же цвета */
#catTable tr.row-pick>td:first-child{background:#e9effc}
table.dt tbody tr:hover td{background:var(--surface-50)}
table.dt tr.row-dim td{color:var(--surface-400)}
table.dt tfoot td{font-weight:600;background:var(--surface-50);border-top:2px solid var(--surface-200);border-bottom:0}
.cell-main{font-weight:600;color:var(--surface-800)}
.issues{padding:12px 28px}
.issue{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-top:1px solid var(--surface-100)}
.issue:first-child{border-top:0}
.issue .tag{flex:none;margin-top:1px}
.issue-text{line-height:20px}

/* ---------- KPI ---------- */
/* Ряд карточек: фиксированное число колонок, а не auto-fit. При auto-fit карточки набивались в строку,
   сколько влезет, и последняя висела сиротой во второй строке (восемь метрик при 1230 px давали 7 + 1),
   а с рекламными их одиннадцать. Ровная сетка 4 / 3 / 2 держит строки целыми на любом числе метрик. */
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
@media (max-width:1280px){.kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:820px){.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
.kpi{background:#fff;border-radius:var(--radius-md);padding:16px 18px;display:flex;flex-direction:column;gap:6px;min-height:118px;min-width:0}
.kpi.na{background:var(--surface-50);border:1px dashed var(--surface-200)}
.kpi-name{color:var(--surface-500);font-size:13px;line-height:18px;display:flex;align-items:center;gap:6px}
.kpi-val{font:600 22px/28px Inter;color:var(--surface-900);font-variant-numeric:tabular-nums;letter-spacing:-.02em;white-space:nowrap}
.kpi.na .kpi-val{color:var(--surface-400);font-size:18px}
.kpi-delta{display:flex;align-items:center;gap:6px;min-height:22px;flex-wrap:wrap}
/* Подпись — две строки, дальше многоточие, полный текст в title: у метрик с оговорками (SOI, реклама)
   она доходила до семи строк, и карточки в ряду стояли рваными по высоте. */
.kpi-note{font:400 12px/16px Inter;color:var(--surface-400);min-height:16px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* ---------- chart ---------- */
.graph-actions{display:flex;flex-direction:column;gap:16px;padding:20px 28px}
.graph-body{padding:20px 28px 20px}
.legend{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px;align-items:center;min-height:26px}
.legend .item{display:flex;align-items:center;gap:6px;border:1px solid transparent;border-radius:6px;padding:3px 7px;font:400 13px/18px Inter;color:var(--surface-700);cursor:pointer;user-select:none}
.legend .item:hover{background:var(--surface-50);border-color:var(--surface-200)}
.legend .item.off{color:var(--surface-400)}
.legend .item.off .dot{background:transparent!important;border-color:var(--surface-300)}
.legend .dot{width:10px;height:10px;border-radius:50%;border:2px solid transparent}
.legend .lg-note{color:var(--warn-700);font-size:13px}
.legend .lg-title{margin-left:auto;color:var(--surface-500);font-size:13px}
.chart-wrap{position:relative}
.chart{width:100%;height:260px;display:block}
.chart .grid{stroke:var(--surface-200);stroke-width:1}
.chart .guide{stroke:var(--surface-300);stroke-width:1;stroke-dasharray:3 3}
.chart .ylab{font:400 11px Inter;fill:var(--surface-400)}
.chart polyline{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chart .area{opacity:.08}
.chart .area-partial{opacity:.04}
.chart .partial-line{stroke-dasharray:5 4;opacity:.7}
.chart .pt{stroke:#fff;stroke-width:1.5}
.chart .pt.partial{fill:#fff;stroke-width:2}
.chart .pt.defect{fill:#fff;stroke:#ef4444 !important;stroke-width:2;stroke-dasharray:2 1.5}
.axis-svg{width:100%;height:20px;display:block;margin-top:2px}
.axis-svg .axis-label{font:400 12px/16px Inter;fill:var(--surface-500)}
.chart-tip{position:absolute;background:var(--surface-900);color:var(--surface-200);border-radius:8px;padding:10px 12px;font:12px/18px Inter;pointer-events:none;z-index:5;box-shadow:var(--shadow-dialog);min-width:170px}
.chart-tip .t-week{font-weight:600;color:#fff;margin-bottom:4px}
.chart-tip .t-row{display:flex;justify-content:space-between;gap:14px}
.chart-tip .t-row .dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px}
.chart-tip .t-val{font-variant-numeric:tabular-nums;font-weight:600;color:#fff}
.chart-tip .t-note{color:#fbbf24;margin-top:4px}
.chart-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--surface-400);font-size:14px;background:repeating-linear-gradient(-45deg,transparent 0 8px,var(--surface-50) 8px 16px);border-radius:8px}

/* ---------- ИИ-режим ---------- */
.page-ai{padding-bottom:16px;max-width:none;height:calc(100vh - 60px)}
.body-ai .content{height:100vh}
.ai-layout{display:grid;grid-template-columns:272px minmax(0,1fr);gap:16px;height:100%;min-height:0}
.chatlist{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chatlist-head{padding:16px 16px 8px}
.chatlist-search{display:flex;align-items:center;gap:8px;margin:0 16px 8px;height:32px;padding:0 10px;border:1px solid var(--surface-200);border-radius:6px;color:var(--surface-400)}
.chatlist-search input{border:0;outline:0;flex:1;font:14px Inter;color:var(--surface-700);min-width:0;background:transparent}
.chatlist-search .pi{font-size:13px}
.chatlist-items{overflow-y:auto;padding:0 8px 12px;flex:1}
.chatlist-group{font:500 11px/16px Inter;color:var(--surface-400);text-transform:uppercase;letter-spacing:.04em;padding:12px 8px 4px}
.chat-item{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:6px;text-decoration:none;color:var(--surface-700)}
.chat-item:hover{background:var(--surface-50)}
.chat-item.active{background:var(--primary-50)}
.chat-item.active .ci-title{color:var(--primary-700)}
.ci-title{font:500 13px/18px Inter;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ci-meta{font:400 11px/14px Inter;color:var(--surface-400);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ci-who{color:var(--surface-500);font-weight:500}
.chatlist-empty{padding:16px 10px}
.chat{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chat-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:16px 24px 12px;border-bottom:1px solid var(--surface-200)}
.chat-head-main{min-width:0;flex:1}
.chat-title{font:600 18px/24px Inter;color:var(--surface-900);outline:none;border-radius:4px;padding:0 4px;margin-left:-4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-title[contenteditable]:hover{background:var(--surface-50)}
.chat-title[contenteditable]:focus{background:var(--surface-50);box-shadow:0 0 0 2px var(--primary-100);white-space:normal}
.chat-head-meta{margin-top:2px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.chat-actions{display:flex;gap:6px}
.btn-icon.on{color:var(--primary-600);border-color:var(--primary-100);background:var(--primary-50)}
.msgs{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:18px;scroll-behavior:smooth}
.chat-empty{margin:auto;max-width:640px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px 0}
.chat-empty .empty-icon{width:44px;height:44px;font-size:20px}
.suggestions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px;width:100%}
.suggestion{text-align:left;padding:10px 12px;border:1px solid var(--surface-200);border-radius:8px;background:#fff;font:400 13px/18px Inter;color:var(--surface-700);cursor:pointer}
.suggestion:hover{border-color:var(--primary-600);color:var(--primary-700);background:var(--primary-50)}
.msg{display:flex;flex-direction:column;gap:6px;max-width:100%}
.msg-user{align-items:flex-end}
.msg-user .bubble{background:var(--primary-600);color:#fff;border-radius:14px 14px 4px 14px;padding:10px 14px;max-width:78%;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:21px}
.msg-user .bubble.file{background:var(--primary-50);color:var(--primary-700);display:flex;align-items:center;gap:8px;white-space:normal}
.msg-ai{align-items:stretch}
.msg-ai .body{display:flex;gap:12px;align-items:flex-start}
.ai-mark{flex:0 0 28px;width:28px;height:28px;border-radius:8px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:13px;margin-top:2px}
.ai-mark.err{background:var(--danger-50);color:var(--danger-600)}
.ai-content{min-width:0;flex:1}
.steps{border:1px solid var(--surface-200);border-radius:8px;margin-bottom:10px;background:var(--surface-50);overflow:hidden}
.steps-head{display:flex;align-items:center;gap:8px;padding:6px 10px;font:500 12px/16px Inter;color:var(--surface-600);cursor:pointer;user-select:none}
.steps-head .pi-chevron-right{font-size:10px;transition:transform .15s;color:var(--surface-400)}
.steps.open .steps-head .pi-chevron-right{transform:rotate(90deg)}
.steps-body{display:none;border-top:1px solid var(--surface-200);padding:4px 0}
.steps.open .steps-body{display:block}
.step{display:flex;align-items:center;gap:8px;padding:4px 10px;font:400 12px/16px Inter;color:var(--surface-600)}
.step .s-ico{width:14px;text-align:center;font-size:11px;color:var(--surface-400)}
.step.ok .s-ico{color:var(--success-700)}
.step.err .s-ico{color:var(--danger-600)}
.step.run .s-ico{color:var(--primary-600)}
.step .s-name{font-weight:500;color:var(--surface-700)}
.step .s-args{color:var(--surface-400);font-family:ui-monospace,Menlo,monospace;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px}
.step .s-res{margin-left:auto;white-space:nowrap;color:var(--surface-500)}
.step .s-ms{color:var(--surface-400);font-variant-numeric:tabular-nums}
.spin{display:inline-block;width:11px;height:11px;border:2px solid var(--primary-100);border-top-color:var(--primary-600);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.status-line{display:flex;align-items:center;gap:8px;color:var(--surface-500);font-size:13px;margin:2px 0 6px}
.md{font-size:14px;line-height:22px;color:var(--surface-800);overflow-wrap:anywhere}
.md>*+*{margin-top:8px}
.md p{margin:0}
.md h1,.md h2,.md h3,.md h4{font-weight:600;color:var(--surface-900);line-height:1.3}
.md h1{font-size:18px}.md h2{font-size:16px}.md h3,.md h4{font-size:14px}
.md ul,.md ol{padding-left:22px}
.md li{margin:2px 0}
.md code{background:var(--surface-100);border-radius:4px;padding:1px 5px;font-size:12.5px}
.md pre{background:var(--surface-900);color:var(--surface-100);border-radius:8px;padding:12px 14px;overflow-x:auto;font-size:12.5px;line-height:18px}
.md pre code{background:transparent;padding:0;color:inherit}
.md table{border-collapse:collapse;width:auto;max-width:100%;display:block;overflow-x:auto;font-size:13px}
.md th,.md td{border:1px solid var(--surface-200);padding:5px 10px;text-align:left;vertical-align:top;white-space:nowrap}
.md th{background:var(--surface-50);font-weight:600;color:var(--surface-600)}
.md td.num,.md th.num{text-align:right;font-variant-numeric:tabular-nums}
.md blockquote{border-left:3px solid var(--surface-200);padding-left:12px;color:var(--surface-500)}
.md hr{border:0;border-top:1px solid var(--surface-200)}
.md a{color:var(--primary-600)}
.md .dl{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border:1px solid var(--primary-100);background:var(--primary-50);border-radius:6px;text-decoration:none;font-weight:500}
.md .src{color:var(--surface-500);font-size:12.5px;border-top:1px dashed var(--surface-200);padding-top:6px;margin-top:10px}
.md .cursor{display:inline-block;width:2px;height:16px;background:var(--primary-600);vertical-align:-3px;margin-left:1px;animation:blink 1s steps(2) infinite}
@keyframes blink{50%{opacity:0}}
.msg-tools{display:flex;gap:4px;align-items:center;margin-left:40px;opacity:0;transition:opacity .15s;min-height:20px}
.msg:hover .msg-tools,.msg.last .msg-tools{opacity:1}
.msg-tools button{border:0;background:transparent;color:var(--surface-400);font:400 12px Inter;cursor:pointer;display:inline-flex;align-items:center;gap:4px;padding:2px 6px;border-radius:4px}
.msg-tools button:hover{color:var(--primary-600);background:var(--surface-50)}
.msg-tools .meta{color:var(--surface-400);font-size:11px;margin-left:auto}
.msg-user .msg-tools{margin-left:0;justify-content:flex-end}
.msg.marked .msg-tools{opacity:1}
.msg-tools .verdict{display:inline-flex;align-items:center;gap:2px}
.msg-tools .verdict button.on{color:var(--primary-600);background:var(--primary-50)}
.msg-tools .verdict .vd{color:var(--surface-500);font-size:11.5px;margin-left:4px;max-width:420px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.msg-tools .verdict-note{margin-left:6px;font:400 12px Inter;padding:2px 8px;border:1px solid var(--surface-300);border-radius:6px;width:min(360px,60vw)}
.composer{padding:8px 24px 12px;border-top:1px solid var(--surface-200);position:relative}
.composer-box{border:1px solid var(--surface-300);border-radius:12px;box-shadow:var(--shadow-1);background:#fff;transition:border-color .12s,box-shadow .12s}
.composer-box:focus-within{border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.composer-box textarea{display:block;width:100%;border:0;outline:0;resize:none;padding:12px 14px 4px;font:14px/21px Inter;color:var(--surface-800);min-height:44px;max-height:240px;background:transparent}
.composer-box textarea::placeholder{color:var(--surface-400)}
.composer-bar{display:flex;align-items:center;gap:8px;padding:4px 8px 8px 8px}
.composer-hint{font-size:12px;margin-left:2px}
.composer-status{margin-left:auto;font-size:12px;color:var(--surface-500);display:flex;align-items:center;gap:6px}
.composer-foot{padding:8px 4px 0;font-size:12px;display:flex;gap:6px;align-items:center}
.composer-budget{margin-top:8px;padding:6px 10px;border-radius:6px;font-size:12px;color:var(--surface-500)}
.composer-budget.lvl-warn{background:var(--warn-50);color:var(--warn-700);font-weight:600}
.composer-budget.lvl-over{background:var(--danger-50);color:var(--danger-700);font-weight:600}
.dropzone{position:absolute;inset:8px 24px 12px;border:2px dashed var(--primary-500);border-radius:12px;background:rgba(239,246,255,.95);display:none;align-items:center;justify-content:center;gap:8px;color:var(--primary-700);font-weight:500;z-index:3}
.composer.drag .dropzone{display:flex}
.cred-row{display:flex;gap:8px;align-items:center;margin-top:10px;flex-wrap:wrap}
.cred{font-size:16px;background:#fff;border:1px solid #bbf7d0;border-radius:6px;padding:6px 12px;letter-spacing:.04em}

/* ---------- login ---------- */
.login-body{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--surface-100);padding:24px}
.login-card{background:#fff;border-radius:16px;padding:36px 34px 28px;width:380px;max-width:100%;box-shadow:var(--shadow-1)}
.login-lockup{display:flex;align-items:center;gap:6px;margin-bottom:22px}
.login-lockup .logo-wm svg{height:16px}
.login-lockup .logo-suffix{font-size:16px;line-height:17px}
.login-title{font:600 20px/26px Inter;color:var(--surface-900)}
.login-sub{margin-top:4px;color:var(--surface-500);font-size:13px}
.login-card .btn{margin-top:22px}
.login-help{margin-top:14px;font-size:12.5px;color:var(--surface-500);text-align:center}

/* ---------- toasts ---------- */
.toasts{position:fixed;right:20px;bottom:20px;display:flex;flex-direction:column;gap:8px;z-index:70}
.toast{background:var(--surface-900);color:#fff;border-radius:8px;padding:10px 14px;font-size:13px;box-shadow:var(--shadow-dialog);display:flex;align-items:center;gap:8px;animation:toast-in .18s ease-out}
.toast.err{background:var(--danger-700)}
@keyframes toast-in{from{transform:translateY(8px);opacity:0}to{transform:none;opacity:1}}

/* ---------- responsive ---------- */
@media (max-width:1100px){.ai-layout{grid-template-columns:232px minmax(0,1fr)}}
@media (max-width:900px){
  .navbar{position:fixed;left:0;top:0;bottom:0;z-index:60;transform:translateX(-100%);transition:transform .18s;box-shadow:2px 0 24px rgba(15,23,42,.08);height:100vh}
  html.nav-open .navbar{transform:none}
  html.nav-collapsed .navbar{width:var(--nav-w);flex-basis:var(--nav-w);padding:8px 16px 20px;align-items:stretch}
  html.nav-collapsed .nav-text,html.nav-collapsed .nav-label,html.nav-collapsed .logo-lockup{display:initial}
  html.nav-collapsed .logo-badge{display:none}
  html.nav-collapsed .nav-item{width:auto;justify-content:flex-start;padding:10px;gap:12px}
  #navCollapse{display:none}
  .tb-burger{display:inline-flex;align-items:center;justify-content:center}
  .topbar{padding:0 16px}
  .page{padding:4px 12px 16px}
  .card{padding:18px 16px}
  .card-head,.issues{padding-left:16px;padding-right:16px}
  table.dt th:first-child,table.dt td:first-child{padding-left:16px}
  table.dt th:last-child,table.dt td:last-child{padding-right:16px}
  .ai-layout{grid-template-columns:1fr}
  .chatlist{display:none}
  .suggestions{grid-template-columns:1fr}
  .msg-user .bubble{max-width:92%}
  .composer-hint,.tb-meta{display:none}
  .page-ai{height:calc(100vh - 56px)}
  .page .cols2{grid-template-columns:minmax(0,1fr)}
  /* переключатель шире экрана прокручивается сам, а не растягивает страницу (в мини-приложении так и было) */
  .segmented{max-width:100%;overflow-x:auto}
}

/* ---------- мини-приложение Telegram (body.tg-mode: кука mv_tg) ----------
   Навбар и верхняя панель убраны: экран телефона внутри Telegram, разделы — вкладками снизу,
   «Назад» и главная кнопка — у самого Telegram (static/tg.js). */
.tg-mode .navbar,.tg-mode .topbar,.tg-mode .scrim,.tg-mode .chatlist,.tg-mode .composer-hint{display:none}
.tg-mode .page{padding:12px 12px calc(72px + env(safe-area-inset-bottom));gap:12px}
.tg-mode .card{padding:16px;border-radius:var(--radius-lg)}
.tg-mode .card-head,.tg-mode .issues{padding-left:16px;padding-right:16px}
.tg-mode .h1{font-size:20px;line-height:26px}
.tg-mode .ai-layout{grid-template-columns:1fr}
.tg-mode .page-ai{height:calc(var(--tg-vh, 100dvh) - 48px);padding:8px 8px calc(64px + env(safe-area-inset-bottom))}
.tg-mode .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
.tg-mode{overflow-x:hidden}
.tg-mode .content{max-width:100vw}
.tg-mode .card,.tg-mode .tscroll{overflow-x:auto}
.tg-mode .segmented{max-width:100%;overflow-x:auto}
.tg-mode .page .cols2{grid-template-columns:minmax(0,1fr)}
.tg-mode .card-head{flex-wrap:wrap;gap:8px}
.tg-mode .nt-pick .select{min-width:0;width:100%}
.tg-tabs{position:fixed;left:0;right:0;bottom:0;z-index:60;display:flex;background:#fff;border-top:1px solid var(--surface-200);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
.tg-tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:4px 0;font:500 11px/14px Inter;color:var(--surface-500);text-decoration:none;border-radius:8px}
.tg-tab .pi{font-size:18px}
.tg-tab.active{color:var(--primary-600)}
.tg-boot{display:flex;align-items:center;justify-content:center;min-height:100vh;background:var(--surface-100);padding:24px}
.tg-boot-card{background:#fff;border-radius:var(--radius-lg);padding:32px 24px;width:100%;max-width:380px;display:flex;flex-direction:column;align-items:center;gap:16px;text-align:center}
.tg-boot-status{font:500 15px/20px Inter;color:var(--surface-900);display:flex;align-items:center;gap:8px}
.tg-boot-text{color:var(--surface-600);font-size:14px;line-height:20px}
.tg-boot .btn{width:100%}

/* экран «Уведомления» */
.nt-form{display:flex;flex-direction:column;gap:16px}
.tg-mode .nt-form{gap:12px}
.nt-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;cursor:pointer}
.nt-row>span:first-child{display:flex;flex-direction:column;gap:2px}
.switch{appearance:none;-webkit-appearance:none;width:44px;height:26px;flex:0 0 44px;border-radius:13px;background:var(--surface-300);position:relative;cursor:pointer;transition:background .15s;margin-top:2px}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:10px;background:#fff;box-shadow:var(--shadow-1);transition:transform .15s}
.switch:checked{background:var(--primary-600)}
.switch:checked::after{transform:translateX(18px)}
.nt-sub{margin-top:16px;padding-top:16px;border-top:1px solid var(--surface-100)}
.nt-sub.off{opacity:.45;pointer-events:none}
.nt-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px 24px}
.nt-grid .field{display:flex;flex-direction:column;gap:6px}
.field-label{font:500 13px/18px Inter;color:var(--surface-700)}
.field-label .muted{font-weight:400}
.nt-range{display:flex;align-items:center;gap:10px}
.nt-range input[type=range]{flex:1;accent-color:var(--primary-600);min-width:0}
.nt-range output{font:600 16px/20px Inter;color:var(--surface-900);min-width:34px;text-align:right}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.filter-row .chips{margin-top:0;gap:6px}
.chip{position:relative;cursor:pointer}
.chip input{position:absolute;opacity:0;width:0;height:0}
.chip span{display:inline-flex;align-items:center;min-height:32px;padding:6px 12px;border-radius:16px;border:1px solid var(--surface-200);background:#fff;font:500 13px/18px Inter;color:var(--surface-600);transition:all .12s;user-select:none}
.chip input:checked+span{background:var(--primary-50);border-color:var(--primary-600);color:var(--primary-700)}
.chip input:focus-visible+span{box-shadow:0 0 0 2px var(--primary-100)}
.nt-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.tg-msg{background:var(--surface-50);border:1px solid var(--surface-200);border-radius:12px 12px 12px 4px;padding:12px 14px;font-size:14px;line-height:20px;color:var(--surface-800);max-width:640px;overflow-wrap:anywhere}
.tg-msg pre{white-space:pre-wrap;font-size:12px}
.nt-pick .select{min-width:260px}
.small{font-size:12px}
.card-warn-soft{border:1px solid #fde68a;background:var(--warn-50)}
.row-dim td{color:var(--surface-400)}
.nt-log td{white-space:normal;vertical-align:top}
.nt-log td.mono{overflow-wrap:anywhere;font-size:12px;line-height:16px}

/* разметка: маски, длинные URL, предпросмотр */
.masks code{display:inline-block;margin:2px 4px 2px 0;font-size:12px;background:var(--surface-100);border-radius:4px;padding:1px 5px}
table.dt.urls td.url{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;max-width:520px;overflow-wrap:anywhere;white-space:normal;line-height:16px}
table.dt.compact th,table.dt.compact td{height:32px;padding:5px 10px;font-size:13px}
table.dt.compact th:first-child,table.dt.compact td:first-child{padding-left:12px}
table.dt.compact th:last-child,table.dt.compact td:last-child{padding-right:12px}
table.dt tr.row-edit td{background:var(--primary-50)}
.inline-form .grow{flex:1;min-width:240px}
.nowrap{white-space:nowrap}
textarea.input{resize:vertical;line-height:20px;padding:8px 11px}

/* видимость сайтов: две таблицы рядом, наша строка подсвечена */
.cols2{display:grid;grid-template-columns:repeat(auto-fit,minmax(420px,1fr));gap:16px;align-items:start}
.dt tr.row-own td{background:var(--primary-50);font-weight:600}
.empty-note{padding:20px 28px}

/* справочник категорий (экран «Разметка» → «Категории») */
.masks code.auto{border:1px dashed var(--primary-500);background:var(--primary-50);color:var(--primary-700)}
/* маска-догадка по транслитерации: цифр по такой категории не будет, пока её не проверит человек */
.masks code.auto.guess{border-color:var(--surface-400);background:var(--surface-100);color:var(--text-muted);text-decoration:underline dotted}
.auto-legend code.auto{display:inline-block;font-size:12px;border-radius:4px;padding:1px 5px}
table.dt.cats td.masks{max-width:260px;white-space:normal}
table.dt.cats td.num{white-space:nowrap}
table.dt.cats tr.cat-sub td:first-child{padding-left:32px}
table.dt.cats tr.cat-sub .cell-main::before{content:"↳ ";color:var(--surface-400)}
.cat-links{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}
.cat-links .field{display:flex;flex-direction:column;gap:4px}
.cat-links textarea{width:100%;min-height:72px;font-size:12px}
.small{font-size:12px;line-height:16px}
.mt16.card{margin-top:16px}

/* ---------- конструктор отчётов ---------- */
.bld-layout{display:grid;grid-template-columns:300px minmax(0,1fr);gap:16px;align-items:start}
.bld-left{padding:16px 12px;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto}
.bld-left-head{display:flex;justify-content:space-between;align-items:center;padding:0 8px 10px}
.bld-group{margin-bottom:10px}
.bld-group-title{display:flex;align-items:center;gap:6px;width:100%;border:0;background:transparent;cursor:pointer;text-align:left;font:500 12px/16px Inter;color:var(--surface-500);text-transform:uppercase;letter-spacing:.02em;padding:8px 8px 6px;border-radius:var(--radius)}
.bld-group-title:hover{background:var(--surface-50);color:var(--surface-700)}
.bld-group-title .pi{font-size:11px;color:var(--surface-400)}
.bld-group-count{margin-left:auto;font:400 12px/16px Inter;color:var(--surface-400);text-transform:none;letter-spacing:0}
.bld-group.open .bld-group-count{color:var(--primary-600)}
.bld-group-body{display:none}
.bld-group.open .bld-group-body{display:block}
.bld-domain{display:flex;align-items:center;gap:8px;padding:2px 8px 6px}
.bld-domain select{flex:1;height:30px;border:1px solid var(--surface-300);border-radius:var(--radius);font:400 13px Inter;color:var(--surface-700);background:#fff;padding:0 6px;min-width:0}
.bld-metric{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;text-align:left;border:1px solid transparent;background:transparent;border-radius:var(--radius);padding:7px 8px;cursor:pointer;font:400 14px/18px Inter;color:var(--surface-700)}
.bld-metric:hover{background:var(--surface-50)}
.bld-metric.on{background:var(--primary-50);border-color:var(--primary-100);color:var(--primary-700)}
.bld-metric.on .bld-m-title::before{content:"✓ ";color:var(--primary-600)}
.bld-metric.na{color:var(--surface-400)}
.bld-metric.na .bld-m-title{text-decoration:line-through;text-decoration-color:var(--surface-300)}
.bld-metric.full{cursor:not-allowed;opacity:.6}
.bld-metric.chip{margin-top:4px}
.bld-m-title{font-weight:500}
.bld-m-meta{font-size:12px;line-height:16px;color:var(--surface-400)}
.bld-m-why{font-size:12px;line-height:16px;color:var(--warn-700)}
.bld-m-why.ok{color:var(--surface-500)}
.bld-main{display:flex;flex-direction:column;gap:16px;min-width:0}
.bld-chart-card{border-radius:var(--radius-md)}
.bld-chart{height:300px}
.chart .ylab.right{fill:var(--surface-400)}
.chart .axis-title{font-weight:500}
.chart path.ln{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chart path.ln.stepped{stroke-dasharray:6 3;opacity:.85}
.chart path.ln.partial-line{stroke-dasharray:5 4;opacity:.7}
.bld-notes{margin-top:12px;display:flex;flex-direction:column;gap:2px}
.bld-notes .gap-rule{color:var(--surface-400)}
.bld-date{display:flex;align-items:center;gap:6px;height:32px;padding:0 8px;background:#fff;border:1px solid var(--surface-300);border-radius:var(--radius)}
.bld-date input{border:0;font:400 14px Inter;color:var(--surface-700);background:transparent;outline:none}
.bld-cat-menu{max-height:320px;overflow:auto}
/* селект категорий: сразу видны только крупнейшие, остальные достаются поиском */
.fs-find{display:block;width:100%;box-sizing:border-box;margin:2px 0 4px;padding:6px 8px;font:400 14px Inter;color:var(--surface-700);border:1px solid var(--surface-300);border-radius:6px;outline:none}
.fs-find:focus{border-color:var(--primary-400)}
.fs-opt.fs-rest,.fs-opt.fs-hidden{display:none}
.fs-menu.searching .fs-opt.fs-rest{display:block}
.fs-menu.searching .fs-opt.fs-hidden{display:none}
.fs-menu.searching .fs-note{display:none}
.fs-note{padding:6px 10px 4px;font:400 12px/16px Inter;color:var(--surface-500);white-space:normal;max-width:320px}
label.chk{display:inline-flex;align-items:center;gap:6px;font:400 13px Inter;color:var(--surface-600);cursor:pointer}
label.chk input{margin:0}
.filter-select.dimmed{opacity:.55}
.legend .item b{font-weight:500}
.legend .item .why{color:var(--warn-700)}
.legend .item.refused{cursor:default;color:var(--surface-500);border-color:var(--surface-200);background:var(--surface-50)}
.legend .item.refused .dot{background:transparent;border-color:var(--surface-300)}
.legend .item a.rm{color:var(--surface-400);text-decoration:none;margin-left:4px;padding:0 3px}
.legend .item a.rm:hover{color:var(--danger-600)}
.legend .item a.fix{color:var(--primary-600);margin-left:6px}
@media (max-width:1100px){.bld-layout{grid-template-columns:1fr}.bld-left{position:static;max-height:none}}
.bld-sets{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.bld-select{height:32px;min-width:220px;max-width:340px;border:1px solid var(--surface-300);border-radius:var(--radius);font:400 14px Inter;color:var(--surface-700);background:#fff;padding:0 8px}
.bld-set-title{font:500 14px/18px Inter;color:var(--primary-700)}
/* ---------- экран конструктора v2 (27.09.2026): настройки одной карточкой, метрики токенами ----------
   Подача по макетам PLT-2106. Прежний экран (колонка метрик слева) остаётся на ?ux=legacy. */
.page-wide{max-width:none}
.cfg-card{display:flex;flex-direction:column;gap:0}
.cfg-card .rep-header{align-items:flex-start;gap:16px;flex-wrap:wrap}
.cfg-card .rep-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.cfg-summary{display:flex;gap:6px;flex-wrap:wrap;padding:12px 0 0}
.filters-panel:not(.bld-collapsed) .cfg-summary{display:none}
.cfg-body{display:flex;flex-direction:column;gap:0;padding-top:4px}
.cfg-row{display:flex;align-items:flex-start;gap:16px;padding:12px 0}
.cfg-label{flex:0 0 132px;padding-top:6px;font:500 13px/18px Inter;color:var(--surface-500)}
.cfg-count{color:var(--surface-400);font-weight:400}
.cfg-hint{border-bottom:1px dashed var(--surface-300);cursor:help}
.cfg-items{display:flex;flex-wrap:wrap;gap:8px;align-items:center;flex:1;min-width:0}
.cfg-divider{height:1px;background:var(--surface-100)}
.cfg-foot{padding-top:12px;font:400 13px/18px Inter}
.filters-panel.bld-collapsed .cfg-body,.filters-panel.bld-collapsed .cfg-divider{display:none}
.bld-tokens{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.bld-no-metrics{font:400 14px/20px Inter}
.token{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 6px 0 10px;border:1px solid var(--surface-200);border-radius:var(--radius);background:#fff;font:400 14px/20px Inter;color:var(--surface-700);white-space:nowrap}
.token .tk-dot{width:8px;height:8px;border-radius:50%;flex:0 0 8px}
.token .tk-x{border:0;background:transparent;cursor:pointer;color:var(--surface-400);font-size:16px;line-height:1;padding:0 2px;border-radius:4px}
.token .tk-x:hover{background:var(--surface-100);color:var(--surface-700)}
.token-add{height:32px;min-width:32px;padding:0 10px;border:1px dashed var(--surface-300);border-radius:var(--radius);background:#fff;color:var(--surface-600);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.token-add:hover,.token-add.active{border-style:solid;border-color:var(--primary-200);background:var(--primary-50);color:var(--primary-700)}
.bld-pop-wrap{position:relative;display:inline-flex}
.bld-metric-pop{position:absolute;top:calc(100% + 6px);left:0;z-index:40;width:340px;max-height:60vh;overflow:auto;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:8px}
.bld-metric-pop #metricList{padding:0;position:static;max-height:none;overflow:visible}
.bld-result{display:flex;flex-direction:column;gap:16px}
.bld-send-pop{min-width:260px}
.bld-send-pop .bld-select{min-width:0;width:100%;max-width:none}
.bld-send-go{width:100%;margin-top:4px}
@media (max-width:760px){.cfg-row{flex-direction:column;gap:6px;padding:10px 0}.cfg-label{flex:none;padding-top:0}.bld-metric-pop{width:min(92vw,340px)}}

/* ---------- новый UX конструктора (26.09.2026): сводка, быстрые периоды, показатели, состояния ----------
   Откат — MVIDEO_BUILDER_UX=legacy или ?ux=legacy: разметки ниже на экране просто нет. */
.bld-panel-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.bld-sum{display:flex;gap:6px;flex-wrap:wrap;flex:1;min-width:0}
.bld-chip{display:inline-flex;align-items:center;height:26px;padding:0 10px;border-radius:13px;background:var(--surface-50);border:1px solid var(--surface-200);font:400 13px/18px Inter;color:var(--surface-700);white-space:nowrap}
.bld-chip.muted{color:var(--surface-400)}
.bld-toggle{flex:0 0 auto}
.filters-panel.bld-collapsed .filter-row{display:none}
.bld-presets{display:flex;gap:6px;flex-wrap:wrap}
.bld-preset{height:32px;padding:0 12px;border:1px solid var(--surface-300);border-radius:var(--radius);background:#fff;font:400 14px/18px Inter;color:var(--surface-700);cursor:pointer;white-space:nowrap}
.bld-preset:hover{background:var(--surface-50)}
.bld-preset.active{background:var(--primary-50);border-color:var(--primary-200);color:var(--primary-700);font-weight:500}
.bld-kpi{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:18px;padding:18px 20px}
.bld-kpi-item{display:flex;flex-direction:column;gap:4px;min-width:0}
.bld-kpi-name{display:flex;align-items:center;gap:6px;font:400 13px/18px Inter;color:var(--surface-500);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bld-kpi-name .dot{width:8px;height:8px;border-radius:50%;flex:0 0 8px}
.bld-kpi-val{font:600 24px/30px Inter;color:var(--surface-900);letter-spacing:-.01em}
.bld-kpi-sub{font:400 12px/16px Inter}
.bld-kpi-sub .up{color:var(--green-600,#16a34a)}
.bld-kpi-sub .down{color:var(--red-600,#dc2626)}
.bld-kpi-star{color:var(--surface-400);margin-left:2px;cursor:help}
.bld-cmp{margin-left:4px}
.filters-panel.bld-collapsed .bld-sum{cursor:pointer}
#bldTableToggle.active,#bldToBoard.active{background:var(--primary-50);border-color:var(--primary-200);color:var(--primary-700)}
.bld-empty-state{font:400 14px/20px Inter;color:var(--surface-600);padding:18px 20px}
.bld-busy{position:relative}
.bld-busy::after{content:"Считаю…";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.62);border-radius:var(--radius-md);font:500 14px/20px Inter;color:var(--surface-500);z-index:5}
@media (max-width:760px){.bld-panel-head{align-items:flex-start}.bld-bm{right:auto;left:0}.bld-kpi{padding:16px}.bld-kpi-val{font-size:20px;line-height:26px}}
.bld-board-wrap{position:relative;display:inline-flex}
.bld-bm{position:absolute;top:calc(100% + 6px);right:0;z-index:40;min-width:260px;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:8px;display:flex;flex-direction:column;gap:4px}
.bld-bm-head{font:400 12px/16px Inter;text-transform:uppercase;letter-spacing:.02em;padding:2px 6px}
.bld-bm-view{display:flex;align-items:center;gap:8px;font:400 13px/18px Inter;color:var(--surface-700);padding:2px 6px 6px}
.bld-bm-view select{flex:1;height:30px;border:1px solid var(--surface-300);border-radius:var(--radius);background:#fff;font:400 13px Inter;color:var(--surface-700);padding:0 6px}
.bld-bm-item{text-align:left;border:0;background:transparent;border-radius:var(--radius);padding:7px 8px;cursor:pointer;font:400 14px/18px Inter;color:var(--surface-700)}
.bld-bm-item:hover{background:var(--surface-50)}
.bld-bm-new{color:var(--primary-700)}
.bld-bm-empty,.bld-bm-wait{padding:6px 8px;font:400 13px/18px Inter}
/* ---------- мини-приложение: меню, отчёты в чат, конструктор, поддержка ----------
   Стартовый экран в Telegram — плитки во весь экран телефона, а не копия навбара сайта. */
.menu{display:flex;flex-direction:column;gap:16px;max-width:720px}
.menu-head{padding:4px 4px 0}
.menu-hello{font:600 22px/28px Inter;color:var(--surface-900);letter-spacing:-.01em}
.menu-sub{margin-top:2px}
.menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tile{position:relative;display:flex;flex-direction:column;justify-content:flex-start;gap:14px;min-height:150px;padding:16px;background:#fff;border-radius:var(--radius-xxl);text-decoration:none;color:var(--surface-700);box-shadow:var(--shadow-1);-webkit-tap-highlight-color:transparent;transition:transform .08s,box-shadow .12s}
.tile:active{transform:scale(.985)}
.tile:hover{box-shadow:0 4px 14px rgba(15,23,42,.08)}
.tile-ic{width:44px;height:44px;border-radius:12px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:20px;flex:0 0 44px}
.tile-text{display:flex;flex-direction:column;gap:4px;min-width:0}
.tile-text b{font:600 16px/20px Inter;color:var(--surface-900)}
.tile-text span{font:400 13px/18px Inter;color:var(--surface-500)}
.tile-wide{grid-column:1 / -1}
.tile-row{flex-direction:row;align-items:center;min-height:0;gap:14px}
.tile-row .tile-text{flex:1}
.tile-arrow{color:var(--surface-300);font-size:14px}
.tile-primary{background:var(--primary-600);color:#fff;flex-direction:row;align-items:center;min-height:0;padding:20px 16px}
.tile-primary .tile-ic{background:rgba(255,255,255,.18);color:#fff}
.tile-primary .tile-text{flex:1}
.tile-primary .tile-text b{color:#fff;font-size:18px;line-height:22px}
.tile-primary .tile-text span{color:rgba(255,255,255,.82)}
.tile-primary .tile-arrow{color:rgba(255,255,255,.7)}
.tile-primary:hover{background:var(--primary-700)}
.tile-off{opacity:.55}
.tile-badge{min-width:24px;height:24px;padding:0 8px;border-radius:12px;background:var(--warn-50);color:var(--warn-700);font:600 12px/24px Inter;text-align:center}
.menu-foot{padding:0 4px}
.page-home{max-width:none}
.tg-mode .page-home{padding-bottom:calc(16px + env(safe-area-inset-bottom))}
.tg-mode .menu-head{padding-top:4px}

/* отчёты в чат */
.rep-list{display:flex;flex-direction:column;gap:12px}
.rep-item{display:flex;flex-direction:column;gap:12px;padding:16px}
.rep-main{display:flex;gap:12px;align-items:flex-start}
.rep-ic{width:40px;height:40px;border-radius:10px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:18px;flex:0 0 40px}
.rep-body{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}
.rep-title{font:600 15px/20px Inter;color:var(--surface-900);display:flex;align-items:center;gap:8px}
.rep-desc{font-size:13px;line-height:18px}
.rep-foot{display:flex;gap:8px;align-items:center;padding-left:52px}
.rep-foot .rep-arg{flex:1;min-width:0}
.rep-spacer{flex:1}
.rep-send{height:36px;padding:0 14px;flex:0 0 auto}
.rep-status{font:500 13px/18px Inter;color:var(--surface-600);display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-left:52px}
.rep-status.ok{color:var(--success-700)}
.rep-status.err{color:var(--danger-700)}
.rep-status .btn{height:28px;font-size:13px}
.rep-more{display:flex;align-items:center;gap:12px;padding:16px;text-decoration:none;color:inherit}
.rep-more .pi-chevron-right{color:var(--surface-300)}
#bStatus{padding-left:0}
.tg-mode .rep-foot,.tg-mode .rep-status{padding-left:0}
.tg-mode .rep-item{padding:14px}
.tg-mode .rep-actions{margin-left:0;width:100%}
.tg-mode .rep-actions .btn{flex:1}
.tg-mode #sendBtn{display:none}   /* в Telegram отправляет главная кнопка внизу */

/* поддержка */
.sup-text{height:auto;min-height:120px;resize:vertical;width:100%;padding:10px 12px;line-height:20px;font-family:inherit}
.sup-list{display:flex;flex-direction:column;gap:12px}
.sup-item{padding:12px 14px;border:1px solid var(--surface-200);border-radius:var(--radius-md);display:flex;flex-direction:column;gap:8px}
.sup-item.done{opacity:.7}
.sup-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px}
.sup-text-body{white-space:pre-wrap;color:var(--surface-800);line-height:20px;overflow-wrap:anywhere}
.sup-note{background:var(--surface-50);border-radius:8px;padding:8px 10px;font-size:13px;line-height:18px}
.sup-admin{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.sup-admin .grow{flex:1;min-width:160px}

/* полоска мини-приложения: «‹ Меню» и «×» — не зависят от кнопок Telegram */
.tg-bar{display:none}
.tg-mode .tg-bar{display:flex;align-items:center;gap:8px;padding:8px 8px 0;min-height:40px}
.tg-bar-btn{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 10px;border:0;border-radius:16px;background:#fff;color:var(--primary-600);font:500 14px/18px Inter;text-decoration:none;cursor:pointer;box-shadow:var(--shadow-1)}
.tg-bar-btn .pi{font-size:12px}
.tg-bar-close{width:32px;padding:0;justify-content:center;color:var(--surface-500)}
.tg-bar-close .pi{font-size:14px}
.tg-bar-title{font:600 15px/20px Inter;color:var(--surface-900);padding-left:8px}
.tg-bar-spacer{flex:1}
.tg-mode .page{padding-top:8px}

/* ИИ-режим на телефоне: плотнее шапка и сообщения, без подписи под полем, список чатов — шторкой по кнопке */
.tg-mode .body-ai .content{height:auto;min-height:0}
.tg-mode .chat{border-radius:var(--radius-lg)}
.tg-mode .chat-head{padding:12px 14px 10px;gap:8px}
.tg-mode .chat-title{font-size:16px;line-height:22px}
.tg-mode .chat-head-meta{font-size:12px}
.tg-mode .msgs{padding:12px 12px;gap:14px}
.tg-mode .msg-user .bubble{max-width:88%}
.tg-mode .msg-tools{opacity:1;margin-left:0}
.tg-mode .md table{display:block;max-width:100%;overflow-x:auto;font-size:13px}
.tg-mode .chat-empty{padding:12px 0}
.tg-mode .suggestions{grid-template-columns:1fr}
.tg-mode .composer{padding:8px 10px 10px}
.tg-mode .composer-foot{display:none}
.tg-mode .composer-box textarea{font-size:16px;line-height:22px;padding:10px 12px 2px}  /* 16px — iOS не зумит поле при фокусе */
.tg-mode.show-chatlist .chatlist{display:flex;position:fixed;left:8px;right:8px;top:48px;bottom:calc(64px + env(safe-area-inset-bottom));z-index:55;box-shadow:var(--shadow-dialog)}
.tg-mode.show-chatlist #btnChats{color:var(--primary-600);border-color:var(--primary-100);background:var(--primary-50)}
/* поле ввода ИИ-режима на телефоне — крупнее: выше поле, шрифт 17 px, кнопки 44 px */
.tg-mode .composer{padding:10px 10px 12px}
.tg-mode .composer-box{border-radius:16px}
.tg-mode .composer-box textarea{font-size:17px;line-height:24px;min-height:76px;max-height:200px;padding:14px 16px 4px}
.tg-mode .composer-bar{padding:4px 10px 10px}
.tg-mode .composer-bar .btn-icon,.tg-mode .composer-bar .btn-send{width:44px;height:44px;flex:0 0 44px;border-radius:12px}
.tg-mode .composer-bar .btn-icon .pi,.tg-mode .composer-bar .btn-send .pi{font-size:18px}
.tg-mode .composer-status{font-size:13px}
.chart-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
.chart-actions .rep-status{padding-left:0}
.bld-chat{min-width:160px;max-width:260px}
.bld-send-status{padding-left:0;margin-top:8px}
.md .md-chart{display:block;margin:8px 0}
.md .md-chart img{display:block;max-width:100%;border:1px solid var(--surface-200);border-radius:8px;background:#fff}
.bld-kind{min-width:150px;max-width:230px}
.bld-row-label{min-width:64px;color:var(--surface-500)}
.bld-actions{display:flex;flex-wrap:wrap;gap:24px 40px;padding:16px 28px}
.bld-actions-group{display:flex;flex-direction:column;gap:8px;min-width:0}
.bld-actions-title{font:500 14px/18px Inter;color:var(--surface-900)}
.bld-actions-title .muted{font-weight:400}
.bld-actions-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.bld-notes b{color:var(--surface-700);font-weight:500}

/* ---------- дашборды (/dashboards, /dashboard/<id>): несколько наборов конструктора на одной странице ---------- */
.brd-head{display:flex;flex-direction:column;gap:14px}
.brd-crumbs a{color:var(--surface-500);text-decoration:none}
.brd-crumbs a:hover{color:var(--primary-600)}
.brd-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.brd-status{padding-left:0}
.brd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
.brd-grid.one{grid-template-columns:1fr}
.brd-panel{padding:16px 20px;min-width:0}
.brd-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:8px}
.brd-panel-title{min-width:0}
.brd-panel-actions{display:flex;gap:6px;flex-shrink:0}
/* чат-панель дашборда (static/boardchat.js): правки словами, не уходя со страницы */
.bc-panel{position:fixed;right:0;top:0;bottom:0;width:380px;max-width:100vw;background:var(--surface-0);
  border-left:1px solid var(--surface-200);box-shadow:-8px 0 24px rgba(15,23,42,.06);display:flex;flex-direction:column;z-index:40}
.bc-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:14px 16px;border-bottom:1px solid var(--surface-200)}
.bc-sub{font-size:12px;line-height:16px;margin-top:2px}
.bc-msgs{flex:1;overflow:auto;padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.bc-msg{max-width:100%;padding:8px 12px;border-radius:var(--radius-md);font-size:13px;line-height:19px;word-wrap:break-word}
.bc-user{background:var(--primary-50,#eff6ff);align-self:flex-end}
.bc-ai{background:var(--surface-50);align-self:flex-start}
.bc-err{color:var(--red-600,#e02424)}
.bc-target{margin:0 16px 8px;padding:6px 10px;border-radius:var(--radius-md);background:var(--yellow-50,#fdf6e3);
  font-size:12px;line-height:18px;display:flex;align-items:center;gap:6px}
.bc-x{border:0;background:none;cursor:pointer;font-size:14px;line-height:1;padding:0 2px;color:var(--surface-500)}
.bc-compose{border-top:1px solid var(--surface-200);padding:10px 16px 14px}
.bc-compose textarea{width:100%;resize:vertical;min-height:44px;padding:8px 10px;border:1px solid var(--surface-300);
  border-radius:var(--radius-md);font:400 13px/19px Inter}
.bc-bar{display:flex;align-items:center;gap:8px;margin-top:8px}
.bc-bar .muted{flex:1;font-size:12px}
body.bc-open .page,body.bc-open main{padding-right:396px}
.brd-panel.bc-aim{box-shadow:0 0 0 2px var(--primary-500,#2563eb)}
@media (max-width:1100px){
  .bc-panel{left:0;top:auto;height:70vh;width:auto;border-left:0;border-top:1px solid var(--surface-200)}
  body.bc-open .page,body.bc-open main{padding-right:0}
}
/* виджеты дашборда: карточки KPI и таблица значений (static/widgets.js).
   Свои классы, а не .kpi с «Обзора»: у тех min-height:118px и своя сетка, они рассчитаны на плитку экрана. */
.brd-panel.wide{grid-column:1 / -1}
.wg-cards{display:flex;flex-wrap:wrap;gap:12px}
.wg-card{flex:1 1 150px;min-width:0;padding:12px 14px;border:1px solid var(--surface-200);border-radius:var(--radius-md);background:var(--surface-0)}
.wg-card-off{background:var(--surface-50);border-style:dashed}
.wg-card-name{color:var(--surface-500);font-size:13px;line-height:18px;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wg-card-row{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.wg-card-val{font:600 22px/28px Inter;color:var(--surface-900);font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.wg-card-delta{font-size:13px;font-weight:600;white-space:nowrap}
.wg-card-delta.up{color:var(--green-600,#0e9f6e)}
.wg-card-delta.down{color:var(--red-600,#e02424)}
.wg-card-sub,.wg-card-note{color:var(--surface-500);font-size:12px;line-height:16px;margin-top:4px}
.wg-card-note{color:var(--yellow-700,#8e4b10)}
.wg-card-off-text{color:var(--surface-600);font-size:13px;line-height:18px}
.wg-tscroll{overflow:auto;max-height:420px}
.wg-tscroll thead th{position:sticky;top:0;background:var(--surface-0);z-index:1}
.wg-foot{font-size:12px;line-height:16px;margin-top:8px}
@media (max-width:760px){.wg-card{flex:1 1 100%}}
.btn-sm{height:28px;padding:4px 8px;font-size:13px}
.brd-chart{height:240px}
.brd-panel .legend{margin-bottom:8px}
.brd-panel .legend .item{font-size:12px;padding:2px 6px}
.brd-panel .bld-notes{font-size:12px}
.brd-error{color:var(--danger-700);display:flex;gap:8px;align-items:center;padding:24px 0;font-size:14px}
.brd-list-title{margin:8px 0 -4px}
/* карточка списка: ссылка на дашборд плюс действия рядом — поэтому не <a> целиком, а строка с кнопками */
.brd-item{text-decoration:none;color:inherit;flex-direction:row;align-items:center;gap:8px}
.brd-item .rep-main{align-items:center;flex:1;min-width:0;text-decoration:none;color:inherit}
.brd-item-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.brd-item .brd-del{opacity:0;transition:opacity .12s}
.brd-item:hover .brd-del,.brd-item .brd-del:focus-visible{opacity:1}
@media (hover:none){.brd-item .brd-del{opacity:1}}
.brd-arrow{color:var(--surface-300)}
.brd-intro-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.brd-new{flex-shrink:0}
@media (max-width:760px){.brd-intro-head{flex-direction:column}}
@media (max-width:1100px){.brd-grid{grid-template-columns:1fr}.brd-btn-text{display:none}}
.tg-mode .brd-grid{grid-template-columns:1fr;gap:12px}
.tg-mode .brd-panel{padding:12px}
.tg-mode .brd-chart{height:200px}
.tg-mode .brd-actions .btn{flex:1 1 auto}

/* ---------- справка (/help): оглавление слева, разделы карточками ---------- */
.help-layout{display:grid;grid-template-columns:220px minmax(0,1fr);gap:16px;align-items:start}
.help-toc{position:sticky;top:12px;padding:16px 8px;display:flex;flex-direction:column;gap:2px;max-height:calc(100vh - 24px);overflow-y:auto}
.help-toc-title{padding:0 10px 6px;font-weight:500}
.help-toc a{display:block;padding:7px 10px;border-radius:var(--radius);color:var(--surface-700);text-decoration:none;font:400 13px/18px Inter}
.help-toc a:hover{background:var(--surface-50)}
.help-toc a.active{background:var(--primary-50);color:var(--primary-700);font-weight:500}
.help-body{display:flex;flex-direction:column;gap:16px;min-width:0}
.help-sec{scroll-margin-top:12px}
.help-sec h3{font:600 14px/20px Inter;color:var(--surface-900);margin-top:20px}
.help-sec h3 .tag{margin-left:8px;vertical-align:middle}
.help-sec p{margin-top:8px}
.help-sec ul,.help-sec ol{margin-top:8px;padding-left:22px}
.help-sec li{margin:4px 0}
.help-sec li b,.help-sec dt b{font-weight:600;color:var(--surface-900)}
.help-sec .tscroll{margin-top:8px}
.help-sec .dt td{vertical-align:top}
.help-mgroup+.help-mgroup{margin-top:4px}
.help-mtable td:nth-child(2){min-width:220px}
.help-mtable td:nth-child(5){min-width:150px}
#metricFind{width:240px;flex:0 0 auto}
.help-faq dt{font-weight:600;color:var(--surface-900);margin-top:14px}
.help-faq dd{margin:4px 0 0}
.kpi-val-sm{font-size:16px;line-height:28px}
@media (max-width:900px){
  .help-layout{grid-template-columns:1fr}
  .help-toc{position:static;max-height:none;flex-direction:row;flex-wrap:wrap;gap:4px;padding:12px}
  .help-toc-title{display:none}
  .help-toc a{border:1px solid var(--surface-200);padding:5px 10px}
  #metricFind{width:100%}
}
.tg-mode .help-layout{grid-template-columns:1fr}
.tg-mode .help-toc{position:static;max-height:none;flex-direction:row;flex-wrap:wrap;gap:4px;padding:12px}
.tg-mode .help-toc-title{display:none}
.tg-mode .help-toc a{border:1px solid var(--surface-200);padding:5px 10px}
.tg-mode #metricFind{width:100%}

/* ---- экран «Каталог»: полоса доли прямо в ячейке таблицы.
   Не график: значений по 80 категорий и 40 брендов, отдельный холст на такую таблицу — лишний
   слой, а глазу нужна только длина строки рядом с числом. */
.as-bar{display:flex;align-items:center;gap:8px;justify-content:flex-end}
.as-bar i{display:block;height:6px;border-radius:3px;background:var(--primary-200,#bfd4fb);flex:0 0 auto}
.as-bar b{font-weight:400;font-variant-numeric:tabular-nums;min-width:52px;text-align:right}
.as-steps{display:grid;gap:10px}
.as-step{display:grid;grid-template-columns:120px 1fr 110px;align-items:center;gap:12px}
.as-step i{display:block;height:14px;border-radius:4px;background:var(--primary-200,#bfd4fb)}
.as-step span:last-child{text-align:right;font-variant-numeric:tabular-nums;color:var(--surface-500)}
@media (max-width:700px){.as-step{grid-template-columns:96px 1fr 88px;gap:8px}}

/* ---------- Отчёт CMO (/cmo) ----------
   Экран, где один выбор ведёт всю страницу. Своей палитры не заводит: цвета, карточки и таблицы —
   те же, что на «Обзоре» и «Каталоге». Новое здесь только две вещи — мера прямо в ячейке (полоска
   доли и остаток выдачи, который забирает кто-то другой) и компактная карточка недели со
   спарклайном: график ради шести точек занимал бы пол-экрана. */
/* Служебные строки блока «Бренды» — «прочие бренды» и «без бренда». Это не бренды, а честный
   остаток, без которого сумма по таблице не сошлась бы с категорией: показываем, но приглушённо,
   чтобы они не спорили за внимание с настоящими брендами. */
table.dt tr.cmo-rest td{color:var(--surface-500)}
table.dt tr.cmo-rest td:first-child{font-style:italic}
/* Шесть колонок в карточке на половину экрана: «17,8 млн ₽» и «прочие бренды» ломались пополам,
   и таблица читалась как вдвое более длинная. Ширины хватает — не хватало запрета переноса. */
#brTable th,#brTable td{white-space:nowrap;padding-left:10px;padding-right:10px}
.cmo-legend{margin:12px 28px 20px;color:var(--surface-500);font:400 13px/18px Inter;gap:16px}
.cmo-legend .sw{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:6px;vertical-align:-1px}
.cmo-legend .sw-rev{background:var(--primary-600,#2563eb)}
.cmo-legend .sw-meter{background:#93b4f7}
.cmo-legend .sw-free{background:var(--surface-100);border:1px solid var(--surface-300)}
/* Доля закрашена, остальное — чужая выдача. Шкала корневая, а не линейная до 100: доли тут единицы
   процентов, и на линейной шкале все полоски были бы неотличимы от нуля. */
.cmo-meter{display:inline-block;width:40px;height:8px;border-radius:4px;background:var(--surface-100);
  border:1px solid var(--surface-200);vertical-align:0;overflow:hidden;margin-right:8px}
.cmo-meter i{display:block;height:100%;background:#93b4f7}
.cmo-mv{font-variant-numeric:tabular-nums}
/* полоска и число — одной строкой: иначе число уезжает под меру и колонка вырастает вдвое */
table.dt td.cmo-cell{white-space:nowrap}
.cmo-bar{display:inline-block;width:52px;height:8px;border-radius:4px;background:var(--surface-100);
  vertical-align:0;overflow:hidden;margin-right:8px}
.cmo-bar i{display:block;height:100%;background:var(--primary-600,#2563eb)}
.cmo-bv{font-variant-numeric:tabular-nums}
table.dt td.ch-act,table.dt th.ch-act{background:rgba(37,99,235,.06)}
table.dt tr.cmo-click{cursor:pointer}
/* Колонок с мерами семь — таблица на ноутбучном экране переполняла карточку на несколько десятков
   пикселей, и последняя колонка стояла вечно наполовину срезанной. Ужимаем поля именно этой
   таблицы, а не всех: в остальных воздух нужен. */
#cmoTable th,#cmoTable td{padding-left:10px;padding-right:10px}
#cmoTable th:first-child,#cmoTable td:first-child{padding-left:20px}
#cmoTable th:last-child,#cmoTable td:last-child{padding-right:20px}
/* Имя категории липнет к левому краю — как в «Каталоге»: колонок с мерами много, и без этого
   на середине таблицы уже не видно, чья строка. Фон непрозрачный, иначе сквозь ячейку видно соседние. */
#cmoTable th:first-child,#cmoTable td:first-child{position:sticky;left:0;z-index:2;background:#fff}
#cmoTable thead th:first-child{z-index:3;background:var(--surface-50)}
#cmoTable tbody tr:hover td:first-child{background:var(--surface-50)}
#cmoTable tr.row-pick>td:first-child{background:#e9effc}
.cmo-foot{margin:8px 0 0;padding-left:18px;color:var(--surface-600);font:400 14px/22px Inter}
.cmo-foot li{margin-bottom:8px}
.cmo-foot li b{color:var(--surface-800)}
.wkcards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;padding:0 28px 16px}
.wkcard{border:1px solid var(--surface-200);border-radius:var(--radius-md);padding:12px 14px;min-width:0}
.wkcard .n{color:var(--surface-500);font:400 13px/18px Inter}
.wkcard .v{font:600 18px/26px Inter;color:var(--surface-900);font-variant-numeric:tabular-nums;white-space:nowrap}
.wkcard .r{font:400 12px/16px Inter}
.wkcard .b{display:flex;align-items:center;gap:8px;margin-top:6px;flex-wrap:wrap}
.cmo-spark{width:86px;height:26px;overflow:visible}
.cmo-spark polyline{fill:none;stroke:#2563eb;stroke-width:1.5;vector-effect:non-scaling-stroke}
@media (max-width:900px){.wkcards,.cmo-legend{padding-left:16px;padding-right:16px;margin-left:16px;margin-right:16px}}

/* библиотека отчётов (/library) */
.lib-tabs .segmented{height:auto}
.lib-tab{font:500 14px/18px Inter;color:var(--surface-500);padding:4px 10px;border-radius:6px;white-space:nowrap;text-decoration:none}
.lib-tab.active{background:#fff;color:var(--surface-900);box-shadow:var(--shadow-1)}
.lib-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:12px}
.lib-filters .input{max-width:100%}
.lib-q{flex:1 1 220px}
.lib-date{display:inline-flex;align-items:center;gap:6px}
.lib-error{color:var(--danger-700);padding:12px}
.lib-skills{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.lib-skill{display:inline-flex;gap:6px;align-items:center;min-height:28px;padding:3px 10px;border-radius:14px;border:1px solid var(--surface-200);background:#fff;font:500 13px/18px Inter;color:var(--surface-600);text-decoration:none}
.lib-skill.active{background:var(--primary-50);border-color:var(--primary-600);color:var(--primary-700)}
.lib-title{flex-wrap:wrap;overflow-wrap:anywhere}
.lib-summary{color:var(--surface-700);overflow-wrap:anywhere}
.lib-edit-row{display:flex;flex-wrap:wrap;gap:0 12px}
.lib-edit-row .field{flex:1 1 200px}
.lib-edit .input{width:100%}
.lib-textarea{height:auto;resize:vertical}
.lib-view{padding:8px}
.lib-frame{display:block;width:100%;height:78vh;min-height:360px;border:0;border-radius:6px;background:#fff}
.lib-img{display:block;max-width:100%;height:auto;margin:0 auto}
.lib-preview{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/18px var(--font-mono,monospace);color:var(--surface-700);margin:8px 0 0}
.lib-head .brd-actions{flex-wrap:wrap}
@media (max-width:760px){.lib-frame{height:70vh}.lib-filters .input.select,.lib-date{flex:1 1 140px}}
