@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap");

:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --line-strong: #b9c3d1;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --coral: #e76f51;
  --amber: #b7791f;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.1);
  color-scheme: light;
  font-family:
    Poppins, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.editor-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(248, 250, 252, 0.6);
  backdrop-filter: blur(13px) saturate(1.08);
  -webkit-backdrop-filter: blur(13px) saturate(1.08);
  opacity: 1;
  visibility: visible;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.editor-loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.editor-loading-card {
  min-width: min(302px, calc(100vw - 48px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 28px;
  border: 1px solid rgba(219, 228, 239, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
}

.editor-loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: editorLoadingSpin 800ms linear infinite;
}

@keyframes editorLoadingSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-loading-overlay {
    transition: none;
  }

  .editor-loading-spinner {
    animation: none;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

body:not(.home-body) {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(18px);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.home-link {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: #0f172a;
  box-shadow: 0 6px 16px rgba(23, 32, 51, 0.06);
}

.app-title {
  color: #0f172a;
  font-size: 0.98rem;
  font-weight: 800;
  white-space: nowrap;
}

.toolbar-divider {
  width: 1px;
  height: 30px;
  background: var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  position: relative;
}

.brand-logo {
  display: block;
  width: 205px;
  height: auto;
  flex: 0 0 auto;
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 18px;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.brand .beta-pill {
  align-self: flex-start;
  margin-top: 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #172033 0%, #111827 100%);
  color: white;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 16px rgba(23, 32, 51, 0.16);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand span {
  display: block;
}

.brand span:not(.beta-pill) {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  min-height: 34px;
  display: inline-grid;
  grid-auto-flow: column;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  min-width: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  padding: 6px 10px;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.12);
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding-left: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.88rem;
}

.select-label select {
  height: 32px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0 28px 0 10px;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

#downloadSvg {
  background: #b45309;
  color: #ffffff;
}

#downloadSvg:hover {
  background: #92400e;
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.download-main {
  background: var(--blue);
}

.download-main:hover {
  background: #1d4ed8;
}

.editor-footer {
  position: absolute;
  right: 18px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(500px, calc(100% - 120px));
  padding: 3px 8px;
  border: 1px solid rgba(215, 222, 232, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #64748b;
  font-size: 0.58rem;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.workspace {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 88px clamp(320px, 25vw, 370px) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  background: #ededed;
}

.template-library-pane {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: 18px 8px;
  border-right: 1px solid rgba(229, 231, 235, 0.72);
  background: rgba(255, 255, 255, 0.82);
  overflow: auto;
}

.library-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 0 12px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-head span {
  display: none;
}

.library-head strong {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.library-list {
  display: grid;
  gap: 9px;
  justify-items: center;
}

.library-template {
  width: 70px;
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: center;
  box-shadow: none;
}

.library-template:hover {
  background: rgba(219, 234, 254, 0.54);
}

.library-template.is-active {
  background: rgba(219, 234, 254, 0.78);
  box-shadow: inset 0 0 0 1px rgba(0, 109, 255, 0.24);
}

.library-template-name {
  overflow: hidden;
  color: #0f172a;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.library-template-kind {
  display: none;
}

.control-pane {
  grid-column: 2;
  grid-row: 1;
  background: transparent;
  min-width: 0;
  min-height: 0;
}

.control-pane {
  border-right: 0;
  border-left: 0;
  padding: 18px 0 18px 18px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.42) transparent;
}

.control-pane::-webkit-scrollbar {
  width: 6px;
}

.control-pane::-webkit-scrollbar-track {
  background: transparent;
}

.control-pane::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
}

.control-section {
  padding: 16px 14px 14px;
}

.section-title h2 {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.stage-pane {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px 22px 18px;
  overflow: hidden;
}

.stage-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid rgba(215, 222, 232, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.stage-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.line-legend {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(215, 222, 232, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(23, 32, 51, 0.08);
  backdrop-filter: blur(8px);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
}

.line-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.line-legend i {
  width: 24px;
  height: 3px;
  display: inline-block;
  border-radius: 99px;
}

.legend-cut {
  background: #2563eb;
}

.legend-fold {
  background: repeating-linear-gradient(
    to right,
    #FF0000 0,
    #FF0000 6px,
    transparent 6px,
    transparent 9px
  );
}

.legend-bleed {
  background: #00FF00;
}

body[data-template="laser-box"] .bleed-toggle-row,
body[data-template="laser-box"] .bleed-value-row,
body[data-template="laser-box"] .legend-fold-item,
body[data-template="laser-box"] .legend-bleed-item,
body[data-template="laser-box"] .stage-guide-overlay {
  display: none;
}

.bleed-value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.bleed-value-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.28;
}

.bleed-value-label strong,
.bleed-value-label small {
  display: block;
}

.bleed-value-label strong {
  margin-bottom: 3px;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
}

.bleed-input-group {
  width: 96px;
  max-width: 96px;
}

.bleed-input-group input {
  height: 38px;
  font-size: 0.84rem;
}

.eyebrow {
  display: none;
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.08;
  letter-spacing: 0;
  white-space: nowrap;
}

#templateDescription {
  flex: 1 1 auto;
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-strip {
  display: none;
}

.metric {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 6px 9px;
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.05);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric strong {
  display: block;
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.preview-shell {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(23, 32, 51, 0.032) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 32, 51, 0.032) 1px, transparent 1px),
    #eeeeee;
  background-size: 22px 22px;
  box-shadow: none;
}

.preview-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 18px 24px 78px;
  overflow: auto;
  cursor: grab;
  user-select: none;
  touch-action: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.preview-canvas::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.preview-canvas svg {
  display: block;
  flex: 0 0 auto;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform-origin: center center;
}

.preview-canvas.is-dragging {
  cursor: grabbing;
}

.param-measure-editor {
  overflow: visible;
}

.measure-edit-box {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0.45px solid rgba(15, 118, 110, 0.5);
  border-radius: 4px;
  background: rgba(236, 253, 245, 0.94);
  color: #0f766e;
  font: 700 5.2px Poppins, Arial, sans-serif;
  box-shadow: 0 1px 4px rgba(15, 118, 110, 0.11);
}

.measure-edit-box input {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-weight: 700;
  text-align: right;
  line-height: 1;
  appearance: textfield;
  -moz-appearance: textfield;
}

.measure-edit-box input::selection {
  background: rgba(20, 184, 166, 0.28);
  color: #064e3b;
}

.measure-edit-box input::-webkit-outer-spin-button,
.measure-edit-box input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.measure-edit-box span {
  flex: 0 0 auto;
  padding-right: 2.5px;
  color: #0f766e;
  font-size: inherit;
  font-weight: 700;
  line-height: 1;
}

.measure-edit-box:focus-within {
  border-color: rgba(15, 118, 110, 0.7);
  background: rgba(236, 253, 245, 0.98);
  box-shadow: 0 0 0 0.45px rgba(15, 118, 110, 0.18), 0 1px 5px rgba(15, 118, 110, 0.12);
}

.measure-edit-box:focus-within input,
.measure-edit-box:focus-within span {
  color: #0f766e;
}

.stage-guide-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  z-index: 4;
}

.dimension-guide-trigger {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.14);
  backdrop-filter: blur(8px);
}

.dimension-guide-trigger .ui-icon {
  width: 22px;
  height: 22px;
}

.dimension-guide-trigger:hover,
.dimension-guide-trigger:focus-visible {
  border-color: rgba(15, 118, 110, 0.45);
  background: #ffffff;
  color: var(--accent-strong);
}

.dimension-guide-trigger:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 3px;
}

.canvas-tools {
  position: absolute;
  left: 50%;
  bottom: 44px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(215, 222, 232, 0.96);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(23, 32, 51, 0.11);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.canvas-tools button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: #0f172a;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease;
}

.canvas-tools button:hover:not(:disabled) {
  background: #eef2f6;
}

.canvas-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.canvas-tools span {
  min-width: 50px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

body > .btn-container {
  position: fixed !important;
  right: 18px !important;
  bottom: 18px !important;
  left: auto !important;
  z-index: 40 !important;
  display: inline-flex !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  line-height: 1 !important;
}

body:not(.home-body) > .btn-container {
  right: 364px !important;
  bottom: 82px !important;
}

body > .btn-container .kofi-button {
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 28px rgba(30, 41, 84, 0.18) !important;
  text-decoration: none !important;
}

body > .btn-container .kofitext {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

body > .btn-container .kofiimg {
  width: 20px !important;
  height: 14px !important;
  margin: 0 !important;
}

.download-modal[hidden] {
  display: none;
}

.download-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
}

.download-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(96, 76, 255, 0.12), transparent 34%),
    rgba(241, 246, 252, 0.72);
  backdrop-filter: blur(5px);
}

.download-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 36px));
  min-height: 0;
  padding: 26px 28px 24px;
  border: 1px solid rgba(215, 222, 238, 0.98);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.96)),
    #ffffff;
  box-shadow: 0 24px 60px rgba(30, 41, 84, 0.18);
  color: #192151;
  text-align: center;
}

.download-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f8fafc;
  color: #54607e;
}

.download-close:hover {
  border-color: #dbe3ee;
  background: #eef2ff;
  color: #5548ff;
}

.download-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

.download-status h2 {
  margin: 0;
  color: #192151;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.15;
}

.download-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 34px 2px;
  text-align: center;
  flex-wrap: wrap;
}

.download-progress {
  width: min(210px, 54vw);
  height: 8px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  overflow: hidden;
  background: #eef2ff;
}

.download-progress span {
  display: block;
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5548ff, #72a4f2);
  animation: downloadProgress 1.3s ease-in-out infinite;
}

.download-status p {
  max-width: 420px;
  margin: 20px auto 18px;
  color: #5b6585;
  font-size: 0.88rem;
  line-height: 1.55;
}

.download-status-started p {
  margin-top: 14px;
}

.download-started-copy {
  max-width: 430px;
  margin-left: auto !important;
  margin-right: auto !important;
  color: #3f4a68 !important;
  font-size: 1rem !important;
  line-height: 1.45 !important;
}

.coffee-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 0;
  padding: 0 18px 0 12px;
  border: 1px solid rgba(255, 199, 55, 0.8);
  border-radius: 13px;
  background: linear-gradient(135deg, #ffe38a, #ffd05a);
  color: #192151;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(234, 179, 8, 0.18);
}

.coffee-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ffde73, #ffc83d);
  box-shadow: 0 14px 28px rgba(234, 179, 8, 0.22);
}

.coffee-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}

.coffee-icon svg {
  width: 30px;
  height: 30px;
}

@keyframes downloadProgress {
  0% {
    width: 22%;
  }
  55% {
    width: 72%;
  }
  100% {
    width: 34%;
  }
}

@media (max-width: 560px) {
  .download-dialog {
    width: calc(100vw - 28px);
    padding: 24px 18px 20px;
    border-radius: 14px;
  }

  .download-heading-row {
    padding-left: 26px;
    padding-right: 26px;
  }

  .download-status h2 {
    font-size: 1.06rem;
  }

  .download-started-copy {
    font-size: 0.92rem !important;
  }
}

.download-modal-backdrop {
  background: rgba(248, 251, 255, 0.72);
  backdrop-filter: blur(12px);
}

.download-dialog {
  width: min(470px, calc(100vw - 32px));
  padding: 28px 32px 30px;
  border: 1px solid rgba(222, 230, 244, 0.95);
  border-radius: 24px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
}

.download-close {
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: #64748b;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.download-close:hover {
  background: #f8fbff;
  color: #172033;
}

.download-status h2 {
  color: #172033;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0;
}

.download-status-creating h2 {
  font-size: 1.08rem;
}

.download-heading-row {
  min-height: 34px;
}

.download-progress {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(37, 99, 235, 0.16);
  border-top-color: #2563eb;
  border-radius: 50%;
  background: transparent;
  animation: downloadSpin 0.85s linear infinite;
}

.download-progress span {
  display: none;
}

.download-illustration {
  width: 178px;
  max-width: 58%;
  margin: 0 auto 14px;
}

.download-illustration svg {
  display: block;
  width: 100%;
  height: auto;
}

.download-status p,
.download-status-started p {
  max-width: 360px;
  margin: 12px auto 0;
  color: #667391;
  font-size: 0.95rem;
  line-height: 1.55;
}

.download-started-copy {
  max-width: 365px;
  color: #667391 !important;
  font-size: 0.94rem !important;
  line-height: 1.55 !important;
}

.download-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 2px 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #f1f4ff;
  color: #26365e;
  text-align: left;
}

.download-note span {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #4b63ff;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  font-style: normal;
}

.download-note p {
  max-width: none;
  margin: 0;
  color: #26365e;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.download-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.68fr);
  gap: 16px;
  margin-top: 24px;
}

.download-actions[hidden] {
  display: none;
}

.coffee-button,
.download-later {
  min-height: 52px;
  justify-content: center;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 900;
}

.coffee-button {
  width: 100%;
  margin: 0;
  padding: 0 18px;
  border-color: rgba(244, 180, 0, 0.75);
  background: linear-gradient(180deg, #ffd44d 0%, #ffb900 100%);
  color: #171717;
  box-shadow: 0 14px 28px rgba(245, 158, 11, 0.22);
}

.coffee-button:hover {
  background: linear-gradient(180deg, #ffdc68 0%, #ffc21c 100%);
}

.coffee-icon {
  width: 28px;
  height: 28px;
}

.download-note {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 22px 0 0;
  padding: 14px 16px;
  border: 1px solid #e2e9ff;
  border-radius: 12px;
  background: #f3f6ff;
  color: #26365e;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.download-note span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #3167e8;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
}

.download-note p {
  margin: 0 !important;
  color: #26365e !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  text-align: left !important;
}

.download-later {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e1ef;
  background: #ffffff;
  color: #26365e;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.download-later:hover {
  border-color: #c7d3e5;
  background: #f8fbff;
}

@keyframes downloadSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 560px) {
  .download-dialog {
    padding: 26px 18px 22px;
    border-radius: 20px;
  }

  .download-illustration {
    max-width: 150px;
  }

  .download-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.control-section {
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.param-form {
  display: grid;
  gap: 8px;
}

.param-group {
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.param-group[open] {
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.06),
    0 1px 2px rgba(15, 23, 42, 0.04);
}

.param-group-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  cursor: pointer;
  user-select: none;
}

.param-group-summary::-webkit-details-marker {
  display: none;
}

.param-group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 800;
}

.param-group-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.param-group[open] .param-group-caret {
  transform: rotate(225deg);
}

.param-group-body {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.field-cluster {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #cfe0d8;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 251, 250, 0.98) 100%);
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.field-cluster .field-row {
  margin: 0;
}

.param-group-body.field-cluster {
  margin: 0 8px 8px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  grid-template-areas:
    "copy input";
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.choice-row {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.field-row.is-param-active,
.choice-row.is-param-active,
.toggle-row.is-param-active {
  border-color: rgba(85, 72, 255, 0.5);
  background: linear-gradient(180deg, #ffffff 0%, #f5f4ff 100%);
  box-shadow:
    0 0 0 2px rgba(85, 72, 255, 0.08),
    0 8px 18px rgba(85, 72, 255, 0.1);
}

.choice-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #0f172a;
  font-size: 0.86rem;
  line-height: 1.2;
}

.choice-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.choice-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.choice-segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
}

.choice-segmented button.is-active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

.field-cluster .field-row {
  border-color: #d8e5ee;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.field-copy {
  grid-area: copy;
  min-width: 0;
}

.field-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #0f172a;
  font-size: 0.86rem;
  line-height: 1.2;
}

.field-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-icon .dash {
  stroke-dasharray: 3 2;
}

.field-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.input-group {
  grid-area: input;
  position: relative;
  width: 112px;
}

.input-group input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafc;
  padding: 0 34px 0 8px;
  text-align: right;
  font-size: 0.96rem;
  font-weight: 800;
}

.field-row-slider {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "copy"
    "slider";
  align-items: stretch;
}

.slider-control {
  grid-area: slider;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
}

.slider-control input[type="range"] {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-control output {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.unit-chip {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #475569;
  font-size: 0.66rem;
  font-weight: 800;
  pointer-events: none;
}

.field-range {
  display: none;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
}

.control-section {
  margin-bottom: 10px;
  border: 1px solid rgba(215, 222, 232, 0.92);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 10px 26px rgba(23, 32, 51, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}

.section-title {
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.info-dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #8c8c8c;
  color: #ffffff;
  font-family: Poppins, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.section-unit-switch {
  min-height: 24px;
  margin-left: auto;
  padding: 2px;
  border-color: #d7d7d7;
  border-radius: 999px;
  background: #eeeeee;
}

.section-unit-switch button {
  min-width: 46px;
  padding: 2px 9px;
  border-radius: 999px;
  color: #111827;
  font-size: 0.82rem;
  font-weight: 500;
}

.section-unit-switch button.is-active {
  background: #dbeafe;
  color: #006dff;
  box-shadow: inset 0 0 0 1px #5fa0ff;
}

.param-form {
  gap: 18px;
}

.param-group,
.param-group[open] {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.param-group-summary {
  min-height: 28px;
  padding: 0;
}

.param-group-title {
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 900;
}

.param-group-title .ui-icon {
  display: none;
}

.param-group-caret {
  width: 8px;
  height: 8px;
}

.param-group[data-group-id="dimensions"] > .param-group-summary {
  display: none;
}

.param-group[data-group-id="dimensions"] > .param-group-body {
  padding-top: 0;
}

.param-group-body,
.param-group-body.field-cluster,
.field-cluster {
  gap: 10px;
  margin: 0;
  padding: 6px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.param-group[data-group-id="dimensions"] > .param-group-body {
  padding-top: 0;
}

.field-cluster-primary {
  grid-template-columns: repeat(2, minmax(0, 128px));
  justify-content: start;
  gap: 12px 8px;
}

.field-cluster-primary .field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "copy"
    "input";
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.field-row,
.choice-row,
.toggle-row,
.field-cluster .field-row {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.field-row {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "copy"
    "input";
  gap: 6px;
}

.field-row.is-param-active,
.choice-row.is-param-active,
.toggle-row.is-param-active {
  border-color: transparent;
  background: #dfefff;
  border-radius: 10px;
  box-shadow: none;
}

.field-row.is-param-active {
  margin: 0;
  padding: 4px;
  box-sizing: border-box;
  overflow: hidden;
}

.field-row.is-param-active .field-copy,
.choice-row.is-param-active .choice-copy {
  color: #0f172a;
}

.field-row.is-param-active .input-group {
  background: transparent;
  border-radius: 10px;
}

.field-copy strong,
.choice-copy strong,
.param-toggle-row .toggle-copy strong {
  gap: 0;
  color: #7a7a7a;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.15;
}

.field-row.is-param-active .field-copy strong {
  color: #1f2937;
}

.field-icon {
  display: none;
}

.field-copy span,
.choice-copy span,
.toggle-copy small {
  display: none;
}

.input-group {
  width: 100%;
  max-width: 128px;
  border-radius: 10px;
  background: #ffffff;
}

.input-group input {
  height: 43px;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  background: #ffffff;
  padding: 0 38px 0 14px;
  color: #111827;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.input-group:focus-within {
  background: transparent;
  box-shadow: none;
}

.unit-chip {
  right: 12px;
  color: #111827;
  font-size: 0.88rem;
  font-weight: 500;
}

.choice-row {
  gap: 8px;
}

.choice-segmented {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.choice-segmented button.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.toggle-row {
  min-height: 42px;
  grid-template-columns: minmax(0, 1fr) auto;
}

body[data-template="laser-box"] .param-group[data-group-id="material"] > .param-group-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 128px));
  align-items: start;
  gap: 12px 8px;
}

body[data-template="laser-box"] .param-group[data-group-id="material"] .field-row {
  min-width: 0;
}

body[data-template="laser-box"] .param-group[data-group-id="material"] .input-group {
  max-width: 128px;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] > .param-group-body {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .toggle-row {
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .toggle-copy strong {
  color: #7a7a7a;
  font-size: 0.8rem;
  font-weight: 500;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .toggle-copy small {
  display: none;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .field-row-slider {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  grid-template-areas: "copy slider";
  align-items: center;
  gap: 10px;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .field-row-slider .field-copy strong {
  color: #7a7a7a;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.15;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .field-row-slider .field-copy span {
  display: none;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .slider-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 0;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .slider-control input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: #1477ff;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .slider-control output {
  min-width: 72px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  font-size: 0.88rem;
  font-weight: 500;
}

body[data-template="laser-box"] .param-group[data-group-id="joints"] .toggle-row:focus-within {
  outline: 0;
}

.control-section + .control-section {
  border-top: 0;
}

.template-guide {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(450px, calc(100vw - 48px));
  display: grid;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.stage-guide-overlay:hover .template-guide,
.stage-guide-overlay:focus-within .template-guide {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.template-guide-head strong,
.template-guide-head span {
  display: block;
}

.template-guide-head strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0f172a;
  font-size: 0.8rem;
  line-height: 1.2;
}

.template-guide-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.guide-card {
  overflow: hidden;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
}

.guide-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.guide-card img {
  display: block;
  width: 100%;
  height: auto;
}

.guide-card-image {
  background: #1f2023;
}

.input-group input:focus {
  border-color: #1477ff;
  outline: 0;
}

.select-label select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.toggle-copy {
  min-width: 0;
}

.toggle-copy strong,
.toggle-copy small {
  display: block;
}

.param-toggle-row .toggle-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.86rem;
  line-height: 1.2;
}

.toggle-copy strong {
  color: #0f172a;
  font-size: 0.86rem;
  line-height: 1.15;
}

.toggle-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-switch {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.28);
}

.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.toggle-row:focus-within {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

.swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line-strong);
  transition:
    box-shadow 140ms ease,
    transform 140ms ease;
}

.swatches button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 4px 12px rgba(15, 23, 42, 0.14);
}

.swatches button.is-active {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px rgba(15, 118, 110, 0.45);
}

.swatches button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 4px;
}

.output-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.output-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
}

.output-list dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.output-list dd {
  margin-left: 0;
  min-width: 0;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ui-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 76px minmax(286px, 330px) minmax(0, 1fr);
  }

  .template-library-pane {
    grid-column: 1;
    grid-row: 1;
    border-right: 1px solid rgba(229, 231, 235, 0.72);
    border-bottom: 0;
    overflow: auto;
  }

  .library-list {
    display: grid;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }

  .library-template {
    min-width: 0;
    width: 60px;
  }

  body:not(.home-body) > .btn-container {
    right: 18px !important;
    bottom: 76px !important;
  }

  .stage-guide-overlay {
    width: 42px;
  }

  .control-pane {
    grid-column: 2;
    grid-row: 1;
    border-left: 0;
    border-top: 0;
    display: block;
    padding: 14px 0 14px 12px;
  }

  .control-section {
    border-bottom: 1px solid rgba(215, 222, 232, 0.92);
    border-right: 1px solid rgba(215, 222, 232, 0.92);
  }

  .control-section:last-child {
    border-right: 1px solid rgba(215, 222, 232, 0.92);
  }

  .stage-pane {
    grid-column: 3;
    grid-row: 1;
    padding: 14px 16px 14px;
  }
}

@media (max-width: 980px) {
  .control-pane {
    grid-template-columns: 1fr;
  }

  .control-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .stage-header {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
    min-width: 0;
    overflow: hidden;
  }

  .topbar-actions {
    align-self: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .toolbar-left {
    min-width: 0;
  }

  .topbar-actions > * {
    flex: 0 0 auto;
  }

  .brand-logo {
    width: min(220px, calc(100vw - 96px));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-pane {
    border-right: 0;
    border-left: 0;
  }

  .stage-pane {
    padding: 12px;
  }

  /* On desktop, .app-shell/.workspace/.control-pane/.stage-pane are each
     independently-scrolling fixed-height panels (a standard app-shell
     layout). On a phone-sized viewport that means the controls sit in a
     cramped ~350px scroll box while the canvas sits in a second, separate
     one — two nested scrollbars fighting for the same screen. Switch to
     one natural page scroll instead: the sidebar's field list and the
     canvas preview just flow top-to-bottom like a normal page. */
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace {
    height: auto;
    overflow: visible;
  }

  .control-pane {
    overflow: visible;
  }

  .stage-pane {
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .stage-header {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    min-width: 0;
  }

  .control-pane {
    display: block;
  }

  .stage-guide-overlay {
    top: 12px;
    right: 12px;
    width: 42px;
  }

  .line-legend {
    top: 10px;
    left: 10px;
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.68rem;
  }

  .preview-canvas {
    min-height: clamp(280px, 46vh, 460px);
    padding: 14px;
  }

  .field-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "input"
      "range";
  }

  .input-group {
    width: 100%;
  }

  .control-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* Reference-style compact editor layout */
.topbar {
  min-height: 84px;
  padding: 10px 18px;
}

.toolbar-left {
  min-width: 330px;
}

.brand-logo {
  width: 255px;
}

.topbar-actions {
  gap: 12px;
}

.topbar-actions > .segmented,
.topbar-actions > .select-label,
.topbar-actions > .ghost-button,
.topbar-actions > .primary-button {
  min-height: 46px;
}

.topbar-actions > .segmented {
  border-radius: 11px;
  padding: 4px;
}

.topbar-actions > .segmented button {
  min-width: 58px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 600;
}

.topbar-actions > .select-label {
  border-radius: 11px;
  padding-left: 14px;
  font-size: 0.95rem;
}

.topbar-actions > .select-label select {
  min-width: 150px;
  height: 44px;
  border-radius: 0 11px 11px 0;
  font-size: 0.95rem;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 0.95rem;
}

.workspace {
  grid-template-columns: 108px minmax(390px, 430px) minmax(0, 1fr);
  background: #f3f4f6;
}

.template-library-pane {
  padding: 26px 8px;
  border-right-color: rgba(229, 231, 235, 0.86);
  background: rgba(255, 255, 255, 0.84);
}

.library-head {
  margin-bottom: 22px;
}

.library-template {
  width: 86px;
  min-height: 92px;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 12px;
}

.library-template-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #0f172a;
}

.library-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-template.is-active {
  background: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.library-template.is-active .library-template-icon,
.library-template.is-active .library-template-name {
  color: #006dff;
}

.library-template-name {
  font-size: 0.74rem;
  font-weight: 600;
}

.control-pane {
  padding: 16px 10px 16px 18px;
}

.control-section {
  margin-bottom: 16px;
  padding: 20px 20px 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.section-title {
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.15;
}

.info-dot {
  width: 20px;
  height: 20px;
  font-size: 0.82rem;
}

.section-unit-switch {
  min-height: 30px;
}

.section-unit-switch button {
  min-width: 52px;
  font-size: 0.86rem;
}

.field-cluster-primary {
  max-width: 370px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.field-cluster-primary .field-row {
  gap: 7px;
}

.field-copy strong,
.choice-copy strong,
.param-toggle-row .toggle-copy strong {
  color: #71717a;
  font-size: 0.86rem;
  font-weight: 400;
}

.field-row.is-param-active {
  margin: 0;
  padding: 4px;
  border-radius: 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.input-group {
  max-width: none;
  min-width: 0;
}

.input-leading-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #64748b;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-leading-icon .field-icon {
  width: 17px;
  height: 17px;
  display: block;
  color: currentColor;
}

.input-group input {
  height: 46px;
  padding: 0 46px 0 40px;
  border-color: #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
}

.input-group input:focus {
  border-color: #1477ff;
}

.unit-chip {
  right: 13px;
  font-size: 0.9rem;
  font-weight: 500;
}

.param-form {
  gap: 12px;
}

.param-group:not([data-group-id="dimensions"]) {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.param-group-summary {
  min-height: 38px;
}

.param-group-title {
  gap: 10px;
  font-size: 0.94rem;
  font-weight: 700;
}

.param-group-title .ui-icon {
  width: 19px;
  height: 19px;
  display: block;
  color: #334155;
}

.param-group-caret {
  width: 10px;
  height: 10px;
}

.choice-row,
.toggle-row,
.field-cluster .field-row {
  border-radius: 8px;
}

.choice-segmented button {
  min-height: 38px;
  font-size: 0.8rem;
}

.toggle-row {
  min-height: 46px;
  padding: 7px 10px;
  border-color: #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
}

.toggle-copy strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.toggle-copy small {
  display: block;
  font-size: 0.68rem;
}

.toggle-row input:checked + .toggle-switch {
  background: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.26);
}

.bleed-value-row {
  grid-template-columns: minmax(0, 1fr) 112px;
  margin-top: 10px;
}

.bleed-input-group {
  width: 112px;
  max-width: 112px;
}

.bleed-input-group input {
  height: 38px;
  padding-left: 12px;
}

.control-section:nth-of-type(2) {
  padding-top: 18px;
  padding-bottom: 16px;
}

.control-section:nth-of-type(2) .section-title {
  margin-bottom: 12px;
}

.control-section:nth-of-type(2) .toggle-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 8px 12px;
}

.control-section:nth-of-type(2) .toggle-row::before {
  content: "A";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.control-section:nth-of-type(2) .bleed-toggle-row::before {
  content: "";
  background-color: #fff1f2;
  background-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2028%2028%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Crect%20x%3D%278%27%20y%3D%278%27%20width%3D%2712%27%20height%3D%2712%27%20rx%3D%273%27%20fill%3D%27none%27%20stroke%3D%27%23ef4444%27%20stroke-width%3D%272%27%20stroke-dasharray%3D%273%202%27/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px 24px;
  border-color: #fecdd3;
}

.control-section:nth-of-type(2) .toggle-copy small {
  font-size: 0.66rem;
  line-height: 1.15;
}

.control-section:nth-of-type(2) .bleed-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.control-section:nth-of-type(2) .bleed-value-label {
  flex: 1 1 auto;
  min-width: 0;
}

.control-section:nth-of-type(2) .bleed-input-group {
  flex: 0 0 112px;
  width: 112px;
  max-width: 112px;
}

.control-section:nth-of-type(2) .bleed-input-group input {
  height: 34px;
  padding-right: 34px;
  font-size: 0.78rem;
}

.control-section:nth-of-type(2) .bleed-input-group .unit-chip {
  right: 9px;
  font-size: 0.78rem;
}

.swatches,
.output-section {
  display: none;
}

.stage-pane {
  padding: 18px 22px 18px;
}

.stage-header {
  min-height: 76px;
  margin-bottom: 0;
  padding: 14px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
}

.stage-copy {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

h1 {
  font-size: 1.32rem;
  font-weight: 800;
}

#templateDescription {
  max-width: 100%;
  font-size: 0.92rem;
  line-height: 1.35;
}

.preview-shell {
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(23, 32, 51, 0.038) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 32, 51, 0.038) 1px, transparent 1px),
    #f3f4f6;
  background-size: 24px 24px;
}

.preview-canvas {
  padding: 30px 40px 84px;
}

.line-legend {
  top: 22px;
  left: 22px;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.line-legend i {
  width: 32px;
}

.canvas-tools {
  bottom: 34px;
  gap: 14px;
  padding: 10px 18px;
  border-radius: 16px;
}

.canvas-tools button {
  width: 38px;
  height: 38px;
}

.canvas-tools span {
  min-width: 62px;
  font-size: 0.96rem;
  font-weight: 700;
}

.stage-guide-overlay {
  top: 28px;
  right: 28px;
}

.dimension-guide-trigger {
  width: 54px;
  height: 54px;
}

.editor-footer {
  right: 36px;
  bottom: 26px;
}

@media (max-width: 1400px) {
  .topbar {
    min-height: 72px;
    padding: 8px 14px;
  }

  .toolbar-left {
    min-width: 270px;
  }

  .brand-logo {
    width: 230px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-actions > .segmented,
  .topbar-actions > .select-label,
  .topbar-actions > .ghost-button,
  .topbar-actions > .primary-button {
    min-height: 42px;
  }

  .topbar-actions > .segmented button {
    min-width: 48px;
    font-size: 0.86rem;
  }

  .topbar-actions > .select-label select {
    min-width: 120px;
    height: 40px;
  }

  .primary-button,
  .ghost-button {
    min-height: 42px;
    padding: 0 13px;
    font-size: 0.86rem;
  }

  .workspace {
    grid-template-columns: 84px minmax(318px, 350px) minmax(0, 1fr);
  }

  .template-library-pane {
    padding: 16px 6px;
  }

  .library-template {
    width: 70px;
    min-height: 72px;
    gap: 5px;
  }

  .library-template-icon {
    width: 22px;
    height: 22px;
  }

  .library-icon {
    width: 21px;
    height: 21px;
  }

  .library-template-name {
    font-size: 0.66rem;
  }

  .control-pane {
    padding: 14px 8px 14px 12px;
  }

  .control-section {
    margin-bottom: 12px;
    padding: 18px 16px 16px;
    border-radius: 18px;
  }

  .section-title {
    margin-bottom: 14px;
  }

  .section-title h2 {
    font-size: 1rem;
  }

  .field-cluster-primary {
    gap: 10px 12px;
  }

  .input-group input {
    height: 44px;
    padding-left: 40px;
    padding-right: 46px;
    font-size: 0.88rem;
  }

  .input-leading-icon {
    left: 13px;
  }

  .unit-chip {
    right: 13px;
    font-size: 0.88rem;
  }

  .param-group:not([data-group-id="dimensions"]) {
    padding-top: 10px;
  }

  .param-group-summary {
    min-height: 34px;
  }

  .param-group-title {
    font-size: 0.9rem;
  }

  .param-group-title .ui-icon {
    width: 18px;
    height: 18px;
  }

  .toggle-row {
    min-height: 44px;
    padding: 6px 10px;
  }

  .control-section:nth-of-type(2) {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .control-section:nth-of-type(2) .section-title {
    margin-bottom: 12px;
  }

  .control-section:nth-of-type(2) .toggle-row {
    min-height: 42px;
  }

  .control-section:nth-of-type(2) .toggle-copy small {
    font-size: 0.66rem;
    line-height: 1.15;
  }

  .control-section:nth-of-type(2) .bleed-value-row {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
    margin-top: 8px;
  }

  .control-section:nth-of-type(2) .bleed-input-group {
    width: 92px;
    max-width: 92px;
  }

  .control-section:nth-of-type(2) .bleed-input-group input {
    height: 34px;
    padding-right: 34px;
    font-size: 0.78rem;
  }

  .control-section:nth-of-type(2) .bleed-input-group .unit-chip {
    right: 9px;
    font-size: 0.78rem;
  }

  body[data-template="laser-box"] .control-section:first-child {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  body[data-template="laser-box"] .control-section:first-child .section-title {
    margin-bottom: 10px;
  }

  body[data-template="laser-box"] .param-form {
    gap: 8px;
  }

  body[data-template="laser-box"] .param-group:not([data-group-id="dimensions"]) {
    padding-top: 8px;
  }

  body[data-template="laser-box"] .param-group-summary {
    min-height: 30px;
  }

  body[data-template="laser-box"] .param-group-title {
    font-size: 0.82rem;
  }

  body[data-template="laser-box"] .param-group-title .ui-icon {
    width: 16px;
    height: 16px;
  }

  body[data-template="laser-box"] .param-group-caret {
    width: 8px;
    height: 8px;
  }

  body[data-template="laser-box"] .param-group-body,
  body[data-template="laser-box"] .param-group-body.field-cluster,
  body[data-template="laser-box"] .field-cluster {
    gap: 8px;
    padding-top: 4px;
  }

  body[data-template="laser-box"] .field-cluster-primary,
  body[data-template="laser-box"] .param-group[data-group-id="material"] > .param-group-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  body[data-template="laser-box"] .field-copy strong,
  body[data-template="laser-box"] .choice-copy strong,
  body[data-template="laser-box"] .param-toggle-row .toggle-copy strong {
    font-size: 0.78rem;
  }

  body[data-template="laser-box"] .input-group input {
    height: 38px;
    padding-left: 34px;
    padding-right: 40px;
    font-size: 0.82rem;
  }

  body[data-template="laser-box"] .input-leading-icon {
    left: 10px;
  }

  body[data-template="laser-box"] .input-leading-icon .field-icon {
    width: 16px;
    height: 16px;
  }

  body[data-template="laser-box"] .unit-chip {
    right: 10px;
    font-size: 0.82rem;
  }

  body[data-template="laser-box"] .choice-copy {
    display: none;
  }

  body[data-template="laser-box"] .choice-row {
    gap: 6px;
  }

  body[data-template="laser-box"] .choice-segmented {
    padding: 3px;
  }

  body[data-template="laser-box"] .choice-segmented button {
    min-height: 34px;
    font-size: 0.78rem;
  }

  body[data-template="laser-box"] .param-group[data-group-id="joints"] > .param-group-body {
    gap: 7px;
  }

  body[data-template="laser-box"] .param-group[data-group-id="joints"] .toggle-row {
    min-height: 34px;
    padding: 0;
  }

  body[data-template="laser-box"] .param-group[data-group-id="joints"] .field-row-slider {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
  }

  body[data-template="laser-box"] .param-group[data-group-id="joints"] .slider-control {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  body[data-template="laser-box"] .param-group[data-group-id="joints"] .slider-control output {
    min-width: 64px;
    height: 34px;
    font-size: 0.78rem;
  }

  .stage-pane {
    padding: 14px 16px;
  }

  .stage-header {
    min-height: 72px;
    padding: 12px 18px;
  }

  h1 {
    font-size: 1.12rem;
  }

  #templateDescription {
    font-size: 0.82rem;
  }

  .preview-canvas {
    padding: 24px 28px 82px;
  }

  .line-legend {
    top: 18px;
    left: 18px;
    gap: 8px;
    padding: 12px 14px;
    font-size: 0.72rem;
  }

  .canvas-tools {
    bottom: 28px;
    padding: 10px 16px;
  }

  .dimension-guide-trigger {
    width: 46px;
    height: 46px;
  }
}

@media (max-height: 900px) and (min-width: 1401px) {
  .topbar {
    min-height: 74px;
    padding: 8px 16px;
  }

  .toolbar-left {
    min-width: 290px;
  }

  .brand-logo {
    width: 235px;
  }

  .topbar-actions {
    gap: 9px;
  }

  .topbar-actions > .segmented,
  .topbar-actions > .select-label,
  .topbar-actions > .ghost-button,
  .topbar-actions > .primary-button {
    min-height: 42px;
  }

  .topbar-actions > .segmented button {
    min-width: 50px;
    font-size: 0.86rem;
  }

  .topbar-actions > .select-label select {
    min-width: 126px;
    height: 40px;
  }

  .primary-button,
  .ghost-button {
    min-height: 42px;
    padding: 0 14px;
    font-size: 0.86rem;
  }

  .workspace {
    grid-template-columns: 92px minmax(340px, 390px) minmax(0, 1fr);
  }

  .template-library-pane {
    padding: 16px 6px;
  }

  .library-head {
    margin-bottom: 14px;
  }

  .library-template {
    width: 76px;
    min-height: 78px;
    gap: 5px;
    padding: 8px 6px;
  }

  .library-template-icon {
    width: 22px;
    height: 22px;
  }

  .library-icon {
    width: 21px;
    height: 21px;
  }

  .library-template-name {
    font-size: 0.68rem;
  }

  .control-pane {
    padding: 14px 8px 14px 12px;
  }

  .control-section {
    margin-bottom: 12px;
    padding: 18px 16px 16px;
    border-radius: 18px;
  }

  .section-title {
    margin-bottom: 14px;
  }

  .section-title h2 {
    font-size: 1rem;
  }

  .field-cluster-primary {
    gap: 10px 12px;
  }

  .field-copy strong,
  .choice-copy strong,
  .param-toggle-row .toggle-copy strong {
    font-size: 0.78rem;
  }

  .input-group input {
    height: 42px;
    padding-left: 38px;
    padding-right: 42px;
    font-size: 0.84rem;
  }

  .input-leading-icon {
    left: 12px;
  }

  .input-leading-icon .field-icon {
    width: 16px;
    height: 16px;
  }

  .unit-chip {
    right: 12px;
    font-size: 0.84rem;
  }

  .param-form {
    gap: 10px;
  }

  .param-group:not([data-group-id="dimensions"]) {
    padding-top: 10px;
  }

  .param-group-summary {
    min-height: 34px;
  }

  .param-group-title {
    font-size: 0.88rem;
  }

  .param-group-title .ui-icon {
    width: 18px;
    height: 18px;
  }

  .choice-segmented button {
    min-height: 34px;
    font-size: 0.78rem;
  }

  .toggle-row {
    min-height: 42px;
    padding: 6px 10px;
  }

  .control-section:nth-of-type(2) {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .control-section:nth-of-type(2) .bleed-value-row {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .control-section:nth-of-type(2) .bleed-input-group {
    width: 92px;
    max-width: 92px;
  }

  .stage-pane {
    padding: 14px 18px;
  }

  .stage-header {
    min-height: 72px;
    padding: 12px 18px;
  }

  h1 {
    font-size: 1.12rem;
  }

  #templateDescription {
    font-size: 0.82rem;
  }

  .preview-canvas {
    padding: 24px 32px 78px;
  }

  .line-legend {
    top: 18px;
    left: 18px;
    gap: 8px;
    padding: 12px 14px;
    font-size: 0.72rem;
  }

  .canvas-tools {
    bottom: 26px;
    padding: 9px 16px;
  }

  .dimension-guide-trigger {
    width: 46px;
    height: 46px;
  }

  body[data-template="laser-box"] .control-section:first-child {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  body[data-template="laser-box"] .control-section:first-child .section-title {
    margin-bottom: 10px;
  }

  body[data-template="laser-box"] .param-form {
    gap: 8px;
  }

  body[data-template="laser-box"] .param-group:not([data-group-id="dimensions"]) {
    padding-top: 8px;
  }

  body[data-template="laser-box"] .param-group-summary {
    min-height: 30px;
  }

  body[data-template="laser-box"] .param-group-title {
    font-size: 0.82rem;
  }

  body[data-template="laser-box"] .param-group-body,
  body[data-template="laser-box"] .param-group-body.field-cluster,
  body[data-template="laser-box"] .field-cluster {
    gap: 8px;
    padding-top: 4px;
  }

  body[data-template="laser-box"] .field-cluster-primary,
  body[data-template="laser-box"] .param-group[data-group-id="material"] > .param-group-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  body[data-template="laser-box"] .input-group input {
    height: 38px;
    padding-left: 34px;
    padding-right: 40px;
    font-size: 0.82rem;
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 76px minmax(290px, 320px) minmax(0, 1fr);
  }

  .toolbar-left {
    min-width: 220px;
  }

  .brand-logo {
    width: 190px;
  }
}

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

  .template-library-pane,
  .control-pane,
  .stage-pane {
    grid-column: 1;
  }
}

.control-section:nth-of-type(2) .toggle-row {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 44px;
  padding: 5px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.control-section:nth-of-type(2) .toggle-row:focus-within {
  border-color: transparent;
  outline: 0;
}

.control-section:nth-of-type(2) .toggle-row::before {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 600;
}

.control-section:nth-of-type(2) .bleed-toggle-row::before {
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Crect%20x%3D%274.5%27%20y%3D%274.5%27%20width%3D%2711%27%20height%3D%2711%27%20rx%3D%272%27%20fill%3D%27none%27%20stroke%3D%27%2364748b%27%20stroke-width%3D%271.6%27%20stroke-dasharray%3D%272.5%202%27/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
}

.control-section:nth-of-type(2) .bleed-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 0;
}

.control-section:nth-of-type(2) .bleed-value-label {
  flex: 1 1 auto;
  min-width: 0;
}

.control-section:nth-of-type(2) .toggle-copy strong,
.control-section:nth-of-type(2) .bleed-value-label strong {
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
}

.control-section:nth-of-type(2) .toggle-copy small,
.control-section:nth-of-type(2) .bleed-value-label small {
  color: #64748b;
  font-size: 0.64rem;
  line-height: 1.18;
}

.control-section:nth-of-type(2) .toggle-switch {
  width: 38px;
  height: 22px;
}

.control-section:nth-of-type(2) .toggle-switch::after {
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
}

.control-section:nth-of-type(2) .toggle-row input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

.control-section:nth-of-type(2) .bleed-input-group {
  flex: 0 0 112px;
  width: 112px;
  max-width: 112px;
}

.control-section:nth-of-type(2) .bleed-leading-icon {
  left: 10px;
  color: #64748b;
}

.control-section:nth-of-type(2) .bleed-input-group input {
  padding-left: 36px;
}

body[data-template="laser-box"] .bleed-toggle-row,
body[data-template="laser-box"] .bleed-value-row,
body[data-template="laser-box"] .legend-fold-item,
body[data-template="laser-box"] .legend-bleed-item,
body[data-template="laser-box"] .stage-guide-overlay {
  display: none;
}

body[data-template="laser-box"] .control-section:nth-of-type(2) .bleed-toggle-row,
body[data-template="laser-box"] .control-section:nth-of-type(2) .bleed-value-row {
  display: none;
}

.topbar-actions {
  gap: 10px;
}

.topbar-actions > .select-label,
.topbar-actions > .ghost-button,
.topbar-actions > .primary-button {
  min-height: 42px;
}

.topbar-actions > .select-label {
  border-radius: 10px;
}

.topbar-actions > .select-label select {
  height: 40px;
  min-width: 140px;
  border-radius: 0 10px 10px 0;
}

.ghost-button,
.primary-button {
  min-height: 42px;
  border-radius: 10px;
  gap: 7px;
  padding: 0 15px;
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.94);
  border-color: #d7e0eb;
  box-shadow: none;
}

#downloadSvg,
#downloadDxf,
#printPdf {
  border-color: transparent;
  color: #ffffff;
}

#downloadSvg {
  background: #b45309;
}

#downloadSvg:hover {
  background: #9a4307;
}

#downloadDxf {
  background: #0f766e;
}

#downloadDxf:hover {
  background: #0b665f;
}

#printPdf {
  background: #2563eb;
}

#printPdf:hover {
  background: #1d4ed8;
}

.topbar-actions .button-icon {
  width: 14px;
  height: 14px;
}

.stage-header {
  min-height: 62px;
  margin-bottom: 10px;
  padding: 12px 16px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.stage-copy {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.stage-header h1 {
  font-size: 1.08rem;
  line-height: 1.1;
}

#templateDescription {
  color: #52627a;
  font-size: 0.82rem;
  line-height: 1.25;
}

.input-group input,
.bleed-input-group input {
  height: 36px;
  max-height: 36px;
}

.preview-canvas {
  padding-bottom: 112px;
}

.canvas-tools {
  bottom: 54px;
  padding: 8px 12px;
  border-radius: 14px;
}

.canvas-tools button {
  width: 34px;
  height: 34px;
}

.canvas-tools span {
  min-width: 50px;
  font-size: 0.82rem;
}

.editor-footer {
  right: 18px;
  bottom: 10px;
  max-width: min(520px, calc(100% - 44px));
  padding: 3px 8px;
  font-size: 0.58rem;
  line-height: 1.25;
}

.param-group:not([data-group-id="dimensions"]) > .param-group-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.param-group:not([data-group-id="dimensions"]) .field-row {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
}

.param-group:not([data-group-id="dimensions"]) .field-row.is-param-active {
  padding: 4px;
  border-radius: 10px;
  background: #dfefff;
  box-sizing: border-box;
  overflow: hidden;
}

.param-group:not([data-group-id="dimensions"]) .field-row.is-param-active .input-group {
  max-width: none;
}

.param-group:not([data-group-id="dimensions"]) .field-copy {
  gap: 0;
}

.param-group:not([data-group-id="dimensions"]) .field-copy strong {
  min-height: 17px;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
}

.param-group:not([data-group-id="dimensions"]) .field-copy span,
.param-group:not([data-group-id="dimensions"]) .field-range {
  display: none;
}

.param-group:not([data-group-id="dimensions"]) .input-group {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 34px;
  border-radius: 8px;
}

.param-group:not([data-group-id="dimensions"]) .input-group input {
  height: 34px;
  max-height: 34px;
  padding-left: 30px;
  padding-right: 32px;
  font-size: 0.78rem;
}

.param-group:not([data-group-id="dimensions"]) .input-leading-icon {
  left: 9px;
}

.param-group:not([data-group-id="dimensions"]) .input-leading-icon .field-icon {
  width: 13px;
  height: 13px;
}

.param-group:not([data-group-id="dimensions"]) .unit-chip {
  right: 9px;
  font-size: 0.76rem;
}

.param-group:not([data-group-id="dimensions"]) .choice-row,
.param-group:not([data-group-id="dimensions"]) .toggle-row,
.param-group:not([data-group-id="dimensions"]) .field-row-slider {
  grid-column: 1 / -1;
}

.field-cluster.field-cluster-primary .field-row,
.param-group:not([data-group-id="dimensions"]) .field-row:not(.field-row-slider) {
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
}

.field-cluster.field-cluster-primary .field-row.is-param-active,
.param-group:not([data-group-id="dimensions"]) .field-row.is-param-active:not(.field-row-slider) {
  margin: 0;
  padding: 4px;
  background: #dfefff;
  box-shadow: none;
}

.field-cluster.field-cluster-primary .input-group,
.param-group:not([data-group-id="dimensions"]) .input-group {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.workspace {
  grid-template-columns: clamp(320px, 25vw, 370px) minmax(0, 1fr);
}

.control-pane {
  grid-column: 1;
}

.stage-pane {
  grid-column: 2;
}

@media (max-width: 1180px) {
  .param-group:not([data-group-id="dimensions"]) > .param-group-body {
    gap: 8px 10px;
  }
}

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

  .control-pane,
  .stage-pane {
    grid-column: 1;
  }

  .control-pane {
    grid-row: 1;
  }

  .stage-pane {
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .param-group:not([data-group-id="dimensions"]) > .param-group-body {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .template-library-pane,
  .control-pane,
  .stage-header {
    display: none;
  }

  .workspace,
  .stage-pane,
  .preview-shell,
  .preview-canvas {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
    min-height: 0;
  }

  .preview-canvas svg {
    width: 100%;
    height: auto;
    max-height: none;
  }
}
/* Compact editor export toolbar */
.editor-sheet-control {
  gap: 8px;
}

.editor-sheet-control > span {
  display: none;
}

.editor-sheet-control .sheet-gear {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.download-menu {
  position: relative;
}

.download-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(37, 99, 235, .18);
  transition: background .18s ease, transform .18s ease;
}

.download-menu-trigger:hover {
  background: #1d4ed8;
}

.download-menu-trigger:active {
  transform: translateY(1px);
}

.download-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform .18s ease;
}

.download-menu.is-open .download-chevron {
  transform: rotate(180deg);
}

.download-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  width: 260px;
  padding: 8px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(23, 32, 51, .16);
}

.download-menu-panel[hidden] {
  display: none;
}

.download-menu-panel #downloadSvg,
.download-menu-panel #downloadDxf,
.download-menu-panel #printPdf,
.download-menu-item,
.download-settings-item {
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #172033;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.download-menu-panel #downloadSvg:hover,
.download-menu-panel #downloadDxf:hover,
.download-menu-panel #printPdf:hover,
.download-menu-item:hover,
.download-settings-item:hover {
  background: #f1f5ff;
}

.download-menu-item .format-icon {
  display: block;
  width: 38px;
  height: 38px;
  box-sizing: border-box;
  object-fit: contain;
  flex: 0 0 38px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.format-svg,
.format-dxf,
.format-pdf { background: transparent; }

.download-menu-item strong,
.download-settings-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.download-menu-item small,
.download-settings-item small {
  display: block;
  margin-top: 3px;
  color: #6b7a94;
  font-size: 11px;
  line-height: 1.2;
}

.download-menu-item kbd {
  border: 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #718096;
  font-size: 10px;
  padding: 4px 6px;
}

.download-settings-item {
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #edf1f7;
}

.settings-icon,
.settings-chevron {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.settings-icon {
  color: #61728d;
}

.editor-overflow-button {
  width: 44px;
  height: 44px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #fff;
  color: #172033;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.editor-overflow-button:hover {
  background: #f1f5ff;
}

.topbar-actions {
  gap: 10px;
}

@media (max-width: 920px) {
  .download-menu-trigger {
    padding: 0 12px;
  }
}

@media (max-width: 760px) {
  .topbar-actions {
    gap: 8px;
  }

  .download-menu-trigger span {
    display: none;
  }

  .download-menu-panel {
    width: min(260px, calc(100vw - 24px));
  }
}
