/* Раздел «Статистика» (public/panel/stats.js). Токены — из panel.css; свои классы с префиксом st-. */

.st-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 8px;
}
.st-presets .segmented-btn { min-height: 44px; }
.st-custom { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 12px; }
.st-custom[hidden] { display: none; }
.st-date-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.st-date { min-height: 44px; min-width: 0; }
.st-apply { min-height: 44px; }
.st-form-error { margin: 0 0 8px; font-size: 13.5px; color: var(--danger-ink); }
.st-form-error[hidden] { display: none; }
.st-period { margin: 0 0 16px; font-size: 13.5px; color: var(--ink-2); min-height: 1.4em; }

/* Карточки-показатели */
.st-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.st-kpi {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 16px 18px;
  min-width: 0;
}
.st-kpi-label { font-size: 13px; color: var(--ink-2); }
.st-kpi-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.st-kpi-rate { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.st-kpi-hint { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }

/* Блоки */
.st-section { margin-bottom: 16px; min-width: 0; }
.st-section-head { margin-bottom: 14px; }
.st-section-head h2 { margin: 0; font-size: 16px; }
.st-section-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.st-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.st-cols .st-section { margin-bottom: 0; }
.st-empty { margin: 0; padding: 8px 0; font-size: 14px; color: var(--ink-2); }

/* График по дням */
.st-chart { min-width: 0; }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 13px; color: var(--ink-2); }
.st-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.st-swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--accent); }
.st-swatch-leads { border-top: 3px dashed var(--ok); }
.st-line-plot { position: relative; padding-top: 4px; }
.st-line-max { position: absolute; left: 0; top: -2px; font-size: 11.5px; color: var(--ink-3); background: var(--surface); padding-right: 4px; z-index: 1; }
.st-line { display: block; width: 100%; height: 180px; overflow: visible; }
.st-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.st-line-dialogs, .st-line-leads { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.st-line-dialogs { stroke: var(--accent); }
.st-line-leads { stroke: var(--ok); stroke-dasharray: 6 4; }
.st-line-x { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--ink-3); }

/* Полосы */
.st-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.st-bar-row { min-width: 0; }
.st-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.st-bar-name { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.st-bar-count { flex: none; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.st-bar { display: block; width: 100%; height: 8px; margin-top: 5px; }
.st-bar-track { fill: var(--surface-2); }
.st-bar-fill { fill: var(--accent); }
.st-bar-warn { fill: var(--warn); }
.st-bar-note { margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }

@media (min-width: 900px) {
  .st-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .st-kpi { padding: 18px 20px; }
  .st-kpi-value { font-size: 30px; }
  .st-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-line { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .st-bar-fill { transition: none; }
}

/* П168: широкий экран — графики сеткой: 2 колонки от 1600px, 3 — от 1920px. Динамика занимает две колонки. */
@media (min-width: 1600px) {
  .st-report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .st-report > .st-kpis { grid-column: 1 / -1; margin-bottom: 0; }
  .st-report > .st-trend { grid-column: 1 / -1; margin-bottom: 0; }
  .st-report > .st-cols { display: contents; }
  .st-line { height: 260px; }
}
@media (min-width: 1920px) {
  .st-report { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-report > .st-trend { grid-column: span 2; }
}
