/**
 * Товары — полноэкранный хаб: крупные строки, WB/Ozon в одном взгляде
 */

#section-products.section-products-hub {
  display: none;
  flex-direction: column;
  max-width: none !important;
  width: 100%;
  padding: 10px 14px 8px !important;
  margin: 0 !important;
  min-height: calc(100dvh - var(--nav-h, 68px) - 20px);
  box-sizing: border-box;
}

#section-products.section-products-hub.active {
  display: flex !important;
}

#section-products .products-hub-top {
  flex-shrink: 0;
}

#section-products .page-header {
  margin-bottom: 8px !important;
  padding-bottom: 8px !important;
}

#section-products .page-title {
  font-size: 22px !important;
  margin-bottom: 2px !important;
}

#section-products .page-sub {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

/* Магазины — горизонтальная полоска, не съедает высоту */
#section-products .shop-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 10px !important;
  margin-bottom: 10px !important;
  padding-bottom: 4px !important;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

#section-products .shop-grid .shop-card {
  flex: 0 0 auto;
  min-width: 148px;
  max-width: 220px;
  padding: 14px 18px !important;
  background: linear-gradient(145deg, rgba(123,92,250,0.08) 0%, var(--bg2) 100%) !important;
  border: 1px solid rgba(123,92,250,0.20) !important;
  transition: transform 0.22s cubic-bezier(0.34,1.3,0.64,1), border-color 0.18s ease, box-shadow 0.18s ease !important;
}

#section-products .shop-grid .shop-card.active {
  border-color: rgba(123,92,250,0.50) !important;
  box-shadow: 0 0 20px rgba(123,92,250,0.22) !important;
}

#section-products .shop-grid .shop-card:hover {
  transform: translateY(-3px) scale(1.02) !important;
  border-color: rgba(123,92,250,0.40) !important;
}

#section-products .shop-grid .shop-name {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
  color: var(--text) !important;
  -webkit-text-fill-color: currentColor !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#section-products .shop-grid .shop-card.active .shop-name {
  color: var(--accent3) !important;
}

html[data-theme="dark"] #section-products .shop-grid .shop-card.active .shop-name {
  color: #f4f4ff !important;
}

#section-products .products-layout,
#section-products .products-main,
#section-products #products-table-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#section-products #products-table-wrap {
  overflow: hidden;
}

#section-products .table-toolbar {
  flex-shrink: 0;
  padding: 10px 14px !important;
}

#section-products .toolbar-title {
  font-size: 15px !important;
  font-weight: 700 !important;
}

#section-products #products-table-scroll {
  flex: 1;
  min-height: 0;
  max-height: none !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}

#section-products .pagination {
  flex-shrink: 0;
}

/* Поиск + кнопка «Искать» */
#section-products .search-wrap--wide {
  flex: 1 1 280px;
  min-width: 200px;
  max-width: none;
}

#section-products .search-inp--wide {
  width: 100% !important;
  min-width: 0;
}

#section-products .search-btn {
  flex-shrink: 0;
  padding: 10px 22px;
  border-radius: var(--r-pill, 999px);
  border: none;
  background: var(--gradient-brand, linear-gradient(135deg, var(--accent), var(--accent2)));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#section-products .search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.45);
}

#section-products .search-btn:active {
  transform: translateY(0);
}

#section-products .products-view-toggle {
  display: flex;
  flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

#section-products .products-view-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#section-products .products-view-btn.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#section-products .products-view-btn:hover:not(.active) {
  color: var(--text);
}

#section-products .prod-hub-row--compact .prod-photo,
#section-products .prod-hub-row--compact .prod-photo-ph {
  width: 72px !important;
  height: 72px !important;
  border-radius: 12px !important;
}

#section-products .prod-hub-name--compact {
  font-size: 15px !important;
}

#section-products .prod-hub-sizes-line {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

#section-products .prod-hub-sizes-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  margin-left: 6px;
}

#section-products .prod-hub-art-val--base {
  font-weight: 800;
}

#section-products tr.prod-row--size td {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

#section-products tr.prod-row--size .prod-hub-photo-wrap .prod-photo,
#section-products tr.prod-row--size .prod-hub-photo-wrap .prod-photo-ph {
  width: 56px !important;
  height: 56px !important;
}

#section-products .prod-size-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  margin-right: 8px;
  flex-shrink: 0;
}

#section-products .prod-hub-row--with-size {
  align-items: center;
}

#section-products .pmc-sizes-line {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

#section-products .toolbar-right {
  flex: 1;
  justify-content: flex-end;
  gap: 10px !important;
}

@media (max-width: 768px) {
  #section-products .toolbar-right {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center !important;
    width: 100%;
  }
  #section-products .search-wrap--wide {
    flex: 1 1 100%;
    max-width: none;
  }
  #section-products .search-btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
  #section-products .products-view-toggle {
    flex: 1 1 100%;
    justify-content: center;
  }
  #section-products .products-view-btn {
    flex: 1;
    min-height: 40px;
  }
}

/* ── Таблица-хаб ── */
#section-products .products-hub-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: fixed;
}

#section-products .products-hub-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 12px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase !important;
  color: var(--text3) !important;
  background: var(--bg2) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

#section-products .products-hub-table .col-product { width: 36%; }
#section-products .products-hub-table .col-wb,
#section-products .products-hub-table .col-ozon { width: 11%; }
#section-products .products-hub-table .col-insight { width: 15%; }
#section-products .products-hub-table .col-1c { width: 12%; min-width: 108px; }

/* Staggered row entrance */
@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

#section-products .products-hub-table tbody tr.prod-row {
  min-height: 112px;
  animation: rowSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#section-products .products-hub-table tbody tr.prod-row:nth-child(1)  { animation-delay: 0.00s; }
#section-products .products-hub-table tbody tr.prod-row:nth-child(2)  { animation-delay: 0.04s; }
#section-products .products-hub-table tbody tr.prod-row:nth-child(3)  { animation-delay: 0.07s; }
#section-products .products-hub-table tbody tr.prod-row:nth-child(4)  { animation-delay: 0.10s; }
#section-products .products-hub-table tbody tr.prod-row:nth-child(5)  { animation-delay: 0.13s; }
#section-products .products-hub-table tbody tr.prod-row:nth-child(n+6){ animation-delay: 0.16s; }

#section-products .products-hub-table tbody tr.prod-row td {
  padding: 14px 12px !important;
  vertical-align: middle !important;
  background: var(--bg3) !important;
  border: none !important;
  transition: background 0.18s ease !important;
}

#section-products .products-hub-table tbody tr.prod-row td:first-child {
  border-radius: 16px 0 0 16px !important;
}

#section-products .products-hub-table tbody tr.prod-row td:last-child {
  border-radius: 0 16px 16px 0 !important;
}

#section-products .prod-hub-combined {
  padding: 12px 14px !important;
}

#section-products .prod-hub-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

#section-products .prod-hub-photo-wrap {
  flex: 0 0 auto;
}

#section-products .prod-hub-row .prod-photo,
#section-products .prod-hub-row .prod-photo-ph {
  width: 104px !important;
  height: 104px !important;
  border-radius: 16px !important;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

#section-products .prod-hub-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#section-products .products-hub-table tbody tr.prod-row:hover td {
  background: rgba(123, 92, 250, 0.12) !important;
}

#section-products .products-hub-table tbody tr.prod-row:hover td:first-child {
  box-shadow: inset 3px 0 0 rgba(123, 92, 250, 0.7) !important;
}

#section-products .products-hub-table tbody tr.prod-row-active td {
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: none !important;
}

#section-products .prod-hub-name {
  font-size: 17px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  color: var(--text) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#section-products .prod-hub-entity {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

#section-products .prod-hub-arts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#section-products .prod-hub-art {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
}

#section-products .prod-hub-art--sub {
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-left: 2px solid var(--border2);
  margin-left: 4px;
  border-radius: 0;
}

#section-products .prod-hub-art--empty .prod-hub-art-val {
  color: var(--text3);
  font-weight: 500;
}

#section-products .prod-hub-art .pb {
  flex-shrink: 0;
  font-size: 11px !important;
  padding: 4px 10px !important;
  font-weight: 800 !important;
}

#section-products .prod-hub-art-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

#section-products .prod-hub-art-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  min-width: 72px;
}

#section-products .prod-hub-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  font-size: 14px;
  padding-top: 2px;
}

#section-products .prod-hub-barcode-lbl,
#section-products .prod-hub-size-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
}

#section-products .prod-hub-barcode,
#section-products .prod-hub-size {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  word-break: break-all;
}

/* Блок маркетплейса: ост + зак крупно */
.prod-mp-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.prod-mp-head {
  display: flex;
  align-items: center;
  justify-content: center;
}

.prod-mp-head .pb {
  font-size: 11px !important;
  padding: 4px 12px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
}

.prod-mp-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prod-mp-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  gap: 4px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.prod-mp-metric .prod-mp-l {
  order: 1;
}

.prod-mp-metric .prod-mp-n {
  order: 2;
}

.prod-mp-block--wb .prod-mp-metric {
  border-color: rgba(167,140,252,0.18);
}

.prod-mp-block--wb .prod-mp-metric--orders {
  background: rgba(167,140,252,0.05);
}

.prod-mp-block--ozon .prod-mp-metric {
  border-color: rgba(56,189,248,0.18);
}

.prod-mp-block--ozon .prod-mp-metric--orders {
  background: rgba(56,189,248,0.05);
}

tr:hover .prod-mp-block--wb .prod-mp-metric {
  border-color: rgba(167,140,252,0.35);
  box-shadow: 0 0 12px rgba(167,140,252,0.12);
}

tr:hover .prod-mp-block--ozon .prod-mp-metric {
  border-color: rgba(56,189,248,0.35);
  box-shadow: 0 0 12px rgba(56,189,248,0.12);
}

.prod-mp-n {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.prod-mp-block--wb .prod-mp-n {
  background: linear-gradient(135deg, #c4b5fd, #a78cfc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.prod-mp-block--ozon .prod-mp-n {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.prod-mp-metric--orders .prod-mp-n {
  font-size: 22px;
}

.prod-mp-metric--zero .prod-mp-n {
  color: var(--text3) !important;
  font-weight: 500 !important;
  font-size: 20px !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: var(--text3) !important;
}

.prod-mp-l {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-top: 0;
}

/* Квадрат оценки: где продаётся лучше */
.prod-insight {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border2);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.prod-insight--wb {
  border-color: rgba(167,140,252,0.22);
  background: linear-gradient(145deg, rgba(167,140,252,0.07) 0%, transparent 70%);
}

.prod-insight--ozon {
  border-color: rgba(56,189,248,0.22);
  background: linear-gradient(145deg, rgba(56,189,248,0.07) 0%, transparent 70%);
}

tr:hover .prod-insight--wb {
  border-color: rgba(167,140,252,0.42);
  box-shadow: 0 0 14px rgba(167,140,252,0.12);
}

tr:hover .prod-insight--ozon {
  border-color: rgba(56,189,248,0.42);
  box-shadow: 0 0 14px rgba(56,189,248,0.12);
}

.prod-insight--even {
  border-color: rgba(52, 211, 153, 0.35);
}

.prod-insight--none {
  opacity: 0.85;
}

.prod-insight-verdict {
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.prod-insight-bar-row {
  display: grid;
  grid-template-columns: 26px 1fr 34px;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.prod-insight-bar-lbl {
  font-weight: 800;
  color: var(--text2);
}

.prod-insight-track {
  height: 8px;
  border-radius: 99px;
  background: var(--bg3);
  overflow: hidden;
  border: 1px solid var(--border);
}

.prod-insight-fill {
  height: 100%;
  border-radius: 99px;
  min-width: 2px;
  transition: width 0.35s ease;
}

.prod-insight-fill--wb {
  background: linear-gradient(90deg, #7c5cff, #a78bfa);
}

.prod-insight-fill--ozon {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.prod-insight-pct {
  font-weight: 700;
  text-align: right;
  color: var(--text2);
  font-size: 10px;
}

.prod-insight-tags {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
}

.prod-insight-tag {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
}

.prod-insight-tag--good {
  color: var(--green);
  border-color: rgba(46, 230, 168, 0.35);
  background: rgba(46, 230, 168, 0.1);
}

.prod-insight-tag--mid {
  color: var(--yellow);
  border-color: rgba(255, 200, 87, 0.35);
  background: rgba(255, 200, 87, 0.1);
}

.prod-insight-tag--bad {
  color: var(--text3);
  border-color: var(--border);
}

.prod-1c-block {
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
}

.prod-1c-block .prod-mp-n {
  font-size: 28px;
  color: var(--green);
}

.prod-1c-block.prod-1c-block--zero .prod-mp-n {
  color: var(--text3);
}

.prod-1c-block .prod-mp-l {
  margin-top: 6px;
}

/* Мобильные карточки — крупные платформы */
#section-products .pmc-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

#section-products .pmc-platform {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

#section-products .pmc-platform--wb {
  border-color: rgba(124, 111, 247, 0.35);
}

#section-products .pmc-platform--ozon {
  border-color: rgba(96, 160, 242, 0.35);
}

#section-products .pmc-platform-head {
  text-align: center;
  margin-bottom: 10px;
}

#section-products .pmc-platform-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#section-products .pmc-platform-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--bg3);
  gap: 4px;
}

#section-products .pmc-platform-metric .pmc-v {
  display: block;
  font-size: 24px !important;
  font-weight: 800 !important;
  line-height: 1.1;
}

#section-products .pmc-platform-metric .pmc-l {
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  order: -1;
}

#section-products .pmc-insight-wrap {
  margin-top: 10px;
}

#section-products .pmc-insight-wrap .prod-insight {
  min-height: auto;
}

#section-products .pmc-1c-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
}

#section-products .pmc-1c-row .pmc-v {
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--green);
}

#section-products .prod-mobile-card {
  padding: 16px !important;
}

#section-products .pmc-photo,
#section-products .pmc-photo-ph {
  width: 88px !important;
  height: 88px !important;
  border-radius: 16px !important;
}

#section-products .pmc-name {
  font-size: 17px !important;
  font-weight: 800 !important;
}

#section-products .pmc-arts {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#section-products .pmc-art-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

#section-products .pmc-art-line span:last-child {
  word-break: break-word;
}

#section-products .pmc-barcode {
  font-size: 14px !important;
  font-weight: 600 !important;
}

@media (min-width: 1200px) {
  #section-products .products-hub-table .col-product { width: 38%; }
  #section-products .products-hub-table .col-insight { width: 14%; }
  #section-products .prod-hub-row .prod-photo,
  #section-products .prod-hub-row .prod-photo-ph {
    width: 120px !important;
    height: 120px !important;
  }
  #section-products .prod-hub-art-val { font-size: 17px; }
  #section-products .prod-hub-name { font-size: 18px !important; }
  .prod-mp-n { font-size: 30px; }
  .prod-mp-metric--orders .prod-mp-n { font-size: 26px; }
}

@media (max-width: 1100px) {
  #section-products .products-hub-table .col-product { width: 28%; }
  .prod-mp-n { font-size: 22px; }
}

@media (max-width: 768px) {
  #section-products.section-products-hub {
    min-height: 0;
    height: auto;
    flex: 1;
    overflow: hidden;
  }

  body.vish-app #section-products.active {
    display: flex !important;
    flex: 1;
    min-height: 0;
  }

  #section-products .products-layout,
  #section-products #products-table-wrap {
    flex: 1;
    min-height: 0;
  }

  #section-products .products-mobile-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto !important;
    padding: 8px 10px 12px !important;
  }
}

/* Не ломать общие стили vish-modern для других таблиц */
#section-products .products-hub-table tbody tr td[colspan] {
  border-radius: 16px !important;
}

/* 1С + кнопка истории продаж */
.prod-1c-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 100px;
}

.prod-history-btn {
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(123,92,250,0.30);
  background: rgba(123,92,250,0.10);
  color: var(--accent3, #a78cfc);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s, transform 0.15s ease;
}

.prod-history-btn:hover {
  background: rgba(123,92,250,0.22);
  border-color: rgba(123,92,250,0.5);
  transform: translateY(-1px);
}

.prod-history-btn--mobile {
  margin-top: 8px;
  font-size: 12px;
  padding: 10px 12px;
}

/* Модальное окно истории продаж */
.sales-history-overlay {
  z-index: 9850;
  padding: 16px;
}

.sales-history-modal {
  width: min(1100px, 100%);
  max-height: min(94vh, 920px);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.22s ease;
  overflow: hidden;
}

.sales-history-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}

.sales-history-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent3), var(--cyan, #26d4ed));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sales-history-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text2);
}

.sales-history-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.sales-history-close:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.sales-history-body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sales-hist-loading,
.sales-hist-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.5;
}

.sales-hist-empty--warn {
  text-align: left;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: var(--text);
}

.sales-hist-empty-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.sales-hist-empty-block {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.sales-hist-empty-block ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.sales-hist-empty-block li {
  margin-bottom: 4px;
}

.sales-hist-meta {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 14px;
  display: grid;
  gap: 6px;
}

.sales-hist-meta-l {
  color: var(--text3);
  font-weight: 600;
  margin-right: 4px;
}

.sales-hist-listed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sales-hist-listed input[type="date"] {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
}

.sales-hist-totals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.sales-hist-total {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg3);
  text-align: center;
}

.sales-hist-total--wb { border-color: rgba(167, 139, 250, 0.45); }
.sales-hist-total--oz { border-color: rgba(96, 160, 242, 0.45); }
.sales-hist-total--all { border-color: rgba(52, 211, 153, 0.45); }

.sales-hist-total-n {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.sales-hist-total-l {
  font-size: 10px;
  color: var(--text2);
}

.sales-hist-chart {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg3);
}

.sales-hist-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 10px;
}

.sales-hist-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sales-hist-chart-col {
  flex: 0 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 1px;
}

.sales-hist-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.sales-hist-bar.wb { background: #a78bfa; }
.sales-hist-bar.oz { background: #60a0f2; }

.sales-hist-chart-lbl {
  font-size: 8px;
  color: var(--text3);
  margin-top: 2px;
}

.sales-hist-table-wrap {
  margin-top: 8px;
}

.sales-hist-table-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text2);
}

.sales-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sales-hist-table th,
.sales-hist-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.sales-hist-table th {
  color: var(--text2);
  font-weight: 600;
  background: var(--bg3);
  position: sticky;
  top: 0;
}

.sales-hist-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sales-hist-table td.sales-hist-art {
  font-size: 11px;
  max-width: 220px;
  word-break: break-word;
  line-height: 1.35;
}

.sales-hist-table-wrap--primary {
  margin-bottom: 18px;
}

.sales-hist-table-wrap--primary .sales-hist-table-title {
  color: var(--text);
  font-size: 13px;
}

.sales-hist-table--detail thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.sales-hist-legend-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.25);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text2);
}

.sales-hist-legend-box code {
  font-size: 10px;
  color: var(--accent3, #a78bfa);
}

.sales-hist-catalog {
  margin-top: 10px;
}

.sales-hist-table--compact td {
  padding: 4px 8px;
  font-size: 11px;
}

.sales-hist-foot {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--text3);
}

.sales-hist-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.2);
  font-size: 10px;
  font-weight: 700;
}

/* График истории продаж (sh-*) */
.sh-loading,
.sh-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.5;
}

.sh-empty {
  text-align: left;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 12px;
}

.sh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sh-tabs {
  display: flex;
  gap: 6px;
}

.sh-tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.sh-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--cyan, #26d4ed));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 12px rgba(123,92,250,0.35);
}

.sh-year-pick {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sh-year-pick select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
}

.sh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 12px;
  align-items: center;
}

.sh-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.sh-dot.oz-ord,
.sh-bar.oz-ord { background: #5b9bd5; }
.sh-dot.oz-buy,
.sh-bar.oz-buy { background: #1e5a8a; }
.sh-dot.wb-ord,
.sh-bar.wb-ord { background: #a78bfa; }
.sh-dot.wb-buy,
.sh-bar.wb-buy { background: #6d28d9; }

.sh-legend-note {
  opacity: 0.85;
  font-size: 10px;
}

.sh-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.sh-total {
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
}

.sh-total .n {
  display: block;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent3), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sh-total .l {
  font-size: 10px;
  color: var(--text2);
}

.sh-platform-block {
  margin-bottom: 20px;
}

.sh-platform-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.sh-chart-scroll,
.sh-chart-hscroll {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.sh-chart-inner {
  position: relative;
  height: 100%;
  min-height: 260px;
}

.sh-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 200px;
  padding: 8px 4px 0;
  min-width: min(100%, 720px);
}

.sh-chart--years {
  min-width: auto;
}

.sh-col {
  flex: 1 0 36px;
  max-width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sh-col--year {
  flex: 0 0 72px;
  max-width: 96px;
}

.sh-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 180px;
  width: 100%;
}

.sh-bar {
  flex: 1;
  max-width: 14px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.2s ease;
}

.sh-lbl {
  font-size: 10px;
  color: var(--text3);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

.sh-foot {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text3);
  text-align: center;
}

.sh-hint-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
}

.sh-hint-list code {
  font-size: 11px;
  color: var(--accent3, #a78bfa);
}

.sh-listed-panel {
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
}

.sh-listed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 4px 16px;
  font-size: 13px;
}

.sh-listed-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sh-listed-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent, #7c5cff);
}

.sh-listed-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.sh-listed--edit {
  justify-content: flex-start;
}

.sh-listed-label {
  font-weight: 700;
  color: var(--text);
  width: 100%;
  margin-bottom: 2px;
}

.sh-listed-date {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.sh-listed-edit-btn,
.sh-listed-save {
  padding: 8px 16px !important;
  font-size: 12px !important;
}

.sh-empty--inline {
  margin-bottom: 12px;
  padding: 14px;
}

.sh-legend-note {
  font-size: 11px;
  color: var(--text3);
  margin: 0 0 10px;
}

.sh-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.sh-legend-item {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px 4px 22px;
  border-radius: 999px;
  position: relative;
  color: var(--text2);
}

.sh-legend-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.sh-legend-item--oz-ord::before { background: #3b82f6; }
.sh-legend-item--oz-buy::before { background: #06b6d4; }
.sh-legend-item--wb-ord::before { background: #a855f7; }
.sh-legend-item--wb-buy::before { background: #f97316; }

.sh-year-pick--hidden {
  display: none !important;
}

.sh-chart-hint {
  font-size: 11px;
  color: var(--text3);
  margin: 0 0 10px;
}

.sh-chart-block {
  margin-bottom: 20px;
}

.sh-chart-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.sh-chart-wrap {
  position: relative;
  height: 300px;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px 10px;
  transition: box-shadow 0.2s ease;
}

.sh-chart-wrap--day {
  height: 340px;
  padding: 16px 10px 10px;
}

.sh-chart-wrap--day .sh-chart-hscroll {
  height: 100%;
}

.sh-chart-wrap--day .sh-chart-inner {
  height: 100%;
}

.sh-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.sh-total--oz-ord .n { background: linear-gradient(135deg, #3b82f6, #60a5fa); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sh-total--oz-buy .n { background: linear-gradient(135deg, #06b6d4, #22d3ee); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sh-total--wb-ord .n { background: linear-gradient(135deg, #a855f7, #c084fc); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sh-total--wb-buy .n { background: linear-gradient(135deg, #f97316, #fb923c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

@media (max-width: 640px) {
  .sh-totals {
    grid-template-columns: repeat(2, 1fr);
  }
  .sh-col {
    flex: 0 0 28px;
  }
}
