/* Fonts load from <link> tags in index.html (an @import here delays first paint). */

/* Grocery-store look: warm off-white aisles, white cards, fresh green for actions,
   yellow shelf tags for prices and red for sale callouts. */
:root {
  --bg:        #f6f7f2;
  --surface:   #ffffff;
  --surface-2: #f1f4ed;
  --ink:       #17231b;
  --ink-2:     #3d4a41;
  --muted:     #66726a;
  --line:      #e3e7de;
  --line-2:    #d3d9cd;
  --green:     #1b7f45;
  --green-600: #166c3a;
  --green-700: #0f5a2f;
  --green-50:  #ebf6ef;
  --green-100: #d3ecdc;
  --red:       #d23c28;
  --red-50:    #fdeeeb;
  --yellow:    #ffd23f;
  --yellow-50: #fff7d9;
  --amber:     #8a5a00;
  --radius:    14px;
  --shadow-sm: 0 1px 2px rgba(23, 35, 27, 0.06), 0 1px 3px rgba(23, 35, 27, 0.06);
  --shadow-md: 0 8px 24px rgba(23, 35, 27, 0.09);
  --sans:      'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num:       'Barlow Condensed', 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Category tile tints */
  --cat-veg: #e4f3e3;  --cat-fruit: #fde8e3;  --cat-meat: #fbe3e6;  --cat-dairy: #e6eefb;
  --cat-bakery: #f8ecdb;  --cat-pantry: #f3eee2;  --cat-frozen: #e2f2f8;  --cat-snacks: #fbefd6;
  --cat-drinks: #e9e6f8;  --cat-household: #eceff1;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; font-weight: 600; }
a:hover { color: var(--green-700); text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(27, 127, 69, 0.35); outline-offset: 2px; }

/* ── Top bar ────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 28px 6px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); flex-shrink: 0; margin-right: auto; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; height: 42px; padding: 0 11px; border-radius: 12px;
  font-weight: 800; font-size: 1rem; letter-spacing: 0.04em;
  color: #fff; background: var(--green);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}
.brand-mark.small { height: 28px; padding: 0 7px; border-radius: 8px; font-size: 0.72rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: 0.76rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

.postal {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 5px 5px 5px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.postal .pin { width: 17px; height: 17px; fill: none; stroke: var(--green); stroke-width: 2; }
.postal label { font-size: 0.78rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.postal input {
  width: 78px; padding: 4px 2px; border: 0; background: transparent; outline: none;
  font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.postal input.bad { color: var(--red); }

.tab-bar {
  max-width: 1240px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  position: relative; background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  padding: 10px 10px 12px; font-size: 0.9rem; font-weight: 600; color: var(--muted);
  transition: color .15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--green); transform: scaleX(0); transition: transform .2s;
}
.tab-btn.active { color: var(--green); }
.tab-btn.active::after { transform: scaleX(1); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-size: 0.92rem; font-weight: 700; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--green); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15); }
.btn.primary:hover { background: var(--green-600); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--green); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--green); background: var(--green-50); color: var(--green-700); }
.btn.small { padding: 8px 14px; font-size: 0.8rem; }

/* ── Layout ─────────────────────────────────────────────────────── */
main { max-width: 1240px; margin: 0 auto; padding: 0 28px 72px; }
.tab-panel { display: none; padding-top: 28px; animation: fadeUp .25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.subsection-title { font-size: 1.05rem; font-weight: 700; margin: 36px 0 12px; }
.caption { color: var(--muted); font-size: 0.95rem; margin-bottom: 22px; max-width: 72ch; }

.block { margin-top: 56px; }
.block-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 16px; }
.block-head h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.block-head p { color: var(--muted); font-size: 0.92rem; }

/* ── Hero / search ──────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 44px 28px 26px; border-radius: 24px;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 210, 63, 0.28), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(27, 127, 69, 0.14), transparent 45%),
    linear-gradient(180deg, #eef7f0, #e6f2e9);
  border: 1px solid var(--green-100);
}
.eyebrow {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--green-100);
  font-size: 0.78rem; font-weight: 700; color: var(--green-700);
}
.eyebrow span { color: var(--muted); font-weight: 600; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.9rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; max-width: 18ch; margin: 0 auto 12px; }
.lede { color: var(--ink-2); font-size: 1.02rem; max-width: 56ch; margin: 0 auto 26px; }

.search {
  position: relative; display: flex; align-items: center; gap: 8px;
  max-width: 680px; margin: 0 auto; padding: 6px 6px 6px 50px;
  background: var(--surface); border: 2px solid var(--line-2); border-radius: 999px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(27, 127, 69, 0.14), var(--shadow-md); }
.search-icon { position: absolute; left: 18px; width: 21px; height: 21px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 1.05rem; font-weight: 500; padding: 10px 0; }
.search input::placeholder { color: #9aa49d; font-weight: 400; }

.quick { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 18px auto 0; max-width: 900px; }
.quick-label, .stores-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chips { display: contents; }
.chip {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2);
  font-size: 0.85rem; font-weight: 600; transition: all .15s;
}
.chip:hover { border-color: var(--green); color: var(--green-700); background: var(--green-50); }
.chip.mine { border-color: var(--green-100); background: var(--green-50); color: var(--green-700); }
.chip.reset { border-style: dashed; color: var(--muted); background: transparent; font-weight: 500; }

.stores-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px; margin-top: 22px; }
.store-toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.store-toggle {
  display: grid; place-items: center; height: 40px; min-width: 84px; padding: 4px 10px;
  border-radius: 10px; cursor: pointer; background: var(--surface); border: 2px solid var(--green);
  transition: opacity .15s, filter .15s, border-color .15s;
}
.store-toggle .logo { height: 26px; max-width: 92px; }
.store-toggle.off { border-color: var(--line-2); opacity: 0.45; filter: grayscale(1); }
.store-toggle:hover { opacity: 1; }

.status { margin-top: 18px; font-size: 0.8rem; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.status .warn { color: var(--amber); font-weight: 600; }
.status .err { color: var(--red); font-weight: 600; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Logos ──────────────────────────────────────────────────────── */
.logo { display: block; height: 24px; width: auto; max-width: 96px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.logo.sm { height: 18px; max-width: 70px; border-radius: 3px; }
.logo.lg { height: 34px; max-width: 130px; }
.logo.xl { height: 44px; max-width: 150px; }

/* ── Results ────────────────────────────────────────────────────── */
#results:not(:empty) { margin-top: 36px; scroll-margin-top: 120px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 16px; }
.results-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.results-head h2 em { font-style: normal; color: var(--green); }
.results-head .meta { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.cat-title { display: flex; align-items: center; gap: 10px; }
.cat-title .cat-icon { width: 28px; height: 28px; }
.results-head .cat-title + .meta { margin-right: auto; }

.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 26px; }
.verdict {
  display: grid; grid-template-columns: 116px 1fr; gap: 18px; align-items: center;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--green);
  box-shadow: var(--shadow-md);
}
.verdict-label {
  display: inline-block; margin-bottom: 8px; padding: 3px 9px; border-radius: 6px;
  background: var(--green); color: #fff; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.verdict-price {
  display: inline-block; padding: 2px 10px 0; border-radius: 6px; background: var(--yellow);
  font-family: var(--num); font-weight: 700; font-size: 2.2rem; line-height: 1.1;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
}
.verdict-price small { font-size: 1rem; font-weight: 600; margin-left: 2px; }
.verdict-store { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 10px 0 2px; }
.verdict-item { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.verdict-save { margin-top: 8px; font-size: 0.84rem; font-weight: 700; color: var(--green); }
.pm-tip {
  grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px; font-size: 0.85rem; line-height: 1.45;
  background: var(--green-50); color: var(--ink-2);
}
.pm-tip b { color: var(--green-700); }
.pm-tip .ico {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 800;
}

/* ── Store cards ────────────────────────────────────────────────── */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.store-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.store-card.empty { background: var(--surface-2); box-shadow: none; }
.store-card.empty .logo { filter: grayscale(0.6); opacity: 0.75; }
.store-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.store-head .name { font-weight: 700; font-size: 0.98rem; white-space: nowrap; }
.store-head .best { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.badge {
  font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.badge.yes { color: var(--green-700); background: var(--green-100); }
.badge.no { color: var(--muted); background: var(--surface-2); }
.badge.unknown { color: var(--amber); background: var(--yellow-50); }

.items { list-style: none; display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 80px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.is-best { background: var(--yellow-50); }
.thumb {
  width: 80px; height: 80px; border-radius: 10px; overflow: hidden; cursor: zoom-in; padding: 4px;
  background: #fff; border: 1px solid var(--line); display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.noimg { background: var(--surface-2); cursor: default; color: var(--muted); font-size: 0.66rem; }
.item-name { font-size: 0.9rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item-name a { font-weight: 500; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: 0.74rem; color: var(--muted); align-items: center; }
.tag { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.tag.best { background: var(--green); color: #fff; }
.tag.close { background: var(--yellow-50); color: var(--amber); }
.tag.sale { background: var(--red-50); color: var(--red); }
.tag.soon { background: var(--yellow-50); color: var(--amber); }
.soon-text { color: var(--amber); font-weight: 600; }
.item-price { text-align: right; white-space: nowrap; }
.item-price .p { font-family: var(--num); font-weight: 700; font-size: 1.45rem; line-height: 1; }
.is-best .item-price .p { background: var(--yellow); padding: 1px 6px 0; border-radius: 5px; }
.item-price .u { font-size: 0.76rem; color: var(--muted); font-weight: 600; margin-left: 2px; }
.item-price .eff { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 3px; }
.item-price .was { display: block; font-size: 0.74rem; color: var(--muted); text-decoration: line-through; }
.empty-msg { padding: 20px 16px; color: var(--muted); font-size: 0.88rem; }
.more-btn { padding: 11px; background: transparent; border: 0; border-top: 1px solid var(--line); color: var(--green); font-size: 0.84rem; font-weight: 700; cursor: pointer; }
.more-btn:hover { background: var(--green-50); }

.note { margin-top: 18px; font-size: 0.8rem; color: var(--muted); text-align: center; }

/* Loading skeleton */
.skeleton { height: 220px; border-radius: var(--radius); background: linear-gradient(90deg, #eceee8 0%, #f6f7f3 50%, #eceee8 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Categories ─────────────────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.cat-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 16px; border-radius: var(--radius); cursor: pointer;
  background: var(--tint, var(--surface-2)); border: 2px solid transparent;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cat-tile.active { border-color: var(--green); box-shadow: var(--shadow-md); }
.cat-icon { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.cat-tile .cat-icon {
  width: 46px; height: 46px; padding: 8px; margin-bottom: 6px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.75); stroke: var(--green-700);
}
.cat-name { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.cat-count { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.cat-pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: thin; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2);
  font-size: 0.84rem; font-weight: 600; color: var(--ink-2); transition: all .15s;
}
.cat-pill .cat-icon { width: 17px; height: 17px; stroke-width: 2; }
.cat-pill span { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.cat-pill:hover { border-color: var(--green); }
.cat-pill.active { background: var(--green); border-color: var(--green); color: #fff; }
.cat-pill.active .cat-icon { stroke: #fff; }
.cat-pill.active span { color: rgba(255, 255, 255, 0.8); }

/* ── How it works ───────────────────────────────────────────────── */
.how-grid { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.how-grid li {
  counter-increment: step; display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.how-grid li::before {
  content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-50); color: var(--green-700); font-weight: 800; font-size: 0.9rem; margin-bottom: 4px;
}
.how-grid b { font-size: 0.98rem; }
.how-grid span { font-size: 0.88rem; color: var(--muted); }

/* ── Price matching tab ─────────────────────────────────────────── */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.pm-card { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.pm-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; }
.pm-card-head .name { font-weight: 700; margin-right: auto; white-space: nowrap; }
.pm-card-head .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pm-card p { font-size: 0.87rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.pm-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 560px; }
.pm-table th, .pm-table td { padding: 11px 14px; text-align: center; border-bottom: 1px solid var(--line); }
.pm-table th { font-size: 0.74rem; font-weight: 700; color: var(--muted); background: var(--surface-2); }
.pm-table td:first-child, .pm-table th:first-child { text-align: left; font-weight: 700; }
.pm-table td:first-child { display: flex; align-items: center; gap: 8px; }
.pm-table tr:last-child td { border-bottom: 0; }
.pm-table .y { color: var(--green); font-weight: 800; }
.pm-table .n { color: #b5bdb7; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.tips { margin-top: 20px; padding-left: 18px; color: var(--ink-2); font-size: 0.9rem; display: grid; gap: 6px; }

/* ── Flyers tab ─────────────────────────────────────────────────── */
.flyer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.flyer-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); border-top: 4px solid var(--store);
}
.flyer-logo { height: 56px; display: flex; align-items: center; margin-bottom: 8px; }
.flyer-card .name { font-weight: 800; font-size: 1.05rem; }
.flyer-card .row { font-size: 0.85rem; color: var(--muted); }
.flyer-card .missing { color: var(--amber); font-size: 0.85rem; font-weight: 600; }
.flyer-links { display: flex; align-items: center; gap: 14px; margin-top: auto; padding-top: 14px; font-size: 0.84rem; }

/* ── Store deals tab ────────────────────────────────────────────── */
.deals-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; margin-bottom: 24px; }
.deal-store {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px 10px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.deal-store .logo { height: 30px; max-width: 110px; }
.deal-store-name { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.deal-store .count { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.deal-store:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.deal-store.active { border-color: var(--green); background: var(--green-50); }
.deal-store.active .count { background: var(--green); color: #fff; }

.deals-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px;
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.deals-title { display: flex; align-items: center; gap: 12px; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.deals-sub { margin-top: 6px; font-size: 0.84rem; color: var(--muted); }
.deals-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.deals-tools input, .deals-tools select {
  padding: 9px 14px; border-radius: 999px; outline: none;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 0.86rem; font-weight: 500; transition: border-color .15s, box-shadow .15s;
}
.deals-tools input { width: 230px; }
.deals-tools select { cursor: pointer; }
.deals-tools input:focus, .deals-tools select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(27, 127, 69, 0.14); }

.deal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.top-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.deal-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.deal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.deal-media { position: relative; }
.deal-card .thumb { width: 100%; height: 160px; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); padding: 12px; }
.deal-media .rank {
  position: absolute; top: 10px; left: 10px; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff;
  font-weight: 800; font-size: 0.82rem; pointer-events: none;
}
.deal-media .off {
  position: absolute; top: 10px; right: 10px; padding: 3px 8px; border-radius: 6px;
  background: var(--red); color: #fff; font-size: 0.74rem; font-weight: 800; pointer-events: none;
}
.deal-store-row { display: flex; align-items: center; gap: 7px; padding: 10px 14px 0; font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.deal-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 14px; flex: 1; }
.deal-price { line-height: 1.1; }
.deal-price .p { font-family: var(--num); font-weight: 700; font-size: 1.6rem; }
.deal-price .u { font-size: 0.76rem; color: var(--muted); font-weight: 600; margin-left: 2px; }
.deal-price .u.long { display: block; margin: 2px 0 0; text-transform: lowercase; }
.deal-price .was { font-size: 0.78rem; color: var(--muted); text-decoration: line-through; margin-right: 6px; }
.deal-price .eff { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 3px; }
.deal-name { font-size: 0.86rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.deal-card .item-meta { margin-top: auto; }
.deal-skel { height: 300px; }
.deals-more { display: flex; margin: 24px auto 0; }

/* ── Side nav (Compare tab) ─────────────────────────────────────── */
#hero, .block { scroll-margin-top: 130px; }
.side-nav {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border-radius: 999px; border: 1px solid rgba(23, 35, 27, 0.08);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.side-nav[hidden] { display: none; }
.side-nav button {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; cursor: pointer; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side-nav button:hover { background: rgba(27, 127, 69, 0.1); color: var(--green-700); }
.side-nav button.active { background: var(--green); color: #fff; }
/* Label slides out to the left on hover or keyboard focus */
.side-nav span {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(6px, -50%);
  padding: 5px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 0.78rem; font-weight: 600;
  opacity: 0; transition: opacity .15s, transform .15s;
}
.side-nav button:hover span, .side-nav button:focus-visible span { opacity: 1; transform: translate(0, -50%); }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer { background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 28px 28px 36px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px 32px; align-items: center;
  font-size: 0.82rem; color: var(--muted);
}
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); white-space: nowrap; }

/* ── Lightbox ───────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(15, 25, 18, 0.72); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox figure { max-width: min(720px, 100%); text-align: center; padding: 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.lightbox img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.lightbox figcaption { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }
.lightbox figcaption b { color: var(--ink); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .top-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (max-width: 1320px) {
  .side-nav { right: 8px; }
  main { padding-right: 72px; }
}
@media (max-width: 860px) {
  .side-nav { top: auto; bottom: 16px; right: 50%; transform: translateX(50%); flex-direction: row; }
  .side-nav span { display: none; }
  .topbar-inner { padding: 10px 16px 4px; gap: 12px; }
  .brand-sub { display: none; }
  .tab-bar { padding: 0 8px; }
  main { padding: 0 16px 56px; }
  .tab-panel { padding-top: 16px; }
  .hero { padding: 30px 16px 20px; border-radius: 18px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; padding: 24px 16px 32px; }
  .block { margin-top: 44px; }
}
@media (max-width: 520px) {
  .brand { gap: 9px; }
  .brand-mark { height: 36px; padding: 0 8px; font-size: 0.85rem; }
  .brand-name { font-size: 0.86rem; white-space: normal; max-width: 92px; line-height: 1.1; }
  .topbar-inner { padding: 10px 12px 4px; gap: 8px; }
  .postal { padding-left: 9px; gap: 5px; }
  .postal .pin { width: 15px; height: 15px; }
  .postal input { width: 64px; font-size: 0.85rem; }
  .postal .btn.small { padding: 7px 10px; }
  .store-head { padding: 10px 12px; gap: 8px; }
  .store-head .name { display: none; }
  .postal label { display: none; }
  .tab-btn { font-size: 0.84rem; padding: 9px 8px 11px; }
  .lede { font-size: 0.94rem; }
  .eyebrow { flex-wrap: wrap; justify-content: center; font-size: 0.72rem; }
  .search { padding-left: 42px; }
  .search-icon { left: 15px; }
  .search .btn { padding: 11px 16px; }
  .store-toggle { min-width: 0; height: 36px; padding: 3px 8px; }
  .store-toggle .logo { height: 22px; max-width: 72px; }
  .store-grid, .verdicts { grid-template-columns: 1fr; }
  .verdict { grid-template-columns: 88px 1fr; gap: 14px; }
  .verdict-price { font-size: 1.8rem; }
  .item { grid-template-columns: 64px 1fr auto; gap: 10px; padding: 10px 12px; }
  .thumb { width: 64px; height: 64px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-tile { padding: 12px; }
  .cat-tile .cat-icon { width: 40px; height: 40px; }
  .deal-grid, .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .deal-card .thumb { height: 128px; }
  .deals-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deals-tools, .deals-tools input { width: 100%; }
  .deals-tools input { flex: 1 1 100%; }
  .how-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
