:root {
  --ink: #21302D;
  --ink-2: #3A4A46;
  --ink-soft: #5D6966;
  --paper: #F9F3EE;
  --paper-2: #F2EAE2;
  --card: #FFFCF9;
  --line: #E4DAD0;
  --line-2: #D5C9BD;
  --red: #C7222E;
  --red-d: #A51A24;
  --ok: #2E7D4F;
  --warn: #B7791F;
  --bad: #C7222E;
  --spectrum: linear-gradient(90deg, #19B8D6 0%, #F4D03F 50%, #C7222E 100%);
  /* Store branding (Designer app → Studio branding) overrides these */
  --bar: var(--ink);
  --on-bar: #F9F3EE;
  --on-ink: #F9F3EE;
  --on-accent: #fff;
  --stripe-h: 3px;
  --logo-h: 28px;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.35rem);
  --text-xl: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(33, 48, 45, .06), 0 6px 20px rgba(33, 48, 45, .06);
  --font: 'Archivo', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.eyebrow {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); font-stretch: 90%;
}
.hint { font-size: var(--text-xs); color: var(--ink-soft); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(14px, 2vw, 24px);
  background: var(--bar); color: var(--on-bar);
}
.spectrum { position: absolute; left: 0; right: 0; bottom: 0; height: var(--stripe-h); background: var(--spectrum); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; height: var(--logo-h); max-height: 44px; width: auto; max-width: 200px; object-fit: contain; }
.brand-logo[hidden] { display: none; }
.brand-name { font-weight: 800; font-stretch: 112%; letter-spacing: .02em; font-size: var(--text-sm); white-space: nowrap; }
.brand-name b { font-weight: 500; opacity: .75; }
.brand-div { width: 1px; height: 20px; background: color-mix(in srgb, var(--on-bar) 25%, transparent); }
.brand-app { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; }
.chip { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; }
.chip-proto { background: rgba(244, 208, 63, .16); color: #F4D03F; border: 1px solid rgba(244, 208, 63, .35); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.save-state { font-size: var(--text-xs); opacity: .7; margin-right: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar .icon-btn:hover { background: color-mix(in srgb, var(--on-bar) 10%, transparent); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.ghost-btn {
  white-space: nowrap; text-transform: none;
  height: 36px; padding: 0 12px; border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: 600;
  background: transparent; border: 1px solid color-mix(in srgb, var(--on-bar) 28%, transparent);
}
.ghost-btn:hover { background: color-mix(in srgb, var(--on-bar) 8%, transparent); }

/* ---------- Layout ---------- */
.studio {
  display: grid;
  grid-template-columns: minmax(330px, 360px) minmax(0, 1fr) minmax(320px, 360px);
  gap: 0;
  min-height: calc(100vh - 60px);
}
.tools { display: grid; grid-template-columns: 76px 1fr; border-right: 1px solid var(--line); background: var(--card); min-height: 0; }
.rail { display: flex; flex-direction: column; gap: 4px; padding: 12px 8px; border-right: 1px solid var(--line); background: var(--paper-2); }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--r);
  background: transparent; border: 0; font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.rail-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: rgba(33, 48, 45, .06); }
.rail-btn.is-active { background: var(--ink); color: var(--on-ink); }
.panel { padding: 18px 16px 28px; overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 60px; }
.panel h2 { font-size: var(--text-lg); margin: 0 0 4px; font-weight: 800; font-stretch: 95%; letter-spacing: -.005em; }
.panel .lede { margin: 0 0 16px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; }
.panel-sec { margin-top: 20px; }
.panel-sec > .eyebrow { display: block; margin-bottom: 8px; }
.back-link { background: none; border: 0; padding: 0; font-size: var(--text-xs); font-weight: 700; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px; }
.back-link:hover { color: var(--ink); }

/* Product cards */
.prod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prod-card {
  text-align: left; padding: 10px; border-radius: var(--r); border: 1px solid var(--line); background: #fff;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s;
}
.prod-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.prod-card.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.prod-thumb { aspect-ratio: 1; border-radius: var(--r-sm); background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.prod-thumb svg { width: 92%; height: 92%; }
.prod-name { font-weight: 700; font-size: var(--text-sm); }
.prod-meta { display: flex; justify-content: space-between; align-items: center; font-size: var(--text-xs); color: var(--ink-soft); }
.tag-proposed { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--warn); }

/* Upload */
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 26px 16px; text-align: center; background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--ink); background: var(--paper); }
.dropzone svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: var(--text-sm); }
.dropzone small { color: var(--ink-soft); font-size: var(--text-xs); }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: var(--text-sm); color: var(--ink-2); }
.tips li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; line-height: 1.4; }
.tips li::before { content: ''; width: 8px; height: 8px; margin-top: 6px; border-radius: 2px; background: var(--spectrum); }

/* Buttons */
.btn {
  text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; font-weight: 700; font-size: var(--text-sm);
}
.btn:hover { border-color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--on-ink) !important; border-color: var(--ink); }
.btn-dark:hover { background: #2C3E3A; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: var(--text-xs); font-weight: 700; }
.pill:hover { border-color: var(--ink); }

/* Text tools */
.font-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.font-btn {
  height: 52px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; font-size: 19px; line-height: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; overflow: hidden;
}
.font-btn small { font-family: var(--font); font-size: 10px; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; }
.font-btn:hover { border-color: var(--line-2); }
.font-btn.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.field { display: grid; gap: 6px; }
.field label, .field .label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
textarea.input, input.input, select.input {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; padding: 9px 10px; font-size: var(--text-base);
}
textarea.input { resize: vertical; min-height: 64px; line-height: 1.35; }
.inks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ink {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); padding: 0;
  box-shadow: inset 0 0 0 2px #fff;
}
.ink.is-active { outline: 2px solid var(--ink); outline-offset: 2px; }
.ink-none { background: repeating-linear-gradient(135deg, #fff 0 4px, #eee 4px 8px); position: relative; }
.ink-none::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; background: var(--red); transform: rotate(-45deg); }
.ink-picker { width: 26px; height: 26px; border: 0; padding: 0; background: none; border-radius: 50%; overflow: hidden; cursor: pointer; }
.ink-picker::-webkit-color-swatch-wrapper { padding: 0; }
.ink-picker::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.15); border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red) !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-row { display: grid; grid-template-columns: 1fr 52px; gap: 10px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.range-val { font-family: var(--mono); font-size: var(--text-xs); text-align: right; color: var(--ink-2); }
.seg { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: var(--text-xs); font-weight: 700; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-active { background: var(--ink); color: var(--on-ink); }
.stack { display: grid; gap: 14px; }

/* Clipart */
.clip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.clip-btn { aspect-ratio: 1; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.clip-btn svg { width: 58%; height: 58%; fill: var(--ink); }
.clip-btn:hover { border-color: var(--ink); }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-btn { text-align: left; border-radius: var(--r); border: 1px solid var(--line); background: #fff; padding: 8px; display: grid; gap: 6px; }
.tpl-btn:hover { border-color: var(--ink); }
.tpl-prev { aspect-ratio: 6/5; border-radius: var(--r-sm); background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.tpl-prev img { width: 84%; height: 84%; object-fit: contain; }
.tpl-name { font-weight: 700; font-size: var(--text-sm); }
.tpl-hint { font-size: var(--text-xs); color: var(--ink-soft); }

/* Layers */
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.layer {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 6px 6px 6px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; cursor: pointer;
}
.layer.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.layer-thumb { width: 34px; height: 34px; border-radius: 5px; background: var(--paper); display: grid; place-items: center; font-weight: 800; font-size: 13px; overflow: hidden; }
.layer-thumb img { max-width: 100%; max-height: 100%; }
.layer-name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-meta { font-size: var(--text-xs); color: var(--ink-soft); font-family: var(--mono); }
.layer-acts { display: flex; gap: 2px; }
.mini { width: 28px; height: 28px; border-radius: 5px; border: 0; background: transparent; display: grid; place-items: center; }
.mini:hover { background: var(--paper); }
.mini svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty-note { padding: 18px; border: 1px dashed var(--line-2); border-radius: var(--r); text-align: center; color: var(--ink-soft); font-size: var(--text-sm); }

/* Quality badges */
.qbadge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.qbadge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.q-ok { color: var(--ok); background: rgba(46, 125, 79, .1); }
.q-warn { color: var(--warn); background: rgba(183, 121, 31, .12); }
.q-bad { color: var(--bad); background: rgba(199, 34, 46, .1); }
.spec-card { border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 12px; display: grid; gap: 10px; }
.spec-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: var(--text-sm); }
.spec-row .mono { font-size: var(--text-xs); }
.note-inline { font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.45; margin: 0; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--text-sm); font-weight: 600; }
.toggle input { width: 38px; height: 22px; appearance: none; background: var(--line-2); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { transform: translateX(16px); }

/* ---------- Stage ---------- */
.stage-col { display: flex; flex-direction: column; align-items: center; padding: 16px clamp(12px, 2vw, 28px) 24px; min-width: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(33, 48, 45, .09) 1px, transparent 0) 0 0 / 18px 18px,
    var(--paper);
}
.view-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.vtab {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); font-size: var(--text-sm); font-weight: 600;
}
.vtab:hover { border-color: var(--ink); }
.vtab.is-active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.vtab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.vtab .dot.on { background: var(--red); }
.vtab.is-active .dot:not(.on) { background: color-mix(in srgb, var(--on-ink) 35%, transparent); }
.stage-wrap { position: relative; width: 100%; max-width: min(640px, calc((100vh - 258px) * 600 / 640)); min-width: 280px; }
.stage { position: relative; width: 100%; aspect-ratio: 600 / 640; user-select: none; touch-action: none; }
.garment { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .canvas-container { position: absolute !important; inset: 0; }
.print-area {
  position: absolute; border: 1.5px dashed rgba(33, 48, 45, .45); border-radius: 2px; pointer-events: none;
  transition: border-color .2s, opacity .25s;
}
.print-area.pa-hidden { opacity: 0; }
.print-area.on-dark { border-color: rgba(249, 243, 238, .55); }
.pa-label {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, calc(-100% - 4px)); white-space: nowrap;
  font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 4px; background: rgba(33, 48, 45, .82); color: var(--on-ink);
}
.guide { position: absolute; background: var(--red); opacity: 0; pointer-events: none; z-index: 3; transition: opacity .1s; }
.guide-v { width: 1px; }
.guide-h { height: 1px; }
.guide.show { opacity: .9; }
.drop-hint {
  position: absolute; inset: 0; display: none; place-items: center; z-index: 5; pointer-events: none;
  background: rgba(249, 243, 238, .7); border: 2px dashed var(--ink); border-radius: var(--r-lg);
  font-weight: 700;
}
.drop-hint.show { display: grid; }
.empty-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 10px 9px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line);
}
.empty-copy { display: grid; gap: 1px; min-width: 0; }
.empty-hint strong { font-size: var(--text-sm); }
.empty-hint span { font-size: var(--text-xs); color: var(--ink-soft); }
.empty-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-hint[hidden] { display: none; }

.selbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 6px 6px 6px 12px; border-radius: var(--r); background: var(--ink); color: var(--on-ink);
  width: 100%; max-width: 640px;
}
.selbar[hidden] { display: none; }
.sel-size { font-size: var(--text-xs); opacity: .9; }
.sel-actions { display: flex; gap: 2px; flex-wrap: wrap; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border-radius: 6px; border: 0; background: transparent; font-size: var(--text-xs); font-weight: 600; }
.tool-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn:hover { background: color-mix(in srgb, var(--on-ink) 12%, transparent); }
.tool-btn.danger:hover { background: var(--red); }

.colorbar { width: 100%; max-width: 640px; margin-top: 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.cdrop-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent; border-radius: var(--r); text-align: left; min-height: 48px; }
.cdrop-btn:hover { background: var(--paper); }
.cdrop-cur { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.cdrop-btn .hint { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cdrop-sw { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); display: inline-block; }
.color-name { font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.sbub-chev { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.colorbar.open .cdrop-btn .sbub-chev, .sbub.open .sbub-chev { transform: rotate(180deg); }
.cdrop-pop { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.cdrop-pop[hidden] { display: none; }
.cdrop-search { width: 100%; }
.clist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.crow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-size: var(--text-sm); font-weight: 600; min-height: 38px; }
.crow[hidden] { display: none; }
.crow:hover { background: var(--paper); }
.crow span { flex: 1; min-width: 0; }
.crow-check { width: 16px; height: 16px; fill: none; stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.crow.is-active { background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); }
.crow.is-active .crow-check { visibility: visible; }
.clist-empty { margin: 4px; font-size: var(--text-xs); color: var(--ink-soft); }
.clist-empty[hidden] { display: none; }

/* ---------- Stage bubbles ---------- */
.stage-ctrls { position: absolute; top: 10px; left: 10px; z-index: 20; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: calc(100% - 20px); }
.sbub { position: relative; }
.sbub[hidden] { display: none !important; }
.sbub.open { z-index: 2; }
.sbub-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 252, 249, .95); box-shadow: 0 2px 8px rgba(33,48,45,.12); font-size: var(--text-xs); font-weight: 600; color: var(--ink); white-space: nowrap; backdrop-filter: blur(6px); }
.sbub-btn:hover, .sbub.open .sbub-btn { border-color: var(--ink); }
.sbub-lab { color: var(--ink-2); }
.sbub-val { font-weight: 800; font-family: var(--mono); font-size: 11.5px; }
.sbub-val:empty { display: none; }
.sbub-pop { display: none; position: absolute; top: calc(100% + 6px); left: 0; width: max-content; min-width: 240px; max-width: min(400px, calc(100vw - 40px)); padding: 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: 0 14px 34px -10px rgba(33,48,45,.35); }
.sbub.open .sbub-pop { display: grid; gap: 6px; }
.sbub-pop .fit-head, .sbub-pop .preset-head { margin-bottom: 2px; }
.sbub-pop .emb-bar { margin-top: 8px; }

/* ---------- Order ---------- */
.order { border-left: 1px solid var(--line); background: var(--card); padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto; }
.order-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.order-title { margin: 2px 0 0; font-size: var(--text-xl); font-weight: 800; font-stretch: 92%; letter-spacing: -.01em; line-height: 1.05; }
.unit-price { text-align: right; display: grid; }
.unit-price .mono { font-size: var(--text-lg); font-weight: 600; }
.unit-price small { font-size: var(--text-xs); color: var(--ink-soft); }
.block { border-top: 1px solid var(--line); padding-top: 14px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; }
.locs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.loc { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; font-size: var(--text-sm); padding: 7px 10px; border-radius: var(--r-sm); background: var(--paper); cursor: pointer; border: 1px solid transparent; }
.loc:hover { border-color: var(--line-2); }
.loc .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.loc.used .dot { background: var(--red); }
.loc .fee { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-soft); }
.loc.used .fee { color: var(--ink); }
.loc .spec { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.size { display: grid; gap: 3px; }
.size label { font-size: var(--text-xs); font-weight: 700; text-align: center; color: var(--ink-2); }
.size label small { font-weight: 500; color: var(--ink-soft); }
.size input {
  width: 100%; height: 38px; text-align: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff;
  font-family: var(--mono); font-size: var(--text-sm); -moz-appearance: textfield;
}
.size input::-webkit-outer-spin-button, .size input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size input.has { border-color: var(--ink); background: var(--paper); font-weight: 600; }
.sizes.one { grid-template-columns: 1fr; }
.qty-step { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; }
.qty-step button { height: 40px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; font-size: 18px; font-weight: 700; }
.qty-step input { height: 40px; }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.tier { text-align: center; padding: 6px 2px; border-radius: 6px; background: var(--paper); font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.tier b { display: block; font-size: var(--text-xs); color: var(--ink); }
.tier.is-on { background: var(--ink); color: color-mix(in srgb, var(--on-ink) 75%, transparent); }
.tier.is-on b { color: var(--on-ink); }
.tier-next { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--ink-2); margin-top: 4px; }
.tier-next b { color: var(--red); }
.totals dl, dl.rv-bd { margin: 0 0 8px; display: grid; gap: 6px; }
.totals dl div, dl.rv-bd div { display: flex; justify-content: space-between; font-size: var(--text-sm); color: var(--ink-2); gap: 10px; }
.totals dd, dl.rv-bd dd { margin: 0; font-family: var(--mono); font-size: var(--text-xs); }
.totals .disc dd, dl.rv-bd .disc dd { color: var(--ok); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px dashed var(--line-2); font-weight: 800; font-size: var(--text-lg); }
.ship-note { margin-top: 8px; font-size: var(--text-xs); color: var(--ink-soft); }
.warnings { display: grid; gap: 6px; margin: 12px 0 0; }
.warn { display: grid; grid-template-columns: 16px 1fr; gap: 8px; font-size: var(--text-xs); line-height: 1.4; padding: 8px 10px; border-radius: var(--r-sm); background: rgba(183, 121, 31, .1); color: #7A5214; }
.warn.bad { background: rgba(199, 34, 46, .08); color: var(--red-d); }
.warn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.cta {
  width: 100%; height: 50px; margin-top: 12px; border: 0; border-radius: var(--r); background: var(--red); color: var(--on-accent);
  font-weight: 800; font-size: var(--text-base); letter-spacing: .02em; transition: background .15s, transform .05s;
}
.cta:hover { background: var(--red-d); }
.cta:active { transform: translateY(1px); }
.cta:disabled { background: var(--line-2); color: var(--ink-soft); cursor: not-allowed; }

.mobile-bar { display: none; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(21, 30, 28, .55); display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: hidden; display: flex; flex-direction: column; background: var(--card); border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-card.narrow { width: min(620px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 2px 0 0; font-size: var(--text-xl); font-weight: 800; font-stretch: 92%; }
.modal-body { padding: 20px; overflow-y: auto; }
.handoff { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
.mockups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mock { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding: 8px; display: grid; gap: 6px; }
.mock img { width: 100%; aspect-ratio: 600/640; object-fit: contain; }
.mock span { font-size: var(--text-xs); font-weight: 700; text-align: center; }
.files { display: grid; gap: 8px; margin-top: 14px; }
.file { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: #fff; }
.file-thumb { width: 52px; height: 52px; border-radius: 6px; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.file-thumb img { max-width: 100%; max-height: 100%; }
.file-name { font-family: var(--mono); font-size: var(--text-xs); font-weight: 600; word-break: break-all; }
.file-meta { font-size: var(--text-xs); color: var(--ink-soft); }
.kv { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.kv th, .kv td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { font-weight: 600; color: var(--ink-soft); width: 40%; font-size: var(--text-xs); padding-right: 10px; }
.kv td { font-family: var(--mono); font-size: var(--text-xs); }
.flow { margin-top: 16px; padding: 14px; border-radius: var(--r); background: var(--ink); color: var(--on-ink); font-size: var(--text-sm); line-height: 1.5; }
.flow ol { margin: 6px 0 0; padding-left: 18px; }
.flow .eyebrow { color: color-mix(in srgb, var(--on-ink) 65%, transparent); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.prose { font-size: var(--text-sm); line-height: 1.55; color: var(--ink-2); }
.prose h3 { font-size: var(--text-base); color: var(--ink); margin: 18px 0 6px; }
.prose ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.prose p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 70;
  background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 999px; font-size: var(--text-sm); font-weight: 600;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .studio { grid-template-columns: minmax(300px, 330px) minmax(0, 1fr); }
  .order { grid-column: 1 / -1; position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .order-head { grid-column: 1 / -1; }
  .order .block:first-of-type { grid-column: 1 / -1; }
  .locs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 820px) {
  .studio { display: flex; flex-direction: column; }
  .stage-col { order: 1; padding: 12px 12px 16px; }
  .tools { order: 2; grid-template-columns: 1fr; border-right: 0; border-top: 1px solid var(--line); }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; position: sticky; top: 60px; z-index: 10; }
  .rail-btn { flex: 1; min-width: 64px; }
  .panel { position: static; max-height: none; }
  .order { order: 3; display: flex; padding-bottom: 96px; }
  .stage-wrap { max-width: 100%; }
  .brand-name, .brand-div { display: none; }
  .save-state { display: none; }
  .hide-sm { display: none; }
  .ghost-btn { text-transform: capitalize; }
  .chip-proto { display: none; }
  .view-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .vtab { flex: none; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 12px; align-items: center; justify-content: space-between;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(33,48,45,.08);
  }
  .mobile-bar > div { display: grid; }
  .mobile-bar .mono { font-weight: 700; font-size: var(--text-lg); }
  .mobile-bar small { font-size: var(--text-xs); color: var(--ink-soft); }
  .mobile-bar .cta { width: auto; padding: 0 22px; margin: 0; height: 46px; }
  .handoff { grid-template-columns: 1fr; }
  .sel-actions .tool-btn span { display: none; }
  .toast { bottom: 90px; }
}
@media (max-width: 420px) {
  .ghost-btn { padding: 0 8px; font-size: var(--text-xs); }
  .sizes { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Photo stage ---------- */
.stage { border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 1px 2px rgba(33,48,45,.06), 0 18px 40px -18px rgba(33,48,45,.25); background: #F6F1EB; }
.stage.is-loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.stage .upper-canvas { z-index: 3; }
.stage.m-dtg .lower-canvas { filter: saturate(.9) contrast(.97); }
.design-shade { z-index: 1; }
.print-area { z-index: 2; }
.prod-thumb img { width: 92%; height: 92%; object-fit: contain; }

/* ---------- Placement presets ---------- */
.preset-bar { width: 100%; max-width: 640px; margin: 0 0 10px; }
.preset-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.preset-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.pgroup { display: grid; gap: 4px; }
.pgroup-lab { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.pchips { display: flex; gap: 4px; flex-wrap: wrap; }
.pchip { display: grid; justify-items: center; gap: 1px; min-width: 54px; padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card); font-size: var(--text-xs); font-weight: 700; line-height: 1.1; }
.pchip:hover:not(:disabled) { border-color: var(--ink); }
.pchip.is-active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.pchip:disabled { opacity: .38; cursor: not-allowed; text-decoration: line-through; }
.preset-fixed { display: flex; justify-content: center; gap: 10px; align-items: baseline; font-size: var(--text-sm); }

/* ---------- Print method ---------- */
.method-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mopt { text-align: left; display: grid; gap: 4px; padding: 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: #fff; }
.mopt:hover:not(:disabled) { border-color: var(--ink); }
.mopt.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper); }
.mopt:disabled { opacity: .45; cursor: not-allowed; }
.mopt-top { display: flex; align-items: baseline; gap: 6px; }
.mopt-top b { font-size: var(--text-base); font-weight: 800; }
.mopt-top small { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
.mopt-blurb { font-size: var(--text-xs); color: var(--ink-2); line-height: 1.35; }
.mopt.is-active .mopt-top b { color: var(--red); }
.method-note { margin: 8px 0 0; font-size: var(--text-xs); color: var(--ink-soft); }

/* ---------- Fit / mockup size ---------- */
.fit-bar { width: 100%; max-width: 640px; margin: 0 0 8px; display: grid; gap: 5px; }
.fit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.zchips { display: flex; gap: 4px; flex-wrap: wrap; }
.zchip { min-width: 40px; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: var(--text-xs); font-weight: 700; }
.zchip:hover { border-color: var(--ink); }
.zchip.is-active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.pchip.needs-size { border-style: dashed; }
.pchip-size { font-size: 9.5px; font-weight: 800; color: var(--warn); letter-spacing: .02em; }
.pchip.is-active .pchip-size { color: #F4D03F; }
.pnote { font-size: var(--text-xs); color: var(--ink-soft); max-width: 340px; line-height: 1.35; }
.print-area.no-fit { border-color: var(--bad) !important; border-style: dashed !important; background: rgba(199,34,46,.06); }
.print-area.no-fit .pa-label { background: var(--bad); color: #fff; }
.fit-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin-bottom: 8px; }
.fit-chips[hidden] { display: none; }
.fchip { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; }
.fchip b { font-size: var(--text-sm); font-weight: 800; }
.fchip small { font-size: 10.5px; color: var(--ink-soft); line-height: 1.25; }
.fchip:hover { border-color: var(--ink); }
.fchip.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper); }
.fchip.is-active b { color: var(--red); }
.style-list { display: grid; gap: 6px; }
.scard { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; }
.scard:hover { border-color: var(--ink); }
.scard.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--paper); }
.scard-dots { display: flex; flex: none; }
.scard-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); margin-left: -4px; }
.scard-dots i:first-child { margin-left: 0; }
.scard-txt { display: grid; flex: 1; min-width: 0; }
.scard-txt b { font-size: var(--text-sm); font-weight: 800; }
.scard-txt small { font-size: 11px; color: var(--ink-soft); }
.scard-n { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Round 4: over-zipper/pocket, crop warnings, embroidery ---------- */
.print-area.over { border-color: var(--warn) !important; border-style: dashed !important; background: rgba(176,112,0,.05); }
.print-area.over .pa-label { background: var(--warn); color: #fff; }
.pchip.may-crop { border-style: dashed; border-color: color-mix(in srgb, var(--bad) 55%, var(--line-2)); }
.pchip.may-crop .pchip-size { color: var(--bad); }
.pchip.over .pchip-size { color: var(--warn); }
.pchip.is-active.may-crop .pchip-size, .pchip.is-active.over .pchip-size { color: #F4D03F; }
.stage.emb-sim .lower-canvas { opacity: 0; }
.emb-bar { display: grid; gap: 6px; width: 100%; }
.emb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.emb-row .mono { font-family: var(--mono); font-size: var(--text-xs); }
.emb-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.emb-toggle input { accent-color: var(--ink); }
.emb-est { font-size: var(--text-sm); font-weight: 700; }
.emb-est small { font-weight: 500; color: var(--ink-soft); }
.emb-threads { display: flex; flex-wrap: wrap; gap: 4px; }
.emb-threads span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 11px; background: var(--card); }
.emb-threads i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.fit-bar[hidden], .preset-bar[hidden] { display: none !important; }
.method-seg .mopt { min-width: 0; }
.method-seg.is-list { grid-template-columns: 1fr; gap: 5px; }
.method-seg.is-list .mopt { grid-template-columns: 112px 1fr; align-items: center; column-gap: 10px; padding: 8px 10px; }
.method-seg.is-list .mopt-top { flex-direction: column; align-items: flex-start; gap: 0; }
.cdrop-btn .eyebrow { white-space: nowrap; }
@media (max-width: 480px) { .cdrop-btn .hint { display: none; } .cdrop-cur { margin-right: auto; } .clist { grid-template-columns: 1fr; max-height: 280px; } }

/* Print box toggle (top-right of the mockup) */
.stage-tog { position: absolute; top: 10px; right: 10px; z-index: 19; }
.sbub-tog .tog { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--line-2); transition: background .15s; flex: none; }
.sbub-tog .tog i { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sbub-tog[aria-checked="true"] .tog { background: var(--ink); }
.sbub-tog[aria-checked="true"] .tog i { transform: translateX(12px); }
.sbub-tog:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Color bar: add-to-order */
.cbar-row { display: flex; align-items: stretch; }
.cbar-row .cdrop-btn { flex: 1; min-width: 0; }
.add-color { flex: none; margin: 7px 7px 7px 0; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--ink); background: var(--ink); color: var(--card); font-size: var(--text-xs); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.add-color:hover:not(:disabled) { background: var(--ink-2); }
.add-color.is-in { background: transparent; color: var(--ink-2); border-color: var(--line-2); cursor: default; }
.add-color svg { width: 14px; height: 14px; fill: none; stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.crow-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crow-wrap[hidden] { display: none; }
.crow-wrap .crow { flex: 1; min-width: 0; }
.crow-add { flex: none; height: 28px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 11.5px; font-weight: 700; color: var(--ink); }
.crow-add:hover { border-color: var(--ink); }
.crow-in { flex: none; font-size: 11px; font-weight: 700; color: var(--ink-soft); padding: 0 8px; }

/* Order lines */
.olines { display: grid; gap: 8px; }
.oline { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px 10px; background: var(--card); display: grid; gap: 8px; }
.oline.is-cur { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--red); }
.oline-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.oline-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 2px 0; text-align: left; }
.oline-pick:hover .oline-txt b { text-decoration: underline; }
.oline-txt { display: grid; min-width: 0; }
.oline-txt b { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oline-txt small { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oline-sum { flex: none; font-size: 11.5px; color: var(--ink-2); }
.oline-x { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--ink-soft); }
.oline-x:hover { border-color: var(--line-2); color: var(--ink); }
.oline-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.oline-tag { justify-self: start; margin-top: -4px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.line-preview { margin-top: 8px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); font-size: var(--text-xs); color: var(--ink-2); }
.line-preview[hidden] { display: none; }
.line-preview span { flex: 1; min-width: 0; }
.btn-sm { height: 30px; padding: 0 12px; font-size: var(--text-xs); }
.add-another { margin-top: 8px; width: 100%; height: 38px; border-radius: var(--r-sm); border: 1px dashed var(--line-2); background: transparent; font-size: var(--text-xs); font-weight: 700; color: var(--ink); }
.add-another:hover { border-color: var(--ink); background: var(--paper); }
.group-note { margin: 8px 0 0; }
.tag-order { font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--red); }
.cart-line { border-top: 1px solid var(--line); }

/* Product setup page (left panel, step 2) */
.setup { display: grid; gap: 16px; }
.back-link { justify-self: start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 4px 6px 4px 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.back-link:hover { color: var(--ink); }
.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.setup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: -8px; }
.setup-head h2 { margin: 0; }
.setup .lede { margin: -10px 0 0; }
.setup .setup-sec { padding-top: 14px; }
.setup .colorbar { margin-top: 0; max-width: none; }
.setup .cdrop-btn .eyebrow, .setup .cdrop-btn .hint { display: none; }
.setup .cdrop-cur { margin-right: auto; min-width: 0; }
.setup .clist { grid-template-columns: 1fr; max-height: 320px; }
.setup .fit-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.setup-next { width: 100%; height: 44px; justify-content: center; }

/* Order summary (right column) */
.osum { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.osum li { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font-size: var(--text-sm); }
.osum li .mono { margin-left: auto; font-size: var(--text-xs); }
.osum-txt { display: grid; min-width: 0; }
.osum-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osum-txt small { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osum li.osum-empty { color: var(--ink-soft); border-style: dashed; background: transparent; }
#orderBlock .add-another { margin-top: 0; margin-bottom: 10px; }

/* ---------- Round 9 ---------- */
/* Steps */
.steps { display: flex; align-items: center; gap: 4px; min-width: 0; }
.step { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px 0 4px; border: 0; border-radius: 999px; background: transparent; color: color-mix(in srgb, var(--on-bar) 72%, transparent); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.step:hover { color: var(--on-bar); background: color-mix(in srgb, var(--on-bar) 8%, transparent); }
.step-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid color-mix(in srgb, var(--on-bar) 40%, transparent); font-family: var(--mono); font-size: 11px; flex: none; }
.step-n svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step.is-done .step-n { background: color-mix(in srgb, var(--on-bar) 16%, transparent); border-color: transparent; color: var(--on-bar); }
.step.is-cur { color: var(--on-bar); }
.step.is-cur .step-n { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.step[aria-disabled="true"] { opacity: .55; }
.step-sep { width: 14px; height: 1.5px; background: color-mix(in srgb, var(--on-bar) 25%, transparent); flex: none; }
.steps-m { display: none; }
@media (max-width: 1280px) { .topbar .steps .step:not(.is-cur) .step-l { display: none; } .topbar .steps .step:not(.is-cur) { padding-right: 4px; } .save-state { display: none; } }

/* Stage: View bubble on the right; inline note under the mockup */
.stage-view, .stage-view.open { position: absolute; top: 10px; right: 10px; z-index: 21; }
.sbub-right .sbub-pop { left: auto; right: 0; min-width: 280px; }
.sbub-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#fitBar[hidden] { display: none; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
#fitBar[hidden] + .vrow { border-top: 0; padding-top: 0; }
.vrow > span { display: grid; gap: 1px; font-size: var(--text-xs); }
.vrow small { color: var(--ink-soft); max-width: 220px; }
.sbub-tog { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: var(--text-xs); flex: none; }
.stage-note { width: 100%; max-width: 640px; min-height: 30px; margin-top: 8px; display: flex; align-items: center; justify-content: center; text-align: center; }
.stage-note span { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); opacity: 0; transition: opacity .2s; max-width: 100%; }
.stage-note.show span { opacity: 1; }
.stage-note span:empty { display: none; }
@media (min-width: 821px) { #toast { display: none; } }

/* Color grid */
.setup .colorbar { padding: 10px; display: grid; gap: 10px; }
.cmode { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }
.cmode button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; border-radius: 6px; background: transparent; font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
.cmode button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.cmode button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(33,48,45,.15); }
.swgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 4px; }
.sw { position: relative; width: 40px; height: 40px; justify-self: center; border-radius: 50%; border: 0; padding: 0; background: transparent; }
.sw[hidden] { display: none; }
.sw i { position: absolute; inset: 3px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); }
.sw.light i { border-color: rgba(0,0,0,.3); }
.sw:hover i { transform: scale(1.06); }
.sw.cur { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.sw-check { position: absolute; right: -3px; top: -3px; width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--red); fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; display: none; box-shadow: 0 0 0 2px var(--card); }
.sw.in .sw-check { display: block; }
.cnow { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-2); min-height: 24px; }
.cnow b { color: var(--ink); }

/* Size cards: steppers, quick fill, tier meter */
.szs { display: grid; grid-template-columns: 1fr; }
.szb { display: none; }
@media (max-width: 820px), (pointer: coarse) {
  .setup .sizes:not(.one) { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .szs { grid-template-columns: 34px 1fr 34px; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
  .szs input { border: 0 !important; border-radius: 0 !important; height: 44px !important; min-width: 0; }
  .szb { display: block; border: 0; background: var(--paper); font-size: 18px; font-weight: 700; color: var(--ink); }
  .szb:active { background: var(--line); }
}
.qfill { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qfill span { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.qfill button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 11.5px; font-weight: 600; }
.qfill button:hover { border-color: var(--ink); }
.tier-meter { margin-top: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--paper); display: grid; gap: 7px; }
.tm-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: var(--text-xs); }
.tm-on { color: var(--ink); font-weight: 700; }
.tm-next { margin-left: auto; color: var(--ink-2); }
.tm-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.tm-bar i { display: block; height: 100%; background: var(--red); border-radius: inherit; transition: width .25s; }
@keyframes lineflash { 0% { box-shadow: 0 0 0 3px rgba(212,59,46,.45); } 100% { box-shadow: 0 0 0 0 rgba(212,59,46,0); } }
.oline.flash { animation: lineflash 1.1s ease-out; }

/* Blank list */
.scard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.scard-tags em { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); }
.scard-tags em.tag-poly { background: #FFF4E5; border-color: #F2C98B; color: #7A4A06; }
.scard-side { display: grid; justify-items: end; gap: 1px; flex: none; }
.scard-add { font-size: 11.5px; font-weight: 800; color: var(--ink); }
.scard-add:empty { display: none; }
.more-blanks { height: 36px; border-radius: var(--r-sm); border: 1px dashed var(--line-2); background: transparent; font-size: var(--text-xs); font-weight: 700; }
.more-blanks:hover { border-color: var(--ink); }

/* Right column */
.mopt-limit { display: block; margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.mopt-limit.off { color: var(--red); }
.loc.is-cur { border-color: var(--ink); }
.loc-more { list-style: none; }
.loc-more button { width: 100%; text-align: left; display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px dashed var(--line-2); background: transparent; font-size: var(--text-sm); font-weight: 700; }
.loc-more button:hover { border-color: var(--ink); }
.loc-more small { font-weight: 500; font-size: 11px; color: var(--ink-soft); }
.unit-why { margin: 6px 0 0; font-size: var(--text-xs); color: var(--ink-2); line-height: 1.45; }
.unit-why small { color: var(--ink-soft); font-size: 11px; }
#qtyTotal .nb { color: var(--red); font-weight: 700; }

/* Setup sub-tabs (phones only) */
.sub-tabs { display: none; }

/* Review modal */
.rv-wait { display: flex; align-items: center; gap: 10px; padding: 30px 0; justify-content: center; color: var(--ink-soft); }
.review { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
.rv-mocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; }
.rv-mocks figure { margin: 0; border-radius: var(--r); overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.rv-mocks img { width: 100%; display: block; }
.rv-mocks figcaption { font-size: 11px; padding: 6px 8px; color: var(--ink-2); }
.rv-side { display: grid; gap: 12px; align-content: start; }
.rv-table-wrap { overflow-x: auto; }
.rv-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.rv-table th { text-align: left; font-weight: 700; color: var(--ink-soft); padding: 6px; border-bottom: 1px solid var(--line); }
.rv-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rv-table td:first-child { display: grid; grid-template-columns: 18px 1fr; column-gap: 6px; }
.rv-table td:first-child .cdrop-sw { width: 16px; height: 16px; grid-row: span 2; margin-top: 1px; }
.rv-table td small { color: var(--ink-soft); }
.rv-bd { margin: 0; }
.rv-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; border-top: 1px solid var(--line); padding-top: 10px; }
.rv-total b { font-size: var(--text-xl); }
.rv-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-acts .btn { flex: 1; justify-content: center; }
.btn-lg { height: 48px; width: 100%; justify-content: center; font-size: var(--text-base); }
.share-row { display: flex; gap: 8px; margin: 12px 0 8px; }
.share-row .input { flex: 1; min-width: 0; font-size: 12px; }
#shareBody .warn { display: block; }

/* Mobile */
.m-sheet { display: none; }
@media (max-width: 820px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .steps-m { display: flex; justify-content: center; width: 100%; margin-bottom: 10px; gap: 2px; }
  .topbar .steps { display: none; }
  .steps-m .step { color: var(--ink-2); padding: 0 6px 0 2px; height: 36px; }
  .steps-m .step .step-l { font-size: 11px; }
  .steps-m .step:not(.is-cur) .step-l { display: none; }
  .steps-m .step-n { border-color: var(--line-2); }
  .steps-m .step.is-done .step-n { background: var(--ink); color: var(--on-ink); }
  .steps-m .step.is-cur { color: var(--ink); }
  .steps-m .step-sep { background: var(--line-2); width: 12px; }
  .stage-note { display: none; }
  .sub-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); }
  .sub-tabs button { height: 40px; border: 0; border-radius: 7px; background: transparent; font-size: var(--text-xs); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink-2); }
  .sub-tabs button b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; background: var(--line); }
  .sub-tabs button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(33,48,45,.15); }
  .sub-tabs button.is-active b { background: var(--red); color: #fff; }
  #setupPage[data-sub="blank"] .setup-sec:not([data-sub="blank"]),
  #setupPage[data-sub="colors"] .setup-sec:not([data-sub="colors"]),
  #setupPage[data-sub="sizes"] .setup-sec:not([data-sub="sizes"]) { display: none; }
  .setup .setup-sec { padding-top: 0; }
  .swgrid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .sw { width: 44px; height: 44px; }
  .m-sum { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; justify-items: start; border: 0; background: transparent; padding: 4px 6px 4px 0; text-align: left; min-height: 44px; }
  .m-sum .mono { font-weight: 700; font-size: var(--text-lg); }
  .m-sum small { grid-column: 1; font-size: var(--text-xs); color: var(--ink-soft); }
  .m-sum svg { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform .15s; }
  .m-sum[aria-expanded="true"] svg { transform: rotate(180deg); }
  .m-sheet { display: grid; gap: 10px; position: fixed; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 39; max-height: 60vh; overflow-y: auto; padding: 14px 16px 16px; background: var(--card); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 40px rgba(33,48,45,.18); }
  .m-sheet[hidden] { display: none; }
  .ms-head { display: flex; justify-content: space-between; align-items: center; }
  .ms-x { width: 44px; height: 44px; margin: -10px -10px -10px 0; display: grid; place-items: center; border: 0; background: transparent; }
  .ms-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
  .ms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .ms-list li { display: flex; align-items: center; gap: 9px; font-size: var(--text-sm); }
  .ms-list li span:not(.mono) { display: grid; flex: 1; min-width: 0; }
  .ms-list small { font-size: 11.5px; color: var(--ink-soft); }
  .ms-tier, .ms-empty { margin: 0; font-size: var(--text-xs); font-weight: 700; }
  .ms-bad { margin: 0; font-size: var(--text-xs); color: var(--red); font-weight: 600; }
  .ms-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ms-acts .btn { height: 44px; justify-content: center; }
  .review { grid-template-columns: 1fr; }
  .rv-mocks { grid-template-columns: repeat(2, 1fr); }
  .stage-view { top: 8px; right: 8px; }
  .sbub-right .sbub-pop { max-width: calc(100vw - 40px); }
}
@media (pointer: coarse) {
  .vtab, .zchip, .fchip, .scard, .pill, .btn, .qfill button, .loc, .sbub-btn, .more-blanks, .cmode button { min-height: 44px; }
  .oline-x { width: 44px; height: 44px; }
}
.cnow #colorHover, .cnow.hov #colorNow { display: none; }
.cnow.hov #colorHover { display: inline; }
@media (max-width: 820px) {
  body.sheet-open .toast { display: none; }
  .rv-table th:nth-child(4), .rv-table td:nth-child(4) { display: none; }
  .rv-table td:first-child { grid-template-columns: 1fr; }
  .rv-table td:first-child .cdrop-sw { display: none; }
}

/* ================= Round 10: Design → Quantity & sizes → Review ================= */
/* Design step: tools + a wide stage. Steps 2–3: a panel opens on the right. */
.studio { grid-template-columns: minmax(330px, 360px) minmax(0, 1fr) 400px; }
body[data-step="design"] .studio { grid-template-columns: minmax(330px, 360px) minmax(0, 1fr); }
body[data-step="design"] .order { display: none; }
.order { gap: 14px; padding: 18px 18px 120px; border-left: 1px solid var(--line); }
.order .op-sec[hidden] { display: none; }
.op-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.op-title { margin: 2px 0 0; font-size: var(--text-xl); font-weight: 800; font-stretch: 92%; letter-spacing: -.01em; line-height: 1.05; }
.op-sec { display: grid; gap: 12px; align-content: start; }
.op-sec .lede { margin: 0; font-size: var(--text-sm); color: var(--ink-2); }
.order .rv-mocks { grid-template-columns: repeat(2, 1fr); }
.order .rv-acts .btn { flex: 1; justify-content: center; }
.lgroup { display: grid; gap: 8px; }
.lgroup + .lgroup { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.lgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lgroup-head > span { display: grid; min-width: 0; }
.lgroup-head b { font-size: var(--text-sm); }
.lgroup-head small { color: var(--ink-soft); font-size: 11px; }
.lgroup-head .btn { flex: none; }
@media (max-width: 1180px) {
  .studio, body[data-step="design"] .studio { grid-template-columns: minmax(300px, 330px) minmax(0, 1fr); }
  .order { position: fixed; top: 60px; right: 0; bottom: 0; width: min(420px, 100%); max-height: none; z-index: 45; display: flex; flex-direction: column; grid-template-columns: none; box-shadow: -18px 0 40px rgba(33,48,45,.14); border-top: 0; }
}

/* Next-step bar: bottom right */
.nextbar {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 12px 34px rgba(33,48,45,.16);
}
body:not([data-step="design"]) .nextbar { right: 0; bottom: 0; width: 400px; border-radius: 0; border-width: 1px 0 0 1px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
@media (max-width: 1180px) { body:not([data-step="design"]) .nextbar { width: min(420px, 100%); } }
.nb-sum { display: grid; min-width: 0; margin-right: auto; }
.nb-sum b { font-size: var(--text-lg); font-weight: 700; }
.nb-sum small { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.nextbar .nb-next { width: auto; margin: 0; height: 46px; padding: 0 20px; white-space: nowrap; }
.nextbar .nb-back { height: 46px; }
.nextbar .nb-back[hidden] { display: none; }
.stage-col { padding-bottom: 96px; }

/* Product cards on the left */
.pcards { display: grid; gap: 10px; margin-top: 8px; }
.pcard { border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 10px; display: grid; gap: 10px; }
.pcard.is-cur { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pcard-top { display: flex; align-items: flex-start; gap: 6px; }
.pcard-main { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; }
.pcard-thumb { width: 64px; height: 64px; flex: none; border-radius: var(--r-sm); background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.pcard-thumb img, .pcard-thumb canvas, .pcard-thumb svg { width: 100%; height: 100%; object-fit: contain; }
.pcard-txt { display: grid; min-width: 0; gap: 1px; }
.pcard-txt b { font-size: var(--text-md, 15px); }
.pcard-txt small { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-txt .tag-poly { justify-self: start; margin-top: 3px; }
.pcard-x { width: 30px; height: 30px; flex: none; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink-soft); }
.pcard-x:hover { background: var(--paper); color: var(--ink); }
.pcard-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pcard-colors { display: grid; gap: 6px; }
.pcard-lab { font-size: 12px; color: var(--ink-2); }
.pcard-sws { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.psw { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); background: var(--c); padding: 0; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.psw.light { border-color: rgba(0,0,0,.3); }
.psw.is-cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.psw:hover { transform: scale(1.08); }
.psw-add { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; font-size: 12px; font-weight: 700; color: var(--ink); cursor: pointer; }
.psw-add:hover { border-color: var(--ink); background: var(--paper); }
.pcard-change { width: 100%; justify-content: center; }
.add-prod { width: 100%; margin-top: 10px; height: 42px; border-radius: var(--r); border: 1px dashed var(--line-2); background: transparent; font-weight: 700; color: var(--ink); cursor: pointer; }
.add-prod:hover { border-color: var(--ink); background: var(--paper); }
.add-prod-note { margin: 6px 0 0; }

/* Color list popover */
.cpop { position: fixed; z-index: 70; width: 320px; max-height: min(520px, calc(100vh - 80px)); display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 20px 50px rgba(33,48,45,.22); }
.cpop[hidden] { display: none; }
.cpop-head { display: flex; align-items: center; gap: 8px; }
.cpop-head b { font-size: var(--text-sm); }
.cpop-head .hint { margin-right: auto; }
.cpop .icon-btn { width: 32px; height: 32px; }
.clist2 { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; display: grid; gap: 1px; align-content: start; }
.crow2 { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--text-sm); }
.crow2:hover, .crow2:focus-visible, .crow2.is-hover { background: var(--paper); outline: none; }
.csw { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.csw.light { border-color: rgba(0,0,0,.32); }
.crow2[hidden] { display: none; }
.crow2 .cname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow2.is-cur .cname { font-weight: 800; }
.crow2.is-in .cname { font-weight: 700; }
.cstate { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.crow2.is-in .cstate { color: var(--ok); font-weight: 700; }
.cadd { font-size: 11px; font-weight: 700; color: var(--ink-soft); opacity: 0; }
.crow2:hover .cadd, .crow2:focus-visible .cadd { opacity: 1; }
.crm { width: 26px; height: 26px; flex: none; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink-soft); cursor: pointer; }
.crm:hover { background: #fff; color: var(--red); }
.crm svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.cpop-tip { margin: 0; font-size: 11px; color: var(--ink-soft); }
.clist-empty { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }

/* Product picker */
.modal-card.wide { width: min(980px, 100%); }
.picker { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; min-height: 420px; }
.ptypes { display: grid; gap: 4px; align-content: start; border-right: 1px solid var(--line); padding-right: 12px; }
.ptype { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.ptype:hover { background: var(--paper); }
.ptype.is-active { border-color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--ink); }
.ptype-thumb { width: 44px; height: 44px; flex: none; border-radius: 6px; background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.ptype-thumb img, .ptype-thumb canvas, .ptype-thumb svg { width: 100%; height: 100%; object-fit: contain; }
.ptype-txt { display: grid; }
.ptype-txt small { font-size: 11.5px; color: var(--ink-soft); }
.pmain { display: grid; gap: 8px; align-content: start; min-width: 0; }
.pmain-head { display: flex; align-items: baseline; gap: 10px; }
.pmain-head h3 { margin: 0; font-size: var(--text-lg); font-weight: 800; }
.pmain .style-list { display: grid; gap: 6px; }
.scard-act { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--red); }
.scard:disabled { cursor: default; }
.scard:disabled .scard-act { color: var(--ink-soft); }
.scard.is-active:disabled { opacity: 1; }
.pick-note { margin: 4px 0 0; }

@media (max-width: 820px) {
  .studio, body[data-step="design"] .studio { display: flex; }
  .order { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; width: auto; z-index: 45; padding: 16px 14px 130px; order: 0; box-shadow: none; }
  .nextbar, body:not([data-step="design"]) .nextbar { left: 0; right: 0; bottom: 0; width: auto; border-radius: 0; border-width: 1px 0 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(33,48,45,.08); }
  .nextbar .nb-next { padding: 0 16px; }
  .nb-sum small { max-width: 150px; }
  .tools { padding-bottom: 90px; }
  .stage-col { padding-bottom: 16px; }
  .cpop.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-height: 72vh; border-radius: 16px 16px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .picker { grid-template-columns: 1fr; min-height: 0; }
  .ptypes { grid-auto-flow: column; grid-auto-columns: 150px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 10px; }
  .modal-card.wide { max-height: calc(100vh - 20px); }
  .sub-tabs { display: none; }
}
.osum-r { margin-left: auto; display: grid; justify-items: end; gap: 1px; flex: none; }
.osum li .osum-r .mono { margin-left: 0; }
.osum-r small { font-size: 11px; color: var(--ink-soft); }
.osum-txt { flex: 1; }
.order .rv-mocks { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.order .rv-mocks figcaption { font-size: 10.5px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-txt .eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Keep the mockup + its action bar clear of the bottom-right Next bar */
@media (min-width: 821px) { .stage-wrap { max-width: min(640px, calc((100vh - 350px) * 600 / 640)); } }
.sbub-val { margin-right: 3px; }

/* ================= Round 11: bigger mockup, sliding panels, side previews ================= */
/* Three tracks always; Next slides the left tools closed and the step panel open (and back). */
:root { --slide: .5s; --ease: cubic-bezier(.32, .72, .24, 1); --rsv: 238px; }
body:not([data-step="design"]) { --rsv: 168px; }
.studio, body[data-step="design"] .studio { grid-template-columns: 360px minmax(0, 1fr) 0px; transition: grid-template-columns var(--slide) var(--ease); }
body:not([data-step="design"]) .studio { grid-template-columns: 0px minmax(0, 1fr) 400px; }
.tools { min-width: 0; overflow: hidden; grid-template-columns: 76px 284px; justify-content: end; visibility: visible; transition: visibility 0s linear 0s; }
body:not([data-step="design"]) .tools { visibility: hidden; transition-delay: var(--slide); border-right-color: transparent; }
body[data-step="design"] .order, .order { display: flex; min-width: 0; overflow-x: hidden; visibility: hidden; transition: visibility 0s linear var(--slide); }
body:not([data-step="design"]) .order { visibility: visible; transition-delay: 0s; }
.order > * { width: 364px; flex: none; }
@media (max-width: 1180px) and (min-width: 821px) {
  .studio, body[data-step="design"] .studio { grid-template-columns: 330px minmax(0, 1fr) 0px; }
  body:not([data-step="design"]) .studio { grid-template-columns: 0px minmax(0, 1fr) 400px; }
  .tools { grid-template-columns: 76px 254px; }
  .order { position: sticky; top: 60px; right: auto; bottom: auto; width: auto; max-height: calc(100vh - 60px); box-shadow: none; border-left: 1px solid var(--line); z-index: auto; }
}
/* Next bar: same width floating (design) or docked under the step panel */
.nextbar, body:not([data-step="design"]) .nextbar { width: 400px; transition: right var(--slide) var(--ease), bottom var(--slide) var(--ease), border-radius var(--slide) var(--ease), box-shadow var(--slide); }
body[data-step="design"] .nextbar { right: 20px; bottom: 20px; width: 380px; }
@media (max-width: 1180px) { body:not([data-step="design"]) .nextbar { width: 400px; } }

/* Stage: mockup as big as the screen allows; side buttons stacked on its right */
.stage-col { padding: 12px clamp(12px, 2vw, 28px) 16px; }
.stage-row { display: flex; align-items: flex-start; justify-content: center; gap: 14px; width: 100%; }
.stage-wrap, .stage-wrap:not(#x) { flex: 0 1 auto; width: min(calc(100% - 118px), calc((100vh - var(--rsv)) * 600 / 640)); max-width: none; min-width: 260px; transition: width var(--slide) var(--ease); }
.stage-wrap .selbar { max-width: none; }
.view-tabs { flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; width: 104px; flex: none; margin: 0; gap: 8px; max-height: calc(100vh - var(--rsv) + 50px); overflow-y: auto; scrollbar-width: thin; }
.vtab { flex-direction: column; align-items: stretch; height: auto; width: 100%; padding: 5px 5px 6px; gap: 4px; border-radius: var(--r); background: var(--card); color: var(--ink); }
.vtab.is-active { background: #fff; color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.vtab.is-active .dot:not(.on) { background: var(--line-2); }
.vtab-mini { display: grid; place-items: center; width: 100%; aspect-ratio: 600 / 640; border-radius: 6px; background: var(--paper); overflow: hidden; }
.vtab-mini img { width: 100%; height: 100%; object-fit: contain; display: block; }
.vtab-mini .spin { width: 16px; height: 16px; }
.vtab-l { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; line-height: 1.15; text-align: center; }
.vtab.has-art .vtab-mini { background: #fff; }
.stage-note { max-width: 640px; }
@media (min-width: 821px) { body[data-step="design"] .stage-note { max-width: calc(100% - 420px); align-self: flex-start; justify-content: flex-start; } }

/* Color list: wider, and the scrollbar no longer covers "+ Add" */
.cpop { width: 360px; }
.clist2 { padding-right: 6px; scrollbar-gutter: stable; }
.crow2 { padding-right: 12px; }
.cadd { flex: none; padding-left: 6px; }

/* Product card: remove the color on the mockup */
.pcard-acts { display: flex; gap: 6px; }
.pcard-acts .btn { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 32px; text-align: center; }
.pcard-rm { color: var(--red); }
.pcard-rm:hover:not(:disabled) { border-color: var(--red); background: #fff5f5; }
.pcard-rm:disabled { color: var(--ink-soft); opacity: .6; cursor: not-allowed; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-d); border-color: var(--red-d); }
.confirm-card { width: min(420px, 100%); }
.confirm-in { padding: 22px 22px 18px; display: grid; gap: 10px; }
.confirm-in h2 { margin: 0; font-size: var(--text-lg); font-weight: 800; }
.confirm-in p { margin: 0; font-size: var(--text-sm); color: var(--ink-2); line-height: 1.45; }
.confirm-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Your uploads */
.up-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.up-item { display: grid; gap: 4px; padding: 5px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; position: relative; }
.up-item:hover { border-color: var(--ink); }
.up-item.is-on { border-color: var(--ink); }
.up-img { display: grid; place-items: center; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.up-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.up-name { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.up-tag { position: absolute; top: 8px; left: 8px; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: var(--ink); color: var(--on-ink); }

@media (max-width: 820px) {
  .order, body[data-step="design"] .order { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; width: auto; transform: translateX(100%); transition: transform var(--slide) var(--ease), visibility 0s linear var(--slide); }
  body:not([data-step="design"]) .order { transform: none; transition: transform var(--slide) var(--ease), visibility 0s; }
  .order > * { width: auto; }
  .tools, body:not([data-step="design"]) .tools { visibility: visible; grid-template-columns: 1fr; }
  .nextbar, body[data-step="design"] .nextbar, body:not([data-step="design"]) .nextbar { width: auto; left: 0; right: 0; bottom: 0; }
  .stage-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .stage-wrap, .stage-wrap:not(#x) { width: 100%; min-width: 0; }
  .view-tabs { flex-direction: row; width: 100%; max-height: none; overflow-x: auto; overflow-y: hidden; gap: 6px; }
  .vtab { flex: none; width: 78px; }
  .cpop { width: auto; }
}
@media (prefers-reduced-motion: reduce) { :root { --slide: 0s; } }
.studio { overflow-x: clip; }
.pcard-acts .btn { padding: 0 6px; font-size: 12.5px; }
body[data-step="design"] .nextbar { width: auto; min-width: 380px; }
@media (max-width: 1180px) and (min-width: 821px) { body[data-step="design"] { --rsv: 272px; } }

/* ================= Round 12: placement column, size strip, zoom, richer toolbar ================= */
/* Zoomable viewport: the stage grows inside it (fit() re-renders the canvas sharp at the new width). */
.stage-box { position: relative; }
.stage-vp { position: relative; width: 100%; aspect-ratio: 600 / 640; overflow: hidden; border-radius: var(--r-lg); background: #F6F1EB; box-shadow: 0 1px 2px rgba(33,48,45,.06), 0 18px 40px -18px rgba(33,48,45,.25); }
.stage-vp.zoomed { overflow: auto; scrollbar-width: thin; cursor: grab; }
.stage-vp.zoomed .upper-canvas { cursor: grab !important; }
.stage-vp.panning, .stage-vp.panning .upper-canvas { cursor: grabbing !important; }
.stage-vp .stage { border-radius: 0; box-shadow: none; overflow: hidden; flex: none; max-width: none; }
.zoom-ctrls { position: absolute; right: 10px; bottom: 10px; z-index: 22; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 252, 249, .95); border: 1px solid var(--line-2); box-shadow: 0 2px 8px rgba(33,48,45,.12); backdrop-filter: blur(6px); }
.zc-btn { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 11.5px; font-weight: 700; }
.zc-btn:hover:not(:disabled) { background: var(--paper); }
.zc-btn:disabled { opacity: .35; cursor: default; }
.zc-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.zc-btn.is-busy svg { animation: spin .8s linear infinite; }
.zc-val { min-width: 46px; }
.zc-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 2px; }

/* Selection toolbar: icon tools in groups */
.selbar { padding: 4px 4px 4px 12px; gap: 6px 10px; }
.sel-actions { align-items: center; gap: 1px; }
.sel-actions .tool-btn { padding: 0 7px; }
.sel-actions .tool-btn[hidden] { display: none; }
.sel-sep { width: 1px; height: 20px; background: color-mix(in srgb, var(--on-ink) 22%, transparent); margin: 0 3px; }
.tool-btn.is-on { background: color-mix(in srgb, var(--on-ink) 18%, transparent); }
.tool-btn.sel-up { background: var(--paper); color: var(--ink); margin-left: 2px; }
.tool-btn.sel-up:hover { background: #fff; }
.empty-hint.has-design strong { color: var(--ink); }

/* Size strip (top-right of the mockup when there's room) */
.size-strip { position: absolute; top: 10px; right: 10px; z-index: 21; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 20px); pointer-events: none; }
.size-strip[hidden] { display: none; }
.size-strip > * { pointer-events: auto; }
.ss-chips { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 252, 249, .95); border: 1px solid var(--line-2); box-shadow: 0 2px 8px rgba(33,48,45,.12); backdrop-filter: blur(6px); }
.ss-chips:empty { display: none; }
.ss-lab { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); padding: 0 6px 0 7px; text-transform: uppercase; letter-spacing: .04em; }
.sschip { min-width: 30px; height: 26px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; font-size: 11.5px; font-weight: 800; color: var(--ink-2); }
.sschip:hover { background: var(--paper); color: var(--ink); }
.sschip.is-active { background: var(--ink); color: var(--on-ink); }
.ss-box { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 3px 0 10px; border-radius: 999px; background: rgba(255, 252, 249, .95); border: 1px solid var(--line-2); box-shadow: 0 2px 8px rgba(33,48,45,.12); }
.ss-boxlab { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.ss-box .sbub-tog { height: 26px; border: 0; background: transparent; padding: 0 6px; }
.stage-row.wide #presetBub, .stage-row.wide #fitBub { display: none !important; }

/* Placement column (left of the mockup), stacked like the print sides */
.place-col { display: none; }
.stage-row.wide .place-col { display: block; width: 138px; flex: none; max-height: calc(100vh - var(--rsv) + 50px); overflow-y: auto; scrollbar-width: thin; }
.stage-row.wide .stage-wrap, .stage-row.wide .stage-wrap:not(#x) { width: min(calc(100% - 280px), calc((100vh - var(--rsv)) * 600 / 640)); }
.place-col .sbub-pop { display: grid; gap: 8px; position: static; width: auto; min-width: 0; max-width: none; padding: 0; border: 0; background: none; box-shadow: none; }
.place-col .preset-head { display: grid; gap: 2px; margin: 0; }
.place-col .preset-head .hint { font-size: 10.5px; line-height: 1.3; }
.place-col .preset-row { display: grid; gap: 10px; }
.place-col .pgroup { display: grid; gap: 5px; }
.place-col .pchips { display: grid; gap: 6px; }
.place-col .pchip { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 6px; padding: 8px 9px; min-height: 0; text-align: left; border-radius: var(--r); }
.place-col .pchip-name { font-size: 12.5px; }
.place-col .pnote { font-size: 11px; line-height: 1.35; }
.place-col .preset-fixed { display: grid; gap: 4px; justify-content: start; text-align: left; }
.place-col .emb-bar { margin-top: 4px; font-size: 11.5px; }
@media (max-width: 820px) { .zoom-ctrls { right: 8px; bottom: 8px; } .zc-btn { min-width: 36px; height: 36px; } }
.stage-box .sel-size { position: absolute; left: 10px; bottom: 10px; z-index: 22; padding: 7px 11px; border-radius: 999px; background: rgba(33, 48, 45, .88); color: var(--on-ink); font-size: 11.5px; opacity: 1; pointer-events: none; }
.stage-box .sel-size[hidden] { display: none; }
.selbar { justify-content: center; padding: 4px; }
.sel-actions { justify-content: center; }
.stage-wrap { container-type: inline-size; container-name: stagew; }
@container stagew (max-width: 600px) {
  .sel-actions .tool-btn:not(.sel-up) span { display: none; }
  .sel-actions .tool-btn { padding: 0 6px; }
  .sel-sep { margin: 0 1px; }
}
@container stagew (max-width: 440px) { .stage-box .sel-size { display: none; } .zc-val { min-width: 40px; } }
@container stagew (max-width: 600px) { .empty-copy span { display: none; } .empty-hint { flex-wrap: nowrap; padding-top: 6px; padding-bottom: 6px; } .empty-copy strong { white-space: nowrap; } }
@container stagew (max-width: 460px) { .empty-hint { flex-wrap: wrap; } }

/* ================= Round 13: one-screen phone layout ================= */
.tool-sheet { display: contents; }
.ts-head, .m-subbar .m-sides:empty, .m-next, .m-total { display: none; }
/* No price until quantities are entered */
.nextbar.no-price .nb-sum { display: none; }
body[data-step="design"] .nextbar.no-price { min-width: 0; }

@media (max-width: 820px) {
  :root { --topH: 56px; --railH: calc(62px + env(safe-area-inset-bottom)); --subH: 48px; }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { padding-bottom: 0; }
  .topbar { height: var(--topH); padding: 0 10px 0 12px; gap: 6px; }
  .brand { min-width: 0; }
  .brand-app { font-size: 14px; white-space: nowrap; }
  .top-actions { gap: 2px; }
  .top-actions .icon-btn { width: 34px; height: 34px; }
  #notesBtn { padding: 0 8px; height: 34px; font-size: 12px; }
  .m-next { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 38px; margin: 0 0 0 4px; padding: 0 16px; font-size: 14px; border-radius: 999px; white-space: nowrap; }
  .m-next:disabled { opacity: .45; }
  .m-total:not([hidden]) { display: inline; font-size: 13px; font-weight: 700; color: var(--on-bar); margin-left: 4px; }
  .nextbar, body[data-step="design"] .nextbar, body:not([data-step="design"]) .nextbar { display: none; }

  /* Everything on one screen: stage column fills the space between the top bar and the bottom tool bar */
  .studio, body[data-step="design"] .studio { height: calc(100dvh - var(--topH) - var(--railH)); overflow: hidden; }
  .stage-col { order: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 10px 8px; overflow: hidden; }
  .m-subbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: var(--subH); flex: none; }
  .m-subbar .steps-m { width: auto; margin: 0; justify-content: flex-start; flex: none; }
  .m-sides { display: flex; justify-content: flex-end; min-width: 0; }
  .m-sides .view-tabs, .m-sides .view-tabs:not(#x) { flex-direction: row; width: auto; max-height: none; overflow-x: auto; gap: 4px; padding: 0; margin: 0; scrollbar-width: none; }
  .m-sides .vtab { width: 38px; padding: 2px; gap: 0; border-radius: 8px; position: relative; }
  .m-sides .vtab-mini { border-radius: 6px; }
  .m-sides .vtab-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .m-sides .vtab.has-art::after { content: ""; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 1.5px #fff; }
  .stage-row { flex: none; width: 100%; }
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - 104px) * 600 / 640)); margin: 0 auto; }
  .empty-hint { padding: 6px 6px 6px 12px; flex-wrap: nowrap !important; }
  .empty-copy span { display: none; }
  .empty-copy strong { white-space: nowrap; font-size: 13.5px; }
  .empty-actions .pill:not([data-go="upload"]) { display: none; }
  .selbar { padding: 3px; }
  .sel-actions { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .sel-actions .tool-btn { flex: none; padding: 0 7px; }

  /* Tool bar stuck to the bottom; menus slide up from it */
  .tools, body:not([data-step="design"]) .tools { order: 2; display: block; border: 0; padding: 0; overflow: visible; visibility: visible; }
  .rail, .rail:not(#x) { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 42; height: var(--railH); padding: 6px 6px env(safe-area-inset-bottom); display: flex; flex-direction: row; gap: 2px; background: var(--card); border: 0; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(33,48,45,.08); overflow: visible; }
  .rail-btn { flex: 1; min-width: 0; height: 50px; }
  body:not(.sheet-up) .rail-btn.is-active { background: transparent; color: var(--ink-2); }
  body:not(.sheet-up) .rail-btn.is-active svg { stroke: currentColor; }
  .tool-sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: var(--railH); z-index: 41; max-height: min(56dvh, 520px); background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 32px rgba(33,48,45,.18); transform: translateY(calc(100% + var(--railH) + 8px)); visibility: hidden; transition: transform .32s var(--ease), visibility 0s linear .32s; }
  body.sheet-up .tool-sheet { transform: none; visibility: visible; transition: transform .32s var(--ease), visibility 0s; }
  .ts-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 14px 12px 6px 16px; position: relative; flex: none; }
  .ts-grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
  .ts-title { font-size: 15px; font-weight: 800; }
  .ts-done { height: 34px; padding: 0 14px; }
  .tool-sheet .panel, .tool-sheet .panel:not(#x) { position: static; flex: 1; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
  .tool-sheet .panel > h2:first-child, .tool-sheet .panel .panel-title:first-child { display: none; }
  body:not([data-step="design"]) .tool-sheet { transform: translateY(calc(100% + var(--railH) + 8px)); visibility: hidden; }

  /* Steps 2–3: the panel slides in under the steps row so the steps stay tappable */
  .order, body[data-step="design"] .order { top: calc(var(--topH) + var(--subH)); bottom: 0; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; border-top: 1px solid var(--line); }
  body:not([data-step="design"]) .rail { visibility: hidden; }
  .toast { bottom: calc(var(--railH) + 14px); }
  body.sheet-up .toast { bottom: auto; top: calc(var(--topH) + 10px); }
  .cpop.sheet { z-index: 60; }
}
@media (max-width: 380px) { .brand-app { display: none; } }
@media (max-width: 820px) {
  .stage-row { margin-top: auto; }
  .stage-col > .stage-note { margin-bottom: auto; }
  .stage-col { padding-left: 6px; padding-right: 6px; }
  .sel-actions { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .order .sizes:not(.one) { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .order .szs { grid-template-columns: 32px minmax(0, 1fr) 32px; }
}
@media (max-width: 820px) { .stage-row { margin: auto 0; } }
@media (max-width: 820px) {
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - 132px) * 600 / 640)); }
  .toast, body.sheet-up .toast { top: calc(var(--topH) + var(--subH) + 8px); bottom: auto; }
}
@container stagew (max-width: 350px) {
  .sbub-btn { padding-left: 10px; padding-right: 8px; gap: 4px; font-size: 12px; }
  #presetBub .sbub-lab { font-size: 0; }
  #presetBub .sbub-lab::before { content: "Print"; font-size: 12px; }
  #fitBub .sbub-lab { font-size: 0; }
  #fitBub .sbub-lab::before { content: "Size"; font-size: 12px; }
}
@media (max-width: 820px) {
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - 162px) * 600 / 640)); }
}
@media (max-width: 360px) {
  .m-sides .vtab { width: 34px; }
  .m-subbar .steps-m .step-sep { width: 8px; }
  .m-subbar .steps-m .step { padding: 0 3px 0 1px; }
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - 196px) * 600 / 640)); }
}
/* Short phones: one-row toolbar that swipes sideways, so the mockup stays big */
@media (max-width: 820px) and (max-height: 720px) {
  .sel-actions { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - 128px) * 600 / 640)); }
}
@media (max-width: 820px) { body.has-total[data-step="design"] .brand-app { display: none; } }
@media (max-width: 820px) and (max-height: 720px) {
  .selbar { position: relative; }
  .selbar::after { content: ""; position: absolute; right: 3px; top: 3px; bottom: 3px; width: 22px; border-radius: 0 10px 10px 0; background: linear-gradient(90deg, transparent, var(--ink)); pointer-events: none; }
}

/* ================= Round 14: phone method row + full-screen menus ================= */
.m-methods { display: none; }
@media (max-width: 820px) {
  :root { --mmH: 40px; }
  body[data-step="design"] .m-methods, .m-methods { display: flex; gap: 4px; width: 100%; height: var(--mmH); flex: none; padding: 3px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); }
  .m-methods:empty { display: none; }
  .mm-opt { flex: 1 1 0; min-width: 0; border: 0; border-radius: 999px; background: transparent; font-size: 13px; font-weight: 800; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mm-opt.is-active { background: var(--ink); color: var(--on-ink); }
  .mm-opt:disabled { opacity: .4; text-decoration: line-through; }
  .stage-col { gap: 6px; }
  .tool-sheet .methods-sec { display: none; }
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - var(--mmH) - 168px) * 600 / 640)); }

  /* Menus take the whole screen */
  .tool-sheet { top: 0; bottom: 0; max-height: none; height: 100dvh; z-index: 55; border-radius: 0; padding-top: env(safe-area-inset-top); transform: translateY(100%); box-shadow: none; }
  body:not([data-step="design"]) .tool-sheet { transform: translateY(100%); }
  .tool-sheet.dragging { transition: none !important; }
  .ts-head { padding: 18px 12px 10px 16px; border-bottom: 1px solid var(--line); touch-action: none; cursor: grab; user-select: none; }
  .ts-grab { top: 7px; width: 44px; height: 5px; margin-left: -22px; }
  .ts-title { font-size: 17px; }
  .tool-sheet .panel, .tool-sheet .panel:not(#x) { padding-top: 12px; }
}
@media (max-width: 360px) {
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - var(--mmH) - 202px) * 600 / 640)); }
  .mm-opt { font-size: 12px; }
}
@media (max-width: 820px) and (max-height: 720px) {
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - var(--mmH) - 134px) * 600 / 640)); }
}
/* Round 14: very narrow mockups (320px phones with the methods row) */
@container stagew (max-width: 250px) {
  .sbub-btn { padding-left: 8px; padding-right: 6px; gap: 3px; }
  #presetBub .sbub-lab, #fitBub .sbub-lab { display: none; }
  .sbub-chev { width: 14px; height: 14px; }
}
@media (max-width: 820px) {
  .toast, body.sheet-up .toast { top: calc(var(--topH) + var(--subH) + var(--mmH, 0px) + 8px); }
}

/* ================= Round 15: phone bubble row, no chip prices, full start bar ================= */
.m-bubs { display: none; }
@media (max-width: 820px) {
  :root { --mbH: 38px; }
  .studio, body[data-step="design"] .studio { min-height: 0; }
  .m-bubs .sbub-btn { min-height: 0; }
  .m-bubs { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: var(--mbH); flex: none; position: relative; z-index: 30; }
  .m-bubs .sbub, .m-bubs .stage-view, .m-bubs .stage-view.open { position: relative; top: auto; right: auto; left: auto; min-width: 0; }
  .m-bubs #presetBub { flex: 0 1 auto; min-width: 0; }
  .m-bubs .sbub-btn { height: var(--mbH); padding: 0 10px 0 12px; gap: 6px; max-width: 100%; }
  .m-bubs .sbub-val { overflow: hidden; text-overflow: ellipsis; }
  .m-bubs #presetBub .sbub-lab, .m-bubs #fitBub .sbub-lab { display: inline; font-size: 12px; }
  .m-bubs #presetBub .sbub-lab::before, .m-bubs #fitBub .sbub-lab::before { content: none; }
  .m-bubs .sbub-pop { z-index: 31; max-width: calc(100vw - 20px); }
  .m-bubs .sbub-right .sbub-pop { right: 0; left: auto; }
  /* No prices on the placement / size chips on phones */
  /* Start bar: Upload, Text, Templates all visible */
  .empty-actions .pill:not([data-go="upload"]) { display: inline-flex; }
  .empty-hint { gap: 6px; }
  .empty-actions { flex-wrap: nowrap; gap: 4px; }
  .empty-actions .pill { padding: 0 10px; height: 32px; font-size: 12.5px; white-space: nowrap; }
}
@media (max-width: 380px) {
  .empty-copy strong { font-size: 12.5px; }
  .empty-actions .pill { padding: 0 8px; font-size: 12px; }
}
@media (max-width: 370px) { .m-bubs .sbub-lab { display: none !important; } }
@media (max-width: 820px) {
  .stage-wrap, .stage-wrap:not(#x) { width: min(100%, calc((100dvh - var(--topH) - var(--railH) - var(--subH) - var(--mmH) - var(--mbH) - var(--r15, 104px)) * 600 / 640)); }
}
@media (max-width: 360px) { :root { --r15: 112px; } }
@media (max-width: 820px) and (max-height: 720px) { :root { --r15: 92px; } }
@media (max-width: 820px) {
  .empty-hint { width: calc(100vw - 20px); max-width: none; margin-left: calc((100% - (100vw - 20px)) / 2); margin-right: 0; box-sizing: border-box; align-items: center; justify-content: space-between; }
  .empty-copy { min-width: 0; }
  .empty-actions .pill, .empty-actions .pill:not([data-go="upload"]) { display: inline-flex; align-items: center; justify-content: center; min-height: 0; height: 34px; line-height: 1; }
}
@media (max-width: 380px) {
  .empty-copy strong { white-space: normal; line-height: 1.15; display: block; }
  .empty-actions .pill[data-go="text"] { font-size: 0; }
  .empty-actions .pill[data-go="text"]::before { content: "Text"; font-size: 12px; }
}
@media (max-width: 820px) {
  .toast, body.sheet-up .toast { top: calc(var(--topH) + var(--subH) + var(--mmH, 0px) + var(--mbH, 0px) + 18px); }
}

/* Round 15: phones — steps 2 & 3 use a sticky bottom bar (total, per-piece on step 2, Review / Add to cart) */
.nb-each { display: none; }
@media (max-width: 820px) {
  body:not([data-step="design"]) .nextbar, body:not([data-step="design"]) .nextbar:not(#x) {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; min-width: 0; z-index: 50;
    align-items: center; gap: 12px; margin: 0; border-radius: 0; border: 0; border-top: 1px solid var(--line);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--card); box-shadow: 0 -8px 24px rgba(33,48,45,.1);
    animation: nbUp .32s var(--ease);
  }
  body:not([data-step="design"]) .nextbar .nb-back { display: none; }
  body:not([data-step="design"]) .nextbar .nb-next { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 999px; flex: none; }
  body:not([data-step="design"]) .nextbar .nb-sum { display: grid; gap: 1px; margin-right: auto; }
  body:not([data-step="design"]) .nextbar.no-price .nb-sum b { display: none; }
  body:not([data-step="design"]) .nb-sum b { font-size: 20px; line-height: 1.1; }
  body:not([data-step="design"]) .nb-sum small { max-width: none; font-size: 12px; }
  body[data-step="sizes"] .nextbar:not(.no-price) .nb-each { display: block; color: var(--ink); font-weight: 700; font-family: var(--mono); font-size: 12px; }
  body[data-step="sizes"] .nextbar:not(.no-price) #nbSub { display: none; }
  /* The top bar keeps Next + total only on the Design step */
  body:not([data-step="design"]) #mNext, body:not([data-step="design"]) #mTotal, body:not([data-step="design"]) #mTotal:not([hidden]) { display: none; }
  .order, body[data-step="design"] .order { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@keyframes nbUp { from { transform: translateY(100%); } to { transform: none; } }

/* Round 16: catalog-driven */
body.no-templates [data-go="clipart"], body.no-templates .rail-btn[data-tool="clipart"] { display: none !important; }
body.draft-catalog::before { content: "Previewing the unpublished draft catalog"; position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 90; background: #B45309; color: #fff; font: 700 11px/1 var(--font-sans, inherit); padding: 6px 10px; border-radius: 999px; pointer-events: none; letter-spacing: .02em; }

/* ---------- In the store (served by the Shopify app) ---------- */
.in-shopify .chip-proto, .in-shopify #notesBtn { display: none; }
.sh-status { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 34px 0; color: var(--ink-soft); }
.sh-done, .sh-error { max-width: 520px; margin: 0 auto; padding: 6px 0 4px; }
.sh-done h3, .sh-error h3 { margin: 6px 0 8px; font-size: 22px; line-height: 1.25; }
.sh-done p, .sh-error p { margin: 0 0 14px; color: var(--ink-soft); line-height: 1.5; }
.sh-error ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.5; font-size: 13px; color: var(--ink-soft); }
.sh-det { margin: 0 0 14px; font-size: 13px; }
.sh-det summary { cursor: pointer; color: var(--ink-soft); }
.sh-error .eyebrow { color: #C7222E; }

/* Exit (top right): back to the product page */
.exit-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 10px; margin-left: 4px; border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  background: transparent; color: inherit; border: 1px solid color-mix(in srgb, var(--on-bar) 28%, transparent); }
.exit-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.exit-btn:hover { background: color-mix(in srgb, var(--on-bar) 10%, transparent); }
.exit-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@media (max-width: 820px) { .exit-btn { width: 34px; height: 34px; padding: 0; justify-content: center; margin-left: 2px; } }
/* Order summary rows */
.totals dl div.bd-unit { font-weight: 700; color: var(--ink); padding: 6px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.totals dl div.bd-unit dd { font-size: var(--text-sm); }
.totals dl div.bd-sub { font-weight: 600; color: var(--ink); }
.totals dl dt { min-width: 0; }
body.sum-simple .totals dl { margin-bottom: 4px; }
.osum li .osum-txt small.osum-runs { margin-left: 0; color: var(--ink-2); font-size: 11px; white-space: normal; }

/* Breakdown sub-line: the design's measured size and the chart size it's priced at. */
#breakdown .bd-note { display: block; font-size: 11.5px; color: var(--muted, #6b6b6b); margin-top: 1px; }
