.panel--history {
  overflow: hidden;
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.history-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 24, 39, 0.74);
}

.history-range {
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.94rem;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.history-range:hover,
.history-range:focus-visible {
  color: var(--text);
}

.history-range:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.history-range.is-active {
  color: #03111c;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
}

.history-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 24px 0 22px;
}

.history-metric {
  min-width: 0;
  background: var(--panel-strong);
}

.history-metric .metric-label {
  margin-bottom: 12px;
}

.history-metric strong {
  display: block;
  font-family: "Google Sans", sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.history-chart-card {
  background: var(--panel-strong);
}

.history-chart {
  position: relative;
  height: 280px;
  cursor: crosshair;
}

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

.history-grid-line {
  stroke: rgba(93, 141, 197, 0.2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.history-area-path {
  fill: url(#history-area-gradient);
}

.history-line-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.history-point {
  fill: var(--accent);
}

.history-crosshair {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}

.history-marker {
  fill: var(--accent-soft);
  stroke: var(--bg-soft);
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.history-tooltip {
  position: absolute;
  top: 8px;
  z-index: 2;
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: var(--shadow-blue);
  transform: translateX(12px);
  pointer-events: none;
}

.history-tooltip.is-left {
  transform: translateX(calc(-100% - 12px));
}

.history-tooltip strong,
.history-tooltip span {
  display: block;
}

.history-tooltip strong {
  font-size: 1.25rem;
}

.history-tooltip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.history-empty[hidden] {
  display: none;
}

.history-axis {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel--history.is-loading .history-chart-card {
  opacity: 0.7;
}

@media (max-width: 720px) {
  .history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-ranges {
    max-width: 100%;
  }

  .history-metrics {
    grid-template-columns: 1fr;
  }

  .history-chart {
    height: 220px;
  }
}
