:root {
  /* Палитра — sage / forest green на тёплом off-white */
  --bg: hsl(110 14% 96%);
  --surface: hsl(0 0% 100%);
  --surface-2: hsl(110 12% 98%);
  --surface-hover: hsl(150 18% 95%);
  --border: hsl(120 8% 89%);
  --border-strong: hsl(120 8% 80%);

  --text: hsl(150 18% 14%);
  --text-muted: hsl(150 8% 42%);
  --text-faint: hsl(150 6% 60%);

  --accent: hsl(150 44% 30%);          /* forest */
  --accent-hover: hsl(150 50% 24%);
  --accent-soft: hsl(150 40% 92%);
  --mint: hsl(150 38% 62%);            /* highlight */
  --mint-soft: hsl(150 38% 90%);

  --positive: hsl(150 50% 36%);
  --positive-soft: hsl(150 50% 92%);
  --negative: hsl(8 55% 50%);          /* приглушённый, не неон */
  --negative-soft: hsl(8 60% 95%);
  --warning: hsl(38 70% 48%);
  --warning-soft: hsl(38 70% 94%);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px hsl(150 18% 14% / 0.04), 0 0 0 1px hsl(120 8% 89% / 0.7);
  --shadow: 0 1px 3px hsl(150 18% 14% / 0.06), 0 0 0 1px hsl(120 8% 89%);
  --shadow-lg: 0 4px 16px hsl(150 18% 14% / 0.08), 0 0 0 1px hsl(120 8% 89%);

  --font-sans: 'JetBrains Mono', ui-monospace, monospace;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; max-width: 100vw; }
.app { max-width: 100vw; }
.app, .main, .toolbar, .kpi-row, .card, .day-split, .art-grid, .art-stack, .article-shell { min-width: 0; max-width: 100%; }
.article-shell > *, .day-split > *, .art-grid > *, .art-stack > * { min-width: 0; }
.card { overflow-x: hidden; overflow-y: visible; }
.tbl-wrap { width: 100%; max-width: 100%; }
table.tbl { table-layout: auto; width: 100%; max-width: 100%; }
.card .tbl { width: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11','ss01','tnum';
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }

/* === Layout === */
.app { min-height: 100vh; }

/* Top nav */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 32px; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em;
  padding-right: 16px; border-right: 1px solid var(--border);
  height: 100%;
  cursor: pointer; user-select: none;
}
.brand:hover { color: var(--accent); }
.brand:hover .brand-mark { filter: brightness(1.1); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--mint));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 12px;
}
.topnav { display: flex; gap: 2px; height: 100%; align-items: center; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600;
  transition: 0.15s; font-size: 14px;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 15px; height: 15px; flex: 0 0 15px; }
.nav-item.disabled {
  color: var(--text-faint); opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.tbl td, .tbl th { white-space: nowrap; }
.kpi-value { white-space: nowrap; }
.kpi-delta { white-space: nowrap; }
.cell-bar { white-space: nowrap; display: inline-block; }
.nav-item.disabled .soon {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-faint); margin-left: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.shop-switcher {
  display: flex; align-items: center; gap: 8px;
}
.shop-switcher label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.shop-switcher select {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); padding: 5px 8px;
  font-weight: 500; font-size: 13px;
}

/* === Main === */
.main { padding: 24px 24px 64px; max-width: 100%; }
@media (max-width: 1280px) {
  .main { padding: 18px 14px 48px; }
}
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.crumbs a { color: var(--accent); cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--text-faint); }

.h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--text-muted); }
.right-tools { display: flex; gap: 8px; align-items: center; }
.btn {
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: 0.15s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* === KPI cards === */
.kpi-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 22px;
}
.kpi-row.kpi-row-6 { grid-template-columns: repeat(6, 1fr); gap: 10px; }
.kpi-row.kpi-row-8 { grid-template-columns: repeat(8, 1fr); gap: 8px; }
/* В rows с 6+ плитками — ужимаем САМИ КАРТОЧКИ (padding) и только нижнюю строку (delta).
   Шрифты values/labels не трогаем — должны выглядеть как на 5-плиточных. */
.kpi-row.kpi-row-6 .kpi, .kpi-row.kpi-row-8 .kpi { padding: 10px 12px; min-width: 0; }
.kpi-row.kpi-row-6 .kpi-delta, .kpi-row.kpi-row-8 .kpi-delta {
  font-size: 11px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.kpi-label { font-size: 12.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.kpi-photo {
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  min-height: 110px;
  max-height: 140px;
}
.kpi.kpi-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.kpi.kpi-photo .kpi-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
}
/* Все плитки в kpi-row-6 одинаковой высоты ради ровного row */
.kpi-row.kpi-row-6 .kpi { min-height: 110px; }
.kpi-delta { font-size: 13px; margin-top: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.4; }
.kpi-sub b { color: var(--text); font-weight: 600; }
.kpi-share { margin-top: 6px; }
.kpi-share-bar {
  height: 5px; background: var(--surface-2);
  border-radius: 3px; overflow: hidden;
  border: 1px solid var(--border);
}
.kpi-share-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--mint));
  border-radius: 3px;
  transition: width 0.3s;
}
.kpi-share-meta { font-size: 12px; margin-top: 4px; color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-share-meta b { color: var(--accent); font-weight: 700; }
.kpi-delta.up { color: var(--positive); }
.kpi-delta.down { color: var(--negative); }
.kpi-delta.neutral { color: var(--text-muted); }

/* === Card === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-h {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 15px;
}
.card-h .actions { display: flex; gap: 8px; }
.card-b { padding: 14px 18px; }

/* === Table === */
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14.5px; font-weight: 500; }
table.tbl th { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
table.tbl tbody tr { transition: 0.1s; cursor: pointer; }
table.tbl tbody tr:hover { background: var(--surface-hover); }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.row-total td { background: var(--accent-soft); font-weight: 700; }

.pos { color: var(--positive); }
.neg { color: var(--negative); }
.warn { color: var(--warning); }

.cell-bar {
  position: relative;
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  font-weight: 500;
}
.cell-bar.up { background: var(--positive-soft); color: var(--positive); }
.cell-bar.down { background: var(--negative-soft); color: var(--negative); }
.cell-bar.warn { background: var(--warning-soft); color: var(--warning); }

/* heat: интенсивность зелёного по % */
[data-heat] { font-weight: 500; }
[data-heat="low"] { background: var(--negative-soft); color: var(--negative); padding: 2px 6px; border-radius: 4px; }
[data-heat="mid"] { background: var(--warning-soft); color: var(--warning); padding: 2px 6px; border-radius: 4px; }
[data-heat="high"] { background: var(--positive-soft); color: var(--positive); padding: 2px 6px; border-radius: 4px; }

/* === Day view: split === */
.day-split { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.art-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; max-height: calc(100vh - 200px); overflow-y: auto; }
.day-side-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 10px 14px; cursor: pointer; transition: 0.1s;
  border-bottom: 1px solid var(--border); position: relative;
}
.day-side-row:hover { background: var(--surface-hover); }
.day-side-row.selected { background: var(--accent-soft); }
.day-side-row.selected::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.day-side-row.week-break { border-top: 2px solid var(--accent); padding-top: 14px; }
.day-side-row.week-break::before {
  content: 'нов. неделя';
  position: absolute; top: -1px; left: 14px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--surface); padding: 0 4px; transform: translateY(-50%);
}
.day-side-date { font-weight: 700; font-size: 14px; }
.day-side-dow  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.day-side-pp   { font-weight: 700; font-family: var(--font-mono); font-size: 13px; text-align: right; align-self: center; }
.day-side-pp.pos { color: var(--positive); }
.day-side-pp.neg { color: var(--negative); }
.art-list-h {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  position: sticky; top: 0;
}
.art-list-h input { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; flex: 1; background: var(--surface); }
.art-card {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: 0.1s;
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px;
  align-items: center;
}
.art-card:hover { background: var(--surface-hover); }
.art-card.selected { background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 11px; }
.art-card-name { font-weight: 700; font-size: 14.5px; }
.art-card-meta { font-size: 13px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.art-card-profit { font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 14.5px; }
.art-card-profit.pos { color: var(--positive); }
.art-card-profit.neg { color: var(--negative); }

/* === Article card === */
/* Карточка артикула: слева 22-дн+заметки (большая), справа остатки/реклама/цена/акции (фикс узкая) */
.art-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 16px;
  align-items: start;
}
.art-grid-full { grid-column: 1/-1; }

@media (max-width: 1200px) {
  .art-grid { grid-template-columns: 1fr; }
}

/* Overview-таблица — нормальный шрифт, чуть меньше горизонтальный padding для 15 колонок */
table.tbl-overview td, table.tbl-overview th { padding: 10px 8px; white-space: nowrap; }
table.tbl-overview th { padding: 11px 8px; }
/* Таблица «Артикулы дня» — компактнее по горизонтали, чтобы все 12 колонок влезли без скролла */
.day-split table.tbl th, .day-split table.tbl td { padding: 9px 8px; font-size: 13.5px; white-space: nowrap; }

/* 22-дн таблица — узкие пробелы между столбцами, заголовки центрированы */
table.tbl-history { width: 100%; }
table.tbl-history th, table.tbl-history td { padding: 8px 6px; }
table.tbl-history th { padding: 9px 6px; text-align: center; }
table.tbl-history th.num { text-align: center; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; color: var(--text-muted); margin: 0 0 10px;
}

.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.size-tile {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.size-tile-name { font-weight: 600; font-size: 11.5px; color: var(--text-muted); }
.size-tile-stock { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.size-tile-days { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.size-tile.low .size-tile-stock { color: var(--negative); }
.size-tile.warn .size-tile-stock { color: var(--warning); }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.action-row .promo-name { font-weight: 600; font-size: 12.5px; }
.action-row .promo-period { font-size: 11px; color: var(--text-muted); }
.action-row .promo-price { font-family: var(--font-mono); font-weight: 700; }
.action-row .badge {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge.in { background: var(--positive-soft); color: var(--positive); }
.badge.out { background: var(--warning-soft); color: var(--warning); }

.price-edit { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 12px 14px; border: 1px dashed var(--mint); border-radius: var(--radius-sm); background: var(--mint-soft); }
.price-edit input { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--surface); font-family: var(--font-mono); font-weight: 600; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-sm); width: fit-content; margin-bottom: 10px; }
.tabs .tab { padding: 5px 12px; border-radius: 5px; font-size: 12px; color: var(--text-muted); font-weight: 500; }
.tabs .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* mini sparkline placeholder */
.spark { height: 36px; width: 100%; background: linear-gradient(180deg, var(--mint-soft), transparent); border-radius: 4px; display: flex; align-items: end; gap: 2px; padding: 4px; }
.spark .bar { flex: 1; background: var(--mint); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark .bar.hi { background: var(--accent); }

.hidden { display: none !important; }

/* === Компактная таблица (для узких блоков типа Остатки по размерам) === */
table.tbl.tbl-compact th, table.tbl.tbl-compact td { padding: 7px 10px; font-size: 14px; font-weight: 600; line-height: 1.25; }
table.tbl.tbl-compact th { font-size: 11.5px; padding: 8px 10px; font-weight: 700; }
table.tbl.tbl-compact td.num, table.tbl.tbl-compact th.num { font-size: 14px; font-weight: 700; }
/* колонки-акцент СО ВБ / СО+ФФ — только граница, без фона (чтобы не маскировать heat внутри) */
table.tbl.tbl-compact td.emph, table.tbl.tbl-compact th.emph { background: transparent; border-left: 2px solid var(--mint); }
table.tbl.tbl-compact th.emph { color: var(--positive); }
/* day-over-day delta — мелкая подпись % изм. под значением */
.dod { display: block; font-size: 10.5px; font-weight: 700; margin-top: 2px; letter-spacing: 0.02em; }
.dod.up   { color: var(--positive); }
.dod.down { color: var(--negative); }
.dod.flat { color: var(--text-faint); }

/* «22 дня · подневно» — скролл внутри блока, чтобы не двигать всю страницу */
.tbl-history-scroll { max-height: 540px; overflow-y: auto; }
.tbl-history-scroll table.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2, #f5f5f7);
  box-shadow: 0 1px 0 var(--border);
}

/* Дни запаса в карточке артикула — контрастные heat-цвета */
table.tbl.tbl-compact .days { font-size: 13px; padding: 3px 10px; font-weight: 700; border-radius: 4px; display: inline-block; }
table.tbl.tbl-compact .days.low  { background: hsl(8 70% 88%);   color: hsl(8 70% 32%); }
table.tbl.tbl-compact .days.warn { background: hsl(38 80% 84%);  color: hsl(38 80% 28%); }
table.tbl.tbl-compact .days.ok   { background: hsl(150 50% 82%); color: hsl(150 55% 25%); }

/* === Разделитель недель в сводке === */
table.tbl tr.week-start td {
  border-top: 2px solid var(--accent);
  padding-top: 14px;
}
table.tbl tr.week-start td:first-child::after {
  content: 'нов. неделя';
  display: block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  margin-top: 2px;
}

/* === «Рыночные» колонки — визуально отделены === */
table.tbl th.market-col, table.tbl td.market-col {
  border-left: 2px solid var(--mint);
  padding-left: 16px;
}
table.tbl th.market-col { color: var(--accent); }

/* === Emphasis-колонки в таблицах === */
table.tbl th.emph, table.tbl td.emph {
  background: var(--mint-soft);
  border-left: 1.5px solid var(--mint);
  border-right: 1.5px solid var(--mint);
  position: relative;
}
table.tbl tbody tr:hover td.emph { background: hsl(150 38% 86%); }
table.tbl thead th.emph { background: var(--mint-soft); color: var(--accent); font-weight: 700; }

/* === Article view shell (карточка с боковым списком) === */
.article-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 1200px) {
  .article-shell { grid-template-columns: 1fr; }
  .article-side { position: relative; max-height: 320px; }
}
/* На больших экранах sidebar шире — удобнее искать */
@media (min-width: 1600px) {
  .article-shell { grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
}
.article-side {
  position: sticky; top: 70px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-height: calc(100vh - 90px); overflow-y: auto;
}
.article-side-h {
  padding: 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
.article-side-h input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; background: var(--surface); font-weight: 500; font-size: 14px;
}
.article-side-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border);
}
.article-side-meta select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 12px; background: var(--surface); font-weight: 500;
}
.side-art {
  padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: 0.1s; position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px;
}
.side-art:hover { background: var(--surface-hover); }
.side-art.selected { background: var(--accent-soft); }
.side-art.selected::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.side-art-name { font-weight: 700; font-size: 13px; line-height: 1.3; }
.side-art-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.side-art-pp { font-weight: 700; font-family: var(--font-mono); font-size: 13px; text-align: right; }
.side-art-pp.pos { color: var(--positive); }
.side-art-pp.neg { color: var(--negative); }
.side-art[data-cluster] { padding-left: 18px; }
.side-art[data-cluster]::before {
  content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 3px;
  background: var(--cluster-color); border-radius: 2px;
}
.side-art.cluster-gap-after { border-bottom: 6px solid var(--bg); }

/* === Clusters (склейки карточек WB) === */
/* приглушённые HSL акценты для маркеров склеек */
[data-cluster="1"] { --cluster-color: hsl(150 38% 50%); --cluster-soft: hsl(150 38% 94%); }
[data-cluster="2"] { --cluster-color: hsl(200 36% 55%); --cluster-soft: hsl(200 36% 94%); }
[data-cluster="3"] { --cluster-color: hsl(30  44% 58%); --cluster-soft: hsl(30  50% 95%); }
[data-cluster="4"] { --cluster-color: hsl(280 25% 60%); --cluster-soft: hsl(280 30% 96%); }
[data-cluster="5"] { --cluster-color: hsl(355 38% 62%); --cluster-soft: hsl(355 50% 96%); }
[data-cluster="6"] { --cluster-color: hsl(180 30% 48%); --cluster-soft: hsl(180 30% 95%); }

/* строка таблицы внутри склейки */
table.tbl tr[data-cluster] td:first-child {
  position: relative;
  padding-left: 22px;
}
table.tbl tr[data-cluster] td:first-child::before {
  content: ''; position: absolute;
  left: 6px; top: 0; bottom: 0; width: 3px;
  background: var(--cluster-color);
}
table.tbl tr[data-cluster].cluster-first td:first-child::before { top: 6px; border-radius: 2px 2px 0 0; }
table.tbl tr[data-cluster].cluster-last  td:first-child::before { bottom: 6px; border-radius: 0 0 2px 2px; }
table.tbl tr[data-cluster].cluster-solo  td:first-child::before { top: 6px; bottom: 6px; border-radius: 2px; }
/* пустой разделитель между склейками */
table.tbl tr.cluster-gap td { padding: 0; height: 8px; background: var(--bg); border: 0; }
/* счётчик размера склейки в тултипе */
table.tbl tr[data-cluster] td:first-child .cluster-badge {
  display: inline-block; font-size: 10.5px; padding: 1px 5px; border-radius: 3px;
  background: var(--cluster-soft); color: var(--cluster-color);
  font-weight: 700; margin-left: 6px; vertical-align: middle; letter-spacing: 0.02em;
}

/* для левой панели артикулов */
.art-card[data-cluster] { position: relative; padding-left: 18px; }
.art-card[data-cluster]::before {
  content: ''; position: absolute;
  left: 6px; top: 8px; bottom: 8px; width: 3px;
  background: var(--cluster-color);
  border-radius: 2px;
}
.art-card.cluster-first { padding-top: 14px; }
.art-card.cluster-last  { padding-bottom: 14px; border-bottom-width: 0; }
.art-card.cluster-gap-after { border-bottom: 8px solid var(--bg); }

/* === Notes & history === */
.note-input {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  margin-bottom: 14px;
}
.note-input select, .note-input input {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; background: var(--surface); font-weight: 500; font-size: 14px;
}
.note-input input { font-weight: 500; }
.note-input button { padding: 6px 12px; font-size: 12.5px; }
.notes-list { display: flex; flex-direction: column; }
.note-row {
  display: grid; grid-template-columns: 80px 1fr 24px; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  align-items: start;
}
.note-del {
  background: transparent; color: var(--text-faint);
  border: 1px solid transparent; border-radius: 4px;
  width: 22px; height: 22px; line-height: 1;
  font-size: 16px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.note-del:hover { color: var(--negative); border-color: var(--negative); background: var(--negative-soft); }

/* === Прозрачная разбивка цены === */
.price-breakdown {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2, #f7f7f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.price-breakdown .pb-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13.5px;
}
.price-breakdown .pb-label { color: var(--text-muted); }
.price-breakdown .pb-value { font-weight: 700; text-align: right; }
.price-breakdown .pb-extra { color: var(--text-muted); font-size: 12.5px; }
.price-breakdown .pb-emph {
  background: hsl(150 50% 95%);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px -4px;
}
.price-breakdown .pb-emph .pb-label,
.price-breakdown .pb-emph .pb-value { color: var(--positive); font-weight: 800; font-size: 14.5px; }
.price-breakdown .pb-emph .pb-extra { color: var(--positive); font-weight: 700; font-size: 13.5px; }
.price-breakdown .pb-meta {
  border-top: 1px dashed var(--border);
  margin-top: 6px;
  padding-top: 8px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.price-breakdown .pb-preview-h {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

/* === Drop zone for xlsx files === */
.drop-zone {
  display: block; position: relative; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 12px;
  background: var(--surface);
  padding: 28px 20px; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover { border-color: var(--accent); background: var(--surface-2, #f5f5f7); }
.drop-zone.drag-over {
  border-color: var(--accent); background: hsl(150 50% 95%);
}
.drop-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-muted); }
.drop-zone svg { color: var(--text-faint); }
.drop-zone.drag-over svg { color: var(--accent); }
.drop-zone-title { font-size: 15px; font-weight: 700; color: var(--text); }
.drop-zone-hint { font-size: 12.5px; color: var(--text-muted); }
.drop-zone-hint .link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.drop-zone-files {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  font-family: var(--font-mono); font-size: 11.5px;
}
.drop-zone-file {
  background: var(--mint-soft); color: var(--positive);
  padding: 4px 10px; border-radius: 4px; font-weight: 600;
  max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Восклицательный знак артикула с актуальным предложением */
.badge-suggest {
  display: inline-block; width: 16px; height: 16px; line-height: 16px;
  background: hsl(38 90% 55%); color: white;
  border-radius: 4px; font-size: 11px; font-weight: 800;
  text-align: center; vertical-align: middle; margin-right: 4px;
}
.note-row:last-child { border-bottom: 0; }
.note-when { font-size: 12.5px; color: var(--text-muted); font-weight: 600; font-family: var(--font-mono); }
.note-when small { color: var(--text-faint); display: block; font-weight: 500; margin-top: 2px; }
.note-body { font-size: 14px; line-height: 1.5; }
.note-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11.5px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin-right: 8px;
}
.note-tag.strategy { background: var(--accent-soft); color: var(--accent); }
.note-tag.action   { background: var(--mint-soft); color: var(--accent); }
.note-tag.price    { background: var(--warning-soft); color: var(--warning); }
.note-tag.reminder { background: hsl(220 30% 92%); color: hsl(220 50% 35%); }
.note-author { color: var(--text-muted); font-size: 12.5px; margin-left: 6px; }

/* === Stocks card (по складам) === */
.stock-block { display: flex; flex-direction: column; }
.stock-block-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  font-weight: 700; color: var(--text-muted);
}
.stock-block-h .total { font-family: var(--font-mono); font-size: 14px; color: var(--text); font-weight: 700; text-transform: none; letter-spacing: 0; }
.stock-row {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 14px; align-items: center;
  padding: 9px 14px; font-size: 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.stock-row:last-child { border-bottom: 0; }
.stock-row-name { font-weight: 500; }
.stock-row-name small { color: var(--text-faint); font-weight: 400; margin-left: 6px; }
.stock-row .num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.stock-row .days { font-size: 11.5px; padding: 1px 6px; border-radius: 4px; }
.stock-row .days.low  { background: var(--negative-soft); color: var(--negative); }
.stock-row .days.warn { background: var(--warning-soft); color: var(--warning); }
.stock-row .days.ok   { background: var(--positive-soft); color: var(--positive); }

/* responsive */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .day-split { grid-template-columns: 1fr; }
  .art-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px; gap: 12px; }
  .topnav { order: 3; flex-basis: 100%; overflow-x: auto; }
}

/* === Login page === */
.login-box {
  max-width: 380px; margin: 15vh auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 32px;
}
.login-box h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
.login-box .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-box label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em;
}
.login-box input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; margin-bottom: 14px;
}
.login-box button {
  width: 100%; padding: 11px; background: var(--accent); color: white;
  border: 0; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.login-box button:hover { background: var(--accent-hover); }
.login-box .err {
  color: var(--negative); font-size: 13px; margin-top: 10px; min-height: 20px;
}
.login-box .login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-box .brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--mint));
  display: grid; place-items: center; color: white; font-weight: 700;
}

/* ====== Inventory (товарный учёт) ====== */

/* Табы внутри раздела */
.inv-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px; width: fit-content;
}
.inv-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 13.5px;
  text-decoration: none; transition: 0.15s;
}
.inv-tab:hover { background: var(--surface-hover); color: var(--text); }
.inv-tab.active { background: var(--accent-soft); color: var(--accent); }

/* Сводка по остаткам */
.inv-tbl tr.inv-row-toggle { cursor: pointer; user-select: none; }
.inv-tbl tr.inv-row-toggle:hover td { background: var(--surface-hover); }
.inv-tbl .chev {
  display: inline-block; transition: 0.15s;
  color: var(--text-faint); margin-right: 8px; font-size: 11px;
}
.inv-tbl tr.inv-row-toggle.expanded .chev { transform: rotate(90deg); }
.inv-tbl tr.inv-size-row td {
  background: var(--surface-2); font-size: 12.5px; color: var(--text-muted);
}
.inv-tbl tr.inv-size-row td:first-child { padding-left: 38px; }
.inv-tbl td.profit { background: var(--mint-soft); font-weight: 600; }

.art-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.art-photo {
  width: 36px; height: 36px; border-radius: 6px;
  background: linear-gradient(135deg, #dde, #bbc); object-fit: cover; flex: 0 0 36px;
}
.art-name { font-weight: 600; font-size: 13px; }
.art-vc {
  font-size: 14px; font-weight: 600; color: var(--text);
  font-family: var(--font-mono);
}

/* Компактные строки в таблицах inventory */
.inv-tbl th, .inv-tbl td { padding: 5px 10px; }
.inv-tbl tr.inv-size-row td { padding: 4px 10px; }
.inv-fo-tbl th, .inv-fo-tbl td { padding: 5px 10px; }

/* Прокручиваемое окно вокруг таблицы — шапка sticky внутри него */
.inv-scroll {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  overflow-x: hidden;
}
.inv-scroll .inv-tbl thead th,
.inv-scroll .inv-fo-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border);
}

/* СО conditional */
.so-bad { color: var(--negative); font-weight: 700; }
.so-warn { color: var(--warning); font-weight: 600; }
.so-ok { color: var(--text); }
.so-good { color: var(--positive); font-weight: 600; }
.so-empty { color: var(--text-faint); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-ok { background: var(--positive-soft); color: var(--positive); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-bad { background: var(--negative-soft); color: var(--negative); }
.badge-mute { background: var(--surface-2); color: var(--text-faint); }

/* По складам — pill'ы ФО */
.fo-pills {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.fo-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px;
}
.fo-pill .pill-name { font-weight: 700; font-size: 13px; }
.fo-pill .pill-stat { color: var(--text-muted); }
.fo-pill.bad { border-color: var(--negative); background: var(--negative-soft); }
.fo-pill.warn { border-color: var(--warning); background: var(--warning-soft); }
.fo-pill.ok { border-color: var(--positive); background: var(--positive-soft); }

/* Таблица артикул × ФО */
.inv-fo-tbl td.inv-cell-has {
  background: var(--positive-soft); color: var(--positive); font-weight: 600;
}
.inv-fo-tbl td.inv-cell-empty { color: var(--text-faint); }

/* Recommendations placeholder */
.rec-placeholder {
  text-align: center; padding: 64px 24px; color: var(--text-muted);
}
.rec-placeholder h2 { margin: 0 0 12px; font-size: 20px; color: var(--text); }
.rec-placeholder p { max-width: 520px; margin: 0 auto 8px; line-height: 1.6; }
.rec-placeholder .icon { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }

.tag {
  display: inline-block; padding: 1px 6px; background: var(--surface-2);
  border-radius: 4px; font-size: 10.5px; color: var(--text-muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Кнопка удаления акции в строке таблицы /promotions */
.promo-del-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 600;
  display: inline-grid; place-items: center;
  border: 1px solid transparent;
  transition: 0.12s;
}
.promo-del-btn:hover {
  background: var(--negative-soft);
  color: var(--negative);
  border-color: var(--negative);
}

/* Маленькая подпись СО в ячейке таблицы /inventory/warehouses */
.inv-fo-tbl td .cell-so {
  font-size: 10.5px;
  margin-top: 1px;
  font-weight: 500;
  opacity: 0.85;
}
.inv-fo-tbl td .cell-so .so-bad,
.inv-fo-tbl td .cell-so .so-warn,
.inv-fo-tbl td .cell-so .so-ok,
.inv-fo-tbl td .cell-so .so-good { font-size: 10.5px; }

/* ============================== Анализ конкурентов ============================== */

.cmp-hero {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 18px;
  padding: 16px;
  margin-bottom: 16px;
  align-items: center;
}
.cmp-config-btn {
  display: inline-flex; gap: 6px; align-items: center;
  white-space: nowrap;
}
.cmp-config-btn svg { flex-shrink: 0; }

/* ===== Модалка «Конкуренты по товару» ===== */
.cmp-modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: hsl(0 0% 10% / 0.5);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}
.cmp-modal-backdrop.open { display: flex; }
.cmp-modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px hsl(0 0% 0% / 0.25);
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cmp-modal-h {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.cmp-modal-x {
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text-faint);
  padding: 0 4px;
}
.cmp-modal-x:hover { color: var(--text); }

.cmp-modal-list {
  overflow-y: auto;
  padding: 8px 12px;
  flex: 1 1 auto;
  min-height: 60px;
}
.cmp-modal-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
}
.cmp-modal-item:hover { background: var(--surface-hover); }
.cmp-modal-item img {
  width: 44px; height: 58px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border);
}
.cmp-modal-item-thumb-placeholder {
  width: 44px; height: 58px; border-radius: 4px;
  background: var(--surface-2); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 18px;
}
.cmp-modal-item-body { min-width: 0; }
.cmp-modal-item-body a { color: var(--accent); font-weight: 500; }
.cmp-modal-rm {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  width: 26px; height: 26px; line-height: 1;
  font-size: 17px; color: var(--text-faint); cursor: pointer;
}
.cmp-modal-rm:hover { color: var(--negative); border-color: var(--negative); }

.cmp-modal-add {
  display: flex; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.cmp-modal-add input {
  flex: 1; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: var(--font-mono);
}
.cmp-modal-add input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.cmp-modal-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* Сайдбар: кнопка «+» рядом с не-tracked артикулами */
.side-art-row {
  display: flex; align-items: stretch; gap: 4px;
  position: relative;
}
.side-art-row.tracked-section-end {
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 6px; margin-bottom: 6px;
}
.side-art-row .side-art { flex: 1; min-width: 0; }
.side-art.untracked { opacity: 0.55; }
.side-art.untracked:hover { opacity: 0.85; }
.side-art.untracked.selected { opacity: 1; }
.side-tracked-dot {
  color: var(--accent); font-size: 11px;
  margin-right: 4px; vertical-align: middle;
}
.side-add-btn {
  flex-shrink: 0; width: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  font-size: 18px; font-weight: 300;
  color: var(--accent);
  align-self: center; margin-right: 6px;
}
.side-add-btn:hover {
  background: var(--accent-soft); border-color: var(--accent);
}

/* Заглушка «выключено / синхронизируется» */
.cmp-empty {
  padding: 48px 24px;
  text-align: center;
  margin-bottom: 16px;
}
.cmp-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: cmp-spin 0.8s linear infinite;
}
@keyframes cmp-spin {
  to { transform: rotate(360deg); }
}
.cmp-hero-thumb img {
  width: 140px; height: auto; border-radius: 8px; display: block;
  border: 1px solid var(--border);
}
.cmp-hero-body { min-width: 0; }
.cmp-hero-name { font-weight: 600; font-size: 15px; line-height: 1.35; }
.cmp-hero-meta { margin-top: 4px; font-size: 12.5px; }
.cmp-hero-meta a { color: var(--accent); }
.cmp-hero-kpi {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.cmp-hero-kpi-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.cmp-k-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; }
.cmp-k-value { font-size: 16px; font-weight: 600; margin-top: 4px; font-family: var(--font-mono); }
.cmp-k-sub { font-size: 11.5px; margin-top: 2px; }
.cmp-k-sub.pos { color: var(--positive); }
.cmp-k-sub.neg { color: var(--negative); }

.cmp-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.cmp-summary-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.cmp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.cmp-two-col > div { min-width: 0; }
.cmp-two-col .cmp-section-h { margin-top: 6px; }

.cmp-table-compact { font-size: 12.5px; }
.cmp-table-compact th, .cmp-table-compact td { padding: 6px 8px; }
.cmp-table-compact .cmp-thumb-sm { width: 28px; height: 38px; }

/* Сгруппированная таблица: визуальное разделение блоков «Цена» и «Выручка» */
.cmp-combined .cmp-group-row th {
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  padding: 6px 8px 4px;
  background: var(--surface);
  border-bottom: 0;
}
.cmp-combined .cmp-group {
  border-bottom: 2px solid var(--border-strong);
  background: var(--surface-2) !important;
}
.cmp-combined .cmp-group-price { color: var(--accent); }
.cmp-combined .cmp-group-sales { color: hsl(220 40% 40%); }
.cmp-combined .cmp-group-start {
  border-left: 1px solid var(--border-strong);
}
.cmp-combined tbody td.cmp-group-start {
  border-left: 1px solid var(--border-strong);
  background: hsl(150 20% 99%);
}
.cmp-combined tbody tr:hover td.cmp-group-start {
  background: var(--surface-hover);
}
.cmp-combined .cmp-row-own td.cmp-group-start {
  background: hsl(150 38% 88%) !important;
}

.cmp-trend { font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; }
.cmp-trend.up { color: var(--negative); }   /* цена выросла = плохо для покупателя, хорошо для рынка */
.cmp-trend.down { color: var(--positive); } /* цена упала = демпинг */
.cmp-trend.neu { color: var(--text-faint); }
.cmp-sum-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.cmp-sum-label { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.3px; }
.cmp-sum-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 6px; font-family: var(--font-mono);
}
.cmp-sum-our { font-size: 17px; font-weight: 700; color: var(--accent); }
.cmp-sum-other { font-size: 15px; font-weight: 500; }
.cmp-sum-vs { font-size: 12px; }
.cmp-sum-range { margin-top: 4px; font-size: 11.5px; font-family: var(--font-mono); }

.cmp-section-h {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-faint); margin: 20px 0 10px; font-weight: 600;
}

.cmp-table-wrap { padding: 0; overflow: hidden; }
.cmp-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cmp-table th {
  text-align: left; padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-faint);
}
.cmp-table th.num, .cmp-table td.num {
  text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.cmp-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table tr:hover td { background: var(--surface-hover); }
.cmp-row-own td { background: var(--mint-soft) !important; font-weight: 500; }
.cmp-row-own:hover td { background: var(--mint-soft) !important; }

.cmp-thumb-sm {
  width: 36px; height: 48px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border); display: block;
}
.cmp-thumb-md {
  width: 56px; height: 75px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); display: block;
}

.cmp-delta { font-weight: 600; font-family: var(--font-mono); font-size: 12.5px; }
.cmp-delta.pos { color: var(--positive); }
.cmp-delta.neg { color: var(--negative); }
.cmp-delta.neu { color: var(--text-faint); }

.cmp-bar {
  width: 100%; height: 8px; background: var(--surface-2);
  border-radius: 4px; overflow: hidden;
}
.cmp-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--mint));
  border-radius: 4px;
}
.cmp-bar-fill.cmp-bar-other {
  background: linear-gradient(90deg, hsl(220 20% 70%), hsl(220 20% 80%));
}

.cmp-stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.cmp-stock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.cmp-stock-card.cmp-stock-own { background: var(--mint-soft); border-color: var(--mint); }
.cmp-stock-card.cmp-stock-out { border-color: var(--negative); background: hsl(0 70% 98%); }
.cmp-stock-card.cmp-stock-critical { border-color: var(--warning); background: hsl(38 70% 98%); }
.cmp-stock-card.cmp-stock-low { border-left: 3px solid var(--warning); }
.cmp-stock-h { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.cmp-stock-name { font-size: 13px; font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cmp-stock-name a { color: var(--accent); text-decoration: none; }
.cmp-stock-name a:hover { text-decoration: underline; }

.cmp-sizes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px;
}
.cmp-size-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 4px;
  text-align: center;
  font-family: var(--font-mono);
}
.cmp-size-name { font-size: 10.5px; color: var(--text-faint); }
.cmp-size-qty { font-size: 13px; font-weight: 600; margin-top: 2px; }
.cmp-size-cell.out { background: hsl(0 70% 95%); border-color: var(--negative); }
.cmp-size-cell.out .cmp-size-qty { color: var(--negative); }
.cmp-size-cell.crit { background: hsl(38 70% 94%); border-color: var(--warning); }
.cmp-size-cell.crit .cmp-size-qty { color: var(--warning); }
.cmp-size-cell.low { background: hsl(48 80% 96%); }

.cmp-chip {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  text-transform: lowercase;
}
.cmp-chip-ok { background: var(--mint-soft); color: var(--accent); }
.cmp-chip-low { background: hsl(48 90% 92%); color: hsl(38 75% 35%); }
.cmp-chip-crit { background: var(--warning-soft); color: var(--warning); }
.cmp-chip-out { background: hsl(0 70% 95%); color: var(--negative); }

@media (max-width: 1280px) {
  .cmp-summary-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .cmp-hero { grid-template-columns: 140px 1fr; }
  .cmp-config-btn { grid-column: 1 / -1; justify-self: start; }
  .cmp-summary, .cmp-summary-5 { grid-template-columns: repeat(2, 1fr); }
  .cmp-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .cmp-summary, .cmp-summary-5 { grid-template-columns: 1fr; }
}

/* ============= Поразмерный редактор цен (карточка артикула) ============= */
table.tbl.size-price th, table.tbl.size-price td { padding: 5px 12px; vertical-align: middle; }
.size-price .sp-input {
  width: 82px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  font-family: var(--font-mono); font-weight: 700; font-size: 13.5px; text-align: right;
  background: var(--surface);
}
.size-price .sp-input:focus { outline: 2px solid var(--mint); border-color: var(--mint); }
.size-price .sp-input.bad { border-color: var(--negative); background: var(--negative-soft); }
.size-price .sp-base { font-size: 11.5px; color: var(--text-faint); margin-left: 8px; }
.size-price .sp-base:empty { display: none; }
.size-price .seb { padding: 2px 7px; border-radius: 4px; font-weight: 700; font-size: 13px; }
.size-price .seb.good { background: var(--positive-soft); color: var(--positive); }
.size-price .seb.mid  { background: hsl(45 90% 90%); color: hsl(38 80% 32%); }
.size-price .seb.bad  { background: var(--negative-soft); color: var(--negative); }
.size-price tr.row-dirty td { background: hsl(150 50% 96%); }
.sp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.sp-rule { font-size: 12.5px; color: var(--text-muted); }
.sp-rule b { color: var(--text); }
.sp-rule .sp-ok { color: var(--positive); font-weight: 700; }
.sp-rule .sp-err { color: var(--negative); font-weight: 700; }
.sp-changed { font-size: 12.5px; color: var(--text-muted); }
