.sm-history {
  margin: 1.2rem 0 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--lightgray);
}

.sm-history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.4rem 0 0.9rem;
  color: var(--darkgray);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.sm-history-chart {
  position: relative;
  width: 100%;
  height: 360px;
  min-width: 0;
  overflow: hidden;
}

.sm-price-history-chart {
  height: 430px;
}

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

.sm-chart-svg text {
  letter-spacing: 0;
  font-family: inherit;
}

.sm-chart-svg .axis text {
  fill: var(--darkgray);
  font-size: 11px;
}

.sm-chart-svg .axis path,
.sm-chart-svg .axis line {
  stroke: var(--lightgray);
}

.sm-chart-svg .sm-grid line {
  stroke: color-mix(in srgb, var(--lightgray) 70%, transparent);
}

.sm-chart-svg .sm-grid path {
  display: none;
}

.sm-commit-bar {
  fill: #0b57d0;
}

.sm-realized-bar {
  fill: #188038;
}

.sm-rate-line {
  fill: none;
  stroke: #c45100;
  stroke-width: 2.5;
}

.sm-rate-dot {
  fill: #c45100;
  stroke: var(--light);
  stroke-width: 1.5;
}

.sm-chart-value {
  stroke: var(--light);
  stroke-width: 3px;
  paint-order: stroke;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  pointer-events: none;
}

.sm-commit-value {
  fill: #4f8cff;
}

.sm-realized-value {
  fill: #34a853;
}

.sm-rate-value {
  fill: #e8710a;
}

.sm-price-band {
  fill: rgb(0 121 107 / 16%);
}

.sm-price-line {
  fill: none;
  stroke: #00796b;
  stroke-width: 2.5;
}

.sm-price-benchmark {
  fill: #00796b;
  stroke: var(--light);
  stroke-width: 2px;
  pointer-events: none;
}

.sm-price-observation-line {
  fill: none;
  stroke: #d93025;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.sm-price-observation {
  fill: #d93025;
  stroke: var(--light);
  stroke-width: 1.5;
  cursor: pointer;
}

.sm-price-value {
  fill: #ea4335;
}

.sm-pointer-layer {
  fill: transparent;
  cursor: crosshair;
}

.sm-crosshair {
  pointer-events: none;
  stroke: var(--darkgray);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.sm-range-brush > line {
  stroke: var(--gray);
  stroke-width: 2;
}

.sm-range-brush {
  touch-action: none;
}

.sm-range-brush .overlay {
  fill: rgb(11 87 208 / 8%);
  cursor: crosshair;
}

.sm-range-brush .selection {
  fill: rgb(11 87 208 / 25%);
  stroke: #0b57d0;
  stroke-width: 2px;
  cursor: move;
}

.sm-range-brush .handle {
  fill: #0b57d0;
  stroke: #0b57d0;
  stroke-width: 8px;
  cursor: ew-resize;
}

.sm-brush-label {
  fill: var(--darkgray);
  font-size: 11px;
}

.sm-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0.35rem;
}

.sm-price-provenance {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin: 0.4rem 0 0.15rem;
  color: var(--darkgray);
  font-size: 0.78rem;
}

.sm-price-provenance strong {
  color: #00796b;
}

.sm-history-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0.38rem 0.62rem;
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  background: var(--light);
  color: var(--darkgray);
  cursor: pointer;
}

.sm-history-toolbar button small {
  color: var(--gray);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.sm-history-toolbar button[aria-pressed="true"] {
  border-color: #0b57d0;
  color: #0b57d0;
  box-shadow: inset 0 0 0 1px #0b57d0;
}

.sm-history-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin: 0.45rem 0 0.25rem;
}

.sm-history-range-buttons {
  display: inline-flex;
  gap: 0.35rem;
}

.sm-history-range button {
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  background: var(--light);
  color: var(--darkgray);
  cursor: pointer;
}

.sm-history-range button[aria-pressed="true"] {
  border-color: #0b57d0;
  background: rgb(11 87 208 / 10%);
  color: #4f8cff;
  box-shadow: inset 0 0 0 1px #0b57d0;
}

.sm-history-range > strong {
  color: var(--darkgray);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.sm-history-tooltip {
  position: fixed;
  z-index: 50;
  max-width: min(360px, calc(100vw - 24px));
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  background: var(--light);
  color: var(--dark);
  box-shadow: 0 8px 24px rgb(0 0 0 / 14%);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.sm-history-detail {
  margin: 0.75rem 0 1rem;
  overflow-x: auto;
}

.sm-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.sm-detail-head button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--lightgray);
  border-radius: 50%;
  background: transparent;
  color: var(--darkgray);
  font-size: 1.15rem;
  cursor: pointer;
}

.sm-history-detail table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sm-history-detail th,
.sm-history-detail td {
  padding: 0.42rem;
  border-bottom: 1px solid var(--lightgray);
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .sm-history-chart {
    height: 310px;
  }

  .sm-price-history-chart {
    height: 400px;
  }

  .sm-history-toolbar button {
    flex: 1 1 calc(50% - 0.4rem);
  }

  .sm-history-range {
    align-items: stretch;
    flex-direction: column;
  }

  .sm-history-range-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
