/* Дашборд магазина. Цвета серий — категориальная палитра (порядок фиксирован), отдельно
   для светлой и тёмной темы; текст — токенами текста, не цветом серии. */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --grid-line: #e1e0d9; --axis-line: #c3c2b7; }
@media (prefers-color-scheme: dark) {
  :root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid-line: #2c2c2a; --axis-line: #383835; }
}

.db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.db-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; min-width: 0; }
.db-kpi h3 { margin: 0; font-size: 14px; font-weight: 500; }
.db-kpi .value { font-size: 26px; font-weight: 700; grid-column: 1; }
.db-kpi .sub { grid-column: 1; color: var(--muted); font-size: 12px; }
.db-kpi .delta { grid-column: 2; grid-row: 2 / 4; align-self: end; font-size: 13px; font-weight: 600; text-align: right; }
.db-kpi .delta.up { color: var(--good); }
.db-kpi .delta.down { color: var(--bad); }
.db-kpi .spark { grid-column: 2; grid-row: 1; width: 90px; height: 32px; }
.db-kpi .spark path { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.db-kpi.empty .value { color: var(--muted); font-size: 16px; font-weight: 500; }

.db-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .db-row { grid-template-columns: 1fr; } }
.db-chart { position: relative; width: 100%; height: 260px; }
.db-chart.small { height: 220px; }
.db-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.db-chart .grid-line { stroke: var(--grid-line); stroke-width: 1; }
.db-chart .axis-line { stroke: var(--axis-line); stroke-width: 1; }
.db-chart .tick { fill: var(--muted); font-size: 11px; }
.db-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.db-chart .area { stroke: none; opacity: .12; }
.db-chart .s1 { stroke: var(--series-1); fill: var(--series-1); }
.db-chart .s2 { stroke: var(--series-2); fill: var(--series-2); }
.db-chart .s3 { stroke: var(--series-3); fill: var(--series-3); }
.db-chart .line.s1, .db-chart .line.s2, .db-chart .line.s3 { fill: none; }
.db-chart .bar { fill: var(--series-1); }
.db-chart .bar:hover, .db-chart .bar.on { fill: var(--accent); }
.db-chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.db-chart .dot { stroke: var(--surface); stroke-width: 2; }
.db-chart .hit { fill: transparent; }
.db-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.db-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.db-legend .s1::before { background: var(--series-1); }
.db-legend .s2::before { background: var(--series-2); }
.db-legend .s3::before { background: var(--series-3); }
.db-note { font-size: 12px; margin: 6px 0 0; }

.db-tip { position: fixed; z-index: 70; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 8px 10px;
  font-size: 12px; min-width: 150px; }
.db-tip b { display: block; margin-bottom: 4px; }
.db-tip div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }

/* Доли прибыли: плитки по площади = прибыль, с фото товара. */
.db-tree { position: relative; height: 340px; }
.db-tile { position: absolute; box-sizing: border-box; border: 2px solid var(--surface); border-radius: 10px;
  overflow: hidden; background: var(--surface-2); display: flex; align-items: flex-end; }
.db-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.db-tile .cap { position: relative; width: 100%; padding: 6px 8px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; line-height: 1.3; }
.db-tile .cap b { display: block; font-size: 13px; }
.db-tile.other { background: var(--accent-soft); }
.db-tile.other .cap { background: none; color: var(--text); }
.db-empty { padding: 40px; text-align: center; color: var(--muted); }

.db-section-head { margin-top: 28px; }
.db-section-head h2 { margin: 0; font-size: 20px; }
