/* DYOS Simple designer (guided, to-scale preview) */
.sd { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.sd-stage-col { background: #fff; border: 1px solid var(--border-light, #e2e8f0); border-radius: 14px; padding: 0.9rem; min-width: 0; position: sticky; top: 76px; }
.sd-panel { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }

.sd-toolbar { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.sd-toolbar .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.sd-toolbar .btn.on { background: #0F172A !important; color: #fff !important; }
.sd-spacer { flex: 1; }
.sd-zoomval { font-size: 0.78rem; font-weight: 700; min-width: 2.6rem; text-align: center; }

.sd-badge { background: #FFF7ED; border: 1px solid #FED7AA; color: #9A3412; font-size: 0.78rem; border-radius: 8px; padding: 0.4rem 0.6rem; margin-bottom: 0.6rem; }

.sd-canvas { background: repeating-conic-gradient(#f8fafc 0% 25%, #f1f5f9 0% 50%) 50% / 24px 24px; border-radius: 10px; border: 1px solid var(--border-light, #e2e8f0); overflow: hidden; }
.sd-svg { display: block; width: 100%; height: auto; max-height: 44vh; user-select: none; -webkit-user-select: none; }
.sd-svg [data-layer] { touch-action: none; }
.sd-svg.sel { touch-action: none; }
.sd-empty { padding: 3rem 1rem; text-align: center; color: #64748b; font-size: 0.9rem; }

.sd-msgs { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.sd-msg { font-size: 0.82rem; border-radius: 8px; padding: 0.45rem 0.65rem; border: 1px solid; }
.sd-msg.err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.sd-msg.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.sd-msg.ok { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }

.sd-dock { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border-light, #e2e8f0); }
.sd-price strong { font-size: 1.5rem; font-weight: 800; display: block; line-height: 1.1; }
.sd-price small { color: #64748b; font-size: 0.74rem; }
.sd-dock-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sd-dock-actions .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.sd-step { background: #fff; border: 1px solid var(--border-light, #e2e8f0); border-radius: 14px; padding: 0.9rem; }
.sd-step h3 { font-size: 0.95rem; font-weight: 800; margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.sd-step h3 span { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #0F172A; color: #8AFB04; font-size: 0.75rem; align-items: center; justify-content: center; }
.sd-lbl { display: block; font-size: 0.78rem; font-weight: 700; color: #334155; margin: 0.5rem 0 0.3rem; }
.sd-lbl select, .sd-lbl input[type=range], .sd-sel input[type=text], .sd-sel select { width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.55rem; border: 1px solid var(--border-light, #cbd5e1); border-radius: 8px; font: inherit; font-weight: 600; background: #fff; }
.sd-lbl input[type=range] { padding: 0; }
.sd-sel input[type=text], .sd-sel select { margin-bottom: 0.5rem; }
.sd-note { font-size: 0.76rem; color: #64748b; margin: 0.4rem 0 0; }

.sd-swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sd-sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.sd-sw.on { box-shadow: 0 0 0 2px #0F172A; }
.sd-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sd-chip { min-width: 44px; padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; font-weight: 700; cursor: pointer; }
.sd-chip.on { background: #0F172A; color: #fff; border-color: #0F172A; }
.sd-seg { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; }
.sd-seg button { padding: 0.45rem 1.1rem; border: 0; background: #fff; font-weight: 700; cursor: pointer; }
.sd-seg button.on { background: #0F172A; color: #fff; }

.sd-areas { display: flex; flex-direction: column; gap: 0.4rem; }
.sd-area { text-align: left; border: 1.5px solid #e2e8f0; background: #fff; border-radius: 10px; padding: 0.55rem 0.7rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.1rem; font: inherit; }
.sd-area strong { font-size: 0.86rem; }
.sd-area em { font-style: normal; font-size: 0.76rem; color: #475569; }
.sd-area small { font-size: 0.72rem; color: #64748b; }
.sd-area.on { border-color: #0F172A; background: #F7FFEB; box-shadow: 0 0 0 2px rgba(138, 251, 4, 0.45); }
.sd-area[disabled] { opacity: 0.55; cursor: not-allowed; background: #f8fafc; }
.sd-area[disabled] small { color: #B45309; }

.sd-add { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sd-sel { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed #cbd5e1; }
.sd-sel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.86rem; }
.sd-sel-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-link { background: none; border: 0; color: #3F7A00; font-weight: 700; font-size: 0.78rem; cursor: pointer; padding: 0 0.25rem; }
.sd-link.danger { color: #DC2626; }
.sd-layers { list-style: none; margin: 0.8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.sd-layers li { padding: 0.4rem 0.6rem; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.8rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-layers li.on { border-color: #0F172A; background: #F3FFE0; }

.sd-mode { display: inline-flex; margin-top: 0.6rem; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: #fff; }
.sd-mode button { padding: 0.4rem 1rem; border: 0; background: transparent; font-weight: 700; cursor: pointer; }
.sd-mode button.on { background: #0F172A; color: #8AFB04; }
.sd-mode-note { font-size: 0.76rem; color: #64748b; margin: 0.4rem 0 0; }

/* the old toolbar belongs to the Advanced editor */
.designer-studio.mode-simple .designer-header-actions #btn-undo,
.designer-studio.mode-simple .designer-header-actions #btn-redo,
.designer-studio.mode-simple .designer-header-actions #btn-reset-canvas,
.designer-studio.mode-simple .designer-header-actions #btn-designer-save { display: none; }

@media (max-width: 900px) {
  .designer-studio.mode-simple { padding-top: 0.75rem; }
  .designer-studio.mode-simple .designer-header { margin-bottom: 0.5rem; gap: 0.4rem; align-items: flex-start; }
  .designer-studio.mode-simple .designer-header-left h1 { font-size: 1.15rem; }
  .designer-studio.mode-simple .designer-header-left p:not(.sd-mode-note) { display: none; }
  .designer-studio.mode-simple .designer-header-actions .btn { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
  .sd-mode { margin-top: 0.3rem; }
  .sd-toolbar { gap: 0.25rem; margin-bottom: 0.4rem; }
  .sd-toolbar .btn { padding: 0.3rem 0.5rem; font-size: 0.74rem; }
  .sd-zoomval { min-width: 2rem; font-size: 0.72rem; }
  .sd-badge { font-size: 0.72rem; padding: 0.3rem 0.5rem; margin-bottom: 0.4rem; }
  .sd { grid-template-columns: minmax(0, 1fr); }
  .sd-stage-col { position: static; order: -1; }
  .sd-svg { max-height: 36vh; }
  .sd-dock { position: sticky; bottom: 0; background: #fff; padding-bottom: 0.4rem; }
}

/* ---- Stage 3: Advanced mode, layers, modal, drafts ---- */
.sd-mode-note { max-width: 40rem; }
.sd-toggles { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.6rem 0; font-size: 0.82rem; font-weight: 600; color: #334155; }
.sd-toggles label { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.sd-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.sd-fs[disabled] { opacity: 0.55; }
.sd-fs input[type=text], .sd-fs select { width: 100%; margin-bottom: 0.5rem; padding: 0.45rem 0.55rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-weight: 600; background: #fff; }
.sd-row { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.4rem; }
.sd-num { display: flex; flex-direction: column; font-size: 0.72rem; font-weight: 700; color: #334155; flex: 1; min-width: 5.5rem; }
.sd-num input { margin-top: 0.2rem; padding: 0.4rem 0.5rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-weight: 600; width: 100%; box-sizing: border-box; }
.sd-colorpick { display: flex; flex-direction: column; font-size: 0.72rem; font-weight: 700; color: #334155; }
.sd-colorpick input { width: 44px; height: 34px; padding: 0; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.sd-tgl { width: 34px; height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.sd-tgl.on { background: #0F172A; color: #fff; border-color: #0F172A; }
.sd-crop { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.8rem; margin-bottom: 0.5rem; }
.sd-crop label { font-size: 0.72rem; font-weight: 700; color: #334155; display: flex; flex-direction: column; }
.sd-crop input[type=range] { width: 100%; }
.sd-align { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; }
.sd-align .sd-chip { min-width: 0; padding: 0.35rem 0.3rem; font-size: 0.76rem; }
.sd-fs .sd-lbl input[type=range] { width: 100%; }

.sd-layers li { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.sd-layers li.off .sd-lname { opacity: 0.5; text-decoration: line-through; }
.sd-lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.sd-lctl { display: inline-flex; gap: 0.2rem; flex-shrink: 0; }
.sd-lctl button { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; font-size: 0.68rem; font-weight: 700; padding: 0.2rem 0.4rem; cursor: pointer; }
.sd-lctl button:hover { background: #f1f5f9; }

.sd-mode button:focus-visible, .sd-chip:focus-visible, .sd-sw:focus-visible { outline: 2px solid #0F172A; outline-offset: 2px; }

.sd { position: relative; }
.sd-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 4000; padding: 1rem; }
.sd-modal-box { background: #fff; border-radius: 14px; padding: 1.2rem; max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.sd-modal-box h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.sd-modal-box h4 { margin: 0.8rem 0 0.3rem; font-size: 0.85rem; }
.sd-modal-box ul { margin: 0; padding-left: 1.1rem; font-size: 0.82rem; }
.sd-modal-box li { margin-bottom: 0.35rem; }
.sd-modal-box .sd-lbl input { width: 100%; margin-top: 0.3rem; padding: 0.5rem 0.6rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; box-sizing: border-box; }
.sd-modal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
ul.sd-drafts { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
ul.sd-drafts li { display: flex; align-items: center; gap: 0.7rem; border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.5rem; margin: 0; }
.sd-thumb { width: 54px; height: 64px; background: #f1f5f9; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.sd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sd-dinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sd-dinfo small { color: #64748b; font-size: 0.72rem; }
.sd-dact { display: flex; flex-direction: column; gap: 0.25rem; }

/* old toolbar belongs only to Classic */
.designer-studio.mode-advanced .designer-header-actions #btn-undo,
.designer-studio.mode-advanced .designer-header-actions #btn-redo,
.designer-studio.mode-advanced .designer-header-actions #btn-reset-canvas,
.designer-studio.mode-advanced .designer-header-actions #btn-designer-save { display: none; }

@media (max-width: 900px) {
  .designer-studio.mode-advanced { padding-top: 0.75rem; }
  .designer-studio.mode-advanced .designer-header { margin-bottom: 0.5rem; gap: 0.4rem; align-items: flex-start; }
  .designer-studio.mode-advanced .designer-header-left h1 { font-size: 1.15rem; }
  .designer-studio.mode-advanced .designer-header-left p:not(.sd-mode-note) { display: none; }
  .designer-studio.mode-advanced .designer-header-actions .btn { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
  .sd-lctl button { padding: 0.25rem 0.35rem; }
  .sd-dock-actions { width: 100%; }
  .sd-dock-actions .btn { flex: 1; }
}

/* ---- Brand palette: logo navy #0F172A + neon green #8AFB04, scoped to the studio ---- */
#designer-view {
  --brand-primary: #0F172A;
  --brand-primary-hover: #1E293B;
  --brand-primary-light: #F3FFE0;
  --accent-neon-violet: #5FAE00;
}
#designer-view .sd input[type=checkbox], #designer-view .sd input[type=range], #designer-view .sd input[type=radio] { accent-color: #0F172A; }
#designer-view .sd-link { color: #3F7A00; }
#designer-view .sd-link.danger { color: #DC2626; }
#designer-view .sd-stage-col, #designer-view .sd-step { border-color: #E2E8F0; }
#designer-view .sd-step h3 span { background: #0F172A; color: #8AFB04; }
#designer-view .sd-chip.on, #designer-view .sd-seg button.on, #designer-view .sd-tgl.on { background: #0F172A; color: #8AFB04; border-color: #0F172A; }
#designer-view .sd-sw.on { box-shadow: 0 0 0 2px #0F172A, 0 0 0 4px #8AFB04; }
#designer-view .sd-area.on { border-color: #0F172A; background: #F3FFE0; box-shadow: 0 0 0 2px rgba(138, 251, 4, 0.55); }
#designer-view .sd-layers li.on { border-color: #0F172A; background: #F3FFE0; }
#designer-view .sd-modal-box h3 { color: #0F172A; }
#designer-view .sd-msg.ok { background: #F3FFE0; border-color: #BDEB7A; color: #2F5D00; }

/* Compact preview: less chrome around the shirt */
.sd-stage-col { padding: 0.7rem; }
.sd-badge { padding: 0.3rem 0.55rem; font-size: 0.74rem; margin-bottom: 0.45rem; }
.sd-msgs { margin-top: 0.4rem; }
.sd-dock { margin-top: 0.55rem; padding-top: 0.55rem; }
.sd-price strong { font-size: 1.3rem; }
@media (max-width: 900px) {
  .sd-stage-col { padding: 0.55rem; }
  .sd-badge { font-size: 0.68rem; padding: 0.22rem 0.45rem; }
  .sd-msg { font-size: 0.74rem; padding: 0.3rem 0.5rem; }
  .sd-price strong { font-size: 1.15rem; }
  .sd-price small { font-size: 0.66rem; display: block; }
  .sd-dock-actions .btn { padding: 0.5rem 0.4rem; font-size: 0.82rem; }
  .sd-dock-actions .btn-lg { font-size: 0.9rem; }
}

/* Touch targets on phones */
@media (max-width: 900px) {
  .sd-toolbar .btn { min-height: 36px; }
  .sd-chip, .sd-tgl { min-height: 38px; }
  .sd-lctl button { min-height: 34px; min-width: 38px; font-size: 0.72rem; }
  .sd-layers li { flex-wrap: wrap; row-gap: 0.3rem; }
  .sd-lctl { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .sd-sw { width: 34px; height: 34px; }
  .sd-link { padding: 0.35rem 0.5rem; font-size: 0.84rem; }
  .sd-mode button { padding: 0.5rem 1rem; }
}

/* ---- 3D view (2026-11-17) ---- */
.sd-3d-toggle.on { background: #0F172A; color: #FFFFFF; border-color: #0F172A; }
.sd-canvas.is-3d { background: radial-gradient(120% 90% at 50% 35%, #FFFFFF 0%, #EEF2F6 70%, #E2E8F0 100%); }
.sd3d { position: relative; height: clamp(380px, 62vh, 680px); overflow: hidden; isolation: isolate; border-radius: inherit; background: #c9d2cb; }
/* Out-of-focus studio backdrop (image drawn by tshirt-3d.js, tinted to the garment colour). */
.sd3d-bg { position: absolute; inset: -40px; z-index: 0; background-size: cover; background-position: center; filter: blur(18px) saturate(1.05); transform: scale(1.06); transition: background-image 0.4s ease; pointer-events: none; }
.sd3d-gl { position: relative; z-index: 1; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.sd3d-status, .sd3d-bar, .sd3d-hint { z-index: 2; }
.sd3d-gl:active { cursor: grabbing; }
.sd3d-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; color: #475569; font-size: 0.9rem; font-weight: 600; pointer-events: none; }
.sd3d-bar { position: absolute; top: 0.75rem; left: 0.75rem; right: 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; pointer-events: none; }
.sd3d-bar > * { pointer-events: auto; }
.sd3d-seg { display: inline-flex; background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 10px; padding: 3px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06); }
.sd3d-seg button, .sd3d-spin { font: inherit; font-size: 0.8rem; font-weight: 700; color: #334155; background: none; border: 0; border-radius: 7px; padding: 0.45rem 0.8rem; min-height: 36px; cursor: pointer; }
.sd3d-seg button:hover, .sd3d-spin:hover { background: #F1F5F9; color: #0F172A; }
.sd3d-spin { background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 10px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06); }
.sd3d-spin.on { background: #0F172A; color: #FFFFFF; border-color: #0F172A; }
.sd3d-seg button:focus-visible, .sd3d-spin:focus-visible { outline: 2px solid #0F172A; outline-offset: 2px; }
.sd3d-hint { position: absolute; bottom: 0.6rem; left: 50%; right: auto; transform: translateX(-50%); margin: 0; padding: 0.3rem 0.75rem; border-radius: 999px; background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(6px); text-align: center; white-space: nowrap; font-size: 0.75rem; color: #334155; pointer-events: none; }
