.hca-chart {
  --hca-chart-navy: #1A2B5B;
  --hca-chart-blue: #385AE2;
  --hca-chart-red: #c8423b;
  --hca-chart-grey: #E0E0E0;
  background: #fff;
  border: 1px solid rgba(26, 43, 91, 0.12);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(26, 43, 91, 0.08);
  color: var(--hca-chart-navy);
  padding: 20px;
}

.hca-chart-head {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hca-chart-head h3 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  margin: 0 0 4px;
}

.hca-chart-head p {
  color: #64748b;
  margin: 0;
}

.hca-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hca-chart-legend span {
  align-items: center;
  border: 1px solid rgba(26, 43, 91, 0.12);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.85rem;
  gap: 6px;
  padding: 6px 10px;
}

.hca-chart-legend span.principal {
  border-color: rgba(56, 90, 226, 0.42);
  box-shadow: inset 0 0 0 1px rgba(56, 90, 226, 0.18);
  font-weight: 800;
}

.hca-chart-legend i {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.hca-chart-swatch {
  display: inline-block;
  flex: none;
  height: 8px;
  overflow: visible;
  width: 30px;
}

.hca-chart-tag {
  background: rgba(56, 90, 226, 0.12);
  border-radius: 999px;
  color: #1A2B5B;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  text-transform: uppercase;
}

.hca-chart-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 14px 0;
}

.hca-chart-controls label {
  color: #475569;
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 5px;
  text-transform: uppercase;
}

.hca-chart-controls label.check {
  align-items: center;
  display: flex;
  gap: 8px;
  padding-bottom: 10px;
  text-transform: none;
}

.hca-chart-controls input {
  border: 1px solid rgba(26, 43, 91, 0.16);
  border-radius: 12px;
  color: var(--hca-chart-navy);
  font: inherit;
  min-width: 0;
  padding: 10px;
}

.hca-chart-controls button {
  background: var(--hca-chart-blue);
  border: 0;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 12px 14px;
}

.hca-chart-warnings {
  background: rgba(252, 227, 0, 0.18);
  border: 1px solid rgba(249, 114, 22, 0.28);
  border-radius: 16px;
  color: #7c2d12;
  margin: 12px 0;
  padding: 10px 14px 10px 28px;
}

.hca-chart-svg {
  display: block;
  height: auto;
  max-width: 100%;
  overflow: visible;
  width: 100%;
}

.hca-chart-grid {
  stroke: rgba(26, 43, 91, 0.09);
  stroke-width: 1;
}

.hca-chart-axis {
  stroke: rgba(26, 43, 91, 0.38);
  stroke-width: 1.5;
}

.hca-chart-y-label,
.hca-chart-x-label {
  fill: #64748b;
  font-size: 13px;
}

.hca-chart-segment {
  fill: none;
  opacity: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.hca-chart-segment.up {
  stroke: var(--hca-chart-blue);
}

.hca-chart-segment.down {
  stroke: var(--hca-chart-red);
}

.hca-chart-segment.principal {
  opacity: 1;
  stroke-width: 4;
}

.hca-chart-segment.clipped {
  stroke-dasharray: 5 3;
}

/* Gráfica combinada: color y trazo van en línea; el recorte se marca solo con opacidad. */
.hca-chart-segment.combined.clipped {
  opacity: 0.45;
}

.hca-chart-point {
  filter: drop-shadow(0 3px 5px rgba(26, 43, 91, 0.18));
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.hca-chart-point.principal {
  stroke: var(--hca-chart-navy);
  stroke-width: 2.5;
}

.hca-chart-point.negative {
  opacity: 0.86;
}

.hca-chart-point.zero {
  opacity: 0.72;
}

.hca-chart-point.clipped {
  stroke: #F97216;
  stroke-width: 3;
}

.hca-chart-missing {
  fill: url(#missing);
  fill: #E0E0E0;
  opacity: 0.95;
}

.hca-chart-quota {
  opacity: 0.78;
  stroke: #F97216;
  stroke-dasharray: 7 5;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 780px) {
  .hca-chart {
    border-radius: 18px;
    padding: 14px;
  }

  .hca-chart-head {
    display: grid;
  }

  .hca-chart-legend {
    justify-content: flex-start;
  }

  .hca-chart-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hca-chart-controls button,
  .hca-chart-controls label.check {
    grid-column: span 2;
  }
}
