:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-soft: #f7f9fa;
  --surface-2: #f1f5f6;
  --text: #142033;
  --muted: #6c7788;
  --border: #dfe5e8;
  --border-strong: #cfd8dd;
  --accent: #159268;
  --accent-strong: #0f7c58;
  --accent-soft: #e9f7f1;
  --blue: #0f2d5b;
  --danger: #d94848;
  --danger-soft: #fff0f0;
  --shadow: 0 10px 30px rgba(24, 40, 54, 0.08);
  --shadow-soft: 0 4px 18px rgba(24, 40, 54, 0.05);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --header-h: 86px;
  --summary-h: 82px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .upload-card:focus-within {
  outline: 3px solid rgba(21, 146, 104, 0.2);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.icon { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--summary-h);
  background: #f2f5f6;
}

.topbar {
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(310px, 1fr);
  align-items: center;
  padding: 0 22px;
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.brand-wrap { display: flex; align-items: center; gap: 26px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-zen { font-size: 42px; font-weight: 900; letter-spacing: -3px; color: #2db77f; line-height: 1; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 17px; letter-spacing: -0.4px; }
.brand-copy small { margin-top: 4px; font-size: 7.5px; font-weight: 800; letter-spacing: 0.4px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: #2e4057; text-decoration: none; font-weight: 600; font-size: 14px; }
.back-link:hover { color: var(--accent-strong); }

.topbar-tools { display: flex; align-items: stretch; justify-content: center; height: 58px; }
.top-tool {
  min-width: 66px;
  border: 0;
  background: transparent;
  color: #26364a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 10px;
  font-size: 12px;
}
.top-tool .icon { width: 22px; height: 22px; }
.top-tool:hover { background: var(--surface-soft); color: var(--accent-strong); }
.top-tool:disabled { opacity: .35; cursor: default; }
.top-divider { width: 1px; height: 34px; margin: 12px 8px; background: var(--border); }

.view-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.mode-switch { display: inline-flex; padding: 4px; border-radius: 10px; background: #f0f3f5; }
.mode-btn { min-height: 42px; padding: 0 15px; border: 0; border-radius: 8px; color: #657286; background: transparent; display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.mode-btn.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(21,146,104,.18); }
.mode-btn:not(.active):hover { background: #fff; color: var(--text); }
.save-btn, .order-btn, .primary-button {
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: .18s ease;
}
.save-btn { height: 46px; padding: 0 20px; }
.save-btn:hover, .order-btn:hover, .primary-button:hover { background: var(--accent-strong); transform: translateY(-1px); }

.editor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 315px minmax(520px, 1fr) 390px;
  overflow: hidden;
}
.panel-scroll { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cbd5da transparent; }
.left-sidebar, .right-sidebar { background: #fff; }
.left-sidebar { border-right: 1px solid var(--border); padding: 24px 16px 18px; }
.right-sidebar { border-left: 1px solid var(--border); padding: 18px 16px 22px; }
.sidebar-section + .sidebar-section { margin-top: 20px; }
.section-heading-row, .panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h2,h3,h4,p { margin-top: 0; }
.sidebar-section h2 { font-size: 20px; margin-bottom: 15px; }
.sidebar-section h3, .tool-panel h3 { font-size: 16px; margin-bottom: 14px; }
.status-pill, .selection-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 800; }

.product-list { display: grid; gap: 8px; }
.product-card {
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: 76px 1fr 22px;
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  color: var(--text);
  transition: .18s ease;
}
.product-card:hover { background: #f8fbfa; border-color: #dfe9e5; }
.product-card.active { border-color: var(--accent); background: #fbfffd; box-shadow: inset 0 0 0 1px rgba(21,146,104,.08); }
.product-thumb { width: 72px; height: 68px; border-radius: 10px; background: #f7f9fa; display: grid; place-items: center; overflow: hidden; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.product-card strong { display: block; font-size: 14px; margin-bottom: 5px; }
.product-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.product-card .check { color: var(--accent); opacity: 0; }
.product-card.active .check { opacity: 1; }

.options-section { padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: var(--shadow-soft); }
.form-row { margin-bottom: 13px; }
.form-row:last-child { margin-bottom: 0; }
.form-row label, .field-label { display: block; color: #344154; font-size: 12px; font-weight: 750; margin-bottom: 7px; }
.field-label.no-margin { margin-bottom: 0; }
.input { width: 100%; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); padding: 0 12px; }
.input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(21,146,104,.1); }
.view-choice { display: flex; gap: 7px; }
.view-choice button { flex: 1; min-height: 38px; border: 1px solid var(--border); border-radius: 8px; background: #f6f8f9; color: #506075; font-weight: 750; }
.view-choice button.active { background: var(--accent); border-color: var(--accent); color: white; }
.sidebar-note { margin-top: 14px; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: #eef7f4; color: #536675; }
.sidebar-note p { margin: 0; font-size: 12px; line-height: 1.45; }
.note-icon { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: white; font-size: 12px; font-weight: 900; flex: 0 0 auto; }

.workspace {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: radial-gradient(circle at 50% 35%, #f8fafb 0, #edf1f3 55%, #e7ecef 100%);
  padding: 16px 18px 12px;
}
.workspace-head { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 2px 8px; }
.workspace-head .eyebrow { margin: 0 0 3px; text-transform: uppercase; letter-spacing: 1px; font-size: 10px; font-weight: 850; color: #7c8998; }
.workspace-head h1 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.zoom-readout { min-width: 58px; text-align: center; padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,.75); border: 1px solid rgba(216,225,230,.9); color: #526172; font-size: 12px; font-weight: 800; }
.stage-wrap { min-height: 0; display: grid; place-items: center; overflow: auto; padding: 8px; }
.stage {
  position: relative;
  width: min(760px, 100%);
  aspect-ratio: 760/720;
  flex: 0 0 auto;
  transform-origin: center center;
  transition: transform .16s ease;
}
.product-base-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 16px 22px rgba(39,52,67,.12));
}
.canvas-container { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }
.canvas-container canvas { width: 100% !important; height: 100% !important; }
.canvas-container .lower-canvas { pointer-events: none !important; z-index: 1 !important; }
.canvas-container .upper-canvas { pointer-events: auto !important; z-index: 5 !important; touch-action: none; }
.print-guide {
  position: absolute;
  z-index: 4;
  border: 2px dashed rgba(37,120,214,.8);
  border-radius: 8px;
  pointer-events: none;
  background: rgba(255,255,255,.015);
}
.print-guide-label {
  position: absolute;
  left: 50%;
  top: -26px;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.92);
  border: 1px solid #dce5ec;
  color: #4f6174;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.canvas-message { position: absolute; z-index: 8; top: 10px; left: 50%; transform: translateX(-50%); min-height: 0; padding: 0; border-radius: 8px; font-size: 12px; font-weight: 700; pointer-events: none; opacity: 0; transition: .2s ease; }
.canvas-message.show { opacity: 1; padding: 8px 12px; color: #9b6114; background: #fff7e7; border: 1px solid #f4d59d; }
.view-thumbnails { min-height: 78px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.view-thumb-btn { border: 0; background: transparent; color: #5f6e7d; padding: 0; }
.view-thumb-image { width: 58px; height: 58px; border: 2px solid transparent; border-radius: 10px; background: rgba(255,255,255,.75); display: grid; place-items: center; overflow: hidden; }
.view-thumb-image img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.view-thumb-btn span { display: block; margin-top: 5px; font-size: 11px; font-weight: 700; }
.view-thumb-btn.active .view-thumb-image { border-color: var(--accent); box-shadow: 0 4px 12px rgba(21,146,104,.12); }
.view-thumb-btn.active span { color: var(--accent-strong); }

.tool-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 12px; }
.tool-tab { min-height: 68px; border: 0; border-radius: 9px; background: #f8fafb; color: #26364a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; }
.tool-tab .icon { width: 22px; height: 22px; }
.tool-tab:hover { background: #f0f5f3; }
.tool-tab.active { background: var(--accent); color: white; }
.tool-panel { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow-soft); }
.tool-panel + .selected-actions { margin-top: 12px; }
.panel-title-row h3 { margin-bottom: 0; }
.panel-title-row { margin-bottom: 14px; }
.panel-copy { color: var(--muted); font-size: 12px; line-height: 1.5; margin-bottom: 14px; }
.field-with-button { display: grid; grid-template-columns: 1fr 42px; gap: 8px; margin-bottom: 13px; }
.icon-button { width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; }
.icon-button.primary { border-color: var(--accent); background: var(--accent); color: white; }
.form-grid.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(90px, .8fr); gap: 10px; margin-bottom: 13px; }
.color-field { display: grid; grid-template-columns: 46px 1fr; gap: 8px; margin-bottom: 14px; }
.color-field input[type="color"] { width: 46px; height: 42px; padding: 4px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
.shape-style-field { margin-bottom: 12px; }
.shape-transparent-row { display: flex; align-items: center; gap: 7px; color: #536173; font-size: 12px; font-weight: 700; margin: -4px 0 12px; }
.shape-transparent-row input { accent-color: var(--accent); }
.shape-style-field .input[type="number"] { min-height: 42px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; }
.property-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 13px 0; }
.segmented { display: inline-flex; gap: 4px; }
.segmented button { min-width: 38px; min-height: 38px; border: 1px solid var(--border); border-radius: 7px; background: #f5f7f8; color: #354458; }
.segmented button.active { border-color: var(--accent); background: var(--accent); color: white; }
.range-row { display: grid; grid-template-columns: 62px 1fr 54px; gap: 8px; align-items: center; margin-top: 14px; }
.range-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-row output { min-width: 54px; min-height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfd; font-size: 12px; font-weight: 750; color: #536173; }
.upload-card { min-height: 150px; border: 1.5px dashed #c8d3d8; border-radius: 12px; background: #f9fbfb; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #4b5e6e; cursor: pointer; text-align: center; padding: 20px; }
.upload-card:hover { border-color: var(--accent); background: #f4fbf8; }
.upload-card strong { color: var(--text); font-size: 14px; }
.upload-card span:last-of-type { font-size: 11px; }
.upload-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); }
.secondary-button, .primary-button { min-height: 42px; padding: 0 15px; border-radius: 8px; }
.secondary-button { border: 1px solid var(--border-strong); background: #fff; color: #334257; font-weight: 750; }
.secondary-button:hover { background: #f7f9fa; }
.full { width: 100%; margin-top: 14px; }
.shape-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.shape-card { min-height: 94px; border: 1px solid var(--border); border-radius: 10px; background: #fafcfc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: #4a5a6d; font-size: 12px; font-weight: 700; }
.shape-card:hover { border-color: var(--accent); background: #f5fbf8; color: var(--accent-strong); }
.shape-preview { display: block; width: 30px; height: 30px; border: 2px solid currentColor; }
.shape-preview.rect { border-radius: 4px; }
.shape-preview.circle { border-radius: 50%; }
.shape-preview.line { width: 34px; height: 0; border: 0; border-top: 3px solid currentColor; transform: rotate(-25deg); }
.shape-preview.triangle { width: 0; height: 0; border: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 28px solid currentColor; }

.layers-list { display: grid; gap: 6px; }
.layer-item { display: grid; grid-template-columns: 34px 1fr 32px 32px; gap: 5px; align-items: center; min-height: 44px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfd; }
.layer-item.active { border-color: var(--accent); background: #f5fbf8; }
.layer-kind { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: #edf2f4; color: #445468; }
.layer-name { border: 0; background: transparent; color: #334154; font-size: 12px; font-weight: 700; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-icon-btn { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: #687585; display: grid; place-items: center; }
.layer-icon-btn:hover { background: #edf2f4; color: #243348; }
.empty-layers { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--border); border-radius: 9px; }

.selected-actions, .design-tips { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow-soft); }
.selected-actions h4 { margin: 0 0 10px; font-size: 13px; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.action-grid button { min-height: 58px; padding: 7px 4px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafb; color: #46576a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 9px; font-weight: 750; }
.action-grid button:hover { border-color: #c6d0d6; background: #f0f4f5; }
.action-grid button:disabled { opacity: .4; cursor: default; }
.action-grid button.danger { color: var(--danger); background: var(--danger-soft); }
.design-tips { color: #5f6f7f; }
.tips-title { display: flex; align-items: center; gap: 7px; color: #26374a; font-size: 13px; }
.design-tips ul { margin: 9px 0 0; padding-left: 18px; font-size: 11px; line-height: 1.6; }

.summary-bar {
  min-height: var(--summary-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 22px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.98);
  z-index: 25;
}
.summary-product, .summary-order { display: flex; align-items: center; gap: 14px; }
.summary-product img { width: 38px; height: 38px; object-fit: contain; }
.summary-product div { display: flex; gap: 4px; align-items: center; font-size: 13px; }
.summary-product span { color: #778392; }
.summary-product strong { color: #233248; }
.summary-separator { width: 1px; height: 24px; background: var(--border-strong); }
.summary-order { margin-left: auto; }
.quantity-control { display: flex; align-items: center; gap: 9px; }
.quantity-control label { font-size: 12px; font-weight: 800; }
.stepper { display: grid; grid-template-columns: 38px 68px 38px; height: 42px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; background: #f4f7f8; font-size: 22px; color: #334154; }
.stepper button:hover { background: #eaf0f2; }
.stepper input { min-width: 0; width: 100%; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font-weight: 800; color: #233146; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-stat { min-width: 100px; padding-left: 14px; border-left: 1px solid var(--border); }
.price-stat span { display: block; color: #778392; font-size: 11px; margin-bottom: 3px; }
.price-stat strong { font-size: 17px; letter-spacing: -.3px; }
.price-stat.total strong { font-size: 19px; }
.order-btn { min-height: 48px; padding: 0 22px; font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 16px); z-index: 100; padding: 11px 16px; border-radius: 9px; background: #142033; color: #fff; font-size: 12px; font-weight: 750; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(10,20,30,.38); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(520px, 100%); position: relative; padding: 28px; border-radius: 18px; background: #fff; box-shadow: 0 25px 70px rgba(20,32,51,.22); text-align: center; }
.modal-close { position: absolute; right: 14px; top: 12px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: #f4f6f7; font-size: 24px; color: #647180; }
.modal-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.modal-icon .icon { width: 27px; height: 27px; }
.modal-card h2 { margin-bottom: 8px; font-size: 24px; }
.modal-card > p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-summary { margin: 18px 0; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: #f8fafb; text-align: left; display: grid; gap: 8px; }
.modal-summary div { display: flex; justify-content: space-between; gap: 20px; font-size: 12px; }
.modal-summary span { color: var(--muted); }
.modal-actions { display: flex; justify-content: center; gap: 10px; }

@media (max-width: 1350px) {
  .topbar { grid-template-columns: 260px 1fr 290px; padding: 0 14px; }
  .brand-copy { display: none; }
  .brand-zen { font-size: 36px; }
  .back-link span:last-child { display: none; }
  .top-tool { min-width: 56px; }
  .editor-grid { grid-template-columns: 280px minmax(460px, 1fr) 350px; }
  .action-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 1080px) {
  :root { --header-h: 74px; }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; }
  .topbar-tools { order: 3; grid-column: 1/-1; display: none; }
  .view-actions { justify-content: flex-end; }
  .mode-switch { display: none; }
  .editor-grid { grid-template-columns: 240px 1fr; }
  .right-sidebar { position: fixed; z-index: 60; right: 0; top: var(--header-h); bottom: var(--summary-h); width: min(390px, 94vw); transform: translateX(100%); transition: .22s ease; box-shadow: -14px 0 32px rgba(20,32,51,.12); }
  .right-sidebar.mobile-open { transform: translateX(0); }
  .workspace { min-width: 0; }
  .summary-bar { padding: 8px 12px; }
  .summary-product .summary-separator, .summary-product div:last-child { display: none; }
  .price-stat { min-width: 86px; }
}

@media (max-width: 760px) {
  :root { --header-h: 64px; --summary-h: 150px; }
  .app-shell { grid-template-rows: var(--header-h) auto auto; }
  .topbar { padding: 0 10px; }
  .brand-zen { font-size: 30px; letter-spacing: -2px; }
  .save-btn { height: 40px; padding: 0 12px; font-size: 12px; }
  .save-btn .icon { display: none; }
  .editor-grid { display: flex; flex-direction: column; overflow: visible; }
  .left-sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; overflow: visible; }
  .product-section h2 { font-size: 16px; margin-bottom: 10px; }
  .product-list { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .product-card { min-width: 215px; min-height: 72px; grid-template-columns: 58px 1fr 16px; }
  .product-thumb { width: 56px; height: 54px; }
  .options-section { margin-top: 10px !important; padding: 12px; }
  .sidebar-note { display: none; }
  .workspace { min-height: 620px; padding: 10px 8px; }
  .stage-wrap { overflow: hidden; }
  .workspace-head { padding-inline: 4px; }
  .view-thumbnails { min-height: 70px; }
  .right-sidebar { top: var(--header-h); bottom: 0; }
  .summary-bar { position: sticky; bottom: 0; min-height: var(--summary-h); flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
  .summary-product { justify-content: center; }
  .summary-order { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .quantity-control { grid-column: 1/-1; justify-content: center; }
  .price-stat { border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; }
  .order-btn { grid-column: 1/-1; }
  .modal-actions { flex-direction: column; }
}
.mobile-tools-btn { display: none; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #334257; font-weight: 750; align-items: center; gap: 7px; }
@media (max-width: 1080px) { .mobile-tools-btn { display: inline-flex; } }

/* ===== V2 polished editor overrides ===== */
:root {
  --header-h: 76px;
  --summary-h: 72px;
}
html, body { height: 100%; overflow: hidden; }
body { min-width: 320px; }
.app-shell { height: 100vh; min-height: 0; overflow: hidden; }
.topbar { height: var(--header-h); padding: 0 18px; grid-template-columns: minmax(245px, .9fr) auto minmax(330px, 1fr); }
.brand-zen { font-size: 38px; }
.topbar-tools { height: 52px; }
.top-tool { min-width: 62px; font-size: 11px; gap: 3px; }
.top-tool .icon { width: 20px; height: 20px; }
.save-btn { height: 42px; }
.editor-grid { height: calc(100vh - var(--header-h) - var(--summary-h)); min-height: 0; grid-template-columns: 300px minmax(0,1fr) 380px; }
.left-sidebar { padding: 14px 14px 12px; }
.right-sidebar { padding: 12px 14px 14px; }
.panel-scroll { overscroll-behavior: contain; }
.sidebar-section + .sidebar-section { margin-top: 12px; }
.sidebar-section h2 { font-size: 18px; margin-bottom: 10px; }
.product-list { gap: 6px; }
.product-card { min-height: 70px; grid-template-columns: 62px 1fr 18px; padding: 5px 7px; border-color: #edf1f2; }
.product-thumb { width: 58px; height: 58px; background: linear-gradient(180deg,#fbfcfd,#f2f5f7); }
.product-card strong { font-size: 13px; margin-bottom: 2px; }
.product-card small { font-size: 10.5px; line-height: 1.25; }
.options-section { padding: 12px; box-shadow: none; }
.options-section h3 { margin-bottom: 10px; }
.form-row { margin-bottom: 9px; }
.input { min-height: 36px; padding: 0 10px; font-size: 12px; }
.form-row label, .field-label { font-size: 11px; margin-bottom: 5px; }
.sidebar-note { margin-top: 10px; padding: 9px 10px; }
.sidebar-note p { font-size: 10.5px; }

.workspace { overflow: hidden; grid-template-rows: 40px minmax(0,1fr) 66px; padding: 8px 12px 7px; }
.workspace-head { min-height: 40px; padding: 0 2px 3px; }
.workspace-head .eyebrow { display: none; }
.workspace-head h1 { font-size: 15px; }
.zoom-readout { padding: 5px 8px; min-width: 50px; }
.stage-wrap { grid-row: 2; overflow: hidden; padding: 0; min-width: 0; min-height: 0; }
.stage { width: 600px; max-width: 100%; aspect-ratio: 760/720; }
.product-base-image { filter: drop-shadow(0 20px 24px rgba(32,48,64,.16)); }
.print-guide-label { top: -22px; font-size: 9px; padding: 3px 7px; }
.view-thumbnails { grid-row: 3; min-height: 62px; gap: 8px; }
.view-thumb-image { width: 50px; height: 48px; border-radius: 8px; }
.view-thumb-btn > span:last-child { font-size: 10px; margin-top: 3px; }

.tool-tabs { position: sticky; top: 0; z-index: 4; margin: -2px -2px 8px; padding: 2px; background: #fff; grid-template-columns: repeat(4,1fr); gap: 5px; }
.tool-tab { min-height: 58px; border-radius: 9px; gap: 4px; font-size: 10px; }
.tool-tab .icon { width: 20px; height: 20px; }
.tool-panel { padding: 12px; }
.tool-panel h3 { font-size: 14px; margin-bottom: 10px; }
.panel-copy { font-size: 11px; margin-bottom: 10px; }
.panel-title-row { margin-bottom: 8px; }
.form-grid { gap: 8px; }
.field-with-button { gap: 6px; }
.icon-button { min-width: 38px; width: 38px; height: 36px; }
.property-row { margin: 9px 0; }
.range-row { margin: 9px 0 0; gap: 8px; }
.range-row output { min-width: 46px; padding: 6px; font-size: 10px; }
.color-field { grid-template-columns: 42px 1fr; }
.color-field input[type=color] { height: 36px; }
.segmented.compact button { width: 36px; height: 34px; }
.selected-actions, .design-tips { margin-top: 8px; padding: 10px; box-shadow: none; }
.selected-actions h4 { margin-bottom: 7px; }
.action-grid button { min-height: 48px; }
.design-tips { padding: 9px 11px; }
.design-tips ul { margin-top: 5px; line-height: 1.45; font-size: 10px; }

.preset-block { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); }
.preset-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.preset-title > span { font-size: 11px; font-weight: 800; color: #344154; }
.preset-title small { color: var(--muted); font-size: 9px; }
.preset-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.preset-card { position: relative; min-width: 0; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafb; color: var(--text); transition: .16s ease; }
.preset-card:hover { border-color: #b9d9cc; background: #f3fbf7; }
.preset-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f7fdf9; }
.preset-art { display: block; height: 48px; border-radius: 7px; overflow: hidden; background: #fff; }
.preset-art img { width: 100%; height: 100%; object-fit: contain; }
.preset-meta { display: block; padding-top: 4px; min-width: 0; }
.preset-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8.5px; }
.preset-swatches { display: flex; gap: 2px; margin-top: 3px; }
.preset-swatches i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); }

.summary-bar { height: var(--summary-h); min-height: 0; padding: 7px 18px; gap: 12px; }
.summary-product img { width: 34px; height: 34px; }
.summary-product div { font-size: 12px; }
.stepper { height: 38px; }
.price-stat { min-width: 88px; }
.price-stat strong { font-size: 15px; }
.price-stat.total strong { font-size: 18px; }
.order-btn { min-height: 44px; padding: 0 18px; }

/* Interactive CSS 3D preview: front/back product images + live Fabric artwork */
.preview3d { grid-row: 2 / 4; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; padding: 2px 10px 8px; overflow: hidden; }
.preview3d-toolbar { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 40px; color: #6b7787; font-size: 11px; }
.preview3d-toolbar button { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 6px 10px; color: #425267; font-weight: 700; }
.preview3d-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; }
.preview3d-badge .icon { width: 16px; height: 16px; }
.preview3d-scene { min-height: 0; display: grid; place-items: center; perspective: 1100px; cursor: grab; touch-action: pan-y; user-select: none; }
.preview3d-scene:active { cursor: grabbing; }
.preview3d-object { position: relative; width: min(620px, 82%); aspect-ratio: 760/720; transform-style: preserve-3d; transition: transform .08s linear; }
.preview3d-face { position: absolute; inset: 0; backface-visibility: hidden; transform-style: preserve-3d; }
.preview3d-front { transform: translateZ(8px); }
.preview3d-back { transform: rotateY(180deg) translateZ(8px); }
.preview3d-product, .preview3d-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.preview3d-product { filter: drop-shadow(0 26px 28px rgba(23,38,52,.22)); }
.preview3d-art { z-index: 2; }
.preview3d-edge { position: absolute; top: 12%; bottom: 12%; width: 16px; background: linear-gradient(90deg,rgba(38,48,60,.22),rgba(255,255,255,.14)); transform-style: preserve-3d; opacity: .45; }
.preview3d-edge-left { left: 11%; transform: rotateY(90deg) translateZ(8px); transform-origin: left center; }
.preview3d-edge-right { right: 11%; transform: rotateY(90deg) translateZ(-8px); transform-origin: right center; }
.preview3d-help { text-align: center; color: #778493; font-size: 10.5px; padding-top: 4px; }

@media (max-width: 1420px) and (min-width: 1081px) {
  .editor-grid { grid-template-columns: 270px minmax(0,1fr) 350px; }
  .product-card { grid-template-columns: 54px 1fr 16px; }
  .product-thumb { width: 50px; height: 50px; }
  .product-card small { display: none; }
  .topbar { grid-template-columns: 220px 1fr 285px; }
  .mode-btn { padding-inline: 10px; font-size: 12px; }
}

@media (max-width: 1080px) {
  html, body { overflow: hidden; }
  .app-shell { height: 100vh; }
  .editor-grid { height: calc(100vh - var(--header-h) - var(--summary-h)); grid-template-columns: 250px minmax(0,1fr); overflow: hidden; }
  .left-sidebar { overflow-y: auto; }
  .workspace { min-height: 0; }
  .right-sidebar { overflow-y: auto; }
  .preview3d-object { width: min(560px, 90%); }
}

@media (max-width: 760px) {
  html, body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  :root { --header-h: 62px; --summary-h: 138px; }
  .app-shell { min-height: 100vh; height: auto; overflow: visible; grid-template-rows: var(--header-h) auto auto; }
  .editor-grid { height: auto; min-height: 0; display: flex; overflow: visible; }
  .left-sidebar { max-height: 230px; overflow-y: auto; }
  .product-list { display: flex; overflow-x: auto; }
  .product-card { min-width: 205px; }
  .preset-grid { grid-template-columns: repeat(3,1fr); }
  .workspace { min-height: 560px; }
  .stage-wrap { min-height: 420px; }
  .preview3d { min-height: 500px; }
  .preview3d-object { width: min(500px, 94%); }
  .summary-bar { height: auto; min-height: var(--summary-h); }
}
#designCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; }

/* Premium 2D stage sizing: keep the Fabric canvas at a stable design resolution
   and use the workspace zoom to fit it into the available viewport. */
.editor-grid { grid-template-columns: minmax(270px, 292px) minmax(0, 1fr) minmax(330px, 360px); }
.stage-wrap { overflow: visible; scrollbar-width: thin; scrollbar-color: #c7d2d8 transparent; }
.stage-wrap.is-zoomed { overflow: auto; }
.stage { width: 760px; height: 720px; max-width: none; aspect-ratio: auto; }
.stage { transform: none !important; transform-origin: initial; transition: none; }
.secondary-button:disabled { opacity: .45; cursor: default; }
.product-base-image { object-fit: contain; }

@media (max-width: 1420px) and (min-width: 1081px) {
  .editor-grid { grid-template-columns: 270px minmax(0, 1fr) 350px; }
}

@media (max-width: 1080px) {
  .stage-wrap { overflow: visible; }
  .stage-wrap.is-zoomed { overflow: auto; }
  .stage { max-width: none; }
}

@media (max-width: 760px) {
  .stage-wrap { overflow: visible; }
  .stage { width: 760px; height: 720px; }
}
