:root {
  --bg: #0a0a0a;
  --fg: #fafaf8;
  --muted: #c6c6be;
  --line: #ffffff;
  --line-strong: #ffffff;
  --surface: #121212;
  --rule: 4px;
  --logo-size: 7rem;
  /* Match rail width to top row (logo strip / search banner height) */
  --sidebar-width: var(--logo-size);
  --account-rail-width: calc(1rem + 2.35rem);
  --shop-footer-fixed-h: 4rem;
  --font-scale: 1.5;
  --rail-font-mul: 0.5;
  --font: "Unbounded", system-ui, sans-serif;
  --radius: 2px;
}

[data-theme="light"] {
  --bg: #f4f4f2;
  --fg: #0a0a0a;
  --muted: #33332f;
  --line: #0a0a0a;
  --line-strong: #0a0a0a;
  --surface: #ffffff;
}

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

html {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: calc(1rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Storefront: clip document scroll; only rail body + main scroll */
body.shop {
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: calc(var(--shop-footer-fixed-h) + env(safe-area-inset-bottom, 0px));
}

/* Viewport-locked chrome: only .main (and rail body if needed) scroll */
.shell-grid {
  height: calc(100vh - var(--shop-footer-fixed-h) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100vh - var(--shop-footer-fixed-h) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - var(--shop-footer-fixed-h) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - var(--shop-footer-fixed-h) - env(safe-area-inset-bottom, 0px));
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--logo-size) minmax(0, 1fr);
}

/* Full-height vertical separator replaces rail's own border-right */
body.shop::before {
  content: '';
  position: fixed;
  left: var(--sidebar-width);
  top: 0;
  bottom: 0;
  width: var(--rule);
  background: var(--line);
  z-index: 160;
  pointer-events: none;
}

/* Full-height vertical separator: account / right strip (matches header padding + button) */
body.shop::after {
  content: '';
  position: fixed;
  right: var(--account-rail-width);
  top: 0;
  bottom: 0;
  width: var(--rule);
  background: var(--line);
  z-index: 160;
  pointer-events: none;
}

.rail {
  grid-row: 1 / -1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.logo-strip {
  flex-shrink: 0;
  width: 100%;
  height: var(--logo-size);
  border-bottom: var(--rule) solid var(--line);
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  z-index: 1;
  box-sizing: border-box;
}

.logo-block {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: var(--logo-size);
  max-height: var(--logo-size);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  background: var(--bg);
}

.logo-img {
  width: 68%;
  height: 68%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.rail-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.1rem 0.9rem 0.5rem;
}

.top-strip {
  grid-row: 1;
  grid-column: 2;
  border-bottom: var(--rule) solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 0 1rem;
  min-width: 0;
  flex-shrink: 0;
  background: var(--bg);
  z-index: 2;
}

.top-strip__inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

/* Mobile-only duplicate; hidden on wider layouts (logo lives in sidebar). */
.top-strip__brand {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  height: 100%;
  min-height: 0;
  text-decoration: none;
  color: inherit;
}

.top-strip__brand-img {
  display: block;
  width: 2.35rem;
  height: 2.35rem;
  object-fit: contain;
}

.top-strip__search {
  flex: 1;
  min-width: 0;
}

.top-strip__trailing {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-shrink: 0;
  min-width: 0;
}

.top-strip__account-slot {
  position: relative;
  flex: 0 0 var(--account-rail-width);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.top-strip__view-label {
  flex-shrink: 1;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28rem 0.45rem;
  justify-content: flex-end;
  min-width: 0;
  text-align: right;
  line-height: 1.2;
}

.top-strip__view-label[hidden] {
  display: none !important;
}

.top-strip__view-title {
  font-weight: 700;
  font-size: calc(0.62rem * var(--font-scale));
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}

.top-strip__view-meta {
  font-weight: 600;
  font-size: calc(0.68rem * var(--font-scale));
  letter-spacing: 0.05em;
  color: var(--muted);
}

.top-strip__view-back {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.2rem 0.45rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.top-strip__view-back:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--fg) 30%);
}

.top-strip__view-back:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .top-strip__view-label {
    max-width: none;
  }

  .top-strip__trailing {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .top-strip__view-meta {
    font-size: calc(0.62rem * var(--font-scale));
  }

  .top-strip__view-back {
    font-size: calc(0.52rem * var(--font-scale));
    padding: 0.18rem 0.38rem;
  }
}

.account-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  text-decoration: none;
  border: none;
  border-radius: 0;
  background: transparent;
  transition: color 0.12s ease, opacity 0.12s ease;
}

.account-btn:hover {
  color: var(--fg);
  background: transparent;
}

[data-theme="light"] .account-btn:hover {
  background: transparent;
}

.account-btn:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

.account-btn__icon {
  width: 2rem;
  height: 2rem;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

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

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 0.35rem 0;
  outline: none;
}

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

.search-input:focus {
  outline: none;
}

.top-strip__search {
  font-size: calc(1.2rem * var(--font-scale));
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.52rem 0;
}

.top-strip__search::placeholder {
  color: var(--muted);
  text-transform: uppercase;
  opacity: 1;
}

.main {
  grid-row: 2;
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  padding: 0 var(--account-rail-width) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.site-footer--fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  background: var(--bg);
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.site-footer__rule {
  position: relative;
  z-index: 2;
  display: block;
  height: var(--rule);
  width: 100%;
  flex-shrink: 0;
  background: var(--line);
}

.footer-inner {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  position: relative;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  gap: 0.5rem;
  min-height: 3.25rem;
}

.footer-corner {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.footer-corner--left {
  justify-content: flex-start;
  align-self: stretch;
  min-width: var(--sidebar-width);
  pointer-events: none;
  position: relative;
}

.footer-corner--balance {
  /* Mirrors left column so legal links stay visually centered on the viewport */
  pointer-events: none;
  position: relative;
}

.footer-corner--partner {
  justify-content: flex-end;
}

/* Right edge aligns with viewport; offset by account strip + divider so logo sits left of body.shop::after */
.footer-partner-slot {
  position: absolute;
  right: calc(var(--account-rail-width) + var(--rule) + 0.45rem);
  left: auto;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 2;
}

.footer-audacieu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  line-height: 0;
  text-decoration: none;
  border-radius: var(--radius);
}

.footer-audacieu-link:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

.footer-audacieu-logo {
  display: block;
  height: clamp(1.1rem, 3.2vmin, 1.85rem);
  width: auto;
  max-width: min(28vw, 9.5rem);
  object-fit: contain;
}

.corner-square {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  width: 100%;
  height: 100%;
}

.corner-square:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

.corner-square--theme {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--fg);
  transition: background 0.12s ease;
}

.corner-square--theme:hover {
  background: color-mix(in srgb, var(--bg) 74%, var(--fg) 26%);
}

.corner-square--submit {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--fg);
  transition: background 0.12s ease;
}

.corner-square--submit:hover {
  background: color-mix(in srgb, var(--surface) 74%, var(--fg) 26%);
}

.corner-square__icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  display: block;
  pointer-events: none;
}


/* Full width of bottom-left sidebar band (screen left → main vertical line); divider stays centered via flex halves */
.corner-squares {
  position: absolute;
  left: 0;
  top: calc(-1 * var(--rule));
  bottom: 0;
  width: var(--sidebar-width);
  max-width: 100%;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr var(--rule) 1fr;
  align-items: stretch;
  pointer-events: auto;
}

.footer-nav--tight {
  display: block;
  justify-self: center;
  align-self: center;
  padding: 0.55rem 0;
  text-align: center;
  font-size: calc(0.48rem * var(--font-scale));
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-nav--tight .footer-link {
  display: inline;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  text-transform: inherit;
  border-bottom: none;
  text-decoration: none;
  color: var(--muted);
}

.footer-nav--tight .footer-link:hover {
  color: var(--fg);
  border-bottom: var(--rule) solid var(--line-strong);
}

.footer-gap {
  user-select: none;
}

/* Narrow viewports: legal links left-aligned; partner logo in-flow so it does not cover Terms / Privacy / Cookies */
@media (max-width: 720px) {
  .footer-inner {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    column-gap: 0.45rem;
  }

  /* Wider theme / submit taps; nudge strip right so it clears the hinge line */
  .footer-corner--left {
    min-width: calc(var(--sidebar-width) + 1.05rem + 0.5rem);
  }

  .corner-squares {
    width: calc(var(--sidebar-width) + 1.05rem);
    left: 0.5rem;
  }

  .site-footer .corner-square__icon {
    width: 1.92rem;
    height: 1.92rem;
  }

  .footer-nav--tight {
    justify-self: start;
    text-align: left;
    padding-left: 0;
    padding-right: 0.25rem;
  }

  .footer-partner-slot {
    position: static;
    right: auto;
    left: auto;
    justify-content: flex-end;
    padding-right: max(0.12rem, env(safe-area-inset-right, 0px));
    margin-inline-end: -0.15rem;
  }

  .footer-corner--partner {
    min-width: 0;
  }
}

.shop-banner {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-size: calc(0.8rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
  border-bottom: var(--rule) solid var(--line);
  background: var(--bg);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: calc(1rem * var(--font-scale) * var(--rail-font-mul));
  padding: 0.35rem 0;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.12s ease, background 0.12s ease;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link.is-active {
  color: var(--fg);
  font-weight: 600;
}

/* Category filters: icon buttons (full button is clickable) */
.nav-link--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: 0.45rem 0.35rem;
  text-align: center;
  font-size: 0;
  line-height: 0;
}

.nav-link--icon .nav-link__img {
  width: clamp(2.65rem, 8vw, 4rem);
  height: clamp(2.65rem, 8vw, 4rem);
  object-fit: contain;
  display: block;
  pointer-events: none;
  opacity: 1;
}

.nav-link--icon:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 1.15rem;
}

.btn-rail {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: var(--rule) solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.82rem * var(--font-scale));
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

a.btn-rail {
  display: block;
}

.btn-rail:hover {
  border-color: var(--fg);
  background: rgba(244, 244, 242, 0.04);
}

[data-theme="light"] .btn-rail:hover {
  background: rgba(10, 10, 10, 0.04);
}

.btn-rail--ghost {
  font-weight: 500;
  color: var(--muted);
}

.btn-rail--ghost:hover {
  color: var(--fg);
}

.btn-rail--icon {
  width: 2.1rem;
  height: 2.1rem;
  max-width: 2.1rem;
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
}

.rail-submit {
  margin-top: auto;
  margin-bottom: 0.35rem;
}

.btn-submit-rail {
  font-size: calc(0.88rem * var(--font-scale) * var(--rail-font-mul));
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 0.58rem 0.45rem;
  width: 100%;
  flex-shrink: 0;
}

.btn-rail--icon .btn-rail__icon {
  width: 0.92rem;
  height: 0.92rem;
  flex-shrink: 0;
}

.rail-link {
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: var(--rule) solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.rail-link:hover {
  color: var(--fg);
  border-bottom-color: var(--line-strong);
}

.rail-link--admin {
  font-size: calc(0.7rem * var(--font-scale));
  letter-spacing: 0.04em;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-label {
  font-size: calc(0.72rem * var(--font-scale));
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.theme-toggle {
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

.theme-toggle-track {
  display: block;
  width: 2.5rem;
  height: 1.35rem;
  border: var(--rule) solid var(--line-strong);
  border-radius: 999px;
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.theme-toggle-knob {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--fg);
  transform: translateY(-50%);
  transition: transform 0.18s ease, background 0.18s ease;
}

.theme-toggle[aria-checked="true"] .theme-toggle-track {
  background: var(--surface);
}

.theme-toggle[aria-checked="true"] .theme-toggle-knob {
  transform: translate(1.15rem, -50%);
}

/*
 * Main feed: fixed track widths so listing tiles stay 1x1 regardless of item count.
 */
.grid {
  list-style: none;
  margin: 0;
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  padding: 0;
  display: grid;
  --grid-tile-min: 12.5rem;
  --grid-tile-max: 22rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-tile-min)), 1fr));
  grid-auto-rows: auto;
  grid-auto-flow: row dense;
  justify-content: stretch;
  align-content: start;
  /* Row height = each tile's intrinsic square; avoids neighbors stretching when a 2×2 cell's content is taller */
  align-items: start;
  gap: 0;
  background: var(--bg);
}

.grid.grid--single-summary {
  grid-template-columns: repeat(2, minmax(0, var(--grid-tile-min)));
  justify-content: start;
}

.grid.grid--single-summary .grid-cell--view-summary {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}

.grid.grid--account-open {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  position: relative;
  padding: 1.15rem clamp(0.85rem, 4vw, 2rem) 0;
}

.grid-cell {
  --cell-pad: clamp(0.42rem, 1.5vw, 0.62rem);
  padding: var(--cell-pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.24rem;
  background: var(--bg);
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  justify-self: stretch;
  overflow: hidden;
  position: relative;
  border-style: solid;
  border-color: var(--line);
  border-width: 0 var(--rule) var(--rule) 0;
}

.cell-media {
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  position: relative;
  width: 100%;
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(244, 244, 242, 0.04);
}

[data-theme="light"] .cell-media {
  background: rgba(10, 10, 10, 0.04);
}

.cell-media-meta {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 3;
  pointer-events: none;
}

/* In-tile details slide: hide price/claimed overlays above the copy */
.grid-cell--expanded .cell-media:has(.cell-media-details-card:not([hidden])) .cell-media-meta,
.grid-cell--expanded .cell-media:has(.cell-media-details-card:not([hidden])) .cell-claimed-badge {
  visibility: hidden;
}

.cell-img,
.cell-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* HEIC placeholders decode client-side to JPEG (see heic-web.js) */
.cell-img--heic {
  background: var(--surface);
}

.cell-img--heic-failed {
  object-fit: contain;
  opacity: 0.65;
}

.cell-media-placeholder {
  width: 100%;
  height: 100%;
  min-height: 3.5rem;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    #ffffff 4px,
    #ffffff 6px
  );
}

[data-theme="light"] .cell-media-placeholder {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    #0a0a0a 4px,
    #0a0a0a 6px
  );
}

.cell-meta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-height: 1em;
  line-height: 1.08;
  white-space: nowrap;
}

.cell-cat {
  margin: 0;
  font-size: calc(0.68rem * var(--font-scale));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cell-price {
  margin: 0;
  font-size: calc(0.7rem * var(--font-scale));
  font-weight: 700;
  color: var(--fg);
  flex-shrink: 0;
}

.cell-title {
  display: none;
  margin: 0;
  font-size: clamp(calc(0.66rem * var(--font-scale)), calc(1.08vw * var(--font-scale)), calc(0.8rem * var(--font-scale)));
  font-weight: 600;
  line-height: 1.16;
  flex: 0 0 auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  word-break: break-word;
}

.cell-desc {
  display: block;
  margin: 0;
  font-size: clamp(calc(0.6rem * var(--font-scale)), calc(0.98vw * var(--font-scale)), calc(0.72rem * var(--font-scale)));
  font-weight: 500;
  color: var(--muted);
  line-height: 1.24;
  flex: 0 0 auto;
}

.cell-issues {
  display: block;
  margin: 0;
  font-size: clamp(calc(0.58rem * var(--font-scale)), calc(0.92vw * var(--font-scale)), calc(0.68rem * var(--font-scale)));
  font-weight: 500;
  color: var(--fg);
  line-height: 1.24;
  flex: 0 0 auto;
}

.cell-issues.is-none {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-weight: 500;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.grid-cell .cell-title.clamp-2 {
  display: none;
  -webkit-line-clamp: 1;
}

.grid-cell .cell-desc.clamp-2,
.grid-cell .cell-issues.clamp-2 {
  display: none;
}

.cell-details {
  display: none;
}

@media (max-width: 1100px) {
  .grid {
    --grid-tile-min: 11.25rem;
    --grid-tile-max: 20rem;
  }
}

@media (max-width: 880px) {
  .grid {
    --grid-tile-min: 10.5rem;
    --grid-tile-max: 19rem;
  }
}

@media (max-width: 640px) {
  .grid {
    --grid-tile-min: 9.25rem;
    --grid-tile-max: 100%;
  }
}

.empty {
  margin: 0;
  padding: 1.25rem 1.15rem;
  font-size: calc(0.95rem * var(--font-scale));
  font-weight: 500;
  color: var(--muted);
}

@media (max-width: 720px) {
  :root {
    --logo-size: 4rem;
  }

  body.shop::before {
    display: none;
  }

  body.shop::after {
    display: none;
  }

  .shell-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }

  /* Logo + search + account in one bar; categories rail below */
  .top-strip {
    order: -1;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: 0.55rem;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
    flex-shrink: 0;
  }

  .top-strip__brand {
    display: flex;
    align-self: center;
  }

  .top-strip__brand-img {
    width: clamp(2.15rem, 9vw, 2.85rem);
    height: clamp(2.15rem, 9vw, 2.85rem);
  }

  /* Logo moves into header; sidebar row is categories only */
  .logo-strip {
    display: none;
  }

  .rail {
    border-right: none;
    border-bottom: var(--rule) solid var(--line);
    flex-shrink: 0;
    max-height: none;
    min-height: 0;
  }

  .rail-body {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .rail-body::-webkit-scrollbar {
    height: 5px;
  }

  .rail-body::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--line) 45%, transparent);
    border-radius: 999px;
  }

  .nav {
    flex: 0 0 auto;
    width: max-content;
    max-width: none;
    min-width: 0;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.35rem;
    width: max-content;
  }

  .nav-list > li {
    flex: 0 0 auto;
  }

  .nav-link {
    width: auto;
    flex: 0 0 auto;
    padding: 0.35rem 0.45rem 0.35rem 0;
  }

  .nav-link--icon {
    min-height: 3.25rem;
    padding: 0.3rem 0.4rem;
  }

  .rail-actions {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 0;
    gap: 0.65rem;
  }

  .rail-actions .btn-rail:not(.btn-rail--icon) {
    width: auto;
    flex: 1 1 auto;
    min-width: 8.5rem;
  }

  .rail-actions .btn-rail--icon {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    flex: 0 0 auto;
    margin: 0;
  }

  .rail-actions .btn-rail--icon .btn-rail__icon {
    width: 0.88rem;
    height: 0.88rem;
  }

  .rail-actions .rail-link {
    flex: 0 0 auto;
  }

  .sidebar-foot {
    margin-top: 0;
    padding-top: 0;
    flex: 1 1 100%;
  }

  .top-strip__inner {
    gap: 0.5rem;
  }

  .top-strip__search {
    flex: 1;
    font-size: calc(0.95rem * var(--font-scale));
    padding: 0.35rem 0;
    min-width: 0;
  }

  /* Search no longer clears a phantom right rail strip on mobile */
  .top-strip__account-slot {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
  }

  .credit-chip {
    display: none !important;
  }

  .account-btn {
    width: 3rem;
    height: 3rem;
  }

  .account-btn__icon {
    width: 1.8rem;
    height: 1.8rem;
  }

  .main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-right: 0;
  }

  .main-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Submit modal */
body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
}

.modal-backdrop[hidden] {
  display: none !important;
}

[data-theme="light"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.modal {
  width: min(28rem, 100%);
  max-height: min(90vh, 36rem);
  overflow-y: auto;
  padding: 1.15rem 1.2rem 1.25rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

#submit-modal .modal {
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(92vh, 48rem);
  padding: 1.35rem 1.45rem 1.5rem;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.modal-title {
  margin: 0;
  font-size: calc(1rem * var(--font-scale));
  font-weight: 600;
  line-height: 1.25;
}

.modal-close {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: calc(1.35rem * var(--font-scale));
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.modal-close:hover {
  color: var(--fg);
}

.modal-text {
  margin: 0 0 0.65rem;
  font-size: calc(0.84rem * var(--font-scale));
  line-height: 1.5;
  color: var(--fg);
}

.modal-text--muted {
  color: var(--muted);
  font-size: calc(0.8rem * var(--font-scale));
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.submit-form {
  margin-top: 0.35rem;
}

.modal-label {
  display: block;
  font-size: calc(0.72rem * var(--font-scale));
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0.55rem 0 0.2rem;
}

.modal-label:first-of-type {
  margin-top: 0;
}

.modal-optional {
  text-transform: none;
  letter-spacing: 0;
  font-size: calc(0.68rem * var(--font-scale));
  color: var(--muted);
}

.modal-input {
  width: 100%;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 0.45rem 0.5rem;
  outline: none;
}

.modal-input:focus {
  border-color: var(--fg);
}

.modal-textarea {
  resize: vertical;
  min-height: 4rem;
}

input.modal-input[type="file"] {
  padding: 0.35rem 0;
  border-style: dashed;
}

#admin-fatal:empty {
  display: none;
}

/* Admin */
.admin-page {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 2.5rem;
  min-height: 100vh;
}

.admin-header {
  margin-bottom: 1.25rem;
}

.admin-back {
  font-size: calc(0.8rem * var(--font-scale));
  color: var(--muted);
  text-decoration: none;
}

.admin-back:hover {
  color: var(--fg);
}

.admin-h1 {
  margin: 0.5rem 0 0.35rem;
  font-size: calc(1.15rem * var(--font-scale));
  font-weight: 600;
}

.admin-lead {
  margin: 0;
  font-size: calc(0.82rem * var(--font-scale));
  line-height: 1.5;
  color: var(--muted);
}

.admin-card {
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.1rem;
  background: var(--bg);
}

.admin-label {
  display: block;
  font-size: calc(0.7rem * var(--font-scale));
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.admin-pin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-input {
  flex: 1;
  min-width: 8rem;
  padding: 0.45rem 0.5rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
}

.admin-input:focus {
  outline: none;
  border-color: var(--fg);
}

.admin-hint {
  margin: 0.65rem 0 0;
  font-size: calc(0.76rem * var(--font-scale));
  color: var(--muted);
}

.admin-hint code {
  font-size: calc(0.9em * var(--font-scale));
}

.admin-error {
  margin: 0.5rem 0 0;
  font-size: calc(0.8rem * var(--font-scale));
  color: #c96b6b;
}

[data-theme="light"] .admin-error {
  color: #a34444;
}

.admin-save-status {
  margin: 0;
  min-height: 0;
}

.admin-save-status:not(:empty) {
  margin: 0 0 0.75rem;
  font-size: calc(0.8rem * var(--font-scale));
  line-height: 1.35;
}

.admin-list-hint {
  margin: 0 0 0.65rem;
  font-size: calc(0.78rem * var(--font-scale));
  color: var(--muted);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(60vh, 28rem);
  overflow-y: auto;
  margin-bottom: 1rem;
}

.admin-row {
  border-bottom: var(--rule) solid var(--line);
  padding: 0.45rem 0;
}

.admin-row:last-child {
  border-bottom: none;
}

.admin-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.admin-visible {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.admin-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.admin-item-id {
  font-size: calc(0.68rem * var(--font-scale));
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-item-title {
  font-size: calc(0.88rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.3;
}

.admin-item-cat {
  font-size: calc(0.72rem * var(--font-scale));
  color: var(--muted);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.admin-toolbar .btn-rail {
  width: auto;
}

.admin-status {
  font-size: calc(0.78rem * var(--font-scale));
  color: var(--muted);
}

.admin-header--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-signout-btn {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  padding: 0.28rem 0.5rem;
  font-size: calc(0.68rem * var(--font-scale));
  font-weight: 500;
}

.admin-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: var(--rule) solid var(--line);
  padding-bottom: 0.35rem;
}

.admin-tab {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: calc(0.82rem * var(--font-scale));
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-radius: var(--radius);
}

.admin-tab:hover {
  color: var(--fg);
}

.admin-tab--active {
  color: var(--fg);
  font-weight: 600;
  box-shadow: inset 0 calc(-1 * var(--rule)) 0 0 var(--fg);
}

.admin-h2 {
  margin: 0 0 0.75rem;
  font-size: calc(0.95rem * var(--font-scale));
  font-weight: 600;
}

.admin-input--block {
  display: block;
  width: 100%;
}

.admin-textarea {
  resize: vertical;
  min-height: 4rem;
}

.admin-checkrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.65rem 0;
  font-size: calc(0.84rem * var(--font-scale));
  cursor: pointer;
}

.admin-muted {
  font-size: calc(0.78rem * var(--font-scale));
  color: var(--muted);
}

.admin-toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.btn-rail--small {
  padding: 0.35rem 0.45rem;
  font-size: calc(0.72rem * var(--font-scale));
}

.btn-rail--danger {
  border-color: rgba(201, 107, 107, 0.55);
  color: #c96b6b;
}

[data-theme="light"] .btn-rail--danger {
  color: #a34444;
  border-color: rgba(163, 68, 68, 0.45);
}

.btn-rail--danger:hover {
  border-color: #c96b6b;
}

.admin-thumb {
  width: 4.25rem;
  height: 4.25rem;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  border: var(--rule) solid var(--line);
}

.admin-thumb--heic {
  background: var(--surface);
}

.admin-thumb--heic-failed {
  object-fit: contain;
  opacity: 0.65;
}

.admin-thumb--empty {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    #ffffff 4px,
    #ffffff 6px
  );
}

[data-theme="light"] .admin-thumb--empty {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    #0a0a0a 4px,
    #0a0a0a 6px
  );
}

.admin-listing-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.admin-listing-main {
  flex: 1;
  min-width: 0;
}

.admin-listing-title {
  font-weight: 600;
  font-size: calc(0.92rem * var(--font-scale));
}

.admin-listing-meta {
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.15rem;
}

.admin-badge {
  display: inline-block;
  font-size: calc(0.68rem * var(--font-scale));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: var(--radius);
  border: var(--rule) solid var(--line);
}

.admin-badge--on {
  color: var(--fg);
}

.admin-badge--off {
  color: var(--muted);
}

.admin-badge--pending {
  border-color: rgba(200, 160, 80, 0.5);
  color: #d4b060;
}

.admin-badge--accepted {
  border-color: rgba(100, 180, 120, 0.45);
  color: #7dcd96;
}

.admin-badge--rejected {
  border-color: rgba(201, 107, 107, 0.45);
  color: #c96b6b;
}

.admin-badge--shipped {
  border-color: rgba(120, 160, 220, 0.5);
  color: #8ab4f8;
}

.admin-badge--delivered {
  border-color: rgba(100, 180, 120, 0.45);
  color: #7dcd96;
}

.admin-sub-row {
  margin-bottom: 1rem;
}

.admin-delivery-row {
  margin-bottom: 1rem;
}

.admin-delivery-title {
  margin: 0.35rem 0 0.15rem;
  font-size: calc(0.88rem * var(--font-scale));
}

.admin-delivery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem 1rem;
  margin-top: 0.65rem;
  font-size: calc(0.78rem * var(--font-scale));
  line-height: 1.35;
}

.admin-delivery-address-wrap {
  margin-top: 0.75rem;
  font-size: calc(0.78rem * var(--font-scale));
  line-height: 1.35;
}

.admin-delivery-address {
  margin-top: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius);
  border: var(--rule) solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-delivery-status-label {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-deliveries-h2 {
  margin: 1.25rem 0 0.65rem;
  font-size: calc(0.92rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
}

.admin-deliveries-h2:first-child {
  margin-top: 0;
}

.admin-delivery-section-title {
  margin: 0.65rem 0 0.35rem;
  font-size: calc(0.72rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-code {
  font-family: ui-monospace, monospace;
  font-size: 0.88em;
}

.admin-sub-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.admin-sub-notes {
  font-size: calc(0.82rem * var(--font-scale));
  line-height: 1.45;
  margin: 0.35rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-media-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.admin-sub-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.5rem;
  margin: 0.55rem 0;
}

.admin-sub-thumb {
  display: block;
  color: inherit;
  text-decoration: none;
}

.admin-sublink {
  font-size: calc(0.72rem * var(--font-scale));
  color: var(--fg);
}

.admin-sublink--video {
  align-self: center;
  padding: 0.35rem 0.45rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.admin-contact-toolbar {
  margin-top: 0.65rem;
}

.admin-contact-link {
  width: auto;
  text-decoration: none;
}

.admin-message-thread {
  margin-bottom: 1rem;
}

.admin-message-thread-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.admin-message-bubble {
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.6rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.admin-message-bubble--admin {
  margin-left: 2rem;
}

.admin-message-bubble--user {
  margin-right: 2rem;
}

.admin-message-bubble-meta,
.admin-message-bubble-text {
  margin: 0;
}

.admin-message-bubble-meta {
  margin-bottom: 0.18rem;
  font-size: calc(0.66rem * var(--font-scale));
  font-weight: 700;
  color: var(--muted);
}

.admin-message-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: calc(0.78rem * var(--font-scale));
  line-height: 1.45;
}

.admin-message-reply-form {
  margin-top: 0.65rem;
}

/* ── Listings card grid (admin) ─────────────────────────────────────── */
.admin-listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.admin-listing-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-card-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

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

.admin-card-thumb--empty {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    var(--line) 5px,
    var(--line) 7px
  );
}

/* ── Two-column listing editor ──────────────────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  align-items: start;
}

.editor-col {
  min-width: 0;
}

.editor-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0 0.85rem;
}

.editor-empty {
  margin: 0.4rem 0 0.85rem;
  font-size: calc(0.76rem * var(--font-scale));
  color: var(--muted);
}

.editor-img-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.editor-img-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

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

.editor-img-thumb--busy {
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-img-busy {
  font-size: calc(0.64rem * var(--font-scale));
  color: var(--muted);
}

.editor-img-cover-badge {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  z-index: 1;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.32rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
}

.editor-img-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.editor-img-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.26rem 0.2rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.editor-img-btn:hover:not(:disabled) {
  border-color: var(--fg);
}

.editor-img-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.editor-img-btn--danger {
  color: #c96b6b;
  border-color: rgba(201, 107, 107, 0.5);
}

[data-theme="light"] .editor-img-btn--danger {
  color: #a34444;
}

.editor-video {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.6rem;
  font-size: calc(0.76rem * var(--font-scale));
  color: var(--muted);
}

@media (max-width: 720px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Crop modal ─────────────────────────────────────────────────────── */
.crop-modal {
  width: min(26rem, 100%);
  max-height: min(94vh, 44rem);
}

.crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage-img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.crop-status {
  margin: 0.55rem 0 0;
  font-size: calc(0.72rem * var(--font-scale));
  color: var(--muted);
  text-align: center;
}

.crop-controls {
  margin-top: 0.6rem;
}

.crop-zoom {
  width: 100%;
}

/* ── Grid cell: clickable + 2×2 expanded state ─────────────────────── */
.grid-cell {
  cursor: pointer;
}

.grid-cell--expanded {
  grid-column: span 2;
  grid-row: span 2;
  cursor: default;
  border-color: var(--fg);
  /* Same width as two columns → square box (exactly 2×2 track footprint); content clips inside */
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: none;
  min-width: 0;
  min-height: 0;
  justify-self: stretch;
  justify-content: flex-start;
  /* Inner min-width:0 + overflow on flex descendants stops spanning tile min-content from widening 1fr tracks */
}

/*
 * Tiles only draw right + bottom borders; the left edge comes from the neighbor's right border.
 * When a 1-row tile is to the upper-left and nothing continues that seam through the lower
 * half, app.js adds .grid-cell--expanded--leftfill and --expanded-leftfill-left (viewport delta).
 */
.grid-cell--expanded.grid-cell--expanded--leftfill {
  overflow: visible;
}

.grid-cell--expanded.grid-cell--expanded--leftfill::before {
  content: "";
  display: block;
  position: absolute;
  left: var(--expanded-leftfill-left, 0px);
  top: 50%;
  bottom: 0;
  width: var(--rule);
  height: auto;
  margin: 0;
  padding: 0;
  box-sizing: content-box;
  border: none;
  background: var(--line);
  pointer-events: none;
  z-index: 1;
}

.grid-cell--expanded .cell-media {
  flex: 1;
  min-width: 0;
  min-height: 0;
  aspect-ratio: unset;
  touch-action: pan-y;
}

.grid-cell--expanded .cell-desc,
.grid-cell--expanded .cell-title,
.grid-cell--expanded .cell-issues {
  display: none !important;
}

.grid-cell--expanded .clamp-2 {
  -webkit-line-clamp: 5;
}

/* Compound selector beats `.grid-cell--expanded { grid-row/grid-column }` so the tile stays top-right. */
.grid-cell.grid-cell--expanded.grid-cell--account {
  cursor: default;
  justify-content: flex-start;
  gap: 0.55rem;
  width: min(100%, calc(var(--grid-tile-min) * 2));
  max-width: calc(var(--grid-tile-min) * 2);
  justify-self: end;
  /* Top-right 2×2: anchor to last columns, independent of DOM order */
  grid-row: 1 / span 2;
  grid-column: span 2 / -1;
  position: relative;
  z-index: 2;
  border-left: var(--rule) solid var(--line);
}

.grid.grid--account-open .grid-cell.grid-cell--expanded.grid-cell--account {
  position: static;
  top: auto;
  right: auto;
  width: min(100%, 68rem);
  max-width: 68rem;
  height: auto;
  grid-row: auto;
  grid-column: 1 / -1;
  justify-self: center;
  z-index: 3;
  border: none;
  padding: 0;
  background: transparent;
  aspect-ratio: auto;
}

.grid.grid--account-open .grid-cell.grid-cell--expanded.grid-cell--account .account-tile-body {
  min-height: auto;
  overflow: visible;
}

/* Keep summary pinned to top-left in account views. */
body.shop[data-shop-view="wishlist"] .grid-cell--view-summary,
body.shop[data-shop-view="orders"] .grid-cell--view-summary,
body.shop[data-shop-view="policies"] .grid-cell--view-summary {
  grid-column: 1;
  grid-row: 1;
}

body.shop[data-shop-view="basket"] .grid-cell--view-summary {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}

.view-summary-hint--legal-placeholder {
  font-size: calc(0.62rem * var(--font-scale));
}

/* ── Legal policy tiles (Terms / Privacy / Cookies) ── */
.grid-cell--policy {
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.32rem;
  cursor: default;
}

.policy-tile-title {
  margin: 0;
  flex-shrink: 0;
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}

.policy-tile-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.policy-tile-p {
  margin: 0 0 0.55em;
  font-size: calc(0.65rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.42;
  color: var(--fg);
}

.policy-tile-p:last-child {
  margin-bottom: 0;
}

/* ── Wishlist / basket / orders: summary in first (top-left) grid cell — same square as other tiles ── */
.grid-cell--view-summary {
  justify-content: flex-start;
  align-items: stretch;
  cursor: default;
  gap: 0.24rem;
}

.view-summary-head {
  flex-shrink: 0;
}

.view-summary-title {
  margin: 0;
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}

.view-summary-meta {
  margin: 0;
  font-size: calc(0.72rem * var(--font-scale));
  font-weight: 600;
  color: var(--muted);
}

.view-summary-hint {
  margin: 0;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  font-size: calc(0.68rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
}

.view-summary-back {
  align-self: stretch;
  width: 100%;
  margin-top: auto;
  flex: 0 0 auto;
  padding: 0.2rem 0.45rem;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.view-summary-footer {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  align-self: stretch;
}

.view-summary-footer .view-summary-back {
  margin-top: 0;
}

.view-summary-back:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--fg) 30%);
}

.view-summary-back:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

.view-summary-checkout {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.view-summary-checkout__summary {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 600;
  line-height: 1.25;
  color: var(--muted);
}

.view-summary-checkout__row strong {
  font-weight: 700;
  color: var(--fg);
}

.view-summary-checkout__hint {
  margin: 0;
  flex-shrink: 0;
  font-size: calc(0.56rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.view-summary-checkout__hint--warn {
  color: #c96b6b;
  font-weight: 600;
}

[data-theme="light"] .view-summary-checkout__hint--warn {
  color: #a34444;
}

.view-summary-checkout__claim {
  flex-shrink: 0;
  margin-top: 0.05rem;
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.view-summary-checkout__msg {
  margin: 0;
  flex-shrink: 0;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.3;
  color: var(--muted);
}

.view-summary-giveaway-action {
  width: 100%;
}

body.shop[data-shop-view="orders"] .view-summary-footer,
body.shop[data-shop-view="giveaways"] .view-summary-footer {
  align-self: flex-start;
  width: auto;
  margin-top: 0.45rem;
}

body.shop[data-shop-view="orders"] .view-summary-giveaway-action,
body.shop[data-shop-view="giveaways"] .view-summary-giveaway-action {
  width: auto;
}

.account-list-row {
  list-style: none;
  width: min(100%, 68rem);
  max-width: 68rem;
  justify-self: center;
  min-width: 0;
}

.account-accordion {
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.account-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.72rem 0.85rem;
  cursor: pointer;
  list-style: none;
}

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

.account-accordion-summary::before {
  content: "+";
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1;
}

.account-accordion[open] .account-accordion-summary::before {
  content: "-";
}

.account-accordion-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.account-accordion-title {
  font-size: calc(0.82rem * var(--font-scale));
  font-weight: 750;
  line-height: 1.3;
  color: var(--fg);
}

.account-accordion-meta {
  font-size: calc(0.66rem * var(--font-scale));
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
}

.account-status {
  flex-shrink: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 0.16rem 0.42rem;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
}

.account-status--delivery-pending,
.giveaway-status--pending {
  color: #d4b060;
}

.account-status--delivery-shipped {
  color: #8ab4f8;
}

.account-status--delivery-delivered,
.giveaway-status--accepted {
  color: #7dcd96;
}

.giveaway-status--rejected {
  color: #c96b6b;
}

.account-accordion-panel {
  border-top: var(--rule) solid var(--line);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.account-list-description {
  margin: 0;
  font-size: calc(0.78rem * var(--font-scale));
  line-height: 1.45;
  color: var(--fg);
}

.account-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.account-tile-heading {
  min-width: 0;
}

.account-tile-title {
  margin: 0;
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-tile-username {
  margin: 0.14rem 0 0;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tile-close {
  width: 1.6rem;
  height: 1.6rem;
  min-width: 1.6rem;
  padding: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.9rem * var(--font-scale));
  line-height: 1;
  cursor: pointer;
}

.account-tile-body {
  min-height: 0;
  overflow: auto;
}

.grid-cell.grid-cell--expanded.grid-cell--flow-tile {
  grid-row: span 3;
  aspect-ratio: 2 / 3;
  cursor: default;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.75rem;
  overflow: hidden;
}

.grid-cell.grid-cell--expanded.grid-cell--flow-tile.grid-cell--expanded--leftfill {
  overflow: visible;
}

body.shop[data-shop-view="submit"] .grid,
body.shop[data-shop-view="settings"] .grid,
body.shop[data-shop-view="topup"] .grid,
body.shop[data-shop-view="policies"] .grid {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  padding: 1.15rem clamp(0.85rem, 4vw, 2rem) 0;
}

body.shop[data-shop-view="orders"] .grid,
body.shop[data-shop-view="giveaways"] .grid {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 0.55rem;
  padding: 1.15rem clamp(0.85rem, 4vw, 2rem) 0;
}

body.shop[data-shop-view="orders"] .grid-cell--view-summary,
body.shop[data-shop-view="giveaways"] .grid-cell--view-summary {
  grid-column: 1 / -1;
  grid-row: auto;
  width: min(100%, 68rem);
  max-width: 68rem;
  min-height: auto;
  aspect-ratio: auto;
  justify-self: center;
  border: none;
  padding: 0;
  background: transparent;
}

body.shop[data-shop-view="submit"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile,
body.shop[data-shop-view="settings"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile,
body.shop[data-shop-view="topup"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile {
  grid-column: 1 / -1;
  grid-row: auto;
  aspect-ratio: auto;
  width: min(100%, 68rem);
  max-width: 68rem;
  justify-self: center;
  border: none;
  padding: 0;
  background: transparent;
}

body.shop[data-shop-view="policies"] .grid-cell--policy {
  grid-column: 1 / -1;
  grid-row: auto;
  aspect-ratio: auto;
  width: min(100%, 68rem);
  max-width: 68rem;
  justify-self: center;
  border: none;
  padding: 0 0 0.9rem;
  background: transparent;
  overflow: visible;
}

body.shop[data-shop-view="policies"] .policy-tile-title {
  font-size: calc(1rem * var(--font-scale));
}

body.shop[data-shop-view="policies"] .policy-tile-body {
  overflow: visible;
}

body.shop[data-shop-view="policies"] .policy-tile-p {
  font-size: calc(0.82rem * var(--font-scale));
  line-height: 1.55;
}

body.shop[data-shop-view="submit"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile .flow-tile-body,
body.shop[data-shop-view="settings"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile .flow-tile-body,
body.shop[data-shop-view="topup"] .grid-cell.grid-cell--expanded.grid-cell--flow-tile .flow-tile-body {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

.flow-tile-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-shrink: 0;
}

.flow-tile-back {
  flex-shrink: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.24rem 0.42rem;
  cursor: pointer;
}

.flow-tile-back:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--fg) 30%);
}

.flow-tile-title {
  margin: 0;
  font-size: calc(0.78rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-tile-intro {
  margin: 0;
  flex-shrink: 0;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.flow-tile-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.flow-tile-body .submit-form {
  margin-top: 0;
}

.flow-tile-body .modal-label {
  font-size: calc(0.58rem * var(--font-scale));
  margin-top: 0.4rem;
}

.flow-tile-body .modal-input {
  padding: 0.34rem 0.42rem;
  font-size: calc(0.68rem * var(--font-scale));
}

.flow-tile-body .modal-text {
  font-size: calc(0.62rem * var(--font-scale));
  line-height: 1.35;
}

.flow-tile-body .modal-actions {
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.flow-tile-body .btn-rail {
  width: auto;
  padding: 0.38rem 0.5rem;
  font-size: calc(0.62rem * var(--font-scale));
  white-space: normal;
}

body.shop[data-shop-view="submit"] .flow-tile-body .modal-actions,
body.shop[data-shop-view="settings"] .flow-tile-body .modal-actions,
body.shop[data-shop-view="topup"] .flow-tile-body .modal-actions,
body.shop[data-shop-view="account"] .account-tile-body .modal-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
}

body.shop[data-shop-view="account"] .account-tile-body .btn-rail,
body.shop[data-shop-view="account"] .account-menu.account-menu--tile .account-menu__item {
  width: auto;
  align-self: flex-start;
}

.grid-cell--message-thread {
  justify-content: flex-start;
  align-items: stretch;
  cursor: default;
  gap: 0.3rem;
}

.message-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  flex-shrink: 0;
}

.message-thread-title {
  margin: 0;
  font-size: calc(0.72rem * var(--font-scale));
  font-weight: 700;
  line-height: 1.25;
}

.message-thread-unread {
  flex-shrink: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 0.08rem 0.28rem;
  font-size: calc(0.52rem * var(--font-scale));
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-thread-meta {
  margin: 0;
  flex-shrink: 0;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 600;
  color: var(--muted);
}

.message-thread-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.message-bubble {
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 0.3rem 0.38rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.message-bubble--mine {
  margin-left: 0.7rem;
}

.message-bubble--admin {
  margin-right: 0.7rem;
}

.message-bubble-meta,
.message-bubble-text {
  margin: 0;
}

.message-bubble-meta {
  margin-bottom: 0.12rem;
  font-size: calc(0.5rem * var(--font-scale));
  font-weight: 700;
  color: var(--muted);
}

.message-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: calc(0.6rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.35;
}

.message-reply-form {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.message-reply-label {
  font-size: calc(0.52rem * var(--font-scale));
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.message-reply-input {
  width: 100%;
  min-height: 3.1rem;
  resize: vertical;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.62rem * var(--font-scale));
  padding: 0.32rem 0.38rem;
}

.message-reply-actions {
  display: flex;
  gap: 0.28rem;
}

.message-reply-actions .btn-rail {
  width: auto;
  padding: 0.28rem 0.4rem;
  font-size: calc(0.56rem * var(--font-scale));
}

.message-reply-status {
  min-height: 0.8rem;
  margin: 0;
  font-size: calc(0.54rem * var(--font-scale));
  color: var(--muted);
}

.grid-cell--giveaway {
  justify-content: flex-start;
  align-items: stretch;
  cursor: default;
  gap: 0.28rem;
  grid-column: span 2;
  grid-row: span 2;
}

.giveaway-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  flex-shrink: 0;
}

.giveaway-title {
  margin: 0;
  font-size: calc(0.72rem * var(--font-scale));
  font-weight: 700;
  line-height: 1.25;
}

.giveaway-status {
  flex-shrink: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  padding: 0.08rem 0.28rem;
  font-size: calc(0.5rem * var(--font-scale));
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.giveaway-status--pending {
  color: #d4b060;
}

.giveaway-status--accepted {
  color: #7dcd96;
}

.giveaway-status--rejected {
  color: #c96b6b;
}

.giveaway-meta,
.giveaway-contact,
.giveaway-messages-title,
.giveaway-messages-empty {
  margin: 0;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
}

.giveaway-notes {
  margin: 0;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: calc(0.62rem * var(--font-scale));
  font-weight: 500;
  line-height: 1.35;
}

.giveaway-contact {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  flex-shrink: 0;
}

.giveaway-message-links {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.giveaway-message-link {
  width: 100%;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.56rem * var(--font-scale));
  font-weight: 700;
  line-height: 1.25;
  padding: 0.22rem 0.34rem;
  text-align: left;
  cursor: pointer;
}

.giveaway-message-link:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--fg) 30%);
}

/* ── Hide native scrollbars (main grid + rail body) ─────────────────── */
.main-scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.main-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.rail-body {
  scrollbar-width: none;
}
.rail-body::-webkit-scrollbar {
  width: 0;
  display: none;
}

/* ── Main grid proxy scrollbar (right strip, same band as account column) ─ */
.main-edge-scrollbar {
  position: fixed;
  right: 0;
  top: var(--logo-size);
  bottom: calc(var(--shop-footer-fixed-h) + env(safe-area-inset-bottom, 0px));
  width: var(--account-rail-width);
  z-index: 200;
  pointer-events: none;
  box-sizing: border-box;
}
.main-edge-scrollbar[hidden] {
  display: none;
}
.main-edge-scrollbar__thumb {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  top: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #fff;
  opacity: 1;
  cursor: grab;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  box-sizing: border-box;
}
.main-edge-scrollbar__thumb:hover {
  filter: brightness(0.92);
}
.main-edge-scrollbar__thumb:active {
  cursor: grabbing;
  filter: brightness(0.85);
}

[data-theme="light"] .main-edge-scrollbar__thumb {
  background: var(--fg);
}

/* ── Header balance (pence in DB, £ in UI) ───────────────────────────── */
.credit-chip {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: calc(0.7rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transform: translateX(-0.45rem);
}
.credit-chip[hidden] {
  display: none;
}

.cell-claim-price {
  font-size: calc(0.6rem * var(--font-scale));
  font-weight: 700;
  color: var(--muted);
  margin-left: 0.28rem;
  white-space: nowrap;
}

.grid-cell--claimed {
  opacity: 0.6;
}
.grid-cell--claimed .cell-img,
.grid-cell--claimed .cell-vid {
  filter: grayscale(0.6);
}
.cell-claimed-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  font-size: calc(0.6rem * var(--font-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
  pointer-events: none;
}

.cell-claimed-badge--pending {
  background: var(--fg);
  color: var(--bg);
}

.cell-claimed-badge--shipped {
  background: color-mix(in srgb, #6b9dc9 72%, var(--bg));
  color: var(--fg);
  border: calc(var(--rule) * 0.35) solid var(--line);
}

.cell-claimed-badge--delivered {
  background: color-mix(in srgb, #7ab88a 75%, var(--bg));
  color: var(--fg);
  border: calc(var(--rule) * 0.35) solid var(--line);
}

[data-theme="light"] .cell-claimed-badge--shipped {
  background: color-mix(in srgb, #3a6a9a 28%, var(--surface));
}

[data-theme="light"] .cell-claimed-badge--delivered {
  background: color-mix(in srgb, #2d6a3f 22%, var(--surface));
}

.grid-cell--expanded .cell-saved-dots {
  display: none;
}

.cell-saved-dots {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.32rem;
  position: absolute;
  left: 0.35rem;
  bottom: 0.35rem;
  z-index: 2;
  pointer-events: none;
}

.cell-saved-dot {
  width: 0.72rem;
  height: 0.72rem;
  min-width: 0.72rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--bg) 55%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

.cell-saved-dot--wish {
  background: #c62828;
}

.cell-saved-dot--basket {
  background: #2e7d32;
}

[data-theme="light"] .cell-saved-dot {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

/* ── Action buttons on expanded cells (Wishlist / Basket) ───────────── */
.cell-actions {
  display: none;
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  gap: 0.32rem;
  flex-wrap: nowrap;
  margin: 0;
  flex-shrink: 0;
}
.grid-cell--expanded .cell-actions {
  display: flex;
}
.cell-action-btn {
  width: 1.7rem;
  height: 1.7rem;
  min-width: 1.7rem;
  padding: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.cell-action-btn:hover:not(:disabled) {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--bg) 66%, transparent);
}
.cell-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cell-action-btn[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.cell-action-btn--wish[aria-pressed="true"] {
  background: #c62828;
  color: #fafafa;
  border-color: #c62828;
}

.cell-action-btn--wish[aria-pressed="true"]:hover:not(:disabled) {
  background: #b71c1c;
  border-color: #b71c1c;
}

.cell-action-btn--basket[aria-pressed="true"] {
  background: #2e7d32;
  color: #fafafa;
  border-color: #2e7d32;
}

.cell-action-btn--basket[aria-pressed="true"]:hover:not(:disabled) {
  background: #1b5e20;
  border-color: #1b5e20;
}

.cell-action-icon {
  width: 0.88rem;
  height: 0.88rem;
  fill: currentColor;
  display: block;
}

.cell-media-expand-row {
  display: none;
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 7;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.grid-cell--expanded .cell-media-expand-row {
  display: flex;
}

.cell-details-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  min-width: 1.7rem;
  padding: 0;
  margin: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.cell-details-btn:hover {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--bg) 66%, transparent);
}

.cell-details-btn .cell-action-icon {
  width: 0.92rem;
  height: 0.92rem;
}

.cell-zoom-btn {
  display: inline-flex;
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 1.7rem;
  height: 1.7rem;
  min-width: 1.7rem;
  padding: 0;
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  color: var(--fg);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.cell-zoom-btn:hover {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--bg) 66%, transparent);
}

.cell-media-details-card {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 0.65rem;
  background: var(--surface);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  overflow: auto;
}

/* `display: flex` above beats the UA [hidden] rule — force hidden tiles off */
.cell-media-details-card[hidden] {
  display: none !important;
}

.cell-media-details-title {
  margin: 0;
  font-size: calc(0.82rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.28;
  word-break: break-word;
  color: var(--fg);
}

.cell-media-details-flaws-label {
  margin: 0.35rem 0 0;
  font-size: calc(0.58rem * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cell-media-details-text {
  margin: 0;
  font-size: calc(0.62rem * var(--font-scale));
  line-height: 1.28;
  color: var(--fg);
  word-break: break-word;
}

/* Collapsed tiles: show cover (photo/video) only — never the in-media “Details” card */
.grid-cell:not(.grid-cell--expanded) .cell-media-details-card {
  display: none !important;
}

.grid-cell:not(.grid-cell--expanded) .cell-media .cell-img,
.grid-cell:not(.grid-cell--expanded) .cell-media .cell-vid {
  display: block !important;
}

.cell-media-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  width: 1.55rem;
  height: 1.55rem;
  min-width: 1.55rem;
  padding: 0;
  border: var(--rule) solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--fg);
  align-items: center;
  justify-content: center;
  line-height: 0;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.cell-media-nav-icon {
  width: 0.72rem;
  height: 0.72rem;
  display: block;
  flex-shrink: 0;
}

.cell-media-nav--prev {
  left: 0.35rem;
}

.cell-media-nav--next {
  right: 0.35rem;
}

.grid-cell--expanded .cell-media-nav {
  display: inline-flex;
}

/* ── Account menu dropdown (under the account button) ───────────────── */
.account-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.45rem;
  min-width: 13rem;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem;
  background: var(--bg);
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.account-menu[hidden] {
  display: none;
}
[data-theme="light"] .account-menu {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
}
.account-menu__email {
  margin: 0 0 0.15rem;
  padding: 0.2rem 0.4rem 0.35rem;
  font-size: calc(0.66rem * var(--font-scale));
  color: var(--muted);
  border-bottom: var(--rule) solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu__balance {
  margin: 0.1rem 0 0.3rem;
  padding: 0 0.4rem;
  font-size: calc(0.7rem * var(--font-scale));
  font-weight: 700;
  color: var(--fg);
}

.account-menu__status {
  margin: 0.05rem 0.35rem 0.35rem;
  padding: 0.28rem 0.38rem;
  font-size: calc(0.58rem * var(--font-scale));
  line-height: 1.35;
  border: calc(var(--rule) * 0.5) solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(244, 244, 242, 0.04);
}

[data-theme="light"] .account-menu__status {
  background: rgba(10, 10, 10, 0.04);
}

.account-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0 0.12rem;
}

.account-menu__top .account-menu__balance {
  margin: 0;
  padding: 0.2rem 0.28rem;
}

.account-menu__divider {
  height: 0;
  border-top: var(--rule) solid var(--line);
  margin: 0.1rem 0.28rem 0.2rem;
}

/* Orders & delivery — listing text first, then order meta + checkout snapshot */
.cell-order-meta {
  margin: 0.35rem 0 0;
  padding-top: 0.32rem;
  border-top: calc(var(--rule) * 0.5) solid var(--line);
  font-size: calc(0.57rem * var(--font-scale));
  line-height: 1.35;
}

.cell-order-meta__row {
  margin: 0;
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.38rem;
  align-items: start;
}

.cell-order-meta__row + .cell-order-meta__row {
  margin-top: 0.2rem;
}

.cell-order-meta__label {
  font-weight: 600;
  color: var(--muted);
}

.cell-order-meta__value {
  font-weight: 500;
  color: var(--fg);
}

.cell-order-shipping {
  margin: 0.4rem 0 0;
  font-size: calc(0.57rem * var(--font-scale));
  border-radius: var(--radius);
  border: calc(var(--rule) * 0.5) solid var(--line);
  padding: 0.28rem 0.45rem;
  background: rgba(244, 244, 242, 0.04);
}

[data-theme="light"] .cell-order-shipping {
  background: rgba(10, 10, 10, 0.04);
}

.cell-order-shipping__title {
  margin: 0 0 0.32rem;
  font-size: inherit;
  font-weight: 700;
  color: var(--fg);
}

.cell-order-shipping__body {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.cell-order-shipping__row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.38rem;
  align-items: start;
}

.cell-order-shipping__label {
  font-weight: 600;
  color: var(--muted);
}

.cell-order-shipping__value {
  font-weight: 500;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

.grid-cell--order-unavailable .cell-desc {
  color: var(--muted);
}

.grid-cell--order-unavailable .cell-media-placeholder {
  opacity: 0.5;
}

.account-menu__item {
  border: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: calc(0.72rem * var(--font-scale));
  font-weight: 600;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.account-menu__item:hover {
  background: rgba(244, 244, 242, 0.08);
}
[data-theme="light"] .account-menu__item:hover {
  background: rgba(10, 10, 10, 0.05);
}

.account-menu__item--inline {
  width: auto;
  flex-shrink: 0;
  padding: 0.26rem 0.45rem;
  font-size: calc(0.64rem * var(--font-scale));
  letter-spacing: 0.03em;
}

.account-menu.account-menu--tile {
  position: static;
  margin: 0;
  min-width: 0;
  width: 100%;
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: 0;
  gap: 0.25rem;
  align-items: flex-start;
}

.account-menu.account-menu--tile .account-menu__email {
  padding-left: 0;
  padding-right: 0;
}

.account-menu.account-menu--tile .account-menu__balance {
  padding-left: 0;
  padding-right: 0;
}

.account-menu.account-menu--tile .account-menu__top {
  padding: 0;
}

.account-menu.account-menu--tile .account-menu__divider {
  margin-left: 0;
  margin-right: 0;
}

.settings-modal {
  max-width: 26rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.settings-modal__hint {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

/* ── Auth modal (login / signup) ─────────────────────────────────────── */
.auth-modal {
  width: min(36rem, calc(100vw - 2.5rem));
  max-height: min(92vh, 40rem);
}

/* ── Item image viewer modal ─────────────────────────────────────────── */
.item-viewer-backdrop {
  z-index: 260;
}

.item-viewer-modal {
  width: min(58rem, calc(100vw - 2rem));
  max-height: min(94vh, 54rem);
  padding: 0.9rem;
}

.item-viewer-head {
  margin-bottom: 0.5rem;
}

.item-viewer-head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-viewer-count {
  margin: 0;
  font-size: calc(0.72rem * var(--font-scale));
  color: var(--muted);
  white-space: nowrap;
}

.item-viewer-stage {
  position: relative;
}

.item-viewer-media {
  width: 100%;
  height: min(74vh, 42rem);
  border: var(--rule) solid var(--line);
  border-radius: var(--radius);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-viewer-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.item-viewer-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.35) 10px,
    rgba(255, 255, 255, 0.35) 12px
  );
}

.item-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: var(--rule) solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: calc(1.05rem * var(--font-scale));
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.item-viewer-nav:hover:not(:disabled) {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--bg) 64%, transparent);
}

.item-viewer-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.item-viewer-nav--prev {
  left: 0.45rem;
}

.item-viewer-nav--next {
  right: 0.45rem;
}

@media (max-width: 720px) {
  .main-edge-scrollbar {
    display: none !important;
  }
  .account-menu {
    right: 0;
    left: auto;
  }
}
