.table-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 8px; box-shadow: var(--card-shadow); overflow: hidden;
}
.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
@media (max-width: 600px) {
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 6px; }
  .table-card .data-table { min-width: 620px; width: 100%; }
  .right-col { min-width: 0; overflow-x: clip; }
  .main-grid { min-width: 0; }
}

/* sticky thead */
.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.data-table { width: 100%; table-layout: auto; }
.data-table thead { position: sticky; top: 0; z-index: 5; }
.data-table thead th {
  padding: 12px 14px; text-align: left;
  font-size: 12px; font-weight: 500; color: var(--table-header);
  letter-spacing: 0.25px; border-bottom: 1px solid var(--table-border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--card-bg);
}
.th-hash  { width: 44px; min-width: 44px; }
.th-art   { min-width: 120px; width: 140px; }
.th-name  { min-width: 160px; }
.th-vnd   { min-width: 90px; width: 110px; }
.th-dst   { min-width: 110px; width: 140px; }
.th-qty   { min-width: 60px; width: 70px; text-align: right !important; white-space: nowrap; }
.th-prc   { min-width: 80px; width: 90px; text-align: right !important; white-space: nowrap; }
.th-trs   { min-width: 65px; width: 75px; text-align: right !important; white-space: nowrap; }
/* Circle: column # wider to fit numbers */
[data-style="circle"] .th-hash { width: 52px; }
.col-hidden { display: none !important; }
.data-table tbody tr { border-bottom: 1px solid var(--table-border); transition: background 0.1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--row-hover) !important; }
.data-table tbody tr:nth-child(odd)  { background: transparent; }
.data-table tbody tr:nth-child(even) { background: var(--row-alt); }
.data-table tbody td {
  padding: var(--row-pad-v, 11px) 14px; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: padding 0.2s ease;
}
/* density toggle buttons */
/* SORT PRICE BUTTON */
.sort-price-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 4px;
  border: 1px solid transparent;
  background: transparent; cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0; padding: 0;
}
.sort-price-btn:hover { background: var(--row-hover); color: var(--text-secondary); }
/* sort-price-btn always neutral, no active highlight */
.sort-price-btn svg { width: 14px; height: 14px; }
/* ASC state (default): показываем icon-asc, скрываем icon-desc */
.sort-price-btn .icon-asc  { display: block; }
.sort-price-btn .icon-desc { display: none; }
/* DESC state */
.sort-price-btn.desc .icon-asc  { display: none; }
.sort-price-btn.desc .icon-desc { display: block; }

.density-btns { display: flex; gap: 4px; }
.density-divider {
  width: 1px; height: 16px; background: var(--card-border);
  align-self: center; flex-shrink: 0; margin: 0 2px;
}
.col-vis-group { display: flex; align-items: center; gap: 6px; }
.col-vis-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; user-select: none; white-space: nowrap;
  padding: 4px 2px;
}
.col-vis-label input[type="checkbox"] {
  display: block; width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--text-secondary); background: transparent;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  position: relative; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.col-vis-label input[type="checkbox"]:checked {
  background: #0078D4; border-color: #0078D4;
}
.col-vis-label input[type="checkbox"]:checked::after {
  content: ''; position: absolute;
  left: 50%; top: 50%;
  width: 9px; height: 5px;
  border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
  transform: translate(-50%, -60%) rotate(-45deg);
}
.density-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--card-border);
  background: transparent; cursor: pointer; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0; line-height: 0; font-size: 0;
}
.density-btn.active { background: #0078D4; color: #fff; border-color: #0078D4; }
.density-btn:hover:not(.active) { background: var(--row-hover); color: var(--text); }
.density-btn:active { transform: scale(0.93); }
.density-btn svg { width: 14px; height: 14px; display: block; flex-shrink: 0; }
.filter-btn:active, .pd-period-btn:active, .pd-chart-btn:active,
.anomaly-limit-btn:active, .sort-price-btn:active { transform: scale(0.97); }

/* COLUMN DRAG & DROP */
.data-table thead th[draggable] { cursor: grab; user-select: none; }
.data-table thead th[draggable]:active { cursor: grabbing; }
.data-table thead th.col-drag-over-left  { box-shadow: inset 3px 0 0 #0078D4; }
.data-table thead th.col-drag-over-right { box-shadow: inset -3px 0 0 #0078D4; }
.data-table thead th.col-dragging { opacity: 0.45; }
.td-hash { color: var(--text-secondary); font-size: 12px; }
.td-art  { font-family: 'SF Mono','Menlo','Monaco','Courier New',monospace; font-size: 12px; color: var(--text-secondary); }
.td-vnd, .td-dst { color: var(--text-secondary); }
.td-trs { text-align: right; color: var(--text-secondary); }
.td-qty  { text-align: right; color: var(--text-secondary); }
.td-prc  { text-align: right; font-weight: 600; }
.td-art.copyable, .td-prc.copyable, .wc-sku.copyable, .wc-price.copyable {
  cursor: pointer; user-select: none;
}
.td-art.copyable:hover, .td-prc.copyable:hover { background: var(--hover); border-radius: 3px; }
.wc-sku.copyable:hover, .wc-price.copyable:hover { opacity: 0.75; }

/* CHART MODAL */
