/* Easy Quant — страница дашборда (ADR-0065, шаг 3). Дополняет /upload/styles.css (палитра, шрифт, кнопки,
   тёмная тема). Вид — навигация 19.10: шапка одной строкой (фильтр, настройки), слева вкладки «Вопросы / Методы»,
   в середине карточка (панель разбивки над таблицей как листом Excel, два графика), справа — колонка «Отчёт»
   со скачиванием внизу. */

.dash-page {
  --sig-up-bg: #c6efce;
  --sig-up-fg: #006100;
  --sig-dn-bg: #ffc7ce;
  --sig-dn-fg: #9c0006;
  --role-top: #2e7d32;
  --role-bottom: #a14a12;
  --role-mean: #3a3a99;
  --bar: var(--primary);
  --bar-track: rgba(20, 40, 60, 0.07);
  --cell-total: rgba(31, 95, 168, 0.05);
}
html[data-theme="dark"] .dash-page {
  --sig-up-bg: #173a24;
  --sig-up-fg: #8fdca6;
  --sig-dn-bg: #45202a;
  --sig-dn-fg: #f3a3b0;
  --role-top: #8fdca6;
  --role-bottom: #f0b085;
  --role-mean: #a9b4ff;
  --bar-track: rgba(255, 255, 255, 0.07);
  --cell-total: rgba(110, 168, 236, 0.07);
}

.dash-page .up-nav-inner { max-width: 1320px; }
/* меню «⋯» (навигация 19.10): печать страницы — не выгрузка отчёта */
.dash-more { position: relative; }
.dash-more-btn {
  background: none; border: 0; padding: 2px 8px; border-radius: 8px; font: inherit; font-weight: 700;
  font-size: 1.15rem; line-height: 1; color: var(--primary); cursor: pointer; min-height: 32px;
}
.dash-more-btn:hover, .dash-more-btn[aria-expanded="true"] { background: var(--primary-veil); }
.dash-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 17rem; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); box-shadow: var(--shadow-md);
}
.dash-more-menu.hidden { display: none; }
.dash-more-item {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 6px;
  font: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer;
}
.dash-more-item:hover, .dash-more-item:focus-visible { background: var(--primary-veil); }

.dash-main {
  flex-grow: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}
@media (max-width: 560px) { .dash-main { padding: 16px 16px 32px; } }

/* Разбор 20.10, B3: название — одной строкой с многоточием (полностью — во всплывающей подсказке), «Пример» рядом;
   шапка до прокрутки не выше прокрученной. На телефоне шапка не закреплена — название переносится целиком. */
.dash-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; min-width: 0; }
.dash-head h1 {
  margin: 0;
  min-width: 0;
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 560px) {
  .dash-title-row { flex-wrap: wrap; }
  .dash-head h1 { white-space: normal; overflow-wrap: anywhere; }
}
.dash-badge {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--warn-text);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 10px;
}
.dash-sub { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.92rem; }
/* Предварительный вид (план dashboard_first, Э1а): дашборд до отчёта */
.dash-prep {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 10px 0 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--cell-total); font-size: 0.88rem; color: var(--text-secondary); max-width: 70rem;
}
.dash-prep.hidden { display: none; }
.dash-prep p { margin: 0; flex: 1 1 18rem; }
.dash-sub b { color: var(--text); font-weight: 600; }

.dash-state {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 32px 24px;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-secondary);
}

/* ── Шапка одной строкой (навигация 19.10): проект слева, фильтр и настройки расчёта — справа ── */
/* Разбор 19.10, P1.2: шапка закреплена при прокрутке — название, n с фильтром, условия, настройки, «Отменить»;
   прокрутили — компактнее (название в строку). Высота шапки — `--head-h` (ставит страница), под неё встают левая
   колонка и прокрутка к якорям. */
.dash-head {
  position: sticky; top: 0; z-index: 30;
  margin: -20px -24px 0; padding: 14px 24px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
/* телефон: шапка в две-три строки заняла бы пятую часть экрана — не закрепляем */
@media (max-width: 560px) { .dash-head { position: relative; margin: -16px -16px 0; padding: 12px 16px 8px; } }
.dash-head.stuck { padding-top: 8px; padding-bottom: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
.dash-head.stuck .dash-title-row { flex-wrap: nowrap; }
.dash-head.stuck h1 { min-width: 0; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-head.stuck .dash-sub { margin-top: 1px; font-size: 0.86rem; }
html { scroll-padding-top: calc(var(--head-h, 0px) + 8px); }
/* окна фильтра и настроек — из шапки, поверх страницы (видны при любой прокрутке) */
.flt-panel.head-pop {
  position: absolute; top: calc(100% + 6px); right: 24px; z-index: 35; margin: 0;
  width: min(640px, calc(100vw - 48px)); max-height: calc(100vh - var(--head-h, 80px) - 24px); overflow: auto;
}
@media (max-width: 560px) { .flt-panel.head-pop { left: 16px; right: 16px; width: auto; } }
/* «Отменить / Вернуть» — изменения отчёта; на узком экране — только стрелки */
.dash-undo { display: flex; gap: 2px; }
.dash-undo.hidden { display: none; }
.dash-undo .btn { gap: 5px; }
@media (max-width: 720px) { .undo-lab { display: none; } }
.dash-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.dash-head-text { flex: 1 1 20rem; min-width: 0; }
.dash-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 18px; min-width: 0; }
.dash-tools.hidden { display: none; }
.dash-filter, .dash-break { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
/* ── Панель карточки (разбор 19.10, P1.3): первая строка — разбивка списком, вид, «⋯»; вторая — подсказка
   «различается по». Не выше двух строк на 1366 px, на телефоне — с переносом. ── */
.q-ctl {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--cell-total);
}
.q-ctl:not(:has(> :not(.hidden))) { display: none; }
.q-ctl > * { min-width: 0; }
.q-ctl .dash-break { flex: 0 1 auto; flex-wrap: nowrap; }
.q-ctl .ctl-view { margin-left: auto; flex: none; }
.q-ctl .ctl-more { flex: none; }
.q-ctl .dash-break.hidden + .ctl-view { margin-left: 0; }
.q-ctl .q-suggest { flex: 1 0 100%; margin: 0; flex-wrap: wrap; }
/* подсказки: подпись без кода вопроса, ужимается с многоточием не меньше чем до 9rem (разбор 20.10, B6: чипы
   сжимались до «S2г…»); не влезли в строку — переносятся (полностью — во всплывающей подсказке) */
.q-ctl .q-suggest-label { flex: none; }
.q-ctl .sug { max-width: 100%; flex: 0 1 auto; min-width: 9rem; }
@media (max-width: 560px) {
  .q-ctl .dash-break { flex: 1 1 100%; }
  .q-ctl .ctl-view { margin-left: 0; }
  .q-ctl .q-suggest { flex-wrap: wrap; }
}
/* выпадающие окна панели: список разбивок и «⋯» */
.ctl-pop { position: relative; min-width: 0; }
.ctl-drop {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 34px; padding: 5px 10px 5px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text);
  font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer;
}
.ctl-drop::after { content: "▾"; flex: none; color: var(--text-secondary); font-weight: 400; }
.ctl-drop:hover, .ctl-drop[aria-expanded="true"] { background: var(--primary-veil); }
.ctl-drop-lab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24rem; }
/* z-index выше полосы «В отчёте» (45): разбор 20.10, B1 — нижние пункты списка разбивок уходили под полосу */
.ctl-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 46; width: max-content; min-width: 16rem;
  max-width: min(30rem, calc(100vw - 32px)); max-height: 60vh; overflow: auto; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); box-shadow: var(--shadow-md);
}
.ctl-menu.ctl-menu-end { left: auto; right: 0; }
.ctl-radios { display: grid; }
.ctl-radios button, .ctl-item {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px 8px 28px;
  border-radius: 6px; font: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer; position: relative;
  overflow-wrap: anywhere;
}
.ctl-item { padding-left: 10px; }
.ctl-radios button:hover, .ctl-radios button:focus-visible, .ctl-item:hover, .ctl-item:focus-visible { background: var(--primary-veil); }
.ctl-radios button[aria-checked="true"] { font-weight: 600; }
.ctl-radios button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 10px; color: var(--primary); }
.ctl-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.ctl-more-btn {
  min-height: 34px; min-width: 36px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--primary); font: inherit; font-weight: 700; font-size: 1.1rem; line-height: 1;
  cursor: pointer; position: relative;
}
.ctl-more-btn:hover, .ctl-more-btn[aria-expanded="true"] { background: var(--primary-veil); }
/* у карточки строки-показатели не все идут в отчёт — точка на «⋯» */
.ctl-more-btn.has-off::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.ctl-menu .stat-bar { padding: 4px; max-width: 26rem; }
/* Один главный вид (P1.3): «График» — графики сразу под панелью, таблицы нет; «Таблица» — графики под подвалом. */
.dash-content:not(.view-chart) > #charts { order: 1; }
.dash-content.view-chart > #table-wrap, .dash-content.view-chart > #rows-toggle { display: none; }
@media print {
  .dash-content.view-chart > #table-wrap { display: block; }
  .ctl-menu, .ctl-view, .ctl-more { display: none !important; }
}
.dash-ctl-label { color: var(--text-secondary); font-size: 0.9rem; }
.chips { display: contents; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  border: 1px solid var(--primary-soft-strong);
  background: var(--primary-soft);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1.3;
}
.chip-edit {
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  padding: 5px 4px 5px 12px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 26rem;
}
.chip-x {
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text-secondary);
  padding: 2px 10px 2px 4px;
  cursor: pointer;
  min-height: 30px;
}
.chip-x:hover { color: var(--text); }
.btn.btn-sm { font-size: 0.88rem; padding: 6px 12px; min-height: 34px; }
.link-btn {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.link-btn:hover { color: var(--text); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; max-width: 100%; }
.seg button {
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"] { background: var(--primary); color: #fff; font-weight: 600; }
html[data-theme="dark"] .seg button[aria-checked="true"] { color: #0b1220; }
.seg button:not([aria-checked="true"]):hover { background: var(--primary-veil); }

.flt-panel {
  position: relative;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  max-width: 640px;
}
.flt-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}
.flt-panel input[type="search"], .dash-side input[type="search"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
.flt-panel input[type="search"] { width: calc(100% - 36px); }
.flt-vars { margin-top: 8px; max-height: 320px; overflow: auto; }
.flt-sec { margin: 10px 0 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-hint); }
.flt-var {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.35;
}
.flt-var:hover { background: var(--primary-veil); }
.flt-var-title { font-weight: 600; color: var(--text); padding-right: 32px; margin-bottom: 8px; overflow-wrap: anywhere; }
.flt-vals { display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.flt-val { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 0.9rem; cursor: pointer; }
.flt-val input { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.flt-val .n { margin-left: auto; color: var(--text-hint); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.flt-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── Разбивки вопроса и настройки расчёта (план 16.10, Э2) ── */
.dash-calc { display: flex; align-items: center; gap: 8px; }
.brk-count { font-weight: 400; color: var(--text-hint); font-size: 0.85rem; }
.brk-hint { margin: 0 0 8px; font-size: 0.88rem; color: var(--text-secondary); }
.brk-list { margin-top: 8px; }
.flt-val .sug-tag { color: var(--primary); font-variant-numeric: normal; }
.flt-val input:disabled + span { color: var(--text-hint); }
.q-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 2px 0 10px; font-size: 0.88rem; }
.q-suggest-label { color: var(--text-secondary); }
.sug {
  border: 1px dashed var(--primary-soft-strong);
  background: none;
  color: var(--text);
  font: inherit;
  border-radius: 999px;
  padding: 3px 12px;
  min-height: 30px;
  cursor: pointer;
  max-width: 24rem;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.sug .sug-lab { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sug::before { content: "+ "; color: var(--primary); flex: none; white-space: pre; }
.sug:hover { background: var(--primary-veil); }
.sug.on { border-style: solid; background: var(--primary-soft); }
.sug.on::before { content: ""; }
.sug .sug-v { flex: none; margin-left: 6px; color: var(--text-secondary); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.set-grid { display: grid; gap: 10px; }
.set-row { display: grid; grid-template-columns: 13rem minmax(0, 1fr); align-items: center; gap: 10px; font-size: 0.9rem; }
.set-row span { color: var(--text-secondary); }
.set-row select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 36px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  min-width: 0;
}
/* Оформление Excel (ADR-0095): поля — как «Оформление отчёта» меню */
#xls-panel { width: min(600px, calc(100vw - 32px)); }
.xls-sum { margin: 0 0 4px; font-size: 0.9rem; color: var(--text-secondary); }
#xls-form { margin-top: 10px; }
.xls-logo { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.xls-logo input[type="file"] { max-width: 100%; font: inherit; font-size: 0.85rem; }
.xls-logo .set-hint { margin: 0; }
.xls-sig-colors { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.88rem; color: var(--text-secondary); }
.xls-sig-colors label { display: inline-flex; align-items: center; gap: 6px; }
#xls-panel input[type="color"] {
  width: 44px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer;
}
.set-check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.set-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.set-hint { margin: -4px 0 0; font-size: 0.82rem; color: var(--text-hint); }
.set-note { color: var(--primary); font-weight: 600; }
@media (max-width: 560px) {
  .set-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ── Отчёт: карточки «в отчёт» (план 16.10, Э3) ── */
.q-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.q-head h2 { flex: 1 1 18rem; min-width: 0; }
.q-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--primary-soft-strong);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 3px 10px;
}
.rep-count { font-weight: 400; color: var(--text-hint); }
/* ширина колонки «Отчёт» (разбор 19.10, P1.1: на 1366 px середине нужно место — 300 px вместо 360) */
.dash-page { --rep-w: 300px; }
@media (min-width: 1600px) { .dash-page { --rep-w: 340px; } }
.rep-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--rep-w);
  z-index: 40;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  overflow: auto;
}
/* от 1280 px отчёт — постоянной колонкой справа, дашборд и верхняя строка сужаются (таблица и кнопки не уходят под
   колонку; макет «Мастерская», стенд 17.10; разбор 19.10, P1.1). Уже — колонка поверх страницы по полосе внизу. */
body.rep-open .dash-main { width: calc(100% - var(--rep-w)); max-width: none; margin: 0 var(--rep-w) 0 0; }
body.rep-open .up-nav { margin-right: var(--rep-w); }
body.rep-over .rep-panel { width: min(380px, 100vw); }
.rep-item.flash { animation: xt-flash 1.4s ease-out; }
/* полоса «В отчёте: N» внизу — когда колонки не видно (узкий экран или колонка свёрнута). Разбор 20.10, B1: у правого
   края, а не посередине (посередине закрывала строки таблиц и подписи графиков); пока открыто меню карточки или окно
   шапки — спрятана */
.rep-bar {
  position: fixed; right: 16px; bottom: 14px; z-index: 45;
  display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 32px);
  padding: 5px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); box-shadow: var(--shadow-md);
}
.rep-bar.hidden { display: none; }
.rep-bar-open {
  display: inline-flex; align-items: baseline; gap: 12px; min-height: 36px; min-width: 0; padding: 6px 12px;
  border: 0; border-radius: 999px; background: none; font: inherit; font-size: 0.9rem; color: var(--text);
  white-space: nowrap; cursor: pointer;
}
.rep-bar-open:hover, .rep-bar-open:focus-visible { background: var(--primary-veil); }
.rep-bar-go { color: var(--primary); font-weight: 600; }
.rep-bar .btn { border-radius: 999px; }
.rep-bar.flash { animation: rep-bar-flash 1.4s ease-out; }
@keyframes rep-bar-flash {
  from { box-shadow: 0 0 0 5px var(--primary-soft-strong), var(--shadow-md); }
  to { box-shadow: 0 0 0 0 transparent, var(--shadow-md); }
}
body:has(.ctl-menu:not(.hidden)) .rep-bar, body:has(.flt-panel.head-pop:not(.hidden)) .rep-bar { display: none; }
body.rep-bar-on .dash-main { padding-bottom: 88px; }
body.rep-bar-on .dash-toast { bottom: 76px; }
body.rep-bar-on .dash-side { max-height: calc(100vh - var(--head-h, 0px) - 80px); }
/* миниатюра слайда карточки: схема по плану слайда (вид, заголовок, пропорции чисел, сноска) — белый «слайд» */
.rep-thumb {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 3px;
  width: calc(100% - 1.4em - 8px);
  margin: 6px 0 0 calc(1.4em + 8px);
  aspect-ratio: 16 / 9;
  padding: 6px 8px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: #1d1d1f;
  text-align: left;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}
.rep-thumb:hover { border-color: var(--primary); }
.rep-thumb.loading { background: linear-gradient(90deg, #fff, #f2f4f7, #fff); }
.rt-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 0.66rem; font-weight: 700; line-height: 1.25;
}
.rt-svg { width: 100%; height: 100%; min-height: 0; display: block; }
.rt-foot { font-size: 0.5rem; color: #8a8f98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rep-head h2 { margin: 0; font-size: 1.1rem; }
.rep-tools { display: flex; align-items: center; gap: 4px; }
.rep-close { position: static; }
.link-btn:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
.rep-export { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* выгрузки отчёта — одно место, низ колонки (навигация 19.10) */
.rep-dl {
  position: sticky; bottom: -14px; margin: auto -16px -14px; padding: 12px 16px 14px;
  border-top: 1px solid var(--border); background: var(--bg-card); display: grid; gap: 8px;
}
.rep-dl-title { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-secondary); }
.rep-dl-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rep-dl-row .btn { justify-content: center; }
.rep-dl.flash { animation: xt-flash 1.4s ease-out; }
/* Проба (ADR-0088): выгрузка своего проекта — после оплаты */
.rep-lock { margin: 0; font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); }
.rep-lock a { color: var(--primary); font-weight: 600; }
.done-dl-note { margin: 12px 0 0; font-size: 0.86rem; color: var(--text-secondary); }
.rep-note { margin: 8px 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.rep-empty { margin: 16px 0 0; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.45; }
.rep-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.rep-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-card);
  cursor: grab;
}
.rep-item.open { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.rep-item.dragging { opacity: 0.5; }
.rep-item.over { border-style: dashed; border-color: var(--primary); }
.rep-item.missing { opacity: 0.6; }
.rep-top { display: flex; align-items: baseline; gap: 8px; }
.rep-num { color: var(--text-hint); font-variant-numeric: tabular-nums; font-size: 0.85rem; min-width: 1.4em; }
.rep-title {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
  padding: 0;
  cursor: pointer;
  line-height: 1.35;
}
.rep-title:hover:not(:disabled) { color: var(--primary); text-decoration: underline; }
.rep-title:disabled { cursor: default; }
.rep-rename {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
}
.rep-meta { margin: 4px 0 0 calc(1.4em + 8px); font-size: 0.8rem; color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere; }
.rep-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 6px 0 0 calc(1.4em + 8px); }
.rep-row .link-btn { font-size: 0.8rem; padding: 2px 4px; }
.rep-view {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  font: inherit;
  font-size: 0.8rem;
  background: var(--bg-card);
  color: var(--text);
}
@media print {
  .rep-panel, .q-actions, .rep-bar, .dash-undo { display: none !important; }
  body.rep-open .dash-main { width: 100%; margin: 0; }
  body.rep-open .up-nav { margin-right: 0; }
  .dash-head { position: static; margin: 0; padding: 0 0 12px; box-shadow: none; }
}

/* ── Тело: вопросы слева, таблица и графики справа ── */
.dash-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  padding-top: 18px;
  align-items: start;
}
/* до 1600 px — уже левая колонка: середине на 1366 px с колонкой «Отчёт» нужно место (разбор 19.10, P1.1) */
@media (max-width: 1599px) { .dash-body { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; } }
.dash-body > * { min-width: 0; }
.dash-side {
  position: sticky;
  top: calc(var(--head-h, 0px) + 8px);
  max-height: calc(100vh - var(--head-h, 0px) - 16px);
  overflow: auto;
  padding-right: 4px;
}
#q-list { margin-top: 8px; }
/* вкладки слева (навигация 19.10): «Вопросы» / «Модули анализа» — ширина по тексту, в одну строку */
.side-tabs {
  display: grid; grid-template-columns: auto auto; margin-bottom: 10px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
}
.side-tabs [role="tab"] {
  border: 0; background: none; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--text-secondary);
  padding: 8px 4px; min-height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
.side-tabs [role="tab"] + [role="tab"] { border-left: 1px solid var(--border); }
.side-tabs [role="tab"]:hover { color: var(--text); background: var(--primary-veil); }
.side-tabs [role="tab"][aria-selected="true"] { background: var(--primary); color: #fff; }
.side-n { font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.85; }
.side-n:empty { display: none; }
#side-m.hidden, #side-q.hidden { display: none; }
.m-add { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--primary-soft-strong); border-radius: var(--radius-sm); background: var(--primary-soft); }
.m-add .btn { width: 100%; justify-content: center; }
.m-hint { margin: 0; font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-head .q-count { text-transform: none; letter-spacing: 0; }
.m-item { margin-bottom: 4px; }
.m-title { padding: 6px 10px 2px; font-size: 0.86rem; font-weight: 600; color: var(--text); line-height: 1.35; }
/* карточка анализа в отчёте (P1.4): название — как у метода, листы модуля запуска — под ним */
.q-btn.m-card { font-weight: 600; font-size: 0.86rem; line-height: 1.35; }
.q-btn.m-card.missing { color: var(--text-secondary); font-weight: 400; }
.q-btn.m-sheet { padding-left: 20px; color: var(--text-secondary); font-size: 0.84rem; }
.q-btn.m-sheet[aria-current="true"] { color: var(--text); }
.q-btn.m-can { display: grid; gap: 2px; }
.m-can-t { font-weight: 600; }
.m-can-a { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.35; font-weight: 400; }
.q-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.35;
}
.q-btn:hover { background: var(--primary-veil); }
.q-btn[aria-current="true"] { background: var(--primary-soft); font-weight: 600; }
/* спека «Мастерская» 17.10: «+» у вопроса — в отчёт, не открывая; вопрос тянется в «Разбивку» */
.q-item { position: relative; }
.q-item > .q-btn { padding-right: 32px; }
.q-pin {
  position: absolute; top: 4px; right: 2px; width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: transparent; color: var(--primary); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
  opacity: 0;
}
.q-item:hover .q-pin, .q-pin:focus-visible { opacity: 1; }
.q-pin:hover { background: var(--primary-soft); }
@media (hover: none) { .q-pin { opacity: 0.7; } }
.drop-on { outline: 2px dashed var(--primary); outline-offset: 3px; border-radius: 8px; }
.q-group { margin: 14px 10px 4px; color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
/* Э5: блоки анкеты и батареи одной строкой */
.q-sec {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  margin-top: 10px; padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; font: inherit; text-align: left; cursor: pointer;
  color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1.35;
}
.q-sec:hover { background: var(--primary-veil); color: var(--text); }
.q-sec::before { content: "▸"; flex: none; width: 10px; color: var(--text-secondary); }
.q-sec.open::before { content: "▾"; }
.q-sec-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.q-count {
  flex: none; margin-left: auto; padding: 0 6px; border-radius: 999px; background: var(--primary-veil);
  color: var(--text-secondary); font-size: 0.72rem; font-weight: 600; line-height: 1.6; font-variant-numeric: tabular-nums;
}
.q-sec-body { margin-left: 8px; }
.q-btn.q-bat { display: flex; align-items: flex-start; gap: 8px; }
.q-btn.q-bat::before { content: "▸"; flex: none; width: 10px; color: var(--text-secondary); }
.q-btn.q-bat.open::before { content: "▾"; }
.q-bat-title { flex: 1 1 auto; min-width: 0; }
.q-sub { margin-left: 18px; border-left: 1px solid var(--border); padding-left: 4px; }
/* Разбор 20.10, B4: длинный вопрос — не больше двух строк с многоточием (Q6 занимал шесть); полностью — во
   всплывающей подсказке и в заголовке карточки. Открытый вопрос — целиком. */
.q-btn .q-lab {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.q-btn[aria-current="true"] .q-lab { display: block; -webkit-line-clamp: unset; line-clamp: none; }
.q-row-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 3px;
  color: var(--text-secondary); font-size: 0.74rem; font-weight: 400; font-variant-numeric: tabular-nums;
}
.q-mini { position: relative; flex: none; width: 44px; height: 6px; border-radius: 3px; background: var(--primary-veil); overflow: hidden; }
.q-mini > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 3px; }
.q-mval { color: var(--text); white-space: nowrap; }
/* показатель строки (P2.1) — своей строкой под типом и базой: подпись «Женский», «ср.», «Top-2» сжимается
   многоточием, полоска и число — целиком */
.q-mline { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; min-width: 0; }
.q-mlab { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-type { flex: none; white-space: nowrap; }
.q-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.bat-metric { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.bat-metric select {
  min-height: 32px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
  background: var(--bg-card); color: var(--text); font: inherit;
}
.q-select { display: none; width: 100%; max-width: 100%; min-height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--bg-card); color: var(--text); font: inherit; }

.dash-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dash-content > * { min-width: 0; }

/* ── «Обзор» (план 16.10, Э5а): разделы и ключевые вопросы ── */
.dash-content.ov-mode > :not(.ov):not(.q-select) { display: none !important; }
.ov { display: grid; gap: 14px; }
.ov.hidden { display: none; }
.ov-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.ov-head-text { flex: 1 1 18rem; min-width: 0; }
.ov-sub { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.88rem; }
.ov-secs { display: grid; gap: 22px; }
.ov-sec h3 {
  margin: 0 0 10px; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere;
}
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ov-card {
  display: grid; gap: 8px; align-content: start; text-align: left; width: 100%; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
  padding: 12px 14px; font: inherit; color: var(--text); cursor: pointer;
}
.ov-card:hover { border-color: var(--primary-soft-strong); box-shadow: var(--shadow-md); }
.ov-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ov-q { font-size: 0.88rem; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.ov-num { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ov-big { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text);
  white-space: nowrap; }
.ov-mlab { font-size: 0.8rem; color: var(--text-secondary); min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.ov-bars { display: grid; gap: 4px; }
.ov-bar { display: grid; grid-template-columns: minmax(0, 1fr) 72px 40px; gap: 8px; align-items: center; font-size: 0.76rem; }
.ov-bar .lab { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-bar .track { height: 6px; border-radius: 3px; background: var(--bar-track); position: relative; overflow: hidden; }
.ov-bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); border-radius: 3px; }
.ov-bar .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.ov-more { font-size: 0.74rem; color: var(--text-hint); }
.ov-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.76rem; color: var(--text-secondary); }
/* итог PSM (P2.3): подпись — значение строками */
.ov-kv { display: grid; gap: 4px; }
.ov-kv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8rem; }
.ov-kv-row .lab { color: var(--text-secondary); min-width: 0; }
.ov-kv-row .val { color: var(--text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* теплокарта срезов одного вопроса (P2.3): во всю ширину раздела (колонок сетки может быть и одна) */
.ov-card-wide { grid-column: 1 / -1; }
.ov-heat { border-collapse: collapse; width: 100%; font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.ov-heat th { font-weight: 600; color: var(--text-secondary); padding: 2px 4px; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.ov-heat th.row { text-align: left; max-width: 180px; color: var(--text); font-weight: 400; }
.ov-heat td { padding: 3px 4px; text-align: center; color: var(--text); border: 1px solid var(--surface, #fff); }
.ov-diff { display: inline-flex; align-items: center; gap: 6px; }
.q-btn.q-ov { font-weight: 600; }
@media (max-width: 520px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .ov-heat { display: block; overflow-x: auto; }
}
@media print {
  #ov-pin-all { display: none !important; }
  .ov-card { break-inside: avoid; }
}
/* «Таблицы» (Сергей 17.10): все вопросы одной таблицей — своя прокрутка, шапка и подписи строк закреплены. */
.dash-content.tb-mode > :not(.tb):not(.q-select):not(#brk-panel) { display: none !important; }
.tb { display: grid; gap: 12px; }
.tb.hidden { display: none; }
.tb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-static { cursor: default; }
.tb-wrap { overflow: auto; max-height: calc(100vh - 230px); min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); container-type: inline-size; }
/* строка вопроса не шире видимой части таблицы: «Строки / В отчёт / Изменить» не уходят за край (колонка «Отчёт»
   открыта — таблица узкая) */
.tb-wrap .xt .xt-pin, .tb-wrap .xt .xt-tline { max-width: min(900px, calc(100cqi - 24px)); }
.xt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.xt thead { position: sticky; top: 0; z-index: 3; }
.xt th, .xt td { padding: 5px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; background: var(--bg-card); }
.xt thead th { font-weight: 600; color: var(--text); background: var(--primary-veil-solid, var(--bg-card)); font-size: 0.8rem; vertical-align: bottom; white-space: normal; min-width: 76px; box-shadow: inset 0 -1px 0 var(--border); }
.xt thead th.grp { text-align: center; color: var(--text-secondary); font-weight: 500; }
.xt thead th.total { color: var(--text); }
.xt th:first-child, .xt td:first-child { text-align: left; white-space: normal; min-width: 200px; max-width: 380px; position: sticky; left: 0; z-index: 1; }
.xt thead th:first-child { z-index: 4; }
.xt td.total { background: var(--cell-total); font-weight: 600; }
.xt td.up { background: var(--sig-up-bg); color: var(--sig-up-fg); font-weight: 600; }
.xt td.dn { background: var(--sig-dn-bg); color: var(--sig-dn-fg); font-weight: 600; }
.xt td.small { color: var(--warn-text); }
.xt tr.r-base td { color: var(--text-secondary); font-size: 0.8rem; }
.xt tr.r-note td { color: var(--text-hint); font-style: italic; }
.xt tr.r-top td:first-child { color: var(--role-top); font-weight: 600; }
.xt tr.r-bottom td:first-child { color: var(--role-bottom); font-weight: 600; }
.xt tr.r-mean td:first-child { color: var(--role-mean); font-weight: 600; }
/* строки во всю ширину: раздел анкеты, заголовок вопроса, пояснение — текст закреплён слева при прокрутке вбок */
.xt .xt-full { text-align: left; position: static; max-width: none; min-width: 0; white-space: normal; }
.xt .xt-pin, .xt .xt-tline { position: sticky; left: 10px; display: inline-flex; max-width: min(900px, 80vw); }
.xt tbody.xt-sec th { background: var(--primary-soft); color: var(--text); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 10px; }
.xt tr.xt-title th { padding-top: 16px; border-bottom: 1px solid var(--border); }
.xt .xt-tline { align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.xt .xt-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; line-height: 1.35; }
.xt .xt-name:hover { color: var(--primary); text-decoration: underline; }
.xt .xt-acts { display: inline-flex; gap: 10px; font-weight: 400; }
.xt .xt-acts .link-btn { font-size: 0.8rem; }
/* «Строки» вопроса в «Все таблицы» (навигация 19.10) */
.tb-rows { position: relative; display: inline-flex; }
.tb-pop {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 6; display: grid; gap: 4px; min-width: 15rem;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
  box-shadow: var(--shadow-md); font-size: 0.86rem; text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.tb-pop.to-left { left: auto; right: 0; }
/* строка вопроса с открытым окном — над закреплённой первой колонкой следующих строк (z 1), под шапкой (z 3) */
.xt tr.xt-title th.xt-full:has(.tb-pop) { z-index: 2; }
.tb-pop-title { font-weight: 600; margin-bottom: 2px; }
.tb-pop .set-check { font-size: 0.86rem; }
.tb-pop .link-btn { justify-self: start; margin-top: 4px; }
.xt tr.xt-msg td { color: var(--text-secondary); font-size: 0.82rem; }
.xt tr.xt-wait td { color: var(--text-hint); }
.xt tr.xt-sub td { color: var(--text); font-weight: 600; font-size: 0.82rem; }
.xt tbody.xt-q.flash tr.xt-title th { animation: xt-flash 1.4s ease-out; }
@keyframes xt-flash { from { background: var(--primary-soft); } to { background: var(--bg-card); } }
.back-tb { justify-self: start; }
/* Э7 «Добавить анализ»: плитки модулей и форма выбора (лист модуля — ниже, в таблице вопроса). */
.an-box { display: grid; gap: 12px; }
.an-box.hidden { display: none; }
.an-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.an-tile { text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); padding: 10px 12px; display: grid; gap: 4px; align-content: start; cursor: pointer; font: inherit; color: var(--text); }
.an-tile:hover:not(:disabled) { border-color: var(--primary-soft-strong); }
.an-tile.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.an-tile:disabled { opacity: 0.55; cursor: default; }
.an-t { font-weight: 600; font-size: 0.9rem; }
.an-a { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.35; }
.an-form { display: grid; gap: 10px; max-width: 760px; }
.an-form.hidden { display: none; }
/* «Сравнение профилей групп»: какие группы сравнивать — галочки в строку (ADR-0089) */
.an-check-list { display: flex; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.an-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.an-form .an-check input { min-height: 0; width: 16px; height: 16px; padding: 0; }
.an-form select, .an-form input { min-height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; background: var(--bg-card); color: var(--text); font: inherit; min-width: 0; max-width: 100%; }
.brk-nest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.brk-nest select { min-height: 32px; max-width: 220px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.85rem; }
/* Правки данных: окно вопроса — поверх страницы (его открывают из глубины длинной таблицы). */
.ed-panel, #edl-panel { position: fixed; z-index: 60; top: 72px; left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 96px); overflow: auto; margin: 0; }
.ed-panel input[type="text"], .ed-panel input[type="number"] { min-height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; background: var(--bg-card); color: var(--text); font: inherit; min-width: 0; }
.ed-panel .set-row input { width: 100%; }
.ed-vhead, .ed-val { display: grid; grid-template-columns: 22px minmax(0, 1fr) 64px 72px; gap: 8px; align-items: center; }
.ed-vhead { margin: 12px 0 4px; font-size: 0.78rem; color: var(--text-hint); font-weight: 600; }
.ed-vhead > span:first-child { grid-column: 1 / 3; }
.ed-vals { display: grid; gap: 4px; max-height: 340px; overflow: auto; }
.ed-val .n { text-align: right; color: var(--text-hint); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.ed-val input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); justify-self: center; }
.ed-val.off .ed-lab { color: var(--text-hint); text-decoration: line-through; }
.ed-tag { grid-column: 2 / -1; font-size: 0.76rem; color: var(--primary); margin-top: -2px; }
.ed-group { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.ed-group input { flex: 1 1 16rem; }
.ed-made { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 4px 0; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.ed-panel > #ed-body > input[type="text"] { width: 100%; margin-bottom: 6px; }
.ed-rest { display: grid; gap: 4px; margin: 6px 0; }
/* «Как читать вопрос»: у шкалы — колонка «Вне шкалы» в списке вариантов */
.ed-vals.dk .ed-val, .ed-vhead.dk { grid-template-columns: 22px minmax(0, 1fr) 64px 72px 72px; }
.ed-read { display: grid; gap: 4px; margin: 4px 0 2px; }
.ed-read .set-check { margin-top: 2px; }
.ed-read .ed-top { display: grid; gap: 4px; margin: 2px 0 0 26px; font-size: 0.88rem; }
.ed-read .ed-top > span { color: var(--text-hint); font-size: 0.8rem; }
.ed-bin { display: grid; grid-template-columns: auto 90px auto 90px minmax(0, 1fr) auto; gap: 6px; align-items: center; margin: 4px 0; font-size: 0.86rem; color: var(--text-secondary); }
.edl-list { list-style: none; margin: 8px 0 0; padding: 0; }
#ed-body .set-check { margin-top: 10px; }
@media print {
  .tb-wrap { max-height: none; overflow: visible; border: 0; }
  .xt thead { position: static; }
  .xt th:first-child, .xt td:first-child, .xt .xt-pin, .xt .xt-tline { position: static; }
  .xt .xt-acts, .tb-bar button { display: none !important; }
}

.dash-content h2 { margin: 0; font-size: 1.15rem; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.q-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text-secondary); font-size: 0.88rem; }
.q-meta b { color: var(--text); font-weight: 600; }
.q-busy { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 0.9rem; }
.spinner.spinner-sm { width: 18px; height: 18px; border-width: 2px; margin: 0; }
.q-empty { margin: 0; color: var(--text-secondary); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); }
#tbl { border-collapse: collapse; width: 100%; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
#tbl th, #tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
#tbl th { font-weight: 600; color: var(--text); background: var(--primary-veil); font-size: 0.82rem; vertical-align: bottom; white-space: normal; min-width: 64px; }
#tbl th.grp { text-align: center; color: var(--text-secondary); font-weight: 500; border-bottom: 0; }
#tbl th:first-child, #tbl td:first-child { text-align: left; white-space: normal; min-width: 180px; max-width: 360px; position: sticky; left: 0; background: var(--bg-card); z-index: 1; }
#tbl th:first-child { background: var(--bg-card); }
#tbl th.colh { cursor: pointer; }
#tbl th .colh-l, #tbl th .colh-n { display: block; font-weight: 500; font-size: 0.75rem; }
#tbl th .colh-l { color: var(--primary); }
#tbl th .colh-n { color: var(--text-hint); font-variant-numeric: tabular-nums; }
#tbl thead tr:last-child th:nth-child(2) { white-space: nowrap; }
#tbl th.colh:hover { color: var(--primary); }
#tbl th.colh[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--primary); }
#tbl td.total { background: var(--cell-total); font-weight: 600; }
#tbl td.up { background: var(--sig-up-bg); color: var(--sig-up-fg); font-weight: 600; }
#tbl td.dn { background: var(--sig-dn-bg); color: var(--sig-dn-fg); font-weight: 600; }
#tbl td.small { color: var(--warn-text); }
#tbl tr:last-child td { border-bottom: 0; }
#tbl tr.r-base td { color: var(--text-secondary); font-size: 0.82rem; }
#tbl tr.r-note td { color: var(--text-hint); font-style: italic; }
#tbl tr.r-top td:first-child { color: var(--role-top); font-weight: 600; }
#tbl tr.r-bottom td:first-child { color: var(--role-bottom); font-weight: 600; }
#tbl tr.r-mean td:first-child { color: var(--role-mean); font-weight: 600; }
#tbl tr.r-sel td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
#tbl td.rowh { cursor: pointer; }
/* Э6: частые ответы открытого вопроса — текст ответа во всю ширину */
#tbl td.open-ans { max-width: 640px; white-space: normal; overflow-wrap: anywhere; }
#tbl td.rowh:hover { color: var(--primary); }
/* вариант ответа → фильтр «эти люди» (значок у подписи строки) */
#tbl .row-flt {
  margin-left: 6px; padding: 3px 5px; border: 0; border-radius: 4px; background: transparent; color: var(--primary);
  cursor: pointer; vertical-align: -4px; opacity: 0.6;
}
#tbl tr:hover .row-flt, #tbl .row-flt:focus-visible { opacity: 1; }
#tbl .row-flt:hover { background: var(--primary-soft); }
@media (hover: none) { #tbl .row-flt { opacity: 0.7; } }
/* Лист модуля «как в Excel»: текст слева и с переносом, числа справа; подписи — во всю ширину. */
#tbl tr.sheet-row td { text-align: left; white-space: normal; vertical-align: top; }
#tbl tr.sheet-row td.num { text-align: right; white-space: nowrap; }
#tbl tr.sheet-row td.sheet-title { position: static; max-width: none; min-width: 0; color: var(--text); }
#tbl tr.sheet-row td.sheet-gap { height: 8px; padding: 0; border-bottom: 0; position: static; min-width: 0; }
.q-warn { color: var(--warn-text); }
/* График PSM над листом модуля (разбор 20.10, B2): кривые, коридор, вертикали точек; таблица — по кнопке */
.psm-chart { margin: 4px 0 6px; }
.psm-svg { display: block; width: 100%; max-width: 860px; height: auto; }
.psm-grid { stroke: var(--border); stroke-width: 1; }
.psm-tick { font-size: 11px; fill: var(--text-secondary); }
.psm-band { fill: var(--primary-veil); }
.psm-band-lab { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.psm-opp, .psm-idp { stroke-width: 1.4; }
line.psm-opp { stroke: var(--text); }
line.psm-idp { stroke: var(--text-secondary); stroke-dasharray: 3 3; }
.psm-pt-lab { font-size: 11.5px; stroke: none; }
text.psm-opp { fill: var(--text); font-weight: 600; }
text.psm-idp { fill: var(--text-secondary); }
.psm-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; font-size: 0.82rem; color: var(--text-secondary); }
.psm-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.psm-swatch { width: 22px; height: 0; border-top: 2.5px solid; }
.psm-swatch.dashed { border-top-style: dashed; }
.sheet-data-toggle { justify-self: start; font-size: 0.85rem; }

#tbl .row-flt-tail { white-space: nowrap; }

.q-notes { display: grid; gap: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.82rem; color: var(--text-secondary); }
.rows-toggle { justify-self: start; font-size: 0.85rem; }
/* Строки-показатели карточки и умолчание отчёта (Сергей 18.10): показана — залитый чип, выключена — пустой серый */
.stat-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; }
.stat-bar .stat-lab { color: var(--text-secondary); margin-right: 2px; }
.stat-chip {
  border: 1px solid var(--primary-soft-strong);
  background: var(--primary-soft);
  color: var(--text);
  border-radius: 999px;
  font: inherit;
  padding: 3px 10px;
  min-height: 28px;
  cursor: pointer;
}
.stat-chip[aria-pressed="false"] { background: none; border-color: var(--border); color: var(--text-secondary); }
.stat-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.stat-bar .stat-note { color: var(--text-secondary); font-size: 0.8rem; }
.set-stats-row .stat-bar { min-width: 0; }
.q-foot { margin: 0; font-size: 0.82rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.open-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
/* Превью кодификатора (Э6 шаг 2) */
.cb-box { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); padding: 12px 16px; display: grid; gap: 8px; }
.cb-title { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--text); }
.cb-sum { margin: 0; font-size: 0.86rem; color: var(--text-secondary); }
.cb-sum b { color: var(--text); }
.cb-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.cb-asp-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; }
.cb-asp-head .n, .cb-codes .n { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-desc { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-hint); }
.cb-codes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.84rem; }
.cb-codes li { display: flex; justify-content: space-between; gap: 12px; padding-left: 12px; border-left: 2px solid var(--border); }
.cb-codes li.pos { border-left-color: var(--sig-up-fg); }
.cb-codes li.neg { border-left-color: var(--sig-dn-fg); }
.cb-box > .btn { justify-self: start; }
/* «Готово» (Э8, шаг 1): окно проверок перед сборкой */
.done-sum { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 4px; font-size: 0.9rem; }
.done-sum li::before { content: "✓"; color: var(--sig-up-fg); font-weight: 700; margin-right: 8px; }
.done-clean { margin: 8px 0 0; color: var(--sig-up-fg); font-weight: 600; }
.done-list { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.done-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 6px 10px; border-radius: 8px; background: var(--primary-veil); font-size: 0.86rem; }
.done-list li.warn { border-left: 3px solid var(--warn-text); }
.done-item { display: grid; gap: 2px; min-width: 0; }
.done-item b { color: var(--text); overflow-wrap: anywhere; }
.done-item span { color: var(--text-secondary); }
#rep-done { flex: 1 0 100%; }
.done-item .done-run { font-style: italic; }
/* Выводы «Готово» (Э8): блок окна, строка у карточки отчёта, строка над таблицей карточки */
.done-ins { display: grid; gap: 6px; margin-top: 10px; }
.done-ins > .btn { justify-self: start; }
.done-ins-lead { margin: 0; font-size: 0.9rem; color: var(--text); }
.done-ins-h { margin-top: 4px; font-size: 0.86rem; font-weight: 600; color: var(--text); }
.done-ins-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 0.86rem; color: var(--text); max-height: 260px; overflow: auto; }
.done-ins-ref { color: var(--text-secondary); white-space: nowrap; }
.rep-ins { margin: 4px 0 0 calc(1.4em + 8px); font-size: 0.82rem; color: var(--text); line-height: 1.35; overflow-wrap: anywhere; }
.rep-ins.stale, .q-ins.stale { color: var(--warn-text); }
.q-ins { margin: 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--primary-veil); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.9rem; color: var(--text); overflow-wrap: anywhere; }
.q-ins.stale { border-left-color: var(--warn-text); }
.open-tools input[type="search"] {
  flex: 1 1 18rem; max-width: 26rem; min-height: 34px; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 10px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.9rem;
}
.open-score { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 0.88rem; }
.open-score select {
  min-height: 34px; max-width: 22rem; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
  background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.88rem;
}
.q-foot-lab { color: var(--text); font-weight: 600; }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
/* значок «i» (P1.3): строки легенды листа Excel — по нажатию, под строкой цветов */
.legend-i {
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--bg-card);
  color: var(--text-secondary); font: italic 600 0.78rem/18px Georgia, serif; text-align: center; cursor: pointer;
}
.legend-i:hover, .legend-i[aria-expanded="true"] { color: var(--primary); border-color: var(--primary); }
.legend-more { display: grid; gap: 2px; }
.bar.cur .lab { color: var(--primary); font-weight: 600; }
.chart h3 select {
  max-width: min(100%, 13rem); min-height: 30px; margin-right: 4px; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 6px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 600;
}

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.chart { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.chart h3 { margin: 0; font-size: 0.95rem; color: var(--text); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.chart h3 span { color: var(--text-secondary); font-weight: 400; }
.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 0.85rem; }
.bar .lab { color: var(--text); line-height: 1.3; overflow-wrap: anywhere; }
.bar .track { height: 16px; background: var(--bar-track); border-radius: 4px; position: relative; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); border-radius: 4px; }
.bar.up .fill { background: var(--sig-up-fg); }
.bar.dn .fill { background: var(--sig-dn-fg); }
.bar.small .fill { opacity: 0.45; }
.bar.neg .fill { background: repeating-linear-gradient(135deg, var(--bar) 0 6px, transparent 6px 9px); }
.bar.neg.up .fill { background: repeating-linear-gradient(135deg, var(--sig-up-fg) 0 6px, transparent 6px 9px); }
.bar.neg.dn .fill { background: repeating-linear-gradient(135deg, var(--sig-dn-fg) 0 6px, transparent 6px 9px); }
.bar .val { text-align: right; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar.pick { cursor: pointer; border-radius: 4px; }
.bar.pick:hover .track, .bar.pick:focus-visible .track { outline: 2px solid var(--primary); outline-offset: 1px; }
.bar.pick:hover .lab { color: var(--primary); }
.dash-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  padding: 9px 14px; border-radius: 10px; background: var(--text); color: var(--bg-card); font-size: 0.88rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
@media print { .dash-toast { display: none !important; } }
.chart .empty { color: var(--text-secondary); font-size: 0.88rem; margin: 0; }

.dash-note { margin: 24px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-secondary); max-width: 70rem; }

@media (max-width: 900px) {
  .dash-body { grid-template-columns: minmax(0, 1fr); }
  .dash-side { display: none; }
  .q-select { display: block; }
}
@media (max-width: 520px) {
  .bar { grid-template-columns: minmax(0, 1fr) 50px; }
  .bar .lab { grid-column: 1 / -1; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  #tbl th:first-child, #tbl td:first-child { min-width: 140px; }
  .up-nav-actions { gap: 14px; }
  .dash-page .up-nav-inner { padding: 12px 16px; }
  .dash-page .logo-text { display: none; }
  .dash-page .up-nav-link { white-space: nowrap; font-size: 0.9rem; }
  .dash-tools { justify-content: flex-start; }
}

@media print {
  .up-nav, .dash-side, .q-select, #add-filter, #clear-filter, .chip-x, .flt-panel, .dash-break, .q-busy,
  .dash-calc, #brk-nest { display: none !important; }
  .q-ctl { border: 0; padding: 0; background: none; }
  .dash-body { display: block; }
  .dash-main { max-width: none; padding: 0; }
  .table-wrap { overflow: visible; border: 0; }
  #tbl th:first-child, #tbl td:first-child { position: static; }
  .chart { break-inside: avoid; }
  #tbl td.up, #tbl td.dn, .bar .fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
