/* ===== Base Styles ===== */
:root {
  /* Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-text: #0b1720;
  --color-text-muted: #6b7280;
  --color-bg: #f5f7fb;
  --color-card: #ffffff;
  --color-border: rgba(0, 0, 0, 0.1);
  --color-error: #dc2626;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  
  /* Additional colors for ABC20 */
  --bordo: #7b1420;
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #f59e0b;
  --green: #10b981;
  --blue: #38bdf8;
  --gray: #6b7280;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 10px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Transitions */
  --transition: all 0.2s ease;
  
  /* Max width */
  --maxw: 2040px;
}

/* Dark theme */
[data-theme="dark"] {
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-text: #e6eef8;
  --color-text-muted: #9fb1c8;
  --color-bg: #071021;
  --color-card: rgba(12, 18, 25, 0.86);
  --color-border: rgba(255, 255, 255, 0.1);
}

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-md);
  font-weight: 600;
  line-height: 1.2;
}

p {
  margin: 0 0 var(--spacing-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.app {
  max-width: var(--maxw);
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Cards */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

/* Единый верхний блок: загрузка, состояние, управление и фильтры. */
.top-controls-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

/* File upload button */
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: linear-gradient(180deg, var(--color-card), var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  color: var(--color-text);
}

.file-btn:hover {
  background: linear-gradient(180deg, var(--color-bg), var(--color-card));
}

.file-btn input[type="file"] {
  display: none;
}

/* Кнопки загрузки и экспорт занимают только ширину своего текста. */
.controls .control-block > .file-btn,
.controls .control-block > #exportBtn {
  align-self: flex-start;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

#logoImg {
  height: 48px;
  width: auto;
  border-radius: var(--radius-md);
}

.title-wrap {
  display: flex;
  flex-direction: column;
}

.title-main {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.title-sub {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: flex-end;
}

/* Settings */
.settings-panel {
  margin-bottom: var(--spacing-md);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  justify-content: space-between;
}

.filters-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: flex-end;
}

.status-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 300px;
  max-width: 100%;
}#tableWrap, [data-wha-scroll] {
  scrollbar-gutter: stable both-edges;
  padding-right: 18px;
  box-sizing: border-box;
}#tableWrap table, [data-wha-scroll] table {
  margin-right: 18px;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 1000;
  padding: var(--spacing-md);
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  max-width: 400px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Скрытие отдельных статусных колонок по выбору пользователя. */
.column-hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filters {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .status-summary {
    align-items: flex-start;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app {
    padding: var(--spacing-sm);
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .filters-group {
    flex-direction: column;
    width: 100%;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1920px) and (max-height: 1080px) {
  :root {
    --spacing-sm: 6px;
    --spacing-md: 10px;
    --spacing-lg: 12px;
    --spacing-xl: 18px;
  }

  html {
    font-size: 13px;
  }

  .app {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .card {
    padding: var(--spacing-md);
  }.controls, .filters, .filters-group, .settings-grid {
    gap: var(--spacing-sm);
  }

  .status-summary {
    min-width: 240px;
  }
}

/* ===== ABC20 Specific Styles ===== */
/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  margin-right: 12px;
}

.back-link:hover {
  background: var(--color-primary);
  color: white;
}

#logoImg {
  height: 48px;
  width: auto;
  border-radius: 8px;
  display: block;
}

.title-main {
  font-size: 20px;
  color: #333333;
  margin: 0;
  font-weight: 600;
}

[data-theme="dark"] .title-main {
  color: var(--color-text);
}

.title-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Верхняя панель и компактное управление её видимостью */
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.panel-toggle {
  cursor: pointer;
  padding: 3px 6px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 6px;
  background: transparent;
  color: var(--color-primary);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.panel-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
}

.compact-search {
  display: none;
  align-items: center;
}

.compact-search-input {
  box-sizing: border-box;
  width: 116px;
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 6px;
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  font-size: 10px;
  line-height: 1.2;
}

.compact-search-input.compact-search-input--code {
  width: 64px;
}

.compact-search-input.code-list-filter {
  width: 120px;
  height: 22px;
  max-height: 58px;
  resize: vertical;
  overflow: hidden !important;
  scrollbar-width: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.compact-search-input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.compact-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

[data-theme="dark"] .compact-search-input {
  border-color: rgba(147, 197, 253, 0.4);
  background: var(--color-card);
}

.app.panel-collapsed .compact-search {
  display: inline-flex;
}

[data-theme="dark"] .panel-toggle {
  border-color: rgba(147, 197, 253, 0.4);
}

.app.panel-collapsed .brand,
.app.panel-collapsed .theme-toggle,
.app.panel-collapsed .top-controls-card,
.app.panel-collapsed #controlsCard,
.app.panel-collapsed #supplierDashboard {
  display: none;
}

.app.panel-collapsed .topbar {
  justify-content: flex-end;
  margin-bottom: 0;
}

.app.panel-collapsed .topbar-actions {
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .app.panel-collapsed .topbar-actions {
    flex-wrap: wrap;
  }

  .compact-search-input {
    width: 110px;
  }

  .compact-search-input.compact-search-input--code {
    width: 120px;
  }
}

/* Controls card */
.card {
  background: var(--color-card);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.06);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: max-content;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(180deg, #fff, #f6f9ff);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.file-btn:hover {
  background: linear-gradient(180deg, #f3f6ff, #e5efff);
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

[data-theme="dark"] .file-btn {
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.32), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

.input {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
  min-width: 120px;
}

[data-theme="dark"] .input {
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.96);
  color: var(--color-text);
}


/* Компактные menu-button для массовых действий. Размер совпадает с «В меню». */
.compact-control {
  min-width: 0;
}

.compact-action,
.action-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 31px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.menu-control {
  position: relative;
}

.action-menu-wrap {
  position: relative;
  display: inline-flex;
}

.action-menu-caret {
  font-size: 11px;
  line-height: 1;
}

.action-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  min-width: 100%;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 9px;
  background: var(--color-card);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.action-menu[hidden] {
  display: none;
}

.action-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.action-menu-item:hover,
.action-menu-item:focus-visible {
  background: #eef2ff;
  color: var(--color-primary);
  outline: none;
}

.structure-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.structure-menu-check {
  display: inline-block;
  width: 1.2em;
  color: var(--color-primary);
  font-weight: 700;
  text-align: center;
}

[data-theme="dark"] .action-menu {
  background: #0c1219;
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

[data-theme="dark"] .action-menu-item:hover,
[data-theme="dark"] .action-menu-item:focus-visible {
  background: rgba(30, 64, 175, 0.45);
  color: #e5e7eb;
}

/* Primary button */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.28);
}

[data-theme="dark"] .btn-primary {
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn-ghost:hover {
  background: #eef2ff;
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-ghost {
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.9);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(30, 64, 175, 0.45);
  border-color: rgba(191, 219, 254, 0.9);
}

.small {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ===== Supplier stock health dashboard ===== */
.supplier-dashboard {
  flex-shrink: 0;
  max-height: min(500px, calc(100vh - 230px));
  overflow: auto;
  padding: 8px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.dashboard-header h2 {
  margin: 0;
  font-size: 14px;
}

.dashboard-scope {
  margin: 3px 0 0;
  color: var(--color-text-muted);
  font-size: 11px;
}

.dashboard-toggle {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.dashboard-toggle:hover,
.dashboard-toggle.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.dashboard-horizon-explanation-panel {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 150px;
  flex-direction: column;
  height: 150px;
  min-height: 150px;
  max-height: 150px;
  margin: 0 0 8px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}

.dashboard-horizon-explanation-panel[hidden] {
  display: none;
}

.dashboard-horizon-explanation-panel__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.dashboard-horizon-explanation-panel__header h3 {
  margin: 0;
  font-size: 12px;
}

.dashboard-horizon-explanation-panel__content {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  color: var(--color-text-muted);
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-bottom: 6px;
  line-height: 1.25;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context strong {
  color: var(--color-text);
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context span {
  min-width: 0;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content p {
  margin: 0;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.dashboard-stat {
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
}

.dashboard-stat > span {
  display: block;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat strong .dashboard-stat-current {
  color: var(--color-text);
  font-weight: 700;
}

.dashboard-stat strong .dashboard-stat-context {
  display: inline;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.dashboard-stat small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat--critical {
  border-color: rgba(185, 28, 28, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.dashboard-stat--warning {
  border-color: rgba(194, 65, 12, 0.3);
  background: rgba(249, 115, 22, 0.07);
}

.dashboard-stat--action {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.05);
}

.dashboard-stat--leader {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(245, 158, 11, 0.09);
}

.dashboard-section-title {
  margin: 0 0 4px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dashboard-ranking-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 5px;
}

.dashboard-ranking-legend .dashboard-status-badge {
  padding: 1px 4px;
  font-size: 9px;
}

.dashboard-table-wrap {
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
}

.dashboard-ranking-viewport {
  max-height: 190px;
}

.dashboard-priority-list {
  display: grid;
  gap: 0;
  min-width: 620px;
}

.dashboard-priority-row {
  padding: 4px 8px 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.dashboard-priority-row:last-child {
  border-bottom: 0;
}

.dashboard-priority-row.dashboard-row-open {
  background: rgba(37, 99, 235, 0.055);
}

.dashboard-priority-value {
  flex: 0 0 auto;
  color: var(--color-text);
  font-size: 11px;
}

.dashboard-priority-bar {
  display: flex;
  width: 100%;
  height: 8px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: #f1f5f9;
}

.dashboard-bar-segment {
  display: block;
  min-width: 0;
  height: 100%;
}

/* Сегменты повторяют существующие цвета бейджей статусов. */
.dashboard-bar-segment.status-no-goods {
  background: #fee2e2;
}

.dashboard-bar-segment.status-deficit {
  background: #fee2e2;
}

.dashboard-bar-segment.status-min-stock {
  background: #ffedd5;
}

.dashboard-bar-segment.status-avg-stock {
  background: #fef3c7;
}

.dashboard-bar-segment.status-optimal {
  background: #dcfce7;
}

.dashboard-bar-segment.status-surplus {
  background: #e0e7ff;
}

.dashboard-bar-segment.status-no-sales,
.dashboard-bar-segment.status-neutral {
  background: #f1f5f9;
}

.dashboard-priority-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.2;
}

.dashboard-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 3px 6px;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.dashboard-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-card);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}

.dashboard-table tr:last-child td {
  border-bottom: 0;
}

.dashboard-table th:last-child,
.dashboard-table td:last-child {
  border-right: 0;
}

.dashboard-table tbody tr:hover td,
.dashboard-table tbody tr.dashboard-row-open td {
  background: rgba(37, 99, 235, 0.055);
}

.dashboard-supplier-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 260px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-supplier-trigger:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.dashboard-stat--leader .dashboard-leader-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.dashboard-number-critical,
.dashboard-risk-value {
  color: #b91c1c;
  font-weight: 700;
}

.dashboard-number-deficit {
  color: #dc2626;
  font-weight: 700;
}

.dashboard-number-warning {
  color: #c2410c;
  font-weight: 700;
}

.dashboard-number-zero {
  color: #c4ccd6;
  font-weight: 700;
}

.dashboard-detail {
  margin-top: 8px;
}

.dashboard-detail-table-wrap {
  height: 100px;
  max-height: 100px;
}

.dashboard-detail-table {
  min-width: 1120px;
}

.dashboard-detail-table td:nth-child(2) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-status-badge {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-status-badge.status-no-goods {
  background: #fee2e2;
  color: #991b1b !important;
}

.dashboard-status-badge.status-deficit {
  background: #fee2e2;
  color: #dc2626 !important;
}

.dashboard-status-badge.status-min-stock {
  background: #ffedd5;
  color: #c2410c !important;
}

.dashboard-status-badge.status-avg-stock {
  background: #fef3c7;
  color: #a16207 !important;
}

.dashboard-status-badge.status-optimal {
  background: #dcfce7;
  color: #15803d !important;
}

.dashboard-status-badge.status-surplus {
  background: #e0e7ff;
  color: #4f46e5 !important;
}

.dashboard-status-badge.status-no-sales {
  background: #f1f5f9;
  color: #64748b !important;
}

.dashboard-muted {
  color: var(--color-text-muted);
  font-size: 10px;
}

.dashboard-warehouse-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

[data-theme="dark"] .dashboard-stat {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(148, 163, 184, 0.42);
}

[data-theme="dark"] .dashboard-stat--critical {
  background: rgba(239, 68, 68, 0.14);
}

[data-theme="dark"] .dashboard-stat--warning {
  background: rgba(245, 158, 11, 0.14);
}

[data-theme="dark"] .dashboard-stat--action {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .dashboard-stat--leader {
  background: rgba(245, 158, 11, 0.14);
}

[data-theme="dark"] .dashboard-table th {
  background: #0c1219;
}

[data-theme="dark"] .dashboard-table tbody tr:hover td,
[data-theme="dark"] .dashboard-table tbody tr.dashboard-row-open td {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .dashboard-status-badge.status-no-goods,
[data-theme="dark"] .dashboard-status-badge.status-deficit {
  background: rgba(239, 68, 68, 0.2);
  color: #ff9b9b !important;
}

[data-theme="dark"] .dashboard-status-badge.status-min-stock {
  background: rgba(245, 158, 11, 0.2);
  color: #ffc078 !important;
}

[data-theme="dark"] .dashboard-status-badge.status-avg-stock {
  background: rgba(250, 204, 21, 0.18);
  color: #ffe58a !important;
}

[data-theme="dark"] .dashboard-status-badge.status-optimal {
  background: rgba(34, 197, 94, 0.18);
  color: #8ee6ad !important;
}

[data-theme="dark"] .dashboard-status-badge.status-surplus {
  background: rgba(99, 102, 241, 0.2);
  color: #9bbcff !important;
}

[data-theme="dark"] .dashboard-status-badge.status-no-sales {
  background: rgba(148, 163, 184, 0.16);
  color: #c7d3e2 !important;
}

[data-theme="dark"] .dashboard-bar-segment.status-no-goods,
[data-theme="dark"] .dashboard-bar-segment.status-deficit {
  background: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .dashboard-bar-segment.status-min-stock {
  background: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .dashboard-bar-segment.status-avg-stock {
  background: rgba(250, 204, 21, 0.18);
}

[data-theme="dark"] .dashboard-bar-segment.status-optimal {
  background: rgba(34, 197, 94, 0.18);
}

[data-theme="dark"] .dashboard-bar-segment.status-surplus {
  background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .dashboard-bar-segment.status-no-sales,
[data-theme="dark"] .dashboard-bar-segment.status-neutral {
  background: rgba(148, 163, 184, 0.16);
}

@media (max-width: 900px) {
  .dashboard-summary {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
  }
}

/* Complex table structure */
.table-area {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  contain: layout style paint;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .table-wrap {
  border-color: rgba(148, 163, 184, 0.35);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 11px;
}

/* Компактный отчёт: значения занимают одну строку, заголовки могут переноситься. */
#resultTable {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  /* Separate layout lets sticky headers paint an opaque background. */
  border-collapse: separate;
  border-spacing: 0;
  position: relative;
}

#resultTable th,
#resultTable td {
  vertical-align: middle;
  padding: 2px;
  /* One-sided borders keep the separate layout visually as thin as collapse. */
  border: 0;
  border-right: 1px solid #CCC085;
  border-bottom: 1px solid #CCC085;
}

#resultTable th:first-child,
#resultTable td:first-child {
  border-left: 1px solid #CCC085;
}

#resultTable thead tr:first-child th {
  border-top: 1px solid #CCC085;
}

[data-theme="dark"] #resultTable th,
[data-theme="dark"] #resultTable td {
  border-color: rgba(148, 163, 184, 0.25);
}

#resultTable th {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.05;
  max-width: 80px;
}

/* Узкие заголовки не раздвигают числовые колонки: ширину задают данные. */
#resultTable th:not([colspan]) {
  width: 1%;
}

#resultTable th[colspan] {
  max-width: none;
}

#resultTable td {
  white-space: nowrap;
  line-height: 1.05;
}

th {
  position: sticky;
  background: var(--color-card);
  z-index: 2;
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 6px;
  font-weight: 600;
}

thead tr:first-child th {
  top: 0;
  z-index: 10;
}

thead tr:nth-child(2) th {
  top: 30px;
  z-index: 5;
}

thead tr:nth-child(3) th {
  top: 60px;
  z-index: 5;
}

[data-theme="dark"] th {
  border-color: rgba(148, 163, 184, 0.25);
}

td {
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 4px 6px;
  vertical-align: middle;
  text-align: center;
  z-index: 1;
  position: relative;
}

[data-theme="dark"] td {
  border-color: rgba(148, 163, 184, 0.16);
}

/* Collapse indicator */
.collapse-indicator {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  display: inline-block;
  user-select: none;
  transition: transform 0.2s;
  color: #333;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
}

.collapse-indicator:hover {
  transform: scale(1.1);
  color: #000;
}

[data-theme="dark"] .collapse-indicator {
  color: #e0e0e0;
}

[data-theme="dark"] .collapse-indicator:hover {
  color: #fff;
}

/* Row grouping */
.supplier-row {
  background: #F4ECC6;
  font-weight: 700;
}

/* Только текущий поставщик закрепляется под многоуровневой шапкой. */
#resultTable tbody tr.supplier-row.supplier-row-active td {
  position: sticky;
  top: var(--supplier-sticky-top, 0px);
  z-index: 3;
  background-color: #F4ECC6;
}

.supplier-row:hover {
  background: #EEE5BC;
}

[data-theme="dark"] .supplier-row {
  background: #2a3b45;
}

[data-theme="dark"] .supplier-row:hover {
  background: #3a4b55;
}

.product-row {
  background: #F9F2D9;
  font-weight: 600;
}

.product-row:hover,
.product-row.horizon-analysis-row-selected {
  background: rgba(37, 99, 235, 0.05);
}

/* Переключение группировки доступно только в колонке «№». */
#resultTable tbody tr.supplier-row > td:first-child,
#resultTable tbody tr.product-row > td:first-child {
  cursor: pointer;
}

[data-theme="dark"] .product-row:hover,
[data-theme="dark"] .product-row.horizon-analysis-row-selected {
  background: rgba(37, 99, 235, 0.1);
}

.product-row,
.warehouse-row {
  contain: layout style;
}

.warehouse-row {
  background: #ffffff;
}

[data-theme="dark"] .warehouse-row {
  background: rgba(148, 163, 184, 0.08);
}

.virtual-spacer td {
  height: 1px;
  padding: 0 !important;
  border: 0 !important;
  visibility: hidden;
}

/* Скрытые строки */
#resultTable tbody td.col-svobodnyy-ostatok {
  background-color: rgb(255, 235, 205);
}

[data-theme="dark"] #resultTable tbody td.col-svobodnyy-ostatok {
  background-color: rgb(255, 235, 205);
}

.col-unsecured-red {
  color: rgb(178, 34, 34) !important;
  font-weight: 700;
}

.col-nomenclature {
  white-space: nowrap;
  text-align: left;
}

/* Иконки признаков в группировке номенклатуры не меняют высоту строк. */
#resultTable td.report-defectura-td {
  padding: 1px 2px;
}
#resultTable td.report-flag-cell {
  padding: 1px 2px;
  line-height: 1;
  text-align: center;
}

.report-flag-icon {
  display: inline-block;
  width: auto;
  height: 0.95em;
  max-height: 0.95em;
  object-fit: contain;
  vertical-align: -0.12em;
}

.report-defectura-cell {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1.05;
}

.col-warehouse {
  text-align: left;
  padding-left: 6px;
}


/* Status indicator */
.status-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.busy-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.92);
  color: var(--color-text);
  font-size: 12px;
}

[data-theme="dark"] .busy-banner {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.55);
}

.busy-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.55);
  border-top-color: var(--color-primary);
  animation: busySpin 0.85s linear infinite;
}

@keyframes busySpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Theme toggle */
.theme-toggle {
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
}

.theme-toggle:hover {
  background: rgba(37, 99, 235, 0.05);
}

/* Settings panel */
.settings-panel {
  display: none;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .settings-panel {
  border-top-color: rgba(148, 163, 184, 0.35);
}

.settings-panel.visible,
.settings-panel:not(.hidden) {
  display: block;
}

/* ===== Status Colors for Излишки/Дефицит columns ===== */
/* Излишки / Дефицит 30/45/60 - цвета по статусам */
.status-no-sales { color: rgb(160, 160, 160) !important; }      /* Нет продаж */
.status-surplus { color: rgb(83, 106, 194) !important; }        /* Излишки */
.status-min-stock { color: rgb(255, 140, 0) !important; }       /* Мин. запас */
.status-deficit { color: rgb(255, 0, 0) !important; }           /* Дефицит */
.col-brief-check.status-deficit { color: #ff8f8f !important; } /* Отклонение: светло-красный дефицит */
.status-avg-stock { color: rgb(250, 204, 31) !important; }      /* Ср. запас */
.status-optimal { color: rgb(0, 128, 0) !important; }           /* Опти. запас */
.status-no-goods { color: rgb(139, 0, 0) !important; }          /* Нет товара */
.brief-zero { color: rgb(192, 192, 192) !important; }                 /* Нулевые значения БРИФ */
.brief-muted { color: rgb(160, 160, 160) !important; }                         /* Значения БРИФ без цветового статуса */
.brief-total-planned-positive { color: rgb(0, 100, 0) !important; }              /* Положительное всего запланировано */

/* Заказ на 30/45/60 дней - цвета по значениям (только текст, без фона) */
/* Отрицательные и нулевые значения - серые, положительные - зеленые. */
.order-negative { color: rgb(160, 160, 160) !important; }       /* Значение < -0.00001 или = 0 */
.order-positive { color: rgb(0, 128, 0) !important; }           /* Значение > 0.00001 */

/* ===== Column Header Background Colors ===== */
/* Цвет шапок колонок R:251, G:225, B:81 */
.header-columns-default { 
  background-color: rgb(251, 225, 81) !important; 
  color: #333 !important;
  border-color: #d4c876 !important;
}
[data-theme="dark"] .header-columns-default {
  background-color: rgb(251, 225, 81) !important;
  color: #333 !important;
  border-color: #d4c876 !important;
  opacity: 1 !important;
}

/* Группа "Остатки" - фон шапки rgb(255, 222, 173), цвет текста значений rgb(128, 128, 128) */
.header-ost-group { 
  background-color: rgb(255, 222, 173) !important; 
  color: #333 !important;
  border-color: #d4b896 !important;
}
[data-theme="dark"] .header-ost-group {
  background-color: rgb(255, 222, 173) !important;
  color: #333 !important;
  border-color: #d4b896 !important;
  opacity: 1 !important;
}
.col-ost-group { 
  color: rgb(128, 128, 128) !important; 
}.header-svobodnyy-ostatok, .header-ostatok-na-sklade, .header-v-rezerve, .header-procent-ot-rezerva, .header-otgruzhaetsya, .header-ne-obespecheno, .header-v-puti-na-filial, .header-v-puti-ot-postavshchika {
  background-color: rgb(255, 222, 173) !important;
}[data-theme="dark"] .header-svobodnyy-ostatok, [data-theme="dark"] .header-ostatok-na-sklade, [data-theme="dark"] .header-v-rezerve, [data-theme="dark"] .header-procent-ot-rezerva, [data-theme="dark"] .header-otgruzhaetsya, [data-theme="dark"] .header-ne-obespecheno, [data-theme="dark"] .header-v-puti-na-filial, [data-theme="dark"] .header-v-puti-ot-postavshchika {
  background-color: rgb(255, 222, 173) !important;
  opacity: 1 !important;
}
.col-ostatski, .col-svobodnyy-ostatok, .col-rc-yaroslavl, .col-ostatok-na-sklade, 
.col-v-rezerve, .col-procent-ot-rezerva, .col-otgruzhaetsya, 
.col-ne-obespecheno, .col-v-puti-na-filial, .col-v-puti-ot-postavshchika {
  color: rgb(128, 128, 128) !important;
}

/* Группа "Логистика" - фон шапки rgb(251, 225, 81) */
.header-logistics { 
  background-color: rgb(251, 225, 81) !important; 
  color: #333 !important;
  border-color: #d4c876 !important;
}
[data-theme="dark"] .header-logistics {
  background-color: rgb(251, 225, 81) !important;
  color: #333 !important;
  border-color: #d4c876 !important;
  opacity: 1 !important;
}.header-dostavka, .header-check, .header-sklad {
  background-color: rgb(251, 225, 81) !important;
}[data-theme="dark"] .header-dostavka, [data-theme="dark"] .header-check, [data-theme="dark"] .header-sklad {
  background-color: rgb(251, 225, 81) !important;
  opacity: 1 !important;
}

/* Продажи (всего) - фон шапки rgb(135, 195, 235), текст значений rgb(28, 85, 174) */
.header-sales-total { 
  background-color: rgb(135, 195, 235) !important; 
  color: #333 !important;
  border-color: #5a8fbf !important;
}
[data-theme="dark"] .header-sales-total {
  background-color: rgb(135, 195, 235) !important;
  color: #333 !important;
  border-color: #5a8fbf !important;
  opacity: 1 !important;
}
.col-sales-total { 
  color: rgb(28, 85, 174) !important; 
}
.col-prodazhi-vsego {
  color: rgb(28, 85, 174) !important;
}

/* Продажи за мес. - фон шапки rgb(135, 206, 235), текст значений rgb(70, 130, 180) */
.header-sales-monthly { 
  background-color: rgb(135, 206, 235) !important; 
  color: #333 !important;
  border-color: #5a9fbf !important;
}
[data-theme="dark"] .header-sales-monthly {
  background-color: rgb(135, 206, 235) !important;
  color: #333 !important;
  border-color: #5a9fbf !important;
  opacity: 1 !important;
}
.col-sales-monthly { 
  color: rgb(28, 85, 174) !important; 
}
.col-prodazhi-za-mes {
  color: rgb(70, 130, 180) !important;
}
.col-srednie-prodazhi {
  color: rgb(70, 100, 180) !important;
}

/* Излишки / Дефицит 30 и Заказ на 30 дней - фон шапки rgb(192, 220, 192) */
.header-30days { 
  background-color: rgb(192, 220, 192) !important; 
  color: #333 !important;
  border-color: #8fa88f !important;
}
[data-theme="dark"] .header-30days {
  background-color: rgb(192, 220, 192) !important;
  color: #333 !important;
  border-color: #8fa88f !important;
  opacity: 1 !important;
}.header-zakaz-30 {
  background-color: rgb(192, 220, 192) !important;
}[data-theme="dark"] .header-zakaz-30 {
  background-color: rgb(192, 220, 192) !important;
  opacity: 1 !important;
}

/* Излишки / Дефицит 45 и Заказ на 45 дней - фон шапки rgb(192, 214, 158) */
.header-45days { 
  background-color: rgb(192, 214, 158) !important; 
  color: #333 !important;
  border-color: #8f9f6f !important;
}
[data-theme="dark"] .header-45days {
  background-color: rgb(192, 214, 158) !important;
  color: #333 !important;
  border-color: #8f9f6f !important;
  opacity: 1 !important;
}.header-zakaz-45 {
  background-color: rgb(192, 214, 158) !important;
}[data-theme="dark"] .header-zakaz-45 {
  background-color: rgb(192, 214, 158) !important;
  opacity: 1 !important;
}

/* Излишки / Дефицит 60 и Заказ на 60 дней - фон шапки rgb(143, 188, 139), текст темный */
.header-60days { 
  background-color: rgb(143, 188, 139) !important; 
  color: #333 !important;
  border-color: #5f7f5f !important;
}
[data-theme="dark"] .header-60days {
  background-color: rgb(143, 188, 139) !important;
  color: #333 !important;
  border-color: #5f7f5f !important;
  opacity: 1 !important;
}.header-zakaz-60 {
  background-color: rgb(143, 188, 139) !important;
  color: #333 !important;
}[data-theme="dark"] .header-zakaz-60 {
  background-color: rgb(143, 188, 139) !important;
  color: #333 !important;
  opacity: 1 !important;
}

/* Заказ по горизонту номенклатуры */
.header-order-horizon {
  background-color: rgb(78 114 143) !important;
  color: #fff !important;
  border-color: rgb(55 80 101) !important;
}
[data-theme="dark"] .header-order-horizon {
  background-color: rgb(78 114 143) !important;
  color: #fff !important;
  border-color: rgb(55 80 101) !important;
  opacity: 1 !important;
}

/* ===== Row Highlighting ===== */
/* Подсветка строк по колонке Номенклатура */
.row-zak-yes { background-color: rgb(255, 225, 225) !important; }  /* Зак = Да */
.row-sez-yes { background-color: rgb(215, 240, 199) !important; }

/* Просроченная дефектура */
.row-defectura-expired { 
  background-color: rgb(255, 160, 122) !important; 
  color: rgb(178, 34, 34) !important; 
}

/* Дополнительные цвета для ячеек */
.stock-days-high { color: rgb(83, 106, 194) !important; }
.stock-days-low { color: rgb(255, 0, 0) !important; }
.reserve-percent-high { color: rgb(255, 99, 71) !important; font-weight: 700; }

/* Комбинированные селекторы для предотвращения переопределения цветов */
td.col-ost-group.reserve-percent-high { color: rgb(255, 99, 71) !important; font-weight: 700; }
td.col-ost-group.col-unsecured-red { color: rgb(178, 34, 34) !important; font-weight: 700; }

tr:hover td,
tr.horizon-analysis-row-selected td {
  background: rgba(37, 99, 235, 0.03);
}
[data-theme="dark"] tr:hover td,
[data-theme="dark"] tr.horizon-analysis-row-selected td {
  background: rgba(37, 99, 235, 0.08);
}


/* ===== Filters (same interaction pattern as karzologic.html) ===== */
.filters-card {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  width: 100%;
}

.filters-card .filters {
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.filters-card .filters-group {
  align-items: center;
  gap: var(--spacing-sm);
}

.multi-select {
  position: relative;
  display: inline-flex;
}

.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.ms-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: var(--color-card);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

[data-theme="dark"] .ms-panel {
  background: #0c1219;
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.ms-search {
  width: 100%;
  min-width: 0;
  margin-bottom: 8px;
  font-size: 12px;
}

.ms-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ms-actions {
  display: flex;
  gap: 6px;
}

.ms-actions .btn-ghost,
.ms-row > .btn-ghost {
  padding: 5px 8px;
  font-size: 11px;
}

.ms-list {
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 6px;
}

.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 5px;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

/* Компактный фильтр признаков в едином стиле с остальными фильтрами. */
#flagFilterWrap .ms-panel {
  width: min(260px, calc(100vw - 32px));
  padding: 8px;
}

#flagFilterWrap .ms-search {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 12px;
}

#flagFilterWrap .ms-row {
  margin-bottom: 6px;
}

#flagFilterWrap .ms-list {
  padding-top: 4px;
}

#flagFilterWrap .ms-item {
  gap: 6px;
  min-height: 28px;
  padding: 4px 5px;
  font-size: 12px;
}

#flagFilterWrap .ms-item select.input {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
  height: 28px;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 18px;
}

#flagFilterWrap #flagFilterBtn {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}


/* Компактная сортировка в едином стиле с фильтрами. */
#sortFilterWrap .ms-panel {
  width: min(300px, calc(100vw - 32px));
  padding: 8px;
}

.sort-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.sort-filter-select {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  font-size: 12px;
}

#sortFilterWrap .sort-filter-close {
  padding: 5px 8px;
  font-size: 11px;
}

.sort-filter-number,
.sort-filter-text {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border, #d1d5db);
}

.sort-filter-text .ms-list {
  max-height: 180px;
}

.sort-filter-number-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.sort-filter-number-values--between {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sort-filter-number-values .sort-filter-field {
  min-width: 0;
  margin-bottom: 8px;
}

#sortFilterWrap #sortFilterText {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

.ms-item input {
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
}

.text-filter {
  display: inline-flex;
  min-width: 150px;
}

.text-filter-input {
  width: 150px;
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}

.text-filter-input.code-list-filter {
  height: 34px;
  min-height: 34px;
  resize: vertical;
  overflow-x: clip;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .filters-card .filters,
  .filters-card .filters-group {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .filters-card .multi-select,
  .filters-card .text-filter,
  .filters-card .ms-btn,
  .filters-card #resetAllFiltersBtn {
    width: 100%;
  }

  .filters-card .text-filter-input {
    width: 100%;
  }

  .filters-card .ms-btn {
    justify-content: space-between;
  }

  .ms-panel {
    width: 100%;
  }
}


/* Компактная панель настроек: поле всегда визуально связано со своей подписью. */
.settings-panel {
  display: none;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.035);
}
.settings-panel.visible,
.settings-panel:not(.hidden) { display: block; }
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 0 2px 7px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}
.settings-header h2 { margin: 0 0 2px; font-size: 1rem; }
.settings-header p,
.settings-hint { margin: 0; color: var(--color-text-muted); font-size: 0.78rem; line-height: 1.35; }
.settings-section {
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-sm);
  background: var(--color-card);
}
.settings-section + .settings-section { margin-top: 7px; }
.settings-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0 1px 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 5px 7px;
  max-width: none;
}
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--color-text);
  font-size: 0.78rem;
}
.setting-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.delivery-days-input,
.transfer-max-days-input {
  width: 52px;
  min-height: 25px;
  padding: 2px 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  text-align: right;
}
.settings-hint {
  margin-top: 6px;
  padding: 5px 7px 0;
  border-top: 1px dashed rgba(148, 163, 184, 0.3);
}
.status-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 5px 7px;
  max-width: none;
}
.status-setting-row {
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--color-text);
  font-size: 0.78rem;
}
.status-setting-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.status-rule-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  gap: 4px;
  white-space: nowrap;
  color: var(--color-text-muted);
}
.status-rule-metric { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status-rule-join { margin: 0 1px; }
.status-rule-operator { color: var(--color-text); font-weight: 700; }
.status-rule-input {
  width: 50px;
  min-height: 25px;
  padding: 2px 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  text-align: right;
}
.status-rule-input:focus,
.delivery-days-input:focus,
.transfer-max-days-input:focus { outline: 2px solid rgba(37, 99, 235, 0.25); border-color: var(--color-primary); }
[data-theme="dark"] .settings-section,
[data-theme="dark"] .setting-row,
[data-theme="dark"] .status-setting-row { background: rgba(15, 23, 42, 0.42); border-color: rgba(148, 163, 184, 0.34); }
@media (max-width: 760px) {
  .status-settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .settings-header { align-items: stretch; flex-direction: column; }
  .settings-header .btn-ghost { align-self: flex-start; }
  .settings-grid { grid-template-columns: 1fr; }
}


/* ===== Dark theme report readability ===== */
/* Убираем светлую палитру отчёта в тёмной теме и повышаем читаемость данных. */
[data-theme="dark"] #resultTable { color: #dbe7f5; background: #0b1525; }
[data-theme="dark"] #resultTable th { color: #e7eef8 !important; border-color: #34445b !important; text-shadow: none; }
[data-theme="dark"] #resultTable td { color: #c7d3e2; border-color: #26364c !important; background-color: transparent; }
[data-theme="dark"] #resultTable tbody tr:nth-child(odd) td { background-color: #0d1829; }
[data-theme="dark"] #resultTable tbody tr:nth-child(even) td { background-color: #111f32; }
[data-theme="dark"] #resultTable tbody tr:hover td,
[data-theme="dark"] #resultTable tbody tr.horizon-analysis-row-selected td { background-color: #1a3553 !important; }

/* Заголовки: тёмные оттенки вместо светлых RGB-плашек. */
[data-theme="dark"] .header-columns-default { background-color: #18263a !important; color: #e7eef8 !important; border-color: #3a4d66 !important; }
[data-theme="dark"] .header-logistics { background-color: #1b3048 !important; color: #e7eef8 !important; border-color: #3b5875 !important; }
[data-theme="dark"] .header-ost-group { background-color: #28384d !important; color: #e7eef8 !important; border-color: #48617b !important; }
[data-theme="dark"] .header-sales-total { background-color: #214263 !important; color: #e7f1ff !important; border-color: #477aa8 !important; }
[data-theme="dark"] .header-sales-monthly { background-color: #244b64 !important; color: #e7f1ff !important; border-color: #4d89a8 !important; }
[data-theme="dark"] .header-30days,
[data-theme="dark"] .header-zakaz-30 { background-color: #244638 !important; color: #e6fff1 !important; border-color: #3f755e !important; }
[data-theme="dark"] .header-45days,
[data-theme="dark"] .header-zakaz-45 { background-color: #263f55 !important; color: #e7f2ff !important; border-color: #477395 !important; }
[data-theme="dark"] .header-60days,
[data-theme="dark"] .header-zakaz-60 { background-color: #4a3d27 !important; color: #fff5d6 !important; border-color: #826d42 !important; }

/* Значения в отчёте: повышаем контраст жёстко заданных светлой темой цветов. */
[data-theme="dark"] .col-ostatski,
[data-theme="dark"] .col-svobodnyy-ostatok,
[data-theme="dark"] .col-rc-yaroslavl,
[data-theme="dark"] .col-ostatok-na-sklade,
[data-theme="dark"] .col-v-rezerve,
[data-theme="dark"] .col-procent-ot-rezerva,
[data-theme="dark"] .col-otgruzhaetsya,
[data-theme="dark"] .col-ne-obespecheno,
[data-theme="dark"] .col-v-puti-na-filial,
[data-theme="dark"] .col-v-puti-ot-postavshchika { color: #c7d3e2 !important; }
[data-theme="dark"] .col-sales-total,
[data-theme="dark"] .col-sales-monthly { color: #8fc5ff !important; }
[data-theme="dark"] .col-srednie-prodazhi { color: rgb(70, 100, 180) !important; }
[data-theme="dark"] .status-no-sales,
[data-theme="dark"] .order-negative { color: #aebbd0 !important; }
[data-theme="dark"] .status-surplus { color: #9bbcff !important; }
[data-theme="dark"] .status-min-stock { color: #ffc078 !important; }
[data-theme="dark"] .status-deficit { color: #ff8f8f !important; }
[data-theme="dark"] .status-avg-stock { color: #ffe58a !important; }
[data-theme="dark"] .status-optimal,
[data-theme="dark"] .order-positive { color: #8ee6ad !important; }
[data-theme="dark"] .brief-total-planned-positive { color: #69c98b !important; }
[data-theme="dark"] .status-no-goods { color: #ff9b9b !important; }
[data-theme="dark"] .stock-days-high { color: #a9baff !important; }
[data-theme="dark"] .stock-days-low { color: #ff8f8f !important; }[data-theme="dark"] #resultTable tr.row-zak-yes td { background-color: #3a252d !important; }[data-theme="dark"] #resultTable tr.row-sez-yes td { background-color: #203b32 !important; }[data-theme="dark"] #resultTable tr.row-defectura-expired td { background-color: #463126 !important; }


/* ===== Dark theme nomenclature grouping ===== */
/* Группы номенклатуры должны быть заметнее складских строк. */
[data-theme="dark"] #resultTable tr.product-row td { background-color: #1a3047 !important; border-top-color: #4b7597 !important; border-bottom-color: #304e6a !important; font-weight: 600; }
[data-theme="dark"] #resultTable tr.product-row td:first-child { border-left: 3px solid #64b5e8 !important; color: #e5f3ff !important; }
[data-theme="dark"] #resultTable tr.product-row td.col-nomenclature { color: #f0f7ff !important; font-weight: 700; }
[data-theme="dark"] #resultTable tr.product-row:hover td,
[data-theme="dark"] #resultTable tr.product-row.horizon-analysis-row-selected td { background-color: #244767 !important; }[data-theme="dark"] #resultTable tr.product-row.row-zak-yes td { background-color: #4a2d39 !important; }[data-theme="dark"] #resultTable tr.product-row.row-sez-yes td { background-color: #28503f !important; }
[data-theme="dark"] #resultTable tr.supplier-row td { background-color: #15263a !important; border-bottom-color: #52708b !important; color: #dcecff !important; font-weight: 700; }
[data-theme="dark"] #resultTable tr.supplier-row td.col-ost-group.col-unsecured-red,
[data-theme="dark"] #resultTable tr.product-row td.col-ost-group.col-unsecured-red { color: rgb(178, 34, 34) !important; font-weight: 700 !important; }


/* Выручка - последняя колонка отчёта */
.header-revenue {
  background-color: rgb(102, 205, 170) !important;
  color: #102a25 !important;
}

.col-revenue {
  font-variant-numeric: tabular-nums;
  color: rgb(141, 141, 141) !important;
}


/* Непрозрачная закреплённая шапка: строки тела не должны просвечивать при прокрутке. */
#resultTable {
  position: relative;
}

#resultTable thead {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: rgb(251, 225, 81);
}

#resultTable thead,
#resultTable thead tr {
  background-color: rgb(251, 225, 81);
}

#resultTable thead th {
  background-color: #ffffff;
  background-image: none;
  /* Paint the opaque header underneath its borders as well. */
  background-clip: border-box;
}

[data-theme="dark"] #resultTable thead,
[data-theme="dark"] #resultTable thead tr,
[data-theme="dark"] #resultTable thead th {
  background-color: #0c1219;
}


/* Sales analytics tooltip opened from the «Продажи (всего)» column. */
#resultTable th.col-prodazhi-vsego,
#resultTable td.col-prodazhi-vsego,
#resultTable td.col-sales-total {
  cursor: pointer;
}

#resultTable th.col-prodazhi-vsego:hover,
#resultTable td.col-prodazhi-vsego:hover,
#resultTable td.col-sales-total:hover {
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

#resultTable th.header-order-horizon:hover,
#resultTable td.col-order-horizon:hover,
#resultTable td.col-movement-horizon:hover {
  box-shadow: inset 0 0 0 1px #10b981;
}

#resultTable th.header-order-horizon,
#resultTable td.col-order-horizon,
#resultTable td.col-movement-horizon {
  cursor: pointer;
}

.sales-analytics-breakdown[hidden] {
  display: none;
}

.horizon-cell-stock-days {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
  color: var(--color-text);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.horizon-cell-stock-days-line {
  display: block;
}

.horizon-cell-stock-days-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.sales-analytics-breakdown {
  display: grid;
  max-height: calc(100vh - 128px);
  gap: 10px;
  overflow: auto;
  padding: 12px 14px;
  color: var(--color-text);
}

.horizon-explanation-summary {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
}

.horizon-explanation-summary > span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
}

.horizon-explanation-summary > strong {
  display: block;
  margin: 2px 0 4px;
  color: #059669;
  font-size: 19px;
}

.horizon-explanation-summary p,
.horizon-explanation-muted {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.horizon-explanation-multiplicity {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.horizon-explanation-multiplicity > h3 {
  margin: 0;
  color: var(--color-text);
  font-size: 12px;
}

.horizon-explanation-multiplicity-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-card);
}

.horizon-explanation-multiplicity-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 11px;
}

.horizon-explanation-multiplicity-table th,
.horizon-explanation-multiplicity-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  text-align: right;
  white-space: nowrap;
}

.horizon-explanation-multiplicity-table th {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 600;
}

.horizon-explanation-multiplicity-table th:first-child,
.horizon-explanation-multiplicity-table td:first-child {
  min-width: 230px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.horizon-explanation-multiplicity-table tbody tr:last-child td {
  border-bottom: 0;
}

.horizon-explanation-list {
  display: grid;
  gap: 7px;
}

.horizon-explanation-list > h3,
.horizon-explanation-warehouse > h3 {
  margin: 0;
  color: var(--color-text);
  font-size: 12px;
}

.horizon-explanation-item {
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-card);
}

.horizon-explanation-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 11px;
}

.horizon-explanation-item > summary strong {
  flex: 0 0 auto;
  color: #059669;
}

.horizon-explanation-item-body {
  padding: 8px 10px;
  border-top: 1px solid var(--color-border);
}

.horizon-explanation-warehouse {
  display: grid;
  gap: 8px;
}

.horizon-explanation-steps {
  display: grid;
  gap: 7px;
}

.horizon-explanation-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
}

.horizon-explanation-step p {
  margin: 0;
  color: var(--color-text);
  font-size: 11px;
  line-height: 1.45;
}

.horizon-step-index {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 600px) {
  .sales-analytics-breakdown { padding: 10px; }
}

.sales-analytics[hidden] {
  display: none;
}

.sales-analytics {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.28);
}

.sales-analytics-dialog {
  --sales-dialog-min-width: 320px;
  width: min(var(--sales-dialog-width, 760px), calc(100vw - 24px));
  min-width: min(var(--sales-dialog-min-width, 760px), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  min-height: 180px;
  max-height: calc(100vh - 24px);
  container: sales-analytics-dialog / inline-size;
  overflow: auto;
  resize: both;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 12px;
  background: var(--color-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
}

.sales-analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--color-border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sales-analytics-header.is-dragging {
  cursor: grabbing;
}

.sales-analytics-heading {
  min-width: 0;
}

.sales-analytics-kicker {
  display: block;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sales-analytics-heading h2 {
  margin: 2px 0 1px;
  overflow: visible;
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.sales-analytics-heading p {
  margin: 0;
  overflow: visible;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.sales-analytics-inventory {
  display: grid;
  flex: 0 0 444px;
  min-width: 444px;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  padding: 5px 14px 6px;
  border-bottom: 1px solid var(--color-border);
}

.sales-analytics-inventory-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  padding: 3px 8px;
  border-right: 1px solid rgba(148, 163, 184, 0.28);
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.sales-analytics-inventory-item:nth-child(4n) {
  border-right: 0;
}

.sales-analytics-inventory-item:nth-child(n + 5) {
  border-bottom: 0;
}

.sales-analytics-inventory-label {
  overflow: visible;
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.1;
  overflow-wrap: normal;
  white-space: nowrap;
}

.sales-analytics-inventory-value {
  overflow: hidden;
  color: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-analytics-close {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 23px;
  line-height: 25px;
}

.sales-analytics-close:hover,
.sales-analytics-close:focus-visible {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-text);
  outline: none;
}

.sales-analytics-chart-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 14px 5px;
}

.sales-analytics-chart {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(var(--sales-month-count), minmax(var(--sales-bar-min-width, 0), 1fr));
  align-items: end;
  gap: clamp(1px, 0.35vw, 3px);
  min-width: 0;
  min-height: 156px;
}

.sales-analytics-bar {
  display: flex;
  min-width: var(--sales-bar-min-width, 0);
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  text-align: center;
}

.sales-analytics-value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  min-height: 0;
  overflow: visible;
  color: rgb(37, 99, 235);
  font-size: 9px;
  line-height: 1.1;
  transform: translate(-50%, -3px);
  white-space: nowrap;
}

.sales-analytics-value--zero {
  color: #cbd5e1;
}

.sales-analytics-track {
  display: flex;
  height: 116px;
  align-items: flex-end;
  justify-content: center;
  margin-top: 3px;
  background: transparent;
}

.sales-analytics-bar--year-start {
  position: relative;
}

.sales-analytics-bar--year-start::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2px;
  width: 1px;
  background: rgba(148, 163, 184, 0.62);
  content: '';
}

.sales-analytics-fill {
  position: relative;
  width: 76%;
  min-height: 0;
  border-radius: 5px 5px 2px 2px;
  background: #2563eb;
  transition: height 0.18s ease;
}

.sales-analytics-label {
  margin-top: 4px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-analytics-empty {
  align-self: center;
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  font-size: 12px;
  text-align: center;
}

.sales-analytics-footer {
  padding: 7px 14px 10px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 10px;
}

[data-theme="dark"] .sales-analytics {
  background: rgba(2, 6, 23, 0.62);
}

[data-theme="dark"] .sales-analytics-dialog {
  border-color: rgba(148, 163, 184, 0.38);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .sales-analytics-track {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
}

@media (max-width: 600px) {
  .sales-analytics {
    align-items: center;
    padding: 8px;
  }

  .sales-analytics-dialog {
    max-height: calc(100vh - 16px);
  }

  .sales-analytics-header {
    padding: 10px 11px 7px;
  }

  .sales-analytics-chart-wrap {
    padding: 8px 10px 4px;
  }

  .sales-analytics-chart {
    gap: 2px;
  }

  .sales-analytics-footer {
    padding: 6px 11px 8px;
  }
}

@container sales-analytics-dialog (max-width: 760px) {
  .sales-analytics-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    padding-right: 46px;
  }

  .sales-analytics-heading {
    display: contents;
  }

  .sales-analytics-kicker {
    grid-column: 1;
    grid-row: 1;
  }

  .sales-analytics-heading h2 {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sales-analytics-heading p {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .sales-analytics-inventory {
    grid-column: 1 / -1;
    grid-row: 4;
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sales-analytics-close {
    position: absolute;
    top: 10px;
    right: 11px;
  }

  .sales-analytics-inventory-label {
    overflow-wrap: anywhere;
    white-space: normal;
  }
}



/* Компактная справка по формулам расчёта. */
.calculation-rules-panel {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.3);
}
.calculation-rules-panel.hidden { display: none; }
.calculation-rules-dialog {
  width: min(1200px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 24px));
  min-width: min(360px, calc(100vw - 24px));
  min-height: min(260px, calc(100vh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  resize: both;
  container-type: inline-size;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 12px;
  background: var(--color-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
}
.calculation-rules-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 9px;
  border-bottom: 1px solid var(--color-border);
}
.calculation-rules-kicker {
  display: block;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.calculation-rules-header h2 {
  margin: 2px 0 1px;
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.2;
}
.calculation-rules-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
}
.calculation-rules-body {
  padding: 10px 12px 12px;
  font-size: 11px;
}
.calculation-rules-note,
.calculation-rules-footer {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.calculation-rules-note {
  margin-bottom: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.07);
}
.calculation-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.calculation-rule {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.055);
}
.calculation-rule--wide { grid-column: 1 / -1; }
.calculation-rule h3 {
  margin: 0 0 5px;
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.25;
}
.calculation-rule-formula {
  margin-bottom: 5px;
  padding: 6px 7px;
  border-left: 3px solid var(--color-primary);
  border-radius: 4px;
  background: var(--color-card);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.calculation-rule p { margin: 0; color: var(--color-text-muted); font-size: 11px; line-height: 1.4; }
.calculation-rule p strong { color: var(--color-text); }
.calculation-rules-footer {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}
[data-theme="dark"] .calculation-rules-panel { background: rgba(2, 6, 23, 0.62); }
[data-theme="dark"] .calculation-rules-dialog {
  border-color: rgba(148, 163, 184, 0.38);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
@container (max-width: 700px) {
  .calculation-rules-grid { grid-template-columns: 1fr; }
  .calculation-rule--wide { grid-column: auto; }
}
@media (max-width: 700px) {
  .calculation-rules-panel { align-items: center; padding: 8px; }
  .calculation-rules-dialog {
    width: calc(100vw - 16px);
    height: min(720px, calc(100vh - 16px));
    min-width: min(280px, calc(100vw - 16px));
    min-height: min(220px, calc(100vh - 16px));
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
  .calculation-rules-header { padding: 10px 11px 8px; }
  .calculation-rules-body { padding: 8px 9px 10px; }
}


/* Режим ручной настройки ширины колонок отчёта. */
#resultTable.column-width-mode {
  table-layout: fixed;
}
#resultTable.column-width-mode td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-wrap {
  position: relative;
}
.column-resize-layer {
  position: fixed;
  z-index: 9999;
  display: grid;
  box-sizing: border-box;
  pointer-events: none;
}
.column-resize-layer[hidden] {
  display: none;
}
.column-resize-layer .column-resize-handle {
  position: relative;
  z-index: 1;
  justify-self: end;
  width: 12px;
  height: 100%;
  margin-right: -6px;
  cursor: col-resize;
  pointer-events: auto;
  touch-action: none;
}
.column-resize-layer .column-resize-handle::after {
  content: '';
  position: absolute;
  top: 20%;
  right: 5px;
  bottom: 20%;
  width: 1px;
  background: transparent;
  transition: background-color 0.15s ease;
}
.column-resize-layer .column-resize-handle:hover::after,
.column-resize-layer .column-resize-handle.column-resizing::after {
  background: var(--color-primary);
}
body.column-resize-active,
body.column-resize-active * {
  cursor: col-resize !important;
  user-select: none !important;
}
[data-theme="dark"] .column-resize-layer .column-resize-handle::after {
  background: transparent;
}
[data-theme="dark"] .column-resize-layer .column-resize-handle:hover::after,
[data-theme="dark"] .column-resize-layer .column-resize-handle.column-resizing::after {
  background: #7db8ff;
}

/* Узкие флаговые колонки: уменьшаем шрифт и горизонтальные отступы только в режиме ширины. */
#resultTable thead th.header-flag {
  font-size: 9px;
}

#resultTable.column-width-mode thead th.header-flag {
  padding-left: 1px;
  padding-right: 1px;
}

#resultTable.column-width-mode td.report-flag-cell {
  padding-left: 1px;
  padding-right: 1px;
}

/* Месяцы продаж: компактная ширина и единый адаптивный размер значений. */
#resultTable.column-width-mode th.header-sales-monthly,
#resultTable.column-width-mode td.col-sales-monthly {
  padding-left: 1px;
  padding-right: 1px;
}

#resultTable.column-width-mode td.col-sales-monthly {
  font-size: var(--sales-month-font-size, 11px);
  overflow: hidden;
  text-overflow: clip;
}

/* Блок остатков: компактная ширина и единый адаптивный размер значений. */
#resultTable.column-width-mode th.header-ost-group,
#resultTable.column-width-mode td.col-ost-group {
  padding-left: 1px;
  padding-right: 1px;
}

#resultTable.column-width-mode td.col-ost-group {
  font-size: var(--sales-stock-font-size, 11px);
  overflow: hidden;
  text-overflow: clip;
}

/* Финальный каскад компактного режима: отступы и границы входят в ширину ячейки. */
#resultTable.column-width-mode th.header-sales-monthly,
#resultTable.column-width-mode td.col-sales-monthly,
#resultTable.column-width-mode th.header-ost-group,
#resultTable.column-width-mode td.col-ost-group {
  box-sizing: border-box;
  min-width: 0;
  padding-left: 1px !important;
  padding-right: 1px !important;
}

#resultTable.column-width-mode td.col-sales-monthly,
#resultTable.column-width-mode td.col-ost-group {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-size: var(--sales-month-font-size, 11px);
}

#resultTable.column-width-mode td.col-ost-group {
  font-size: var(--sales-stock-font-size, 11px);
}

/* Обычный режим: статичная ширина по значениям, без лишних отступов. */
#resultTable:not(.column-width-mode) {
  table-layout: fixed;
  /* JS writes the exact sum of the visible <col> widths. */
  width: max-content;
  min-width: 0;
  max-width: none;
}

#resultTable:not(.column-width-mode) th,
#resultTable:not(.column-width-mode) td {
  box-sizing: border-box;
  min-width: 0;
  padding-left: 0.5px !important;
  padding-right: 0.5px !important;
}

#resultTable:not(.column-width-mode) th {
  max-width: none;
  font-size: 9px;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: normal;
  text-overflow: clip;
}

#resultTable:not(.column-width-mode) td {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* Единый компактный горизонтальный ритм для всех групп в режиме ширины. */
#resultTable.column-width-mode th,
#resultTable.column-width-mode td {
  box-sizing: border-box;
  min-width: 0;
  padding-left: 1px !important;
  padding-right: 1px !important;
}


/* Компактные ячейки номера и остатков: содержимое не заходит в соседнюю колонку. */
#resultTable td.report-row-number {
  box-sizing: border-box;
  min-width: 0;
  padding-left: 1px !important;
  padding-right: 1px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#resultTable td.report-row-number .collapse-indicator {
  width: 14px;
  height: 14px;
  margin-right: 0;
  font-size: 11px;
  line-height: 14px;
}

#resultTable td.report-row-number .row-number-value {
  display: inline-block;
  white-space: nowrap;
}

/* В обычном режиме остатки должны вести себя так же, как месячные продажи. */
#resultTable:not(.column-width-mode) td.col-ost-group,
#resultTable:not(.column-width-mode) td.col-sales-monthly {
  box-sizing: border-box;
  min-width: 0;
  padding-left: 1px !important;
  padding-right: 1px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}


/* Минимальный отступ слева для значений номенклатуры и склада. */
#resultTable td.col-nomenclature,
#resultTable td.col-warehouse {
  padding-left: 2px !important;
}


/* Compact dashboard layout: keep the action detail in the visible dashboard area. */
.dashboard-stat {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 5px;
  padding: 4px 7px;
}

.dashboard-stat > span {
  flex: 0 0 auto;
  overflow: hidden;
  padding-right: 5px;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat strong {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: baseline;
  gap: 3px;
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat strong .dashboard-stat-context,
.dashboard-stat small {
  font-size: 9px;
}

.dashboard-stat small {
  flex: 0 1 auto;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-list {
  min-width: 0;
}

.dashboard-priority-row {
  padding: 2px 6px;
}

.dashboard-priority-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0;
}

.dashboard-supplier-trigger {
  flex: 0 1 230px;
  min-width: 120px;
  max-width: 230px;
}

.dashboard-priority-bar {
  flex: 0 0 92px;
  width: 92px;
  height: 6px;
  margin: 0 4px 0 8px;
}

.dashboard-priority-meta {
  display: none;
}

.dashboard-priority-meta-item {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 0 7px;
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-value {
  flex: 0 0 auto;
  padding-left: 7px;
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 10px;
}

.dashboard-detail-table {
  min-width: 860px;
  table-layout: fixed;
  font-size: 10px;
}

.dashboard-detail-table th {
  padding: 2px 4px;
  line-height: 1.05;
  white-space: normal;
}

.dashboard-detail-table td {
  padding: 2px 4px;
}

.dashboard-detail-table th:nth-child(1),
.dashboard-detail-table td:nth-child(1) { width: 74px; }
.dashboard-detail-table th:nth-child(2),
.dashboard-detail-table td:nth-child(2) { width: 142px; }
.dashboard-detail-table th:nth-child(3),
.dashboard-detail-table td:nth-child(3) { width: 100px; }
.dashboard-detail-table th:nth-child(4),
.dashboard-detail-table td:nth-child(4) { width: 62px; }
.dashboard-detail-table th:nth-child(5),
.dashboard-detail-table td:nth-child(5),
.dashboard-detail-table th:nth-child(6),
.dashboard-detail-table td:nth-child(6),
.dashboard-detail-table th:nth-child(7),
.dashboard-detail-table td:nth-child(7) { width: 72px; }

.dashboard-warehouse-status {
  gap: 2px;
  font-size: 9px;
}

.dashboard-detail-table .dashboard-status-badge {
  padding: 1px 3px;
  font-size: 9px;
}

/* Final dashboard fit and table alignment fixes. */
.dashboard-ranking-viewport {
  height: 220px;
  max-height: 220px;
}

.dashboard-detail-table th:nth-child(8),
.dashboard-detail-table td:nth-child(8) { width: 82px; }

.dashboard-detail-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-detail-table td:nth-child(3),
.dashboard-detail-table td:nth-child(4),
.dashboard-detail-table td:nth-child(5),
.dashboard-detail-table td:nth-child(6),
.dashboard-detail-table td:nth-child(7),
.dashboard-detail-table td:nth-child(8) {
  text-align: right;
}

.dashboard-detail-table td:nth-child(9) {
  overflow: hidden;
}

.dashboard-warehouse-status {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

.dashboard-warehouse-status > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Номенклатура в SKU поставщика занимает 540px. */
.dashboard-detail-table th:nth-child(3),
.dashboard-detail-table td:nth-child(3) {
  width: 540px;
  min-width: 540px;
  max-width: 540px;
}

/* Supplier action detail: full-width warehouse status line with horizontal scrolling. */
.dashboard-detail-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
}

.dashboard-detail-table {
  width: max-content;
  min-width: 1800px;
  table-layout: auto;
}

.dashboard-detail-table th:nth-child(9),
.dashboard-detail-table td:nth-child(9) {
  width: 1000px;
  min-width: 1000px;
}

.dashboard-detail-table td:nth-child(9) {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.dashboard-detail-table td:nth-child(9) .dashboard-warehouse-status {
  flex: 0 0 auto;
  overflow: visible;
}

/* Supplier risk bars use the same strong status colors as the badges. */
.dashboard-bar-segment.status-no-goods {
  background: #b91c1c;
}

.dashboard-bar-segment.status-deficit {
  background: #dc2626;
}

.dashboard-bar-segment.status-min-stock {
  background: #c2410c;
}

.dashboard-bar-segment.status-avg-stock {
  background: #a16207;
}

.dashboard-bar-segment.status-optimal {
  background: #15803d;
}

.dashboard-bar-segment.status-surplus {
  background: #4f46e5;
}

.dashboard-bar-segment.status-no-sales,
.dashboard-bar-segment.status-neutral {
  background: #64748b;
}

[data-theme="dark"] .dashboard-bar-segment.status-no-goods {
  background: #ff6b6b;
}

[data-theme="dark"] .dashboard-bar-segment.status-deficit {
  background: #ff5252;
}

[data-theme="dark"] .dashboard-bar-segment.status-min-stock {
  background: #ff9f43;
}

[data-theme="dark"] .dashboard-bar-segment.status-avg-stock {
  background: #f5c542;
}

[data-theme="dark"] .dashboard-bar-segment.status-optimal {
  background: #42d77d;
}

[data-theme="dark"] .dashboard-bar-segment.status-surplus {
  background: #8b8ff5;
}

[data-theme="dark"] .dashboard-bar-segment.status-no-sales,
[data-theme="dark"] .dashboard-bar-segment.status-neutral {
  background: #94a3b8;
}

/* Supplier risk bars match the main Излишки / Дефицит column exactly. */
.dashboard-bar-segment.status-no-goods {
  background: rgb(139, 0, 0);
}

.dashboard-bar-segment.status-deficit {
  background: rgb(255, 0, 0);
}

.dashboard-bar-segment.status-min-stock {
  background: rgb(255, 140, 0);
}

.dashboard-bar-segment.status-avg-stock {
  background: rgb(250, 204, 31);
}

.dashboard-bar-segment.status-optimal {
  background: rgb(0, 128, 0);
}

.dashboard-bar-segment.status-surplus {
  background: rgb(83, 106, 194);
}

.dashboard-bar-segment.status-no-sales,
.dashboard-bar-segment.status-neutral {
  background: rgb(160, 160, 160);
}

[data-theme="dark"] .dashboard-bar-segment.status-no-goods {
  background: rgb(139, 0, 0);
}

[data-theme="dark"] .dashboard-bar-segment.status-deficit {
  background: rgb(255, 0, 0);
}

[data-theme="dark"] .dashboard-bar-segment.status-min-stock {
  background: rgb(255, 140, 0);
}

[data-theme="dark"] .dashboard-bar-segment.status-avg-stock {
  background: rgb(250, 204, 31);
}

[data-theme="dark"] .dashboard-bar-segment.status-optimal {
  background: rgb(0, 128, 0);
}

[data-theme="dark"] .dashboard-bar-segment.status-surplus {
  background: rgb(83, 106, 194);
}

[data-theme="dark"] .dashboard-bar-segment.status-no-sales,
[data-theme="dark"] .dashboard-bar-segment.status-neutral {
  background: rgb(160, 160, 160);
}
/* Legacy supplier SKU detail: compact numbered first column. */
.dashboard-legacy-detail-table {
  width: 100%;
  min-width: 1656px;
  table-layout: fixed;
}
.dashboard-legacy-detail-table th:nth-child(1),
.dashboard-legacy-detail-table td:nth-child(1) { width: 32px; text-align: center; }
.dashboard-legacy-detail-table th:nth-child(2),
.dashboard-legacy-detail-table td:nth-child(2) { width: 74px; min-width: 74px; max-width: 74px; }
.dashboard-legacy-detail-table th:nth-child(3),
.dashboard-legacy-detail-table td:nth-child(3) {
  width: 540px;
  min-width: 540px;
  max-width: 540px;
  text-align: left;
}
.dashboard-legacy-detail-table th:nth-child(4),
.dashboard-legacy-detail-table td:nth-child(4) { width: 130px; text-align: left; }
.dashboard-legacy-detail-table th:nth-child(n+5),
.dashboard-legacy-detail-table td:nth-child(n+5) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  text-align: center;
}
.dashboard-legacy-detail-table .dashboard-warehouse-status-cell {
  white-space: nowrap;
}
.dashboard-warehouse-empty {
  color: var(--color-text-muted);
  font-size: 12px;
}
.dashboard-detail-index { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* Revenue mode uses compact KPI/detail columns and one status column per warehouse. */
.dashboard-summary--revenue {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.dashboard-revenue-detail-table {
  width: max-content;
  min-width: 2260px;
  table-layout: fixed;
}
.dashboard-revenue-detail-table th:nth-child(1),
.dashboard-revenue-detail-table td:nth-child(1) {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}
.dashboard-revenue-detail-table th:nth-child(2),
.dashboard-revenue-detail-table td:nth-child(2) {
  width: 540px;
  min-width: 540px;
  max-width: 540px;
  text-align: left;
}
.dashboard-revenue-detail-table th:nth-child(3),
.dashboard-revenue-detail-table td:nth-child(3) {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  text-align: left;
}
.dashboard-revenue-detail-table th:nth-child(4),
.dashboard-revenue-detail-table td:nth-child(4) {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}
.dashboard-revenue-detail-table th:nth-child(5),
.dashboard-revenue-detail-table td:nth-child(5) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
}
.dashboard-revenue-detail-table th:nth-child(6),
.dashboard-revenue-detail-table td:nth-child(6),
.dashboard-revenue-detail-table th:nth-child(7),
.dashboard-revenue-detail-table td:nth-child(7) {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
}
.dashboard-revenue-detail-table th:nth-child(8),
.dashboard-revenue-detail-table td:nth-child(8) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
}
.dashboard-revenue-detail-table th:nth-child(n+9),
.dashboard-revenue-detail-table td:nth-child(n+9) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  text-align: center;
}
.dashboard-revenue-detail-table td:nth-child(8) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-revenue-detail-table .dashboard-warehouse-status-cell {
  white-space: nowrap;
  text-align: center;
}

/* Situation ranking: sortable headers and full-width status scale. */
.dashboard-sort-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.dashboard-sort-button:hover {
  color: var(--color-primary);
}
.dashboard-sort-indicator {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
}
.dashboard-ranking .dashboard-table th:nth-child(2),
.dashboard-ranking .dashboard-table td:nth-child(2) {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}
.dashboard-ranking .dashboard-status-scale-cell {
  padding-left: 5px;
  padding-right: 5px;
}
.dashboard-ranking .dashboard-situation-status-bar {
  display: flex;
  width: 100%;
  height: 8px;
  min-width: 0;
  flex: 0 0 100%;
  margin: 0;
}


/* Excel export: оформление по образцу отчета 1С. */
.dashboard-export-table {
  width: 100%;
  min-width: 1656px;
  border-collapse: collapse;
  border-spacing: 0;
  background: #ffffff;
  color: #333333;
  font-size: 11px;
}
.dashboard-export-table th,
.dashboard-export-table td {
  box-sizing: border-box;
  padding: 4px 6px;
  border: 0.5px solid #b7a65a;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.dashboard-export-table th {
  background: rgb(251, 225, 81);
  border-color: #a99a4f;
  color: #333333;
  font-weight: 700;
  text-align: center;
}
.dashboard-export-table th.dashboard-export-warehouse-header {
  background: rgb(251, 225, 81);
}
.dashboard-export-table th:nth-child(4),
.dashboard-export-table td:nth-child(4) {
  width: 16cm;
  min-width: 16cm;
  max-width: 16cm;
}
.dashboard-export-table tr.dashboard-export-supplier-row td {
  background: #fff6c9;
  border-top-color: #a99a4f;
  border-bottom-color: #a99a4f;
  color: #333333;
  font-weight: 700;
}
.dashboard-export-table tr.dashboard-export-sku-row td {
  background: transparent;
  border-color: #c8bb7b;
  color: #333333;
}
.dashboard-export-table tr.dashboard-export-sku-row td:nth-child(4) {
  font-weight: 600;
}
.dashboard-export-table td.dashboard-export-status-cell {
  font-weight: 700;
}
.dashboard-export-table td.status-no-goods { color: rgb(139, 0, 0) !important; }
.dashboard-export-table td.status-deficit { color: rgb(255, 0, 0) !important; }
.dashboard-export-table td.status-min-stock { color: rgb(255, 140, 0) !important; }
.dashboard-export-table td.status-avg-stock { color: rgb(180, 145, 0) !important; }
.dashboard-export-table td.status-optimal { color: rgb(0, 128, 0) !important; }
.dashboard-export-table td.status-surplus { color: rgb(83, 106, 194) !important; }
.dashboard-export-table td.status-no-sales,
.dashboard-export-table td.status-neutral { color: rgb(160, 160, 160) !important; }
.dashboard-export-table td.dashboard-export-number-zero {
  color: #333333 !important;
  font-weight: 400 !important;
}


/* Keep revenue dashboard tables the same size as supplier situation mode. */
.supplier-dashboard.supplier-dashboard--revenue .dashboard-ranking-viewport {
  height: 220px;
  max-height: 220px;
}
.supplier-dashboard.supplier-dashboard--revenue .dashboard-detail-table-wrap {
  height: 100px;
  max-height: 100px;
}

/* Цена - фон шапки такой же, как у Выручки. */
.header-price {
  background-color: rgb(102, 205, 170) !important;
  color: #102a25 !important;
  border-color: rgb(102, 205, 170) !important;
}
[data-theme="dark"] .header-price {
  background-color: rgb(102, 205, 170) !important;
  color: #102a25 !important;
  border-color: rgb(102, 205, 170) !important;
  opacity: 1 !important;
}
.col-price {
  font-variant-numeric: tabular-nums;
  color: rgb(141, 141, 141) !important;
}

/* БРИФ - тёмно-синий фон шапки по спецификации отчёта. */
.header-brief {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
}
[data-theme="dark"] .header-brief {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
  opacity: 1 !important;
}

/* БРИФ перемещение - тот же фон шапки, что и у БРИФ. */
.header-brief-transfer {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
}
[data-theme="dark"] .header-brief-transfer {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
  opacity: 1 !important;
}
.col-brief-transfer {
  font-variant-numeric: tabular-nums;
}

/* Проверочные колонки БРИФ - единый фон с БРИФ заказом. */
.header-brief-check {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
}
[data-theme="dark"] .header-brief-check {
  background-color: rgb(50, 80, 137) !important;
  color: #ffffff !important;
  border-color: rgb(50, 80, 137) !important;
  opacity: 1 !important;
}
.col-brief-check {
  font-variant-numeric: tabular-nums;
}


/* Сводка по SKU рядом с рейтингом поставщиков. */
.dashboard-situation-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.dashboard-situation-layout .dashboard-ranking {
  min-width: 0;
}

.dashboard-situation-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.dashboard-status-summary,
.dashboard-sku-summary {
  width: 238px;
}

.dashboard-status-summary {
  --status-no-goods-color: var(--bordo);
  --status-deficit-color: var(--red);
  --status-min-stock-color: var(--orange);
  --status-avg-stock-color: var(--yellow);
  --status-optimal-color: var(--green);
  --status-surplus-color: var(--blue);
  --status-no-sales-color: var(--gray);
  --status-neutral-color: var(--gray);
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
}

.dashboard-status-summary__title {
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-status-summary__body {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-status-summary__chart {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  flex: 0 0 104px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--dashboard-status-chart, var(--status-neutral-color) 0 100%));
}

.dashboard-status-summary__chart::after {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--color-card);
  content: '';
}

.dashboard-status-summary__center {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: 58px;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.05;
}

.dashboard-status-summary__center strong {
  color: var(--color-text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.dashboard-status-summary__center span {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 9px;
}

.dashboard-status-summary__legend {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
  margin: 0;
  padding: 0;
  padding-left: 10px;
  list-style: none;
}

.dashboard-status-summary__legend li {
  display: grid;
  min-width: 0;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.2;
}

.dashboard-status-summary__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-neutral-color);
}

.dashboard-status-summary__dot.status-no-goods { background: var(--status-no-goods-color); }
.dashboard-status-summary__dot.status-deficit { background: var(--status-deficit-color); }
.dashboard-status-summary__dot.status-min-stock { background: var(--status-min-stock-color); }
.dashboard-status-summary__dot.status-avg-stock { background: var(--status-avg-stock-color); }
.dashboard-status-summary__dot.status-optimal { background: var(--status-optimal-color); }
.dashboard-status-summary__dot.status-surplus { background: var(--status-surplus-color); }
.dashboard-status-summary__dot.status-no-sales { background: var(--status-no-sales-color); }

.dashboard-status-summary__legend .dashboard-status-summary__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-status-summary__legend li strong {
  color: var(--color-text);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}


.dashboard-situation-main {
  min-width: 0;
}

.supplier-dashboard .dashboard-scope {
  display: none;
}

.dashboard-sku-summary {
  min-width: 180px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
}

.dashboard-sku-summary__title {
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-sku-summary__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  color: var(--color-text-muted);
  font-size: 11px;
}

.dashboard-sku-summary__total strong {
  color: var(--color-primary);
  font-size: 18px;
  line-height: 1;
}

.dashboard-sku-summary__subtitle {
  margin: 6px 0 3px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}

.dashboard-sku-summary__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.dashboard-sku-summary__list::before,
.dashboard-sku-summary__list::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(148, 163, 184, 0.34);
  content: '';
  pointer-events: none;
}

.dashboard-sku-summary__list::before {
  left: 33.333%;
}

.dashboard-sku-summary__list::after {
  left: 66.666%;
}

.dashboard-sku-summary__list li {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  color: var(--color-text-muted);
  font-size: 10px;
  line-height: 1.35;
}

.dashboard-sku-summary__list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-sku-summary__list strong {
  flex: 0 0 auto;
  color: var(--color-text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

/* Таблица остаётся читаемой: ширина колонок определяется содержимым, длинные данные прокручиваются. */
.dashboard-situation-layout .dashboard-ranking .dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-situation-layout .dashboard-ranking .dashboard-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.dashboard-situation-layout .dashboard-ranking .dashboard-table th,
.dashboard-situation-layout .dashboard-ranking .dashboard-table td {
  width: auto;
  max-width: none;
}

.dashboard-situation-layout .dashboard-ranking .dashboard-table th:nth-child(2),
.dashboard-situation-layout .dashboard-ranking .dashboard-table td:nth-child(2) {
  width: 200px;
  min-width: 200px;
}

.dashboard-situation-layout .dashboard-ranking .dashboard-supplier-trigger {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.supplier-dashboard.supplier-dashboard--revenue .dashboard-sku-summary {
  display: none;
}

.supplier-dashboard.supplier-dashboard--revenue .dashboard-situation-layout {
  display: block;
}

@media (max-width: 720px) {
  .dashboard-sku-summary__list::before,
  .dashboard-sku-summary__list::after {
    display: none;
  }

  .dashboard-situation-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-sku-summary {
    min-width: 0;
  }
}


/* Единая панель: в каждой плашке склада спидометр и доли статусов 2×4. */
.dashboard-situation-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.dashboard-situation-overview {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  align-self: start;
}

.dashboard-warehouse-analytics {
  display: block;
  grid-column: 2;
  grid-row: 1;
  width: min(calc(100% + 248px), 606px);
  min-width: 0;
  height: auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
  align-self: stretch;
  justify-self: start;
}

.dashboard-warehouse-stock {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding: 8px;
}

.dashboard-warehouse-stock__title {
  flex: 0 0 auto;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-warehouse-stock__grid {
  display: grid;
  flex: 1 1 auto;
  height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 5px;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.dashboard-warehouse-stock__tile {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  padding: 3px 4px 2px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}

.dashboard-warehouse-stock__tile--primary {
  grid-column: span 2;
}

.dashboard-warehouse-stock__name {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  overflow: hidden;
  margin-bottom: 1px;
  color: var(--color-text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-warehouse-stock__name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-warehouse-stock__name strong {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.dashboard-warehouse-stock__tile-body {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(48px, 0.9fr) minmax(0, 1.4fr);
  gap: 3px;
  min-width: 0;
  min-height: 0;
  align-items: center;
}

.dashboard-warehouse-stock__gauge {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dashboard-warehouse-stock__gauge > svg {
  width: 100%;
  max-width: 94px;
  max-height: 100%;
  height: auto;
}

.dashboard-warehouse-stock__tile--primary .dashboard-warehouse-stock__gauge > svg {
  max-width: 108px;
}

.dashboard-warehouse-stock__status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 1px 5px;
  min-width: 0;
  min-height: 0;
  align-items: center;
}

.dashboard-warehouse-stock__status-item {
  display: grid;
  min-width: 0;
  grid-template-columns: 5px minmax(0, 1fr) max-content;
  align-items: center;
  justify-content: start;
  gap: 5px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-warehouse-stock__status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.dashboard-warehouse-stock__status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-warehouse-stock__status-item strong {
  min-width: max-content;
  justify-self: end;
  text-align: right;
  color: var(--color-text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-warehouse-stock__empty {
  color: var(--color-text-muted);
  font-size: 11px;
}

.dashboard-situation-overview > .dashboard-situation-sidebar {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  align-self: start;
}

@media (max-width: 1100px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-situation-overview {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .dashboard-warehouse-analytics {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .dashboard-situation-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-situation-overview > .dashboard-situation-sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .dashboard-status-summary,
  .dashboard-sku-summary {
    width: auto;
  }

  .dashboard-warehouse-analytics {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    height: auto !important;
    max-height: none;
  }

  .dashboard-warehouse-stock {
    width: 100%;
    height: 300px;
  }

  .dashboard-warehouse-stock__grid {
    flex: 0 0 auto;
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(8, minmax(0, 1fr));
  }

  .dashboard-warehouse-stock__tile--primary {
    grid-column: span 1;
  }
}


/* Финальная компоновка dashboard: рейтинг не пересекается с левой сводкой. */
.dashboard-situation-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 8px;
}

.dashboard-warehouse-analytics {
  width: 100%;
}

.dashboard-situation-main {
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
}

.dashboard-situation-main .dashboard-summary:not(.dashboard-summary--revenue) {
  grid-template-columns: repeat(4, max-content) minmax(0, 1fr);
  min-width: 0;
}

.dashboard-situation-main .dashboard-ranking {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table th,
.dashboard-situation-main .dashboard-ranking .dashboard-table td {
  box-sizing: border-box;
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  padding: 3px 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table th {
  font-size: 9px;
  line-height: 1.1;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table td {
  font-size: 10px;
}

.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(1),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(1) { width: 18%; }
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(2),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(2) { width: 18%; min-width: 0; max-width: none; }
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(3),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(3) { width: 7%; }
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(4),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(4),
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(5),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(5),
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(6),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(6) { width: 8%; }
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(7),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(7) { width: 21%; }
.dashboard-situation-main .dashboard-ranking .dashboard-table th:nth-child(8),
.dashboard-situation-main .dashboard-ranking .dashboard-table td:nth-child(8) { width: 12%; }

.dashboard-situation-main .dashboard-ranking .dashboard-supplier-trigger {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Типографика складской панели выровнена с карточкой «Статусы». */
.dashboard-warehouse-stock,
.dashboard-warehouse-stock__title,
.dashboard-warehouse-stock__name,
.dashboard-warehouse-stock__status-item {
  font-family: inherit;
}

.dashboard-warehouse-stock__title {
  font-size: 12px;
}

.dashboard-warehouse-stock__name {
  font-size: 11px;
}

.dashboard-warehouse-stock__status-item,
.dashboard-warehouse-stock__status-item strong {
  font-size: 11px;
}

@media (max-width: 1100px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-situation-main {
    width: 100%;
  }
}


/* Полные названия статусов и разделение двух колонок 2×4. */
.dashboard-situation-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.dashboard-warehouse-analytics {
  width: 100%;
}

.dashboard-warehouse-stock__status-grid {
  position: relative;
  padding: 1px 0;
}

.dashboard-warehouse-stock__status-grid::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 104px;
  width: 1px;
  background: rgba(148, 163, 184, 0.42);
  content: '';
  pointer-events: none;
}

.dashboard-warehouse-stock__status-item {
  position: relative;
  z-index: 1;
  overflow: visible;
  line-height: 1.05;
  white-space: normal;
}

.dashboard-warehouse-stock__status-label {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: normal;
}

@media (max-width: 1100px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Финальная настройка складских плашек: одна строка статуса и компактный спидометр. */
.dashboard-situation-layout {
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
}

.dashboard-warehouse-stock__tile-body {
  grid-template-columns: minmax(94px, 0.36fr) 220px;
  column-gap: 3px;
  align-items: stretch;
}

.dashboard-warehouse-stock__tile--primary .dashboard-warehouse-stock__tile-body {
  grid-template-columns: minmax(108px, 0.36fr) 220px;
}

.dashboard-warehouse-stock__gauge {
  justify-content: flex-start;
}

.dashboard-warehouse-stock__status-grid {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  height: 100%;
  box-sizing: border-box;
  grid-template-columns: repeat(2, 106px);
  column-gap: 8px;
  justify-content: start;
  align-self: stretch;
}

.dashboard-warehouse-stock__status-item {
  width: 106px;
  min-width: 106px;
  max-width: 106px;
  box-sizing: border-box;
  grid-template-columns: 5px minmax(0, 1fr) max-content;
  gap: 3px;
  overflow: hidden;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-warehouse-stock__status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Внутри панели используется единый компактный размер текста. */
.dashboard-warehouse-stock,
.dashboard-warehouse-stock * {
  font-size: 10px;
}

.dashboard-warehouse-stock__gauge,
.dashboard-warehouse-stock__status-grid {
  height: 100%;
  align-self: stretch;
}

.dashboard-warehouse-stock__gauge {
  align-items: center;
}

.dashboard-warehouse-stock__gauge svg text {
  font-size: 10px !important;
}

.dashboard-warehouse-stock__title {
  font-size: 12px;
}

.dashboard-warehouse-stock__name,
.dashboard-warehouse-stock__name strong,
.dashboard-warehouse-stock__status-item,
.dashboard-warehouse-stock__status-item strong,
.dashboard-warehouse-stock__empty {
  font-size: 10px;
}

/* На широком экране даём легенде дополнительное место, не меняя мобильную раскладку. */
@media (min-width: 1101px) {
  .dashboard-warehouse-analytics {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 1100px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Keep supplier ranking aligned with warehouse stock panel. */
@media (min-width: 761px) {
  .dashboard-situation-layout {
    align-items: stretch;
  }

  .dashboard-situation-overview,
  .dashboard-situation-main {
    align-self: stretch;
    min-height: 0;
  }

  .dashboard-situation-main {
    display: flex;
    height: 100%;
    flex-direction: column;
  }

  .dashboard-situation-main > #dashboardSummary {
    flex: 0 0 auto;
  }

  .dashboard-situation-main > #dashboardRanking {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .dashboard-situation-main > #dashboardRanking .dashboard-ranking {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .dashboard-situation-main > #dashboardRanking .dashboard-ranking-viewport {
    min-height: 0;
    height: auto;
    max-height: none;
    flex: 1 1 auto;
  }
}


/* Keep the wider warehouse stock panel inside its own dashboard column. */
@media (min-width: 1101px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .dashboard-situation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Prevent warehouse status percentages from overflowing narrow tiles. */
.dashboard-warehouse-stock__tile-body {
  grid-template-columns: minmax(94px, 0.36fr) minmax(0, 1fr);
}

.dashboard-warehouse-stock__tile--primary .dashboard-warehouse-stock__tile-body {
  grid-template-columns: minmax(108px, 0.36fr) minmax(0, 1fr);
}

.dashboard-warehouse-stock__status-grid {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-warehouse-stock__status-item {
  width: auto;
  min-width: 0;
  max-width: none;
}


/* Warehouse stock cards: single-column status legend. */
.dashboard-warehouse-stock {
  padding: 16px;
  overflow: auto;
}

.dashboard-warehouse-stock__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  grid-template-rows: none;
  grid-auto-rows: auto;
  gap: 16px;
  height: auto;
  align-content: start;
  overflow: visible;
}

.dashboard-warehouse-stock__tile {
  display: grid;
  grid-template-areas:
    "header header"
    "gauge legend"
    "value value";
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr);
  grid-template-rows: auto minmax(130px, 1fr) auto;
  gap: 12px 16px;
  min-width: 0;
  min-height: 250px;
  height: auto;
  padding: 16px;
  overflow: visible;
  box-sizing: border-box;
  border: 1px solid rgba(100, 116, 139, 0.42);
  border-radius: 10px;
  background: var(--color-card, rgba(148, 163, 184, 0.08));
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.dashboard-warehouse-stock__tile--primary {
  grid-column: span 2;
}

.dashboard-warehouse-stock__name {
  grid-area: header;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.dashboard-warehouse-stock__name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-warehouse-stock__name strong {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-warehouse-stock__count-label {
  color: var(--color-text-muted);
  font-weight: 500;
}

.dashboard-warehouse-stock__tile-body {
  display: contents;
}

.dashboard-warehouse-stock__gauge {
  grid-area: gauge;
  display: flex;
  width: 100%;
  min-width: 100px;
  min-height: 100px;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.dashboard-warehouse-stock__gauge > svg {
  display: block;
  width: min(120px, 100%);
  min-width: 100px;
  max-width: 120px;
  height: auto;
}

.dashboard-warehouse-stock__tile--primary .dashboard-warehouse-stock__gauge > svg {
  max-width: 120px;
}

.dashboard-warehouse-stock__gauge-value {
  grid-area: value;
  width: 50%;
  justify-self: start;
  margin-top: -4px;
  color: var(--color-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dashboard-warehouse-stock__status-grid {
  grid-area: legend;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  min-height: 100px;
  align-items: center;
  align-content: center;
}

.dashboard-warehouse-stock__status-item {
  display: grid;
  width: auto;
  min-width: 0;
  grid-template-columns: 6px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 6px;
  overflow: visible;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.dashboard-warehouse-stock__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dashboard-warehouse-stock__status-label {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.dashboard-warehouse-stock__status-item strong {
  min-width: max-content;
  justify-self: end;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .dashboard-warehouse-stock__tile--primary {
    grid-column: span 1;
  }

  .dashboard-warehouse-stock__tile {
    grid-template-columns: minmax(100px, 1fr) minmax(120px, 1fr);
  }
}

@media (max-width: 480px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-warehouse-stock__tile {
    grid-template-columns: minmax(100px, 1fr) minmax(0, 1fr);
    padding: 12px;
  }
}


/* Dashboard views: supplier ranking is a separate full-width tab. */
.supplier-dashboard--situation .dashboard-situation-main {
  display: none;
}

.supplier-dashboard--situation .dashboard-situation-layout {
  display: block;
}

.supplier-dashboard--situation .dashboard-situation-overview {
  display: block;
}

.supplier-dashboard--situation .dashboard-warehouse-analytics {
  width: 100%;
  max-height: none;
  overflow: visible;
}

.supplier-dashboard--situation .dashboard-situation-sidebar {
  margin-top: 16px;
}

.supplier-dashboard--ranking .dashboard-situation-overview,
.supplier-dashboard--revenue .dashboard-situation-overview {
  display: none;
}

.supplier-dashboard--ranking .dashboard-situation-layout,
.supplier-dashboard--revenue .dashboard-situation-layout {
  display: block;
}

.supplier-dashboard--ranking .dashboard-situation-main,
.supplier-dashboard--revenue .dashboard-situation-main {
  display: flex;
  width: 100%;
}

/* Eight warehouse cards: four equal columns on desktop, without an internal scroll. */
.dashboard-warehouse-stock {
  height: auto;
  max-height: none;
  overflow: visible;
}

.dashboard-warehouse-stock__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: none;
  grid-auto-rows: auto;
  height: auto;
  overflow: visible;
}

.dashboard-warehouse-stock__tile {
  grid-template-columns: minmax(100px, 1fr) minmax(0, 1fr);
}

.dashboard-warehouse-stock__tile--primary {
  grid-column: auto;
}

@media (max-width: 900px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Final warehouse layout fix: status summary stays in normal document flow. */
.supplier-dashboard--situation .dashboard-situation-overview {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
}

.supplier-dashboard--situation .dashboard-warehouse-analytics {
  position: relative;
  grid-column: auto;
  grid-row: auto;
  flex: 0 0 auto;
  width: 100%;
  height: auto !important;
  max-height: none;
  overflow: visible;
}

.supplier-dashboard--situation .dashboard-situation-sidebar {
  position: relative;
  display: flex;
  width: 100%;
  flex: 0 0 auto;
  margin-top: 0;
  flex-direction: column;
  gap: 12px;
  z-index: auto;
}

.supplier-dashboard--situation .dashboard-status-summary,
.supplier-dashboard--situation .dashboard-sku-summary {
  position: relative;
  width: 100%;
  z-index: auto;
}

.supplier-dashboard--situation .dashboard-warehouse-stock {
  position: relative;
  height: auto !important;
  max-height: none;
  overflow: visible;
}

.dashboard-warehouse-stock__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, 190px);
  grid-auto-rows: 190px;
  gap: 12px;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.dashboard-warehouse-stock__tile {
  min-height: 190px;
  height: 190px;
  padding: 12px;
  gap: 8px 12px;
  grid-template-rows: auto minmax(80px, 1fr) auto;
}

.dashboard-warehouse-stock__gauge {
  min-width: 80px;
  min-height: 80px;
}

.dashboard-warehouse-stock__gauge > svg {
  width: min(100px, 100%);
  min-width: 80px;
  max-width: 100px;
}

.dashboard-warehouse-stock__gauge-value {
  font-size: 17px;
}

.dashboard-warehouse-stock__status-grid {
  min-height: 80px;
  gap: 4px;
}

.dashboard-warehouse-stock__status-item {
  font-size: 11px;
  line-height: 1.2;
  gap: 5px;
}

@media (max-width: 900px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, 190px);
    grid-auto-rows: 190px;
  }
}

@media (max-width: 480px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(8, 190px);
    grid-auto-rows: 190px;
  }
}


/* Restore the original two-column overview: sidebar left, warehouse stock right. */
.supplier-dashboard--situation .dashboard-situation-overview {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  min-height: 0;
}

.supplier-dashboard--situation .dashboard-warehouse-analytics {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: auto !important;
  max-height: none;
  overflow: visible;
}

.supplier-dashboard--situation .dashboard-situation-sidebar {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  width: 238px;
  margin: 0;
  flex-direction: column;
  gap: 10px;
  z-index: auto;
}

.supplier-dashboard--situation .dashboard-status-summary,
.supplier-dashboard--situation .dashboard-sku-summary {
  position: relative;
  width: 238px;
  z-index: auto;
}

/* Compact warehouse panel: two rows remain inside the panel without scrolling. */
.supplier-dashboard--situation .dashboard-warehouse-stock {
  position: relative;
  height: auto !important;
  max-height: none;
  overflow: visible;
}

.dashboard-warehouse-stock__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, 160px);
  grid-auto-rows: 160px;
  gap: 10px;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.dashboard-warehouse-stock__tile {
  min-height: 160px;
  height: 160px;
  padding: 8px;
  gap: 6px 8px;
  grid-template-rows: auto minmax(72px, 1fr) auto;
}

.dashboard-warehouse-stock__name {
  padding-bottom: 4px;
  font-size: 12px;
}

.dashboard-warehouse-stock__name strong {
  font-size: 11px;
}

.dashboard-warehouse-stock__gauge {
  min-width: 72px;
  min-height: 72px;
}

.dashboard-warehouse-stock__gauge > svg {
  width: min(80px, 100%);
  min-width: 72px;
  max-width: 80px;
}

.dashboard-warehouse-stock__gauge-value {
  font-size: 16px;
}

.dashboard-warehouse-stock__status-grid {
  min-height: 72px;
  gap: 3px;
}

.dashboard-warehouse-stock__status-item {
  grid-template-columns: 5px minmax(0, 1fr) max-content;
  font-size: 10px;
  line-height: 1.1;
  gap: 4px;
}

@media (max-width: 900px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, 160px);
    grid-auto-rows: 160px;
  }
}

@media (max-width: 760px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics,
  .supplier-dashboard--situation .dashboard-situation-sidebar {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  .supplier-dashboard--situation .dashboard-status-summary,
  .supplier-dashboard--situation .dashboard-sku-summary {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .dashboard-warehouse-stock__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(8, 160px);
    grid-auto-rows: 160px;
  }
}


/* Fit warehouse cards to the actual height of the left sidebar. */
.supplier-dashboard--situation .dashboard-warehouse-analytics {
  align-self: stretch;
  min-height: 0;
}

.supplier-dashboard--situation .dashboard-warehouse-stock {
  display: flex;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  padding: 6px;
  box-sizing: border-box;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__title {
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__grid {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 6px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__tile {
  min-height: 0;
  height: 100%;
  padding: 5px;
  gap: 3px 6px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__name {
  padding-bottom: 2px;
  font-size: 11px;
  line-height: 1;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__name strong {
  font-size: 9px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge {
  min-width: 60px;
  min-height: 0;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge > svg {
  width: min(90px, 100%);
  min-width: 90px;
  max-width: 95px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge-value {
  font-size: 14px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
  min-height: 0;
  gap: 1px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-item {
  grid-template-columns: 4px minmax(0, 1fr) max-content;
  font-size: 9px;
  line-height: 1;
  gap: 3px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-dot {
  width: 4px;
  height: 4px;
}


/* Compact horizontal warehouse layout: fixed content-sized columns. */
@media (min-width: 901px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: 238px max-content;
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics,
  .supplier-dashboard--situation .dashboard-warehouse-stock {
    width: max-content;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    width: max-content;
    max-width: 100%;
    grid-template-columns: repeat(4, 160px);
    gap: 6px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: 160px;
    grid-template-columns: 58px 86px;
    gap: 3px 6px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge {
    width: 58px;
    min-width: 58px;
    max-width: 58px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge > svg {
    width: 58px;
    min-width: 54px;
    max-width: 58px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
    width: 86px;
    min-width: 86px;
    max-width: 86px;
  }
}

@media (max-width: 900px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics,
  .supplier-dashboard--situation .dashboard-warehouse-stock {
    width: 100%;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: 100%;
    grid-template-columns: minmax(58px, 0.7fr) minmax(0, 1fr);
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge,
  .supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}


/* Final inner-card alignment: one padding scale and contained separators. */
.supplier-dashboard--situation .dashboard-warehouse-stock,
.supplier-dashboard--situation .dashboard-warehouse-stock__tile,
.supplier-dashboard--situation .dashboard-warehouse-stock__gauge,
.supplier-dashboard--situation .dashboard-warehouse-stock__status-grid,
.supplier-dashboard--situation .dashboard-warehouse-stock__gauge-value {
  padding: 5px;
  box-sizing: border-box;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__tile {
  grid-template-areas:
    "header header"
    "gauge legend";
  grid-template-rows: auto minmax(0, 1fr);
}

.supplier-dashboard--situation .dashboard-warehouse-stock__name {
  padding: 0 0 4px;
  font-size: 11px;
  line-height: 1;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__name strong {
  margin-right: 4px;
  font-size: 11px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge-value {
  width: 100%;
  margin-top: -8px;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
  grid-area: legend;
  min-height: 0;
  align-self: stretch;
  gap: 1px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-grid::before {
  top: 5px;
  bottom: 5px;
  left: 0;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-item {
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  line-height: 1;
  gap: 3px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 901px) {
  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(4, 176px);
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: 176px;
    grid-template-columns: 70px 90px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge > svg {
    width: 60px;
    min-width: 56px;
    max-width: 60px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
  }
}


/* Final status readability and gauge/value alignment. */
.supplier-dashboard--situation .dashboard-warehouse-stock__status-item,
.supplier-dashboard--situation .dashboard-warehouse-stock__status-item strong,
.supplier-dashboard--situation .dashboard-warehouse-stock__status-label {
  font-size: 11px;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-item {
  overflow: visible;
  line-height: 1.05;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__status-label {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.supplier-dashboard--situation .dashboard-warehouse-stock__gauge-value {
  position: relative;
  z-index: 2;
  margin-top: -10px;
  font-size: 15px;
}

@media (min-width: 901px) {
  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(4, 216px);
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: 216px;
    grid-template-columns: 90px 110px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__gauge > svg {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__status-grid {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
  }
}


/* Warehouse stock cards background. */
.supplier-dashboard--situation .dashboard-warehouse-stock__tile {
  background: rgb(255 255 255 / 4%);
}


/* Both supplier rankings use the same compact row size and typography. */
.supplier-dashboard--ranking .dashboard-situation-main .dashboard-ranking .dashboard-table td,
.supplier-dashboard--revenue #dashboardRanking .dashboard-priority-line {
  font-size: 10px;
  line-height: 1.2;
}

/* Revenue risk ranking shows ten fixed-height rows before scrolling. */
.supplier-dashboard--revenue #dashboardRanking .dashboard-ranking-viewport {
  height: 222px;
  max-height: 222px;
}

.supplier-dashboard--revenue #dashboardRanking .dashboard-priority-row {
  box-sizing: border-box;
  height: 22px;
  padding: 3px 4px;
}

.supplier-dashboard--revenue #dashboardRanking .dashboard-priority-meta-item {
  font-size: 10px;
  line-height: 1.2;
}

.supplier-dashboard--revenue #dashboardRanking .dashboard-priority-bar {
  height: 8px;
}



/* Денежная карточка товарного запаса в ситуации по поставщикам. */
.supplier-dashboard--situation .dashboard-product-stock {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.035);
}

.dashboard-product-stock__title {
  flex: 0 0 auto;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-product-stock__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 6px;
}

.dashboard-product-stock__split > div {
  min-width: 0;
}

.dashboard-product-stock__split > div:last-child {
  text-align: right;
}

.dashboard-product-stock__split span {
  display: block;
  margin-bottom: 2px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}

.dashboard-product-stock__split strong {
  display: block;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

.dashboard-product-stock__separator {
  height: 1px;
  flex: 0 0 auto;
  margin: 7px 0 6px;
  background: rgba(148, 163, 184, 0.22);
}

.dashboard-product-stock__details {
  display: grid;
  grid-template-columns: max-content auto auto;
  gap: 4px 10px;
  align-items: baseline;
  min-width: 0;
}

.dashboard-product-stock__metric {
  display: contents;
}

.dashboard-product-stock__metric > span {
  color: var(--color-text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-product-stock__metric > strong {
  color: var(--color-text);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.dashboard-product-stock__metric small {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .supplier-dashboard--situation .dashboard-product-stock {
    grid-column: 1;
    grid-row: auto;
    height: auto;
    max-height: none;
  }
}


/* На широком экране товарный запас стоит справа от складского запаса. */
@media (min-width: 1200px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: 238px minmax(0, 1fr) minmax(320px, 360px);
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics {
    grid-column: 2;
    grid-row: 1;
  }

  .supplier-dashboard--situation .dashboard-product-stock {
    grid-column: 3;
    grid-row: 1;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: auto;
  }
}

@media (min-width: 1700px) {
  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* Компактная строка: товарный запас сразу после запаса по складам. */
@media (min-width: 1200px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: 238px max-content max-content;
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics,
  .supplier-dashboard--situation .dashboard-warehouse-stock {
    width: max-content;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    width: max-content;
    max-width: 100%;
    grid-template-columns: repeat(2, 216px);
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__tile {
    width: 216px;
  }

  .supplier-dashboard--situation .dashboard-product-stock {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    justify-self: start;
  }
}

@media (min-width: 1700px) {
  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(4, 216px);
  }
}

/* Разделители между секциями и более компактные отступы карточки. */
.supplier-dashboard--situation .dashboard-product-stock {
  padding: 7px 8px;
}

.supplier-dashboard--situation .dashboard-product-stock__split {
  margin-top: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.supplier-dashboard--situation .dashboard-product-stock__separator {
  display: none;
}

.supplier-dashboard--situation .dashboard-product-stock__details {
  padding-top: 7px;
}


.supplier-dashboard--situation .dashboard-product-stock__dead-title {
  margin: 0 0 1px;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-title span {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 500;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-details {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 4px;
  align-items: baseline;
  min-width: 0;
  color: var(--color-text-muted);
  font-size: 10px;
  line-height: 1.15;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > strong {
  color: var(--color-text);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > .dashboard-product-stock__dead-qty {
  padding-right: 4px;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
}

/* Уменьшаем вертикальные интервалы, чтобы весь раздел помещался в прежнюю высоту. */
.supplier-dashboard--situation .dashboard-product-stock__title {
  margin-bottom: 3px;
}

.supplier-dashboard--situation .dashboard-product-stock__split {
  gap: 4px;
  margin-top: 4px;
  padding-bottom: 4px;
}

.supplier-dashboard--situation .dashboard-product-stock__split strong {
  font-size: 12px;
}

.supplier-dashboard--situation .dashboard-product-stock__details {
  gap: 1px 4px;
  padding-top: 4px;
}

.supplier-dashboard--situation .dashboard-product-stock__metric > span,
.supplier-dashboard--situation .dashboard-product-stock__metric > strong {
  font-size: 10px;
  line-height: 1.1;
}

.supplier-dashboard--situation .dashboard-product-stock__metric > strong:first-of-type {
  padding-right: 10px;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
}


/* Равномерно заполняем карточку по высоте, не оставляя пустого места снизу. */
.supplier-dashboard--situation .dashboard-product-stock {
  justify-content: space-between;
}

.supplier-dashboard--situation .dashboard-product-stock__details {
  row-gap: 5px;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-section {
  flex: 0 0 auto;
  min-width: 0;
}

/* Неликвид выровнен той же сеткой: подпись, количество, стоимость. */
.supplier-dashboard--situation .dashboard-product-stock__dead-details {
  grid-template-columns: max-content auto auto;
  gap: 1px 10px;
  align-items: baseline;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row {
  display: contents;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > strong {
  text-align: right;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row--total > strong {
  color: rgb(178, 34, 34);
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row > .dashboard-product-stock__dead-qty {
  padding-right: 10px;
}


/* Внутренняя плашка для шести операционных показателей товарного запаса. */
.supplier-dashboard--situation .dashboard-product-stock__metrics-plaque {
  flex: 0 0 auto;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-top: 0;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}

.supplier-dashboard--situation .dashboard-product-stock__metrics-plaque .dashboard-product-stock__split {
  margin-top: 0;
}

.supplier-dashboard--situation .dashboard-product-stock__metrics-plaque .dashboard-product-stock__details {
  padding-top: 5px;
}

/* Три показателя товарного запаса с вертикальными разделителями. */
.supplier-dashboard--situation .dashboard-product-stock__split {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.45fr) minmax(0, 0.85fr);
}

.supplier-dashboard--situation .dashboard-product-stock__split > div:not(:last-child) {
  padding-right: 4px;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
}

/* Заголовки и значения товарного запаса идут отдельными, выровненными строками. */
.supplier-dashboard--situation .dashboard-product-stock__split {
  grid-template-columns: minmax(72px, 1.05fr) minmax(128px, 1.75fr) minmax(50px, 0.7fr);
  column-gap: 6px;
  align-items: stretch;
}

.supplier-dashboard--situation .dashboard-product-stock__split > div {
  display: grid;
  grid-template-rows: 22px auto auto;
  align-content: start;
  min-width: 0;
}

.supplier-dashboard--situation .dashboard-product-stock__split > div > span {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  height: 22px;
  margin-bottom: 0;
  padding-bottom: 3px;
  border-bottom: 0;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__split > div > strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Настройки: три секции в одну линию, одинаковая высота и компактная вертикальная раскладка статусов. */
.settings-panel {
  width: min(100%, 1500px);
  max-height: min(72vh, 640px);
  overflow-y: auto;
  padding: 8px;
}

.settings-panel.visible,
.settings-panel:not(.hidden) {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: stretch;
  gap: 6px;
}

.settings-header {
  grid-column: 1 / -1;
  margin-bottom: 0;
  padding-bottom: 5px;
}

.settings-section {
  min-width: 0;
  padding: 7px 8px;
}

.settings-section + .settings-section {
  margin-top: 0;
}

.settings-section-title {
  margin-bottom: 4px;
  padding-bottom: 3px;
}

#deliverySettings.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 4px;
}

#transferMaxStockDays.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 4px;
}

#roundingSettings.settings-grid {
  grid-template-columns: minmax(0, 260px);
  gap: 4px;
}

#statusSettings.status-settings-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.setting-row,
.status-setting-row {
  min-height: 26px;
  padding: 3px 5px;
  gap: 5px;
}

.delivery-days-input,
.transfer-max-days-input,
.status-rule-input {
  min-height: 23px;
}

.settings-hint {
  margin-top: 4px;
  padding: 3px 5px 0;
}

/* На широком экране четыре секции настроек располагаются в одну линию. */
.settings-section--status {
  grid-column: 1;
  grid-row: 2;
  max-width: none;
  height: 100%;
}

.settings-section--delivery {
  grid-column: 2;
  grid-row: 2;
  max-width: none;
  height: 100%;
}

.settings-section--rounding {
  grid-column: 4;
  grid-row: 2;
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.settings-section--transfer-limit {
  grid-column: 3;
  grid-row: 2;
  max-width: none;
  height: 100%;
}

.settings-section--rounding .settings-hint { margin-top: auto; }

@media (max-width: 1100px) {
  .settings-panel.visible:not(.hidden),
  .settings-panel:not(.hidden) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-section--status { grid-column: 1; grid-row: 2; }
  .settings-section--delivery { grid-column: 2; grid-row: 2; }
  .settings-section--transfer-limit { grid-column: 1; grid-row: 3; }
  .settings-section--rounding { grid-column: 2; grid-row: 3; }
}

@media (max-width: 600px) {
  .settings-panel { width: 100%; max-height: 72vh; }
  .settings-panel.visible:not(.hidden),
  .settings-panel:not(.hidden) { grid-template-columns: minmax(0, 1fr); }
  .settings-header { grid-column: 1; grid-row: 1; }
  .settings-section--status { grid-column: 1; grid-row: 2; }
  .settings-section--delivery { grid-column: 1; grid-row: 3; }
  .settings-section--transfer-limit { grid-column: 1; grid-row: 4; }
  .settings-section--rounding { grid-column: 1; grid-row: 5; }
  #deliverySettings.settings-grid,
  #transferMaxStockDays.settings-grid,
  #roundingSettings.settings-grid,
  #statusSettings.status-settings-grid { grid-template-columns: minmax(0, 1fr); }
}




/* User-requested stock/order column colors */
#resultTable thead th.header-zakaz-30,
#resultTable thead th.header-zakaz-45,
#resultTable thead th.header-zakaz-60 {
  background-color: rgb(251, 225, 81) !important;
  border-color: #d4c876 !important;
  color: rgb(64, 64, 64) !important;
}

#resultTable tbody td.col-order-30,
#resultTable tbody td.col-order-45,
#resultTable tbody td.col-order-60 {
  border-color: #d4c876 !important;
}

#resultTable tbody td.col-order-30.order-positive,
#resultTable tbody td.col-order-45.order-positive,
#resultTable tbody td.col-order-60.order-positive {
  color: rgb(128, 128, 128) !important;
}

#resultTable thead th.header-order-horizon {
  background-color: rgb(143, 188, 139) !important;
  border-color: #5f7f5f !important;
  color: rgb(40, 55, 38) !important;
}

#resultTable tbody tr td.col-order-horizon {
  background-color: rgb(229 245 225) !important;
}

#resultTable tbody tr.supplier-row td.col-order-horizon {
  background-color: rgb(191 223 182) !important;
}

#resultTable tbody tr.product-row td.col-order-horizon {
  background-color: rgb(204 227 198) !important;
}

#resultTable thead th.header-movement-horizon {
  background-color: rgb(153 198 149) !important;
  border-color: #70916d !important;
  color: rgb(40, 55, 38) !important;
}

#resultTable tbody tr td.col-movement-horizon {
  background-color: rgb(235 249 232) !important;
}

#resultTable tbody tr.supplier-row td.col-movement-horizon {
  background-color: rgb(202 231 195) !important;
}

#resultTable tbody tr.product-row td.col-movement-horizon {
  background-color: rgb(213 235 207) !important;
}

#resultTable thead th.header-total-stock-order {
  background-color: rgb(251, 225, 81) !important;
  border-color: #d4c876 !important;
  color: rgb(64, 64, 64) !important;
}

#resultTable tbody td.col-group2,
#resultTable tbody td.col-procurement-horizon,
#resultTable tbody td.col-transfer-horizon,
#resultTable tbody td.col-auto-brief-transfer,
#resultTable tbody td.col-procurement-manager,
#resultTable tbody td.col-stock-amount,
#resultTable tbody td.col-order-horizon-amount,
#resultTable tbody td.col-total-stock-order-amount {
  color: rgb(128, 128, 128) !important;
}

#resultTable tbody td.col-order-horizon-amount.order-negative,
#resultTable tbody td.col-total-stock-order-amount.order-negative {
  color: rgb(160, 160, 160) !important;
}

#resultTable tbody td.col-order-horizon-amount.order-positive,
#resultTable tbody td.col-total-stock-order-amount.order-positive {
  color: rgb(128, 128, 128) !important;
}

#resultTable tbody td.col-rc-yaroslavl-zero {
  color: rgb(192, 192, 192) !important;
}



/* Плашки товарного запаса: раздельные итоги и компактная строка склада. */
.supplier-dashboard--situation .dashboard-product-stock__financial-section,
.supplier-dashboard--situation .dashboard-product-stock__in-transit-section {
  flex: 0 0 auto;
  min-width: 0;
}

.supplier-dashboard--situation .dashboard-product-stock__title {
  margin-bottom: 2px;
}

.supplier-dashboard--situation .dashboard-product-stock__section-title {
  width: 100%;
  margin: 0 0 2px;
  color: var(--color-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  align-items: start;
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.06);
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div {
  min-width: 0;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals span {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--color-text-muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div:not(.dashboard-product-stock__section-title) span {
  min-height: 2.2em;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-total--stock-transit span {
  text-overflow: clip;
  white-space: normal;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals strong {
  display: block;
  overflow: hidden;
  color: var(--color-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__in-transit-section > .dashboard-product-stock__metrics-plaque {
  padding: 4px 5px;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.supplier-dashboard--situation .dashboard-product-stock__metrics-plaque .dashboard-product-stock__details {
  row-gap: 2px;
  padding-top: 3px;
}

.supplier-dashboard--situation .dashboard-product-stock__split--summary {
  grid-template-columns: minmax(62px, 1fr) minmax(82px, 1.25fr) minmax(42px, 0.65fr) minmax(64px, 0.95fr) minmax(72px, 1.1fr);
  column-gap: 4px;
  align-items: stretch;
}

.supplier-dashboard--situation .dashboard-product-stock__split--summary > div {
  min-width: 0;
  text-align: right;
}

.supplier-dashboard--situation .dashboard-product-stock__split--summary > div > span {
  display: block;
  overflow: hidden;
  height: 22px;
  margin: 0;
  font-size: 9px;
  line-height: 1.1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-dashboard--situation .dashboard-product-stock__split--summary > div > strong {
  min-width: 0;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.supplier-dashboard--situation .dashboard-product-stock__split--summary > div:nth-child(3) > strong {
  grid-row: 2 / 4;
  align-self: center;
  text-align: right;
}

.supplier-dashboard--situation .dashboard-product-stock__dead-row {
  line-height: 1.05;
}

/* Keep the warehouse group intrinsic-width and place the product card directly after it. */
@media (min-width: 1200px) {
  .supplier-dashboard--situation .dashboard-situation-overview {
    grid-template-columns: 238px max-content 420px minmax(0, 1fr);
  }

  .supplier-dashboard--situation .dashboard-situation-sidebar {
    grid-column: 1;
    grid-row: 1;
  }

  .supplier-dashboard--situation .dashboard-warehouse-analytics {
    grid-column: 2;
    grid-row: 1;
    width: max-content;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock {
    width: max-content;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    width: max-content;
    max-width: 100%;
    grid-template-columns: repeat(2, 216px);
  }

  .supplier-dashboard--situation .dashboard-product-stock {
    grid-column: 3;
    grid-row: 1;
    width: 420px;
    min-width: 420px;
    max-width: 420px;
  }
}

@media (min-width: 1700px) {
  .supplier-dashboard--situation .dashboard-warehouse-stock__grid {
    grid-template-columns: repeat(4, 216px);
  }
}

@media (min-width: 761px) and (max-width: 1199px) {
  .supplier-dashboard--situation .dashboard-product-stock {
    width: min(100%, 420px);
    min-width: 0;
    max-width: 420px;
  }
}

@media (max-width: 760px) {
  .supplier-dashboard--situation .dashboard-product-stock {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .supplier-dashboard--situation .dashboard-product-stock__split--summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 3px;
  }

  .supplier-dashboard--situation .dashboard-product-stock__split--summary > div:nth-child(4) {
    grid-column: 1;
  }

  .supplier-dashboard--situation .dashboard-product-stock__split--summary > div:nth-child(5) {
    grid-column: 2;
  }
}


/* Заголовки расположены внутри своих плашек; финансовые колонки разделены и выровнены вправо. */
.supplier-dashboard--situation .dashboard-product-stock__section-title {
  font-size: 9px;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > .dashboard-product-stock__section-title {
  grid-column: 1 / -1;
  margin-bottom: 1px;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div:not(.dashboard-product-stock__section-title) {
  text-align: right;
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div:nth-child(n + 3) {
  padding-left: 6px;
  border-left: 1px solid rgba(148, 163, 184, 0.55);
}

.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div:nth-child(n + 2) span,
.supplier-dashboard--situation .dashboard-product-stock__financial-totals > div:nth-child(n + 2) strong {
  text-align: right;
}

/* Окно расшифровки растёт по содержимому и прокручивается целиком, если не хватает места. */
.sales-analytics-dialog--horizon {
  min-height: 0;
  height: auto;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  resize: both;
}

.sales-analytics-dialog--horizon .sales-analytics-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-card);
}

.sales-analytics-dialog--horizon .sales-analytics-breakdown {
  max-height: none;
  overflow: visible;
}

.horizon-explanation-overview {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.2fr) minmax(0, 0.85fr) minmax(0, 0.9fr);
  align-items: stretch;
  gap: 8px;
}

.horizon-explanation-overview .horizon-explanation-summary {
  min-width: 0;
  padding: 8px 9px;
}

.horizon-explanation-overview .sales-analytics-inventory {
  min-width: 0;
  flex: initial;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  padding: 4px 5px 5px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.horizon-explanation-sales {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 4px;
  padding: 7px 8px 4px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
}

.horizon-explanation-sales-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.horizon-explanation-sales-warehouse {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 65%;
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horizon-explanation-sales-heading > h3 {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.2;
}

.horizon-explanation-sales-chart-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 2px 2px;
}

.horizon-explanation-sales-rate {
  display: grid;
  min-width: 0;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.horizon-explanation-sales-rate-item {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
}

.horizon-explanation-sales-rate-item > span {
  color: var(--color-text-muted);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.horizon-explanation-sales-rate-item > strong {
  color: #059669;
  font-size: 17px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.horizon-explanation-sales-rate-item > small {
  color: var(--color-text-muted);
  font-size: 9px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.horizon-explanation-inventory .sales-analytics-inventory-item {
  padding: 3px 4px;
  border-right: 1px solid rgba(148, 163, 184, 0.28);
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.horizon-explanation-inventory .sales-analytics-inventory-item:nth-child(2n) {
  border-right: 0;
}

.horizon-explanation-inventory .sales-analytics-inventory-item:nth-child(n + 5) {
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.horizon-explanation-inventory .sales-analytics-inventory-item:nth-child(n + 7) {
  border-bottom: 0;
}

.horizon-explanation-inventory .sales-analytics-inventory-label {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.horizon-explanation-inventory .sales-analytics-inventory-value {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.horizon-explanation-summary > strong,
.horizon-explanation-item > summary > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .horizon-explanation-overview {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Выделяем всю строку тонким контуром, не меняя размеры ячеек. */
#resultTable tbody tr.horizon-analysis-row-selected > td {
  box-shadow: inset 0 0.5px 0 #10b981, inset 0 -0.5px 0 #10b981;
}
#resultTable tbody tr.horizon-analysis-row-selected > td:first-child {
  box-shadow: inset 0.5px 0 0 #10b981, inset 0 0.5px 0 #10b981, inset 0 -0.5px 0 #10b981;
}
#resultTable tbody tr.horizon-analysis-row-selected > td:last-child {
  box-shadow: inset -0.5px 0 0 #10b981, inset 0 0.5px 0 #10b981, inset 0 -0.5px 0 #10b981;
}

/* Сохраняем выделение ячейки, по которой открыт разбор. */
#resultTable th.horizon-analysis-selected,
#resultTable td.horizon-analysis-selected {
  box-shadow: inset 0 0 0 1px #10b981;
}
#resultTable tbody tr.horizon-analysis-row-selected > td.horizon-analysis-selected {
  box-shadow: inset 0 0 0 1px #10b981;
}

.sales-analytics-dialog--horizon .sales-analytics-sticky {
  position: static;
  background: var(--color-card);
}

.sales-analytics-dialog--horizon .sales-analytics-header {
  position: relative;
  top: auto;
  z-index: auto;
  background: transparent;
}

.sales-analytics-pinned-overview:empty {
  display: none;
}

.sales-analytics-pinned-overview {
  padding: 0 12px 10px;
}

.horizon-explanation-product {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin: 7px 0 3px;
  padding-top: 7px;
  border-top: 1px solid var(--color-border);
}

.horizon-explanation-product > span {
  color: var(--color-text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.horizon-explanation-product > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.horizon-explanation-warehouse {
  grid-template-columns: minmax(0, 1.2fr) minmax(230px, 0.8fr);
  align-items: start;
  gap: 12px;
}

.horizon-explanation-steps-column {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.horizon-explanation-steps-column > h3 {
  margin: 0;
}

.horizon-explanation-warehouse-stock {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
}

.horizon-explanation-warehouse-stock > h4 {
  margin: 0 0 5px;
  color: var(--color-text);
  font-size: 11px;
}

.horizon-explanation-warehouse-stock-table.sales-analytics-inventory {
  min-width: 0;
  flex: initial;
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  border: 0;
}

.horizon-explanation-warehouse-stock .sales-analytics-inventory-item {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 2px;
  border-right: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.horizon-explanation-warehouse-stock .sales-analytics-inventory-item:nth-child(n + 5) {
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.horizon-explanation-warehouse-stock .sales-analytics-inventory-item:last-child {
  border-bottom: 0;
}

.horizon-explanation-warehouse-stock .sales-analytics-inventory-label {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.25;
}

.horizon-explanation-warehouse-stock .sales-analytics-inventory-value {
  flex: 0 0 auto;
  max-width: 48%;
  overflow: visible;
  text-align: right;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .horizon-explanation-product {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
}

@media (max-width: 560px) {
  .horizon-explanation-warehouse {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Повторный клик по активному режиму скрывает только данные, оставляя блок расшифровки. */
#dashboardSituationLayout[hidden] {
  display: none !important;
}


/* Этап 3: компактное содержимое расчёта внутри панели фиксированной высоты. */
.dashboard-horizon-explanation-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dashboard-horizon-explanation-panel__content {
  display: grid;
  grid-template-columns: minmax(0, 475px) minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.dashboard-horizon-explanation-panel__content > * {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context {
  grid-column: 1 / -1;
  flex-wrap: nowrap;
  gap: 2px 8px;
  margin-bottom: 4px;
  font-size: 9px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview {
  display: contents;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-rate-column {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: 100px;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview > * {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview .sales-analytics-inventory {
  min-width: 0;
  width: 100%;
  padding: 3px;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-inventory .sales-analytics-inventory-item {
  min-width: 0;
  gap: 1px;
  padding: 2px 3px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-inventory .sales-analytics-inventory-label {
  min-width: 0;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-inventory .sales-analytics-inventory-value {
  min-width: 0;
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales {
  grid-column: 1;
  grid-row: 2;
  box-sizing: border-box;
  width: 475px;
  max-width: 100%;
  min-width: 0;
  height: 100px;
  min-height: 100px;
  max-height: 100px;
  align-self: start;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 2px;
  padding: 4px 5px;
  overflow: hidden;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-heading > h3 {
  font-size: 9px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-chart-wrap {
  min-width: 0;
  padding: 0;
  overflow: hidden !important;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-chart {
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100%;
  grid-template-columns: repeat(var(--sales-month-count), minmax(0, 1fr)) !important;
  gap: 1px;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-bar {
  min-width: 0 !important;
  overflow: hidden;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-fill {
  width: 100%;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-track {
  height: 24px;
  min-width: 0;
  margin-top: 0;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-value {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  line-height: 1;
  text-overflow: clip;
  transform: translate(-50%, -1px);
}

.dashboard-horizon-explanation-panel__content .sales-analytics-label {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate {
  display: contents;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item:first-child {
  grid-column: 1;
  grid-row: 1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item:last-child {
  grid-column: 1;
  grid-row: 2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item {
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  gap: 2px;
  padding: 4px 5px;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > span {
  font-size: 11px;
  line-height: 1.1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > strong {
  font-size: 12px;
  line-height: 1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.1;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview .horizon-explanation-summary {
  box-sizing: border-box;
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  padding: 4px 5px;
  overflow: hidden;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary > span {
  font-size: 11px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary > strong {
  margin: 1px 0 2px;
  font-size: 13px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary p,
.dashboard-horizon-explanation-panel__content .horizon-explanation-stock-days-projection {
  margin-top: 2px;
  font-size: 8px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list {
  display: grid;
  grid-column: 3;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(4, minmax(0, 1fr)) auto;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: 100px;
  max-height: 100px;
  gap: 3px 5px;
  margin: 0;
  overflow: hidden;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list > h3 {
  grid-column: 1 / -1;
  font-size: 9px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list > .horizon-explanation-muted {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 8px;
  line-height: 1.1;
}

.dashboard-horizon-explanation-panel__content > .horizon-explanation-muted {
  grid-column: 3;
  grid-row: 2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  font-size: 8px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table th,
.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table td {
  min-width: 0;
  padding: 2px 3px;
  font-size: 8px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table th:first-child,
.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table td:first-child {
  width: auto;
  min-width: 0;
  text-align: left;
  white-space: normal;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table th:not(:first-child),
.dashboard-horizon-explanation-panel__content .horizon-explanation-multiplicity-table td:not(:first-child) {
  width: 34px;
  text-align: right;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item {
  min-width: 0;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item > summary {
  gap: 5px;
  padding: 3px 5px;
  font-size: 9px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item-body {
  min-width: 0;
  padding: 4px 5px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 5px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps-column {
  min-width: 0;
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps-column > h3,
.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock > h4 {
  font-size: 9px;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step {
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-step-index {
  width: 14px;
  height: 14px;
  font-size: 8px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step p {
  font-size: 9px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock {
  min-width: 0;
  padding: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock-table.sales-analytics-inventory {
  min-width: 0;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  padding: 2px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock .sales-analytics-inventory-item {
  gap: 2px;
  padding: 2px 3px;
  font-size: 8px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock .sales-analytics-inventory-label {
  overflow-wrap: anywhere;
  white-space: normal;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-muted {
  font-size: 8px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .dashboard-horizon-explanation-panel__content .horizon-explanation-overview {
    grid-template-columns: minmax(0, 1fr) fit-content(280px);
  }
}

@media (max-width: 460px) {
  .dashboard-horizon-explanation-panel__content .horizon-explanation-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Не оставляем заголовок скрытого режима над одной расшифровкой. */
#dashboardTitle[hidden],
#dashboardScope[hidden] {
  display: none !important;
}

@media (max-width: 1000px) {
  .dashboard-horizon-explanation-panel__content {
    grid-template-columns: minmax(0, 42vw) minmax(0, 1fr) minmax(0, 1fr);
  }

  .dashboard-horizon-explanation-panel__content .horizon-explanation-sales {
    width: 100%;
  }
}


/* Расшифровка расчёта: карточки 110px без внутренней прокрутки. */
.dashboard-horizon-explanation-panel {
  flex: 0 0 164px;
  height: 164px;
  min-height: 164px;
  max-height: 164px;
  padding: 5px 10px;
}

.dashboard-horizon-explanation-panel__content {
  display: grid;
  grid-template-columns: minmax(0, 475px) minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-rows: min-content 110px;
  align-items: stretch;
  gap: 2px 8px;
  overflow: hidden;
  font-size: 12px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context {
  grid-column: 1 / -1;
  grid-row: 1;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-panel-context strong {
  flex: 0 0 auto;
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview {
  display: contents;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales {
  grid-column: 1;
  grid-row: 2;
  box-sizing: border-box;
  width: 475px;
  max-width: 100%;
  min-width: 0;
  height: 110px;
  min-height: 110px;
  max-height: 110px;
  align-self: stretch;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 2px;
  padding: 4px 5px;
  overflow: hidden;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-heading > h3 {
  font-size: 11px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-chart-wrap {
  min-width: 0;
  min-height: 0;
  padding: 14px 2px 2px;
  overflow: visible !important;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-chart {
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100%;
  grid-template-columns: repeat(var(--sales-month-count), minmax(0, 1fr)) !important;
  gap: 1px;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-bar {
  min-width: 0 !important;
  overflow: visible !important;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-track {
  height: 56px;
  min-width: 0;
  margin-top: 0;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-fill {
  width: 100%;
  overflow: visible;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-value {
  max-width: none;
  overflow: visible;
  font-size: 12px;
  line-height: 1.1;
  text-overflow: clip;
  transform: translate(-50%, -1px);
}

.dashboard-horizon-explanation-panel__content .sales-analytics-label {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-empty {
  font-size: 14px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-rate-column {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: 110px;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate {
  display: contents;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item:first-child {
  grid-column: 1;
  grid-row: 1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item:last-child {
  grid-column: 1;
  grid-row: 2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item {
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  gap: 2px;
  padding: 4px 5px;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > span {
  font-size: 11px;
  line-height: 1.1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > strong {
  font-size: 14px;
  line-height: 1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > small {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.1;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview .horizon-explanation-summary {
  box-sizing: border-box;
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  padding: 4px 5px;
  overflow: hidden;
  border-radius: 6px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary > span {
  font-size: 11px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary > strong {
  margin: 1px 0 2px;
  font-size: 15px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-summary p,
.dashboard-horizon-explanation-panel__content .horizon-explanation-stock-days-projection {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list {
  display: grid;
  grid-column: 3;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(4, minmax(0, 1fr)) auto;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: 110px;
  max-height: 110px;
  gap: 2px 5px;
  margin: 0;
  overflow: hidden;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list > h3 {
  grid-column: 1 / -1;
  font-size: 11px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list > .horizon-explanation-muted {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 10px;
  line-height: 1.1;
}

.dashboard-horizon-explanation-panel__content > .horizon-explanation-muted {
  grid-column: 3;
  grid-row: 2;
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item {
  min-width: 0;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item > summary {
  gap: 5px;
  padding: 2px 4px;
  font-size: 11px;
  line-height: 1.1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-item-body {
  min-width: 0;
  padding: 4px 5px;
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 5px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps-column {
  min-width: 0;
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps-column > h3,
.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock > h4 {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step {
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-step-index {
  width: 16px;
  height: 16px;
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step p {
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-inventory .sales-analytics-inventory-label {
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-inventory .sales-analytics-inventory-value {
  font-size: 11px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock .sales-analytics-inventory-item {
  gap: 2px;
  padding: 2px 3px;
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-stock .sales-analytics-inventory-label {
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 10px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-muted {
  font-size: 10px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
  .dashboard-horizon-explanation-panel__content {
    grid-template-columns: minmax(0, 42vw) minmax(0, 1fr) minmax(0, 1fr);
  }

  .dashboard-horizon-explanation-panel__content .horizon-explanation-sales {
    width: 100%;
  }
}


/* Исправление нижнего отступа и переполнения состава расчёта. */
.dashboard-horizon-explanation-panel {
  flex: 0 0 170px;
  height: 170px;
  min-height: 170px;
  max-height: 170px;
  padding: 10px;
}

.dashboard-horizon-explanation-panel__content {
  grid-template-rows: min-content minmax(110px, 1fr);
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales {
  height: 100%;
  min-height: 110px;
  max-height: none;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-rate-column {
  height: 100%;
  min-height: 110px;
  max-height: none;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list {
  height: 100%;
  min-height: 110px;
  max-height: none;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list > .horizon-explanation-warehouse {
  grid-column: 1 / -1;
  grid-row: 2 / -1;
  min-height: 0;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps-column {
  height: 100%;
  min-height: 0;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-steps {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 4px 8px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step {
  min-width: 0;
  align-items: start;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-step p {
  min-width: 0;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}


/* Складские пояснения в составе расчёта без отдельных карточек. */
.dashboard-horizon-explanation-panel__content .horizon-explanation-list {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  grid-auto-rows: max-content;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-breakdown,
.dashboard-horizon-explanation-panel__content .horizon-explanation-entry {
  min-width: 0;
  grid-column: 1 / -1;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-warehouse-breakdown {
  display: grid;
  gap: 3px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-entry {
  display: grid;
  gap: 3px;
  padding: 2px 0 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: transparent;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-entry > h4 {
  min-width: 0;
  margin: 0;
  color: var(--color-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-entry .horizon-explanation-steps-column {
  height: auto;
  min-height: 0;
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-entry .horizon-explanation-steps {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

/* Keep calculation units beside their values and size them relative to the value. */
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item__monthly {
  --horizon-sales-value-font-size: 14px;
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item__monthly > strong {
  min-width: 0;
  color: #059669;
  font-size: var(--horizon-sales-value-font-size);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item__unit {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: calc(var(--horizon-sales-value-font-size) - 3px);
  line-height: 1;
  white-space: nowrap;
}

.dashboard-horizon-explanation-panel__content .sales-analytics-value {
  width: max-content;
}


/* No separator under stock projections inside the table-value card. */
.dashboard-horizon-explanation-panel__content .horizon-explanation-summary .horizon-explanation-warehouse-breakdown {
  border-bottom: none;
}


.horizon-explanation-summary > strong.horizon-explanation-summary__value--surplus {
  color: var(--color-text-muted);
}


/* Keep dashboard sales-rate cards compact without wrapping their text. */
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item {
  box-sizing: border-box;
  width: 182px;
  max-width: 100%;
  justify-self: start;
}
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > span,
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item__monthly,
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > small {
  white-space: nowrap;
  overflow-wrap: normal;
}
.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item > small {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}


/* Use the freed dashboard width for calculation details. */
.dashboard-horizon-explanation-panel__content {
  grid-template-columns: minmax(0, 475px) 378px minmax(0, 1fr);
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-rate-column {
  box-sizing: border-box;
  width: 378px;
  grid-template-columns: 182px 192px;
  gap: 4px;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-sales-rate-item {
  width: 182px;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-overview .horizon-explanation-summary {
  width: 192px;
  max-width: 100%;
}

.dashboard-horizon-explanation-panel__content .horizon-explanation-list {
  width: 100%;
  min-width: 0;
  max-width: none;
}

@media (max-width: 1000px) {
  .dashboard-horizon-explanation-panel__content {
    grid-template-columns: minmax(0, 42vw) 378px minmax(0, 1fr);
  }
}

/* Pastel blue hierarchy for brief quantity columns. */
#resultTable thead th.header-brief {
  background-color: rgb(145 190 216) !important;
  border-color: rgb(112 150 177) !important;
  color: rgb(36 55 70) !important;
}

#resultTable thead th.header-brief-transfer {
  background-color: rgb(159 202 225) !important;
  border-color: rgb(130 169 192) !important;
  color: rgb(36 55 70) !important;
}

#resultTable tbody tr td.col-brief {
  background-color: rgb(232 244 251) !important;
}

#resultTable tbody tr.supplier-row td.col-brief {
  background-color: rgb(188 216 237) !important;
}

#resultTable tbody tr.product-row td.col-brief {
  background-color: rgb(208 229 244) !important;
}

#resultTable tbody tr td.col-brief-transfer {
  background-color: rgb(240 248 253) !important;
}

#resultTable tbody tr.supplier-row td.col-brief-transfer {
  background-color: rgb(201 225 241) !important;
}

#resultTable tbody tr.product-row td.col-brief-transfer {
  background-color: rgb(219 237 248) !important;
}

#resultTable thead th.header-brief-total-planned {
  background-color: rgb(135 180 208) !important;
  border-color: rgb(105 146 175) !important;
  color: rgb(36 55 70) !important;
}
