/* OST Merch Studio 2 */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #101216;
  --ink-2: #353944;
  --muted: #6b7280;
  --faint: #9aa0ab;
  --line: #e5e7eb;
  --line-2: #d3d6dc;
  --soft: #f6f7f9;
  --soft-2: #eef0f3;
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(79, 70, 229, .28);
  --danger: #d92d20;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --sh-1: 0 1px 2px rgba(16, 18, 22, .06);
  --sh-2: 0 1px 2px rgba(16, 18, 22, .06), 0 6px 18px rgba(16, 18, 22, .08);
  --sh-3: 0 24px 64px rgba(16, 18, 22, .22), 0 2px 6px rgba(16, 18, 22, .1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top-h: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-ring); }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 20px 0 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.h3-value { font-weight: 500; color: var(--muted); font-size: 12px; text-align: right; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0; }
.pill { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--soft-2); border-radius: 99px; padding: 2px 8px; }
kbd { font: 600 11px/1 var(--font); background: var(--soft-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; display: inline-block; min-width: 20px; text-align: center; }

/* thin scrollbars inside panels */
.panel, .stage, .dlg { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r); height: 34px; padding: 0 12px;
  font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  box-shadow: var(--sh-1); transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.btn:hover { background: var(--soft); border-color: #c3c7cf; }
.btn:active { background: var(--soft-2); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--soft-2); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(49, 46, 129, .35); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
label.btn { cursor: pointer; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--ink-2);
  display: inline-grid; place-items: center; padding: 0; transition: background .12s;
}
.icon-btn:hover { background: var(--soft-2); color: var(--ink); }
.icon-btn:disabled { opacity: .32; cursor: default; background: transparent; }
.icon-btn svg, .btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.chev { width: 14px !important; height: 14px !important; margin-left: -2px; opacity: .85; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 14px 0 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding-right: 14px; border-right: 1px solid var(--line); height: 32px; }
a.brand { color: inherit; text-decoration: none; }
a.brand:hover .brand-text strong { text-decoration: underline; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; letter-spacing: -.01em; white-space: nowrap; }
.brand-text em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 1px 5px; margin-left: 3px; vertical-align: 1px; }
.brand-text span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.doc { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.design-name {
  min-width: 60px; width: 100%; max-width: 300px; border: 1px solid transparent; border-radius: var(--r);
  height: 34px; padding: 0 10px; font-weight: 600; font-size: 14px; background: transparent; text-overflow: ellipsis;
}
.design-name:hover { background: var(--soft); }
.design-name:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-ring); }
.doc-meta { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.doc-meta::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22a06b; flex: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn-group { display: flex; gap: 2px; }
.divider { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 304px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-3); padding: 6px; display: none; z-index: 50;
}
.menu-pop.open { display: block; }
.menu-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: var(--r-sm); }
.menu-pop button b { display: block; font-weight: 600; font-size: 13px; }
.menu-pop button small { display: block; color: var(--muted); font-size: 11.5px; }
.menu-pop button:hover { background: var(--soft-2); }
.menu-label { font-size: 11px; font-weight: 600; color: var(--faint); padding: 9px 10px 3px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- layout ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: 72px 312px minmax(0, 1fr) 316px; min-height: 0;
  height: calc(100vh - var(--top-h));
}
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; overflow-y: auto; }
.rail button {
  width: 58px; border: 0; background: transparent; border-radius: 10px; padding: 8px 0 6px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; transition: background .12s, color .12s;
}
.rail button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail button:hover { background: var(--soft-2); color: var(--ink); }
.rail button.active { background: var(--accent-soft); color: var(--accent); }
.rail-space { flex: 1; }
.panel { background: var(--surface); overflow-y: auto; padding: 0 16px 24px; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.panel-head { padding: 16px 0 2px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.tab { display: none; }
.tab.active { display: block; }
.foot-note { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- product tab ---------- */
.garment-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.garment-types button {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 0 7px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.15; text-align: center;
  transition: border-color .12s, box-shadow .12s;
}
.garment-types button svg { width: 100%; height: auto; background: radial-gradient(ellipse at 50% 40%, #fff, #eceef2 80%); padding: 4px 8px 0; }
.garment-types button:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.garment-types button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(16, 18, 22, .16);
  padding: 0; position: relative; transition: transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.swatch.custom { background: conic-gradient(#f44, #fd4, #4d4, #4df, #44f, #f4f, #f44); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

/* label patch */
.patch-panel { margin-top: 14px; }
.patch-panel.flash { animation: flash 1.4s ease-out; border-radius: var(--r-lg); }
@keyframes flash { 0%, 45% { box-shadow: 0 0 0 3px var(--accent-ring), 0 0 0 1px var(--accent); } 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); } }
.patch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 11px 12px; background: var(--soft); }
.patch-head strong { display: block; font-size: 13px; }
.patch-head small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.patch-head .toggle { flex: none; }
.patch-logo { display: flex; gap: 12px; align-items: center; margin: 16px 0 4px; }
.patch-thumb {
  width: 84px; height: 54px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .2); display: grid; place-items: center; flex: none; overflow: hidden;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), 0 2px 6px rgba(0, 0, 0, .12); outline: 1px dashed rgba(0, 0, 0, .28); outline-offset: -5px;
}
.patch-thumb img { max-width: 66px; max-height: 38px; }
.patch-thumb span { font-size: 10px; color: var(--muted); font-weight: 600; }
.patch-logo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.patch-move { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.patch-move .btn { flex: none; color: var(--accent); }

/* ---------- templates ---------- */
.tpl-group h3 { margin-top: 18px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 0 8px; text-align: left; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.tpl:hover { border-color: var(--accent); box-shadow: var(--sh-2); transform: translateY(-1px); }
.tpl .tpl-prev { display: grid; grid-template-columns: 1fr 1fr; background: radial-gradient(ellipse at 50% 40%, #fff, #eceef2 80%); padding: 6px 2px 2px; margin-bottom: 5px; }
.tpl .tpl-prev svg { width: 100%; height: auto; }
.tpl strong { font-size: 12.5px; padding: 0 9px; }
.tpl small { color: var(--muted); font-size: 11px; padding: 0 9px; line-height: 1.3; }

/* ---------- text / graphics / uploads ---------- */
.add-text { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 14px; }
.add-text button {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 66px; padding: 8px 12px; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; text-align: left; transition: border-color .12s, box-shadow .12s;
}
.add-text button small { color: var(--muted); font-size: 11.5px; text-align: right; }
.at-demo { white-space: nowrap; overflow: hidden; }
.arch-svg { width: 128px; height: 46px; fill: currentColor; }
.add-text button:hover, .clip-grid button:hover { border-color: var(--accent); box-shadow: var(--sh-2); }
.clip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.clip-grid button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px; transition: border-color .12s, box-shadow .12s; }
.clip-grid svg { width: 100%; height: 100%; }
.drop {
  margin-top: 14px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 26px 12px; display: flex; flex-direction: column; align-items: center;
  gap: 5px; text-align: center; cursor: pointer; color: var(--muted); background: var(--soft); transition: border-color .12s, background .12s, color .12s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.drop strong { color: var(--ink); }
.drop small { font-size: 11.5px; }
.tips { margin: 14px 0 0; padding: 0 0 0 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.tips b { color: var(--ink-2); }

/* ---------- stage ---------- */
.stage-wrap {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: radial-gradient(120% 85% at 50% 36%, #ffffff 0%, #f2f3f6 52%, #dfe2e8 100%);
}
.stage { flex: 1; overflow: auto; min-height: 0; display: grid; place-items: center; padding: 26px 12px 62px; }
.canvas-holder { display: grid; place-items: center; }
.stack { position: relative; }
.stack > svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; overflow: visible; }
.stack > svg.static { will-change: transform; pointer-events: none; }
#ed-over { pointer-events: none; }
#ed-over [data-patch], #ed-over #overlay [data-handle] { pointer-events: auto; }
#print-layer [data-id] { cursor: move; }
.stage-top { position: absolute; left: 14px; right: 14px; top: 12px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; z-index: 3; }
.stage-top > * { pointer-events: auto; }
.product-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px; border-radius: 99px; background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line); box-shadow: var(--sh-1); font-size: 12.5px; color: var(--muted); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.product-chip .dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(16, 18, 22, .18); }
.product-chip b { color: var(--ink); font-weight: 600; }
.zoom { display: flex; align-items: center; gap: 1px; background: rgba(255, 255, 255, .86); border: 1px solid var(--line); border-radius: 10px; padding: 2px; box-shadow: var(--sh-1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.zoom-val { border: 0; background: transparent; min-width: 50px; height: 28px; border-radius: 7px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); }
.zoom-val:hover { background: var(--soft-2); }
.views { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.views button {
  width: 72px; padding: 0 0 5px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .9); box-shadow: var(--sh-1);
  display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; font-weight: 600; color: var(--muted); overflow: hidden;
  transition: border-color .12s, box-shadow .12s, color .12s;
}
.views button:hover { border-color: var(--line-2); box-shadow: var(--sh-2); color: var(--ink); }
.views button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--sh-2); color: var(--accent); }
.view-thumb { display: block; width: 100%; padding: 3px 6px 0; }
.view-thumb svg { width: 100%; height: auto; }
.stage-hint { position: absolute; left: 14px; bottom: 16px; font-size: 11.5px; color: var(--faint); pointer-events: none; max-width: calc(50% - 100px); }

/* selection overlay */
.sel-box { fill: none; stroke: var(--accent); vector-effect: non-scaling-stroke; stroke-width: 1.5; pointer-events: none; }
.sel-handle { fill: #fff; stroke: var(--accent); vector-effect: non-scaling-stroke; stroke-width: 1.5; cursor: nwse-resize; }
.sel-handle.ne, .sel-handle.sw { cursor: nesw-resize; }
.sel-rot { fill: var(--accent); stroke: #fff; vector-effect: non-scaling-stroke; stroke-width: 1.5; cursor: grab; }
.sel-line { stroke: var(--accent); vector-effect: non-scaling-stroke; stroke-width: 1.5; pointer-events: none; }
.guide { stroke: #f43f7a; vector-effect: non-scaling-stroke; stroke-width: 1; stroke-dasharray: 4 3; }
.area { fill: none; stroke: var(--accent); stroke-opacity: .55; vector-effect: non-scaling-stroke; stroke-width: 1; stroke-dasharray: 5 4; }
.area.no { fill: #e5484d; fill-opacity: .12; stroke: #e5484d; stroke-opacity: .55; }

/* ---------- inspector (right) ---------- */
.props-empty { text-align: center; color: var(--muted); padding: 30px 8px 22px; }
.pe-icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: var(--soft-2); display: grid; place-items: center; }
.pe-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.props-empty strong { color: var(--ink); font-size: 14px; }
.props-empty p { margin: 4px 0 14px; font-size: 12.5px; }
.pe-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.props-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
.ph-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ph-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.ph-ico svg { width: 18px; height: 18px; }
.ph-ico img { max-width: 22px; max-height: 22px; }
.pgroup { border-top: 1px solid var(--line); margin: 14px -16px 0; padding: 2px 16px 0; }
.pgroup > h3 { margin-top: 14px; }
.field { margin: 12px 0; }
.field > label, .field-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field-label output, .field > label output { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.field textarea, .field select, .field input[type=number], .field input[type=text] {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r); padding: 7px 10px; background: var(--surface); box-shadow: var(--sh-1);
}
.field select { height: 34px; padding: 0 8px; }
.field textarea { resize: vertical; min-height: 60px; font-weight: 600; line-height: 1.35; }
.field textarea:focus, .field select:focus, .field input[type=number]:focus, .field input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: var(--sh-1); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: var(--sh-1); }
input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-ring); }
.toggle-row { display: flex; gap: 6px; }
.toggle {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r); height: 34px; min-width: 38px; padding: 0 10px; font-weight: 600;
  box-shadow: var(--sh-1); transition: background .12s, border-color .12s, color .12s;
}
.toggle:hover { background: var(--soft); }
.toggle.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.toggle.sm { font-size: 11.5px; height: 30px; padding: 0 6px; flex: 1; white-space: nowrap; }
.mini-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-swatches .swatch { width: 24px; height: 24px; }
.size-readout { display: flex; align-items: center; gap: 8px; background: var(--soft); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--r); padding: 7px 10px; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.size-readout::before { content: ''; width: 15px; height: 15px; flex: none; background: currentColor; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 8h18v8H3zM7 8v3M11 8v4M15 8v3M19 8v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 8h18v8H3zM7 8v3M11 8v4M15 8v3M19 8v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.place-grid button, .action-grid button {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r); height: 32px; padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--sh-1); transition: border-color .12s, color .12s, background .12s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.place-grid button:hover, .action-grid button:hover { border-color: var(--accent); color: var(--accent); }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.action-grid button.del { color: var(--danger); }
.action-grid button.del:hover { border-color: var(--danger); color: var(--danger); background: #fff5f4; }

/* ---------- layers ---------- */
.layers { border-top: 1px solid var(--line); margin: 16px -16px 0; padding: 0 16px; }
.layers-head { display: flex; align-items: center; justify-content: space-between; }
.layers-head h3 { margin: 14px 0 9px; }
#layer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#layer-list li { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; }
#layer-list li:hover { background: var(--soft); }
#layer-list li.active { border-color: var(--accent); background: var(--accent-soft); }
#layer-list li .lt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
#layer-list li .ico { width: 26px; height: 26px; border-radius: 6px; background: var(--soft-2); display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; color: var(--muted); overflow: hidden; }
#layer-list li .ico svg { width: 19px; height: 19px; }
#layer-list li.hidden-layer .lt, #layer-list li.hidden-layer .ico { opacity: .45; }
#layer-list .eye { border: 0; background: transparent; padding: 4px; color: var(--faint); border-radius: 6px; }
#layer-list .eye:hover { color: var(--ink); background: var(--soft-2); }
#layer-list .eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
#layer-list li.layers-empty { color: var(--muted); font-size: 12.5px; padding: 2px 0 6px; cursor: default; background: none; }

/* ---------- dialogs ---------- */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--sh-3); color: var(--ink); }
.dlg.narrow { width: min(520px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(16, 18, 22, .5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.dlg-head > div { display: flex; gap: 8px; align-items: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 20px; }
.gcard { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; transition: box-shadow .12s, border-color .12s; }
.gcard:hover { box-shadow: var(--sh-2); border-color: var(--line-2); }
.gcard .gprev { background: radial-gradient(ellipse at 50% 40%, #fff, #eceef2 80%); display: grid; grid-template-columns: 1fr 1fr; padding: 10px 4px 4px; cursor: pointer; }
.gcard .gprev svg { width: 100%; height: auto; }
.gcard .gbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); }
.gcard .gbody strong { font-size: 13.5px; }
.gcard .gbody small { color: var(--muted); font-size: 11.5px; }
.gcard .gactions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.gallery-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 44px 10px; }
.gallery-empty strong { color: var(--ink); }

/* class vote */
.vote-body { padding: 6px 20px 20px; }
.vote-body .hint { font-size: 13px; line-height: 1.5; }
.vote-error { color: var(--danger); font-size: 12.5px; font-weight: 500; margin: 0; min-height: 0; }
.vote-error:not(:empty) { margin: 4px 0 10px; }
.vote-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* help */
.help { padding: 4px 20px 22px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; align-items: center; font-size: 13px; }
.keys dt { white-space: nowrap; font-weight: 600; }
.keys dd { margin: 0; color: var(--muted); }
.classic { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.classic a { color: var(--accent); font-weight: 600; text-decoration: none; }
.classic a:hover { text-decoration: underline; }

/* spec sheet */
.spec { padding: 24px 28px 32px; color: #111; }
.spec-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; }
.spec-top h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.spec-top .meta { text-align: right; font-size: 12.5px; color: #444; }
.spec-views { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
.spec-views figure { margin: 0; background: #f4f5f7; border-radius: 12px; padding: 10px; text-align: center; }
.spec-views svg { width: 100%; height: auto; max-height: 380px; }
.spec-views figcaption { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.spec-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.spec-facts div { background: #f4f5f7; border-radius: 10px; padding: 8px 10px; }
.spec-facts small { display: block; color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.spec-facts b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); flex: none; }
.spec table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.spec th, .spec td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #e3e5e9; vertical-align: top; }
.spec th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.spec .note { font-size: 11.5px; color: #666; margin-top: 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); background: var(--ink); color: #fff; padding: 9px 16px;
  border-radius: 10px; font-weight: 600; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
  max-width: calc(100vw - 32px); box-shadow: var(--sh-3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 68px 284px minmax(0, 1fr) 292px; }
  .brand-text span, .doc-meta { display: none; }
  .stage-hint { display: none; }
}
@media (max-width: 1060px) {
  .top-actions .btn.ghost span { display: none; }
  .top-actions .btn.ghost { padding: 0 9px; }
}
@media (max-width: 900px) {
  html, body { height: auto; }
  .layout { display: flex; flex-direction: column; height: auto; flex: none; }
  .stage-wrap { order: -1; height: 76vh; min-height: 420px; }
  .rail { flex-direction: row; justify-content: flex-start; border-right: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 10px; overflow-x: auto; position: sticky; top: 0; z-index: 5; }
  .rail button { flex: none; width: 64px; }
  .rail-space { display: none; }
  .panel { overflow: visible; border: 0 !important; padding: 0 16px 20px; }
  .panel.right { border-top: 1px solid var(--line) !important; }
  .topbar { height: auto; flex-wrap: wrap; gap: 6px 8px; padding: 8px 12px; }
  .brand { border-right: 0; padding-right: 0; }
  .doc { order: 3; flex-basis: 100%; }
  .design-name { max-width: none; }
  .divider, #btn-new { display: none; }
  .spec-views, .spec-facts { grid-template-columns: 1fr 1fr; }
  .clip-grid { grid-template-columns: repeat(6, 1fr); }
  .garment-types { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 560px) {
  .brand-text { display: none; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: 0 9px; }
  .garment-types { grid-template-columns: repeat(3, 1fr); }
  .clip-grid { grid-template-columns: repeat(4, 1fr); }
  .product-chip span:last-child { display: none; }
}

/* ---------- printing the spec sheet ---------- */
@media print {
  body.printing > *:not(#spec-dlg) { display: none !important; }
  body.printing { background: #fff; display: block; }
  body.printing #spec-dlg { position: static; display: block; box-shadow: none; width: auto; max-height: none; border-radius: 0; inset: 0 0 auto 0; margin: 0; max-width: none; overflow: visible; }
  body.printing .no-print { display: none !important; }
  /* no top/bottom page margin: that is where the browser prints its own header and footer
     (date, page address, i.e. the file path on this computer). The sheet keeps its own spacing. */
  .spec { padding: 14mm 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  @page { margin: 0 14mm; }
}
