/* Palette lifted straight from sincitywholesale.com so this storefront
   reads as the same site, not a bolt-on. */
:root {
  --bg: #06100d;
  --bg-elevated: #0b1a15;
  --bg-card: #0e1f19;
  --text: #ecf5f1;
  --text-muted: #8aa89c;
  --border: #1c3a2e;
  --gold: #d4af37;
  --gold-light: #e8c66b;
  --gold-text: #1a1404;
  --danger: #e4572e;
  --danger-bg: rgba(228, 87, 46, 0.12);
  --ok: #6fbf8f;
  --ok-bg: rgba(111, 191, 143, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(6, 16, 13, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 16px;
  flex-wrap: wrap;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}
.brand span { display: block; font-size: 0.75em; color: var(--gold); letter-spacing: 0.18em; }

.nav-links { display: flex; gap: 20px; align-items: center; margin-left: auto; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; position: relative; }
.nav-links a:hover { color: var(--text); }

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--gold-text);
  font-size: 0.7rem;
  font-weight: 700;
}
.cart-badge[hidden] { display: none; }

.header-search input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 8px 16px;
  font-size: 0.9rem;
  width: 220px;
  max-width: 40vw;
}
.header-search input:focus { outline: none; border-color: var(--gold); }

/* ---------- header search: live preview dropdown ---------- */

.header-search-wrap { position: relative; }

.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: min(90vw, 340px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,0.5);
  z-index: 70;
  padding: 6px;
  overflow-x: hidden;
}
.search-suggest[hidden] { display: none; }

.search-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.search-suggest-item:hover,
.search-suggest-item.is-active { background: var(--bg-elevated); }

.search-suggest-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--text-muted);
}
.search-suggest-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.search-suggest-info { min-width: 0; flex: 1 1 auto; }
.search-suggest-name {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-suggest-meta { font-size: 0.76rem; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.search-suggest-price { font-family: "Space Grotesk", sans-serif; font-weight: 700; color: var(--gold); flex-shrink: 0; font-size: 0.86rem; }

.search-suggest-more {
  display: block;
  text-align: center;
  padding: 9px;
  font-size: 0.82rem;
  color: var(--gold);
  text-decoration: none;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.search-suggest-more:hover { color: var(--gold-light); }

.search-suggest-empty { padding: 14px 10px; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* section headings inside the dropdown ("Popular right now", etc.) */
.search-suggest-label {
  padding: 8px 8px 4px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.search-suggest-label:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 10px; }

/* "No exact match for … — you might mean:" line above loose results */
.search-suggest-hint {
  padding: 10px 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* department chips in the starter + no-match states */
.search-suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px 8px;
}
.search-suggest-chip {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.search-suggest-chip:hover,
.search-suggest-chip.is-active {
  border-color: var(--gold);
  color: var(--gold-light);
}

/* chips reused on the full /search results page */
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-chip {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
}
.search-chip:hover { border-color: var(--gold); color: var(--gold-light); }

/* ---------- header: compact mobile layout ----------
   Desktop keeps the original always-visible nav + search bar. Under 640px,
   both collapse behind two icon buttons so the header stays one line
   instead of wrapping into three stacked rows (logo, nav, search). */

.header-mobile-actions { display: none; }

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  flex-shrink: 0;
}
.header-icon-btn svg { width: 18px; height: 18px; }
.header-icon-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }

@media (max-width: 900px) {
  .header-inner { flex-wrap: nowrap; gap: 10px; padding-top: 12px; padding-bottom: 12px; }

  .brand { font-size: 0.85rem; white-space: nowrap; }
  .brand span { display: inline; margin-left: 5px; }

  .header-mobile-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

  /* Both collapse to hidden dropdown panels, off by default, toggled by
     shop.js adding/removing .open (see the mobile-nav/search-toggle
     handlers there). */
  .nav-links,
  .header-search-wrap {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-left: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 24px 12px;
  }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: none; }

  .header-search-wrap.open { display: block; padding: 14px 24px; }
  .header-search input { width: 100%; max-width: none; }

  /* Line the dropdown up with the full-width mobile search field instead
     of the desktop 340px pane anchored to the right edge. */
  .search-suggest {
    left: 24px;
    right: 24px;
    width: auto;
    max-width: none;
    top: calc(100% + 4px);
    max-height: 66vh;
  }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background-image: linear-gradient(var(--gold-light), var(--gold));
  color: var(--gold-text);
  box-shadow: 0 10px 30px -12px rgba(212, 175, 55, 0.7);
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.01);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--gold); }

.btn-small { padding: 8px 16px; font-size: 0.82rem; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(228, 87, 46, 0.4); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- hero ---------- */

.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  display: inline-block;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
  font-weight: 600;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); max-width: 14ch; }
.hero-sub { max-width: 56ch; color: var(--text-muted); font-size: 1.05rem; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

.trust-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; align-items: center; }

.stat-row { display: flex; gap: 40px; margin-top: 48px; flex-wrap: wrap; }
.stat-num { font-family: "Space Grotesk", sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--gold); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- section ---------- */

.section { padding: 56px 0; border-bottom: 1px solid var(--border); }
.section-kicker { color: var(--gold); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin-bottom: 10px; }
.section-head { max-width: 60ch; margin-bottom: 36px; }

/* ---------- category grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

/* Product listing grids (category/search pages) — separate from .grid so
   shrinking these thumbnails doesn't also shrink the text-only category
   cards on the homepage, which need the wider column to fit their copy. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 12px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--gold); }

.cat-card { display: block; }
.cat-code { color: var(--gold); font-size: 0.72rem; letter-spacing: 0.14em; font-weight: 700; margin-bottom: 12px; }
.cat-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.cat-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0; }
.cat-count { display: inline-block; margin-top: 14px; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- bento category grid ---------- */
/* Separate from .grid (used elsewhere on the page for even-sized card
   rows) so mixing tile sizes here doesn't affect those sections. Medium
   tiles (bigger categories) span 2x2; small tiles span 1x1 — sized by
   product count so the busiest departments get the most visual weight. */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 150px;
  grid-auto-flow: dense;
  gap: 14px;
}
.bento-grid .cat-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}
.bento-md { grid-column: span 2; grid-row: span 2; }
.bento-sm { grid-column: span 1; grid-row: span 1; }
.bento-sm .cat-card p, .bento-sm .cat-count { display: none; }
.bento-sm .cat-card h3 { font-size: 0.95rem; margin-bottom: 0; }
.bento-md .cat-card h3 { font-size: 1.3rem; }
.bento-md .cat-card p { -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }

.cat-icon { width: 32px; height: 32px; margin-bottom: 10px; opacity: 0.92; transition: transform 0.2s ease; }
.cat-card:hover .cat-icon { transform: translateY(-2px); }
.bento-sm .cat-icon { width: 22px; height: 22px; margin-bottom: 6px; }

/* Real-photo category tiles (see iconType:'photo') — the photo fills the
   whole tile as a background with a dark gradient for text legibility,
   rather than a small line-art icon sitting above the text. Lets a
   customer recognize the department by picture alone. */
.cat-card-photo { position: relative; overflow: hidden; padding: 0; }
.cat-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform 0.3s ease;
}
.cat-card-photo:hover .cat-photo { transform: scale(1.04); }
.cat-card-photo::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  pointer-events: none; /* decorative gradient — never swallow a click */
  background: linear-gradient(to top, rgba(6,16,13,0.92) 0%, rgba(6,16,13,0.55) 45%, rgba(6,16,13,0.05) 75%);
}
.cat-card-photo .cat-card-body { position: relative; z-index: 2; padding: 16px; }
.cat-card-photo .cat-code { color: var(--gold-light); }
.cat-card-photo h3, .cat-card-photo p, .cat-card-photo .cat-count { color: var(--text); }
.cat-card-photo p { color: rgba(236,245,241,0.8); }

/* ---------- product grid (Puffco-inspired: big image, minimal text, quick-add) ---------- */

.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
}

.pcard-edit-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(6,16,13,0.85);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}
.pcard-edit-toggle:hover { border-color: var(--gold); }

.pcard-editbox {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* display:flex above beats the browser's own [hidden]{display:none} rule
   (author styles win over the user-agent stylesheet regardless of
   selector weight) — same bug class as the chat panel fix earlier.
   Without this, every edit box renders open by default. */
.pcard-editbox[hidden] { display: none; }
.pcard-editbox label { font-size: 0.7rem; margin-bottom: 3px; }
.pcard-editbox input { font-size: 0.8rem; padding: 6px 8px; }
.pcard-editbox-row { display: flex; gap: 8px; }
.pcard-editbox-row label { flex: 1; }
.pcard-editbox-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

.pcard-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.pcard:hover .pcard-thumb { border-color: var(--gold); }
.pcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pcard-noimg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--border);
}

.pcard-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pcard-tag-out { background: rgba(6,16,13,0.85); color: var(--danger); border: 1px solid rgba(228,87,46,0.4); }
.pcard-tag-low { background: rgba(6,16,13,0.85); color: var(--gold); border: 1px solid rgba(212,175,55,0.4); }
.pcard-tag-bulk { background: rgba(6,16,13,0.85); color: var(--ok); border: 1px solid rgba(111,191,143,0.4); }

.pcard.is-out .pcard-thumb img { opacity: 0.45; }

.pcard-quickadd {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background-image: linear-gradient(var(--gold-light), var(--gold));
  color: var(--gold-text);
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 6px 14px -6px rgba(212, 175, 55, 0.8);
}
.pcard:hover .pcard-quickadd, .pcard-quickadd:focus-visible { opacity: 1; transform: translateY(0); }
.pcard-quickadd.is-added { background-image: none; background: var(--ok); color: #06100d; }

@media (hover: none) {
  /* touch devices have no hover — keep the button visible always */
  .pcard-quickadd { opacity: 1; transform: none; }
}

.pcard-info { display: block; padding: 8px 1px 0; }
.pcard-name {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  margin-bottom: 3px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcard-price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pcard-price { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 0.88rem; color: var(--text); }
.pcard-margin { font-size: 0.72rem; color: var(--ok); font-weight: 600; margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: fit-content;
}
.badge-ok { color: var(--ok); border-color: rgba(111,191,143,0.35); background: var(--ok-bg); }
.badge-low { color: var(--gold); border-color: rgba(212,175,55,0.35); background: rgba(212,175,55,0.1); }
.badge-out { color: var(--danger); border-color: rgba(228,87,46,0.35); background: var(--danger-bg); }

/* ---------- quantity stepper ---------- */

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  height: 46px;
}
.qty-btn {
  width: 40px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { background: rgba(255,255,255,0.04); }
.qty-input {
  width: 46px;
  height: 100%;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 0.95rem;
  padding: 0;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- product detail page ---------- */

.pdp { display: grid; grid-template-columns: minmax(0, 480px) 1fr; gap: 48px; align-items: start; }
@media (max-width: 780px) { .pdp { grid-template-columns: 1fr; gap: 24px; } }

.pdp-image {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pdp-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-noimg { position: absolute; inset: 0; font-size: 5rem; }

.pdp-name { font-size: 1.7rem; margin-bottom: 4px; }
.pdp-price { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.6rem; margin-bottom: 4px; }
.pdp-status { font-size: 0.88rem; margin-bottom: 18px; }
.pdp-status.is-ok { color: var(--ok); }
.pdp-status.is-low { color: var(--gold); }
.pdp-status.is-out { color: var(--danger); }
.pdp-desc { color: var(--text-muted); max-width: 52ch; margin-bottom: 22px; }

.price-gate {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}
.price-gate .hero-actions { margin-top: 0; }

.margin-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  background: var(--ok-bg);
  border: 1px solid rgba(111, 191, 143, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.margin-box strong { color: var(--ok); }
.margin-box .margin-pct { font-weight: 700; color: var(--ok); }
.pdp-add-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pdp-add-btn { height: 46px; padding: 0 32px; }

/* ---------- category pill nav ---------- */

.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.cat-pill:hover { border-color: var(--gold); color: var(--text); }
.cat-pill.active { background: var(--gold); border-color: var(--gold); color: var(--gold-text); font-weight: 600; }

/* ---------- toast (add-to-cart confirmation) ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- cart line list ---------- */

.cart-lines { display: flex; flex-direction: column; gap: 14px; }
.cart-line {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  flex-wrap: wrap;
}
.cart-line-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-line-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line-thumb .pcard-noimg { font-size: 1.4rem; }
.cart-line-info { min-width: 0; flex: 1 1 220px; }
.cart-line-name { font-weight: 600; display: block; margin-bottom: 2px; }
.cart-line-price { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.cart-line-controls { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.cart-line-total { font-family: "Space Grotesk", sans-serif; font-weight: 700; white-space: nowrap; min-width: 64px; text-align: right; }
.cart-line-remove {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.cart-line-remove:hover { border-color: var(--danger); color: var(--danger); }

@media (max-width: 640px) {
  .cart-line-controls { margin-left: 0; width: 100%; justify-content: space-between; }
  .qty-stepper { height: 38px; }
}

/* ---------- tables (cart / admin) ---------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.table-wrap table { border: none; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 18px; }

/* Name/SKU/Category columns on /admin/products — bumped up from the
   table's default small inputs since they're the columns you actually
   read, not just scan for a number. Size is a CSS variable so the
   on-page text-size control (see shop.js) can adjust it live and
   remember your preference. */
.admin-col-lg { font-size: var(--admin-col-font-size, 1.08rem); padding: 12px 14px; }

.text-size-control { display: inline-flex; align-items: center; gap: 4px; }
.text-size-control button {
  width: 30px; height: 30px; padding: 0; border-radius: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  font-size: 1rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.text-size-control button:hover { border-color: var(--gold); color: var(--gold); }
.text-size-control span { width: 42px; text-align: center; }

/* ---------- category icon picker (admin/products.ejs) ---------- */

.cat-picker-trigger {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); cursor: pointer; text-align: left; width: 100%;
}
.cat-picker-trigger:hover { border-color: var(--gold); }
.cat-picker-trigger img { width: 24px; height: 24px; flex-shrink: 0; }
.cat-picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-picker-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.cat-picker-modal[hidden] { display: none; }
.cat-picker-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  width: min(680px, 92vw); max-height: 82vh; display: flex; flex-direction: column; overflow: hidden;
}
.cat-picker-header { display: flex; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.cat-picker-header input { flex: 1; }
.cat-picker-header button {
  width: 40px; flex-shrink: 0; background: transparent; border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); cursor: pointer;
}
.cat-picker-header button:hover { border-color: var(--gold); color: var(--gold); }
.cat-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  padding: 16px; overflow-y: auto;
}
.cat-picker-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 8px; cursor: pointer; color: var(--text); font-size: 0.8rem; text-align: center;
}
.cat-picker-tile:hover { border-color: var(--gold); background: rgba(212,175,55,0.08); }
.cat-picker-tile img { width: 36px; height: 36px; }
.cat-picker-tile[hidden] { display: none; }
.cat-picker-tile-new { border-style: dashed; }
.cat-picker-plus { font-size: 1.5rem; line-height: 1; color: var(--gold); }
.cat-picker-new-row { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); }
.cat-picker-new-row input { flex: 1; }

/* ---------- forms ---------- */

label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 14px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 200px; }

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.radio-card input { width: auto; margin-top: 3px; }
.radio-card strong { display: block; }
.radio-card span.muted { font-size: 0.82rem; }

.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(228,87,46,0.35); }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(111,191,143,0.35); }
.alert-pending { background: rgba(212,175,55,0.12); color: var(--gold-light); border: 1px solid rgba(212,175,55,0.35); }

/* ---------- layout helpers ---------- */

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.summary-card { position: sticky; top: 96px; }

.breadcrumb { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--gold); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ---------- footer ---------- */

.site-footer { padding: 48px 0; }
.footer-inner { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.footer-inner h4 { font-size: 0.9rem; }
.footer-legal { max-width: 1180px; margin: 32px auto 0; padding: 20px 24px 0; border-top: 1px solid var(--border); line-height: 1.5; }

/* ---------- admin ---------- */

.admin-shell { display: flex; min-height: calc(100vh - 200px); gap: 0; }
.admin-nav { width: 200px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 24px 0; }
.admin-nav a { display: block; padding: 10px 24px; color: var(--text-muted); font-size: 0.9rem; }
.admin-nav a:hover, .admin-nav a.active { color: var(--gold); }
.admin-main { flex: 1; padding: 32px 32px 60px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.status-pending { background: rgba(212,175,55,0.12); color: var(--gold-light); }
.status-approved { background: var(--ok-bg); color: var(--ok); }
.status-rejected { background: var(--danger-bg); color: var(--danger); }

.admin-thumb-col { display: flex; flex-direction: column; gap: 4px; width: 90px; }
.admin-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--text-muted); font-size: 1.1rem; }
.admin-thumb-empty { display: flex; }
.admin-thumb-file { font-size: 0.68rem; width: 90px; }
.admin-thumb-url { font-size: 0.68rem; width: 90px; padding: 3px 5px !important; }
.stat-card .stat-num { font-size: 1.6rem; }

/* ---------- /admin/products: grid/list view toggle + grid tiles ---------- */

.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.view-toggle-btn { padding: 8px 14px; font-size: 0.82rem; color: var(--text-muted); }
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.active { background: var(--gold); color: var(--gold-text); font-weight: 600; }

/* Admin tiles reuse the storefront .pcard look for visual consistency, at
   a bigger minimum size than the customer grid — there's more to read
   here (category, price, margin, quick-edit) than a shopper's card. */
.admin-product-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.admin-tile-flag {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(6,16,13,0.85); border: 1px solid rgba(228,87,46,0.5); color: var(--danger);
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
}
.admin-tile-delete {
  position: absolute; top: 6px; right: 34px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: rgba(6,16,13,0.85); color: var(--text-muted);
  font-size: 0.8rem; cursor: pointer;
}
.admin-tile-delete:hover { border-color: var(--danger); color: var(--danger); }
.admin-tile-stock { background: rgba(6,16,13,0.85); color: var(--text-muted); border: 1px solid var(--border); }
.admin-tile-sku { margin-bottom: 4px; }
.admin-tile-actions { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.admin-tile-cat {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; color: var(--text-muted); font-size: 0.74rem; cursor: pointer; text-align: left;
}
.admin-tile-cat:hover { border-color: var(--gold); color: var(--text); }
.admin-tile-cat img { width: 16px; height: 16px; flex-shrink: 0; }
.admin-tile-edit-toggle { position: static; flex-shrink: 0; }
.admin-tile-editbox { position: relative; z-index: 3; }

/* ---------- /admin/categories: catalog-style tiles ---------- */
/* Reuses .cat-card/.cat-photo/.cat-icon/.cat-card-body as-is (same
   classes the live home page catalog grid uses) so this looks like the
   real thing — just in its own grid instead of the homepage's bento
   layout, since an edit box needs to expand a tile beyond the bento
   grid's fixed row height. */

.admin-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.admin-cat-tile { display: flex; flex-direction: column; }
.admin-cat-card {
  position: relative;
  height: 170px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.admin-cat-view {
  position: absolute; top: 6px; left: 6px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(6,16,13,0.85); border: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
  text-decoration: none;
}
.admin-cat-view:hover { border-color: var(--gold); color: var(--gold); }
.admin-cat-editbox { margin-top: 8px; }

/* On photo tiles the body fills the whole card at z-index 2, level with
   these controls — lift the pencil + view link clear of it so they stay
   clickable (this is what made the pencil "not work" on photo categories). */
.admin-cat-edit-toggle { z-index: 3; }

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.dropzone input[type="file"] { margin-top: 16px; }

.inline-edit-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-edit-form input, .inline-edit-form select { padding: 7px 10px; font-size: 0.85rem; }
.inline-edit-form input[type="text"] { width: 150px; }
.inline-edit-form input[type="number"] { width: 80px; }

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .admin-nav { width: 100%; display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 24px; gap: 8px; }
  .admin-nav a { padding: 6px 12px; white-space: nowrap; }
  .admin-main { padding: 24px 16px 48px; }
}

/* ---------- chat widget ---------- */

#chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
}

#chat-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: none;
  background-image: linear-gradient(var(--gold-light), var(--gold));
  box-shadow: 0 8px 22px -10px rgba(212, 175, 55, 0.7);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

#chat-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(288px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  flex-direction: column;
  overflow: hidden;
}
/* The [hidden] attribute is how the widget minimizes (chat.js toggles
   panel.hidden). Without this rule, "display: flex" above wins over the
   browser's own default [hidden] { display: none } and the panel never
   actually collapses — it just sits open all the time. */
#chat-panel:not([hidden]) { display: flex; }
#chat-panel[hidden] { display: none; }

#chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}

#chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
#chat-close:hover { color: var(--text); }

#chat-messages {
  flex: 1;
  min-height: 90px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chat-messages:empty::before {
  content: "Have a question about a product, stock, or an order? Send us a message.";
  color: var(--text-muted);
  font-size: 0.8rem;
}

.chat-bubble {
  max-width: 82%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.chat-bubble.from-customer { align-self: flex-end; background-image: linear-gradient(var(--gold-light), var(--gold)); color: var(--gold-text); }
.chat-bubble.from-admin { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); }

#chat-hint {
  padding: 0 12px 6px;
  font-size: 0.78rem;
}

#chat-form {
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#chat-form input { padding: 7px 10px; font-size: 0.84rem; }
#chat-input-row { display: flex; gap: 6px; }
#chat-input-row input { flex: 1; }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields
   but still fill anything positioned normally-but-invisibly). */
.chat-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
}

/* ---------- age gate ---------- */

.age-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08), transparent 60%), var(--bg);
}

.age-gate-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
}

.age-gate-card .eyebrow { display: block; margin-bottom: 14px; }
.age-gate-card h1 { font-size: 1.7rem; margin-bottom: 14px; }
.age-gate-card p { margin-bottom: 0; }

.age-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}
.age-gate-actions .btn { width: 100%; }

@media (max-width: 480px) {
  #chat-widget { right: 12px; bottom: 12px; }
  #chat-panel { right: -4px; }
}
