/* Spare X catalogue — McMaster-style utility in Spare X colours.
   Layout: charcoal top bar with the search as the main control; off-white page;
   left filter column + dense parts tables; amber only for actions. */
:root {
  --charcoal: #151719; --charcoal-2: #23262a; --amber: #f2a51a; --amber-dark: #c98407;
  --paper: #f5f5f2; --white: #ffffff; --ink: #1c1f22; --ink-2: #4a4f55; --muted: #6b7178;
  --line: #d9d9d3; --line-2: #ececE7; --row: #fafaf7; --ok: #1f7a44; --warn: #a15c00;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.spx { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); }
.spx a { color: #0b5394; text-decoration: none; }
.spx a:hover { text-decoration: underline; }
.spx :focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 16px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 50; }

/* Top bar */
.topbar { background: var(--charcoal); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 18px; padding-block: 10px; flex-wrap: wrap; }
.topbar .logo img { height: 40px; width: auto; display: block; }
.topbar form { flex: 1 1 420px; display: flex; min-width: 0; }
.topbar input[type=search] { flex: 1; min-width: 0; font: 16px var(--sans); padding: 10px 12px; border: 2px solid var(--amber); border-right: 0; border-radius: 3px 0 0 3px; background: #fff; color: var(--ink); }
.topbar button.go { font: 600 15px var(--sans); background: var(--amber); color: var(--charcoal); border: 0; padding: 0 18px; border-radius: 0 3px 3px 0; cursor: pointer; }
.topbar nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.topbar nav a, .topbar nav button { color: #e8e8e4; background: none; border: 0; font: inherit; cursor: pointer; padding: 6px 2px; }
.topbar nav .rfq { background: var(--amber); color: var(--charcoal); font-weight: 600; padding: 7px 12px; border-radius: 3px; }
.subbar { background: var(--charcoal-2); color: #cfcfca; font-size: 13px; }
.subbar .wrap { display: flex; gap: 18px; padding-block: 6px; flex-wrap: wrap; }
.subbar a { color: #e8e8e4 !important; }

/* Generic */
main { padding-block: 22px 48px; }
h1, h2, h3 { font-family: var(--cond); font-weight: 600; letter-spacing: .01em; text-wrap: balance; margin: 0 0 .4em; }
h1 { font-size: 34px; line-height: 1.1; } h2 { font-size: 24px; } h3 { font-size: 19px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--ink-2); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px var(--sans); background: var(--amber); color: var(--charcoal) !important; border: 1px solid var(--amber-dark); border-radius: 3px; padding: 8px 14px; cursor: pointer; text-decoration: none !important; }
.btn:hover { background: #ffb534; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink) !important; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 18px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 2px; border: 1px solid var(--line); background: var(--row); color: var(--ink-2); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: #b9dcc6; background: #eef8f1; }
.tag.tag-quote { color: var(--warn); border-color: #ecd2a8; background: #fff7e8; }

/* Home */
.home-hero { padding-block: 26px 10px; }
.home-hero h1 { font-size: 40px; max-width: 22ch; }
.home-search { display: flex; max-width: 760px; margin: 14px 0 10px; }
.home-search input { flex: 1; min-width: 0; font: 18px var(--sans); padding: 14px 16px; border: 2px solid var(--charcoal); border-right: 0; border-radius: 3px 0 0 3px; }
.home-search button { font: 600 17px var(--sans); background: var(--charcoal); color: #fff; border: 0; padding: 0 24px; border-radius: 0 3px 3px 0; cursor: pointer; }
.examples { font-size: 14px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.examples a { font-family: var(--mono); font-size: 13px; background: #fff; border: 1px solid var(--line); padding: 2px 8px; border-radius: 2px; color: var(--ink) !important; }
.facts { display: flex; gap: 28px; margin: 18px 0 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.facts strong { font: 600 26px var(--cond); color: var(--ink); margin-right: 4px; }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 18px; }
.section-card { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.section-card h2 { font-size: 21px; margin: 0; }
.section-card p { margin: 0; font-size: 13px; color: var(--muted); }
.cat-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.cat-list a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 3px; color: var(--ink) !important; }
.cat-list a:hover { background: var(--row); text-decoration: none; }
.cat-list img, .cat-list .ph { width: 44px; height: 44px; object-fit: cover; border-radius: 2px; filter: grayscale(1) contrast(1.05); background: var(--line-2); flex: none; }
.cat-list .count { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-top: 22px; }
.strip .panel h2 { margin-bottom: 6px; }
.steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.areas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Category / results */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow: auto; }
.filters fieldset { border: 0; border-top: 1px solid var(--line-2); margin: 0; padding: 10px 0; }
.filters fieldset:first-of-type { border-top: 0; }
.filters legend { font: 600 15px var(--cond); text-transform: uppercase; letter-spacing: .04em; padding: 0; margin-bottom: 4px; }
.filters label { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 2px 0; cursor: pointer; }
.filters label .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.filters .range { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.filters .range input { width: 80px; padding: 5px; border: 1px solid var(--line); border-radius: 2px; font: 14px var(--sans); }
.filters .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.resultbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.notes { margin: 0 0 12px; display: grid; gap: 4px; }
.notes details { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; font-size: 14px; }
.notes summary { cursor: pointer; font-weight: 600; }
.notes p { margin: 6px 0 2px; color: var(--ink-2); max-width: 75ch; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
table.parts { width: 100%; border-collapse: collapse; font-size: 14px; }
.parts th { text-align: left; font: 600 13px var(--sans); color: var(--ink-2); background: #f0f0ec; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.parts td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.parts tbody tr:hover td { background: #fffaf0; }
.parts td.num, .parts th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.parts .sku { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.parts .desc { min-width: 200px; }
@media (max-width: 1280px) { .parts .tc { display: none; } }
.parts .price { white-space: nowrap; font-weight: 600; }
.parts .add { white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.parts .add input { width: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 2px; font: 14px var(--sans); }
.group h2 { margin-top: 22px; display: flex; gap: 10px; align-items: baseline; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Product */
.product-top { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.photo { background: #fff; border: 1px solid var(--line); border-radius: 4px; aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo .none { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--line); }
.spec-table th { text-align: left; width: 40%; background: #f6f6f2; font-weight: 500; color: var(--ink-2); padding: 7px 10px; border-bottom: 1px solid var(--line-2); }
.spec-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.buybox { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 16px; display: grid; gap: 10px; position: sticky; top: 76px; }
.buybox .bigprice { font: 600 28px var(--cond); }
.buybox form { display: grid; gap: 8px; }
.buybox label { font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; }
.buybox input { padding: 8px; border: 1px solid var(--line); border-radius: 3px; font: 15px var(--sans); width: 100%; }

/* Forms */
.form { display: grid; gap: 12px; max-width: 640px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 500; }
.form input, .form select, .form textarea { font: 15px var(--sans); padding: 9px 10px; border: 1px solid #c8c8c1; border-radius: 3px; background: #fff; width: 100%; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .msg { min-height: 1.5em; font-weight: 500; }
.form .msg.err { color: #b00020; } .form .msg.ok { color: var(--ok); }

/* Footer */
.foot { background: var(--charcoal); color: #cfcfca; font-size: 14px; margin-top: 40px; }
.foot .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; padding-block: 26px; }
.foot a { color: #fff !important; }
.foot h3 { color: #fff; font-size: 17px; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

/* Quotation (print-ready) */
.quote { background: #fff; border: 1px solid var(--line); max-width: 900px; margin: 0 auto; padding: 32px; }
.quote-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; border-bottom: 3px solid var(--amber); padding-bottom: 14px; flex-wrap: wrap; }
.quote-head .logo-dark { background: var(--charcoal); padding: 10px 14px; border-radius: 3px; display: inline-block; }
.quote-head .logo-dark img { height: 40px; display: block; }
.quote-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; font-size: 14px; }
.quote table { width: 100%; border-collapse: collapse; font-size: 14px; }
.quote th, .quote td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.quote th { background: #f0f0ec; }
.quote .num { text-align: right; font-variant-numeric: tabular-nums; }
.quote tfoot td { font-weight: 600; }
.quote tfoot tr:last-child td { font-size: 17px; border-top: 2px solid var(--ink); }
.print-bar { max-width: 900px; margin: 0 auto 12px; display: flex; gap: 8px; justify-content: flex-end; }
@media print {
  .topbar, .subbar, .foot, .print-bar, #rxToast { display: none !important; }
  body.spx { background: #fff; } main { padding: 0; } .quote { border: 0; padding: 0; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .product-top { grid-template-columns: 1fr; }
  .buybox { position: static; }
  .strip { grid-template-columns: 1fr; }
  .foot .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 28px; } .home-hero h1 { font-size: 30px; }
  .topbar nav { width: 100%; justify-content: space-between; }
  .form .row2, .quote-meta { grid-template-columns: 1fr; }
  .parts .hide-sm { display: none; }
  .quote { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Restore defaults that the shared cart/dialog stylesheet resets globally. */
html:has(body.spx) { overflow-x: visible; }
body.spx { overflow-x: visible; font-family: var(--sans); line-height: 1.5; background: var(--paper); }
.spx main p, .spx .panel p, .spx .foot p { margin: 0 0 .7em; }
.spx main ul, .spx main ol { margin: 0 0 .7em; }
.spx .steps { padding-left: 20px; }
.spx .rx-overlay p, .spx .rx-overlay h2, .spx .rx-overlay h3 { margin: 0 0 .5em; }

/* Filters: always open on wide screens; a collapsible "Filters" button on phones. */
.filter-box > summary { display: none; }
@media (max-width: 980px) {
  .filter-box > summary { display: inline-flex; list-style: none; margin-bottom: 8px; }
  .filter-box > summary::-webkit-details-marker { display: none; }
  .subbar .hide-sm { display: none; }
  .topbar .logo img { height: 32px; }
  .topbar .wrap { gap: 10px; padding-block: 8px; }
}
.layout > * { min-width: 0; }

/* ---------- Premium layer: hero, cart, checkout, orders, assistant ---------- */
.topbar nav a.rfq { background: var(--amber); color: var(--charcoal) !important; font-weight: 600; padding: 7px 12px; border-radius: 3px; }
.topbar nav a { color: #e8e8e4 !important; }
.spx-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); background: var(--charcoal); color: #f5f5f2; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.hero-text { padding: 34px 34px 30px; display: grid; gap: 12px; align-content: start; }
.spx-hero h1 { font-size: 46px; line-height: 1.02; margin: 0; max-width: 16ch; color: #fff; }
.spx-hero .lead { color: #c9ccd1; max-width: 56ch; margin: 0; }
.eyebrow { font: 600 13px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin: 0; }
.eyebrow-dark { font: 600 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.spx-hero .home-search { margin: 4px 0 0; }
.spx-hero .home-search input { border-color: var(--amber); }
.spx-hero .home-search button { background: var(--amber); color: var(--charcoal); }
.spx-hero .examples { color: #9aa0a6; }
.spx-hero .examples a { background: transparent; border-color: #3a3e44; color: #e8e8e4 !important; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn.ghost-dark { background: transparent; color: #f5f5f2 !important; border-color: #4a4f55; }
.btn.ghost-dark:hover { border-color: var(--amber); background: rgba(242,165,26,.08); }
.hero-img { background: #0d0e10 url('/static/img/hero-belt.jpg') center / cover no-repeat; min-height: 300px; }
.facts { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 12px 18px; margin: 14px 0 0; justify-content: space-between; }
.btn.wide { width: 100%; }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.cart-layout > * { min-width: 0; }
.summary { position: sticky; top: 80px; display: grid; gap: 10px; }
.summary h2 { margin: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--ink-2); } .totals dd { margin: 0; text-align: right; }
.totals .grand { font: 600 22px var(--cond); color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.cline { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.cline:last-child { border-bottom: 0; }
.cline img, .cline .ph { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; background: var(--line-2); }
.cline .meta { display: grid; gap: 2px; min-width: 0; }
.cline .meta a { font-weight: 500; }
.cline .ctrl { display: grid; gap: 6px; justify-items: end; }
.cline .ctrl input { width: 64px; padding: 5px; border: 1px solid var(--line); border-radius: 3px; font: 15px var(--sans); }
.co-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line-2); }
.pay-options { display: grid; gap: 8px; }
.pay { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; cursor: pointer; font-weight: 500; background: #fff; }
.pay:has(input:checked) { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(242,165,26,.25); }
.pay input { width: auto !important; }
.timeline { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.timeline li { display: grid; gap: 4px; justify-items: start; position: relative; padding-top: 22px; color: var(--muted); font-size: 14px; }
.timeline li::before { content: ""; position: absolute; top: 7px; left: 14px; right: -8px; height: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.timeline li.done { color: var(--ink); }
.timeline li.done .dot { background: var(--amber); border-color: var(--amber-dark); }
.timeline li.done::before { background: var(--amber); }
.qr { width: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 4px; }
.accept { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; max-width: none; }
@media print { .accept, .ask-fab, .assistant, .bottombar { display: none !important; } }

/* Assistant */
.ask-fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--charcoal); color: #fff; border: 2px solid var(--amber); border-radius: 999px; padding: 12px 18px; font: 600 15px var(--sans); cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.assistant { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 45; width: min(400px, calc(100% - 24px)); max-height: min(640px, calc(100vh - 100px)); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.28); display: flex; flex-direction: column; overflow: hidden; }
.assistant header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--charcoal); color: #fff; }
.assistant header h2 { margin: 0; font-size: 20px; color: #fff; }
.as-log { padding: 12px; overflow: auto; display: grid; gap: 10px; flex: 1; background: var(--paper); }
.as-msg { padding: 9px 12px; border-radius: 8px; font-size: 14px; max-width: 92%; }
.as-msg.bot { background: #fff; border: 1px solid var(--line); }
.as-msg.me { background: var(--charcoal); color: #fff; justify-self: end; }
.as-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.as-card a { font-weight: 600; font-size: 14px; }
.as-card .p { font-weight: 600; white-space: nowrap; }
.as-form, .as-photo { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line-2); align-items: center; flex-wrap: wrap; }
.as-form input { flex: 1; min-width: 0; font: 15px var(--sans); padding: 9px 10px; border: 1px solid #c8c8c1; border-radius: 3px; }
.as-photo input[type=tel] { flex: 1; min-width: 120px; font: 14px var(--sans); padding: 7px 8px; border: 1px solid #c8c8c1; border-radius: 3px; }
.as-file { font-size: 13px; display: flex; align-items: center; gap: 6px; max-width: 100%; }
.as-file input { font-size: 12px; max-width: 170px; }
.bottombar { display: none; }
@media (max-width: 980px) {
  .spx-hero { grid-template-columns: minmax(0, 1fr); }
  .hero-img { min-height: 160px; order: -1; }
  .hero-text { padding: 22px 18px; }
  .spx-hero h1 { font-size: 34px; }
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .timeline { grid-template-columns: 1fr; }
  .timeline li { padding: 0 0 0 26px; }
  .timeline li::before { left: 7px; top: 18px; bottom: -10px; right: auto; width: 2px; height: auto; }
}
@media (max-width: 640px) {
  .ask-fab { display: none; }
  .bottombar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--charcoal); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 2px solid var(--amber); }
  .bottombar a, .bottombar button { color: #f5f5f2 !important; background: none; border: 0; font: 600 13px var(--sans); padding: 12px 4px; text-align: center; }
  body.spx { padding-bottom: 56px; }
  .assistant { right: 0; left: 0; bottom: 0; width: 100%; max-height: 85vh; border-radius: 10px 10px 0 0; }
  .topbar nav { display: none; }
  .facts { gap: 12px; }
}

.linkbtn { background: none; border: 0; padding: 0; color: var(--link, #0b5394); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.spx-hero .home-search { max-width: 100%; }
.spx-hero .home-search input { min-width: 0; }
.hero-text { min-width: 0; } .spx-hero .examples { flex-wrap: wrap; }
.hero-text { grid-template-columns: minmax(0, 1fr); }
