/* ── Аналитические страницы: фильтры, карточки графиков, дерево ─────────── */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; }
.filters__item { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.filters__item select { min-width: 260px; }
.filters__label { font-size: 12px; color: var(--text-muted); }
.filters__presets { display: flex; gap: 4px; }
.filters__note { margin-left: auto; font-size: 12px; color: var(--text-muted); align-self: center; }
.filters--inline { background: none; border: 0; padding: 0; margin-bottom: 12px; }

.section { margin-bottom: 28px; }
.section__title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.section__hint { font-size: 13px; color: var(--text-muted); margin: -6px 0 12px; }
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.chart-box { position: relative; height: 340px; }
.chart-box--sm { height: 280px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.empty { color: var(--text-muted); padding: 24px; text-align: center; }
.loading { color: var(--text-muted); padding: 24px; text-align: center; }
.error-box { color: var(--red); background: var(--red-light); padding: 12px 16px; border-radius: var(--radius); }

.tbl-row--total td { font-weight: 600; background: var(--bg-stripe); border-top: 2px solid var(--border); }
.tree-scroll { max-height: 640px; overflow: auto; }
.tree__node { cursor: pointer; font-weight: 600; }
.tree__node--0 { background: var(--brand-subtle); }
.tree__caret { display: inline-block; width: 14px; color: var(--text-muted); }
.tree__count { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.tree__actions { display: flex; gap: 8px; padding: 8px 12px; }

.ms { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.ms__toggle { text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms__panel { position: absolute; top: 100%; left: 0; z-index: 20; width: max(100%, 320px); margin-top: 4px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 8px; }
.ms__actions { display: flex; gap: 4px; margin: 6px 0; }
.ms__list { max-height: 260px; overflow: auto; }
.ms__opt { display: flex; gap: 6px; align-items: flex-start; padding: 4px 2px; font-size: 13px; cursor: pointer; }
.ms__empty { color: var(--text-muted); font-size: 13px; padding: 6px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.kpi__label { font-size: 12px; color: var(--text-muted); }
.kpi__value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__item i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.crm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 16px; align-items: start; }
.crm-grid .filters__item select, .crm-grid .ms { min-width: 0; }
.crm-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.crm-row .field__input { width: 100%; }
.crm-check { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
textarea.field__input { resize: vertical; font-family: inherit; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 0 24px; }
.cell-up { background: rgba(46, 204, 113, .22); padding: 2px 6px; border-radius: 4px; }
.cell-down { background: rgba(231, 76, 60, .2); padding: 2px 6px; border-radius: 4px; }
.pipeline-alert { margin: 16px 24px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--orange-light);
  border: 1px solid var(--orange); color: var(--text-primary); font-size: 13px; }
.pipeline-alert ul { margin: 6px 0 0 18px; padding: 0; }
