:root {
  color: #1f2933;
  background: #eef1ef;
  --workbench-height: min(820px, calc(100vh - 18px));
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

body.embedded {
  background: transparent;
  min-height: 0;
  overflow: hidden;
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 12px;
}

body.embedded .app-shell {
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

body.embedded .topbar {
  display: none;
}

body.embedded .workspace {
  width: 100%;
  height: 100vh;
  max-width: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 16px;
  max-width: 1720px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #6b7780;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.16;
}

.topbar-actions,
.style-tabs,
.category-tabs,
.stage-toolbar,
.view-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.wide-action,
.style-tabs button,
.category-tabs button,
.view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid #c9d2d8;
  border-radius: 8px;
  background: #ffffff;
  color: #24313a;
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button {
  padding: 0 14px;
  white-space: nowrap;
}

.icon-button.primary,
.wide-action {
  border-color: #24313a;
  background: #24313a;
  color: #ffffff;
}

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

.icon-button:hover,
.wide-action:hover,
.style-tabs button:hover,
.view-tabs button:hover,
.category-tabs button:hover,
.space-card:hover,
.plan-card:hover,
.product-card:hover,
.upload-zone:hover,
.variant-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(37, 49, 58, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: 180px minmax(760px, 1fr) 228px;
  gap: 8px;
  width: min(100%, 1360px);
  height: var(--workbench-height);
  max-width: 1360px;
  margin: 0 auto;
  align-items: stretch;
}

.side-panel,
.product-panel,
.stage {
  border: 1px solid #d1d8dd;
  border-radius: 8px;
  background: #fbfcfb;
  min-height: 0;
}

.side-panel,
.product-panel {
  padding: 8px;
  overflow: hidden;
}

.side-panel {
  display: grid;
  grid-template-rows: auto auto auto auto auto auto 1fr;
}

.product-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #26323a;
  font-size: 12px;
  font-weight: 800;
}

.panel-heading.spaced {
  margin-top: 10px;
}

.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: 64px;
  margin: 7px 0;
  padding: 10px;
  border: 1px dashed #9ba9b1;
  border-radius: 8px;
  background: #f4f7f5;
  color: #41505a;
  cursor: pointer;
  text-align: center;
}

.upload-zone img {
  width: 100%;
  height: 54px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.upload-zone strong {
  font-size: 13px;
}

.upload-zone span {
  display: none;
  max-width: 230px;
  color: #66747c;
  font-size: 11px;
  line-height: 1.45;
}

.wide-action {
  width: 100%;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.spin {
  animation: spin 1s linear infinite;
}

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

.plan-list,
.space-list,
.product-list {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.plan-list,
.space-list,
.product-list {
  min-height: 0;
}

.plan-list {
  overflow: hidden;
}

.plan-card,
.space-card,
.product-card {
  width: 100%;
  border: 1px solid #d4dce0;
  border-radius: 8px;
  background: #ffffff;
  color: #27343d;
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
}

.plan-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  min-height: 72px;
  padding: 9px 10px;
}

.space-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 7px 8px;
}

.plan-card span,
.space-card span,
.product-copy strong {
  min-width: 0;
  font-weight: 800;
}

.plan-card small {
  grid-column: 1 / -1;
  color: #66747c;
  font-size: 10px;
  line-height: 1.3;
}

.plan-card em {
  grid-column: 1 / -1;
  display: block;
  color: #34454e;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}

.space-card small,
.space-card em {
  grid-column: 1 / -1;
  color: #66747c;
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.space-card b {
  color: #286a57;
  font-size: 11px;
  white-space: nowrap;
}

.space-card strong {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 0 7px;
  border-radius: 8px;
  background: #edf3f4;
  color: #34454e;
  font-size: 11px;
}

.space-card em {
  display: none;
}

.plan-card strong {
  color: #286a57;
}

.space-card.active,
.plan-card.active,
.product-card.active,
.style-tabs button.active,
.category-tabs button.active {
  border-color: #286a57;
  background: #eef7f1;
  box-shadow: inset 0 0 0 1px #286a57;
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.workflow-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 4px 10px;
  border-bottom: 1px solid #d8dee3;
  background: #ffffff;
}

.workflow-step {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 26px;
  padding: 0 7px;
  color: #6b7780;
  font-size: 12px;
}

.workflow-step::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: #e2e7ea;
}

.workflow-step:last-child::after {
  display: none;
}

.workflow-step i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid #cbd5db;
  border-radius: 50%;
  background: #f5f7f6;
  color: #56636b;
  font-style: normal;
  font-weight: 900;
}

.workflow-step span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.workflow-step small {
  display: none;
}

.workflow-step.done i {
  border-color: #286a57;
  background: #286a57;
  color: #ffffff;
}

.workflow-step.active {
  color: #24313a;
}

.workflow-step.active i {
  border-color: #286a57;
  background: #eef7f1;
  color: #286a57;
}

.stage-toolbar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  justify-content: stretch;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-bottom: 1px solid #d8dee3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  background: #edf3f4;
  color: #34454e;
  font-size: 12px;
  font-weight: 700;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: fit-content;
}

.style-tabs {
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  overflow: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.style-tabs button,
.category-tabs button,
.view-tabs button {
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  min-width: max-content;
}

.style-tabs button {
  min-width: 84px;
}

.view-tabs button {
  min-width: 74px;
}

.view-tabs {
  padding: 3px;
  border: 1px solid #d9e0e4;
  border-radius: 8px;
  background: #f3f6f4;
}

.view-tabs button {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
}

.view-tabs button.active {
  border-color: #24313a;
  background: #24313a;
  color: #ffffff;
  box-shadow: none;
}

.brief-chips {
  display: none;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
  padding: 6px 10px;
  border-bottom: 1px solid #d8dee3;
  background: #ffffff;
}

.brief-chips span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d7e0e4;
  border-radius: 8px;
  background: #f7f9f8;
  color: #52616b;
  font-size: 11px;
  line-height: 1.2;
}

.brief-chips b {
  color: #24313a;
}

.render-frame {
  min-height: 0;
  padding: 0;
  background: #dfe5e2;
}

.editor-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
  background:
    linear-gradient(rgba(80, 94, 101, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 94, 101, 0.07) 1px, transparent 1px),
    #e9eeeb;
  background-size: 28px 28px;
}

.three-mount {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.three-mount canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.render-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: crosshair;
}

.editor-viewport.mode-render .render-canvas {
  opacity: 0;
  pointer-events: none;
}

.editor-viewport:not(.mode-render) .three-mount {
  opacity: 0;
  pointer-events: none;
}

.render-canvas.is-panning {
  cursor: grab;
}

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

.tool-rail,
.zoom-controls,
.canvas-hud {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(188, 198, 205, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(31, 41, 51, 0.14);
  backdrop-filter: blur(12px);
}

.canvas-hud[hidden] {
  display: none !important;
}

.editor-viewport.static-render .tool-rail {
  display: none;
}

.tool-rail {
  top: 14px;
  left: 14px;
  display: grid;
  gap: 6px;
  padding: 6px;
}

.tool-rail button,
.zoom-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #26323a;
  cursor: pointer;
}

.tool-rail button.active,
.zoom-controls button:hover,
.tool-rail button:hover {
  border-color: #286a57;
  background: #eef7f1;
  color: #286a57;
}

.canvas-hud {
  top: 14px;
  right: auto;
  left: 70px;
  display: grid;
  gap: 4px;
  max-width: min(260px, calc(100% - 110px));
  padding: 11px 13px;
  color: #26323a;
}

.canvas-hud strong {
  font-size: 14px;
}

.canvas-hud span {
  color: #66747c;
  font-size: 12px;
  line-height: 1.35;
}

.surface-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.surface-switch button,
.texture-controls button {
  min-height: 30px;
  border: 1px solid #d6dde2;
  border-radius: 8px;
  background: #ffffff;
  color: #34454e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.surface-switch button.active {
  border-color: #286a57;
  background: #eef7f1;
  color: #286a57;
}

.texture-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.texture-controls button {
  padding: 0 7px;
  font-size: 11px;
}

.zoom-controls {
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
}

.zoom-controls span {
  min-width: 54px;
  color: #26323a;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.variant-strip {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 0;
  border-top: 0;
  background: transparent;
  pointer-events: none;
}

.variant-card {
  position: relative;
  display: grid;
  gap: 3px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(212, 220, 224, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #24313a;
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
  box-shadow: 0 12px 28px rgba(31, 41, 51, 0.12);
  pointer-events: auto;
  backdrop-filter: blur(14px);
}

.variant-card.active {
  border-color: #286a57;
  background: #eef7f1;
  box-shadow: inset 0 0 0 1px #286a57;
}

.variant-card strong {
  padding-right: 38px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-card small,
.variant-card em {
  color: #66747c;
  font-size: 10px;
  font-style: normal;
  line-height: 1.25;
}

.variant-card em {
  display: none;
}

.variant-score {
  position: absolute;
  top: 8px;
  right: 10px;
  color: #286a57;
  font-size: 13px;
  font-weight: 900;
}

.metrics-row {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #d8dee3;
  background: #ffffff;
}

.metrics-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid #e0e6e9;
}

.metrics-row div:last-child {
  border-right: 0;
}

.metrics-row span {
  color: #71808a;
  font-size: 12px;
}

.metrics-row strong {
  font-size: 17px;
}

.category-tabs {
  margin-top: 8px;
}

.category-tabs button {
  flex: 1;
}

.product-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
}

.swatch {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(35, 45, 52, 0.15);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--base);
}

.swatch i {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.swatch::before,
.swatch::after {
  content: "";
  position: absolute;
  inset: 0;
}

.swatch::before {
  opacity: 0.76;
}

.swatch.has-real-texture::before {
  background: var(--texture) center / cover;
  opacity: 1;
}

.swatch::after {
  background: linear-gradient(135deg, rgba(255,255,255,.28), transparent 40%, rgba(0,0,0,.16));
}

.material-wood::before,
.material-slatWood::before {
  background:
    repeating-linear-gradient(90deg, rgba(70,42,22,.28) 0 2px, transparent 2px 15px),
    repeating-linear-gradient(8deg, transparent 0 10px, rgba(255,245,220,.24) 10px 12px),
    var(--base);
}

.material-slatWood::before {
  background:
    repeating-linear-gradient(90deg, rgba(65,38,22,.48) 0 2px, transparent 2px 8px),
    var(--base);
}

.material-stone::before,
.material-ceilingPanel::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 20px, rgba(70,78,80,.32) 20px 21px),
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(70,78,80,.28) 20px 21px),
    linear-gradient(135deg, rgba(255,255,255,.34), transparent 42%, rgba(0,0,0,.1)),
    var(--base);
}

.material-terrazzo::before {
  background:
    radial-gradient(circle at 18% 22%, #f8f1e5 0 3px, transparent 4px),
    radial-gradient(circle at 64% 28%, var(--accent) 0 4px, transparent 5px),
    radial-gradient(circle at 42% 70%, rgba(80,88,84,.42) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 78%, #ece3d4 0 5px, transparent 6px),
    var(--base);
}

.material-paint::before {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.16) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.18), transparent 24px),
    var(--base);
}

.material-grid::before {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.24) 0 7px, rgba(70,60,52,.34) 7px 11px, transparent 11px 20px),
    var(--base);
}

.product-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.product-copy strong {
  font-size: 14px;
  line-height: 1.12;
  letter-spacing: 0;
}

.texture-source {
  display: none;
  color: #7c8a91;
  font-size: 11px;
}

.product-copy small,
.product-copy em {
  color: #6d7b83;
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.28;
}

.product-copy em {
  display: none;
}

.product-card b {
  align-self: start;
  color: #286a57;
  font-size: 10.5px;
  white-space: nowrap;
}

.quote-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d8dee3;
}

.quote-row,
.quote-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #e4e9ec;
}

.quote-row span,
.quote-total span {
  color: #64737c;
  min-width: 0;
  line-height: 1.25;
}

.quote-row strong,
.quote-total strong {
  min-width: max-content;
  text-align: right;
  white-space: nowrap;
}

.quote-total {
  border-bottom: 0;
  color: #202b33;
  font-size: 14px;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(210px, 260px) 1fr;
  }

  .product-panel {
    grid-column: 1 / -1;
  }

  .product-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .variant-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .stage-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-bar {
    grid-template-columns: 1fr;
  }

  .workflow-step::after {
    display: none;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .icon-button span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .style-tabs {
    justify-content: stretch;
  }

  .style-tabs button {
    flex: 1 1 44%;
  }

  .view-tabs {
    justify-content: stretch;
  }

  .view-tabs button {
    flex: 1;
  }
}

@media (max-width: 460px) {
  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .product-card b {
    grid-column: 2;
  }
}

/* Mobile embed layout: stack the workbench instead of clipping the desktop columns. */
@media (max-width: 720px) {
  :root {
    --workbench-height: auto;
  }

  body {
    overflow-x: hidden;
  }

  body.embedded {
    min-height: 0;
    overflow: visible;
  }

  .app-shell,
  body.embedded .app-shell {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  .workspace,
  body.embedded .workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    height: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    overflow: visible;
  }

  .side-panel,
  .stage,
  .product-panel {
    width: 100%;
    min-width: 0;
    border-radius: 10px;
  }

  .side-panel,
  .product-panel {
    display: block;
    padding: 12px;
    overflow: visible;
  }

  .stage {
    display: block;
    overflow: visible;
    background: #fbfcfb;
  }

  .panel-heading {
    gap: 10px;
    font-size: 15px;
    line-height: 1.25;
  }

  .panel-heading .icon {
    width: 20px;
    height: 20px;
  }

  .panel-heading.spaced {
    margin-top: 18px;
  }

  .upload-zone {
    min-height: 92px;
    margin: 10px 0;
    padding: 16px;
    border-radius: 10px;
  }

  .upload-zone strong {
    font-size: 16px;
  }

  .wide-action {
    min-height: 48px;
    border-radius: 10px;
    font-size: 15px;
  }

  .plan-list,
  .space-list,
  .product-list {
    gap: 10px;
    margin-top: 10px;
    overflow: visible;
  }

  .plan-card,
  .space-card,
  .product-card {
    border-radius: 10px;
  }

  .space-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 14px;
  }

  .space-card span,
  .plan-card span,
  .product-copy strong {
    font-size: 18px;
    line-height: 1.28;
  }

  .space-card b {
    font-size: 14px;
  }

  .space-card strong {
    min-height: 24px;
    padding: 0 10px;
    font-size: 13px;
  }

  .space-card small,
  .space-card em,
  .plan-card small,
  .plan-card em {
    display: block;
    font-size: 13px;
    line-height: 1.5;
  }

  .plan-card {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 92px;
    gap: 8px 12px;
    padding: 14px;
  }

  .workflow-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
    overflow: visible;
    border-radius: 10px 10px 0 0;
  }

  .workflow-step {
    min-width: 0;
    min-height: 42px;
    padding: 0 5px;
    border: 1px solid #dde4e8;
    border-radius: 10px;
    background: #f6f8f7;
    font-size: 12px;
  }

  .workflow-step::after {
    display: none;
  }

  .workflow-step span {
    white-space: nowrap;
  }

  .stage-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .status-pill {
    width: 100%;
    max-width: none;
    min-height: 42px;
    justify-content: center;
    border-radius: 10px;
    font-size: 13px;
  }

  .view-tabs,
  .style-tabs,
  .category-tabs {
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
  }

  .view-tabs button,
  .style-tabs button,
  .category-tabs button {
    min-width: 0;
    min-height: 46px;
    border-radius: 10px;
    font-size: 14px;
    white-space: normal;
    word-break: keep-all;
  }

  .style-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .render-frame {
    min-height: 360px;
    border-top: 1px solid #d8dee3;
    border-bottom: 1px solid #d8dee3;
    overflow: hidden;
  }

  .editor-viewport {
    height: 360px;
    min-height: 360px;
  }

  .tool-rail {
    top: 12px;
    left: 12px;
  }

  .zoom-controls {
    right: 12px;
    bottom: 12px;
  }

  .canvas-hud {
    right: 12px;
    left: 12px;
    bottom: 70px;
    max-width: none;
  }

  .variant-strip,
  .metrics-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .product-panel {
    padding-bottom: 14px;
  }

  .category-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
    overflow: visible;
  }

  .product-list {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .product-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .product-copy small {
    font-size: 12px;
  }

  .product-copy p {
    font-size: 13px;
    line-height: 1.45;
  }

  .quote-box {
    margin-top: 16px;
  }
}

@media (max-width: 420px) {
  .workspace,
  body.embedded .workspace {
    gap: 10px;
  }

  .side-panel,
  .product-panel {
    padding: 10px;
  }

  .space-card span,
  .plan-card span,
  .product-copy strong {
    font-size: 17px;
  }

  .category-tabs {
    gap: 6px;
  }

  .category-tabs button,
  .view-tabs button,
  .style-tabs button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 13px;
  }

  .product-card {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .product-card b {
    grid-column: 2;
  }
}
