.chart-panel {
  --series-trf: var(--trf, #2e6c53);
  --series-egf: var(--egf, #8a5b42);
  --chart-grid: #e6dece;
  --chart-zero: #a39883;
  --chart-tint: #f4eee3;
  container: sales-panel / inline-size;
  min-width: 0;
}
.chart-panel .chart-panel-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; }
.chart-panel .chart-panel-heading p { color: var(--muted); }
.chart-panel .chart-mode-switch { align-self: flex-start; }
.chart-panel #chart-legend {
  display: flex;
  margin: 15px 0 0;
  gap: 7px 20px;
  color: var(--ink);
  font-size: .77rem;
  font-weight: 620;
}
.chart-panel #chart-legend [data-chart-store] { display: inline-flex; align-items: center; gap: 7px; }
.chart-panel #chart-legend[hidden], .chart-panel #chart-legend [hidden] { display: none; }
.chart-panel .dot, .trend-key {
  display: inline-block;
  width: 17px;
  height: 0;
  border-radius: 0;
  border-top: 3px solid var(--series-trf);
  background: none;
}
.chart-panel .dot.egf, .trend-key.series-egf { border-color: var(--series-egf); border-top-style: dashed; background: none; }
.chart-panel .chart-region {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: stretch;
  column-gap: 9px;
  row-gap: 0;
  margin: 13px 3px 0 0;
}
.chart-panel .chart-region[hidden] { display: none; }
.chart-panel .chart-unit {
  grid-column: 1 / -1;
  margin: 0 0 13px;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 650;
}
.chart-panel #chart-scale {
  position: relative;
  min-width: 1.5em;
  margin: 0;
  color: var(--muted);
  font-size: .69rem;
  line-height: 1;
  text-align: right;
}
.chart-panel #chart-scale > span { position: absolute; right: 0; transform: translateY(-50%); }
.chart-panel #chart {
  display: block;
  position: relative;
  min-height: 0;
  height: clamp(148px, 26cqw, 205px);
  isolation: isolate;
}
.chart-panel #chart > svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sales-grid line, .sales-series :is(.series-line, .series-point) { vector-effect: non-scaling-stroke; }
.sales-grid .tick { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 2 4; }
.sales-grid .zero { stroke: var(--chart-zero); stroke-width: 1; }
.sales-series { color: var(--series-trf); }
.sales-series.series-egf { color: var(--series-egf); }
.series-fill { stroke: none; fill: currentColor; opacity: .09; }
.series-egf .series-fill { opacity: .055; }
.series-line { stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.series-egf .series-line { stroke-dasharray: 5 5; }
.series-point { stroke: currentColor; stroke-width: 5; stroke-linecap: round; }
.chart-panel #chart-dates {
  position: relative;
  grid-column: 2;
  margin-top: 10px;
  height: 20px;
  color: var(--muted);
  font-size: .69rem;
  font-variant-numeric: tabular-nums;
}
#chart-dates span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
#chart-dates span:first-child { transform: none; }
#chart-dates span:last-child { transform: translateX(-100%); }
.trend-scrubber { position: absolute; inset: 0; z-index: 2; cursor: crosshair; touch-action: pan-y; }
.trend-scrubber:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; border-radius: 2px; }
.trend-cursor {
  position: absolute;
  inset-block: 0;
  width: 1px;
  background: var(--chart-zero);
  pointer-events: none;
}
.trend-tooltip {
  position: absolute;
  z-index: 3;
  top: 8px;
  min-width: 112px;
  padding: 9px 11px;
  transform: translateX(6px);
  border-radius: 5px;
  background: var(--forest);
  color: var(--paper);
  box-shadow: 0 3px 12px #132b2229;
  font-size: .73rem;
  line-height: 1.6;
  pointer-events: none;
}
.trend-tooltip.align-end { transform: translateX(calc(-100% - 6px)); }
.trend-tooltip > strong { display: block; margin-bottom: 3px; }
.trend-reading { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.trend-reading b { margin-left: auto; padding-left: 6px; white-space: nowrap; }
.trend-reading .trend-key { width: 13px; border-color: #a4ceae; }
.trend-reading .trend-key.series-egf { border-color: #edb48b; }
.chart-panel .chart-daily {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.chart-panel .chart-daily summary {
  min-height: 34px;
  align-content: center;
  color: var(--green);
  font-size: .77rem;
  font-weight: 680;
}
.chart-panel .chart-daily summary:hover { text-decoration: underline; text-underline-offset: .18em; }
.chart-panel .chart-daily summary:focus-visible,
.chart-panel .chart-product-scroll:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.chart-panel .chart-daily thead th { background: var(--chart-tint); color: var(--muted); }
.chart-panel .chart-daily td, .chart-panel .chart-daily thead th:not(:first-child) { text-align: right; }
.chart-panel .chart-daily tbody th { background: transparent; color: var(--ink); text-align: left; }
.chart-panel .chart-product-scroll {
  max-height: 338px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  scrollbar-width: thin;
}
.chart-product-table { border-spacing: 0; font-variant-numeric: tabular-nums; }
.chart-panel .chart-product-table th, .chart-panel .chart-product-table td { padding: 10px 13px; }
.chart-panel .chart-product-table thead th { background: var(--chart-tint); color: var(--muted); }
.chart-panel .chart-product-table tbody tr:nth-child(even) { background: #faf6ee; }
.chart-panel .chart-product-table tbody tr:hover { background: var(--chart-tint); }
.chart-panel .chart-product-table :is(th, td):last-child { text-align: right; }
.chart-product-name, .chart-product-units { color: var(--ink); }
.chart-product-source { color: var(--muted); }
.chart-panel .chart-product-rail { height: 4px; min-width: 62px; background: var(--chart-tint); }
.chart-panel .chart-product-rail::after { background: var(--chart-zero); }
.chart-panel .chart-product-bar { background: var(--series-trf); }
.chart-panel .chart-product-bar.is-negative { background: var(--series-egf); }
@container sales-panel (max-width: 420px) {
  #chart-dates .dense-date { display: none; }
  .chart-panel #chart { height: 148px; }
  .chart-panel #chart-legend { gap: 4px 12px; font-size: .71rem; }
  .chart-panel .chart-product-table th, .chart-panel .chart-product-table td { padding: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sales-series { animation: sales-series-in .22s ease-out both; }
  @keyframes sales-series-in { from { opacity: 0; } to { opacity: 1; } }
}
