/* =====================================================================
   Voltline: main stylesheet (mobile-first)
   Breakpoints: 640px (large phones), 720px (tablets), 900px (desktop nav)
   Look: light cool-grey page, navy "blueprint grid" panels, amber accents.
   ===================================================================== */

:root {
  --ink: #0e1a2e;
  --ink-soft: #4a5a72;
  --navy: #0b1d3f;
  --paper: #f3f5f8;
  --card: #ffffff;
  --line: #dce2ea;
  --blue: #1d4fff;
  --blue-dark: #1238c9;
  --amber: #ffb524;
  --amber-dark: #ffc54f;
  --grid: rgba(255, 255, 255, 0.07);
  --grid-light: rgba(29, 79, 255, 0.07);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

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

a { color: inherit; text-decoration: none; }

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

button { cursor: pointer; }

h1, h2, h3, p, ul { margin-top: 0; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: var(--amber-dark); }
.btn-ghost { border-color: rgba(255, 255, 255, 0.45); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--ink-soft);
  color: #fff;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.header-main {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand actions"
    "search search";
  align-items: center;
  gap: 10px 12px;
  padding-block: 12px;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--blue);
  display: grid;
  place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; }

.search {
  grid-area: search;
  display: flex;
  min-width: 0;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 79, 255, 0.18);
}
.search select {
  display: none;
  max-width: 170px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--paper);
  outline: 0;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  outline: 0;
}
.search-submit {
  display: grid;
  place-items: center;
  padding: 0 16px;
  border: 0;
  background: var(--ink);
  color: #fff;
}
.search-submit:hover { background: var(--blue); }

.header-actions {
  grid-area: actions;
  display: none; /* shown again at the 900px desktop breakpoint below */
  align-items: center;
  gap: 2px;
}
.action {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
}
.action:hover { background: var(--paper); }
/* Hidden by .header-actions on phones; kept visible-but-icon-only as a
   fallback for any narrow viewport between 320px and the 900px cutoff
   where display:flex is restored (see the desktop breakpoint below). */
.action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border-radius: 9px;
  background: var(--amber);
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

/* Account menu: bundles wishlist, orders and sign out under the user's name
   (desktop header only - phones use the bottom-nav sheet in footer.php). */
.account-menu { position: relative; }
.account-trigger { gap: 10px; }
.account-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.account-trigger-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.account-trigger svg:last-child { width: 16px; height: 16px; }
.account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 12px 28px rgba(14, 26, 46, 0.14);
}
.account-menu:hover .account-dropdown,
.account-menu:focus-within .account-dropdown { display: flex; }
.account-dropdown a,
.account-dropdown button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}
.account-dropdown a:hover,
.account-dropdown button:hover { background: var(--paper); }
.account-dropdown .badge { position: static; margin-left: auto; }
.account-dropdown-logout-form { display: contents; }

/* Category navigation: a scrollable row of pills on phones, a plain bar on desktop */
.cat-nav { border-top: 1px solid var(--line); }
.cat-nav ul {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 10px 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-nav ul::-webkit-scrollbar { display: none; }
.cat-nav a {
  display: block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.cat-nav a:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Account dashboard (profile / wishlist / orders sidebar) ---------- */
/* profile.php uses this instead of .auth-page, since its content is now a
   full-width sidebar layout rather than a single centered card. */
.dashboard-page main { padding-block: 24px 48px; }
.dashboard-layout {
  display: grid;
  gap: 20px;
  align-items: start;
}
.dashboard-sidebar {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.dashboard-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.dashboard-user-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--paper);
}
.dashboard-user-avatar svg { width: 20px; height: 20px; }
.dashboard-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.dashboard-user-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dashboard-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
}
.dashboard-nav-link:hover { background: var(--paper); }
.dashboard-nav-link.is-active { background: var(--grid-light); color: var(--blue); }
.dashboard-nav-logout-form { display: contents; }
.dashboard-nav-logout {
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: #c0392b;
}
.dashboard-nav-logout:hover { background: #fdf0ee; }

@media (min-width: 720px) {
  .dashboard-layout { grid-template-columns: 240px 1fr; }
}

/* ---------- Notices ---------- */
.notice {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff8e8;
  font-size: 0.9375rem;
}

/* ---------- Hero ---------- */
.hero { padding-block: 16px 0; }

.hero-panel {
  display: grid;
  gap: 24px;
  padding: 32px 20px 0;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  background-color: var(--navy);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.hero-copy h1 {
  max-width: 15ch;
  margin-bottom: 14px;
  font-size: clamp(1.9rem, 6.5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}
.hero-copy p {
  max-width: 44ch;
  margin-bottom: 22px;
  color: #c6d2ea;
  font-size: 1.0625rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-art {
  align-self: end;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}

/* Hero illustration colors (SVG shapes are styled here because CSP blocks inline styles) */
.art-desk { fill: #16305f; }
.art-bezel { fill: #1c2f57; stroke: #3b5488; stroke-width: 2; }
.art-screen { fill: #0f2a63; }
.art-stand { fill: #2a4274; }
.art-bar { fill: #3f66d6; }
.art-bar-dim { fill: #294588; }
.art-line { fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.art-dot { fill: var(--amber); }
.art-key { fill: #6a86c6; }
.art-board { fill: #22396a; stroke: #3b5488; stroke-width: 1.5; }
.art-mouse { fill: #22396a; stroke: #3b5488; stroke-width: 1.5; }
.art-mouse-line { stroke: #3b5488; stroke-width: 1.5; }

/* ---------- Sections ---------- */
.section { padding-block: 32px 8px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.375rem;
  letter-spacing: -0.015em;
}
.link-more {
  color: var(--blue);
  font-size: 0.9375rem;
  font-weight: 600;
}
.link-more:hover { text-decoration: underline; }

.note {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* Category rail: a single horizontally-scrolling row so any number of
   categories stays compact instead of wrapping into many rows. */
.cat-rail {
  position: relative;
  margin-inline: -16px;
}
.cat-rail-track {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 4px 16px 14px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  -webkit-overflow-scrolling: touch;
}
.cat-rail-track::-webkit-scrollbar { height: 6px; }
.cat-rail-track::-webkit-scrollbar-track { background: transparent; }
.cat-rail-track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.cat-rail-track::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }
.cat-rail-track > li { flex: 0 0 auto; scroll-snap-align: start; }

.cat-rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 16px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  white-space: nowrap;
}
.cat-rail-item:hover { border-color: var(--blue); }
.cat-rail-item.is-active {
  border-color: var(--blue);
  background: var(--grid-light);
}
.cat-rail-item.is-active .cat-rail-icon { background: var(--card); }
.cat-rail-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--blue);
}
.cat-rail-icon .icon { width: 18px; height: 18px; }
.cat-rail-text { display: flex; flex-direction: column; line-height: 1.25; }
.cat-rail-name { font-weight: 700; font-size: 0.9375rem; }
.cat-rail-count { color: var(--ink-soft); font-size: 0.75rem; font-weight: 400; }

/* Product cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.product:hover {
  border-color: #b9c6e0;
  box-shadow: 0 8px 20px rgba(14, 26, 46, 0.08);
  transform: translateY(-2px);
}
.product-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  color: #8ea3d4;
  background-color: #eef2fb;
  background-image:
    linear-gradient(var(--grid-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-light) 1px, transparent 1px);
  background-size: 16px 16px;
}
.product-media > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-media > .icon {
  width: 44px;
  height: 44px;
  stroke-width: 1.4;
}
.tag-sale {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--amber);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}
.wish {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
}
.wish:hover { color: #d6284f; border-color: #d6284f; }
.wish .icon { width: 18px; height: 18px; }
.wish.is-active { color: #d6284f; border-color: #d6284f; }
.wish.is-active .icon { fill: #d6284f; }
.wish[disabled] { opacity: 0.6; }

/* The heart button's own <form> should not affect layout: it just carries the
   POST fields, the button inside is what is actually styled and positioned. */
.wish-form { display: contents; }

.wish-detail { gap: 8px; }
.wish-detail.is-active { border-color: #d6284f; color: #d6284f; }
.wish-detail.is-active .icon { fill: #d6284f; stroke: #d6284f; }
.wish-detail[disabled] { opacity: 0.6; }

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
}
.product-brand { color: var(--ink-soft); font-size: 0.8125rem; }
.product-name {
  min-height: 2.7em;
  margin: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-name a:hover { color: var(--blue); }
.product-desc {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-stock {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
}
.product-stock.stock-low { color: #b45309; }
.product-stock.stock-out { color: #b42318; }
.price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: auto 0 0;
  padding-top: 8px;
  font-variant-numeric: tabular-nums;
}
.price-now { font-size: 1.125rem; font-weight: 800; }
.price-was { color: var(--ink-soft); font-size: 0.875rem; }
.product > .btn { margin: 0 12px 12px; }

/* Placeholder ("loading") card */
.ph-line {
  display: block;
  width: 100%;
  height: 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--line);
}
.ph-short { width: 40%; }
.ph-price { width: 30%; height: 16px; margin-top: 10px; }

/* Brand chips */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: block;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  padding-top: 40px;
  background: var(--ink);
  color: #c7d0e0;
}
.footer-grid {
  display: grid;
  gap: 28px;
}
.footer-brand { color: #fff; }
.footer-about { max-width: 34ch; margin-top: 12px; font-size: 0.9375rem; }
.site-footer h3 {
  margin-bottom: 10px;
  color: #fff;
  font-size: 1rem;
}
.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links li { margin-bottom: 6px; }
.footer-links a { font-size: 0.9375rem; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  margin-top: 32px;
  padding-block: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.875rem;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(14, 26, 46, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- Notice variants (success / error) ---------- */
.notice-success {
  border-left-color: var(--blue);
  background: #eaf0ff;
  color: var(--ink);
}
.notice-error {
  border-left-color: #d6284f;
  background: #fdecef;
  color: #7a1230;
}
.error-list {
  margin: 0;
  padding-left: 1.1em;
}
.error-list li { margin-bottom: 2px; }
.error-list li:last-child { margin-bottom: 0; }

/* ---------- Auth pages (login, register, profile, forgot/reset password) ---------- */
.auth-page main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-block: 32px 48px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.auth-card-wide { max-width: 560px; }
.auth-card h1 {
  margin-bottom: 6px;
  font-size: 1.5rem;
  letter-spacing: -0.015em;
}
.auth-lead {
  margin-bottom: 20px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.auth-subtitle {
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}
.auth-card > .auth-subtitle:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 0.875rem;
  font-weight: 700;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 1rem;
  font-family: inherit;
}
.form-group textarea { resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 79, 255, 0.18);
}
.form-group input[disabled] {
  background: var(--paper);
  color: var(--ink-soft);
}
.field-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}
.form-group input.otp-input {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
}
.form-actions { margin-top: 4px; }
.form-actions .btn { width: 100%; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-google {
  width: 100%;
  gap: 10px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.btn-google:hover { background: var(--paper); }
.icon-google { width: 18px; height: 18px; flex: none; }

.auth-switch {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  text-align: center;
}
.auth-switch a { color: var(--blue); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.auth-card > form[action*="logout"] {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.auth-card > form[action*="logout"] .btn { width: 100%; }

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 8px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--paper);
  font-size: 0.875rem;
}
.profile-meta > div { display: flex; gap: 6px; }
.profile-meta dt { color: var(--ink-soft); font-weight: 600; }
.profile-meta dd { margin: 0; font-weight: 600; }

.btn-ghost-dark {
  border-color: var(--ink);
  color: var(--ink);
}
.btn-ghost-dark:hover { background: var(--paper); }

/* Sign-out forms embedded in the header/footer must not disturb their layout */
.logout-form { display: contents; }
.footer-logout-form { display: contents; }
.footer-logout-form button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  color: inherit;
}
.footer-logout-form button:hover { color: #fff; text-decoration: underline; }

/* ---------- 640px: large phones ---------- */
@media (min-width: 640px) {
  .container { padding-inline: 24px; }
  .cat-rail { margin-inline: -24px; }
  .cat-rail-track { padding-inline: 24px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-panel { padding: 40px 32px 0; }
  .section-head h2 { font-size: 1.625rem; }
}

/* ---------- 720px: tablets ---------- */
@media (min-width: 720px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .hero-panel {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 32px;
    padding: 56px 48px 0;
  }
  .hero-copy { padding-bottom: 56px; }
  .hero-art { margin-inline: 0; }
}

/* ---------- 900px: desktop header ---------- */
@media (min-width: 900px) {
  .site-header { position: sticky; top: 0; }
  .header-main {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand search actions";
    gap: 32px;
  }
  .search { max-width: 640px; width: 100%; justify-self: center; }
  .search select { display: block; }
  .header-actions { display: flex; }
  .action-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }
  .cat-nav ul { gap: 4px; overflow: visible; }
  .cat-nav a {
    padding: 4px 12px;
    border-color: transparent;
    border-radius: 8px;
    background: transparent;
  }
  .cat-nav a:hover { border-color: transparent; background: var(--paper); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

/* ---------- Wide screens ---------- */
@media (min-width: 1200px) {
  .cat-rail-item { height: 60px; }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition: none; }
}

/* =====================================================================
   M5: shop listing and product detail
   ===================================================================== */

/* Product card media is now a link to the product page */
.product-media-link {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
.product-media-link > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-media-link > .icon {
  width: 44px;
  height: 44px;
  stroke-width: 1.4;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-block: 16px 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.breadcrumb a:hover { color: var(--blue); text-decoration: underline; }
.breadcrumb [aria-current="page"] {
  overflow: hidden;
  max-width: 28ch;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Shop layout ---------- */
.shop-layout {
  display: grid;
  gap: 20px;
  padding-block: 20px 8px;
}
.shop-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}
.shop-head h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.shop-count {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.shop-sort {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.875rem;
}
.shop-sort label { color: var(--ink-soft); }
.shop-sort select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.btn-sm { padding: 8px 14px; font-size: 0.875rem; }

/* ---------- Filters ---------- */
.shop-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}
.filter-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.filter-block h2 {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.filter-link {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9375rem;
}
.filter-link:hover { background: var(--paper); color: var(--blue); }
.filter-link.is-active {
  background: rgba(29, 79, 255, 0.08);
  color: var(--blue);
  font-weight: 700;
}
.filter-count {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* ---------- Active filter chips ---------- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.chip-clear { background: var(--card); }

.empty-state {
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.empty-state a { color: var(--blue); font-weight: 600; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 24px;
}
.page-link {
  display: inline-flex;
  min-width: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.9375rem;
  font-weight: 600;
}
.page-link:hover { border-color: var(--blue); color: var(--blue); }
.page-link.is-current {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}
.page-link.is-disabled {
  color: var(--ink-soft);
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- Product detail ---------- */
.product-detail {
  display: grid;
  gap: 20px;
  padding-block: 20px 8px;
}
.detail-media {
  position: relative;
  display: grid;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #8ea3d4;
  background-color: #eef2fb;
  background-image:
    linear-gradient(var(--grid-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-light) 1px, transparent 1px);
  background-size: 16px 16px;
}
.detail-media > img { width: 100%; height: 100%; object-fit: contain; }
.detail-media > .icon { width: 72px; height: 72px; stroke-width: 1.2; }

/* Gallery thumbnails */
.detail-gallery { display: flex; flex-direction: column; gap: 10px; }
.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gallery-thumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 4px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #eef2fb;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumb:hover { border-color: #8ea3d4; }
.gallery-thumb.is-active { border-color: var(--blue); }
.gallery-thumb:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.detail-body h1 {
  margin: 6px 0 8px;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.detail-body .product-brand { display: inline-block; font-weight: 600; }
.detail-body a.product-brand:hover { color: var(--blue); }
.detail-lead { color: var(--ink-soft); }
.detail-body .price { margin-block: 12px; }
.detail-body .price-now { font-size: 1.5rem; }
.save-note {
  color: #14804a;
  font-size: 0.875rem;
  font-weight: 600;
}
.stock {
  margin: 0 0 16px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.stock-in { color: #14804a; }
.stock-low { color: #b45309; }
.stock-out { color: #b42318; }
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.detail-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 0.9375rem;
}
.detail-meta > div { display: flex; gap: 8px; }
.detail-meta dt { min-width: 110px; color: var(--ink-soft); font-weight: 600; }
.detail-meta dd { margin: 0; font-weight: 600; }
.detail-meta dd a:hover { color: var(--blue); text-decoration: underline; }
.detail-description { padding-block: 24px 0; }
.detail-description h2 { font-size: 1.125rem; }
.detail-description p { max-width: 70ch; color: var(--ink-soft); }

/* ---------- Product reviews (M21-A) ---------- */
.detail-reviews { padding-block: 24px 40px; }
.review-stars { color: var(--amber-dark); letter-spacing: 1px; }
.review-list { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.review-item { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: none; padding-bottom: 0; }
.review-item-head { display: flex; align-items: center; gap: 10px; }
.review-verified {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue-dark);
  background: rgba(29, 79, 255, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}
.review-item-title { font-size: 1rem; margin: 8px 0 4px; }
.review-item-body { margin: 0 0 6px; max-width: 70ch; }
.review-item-meta { margin: 0; font-size: 0.8125rem; color: var(--ink-soft); }
.review-form-wrap { max-width: 480px; margin-top: 24px; }
.review-form-title { font-size: 1.05rem; margin: 0 0 12px; }
.review-form { display: flex; flex-direction: column; gap: 14px; }
.review-form .form-actions { margin-top: 0; }
.review-form .form-actions .btn { width: auto; padding-inline: 24px; }

@media (min-width: 720px) {
  .product-detail { grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
  .detail-body h1 { font-size: 1.75rem; }
}

@media (min-width: 900px) {
  .shop-layout { grid-template-columns: 240px 1fr; gap: 28px; }
  .product-detail { grid-template-columns: 1.1fr 1fr; }
}

/* =====================================================================
   M8: Cart
   ===================================================================== */

/* The add-to-cart <form> should not affect layout on a product card: the
   button inside keeps the same position the old plain button had. */
.cart-form-card { display: contents; }

.cart-form-detail {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.qty-field {
  display: grid;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.qty-field input {
  width: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

/* ---------- Cart page ---------- */
.cart-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.cart-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cart-line {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.cart-media {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  color: #8ea3d4;
  background: #eef2fb;
}
.cart-media img { width: 100%; height: 100%; object-fit: contain; }
.cart-media .icon { width: 32px; height: 32px; }
.cart-info { min-width: 0; }
.cart-name {
  margin: 0 0 2px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}
.cart-name a:hover { color: var(--blue); }
.cart-unit { margin: 0; color: var(--ink-soft); font-size: 0.875rem; }

.cart-qty {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  grid-column: 1 / -1;
}
.qty-step { display: contents; }
.qty-set {
  display: flex;
  gap: 6px;
  align-items: center;
}
.qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1;
}
.qty-btn:hover:not([disabled]) { border-color: var(--blue); color: var(--blue); }
.qty-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.qty-input {
  width: 68px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  text-align: center;
}

.cart-line-end {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.cart-subtotal {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cart-remove {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: #b42318;
  font-size: 0.875rem;
  font-weight: 600;
}
.cart-remove:hover { border-color: #b42318; }

.cart-summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.cart-summary h2 { margin: 0 0 10px; font-size: 1.0625rem; }
.summary-rows { display: grid; gap: 8px; margin: 0 0 12px; }
.summary-rows > div {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.summary-rows dt { color: var(--ink-soft); }
.summary-rows dd { margin: 0; font-weight: 700; }
.cart-summary .btn { width: 100%; }

@media (min-width: 720px) {
  .cart-line {
    grid-template-columns: 110px minmax(0, 1fr) auto;
    align-items: center;
  }
  .cart-qty { grid-column: auto; justify-content: flex-end; }
  .cart-line-end {
    flex-direction: column;
    align-items: flex-end;
    grid-column: 1 / -1;
    padding-top: 10px;
  }
}

@media (min-width: 900px) {
  .cart-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .cart-line {
    grid-template-columns: 110px minmax(0, 1fr) auto 150px;
  }
  .cart-line-end {
    grid-column: auto;
    align-items: flex-end;
    padding-top: 0;
    border-top: 0;
  }
}

/* ---------- Checkout (M9) ---------- */
.checkout-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.checkout-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.checkout-block {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.checkout-block legend {
  padding: 0 6px;
  font-size: 1.0625rem;
  font-weight: 700;
}
.checkout-block .form-group { margin-bottom: 12px; }
.form-row {
  display: grid;
  gap: 0 12px;
}
.label-optional { color: var(--ink-soft); font-weight: 400; }

.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.choice:last-child { margin-bottom: 0; }
.choice:hover { border-color: var(--blue); }
.choice input { margin-top: 3px; }
.choice-body { display: grid; gap: 2px; }
.choice-title { font-weight: 600; }
.choice-hint { color: var(--ink-soft); font-size: 0.875rem; line-height: 1.45; }

.checkout-items {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px dashed var(--line);
  list-style: none;
}
.checkout-item {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  font-size: 0.9375rem;
}
.checkout-item-name { display: grid; gap: 2px; min-width: 0; }
.checkout-item-meta { color: var(--ink-soft); font-size: 0.8125rem; }
.checkout-item-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.summary-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.0625rem;
}
.summary-total dt { color: var(--ink); font-weight: 700; }

.checkout-summary .btn { width: 100%; margin-bottom: 8px; }
.checkout-summary .note { margin: 4px 0 0; }

/* ---------- Order confirmation ---------- */
.order-success {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.order-success-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7f6ec;
  color: #1a7f42;
  font-size: 0.8125rem;
  font-weight: 700;
}
.order-success h1 { margin: 0 0 8px; font-size: 1.5rem; }
.order-success-lead { margin: 0 0 16px; color: var(--ink-soft); line-height: 1.55; }
.order-success-meta { margin-bottom: 16px; }
.order-address {
  margin: 0;
  color: var(--ink-soft);
  font-style: normal;
  line-height: 1.6;
}
.order-success-actions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

@media (min-width: 640px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .order-success-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .checkout-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* ---------- Order history (M10) ---------- */
.order-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.order-row {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.order-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: baseline;
  justify-content: space-between;
}
.order-row-number {
  color: var(--blue);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.order-row-number:hover { text-decoration: underline; }
.order-row-date { color: var(--ink-soft); font-size: 0.875rem; }

.order-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}
.order-meta dt { color: var(--ink-soft); font-size: 0.8125rem; }
.order-meta dd {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.status-pending { background: #fff4d6; color: #8a5a00; }
.status-confirmed,
.status-processing,
.status-shipped,
.status-out_for_delivery { background: #e4ecff; color: var(--blue-dark); }
.status-delivered,
.status-paid { background: #e7f6ec; color: #1a7f42; }
.status-cancelled,
.status-failed { background: #fde8ec; color: #b42318; }
.status-unpaid,
.status-refunded { background: #eef1f6; color: var(--ink-soft); }

/* Order detail */
.order-detail-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.order-detail-main,
.order-detail-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.order-block {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.order-block h2 { margin: 0 0 12px; font-size: 1.0625rem; }
.order-block .summary-rows { margin-bottom: 0; }
.order-block .note { margin: 12px 0 0; }
.order-note { margin: 12px 0 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.order-pay-form { margin: 12px 0 0; }

.table-wrap { overflow-x: auto; }
.order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.order-table th,
.order-table td {
  padding: 10px 8px;
  border-bottom: 1px dashed var(--line);
  text-align: left;
  vertical-align: top;
}
.order-table thead th {
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}
.order-table tbody tr:last-child th,
.order-table tbody tr:last-child td { border-bottom: 0; }
.order-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-table-product {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.order-table-sku {
  display: block;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 400;
}
.order-detail-side > .btn { width: 100%; }

@media (min-width: 640px) {
  .order-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .order-row > .btn { justify-self: start; }
}

@media (min-width: 900px) {
  .order-detail-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* =====================================================================
   M30: Beautiful authentication modals
   Login, register, verify-otp, forgot-password and reset-password all
   render exactly as before (full .auth-card pages - see the "Auth pages"
   block above) so a direct URL, an email link, or JavaScript being off
   all keep working. When JavaScript is available, assets/js/main.js
   moves that same .auth-card markup into the overlay below instead of
   letting the browser navigate, so no styling or markup is duplicated
   here - this block only adds the overlay chrome around it.
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 29, 63, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.is-open { opacity: 1; }

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: auto;
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.modal-overlay.is-open .modal-dialog { transform: translateY(0) scale(1); opacity: 1; }

/* The fetched/relocated .auth-card supplies the card's own background,
   border and radius; inside the modal it also gets a lifted shadow and
   loses its outer page margin since the overlay already centers it. */
.modal-dialog .auth-card {
  margin: 0;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(11, 29, 63, 0.35);
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(11, 29, 63, 0.25);
}
.modal-close:hover { background: var(--paper); }
.modal-close:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* html.modal-open locks background scrolling while a modal is up. */
html.modal-open { overflow: hidden; }

@media (max-width: 480px) {
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal-dialog { max-width: 100%; }
  .modal-dialog .auth-card { max-height: calc(100vh - 24px); border-radius: var(--radius) var(--radius) 0 0; }
  .modal-close { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-dialog { transition: none; }
}

/* =====================================================================
   M31-B: Mobile bottom navigation + secondary ("more") sheet
   Phone/tablet only (< 900px, the same breakpoint where the desktop
   header nav takes over). Primary links: Home, Categories, Orders,
   Profile. The hamburger opens a bottom sheet with the remaining
   header actions (wishlist, cart, sign in/out) so nothing is
   duplicated - it's the same links, just relocated.
   ===================================================================== */
:root { --bottom-nav-h: 62px; }

body { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  height: var(--bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(14, 26, 46, 0.08);
}
.bottom-nav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
}
.bottom-nav-item .icon { width: 22px; height: 22px; }
.bottom-nav-item.is-active { color: var(--blue); }
.bottom-nav-item:active { background: var(--paper); }
.bottom-nav-more { position: relative; }

.toast { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 14px); }

/* Secondary sheet: same overlay pattern as the auth modal above, but it
   always docks to the bottom edge, sized to its content. */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(11, 29, 63, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sheet-overlay[hidden] { display: none; }
.sheet-overlay.is-open { opacity: 1; }

.sheet-panel {
  width: 100%;
  max-width: 480px;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--card);
  box-shadow: 0 -12px 30px rgba(11, 29, 63, 0.3);
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-overlay.is-open .sheet-panel { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 6px auto 10px;
  border-radius: 999px;
  background: var(--line);
}

.sheet-list { margin: 0; padding: 0; list-style: none; }
.sheet-list a,
.sheet-list button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
}
.sheet-list a:hover,
.sheet-list button:hover { background: var(--paper); }
.sheet-list .badge { position: static; margin-left: auto; }

html.sheet-open { overflow: hidden; }

@media (min-width: 900px) {
  .bottom-nav,
  .sheet-overlay { display: none; }
  body { padding-bottom: 0; }
  .toast { bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-overlay, .sheet-panel { transition: none; }
}
