/* ==================================================================
   STOREFOLD — professional light skin
   Clean, calm, easy-on-eyes surfaces for storefront, studio and console.
   Loaded last so it can normalise every screen. Owner presets and
   themeStyle still supply per-workspace brand hues.
   ================================================================== */

:root {
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .10), 0 2px 8px rgba(16, 24, 40, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  color-scheme: light;
}

html { background: var(--bg, #f4f6fb); }

body {
  color: var(--ink, #111827);
  background: var(--bg, #f4f6fb);
  background-image: none;
}

::selection {
  background: color-mix(in srgb, var(--brand, #4f46e5) 22%, #fff);
  color: var(--ink, #111827);
}

* { scrollbar-color: #cbd5e1 #f1f5f9; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid #f1f5f9; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

a { color: var(--brand, #4f46e5); }
a:hover { color: var(--brand-strong, #3730a3); }

h1, h2, h3, h4,
.section-title, .page-title, .card-title, .display-title { color: var(--ink, #111827); }

.eyebrow, .section-kicker { color: var(--brand-strong, #3730a3); letter-spacing: .08em; }
.muted, .section-sub, .card-sub, .page-sub, .cell-sub, .small.muted { color: var(--muted, #6b7280); }
hr { border-top: 1px solid var(--line, #e5e7eb); }

/* ---------- chrome ---------- */
.topbar, .store-head {
  background: var(--header-bg, rgba(255, 255, 255, .94));
  border-bottom: 1px solid var(--line, #e5e7eb);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 1px 0 rgba(16, 24, 40, .03);
}
.topbar::after, .store-head::after { display: none; }

.brand-word, .store-word, .auth-word {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--brand, #4f46e5);
  filter: none;
  font-weight: 800;
  letter-spacing: .08em;
}
.brand-tag, .store-sub, .auth-sub { color: var(--muted, #6b7280); }

.tabs { gap: 4px; }
.tab, .store-tab {
  color: var(--ink-2, #374151);
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 500;
}
.tab:hover, .store-tab:hover { color: var(--ink, #111827); background: var(--brand-soft, #eef2ff); }
.tab.is-active, .store-tab.is-active {
  color: var(--brand-strong, #3730a3);
  background: var(--brand-soft, #eef2ff);
  border-color: color-mix(in srgb, var(--brand, #4f46e5) 18%, transparent);
  box-shadow: none;
}
.tab { position: relative; white-space: nowrap; }

.tab-badge, .badge-count, [data-orders-badge] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: #dc2626;
  color: #fff;
}

.who, .link-quiet { color: var(--ink-2, #374151); }
.link-quiet:hover { color: var(--brand, #4f46e5); }

.cart-link {
  background: #fff;
  border: 1px solid var(--line-strong, #d1d5db);
  color: var(--ink-2, #374151);
  border-radius: 10px;
  padding: 8px 12px;
}
.cart-link:hover { border-color: var(--brand, #4f46e5); box-shadow: none; }
.cart-count { background: var(--brand, #4f46e5); color: #fff; box-shadow: none; }

.announce {
  background: var(--brand, #4f46e5);
  color: #fff;
  border-bottom: 0;
  text-shadow: none;
  font-size: 13px;
  letter-spacing: .01em;
  padding: 10px 16px;
}

/* ---------- buttons ---------- */
.btn { border-radius: 10px; box-shadow: none; font-weight: 600; }
.btn:hover { transform: none; }
.btn-primary {
  background: var(--brand, #4f46e5);
  color: #fff;
  border-color: var(--brand, #4f46e5);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.btn-primary:hover {
  background: var(--brand-strong, #3730a3);
  color: #fff;
  filter: none;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .12);
}
.btn-bright { background: var(--brand, #4f46e5); color: #fff; border: 0; }
.btn-bright:hover { background: var(--brand-strong, #3730a3); color: #fff; filter: none; }
.btn-ghost { background: #fff; border: 1px solid var(--line-strong, #d1d5db); color: var(--ink-2, #374151); }
.btn-ghost:hover { background: #f8fafc; border-color: #94a3b8; color: var(--ink, #111827); }
.btn-soft { background: var(--brand-soft, #eef2ff); color: var(--brand-strong, #3730a3); }
.btn-danger { background: #fff; color: #b42318; border-color: #f0c9c4; }
.btn-danger:hover { background: #fef2f2; }

/* ---------- surfaces ---------- */
.card, .panel-card, .product-card, .mockup-card, .stat, .step-card, .feature, .auth-card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: var(--shadow-sm);
  color: var(--ink, #111827);
}
.card { border-radius: var(--radius); }
.card-title { color: var(--ink, #111827); }
.stat { border-radius: var(--radius); }
.stat-label { color: var(--muted, #6b7280); }
.stat-value { color: var(--ink, #111827); }

/* ---------- forms ---------- */
.field-label { color: var(--ink-2, #374151); font-weight: 600; }
.input, .select, .textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="date"], input[type="url"],
select, textarea {
  background: #fff;
  color: var(--ink, #111827);
  border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 10px;
}
.input::placeholder, textarea::placeholder { color: #9ca3af; }
.input:focus, .select:focus, .textarea:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--brand, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #4f46e5) 18%, transparent);
  outline: none;
}
.check-row { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.check-row:has(input:checked) {
  border-color: var(--brand, #4f46e5);
  background: var(--brand-soft, #eef2ff);
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { color: var(--muted, #6b7280); font-weight: 600; background: #f8fafc; text-align: left; }
table.data td, table.data th { border-bottom: 1px solid var(--line, #e5e7eb); padding: 10px 12px; vertical-align: top; }
table.data tr:hover td { background: #f9fafb; }

/* ---------- pills ---------- */
.pill {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.pill.ok { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.pill.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.pill.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.pill.danger { background: #fef2f2; color: #b42318; border-color: #fecaca; }
.pill.muted { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

/* ---------- hero ---------- */
.hero, .hero-modern, .section-hero {
  background: var(--hero-bg, linear-gradient(135deg, #f8faff 0%, #eef2ff 100%));
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: var(--shadow-sm);
}
.hero::after, .hero::before { display: none; }
.hero-copy h1, .hero-copy .display-title, .hero-modern h1 { color: var(--ink, #111827); text-shadow: none; }
.hero-copy p, .hero-modern p { color: var(--ink-2, #374151); }

/* ---------- storefront ---------- */
.store-foot { background: var(--footer-bg, #f8fafc); border-top: 1px solid var(--line, #e5e7eb); color: var(--ink-2, #374151); }
.site-foot { background: #fff; border-top: 1px solid var(--line, #e5e7eb); color: var(--muted, #6b7280); }
.foot-brand { color: var(--brand, #4f46e5); }
.product-card { border-radius: 16px; overflow: hidden; }
.product-thumb-link, .garment-wrap { background: #f8fafc; }

/* ---------- studio ---------- */
.stage, .studio-stage, .canvas-wrap, .preview-wrap {
  background: #f8fafc;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
}
.stage-zoom-wrap {
  background: #f3f4f6;
  padding: 8px;
  border-radius: 12px;
  overflow: auto;
  max-height: 72vh;
}

/* paired front + back previews */
.stage-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.stage-pair.has-mockup { grid-template-columns: 1fr; }
.stage-pane {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}
.stage-pane[hidden] { display: none !important; }

.stage { position: relative; width: 100%; margin: 0 auto; }
.garment-layer { position: absolute; inset: 0; }
.garment-layer svg { display: block; width: 100%; height: 100%; }
.art-canvas {
  position: absolute;
  border: 1px dashed color-mix(in srgb, var(--brand, #4f46e5) 35%, #cbd5e1);
  background: transparent;
  touch-action: none;
}
.stage-caption {
  color: var(--muted, #6b7280);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  display: block;
  margin-top: 6px;
}

.side-toggle button, .sheet-toggle button {
  background: #fff;
  color: var(--ink-2, #374151);
  border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 10px;
  padding: 8px 12px;
}
.side-toggle button.is-active, .sheet-toggle button.is-active {
  background: var(--brand-soft, #eef2ff);
  color: var(--brand-strong, #3730a3);
  border-color: color-mix(in srgb, var(--brand, #4f46e5) 30%, transparent);
}
.studio-hint { color: var(--muted, #6b7280); }

.layer-row { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.layer-row.is-active { border-color: var(--brand, #4f46e5); background: var(--brand-soft, #eef2ff); }

.swatch { border: 2px solid #fff; box-shadow: 0 0 0 1px #d1d5db; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--brand, #4f46e5); }

.size-chip { background: #fff; color: var(--ink-2, #374151); border: 1px solid var(--line-strong, #d1d5db); }
.size-chip[aria-pressed="true"] { background: var(--brand-soft, #eef2ff); color: var(--brand-strong, #3730a3); border-color: var(--brand, #4f46e5); }
.size-chip:disabled { opacity: .45; }

/* ---------- production board ---------- */
.prod-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}
.prod-column {
  background: #f8fafc;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prod-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: var(--ink, #111827);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.prod-column header b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  font-size: 12px;
  color: var(--ink-2, #374151);
}
.prod-column > p { margin: 0; }

.prod-card {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.prod-card.is-late { border-color: #fecaca; background: #fffafa; }
.prod-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prod-card a, .prod-meta, .prod-due, .prod-product { overflow-wrap: anywhere; word-break: break-word; }
.prod-meta, .prod-due { font-size: 12.5px; color: var(--muted, #6b7280); }
.prod-due.is-late { color: #b42318; font-weight: 600; }
.prod-toolbar {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- navigation responsiveness ---------- */
.topbar-inner { flex-wrap: wrap; gap: 12px 16px; }
.tabs {
  flex: 1 1 420px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.topbar-right { flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.store-head-inner { flex-wrap: wrap; }
.store-nav {
  flex: 1 1 320px;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 10px;
  overflow: visible;
}
.store-actions { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- overflow + readability ---------- */
.page, .card, .panel-card, .prod-card, .msg-body, .timeline-body, .product-title,
.hero-copy, .cell-main, .mini-row, .inbox-row, .receipt-row, .order-summary-row {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.page-title, .section-title { line-height: 1.2; }
img { max-width: 100%; height: auto; }
pre, code { white-space: pre-wrap; word-break: break-word; }
.table-wrap, .data, .split, .studio-shell, .inbox-shell { min-width: 0; }

/* ---------- admin toasts ---------- */
.admin-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  pointer-events: none;
  z-index: 120;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}
.admin-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-left: 4px solid var(--brand, #4f46e5);
  border-radius: 12px;
  padding: 12px 12px 12px 14px;
  box-shadow: var(--shadow-lg);
}
.admin-toast > div { min-width: 0; display: grid; gap: 2px; }
.admin-toast strong { color: var(--ink, #111827); font-size: 13px; }
.admin-toast span {
  color: var(--muted, #6b7280);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-toast-close {
  background: transparent;
  border: 0;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* ---------- auth + notices ---------- */
.auth-body { background: var(--bg, #f4f6fb); }
.auth-card { border-radius: 16px; }
.flash, .flash-ok, .flash-error { border-radius: 10px; padding: 12px 14px; }
.flash-ok { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #b42318; border: 1px solid #fecaca; }
.notice, .notice-teal, .notice-soft { border-radius: 10px; }
.notice-teal { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.warn-text { color: #92400e; }

/* ---------- inbox ---------- */
.msg { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px 12px; }
.msg.staff { background: #f8fafc; }
.chat { min-height: 280px; max-height: 60vh; overflow: auto; }

/* ---------- layout safety ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.split > * { min-width: 0; }
.studio-shell { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.studio-shell > * { min-width: 0; }

/* ---------- studio: combined + separate stages ---------- */
.stage-pane { display: grid; gap: 6px; align-content: start; }
.stage-pane-combined { background: #fff; }
.stage-separate {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.stage .mockup-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.preview-canvas {
  border-style: solid;
  border-color: color-mix(in srgb, var(--brand, #4f46e5) 22%, #dbe3ef);
  pointer-events: none;
}
.stage-zoom-inner { display: grid; gap: 0; }

/* ---------- production board extras ---------- */
.prod-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.prod-stat {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.prod-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #6b7280); font-weight: 700; }
.prod-stat strong { font-size: 20px; line-height: 1.1; color: var(--ink, #111827); font-variant-numeric: tabular-nums; }
.prod-stat.is-late { border-color: #fecaca; background: #fff5f5; }
.prod-stat.is-late strong { color: #b42318; }

.prod-toolbar-hint { margin-left: auto; }
.prod-column-hint { color: var(--muted, #6b7280); font-size: 12px; }
.prod-column-body { display: grid; gap: 10px; }
.prod-empty {
  margin: 0;
  padding: 16px 12px;
  border: 1px dashed #dbe3ef;
  border-radius: 10px;
  background: #fff;
  color: var(--muted, #6b7280);
  font-size: 12.5px;
  text-align: center;
}
.prod-card-top { justify-content: flex-start; flex-wrap: wrap; row-gap: 6px; }
.prod-select { display: inline-flex; align-items: center; margin-right: 2px; }
.prod-select input { width: 16px; height: 16px; accent-color: var(--brand, #4f46e5); }
.prod-order { font-weight: 700; color: var(--ink, #111827); text-decoration: none; }
.prod-order:hover { color: var(--brand, #4f46e5); }
.prod-stage {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-soft, #eef2ff);
  color: var(--brand-strong, #3730a3);
  border: 1px solid #e0e7ff;
  white-space: nowrap;
}
.prod-stage.is-late { background: #fef2f2; color: #b42318; border-color: #fecaca; }
.prod-product { font-weight: 600; color: var(--ink, #111827); line-height: 1.3; }
.prod-customer { color: var(--ink-2, #374151); }
.prod-links { display: flex; flex-wrap: wrap; gap: 6px; }
.prod-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #eef1f6;
}
.prod-quick { margin: 0; }
.prod-ready { font-size: 11.5px; font-weight: 700; color: #166534; }

/* ---------- per-product print sheets ---------- */
.sheet-allow-list { display: grid; gap: 8px; }
.sheet-allow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fbfcfe;
}
.sheet-allow.is-allowed { background: #f5f7ff; border-color: #dbe3ff; }
.sheet-allow-check { display: flex; align-items: center; gap: 8px; min-width: 140px; margin: 0; }
.sheet-allow-check input { width: 16px; height: 16px; accent-color: var(--brand, #4f46e5); }
.sheet-allow-name { font-weight: 600; color: var(--ink, #111827); overflow-wrap: anywhere; }
.sheet-allow-meta { color: var(--muted, #6b7280); font-size: 12px; overflow-wrap: anywhere; }
.sheet-allow-locked { margin-left: auto; font-size: 11.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 3px 8px; border-radius: 999px; }
.sheet-allow .btn { margin-left: auto; }
.filter-chip.is-locked { opacity: .75; background: #f8fafc; color: #92400e; border-style: dashed; text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .topbar-right .who { display: none; }
  .topbar-inner { align-items: flex-start; }
  .tabs { order: 3; flex-basis: 100%; }
  .topbar-right { margin-left: auto; }
  .store-actions .link-quiet { display: none; }
  .split, .studio-shell { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .card { padding: 16px; }
  .topbar-inner { padding: 10px 14px; }
  .prod-board { grid-template-columns: 1fr; }
  .hero, .hero-modern { grid-template-columns: 1fr; padding: 22px; }
  .store-head-inner { gap: 10px; }
  .stage-pair, .stage-separate { grid-template-columns: 1fr; }
  .prod-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod-toolbar-hint { margin-left: 0; flex-basis: 100%; }
  .sheet-allow .btn, .sheet-allow-locked { margin-left: 0; }
}

/* ---------- storefront: shop card grid ---------- */
.shop-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin: 2px 0 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.shop-bar .filters { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  color: var(--ink-2, #475569); background: #fff;
  border: 1px solid var(--line, #e5e7eb); text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-chip:hover { border-color: #cbd5e1; color: var(--ink, #111827); background: #fff; }
.filter-chip.is-active {
  background: var(--brand-soft, #eef2ff);
  border-color: color-mix(in srgb, var(--brand, #4f46e5) 32%, #fff);
  color: var(--brand-strong, #3730a3); font-weight: 650;
}
.shop-count { font-size: 12.5px; color: var(--muted, #6b7280); }

.product-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.product-card {
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius); box-shadow: none;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: #d7deea; box-shadow: var(--shadow); }
.product-thumb-link {
  position: relative; display: block; padding: 18px 18px 6px;
  background: linear-gradient(180deg, #f8fafc, #f2f5fa);
}
.product-thumb-link .garment-wrap { aspect-ratio: 1 / 1; background: transparent; }
.product-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(255, 255, 255, .94); border: 1px solid var(--line, #e5e7eb);
  color: var(--ink-2, #475569); font-size: 10.5px; font-weight: 650;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
}
.product-card-body { padding: 14px 16px 16px; gap: 8px; }
.product-card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; }
.product-card-kicker .eyebrow { font-size: 10.5px; }
.rating-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; color: #92400e; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.rating-pill span { color: #a16207; font-weight: 500; }
.product-title { font-size: 15px; line-height: 1.35; margin: 0; font-weight: 650; }
.product-title a { color: var(--ink, #111827); text-decoration: none; }
.product-title a:hover { color: var(--brand, #4f46e5); }
.product-price-row {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted, #6b7280);
}
.product-price-row strong { font-size: 16px; color: var(--ink, #111827); font-weight: 700; }
.product-price-row .price-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.product-actions { gap: 8px; padding-top: 12px; }
.product-actions .btn { flex: 1 1 auto; justify-content: center; }

/* ---------- storefront: product page ---------- */
.product-detail {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 460px);
  gap: 22px; align-items: start;
}
.detail-visual {
  padding: 0; overflow: hidden; background: #fff;
  border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius);
  position: sticky; top: 84px;
}
.detail-visual-frame { padding: 26px 26px 14px; background: linear-gradient(180deg, #f8fafc, #f3f6fb); }
.detail-visual .garment-wrap { aspect-ratio: 1 / 1; background: transparent; }
.detail-visual-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--line, #e5e7eb);
  background: #fff; font-size: 12px; color: var(--muted, #6b7280);
}
.detail-visual-label { font-weight: 600; color: var(--ink-2, #475569); }
.detail-visual-chip {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; white-space: nowrap;
}
.detail-col { display: grid; gap: 14px; }
.detail-buy { padding: 20px 20px 18px; }
.detail-title { font-size: 26px; line-height: 1.25; letter-spacing: -.01em; margin: 6px 0 0; }
.detail-buy .product-card-kicker { min-height: 0; }
.detail-price-block {
  margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px;
  background: #f8fafc; border: 1px solid var(--line, #e5e7eb);
}
.detail-price { font-size: 26px; font-weight: 700; color: var(--ink, #111827); letter-spacing: -.01em; }
.detail-price-note { margin: 4px 0 0; font-size: 12px; color: var(--muted, #6b7280); line-height: 1.5; }
.detail-desc { margin: 12px 0 2px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2, #475569); }
.variant-block { margin-top: 16px; }
.variant-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted, #6b7280); margin-bottom: 8px;
}
.variant-value { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ink, #111827); font-size: 12.5px; }
.detail-buy .buy-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.detail-buy .buy-row .btn-primary { flex: 1 1 200px; justify-content: center; }
.detail-assurance {
  list-style: none; margin: 16px 0 0; padding: 14px 0 0;
  border-top: 1px solid var(--line, #e5e7eb); display: grid; gap: 7px;
}
.detail-assurance li { position: relative; padding-left: 20px; font-size: 12.5px; color: var(--ink-2, #475569); }
.detail-assurance li::before {
  content: ""; position: absolute; left: 3px; top: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px #ecfdf5;
}
.detail-facts { padding: 18px 20px; }
.detail-facts .kv { margin: 0; }

/* ---------- storefront: cart ---------- */
.cart-layout { grid-template-columns: minmax(0, 1.5fr) minmax(290px, .8fr); }
.cart-card { padding-top: 10px; }
.cart-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 2px 0 10px; border-bottom: 1px solid var(--line, #e5e7eb);
  font-size: 12.5px; font-weight: 650; color: var(--ink-2, #475569);
}
.cart-line { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; padding: 16px 0; }
.cart-line:last-child { padding-bottom: 4px; }
.cart-thumb {
  width: 76px; height: 76px; border-radius: 10px; overflow: hidden;
  background: #f4f7fb; border: 1px solid var(--line, #e5e7eb);
}
.cart-name { font-size: 14px; font-weight: 600; color: var(--ink, #111827); }
.cart-line-price { text-align: right; align-self: start; padding-top: 2px; }
.cart-line-total { font-size: 15px; font-weight: 700; color: var(--ink, #111827); }
.cart-summary { position: sticky; top: 84px; }
.cart-summary .promo-form { margin-top: 12px; }
.cart-summary .ship-block {
  background: #f8fafc; border: 1px solid var(--line, #e5e7eb);
  color: var(--ink-2, #475569);
}
.cart-summary .ship-block strong { color: var(--muted, #6b7280); }

/* ---------- storefront: checkout ---------- */
.checkout-layout { grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr); }
.checkout-card { padding: 20px; }
.checkout-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 650; color: var(--ink, #111827); margin-bottom: 14px;
}
.checkout-step-num {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--brand-soft, #eef2ff); color: var(--brand-strong, #3730a3);
  border: 1px solid color-mix(in srgb, var(--brand, #4f46e5) 25%, #fff);
}
.checkout-note {
  margin-top: 14px; padding: 11px 13px; border-radius: 10px;
  background: #f8fafc; border: 1px dashed var(--line-strong, #d5dbe5);
  font-size: 12.5px; color: var(--ink-2, #475569); line-height: 1.55;
}
.checkout-summary { position: sticky; top: 84px; padding: 20px; }
.checkout-summary .order-summary-row { padding: 9px 0; font-size: 13px; }
.checkout-summary .order-summary-row > span:last-child { font-weight: 600; color: var(--ink); }
.checkout-secure { margin: 12px 0 0; font-size: 11.5px; color: var(--muted, #6b7280); line-height: 1.5; text-align: center; }

@media (max-width: 980px) {
  .product-detail, .cart-layout, .checkout-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-visual, .cart-summary, .checkout-summary { position: static; }
  .detail-visual-frame { padding: 18px 18px 10px; }
  .detail-title { font-size: 22px; }
  .detail-buy, .checkout-card, .checkout-summary { padding: 16px; }
}

@media (max-width: 720px) {
  .shop-bar { margin-bottom: 14px; }
  .shop-count { order: 2; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-thumb-link { padding: 10px 10px 2px; }
  .product-badge { top: 6px; left: 6px; font-size: 9.5px; padding: 2px 6px; }
  .product-card-body { padding: 10px 12px 12px; }
  .product-title { font-size: 13.5px; }
  .product-price-row strong { font-size: 14.5px; }
  .product-actions .btn { font-size: 12px; padding: 6px 10px; }
  .cart-line { grid-template-columns: 60px minmax(0, 1fr); }
  .cart-line-price { grid-column: 2; text-align: left; }
  .cart-line-total { font-size: 14px; }
  .cart-thumb { width: 60px; height: 60px; }
  .detail-price { font-size: 22px; }
  .checkout-step { font-size: 14px; }
  .detail-buy .buy-row .btn-primary { flex: 1 1 100%; }
}

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

/* ---------- studio: single main editable mockup ---------- */
.stage-pane-main { padding: 0; background: transparent; border: 0; box-shadow: none; }
.stage-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
}
.stage-zoom-wrap {
  overflow: auto;
  padding: 8px 4px 12px;
  border-radius: 12px;
  background: #f6f9fa;
  max-height: 78vh;
  -webkit-overflow-scrolling: touch;
  /* One-finger scrolling stays native; pinch is handled in the studio so it
     magnifies the design area instead of the page. */
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
}
.stage-zoom-inner {
  display: grid;
  gap: 0;
  width: 100%;
  transform-origin: top center;
  transition: transform .12s ease;
}
.art-canvas.art-canvas-edit { touch-action: none; }
.art-canvas.is-inactive {
  opacity: .88;
  border-style: dashed;
  filter: saturate(.92);
}
.art-canvas.is-active {
  box-shadow: 0 0 0 2px rgba(79, 70, 229, .18);
}
.stage-top { gap: 10px; }
.stage-zoom {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px; padding: 4px 6px;
}
.stage-zoom button {
  border: 0; background: #f8fafc; color: var(--ink-2, #475569);
  font: inherit; font-size: 13px; font-weight: 700;
  border-radius: 7px; min-width: 28px; height: 28px; cursor: pointer;
}
.stage-zoom button:hover:not(:disabled) { background: #eef2ff; color: var(--brand-strong, #3730a3); }
.stage-zoom button:disabled { opacity: .35; cursor: default; }
.stage-zoom span {
  min-width: 44px; text-align: center; font-size: 12px; font-weight: 650;
  color: var(--ink, #111827); font-variant-numeric: tabular-nums;
}
.stage-caption { margin-top: 10px; }
.stage-caption strong { color: var(--brand-strong, #3730a3); }

/* ---------- admin navbar: all links visible on small screens ---------- */
.topbar-inner { row-gap: 8px; }
.tabs {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; }
.topbar-right { flex: 0 0 auto; }
.store-nav, .store-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
.store-nav::-webkit-scrollbar, .store-tabs::-webkit-scrollbar { display: none; }
.store-tab, .store-nav a { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 980px) {
  .topbar-inner { flex-wrap: wrap; align-items: center; }
  .brand { order: 1; }
  .topbar-right { order: 2; margin-left: auto; }
  .tabs { order: 3; flex: 1 1 100%; width: 100%; padding-bottom: 2px; }
  .studio-shell { grid-template-columns: 1fr; }
  .studio-stage-card { position: static; }
  .stage-main { max-width: 100%; }
  .store-head-inner { flex-wrap: wrap; }
  .store-nav { order: 3; flex: 1 1 100%; width: 100%; }
  .store-actions { order: 2; margin-left: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .split, .inbox-shell, .cart-layout, .checkout-layout, .product-detail { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar-right .who { display: none; }
  .topbar-right .btn { padding: 6px 10px; font-size: 12px; }
  .stage-top { flex-direction: column; align-items: stretch; }
  .stage-top .side-toggle, .stage-top .stage-zoom { justify-content: center; }
  .stage-zoom-wrap { max-height: 65vh; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .page-actions .btn, .buy-row .btn { width: 100%; justify-content: center; }
  .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .hero, .hero-modern { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Only tables with their own scroll container get a minimum width; a table
     without one must shrink, or it pushes the whole page sideways on a phone. */
  .table-wrap table.data { min-width: 560px; }
}

@media (max-width: 480px) {
  .page { padding: 16px 12px 28px; }
  .card, .panel-card { padding: 14px; border-radius: 12px; }
  .tab { padding: 7px 10px; font-size: 12.5px; }
  .brand-tag { display: none; }
  .stage-zoom button { min-width: 26px; height: 26px; }
  .detail-buy .buy-row { flex-direction: column; }
}



/* ------------------------------------------------------------------
   Small-screen navigation
   Below 820px a multi-row header must not stay pinned to the top of a
   phone (it eats the viewport and hides the page), and every nav link
   must be visible instead of scrolling off behind a clipped edge.
   ------------------------------------------------------------------ */
@media (max-width: 980px) {
  .store-actions .link-quiet { display: inline-flex; }
}

@media (max-width: 820px) {
  .topbar, .store-head { position: static; }
  .topbar-inner {
    align-items: center;
    row-gap: 8px;
    padding: 10px 14px;
  }
  .topbar .brand, .store-head .store-brand { order: 1; }
  .topbar-right, .store-actions { order: 2; margin-left: auto; }
  .tabs, .store-nav {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    gap: 4px;
    padding-bottom: 0;
  }
  .tab {
    flex: 0 0 auto;
    padding: 7px 11px;
    font-size: 13px;
    border: 1px solid transparent;
  }
  .tab.is-active { border-color: color-mix(in srgb, var(--brand, #4f46e5) 22%, transparent); }
  .store-nav { gap: 2px 6px; }
  .store-tab { padding: 7px 10px; font-size: 13px; }
  .store-head-inner { row-gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .store-brand { min-width: 0; max-width: 62%; }
  .store-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right .btn, .store-actions .btn { padding: 7px 11px; font-size: 12.5px; }
  .stage-zoom button { min-width: 36px; height: 36px; }
  .layer-icon { width: 30px; height: 30px; }
  .qty-form button { padding: 7px 11px; }
}

/* 821–980px keeps one horizontally scrolling row: fade the right edge so the
   hidden links are obvious rather than looking missing. */
@media (min-width: 821px) and (max-width: 980px) {
  .tabs, .store-nav {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 92%, transparent 100%);
  }
}

@media (max-width: 420px) {
  .tab { padding: 6px 9px; font-size: 12.5px; }
  .store-tab { padding: 6px 8px; font-size: 12.5px; }
  .topbar-right .btn, .store-actions .btn { padding: 6px 9px; font-size: 12px; }
  .store-actions { gap: 6px; }
}

@media print {
  .topbar, .store-head, .admin-toasts, .no-print { display: none !important; }
  body { background: #fff; }
  .card, .prod-card { box-shadow: none; }
}

/* --------------------------------------------------------- desktop nav overflow
   A console with twenty-plus sections cannot fit one row, and a row that is
   silently clipped looks like missing features. On desktop the trailing links
   move into a "More" menu instead: nothing is hidden, nothing scrolls away,
   and the header never grows to two rows. `nav-collapsed` is set by nav.js only
   after the links actually stop fitting, so a JS-less browser keeps the plain
   horizontally scrollable row it had before. */
@media (min-width: 901px) {
  .nav-panel[data-overflow] { min-width: 0; }
  .nav-panel[data-overflow].nav-collapsed {
    overflow: visible;
    overflow-y: visible;
    flex-wrap: nowrap;
  }
  .nav-more { position: relative; flex: 0 0 auto; }
  .nav-more[hidden] { display: none !important; }
  .nav-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-2, #374151);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
  }
  .nav-more-btn:hover,
  .nav-more.is-open .nav-more-btn {
    color: var(--brand, #4f46e5);
    background: var(--brand-soft, #eef2ff);
    border-color: color-mix(in srgb, var(--brand, #4f46e5) 20%, transparent);
  }
  .nav-more-btn:focus-visible {
    outline: 2px solid var(--brand, #4f46e5);
    outline-offset: 2px;
  }
  .store-nav .nav-more-btn { padding: 6px 2px; border-radius: 0; font-size: 13.5px; font-weight: 500; }
  .store-nav .nav-more-btn:hover,
  .store-nav .nav-more.is-open .nav-more-btn { background: transparent; color: var(--brand); }
  .nav-more-caret { font-size: 10px; line-height: 1; }
  .nav-more.is-open .nav-more-caret { transform: rotate(180deg); }

  .nav-more-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 90;
    display: none;
    min-width: 230px;
    max-width: min(320px, 80vw);
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(16, 24, 40, 0.18);
  }
  .nav-more.is-open .nav-more-panel { display: grid; gap: 1px; }
  .nav-more-panel .tab,
  .nav-more-panel .store-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2, #374151);
    text-align: left;
    white-space: nowrap;
  }
  .nav-more-panel .tab:hover,
  .nav-more-panel .store-tab:hover { background: var(--brand-soft, #eef2ff); color: var(--brand, #4f46e5); }
  .nav-more-panel .is-active { color: var(--brand, #4f46e5); background: var(--brand-soft, #eef2ff); }
}

/* The console header is one row above the stacked breakpoint: the nav takes the
   space the brand and the account actions leave behind, and its overflow menu
   absorbs whatever does not fit. Without this the collapsed row would keep its
   full content width and push the account actions onto a second header row. */
@media (min-width: 981px) {
  .topbar-console .topbar-inner,
  .store-head-inner { flex-wrap: nowrap; }
  .topbar-console .nav-panel[data-overflow],
  .store-head-inner .nav-panel[data-overflow] { flex: 1 1 0; }
}

/* Twenty-three console sections in a one-column menu is a scroll, not a menu.
   On desktop the overflow list reads as two compact columns. */
@media (min-width: 901px) {
  .tabs .nav-more-panel {
    grid-template-columns: 1fr 1fr;
    min-width: 380px;
    max-width: 460px;
    gap: 2px;
  }
}

/* Neutral product tile: a product outside the personalisation studio with no
   photography yet must not be drawn as a garment. */
.product-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  padding: 18px;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(150deg, #f6f3ec, #e7e1d6);
  color: #6f685c;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.product-placeholder span { max-width: 80%; }
.product-placeholder-lg { height: 100%; min-height: 260px; }

/* Product photography: owner photos replace the mockup as the storefront image. */
.product-photo {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
}
.product-gallery { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.product-gallery .gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  background: #f4f1ea;
}
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery-thumb {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f1ea;
  cursor: pointer;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.is-active { border-color: var(--teal, #0f766e); }
.gallery-thumb:hover { border-color: rgba(15, 118, 110, 0.45); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-tile { margin: 0; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 14px; overflow: hidden; background: #fbfaf7; }
.photo-tile img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; }

/* True scarcity only: the label is neutral unless stock is at or below the threshold. */
#stockLabel.is-urgent { color: #b45309; font-weight: 700; }

/* Landing: the shop verticals. */

/* ---------- store console: ERP-style sidebar shell ---------- */
.admin-body { background: #f6f7fb; }
.console-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: #fff;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.console-bar-inner { display: flex; align-items: center; gap: 14px; padding: 10px 20px; min-height: 58px; }
.console-bar-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
  font-weight: 600;
}
.console-bar .topbar-right { margin-left: auto; }
.console-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;
}
.console-side {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 16px 12px 24px;
  background: #fff;
  border-right: 1px solid var(--line, #e5e7eb);
  scrollbar-width: thin;
}
.console-side-head { padding: 4px 10px 14px; border-bottom: 1px solid var(--line, #e5e7eb); margin-bottom: 12px; }
.console-store { font-weight: 650; font-size: 14px; color: var(--ink, #111827); }
.console-role { font-size: 11.5px; color: var(--muted, #6b7280); margin-top: 2px; }
.console-group { margin-bottom: 16px; }
.console-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #98a2b3;
  padding: 0 10px 6px;
}
.console-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-2, #374151);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
}
.console-link + .console-link { margin-top: 2px; }
.console-link:hover { background: #f3f5f9; color: var(--ink, #111827); }
.console-link.is-active {
  background: var(--brand-soft, #eef2ff);
  color: var(--brand-strong, #3730a3);
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--brand, #4f46e5);
}
.console-ico { display: inline-flex; flex: 0 0 18px; color: #8a94a6; }
.console-link.is-active .console-ico, .console-link:hover .console-ico { color: currentColor; }
.console-link-text { flex: 1 1 auto; min-width: 0; }
.console-badge { margin-left: auto; }
.console-side-foot { border-top: 1px solid var(--line, #e5e7eb); padding-top: 10px; margin-top: 6px; }
.console-link-quiet { color: var(--muted, #6b7280); font-size: 12.5px; }
.console-mode-toggle { margin-bottom: 2px; }
.console-mode-toggle button { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.console-main { min-width: 0; }
.console-tabbar { display: none; }
.console-page { padding: 24px 28px 48px; max-width: 1180px; }
.console-purpose {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
}
.console-purpose p { margin: 0; font-size: 13px; color: var(--ink-2, #374151); }
.console-purpose-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #98a2b3;
}
.console-foot { padding: 0 28px 28px; color: var(--muted, #6b7280); font-size: 12px; }
@media (max-width: 900px) {
  .console-shell { grid-template-columns: minmax(0, 1fr); }
  .console-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 272px;
    height: auto;
    z-index: 55;
    padding-top: 70px;
    transform: translateX(-104%);
    transition: transform .18s ease;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
  }
  .console-side.is-open { transform: none; }
  .console-page { padding: 18px 16px 44px; }
  .console-foot { padding: 0 16px 24px; }
  .console-bar-label { display: none; }
  .console-bar-inner { gap: 10px; padding: 9px 14px; }

  /* Thumb-reach shortcuts: the five daily jobs stay one tap away. */
  .console-tabbar {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--line, #e5e7eb);
    box-shadow: 0 -8px 28px rgba(16, 24, 40, .08);
    -webkit-backdrop-filter: blur(14px) saturate(1.1);
    backdrop-filter: blur(14px) saturate(1.1);
  }
  .console-tabbar .console-tab {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 2px;
    border-radius: 9px;
    color: var(--muted, #6b7280);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
  }
  .console-tabbar .console-tab:hover { background: #f3f5f9; color: var(--ink, #111827); }
  .console-tabbar .console-tab.is-active {
    background: var(--brand-soft, #eef2ff);
    color: var(--brand-strong, #3730a3);
  }
  .console-tabbar .console-tab .console-ico-svg { width: 20px; height: 20px; }
  .console-page { padding-bottom: 86px; }
  .console-foot { padding-bottom: 86px; }
}

/* ---------- phones: data tables become labelled cards ---------- */
@media (max-width: 640px) {
  .table-wrap table.data.is-stacked { min-width: 0; width: 100%; }
  .table-wrap table.data.is-stacked thead { display: none; }
  .table-wrap table.data.is-stacked tbody,
  .table-wrap table.data.is-stacked tr { display: block; }
  .table-wrap table.data.is-stacked tr {
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    padding: 4px 12px;
    margin: 0 0 10px;
  }
  .table-wrap table.data.is-stacked tr:last-child { margin-bottom: 0; }
  .table-wrap table.data.is-stacked td {
    display: block;
    padding: 7px 0;
    border-bottom: 1px dashed #eef1f5;
    text-align: right;
  }
  .table-wrap table.data.is-stacked td::after { content: ''; display: block; clear: both; }
  .table-wrap table.data.is-stacked td:last-child { border-bottom: 0; }
  .table-wrap table.data.is-stacked td::before {
    content: attr(data-label);
    float: left;
    max-width: 45%;
    padding-right: 12px;
    font-size: 10.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted, #6b7280);
    font-weight: 650;
    text-align: left;
    line-height: 1.6;
  }
  .table-wrap table.data.is-stacked td:first-child {
    display: block;
    text-align: left;
    font-weight: 650;
    font-size: 14.5px;
    padding: 9px 0 8px;
  }
  .table-wrap table.data.is-stacked td:first-child::before { display: none; }
  .table-wrap table.data.is-stacked td[data-label] { border-bottom: 1px dashed #eef1f5; }
  .table-wrap table.data.is-stacked td:not([data-label])::before { display: none; }
  .table-wrap table.data.is-stacked td:not([data-label]) { padding-top: 9px; padding-bottom: 9px; }
  .table-wrap table.data.is-stacked td[colspan] { display: block; text-align: left; }
  .table-wrap table.data.is-stacked tr:hover td { background: none; }
  .table-wrap table.data.is-stacked .cell-sub { font-size: 11.5px; color: var(--muted, #6b7280); }

  /* Search bars: the field gets its own row instead of squeezing the button. */
  .inline-search { flex-wrap: wrap; }
  .inline-search .input { max-width: none; flex: 1 1 100%; }
  .inline-search .btn { width: 100%; }
}

/* ---------- very small phones: keep Sign out reachable ----------
   app.css hides every ghost button under 380px, which took the console's
   Sign out with it. The duplicate "View store" link goes; Sign out stays. */
@media (max-width: 480px) {
  .console-bar .topbar-right .btn-ghost { display: inline-flex; }
  .console-bar .topbar-right .console-view-store { display: none; }
  .console-bar .topbar-right .btn { padding: 6px 9px; font-size: 12px; }
}

/* On a phone the shop header should be two rows, not three: customer links and
   the menu button share the second row instead of leaving the button alone. */
@media (max-width: 480px) {
  .store-head-inner .nav-burger { order: 3; margin-left: 8px; }
  .store-head .store-sub { display: none; }
  .store-head .store-brand { max-width: 46%; }
}

/* Short action buttons share a row on a phone instead of stacking as slabs. */
@media (max-width: 720px) {
  .page-actions .btn { width: auto; flex: 1 1 auto; min-width: 96px; }
}

/* ============================================================ simplicity pass
   Console search, the "what changed" bell, merged sidebar tabs, the first-run
   checklist, share card, task-sized settings pages and plain product facts. */

.console-search { position: relative; display: flex; align-items: center; flex: 1 1 220px; max-width: 360px; margin-left: auto; }
.console-search-ico { position: absolute; left: 10px; display: inline-flex; color: #6b7280; pointer-events: none; }
.console-search-ico svg { width: 16px; height: 16px; }
.console-search-input {
  width: 100%; height: 36px; padding: 0 12px 0 33px; border: 1px solid #e5e7eb; border-radius: 999px;
  background: #fff; font: inherit; font-size: 13px; color: #111827;
}
.console-search-input:focus { outline: 2px solid #4f46e5; outline-offset: 1px; border-color: transparent; }

.console-bell { position: relative; }
.console-bell > summary {
  list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid #e5e7eb; background: #fff; display: inline-flex; align-items: center; justify-content: center;
  position: relative; color: #111827;
}
.console-bell > summary::-webkit-details-marker { display: none; }
.console-bell[open] > summary { background: #f3f4f6; }
.console-bell-count {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #b42318; color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.console-bell-panel {
  position: absolute; right: 0; top: 44px; z-index: 70; width: 264px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 14px; padding: 8px; box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
}
.console-bell-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: 6px 10px; }
.console-bell-panel a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; color: #111827; text-decoration: none;
}
.console-bell-panel a:hover { background: #f3f4f6; }
.console-bell-panel strong { font-variant-numeric: tabular-nums; }
.console-bell-all { margin-top: 4px; border-top: 1px solid #eef0f3; font-weight: 600; }

.console-subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.console-subtab {
  padding: 7px 12px; border-radius: 999px; border: 1px solid #e5e7eb; background: #fff;
  font-size: 13px; color: #374151; text-decoration: none;
}
.console-subtab.is-active { background: #111827; border-color: #111827; color: #fff; }

.setup-card { margin-bottom: 16px; }
.setup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.setup-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.setup-step {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
}
.setup-step.is-done { background: #f8fafc; }
.setup-tick {
  flex: none; width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid #d1d5db;
  display: grid; place-items: center; font-size: 12px; color: #fff;
}
.setup-step.is-done .setup-tick { background: #16a34a; border-color: #16a34a; }
.setup-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pill-ok { background: #e8f7ee; color: #15803d; }

.share-card { margin-bottom: 16px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.settings-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; margin: 0 0 14px; }
.settings-tab {
  flex: 0 0 auto; min-width: 150px; display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
  color: #111827; text-decoration: none; font-size: 13px;
}
.settings-tab span { font-size: 11px; color: #6b7280; line-height: 1.4; }
.settings-tab.is-active { border-color: #4f46e5; box-shadow: inset 0 0 0 1px #4f46e5; }
.settings-page[data-settings-tab="look"] [data-tab]:not([data-tab="look"]),
.settings-page[data-settings-tab="sell"] [data-tab]:not([data-tab="sell"]),
.settings-page[data-settings-tab="money"] [data-tab]:not([data-tab="money"]),
.settings-page[data-settings-tab="email"] [data-tab]:not([data-tab="email"]),
.settings-page[data-settings-tab="advanced"] [data-tab]:not([data-tab="advanced"]) { display: none; }

.more-options { margin-top: 14px; border: 1px dashed #d1d5db; border-radius: 12px; padding: 10px 14px; }
.more-options > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.more-options[open] { border-style: solid; }

.explain { margin: 14px 0 0; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #f8fafc; font-size: 13px; }
.explain > summary { cursor: pointer; font-weight: 600; }
.explain ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; color: #374151; }

.detail-assurance {
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin: 10px 0 12px; padding: 0; font-size: 12px; color: #374151;
}
.detail-assurance li { display: flex; align-items: center; gap: 6px; }
.detail-assurance li::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: #4f46e5; }

/* Printable QR card: shop poster and single-product promo. */
.poster-body {
  background: #eef1f5; display: grid; place-items: center;
  padding: 72px 20px 48px; min-height: 100vh;
}
.poster-tools {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 5;
}
.poster-sheet {
  width: min(420px, 100%); background: #fff; border: 1px solid #e6e9ef; border-radius: 22px;
  overflow: hidden; box-shadow: 0 18px 46px rgba(15, 23, 42, .14);
  display: grid; justify-items: center; text-align: center; padding: 0 0 28px;
}
.poster-head {
  width: 100%; background: var(--poster-accent, #0d0c11); color: #fff;
  padding: 26px 24px 22px; display: grid; justify-items: center; gap: 7px;
}
.poster-logo { max-height: 52px; max-width: 70%; background: #fff; padding: 6px 10px; border-radius: 10px; }
.poster-monogram {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .16); font-weight: 700; font-size: 20px; letter-spacing: .04em;
}
.poster-store { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.poster-line { font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.poster-photo { width: 100%; padding: 20px 24px 0; }
.poster-photo img { width: 100%; height: 170px; object-fit: cover; border-radius: 14px; display: block; }
.poster-qr { padding-top: 20px; }
.poster-qr-frame { background: #fff; padding: 10px; border: 1px solid #e6e9ef; border-radius: 14px; line-height: 0; }
.poster-qr svg { display: block; width: 214px; height: 214px; }
.poster-scan {
  margin-top: 12px; font-size: 12px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: #6b7280;
}
.poster-url { font-size: 15px; font-weight: 700; word-break: break-all; padding: 0 26px; }
.poster-foot { font-size: 12px; color: #6b7280; padding: 8px 26px 0; }
.poster-hint { font-size: 11px; color: #9ca3af; margin-top: 14px; padding: 0 20px; }

/* Dashboard: four plain next steps, and the shop link with its own QR. */
.quick-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.quick-card {
  display: grid; gap: 3px; padding: 14px 16px; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  transition: border-color .15s ease, transform .15s ease;
}
.quick-card strong { font-size: 14px; }
.quick-card span { font-size: 12px; color: var(--muted, #6b7280); }
.quick-card:hover { border-color: var(--brand, #4f46e5); transform: translateY(-1px); }
.share-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.share-url {
  font-size: 13px; background: #f6f7f9; border: 1px dashed var(--line-strong, #d1d5db);
  border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; overflow-wrap: anywhere;
}
.share-qr { background: #fff; padding: 6px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; line-height: 0; }
.share-qr svg { width: 104px; height: 104px; display: block; }

/* The expert tools stay folded so the first screen is the shop, not the machinery. */
.console-more > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; }
.console-more > summary::-webkit-details-marker { display: none; }
.console-more > summary::after { content: "+"; font-size: 12px; opacity: .55; }
.console-more[open] > summary::after { content: "−"; }
.console-more-list { margin-top: 6px; }

@media (max-width: 900px) {
  .console-bar-inner { flex-wrap: wrap; }
  .console-search { order: 3; flex: 1 1 100%; max-width: none; margin-left: 0; }
  .console-search-input { height: 34px; }
  .console-bell-panel { right: -8px; width: min(280px, calc(100vw - 32px)); }
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .setup-step { display: grid; grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; }
  .setup-step > .btn, .setup-step > .pill-ok { grid-column: 2; justify-self: start; }
  .setup-head .btn { white-space: nowrap; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  .poster-body { background: #fff; padding: 0; display: block; min-height: 0; }
  .poster-sheet { width: 100%; max-width: none; border: 0; border-radius: 0; box-shadow: none; padding-bottom: 0; }
  .poster-store { font-size: 30pt; }
  .poster-line { font-size: 12pt; }
  .poster-qr svg { width: 72mm; height: 72mm; }
  .poster-scan { font-size: 11pt; }
  .poster-url { font-size: 15pt; }
  .poster-photo img { height: 55mm; }
  .no-print, .poster-tools, .poster-hint { display: none !important; }
}

/* ============================================================ first-run guide
   A new shop walks four steps: what it sells, how it looks, what it sells
   first, and how it gets paid. Same form language as the rest of the console. */

.wizard-steps {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none;
  padding: 0; margin: 0 0 16px;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  border: 1px solid #e5e7eb; border-radius: 999px; background: #fff;
  font-size: 12px; color: #4b5563;
}
.wizard-step-num {
  width: 20px; height: 20px; border-radius: 999px; background: #f3f4f6;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #374151;
}
.wizard-step.is-current { border-color: #4f46e5; color: #111827; box-shadow: inset 0 0 0 1px #4f46e5; }
.wizard-step.is-done .wizard-step-num { background: #16a34a; color: #fff; }

.wizard-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.wizard-type {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px;
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; cursor: pointer;
}
.wizard-type:hover { border-color: #c7d2fe; }
.wizard-type:has(input:checked) { border-color: #4f46e5; box-shadow: inset 0 0 0 1px #4f46e5; }
.wizard-type input { margin-top: 3px; }
.wizard-type-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.wizard-products { display: grid; gap: 8px; }
.wizard-product {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff;
}
.wizard-product > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.setup-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* What one subscription replaces, on the landing and pricing pages. */
.value-band { margin-top: 34px; }
.value-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 14px; }
.value-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.value-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px; border-bottom: 1px dashed #e5e7eb; font-size: 14px; color: #111827;
}
.value-list li:last-child { border-bottom: 0; }
.value-list li::before {
  content: "✓"; flex: none; width: 18px; height: 18px; border-radius: 999px;
  background: #e8f7ee; color: #15803d; font-size: 11px; display: grid; place-items: center;
}
.value-list li > span:first-child { flex: 1; }
.value-total { align-self: start; }

.value-now span { font-size: 13px; font-weight: 500; }
.value-now { font-size: 30px; font-weight: 750; letter-spacing: -.02em; color: #111827; }

@media (max-width: 900px) {
  .value-grid { grid-template-columns: 1fr; }
  .wizard-steps { gap: 4px; }
  .wizard-step { padding: 6px 9px 6px 7px; }
}
@media (max-width: 640px) {
  .wizard-step span:last-child { font-size: 11px; }
  .wizard-product { flex-direction: column; align-items: flex-start; gap: 4px; }
  .setup-head-actions { width: 100%; justify-content: flex-start; }
}

/* Landing hero: a real shop preview instead of a single garment. */
.hero-shop { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 380px; }
.hero-shop-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}
.hero-shop-img {
  height: 86px; border-radius: 10px;
  background: linear-gradient(135deg, var(--tone, #eef2ff), #ffffff 78%);
  border: 1px solid rgba(17, 24, 39, .04);
}
.hero-shop-card strong { font-size: 13px; color: #111827; }
.hero-shop-price { font-size: 12px; color: #6b7280; }
.hero-shop-card:nth-child(3) { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.hero-shop-card:nth-child(3) .hero-shop-img { width: 86px; height: 58px; flex: none; }
.hero-shop-badge {
  grid-column: span 2; background: #111827; color: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 11px; text-align: center; letter-spacing: .01em;
}
@media (max-width: 900px) { .hero-shop { max-width: 420px; margin: 6px auto 0; } }

/* Shop filters, bulk edit and back-in-stock requests. */
.shop-filters .select,
.shop-filters .input { width: auto; flex: 0 1 170px; min-width: 120px; }
.shop-filters .btn { flex: none; width: auto; white-space: nowrap; }
.shop-search .btn { flex: none; width: auto; white-space: nowrap; }
.shop-filters .check-inline { font-size: 13px; }
.stock-alert { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; background: #fff; }
.stock-alert summary { cursor: pointer; font-weight: 600; font-size: 13px; color: #111827; }
.stock-alert[open] summary { margin-bottom: 10px; }
form#bulkEdit { gap: 8px; }
@media (max-width: 640px) {
  .shop-filters { display: grid !important; grid-template-columns: 1fr 1fr; }
  .shop-filters .select,
  .shop-filters .input { width: 100%; max-width: none !important; }
  .shop-filters .btn { grid-column: span 2; }
  form#bulkEdit { align-items: stretch; }
  form#bulkEdit .select,
  form#bulkEdit .input { flex: 1 1 140px; }
}

/* ============================================================ website builder
   A component palette, a scaled 1200-unit canvas and an inspector. The canvas
   is transformed as a whole, so dragging stays exact at any window size. */

.bw-body { margin: 0; height: 100vh; overflow: hidden; background: #eef1f5; color: #111827;
  font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
.bw-bar { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: #0f1115; color: #fff; }
.bw-exit { color: #c9ced8; text-decoration: none; font-size: 13px; }
.bw-exit:hover { color: #fff; }
.bw-bar-title { font-size: 14px; font-weight: 600; }
.bw-bar-title span { color: #8f97a5; font-weight: 400; margin-left: 6px; }
.bw-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bw-template-form { display: flex; gap: 6px; align-items: center; min-width: 0; }
/* The global .select padding is 9px; a fixed 32px height clipped the label. */
.bw-template-select {
  height: 36px;
  flex: 0 0 auto;
  width: auto;
  min-width: 132px;
  max-width: 240px;
  padding: 0 8px 0 10px;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
@media (max-width: 900px) {
  .bw-template-select { max-width: 130px; }
  .bw-bar-title span { display: none; }
}
.bw-flash { padding: 8px 16px; font-size: 13px; }
.bw-flash-ok { background: #e8f7ee; color: #14532d; }
.bw-flash-err { background: #fdeaea; color: #7f1d1d; }
.bw-empty-note { padding: 10px 16px; background: #fff8e6; color: #6b4a00; font-size: 12.5px; }

.bw-shell { display: grid; grid-template-columns: 208px minmax(0, 1fr) 288px; height: calc(100vh - 56px); }
.bw-palette, .bw-inspector { background: #fff; overflow-y: auto; padding: 14px; }
.bw-palette { border-right: 1px solid #e2e6ee; }
.bw-inspector { border-left: 1px solid #e2e6ee; }
.bw-panel-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #6b7280; margin: 4px 0 10px; }
.bw-palette-grid { display: grid; gap: 8px; }
.bw-palette-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; background: #f7f8fb;
  border: 1px solid #e2e6ee; border-radius: 9px; cursor: grab; text-align: left; font: inherit; color: inherit; }
.bw-palette-item:hover { border-color: #111827; background: #fff; }
.bw-palette-item:active { cursor: grabbing; }
.bw-palette-mark { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  background: #111827; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.bw-palette-label { font-size: 13px; font-weight: 500; }
.bw-hint { font-size: 12px; line-height: 1.5; color: #6b7280; margin: 10px 0 14px; }
.bw-danger { color: #b42318; }

.bw-stage { display: flex; flex-direction: column; min-width: 0; background: #eef1f5; }
.bw-stage-top { display: flex; justify-content: space-between; padding: 8px 20px; font-size: 12px; color: #6b7280; }
.bw-canvas-scroll { flex: 1; overflow: auto; padding: 18px 28px 40px; }
.bw-canvas-wrap { transform-origin: top left; margin: 0 auto; }
.bw-canvas { width: 1200px; position: relative; background: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.10);
  border-radius: 4px; }

.bw-block { position: absolute; outline: 1px dashed transparent; }
.bw-block:hover { outline-color: #b9c0cc; }
.bw-block.is-selected { outline: 2px solid #2563eb; }
.bw-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 3px;
  background: #2563eb; border: 2px solid #fff; cursor: nwse-resize; display: none; }
.bw-block.is-selected .bw-handle { display: block; }
.bw-inner { min-height: inherit; }
.bw-text { white-space: pre-wrap; }
.bw-text-body { line-height: 1.6; }
.bw-btn-preview { display: inline-flex; align-items: center; justify-content: center; padding: 0 18px;
  height: 100%; min-height: 44px; font-weight: 600; text-decoration: none; }
.bw-btn-preview.is-light { background: #fff; color: #111; border-radius: 10px; height: auto; padding: 11px 20px; }
.bw-image-empty { display: grid; place-items: center; background: #f2f4f8; border: 1px dashed #c3c9d4;
  color: #6b7280; font-size: 13px; padding: 12px; text-align: center; }
.bw-block-image img, .bw-block-image .bw-image-empty { width: 100%; object-fit: cover; display: block; }
.bw-banner { display: flex; align-items: center; padding: 52px; }
.bw-banner-copy { max-width: 640px; }
.bw-banner-sub { color: rgba(255,255,255,.86); font-size: 17px; margin: 10px 0 18px; }
.bw-products { display: grid; gap: 16px; }
.bw-product-tile { background: #f7f8fb; border: 1px solid #e2e6ee; border-radius: 10px; padding: 12px;
  display: grid; gap: 8px; }
.bw-product-thumb { display: block; height: 120px; border-radius: 7px; background: #e6e9f0; }
.bw-product-line { display: block; height: 9px; border-radius: 4px; background: #dfe3eb; }
.bw-product-line.is-short { width: 45%; }
.bw-divider-line { height: 1px; opacity: .2; }

.bw-field { display: grid; gap: 5px; margin-bottom: 10px; font-size: 12px; color: #4b5563; }
.bw-input { width: 100%; box-sizing: border-box; padding: 7px 9px; font: inherit; font-size: 13px;
  border: 1px solid #d7dce5; border-radius: 7px; background: #fff; color: #111827; }
.bw-input:focus { outline: 2px solid #bfdbfe; border-color: #2563eb; }
.bw-input[type="color"] { height: 34px; padding: 3px; }
.bw-textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.bw-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bw-inspector-actions { display: flex; gap: 8px; margin-top: 14px; }
.bw-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); opacity: 0;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px;
  pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.bw-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.bw-toast.is-error { background: #b42318; }

@media (max-width: 980px) {
  .bw-shell { grid-template-columns: 168px minmax(0, 1fr); }
  .bw-inspector { display: none; }
}

/* ======================================================== built storefront page
   Desktop keeps the freeform composition; a phone stacks the same blocks in the
   same order at full width, which is what a shopper expects. */
.sf-page { position: relative; }
.sf-canvas { position: relative; max-width: 1200px; margin: 0 auto; }
.sf-block { position: absolute; }
.sf-img { width: 100%; object-fit: cover; display: block; }
.sf-img-empty { display: grid; place-items: center; background: #f2f4f8; color: #6b7280; font-size: 13px; }
.sf-banner-inner { display: flex; align-items: center; padding: 56px; }
.sf-banner-copy { max-width: 680px; }
.sf-product-grid { display: grid; gap: 18px; }
.sf-empty { grid-column: 1 / -1; color: #6b7280; font-size: 14px; }
.bw-preview-note { background: #fff8e6; color: #6b4a00; font-size: 12.5px; padding: 8px 16px; text-align: center; }

@media (max-width: 760px) {
  .sf-canvas { height: auto !important; min-height: 0 !important; display: flex; flex-direction: column;
    gap: 18px; padding: 16px 18px 28px; }
  .sf-block { position: static !important; left: auto !important; top: auto !important;
    width: auto !important; min-height: 0 !important; }
  .sf-block .sf-img { max-height: 320px; }
  .sf-block .sf-banner-inner { padding: 34px 22px; min-height: 300px !important; }
  .sf-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .sf-block[style*="min-height:2400px"] { display: none; }
}

/* Setup guide stages: a checklist the console can actually tick. */
.stack-sm { display: grid; gap: 8px; }
.bw-stage-state { font-size: 12px; color: #5d6b63; margin-left: 10px; }
.bw-stage-state.is-dirty { color: #9a4b00; font-weight: 600; }

/* Toolbar must survive a narrow preview panel: wrap instead of overlapping. */
.bw-body { display: flex; flex-direction: column; min-height: 100vh; }
.bw-bar { flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 12px; row-gap: 8px; }
.bw-bar-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
.bw-shell { flex: 1 1 auto; height: auto; min-height: 0; }
.bw-stage-top { flex-wrap: wrap; gap: 2px 10px; height: auto; padding: 6px 12px; align-items: center; }
@media (max-width: 560px) {
  .bw-bar-title { display: none; }
  .bw-template-select { min-width: 108px; max-width: 128px; }
  .bw-exit { font-size: 12px; }
}

/* The editor must scroll. Earlier the shell was auto-height, so the tall canvas
   grew the page while body hid the overflow: nothing could be reached below the
   fold. The shell now owns the remaining height and each pane scrolls. */
.bw-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.bw-bar { flex: 0 0 auto; }
.bw-shell { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; }
.bw-stage { min-height: 0; }
.bw-canvas-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.bw-bar-link { color: #c9ced8; font-size: 12.5px; text-decoration: none; border: 1px solid #2a2f3a;
  border-radius: 8px; padding: 6px 10px; white-space: nowrap; }
.bw-bar-link:hover { color: #fff; border-color: #4b5563; }

/* ---------- theme gallery ---------- */
.th-page { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.th-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 8px; }
.th-title { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.th-sub { color: #5b6472; max-width: 620px; margin: 0; font-size: 14px; }
.th-palettes { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.th-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 999px;
  border: 1px solid #e2e6ee; background: #fff; text-decoration: none; color: #111827; font-size: 12.5px; }
.th-swatch.is-current { border-color: #111827; box-shadow: 0 0 0 2px rgba(17,24,39,.08); }
.th-dots { display: inline-flex; gap: 3px; }
.th-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.th-card { background: #fff; border: 1px solid #e2e6ee; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; }
.th-shot { position: relative; height: 250px; overflow: hidden; background: #f4f6fa; border-bottom: 1px solid #e2e6ee; }
.th-shot-inner { position: absolute; top: 0; left: 0; width: 1200px; transform: scale(.3); transform-origin: top left;
  pointer-events: none; }
.th-card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.th-card-name { font-weight: 650; font-size: 15px; }
.th-card-hint { color: #5b6472; font-size: 12.5px; line-height: 1.45; flex: 1; }
.th-card-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.th-badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #14532d; background: #e8f7ee; border-radius: 999px; padding: 3px 9px; }
.bw-gallery { margin: 0; min-height: 100vh; background: #eef1f5; color: #111827;
  font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
.th-dot { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .18); }
.th-shot { background: #0b0d12; }

/* Storefront header block: logo/monogram, name and the main links. */
.sf-navbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.sf-nav-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.sf-nav-logo { height: 40px; max-width: 150px; object-fit: contain; display: block; }
.sf-nav-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.sf-nav-name { font-weight: 700; letter-spacing: -.01em; }
.sf-nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.sf-nav-links a { color: inherit; text-decoration: none; font-size: 14px; opacity: .82; }
.sf-nav-links a:hover { opacity: 1; text-decoration: underline; }
.sf-logo { display: block; }
.sf-logo-mark { display: grid; place-items: center; font-weight: 700; letter-spacing: .02em; }
@media (max-width: 760px) {
  .sf-navbar { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* The shop's own header, shown above the canvas so a page is never designed in
   a vacuum. It comes from the storefront settings, not from the document. */
.bw-chrome { display: flex; align-items: center; gap: 18px; padding: 10px 22px;
  background: #fff; border-bottom: 1px solid #e2e6ee; font-size: 13px; color: #111827; }
.bw-chrome-brand { display: inline-flex; align-items: center; gap: 9px; }
.bw-chrome-logo { height: 26px; max-width: 110px; object-fit: contain; display: block; }
.bw-chrome-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px; }
.bw-chrome-name { font-weight: 700; letter-spacing: -.01em; }
.bw-chrome-links { color: #5b6472; font-size: 12.5px; }
.bw-chrome-cart { margin-left: auto; border: 1px solid #e2e6ee; border-radius: 999px; padding: 4px 11px;
  font-size: 12px; color: #374151; }
.bw-chrome { flex-wrap: nowrap; }
.bw-chrome-brand { flex: none; }
.bw-chrome-links { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 620px) { .bw-chrome-links { display: none; } }
