/* ==========================================================================
   Naya Purano Quick Spares — design system
   --------------------------------------------------------------------------
   Organised as: tokens → reset → utilities → layout → components → pages →
   dashboard → responsive. Component styles live under one heading each; put
   new rules under the heading they belong to rather than at the bottom.

   Everything is plain CSS on purpose (no build step — see CLAUDE.md), so the
   only abstraction available is the custom property. Use the tokens; avoid
   literal hex values and one-off pixel spacing below this block.
   ========================================================================== */

/* ---------- Tokens: brand palette (canonical, see CLAUDE.md) ---------- */

:root {
  /* Brand */
  --color-bg:            #FFFFFF;  /* clean page background */
  --color-surface:       #FFFFFF;  /* cards, panels */
  --color-surface-alt:   #F5F5F5;  /* soft gray — section backgrounds, table headers */

  /* Primary (trust/eco green — nav, headings, links, primary buttons) */
  --color-primary:       #2E7D32;
  --color-primary-dark:  #1F5722;
  --color-primary-light: #E8F3E9;  /* light green tint, e.g. selected nav item */

  /* Secondary (used sparingly — tags, badges, chart's 2nd line, never as a 3rd loud brand color) */
  --color-secondary:     #009688;

  /* CTA — the ONE high-contrast action color. Use for primary buttons
     (Add Listing, Browse, admin actions) — never for backgrounds or nav. */
  --color-cta:           #FF6F00;
  --color-cta-dark:      #E05F00;

  /* Exception: the WhatsApp enquiry button keeps WhatsApp's own green —
     recognizability there beats brand consistency. */
  --color-whatsapp:      #25D366;

  /* Status */
  --color-success:       #2E7D32;  /* "Active" badges — reuse primary */
  --color-warning:       #E8A33D;  /* "Draft" badges */
  --color-danger:        #D32F2F;  /* "Urgent" / error states */

  /* Text */
  --color-text:          #222222;
  --color-text-muted:    #6B7280;
  --color-border:        #E5E5E5;

  /* Radii / shadow */
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
}

/* ---------- Tokens: derived ----------
   Extensions to the palette above, kept separate so the canonical block stays
   copy-pasteable. Nothing here overrides a brand colour; these are variants
   derived from it for jobs the base palette doesn't cover.

   Contrast: several brand colours are vivid enough that white text on them
   fails WCAG AA (#FF6F00 → 2.8:1, #25D366 → 2.0:1, #E8A33D → 1.9:1). Rather
   than restyle the brand, solid fills use a darkened "-ink" variant, and
   badges/pills switched to a tinted treatment (soft background + dark text)
   which is both accessible and the more current look. */

:root {
  /* Solid action fills that carry white text */
  --color-cta-ink:        #BC5400;  /* 4.8:1 with #fff */
  --color-cta-ink-hover:  #9C4600;
  --color-primary-hover:  #276B2A;

  /* Soft tints for badges, pills, callouts and selected states */
  --color-cta-tint:        #FFF1E3;
  --color-cta-tint-ink:    #8A3B00;
  --color-warning-tint:    #FDF3DF;
  --color-warning-tint-ink:#7A5410;
  --color-danger-tint:     #FDECEA;
  --color-danger-tint-ink: #A81E1E;
  --color-info-tint:       #E7F1FB;
  --color-info-tint-ink:   #1B4F82;
  --color-secondary-tint:  #DCF2F0;
  --color-secondary-tint-ink: #00625A;

  /* Label ink for the two vivid brand fills that keep their exact hue
     (--color-whatsapp for recognisability, --color-cta on the dashboard
     brand mark). White text on either fails AA; this near-black green
     clears it — 7.5:1 on #25D366, 5.3:1 on #FF6F00. */
  --color-ink-deep:        #052E16;
  --color-whatsapp-hover:  #1FBA5A;
  --color-whatsapp-tint:   #E4F8EC;
  --color-whatsapp-tint-ink: #0B6B36;

  /* Neutrals */
  --color-surface-sunken:  #FAFAFA;
  --color-border-subtle:   #EFEFEF;
  --color-border-strong:   #D4D4D4;
  --color-text-subtle:     #5B6472;  /* muted text on tinted backgrounds */
  --color-overlay:         rgba(17, 24, 28, 0.55);

  /* Spacing — 4px base. Use these instead of ad-hoc rem values. */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm:   6px;
  --radius-xl:   22px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: var(--shadow-card);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  /* Focus — one ring, used on every interactive element. */
  --focus-ring: 0 0 0 3px rgba(46, 125, 50, 0.35);
  --focus-ring-danger: 0 0 0 3px rgba(211, 47, 47, 0.30);

  /* Motion */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  /* Longer, decelerating — for something the size of the hero slider, where
     the 200ms base curve reads as a jump rather than a slide. */
  --transition-slide: 500ms cubic-bezier(0.32, 0.72, 0, 1);

  /* Layout */
  --container-width: 1180px;
  --container-pad: clamp(1rem, 4vw, 2rem);
  --header-height: 4.25rem;

  /* Typography — OS-native stack (instant load, matches the visitor's own
     device UI, no webfont to host) plus a ~1.25 modular type scale. */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.375rem;
  --font-size-2xl:  1.75rem;
  --font-size-3xl:  2.25rem;
}

/* ==========================================================================
   Reset & base elements
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video { max-width: 100%; }

img { height: auto; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, var(--font-size-2xl)); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4, h5, h6 { font-size: var(--font-size-base); }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-primary);
  text-underline-offset: 0.15em;
}

a:hover { color: var(--color-primary-dark); }

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* One focus treatment for the whole app. :focus-visible keeps it off mouse
   clicks but guarantees it for keyboard users — previously there was none at
   all, which made the site unusable without a pointer. */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  z-index: 200;
  transform: translateY(-200%);
  background: var(--color-primary-dark);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
  color: #fff;
}

.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-nowrap { white-space: nowrap; }


.push-right { margin-left: auto; }

[hidden] { display: none !important; }

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: var(--space-6) var(--container-pad) var(--space-12);
}

.section { margin: var(--space-12) 0; }
.section:first-child { margin-top: var(--space-6); }

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-5);
}

.section-title {
  margin: 0;
  font-size: var(--font-size-xl);
}

.section-subtitle {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-lg);
}

.section-hint {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.section-link {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover { text-decoration: underline; }

/* Page heading block used at the top of every content page. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-6);
}

.page-head-title {
  margin: 0;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, var(--font-size-2xl));
}

.page-head-lead {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  max-width: 60ch;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.625rem 1.15rem;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast), box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.btn:active { transform: translateY(1px); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

.btn-cta {
  background: var(--color-cta-ink);
  border-color: var(--color-cta-ink);
  color: #fff;
}
.btn-cta:hover {
  background: var(--color-cta-ink-hover);
  border-color: var(--color-cta-ink-hover);
  color: #fff;
}


.btn-outline {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn-outline:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: #B22222; border-color: #B22222; color: #fff; }
.btn-danger:focus-visible { outline-color: var(--color-danger); }

.btn-whatsapp {
  background: var(--color-whatsapp);
  border-color: var(--color-whatsapp);
  color: var(--color-ink-deep);
}
.btn-whatsapp:hover {
  background: var(--color-whatsapp-hover);
  border-color: var(--color-whatsapp-hover);
  color: var(--color-ink-deep);
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: var(--font-size-base);
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: var(--font-size-xs);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Square icon-only control. Always needs an aria-label. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--color-surface-alt);
  color: var(--color-primary);
}

.icon-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  stroke: currentColor;
  fill: none;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover { color: var(--color-primary-dark); }

/* ==========================================================================
   Badges & pills
   ========================================================================== */

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--color-surface-alt);
  color: var(--color-text-subtle);
}

.badge-active,
.pill-active,
.badge-new {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.badge-draft,
.pill-draft {
  background: var(--color-warning-tint);
  color: var(--color-warning-tint-ink);
}

.badge-sold,
.pill-sold,
.badge-discount {
  background: var(--color-danger-tint);
  color: var(--color-danger-tint-ink);
}

.badge-condition {
  background: var(--color-secondary-tint);
  color: var(--color-secondary-tint-ink);
}

.badge-featured {
  background: var(--color-cta-tint);
  color: var(--color-cta-tint-ink);
}

.pill-inactive {
  background: var(--color-surface-alt);
  color: var(--color-text-subtle);
}

.pill-whatsapp {
  background: var(--color-whatsapp-tint);
  color: var(--color-whatsapp-tint-ink);
}

/* Badges laid over a photo. The tint backgrounds above are already opaque, so
   this only adds separation from whatever is behind them — it must not set a
   background of its own or every overlay badge would lose its colour coding. */
.badge-overlay {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.price {
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.price-original {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 0.85em;
  text-decoration: line-through;
  margin-left: var(--space-2);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.form-group > label,
.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.form-control,
input[type="text"].form-control,
input[type="search"],
select,
textarea {
  font-family: inherit;
}

.form-control {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder { color: var(--color-text-muted); }

.form-control:hover:not(:disabled) { border-color: var(--color-text-muted); }

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.form-control:disabled {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1.05rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 6rem;
  line-height: 1.55;
}

/* Native controls tinted to the brand so checkboxes/radios stop looking
   like they belong to a different site than the buttons next to them. */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-primary);
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
}

.form-hint {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
}

.form-group-wide { grid-column: 1 / -1; }

/* A checkbox and its label on one line, vertically centred. */
.form-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}


.form-check-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-section-title {
  margin: 0;
  font-size: var(--font-size-lg);
}

.form-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
}

.errorlist {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--color-danger);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.errorlist li::before {
  content: "⚠ ";
}

/* A field wrapper turns red when Django rendered errors inside it. */
.form-group:has(.errorlist li) .form-control,
.form-control.is-invalid {
  border-color: var(--color-danger);
}

.form-group:has(.errorlist li) .form-control:focus {
  box-shadow: var(--focus-ring-danger);
}

/* ==========================================================================
   Alerts & messages
   ========================================================================== */

.messages {
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert::before {
  font-weight: 700;
  line-height: 1.4;
  flex-shrink: 0;
}

.alert-success {
  background: var(--color-primary-light);
  border-color: #BFDDC2;
  color: var(--color-primary-dark);
}
.alert-success::before { content: "✓"; }

.alert-error {
  background: var(--color-danger-tint);
  border-color: #F3C6C2;
  color: var(--color-danger-tint-ink);
}
.alert-error::before { content: "!"; }

.alert-warning {
  background: var(--color-warning-tint);
  border-color: #EEDCB0;
  color: var(--color-warning-tint-ink);
}
.alert-warning::before { content: "!"; }

.alert-info,
.alert-debug {
  background: var(--color-info-tint);
  border-color: #C7DDF2;
  color: var(--color-info-tint-ink);
}
.alert-info::before,
.alert-debug::before { content: "i"; }

.alert-dismiss {
  margin-left: auto;
  border: none;
  background: none;
  color: inherit;
  opacity: 0.6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
}

.alert-dismiss:hover { opacity: 1; }

/* Inline notice used inside a page (not a flash message). */
.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
}

.notice-title {
  margin: 0 0 var(--space-1);
  font-weight: 700;
  color: var(--color-text);
}

.notice-warning {
  background: var(--color-warning-tint);
  border-color: #EEDCB0;
  color: var(--color-warning-tint-ink);
}

.notice-warning .notice-title { color: var(--color-warning-tint-ink); }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-5);
}


.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: var(--space-5) var(--space-4);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table th {
  text-align: left;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--color-text-subtle);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--color-surface-sunken); }

.data-table-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-10) var(--space-5) !important;
}

.data-table-empty:hover { background: transparent; }

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: var(--space-3);
}

.empty-state-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.empty-state-hint {
  margin: 0;
  color: var(--color-text-subtle);
  max-width: 46ch;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.pagination-link:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.pagination-status {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  padding: 0 var(--space-3);
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: 0 0 var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

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

.breadcrumbs-current {
  color: var(--color-text);
  font-weight: 600;
}

.breadcrumbs-sep {
  color: var(--color-border-strong);
}

/* ==========================================================================
   Site header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.navbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: var(--container-width);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: var(--space-3) var(--container-pad);
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary-dark);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-brand:hover { color: var(--color-primary-dark); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--font-size-base);
  font-weight: 800;
}

/* On desktop the <nav> is just a flex child holding the link list; on mobile
   it becomes the slide-in drawer. (Deliberately not display:contents — that
   drops the nav landmark from the a11y tree in older browsers.) */
.navbar-nav {
  display: flex;
  align-items: center;
  min-width: 0;
}

.navbar-nav-head { display: none; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-links a {
  display: inline-block;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-sm);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.navbar-links a:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.navbar-links a.is-active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 700;
}

.navbar-search {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 26rem;
  margin-left: auto;
}

.navbar-search svg {
  position: absolute;
  left: 0.85rem;
  width: 1.05rem;
  height: 1.05rem;
  stroke: var(--color-text-muted);
  fill: none;
  pointer-events: none;
}

.navbar-search input[type="search"] {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 1rem 0.55rem 2.45rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.navbar-search input[type="search"]:focus {
  outline: none;
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.navbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: none;
  color: var(--color-text);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.navbar-toggle:hover { background: var(--color-surface-alt); }

.navbar-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  fill: none;
}


/* ---------- Dropdown menu (account, row actions) ---------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 12rem;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.dropdown-menu.is-open { display: flex; }

.dropdown-menu-header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-menu-header strong {
  display: block;
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.dropdown-menu form { margin: 0; }

.dropdown-menu-danger { color: var(--color-danger) !important; }
.dropdown-menu-danger:hover { background: var(--color-danger-tint) !important; }

.dropdown-divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--color-border-subtle);
}

/* ---------- Off-canvas drawer (mobile nav) ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--color-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.has-drawer-open { overflow: hidden; }

/* ==========================================================================
   Site footer
   ========================================================================== */

.footer {
  background: var(--color-surface-alt);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-16);
}

.footer-grid {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: var(--space-12) var(--container-pad) var(--space-8);
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: var(--space-8);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary-dark);
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
}

.footer-blurb {
  margin: var(--space-3) 0 0;
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
  max-width: 42ch;
}

.footer-col h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  color: var(--color-text-subtle);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.footer-links a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.footer-bottom {
  max-width: var(--container-width);
  margin: 0 auto;
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) var(--container-pad);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  text-align: center;
}

/* ==========================================================================
   Home page
   ========================================================================== */

/* ---------- Hero slider ---------- */

/* The whole top of the home page. Slides are uploaded from the dashboard
   (apps.core.models.HeroSlide), so nothing here may assume a particular
   image's colours — captions sit on their own scrim rather than trusting
   the artwork to be dark enough behind text.

   Without JavaScript the viewport is a snapping horizontal scroller and the
   arrows/dots stay hidden; main.js adds .is-enhanced, which hands control of
   the track to a transform. */

.hero-slider {
  position: relative;
  margin: 0 0 var(--space-10);
}

.hero-slider-viewport {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  background: var(--color-surface-alt);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hero-slider-viewport::-webkit-scrollbar { display: none; }

.hero-slider.is-enhanced .hero-slider-viewport {
  overflow: hidden;
  scroll-snap-type: none;
}

.hero-slider-track {
  display: flex;
}

.hero-slider.is-enhanced .hero-slider-track {
  transition: transform var(--transition-slide);
  will-change: transform;
}

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 21 / 9;
  min-height: 13rem;
  scroll-snap-align: start;
}

.hero-slide-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-slide-caption {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: clamp(1.25rem, 4vw, 2.75rem);
  /* Leaves room for the dots, which float over the same corner. */
  padding-bottom: clamp(2.9rem, 6vw, 3.9rem);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.74) 0%,
    rgba(0, 0, 0, 0.42) 45%,
    rgba(0, 0, 0, 0) 100%
  );
  color: #fff;
  text-align: left;
  pointer-events: none;
}

/* Only the button inside the scrim is interactive — the gradient itself must
   not swallow a swipe aimed at the slider. */
.hero-slide-caption .btn { pointer-events: auto; }

.hero-slide-heading {
  margin: 0;
  max-width: 22ch;
  color: #fff;
  font-size: clamp(1.5rem, 0.9rem + 2.4vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.hero-slide-sub {
  margin: 0;
  max-width: 52ch;
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-lg);
  line-height: 1.45;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.hero-slide-overlay-link {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.hero-slide-overlay-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--color-cta);
  border-radius: var(--radius-xl);
}

.hero-slider-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.hero-slider-arrow svg {
  width: 1.2rem;
  height: 1.2rem;
  stroke: currentColor;
  fill: none;
}

.hero-slider-arrow:hover { background: var(--color-surface-alt); }

/* The controls ship with the `hidden` attribute and main.js clears it. A
   `display` of our own outranks the UA stylesheet's [hidden] rule, so both
   controls have to opt back out explicitly or they'd show without JS. */
.hero-slider-arrow[hidden],
.hero-slider-dots[hidden] { display: none; }

.hero-slider-arrow-prev { left: var(--space-4); }
.hero-slider-arrow-next { right: var(--space-4); }

.hero-slider-dots {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: var(--space-4);
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.hero-slider-dot {
  width: 0.55rem;
  height: 0.55rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: width var(--transition-base), background var(--transition-base);
}

.hero-slider-dot[aria-current="true"] {
  width: 1.6rem;
  background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .hero-slider.is-enhanced .hero-slider-track { transition: none; }
  .hero-slider-dot { transition: none; }
}

/* ---------- Horizontal scroll row ---------- */

.scroll-row-wrapper { position: relative; }

.scroll-row {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.scroll-row-item {
  flex: 0 0 min(72vw, 230px);
  scroll-snap-align: start;
}

.scroll-row-item .product-card { height: 100%; }

.scroll-row-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 5;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.scroll-row-arrow svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke: currentColor;
  fill: none;
}

.scroll-row-arrow:hover { background: var(--color-surface-alt); }

/* Same trap as the slider arrows: the `display` above outranks the UA
   stylesheet's [hidden] rule, so it has to opt back out explicitly or an
   arrow main.js hid would still paint. */
.scroll-row-arrow[hidden] { display: none; }

/* Kept in place rather than hidden at the ends — an arrow that vanishes as
   you reach the edge makes the other one jump. */
.scroll-row-arrow:disabled {
  opacity: 0.35;
  box-shadow: var(--shadow-xs);
  cursor: default;
}

.scroll-row-arrow:disabled:hover { background: var(--color-surface); }

.scroll-row-arrow-prev { left: -0.85rem; }
.scroll-row-arrow-next { right: -0.85rem; }

/* ==========================================================================
   Category cards
   ========================================================================== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: var(--space-4);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.category-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--color-text);
}

.category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  font-size: 1.5rem;
  line-height: 1;
}

.category-name {
  font-weight: 700;
  font-size: var(--font-size-sm);
}

.category-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ==========================================================================
   Product card
   ========================================================================== */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.product-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.product-card:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.product-card-media { position: relative; }

.product-card-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-base);
}

.product-card:hover .product-card-image img { transform: scale(1.03); }

.product-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  color: var(--color-border-strong);
  font-size: 1.75rem;
}

.product-card-tags {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  right: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  pointer-events: none;
  z-index: 2;
}

.product-card-wishlist-form {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  z-index: 3;
  margin: 0;
}

.product-card-wishlist-btn {
  width: 2.25rem;
  height: 2.25rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-subtle);
}

.product-card-wishlist-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.product-card-wishlist-btn:hover {
  background: #fff;
  color: var(--color-danger);
}

.product-card-wishlist-btn.is-active { color: var(--color-danger); }
.product-card-wishlist-btn.is-active svg { fill: currentColor; }

.product-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  flex: 1;
}

.product-card-category {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.product-card-title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.product-card-title a {
  color: var(--color-text);
  text-decoration: none;
}

.product-card-title a:hover { color: var(--color-primary-dark); }

.product-card-price {
  margin: auto 0 0;
  padding-top: var(--space-2);
  font-size: var(--font-size-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Sold cards are dimmed so they read as unavailable at a glance. */
.product-card.is-sold .product-card-image img { opacity: 0.55; }
.product-card.is-sold .product-card-price .price { color: var(--color-text-muted); }

/* ==========================================================================
   Listing page: toolbar, filters, results
   ========================================================================== */

.listing-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

.listing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.listing-count {
  margin: 0;
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
}

.listing-count strong { color: var(--color-text); }

.listing-sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.listing-sort .form-control { width: auto; }

.filter-toggle {
  display: none;
}

.filter-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.filter-group-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--color-text-subtle);
}

.filter-list,
.filter-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.filter-list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}

.filter-list-link:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.filter-list-link.is-active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 700;
}

.filter-checklist label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  padding: 0.3rem 0;
  cursor: pointer;
}

.filter-price-range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-price-range .form-control { width: 0; flex: 1; }

.filter-price-range span { color: var(--color-text-muted); }

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-clear {
  text-align: center;
  color: var(--color-text-muted);
  text-decoration: underline;
  font-size: var(--font-size-sm);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-decoration: none;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.filter-chip span[aria-hidden] { opacity: 0.7; font-size: 0.9em; }

.filter-chip-clear {
  background: none;
  color: var(--color-text-muted);
  text-decoration: underline;
  font-weight: 500;
}

.filter-chip-clear:hover { color: var(--color-text); }

/* ==========================================================================
   Product detail
   ========================================================================== */

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.product-gallery {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
}

.product-gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.product-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border-strong);
  font-size: 3rem;
}

.product-gallery-main img {
  transition: transform var(--transition-base);
  cursor: zoom-in;
}

.product-gallery-main.is-zoomed img { transform: scale(2); }

.product-gallery-thumbs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-1);
}

.product-gallery-thumb {
  width: 4.5rem;
  height: 4.5rem;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-alt);
  cursor: pointer;
}

.product-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-gallery-thumb:hover { border-color: var(--color-text-muted); }
.product-gallery-thumb.is-active { border-color: var(--color-primary); }

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  padding: var(--space-6);
}

.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  display: block;
}

.image-lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* ---------- Info column ---------- */

.product-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.product-title {
  margin: 0;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, var(--font-size-2xl));
}

.product-sku {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
}

.product-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
}

.product-price {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2rem);
  color: var(--color-primary-dark);
}

.product-saving {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-danger-tint-ink);
}

.product-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.product-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* The enquiry box is the page's single most important element, so it gets a
   visible container rather than sitting loose in the text flow. */
.enquiry-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.enquiry-panel-title {
  margin: 0;
  font-size: var(--font-size-base);
}

.enquiry-panel-hint {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
}

.enquiry-panel form { margin: 0; }

.enquiry-panel-sold {
  background: var(--color-surface-alt);
  border-style: dashed;
  box-shadow: none;
  text-align: center;
}


.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.specs-table tr { border-bottom: 1px solid var(--color-border-subtle); }
.specs-table tr:last-child { border-bottom: none; }

.specs-table th,
.specs-table td {
  text-align: left;
  padding: var(--space-3) 0;
  font-weight: 400;
  vertical-align: top;
}

.specs-table th {
  color: var(--color-text-muted);
  width: 40%;
  padding-right: var(--space-4);
  font-weight: 500;
}

.product-description {
  color: var(--color-text-subtle);
  white-space: pre-line;
  max-width: 72ch;
}

/* Collapsible section used for specs/description on mobile and the FAQ. */
.accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.accordion + .accordion { margin-top: var(--space-2); }

.accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.accordion > summary::-webkit-details-marker { display: none; }

.accordion > summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1;
}

.accordion[open] > summary::after { content: "–"; }

.accordion > summary:hover { background: var(--color-surface-sunken); }

.accordion-body {
  padding: 0 var(--space-4) var(--space-4);
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
}

/* ==========================================================================
   Auth pages
   ========================================================================== */

.auth-layout {
  display: flex;
  justify-content: center;
  padding: var(--space-8) 0 var(--space-12);
}

.auth-card {
  width: 100%;
  max-width: 27rem;
  padding: var(--space-8);
}

.auth-card h1 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-2);
}

.auth-lead {
  margin: 0 0 var(--space-6);
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

.auth-step.is-current {
  background: var(--color-primary);
  color: #fff;
}

.auth-step-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
}

.auth-switch {
  margin: var(--space-5) 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}

.auth-switch + .auth-switch {
  margin-top: var(--space-2);
  padding-top: 0;
  border-top: none;
}

/* The OTP field is one big monospaced box — it's the only thing on the page
   and it should look like the code slot it is. */
.otp-input.form-control {
  font-family: var(--font-family-mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-align: center;
  padding: var(--space-4) var(--space-3);
}

.settings-card {
  max-width: 44rem;
  padding: var(--space-8);
}

/* ==========================================================================
   Content pages (About, FAQ, …)
   ========================================================================== */

.page-content {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.page-content-body {
  color: var(--color-text-subtle);
  font-size: var(--font-size-base);
  line-height: 1.7;
}

.page-content-body h2 { margin-top: var(--space-8); }

.page-info-section { margin-top: var(--space-10); }

.trust-details-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-4);
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
}

.trust-details-list li {
  padding-left: var(--space-6);
  position: relative;
}

.trust-details-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--color-primary);
  font-weight: 700;
}

.trust-details-list strong { color: var(--color-text); }

.faq-list {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-answer p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Dashboard shell
   ========================================================================== */

.dashboard-body {
  margin: 0;
  background: var(--color-surface-alt);
}

.dashboard-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  width: 16rem;
  height: 100vh;
  flex-shrink: 0;
  background: var(--color-primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  overflow-y: auto;
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: #fff;
  text-decoration: none;
  margin-bottom: var(--space-6);
  padding: 0 var(--space-2);
}

.dashboard-brand:hover { color: #fff; }

.dashboard-brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius-sm);
  background: var(--color-cta);
  color: var(--color-ink-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.dashboard-brand-text {
  font-weight: 700;
  font-size: var(--font-size-base);
  line-height: 1.2;
  min-width: 0;
}

.dashboard-brand-text span {
  display: block;
  font-weight: 400;
  font-size: var(--font-size-xs);
  opacity: 0.7;
}

.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.dashboard-nav-heading {
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.45);
}

.dashboard-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.6rem var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.dashboard-nav-link svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.dashboard-nav-link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.dashboard-nav-link.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--color-cta);
}

.dashboard-nav-link:focus-visible {
  outline-color: #fff;
}


.dashboard-sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.dashboard-user-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.dashboard-user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.dashboard-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.dashboard-user-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-user-role {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.6);
}

/* Logout / view-site sit here; previously the dashboard had no sign-out at
   all and this whole block was display:none below 800px. */
.dashboard-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dashboard-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 0.5rem var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: var(--font-size-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.dashboard-sidebar-link svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.dashboard-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.dashboard-sidebar-link:focus-visible { outline-color: #fff; }

.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-6);
}

.dashboard-topbar-toggle { display: none; }

.dashboard-topbar-search {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 24rem;
  display: flex;
  align-items: center;
}

.dashboard-topbar-search svg {
  position: absolute;
  left: 0.85rem;
  width: 1rem;
  height: 1rem;
  stroke: var(--color-text-muted);
  fill: none;
  pointer-events: none;
}

.dashboard-topbar-search input {
  width: 100%;
  padding: 0.55rem 1rem 0.55rem 2.35rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  font-family: inherit;
  font-size: var(--font-size-sm);
}

.dashboard-topbar-search input:focus {
  outline: none;
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.dashboard-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.dashboard-content {
  padding: var(--space-6);
  flex: 1;
}

.dashboard-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.dashboard-page-title {
  margin: 0;
  font-size: var(--font-size-xl);
}

.dashboard-page-subtitle {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* ---------- Stat cards ---------- */

.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.stat-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
}

.stat-card-body { min-width: 0; }

.stat-card-label {
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.stat-card-value {
  margin: var(--space-2) 0 0;
  font-size: var(--font-size-2xl);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.stat-card-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.stat-card-chip {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
}

.stat-card-chip-up {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.stat-card-chip-down {
  background: var(--color-danger-tint);
  color: var(--color-danger-tint-ink);
}

/* ---------- Chart + quick actions ---------- */

.dashboard-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  align-items: stretch;
}

.dashboard-chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-legend i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: var(--radius-pill);
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-whatsapp { stroke: var(--color-whatsapp); }
.chart-line-call { stroke: var(--color-primary); }

.chart-grid-line {
  stroke: var(--color-border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.chart-axis span {
  flex: 1;
  text-align: center;
}

.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 11rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  background: var(--color-surface-sunken);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
}

.quick-actions-panel {
  background: var(--color-primary-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: #fff;
}

.quick-actions-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-base);
  color: #fff;
}

.quick-action-btn {
  justify-content: flex-start;
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
  color: #fff;
  text-align: left;
}

.quick-action-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: transparent;
  color: #fff;
}

.quick-action-btn:focus-visible { outline-color: #fff; }

/* ---------- Dashboard tables ---------- */

.dashboard-table-card {
  padding: 0;
  overflow: hidden;
}

.dashboard-table-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.dashboard-table-header h2 { margin: 0; font-size: var(--font-size-base); }

.dashboard-table-view-all {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.dashboard-table-view-all:hover { text-decoration: underline; }

.dashboard-table-thumb-col,
.dashboard-table-thumb { width: 3.5rem; }

.dashboard-table-thumb img,
.dashboard-table-thumb-placeholder {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-surface-alt);
  display: block;
}

.dashboard-table-actions-col,
.dashboard-table-actions {
  width: 3rem;
  text-align: right;
}

.dashboard-table-check-col { width: 2.75rem; }

.dashboard-table-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 12rem;
}

.dashboard-table-title a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}

.dashboard-table-title a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.dashboard-table-title small {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
}

/* A slide's subheading is prose, not an identifier like the SKU the mono
   face above is meant for. */
.dashboard-table-title .slide-subtitle { font-family: var(--font-family-base); }

.slide-thumb-col { width: 5.5rem; }

.slide-thumb {
  display: block;
  width: 4.5rem;
  height: 2.55rem;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-surface-alt);
}

.slide-preview {
  display: block;
  width: 100%;
  max-height: 18rem;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  object-fit: cover;
}

/* ---------- Dashboard filters & bulk actions ---------- */

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  width: fit-content;
  max-width: 100%;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
}

.status-tab:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.status-tab.is-active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.status-tab-count {
  font-size: var(--font-size-xs);
  font-weight: 700;
  opacity: 0.7;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.filter-bar .form-control { width: auto; min-width: 10rem; }
.filter-bar .filter-bar-search { flex: 1 1 16rem; min-width: 0; }

.bulk-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.bulk-actions-bar > span {
  font-weight: 700;
  color: var(--color-primary-dark);
  font-size: var(--font-size-sm);
}

.bulk-actions-bar .form-control { width: auto; }

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

.dashboard-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 60rem;
}

.dashboard-form .card { padding: var(--space-6); }

/* Save/cancel stay reachable without scrolling to the bottom of a long form. */
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-top: calc(var(--space-2) * -1);
  background: linear-gradient(to top, var(--color-surface-alt) 70%, rgba(245, 245, 245, 0));
}

.form-actions-sticky .form-actions-note {
  margin-right: auto;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ---------- Photo manager ---------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: var(--space-4);
}

.image-grid:empty { display: none; }

.image-tile {
  position: relative;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
}

.image-tile.is-dragging { opacity: 0.4; }

.image-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.image-tile-primary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  padding: var(--space-2);
  color: var(--color-text-subtle);
  cursor: pointer;
  background: var(--color-surface);
}

.image-tile-remove {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  line-height: 1;
  cursor: pointer;
}

.image-tile-remove:hover { background: var(--color-danger); }

.image-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  text-align: center;
}

/* ---------- Spec formset ---------- */

#spec-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: end;
}

.spec-row.is-removed { display: none; }

.spec-delete-hidden { display: none; }

.spec-remove-btn {
  background: var(--color-surface-alt);
  color: var(--color-danger);
  border: 1px solid var(--color-border);
  width: 2.4rem;
  height: 2.4rem;
}

.spec-remove-btn:hover {
  background: var(--color-danger-tint);
  color: var(--color-danger);
}

/* ---------- Category tree ---------- */

.category-tree-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.category-tree-branch { color: var(--color-border-strong); }

/* ---------- Enquiry contact column ---------- */

.enquiry-contact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.enquiry-contact-actions {
  display: inline-flex;
  gap: var(--space-3);
  white-space: nowrap;
  font-size: var(--font-size-xs);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .dashboard-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .listing-layout { grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); }
  .product-detail { grid-template-columns: minmax(0, 1fr); }
  .product-gallery { position: static; }
}

@media (max-width: 900px) {
  .hero-slide { aspect-ratio: 16 / 9; }

  .navbar-nav {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: min(20rem, 84vw);
    padding: var(--space-3) var(--space-4) var(--space-6);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .navbar-nav.is-open { transform: translateX(0); }

  .navbar-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: 0 calc(var(--space-4) * -1) var(--space-4);
    padding: 0 var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    min-height: 2.75rem;
  }

  .navbar-links {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }

  .navbar-links a {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
  }

  .navbar-toggle { display: inline-flex; }

  .navbar-search { max-width: none; }


  .listing-layout { grid-template-columns: minmax(0, 1fr); }

  .filter-toggle {
    display: flex;
    width: 100%;
    margin-bottom: var(--space-4);
  }

  /* Filters become a bottom sheet on small screens: a left-rail sidebar
     squeezed into a narrow viewport pushed results below the fold. */
  .filter-sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 100;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(101%);
    transition: transform var(--transition-base);
    padding-bottom: var(--space-8);
  }

  .filter-sidebar.is-open { transform: translateY(0); }

  .filter-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
  }

  .filter-actions {
    position: sticky;
    bottom: calc(var(--space-8) * -1);
    padding: var(--space-3) 0;
    background: var(--color-surface);
  }
}

@media (min-width: 901px) {
  .filter-sheet-head { display: none; }
}

@media (max-width: 900px) {
  .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .dashboard-sidebar.is-open { transform: translateX(0); }

  .dashboard-topbar-toggle { display: inline-flex; }

  .dashboard-topbar { padding: var(--space-3) var(--space-4); }

  .dashboard-content { padding: var(--space-4); }
}

@media (max-width: 768px) {
  /* iOS Safari zooms the whole page in whenever a focused field is under
     16px, which then leaves the layout scrolled sideways. Every text control
     goes up to 16px at touch sizes to prevent it. */
  .form-control,
  input[type="search"],
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  select,
  textarea,
  .navbar-search input[type="search"],
  .dashboard-topbar-search input {
    font-size: var(--font-size-base);
  }

  .scroll-row-arrow { display: none; }

  /* A 21:9 band is only a few centimetres tall on a phone, which crops the
     subject out of most banners — go taller and let the sides go instead. */
  .hero-slide { aspect-ratio: 4 / 3; }

  /* Arrows would sit on top of the artwork at this width; swiping the track
     is the natural gesture here anyway, and the dots still show position. */
  .hero-slider-arrow { display: none; }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-group-wide { grid-column: auto; }

  .spec-row { grid-template-columns: minmax(0, 1fr); }

  .spec-remove-btn { width: 100%; }

  .dashboard-topbar-search { max-width: none; }

  .listing-sort { margin-left: 0; width: 100%; }
  .listing-sort .form-control { flex: 1; }
}

@media (max-width: 640px) {
  .navbar {
    flex-wrap: wrap;
    row-gap: var(--space-3);
    padding: var(--space-3) var(--container-pad);
  }

  .navbar-brand { margin-right: auto; min-width: 0; }

  .navbar-search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    margin-left: 0;
  }

  .navbar-search input[type="search"] {
    /* 16px keeps iOS Safari from zooming the page in on focus. */
    font-size: var(--font-size-base);
  }


  .footer-grid { grid-template-columns: 1fr; gap: var(--space-6); }

  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 155px), 1fr)); gap: var(--space-3); }

  .product-card-body { padding: var(--space-3); }
  .product-card-price { font-size: var(--font-size-base); }


  .stat-card { padding: var(--space-4); }
  .stat-card-value { font-size: var(--font-size-xl); }

  .auth-card,
  .settings-card { padding: var(--space-5); }

  .card { padding: var(--space-4); }
  .dashboard-form .card { padding: var(--space-4); }

  .data-table th,
  .data-table td { padding: var(--space-3); }

  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
}
