.chart-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 0;
  height: 100%;
  min-height: 500px;
  background: var(--bg-elev-1);
  overflow: hidden;
}

.chart-area {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
  overflow: hidden;
  background: var(--bg-elev-1);
}

.chart-plotly {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.chart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.chart-overlay svg {
  width: 100%;
  height: 100%;
}

.chart-layer-sidebar {
  background: var(--bg-elev-2);
  padding: var(--space-3);
  overflow-y: auto;
  border-left: 1px solid var(--border-subtle);
  color: var(--fg-secondary);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
}

.chart-layer-sidebar .sidebar-title {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-tertiary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.layer-group {
  margin-bottom: var(--space-4);
}

.layer-group-header {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-tertiary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}

.layer-row:hover {
  background: var(--bg-elev-3);
}

.layer-row input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-cyan);
  width: 14px;
  height: 14px;
}

.layer-label {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--fg-secondary);
}

.layer-row input:checked ~ .layer-label,
.layer-row:has(input:checked) .layer-label {
  color: var(--fg-primary);
  font-weight: 500;
}

.layer-row:has(input:checked) {
  background: rgba(86, 216, 224, 0.06);
}

@media (max-width: 900px) {
  .chart-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .chart-layer-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    max-height: 200px;
  }
}
