/* Trade Ordering Platform — design system.
   Palette/typeface pulled from the real autopartuk.com site (Work Sans,
   deep teal-green accent, near-black header/footer) so this reads as part
   of the same business rather than a generic scaffold. */

:root {
  --color-primary: #1f5c46;
  --color-primary-dark: #143f30;
  --color-primary-light: #2c7a5b;
  --color-dark: #16171a;
  --color-bg: #f2f3f5;
  --color-surface: #ffffff;
  --color-text: #434549;
  --color-text-muted: #75777c;
  --color-border: #e1e3e6;
  --color-danger: #b3261e;
  --color-danger-bg: #fdecea;
  --color-success: #1f5c46;
  --color-success-bg: #e9f3ef;
  --color-warning: #a15c00;
  --color-warning-bg: #fff4e5;
  --radius: 8px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(22, 23, 26, 0.06), 0 1px 8px rgba(22, 23, 26, 0.05);
}

* { box-sizing: border-box; }
/* The `hidden` attribute must always win, even over a class that sets
   display (e.g. .btn's inline-flex) — otherwise `el.hidden = true` in JS
   silently does nothing for those elements. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Work Sans", Arial, Helvetica, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: "Work Sans", Arial, Helvetica, sans-serif;
  color: var(--color-dark);
  font-weight: 700;
  margin: 0 0 0.6em;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 1.6em; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout shell ---- */

.site-header {
  background: var(--color-dark);
  color: #fff;
}
.site-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-header__brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
}
.site-header__brand span { color: var(--color-primary-light); }
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.92rem;
}
.site-header__nav a {
  color: rgba(255, 255, 255, 0.85);
}
.site-header__nav a:hover { color: #fff; }
.site-header__cart-count {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  padding: 1px 8px;
  margin-left: 4px;
}

/* Basket hover preview. The dropdown sits flush against the nav link's own
   bottom edge (no gap) so the mouse never leaves .basket-nav while moving
   from the link down into the dropdown — a gap there would make it flicker
   closed before you reach it. */
.basket-nav {
  position: relative;
}
.basket-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  margin-top: 0;
  padding-top: 12px;
  z-index: 20;
}
.basket-nav:hover .basket-dropdown,
.basket-nav.is-open .basket-dropdown {
  display: block;
}
/* Nothing in the basket: shown as dimmed text rather than a link. */
.basket-nav--empty {
  color: rgba(255, 255, 255, 0.45);
  cursor: default;
}
.basket-dropdown__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  background: var(--color-surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
}
.basket-dropdown__list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text);
}
.basket-dropdown__list li:last-child { border-bottom: none; }
.basket-dropdown__name { flex: 1 1 auto; }
.basket-dropdown__qty { color: var(--color-text-muted); }
.basket-dropdown__price { font-weight: 600; white-space: nowrap; }
.basket-dropdown__footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text);
}
.basket-dropdown .btn--block {
  border-radius: 0 0 var(--radius) var(--radius);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}
.site-footer__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

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

/* ---- Cards & surfaces ---- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card--narrow {
  max-width: 420px;
  margin: 48px auto;
}

/* Order detail: totals / payment / delivery side by side instead of
   stacked full-width blocks, so the page doesn't run on forever. */
.order-summary-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}
.order-summary-grid > .card {
  flex: 1 1 280px;
  min-width: 0;   /* may shrink below its inputs' intrinsic width on a phone */
  padding: 20px 24px;
}
/* Inputs side by side (City/Postcode, phone/email) must be allowed to
   shrink, or the card can't and the whole page goes wider than the phone.
   Same for the <fieldset> around the delivery address: browsers give
   fieldsets min-inline-size: min-content, which pinned it at 402px. */
.cluster > input { min-width: 0; }
fieldset { min-inline-size: 0; min-width: 0; }

/* Basket totals box: sits under the line-item table, right-aligned on
   desktop like an invoice's totals block, full-width on phones. */
.basket-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 12px;
}
.basket-summary { flex: 0 1 380px; margin-left: auto; }
.basket-summary__zone { font-weight: 400; font-size: 0.85rem; }
.basket-summary__zone:has(> [data-total="zone"]:empty) { display: none; }
.basket-summary__note { margin-top: 10px; font-size: 0.8rem; }
@media (max-width: 640px) {
  .basket-summary { flex-basis: 100%; }
}

/* Basket / order tables on phones: no sideways scrolling. Each row becomes
   a stacked block — the product cell as a heading, the other cells as
   "Label   value" lines (label from data-label), actions at the bottom. */
@media (max-width: 640px) {
  .table-scroll:has(> .table-stack) { overflow-x: visible; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { padding: 5px 0; border: 0; white-space: normal; }
  .table-stack td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .table-stack td[data-label]::before {
    content: attr(data-label);
    flex: none;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
  }
  .table-stack td[data-label] > * { text-align: right; }
  .table-stack td[data-label] select { max-width: 60%; }
  .table-stack__title { font-weight: 600; padding-bottom: 6px; }
  .table-stack__actions { padding-top: 10px; text-align: right; }
}

.summary-list { margin: 0; }
.summary-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}
.summary-list > div:last-child { border-bottom: none; }
.summary-list dt { color: var(--color-text-muted); margin: 0; }
.summary-list dd { margin: 0; font-weight: 600; }
.summary-list__total dt,
.summary-list__total dd { font-weight: 700; color: var(--color-dark); }

/* ---- Messages ---- */

.messages { list-style: none; margin: 0 0 20px; padding: 0; }
.messages li {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.92rem;
  border-left: 4px solid var(--color-text-muted);
  background: var(--color-bg);
}
.messages li.success { background: var(--color-success-bg); border-color: var(--color-success); color: var(--color-primary-dark); }
.messages li.error { background: var(--color-danger-bg); border-color: var(--color-danger); color: var(--color-danger); }
.messages li.warning { background: var(--color-warning-bg); border-color: var(--color-warning); color: var(--color-warning); }
.messages li.info { background: var(--color-bg); border-color: var(--color-text-muted); }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  cursor: pointer;
  background: var(--color-primary);
  color: #fff;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; }

.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--secondary:hover { background: var(--color-bg); }

.btn--danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger-bg);
}
.btn--danger:hover { background: var(--color-danger-bg); }

.btn--small { padding: 5px 14px; font-size: 0.78rem; }
.btn--block { width: 100%; justify-content: center; }

/* ---- Forms ---- */

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

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
select,
textarea {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(31, 92, 70, 0.12);
}
input[type="number"] { width: 5.5em; }
input:disabled, select:disabled, textarea:disabled {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }

/* The most common choice on the delivery step, so it gets its own
   button-like toggle instead of a plain small checkbox easy to miss. */
.ship-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ship-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--color-primary);
}
.ship-toggle--on {
  border-color: var(--color-primary);
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
}

/* Plain Django {{ form.as_p }} output */
form p { margin-bottom: 16px; }
form p label { display: block; margin-bottom: 4px; font-weight: 600; color: var(--color-text); }
form p input, form p select, form p textarea { width: 100%; }

/* Vehicle lookup on the product list: the picker (four cascading
   dropdowns, shown until a vehicle is chosen) and the banner that replaces
   it once one is. Same card treatment as the filter bar beneath, but not
   sticky — it's a one-off choice, not something to keep at hand while
   scrolling. */
.vehicle-picker,
.vehicle-banner {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-bottom: 16px;
}
/* Vehicle picker, list style: collapsed to a one-line bar by default on
   every screen size (see .collapse-toggle); open, it's Make › Model ›
   Version crumbs and one scrollable pick-list at a time with a filter box. */
.vehicle-picker { padding: 12px 20px; border-left: 4px solid var(--color-primary); }
.vehicle-picker > .collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;   /* centred, and reads as an action, not a footnote */
  flex-wrap: wrap;
  gap: 10px 16px;
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.02rem;
  color: var(--color-dark);
  cursor: pointer;
  text-align: center;
}
.collapse-toggle__icon { flex: none; color: var(--color-primary); }
.collapse-toggle__text strong { font-size: 1.08rem; }
.collapse-toggle__hint { color: var(--color-text-muted); font-weight: 400; font-size: 0.92rem; }
.collapse-toggle__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}
.vehicle-picker > .collapse-toggle:hover .collapse-toggle__cta { background: var(--color-primary-dark); }
.collapse-toggle__cta svg { transition: transform 0.15s ease; }
.vehicle-picker > .collapse-toggle[aria-expanded="true"] .collapse-toggle__cta svg { transform: rotate(180deg); }
.vehicle-picker > .collapse-body { display: none; padding-top: 14px; }
.vehicle-picker.is-open > .collapse-body { display: block; }
.vp-tabs {
  display: flex;
  width: min(100%, 420px);
  margin: 0 auto 14px;
  border: 1px solid var(--color-dark);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.vp-tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  background: var(--color-surface);
  color: var(--color-dark);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.vp-tab[aria-selected="true"] { background: var(--color-dark); color: #fff; }
.vp-reg {
  display: flex;
  align-items: stretch;
  width: min(100%, 400px);
  margin: 0 auto 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--color-dark);
}
.vp-reg__flag {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}
.vp-reg__input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  background: #fcd34d;
  color: var(--color-dark);
}
.vp-reg__go {
  border: 0;
  padding: 0 16px;
  background: var(--color-dark);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.vp-steps__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: 10px;
}
.vp-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}
.vp-crumb {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.vp-crumb + .vp-crumb::before { content: none; }
.vp-crumb--done { background: var(--color-success-bg); color: var(--color-primary-dark); }
.vp-crumb--current { background: var(--color-dark); color: #fff; }
.vp-steps__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.vp-steps__label { margin: 0; font-weight: 700; color: var(--color-dark); }
.vp-filter { width: min(100%, 260px); padding: 7px 10px; font-size: 0.88rem; }
.vp-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.vp-list li + li { border-top: 1px solid var(--color-border); }
.vp-list__empty { padding: 14px 16px; color: var(--color-text-muted); font-size: 0.9rem; }
.vp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  background: transparent;
  color: var(--color-dark);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.vp-item:hover, .vp-item:focus-visible { background: var(--color-success-bg); outline: none; }
.vp-item__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vp-item__title { font-weight: 600; font-size: 0.92rem; }
.vp-item__sub { font-size: 0.8rem; color: var(--color-text-muted); }
.vp-item__chevron { flex: none; color: var(--color-text-muted); }
@media (max-width: 767px) {
  .vehicle-picker { padding: 10px 14px; }
  .collapse-toggle__hint { display: none; }   /* just the title on a phone */
  .collapse-toggle__icon { display: none; }
  .vehicle-picker > .collapse-toggle { font-size: 0.9rem; gap: 6px 12px; padding: 0; }
  .collapse-toggle__text strong { font-size: 0.95rem; }
  .collapse-toggle__cta { padding: 6px 14px; font-size: 0.8rem; }
  .guest-notice { padding: 8px 12px; font-size: 0.82rem; gap: 2px 8px; margin-bottom: 10px; }
  .vp-steps__head { flex-wrap: wrap; }
  .vp-filter { width: 100%; }
  .vp-list { max-height: 55vh; }
}

/* Fitment disclaimer: an amber banner (meant to be noticed) with a
   one-line summary; native <details> expands the fuller explanation —
   always in the HTML, never in the way. */
.fitment-disclaimer {
  flex: 1 1 100%;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--color-warning);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: 0.85rem;
  line-height: 1.45;
}
.fitment-disclaimer summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}
.fitment-disclaimer summary::-webkit-details-marker { display: none; }
.fitment-disclaimer__icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-warning);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  margin-top: 1px;
}
.fitment-disclaimer__text { flex: 1; }
.fitment-disclaimer__more {
  flex: none;
  text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
}
.fitment-disclaimer[open] .fitment-disclaimer__more { display: none; }
.fitment-disclaimer__body { margin-top: 8px; padding-left: 30px; font-weight: 400; }
.fitment-disclaimer__body p { margin: 6px 0 0; }
.fitment-disclaimer__body strong { font-weight: 700; }
@media (max-width: 640px) {
  .fitment-disclaimer summary { flex-wrap: wrap; }
  .fitment-disclaimer__more { margin-left: 30px; }
  .fitment-disclaimer__body { padding-left: 0; }
}

.vehicle-picker__note {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--color-warning);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: 0.88rem;
}

.vehicle-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  border-left: 4px solid var(--color-primary);
}
.vehicle-banner__main {
  display: flex;
  flex-direction: column;
  flex: 1 1 220px;
}
.vehicle-banner__eyebrow {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.vehicle-banner__title {
  font-size: 1.05rem;
  color: var(--color-dark);
}
.vehicle-banner__version {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.vehicle-banner__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
}
.vehicle-banner__specs > div { display: flex; flex-direction: column; }
.vehicle-banner__specs dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.vehicle-banner__specs dd {
  margin: 0;
  font-weight: 600;
  color: var(--color-dark);
}
.vehicle-banner__limit {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
/* Van load-rating slider (business's design spec, 10 Sep 2026): a white
   card inside the banner. 61 discrete stops (Any, then 750–1350kg in
   10kg steps) — position is index/61; the fill and handle are positioned
   by the script (and server-side for first paint). The readout lives in
   the header, not in a bubble over the handle (it would overflow the card
   at the ends). */
.load-scale {
  flex: 1 1 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.load-scale__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.load-scale__title { font-size: 15px; font-weight: 600; color: #111827; letter-spacing: -0.005em; }
.load-scale__sub { font-size: 12.5px; color: #9ca3af; margin-top: 3px; }
.load-scale__controls { display: flex; align-items: center; gap: 10px; }
.load-scale__readout {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 3.2em;
  text-align: center;
}
.load-scale__nudge {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.load-scale__nudge:hover { background: #f9fafb; }
.load-scale__track {
  position: relative;
  height: 56px;
  margin-top: 18px;
  touch-action: none;
  cursor: pointer;
  outline: none;
}
.load-scale__track:focus-visible .load-scale__handle { box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18), 0 0 0 6px rgba(20, 83, 45, 0.12); }
.load-scale__rail,
.load-scale__fill {
  position: absolute;
  left: 0;
  top: 14px;
  height: 6px;
  border-radius: 999px;
}
.load-scale__rail { right: 0; background: #e5e7eb; }
.load-scale__fill { width: 0; background: #14532d; }
.load-scale__handle {
  position: absolute;
  top: 6px;
  left: 0;
  margin-left: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #14532d;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
  cursor: grab;
  transition: box-shadow 0.12s;
}
.load-scale__handle.is-dragging { cursor: grabbing; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18), 0 0 0 6px rgba(20, 83, 45, 0.12); }
/* ≥44px touch target around the 22px handle, without enlarging the visual. */
.load-scale__hit { position: absolute; inset: -12px; border-radius: 50%; }
.load-scale__scale { position: absolute; left: 0; right: 0; top: 30px; height: 24px; }
.load-scale__label {
  position: absolute;
  top: 0;
  padding-top: 8px;
  transform: translateX(-50%);
  font-size: 11px;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
}
.load-scale__label::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 5px;
  background: #d1d5db;
}
.load-scale__label--any { transform: none; }
.load-scale__label--any::before { left: 0; }
.load-scale__label--any.is-active { color: #111827; font-weight: 700; }
.load-scale__fallback { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
@media (max-width: 480px) {
  /* A phone-width track can't fit eight labels: 800 and 1300 would sit on
     top of "Any" and "1350+", so they go (their ticks too). */
  .load-scale { padding: 16px 16px 14px; }
  .load-scale__label[data-kg="800"], .load-scale__label[data-kg="1300"] { display: none; }
}
.vehicle-banner__caveat {
  flex: 1 1 100%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--color-warning);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: 0.88rem;
}

/* Filter bar on the product list. Sticks to the top of the viewport while
   scrolling through a long results table, so the filters are always at
   hand. Needs a solid background + shadow (already has both) so the table
   scrolling underneath it is fully hidden, not overlapping — the earlier
   "blocks the table" complaint turned out to be about the Django admin's
   changelist filter, not this one. */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.filter-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}
.filter-bar__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-bar__field label {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.8rem;
}
.filter-bar__field--search {
  flex: 1 1 200px;
}
.filter-bar__field--search input {
  width: 100%;
}

/* "In stock only" — was a plain small checkbox + label that read as an
   afterthought next to a row of proper dropdowns. Styled as a bordered
   toggle (same idea as .ship-toggle on the basket page: lights up green
   once checked) sized to match the height of the <select>s beside it. */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 37px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.filter-toggle:hover {
  border-color: var(--color-primary);
}
.filter-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
}
.filter-toggle.filter-toggle--on {
  /* Two classes, not one — needs to outrank .filter-bar__field label's
     (0,1,1) specificity, which otherwise wins the `color` property back to
     the default text colour regardless of rule order. */
  border-color: var(--color-primary);
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
}

/* ---- Tables ---- */

.table-scroll {
  overflow-x: auto;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}
th {
  color: var(--color-text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  background: #fafafb;
}
tbody tr:hover { background: #fafbfa; }
td img { display: block; border-radius: 6px; }

/* Product list: fewer, narrower columns (stock code/brand/design merged,
   bore/max bore merged, qty+add merged) plus wrapping instead of nowrap, so
   the whole table fits without horizontal scrolling on an ordinary desktop
   width instead of needing .table-scroll's overflow-x as the only way to
   see the last few columns. */
.product-table th, .product-table td {
  white-space: normal;
  padding: 10px 12px;
}
.product-table { font-size: 0.83rem; }
.product-table select { max-width: 110px; }
.product-table input[type="number"] { width: 3.5em; }

/* Product photo thumbnail + hover zoom. Wheels are a heavily look-driven
   purchase, so 64px (up from 36px) reads more clearly at a glance, and
   hovering shows a much larger preview via #product-thumb-zoom (a single
   shared, fixed-position <img> — see the inline script in
   product_list.html for why fixed rather than absolute). */
.product-thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
}
.product-thumb-zoom {
  display: none;
  position: fixed;
  width: 260px;
  height: 260px;
  object-fit: cover;
  border-radius: 10px;
  border: 4px solid var(--color-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  z-index: 50;
  pointer-events: none;
}

/* Whole-row link: the row-link anchor stretches over the entire <tr> via
   ::after so clicking anywhere in the row navigates, while still being a
   real, keyboard/screen-reader-accessible link (not JS-driven). */
.table-row-links tbody tr { position: relative; cursor: pointer; }
.table-row-links .row-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Public catalogue: guests see the table without prices/order columns and
   this one-line prompt to sign in (or to become a dealer) instead. */
.guest-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 10px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border-left: 4px solid var(--color-primary);
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
  font-size: 0.9rem;
}
.guest-notice a { font-weight: 600; text-decoration: underline; }

.result-count {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

/* ---- Status badges ---- */

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge--placed { background: #e8eaf0; color: #3d4560; }
.badge--in_review { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--quote_sent { background: #e6effa; color: #1c5aa3; }
.badge--queued_for_machining { background: #f1e9fa; color: #6a3cad; }
.badge--dispatched { background: var(--color-success-bg); color: var(--color-primary); }

.stock--in { color: var(--color-primary); font-weight: 600; }
.stock--out { color: var(--color-danger); font-weight: 600; }

/* ---- Product results: grid / list ----
   Both renderings are in the page; the modifier class on .product-results
   picks one. The table (list) is the dense ordering tool; the card grid is
   for browsing and for phones, where the table needs sideways scrolling. */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.results-bar .result-count { margin: 0; }
.sort-form { margin-left: auto; }
.sort-form__label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--color-text); }
.sort-form select { padding: 6px 28px 6px 10px; font-size: 0.82rem; }
@media (max-width: 640px) {
  .results-bar { flex-wrap: wrap; }
  .sort-form { margin-left: 0; flex: 1 1 100%; order: 3; }
  .sort-form select { width: 100%; }
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-surface);
}
.view-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.view-toggle__btn + .view-toggle__btn { border-left: 1px solid var(--color-border); }
.view-toggle__btn svg { fill: currentColor; }
.view-toggle__btn[aria-pressed="true"] {
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
}
.product-results--grid .product-results__list { display: none; }
.product-results--list .product-results__grid { display: none; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.product-grid__empty {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius);
}
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.product-card--out .product-card__image img { opacity: 0.55; }
.product-card__image {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  /* It's a <button> (tap to enlarge) — strip the button chrome. */
  width: 100%;
  border: 0;
  cursor: zoom-in;
}
.product-card__image:disabled { cursor: default; }
.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  flex: 1;
}
.product-card__title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}
.product-card__specs {
  margin: 0;
  display: grid;
  /* Two label/value pairs on one row: Bore … | Load … */
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 2px 8px;
  font-size: 0.8rem;
  line-height: 1.35;
}
.product-card__specs > div { display: contents; }
.product-card__specs > div[hidden] { display: none; }
.product-card__specs dd { white-space: nowrap; }
.product-card__specs dt { color: var(--color-text-muted); }
.product-card__specs dd { margin: 0; color: var(--color-text); }
.product-card__status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.8rem;
  white-space: nowrap;   /* "In stock (16)" and the price each stay on one line */
}
.product-card__price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark);
}
.product-card__order {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-card__order select { min-width: 0; font-size: 0.82rem; padding: 6px 8px; }
/* Row 1: PCD + offset side by side (dropdowns or fixed values); row 2: qty + Add. */
.product-card__order-row { display: grid; gap: 6px; align-items: center; }
.product-card__order-row--spec { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.product-card__order-row--spec > span { display: contents; }   /* the js-pcd / js-offset hosts; their select/span is the grid item */
.product-card__order-row--size select { width: 100%; }
.product-card__finish { margin: -4px 0 0; font-size: 0.82rem; color: var(--color-text-muted); }
.product-card__order-row--buy { grid-template-columns: auto 1fr; }
.product-card__order-row--buy .btn { justify-content: center; }
.product-card__order-row input[type="number"] { width: 3.6em; padding-left: 6px; padding-right: 2px; }
.product-card__fixed {
  font-size: 0.82rem;
  color: var(--color-text);
  padding: 6px 8px;
  border: 1px solid transparent;   /* same height as the neighbouring select */
  white-space: nowrap;
}

/* Tap-to-enlarge photo overlay. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 23, 26, 0.9);
  cursor: zoom-out;
}
.lightbox__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
}
.lightbox__img {
  max-width: min(92vw, 900px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
/* Host for the in-page 360° viewer (aw360.js takes over the .aw360 div),
   or the frame used for a non-native viewer page. Square, sized to the
   viewport. */
.lightbox__spin,
.lightbox__frame {
  width: min(92vw, 88vh, 720px);
  height: min(92vw, 88vh, 720px);
  border: 0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.lightbox__spin .aw360 { max-width: none; width: 100%; height: 100%; }
.lightbox__hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(22, 23, 26, 0.65);
  color: #fff;
  font-size: 0.75rem;
  pointer-events: none;
}
/* Colour strip on a design tile: one photo per finish, swipe (scroll-snap)
   or use the arrows / dots. Single-finish tiles are just the one photo. */
.product-card__gallery { position: relative; }
.product-card__slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.product-card__slides::-webkit-scrollbar { display: none; }
.product-card__slide { flex: 0 0 100%; scroll-snap-align: start; }
.product-card__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 23, 26, 0.55);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 0 0 3px;
  cursor: pointer;
  /* Always visible (not hover-only): the arrows double as the signal that
     the design comes in more colours, so they need to be seen up front. */
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.product-card__arrow--prev { left: 6px; }
.product-card__arrow--next { right: 6px; }
.product-card__arrow:hover,
.product-card__arrow:focus-visible { opacity: 1; background: rgba(22, 23, 26, 0.75); }
@media (hover: none) {
  .product-card__arrow { width: 24px; height: 24px; font-size: 17px; }
}
.product-card__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
  z-index: 1;
}
.product-card__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(22, 23, 26, 0.22);
  cursor: pointer;
}
.product-card__dot.is-active { background: var(--color-primary); }
.product-card__finish-count { color: var(--color-text-muted); font-size: 0.72rem; white-space: nowrap; }
.product-card__finish-count::before { content: "· "; }

/* "360°" corner badge on card photos that have a spin. */
.product-card__image { position: relative; }
.badge-360 {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(22, 23, 26, 0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lightbox__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 767px) {
  /* Phone filter panel, open by default (colleagues expected to see it),
     so it has to be compact: a 3-column grid — Search (2 cols) + Brand;
     Design / Diameter / Width; PCD / Colour / Finish; In stock —
     with small labels and controls. "Clear filters" is dropped here (the
     header row's Clear link does the same). Roughly a quarter of a phone
     screen instead of half. */
  .filter-bar__row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 8px;
    align-items: end;
  }
  .filter-bar__field { gap: 2px; min-width: 0; }
  .filter-bar__field label { font-size: 0.68rem; line-height: 1.2; }
  .filter-bar__field label[style*="visibility"] { display: none; }   /* the spacer labels above Stock/Size */
  .filter-bar__field select,
  .filter-bar__field input[type="text"] { width: 100%; padding: 6px 8px; font-size: 0.85rem; }
  .filter-bar__field select { padding-right: 24px; background-position: right 8px center; }
  .filter-bar__field--search { grid-column: span 2; flex: none; }
  .filter-bar__field--stock { grid-column: span 1; }
  .filter-toggle { height: 34px; padding: 0 10px; font-size: 0.78rem; gap: 6px; }
  .filter-bar__field--clear { display: none; }
}

@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card__body { padding: 8px 9px 10px; gap: 6px; }
  /* Two tiles across a phone: "Bore 72.6–74.1mm" and "Load 1000kg" don't
     fit on one row, so the pairs stack (one per row) here. */
  .product-card__specs { font-size: 0.72rem; gap: 1px 6px; grid-template-columns: auto minmax(0, 1fr); }
  .product-card__title { font-size: 0.88rem; }
  .product-card__status { font-size: 0.74rem; }
  .product-card__price { font-size: 0.92rem; }
  /* Two tiles across a phone leaves no room for "In stock (24)" plus a
     struck-through list price AND the dealer price — drop the list price. */
  .product-card__price s { display: none; }
  .product-card__order select { font-size: 0.76rem; padding: 5px 4px; }
  .product-card__order-row { gap: 4px; }
  .product-card__order-row input[type="number"] { width: 2.8em; font-size: 0.8rem; padding: 5px 2px 5px 5px; }
  .product-card__order-row .btn { padding: 5px 10px; font-size: 0.74rem; }
}

/* ---- Utility ---- */

.text-muted { color: var(--color-text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
/* Basket: one vehicle-details block per line item (each product in the
   basket can be going on a different car), stacked in their own card next
   to Delivery rather than as extra columns in the fitment table — the
   table was the wrong place for free-text vehicle fields since it forced
   them into narrow, horizontally-scrolling cells no matter how the other
   columns were sized. */
.vehicle-details-line {
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
}
.vehicle-details-line:first-of-type {
  border-top: none;
  padding-top: 4px;
}
.vehicle-details-line__title {
  margin: 0 0 12px;
  font-size: 0.95rem;
}
/* "Same vehicle as previous line" — mirrored, read-only fields (see the
   inline script in cart.html), styled to look inert rather than a normal
   editable field. */
.field--linked {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* Basket: the fitment row a line was chosen for via the vehicle lookup. */
.fitment-tag {
  margin: -6px 0 12px;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 4px solid var(--color-primary);
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
  font-size: 0.82rem;
}
/* Infinite scroll: the sentinel/“Load more” fallback and the end note. */
.load-more { display: flex; justify-content: center; margin: 24px 0 8px; }
.load-more__end { margin: 24px 0 8px; text-align: center; color: var(--color-text-muted); font-size: 0.88rem; }

/* Phone-only collapsing of the vehicle picker and filter bar. On a phone
   the sticky filter bar pinned half the screen for the whole visit; now
   both panels are single-line buttons that expand on tap, and the bar
   isn't sticky. Desktop (>=768px): toggles hidden, bodies always shown. */
.collapse-toggle,
.collapse-toggle-row { display: none; }
@media (max-width: 767px) {
  .collapse-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-dark);
    cursor: pointer;
    text-align: left;
  }
  .collapse-toggle svg { flex: none; transition: transform 0.15s ease; }
  .collapse-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .collapse-toggle__count {
    display: inline-block;
    min-width: 1.5em;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    text-align: center;
    margin-left: 4px;
  }
  .collapse-toggle-row__clear { font-size: 0.85rem; white-space: nowrap; }
  .collapse-body { display: none; padding-top: 12px; }
  .is-open > .collapse-body { display: block; }
  .vehicle-picker, .filter-bar { padding: 12px 16px; margin-bottom: 12px; }
  .filter-bar { position: static; }          /* no longer pinned on phones */
}

@media (max-width: 640px) {
  .site-header__inner { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 8px; }
  /* Nav items must not wrap mid-label ("My / orders", "Sign / out"). */
  .site-header__nav { gap: 12px; flex-wrap: wrap; }
  .site-header__nav a, .site-header__nav button { white-space: nowrap; }
  /* Basket preview on phones: opened by tapping "Basket" (base.html script)
     rather than hover, and anchored to the header itself — not the link —
     so it spans the screen width instead of hanging 320px off the right
     edge of wherever the link happens to sit. */
  .site-header { position: relative; }
  .basket-nav { position: static; }
  .basket-dropdown {
    display: none;
    left: 12px;
    right: 12px;
    width: auto;
    padding-top: 6px;
  }
  .basket-nav:hover .basket-dropdown { display: none; }   /* touch "hover" must not open it */
  .basket-nav.is-open .basket-dropdown { display: block; }
  .page { padding: 20px 14px 48px; }
  .card { padding: 20px; }
}
