.product-history-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
  border: 1px solid rgba(124, 242, 198, .48);
  border-radius: 999px;
  background: rgba(18, 53, 41, .72);
  color: #c8f9e5;
  padding: 8px 12px;
  font: 800 12px/1 system-ui;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.product-history-trigger::before {
  content: '';
  width: 12px;
  height: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: linear-gradient(145deg, transparent 42%, currentColor 43% 54%, transparent 55%);
}

.product-history-trigger:hover {
  background: #164836;
  border-color: rgba(124, 242, 198, .8);
  transform: translateY(-1px);
}

.product-history-trigger:focus-visible,
.product-history-close:focus-visible,
.product-history-windows button:focus-visible,
.product-history-stores summary:focus-visible {
  outline: 3px solid rgba(124, 242, 198, .45);
  outline-offset: 2px;
}

.product-price-history-panel {
  margin: 14px 0 5px;
  border: 1px solid rgba(124, 242, 198, .26);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(41, 113, 88, .22), transparent 34%),
    linear-gradient(145deg, rgba(8, 25, 42, .98), rgba(6, 18, 31, .98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  padding: 20px;
}

.product-history-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.product-history-head > div {
  display: grid;
  gap: 4px;
}

.product-history-head small,
.product-history-section-title small {
  color: #7cf2c6;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.product-history-head strong {
  color: #f3f8fc;
  font-size: 20px;
  line-height: 1.2;
}

.product-history-head span {
  color: #8fa4b8;
  font-size: 11px;
  line-height: 1.45;
}

.product-history-close,
.product-history-windows button {
  border: 1px solid #30445d;
  border-radius: 10px;
  background: #0b1928;
  color: #dce9f5;
  padding: 8px 11px;
  font-weight: 800;
  cursor: pointer;
}

.product-history-close:hover,
.product-history-windows button:hover {
  border-color: #52708f;
  background: #10243a;
}

.product-history-windows {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  max-width: 430px;
  margin: 18px 0;
  padding: 4px;
  border: 1px solid rgba(132, 154, 180, .16);
  border-radius: 13px;
  background: rgba(4, 15, 27, .48);
}

.product-history-windows button {
  border-color: transparent;
  background: transparent;
  color: #91a8bf;
  font-size: 11px;
}

.product-history-windows button.active {
  border-color: rgba(124, 242, 198, .42);
  background: #123529;
  color: #c8f9e5;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
}

.product-history-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 13px 20px;
  margin: 2px 0 14px;
  padding: 18px;
  border: 1px solid rgba(124, 242, 198, .32);
  border-radius: 16px;
  background: rgba(14, 42, 35, .56);
}

.product-history-context-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-history-context-head > div {
  display: grid;
  gap: 5px;
}

.product-history-context-head small {
  color: #8eeecb;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .1em;
}

.product-history-context-head strong {
  color: #f0fff8;
  font-size: 17px;
  line-height: 1.25;
}

.product-history-context-confidence {
  border: 1px solid rgba(132, 154, 180, .35);
  border-radius: 999px;
  padding: 6px 9px;
  color: #bfd0df;
  background: rgba(5, 18, 31, .28);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.product-history-current {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  align-content: center;
  min-width: 170px;
  padding-left: 20px;
  border-left: 1px solid rgba(124, 242, 198, .2);
}

.product-history-current small {
  color: #91a8bf;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}

.product-history-current strong {
  margin-top: 4px;
  color: #fff;
  font-size: 27px;
  letter-spacing: -.03em;
}

.product-history-current span {
  margin-top: 3px;
  color: #a9bed1;
  font-size: 11px;
}

.product-history-context-explanation {
  max-width: 670px;
  margin: 0;
  color: #d8e5f0;
  font-size: 12px;
  line-height: 1.55;
}

.product-history-context-evidence {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 11px;
  border-top: 1px solid rgba(124, 242, 198, .16);
  color: #9bb0c3;
  font-size: 10px;
  line-height: 1.5;
}

.product-history-context.recorded_low,
.product-history-context.below_average {
  border-color: rgba(124, 242, 198, .5);
  background: linear-gradient(120deg, rgba(18, 69, 51, .78), rgba(12, 42, 38, .58));
}

.product-history-context.above_average {
  border-color: rgba(255, 195, 173, .4);
  background: linear-gradient(120deg, rgba(77, 39, 35, .62), rgba(35, 27, 34, .5));
}

.product-history-context.limited_history,
.product-history-context.insufficient_history {
  border-color: rgba(132, 154, 180, .28);
  background: rgba(11, 27, 45, .68);
}

.product-history-range {
  padding: 16px;
  border: 1px solid rgba(132, 154, 180, .2);
  border-radius: 16px;
  background: rgba(7, 20, 34, .62);
}

.product-history-range-head,
.product-history-scale-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-history-range-head strong {
  color: #eaf2f9;
  font-size: 13px;
}

.product-history-range-head span,
.product-history-scale-labels span,
.product-history-scale-caption {
  color: #8fa4b8;
  font-size: 10px;
}

.product-history-scale {
  margin: 18px 4px 15px;
}

.product-history-scale-track {
  position: relative;
  height: 6px;
  margin: 12px 7px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #62dfb3, #79a9d4 55%, #ffb39a);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}

.product-history-scale.is-flat .product-history-scale-track {
  background: #3b6b60;
}

.product-history-scale-marker {
  position: absolute;
  left: var(--history-position);
  top: 50%;
  width: 15px;
  height: 15px;
  border: 3px solid #081827;
  border-radius: 50%;
  background: #f4fffb;
  box-shadow: 0 0 0 2px #7cf2c6, 0 5px 12px rgba(0, 0, 0, .35);
  transform: translate(-50%, -50%);
}

.product-history-scale-caption {
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

.product-history-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.product-history-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(132, 154, 180, .16);
  border-radius: 11px;
  background: rgba(11, 27, 45, .58);
}

.product-history-metric small {
  color: #8fa4b8;
  font-size: 9px;
}

.product-history-metric strong {
  overflow-wrap: anywhere;
  color: #edf5fb;
  font-size: 14px;
}

.product-history-note,
.product-history-empty,
.product-history-loading {
  color: #91a8bf;
  font-size: 11px;
  line-height: 1.5;
}

.product-history-note {
  margin: 10px 2px 0;
}

.product-history-section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin: 22px 0 9px;
}

.product-history-section-title > div {
  display: grid;
  gap: 4px;
}

.product-history-section-title strong {
  color: #eaf2f9;
  font-size: 14px;
}

.product-history-section-title > span {
  color: #8fa4b8;
  font-size: 10px;
  text-align: right;
}

.product-history-events {
  display: grid;
  gap: 7px;
}

.product-history-event {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(132, 154, 180, .17);
  border-radius: 12px;
  background: rgba(9, 24, 40, .46);
}

.product-history-event > div {
  display: grid;
  gap: 3px;
}

.product-history-event span,
.product-history-event small {
  color: #8fa4b8;
  font-size: 10px;
}

.product-history-event-change {
  justify-items: end;
  text-align: right;
}

.product-history-event-change strong {
  color: #f2f7fb;
  font-size: 15px;
}

.product-history-event-direction {
  width: max-content;
  border-radius: 999px;
  padding: 3px 6px;
  font-weight: 900;
}

.product-history-event-change.down .product-history-event-direction {
  background: rgba(58, 150, 116, .2);
  color: #9cf0c8;
}

.product-history-event-change.up .product-history-event-direction {
  background: rgba(179, 90, 66, .18);
  color: #ffc3ad;
}

.product-history-empty-state {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px dashed rgba(132, 154, 180, .23);
  border-radius: 12px;
  background: rgba(9, 24, 40, .35);
}

.product-history-empty-icon {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(132, 154, 180, .14);
  color: #a9bed1;
  font-weight: 900;
}

.product-history-empty-state > div {
  display: grid;
  gap: 3px;
}

.product-history-empty-state strong {
  color: #dce9f5;
  font-size: 12px;
}

.product-history-empty-state p {
  margin: 0;
}

.product-history-stores {
  margin-top: 16px;
  border-top: 1px solid rgba(132, 154, 180, .18);
  padding-top: 12px;
}

.product-history-stores summary {
  width: fit-content;
  border-radius: 6px;
  color: #cfe0ee;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.product-history-store-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.product-history-store {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(132, 154, 180, .12);
}

.product-history-store > div {
  display: grid;
  gap: 3px;
}

.product-history-store > div:last-child {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.product-history-store span {
  color: #8fa4b8;
  font-size: 10px;
}

@media (max-width: 760px) {
  .product-history-trigger {
    display: inline-flex;
    margin: 8px 0 0;
  }

  .product-price-history-panel {
    padding: 15px;
    border-radius: 16px;
  }

  .product-history-head strong {
    font-size: 18px;
  }

  .product-history-windows {
    max-width: none;
  }

  .product-history-context {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .product-history-context-head {
    flex-direction: column;
  }

  .product-history-current {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
    padding: 12px 0 0;
    border-top: 1px solid rgba(124, 242, 198, .18);
    border-left: 0;
  }

  .product-history-context-evidence {
    grid-column: 1;
  }

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

  .product-history-range-head,
  .product-history-section-title,
  .product-history-event,
  .product-history-store {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-history-section-title > span,
  .product-history-event-change {
    justify-items: start;
    text-align: left;
  }

  .product-history-store > div:last-child {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .product-history-head {
    align-items: center;
  }

  .product-history-close {
    padding: 8px;
    font-size: 11px;
  }

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

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

.product-history-chart-card,
.product-history-summary {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(132, 154, 180, .18);
  border-radius: 16px;
  background: rgba(4, 15, 27, .58);
}

.product-history-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
}

.product-history-chart-head > div:first-child {
  display: grid;
  gap: 3px;
}

.product-history-chart-head small {
  color: #7cf2c6;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.product-history-chart-head strong {
  color: #f3f8fc;
  font-size: 16px;
}

.product-history-chart-head span {
  color: #8fa4b8;
  font-size: 10px;
}

.product-history-series-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
}

.product-history-series-controls button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid rgba(132, 154, 180, .24);
  border-radius: 10px;
  background: rgba(9, 27, 44, .72);
  color: #9cafc1;
  padding: 7px 10px;
  font: 800 10px/1 system-ui;
  cursor: pointer;
}

.product-history-series-controls button:hover:not(:disabled),
.product-history-series-controls button.active {
  border-color: rgba(124, 242, 198, .52);
  background: rgba(20, 61, 47, .78);
  color: #effbf6;
}

.product-history-series-controls button:focus-visible {
  outline: 3px solid rgba(124, 242, 198, .42);
  outline-offset: 2px;
}

.product-history-series-controls button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.product-history-series-controls small {
  color: #7f96aa;
  font-size: 9px;
  font-weight: 600;
}

.product-history-series-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid var(--series-color);
  border-radius: 3px;
  background: transparent;
}

.product-history-series-toggle.active .product-history-series-swatch {
  background: var(--series-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-color) 16%, transparent);
}

.product-history-chart-legend,
.product-history-store-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.product-history-chart-legend {
  color: #c8d5e2;
  font-size: 11px;
  font-weight: 800;
}

.product-history-legend-swatch,
.product-history-store-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: #6ee7b7;
  box-shadow: 0 0 0 3px rgba(110, 231, 183, .12);
}

.product-history-chart-wrap {
  overflow-x: auto;
  padding: 0 8px;
}

.product-history-chart {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.product-history-grid {
  stroke: rgba(151, 173, 197, .17);
  stroke-width: 1;
}

.product-history-axis-label {
  fill: #8fa4b8;
  font: 11px system-ui, sans-serif;
}

.product-history-chart-line {
  fill: none;
  stroke: #6ee7b7;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(52, 211, 153, .22));
}

.product-history-chart-point {
  fill: #071522;
  stroke: #9af6d2;
  stroke-width: 2;
}

.product-history-chart-point:focus {
  outline: none;
  stroke: #fff;
  stroke-width: 4;
}

.product-history-current-line {
  stroke: #f8b84e;
  stroke-width: 1.5;
  stroke-dasharray: 7 5;
}

.product-history-current-label {
  fill: #ffd07a;
  font: 800 11px system-ui, sans-serif;
}

.product-history-chart-caption {
  margin: 0;
  border-top: 1px solid rgba(132, 154, 180, .12);
  padding: 10px 18px 13px;
  color: #8298ae;
  font-size: 10px;
  line-height: 1.45;
}

.product-history-chart-empty {
  margin: 0 18px 18px;
  border: 1px dashed rgba(124, 242, 198, .24);
  border-radius: 13px;
  background: rgba(14, 43, 34, .28);
  padding: 18px;
}

.product-history-chart-empty strong { color: #eaf5ef; }
.product-history-chart-empty p { margin: 6px 0 0; color: #93a8ba; font-size: 11px; line-height: 1.5; }

.product-history-summary .product-history-range-head {
  padding: 15px 18px 12px;
}

.product-history-table-wrap {
  overflow-x: auto;
  border-top: 1px solid rgba(132, 154, 180, .13);
  border-bottom: 1px solid rgba(132, 154, 180, .13);
}

.product-history-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: #c9d8e6;
  font-size: 11px;
}

.product-history-table th,
.product-history-table td {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(132, 154, 180, .1);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.product-history-table th {
  color: #91a7bc;
  background: rgba(9, 27, 44, .82);
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.product-history-table tbody tr:last-child td { border-bottom: 0; }
.product-history-table tbody tr:hover { background: rgba(124, 242, 198, .035); }
.product-history-table td:first-child { display: grid; gap: 3px; }
.product-history-table td:first-child small { color: #8298ae; }
.product-history-summary .product-history-metrics { padding: 14px 16px 16px; }

@media (max-width: 760px) {
  .product-history-chart-head { align-items: flex-start; flex-direction: column; }
  .product-history-series-controls { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 12px; }
  .product-history-series-controls button { flex: 0 0 auto; }
  .product-history-chart { min-width: 560px; }
  .product-history-table { min-width: 700px; }
}
