.db-table {
  display: flex;
  width: calc(100vw - 130px);
  gap: 12px;
}

.db-table .white-box {
  margin-top: 0;
  min-width: 0;
}

.db-table .data-picker button {
  justify-content: space-evenly;
}

.db-table thead th {
  padding: 4px 6px;
}

.db-table tbody td:not(:first-child) {
  text-align: center;
}

.db-table .datatable table {
  border-collapse: collapse;
}

.db-table .datatable thead th {
  padding: 4px 6px;
  border-right: 1px solid #d0d8e6;
}

.db-table .datatable tbody td {
  padding-top: 4px;
  padding-bottom: 4px;
  padding-right: 6px;
  border-right: 1px solid #dce2ee;
  border-bottom: 1px solid #eef0f6;
  line-height: 1.25;
}

.db-table .datatable tbody td:not(:first-child) {
  padding-left: 6px;
}

.db-table .datatable tbody tr.table-custom-subtitle td, 
.db-table .datatable tbody tr.table-custom-title-small td {
  border-bottom: none;
}

.db-table .datatable thead th:first-child,
.db-table .datatable tbody td:first-child {
  border-left: 1px solid #dce2ee;
}

.db-table .datatable .column-sticky {
  border-right-color: #c9d1e0;
}

.db-fix {
  position: sticky;
  top: 6px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  max-width: 350px;
  width: 100%;
}

.db-fix .w-full {
  margin-bottom: 0;
}

.db-fix .white-box {
  min-height: unset;
  padding: 12px;
}

.db-fix-product {
  display: flex;
  gap: 12px;
}

.db-product-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-product-head img {
  border-radius: 16px;
  width: 70px;
  height: auto;
}

.db-product-head .button {
  max-width: 150px;
  padding: 12px;
}

/* =============== Карточка товара =============== */

.db-product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e6e9f2;
  border-radius: 12px;
  background: #fff;
  flex: 1;
  box-shadow: 0 1px 2px rgba(34, 32, 70, 0.04);
}

.db-product-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.db-product-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.db-product-head img {
  border-radius: 10px;
  width: 64px !important;
  height: 86px !important;
  object-fit: cover;
  background: #f5f6fb;
}

.db-product-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding-top: 0;
}

.db-product-name {
  color: #222046;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-product-article {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.db-product-title {
  color: #9aa0b8;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: auto;
}

.db-product-nm-id {
  color: #5c6bc0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.db-product-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5c6bc0;
  cursor: pointer;
  flex-shrink: 0;
}

.db-product-copy svg {
  width: 16px;
  height: 16px;
  display: block;
}

.db-product-copy:hover {
  color: #465687;
}

.db-product-copy-check {
  display: none;
}

.db-product-copy-check svg path {
  stroke: currentColor;
}

.db-product-copy.is-copied {
  color: #3e9c68;
}

.db-product-copy.is-copied .db-product-copy-icon {
  display: none;
}

.db-product-copy.is-copied .db-product-copy-check {
  display: block;
}

.db-product-status {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 8px;
  background: #ece9fb;
  color: #5c6bc0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-product-bottom {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.db-product-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  padding: 0 8px;
}

.db-product-metric:first-child {
  padding-left: 0;
}

.db-product-metric:last-child {
  padding-right: 0;
}

.db-product-metric + .db-product-metric {
  border-left: 1px solid #e6e9f2;
}

.db-product-metric > span:not(.db-product-title) {
  color: #5c6bc0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

/* =============^^====^^================ */

.db-product-row {
  font-size: 16px;
  line-height: 1;
}

.db-product-row td {
  font-size: 16px;
  line-height: 1;
  padding: 12px 0;
}

.db-product-row:last-child td {
  border: none;
}

.db-product-left {
  font-weight: 600;
  color: #5068A5;
}

.db-product-right {
  text-align: end;
}

.db-not-found {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.db-not-found-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  color: rgba(51, 51, 51, 0.5);
}

.db-table .db-previous-year-cell,
.db-table th.db-previous-year-header-cell {
  color: #9AA9CD;
}

.db-popup-type {
  display: inline-block;
  min-width: 85px;
  padding: 16px;
  border-radius: 4px;
}

.db-popup-cell {
  position: relative;
  cursor: pointer;
}

.db-popup-cell:hover .db-popup-window {
  opacity: 1;
  visibility: visible;
}

.db-cell-text {
  padding: 6px 8px;
  min-width: 60px;
  border-radius: 4px;
}

.db-popup-cell  .db-popup-window {
  display: flex;
  opacity: 0;
  visibility: hidden;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 100px;
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  z-index: 999;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.db-popup-cell  .db-popup-window  .db-popup-row {
  font-size: 13px;
  border-radius: 4px;
  padding: 6px 0;
}


/* =============== Шапка-стики ================= */

.db-fix-top {
  position: static;
  top: 0;
  z-index: 200;
  background: #fff !important;
  margin-bottom: 30px;
  padding-bottom: 4px;
  min-width: 0;
}

.db-fix-top.is-pinned {
  position: sticky;
  top: 0;
  z-index: 200;
  padding-top: 12px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  box-shadow: 0 12px 16px #fff;
}

.db-fix-top .white-box {
  border: none;
  padding: 0;
  background: #ffffff !important;
  box-shadow: none;
}

.db-fix-top .table-filters {
  margin-bottom: 24px;
  gap: 12px;
}

.db-fix-top .table-filters .flex-center-gap {
  gap: 10px;
  flex-wrap: wrap;
}

.db-fix-top .table-filters .ts-control {
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  border-radius: 8px;
  border: 1px solid #e0e3ee;
  background: #fff;
  box-shadow: none;
}

.db-fix-top .table-filters .ts-control {
  padding-top: 0;
  padding-bottom: 0;
}

.db-fix-top .table-filters > .button-secondary {
  border-radius: 8px;
}

.db-sticky-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.db-sticky-filter-title {
  color: #333;
  font-size: 14px;
  line-height: 1.2;
}

.db-sticky-filter .label-wrapper {
  flex-shrink: 0;
}

.product-stock-wrapper {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.db-product-card {
  max-width: 360px;
}

.db-not-found,
.db-stock,
.db-kpi-card {
  flex: 1 0 188px;
  min-width: 188px;
  max-width: 360px;
}

.db-not-found,
.db-stock,
.db-kpi-card {
  border: 1px solid #e6e9f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(34, 32, 70, 0.04);
}

.db-not-found,
.db-stock {
  padding: 14px 16px;
}

#chartTitle {
  font-weight: 600;
}


/* ========== карточки остатков, оборачиваемости и капитализации ========= */

.db-stock {
  font-size: 13px;
  display: flex;
  flex-direction: column;
}

.db-stock-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef0f6;
}

.db-stock-title {
  font-weight: 600;
  color: #222046;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.db-stock table {
  width: 100%;
  font-size: 13px;
  margin-bottom: 0;
}

.db-stock table thead th {
  font-weight: 600;
  color: #222046;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  padding: 0 0 10px;
  border-bottom: 1px solid #eef0f6;
}

.db-stock table tbody td {
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.25;
  border: none;
  border-right: 1px solid #eef0f6;
}

.db-stock table tbody td:first-child {
  font-weight: 400;
  color: #9aa0b8;
  padding-left: 0;
  padding-right: 8px;
}

.db-stock table tbody td:last-child {
  text-align: right;
  font-weight: 600;
  color: #222046;
  white-space: nowrap;
  border-right: none;
  padding-right: 0;
}

.db-stock .db-product-row td {
  font-size: 12px;
  line-height: 1.25;
  padding: 3px 6px;
}


/* ========== KPI карточки ========= */

.db-kpi-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-kpi-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.db-card-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.db-kpi-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}

.db-kpi-title {
  font-weight: 600;
  color: #222046;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.db-kpi-subtitle {
  font-size: 11px;
  color: #9aa0b8;
  font-weight: 400;
}

.db-kpi-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  margin: 2px 0 4px;
}

.db-kpi-tab {
  padding: 2px 8px;
  border: 1px solid #e6e9f2;
  border-radius: 999px;
  background: #f5f6fb;
  font-size: 10px;
  font-weight: 500;
  color: #6b728a;
  cursor: pointer;
  transition: all 0.2s;
}

.db-kpi-tab:hover {
  background: #eceff8;
}

.db-kpi-tab.active {
  background: #5c6bc0;
  color: #fff;
  border-color: #5c6bc0;
}

.db-kpi-value {
  display: none;
  font-size: 22px;
  font-weight: 700;
  color: #222046;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.db-kpi-value.active {
  display: block;
}

.db-kpi-value-large {
  font-size: 22px;
  font-weight: 700;
  color: #222046;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.db-kpi-secondary {
  font-size: 13px;
  font-weight: 600;
  color: #5c6bc0;
}

.db-kpi-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 12px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #eef0f6;
}

.db-kpi-footer-header {
  color: #9aa0b8;
  font-weight: 400;
}

.db-kpi-footer-value {
  font-weight: 600;
  color: #222046;
}

.db-kpi-footer-value.article-statistics-cell-more-zero {
  color: #3e9c68 !important;
}

.db-kpi-footer-value.article-statistics-cell-less-zero {
  color: #bc4040 !important;
}


/* ========= табы для таблиц ========== */

.tabs {
  margin-top: 40px;
}

.tabs-header {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f4f9;
  border-radius: 10px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #6b7a8f;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #333;
  background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
  background: #ffffff;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-btn .tab-count {
  display: inline-block;
  background: #e5ebf4;
  color: #5068a5;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  border-radius: 12px;
  margin-left: 6px;
}

.tab-btn.active .tab-count {
  background: #5068a5;
  color: #fff;
}

.tabs-content {
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
