.chart-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 1000;
  align-items: center; justify-content: center;
}
.chart-modal-overlay.open { display: flex; }
.chart-modal {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 8px; width: min(760px, 92vw); padding: 20px 24px 24px;
  position: relative;
}
.chart-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.chart-modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-modal-close {
  width: 28px; height: 28px; border-radius: 8px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.chart-modal-close:hover { background: var(--row-hover); color: var(--text); }
.chart-modal-close svg { width: 15px; height: 15px; }
.chart-canvas-wrap { position: relative; height: 280px; }

@media (max-width: 920px) {
  .main-grid { grid-template-columns: 1fr; }
  .left-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
  .left-col > .card { height: 100%; }
}
@media (max-width: 600px) {
  .left-col { grid-template-columns: 1fr; }
  .page-wrapper { padding: 0 14px 0; }
  .right-col { gap: 6px; }

  /* фильтры: всё в колонку */
  .filter-bar { flex-direction: column; align-items: stretch; gap: 6px; }

  /* строка 1: вендор и дистрибьютор рядом, каждый по 50% */
  .filter-left { flex-direction: row; gap: 8px; flex-wrap: nowrap; }
  .filter-left .dd-wrapper { flex: 1; min-width: 0; }
  .filter-left .filter-btn { width: 100%; justify-content: space-between; }
  .filter-left .dd-list { width: 100%; }
  .filter-left .reset-btn { display: none; }

  /* строка 2: 50 позиций влево, плотность вправо */
  .filter-row2 {
    justify-content: space-between !important; width: 100%; gap: 0 !important;
    padding: 4px 0;
  }
  .filter-row2 .pos-count { margin-left: 0 !important; margin-right: auto; }

  /* touch targets */
  .anomaly-limit-btn { min-height: 28px; }
  .sort-price-btn { height: 28px; }

  /* мобильная таблица */
  .th-hash  { width: 28px; min-width: 28px; }
  .th-art   { min-width: 80px; width: 100px; }
  .th-vnd   { min-width: 70px; width: 80px; }
  .th-dst   { min-width: 80px; width: 100px; }
  .th-qty   { min-width: 44px; width: 52px; }
  .th-prc   { min-width: 64px; width: 76px; }
  .data-table thead th { padding: 10px 6px; font-size: 11px; }
  .data-table tbody td { padding: var(--row-pad-v, 11px) 6px; font-size: 12px; }
  .td-hash  { font-size: 11px; }
  .td-art   { font-size: 11px; }
}

/* SIDEBAR TOGGLE */
/* ── DESKTOP SIDEBAR DIVIDER ── */
.sidebar-divider {
  display: block;
  width: 20px;
  position: relative;
  align-self: stretch;
}
.sidebar-divider::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 1px;
  border-left: 1px dashed var(--card-border);
}
.sidebar-toggle-btn {
  position: fixed;
  top: 50vh;
  transform: translateY(-50%);
  width: 20px; height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: color 0.18s;
  padding: 0;
  z-index: 100;
}
.sidebar-toggle-btn:hover { color: #0078D4; }
.sidebar-toggle-btn svg { width: 10px; height: 10px; transition: transform 0.32s cubic-bezier(0.4,0,0.2,1); }
.main-grid.sidebar-collapsed { grid-template-columns: 0 20px 1fr !important; }
.main-grid.sidebar-collapsed .left-col { overflow: hidden; opacity: 0; pointer-events: none; }
.left-col { transition: opacity 0.28s ease; }
.main-grid.sidebar-collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

/* ── MOBILE TOGGLE BAR ── */
.mobile-toggle-bar { display: none; }
@media (max-width: 920px) {
  /* прячем десктопный разделитель */
  .sidebar-divider { display: none; }

  /* мобильная кнопка-полоска */
  .mobile-toggle-bar {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 0;
    margin: 6px 0 2px 0;
    cursor: pointer; background: none; border: none;
    color: var(--text-tertiary);
    gap: 6px;
    transition: color 0.18s;
  }
  .mobile-toggle-bar:hover { color: #0078D4; }
  .mobile-toggle-bar .mtb-line {
    flex: 1; height: 1px;
    background: var(--card-border);
  }
  .mobile-toggle-bar .mtb-icon {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 18px;
    border-radius: 9px; border: 1px solid var(--card-border);
    background: var(--card-bg);
    flex-shrink: 0;
  }
  .mobile-toggle-bar .mtb-icon svg {
    width: 12px; height: 8px;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }
  /* когда left-col скрыт — иконка смотрит вниз */
  .mobile-collapsed .mtb-icon svg { transform: rotate(180deg); }

  /* скрываем left-col с анимацией */
  .left-col {
    transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease;
    max-height: 2000px;
    overflow: hidden;
  }
  .mobile-collapsed .left-col {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
  }
  /* на мобиле collapsed — main-grid остаётся 1fr, без боковой колонки */
  .main-grid.sidebar-collapsed { grid-template-columns: 1fr !important; }
}


/* ===== FOOTER ===== */
