.designer-page { --wrap: min(100% - 48px, 1536px); }
.studio-intro { padding-block: 20px 16px; }
.studio-intro-inner { display: flex; justify-content: space-between; align-items: end; gap: 12px 25px; flex-wrap: wrap; }
.studio-intro h1 { font-size: clamp(2.55rem, 4.7vw, 3.8rem); margin-block: 7px 6px; }
.studio-intro h1 + p { color: var(--muted); max-width: 76ch; }
.studio-wrap { padding-bottom: 12px; }
.studio-layout {
  display: grid;
  grid-template-columns: clamp(206px, 19.2vw, 276px) minmax(0, 1fr) clamp(189px, 17.6vw, 252px);
  align-items: start;
  gap: 12px;
}
.studio-setup, .studio-finish { display: grid; min-width: 0; gap: 12px; }
.settings-card, .studio-preview { background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.settings-card { padding: clamp(12px, 1.4vw, 19px); }
.settings-card h2, .settings-card h3 {
  font: 700 1rem/1.26 var(--body);
  letter-spacing: -.01em;
}
.settings-card h3 { margin-top: 15px; }
.studio-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-block: 10px 9px; }
.studio-fields label { grid-template-columns: max-content auto; column-gap: 4px; font-size: .85rem; }
.studio-fields label span { font-size: .81rem; }
.studio-fields input { grid-column: 1/-1; min-height: 42px; }
.studio-label { font-size: .88rem; }
.studio-label select { min-height: 41px; }
.profile-highlight {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 10px;
  min-height: 108px;
  border: 1px solid var(--line);
  background: #f2eee8;
}
.profile-highlight img { width: 100%; height: 97px; object-fit: contain; padding: 6px; }
.profile-highlight figcaption { background: var(--bg); padding: 4px 8px; font-size: .81rem; font-weight: 700; }
.profile-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.profile-option {
  padding: 0 2px 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  min-height: 51px;
  line-height: 1.09;
}
.profile-option img { width: 100%; height: 38px; object-fit: contain; padding: 2px; background: #f2eee8; }
.profile-option span { display: block; font-size: .72rem; overflow-wrap: anywhere; margin: 3px 0 1px; }
.profile-option:hover, .profile-option[aria-pressed="true"], .swatch[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-soft); }
.profile-option[aria-pressed="true"], .swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.frame-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 7px; }
.swatch {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  gap: 6px;
  padding: 5px;
  text-align: left;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  font-size: .78rem;
  font-weight: 620;
  line-height: 1.17;
}
.swatch > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.swatch:not(:disabled):hover { border-color: var(--accent); }
.swatch:disabled { opacity: .53; cursor: default; }
.swatch-sample {
  display: block;
  background: var(--sample);
  border: 1px solid #554b3677;
  width: 18px;
  height: 19px;
  flex: 0 0 auto;
}
.material-swatch { display: grid; grid-template-rows: 28px minmax(19px, auto); align-content: start; gap: 4px; }
.material-swatch .swatch-sample { width: 100%; height: 28px; }
.material-swatch .has-grain {
  background: repeating-linear-gradient(86deg, #0000 0px, #2a1c1620 1px, #fff2 3px, #0000 6px), var(--sample);
}
.swatch-mirror, .swatch-glass {
  background: linear-gradient(126deg, #fff3 1%, #fff8 24%, #fff1 48%, #0001 68%, #0003 100%), var(--sample);
}
.door-palette { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 7px; max-height: 214px; overflow-y: auto; padding: 2px; scrollbar-color: var(--line) transparent; }
.studio-segmented, .door-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.studio-segmented button, .door-tabs button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  min-height: 38px;
  padding: 4px 9px;
  line-height: 1.15;
  font-size: .87rem;
  font-weight: 650;
}
.studio-segmented button[aria-pressed="true"], .door-tabs button[aria-pressed="true"] {
  color: var(--button-text);
  background: var(--button);
  border-color: var(--button);
}
.finish-tabs { margin-top: 8px; gap: 3px; }
.finish-tabs button { flex: 1; padding-inline: 5px; }
.studio-dividers .form-note, .studio-finish .form-note { font-size: .79rem; line-height: 1.39; }
.divider-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.button-compact { min-height: 37px; padding: 5px 8px; font-size: .83rem; }
.preview-head, .preview-controls, .preview-info {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 7px 8px;
}
.preview-stage { min-width: 0; background: #ede5d8; }
.preview-stage canvas {
  display: block;
  width: 100%;
  height: clamp(320px, min(43vw, 100svh - 285px), 570px);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.preview-stage canvas:active { cursor: grabbing; }
.preview-action-row { display: flex; gap: 5px; flex-wrap: wrap; }
.angle-control, .door-area-control { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.angle-control input { width: clamp(80px, 12vw, 130px); accent-color: var(--accent); }
.door-area-control select { min-height: 38px; padding: 3px 6px; min-width: 98px; }
.preview-info {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .84rem;
  min-height: 39px;
  padding-block: 7px;
}
.studio-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
}
.studio-bottom .actions { margin-left: auto; }
.studio-bottom .feedback:not(:empty) { margin-top: 0; }
.studio-disclaimer { margin-top: 10px; font-size: .85rem; color: var(--muted); }
.print-details { display: none; }

@media (max-width: 960px) {
  .designer-page { --wrap: calc(100% - 36px); }
  .studio-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .studio-preview { grid-row: 1; grid-column: 1/-1; }
  .profile-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .door-palette { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: none; overflow: visible; }
  .preview-stage canvas { height: clamp(360px, 55vw, 515px); }
}

@media (max-width: 570px) {
  .designer-page { --wrap: calc(100% - 26px); }
  .studio-intro { padding-block: 24px 16px; }
  .studio-layout { grid-template-columns: minmax(0, 1fr); }
  .preview-stage canvas { height: clamp(320px, 82vw, 390px); }
  .preview-head { padding-inline: 8px; }
  .studio-setup, .studio-finish { gap: 8px; }
  .studio-layout { gap: 8px; }
  .door-tabs button { padding-inline: 6px; font-size: .82rem; }
  .studio-bottom .actions { margin-left: 0; }
}

@media print {
  :root, :root[data-theme="dark"] { --bg: white; --surface: white; --text: #201d19; --muted: #45413a; --line: #ded8ce; --accent: #513c14; }
  body { background: white; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .designer-page { --wrap: 100%; }
  .site-header { border: none; background: white; }
  .mast-top { min-height: 0; display: block; }
  .brand { width: 168px; min-height: 0; }
  .site-header .brand img { filter: brightness(.61) saturate(.95); }
  .mast-nav, .mast-tools, .site-footer, .skip, .studio-setup, .studio-finish,
  .studio-intro a, .preview-head, .preview-controls, .preview-info,
  .studio-bottom, .studio-disclaimer { display: none !important; }
  .studio-intro { padding: 13px 0 9px; }
  .studio-intro h1 { font-size: 34pt; }
  .studio-intro p { margin: 0; }
  .studio-layout { display: block; }
  .studio-preview { border: 0; }
  .preview-stage canvas { height: 98mm; }
  .print-details { display: block; color: #201d19; padding-top: 10px; }
  .print-details > p { font-size: .9rem; margin-bottom: 5px; }
}
.project-bar { justify-content: flex-start; flex-wrap: wrap; gap: 12px 20px; margin: 0 0 18px; }
.project-bar .new-project { min-height: 46px; padding: 10px 19px; background: #e6c690; border-color: #ba9656; color: #242017; }
.new-project > span { font-size: 1.35em; line-height: 1; }
.studio-size-rule { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.studio-size-rule[data-invalid] { color: var(--text); font-weight: 700; }
.project-bar label { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: .88rem; min-width: 0; }
.project-bar select { min-height: 38px; width: min(46vw, 240px); padding: 4px 8px; }
.system-switch { margin-block: 9px; }
.profile-option img, .profile-highlight img { display: block; background: white; }
.profile-highlight { border: 0; background: transparent; }
.profile-option { display: grid; grid-template-rows: 53px auto; align-items: start; padding: 0; background: transparent; border: 0; }
.profile-option:hover, .profile-option[aria-pressed="true"] { background: var(--surface-soft); }
.profile-option[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
.profile-option span { padding: 3px 1px 5px; }
.profile-highlight img[hidden] { display: none; }
.profile-highlight img { height: 135px; }
.profile-option img { height: 53px; }
.profile-drawing-pending { display: grid; place-items: center; padding: 5px; font-size: .74rem; min-height: 53px; color: var(--muted); }
.profile-highlight .profile-drawing-pending { min-height: 110px; background: var(--surface-soft); }
.material-swatch .swatch-sample.has-photo { background-image: var(--sample-image); background-position: center; background-size: cover; }
.clear-finish { margin-top: 10px; font-size: .84rem; }
.clear-finish:disabled { display: none; }
[data-gauge-label] { margin-top: 9px; }
[data-divide] { cursor: grab; }
[data-divide]:active { cursor: grabbing; }
[data-divide], [data-material] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[data-divide] { touch-action: none; }
[data-material] { touch-action: pan-y; }
@media (pointer: coarse) and (min-width: 700px) {
  .studio-segmented button, .door-tabs button, .button-compact, .frame-swatch, .studio-label select { min-height: 44px; }
}
