/* Product cards, chart, tables, and watchlist rows. */
.catalog-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.refresh-button { display: inline-flex; align-items: center; gap: 7px; }
.refresh-button svg { width: 15px; height: 15px; }
#refreshStatus:empty { display: none; }

.catalog-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 16px; }
.filter-field { display: grid; gap: 4px; min-width: 150px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.filter-field select { width: 100%; min-width: 0; min-height: 36px; padding: 0 30px 0 10px; color: var(--ink); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23767b85' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: .88rem; appearance: none; cursor: pointer; }
.filter-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; color: var(--ink-2); font-size: .88rem; cursor: pointer; }
.filter-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.catalog-filters .text-button { min-height: 36px; margin-left: auto; }
.catalog-filters .text-button[hidden] { display: none; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.product-card { display: flex; flex-direction: column; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.product-card:hover { border-color: var(--line-strong); }
.product-card.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.product-image { position: relative; display: grid; place-items: center; height: 150px; margin-bottom: 10px; overflow: hidden; background: #fff; border-radius: 6px; }
.product-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.product-image-fallback { display: none; color: var(--muted); font-size: .8rem; }
.product-image.no-image { background: var(--surface-2); }
.product-image.no-image .product-image-fallback { display: block; }
.product-card h3 { margin: 0; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.product-variant { margin: 2px 0 8px; color: var(--muted); font-size: .8rem; }
.card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: auto 0 4px; }
.card-price strong { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.product-card.out-of-stock .card-price strong { color: var(--muted); font-size: 1.1rem; }
.card-change { font-size: .8rem; font-weight: 600; }
.card-change.drop { color: var(--good); }
.card-installment { margin: 0 0 4px; color: var(--ink-2); font-size: .8rem; }
.card-meta { margin: 0; color: var(--muted); font-size: .78rem; }
.card-meta .savings { color: var(--good); font-weight: 600; }
.card-tag { align-self: flex-start; margin-bottom: 8px; padding: 2px 8px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; font-size: .74rem; font-weight: 700; }
.product-card.top-deal { border-color: var(--accent); }

.catalog-controls { display: flex; gap: 10px; margin-top: 14px; }
.show-more-button, .show-less-button { min-height: 42px; padding: 0 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: .88rem; font-weight: 600; cursor: pointer; }
.show-more-button { flex: 1; }
.show-more-button:hover, .show-less-button:hover { background: var(--surface-2); }
.show-more-button[hidden], .show-less-button[hidden] { display: none; }
.loading-state, .empty-state { grid-column: 1 / -1; min-height: 140px; display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; }

.history-tools { display: grid; justify-items: end; gap: 12px; }
.history-product { min-width: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: start; gap: 14px; }
.history-product-image { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.history-product-image img { width: 100%; height: 100%; object-fit: contain; }
.history-product-image span { color: var(--muted); font-size: .7rem; }
.history-product-image.no-image { background: var(--surface-2); }
.history-product-copy { min-width: 0; }
.summary-strip { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 12px 20px; }
.summary-item span { display: block; color: var(--muted); font-size: .78rem; }
.summary-item strong { font-size: 1.05rem; font-weight: 700; }
.selected-actions { display: flex; gap: 8px; width: 100%; }
.selected-actions .small-button { flex: 1; }

#priceChart { display: block; width: 100%; height: 320px; overflow: visible; }
#priceChart text { stroke: none; }
.chart-wrap { position: relative; min-height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-baseline { stroke-dasharray: 9 8; opacity: .8; }
.chart-tooltip-link { fill: none; stroke: var(--line-strong); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-tooltip { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-tooltip-price { fill: var(--ink); font: 700 28px var(--font); }
.chart-tooltip-date { fill: var(--muted); font: 21px var(--font); }
.chart-axis-price { fill: var(--muted); font-size: 26px; }
.chart-snapshot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-snapshot-large { stroke-width: 5; }
.chart-annotation { fill: var(--muted); font: 24px var(--font); }
.chart-note { fill: var(--ink); font: 600 17px var(--font); }
.chart-label { fill: var(--muted); font: 14px var(--font); }
.chart-point-price { fill: var(--ink); font: 600 15px var(--font); }
.chart-point-date { fill: var(--muted); font: 12px var(--font); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: var(--muted); font-size: .88rem; text-align: center; }
.chart-empty[hidden] { display: none; }
/* "Buy now or wait?": a colored edge says which. */
.verdict { margin: 0 0 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--verdict-color, var(--line-strong)); border-radius: var(--radius); }
.verdict strong { display: block; font-size: 1rem; }
.verdict p { margin: 2px 0 0; color: var(--ink-2); font-size: .88rem; line-height: 1.45; }
.verdict-good { --verdict-color: var(--good); background: var(--good-soft); }
.verdict-wait { --verdict-color: var(--warn); background: var(--warn-soft); }
.verdict-good strong { color: var(--good); }
.verdict-wait strong { color: var(--warn); }
.compare-card .verdict { margin: 10px 0 0; padding: 8px 12px; }
.all-time-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.all-time-price { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.all-time-price span { color: var(--muted); font-size: .8rem; }
.all-time-price strong { font-size: 1.05rem; font-weight: 700; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: .88rem; }
th { color: var(--muted); font-size: .78rem; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.best-offer td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.listing-title { display: block; max-width: 280px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.listing-price { font-weight: 700; white-space: nowrap; }
.listing-installment { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; font-weight: 400; }
.listing-diff { color: var(--muted); white-space: nowrap; }
.best-tag { margin-left: 8px; color: var(--good); font-size: .78rem; font-weight: 600; }
.status { color: var(--good); font-weight: 600; }
.status.unavailable { color: var(--muted); font-weight: 400; }
.store-link { display: grid; place-items: center; width: 32px; height: 32px; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.store-link:hover { color: var(--ink); background: var(--surface-2); }
.empty-inline { padding: 24px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }

.account-panel { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.account-panel > p { margin: 0; color: var(--muted); }
.tracked-list { width: 100%; }
.tracked-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, .8fr) auto; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tracked-row:last-child { border-bottom: 0; }
.tracked-row h3 { margin: 0 0 2px; font-size: .95rem; }
.tracked-row p { margin: 0; color: var(--muted); font-size: .85rem; }
.tracked-row .tracked-price { color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.tracked-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.alert-value { color: var(--ink-2) !important; font-weight: 600; }
.alert-value.reached { color: var(--good) !important; }

/* Compare page */
.compare-pickers { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 14px; margin-bottom: 22px; }
.compare-slot { display: grid; gap: 8px; min-width: 0; }
.compare-slot > label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.picker-search { position: relative; display: flex; align-items: center; min-height: 44px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.picker-search:focus-within { border-color: var(--ink-2); }
.picker-search > svg { flex: 0 0 auto; width: 16px; height: 16px; margin-left: 12px; color: var(--muted); }
.picker-search input { min-width: 0; flex: 1; padding: 0 12px; color: var(--ink); background: transparent; border: 0; outline: 0; font-weight: 600; }
.picker-options { display: grid; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 0 12px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chip.selected { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.compare-vs { align-self: center; margin-top: 22px; color: var(--muted); font-size: .85rem; font-weight: 700; text-transform: uppercase; }
.compare-result h2 { margin: 28px 0 12px; font-size: 1.15rem; }
.compare-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.compare-card h3 { margin: 0; font-size: 1rem; }
.compare-card .muted { margin: 2px 0 8px; }
.spec-table { min-width: 0; table-layout: fixed; }
.spec-table th:first-child { width: 28%; }
.spec-table thead th { color: var(--ink); font-size: .85rem; }
.spec-table thead small { display: block; color: var(--muted); font-weight: 400; }
.spec-table tbody th { color: var(--muted); font-weight: 600; }
.spec-table td { overflow-wrap: anywhere; }
.spec-table td.spec-win { color: var(--ink); font-weight: 700; }
.spec-check { color: var(--good); }
.compare-result td a { color: var(--ink); text-decoration: none; }
.compare-result td a:hover { text-decoration: underline; }
.compare-chart { display: block; width: 100%; height: 280px; }
.compare-chart text { stroke: none; }
.compare-line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.compare-line-a, .compare-key-a::before { stroke: var(--accent); background: var(--accent); }
.compare-line-b, .compare-key-b::before { stroke: #4ea1ff; background: #4ea1ff; }
.compare-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; list-style: none; color: var(--ink-2); font-size: .85rem; }
.compare-legend li::before { display: inline-block; width: 14px; height: 3px; margin: 0 6px 3px 0; content: ""; border-radius: 2px; vertical-align: middle; }
.compare-pick { margin-top: 24px; padding: 24px 28px; background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); border-radius: 12px; }
.compare-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.compare-pick h2 { margin: 0 0 8px; color: var(--good); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.compare-pick-head h2 { margin: 0; }
.compare-pick-phone { display: grid; gap: 16px; margin: 0 0 22px; }
.compare-pick-phone > p { margin: 0; font-size: 1.45rem; font-weight: 400; line-height: 1.25; }
.compare-pick-phone > p strong { font-weight: 700; }
.compare-pick-phone > p span { color: var(--ink-2); font-size: 1.05rem; }
/* The two buttons share the box's full width. */
.compare-pick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-pick-actions > * { width: 100%; min-height: 48px; font-size: .95rem; }
.compare-pick-store { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.compare-pick-store svg { width: 15px; height: 15px; }
.compare-pick-headline { margin: 0 0 10px; padding-top: 20px; border-top: 1px solid color-mix(in srgb, var(--good) 30%, transparent); font-size: 1.1rem; font-weight: 700; line-height: 1.4; }
/* "What's the phone for?" buttons inside the pick box. */
.use-picker { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.use-picker legend { margin-bottom: 12px; padding: 0; font-size: 1.05rem; font-weight: 700; }
.use-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.use-option { display: grid; justify-items: start; gap: 4px; padding: 12px 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; text-align: left; cursor: pointer; }
.use-option:hover { background: var(--surface-2); }
.use-option.selected { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.use-icon { font-size: 1.4rem; line-height: 1; }
.use-option strong { font-size: .95rem; }
.use-option small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.compare-pick ul { margin: 0 0 12px; padding-left: 20px; }
.compare-pick li { margin: 4px 0; line-height: 1.45; }
.compare-pick .muted { margin: 8px 0 0; line-height: 1.6; }
/* Where each phone beats the other, two columns. */
.compare-edges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }
.compare-edge h3 { margin: 0 0 8px; font-size: .95rem; font-weight: 700; line-height: 1.35; }
.compare-edge ul { margin: 0; }
.compare-edge .muted { margin: 0; }
.edge-minor { color: var(--muted); }
.edge-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 50%, transparent); border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.edge-note { font-size: .82rem; }
/* "Thinking" before a first pick: spinner, spec lines ticking in one by one, a filling bar. */
.pick-thinking { padding: 18px 20px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--good) 50%, transparent); border-radius: var(--radius); }
.pick-thinking-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 700; }
.pick-spinner { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, var(--good) 25%, transparent); border-top-color: var(--good); border-radius: 50%; animation: pick-spin .7s linear infinite; }
.compare-pick .pick-steps { margin: 0 0 14px; padding: 0; list-style: none; }
.pick-steps li { margin: 6px 0; color: var(--ink-2); font-size: .9rem; opacity: 0; animation: pick-step .3s ease-out forwards; animation-delay: calc(var(--step) * 280ms); }
.pick-steps li::before { display: inline-block; width: 1.4em; color: var(--good); content: "✓"; }
.pick-progress { height: 4px; overflow: hidden; background: color-mix(in srgb, var(--good) 15%, transparent); border-radius: 2px; }
.pick-progress span { display: block; width: 100%; height: 100%; background: var(--good); transform: scaleX(0); transform-origin: left; animation: pick-fill 1.3s ease-in-out forwards; }
.pick-reveal { animation: pick-step .4s ease-out; }
.pick-reveal .compare-edge li { opacity: 0; animation: pick-step .3s ease-out forwards; animation-delay: calc(.25s + var(--i, 0) * 60ms); }
/* Spec score bar: one segment per phone, in the history chart's colors. */
.pick-label { margin: 0 0 8px; color: var(--ink-2); font-size: .85rem; font-weight: 700; }
.score-meter { margin-top: 18px; }
.score-bar { display: flex; gap: 2px; height: 12px; overflow: hidden; background: color-mix(in srgb, var(--good) 15%, transparent); border-radius: 6px; }
.score-bar span { width: var(--share); }
.score-a, .score-key-a::before { background: var(--accent); }
.score-b, .score-key-b::before { background: #4ea1ff; }
.pick-reveal .score-bar span { animation: score-grow .7s ease-out .2s both; }
.compare-pick .score-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: .88rem; font-weight: 600; }
.score-labels li::before { display: inline-block; width: 10px; height: 10px; margin-right: 6px; content: ""; border-radius: 50%; }
.compare-pick .score-note { margin: 4px 0 0; font-size: .8rem; }
.compare-pick-timing .verdict { margin: 0; }
.compare-suggestions { margin-top: 14px; }
@keyframes score-grow { from { width: 0; } }
@keyframes pick-spin { to { transform: rotate(360deg); } }
@keyframes pick-step { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pick-fill { to { transform: scaleX(1); } }
@media (max-width: 700px) {
  .compare-pickers { grid-template-columns: 1fr; }
  .compare-pick { padding: 20px; }
  .compare-pick-actions { grid-template-columns: 1fr; }
  .compare-edges { grid-template-columns: 1fr; }
  .compare-pick-phone > p { font-size: 1.25rem; }
  .compare-vs { margin: 0; justify-self: center; }
  .compare-cards { grid-template-columns: 1fr; }
  .spec-table th:first-child { width: 34%; }
  .spec-table th, .spec-table td { padding: 10px 8px; font-size: .82rem; }
}
