/* Price Watch dashboard - one stylesheet, no build step.
   Built for a presbyopic reader: 18 px body, 24-40 px prices, 44 px tap targets, strong contrast.
   Colour jobs: one accent (blue) for navigation and actions; green = cheaper / in stock,
   amber = few left / deal ending, red = out of stock. Product photos sit on white tiles. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eceff5;
  --border: #dde2eb;
  --border-strong: #c3cad8;
  --text: #0c111d;
  --text-2: #353d4f;
  --muted: #545d70;            /* 7:1 on white - still readable for small meta text */
  --accent: #2443e6;
  --accent-hover: #1a34c4;
  --accent-ink: #ffffff;
  --accent-soft: #e7ebff;
  --accent-text: #1b33bd;
  --good: #0a7a3d;
  --good-soft: #dcf5e6;
  --good-strong: #13a152;
  --warn: #8f4c00;
  --warn-soft: #ffefcc;
  --warn-strong: #e8960c;
  --bad: #b3261e;
  --bad-soft: #fde5e2;
  --bad-strong: #e0362a;
  --hot: #c2410c;
  --hot-soft: #ffeadd;
  --tile: #ffffff;              /* product photos are white-background shots */
  --tile-border: #e6e9ef;
  --header-bg: rgba(242, 244, 248, 0.86);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, 0.12), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 60px -12px rgba(16, 24, 40, 0.35);
  --banner-a: #1830b8;
  --banner-b: #2f55f5;
  --banner-c: #6b3cf0;
  --chart-line: #2443e6;
  --chart-fill: rgba(36, 67, 230, 0.10);
  --chart-grid: #e3e7ef;
  --chart-oos: rgba(179, 38, 30, 0.10);
  --chart-oos-line: rgba(179, 38, 30, 0.35);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Dark palette: chosen, not inverted - each colour re-stepped for the dark surface. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d13;
    --surface: #131823;
    --surface-2: #181e2b;
    --surface-3: #212838;
    --border: #283042;
    --border-strong: #3a4459;
    --text: #f3f5fa;
    --text-2: #cdd3df;
    --muted: #a4adbf;
    --accent: #7f95ff;
    --accent-hover: #9cadff;
    --accent-ink: #0a0d13;
    --accent-soft: rgba(127, 149, 255, 0.16);
    --accent-text: #aebbff;
    --good: #5fe394;
    --good-soft: rgba(95, 227, 148, 0.13);
    --good-strong: #3ccf77;
    --warn: #ffc65a;
    --warn-soft: rgba(255, 198, 90, 0.14);
    --warn-strong: #f5ab26;
    --bad: #ff8b80;
    --bad-soft: rgba(255, 139, 128, 0.14);
    --bad-strong: #ff6b5e;
    --hot: #ff9a5c;
    --hot-soft: rgba(255, 154, 92, 0.15);
    --tile: #f3f3f1;
    --tile-border: transparent;
    --header-bg: rgba(10, 13, 19, 0.82);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.75);
    --banner-a: #14228a;
    --banner-b: #2440c8;
    --banner-c: #5229c4;
    --chart-line: #8fa2ff;
    --chart-fill: rgba(127, 149, 255, 0.14);
    --chart-grid: #263044;
    --chart-oos: rgba(255, 139, 128, 0.12);
    --chart-oos-line: rgba(255, 139, 128, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d13;
  --surface: #131823;
  --surface-2: #181e2b;
  --surface-3: #212838;
  --border: #283042;
  --border-strong: #3a4459;
  --text: #f3f5fa;
  --text-2: #cdd3df;
  --muted: #a4adbf;
  --accent: #7f95ff;
  --accent-hover: #9cadff;
  --accent-ink: #0a0d13;
  --accent-soft: rgba(127, 149, 255, 0.16);
  --accent-text: #aebbff;
  --good: #5fe394;
  --good-soft: rgba(95, 227, 148, 0.13);
  --good-strong: #3ccf77;
  --warn: #ffc65a;
  --warn-soft: rgba(255, 198, 90, 0.14);
  --warn-strong: #f5ab26;
  --bad: #ff8b80;
  --bad-soft: rgba(255, 139, 128, 0.14);
  --bad-strong: #ff6b5e;
  --hot: #ff9a5c;
  --hot-soft: rgba(255, 154, 92, 0.15);
  --tile: #f3f3f1;
  --tile-border: transparent;
  --header-bg: rgba(10, 13, 19, 0.82);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.75);
  --banner-a: #14228a;
  --banner-b: #2440c8;
  --banner-c: #5229c4;
  --chart-line: #8fa2ff;
  --chart-fill: rgba(127, 149, 255, 0.14);
  --chart-grid: #263044;
  --chart-oos: rgba(255, 139, 128, 0.12);
  --chart-oos-line: rgba(255, 139, 128, 0.4);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 150px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;             /* belt and braces: the phone layout must never scroll sideways */
}
img { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num, .price, .money { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 28px; } }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ header */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--banner-b), var(--banner-c)); color: #fff;
  box-shadow: 0 6px 14px -6px rgba(36, 67, 230, 0.7);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { min-width: 0; }
.brand h1 { font-size: 24px; font-weight: 800; }
.status-line {
  margin: 1px 0 0; font-size: 16px; color: var(--muted); line-height: 1.35;
}
.status-line strong { color: var(--text-2); font-weight: 600; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good-strong); margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 3px var(--good-soft); }
.status-dot.is-stale { background: var(--bad-strong); box-shadow: 0 0 0 3px var(--bad-soft); }
.status-dot.is-event { animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--good-soft); } 50% { box-shadow: 0 0 0 7px transparent; } }
.header-actions { display: flex; gap: 8px; flex: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.is-spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented tabs: one horizontal control; on a phone it scrolls inside itself, never the page. */
.tabs-bar { padding-bottom: 12px; }
.tabs {
  display: flex; gap: 4px; padding: 4px; border-radius: 15px; background: var(--surface-3);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: 100%;
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 1 0 auto; min-height: 46px; padding: 8px 18px; border: 0; border-radius: 11px;
  background: transparent; color: var(--text-2); font-weight: 650; font-size: 18px; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; scroll-snap-align: start;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s;
}
.tab svg { width: 20px; height: 20px; opacity: 0.85; }
.tab:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab[aria-selected="true"] svg { color: var(--accent); opacity: 1; }
.tab-count {
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; font-size: 15px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); display: inline-grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab-count { background: var(--accent-soft); color: var(--accent-text); }
.tab-count.has-new { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------ notices (stale, paused, sample, load error) */
.notices { display: grid; gap: 10px; margin-top: 16px; }
.notices:empty { display: none; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); font-size: 17px;
}
.notice svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.notice strong { font-weight: 700; }
.notice.is-bad { background: var(--bad-soft); border-color: transparent; color: var(--text); }
.notice.is-bad svg { color: var(--bad); }
.notice.is-warn { background: var(--warn-soft); border-color: transparent; }
.notice.is-warn svg { color: var(--warn); }
.notice.is-info { background: var(--accent-soft); border-color: transparent; }
.notice.is-info svg { color: var(--accent-text); }

/* ------------------------------------------------------------------ event banner */
.banner-slot:empty { display: none; }
.event-banner {
  position: relative; overflow: hidden; margin-top: 18px; border-radius: var(--radius-lg); color: #fff;
  background: linear-gradient(120deg, var(--banner-a) 0%, var(--banner-b) 55%, var(--banner-c) 100%);
  box-shadow: var(--shadow-md);
  padding: 22px 22px 20px;
  display: grid; gap: 18px;
}
.event-banner::after {
  /* soft light bloom - decorative only */
  content: ""; position: absolute; inset: auto -80px -140px auto; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.22), transparent); pointer-events: none;
}
.event-kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; background: rgba(255, 255, 255, 0.16); padding: 5px 12px; border-radius: 99px;
}
.event-kicker .live-dot { width: 9px; height: 9px; border-radius: 50%; background: #7dffb0; box-shadow: 0 0 0 0 rgba(125, 255, 176, 0.7); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 9px rgba(125, 255, 176, 0); } 100% { box-shadow: 0 0 0 0 rgba(125, 255, 176, 0); } }
.event-title { font-size: clamp(26px, 4.4vw, 38px); font-weight: 800; margin-top: 10px; line-height: 1.15; }
.event-sub { margin: 6px 0 0; font-size: 18px; color: rgba(255, 255, 255, 0.9); }
.countdown { display: flex; gap: 10px; flex-wrap: wrap; }
.cd-box {
  min-width: 78px; padding: 10px 12px 8px; border-radius: 14px; text-align: center;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.18);
}
.cd-num { display: block; font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; font-family: var(--font-ui); }
.cd-unit { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255, 255, 255, 0.85); }
.event-more { display: flex; flex-wrap: wrap; gap: 8px; font-size: 16px; }
.event-pill { padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.13); color: #fff; }
.event-pill b { font-weight: 700; }
.event-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-on-dark { background: #fff; color: #1830b8; }
.btn-on-dark:hover { background: #eef1ff; color: #1830b8; }
@media (min-width: 900px) {
  .event-banner { grid-template-columns: 1fr auto; align-items: center; padding: 26px 30px; }
  .event-banner .event-foot { grid-column: 1 / -1; }
}
/* Slim strip on the product tabs: title + countdown only. */
.event-banner.is-compact { padding: 14px 18px; gap: 10px; grid-template-columns: 1fr auto; align-items: center; }
.event-banner.is-compact .event-foot, .event-banner.is-compact .event-kicker { display: none; }
.event-banner.is-compact .event-title { font-size: 22px; margin-top: 0; }
.event-banner.is-compact .event-sub { font-size: 16px; margin-top: 2px; }
.event-banner.is-compact .countdown { gap: 6px; }
.event-banner.is-compact .cd-box { min-width: 54px; padding: 6px 8px 5px; border-radius: 11px; }
.event-banner.is-compact .cd-num { font-size: 22px; }
.event-banner.is-compact .cd-unit { font-size: 12px; margin-top: 3px; }
@media (max-width: 560px) {
  .event-banner.is-compact { grid-template-columns: 1fr; }
}
.next-event {
  margin-top: 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px 18px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.next-event .ne-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.next-event .ne-text { flex: 1; min-width: 200px; }
.next-event .ne-title { font-weight: 700; font-size: 19px; }
.next-event .ne-sub { color: var(--muted); font-size: 16px; }

/* ------------------------------------------------------------------ sections / panels */
main { padding-bottom: 40px; }
.panel { padding-top: 26px; animation: panel-in 0.28s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-title { font-size: 28px; font-weight: 800; }
.panel-sub { margin: 4px 0 0; color: var(--muted); font-size: 17px; }
.section-title { font-size: 21px; font-weight: 750; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title .count { font-size: 16px; font-weight: 600; color: var(--muted); }

/* ------------------------------------------------------------------ KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi {
  text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  transition: transform 0.18s var(--ease), box-shadow 0.18s, border-color 0.18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi-num { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 16px; color: var(--muted); font-weight: 600; line-height: 1.3; display: flex; align-items: center; gap: 6px; }
.kpi.is-good .kpi-num { color: var(--good); }
.kpi.is-bad .kpi-num { color: var(--bad); }
.kpi.is-accent .kpi-num { color: var(--accent-text); }
.kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 720px) { .kpi:last-child:nth-child(odd) { grid-column: auto; } }

/* ------------------------------------------------------------------ toolbar: search, sort, chips */
.toolbar { display: grid; gap: 12px; margin-bottom: 18px; }
.toolbar-top { display: flex; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 260px; min-width: 0; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; height: 50px; padding: 0 44px 0 46px; border-radius: 14px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 18px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0;
  border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center;
}
.search-clear:hover { background: var(--surface-3); color: var(--text); }
.select-wrap { position: relative; flex: 0 1 auto; min-width: 0; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; height: 50px; padding: 0 44px 0 16px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 18px; font-weight: 600; max-width: 100%;
}
.select-wrap select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.select-wrap svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; pointer-events: none; color: var(--muted); }
.select-wrap .select-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 560px) {
  .select-wrap { flex: 1 1 100%; }
  .select-wrap select { width: 100%; }
}

.chip-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chip-group-label { flex: none; font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; min-width: 64px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
/* Phones: each chip row becomes one swipeable line instead of five wrapped lines. */
@media (max-width: 720px) {
  .chip-group { flex-direction: column; align-items: stretch; gap: 6px; }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chips > :last-child { margin-right: 24px; }
}
.chip {
  flex: none; min-height: 44px; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: 17px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s var(--ease);
}
.chip:hover { border-color: var(--text-2); color: var(--text); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .chip-n { font-size: 15px; font-weight: 700; opacity: 0.7; font-variant-numeric: tabular-nums; }
.chip .chip-dot { width: 10px; height: 10px; border-radius: 50%; }
.chip.is-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip svg { width: 18px; height: 18px; }

.results-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 14px; color: var(--muted); font-size: 17px; }
.results-line strong { color: var(--text); }
.link-btn { border: 0; background: none; padding: 8px 4px; min-height: 44px; color: var(--accent-text); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent-hover); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px -6px rgba(36, 67, 230, 0.8); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ grids and cards */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.grid.is-dense { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.card.is-clickable { cursor: pointer; }
.card.is-clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.is-new { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }

/* White photo tile: every product photo is shot on white, so the tile frames it cleanly. */
.tile {
  position: relative; background: var(--tile); aspect-ratio: 4 / 3; display: grid; place-items: center;
  overflow: hidden; border-bottom: 1px solid var(--tile-border);
}
.tile img {
  width: 100%; height: 100%; object-fit: contain; padding: 16px;
  mix-blend-mode: multiply;            /* white photo backgrounds melt into the tile, also in dark mode */
  transition: transform 0.35s var(--ease), opacity 0.3s;
}
.tile img.is-loading { opacity: 0; }
.card.is-clickable:hover .tile img { transform: scale(1.035); }
.tile-ph { display: none; flex-direction: column; align-items: center; gap: 6px; color: #8a93a5; font-size: 15px; font-weight: 600; }
.tile-ph svg { width: 40px; height: 40px; }
.tile.no-img img { display: none; }
.tile.no-img .tile-ph { display: flex; }
.tile.no-img { background: repeating-linear-gradient(135deg, var(--tile), var(--tile) 12px, #f1f2f5 12px, #f1f2f5 24px); }
.tile-badges { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.tile-corner { position: absolute; right: 10px; top: 10px; }

.store-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px;
  font-size: 15px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.tag.is-store { background: var(--accent-soft); color: var(--accent-text); }
.tag.is-folder::before { content: ""; width: 14px; height: 11px; border-radius: 2px 3px 3px 3px; background: currentColor; opacity: 0.55; margin-right: 2px; clip-path: polygon(0 0, 40% 0, 50% 18%, 100% 18%, 100% 100%, 0 100%); }
.card-title {
  font-family: var(--font-ui); font-size: 18px; font-weight: 650; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.card-title.lines-3 { -webkit-line-clamp: 3; }
.price-row { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.price-row.has-spark { flex-wrap: nowrap; align-items: center; justify-content: space-between; }
.price-main { display: flex; align-items: baseline; gap: 2px 10px; flex-wrap: wrap; min-width: 0; }
.spark-slot { flex: none; display: inline-flex; }
.price.is-stale { color: var(--text-2); }
.price { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
.price.is-lg { font-size: 40px; }
.price.is-sm { font-size: 24px; }
.price.is-none { font-size: 19px; font-weight: 650; color: var(--muted); letter-spacing: 0; }
.price-label { font-size: 16px; color: var(--muted); font-weight: 600; }
.compare { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; color: var(--muted); }
.compare s { color: var(--text-2); font-weight: 600; text-decoration-thickness: 2px; }
.pct {
  display: inline-flex; align-items: center; height: 28px; padding: 0 9px; border-radius: 8px;
  background: var(--good-soft); color: var(--good); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.pct.is-big { height: 34px; font-size: 19px; padding: 0 12px; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 10px; border-radius: 99px;
  font-size: 15px; font-weight: 700; line-height: 1.2; background: var(--surface-3); color: var(--text-2);
}
.badge svg { width: 16px; height: 16px; flex: none; }
.badge .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.badge.is-good { background: var(--good-soft); color: var(--good); }
.badge.is-warn { background: var(--warn-soft); color: var(--warn); }
.badge.is-bad { background: var(--bad-soft); color: var(--bad); }
.badge.is-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.is-hot { background: var(--hot-soft); color: var(--hot); }
.badge.is-solid { background: var(--accent); color: var(--accent-ink); }
.badge.is-solid-good { background: var(--good-strong); color: #fff; }
.badge.is-solid-bad { background: var(--bad-strong); color: #fff; }
.badge.is-solid-warn { background: var(--warn-strong); color: #1d1300; }
.tile-badges .badge { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
/* Tiles stay white in both themes, so badges on them use fixed light-surface colours. */
.tile-badges .badge.is-hot { background: #fff0e6; color: #b23a06; }

.note { font-size: 16px; color: var(--text-2); display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.note.is-good { color: var(--good); font-weight: 650; }
.note.is-up { color: var(--muted); }
.note.is-warn { color: var(--warn); font-weight: 600; }
.note.is-bad { color: var(--bad); font-weight: 600; }
.state-box { padding: 10px 12px; border-radius: 12px; font-size: 16px; line-height: 1.4; background: var(--warn-soft); color: var(--text); display: flex; gap: 8px; }
.state-box svg { width: 20px; height: 20px; flex: none; color: var(--warn); margin-top: 1px; }
.state-box.is-error { background: var(--bad-soft); }
.state-box.is-error svg { color: var(--bad); }
.state-box.is-paused { background: var(--surface-3); }
.state-box.is-paused svg { color: var(--muted); }
.lowest-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; color: var(--muted); }
.lowest-row b { color: var(--text-2); font-weight: 700; }
.spark { width: 110px; height: 34px; flex: none; overflow: visible; }
.spark path.line { fill: none; stroke: var(--chart-line); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark circle { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.spark.is-low path.line { stroke: var(--good-strong); }
.spark.is-low circle { fill: var(--good-strong); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.card-actions .btn { flex: 1; }
.card-actions .btn-secondary { flex: 0 0 auto; }
.btn-icon { width: 48px; padding: 0; }
.btn-icon svg { width: 21px; height: 21px; }

/* ------------------------------------------------------------------ alerts */
.day-group { margin-top: 26px; }
.day-group:first-child { margin-top: 6px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.day-head h3 { font-size: 21px; font-weight: 800; }
.day-head span { color: var(--muted); font-size: 16px; }
.alert-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.alert-card { flex-direction: row; align-items: stretch; }
.alert-card .tile { width: 132px; flex: none; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--tile-border); }
.alert-card .tile img { padding: 12px; }
.alert-card .card-body { gap: 7px; }
.alert-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.alert-time { font-size: 16px; color: var(--muted); white-space: nowrap; }
.alert-text { font-size: 17px; color: var(--text-2); line-height: 1.45; }
.alert-price { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-price .old { font-size: 19px; color: var(--muted); font-weight: 600; text-decoration: line-through; text-decoration-thickness: 2px; }
.alert-price .arrow { color: var(--muted); width: 20px; height: 20px; }
.alert-price .price { font-size: 28px; }
.type-pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; font-size: 15px; font-weight: 800; letter-spacing: 0.01em; }
.type-pill svg { width: 17px; height: 17px; }
.type-pill.t-drop { background: var(--good-soft); color: var(--good); }
.type-pill.t-deal { background: var(--warn-soft); color: var(--warn); }
.type-pill.t-stock { background: var(--good-strong); color: #fff; }
.type-pill.t-new { background: var(--accent-soft); color: var(--accent-text); }
.type-pill.t-markdown { background: var(--good-soft); color: var(--good); }
.type-pill.t-feed { background: var(--hot-soft); color: var(--hot); }
.new-flag { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
@media (max-width: 560px) {
  .alert-card .tile { width: 96px; }
  .alert-card .card-body { padding: 12px 14px 14px; }
  .alert-card .card-actions { flex-wrap: wrap; }
}

.attention-box { border-radius: var(--radius-lg); background: var(--warn-soft); padding: 4px 0; margin: 4px 0 22px; }
.attention-box > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 18px; min-height: 56px;
  font-weight: 750; font-size: 19px;
}
.attention-box > summary::-webkit-details-marker { display: none; }
.attention-box > summary svg.lead { width: 26px; height: 26px; color: var(--warn); flex: none; }
.attention-box > summary .chev { margin-left: auto; width: 22px; height: 22px; transition: transform 0.2s var(--ease); }
.attention-box[open] > summary .chev { transform: rotate(180deg); }
.attention-list { list-style: none; margin: 0; padding: 0 18px 14px; display: grid; gap: 10px; }
.attention-list li { background: var(--surface); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.attention-list .a-title { font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.attention-list .a-text { color: var(--text-2); font-size: 16px; }
.attention-list .a-main { flex: 1 1 260px; min-width: 0; }

/* ------------------------------------------------------------------ deals */
.new-summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 16px;
}
.new-summary p { margin: 0; font-weight: 650; color: var(--text); }
.new-summary p span { color: var(--text-2); font-weight: 500; }
.deal-card .tile { aspect-ratio: 16 / 11; }
.deal-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 16px; color: var(--muted); }
.deal-meta .votes { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--text-2); }
.deal-meta .votes svg { width: 17px; height: 17px; }
.deal-card .price { font-size: 28px; }
.flame { color: var(--hot); }

/* ------------------------------------------------------------------ Costco aisles */
.aisle { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
.aisle-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; flex-wrap: wrap; }
.aisle-toggle {
  flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 14px; text-align: left; border: 0; background: none;
  padding: 6px 4px; min-height: 56px; border-radius: 12px;
}
.aisle-toggle .chev { width: 26px; height: 26px; flex: none; color: var(--muted); transition: transform 0.22s var(--ease); }
.aisle-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.aisle-name { font-family: var(--font-display); font-size: 21px; font-weight: 800; display: block; overflow-wrap: anywhere; }
.aisle-sub { display: block; font-size: 16px; color: var(--muted); margin-top: 2px; }
.aisle-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.aisle-body { padding: 4px 18px 20px; border-top: 1px solid var(--border); }
.aisle-body[hidden] { display: none; }
.aisle-sub-title { font-size: 18px; font-weight: 750; margin: 18px 0 12px; color: var(--text-2); }
.mini-card .card-body { padding: 12px 14px 14px; gap: 7px; }
.mini-card .card-title { font-size: 17px; }
.mini-card .price { font-size: 25px; }
a.card { text-decoration: none; color: inherit; }
a.card:hover { color: inherit; }
.mini-card.is-oos .tile img { opacity: 0.55; filter: grayscale(0.6); }

/* ------------------------------------------------------------------ searches */
.search-card .card-body { gap: 14px; }
.search-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.search-q { font-size: 23px; font-weight: 800; font-family: var(--font-display); overflow-wrap: anywhere; }
.best-block { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; background: var(--surface-2); border-radius: var(--radius); padding: 12px; }
.best-block .tile { border-radius: 12px; border: 1px solid var(--tile-border); aspect-ratio: 1; }
.best-block .tile img { padding: 10px; }
.best-kicker { font-size: 15px; font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: 0.05em; }
.trend-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.trend-row .spark { width: 200px; height: 46px; }
.result-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.result-list li a { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; text-decoration: none; color: var(--text); }
.result-list li a:hover { background: var(--surface-3); color: var(--text); }
.result-list .r-img { width: 64px; height: 64px; border-radius: 10px; background: var(--tile); display: grid; place-items: center; overflow: hidden; }
.result-list .r-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; mix-blend-mode: multiply; }
.result-list .r-img.no-img img { display: none; }
.result-list .r-title { font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-list .r-price { text-align: right; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.result-list .r-price small { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
.result-list li.is-best a { background: var(--good-soft); }
details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; color: var(--accent-text); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { width: 20px; height: 20px; transition: transform 0.2s var(--ease); }
details.more[open] > summary svg { transform: rotate(180deg); }
@media (max-width: 560px) {
  .best-block { grid-template-columns: 96px 1fr; gap: 12px; }
  .result-list li a { grid-template-columns: 52px 1fr auto; }
  .result-list .r-img { width: 52px; height: 52px; }
}

/* ------------------------------------------------------------------ empty / loading */
.empty {
  text-align: center; padding: 48px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-2); background: var(--surface);
}
.empty svg { width: 52px; height: 52px; color: var(--muted); margin-bottom: 8px; }
.empty h3 { font-size: 21px; margin-bottom: 6px; color: var(--text); }
.empty p { margin: 0 auto; max-width: 560px; }
.empty .btn { margin-top: 16px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-card { height: 420px; border-radius: var(--radius-lg); }

/* ------------------------------------------------------------------ footer */
.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 30px 0 46px; margin-top: 20px; }
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.1fr 1fr; } }
.app-footer h2 { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.watch-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.watch-stat { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.watch-stat b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.watch-stat span { font-size: 16px; color: var(--muted); font-weight: 600; }
.fold { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; background: var(--surface); }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; min-height: 54px; font-weight: 700; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .chev { margin-left: auto; width: 22px; height: 22px; color: var(--muted); transition: transform 0.2s var(--ease); flex: none; }
.fold[open] > summary .chev { transform: rotate(180deg); }
.fold-body { padding: 0 16px 16px; }
.ign-group h4 { font-family: var(--font-ui); font-size: 16px; color: var(--muted); font-weight: 700; margin: 12px 0 6px; }
.ign-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ign-list li { display: flex; gap: 10px; align-items: baseline; font-size: 16px; padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.ign-list li a { overflow-wrap: anywhere; min-width: 0; }
.run-list { list-style: none; margin: 0; padding: 0; }
.run-list li { display: grid; grid-template-columns: 22px 92px 1fr; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
.run-list li svg { width: 18px; height: 18px; align-self: center; }
.run-list .ok svg { color: var(--good); }
.run-list .bad svg { color: var(--bad); }
.run-list .r-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.run-list .r-day { list-style: none; font-weight: 800; padding: 14px 0 4px; display: block; border: 0; font-size: 16px; color: var(--muted); }
.footer-meta { margin-top: 22px; color: var(--muted); font-size: 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.theme-switch { display: inline-flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.theme-switch button { border: 0; background: transparent; min-height: 40px; padding: 6px 14px; border-radius: 9px; font-weight: 650; font-size: 16px; color: var(--text-2); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ detail modal */
dialog.detail {
  width: min(1060px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 0;
  border-radius: 26px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.detail[open] { display: flex; flex-direction: column; animation: dlg-in 0.26s var(--ease); }
dialog.detail:focus-visible { outline: none; }
dialog.detail::backdrop { background: rgba(6, 10, 20, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade-in 0.2s; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
.dlg-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dlg-bar .store-row { flex: 1; min-width: 0; }
.dlg-scroll { overflow-y: auto; overscroll-behavior: contain; }
.dlg-top { display: grid; gap: 24px; padding: 22px; }
@media (min-width: 860px) { .dlg-top { grid-template-columns: 360px 1fr; padding: 26px 28px; } }
.dlg-photo { border-radius: 20px; aspect-ratio: 1; border: 1px solid var(--tile-border); }
.dlg-photo img { padding: 26px; }
.dlg-title { font-size: 24px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.dlg-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dlg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dlg-section { padding: 6px 22px 24px; }
@media (min-width: 860px) { .dlg-section { padding: 6px 28px 28px; } }
.dlg-section h3 { font-size: 20px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; margin: 0; }
.fact { background: var(--surface-2); border-radius: 14px; padding: 11px 14px; min-width: 0; }
.fact dt { font-size: 15px; color: var(--muted); font-weight: 650; }
.fact dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.fact dd small { display: block; font-size: 15px; color: var(--muted); font-weight: 500; }
.seg { display: inline-flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; min-height: 40px; padding: 6px 14px; border-radius: 9px; font-size: 16px; font-weight: 650; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) {
  dialog.detail { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .dlg-photo { aspect-ratio: 4 / 3; }
  .dlg-title { font-size: 21px; }
}

/* ------------------------------------------------------------------ price chart */
.chart-wrap { position: relative; border-radius: var(--radius); background: var(--surface-2); padding: 10px 6px 4px; touch-action: pan-y; }
.chart-wrap:focus-visible { outline-offset: 3px; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }
.chart-wrap .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-wrap .axis-text { fill: var(--muted); font-size: 14px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart-wrap .line { fill: none; stroke: var(--chart-line); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .area { fill: var(--chart-fill); }
.chart-wrap .oos-band { fill: var(--chart-oos); }
.chart-wrap .oos-edge { stroke: var(--chart-oos-line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-wrap .oos-text { fill: var(--bad); font-size: 13px; font-weight: 700; font-family: var(--font-ui); }
.chart-wrap .mk-first { fill: var(--surface); stroke: var(--text-2); stroke-width: 2.5; }
.chart-wrap .mk-low { fill: var(--good-strong); stroke: var(--surface); stroke-width: 2.5; }
.chart-wrap .mk-now { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2.5; }
.chart-wrap .mk-label { font-size: 13px; font-weight: 700; font-family: var(--font-ui); fill: var(--text-2); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.chart-wrap .mk-label.is-low { fill: var(--good); }
.chart-wrap .guide { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 3; }
.chart-wrap .hover-dot { fill: var(--surface); stroke: var(--chart-line); stroke-width: 3; }
.chart-tip {
  position: absolute; top: 8px; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 12px;
  padding: 8px 12px; font-size: 15px; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow-md);
  opacity: 0; transition: opacity 0.12s; z-index: 2;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-tip .t-oos { color: var(--bad-soft); font-weight: 700; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 15px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { display: inline-block; flex: none; }
.lg-line { width: 18px; height: 3px; border-radius: 2px; background: var(--chart-line); }
.lg-oos { width: 16px; height: 14px; border-radius: 3px; background: var(--chart-oos); border: 1px dashed var(--chart-oos-line); }
.lg-low { width: 12px; height: 12px; border-radius: 50%; background: var(--good-strong); }
.lg-first { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--text-2); }
.change-table { width: 100%; border-collapse: collapse; font-size: 17px; margin-top: 6px; }
.change-table th { text-align: left; font-size: 15px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.change-table td { padding: 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.change-table td.dn { color: var(--good); font-weight: 700; }
.change-table td.up { color: var(--bad); font-weight: 700; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; font-size: 17px;
  box-shadow: var(--shadow-lg); transition: opacity 0.25s, transform 0.25s var(--ease); max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 20px; height: 20px; flex: none; }

/* ------------------------------------------------------------------ motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .card.is-clickable:hover, .kpi:hover { transform: none; }
  .card.is-clickable:hover .tile img { transform: none; }
}
@media (forced-colors: active) {
  .chip[aria-pressed="true"], .tab[aria-selected="true"] { outline: 2px solid CanvasText; }
}

/* ------------------------------------------------------------------ phone tuning */
.nowrap { white-space: nowrap; }
@media (max-width: 560px) {
  /* All five sections stay visible on a phone: two rows of big tabs instead of a
     row that scrolls sideways with no sign that "Costco aisles" and "Searches" exist. */
  .tabs { flex-wrap: wrap; overflow-x: visible; scroll-snap-type: none; }
  .tab { flex: 1 1 auto; min-height: 44px; justify-content: center; }
  .brand h1 { font-size: 22px; }
  .brand-mark { width: 40px; height: 40px; }
  .status-line { font-size: 15px; }
  .header-row { gap: 10px; }
  .tab { padding: 8px 12px; font-size: 17px; gap: 6px; }
  .tab svg { display: none; }                 /* words alone, so more tabs fit before scrolling */
  .countdown { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
  .cd-box { min-width: 0; padding: 9px 4px 7px; }
  .cd-num { font-size: 28px; }
  .cd-unit { font-size: 12px; }
  .event-banner { padding: 18px 16px; }
  .item-card .tile, .deal-card .tile { aspect-ratio: 16 / 10; }
  .panel-title { font-size: 25px; }
}
