/* Amazon history (Keepa). Series ink is a deeper sky than --accent so 2px lines
   clear 3:1 against white (validated: #0a7cc2 passes, #11a8ff is 2.54:1). */
#keepa-page,
.keepa-dialog {
  --keepa-series: #0a7cc2;
  --keepa-grid: var(--color-stone-divider);
  --keepa-axis: var(--color-graphite-body);
  --keepa-coupon: var(--color-amber-highlight);
}
.keepa-table { min-width: 1320px; }
.keepa-table td { vertical-align: middle; }
.keepa-table .numeric,
.keepa-table-view .numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.keepa-product { min-width: 320px; max-width: 460px; white-space: normal; line-height: 1.5; }
.keepa-category { max-width: 180px; white-space: normal; }
.keepa-muted { color: var(--muted); }
.keepa-change { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.keepa-coupon { display: inline-block; padding: 2px 6px; border-radius: var(--radius-badge); background: var(--keepa-coupon); font-size: 12px; white-space: nowrap; }
.keepa-spark { display: block; overflow: visible; }
.keepa-spark path { fill: none; stroke: var(--keepa-series); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.keepa-spark circle { fill: var(--keepa-series); stroke: var(--paper); stroke-width: 1.5; }

.keepa-dialog { width: min(1040px, calc(100% - 32px)); }
.keepa-facts { margin-bottom: 20px; }
.keepa-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.keepa-range {
  min-height: 32px; padding: 4px 12px; border: 1px solid var(--color-ash-border); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 13px; cursor: pointer;
}
.keepa-range:hover { background: var(--color-fog-surface); }
.keepa-range.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.keepa-range:focus-visible, .keepa-charts:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.keepa-amazon-link { margin-left: auto; font-size: 13px; }

.keepa-charts { position: relative; border-radius: 8px; }
.keepa-chart { margin: 0 0 12px; }
.keepa-chart figcaption { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.keepa-chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.keepa-grid { stroke: var(--keepa-grid); stroke-width: 1; }
.keepa-axis { fill: var(--keepa-axis); font-size: 12px; font-variant-numeric: tabular-nums; }
.keepa-line { fill: none; stroke: var(--keepa-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.keepa-coupon-band { fill: var(--keepa-coupon); }
.keepa-crosshair { stroke: var(--color-silver-muted); stroke-width: 1; }
.keepa-dot { fill: var(--keepa-series); stroke: var(--paper); stroke-width: 2; }
.keepa-tooltip {
  position: absolute; top: 24px; z-index: 2; min-width: 160px; padding: 10px 12px; pointer-events: none;
  background: var(--paper); border-radius: 8px; box-shadow: var(--shadow-card); font-size: 12px;
}
.keepa-tooltip strong { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.keepa-tooltip div { display: flex; justify-content: space-between; gap: 16px; line-height: 1.7; }
.keepa-tooltip b { order: 2; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.keepa-tooltip span { color: var(--muted); }
.keepa-table-view { margin-top: 16px; }
.keepa-table-view summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.keepa-table-view .table-wrap { max-height: 360px; overflow: auto; margin-top: 8px; }

/* Collection progress (queue + token budget). */
.keepa-progress { margin-bottom: 16px; padding: 20px; }
.keepa-progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.keepa-progress-head h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.keepa-progress-head p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.keepa-progress-head p::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
  background: var(--color-ash-border); vertical-align: 1px;
}
.keepa-progress-head p[data-state="running"]::before { background: var(--color-mint-active); }
.keepa-progress-head p[data-state="waiting_tokens"]::before { background: var(--keepa-series); }
.keepa-progress-head p[data-state="done"]::before { background: var(--ink); }
.keepa-meter { margin: 16px 0 12px; }
.keepa-meter-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.keepa-meter-label strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.keepa-meter-track { height: 8px; border-radius: 4px; background: var(--color-stone-divider); overflow: hidden; }
.keepa-meter-track span { display: block; height: 100%; border-radius: 4px; background: var(--keepa-series); transition: width 0.4s var(--ease-out); }
.keepa-meter-regions { margin: 6px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.keepa-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0; }
.keepa-metrics div { min-width: 0; }
.keepa-metrics dt { font-size: 12px; color: var(--muted); }
.keepa-metrics dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.keepa-metrics small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.keepa-failing { margin-top: 16px; }
.keepa-failing summary { cursor: pointer; font-size: 13px; color: var(--ink); }
.keepa-failing .table-wrap { max-height: 280px; overflow: auto; margin-top: 8px; }
.keepa-failing .numeric { text-align: right; }
.keepa-error { max-width: 420px; white-space: normal; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .keepa-progress-head { flex-direction: column; }
}
.keepa-categories { margin-top: 20px; }
.keepa-categories-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.keepa-categories-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.keepa-categories-head span { font-size: 12px; color: var(--muted); }
.keepa-categories td { font-size: 13px; }
.keepa-issue { color: var(--ink); font-weight: 500; }
.keepa-row-muted td { color: var(--muted); }
