/* ==========================================================================
   BEST TOP ECOMMERCE — Storefront & Admin Design System
   Single stylesheet for the storefront and the admin area.
   Plain CSS only. No frameworks, no CDN, no icon fonts.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colour — neutral canvas + one confident teal accent + sale accent */
  --canvas: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --surface-sunken: #f1f2f4;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;

  --primary: #0f766e;
  --primary-600: #0d6b63;
  --primary-700: #115e59;
  --primary-800: #134e4a;
  --primary-soft: #ccfbf1;
  --primary-tint: #f0fdfa;

  --accent: #e11d48;
  --accent-600: #be123c;
  --accent-soft: #ffe4e6;

  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;

  --star: #f59e0b;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shadows — soft and restrained */
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow: 0 6px 18px -6px rgba(17, 24, 39, 0.12), 0 2px 6px rgba(17, 24, 39, 0.05);
  --shadow-lg: 0 24px 48px -16px rgba(17, 24, 39, 0.22), 0 8px 16px -8px rgba(17, 24, 39, 0.12);
  --ring: 0 0 0 3px rgba(15, 118, 110, 0.28);
  --ring-accent: 0 0 0 3px rgba(225, 29, 72, 0.25);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Layout */
  --container: 1200px;
  --header-h: 72px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 140ms var(--ease);
  --t: 200ms var(--ease);
  --t-slow: 320ms var(--ease);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-weight: 700;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-4); }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast);
}

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

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.2em; }

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-800);
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.page-hero {
  background:
    radial-gradient(120% 140% at 0% 0%, var(--primary-tint) 0%, transparent 55%),
    linear-gradient(180deg, var(--surface) 0%, var(--canvas) 100%);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-12) 0;
  text-align: center;
}

.page-hero h1 {
  margin-bottom: var(--sp-2);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
}

.page-hero p {
  color: var(--muted);
  max-width: 60ch;
  margin-inline: auto;
  margin-bottom: 0;
}

.section {
  padding: var(--sp-16) 0;
}

.section-sm { padding: var(--sp-10) 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  flex-wrap: wrap;
}

.section-head h2 {
  margin-bottom: var(--sp-1);
  font-size: clamp(1.375rem, 3vw, 2rem);
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.section-head .section-link {
  font-weight: 600;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  margin: 0 0 var(--sp-6);
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--muted-2);
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-5);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-4);
  color: var(--muted-2);
}

.empty-state h3 { color: var(--ink); margin-bottom: var(--sp-2); }
.empty-state p { margin-bottom: var(--sp-5); max-width: 44ch; margin-inline: auto; }

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

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-tint);
}

.pagination .active,
.pagination [aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination .disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Site header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar {
  background: var(--ink);
  color: #e5e7eb;
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  min-height: 38px;
  text-align: center;
}

.topbar strong { color: #fff; font-weight: 600; }
.topbar a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.topbar svg { width: 14px; height: 14px; flex: none; }

.header-main {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: var(--sp-6);
  min-height: var(--header-h);
  padding-block: var(--sp-3);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--ink);
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo img,
.logo svg {
  height: 32px;
  width: auto;
  display: block;
}

.logo:hover { color: var(--ink); }

.search-form {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 4px 4px 4px var(--sp-4);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  max-width: 620px;
  width: 100%;
  margin-inline: auto;
}

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

.search-form svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: none;
}

.search-form input[type="search"],
.search-form input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: var(--fs-sm);
  outline: none;
}

.search-form input::placeholder { color: var(--muted-2); }

.search-form button[type="submit"] {
  flex: none;
  border: 0;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--t-fast);
}

.search-form button[type="submit"]:hover { background: var(--primary-700); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.icon-btn svg { width: 21px; height: 21px; }

.icon-btn:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.icon-btn .icon-label {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Main navigation */
.main-nav {
  border-top: 1px solid var(--line);
}

.main-nav .container {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 48px;
  flex-wrap: wrap;
}

.main-nav a,
.main-nav .nav-link,
.main-nav .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.main-nav a:hover,
.main-nav .nav-link:hover,
.main-nav .dropdown-toggle:hover,
.main-nav a.active {
  background: var(--primary-tint);
  color: var(--primary-700);
}

.main-nav .dropdown-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform var(--t-fast);
}

.nav-spacer { flex: 1; }

.nav-toggle { display: none; }

/* Dropdown */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
  z-index: 300;
}

.dropdown.open > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown.open > .dropdown-toggle svg { transform: rotate(180deg); }

.dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  width: 100%;
}

.dropdown-menu a:hover {
  background: var(--primary-tint);
  color: var(--primary-700);
}

.dropdown-menu .count {
  color: var(--muted-2);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}

.dropdown-menu .dropdown-head {
  padding: 8px 12px 6px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.dropdown-menu .dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: var(--sp-2) 0;
}

/* Flash messages live just under the header */
.flash-stack {
  margin-top: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast),
    border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.btn svg { width: 18px; height: 18px; flex: none; }

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

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

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

.btn-primary:focus-visible { outline: 2px solid var(--primary-800); outline-offset: 2px; }

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

.btn-secondary:hover { background: #1f2937; border-color: #1f2937; color: #fff; }

.btn-outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-700);
  background: var(--primary-tint);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-sm { padding: 7px 13px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-sm svg { width: 15px; height: 15px; }

.btn-lg { padding: 15px 30px; font-size: var(--fs-md); border-radius: var(--radius-lg); }

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

.btn-link {
  background: none;
  border: 0;
  color: var(--primary);
  padding: 0;
  font-weight: 600;
  cursor: pointer;
}

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

/* --------------------------------------------------------------------------
   6. Cards, grids & products
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body { padding: var(--sp-6); }

.card-head {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.card-head h3 { margin: 0; font-size: var(--fs-lg); }

.grid {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

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

.product-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-sunken);
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}

.product-card:hover .product-media img { transform: scale(1.05); }

.product-media .badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 2;
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  flex: 1;
}

.product-title {
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.product-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-wrap: wrap;
}

.product-meta a { color: var(--muted); }
.product-meta a:hover { color: var(--primary); }

.product-price {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.price-now {
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.price-now.is-sale { color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  white-space: nowrap;
}

.badge-sale { background: var(--accent); color: #fff; }
.badge-new { background: var(--primary); color: #fff; }
.badge-out { background: var(--ink); color: #fff; }

.rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stars {
  position: relative;
  display: inline-block;
  font-size: 0;
  line-height: 1;
  color: var(--line-strong);
}

.stars::before {
  content: "★★★★★";
  font-size: 14px;
  letter-spacing: 1px;
}

.stars-fill {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--star);
}

.stars-fill::before {
  content: "★★★★★";
  font-size: 14px;
  letter-spacing: 1px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary-700);
  background: var(--primary-tint);
}

.chip.active,
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* --------------------------------------------------------------------------
   7. Forms
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--sp-5);
}

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

.form-row > .form-group { margin-bottom: 0; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

.form-label .req { color: var(--accent); }

.form-control {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.4;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}

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

.form-control:hover { border-color: var(--muted-2); }

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

.form-control:disabled,
.form-control[readonly] {
  background: var(--surface-sunken);
  color: var(--muted);
  cursor: not-allowed;
}

textarea.form-control { min-height: 130px; resize: vertical; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-help {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.form-error {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--error);
  font-weight: 500;
}

.form-control.is-invalid {
  border-color: var(--error);
}

.form-control.is-invalid:focus { box-shadow: var(--ring-accent); }

.checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  flex: none;
  cursor: pointer;
}

/* Quantity stepper */
.qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  width: max-content;
}

.qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 42px;
  border: 0;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.qty-btn:hover { background: var(--surface-sunken); color: var(--ink); }

.qty-btn:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  background: var(--surface-2);
}

.qty-input {
  width: 56px;
  border: 0;
  border-inline: 1px solid var(--line);
  text-align: center;
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input:focus { outline: none; background: var(--primary-tint); }

/* --------------------------------------------------------------------------
   8. Feedback — alerts
   -------------------------------------------------------------------------- */
.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-xs);
  transition: opacity var(--t-slow), transform var(--t-slow), margin var(--t-slow);
}

.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert p { margin: 0; }
.alert a { font-weight: 600; text-decoration: underline; }

.alert-title {
  display: block;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.alert-success { border-left-color: var(--success); background: var(--success-soft); color: #065f46; }
.alert-success svg { color: var(--success); }

.alert-error { border-left-color: var(--error); background: var(--error-soft); color: #991b1b; }
.alert-error svg { color: var(--error); }

.alert-info { border-left-color: var(--info); background: var(--info-soft); color: #1e40af; }
.alert-info svg { color: var(--info); }

.alert-warning { border-left-color: var(--warning); background: var(--warning-soft); color: #92400e; }
.alert-warning svg { color: var(--warning); }

.alert-close,
.alert [data-dismiss] {
  margin-left: auto;
  flex: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-size: var(--fs-lg);
}

.alert-close:hover,
.alert [data-dismiss]:hover { opacity: 1; }

.alert.is-dismissed {
  opacity: 0;
  transform: translateY(-6px);
  margin-bottom: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.table .num,
.table th.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.table-actions form { display: inline-flex; margin: 0; }

/* --------------------------------------------------------------------------
   10. Commerce
   -------------------------------------------------------------------------- */
.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--sp-8);
  align-items: start;
}

.cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-4);
}

.cart-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.cart-row .cart-info { min-width: 0; }
.cart-row .cart-info a { font-weight: 600; color: var(--ink); }
.cart-row .cart-info a:hover { color: var(--primary); }
.cart-row .cart-info .product-meta { margin-top: 4px; }

.cart-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  flex: none;
}

.cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-row .cart-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cart-row .cart-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.cart-row .cart-remove:hover { color: var(--accent); background: var(--accent-soft); }
.cart-row .cart-remove svg { width: 18px; height: 18px; }

.summary-card {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-6);
}

.summary-card h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-4);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.summary-row span:last-child { color: var(--ink); font-weight: 600; }

.summary-row.is-free span:last-child { color: var(--success); }

.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.summary-total span:last-child { font-size: var(--fs-xl); }

.summary-card .btn-block { margin-top: var(--sp-5); }

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

.step-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-5);
  color: var(--ink);
}

.step-title .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  flex: none;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}

.order-card + .order-card { margin-top: var(--sp-4); }

.order-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.order-status .order-number {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-paid { background: var(--success-soft); color: #065f46; }
.status-pending { background: var(--warning-soft); color: #92400e; }
.status-failed { background: var(--error-soft); color: #991b1b; }

/* Product detail */
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-12);
  align-items: start;
}

.gallery {
  display: grid;
  gap: var(--sp-4);
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
}

.gallery-main {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-sunken);
}

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

.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.gallery-thumbs button,
.gallery-thumbs img {
  width: 76px;
  height: 76px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-sunken);
  cursor: pointer;
  object-fit: cover;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.gallery-thumbs button:hover,
.gallery-thumbs img:hover { border-color: var(--muted-2); transform: translateY(-2px); }

.gallery-thumbs button.active,
.gallery-thumbs img.active,
.gallery-thumbs [aria-selected="true"] {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.product-detail .detail-price {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  font-variant-numeric: tabular-nums;
}

.product-detail .detail-price .price-now { font-size: var(--fs-2xl); }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.spec-table th,
.spec-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }

.spec-table th {
  width: 38%;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}

.spec-table td { color: var(--ink-soft); }

.tab-nav {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
}

.tab-nav button,
.tab-nav a {
  position: relative;
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.tab-nav button:hover,
.tab-nav a:hover { color: var(--ink); }

.tab-nav button.active,
.tab-nav a.active,
.tab-nav [aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
  animation: fade-in var(--t) both;
}

.tab-panel.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   11. Auth
   -------------------------------------------------------------------------- */
.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-10);
  align-items: center;
  max-width: 1000px;
  margin-inline: auto;
  padding: var(--sp-16) 0;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-10);
  width: 100%;
  max-width: 460px;
  justify-self: center;
}

.auth-title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}

.auth-card .auth-sub {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-6);
}

.auth-aside {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.18) 0%, transparent 55%),
    linear-gradient(160deg, var(--primary-700) 0%, var(--primary-800) 60%, #0b3d3a 100%);
  color: #fff;
  padding: var(--sp-12) var(--sp-10);
  box-shadow: var(--shadow-lg);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-aside h2 {
  color: #fff;
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-4);
}

.auth-aside p { color: rgba(255, 255, 255, 0.82); }

.auth-aside ul {
  list-style: none;
  padding: 0;
  margin: var(--sp-6) 0 0;
  display: grid;
  gap: var(--sp-3);
}

.auth-aside li {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--fs-sm);
}

.auth-aside svg { width: 20px; height: 20px; flex: none; color: #5eead4; }

.auth-alt {
  margin-top: var(--sp-5);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   12. Admin
   -------------------------------------------------------------------------- */
.admin-body {
  margin: 0;
  background: var(--canvas);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--ink);
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 150;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3) var(--sp-6);
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}

.admin-brand img,
.admin-brand svg { height: 30px; width: auto; }
.admin-brand .brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5eead4;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px var(--sp-3);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}

.admin-nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }

.admin-nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.admin-nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(15, 118, 110, 0.9);
}

.admin-nav-item.active svg { opacity: 1; }

.admin-nav-group {
  margin: var(--sp-5) 0 var(--sp-2);
  padding: 0 var(--sp-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7280;
}

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

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-8);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar h1 {
  margin: 0;
  font-size: var(--fs-xl);
}

.admin-topbar .admin-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.admin-content {
  padding: var(--sp-8);
  flex: 1;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

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

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-xs);
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 150px; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: rgba(17, 24, 39, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal.open,
.modal.is-open,
.modal[aria-hidden="false"] { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - var(--sp-10));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--t) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line);
}

.modal-header h3 { margin: 0; font-size: var(--fs-lg); }

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* --------------------------------------------------------------------------
   13. Site footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: #9ca3af;
  margin-top: var(--sp-20);
  font-size: var(--fs-sm);
}

.site-footer .container { padding-block: var(--sp-16) var(--sp-8); }

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: var(--sp-10);
  padding-bottom: var(--sp-10);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-col h4 {
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-4);
}

.footer-col p { color: #9ca3af; line-height: 1.7; }

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.footer-col a {
  color: #9ca3af;
  transition: color var(--t-fast);
}

.footer-col a:hover { color: #fff; }

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.footer-brand img,
.footer-brand svg { height: 30px; width: auto; }

.footer-contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-3);
}

.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  color: #9ca3af;
}

.footer-contact svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 3px;
  color: #5eead4;
}

.footer-contact a { color: #9ca3af; }
.footer-contact a:hover { color: #fff; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  padding-top: var(--sp-6);
  font-size: var(--fs-xs);
  color: #6b7280;
}

.payment-badges {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.payment-badges .pay-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 9px;
  background: #fff;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
}

.payment-badges svg {
  height: 18px;
  width: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   14. Utilities
   -------------------------------------------------------------------------- */
.text-muted { color: var(--muted) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-2) !important; }
.mt-2 { margin-top: var(--sp-4) !important; }
.mt-3 { margin-top: var(--sp-6) !important; }
.mt-4 { margin-top: var(--sp-8) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--sp-2) !important; }
.mb-2 { margin-bottom: var(--sp-4) !important; }
.mb-3 { margin-bottom: var(--sp-6) !important; }
.mb-4 { margin-bottom: var(--sp-8) !important; }

.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }
.flex-between {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: var(--sp-4);
}
.flex-wrap { flex-wrap: wrap !important; }
.align-center { align-items: center !important; }

.gap-1 { gap: var(--sp-2) !important; }
.gap-2 { gap: var(--sp-4) !important; }
.gap-3 { gap: var(--sp-6) !important; }

.w-100 { width: 100% !important; }

.hidden { display: none !important; }

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   15. Responsive — 1024 / 768 / 480
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root { --fs-3xl: 2.25rem; --fs-2xl: 1.75rem; }

  .grid,
  .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

  .summary-card { position: static; }

  .product-detail {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-8);
  }

  .gallery { position: static; }

  .auth-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-8);
    padding: var(--sp-10) 0;
  }

  .auth-aside { min-height: auto; order: -1; padding: var(--sp-8); }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-8);
  }

  .admin-body { grid-template-columns: 220px minmax(0, 1fr); }
  .admin-content { padding: var(--sp-6); }
}

@media (max-width: 768px) {
  :root { --fs-3xl: 1.875rem; --fs-2xl: 1.5rem; --header-h: 64px; }

  .container { padding-inline: var(--sp-4); }

  .section { padding: var(--sp-12) 0; }
  .page-hero { padding: var(--sp-10) 0; }

  /* Header collapses to a hamburger-driven drawer */
  .header-main {
    grid-template-columns: auto 1fr auto;
    gap: var(--sp-3);
    min-height: var(--header-h);
  }

  .nav-toggle { display: inline-flex; order: -1; }

  .header-main .search-form {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
    margin-top: var(--sp-2);
  }

  .main-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 320px);
    background: var(--surface);
    border-right: 1px solid var(--line);
    border-top: 0;
    box-shadow: var(--shadow-lg);
    padding: var(--sp-5) var(--sp-4);
    transform: translateX(-104%);
    transition: transform var(--t-slow);
    z-index: 400;
    overflow-y: auto;
    display: block;
  }

  body.nav-open .main-nav { transform: translateX(0); }

  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    z-index: 350;
    animation: fade-in var(--t) both;
  }

  .main-nav .container {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .main-nav a,
  .main-nav .nav-link,
  .main-nav .dropdown-toggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
    padding: 13px var(--sp-3);
    font-size: var(--fs-base);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }

  .nav-spacer { display: none; }

  .main-nav .dropdown { width: 100%; }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0 0 var(--sp-2) var(--sp-4);
    display: none;
  }

  .dropdown.open > .dropdown-menu { display: block; }

  .header-actions .icon-label { display: none; }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }

  .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .form-row > .form-group { margin-bottom: var(--sp-5); }

  .cart-row {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas:
      "thumb info"
      "qty   price";
    row-gap: var(--sp-3);
  }

  .cart-row .cart-thumb { grid-area: thumb; width: 72px; height: 72px; }
  .cart-row .cart-info { grid-area: info; }
  .cart-row .qty { grid-area: qty; }
  .cart-row .cart-price { grid-area: price; justify-self: end; }
  .cart-row .cart-remove { position: absolute; top: 8px; right: 8px; }
  .cart-row { position: relative; }

  .table { min-width: 560px; }

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

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    transform: translateX(-104%);
    transition: transform var(--t-slow);
  }

  body.admin-nav-open .admin-sidebar { transform: translateX(0); }

  .admin-topbar { padding: var(--sp-3) var(--sp-4); }
  .admin-content { padding: var(--sp-4); }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-6);
  }

  .site-footer .container { padding-block: var(--sp-10) var(--sp-6); }

  .footer-bottom { justify-content: center; text-align: center; }

  .auth-card { padding: var(--sp-6); }
}

@media (max-width: 480px) {
  .container { padding-inline: var(--sp-4); }

  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: minmax(0, 1fr); }

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

  .header-main { gap: var(--sp-2); }

  .logo img,
  .logo svg { height: 28px; }

  .search-form { padding-left: var(--sp-3); }
  .search-form button[type="submit"] { padding: 9px 14px; }

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

  .btn { width: 100%; }
  .btn.btn-inline,
  .table-actions .btn,
  .cart-row .btn,
  .qty .btn { width: auto; }

  .cart-row {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: var(--sp-3);
  }

  .cart-row .cart-thumb { width: 64px; height: 64px; }

  .summary-card,
  .card-body { padding: var(--sp-4); }

  .auth-card { padding: var(--sp-5); }
  .auth-aside { padding: var(--sp-6); }

  .modal-dialog { max-height: calc(100vh - var(--sp-6)); }

  .section-head { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   16. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .admin-sidebar,
  .admin-topbar,
  .btn { display: none !important; }
  body { background: #fff; }
}
