/* History / Chart */

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

.chart-card {
  background: rgba(201, 168, 76, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.chart-card__header h3 {
  margin: 0;
  font-size: 18px;
}

.chart-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chart-metric {
  background: none;
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted-color);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.chart-metric:hover {
  color: var(--text);
}

.chart-metric.is-active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
}

.chart-card__body {
  width: 100%;
  height: 360px;
}

#history-chart {
  width: 100%;
  height: 100%;
  display: block;
}


/* Series colors */

[data-slot="1"] { --slot-color: var(--series-1); }
[data-slot="2"] { --slot-color: var(--series-2); }
[data-slot="3"] { --slot-color: var(--series-3); }
[data-slot="4"] { --slot-color: var(--series-4); }
[data-slot="5"] { --slot-color: var(--series-5); }
[data-slot="other"] { --slot-color: var(--series-other); }

/* Sparklines */

.spark {
  display: block;
  width: 100%;
  overflow: visible;
}

.spark__line {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.spark__area {
  fill: var(--gold-soft);
  opacity: 0.6;
}

.spark__end,
.spark__focus {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 8;
  stroke-linecap: round;
}

.spark__cross {
  stroke: var(--chart-label);
  stroke-width: 1;
  opacity: 0;
}

.spark__focus {
  opacity: 0;
}

.spark.is-hovering .spark__cross,
.spark.is-hovering .spark__focus {
  opacity: 1;
}

.spark.is-hovering .spark__end {
  opacity: 0.35;
}

.spark__hit {
  fill: transparent;
  cursor: crosshair;
}

.spark-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.viz-tooltip {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(15, 14, 12, 0.94);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* Allocation */

.allocation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 32px;
}

.allocation h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.allocation__title {
  margin-bottom: 10px;
  color: var(--muted-color);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.alloc-bar {
  display: flex;
  gap: 2px;
  height: 14px;
}

.alloc-bar__seg {
  flex-basis: 0;
  min-width: 3px;
  background: var(--slot-color);
  cursor: default;
  transition: filter 0.15s ease;
}

.alloc-bar__seg:first-child {
  border-radius: 4px 0 0 4px;
}

.alloc-bar__seg:last-child {
  border-radius: 0 4px 4px 0;
}

.alloc-bar__seg:only-child {
  border-radius: 4px;
}

.alloc-bar__seg:hover {
  filter: brightness(1.25);
}

.alloc-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.alloc-legend__item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 90px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.alloc-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--slot-color);
}

.alloc-legend__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alloc-legend__share {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.alloc-legend__value {
  color: var(--muted-color);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.alloc-note {
  margin: 10px 0 0;
  color: var(--copper);
  font-size: 13px;
}

/* Price trends */

.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.trend-card {
  margin: 0;
  padding: 16px 18px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(201, 168, 76, 0.02);
}

.trend-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.trend-card__title {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.trend-card__range {
  display: flex;
  gap: 12px;
  color: var(--muted-color);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trend-card__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 12px;
}
