:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #eef2f5;
  color: #18212b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef2f5;
}

main {
  max-width: 1840px;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(300px, 560px) minmax(360px, 1fr);
  gap: 14px;
  align-items: start;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
}

.topbar p {
  color: #5f6e7d;
  margin-top: 4px;
}

.mode-tabs {
  display: flex;
  flex: 1 0 100%;
  gap: 6px;
  order: 3;
  margin-top: 8px;
  border-bottom: 1px solid #c8d2dc;
}

.mode-tab {
  width: auto;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #536576;
}

.mode-tab:hover {
  background: rgba(20, 108, 102, 0.08);
  color: #173f3c;
}

.mode-tab[aria-selected="true"] {
  border-color: #c8d2dc;
  border-bottom-color: #146c66;
  background: #ffffff;
  color: #132b39;
}

.mode-tab:focus-visible {
  outline: 3px solid rgba(20, 108, 102, 0.34);
  outline-offset: 2px;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #aebcc9;
  border-radius: 999px;
  background: #ffffff;
  color: #536576;
  font-size: 12px;
  font-weight: 800;
}

.mode-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  border-radius: 999px;
  background: #8797a6;
  box-shadow: inset 0 0 0 1px rgba(15, 31, 41, 0.2);
  transition: background 160ms ease;
}

.mode-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 160ms ease;
}

.mode-switch[aria-checked="true"] .mode-switch-track {
  background: #22978c;
}

.mode-switch[aria-checked="true"] .mode-switch-thumb {
  transform: translateX(16px);
}

.mode-switch[aria-checked="false"] .mode-switch-admin,
.mode-switch[aria-checked="true"] .mode-switch-customer {
  color: #173f3c;
}

.mode-switch[aria-checked="false"] .mode-switch-customer,
.mode-switch[aria-checked="true"] .mode-switch-admin {
  opacity: 0.58;
}

.case-design-tabs {
  display: flex;
  flex: 1 0 100%;
  gap: 8px;
  order: 4;
  padding-top: 8px;
}

.control-case-tabs {
  margin: 0 0 14px;
}

.case-design-tab {
  width: auto;
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid #aebcc9;
  border-radius: 999px;
  background: #f1f5f7;
  color: #405466;
}

.case-design-tab[aria-selected="true"] {
  border-color: #146c66;
  background: #146c66;
  color: #fff;
}

.rack-prototype-note {
  display: none;
  gap: 4px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #94b9b4;
  border-radius: 8px;
  background: #edf8f6;
  color: #264743;
  font-size: 13px;
}

body[data-case-design="shock-rack"] .rack-prototype-note {
  display: grid;
}

body[data-case-design="shock-rack"] .trunk-only-control {
  display: none !important;
}

.booth-only-control {
  display: none !important;
}

body[data-case-design="dj-booth"] .booth-only-control {
  display: grid !important;
}

body[data-case-design="dj-booth"] .trunk-only-control,
body[data-case-design="dj-booth"] #customerSceneCaseControls,
body[data-case-design="dj-booth"] .cad-lid-toggle,
body[data-case-design="dj-booth"] #cadLidMotionStatus,
body[data-case-design="dj-booth"] #tipOverReview {
  display: none !important;
}

body[data-cnc-panels="false"] #cncCutoutSection,
body[data-interior-structures="false"] #interiorInsertSection,
body[data-multi-case="false"] .cad-stack-test,
body[data-cad-assembly-targets="part"] #cadAssemblyLabel {
  display: none !important;
}

.missing-hardware {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #dfb15d;
  border-radius: 8px;
  background: #fff8e9;
  color: #4f4027;
  font-size: 13px;
  line-height: 1.45;
}

.missing-hardware ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.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;
}

.status-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status {
  border: 1px solid #b8c5d2;
  border-radius: 999px;
  background: #fff;
  min-height: 32px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.ok {
  border-color: #8fbea3;
  background: #eef8f1;
  color: #215f39;
}

.warn {
  border-color: #ddc266;
  background: #fff8dc;
  color: #6c4b00;
}

.workspace {
  display: block;
  grid-column: 1;
}

.controls,
.summary-panel,
.model-section,
.table-section {
  background: #fff;
  border: 1px solid #d4dde6;
  border-radius: 8px;
}

.controls {
  padding: 16px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-grid .full-span {
  grid-column: 1 / -1;
}

.control-note {
  display: block;
  margin-top: 6px;
  color: #68798a;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

label,
legend {
  color: #334353;
  display: block;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #acbac8;
  border-radius: 6px;
  margin-top: 7px;
  min-height: 40px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

.range-control {
  position: relative;
}

.range-control .range-readout {
  position: absolute;
  right: 0;
  top: 0;
  color: #142231;
  font-size: 13px;
  font-weight: 800;
}

.range-control input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  min-height: 40px;
  padding: 0;
  background: transparent;
}

.range-control input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid #9dacbb;
  border-radius: 999px;
  background: linear-gradient(90deg, #146c66, #218f86);
}

.range-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 999px;
  margin-top: -8px;
  background: #146c66;
  box-shadow: 0 1px 4px rgba(20, 34, 49, 0.28);
}

.range-control input[type="range"]::-moz-range-track {
  height: 8px;
  border: 1px solid #9dacbb;
  border-radius: 999px;
  background: linear-gradient(90deg, #146c66, #218f86);
}

.range-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #146c66;
  box-shadow: 0 1px 4px rgba(20, 34, 49, 0.28);
}

fieldset {
  border: 1px solid #d4dde6;
  border-radius: 8px;
  margin: 14px 0;
  padding: 10px 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.handle-option-fieldset {
  display: grid;
  gap: 10px;
}

.conditional-handle-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 10px;
  border: 1px solid #dce4ea;
  border-radius: 7px;
  background: #f7fafb;
}

.conditional-handle-controls[hidden] {
  display: none !important;
}

.conditional-handle-controls label {
  display: grid;
  gap: 6px;
}

button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: #146c66;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
}

button[type="button"] {
  width: auto;
  min-height: 34px;
  padding: 7px 10px;
}

.summary-panel {
  padding: 16px;
  margin-top: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
}

.metric-grid div {
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  min-height: 86px;
  padding: 12px;
  background: #f8fafb;
}

.metric-grid span {
  display: block;
  color: #5f6e7d;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-grid strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
  margin-top: 12px;
}

.notes {
  margin-top: 14px;
  color: #445464;
  font-size: 14px;
  line-height: 1.45;
}

.model-section,
.table-section {
  margin-top: 14px;
  overflow: hidden;
}

.model-section:not(.is-disabled-view) {
  grid-column: 2;
  grid-row: 2;
  margin-top: 0;
  position: sticky;
  top: 14px;
}

.table-section,
.model-section.is-disabled-view {
  grid-column: 1 / -1;
}

.model-host {
  height: 560px;
  min-height: 560px;
  background: #f4f7f9;
  position: relative;
}

.cad-host {
  height: 640px;
  min-height: 640px;
  background: #eef3f6;
  position: relative;
}

.tip-over-review {
  position: absolute;
  z-index: 28;
  top: 104px;
  right: 14px;
  display: grid;
  width: min(318px, calc(100% - 28px));
  padding: 12px;
  gap: 9px;
  border: 1px solid #b7c3cd;
  border-left: 5px solid #778797;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(14, 29, 43, 0.18);
  color: #142231;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.tip-over-review[data-level="low"] { border-left-color: #2e8b57; }
.tip-over-review[data-level="watch"] { border-left-color: #c58b00; }
.tip-over-review[data-level="high"] { border-left-color: #d56400; }
.tip-over-review[data-level="critical"] { border-left-color: #bd3030; }

.tip-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tip-review-head span {
  color: #667584;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.tip-review-head strong {
  color: #182838;
  font-size: 14px;
  text-align: right;
}

.tip-review-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.tip-review-metrics div {
  min-width: 0;
  padding: 7px;
  border: 1px solid #d9e1e8;
  border-radius: 5px;
  background: #f5f8fa;
}

.tip-review-metrics dt {
  color: #667584;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.tip-review-metrics dd {
  margin: 5px 0 0;
  color: #142231;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.tip-review-recommendation {
  margin: 0;
  color: #334353;
  font-size: 11px;
  line-height: 1.35;
}

.tip-review-assumptions {
  border-top: 1px solid #d9e1e8;
  padding-top: 8px;
}

.tip-review-assumptions summary {
  cursor: pointer;
  color: #334353;
  font-size: 11px;
  font-weight: 800;
}

.tip-review-assumptions label {
  margin-top: 10px;
  font-size: 11px;
}

.tip-review-assumptions .range-readout {
  font-size: 11px;
}

.tip-review-assumptions input[type="range"] {
  min-height: 28px;
  margin-top: 4px;
}

.tip-over-review small {
  color: #748391;
  font-size: 9px;
  line-height: 1.3;
}

body[data-app-mode="customer"] .tip-over-review {
  display: none;
  top: 86px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(5, 7, 8, 0.93);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  color: #ffffff;
}

body[data-app-mode="customer"] .tip-review-head span,
body[data-app-mode="customer"] .tip-review-metrics dt,
body[data-app-mode="customer"] .tip-over-review small {
  color: rgba(255, 255, 255, 0.58);
}

body[data-app-mode="customer"] .tip-review-head strong,
body[data-app-mode="customer"] .tip-review-metrics dd {
  color: #ffffff;
}

body[data-app-mode="customer"] .tip-review-metrics div {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
}

body[data-app-mode="customer"] .tip-review-recommendation,
body[data-app-mode="customer"] .tip-review-assumptions summary,
body[data-app-mode="customer"] .tip-review-assumptions label {
  color: rgba(255, 255, 255, 0.78);
}

body[data-app-mode="customer"] .tip-review-assumptions {
  border-color: rgba(255, 255, 255, 0.14);
}

@media (max-width: 700px) {
  .tip-over-review {
    top: 96px;
    right: 8px;
    width: min(276px, calc(100% - 16px));
    padding: 9px;
  }

  body[data-app-mode="customer"] .tip-over-review {
    top: 72px;
  }

  .tip-review-metrics {
    grid-template-columns: 1fr;
  }

  .tip-review-metrics div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 6px;
  }

  .tip-review-metrics dd {
    margin: 0;
    text-align: right;
  }
}

.cutout-host {
  min-height: 320px;
  padding: 16px;
  background: #f6f8fa;
}

.model-host canvas,
.model-host svg,
.cad-host canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.cad-host canvas {
  cursor: pointer;
}

.cad-host::after {
  content: "Drag to orbit. Scroll to zoom.";
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: #526271;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.cad-motion-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 16px;
  border-bottom: 1px solid #dce4eb;
  background: #f4f8fa;
}

.cad-lid-toggle {
  color: #20384d;
  font-weight: 800;
}

.cad-lid-motion-status {
  color: #52687a;
  font-size: 12px;
  font-weight: 750;
}

.cad-lid-motion-status.is-open {
  color: #0b765e;
}

.cad-stage-environment-status {
  color: #52687a;
  font-size: 12px;
  font-weight: 750;
}

.cad-camera-lock-status {
  color: #52687a;
  font-size: 12px;
  font-weight: 750;
}

.cad-camera-lock-status.is-editing {
  color: #86eadf;
}

body[data-app-mode="admin"] .customer-environment-control {
  display: none;
}

.cad-editor {
  border-top: 1px solid #dce4eb;
  padding: 12px 16px 16px;
}

.cad-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cad-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cad-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cad-view-actions .is-active {
  background: #20384d;
  color: #ffffff;
}

.cad-stack-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  background: #f4f8fa;
}

.cad-stack-toggle {
  color: #20384d;
  font-weight: 750;
}

.cad-stack-diagnostics {
  color: #52687a;
  font-size: 12px;
  font-weight: 700;
}

.cad-stack-diagnostics.is-pass {
  color: #0b765e;
}

.cad-stack-diagnostics.is-warn {
  color: #a04623;
}

.cad-instance-label {
  margin-top: 10px;
  max-width: 280px;
}

.cad-control-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(74px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.cad-control-grid input {
  min-height: 34px;
  padding: 7px 8px;
}

.cad-scan-report {
  margin: 12px 0 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #cfd9e2;
  border-radius: 6px;
  background: #0d141b;
  color: #d7f7ef;
  padding: 12px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.cad-scan-report:empty {
  display: none;
}

.muted-control {
  color: #8794a1;
}

.muted-control input {
  background: #eef2f5;
}

.ortho-drawing {
  background: #f7f9fb;
}

.panel {
  fill: #111820;
  stroke: #10151b;
  stroke-width: 1.5;
}

.case-outline {
  fill: none;
  stroke: #bfc7ce;
  stroke-width: 9;
}

.metal {
  fill: #c9d1d8;
  stroke: #697782;
  stroke-width: 1.2;
}

.dish {
  fill: #bfc8d0;
  stroke: #66737e;
  stroke-width: 1.2;
}

.label-dish {
  fill: #202832;
  stroke: #66737e;
  stroke-width: 1.2;
}

.recess {
  fill: #27313b;
  stroke: #88949e;
  stroke-width: 1;
}

.strap {
  fill: #9faab3;
  stroke: #5f6b75;
  stroke-width: 1;
}

.rivet,
.corner {
  fill: #d7dde2;
  stroke: #5c6872;
  stroke-width: 1;
}

.hole {
  fill: #f7f9fb;
  stroke: #87939d;
  stroke-width: 1;
}

.small-brace,
.large-brace {
  fill: #b9c3cb;
  stroke: #5f6e7a;
  stroke-width: 1.2;
}

.rail-line {
  stroke: #c8d0d6;
  stroke-width: 7;
  stroke-linecap: square;
}

.tongue-line {
  stroke: #d6dee4;
  stroke-width: 6;
}

.groove-line {
  stroke: #8f9ba5;
  stroke-width: 6;
}

.handle-line {
  stroke: #5b6872;
  stroke-width: 3;
  stroke-linecap: round;
}

.detail-line {
  stroke: #5b6872;
  stroke-width: 2;
  stroke-linecap: round;
}

.caster {
  fill: #245fa8;
  stroke: #15191f;
  stroke-width: 3;
}

.caster-lock {
  fill: #1b4f96;
  stroke: #15191f;
  stroke-width: 3;
}

.caster-hub {
  fill: #d5dde3;
  stroke: #596670;
  stroke-width: 1;
}

.brake {
  fill: #c8483d;
  stroke: #7f2c25;
  stroke-width: 1;
}

.cad-silhouette {
  fill: #d8dde2;
  stroke: #6d7884;
  stroke-width: 1.2;
}

.dimension-line {
  stroke: #5f6e7d;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.view-title,
.drawing-label,
.dimension-text,
.small-label,
.drawing-note {
  fill: #334353;
  font-family: Arial, Helvetica, sans-serif;
}

.view-title {
  font-size: 18px;
  font-weight: 700;
}

.dimension-text,
.small-label {
  font-size: 14px;
  font-weight: 700;
}

.drawing-note {
  font-size: 14px;
}

.highlighted-part {
  fill: #21b7a8 !important;
  stroke: #0b6e66 !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 6px rgba(33, 183, 168, 0.95)) drop-shadow(0 0 2px #0b6e66) saturate(1.45) !important;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #dce4eb;
}

.section-head span {
  color: #5f6e7d;
  font-size: 13px;
  font-weight: 700;
}

.section-head > div:first-child {
  display: grid;
  gap: 4px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #e4ebf1;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4c5d6e;
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

td:nth-child(3),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9) {
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
}

tbody tr.selected td {
  background: #e5f4f2;
}

.empty {
  color: #6c7b89;
  padding: 20px;
  text-align: center;
}

.missing {
  color: #7a4f00;
  font-weight: 700;
}

.cnc-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.cnc-panel-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cfd9e1;
  border-radius: 6px;
  background: #fff;
}

.cnc-panel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #dce4eb;
}

.cnc-panel-card-head > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.cnc-panel-card h3 {
  margin: 0;
  color: #1d2a35;
  font-size: 16px;
  letter-spacing: 0;
}

.cnc-panel-card-head span {
  color: #5f6e7d;
  font-size: 12px;
  font-weight: 700;
}

.cnc-panel-preview-host {
  height: 230px;
  padding: 14px;
  background: #172129;
}

.cnc-panel-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.cnc-panel-outline {
  fill: #313d47;
  stroke: #f2f5f7;
  stroke-width: 0.035;
  vector-effect: non-scaling-stroke;
}

.cnc-through-cut {
  fill: #172129;
  stroke: #ff6d62;
  stroke-width: 0.045;
  vector-effect: non-scaling-stroke;
}

.cnc-panel-details {
  display: grid;
  gap: 7px;
  padding: 12px;
  color: #4d5e6d;
  font-size: 12px;
  line-height: 1.45;
}

.cnc-panel-details strong {
  color: #24333f;
}

.cnc-panel-details span + span {
  padding-top: 7px;
  border-top: 1px solid #e4eaef;
}

.insert-actions select {
  min-width: 230px;
}

.interior-insert-host {
  display: grid;
  gap: 14px;
}

.insert-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #cfd9e1;
  border-radius: 6px;
  background: #cfd9e1;
}

.insert-summary-grid > div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  background: #fff;
}

.insert-summary-grid span,
.insert-panel-card span {
  color: #607080;
  font-size: 12px;
}

.insert-prototype-note {
  margin: 0;
  padding: 11px 12px;
  border-left: 3px solid #c6842f;
  background: #fff7e9;
  color: #4d5963;
  font-size: 13px;
}

.insert-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}

.insert-panel-card {
  overflow: hidden;
  border: 1px solid #cfd9e1;
  border-radius: 6px;
  background: #172129;
}

.insert-panel-card > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  padding: 10px;
  background: #fff;
}

.insert-panel-card > div strong,
.insert-panel-card > div span {
  min-width: 0;
}

.insert-panel-card > div button {
  grid-row: 1 / 3;
  grid-column: 2;
}

.insert-panel-preview {
  display: block;
  width: 100%;
  height: 150px;
  padding: 12px;
}

.insert-panel-outline {
  fill: #343f47;
  stroke: #f3f6f7;
  stroke-width: 0.04;
  vector-effect: non-scaling-stroke;
}

.insert-panel-opening {
  fill: #172129;
  stroke: #ff6d62;
  stroke-width: 0.04;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 720px) {
  .section-head,
  .cnc-panel-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
  }

  .section-actions button {
    flex: 1;
  }

  .cnc-panel-grid {
    grid-template-columns: 1fr;
  }

  .insert-actions select,
  .insert-actions button {
    width: 100%;
  }
}

/* Customer mode is presentation-only: the generator keeps every admin control
   mounted so its existing data and rendering behavior remain unchanged. */
body[data-app-mode="customer"] {
  color: #f3f5f6;
  background:
    radial-gradient(circle at 74% 18%, rgba(38, 116, 116, 0.18), transparent 32%),
    radial-gradient(circle at 12% 84%, rgba(190, 129, 49, 0.13), transparent 30%),
    #101416;
}

body[data-app-mode="customer"] main {
  max-width: 1920px;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 20px;
  padding: 22px 28px 30px;
}

body[data-app-mode="customer"] .topbar {
  margin-bottom: 2px;
}

body[data-app-mode="customer"] .topbar p {
  color: #9ba6ab;
}

body[data-app-mode="customer"] .status-stack {
  display: none;
}

body[data-app-mode="customer"] .mode-tabs {
  border-bottom-color: #354044;
}

body[data-app-mode="customer"] .mode-tab {
  color: #aab4b8;
}

body[data-app-mode="customer"] .mode-tab:hover {
  background: rgba(102, 211, 200, 0.09);
  color: #e7f7f4;
}

body[data-app-mode="customer"] .mode-tab[aria-selected="true"] {
  border-color: #354044;
  border-bottom-color: #67d0c5;
  background: #1b2225;
  color: #ffffff;
}

body[data-app-mode="customer"] .case-design-tab {
  border-color: #465459;
  background: #1b2225;
  color: #c6d0d3;
}

body[data-app-mode="customer"] .case-design-tab[aria-selected="true"] {
  border-color: #67d0c5;
  background: #245f5a;
  color: #fff;
}

body[data-app-mode="customer"] .rack-prototype-note {
  border-color: #405a58;
  background: #1b2929;
  color: #dce9e7;
}

body[data-app-mode="customer"] .workspace {
  align-self: stretch;
}

body[data-app-mode="customer"] .controls {
  height: 100%;
  padding: 26px 22px;
  border-color: #323d41;
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(33, 41, 44, 0.98), rgba(21, 27, 29, 0.98));
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
}

body[data-app-mode="customer"] .control-grid {
  grid-template-columns: 1fr;
  gap: 25px;
}

body[data-app-mode="customer"] .control-grid > label:not(.preset-control):not(.customer-dimension-control):not(.customer-config-control),
body[data-app-mode="customer"] .controls fieldset:not(.customer-config-control),
body[data-app-mode="customer"] .controls > button,
body[data-app-mode="customer"] .summary-panel,
body[data-app-mode="customer"] .table-section,
body[data-app-mode="customer"] .model-section.is-disabled-view {
  display: none !important;
}

body[data-app-mode="customer"] .preset-control,
body[data-app-mode="customer"] .customer-dimension-control,
body[data-app-mode="customer"] .customer-config-control {
  color: #dce3e5;
  font-size: 14px;
  letter-spacing: 0.01em;
}

body[data-app-mode="customer"] .handle-option-fieldset {
  border-color: #536166;
  background: rgba(37, 45, 48, 0.82);
}

body[data-app-mode="customer"] .conditional-handle-controls {
  grid-template-columns: 1fr;
  border-color: #536166;
  background: #252d30;
}

body[data-app-mode="customer"] .preset-control select {
  min-height: 50px;
  border-color: #536166;
  background: #252d30;
  color: #ffffff;
}

body[data-app-mode="customer"] .control-note {
  margin-top: 9px;
  color: #96a3a7;
  font-size: 12px;
}

body[data-app-mode="customer"] .range-control .range-readout {
  color: #8ee2d9;
  font-size: 14px;
}

body[data-app-mode="customer"] .range-control input[type="range"]::-webkit-slider-runnable-track {
  border-color: #566267;
  background: linear-gradient(90deg, #338b82, #72d7cc);
}

body[data-app-mode="customer"] .range-control input[type="range"]::-webkit-slider-thumb {
  border-color: #1b2225;
  background: #eefcf9;
  box-shadow: 0 0 0 2px #67d0c5, 0 3px 12px rgba(0, 0, 0, 0.5);
}

body[data-app-mode="customer"] .range-control input[type="range"]::-moz-range-track {
  border-color: #566267;
  background: linear-gradient(90deg, #338b82, #72d7cc);
}

body[data-app-mode="customer"] .range-control input[type="range"]::-moz-range-thumb {
  border-color: #1b2225;
  background: #eefcf9;
  box-shadow: 0 0 0 2px #67d0c5, 0 3px 12px rgba(0, 0, 0, 0.5);
}

body[data-app-mode="customer"] #cadPreviewSection {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  top: auto;
  margin: 0;
  border-color: #323d41;
  border-radius: 12px;
  background: #171d1f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

body[data-app-mode="customer"] #cadPreviewSection > .section-head,
body[data-app-mode="customer"] #cadPreviewSection > .cad-editor {
  display: none;
}

body[data-app-mode="customer"] .cad-host {
  height: clamp(560px, calc(100vh - 174px), 900px);
  min-height: 560px;
  background: radial-gradient(circle at 50% 42%, #2a3437, #151a1c 72%);
}

body[data-app-mode="customer"] .cad-host::after {
  color: #abb8bc;
  text-shadow: 0 1px 2px #000000;
}

body[data-app-mode="customer"] .cad-host[data-stage-interaction="case"]::after {
  content: "Drag to rotate the case. Stage and camera stay fixed.";
}

body[data-app-mode="customer"] .cad-host[data-stage-interaction="camera-position"]::after {
  content: "Position camera: drag to orbit, right-drag to pan, and scroll to zoom. Save & lock when ready.";
}

body[data-app-mode="customer"] .cad-host[data-stage-interaction="locked"]::after {
  content: "Camera locked. Use Position camera to change this view.";
}

body[data-app-mode="customer"] .cad-motion-actions {
  border-color: #323d41;
  background: #1d2528;
}

body[data-app-mode="customer"] .cad-stage-environment-status,
body[data-app-mode="customer"] .cad-camera-lock-status,
body[data-app-mode="customer"] .customer-environment-control {
  color: #dce8e8;
}

body[data-app-mode="customer"] .cad-motion-actions button {
  border-color: #58666a;
  background: #2b373a;
  color: #eef8f7;
}

@media (max-width: 900px) {
  body[data-app-mode="customer"] main {
    display: block;
    padding: 18px;
  }

  body[data-app-mode="customer"] .topbar {
    display: flex;
  }

  body[data-app-mode="customer"] .workspace {
    margin-top: 16px;
  }

  body[data-app-mode="customer"] .controls {
    height: auto;
  }

  body[data-app-mode="customer"] #cadPreviewSection {
    margin-top: 18px;
  }

  body[data-app-mode="customer"] .cad-host {
    height: min(72vh, 720px);
    min-height: 520px;
  }
}

/* Customer presentation deck: the upper 2/3 is an unobstructed case view and
   every interactive control stays inside the independently scrolling lower 1/3. */
body[data-app-mode="customer"] {
  --customer-view-height: 66.6667dvh;
  --customer-deck-height: 33.3333dvh;
  --customer-nav-width: clamp(250px, 24vw, 320px);
  --customer-glass: rgba(13, 19, 21, 0.03);
}

body[data-app-mode="customer"] #cadPreviewSection {
  inset: 0 0 auto;
  width: 100vw;
  height: var(--customer-view-height);
  border-bottom: 1px solid rgba(216, 235, 235, 0.2);
}

body[data-app-mode="customer"] .cad-host {
  width: 100vw;
  height: var(--customer-view-height);
}

body[data-app-mode="customer"] .topbar {
  top: var(--customer-view-height);
  bottom: 0;
  left: 0;
  width: var(--customer-nav-width);
  max-height: none;
  padding: 12px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: flex-start;
  gap: 8px;
  border-width: 0 1px 0 0;
  border-radius: 0;
  background: var(--customer-glass);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

body[data-app-mode="customer"] .topbar h1 {
  font-size: 20px;
}

body[data-app-mode="customer"] .brand-block {
  flex: 1 1 100%;
}

body[data-app-mode="customer"] .mode-tabs,
body[data-app-mode="customer"] .case-design-tabs {
  flex: 1 1 100%;
  margin: 0;
  padding-top: 2px;
}

body[data-app-mode="customer"] .mode-tab,
body[data-app-mode="customer"] .case-design-tab {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

body[data-app-mode="customer"] .cad-motion-actions {
  top: var(--customer-view-height);
  right: 0;
  left: var(--customer-nav-width);
  bottom: auto;
  width: auto;
  max-width: none;
  min-height: 60px;
  margin: 0;
  padding: 8px 12px;
  justify-content: flex-start;
  align-content: center;
  gap: 8px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  border-width: 0 0 1px;
  border-radius: 0;
  background: var(--customer-glass);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

body[data-app-mode="customer"] .workspace {
  top: calc(var(--customer-view-height) + 60px);
  right: 0;
  bottom: 0;
  left: var(--customer-nav-width);
  width: auto;
  max-width: none;
  height: calc(var(--customer-deck-height) - 60px);
  overflow: hidden;
  pointer-events: none;
}

body[data-app-mode="customer"] .controls {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 10px 12px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: auto;
  border: 0;
  border-radius: 0;
  background: var(--customer-glass);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

body[data-app-mode="customer"] .controls::-webkit-scrollbar {
  width: auto;
  height: 8px;
}

body[data-app-mode="customer"] .control-grid {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 12px;
  width: max-content;
  height: 100%;
}

body[data-app-mode="customer"] .control-grid > label,
body[data-app-mode="customer"] .handle-option-fieldset,
body[data-app-mode="customer"] .rack-prototype-note {
  flex: 0 0 220px;
  min-width: 220px;
  height: 100%;
  margin: 0;
  padding: 9px 11px;
  overflow-y: auto;
  border: 1px solid rgba(216, 235, 235, 0.18);
  border-radius: 10px;
  background: rgba(13, 19, 21, 0.03);
}

body[data-app-mode="customer"] .control-grid > .preset-control {
  flex-basis: 280px;
  min-width: 280px;
}

body[data-app-mode="customer"] .range-control input,
body[data-app-mode="customer"] .preset-control select,
body[data-app-mode="customer"] .customer-config-control select {
  min-height: 34px;
  margin-top: 5px;
}

body[data-app-mode="customer"] .control-note {
  margin-top: 5px;
  line-height: 1.2;
}

body[data-app-mode="customer"] .handle-option-fieldset {
  flex-basis: 280px;
  min-width: 280px;
}

body[data-app-mode="customer"] .conditional-handle-controls {
  grid-template-columns: 1fr 1fr;
  padding: 7px;
  background: rgba(13, 19, 21, 0.03);
}

body[data-app-mode="customer"] .rack-prototype-note {
  flex-basis: 260px;
  min-width: 260px;
}

body[data-app-mode="customer"] .cad-motion-actions button,
body[data-app-mode="customer"] .preset-control select,
body[data-app-mode="customer"] .customer-config-control select {
  background-color: rgba(20, 28, 30, 0.08);
}

@media (max-width: 760px) {
  body[data-app-mode="customer"] {
    --customer-nav-width: 220px;
  }

  body[data-app-mode="customer"] .topbar {
    padding: 9px 10px;
  }

  body[data-app-mode="customer"] .topbar h1 {
    font-size: 17px;
  }

  body[data-app-mode="customer"] .topbar p {
    font-size: 11px;
  }

  body[data-app-mode="customer"] .mode-tab,
  body[data-app-mode="customer"] .case-design-tab {
    padding: 5px 7px;
    font-size: 11px;
  }
}

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

@media (max-width: 660px) {
  main {
    display: block;
  }

  .workspace,
  .topbar {
    display: block;
  }

  .status-stack {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .summary-panel,
  .model-section:not(.is-disabled-view),
  .table-section {
    margin-top: 14px;
  }

  .model-section:not(.is-disabled-view) {
    position: static;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 560px) {
  main {
    padding: 14px;
  }

  .control-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}

/* Fixed customer compositor: the stage/case canvas is the viewport while the
   controls and navigation float above it as independently scrolling glass. */
body[data-app-mode="customer"] {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-app-mode="customer"] main {
  position: relative;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body[data-app-mode="customer"] .topbar {
  position: fixed;
  z-index: 40;
  top: 18px;
  left: 22px;
  display: flex;
  width: min(410px, calc(100vw - 44px));
  max-height: 168px;
  margin: 0;
  padding: 14px 16px 12px;
  overflow: hidden;
  border: 1px solid rgba(216, 235, 235, 0.22);
  border-radius: 16px;
  background: rgba(13, 19, 21, 0.15);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px) saturate(1.18);
  backdrop-filter: blur(16px) saturate(1.18);
}

body[data-app-mode="customer"] .topbar h1 {
  font-size: 23px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
}

body[data-app-mode="customer"] .mode-tabs {
  margin-top: 2px;
}

body[data-app-mode="customer"] .case-design-tabs {
  padding-top: 3px;
}

body[data-app-mode="customer"] .workspace {
  position: fixed;
  z-index: 35;
  top: 202px;
  bottom: 20px;
  left: 22px;
  display: block;
  width: min(370px, calc(100vw - 44px));
  height: auto;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

body[data-app-mode="customer"] .controls {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 20px 18px 26px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  pointer-events: auto;
  border: 1px solid rgba(216, 235, 235, 0.24);
  border-radius: 16px;
  background: rgba(13, 19, 21, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

body[data-app-mode="customer"] .controls::-webkit-scrollbar {
  width: 8px;
}

body[data-app-mode="customer"] .controls::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(127, 220, 211, 0.52);
}

body[data-app-mode="customer"] .control-grid {
  grid-template-columns: 1fr;
  gap: 20px;
}

body[data-app-mode="customer"] .preset-control select,
body[data-app-mode="customer"] .customer-config-control select,
body[data-app-mode="customer"] .conditional-handle-controls {
  border-color: rgba(214, 235, 233, 0.27);
  background: rgba(20, 28, 30, 0.35);
}

body[data-app-mode="customer"] #cadPreviewSection {
  position: fixed;
  z-index: 1;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #111719;
  box-shadow: none;
}

body[data-app-mode="customer"] .cad-host {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  border-radius: 0;
}

body[data-app-mode="customer"] .cad-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.trunk-ar-button {
  position: absolute;
  z-index: 18;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  min-width: 122px;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.84);
  color: #ffffff;
  font: 800 15px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.trunk-ar-button:disabled {
  color: #a0a0a0;
  cursor: wait;
}

body:not([data-app-mode="customer"]) .trunk-ar-button,
body:not([data-case-design="trunk"]) .trunk-ar-button {
  display: none !important;
}

@media (max-width: 600px) {
  .trunk-ar-button {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    min-width: 112px;
    min-height: 52px;
    padding: 0 14px;
    font-size: 14px;
  }
}

body[data-app-mode="customer"] .cad-motion-actions {
  position: fixed;
  z-index: 38;
  top: 18px;
  right: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100vw - 474px);
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid rgba(216, 235, 235, 0.22);
  border-radius: 14px;
  background: rgba(13, 19, 21, 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.26);
  -webkit-backdrop-filter: blur(16px) saturate(1.18);
  backdrop-filter: blur(16px) saturate(1.18);
}

body[data-app-mode="customer"] .cad-lid-toggle,
body[data-app-mode="customer"] .cad-lid-motion-status,
body[data-app-mode="customer"] .cad-stage-environment-status,
body[data-app-mode="customer"] .cad-camera-lock-status,
body[data-app-mode="customer"] .customer-environment-control {
  color: #f0f8f8;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.72);
}

body[data-app-mode="customer"] .cad-lid-motion-status.is-open {
  color: #8af0e4;
}

@media (max-width: 900px) {
  body[data-app-mode="customer"] .topbar {
    top: 10px;
    left: 12px;
    width: calc(100vw - 24px);
    max-height: 154px;
  }

  body[data-app-mode="customer"] .workspace {
    top: 176px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-width: 350px;
  }

  body[data-app-mode="customer"] .controls {
    height: 100%;
  }

  body[data-app-mode="customer"] .cad-motion-actions {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: auto;
    max-width: calc(100vw - 388px);
    flex-wrap: wrap;
  }
}

/* Compact customer compositor. The case keeps the upper two-thirds of the
   viewport. Every customer option lives in one full-width bottom deck with
   vertical scrolling only; no control is parked beyond a horizontal edge. */
body[data-app-mode="customer"] {
  --customer-view-height: 66.6667dvh;
  --customer-motion-height: 64px;
  overflow-x: hidden;
}

body[data-app-mode="customer"] main {
  overflow-x: hidden;
}

body[data-app-mode="customer"] #cadPreviewSection {
  inset: 0 0 auto;
  width: 100vw;
  max-width: 100vw;
  height: var(--customer-view-height);
  border-bottom: 1px solid rgba(216, 235, 235, 0.2);
}

body[data-app-mode="customer"] .cad-host {
  width: 100vw;
  max-width: 100vw;
  height: var(--customer-view-height);
  min-height: 0;
}

body[data-app-mode="customer"] .topbar {
  z-index: 60;
  top: 14px;
  right: 16px;
  bottom: auto;
  left: auto;
  display: block;
  width: auto;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body[data-app-mode="customer"] .brand-block,
body[data-app-mode="customer"] .status-stack {
  display: none;
}

body[data-app-mode="customer"] .mode-switch {
  min-height: 34px;
  padding: 5px 9px;
  border-color: rgba(216, 235, 235, 0.3);
  background: rgba(13, 19, 21, 0.2);
  color: #dce8e8;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}

body[data-app-mode="customer"] .mode-switch[aria-checked="false"] .mode-switch-admin,
body[data-app-mode="customer"] .mode-switch[aria-checked="true"] .mode-switch-customer {
  color: #ffffff;
}

body[data-app-mode="customer"] .cad-motion-actions {
  z-index: 45;
  top: var(--customer-view-height);
  right: 0;
  bottom: auto;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: var(--customer-motion-height);
  min-height: 0;
  margin: 0;
  padding: 7px 14px;
  justify-content: flex-start;
  align-content: center;
  gap: 6px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  white-space: normal;
  border-width: 0 0 1px;
  border-radius: 0;
  background: var(--customer-glass);
  box-shadow: none;
}

body[data-app-mode="customer"] .cad-motion-actions button,
body[data-app-mode="customer"] .cad-motion-actions .check-row {
  min-height: 32px;
  margin: 0;
  padding-top: 5px;
  padding-bottom: 5px;
}

body[data-app-mode="customer"] .workspace {
  z-index: 40;
  top: calc(var(--customer-view-height) + var(--customer-motion-height));
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: auto;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

body[data-app-mode="customer"] .controls {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 0 14px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  pointer-events: auto;
  border: 0;
  border-radius: 0;
  background: var(--customer-glass);
  box-shadow: none;
}

body[data-app-mode="customer"] .control-case-tabs {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 0 0 10px;
  padding: 9px 0 8px;
  gap: 8px;
  border-bottom: 1px solid rgba(216, 235, 235, 0.17);
  background: rgba(13, 19, 21, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(1.14);
  backdrop-filter: blur(16px) saturate(1.14);
}

body[data-app-mode="customer"] .control-case-tabs .case-design-tab {
  flex: 0 1 auto;
  min-height: 32px;
  padding: 5px 14px;
  font-size: 12px;
}

body[data-app-mode="customer"] .control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: auto;
}

body[data-app-mode="customer"] .control-grid > label,
body[data-app-mode="customer"] .handle-option-fieldset,
body[data-app-mode="customer"] .rack-prototype-note {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 88px;
  margin: 0;
  padding: 9px 11px;
  overflow: visible;
  border: 1px solid rgba(216, 235, 235, 0.18);
  border-radius: 10px;
  background: rgba(13, 19, 21, 0.03);
}

body[data-app-mode="customer"] .control-grid > .preset-control {
  grid-column: span 2;
  min-width: 0;
}

body[data-app-mode="customer"] .handle-option-fieldset {
  width: 100%;
  min-width: 0;
  margin-top: 10px;
}

body[data-app-mode="customer"] .preset-control select,
body[data-app-mode="customer"] .customer-config-control select,
body[data-app-mode="customer"] .conditional-handle-controls {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background-color: rgba(20, 28, 30, 0.2);
}

@media (max-width: 900px) {
  body[data-app-mode="customer"] {
    --customer-motion-height: 78px;
  }

  body[data-app-mode="customer"] .topbar {
    top: 10px;
    right: 10px;
    left: auto;
    width: auto;
  }

  body[data-app-mode="customer"] .workspace {
    top: calc(var(--customer-view-height) + var(--customer-motion-height));
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
  }

  body[data-app-mode="customer"] .cad-motion-actions {
    top: var(--customer-view-height);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100vw;
    max-width: 100vw;
  }

  body[data-app-mode="customer"] .control-grid > .preset-control {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  body[data-app-mode="customer"] .mode-switch-admin,
  body[data-app-mode="customer"] .mode-switch-customer {
    display: none;
  }

  body[data-app-mode="customer"] .controls {
    padding-right: 10px;
    padding-left: 10px;
  }
}

/* Click-to-customize customer controls. Admin keeps the complete generator;
   Customer Mode shows only the controls belonging to the selected 3D part. */
.customer-context-panel {
  display: none;
}

body[data-app-mode="customer"] .workspace {
  top: auto;
  right: auto;
  bottom: 14px;
  left: 50%;
  width: min(820px, calc(100vw - 28px));
  height: auto;
  max-height: calc(33.3333dvh - 76px);
  transform: translateX(-50%);
  overflow: visible;
}

body[data-app-mode="customer"] .controls {
  width: 100%;
  height: auto;
  max-height: calc(33.3333dvh - 76px);
  padding: 10px 12px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(216, 235, 235, 0.22);
  border-radius: 16px;
  background: var(--customer-glass);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

body[data-app-mode="customer"] .control-case-tabs {
  position: static;
  display: flex;
  width: auto;
  margin: 0 0 7px;
  padding: 0;
  gap: 6px;
  border: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body[data-app-mode="customer"] .customer-context-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(216, 235, 235, 0.18);
  border-radius: 12px;
  background: rgba(13, 19, 21, 0.03);
}

body[data-app-mode="customer"] .customer-context-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body[data-app-mode="customer"] .customer-context-copy strong {
  color: #ffffff;
  font-size: 14px;
}

body[data-app-mode="customer"] .customer-context-copy span {
  overflow: hidden;
  color: #c1cdcf;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-app-mode="customer"] #customerContextClose {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 12px;
  border-color: rgba(142, 226, 217, 0.55);
  background: rgba(36, 95, 90, 0.48);
  color: #ffffff;
}

.trunk-panel-graphic-editor {
  display: none;
}

body[data-app-mode="customer"] .trunk-panel-graphic-editor {
  width: 100%;
  min-width: 0;
  margin: 8px 0 0;
  padding: 9px 10px 10px;
  gap: 8px;
  border: 1px solid rgba(216, 235, 235, 0.18);
  border-radius: 10px;
  background: rgba(13, 19, 21, 0.12);
}

body[data-app-mode="customer"] .trunk-panel-graphic-editor[hidden],
body[data-app-mode="customer"] .trunk-panel-graphic-transform[hidden],
body[data-app-mode="customer"] #trunkPanelGraphicRemove[hidden] {
  display: none !important;
}

body[data-app-mode="customer"] .trunk-panel-graphic-editor legend {
  padding: 0 5px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-app-mode="customer"] .trunk-panel-graphic-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

body[data-app-mode="customer"] .trunk-panel-graphic-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(142, 226, 217, 0.55);
  background: rgba(36, 95, 90, 0.48);
  color: #ffffff;
}

body[data-app-mode="customer"] .trunk-panel-graphic-actions button:disabled {
  opacity: 0.45;
}

body[data-app-mode="customer"] .trunk-panel-graphic-transform {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

body[data-app-mode="customer"] .trunk-panel-graphic-transform > label {
  min-width: 0;
  min-height: 0;
  padding: 6px 8px;
  border: 1px solid rgba(216, 235, 235, 0.15);
  border-radius: 8px;
  background: rgba(13, 19, 21, 0.12);
}

body[data-app-mode="customer"] .trunk-panel-graphic-status {
  color: rgba(230, 239, 246, 0.78);
  font-size: 11px;
  line-height: 1.3;
}

body[data-app-mode="customer"] .trunk-panel-graphic-status.is-error {
  color: #ffb4aa;
}

@media (max-width: 620px) {
  body[data-app-mode="customer"] .trunk-panel-graphic-transform {
    grid-template-columns: 1fr;
  }
}

body[data-app-mode="customer"] #generatorForm .control-grid > [data-customer-control],
body[data-app-mode="customer"] #generatorForm > [data-customer-control] {
  display: none !important;
}

body[data-app-mode="customer"][data-customer-context="none"] .control-grid {
  display: none !important;
}

body[data-app-mode="customer"][data-customer-context="size"] #generatorForm [data-customer-control~="size"],
body[data-app-mode="customer"][data-customer-context="side-handles"] #generatorForm [data-customer-control~="side-handles"],
body[data-app-mode="customer"][data-customer-context="front-handles"] #generatorForm [data-customer-control~="front-handles"],
body[data-app-mode="customer"][data-customer-context="nameplate"] #generatorForm [data-customer-control~="nameplate"],
body[data-app-mode="customer"][data-customer-context="corners"] #generatorForm [data-customer-control~="corners"],
body[data-app-mode="customer"][data-customer-context="braces"] #generatorForm [data-customer-control~="braces"],
body[data-app-mode="customer"][data-customer-context="lid"] #generatorForm [data-customer-control~="lid"],
body[data-app-mode="customer"][data-customer-context="interior"] #generatorForm [data-customer-control~="interior"],
body[data-app-mode="customer"][data-customer-context="stacking-dishes"] #generatorForm [data-customer-control~="stacking-dishes"],
body[data-app-mode="customer"][data-customer-context="casters"] #generatorForm [data-customer-control~="casters"],
body[data-app-mode="customer"][data-customer-context="scene-cases"] #generatorForm [data-customer-control~="scene-cases"] {
  display: grid !important;
}

body[data-app-mode="customer"] #generatorForm #trunkPanelGraphicEditor[hidden] {
  display: none !important;
}

body[data-app-mode="customer"] .control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

body[data-app-mode="customer"] .control-grid > label,
body[data-app-mode="customer"] .handle-option-fieldset {
  min-height: 0;
  padding: 8px 10px;
}

body[data-app-mode="customer"][data-customer-context="size"] .control-grid > .preset-control {
  grid-column: 1 / -1;
}

body[data-app-mode="customer"] .handle-option-fieldset {
  margin-top: 8px;
}

body[data-app-mode="customer"] .cad-host[data-stage-interaction="case"]::after {
  content: "Click a case part to customize it. Drag to rotate the case.";
}

@media (max-width: 700px) {
  body[data-app-mode="customer"] .workspace,
  body[data-app-mode="customer"] .controls {
    max-height: calc(33.3333dvh - 88px);
  }

  body[data-app-mode="customer"] .workspace {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    transform: none;
  }

  body[data-app-mode="customer"] .control-grid {
    grid-template-columns: 1fr;
  }

  body[data-app-mode="customer"] .customer-context-copy span {
    white-space: normal;
  }
}

/* Landscape touch navigation: the stage remains fixed while the customer uses
   game-style controls to walk the camera and change its viewing direction. */
.mobile-stage-controls {
  display: none;
}

@media (orientation: landscape) and (max-width: 1400px) and (max-height: 900px) {
  body[data-app-mode="customer"] {
    --mobile-landscape-stick-size: clamp(132px, 28vmin, 180px);
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"][data-mobile-stage-controls="true"] .mobile-stage-controls {
    position: fixed;
    z-index: 84;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .mobile-stage-stick {
    --mobile-stick-size: var(--mobile-landscape-stick-size);
    position: fixed;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
    width: var(--mobile-stick-size);
    height: var(--mobile-stick-size);
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .mobile-stage-stick-move {
    left: max(18px, calc(env(safe-area-inset-left) + 10px));
  }

  .mobile-stage-stick-look {
    right: max(18px, calc(env(safe-area-inset-right) + 10px));
  }

  .mobile-stage-stick-pad[type="button"] {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    aspect-ratio: 1;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: visible;
    touch-action: none;
    border: 2px solid rgba(255, 255, 255, 0.62);
    border-radius: 50%;
    background:
      radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.13) 0 46%, rgba(255, 255, 255, 0.035) 72%),
      rgba(255, 255, 255, 0.035);
    box-shadow:
      inset 0 0 0 9px rgba(255, 255, 255, 0.055),
      0 10px 26px rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(10px) saturate(1.08);
    backdrop-filter: blur(10px) saturate(1.08);
  }

  .mobile-stage-stick-pad[type="button"]:focus-visible,
  .mobile-stage-stick-pad[type="button"][aria-pressed="true"] {
    border-color: rgba(255, 255, 255, 0.94);
    box-shadow:
      inset 0 0 0 9px rgba(255, 255, 255, 0.12),
      0 0 0 3px rgba(255, 255, 255, 0.22),
      0 10px 26px rgba(0, 0, 0, 0.4);
  }

  .mobile-stage-stick-cross,
  .mobile-stage-stick-cross::before,
  .mobile-stage-stick-cross::after {
    position: absolute;
    inset: 50% auto auto 50%;
    display: block;
    width: 62%;
    height: 1px;
    content: "";
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.22);
    pointer-events: none;
  }

  .mobile-stage-stick-cross::before {
    width: 1px;
    height: 62%;
  }

  .mobile-stage-stick-cross::after {
    width: 8px;
    height: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: transparent;
  }

  .mobile-stage-stick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 45%;
    height: 45%;
    margin: -22.5% 0 0 -22.5%;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.42) 56%, rgba(255, 255, 255, 0.2) 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42), inset 0 1px 3px rgba(255, 255, 255, 0.62);
    transform: translate3d(0, 0, 0);
    transition: transform 70ms ease-out;
    pointer-events: none;
    will-change: transform;
  }

  .mobile-stage-stick-pad[type="button"][aria-pressed="true"] .mobile-stage-stick-knob {
    transition: none;
  }

  .mobile-stage-stick-label {
    position: absolute;
    top: -20px;
    left: 50%;
    padding: 3px 8px;
    transform: translateX(-50%);
    border: 1px solid rgba(189, 214, 242, 0.34);
    border-radius: 999px;
    background: rgba(8, 15, 21, 0.62);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 1px 3px #000000;
    pointer-events: none;
  }
}

/* Customer multi-case staging. Added cases are display-only scene instances;
   this compact tool opens the same contextual tray used by other case parts. */
.customer-scene-case-controls {
  display: none;
}

.customer-scene-cases-button {
  display: none;
}

body[data-app-mode="customer"] #customerSceneCasesButton {
  position: fixed;
  z-index: 70;
  top: max(66px, calc(env(safe-area-inset-top) + 62px));
  left: max(10px, env(safe-area-inset-left));
  display: grid !important;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 9px;
  border: 1px solid rgba(208, 225, 244, 0.52);
  border-radius: 50%;
  background: rgba(12, 19, 24, 0.66);
  color: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
}

body[data-app-mode="customer"] #customerSceneCasesButton svg {
  display: block;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-app-mode="customer"] #customerSceneCasesButton:hover,
body[data-app-mode="customer"] #customerSceneCasesButton:focus-visible,
body[data-app-mode="customer"][data-customer-context="scene-cases"] #customerSceneCasesButton {
  border-color: #9bc5ff;
  background: var(--customer-blue);
  box-shadow: 0 0 0 3px var(--customer-blue-soft), 0 8px 26px rgba(0, 0, 0, 0.34);
}

body[data-app-mode="customer"][data-customer-preview="rack"] #customerSceneCasesButton {
  display: none !important;
}

body[data-app-mode="customer"] .customer-scene-case-controls {
  width: 100%;
  min-width: 0;
  gap: 8px;
}

body[data-app-mode="customer"] .customer-scene-case-actions {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) auto minmax(180px, 1fr) auto;
  align-items: end;
  gap: 7px;
}

body[data-app-mode="customer"] .customer-scene-case-actions label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

body[data-app-mode="customer"] .customer-scene-case-actions select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

body[data-app-mode="customer"] .customer-scene-case-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(118, 175, 255, 0.58);
  background: rgba(23, 105, 210, 0.74);
}

body[data-app-mode="customer"] .customer-scene-case-actions button:disabled {
  opacity: 0.45;
}

body[data-app-mode="customer"] .customer-scene-case-move-heading {
  margin: 1px 0 -2px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-app-mode="customer"] .customer-scene-case-range-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

body[data-app-mode="customer"] .customer-scene-case-range-grid > label {
  min-width: 0;
  min-height: 0;
  padding: 6px 8px;
  border: 1px solid rgba(216, 235, 235, 0.18);
  border-radius: 10px;
  background: rgba(13, 19, 21, 0.12);
}

body[data-app-mode="customer"] .customer-scene-case-status {
  color: rgba(230, 239, 246, 0.78);
  font-size: 11px;
  line-height: 1.3;
}

@media (orientation: landscape) and (max-width: 1400px) and (max-height: 900px) {
  body[data-app-mode="customer"] .customer-scene-case-actions {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  }

  body[data-app-mode="customer"] .customer-scene-case-preset-label {
    grid-row: 1;
    grid-column: 1;
  }

  body[data-app-mode="customer"] #customerSceneCaseAdd {
    grid-row: 1;
    grid-column: 2;
  }

  body[data-app-mode="customer"] .customer-scene-case-selected-label {
    grid-row: 2;
    grid-column: 1;
  }

  body[data-app-mode="customer"] #customerSceneCaseRemove {
    grid-row: 2;
    grid-column: 2;
  }

  body[data-app-mode="customer"] .customer-scene-case-actions button {
    width: 100%;
  }

  body[data-app-mode="customer"] .customer-scene-case-range-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr));
  }

  body[data-app-mode="customer"] .customer-scene-case-status {
    display: none;
  }

  body[data-app-mode="customer"] .customer-scene-case-move-heading {
    margin-top: 0;
    font-size: 10px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  body[data-app-mode="customer"] {
    --mobile-landscape-stick-size: clamp(126px, 34dvh, 154px);
  }

  .mobile-stage-stick {
    --mobile-stick-size: var(--mobile-landscape-stick-size);
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 7px));
  }

  .mobile-stage-stick-move {
    left: max(12px, calc(env(safe-area-inset-left) + 7px));
  }

  .mobile-stage-stick-look {
    right: max(12px, calc(env(safe-area-inset-right) + 7px));
  }
}

/* Phone customer layout: preserve the requested 2/3 model and 1/3 controls
   split, but float the motion toolbar over unused stage floor instead of
   subtracting it from the already-small control deck. */
@media (max-width: 700px) {
  body[data-app-mode="customer"] {
    --customer-view-height: 72dvh;
    --customer-sheet-height: 28dvh;
  }

  body[data-app-mode="customer"] .customer-scene-case-actions {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  }

  body[data-app-mode="customer"] .customer-scene-case-preset-label {
    grid-row: 1;
    grid-column: 1;
  }

  body[data-app-mode="customer"] #customerSceneCaseAdd {
    grid-row: 1;
    grid-column: 2;
  }

  body[data-app-mode="customer"] .customer-scene-case-selected-label {
    grid-row: 2;
    grid-column: 1;
  }

  body[data-app-mode="customer"] #customerSceneCaseRemove {
    grid-row: 2;
    grid-column: 2;
  }

  body[data-app-mode="customer"] .customer-scene-case-range-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-app-mode="customer"] #cadPreviewSection,
  body[data-app-mode="customer"] .cad-host {
    height: var(--customer-view-height);
  }

  body[data-app-mode="customer"] .cad-motion-actions {
    top: auto;
    right: 8px;
    bottom: calc(var(--customer-sheet-height) + 8px);
    left: 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: 82px;
    padding: 6px 8px;
    gap: 4px 8px;
    overflow: hidden;
    border: 1px solid rgba(216, 235, 235, 0.2);
    border-radius: 12px;
    background: rgba(13, 19, 21, 0.2);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
    backdrop-filter: blur(14px) saturate(1.12);
  }

  body[data-app-mode="customer"] .cad-motion-actions button,
  body[data-app-mode="customer"] .cad-motion-actions .check-row {
    justify-content: center;
    min-width: 0;
    min-height: 34px;
    padding: 5px 7px;
    font-size: 12px;
    line-height: 1.15;
  }

  body[data-app-mode="customer"] .cad-lid-motion-status,
  body[data-app-mode="customer"] .cad-camera-lock-status,
  body[data-app-mode="customer"] .cad-stage-environment-status {
    display: none;
  }

  body[data-app-mode="customer"] .workspace {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: var(--customer-sheet-height);
    max-height: var(--customer-sheet-height);
    transform: none;
  }

  body[data-app-mode="customer"] .controls {
    height: 100%;
    max-height: 100%;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    scrollbar-gutter: auto;
  }

  body[data-app-mode="customer"] .control-case-tabs {
    position: sticky;
    top: -8px;
    z-index: 4;
    margin: 0 0 6px;
    padding: 8px 0 5px;
    background: rgba(13, 19, 21, 0.88);
  }

  body[data-app-mode="customer"] .control-case-tabs .case-design-tab {
    flex: 1 1 0;
    min-height: 38px;
    padding: 6px 9px;
  }

  body[data-app-mode="customer"] .customer-context-panel {
    min-height: 44px;
    padding: 7px 9px;
  }

  body[data-app-mode="customer"] .customer-context-copy strong {
    font-size: 13px;
  }

  body[data-app-mode="customer"] .customer-context-copy span {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body[data-app-mode="customer"] #customerContextClose {
    min-height: 38px;
  }

  body[data-app-mode="customer"] .control-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 7px;
  }

  body[data-app-mode="customer"] .control-grid > label,
  body[data-app-mode="customer"] .handle-option-fieldset {
    padding: 8px 9px;
  }

  body[data-app-mode="customer"] .mode-switch {
    min-width: 46px;
    min-height: 38px;
  }
}

/* Contextual customer canvas: no lower chrome until the case is touched.
   The stage is permanent and the only always-visible action is the camera. */
.customer-lid-action {
  display: none;
}

body[data-app-mode="customer"] {
  --customer-blue: #2f80ed;
  --customer-blue-strong: #1769d2;
  --customer-blue-soft: rgba(47, 128, 237, 0.24);
}

body[data-app-mode="customer"] #cadPreviewSection,
body[data-app-mode="customer"] .cad-host {
  height: 100dvh;
  border-bottom: 0;
}

body[data-app-mode="customer"][data-customer-context="none"] .workspace {
  display: none !important;
}

body[data-app-mode="customer"] .cad-motion-actions {
  display: contents !important;
}

body[data-app-mode="customer"] .cad-motion-actions > :not(#cadCameraLock):not(#customerSceneCasesButton) {
  display: none !important;
}

body[data-app-mode="customer"] #cadCameraLock {
  position: fixed;
  z-index: 70;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  display: grid !important;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 9px;
  border: 1px solid rgba(208, 225, 244, 0.52);
  border-radius: 50%;
  background: rgba(12, 19, 24, 0.66);
  color: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
}

body[data-app-mode="customer"] #cadCameraLock:hover,
body[data-app-mode="customer"] #cadCameraLock:focus-visible,
body[data-app-mode="customer"] #cadCameraLock[aria-pressed="true"] {
  border-color: #9bc5ff;
  background: var(--customer-blue);
  box-shadow: 0 0 0 3px var(--customer-blue-soft), 0 8px 26px rgba(0, 0, 0, 0.34);
}

body[data-app-mode="customer"] #cadCameraLock svg {
  display: block;
  width: 25px;
  height: 25px;
  fill: currentColor;
}

body[data-app-mode="customer"] .camera-button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body[data-app-mode="customer"] .customer-lid-action {
  align-content: center;
  justify-content: center;
  min-height: 46px;
  border-color: rgba(159, 190, 226, 0.46);
  background: rgba(24, 39, 55, 0.84);
  color: #ffffff;
  font-weight: 800;
}

body[data-app-mode="customer"] .customer-lid-action[aria-pressed="true"] {
  border-color: #9bc5ff;
  background: var(--customer-blue);
}

body[data-app-mode="customer"] .mode-switch[aria-checked="true"] .mode-switch-track {
  background: var(--customer-blue);
}

body[data-app-mode="customer"] .mode-switch[aria-checked="false"] .mode-switch-admin,
body[data-app-mode="customer"] .mode-switch[aria-checked="true"] .mode-switch-customer {
  color: #d9eaff;
}

body[data-app-mode="customer"] .case-design-tab[aria-selected="true"] {
  border-color: #76afff;
  background: var(--customer-blue-strong);
  color: #ffffff;
}

body[data-app-mode="customer"] #customerContextClose {
  border-color: #76afff;
  background: var(--customer-blue-strong);
}

body[data-app-mode="customer"] input[type="checkbox"],
body[data-app-mode="customer"] input[type="range"] {
  accent-color: var(--customer-blue);
}

body[data-app-mode="customer"] .range-control input[type="range"]::-webkit-slider-thumb {
  border-color: #a9ceff;
  background: var(--customer-blue);
}

body[data-app-mode="customer"] .range-control input[type="range"]::-moz-range-thumb {
  border-color: #a9ceff;
  background: var(--customer-blue);
}

body[data-app-mode="customer"] .preset-control select,
body[data-app-mode="customer"] .customer-config-control select {
  color: #ffffff;
  color-scheme: dark;
}

body[data-app-mode="customer"] .preset-control select option,
body[data-app-mode="customer"] .customer-config-control select option {
  background: #10171b;
  color: #ffffff;
}

body[data-app-mode="customer"] #generatorForm select {
  border-color: rgba(145, 177, 214, 0.42) !important;
  background-color: #141d24 !important;
  color: #ffffff !important;
  color-scheme: dark;
  -webkit-text-fill-color: #ffffff;
}

body[data-app-mode="customer"] #generatorForm select option,
body[data-app-mode="customer"] #generatorForm select optgroup {
  background: #10171b;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

@media (max-width: 700px) {
  body[data-app-mode="customer"] .workspace {
    height: min(34dvh, 330px);
    max-height: min(34dvh, 330px);
  }

  body[data-app-mode="customer"] .controls {
    height: 100%;
    max-height: 100%;
  }
}

/* Customer case-type dock. It changes only the customer presentation; the
   working Admin shock-rack prototype stays available through the Admin tabs. */
.customer-case-dock,
.customer-coming-soon {
  display: none;
}

body[data-app-mode="customer"] .control-case-tabs {
  display: none !important;
}

body[data-app-mode="customer"] .customer-case-dock {
  position: fixed;
  z-index: 90;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 7px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(210, 225, 240, 0.34);
  border-radius: 23px;
  background: rgba(13, 19, 25, 0.72);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
}

body[data-app-mode="customer"] .customer-dock-button {
  display: grid;
  width: 68px;
  min-width: 68px;
  min-height: 62px;
  padding: 5px 7px 6px;
  place-items: center;
  gap: 1px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  box-shadow: none;
  transform-origin: bottom center;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

body[data-app-mode="customer"] .customer-dock-button:hover,
body[data-app-mode="customer"] .customer-dock-button:focus-visible {
  border-color: rgba(151, 195, 255, 0.52);
  background: rgba(47, 128, 237, 0.2);
  color: #ffffff;
  transform: translateY(-3px) scale(1.04);
}

body[data-app-mode="customer"] .customer-dock-button[aria-pressed="true"] {
  border-color: #76afff;
  background: var(--customer-blue-strong);
  color: #ffffff;
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(23, 105, 210, 0.38);
}

body[data-app-mode="customer"] .customer-dock-button svg {
  width: 40px;
  height: 34px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-app-mode="customer"] .customer-dock-button span {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
}

body[data-app-mode="customer"] .customer-coming-soon:not([hidden]) {
  position: fixed;
  z-index: 55;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px 24px 120px;
  background: #000000;
  color: #ffffff;
}

body[data-app-mode="customer"] .customer-coming-soon-copy {
  display: grid;
  justify-items: center;
  max-width: 760px;
  text-align: center;
  text-transform: uppercase;
}

body[data-app-mode="customer"] .customer-coming-soon-copy svg {
  width: clamp(76px, 10vw, 126px);
  height: auto;
  margin-bottom: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-app-mode="customer"] .customer-coming-soon-copy span {
  margin-bottom: 9px;
  color: rgba(255, 255, 255, 0.66);
  font-size: clamp(11px, 1.6vw, 15px);
  font-weight: 800;
  letter-spacing: 0.24em;
}

body[data-app-mode="customer"] .customer-coming-soon-copy strong {
  color: #ffffff;
  font-size: clamp(38px, 8vw, 96px);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

body[data-app-mode="customer"][data-customer-preview="rack"] #cadCameraLock {
  display: none !important;
}

body[data-app-mode="customer"]:not([data-customer-context="none"]) .workspace {
  bottom: calc(94px + env(safe-area-inset-bottom));
}

@media (max-width: 700px) {
  body[data-app-mode="customer"] .customer-case-dock {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 6px 8px;
    border-radius: 21px;
  }

  body[data-app-mode="customer"] .customer-dock-button {
    width: 64px;
    min-width: 64px;
    min-height: 58px;
  }

  body[data-app-mode="customer"] .customer-dock-button svg {
    width: 36px;
    height: 30px;
  }

  body[data-app-mode="customer"]:not([data-customer-context="none"]) .workspace {
    right: 0;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 0;
  }
}

/* Mobile landscape uses the center gap as its contextual control tray. The
   case-type dock remains available on the rack placeholder so customers can
   return to the trunk, but it no longer competes with trunk controls. */
@media (orientation: landscape) and (max-width: 1400px) and (max-height: 900px) {
  body[data-app-mode="customer"][data-customer-preview="trunk"] .customer-case-dock {
    display: none !important;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"]:not([data-customer-context="none"]) .workspace {
    z-index: 86;
    top: auto;
    right: calc(max(18px, calc(env(safe-area-inset-right) + 10px)) + var(--mobile-landscape-stick-size) + 18px);
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 7px));
    left: calc(max(18px, calc(env(safe-area-inset-left) + 10px)) + var(--mobile-landscape-stick-size) + 18px);
    width: auto;
    max-width: none;
    height: auto;
    max-height: min(46dvh, 220px);
    transform: none;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .controls {
    max-height: min(46dvh, 220px);
    padding: 7px 9px 9px;
    border-radius: 18px;
    background: rgba(13, 19, 25, 0.48);
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .customer-context-panel {
    min-height: 38px;
    padding: 5px 7px;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .customer-context-copy strong {
    font-size: 12px;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .customer-context-copy span {
    display: none;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] #customerContextClose {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 11px;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .control-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(155px, 100%), 1fr));
    gap: 6px;
    margin-top: 6px;
  }

  body[data-app-mode="customer"][data-customer-preview="trunk"] .control-grid > label,
  body[data-app-mode="customer"][data-customer-preview="trunk"] .handle-option-fieldset {
    padding: 6px 8px;
  }
}
