.history-chart,
.rank-chart {
  --chart-accent: var(--accent, #183bde);
  --chart-line: #e4eaf2;
  --chart-ink: #202c42;
  --chart-muted: #566780;
  --chart-fill: #e8efff;
  --chart-marker: #a2b5fb;
  margin: 0;
  padding: 13px 12px 11px;
  border: 1px solid var(--chart-line);
  border-radius: 12px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}

.history-chart { --history-plot-height: 104px; }

.history-chart[data-layer="weather"] {
  --chart-accent: #08638f;
  --chart-fill: #d4edf5;
  --chart-marker: #91c9dd;
}

.history-chart__heading,
.rank-chart__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin: 0;
}

.history-chart__heading { margin-bottom: 15px; }
.rank-chart__heading { align-items: baseline; margin-bottom: 8px; }
.history-chart__heading-copy { display: grid; gap: 4px; }

.history-chart__title,
.rank-chart__title {
  color: var(--chart-ink);
  font-size: 13px;
  font-weight: 675;
  line-height: 1.2;
}

.history-chart__range,
.rank-chart__unit {
  color: var(--chart-muted);
  font-size: 10px;
  line-height: 1.35;
}

.history-chart__readout {
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--chart-fill);
  color: var(--chart-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}

.history-chart__readout.is-missing { color: var(--chart-muted); background: #f2f4f8; }

.history-chart__plot {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px;
}

.history-chart__scale,
.history-chart__guides {
  display: flex;
  height: var(--history-plot-height);
  flex-direction: column;
  justify-content: space-between;
}

.history-chart__scale {
  align-items: end;
  height: calc(var(--history-plot-height) + 10px);
  margin-top: -5px;
}

.history-chart__tick,
.history-chart__x-label {
  color: var(--chart-muted);
  font-size: 10px;
  line-height: 10px;
  white-space: nowrap;
}

.history-chart__surface {
  position: relative;
  height: calc(var(--history-plot-height) + 19px);
}

.history-chart__guides {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
}

.history-chart__guide {
  width: 100%;
  border-top: 1px dashed var(--chart-line);
}

.history-chart__guide.is-baseline { border-top: 1px solid #ccd6e4; }

.history-chart__drawing,
.history-chart__marker,
.history-chart__columns {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: var(--history-plot-height);
}

.history-chart__drawing { overflow: visible; pointer-events: none; }
.history-chart__area { fill: var(--chart-fill); opacity: .85; }
.history-chart__line { fill: none; stroke: var(--chart-accent); stroke-width: 1.7; stroke-linejoin: round; }
.history-chart__point { fill: #fff; stroke: var(--chart-accent); stroke-width: 1.25; }
.history-chart__point.is-active { fill: var(--chart-accent); stroke: #fff; stroke-width: 1.4; }
.history-chart__bar { fill: var(--chart-marker); }
.history-chart__bar.is-active { fill: var(--chart-accent); }
.history-chart__missing { stroke: #75869d; stroke-width: 1.3; stroke-dasharray: 2 1; }

.history-chart__marker {
  right: auto;
  width: 1px;
  border-left: 1px dashed var(--chart-marker);
  pointer-events: none;
}

.history-chart__column {
  position: absolute;
  top: 0;
  height: calc(var(--history-plot-height) + 16px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

.history-chart__column:hover { background: #3654df0a; }

.history-chart__column:focus-visible,
.rank-chart__button:focus-visible {
  outline: 2px solid var(--chart-accent);
  outline-offset: 1px;
}

.history-chart__x-label {
  position: absolute;
  top: calc(var(--history-plot-height) + 7px);
  transform: translateX(-50%);
}

.history-chart__column[aria-pressed="true"] .history-chart__x-label {
  color: var(--chart-ink);
  font-weight: 750;
}

.history-chart__tooltip {
  position: absolute;
  z-index: 2;
  top: 5px;
  left: clamp(64px, var(--history-tooltip-x), calc(100% - 64px));
  display: grid;
  gap: 3px;
  transform: translateX(-50%);
  max-width: 132px;
  padding: 6px 8px;
  border: 1px solid var(--chart-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 4px 16px #26365a25;
  color: var(--chart-ink);
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

.history-chart__tooltip[hidden],
.history-chart__marker[hidden] { display: none; }
.history-chart__tooltip-period { color: var(--chart-muted); }
.history-chart__tooltip-value { font-size: 11px; }

.history-chart__missing-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 0;
  color: var(--chart-muted);
  font-size: 10px;
}

.history-chart__missing-key { width: 9px; border-top: 1px dashed #75869d; }

.rank-chart__list {
  display: grid;
  gap: 2px;
  margin: 0 -5px;
  padding: 0;
  list-style: none;
}

.rank-chart__button {
  display: grid;
  width: 100%;
  grid-template-columns: 17px minmax(0, 1fr) minmax(33px, .62fr) max-content;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--chart-ink);
  text-align: left;
  cursor: pointer;
}

.rank-chart__button:hover { background: #f0f4ff; }
.rank-chart__button[aria-pressed="true"] { background: #edf2ff; }

.rank-chart__position {
  color: var(--chart-muted);
  font-size: 10px;
  line-height: 1.2;
}

.rank-chart__label {
  overflow: hidden;
  font-size: 11px;
  font-weight: 575;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-chart__track {
  height: 5px;
  overflow: hidden;
  border-radius: 10px;
  background: #e9eff8;
}

.rank-chart__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #98adf3;
}

.rank-chart__button[aria-pressed="true"] .rank-chart__fill { background: var(--chart-accent); }

.rank-chart__value {
  min-width: 35px;
  color: var(--chart-ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}
