/* Shared v4 chart interactions. Theme tokens come from the dashboard shell. */
.dcv4 {
  position: relative;
  min-width: 0;
}

.dcv4-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin: 2px 0 8px;
}

.dcv4-legend,
.dcv4-actions,
.dcv4-scale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.dcv4-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  min-height: 44px;
}

.dcv4-legend-item:hover,
.dcv4-legend-item:focus-visible {
  color: var(--text);
  border-color: var(--line);
  outline: none;
}

.dcv4-legend-item.is-hidden {
  opacity: .48;
  text-decoration: line-through;
}

.dcv4-swatch {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: var(--series-color);
}

.dcv4-actions .btn[aria-pressed="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--teal) 38%, transparent);
  background: color-mix(in srgb, var(--teal) 9%, transparent);
}

.dcv4-actions .btn:disabled {
  cursor: default;
  opacity: .42;
}

.dcv4-actions .btn { min-height: 44px; }

.dcv4-plot {
  position: relative;
  min-width: 0;
}

.dcv4-plot svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 330px;
  overflow: visible;
}

.dcv4-overlay {
  cursor: crosshair;
  touch-action: none;
}

.dcv4-overlay.is-pannable {
  cursor: grab;
}

.dcv4-overlay.is-panning {
  cursor: grabbing;
}

.dcv4-overlay:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.dcv4-crosshair-line {
  stroke: rgba(226, 238, 230, .55);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.dcv4-point {
  vector-effect: non-scaling-stroke;
}

.dcv4-selection {
  vector-effect: non-scaling-stroke;
}

.dcv4 .dcv4-tooltip[hidden] {
  display: none;
}

.dcv4 .dcv4-tooltip {
  display: block;
  max-width: min(270px, calc(100% - 12px));
}

.dcv4-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 4px;
}

.dcv4-help {
  margin: -5px 0 0;
  color: var(--faint);
  font-size: 11px;
  text-align: right;
}

.dcv4-empty {
  fill: var(--muted);
  font-size: 12px;
}

.dcv4-fallback {
  min-height: 320px;
  padding: 22px;
  border-left: 3px solid var(--red);
  background: color-mix(in srgb, var(--red) 6%, transparent);
  color: var(--text);
}

.dcv4-fallback > p {
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dcv4-fallback-table {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
}

.dcv4-fallback-table th:first-child {
  position: sticky;
  left: 0;
}

@media (max-width: 640px) {
  .dcv4-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .dcv4-actions {
    width: 100%;
    justify-content: space-between;
  }

  .dcv4-plot svg {
    min-height: 280px;
  }

  .dcv4-help {
    margin-top: 4px;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dcv4 * {
    scroll-behavior: auto !important;
  }
}
