
/* ---- Переключатель вида результата и линейный график остатков ---- */
.result-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.result-view-bar .size-filter {
  margin-top: 0;
}

.result-view-switch button {
  padding: 7px 14px;
}

#resultsSection.view-chart .result-table-wrap,
#resultsSection.view-chart #resultCards,
.sc-view-chart .sc-hide-in-chart {
  display: none !important;
}

.stock-chart {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fcfcfb;
  padding: 12px 12px 8px;
}

.stock-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stock-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.stock-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-chart-legend-item i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.stock-chart-legend-item.sc-legend-deficit i {
  background: repeating-linear-gradient(90deg, #d03b3b 0 4px, transparent 4px 7px);
}

.stock-chart-legend-item.sc-legend-writeoff i {
  background: repeating-linear-gradient(90deg, #52514e 0 3px, transparent 3px 6px);
}

.stock-chart-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.stock-chart-nav.hidden {
  display: none;
}

.stock-chart-arrow {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.stock-chart-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.stock-chart-alert {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(208, 59, 59, 0.1);
  color: #8f1f1f;
}

.stock-chart-alert.ok {
  background: rgba(12, 163, 12, 0.1);
  color: #1d5e1d;
}

.stock-chart-plot {
  position: relative;
  margin-top: 6px;
  width: 100%;
}

.stock-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: inherit;
}

.sc-band { fill: transparent; }
.sc-band-alt { fill: rgba(31, 42, 36, 0.025); }
.sc-band-deficit { fill: rgba(208, 59, 59, 0.07); }
.sc-negative-zone { fill: rgba(208, 59, 59, 0.06); }
.sc-grid { stroke: rgba(31, 42, 36, 0.08); stroke-width: 1; }
.sc-zero { stroke: rgba(31, 42, 36, 0.55); stroke-width: 1.5; }
.sc-axis-label { font-size: 11px; fill: #52514e; }
.sc-axis-day { font-size: 12px; font-weight: 600; fill: #0b0b0b; }
.sc-delivery-tag { font-size: 10px; font-weight: 600; fill: #52514e; letter-spacing: 0.02em; }
.sc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sc-writeoff { stroke: #52514e; stroke-width: 2; stroke-dasharray: 3 3; }
.sc-deficit { stroke: #d03b3b; stroke-width: 2; stroke-dasharray: 4 3; }
.sc-dot { stroke: #fcfcfb; stroke-width: 2; }
.sc-dot-deficit { fill: #d03b3b; }
.sc-deficit-label { font-size: 11px; font-weight: 700; fill: #8f1f1f; }
.sc-end-label { font-size: 11px; font-weight: 600; fill: #52514e; }
.sc-cursor { stroke: rgba(31, 42, 36, 0.35); stroke-width: 1; }
.sc-cursor.hidden { display: none; }
.sc-hit { fill: transparent; cursor: pointer; outline: none; }

.stock-chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 190px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(31, 42, 36, 0.16);
  font-size: 12px;
  color: var(--ink);
  pointer-events: none;
}

.stock-chart-tooltip.hidden { display: none; }
.stock-chart-tooltip .tt-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.stock-chart-tooltip .tt-row + .tt-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.stock-chart-tooltip .tt-size { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.stock-chart-tooltip .tt-size i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stock-chart-tooltip .tt-metrics { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; color: var(--ink-soft); }
.stock-chart-tooltip .tt-metrics b { color: var(--ink); font-weight: 600; }
.stock-chart-tooltip .tt-in b { color: #1d5e1d; }
.stock-chart-tooltip .tt-writeoff b { color: #52514e; }
.stock-chart-tooltip .tt-deficit { color: #8f1f1f; font-weight: 600; }
.stock-chart-tooltip .tt-deficit b { color: #8f1f1f; }

.stock-chart-note { margin: 6px 2px 0; font-size: 12px; }

@media (max-width: 768px) {
  .result-view-bar { flex-direction: column; align-items: stretch; }
  .result-view-switch { align-self: flex-start; }
  .stock-chart { padding: 10px 8px 6px; }
  .stock-chart-head { flex-direction: column; align-items: stretch; }
  .stock-chart-nav { justify-content: space-between; }
  .stock-chart-tooltip {
    position: static;
    max-width: none;
    margin-top: 4px;
    box-shadow: none;
    background: #fff;
  }
}
