/* ==========================================================================
   Shelf Prices: local warehouse prices, stock, deals, and price history.
   Golden Find identity: clear retail signage, warm paper surfaces, and
   forest/saffron signals that keep real data easy to scan.
   - Headings : Roboto Condensed
   - Body/UI  : Inter
   - Data     : IBM Plex Mono (SKUs, prices-as-data, timestamps, distances)
   ========================================================================== */

:root {
  --ink: #20231f;          /* header / footer / strongest text */
  --surface: #ffffff;      /* cards & panels */
  --surface-2: #f3f4ef;    /* inputs / subtle fills */
  --bg: #fcfaf4;           /* page background */
  --line: #dedfd7;         /* hairline borders */
  --line-strong: #c6c9bd;
  --text: #20231f;
  --muted: #6c716b;

  --brand: #235347;        /* forest: links + primary actions */
  --brand-dark: #183c33;
  --brand-tint: #e7efe8;
  --accent: #e7b93e;       /* saffron: deal and retail-signage highlights */
  --accent-dark: #765709;

  --in-stock: #235347;
  --low-stock: #8b6412;
  --out-stock: #a33a35;
  --unknown: #6c716b;

  --clearance: #805b08;
  --clearance-tint: #fbf3d8;
  --clearance-line: #ead794;
  --sale: #336974;
  --sale-tint: #e9f2f2;
  --sale-line: #c7dddd;
  --price-drop: var(--in-stock);
  --price-drop-tint: #eef6f0;
  --price-drop-line: #cde2d3;

  /* Costco.com online offer: a cool blue keeps "buy online" visually distinct
     from the warehouse's red in-club identity. */
  --online: #3f657a;
  --online-dark: #294b5d;
  --online-tint: #edf3f5;
  --online-line: #cbdce3;

  --shadow: 0 1px 3px rgba(32,35,31,.08);
  --shadow-lg: 0 14px 34px -24px rgba(32,35,31,.48);
  --radius: 10px;
  --radius-sm: 6px;

  --font-display: "Roboto Condensed", "Arial Narrow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.95rem); font-weight: 700; line-height: 1.12; margin: 0 0 .9rem; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 2rem 0 1rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: .5rem; z-index: 100; transform: translateY(-160%); padding: .6rem .85rem; border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; box-shadow: var(--shadow-lg); }
.skip-link:focus { transform: translateY(0); }

/* mono inventory data */
.item-number, .freshness, .distance, .ptable,
.pager-status, .detail-meta, .change-link { font-family: var(--font-mono); }

/* inline icons */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; flex: none; }

/* ==========================================================================
   Header / footer
   ========================================================================== */
.site-header {
  background: var(--ink); color: #fcfaf4;
  position: sticky; top: 0; z-index: 30;
  border-bottom: 3px solid var(--accent); box-shadow: 0 1px 0 rgba(255,255,255,.04);
}
/* Local/dev environment: distinct header colour so it's never confused with prod. */
.site-header--dev {
  background: #3b2f75;
  border-bottom-color: rgba(0,0,0,.35);
}
.header-inner { position: relative; display: flex; align-items: center; gap: 1rem; padding: .65rem 1.25rem; }
.brand { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 800; font-size: 1.48rem; letter-spacing: -.03em; }
.brand:hover { color: #fff; }
.brand-mark { width: 38px; height: 38px; display: block; padding: 4px; border-radius: 6px; background: var(--bg); }

.nav { display: flex; align-items: center; gap: .35rem 1rem; flex-wrap: wrap; margin-left: auto; }
.nav a { min-height: 36px; display: inline-flex; align-items: center; color: #d9e0e3; text-decoration: none; font-size: .94rem; }
.nav a:hover { color: #fff; }

.btn-outline, .btn-secondary, .btn-danger { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-outline:hover, .btn-secondary:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-danger { border-color: #e3b8b1; color: var(--out-stock); }
.btn-danger:hover { border-color: var(--out-stock); background: #fbeae8; color: #7a1d0d; }
.site-header .btn-outline { border-color: rgba(252,250,244,.38); background: transparent; color: #fcfaf4; }
.site-header .btn-outline:hover { background: rgba(248,244,234,.1); color: #fff; }

.nav .nav-warehouse {
  display: inline-flex; align-items: center; gap: .35rem; background: rgba(252,250,244,.08);
  border: 1px solid rgba(252,250,244,.2); padding: .38rem .72rem; border-radius: var(--radius-sm);
  color: #fcfaf4; font-weight: 500; font-size: .9rem; max-width: 240px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.nav .nav-warehouse:hover { background: rgba(243,241,236,.16); }
.nav-warehouse .ico { color: var(--accent); }
.nav-warehouse .ico, .btn-locate .ico { opacity: .95; }

.inline-form { display: inline; margin: 0; }
.linklike { background: none; border: none; color: #d9e0e3; cursor: pointer; font: inherit; font-size: .94rem; padding: 0; }
.linklike:hover { color: #fff; text-decoration: underline; }
.linklike.danger { color: var(--out-stock); }
.linklike.danger:hover { color: #7a1d0d; }
.linklike.edit-link { color: var(--brand); text-decoration: none; }
.linklike.edit-link:hover { color: var(--brand-dark); text-decoration: underline; }

main.container { flex: 1 0 auto; padding-top: 1.5rem; padding-bottom: 3rem; }

.site-footer { border-top: 3px solid var(--accent); background: var(--ink); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; padding: 1.2rem 0; }
.site-footer p { color: #b8c4c9; font-size: .82rem; margin: 0; }
.site-footer strong { color: #fcfaf4; }
.footer-links { display: flex; align-items: center; gap: .85rem; flex: none; }
.footer-links a { color: #d9e0e3; font-size: .82rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flash { margin: 1rem 0 0; padding: .7rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 3px solid var(--muted); background: var(--surface); font-size: .95rem; }
.flash-success { border-left-color: var(--in-stock); background: #eef6f0; color: #14532b; }
.flash-error { border-left-color: var(--out-stock); background: var(--brand-tint); color: #7a1d0d; }
.flash-info { border-left-color: var(--accent); background: #fbf2e2; color: #6b4a05; }

/* ==========================================================================
   Hero: a plain-language promise, with search kept as the primary action
   ========================================================================== */
.hero { max-width: 800px; padding: 2.25rem 0 .65rem; }
.hero h1 { max-width: 720px; font-size: clamp(2.15rem, 1.45rem + 3vw, 3.35rem); letter-spacing: -.035em; }
.hero-sub { color: var(--muted); font-size: clamp(1.03rem, .98rem + .35vw, 1.2rem); margin: 0; max-width: 64ch; }
.hero-cta { display: flex; align-items: center; gap: .5rem .9rem; flex-wrap: wrap; margin-top: 1rem; }
.hero-deals-btn {
  padding: .78rem 1rem; border: 1px solid var(--brand-dark);
  box-shadow: 0 5px 14px -7px rgba(35,83,71,.7);
  transition: background .12s ease, box-shadow .12s ease, transform .12s ease;
}
.hero-deals-btn .ico { width: 1.1em; height: 1.1em; }
.hero-deals-btn:hover { box-shadow: 0 8px 18px -8px rgba(35,83,71,.8); transform: translateY(-1px); }
.hero-deals-btn:active { transform: translateY(1px); }
.hero-deals-arrow { margin-left: .15rem; font-size: 1.15em; line-height: 1; transition: transform .12s ease; }
.hero-deals-btn:hover .hero-deals-arrow { transform: translateX(2px); }

/* ==========================================================================
   Static support pages
   ========================================================================== */
.page-hero { max-width: 760px; padding: 1.4rem 0 .6rem; }
.eyebrow {
  margin: 0 0 .45rem; color: var(--brand); font-family: var(--font-mono);
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.page-sub { color: var(--muted); font-size: 1.02rem; margin: 0; max-width: 68ch; }

.policy-panel, .contact-panel { min-width: 0; }
.policy-panel { padding: 1.35rem 1.5rem; }
.policy-simple { max-width: 760px; margin-top: 1rem; }
.policy-panel section + section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.policy-panel h2 { margin: 0 0 .55rem; font-size: 1.12rem; }
.policy-panel p { margin: .55rem 0 0; }
.policy-panel ul { margin: .65rem 0 0; padding-left: 1.15rem; }
.policy-panel li { margin: .28rem 0; }
.policy-updated { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; }

.contact-page { max-width: 760px; padding-top: 1.1rem; }
.contact-head { max-width: 680px; margin-bottom: 1rem; }
.contact-panel { padding: 1.35rem 1.5rem; }
.contact-panel-head { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.contact-panel h2 { margin: 0 0 .25rem; }
.contact-panel .muted { margin: 0; font-size: .9rem; }
.contact-form { margin-top: 1rem; }
.contact-form .btn { align-self: flex-start; min-width: 12rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.errorlist { list-style: none; margin: 0; padding: 0; }
.contact-success { max-width: 620px; margin: 1rem auto; }

/* ==========================================================================
   Panels & forms
   ========================================================================== */
.search-panel, .auth-panel, .compare-panel, .chart-panel, .desc-panel, .history-table, .empty-state, .story, .lookup-panel, .policy-panel, .contact-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.search-panel { padding: 1.35rem; margin-top: 1rem; border-top: 4px solid var(--accent); }
.search-form { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; flex: 1 1 200px; }
.field-grow { flex: 2 1 320px; }
.field label, .field-label, .stack-form label {
  display: block;
  font-size: .72rem; color: var(--muted); margin-bottom: .35rem;
  font-family: var(--font-mono); font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
}
.field input, .stack-form input[type=email], .stack-form input[type=text], .stack-form textarea {
  padding: .68rem .78rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--font-body); background: var(--surface); color: var(--text);
}
.field input::placeholder, .stack-form textarea::placeholder { color: #a6a39a; }
.field input:focus, .stack-form input:focus, .stack-form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.stack-form textarea { min-height: 11rem; resize: vertical; line-height: 1.5; }
input[type=checkbox] { accent-color: var(--brand); width: 1.05em; height: 1.05em; }

.selected-warehouse {
  display: flex; flex-direction: column; padding: .5rem .72rem; border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .95rem;
}
.selected-warehouse span { color: var(--muted); font-size: .8rem; }
.change-link { font-size: .76rem; margin-top: .15rem; color: var(--muted); }
.change-link:hover { color: var(--brand-dark); }
.make-primary-form { display: inline-flex; margin: 0; }
.make-primary-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-family: var(--font-mono); font-size: .76rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.make-primary-btn:hover { color: var(--brand-dark); }

.btn {
  padding: .68rem 1.4rem; background: var(--brand); color: #fff; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
button[data-loading]:disabled { opacity: .9; cursor: progress; }
.spinner { display: inline-block; width: .85em; height: .85em; margin-right: .15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.1em; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.alert { margin: 1rem 0 0; padding: .7rem .9rem; background: var(--brand-tint); border: 1px solid #eab9ac; border-left: 3px solid var(--out-stock); color: #7a1d0d; border-radius: var(--radius-sm); }
.alert p { margin: 0 0 .65rem; }
.alert p:last-child { margin-bottom: 0; }
.panel-hint { margin: .8rem 0 0; font-size: .9rem; }

/* ==========================================================================
   How it works — plain numbered steps
   ========================================================================== */
.story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 1rem; }
.story { padding: 1.15rem 1.2rem 1.2rem; }
.story-step {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--brand-tint); color: var(--brand-dark);
  font-family: var(--font-mono); font-weight: 600; font-size: .85rem;
}
.story h3 { margin: .6rem 0 .35rem; font-size: 1.05rem; font-weight: 700; }
.story p { margin: 0; color: var(--muted); font-size: .94rem; }

/* ==========================================================================
   Warehouse cards
   ========================================================================== */
.warehouse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: .8rem; }
.warehouse-card {
  display: flex; flex-direction: column; gap: .12rem; padding: .9rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: border-color .12s ease, box-shadow .12s ease;
}
.warehouse-card strong { font-weight: 600; }
.warehouse-card:hover, .warehouse-card:focus-within { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.warehouse-card span { color: var(--muted); font-size: .85rem; }
.warehouse-card .distance { color: var(--brand); font-weight: 600; font-size: .8rem; margin-top: .25rem; }

.stores-panel h1 { margin-bottom: .4rem; }
.stores-form { margin-top: 1rem; }
.btn-locate { align-self: flex-end; padding: .68rem 1rem; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-weight: 500; font-family: var(--font-body); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.btn-locate:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-locate:disabled { opacity: .6; cursor: progress; }
.locate-status { margin: .6rem 0 0; font-size: .9rem; }

.store-card { gap: .15rem; }
.store-card.is-current { border-color: var(--in-stock); background: #eef6f0; }
.current-badge { margin-top: .55rem; color: var(--in-stock); font-weight: 600; font-size: .85rem; font-family: var(--font-mono); }
.store-actions { display: flex; align-items: center; gap: .6rem; margin-top: .65rem; flex-wrap: wrap; }
.store-actions .store-select { margin: 0; flex: 1 1 auto; }
.store-actions .store-remove { margin: 0; }
.store-remove .linklike { min-height: 44px; display: inline-flex; align-items: center; }
.store-select { margin: .6rem 0 0; }
.store-card .btn-outline { display: block; width: 100%; text-align: center; color: var(--text); border: 1px solid var(--line-strong); padding: .5rem .7rem; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; background: var(--surface); }
.store-card .btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); }
.saved-tag { font-family: var(--font-mono); font-size: .76rem; margin-top: .3rem; color: var(--brand); }
.store-deals-link { min-height: 44px; display: inline-flex; align-items: center; font-size: .82rem; font-weight: 600; margin-top: .15rem; text-decoration: none; }
.store-deals-link:hover { text-decoration: underline; }
.saved-section { margin-top: 1.5rem; }

/* Header warehouse switcher (dropdown) */
.warehouse-menu { position: relative; }
.warehouse-menu > summary { list-style: none; cursor: pointer; }
.warehouse-menu > summary::-webkit-details-marker { display: none; }
.warehouse-menu-panel { position: absolute; right: 0; top: calc(100% + .5rem); min-width: min(240px, calc(100vw - 1.5rem)); max-width: calc(100vw - 1.5rem); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .45rem; z-index: 40; }
.menu-label { color: var(--muted); font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; margin: .3rem .55rem .4rem; }
.menu-item-form { margin: 0; }
.menu-item { display: block; width: 100%; min-height: 44px; text-align: left; background: none; border: none; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.menu-item:hover { background: var(--brand-tint); }
.menu-item.is-active { color: var(--brand); font-weight: 600; }
.warehouse-menu-panel .menu-add { display: flex; align-items: center; min-height: 44px; padding: .55rem .6rem; margin-top: .35rem; border-top: 1px solid var(--line); color: var(--brand); font-weight: 600; font-size: .9rem; text-decoration: none; }
.warehouse-menu-panel .menu-add:hover { color: var(--brand-dark); background: var(--brand-tint); }

/* ==========================================================================
   Product cards
   ========================================================================== */
.results-head { margin: .4rem 0 .2rem; }
.results-meta { color: var(--muted); font-size: .95rem; }
.results-meta strong { color: var(--text); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 1rem; margin-top: .6rem; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.card:hover, .card:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-signal { --card-signal: var(--line-strong); --card-signal-tint: var(--surface-2); --card-signal-line: var(--line); border-top: 3px solid var(--card-signal); background: linear-gradient(180deg, var(--card-signal-tint) 0, var(--card-signal-tint) 10rem, var(--surface) 14rem); }
.card-signal-clearance { --card-signal: var(--clearance); --card-signal-tint: var(--clearance-tint); --card-signal-line: var(--clearance-line); }
.card-signal-sale { --card-signal: var(--sale); --card-signal-tint: var(--sale-tint); --card-signal-line: var(--sale-line); }
.card-signal-drop { --card-signal: var(--price-drop); --card-signal-tint: var(--price-drop-tint); --card-signal-line: var(--price-drop-line); }
.card-signal .card-media { border-bottom-color: var(--card-signal-line); }
.card-signal .card-foot { border-top-color: var(--card-signal-line); }
/* Whole-card click target for browse cards (search, deals, featured): each such
   card carries a single item link on its title, so stretch that link across the
   whole card. A click anywhere opens the item, while screen readers and crawlers
   still see one clean link. Hovering anywhere lifts the card and tints the title
   because the stretched pseudo-element counts as hovering the title link. */
.card-linked { cursor: pointer; }
.card-linked .card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-title { font-family: var(--font-body); font-weight: 600; font-size: 1rem; margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.card-title a { color: var(--text); text-decoration: none; display: block; }
.card-title a:hover { color: var(--brand); }
.card-prices { display: flex; align-items: baseline; gap: .5rem; }
.price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text); }
.price-unavailable { color: var(--muted); font-family: var(--font-mono); font-size: .86rem; }
.price-was { color: var(--muted); text-decoration: line-through; font-family: var(--font-mono); font-size: .85rem; }
.price-context { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.target { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; }
.promo { color: var(--brand); font-weight: 600; font-size: .88rem; }
.freshness, .form-note, .field-error { color: var(--muted); font-size: .82rem; }
.field-error { color: var(--out-stock); margin: -.25rem 0 .25rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: .55rem; border-top: 1px solid var(--line); gap: .5rem; }
.item-number { color: var(--muted); font-size: .78rem; }
.card-location { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .78rem; min-width: 0; }
.card-location .ico { width: .9em; height: .9em; flex: none; }
.featured-foot { margin: 1rem 0 0; font-family: var(--font-mono); font-size: .88rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: .72rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; color: #fff; white-space: nowrap; }
.avail-in_stock { background: var(--in-stock); }
.avail-low_stock { background: var(--low-stock); }
.avail-out_of_stock { background: var(--out-stock); }
.avail-unknown { background: var(--unknown); }
.badge-deal { background: var(--accent); color: var(--ink); }
.badge-low { background: var(--brand); }
.badge-clearance { background: var(--clearance); }
.badge-sale { background: var(--sale); }
.badge-eligibility { background: var(--ink); }
.badge-drop { background: var(--price-drop); }
.badge-drop .ico { width: .82em; height: .82em; margin-right: -.05em; }
.chip { display: inline-block; padding: .18rem .5rem; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: .74rem; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); }

.empty-state p { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.empty-state { padding: 2rem 1.5rem; text-align: center; }
.empty-state h2 { margin-top: 0; }
.empty-state .btn { margin-top: .9rem; }
.empty-state .eyebrow { margin: 0 0 .45rem; color: var(--brand-dark); font-size: .72rem; }

/* ==========================================================================
   Item detail + price history
   ========================================================================== */
.back-link { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .6rem; font-family: var(--font-mono); font-size: .85rem; text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--text); }
.detail { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-top: .5rem; }
.detail-media img, .detail-noimg { width: 100%; height: 260px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.detail-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  color: var(--muted); font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  border-style: dashed;
  background-color: hsl(var(--tile-h, 12deg) 38% 95%);
  background-image:
    radial-gradient(hsl(var(--tile-h, 12deg) 32% 78% / .55) 1px, transparent 1.4px),
    linear-gradient(145deg, hsl(var(--tile-h, 12deg) 42% 97%), hsl(var(--tile-h, 12deg) 36% 92%));
  background-size: 14px 14px, 100% 100%; }
.detail-noimg[hidden] { display: none; }
.detail-noimg .dept-icon { width: 56px; height: 56px; }
.detail-title { font-size: 1.5rem; margin: 0 0 .4rem; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); font-size: .85rem; margin: 0 0 .3rem; line-height: 1.6; }
.detail-where { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .5rem; margin: 0 0 .45rem; font-size: .95rem; }
.detail-where .ico { color: var(--brand); }
.detail-where strong { font-weight: 600; }
.detail-where-guess { color: var(--muted); font-size: .82rem; }
.detail-where-empty { color: var(--muted); }
.detail-fresh { display: flex; align-items: center; gap: .5rem .6rem; flex-wrap: wrap; color: var(--muted); font-family: var(--font-mono); font-size: .82rem; margin: .55rem 0 0; }
.recheck-form { display: inline-flex; margin: 0; }
.recheck-btn { min-height: 44px; display: inline-flex; align-items: center; gap: .3rem; background: var(--surface-2); border: 1px solid var(--line-strong); padding: .4rem .7rem; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-family: var(--font-body); font-size: .8rem; font-weight: 600; color: var(--text); }
.recheck-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.recheck-btn .ico { width: .95em; height: .95em; color: var(--muted); }
.recheck-btn:hover .ico { color: var(--brand); }
.detail-unchecked { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; margin-bottom: 1.1rem; }
.detail-unchecked p { margin: 0; }
.detail-prices { display: flex; align-items: center; gap: .55rem .7rem; flex-wrap: wrap; margin: .65rem 0 .35rem; }
.price-xl { font-size: 2.1rem; }
.detail-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.price-status { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; margin: .15rem 0 .55rem; font-family: var(--font-mono); font-size: .85rem; }
.ps-drop { color: var(--in-stock); font-weight: 600; }
.ps-rise { color: var(--muted); font-weight: 600; }
/* Compact price story: the badge names the signal, while the comparison line
   distinguishes Costco's official original price from history tracked here. */
.detail-deal-story { display: grid; gap: .3rem; margin: .15rem 0 .55rem; }
.detail-deal-main { display: flex; align-items: center; gap: .45rem .65rem; flex-wrap: wrap; }
.price-save { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--in-stock); }
.detail-price-reference { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: .82rem; }
.detail-price-reference strong { color: var(--text); font-weight: 500; }
.price-was-lg { font-size: 1.05rem; }

.chart-panel, .history-table { padding: 1.25rem; margin-top: 1.1rem; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }
.chart-head .muted { font-family: var(--font-mono); font-size: .85rem; }
.chart-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: .8rem; }
.chart-legend > span { display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; padding: .6rem .7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.chart-legend strong { font-family: var(--font-display); font-size: 1.05rem; }
.chart-legend .muted { font-family: var(--font-mono); font-size: .76rem; }
.history-label { flex-basis: 100%; color: var(--muted); font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.chart-provenance { margin: .8rem 0 0; font-size: .82rem; font-family: var(--font-mono); }
.changes-more { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.changes-more > summary { min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; color: var(--brand-dark); font-weight: 500; font-family: var(--font-mono); font-size: .85rem; width: fit-content; list-style: none; }
.changes-more > summary::-webkit-details-marker { display: none; }
.changes-more > summary::before { content: "▸ "; }
.changes-more[open] > summary::before { content: "▾ "; }
.changes-more .table-scroll { margin-top: .7rem; }

.desc-panel { padding: 1.25rem; margin-top: 1.1rem; }
.desc-panel h2 { margin: 0 0 .7rem; }
.desc-text { margin: 0; line-height: 1.6; }
.desc-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; }
.desc-list li { line-height: 1.5; }
.desc-more { margin-top: .5rem; }
.desc-more summary { min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; color: var(--brand-dark); font-weight: 500; width: fit-content; }
.desc-more summary:hover { text-decoration: underline; }
.desc-more-hide { display: none; }
.desc-more[open] .desc-more-show { display: none; }
.desc-more[open] .desc-more-hide { display: inline; }
.desc-more .desc-list { margin-top: .5rem; }
.desc-disclaimer { margin: .9rem 0 0; font-size: .82rem; }

.compare-panel { padding: 1.25rem; margin-top: 1.1rem; }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.compare-head h2 { margin: 0; }
.compare-head form { margin: 0; }
.compare-summary { display: flex; align-items: baseline; gap: .75rem 1.2rem; flex-wrap: wrap; margin: 0 0 .85rem; padding: .65rem .75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .9rem; }
.compare-summary strong { font-family: var(--font-display); font-size: 1.05rem; }
.btn-compare { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); padding: .45rem .8rem; border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-body); }
.btn-compare:hover { border-color: var(--brand); color: var(--brand-dark); }
.compare-table { width: 100%; }
.compare-table tr.is-cheapest td { background: #eef6f0; }
.compare-table tr.is-priciest td { background: #fbf1ef; }
.compare-table tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.price-tag { font-family: var(--font-mono); font-weight: 600; font-size: .72rem; text-transform: uppercase; white-space: nowrap; }
.price-tag-low { color: var(--in-stock); }
.price-tag-high { color: var(--brand-dark); }
.price-delta { font-family: var(--font-mono); font-size: .74rem; white-space: nowrap; }
.compare-verdict { margin: 0 0 .85rem; padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); }
.compare-verdict.verdict-cheapest, .compare-verdict.verdict-same { background: #eef6f0; border-color: #bfe0cb; color: #14532b; }
.compare-verdict.verdict-elsewhere { background: var(--brand-tint); border-color: #e6c9bf; color: var(--brand-dark); }

/* Costco.com online offer (item detail): a blue "buy online" module beside the
   in-warehouse price, plus its row in the comparison table and a card tag. */
/* When an item isn't sold online there's nothing to act on, so it collapses to a
   quiet one-liner instead of taking a full prime-position card. */
.online-note { display: flex; align-items: center; gap: .45rem; margin-top: 1.1rem; padding: .5rem .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .88rem; color: var(--muted); }
.online-note-ico { width: 1rem; height: 1rem; color: var(--online); flex: none; }
.online-note a { color: var(--online-dark); font-weight: 600; text-decoration: none; }
.online-note a:hover { text-decoration: underline; }
.online-panel {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem 1.25rem; flex-wrap: wrap;
  margin-top: 1.1rem; padding: 1rem 1.15rem;
  background: var(--online-tint); border: 1px solid var(--online-line);
  border-left: 3px solid var(--online); border-radius: var(--radius);
}
.online-panel-head { display: flex; align-items: center; gap: .5rem; flex: none; }
.online-panel-ico { width: 1.35rem; height: 1.35rem; color: var(--online); flex: none; }
.online-panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--online-dark); }
.online-panel-sub { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--online); background: #fff; border: 1px solid var(--online-line); padding: .1rem .4rem; border-radius: var(--radius-sm); }
.online-panel-body { flex: 1 1 11rem; }
.online-panel-price { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.online-panel-price .price-lg { font-size: 1.5rem; }
.online-panel-diff { margin: .35rem 0 0; font-size: .9rem; color: var(--online-dark); font-weight: 500; }
.online-panel-stamp { margin: .35rem 0 0; font-family: var(--font-mono); font-size: .78rem; }
.online-panel-ref { display: inline-flex; align-items: baseline; gap: .35rem; font-weight: 600; }
.online-panel-ref .muted { font-weight: 400; font-size: .82rem; }
.online-panel-cta { flex: none; }
.btn-costco { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.15rem; background: var(--online); color: #fff; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-costco:hover { background: var(--online-dark); color: #fff; }
.compare-table tr.online-row td { background: var(--online-tint); }
.online-cell { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--online-dark); }
.online-cell-ico { width: 1rem; height: 1rem; color: var(--online); flex: none; }

/* Compact Costco.com price tag on browse cards. z-index lifts it above the
   card-linked stretched overlay so it stays independently clickable. */
.card-online { position: relative; z-index: 2; align-self: flex-start; display: inline-flex; align-items: center; flex-wrap: wrap; max-width: 100%; gap: .25rem .4rem; margin-top: .1rem; padding: .3rem .5rem; background: var(--online-tint); border: 1px solid var(--online-line); border-radius: var(--radius-sm); text-decoration: none; font-family: var(--font-mono); font-size: .78rem; line-height: 1.2; overflow-wrap: anywhere; }
.card-online:hover { border-color: var(--online); }
.card-online-store { color: var(--online-dark); font-weight: 600; }
.card-online-price { color: var(--text); font-weight: 700; }
.card-online-tail { white-space: nowrap; }
.card-online-ext { color: var(--online); }
/* In-club win: warehouse price beats a buyable online price by a real margin. */
.card-online-win { background: #eef6f0; border-color: #bfe0cb; }
.card-online-win:hover { border-color: var(--in-stock); }
.card-online-save { color: var(--in-stock); font-weight: 700; }
.card-online-win .card-online-vs { color: var(--muted); }
.card-online-win .card-online-ext { color: var(--in-stock); }
/* The warehouse finder now lives inside the "other warehouses" panel, so it
   needs a divider from the comparison table (or intro) above it. */
.lookup-inline { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
/* Anchored jumps (finder / search results) should clear the sticky header. */
details.lookup, .lookup-outcome { scroll-margin-top: 5rem; }

/* "Check another warehouse" finder */
.lookup-panel { padding: 1.25rem; margin-top: 1.1rem; }
.lookup-summary { min-height: 44px; cursor: pointer; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; list-style: none; }
.lookup-summary::-webkit-details-marker { display: none; }
.lookup-summary-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.lookup-summary .muted { font-size: .85rem; }
.lookup-summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s ease; }
details.lookup[open] .lookup-summary::after { transform: rotate(180deg); }
.lookup-body { margin-top: 1rem; }
.lookup-intro { margin: 0 0 .9rem; max-width: 70ch; }
.lookup-form { margin-bottom: .2rem; }
.lookup-grid { margin-top: 1rem; }
.lookup-card .lookup-known { color: var(--muted); font-family: var(--font-mono); font-size: .78rem; margin-top: .35rem; }
.lookup-current-tag { margin-top: .35rem; color: var(--in-stock); font-weight: 600; font-size: .8rem; font-family: var(--font-mono); }

/* Comparison-table row actions: Show (switch, GET) / Check (untracked, POST) */
.compare-action { white-space: nowrap; }
.compare-show { min-height: 44px; display: inline-flex; align-items: center; padding: 0 .35rem; font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--brand-dark); }
.compare-show:hover { text-decoration: underline; }
.compare-check { margin: 0; display: inline-flex; }
.compare-check-btn { min-height: 44px; background: var(--surface); border: 1px solid var(--line-strong); padding: .4rem .7rem; border-radius: var(--radius-sm); font: inherit; font-size: .82rem; font-weight: 600; color: var(--text); cursor: pointer; }
.compare-check-btn:hover { border-color: var(--brand); color: var(--brand-dark); }

.ptable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ptable th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; padding: .5rem .55rem; border-bottom: 2px solid var(--line-strong); }
.ptable td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
.ptable tr:last-child td { border-bottom: none; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .ptable { min-width: 560px; }
.table-scroll .compare-table { min-width: 620px; }

/* Auth forms */
.auth-panel { padding: 1.5rem; max-width: 540px; margin: 0 auto; }
.stack-form { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; }
.stack-form .check { display: flex; align-items: center; gap: .5rem; font-family: var(--font-body); font-size: .95rem; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; margin: 0; }
.stack-form .btn { margin-top: .6rem; }
.page-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-actions h1 { margin-bottom: .25rem; }
.page-actions-meta { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: .82rem; overflow-wrap: anywhere; }

/* Card media */
.card-media { position: relative; margin: -1rem -1rem .25rem; height: 160px; background: #fff; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.card-media.is-placeholder { display: flex; align-items: center; justify-content: center; padding: 1rem;
  background-color: hsl(var(--tile-h, 12deg) 38% 95%);
  background-image:
    radial-gradient(hsl(var(--tile-h, 12deg) 32% 78% / .55) 1px, transparent 1.4px),
    linear-gradient(145deg, hsl(var(--tile-h, 12deg) 42% 97%), hsl(var(--tile-h, 12deg) 36% 92%));
  background-size: 14px 14px, 100% 100%; }
.card-img { width: 100%; height: 100%; object-fit: contain; display: block; padding: .55rem; }
.card-noimg { display: none; }
.card-media.is-placeholder .card-noimg {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  color: var(--muted); font-family: var(--font-mono); font-size: .74rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em; text-align: center; line-height: 1.35;
}
/* Department glyph so a missing photo reads as an intentional placeholder. */
.dept-icon { box-sizing: border-box; width: 52px; height: 52px; padding: 7px;
  color: hsl(var(--tile-h, 12deg) 52% 38%); background: hsl(var(--tile-h, 12deg) 48% 98% / .78);
  border: 1px solid hsl(var(--tile-h, 12deg) 30% 76% / .75); border-radius: 50%; }
.is-placeholder .dept-label { color: hsl(var(--tile-h, 12deg) 30% 32%); }
.card-badges { position: absolute; top: .5rem; left: .5rem; right: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.pager-btn { padding: .55rem 1.05rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.pager-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager-btn.is-disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pager-status { color: var(--muted); font-size: .85rem; }
.loading-region.is-loading, .results.is-loading { opacity: .55; pointer-events: none; }

/* Focus visibility */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.site-header :focus-visible { outline-color: #fcfaf4; }
.site-header .warehouse-menu-panel :focus-visible { outline-color: var(--brand); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  /* Keep the simplified header compact while letting the warehouse control wrap. */
  .header-inner { flex-wrap: wrap; gap: .35rem .9rem; padding: .5rem 1.1rem; }
  .brand { order: 1; font-size: 1.12rem; gap: .45rem; }
  .brand-mark { width: 28px; height: 28px; }
  .nav { order: 2; flex: 1 1 100%; justify-content: flex-end; margin-left: 0; gap: .25rem .75rem; }
  .nav a { font-size: .88rem; }
  .nav > a, .nav > details > summary { min-height: 44px; }
  .nav .nav-warehouse { font-size: .86rem; padding: .3rem .6rem; max-width: calc(100vw - 8.5rem); }
  .warehouse-menu { position: static; }
  .warehouse-menu-panel { left: 1.1rem; right: 1.1rem; top: calc(100% + .35rem); min-width: 0; max-width: none; }
  .search-form { flex-direction: column; align-items: stretch; }
  /* in a column layout flex-basis becomes height — pin so inputs don't balloon */
  .field, .field-grow { flex: 0 0 auto; }
  .btn, .btn-locate { width: 100%; }
  /* inline item search must stack, or the full-width button overflows the row */
  .deals-search { flex-direction: column; }
  .deals-head { flex-direction: column; align-items: flex-start; }
  .compare-head { flex-direction: column; align-items: flex-start; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-links { gap: .75rem; }
  .policy-panel, .contact-panel { padding: 1.1rem; }
  .contact-form .btn { width: 100%; }
  .back-link, .change-link, .make-primary-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .card-online { min-height: 44px; }
  .page-actions { align-items: stretch; flex-direction: column; }
  .page-actions .inline-form, .page-actions .btn-secondary { width: 100%; }
}

@media (max-width: 480px) {
  .chart-legend { grid-template-columns: 1fr; }
}

/* Data tables -> stacked cards. The 560px min-width forces an inner horizontal
   scrollbar until the viewport is wide enough to hold it (~660px once panel and
   page padding are counted), so below that we drop the columns and label each
   cell instead, letting warehouse prices read top-to-bottom with no side-scroll. */
@media (max-width: 680px) {
  .table-scroll { overflow-x: visible; }
  .table-scroll .ptable { min-width: 0; }
  .ptable thead {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
  }
  .ptable, .ptable tbody { display: block; width: 100%; }
  .ptable tr {
    display: block; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: .65rem .8rem; margin-bottom: .55rem;
  }
  .ptable tr:last-child { margin-bottom: 0; }
  .ptable td {
    display: block; padding: .3rem 0; border: none;
    text-align: right; overflow-wrap: anywhere;
  }
  .ptable td::before {
    content: attr(data-label); float: left; margin-right: 1rem;
    font-family: var(--font-body); font-weight: 600; font-size: .72rem;
    letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  }
  .ptable td:first-child {
    text-align: left; padding: 0 0 .5rem; margin-bottom: .45rem;
    border-bottom: 1px solid var(--line); font-size: .95rem; line-height: 1.45;
  }
  .ptable td:first-child::before { content: none; }
  .compare-table tr.is-cheapest { background: #eef6f0; border-color: #bfe0cb; }
  .compare-table tr.is-cheapest td { background: transparent; }
  .compare-table tr.is-priciest { background: #fbf1ef; border-color: #e6c9bf; }
  .compare-table tr.is-priciest td { background: transparent; }
  .compare-table tr.is-current { border-left: 3px solid var(--brand); }
  .compare-table tr.is-current td:first-child { box-shadow: none; }
  /* Shade the whole online-offer card, not just its cells (the per-td shading
     used on desktop leaves the card's padding unshaded once rows stack). */
  .compare-table tr.online-row { background: var(--online-tint); border-color: var(--online-line); }
  .compare-table tr.online-row td { background: transparent; }
  /* Pack each warehouse's price, stock and freshness into one tight wrapping row
     under the name so the comparison scans fast on a phone. */
  .compare-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .8rem; }
  .compare-table td { display: inline-flex; align-items: baseline; gap: .3rem; width: auto; padding: .15rem 0; text-align: left; }
  .compare-table td::before { content: none; }
  .compare-table td:first-child { display: block; flex: 1 1 100%; }
  /* Meta line: price (+delta) on the left, stock badge pushed to the right.
     These always fit, so the badges line up on the right without wrapping. */
  .compare-table td[data-label="Stock"] { margin-left: auto; }
  /* Freshness is least important and, with wide gap-to-cheapest amounts, won't
     fit beside the badge on a phone. Give it its own small, muted, right-aligned
     line so every card reads the same instead of orphaning the time at random. */
  .compare-table td[data-label="Updated"] {
    flex-basis: 100%; justify-content: flex-end; white-space: nowrap;
    color: var(--muted); font-family: var(--font-mono); font-size: .72rem;
  }
  /* Row action (Show / Check) gets its own right-aligned line so it's an easy tap;
     empty action cells (the shown row, the online row) collapse away. */
  .compare-table td.compare-action { flex-basis: 100%; justify-content: flex-end; padding-top: .35rem; }
  .compare-table td.compare-action:empty { display: none; }
  /* The cheapest/most-expensive word tags make the price cell wide enough to
     wrap the row on a phone; the green/pink card tint signals them visually, so
     hide the words *visually* here (still read by screen readers) rather than
     display:none, and keep the +$ gap-to-cheapest. */
  .compare-table .price-tag {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
  }
}

/* ==========================================================================
   Deals (clearance + temporary sales)
   ========================================================================== */

/* Home page entry point */
.deals-cta { display: flex; align-items: center; gap: .7rem; margin: .9rem 0 .2rem; padding: .7rem .9rem; background: var(--brand-tint); border: 1px solid #eccfc4; border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .12s ease, box-shadow .12s ease; }
.deals-cta:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.deals-cta-tag { flex: 0 0 auto; font-family: var(--font-mono); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--brand); padding: .2rem .5rem; border-radius: var(--radius-sm); }
.deals-cta-text { flex: 1 1 auto; font-size: .95rem; }
.deals-cta-text strong { font-family: var(--font-mono); color: var(--brand-dark); }
.deals-cta-arrow { flex: 0 0 auto; color: var(--brand); font-weight: 700; }

/* Compact controls for an auto-detected warehouse. */
.geo-banner { display: inline-flex; align-items: center; gap: .4rem .75rem; flex-wrap: wrap; }
.geo-banner-main { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .82rem; }
.geo-banner-main .ico { flex: 0 0 auto; color: var(--brand); }
.geo-banner-actions { display: inline-flex; align-items: center; gap: .7rem; }
.geo-banner-actions form { margin: 0; }
.geo-confirm { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); padding: .3rem .6rem; border-radius: var(--radius-sm); font-weight: 600; font-family: var(--font-body); font-size: .82rem; cursor: pointer; white-space: nowrap; }
.geo-confirm:hover { border-color: var(--brand); color: var(--brand-dark); }
.geo-change { font-family: var(--font-mono); font-size: .82rem; white-space: nowrap; }
.deals-home .deals-head { margin-top: .2rem; }

/* Choose-a-warehouse state */
.deals-empty { max-width: 620px; margin: 1rem auto; }
.deals-empty .btn { margin-top: .4rem; }
.search-panel > .geo-banner { width: 100%; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }

/* Page header */
.deals-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .9rem 1.4rem; flex-wrap: wrap; margin-top: .4rem; }
.deals-head-main { flex: 1 1 32rem; min-width: 0; }
.deals-head h1 { margin: 0; }
.deals-head-location { color: var(--muted); font-size: .6em; font-weight: 500; white-space: nowrap; }
.deals-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .9rem; min-height: 2rem; margin-top: .35rem; }
.deals-meta .change-link, .deals-fresh { font-family: var(--font-mono); font-size: .82rem; }
.deals-fresh { color: var(--muted); margin: 0; }

/* Deal-type tabs (segmented filter): the primary way to switch between the
   clearance (.97) and temporary-sale views, with live counts on each. */
.deal-tabs { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.deal-tab { min-height: 44px; display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; box-shadow: inset 0 3px 0 var(--deal-tab-accent); }
.deal-tab[data-deal-type="all"] { --deal-tab-accent: var(--brand); }
.deal-tab[data-deal-type="markdown"] { --deal-tab-accent: var(--clearance); }
.deal-tab[data-deal-type="sale"] { --deal-tab-accent: var(--sale); }
.deal-tab:hover { border-color: var(--brand); color: var(--brand-dark); }
.deal-tab.is-active { border-color: var(--text); background: var(--surface-2); }
.deal-tab.is-active:hover { color: var(--text); border-color: var(--text); }
.deal-tab-label { color: var(--deal-tab-accent); white-space: nowrap; }
.deal-tab-label-short { display: none; }
.deal-tab-count { font-family: var(--font-mono); font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 999px; padding: .05rem .4rem; min-width: 1.5rem; text-align: center; }
.deal-tab.is-active .deal-tab-count { color: var(--text); background: var(--surface); }

/* Filter + sort toolbar */
.deals-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem 1rem; flex-wrap: wrap; margin: 1.1rem 0 .2rem; }
.deals-filters { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.deals-filter { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); }
.deals-filter select { min-height: 44px; font: inherit; font-size: .88rem; color: var(--text); padding: .4rem .5rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.deals-filter select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.deals-clear { font-family: var(--font-mono); font-size: .82rem; }
.search-toolbar { margin-top: .8rem; }
.search-toolbar .results-meta { margin: 0; }

/* Group the low-stock toggle with the filter controls on the toolbar's right. */
.deals-controls { display: flex; align-items: center; gap: .6rem .9rem; flex-wrap: wrap; }
/* Low-stock visibility toggle, styled as a labeled checkbox. */
.deals-lowstock-form { display: inline-flex; margin: 0; }
.deals-lowstock { display: inline-flex; align-items: center; gap: .45rem; font-family: inherit; font-size: .85rem; font-weight: 600; color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; background: none; border: 0; padding: 0; }
.deals-lowstock:hover { color: var(--brand-dark); }
.deals-lowstock-box { width: 1.05rem; height: 1.05rem; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); flex: 0 0 auto; position: relative; }
.deals-lowstock:hover .deals-lowstock-box { border-color: var(--brand); }
.deals-lowstock.is-on .deals-lowstock-box { background: var(--brand); border-color: var(--brand); }
.deals-lowstock.is-on .deals-lowstock-box::after { content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.deals-lowstock:focus-visible { outline: none; }
.deals-lowstock:focus-visible .deals-lowstock-box { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* Search this warehouse from the deals page (keeps item search one click away) */
.deals-search { display: flex; flex: 1 1 24rem; gap: .5rem; max-width: 36rem; margin: 0; }
.deals-search input[type="search"] { flex: 1 1 auto; min-width: 0; padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font: inherit; color: var(--text); }
.deals-search input[type="search"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.deals-search .btn { flex: 0 0 auto; }
.freshness-stale { color: var(--low-stock); font-size: .8rem; }

/* Sections */
.deal-section { margin-top: 1.6rem; }
.deals-results { margin-top: .85rem; }
.deal-results-note { color: var(--muted); font-size: .85rem; margin: 0 0 .55rem; }
.deal-results-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap; margin-bottom: .55rem; }
.deal-results-meta.is-count-only { justify-content: flex-end; }
.deal-results-meta .deal-results-note { margin: 0; }
.deal-results-count { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: .8rem; }
.deal-section-head { margin-bottom: .2rem; }
.deal-section-head h2 { display: flex; align-items: center; gap: .55rem; margin: 1.4rem 0 .25rem; }
.deal-section-note { color: var(--muted); font-size: .9rem; margin: 0 0 .4rem; max-width: 80ch; }
.deal-pill { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: #fff; padding: .2rem .5rem; border-radius: var(--radius-sm); }
.deal-pill-sale { background: var(--sale); }
.deal-pill-clearance { background: var(--clearance); }

/* Browse cards share one title rhythm across deals, search, and the homepage. */
.browse-card .card-title { min-height: 4.05em; }
.browse-card .card-title a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

/* In-card sale countdown */
.deal-countdown { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--sale); background: var(--sale-tint); border: 1px solid var(--sale-line); padding: .22rem .5rem; border-radius: var(--radius-sm); align-self: flex-start; }
.deal-countdown .ico { width: 1em; height: 1em; }
.deal-countdown.is-soon { color: var(--low-stock); background: #fbf2e3; border-color: #efddc0; }
.deal-countdown.is-urgent { color: var(--out-stock); background: #fbeae8; border-color: #f1cdc8; }

/* Stack the deals toolbar and show the type tabs as a 2-up segmented control on
   narrow screens. Placed after the base .deal-tabs rule so it wins the cascade. */
@media (max-width: 600px) {
  .deals-head { align-items: stretch; }
  .deals-toolbar { flex-direction: column; align-items: stretch; }
  .deals-controls { align-items: stretch; }
  .deals-lowstock-form { width: 100%; }
  .deals-lowstock { width: 100%; min-height: 44px; }
  .deals-filters { display: grid; grid-template-columns: 1fr; width: 100%; gap: .55rem; }
  .deals-filters .deals-filter { display: grid; grid-template-columns: 6rem minmax(0, 1fr); width: 100%; }
  .deals-filters .deals-filter select { width: 100%; min-width: 0; }
  .deals-clear { display: block; padding: .3rem; text-align: center; }
  .search-toolbar .deals-filter { flex: 1 1 100%; justify-content: space-between; }
  .search-toolbar .deals-filter select { flex: 1 1 auto; min-width: 0; }
  .deal-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .deal-tab { justify-content: center; min-width: 0; padding: .5rem .4rem; gap: .35rem; }
  .deal-tab-label-full { display: none; }
  .deal-tab-label-short { display: inline; }
  .deals-head-main, .deals-search { flex: 0 0 auto; width: 100%; max-width: none; }
  .geo-banner { width: 100%; }
  .geo-banner-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: .45rem; }
  .geo-banner-actions form, .geo-confirm { width: 100%; }
  .geo-confirm, .geo-change { min-height: 44px; }
  .geo-change { display: flex; align-items: center; justify-content: center; padding: .3rem; text-align: center; }
}

@media (max-width: 360px) {
  .deal-tab-label { white-space: normal; line-height: 1.2; text-align: center; }
}
