:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #243b33;
  background: #f6f5ef;
  font-synthesis: none;
  --green: #246b57;
  --line: #dcded4;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #cdd3c8;
  background: #fffefa;
  color: #28483b;
  border-radius: 7px;
  padding: 10px 13px;
  line-height: 1.3;
}
button:hover {
  background: #eef2e8;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #1b5948;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #c5933a;
  outline-offset: 3px;
}
header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px 30px;
  background: #fffefa;
  border-bottom: 1px solid var(--line);
}
.brand {
  font:
    36px Georgia,
    serif;
  width: 50px;
  height: 50px;
  border: 1px solid #aab9a4;
  text-align: center;
  line-height: 48px;
}
.brand span {
  color: #a17b3b;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: #6b796b;
}
h1 {
  font:
    29px Georgia,
    serif;
  margin: 5px 0 0;
}
h2 {
  font:
    25px Georgia,
    serif;
  margin: 9px 0 16px;
}
h3 {
  font-size: 14px;
  margin: 0;
}
p {
  line-height: 1.55;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}
.header-actions label {
  font-size: 11px;
  margin: 0;
}
.header-actions select {
  padding: 5px;
}
main {
  display: grid;
  grid-template-columns: 155px 280px minmax(0, 1fr);
  min-height: calc(100vh - 102px);
}
nav {
  padding: 25px 12px;
  border-right: 1px solid var(--line);
  background: #eeefe6;
}
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  margin: 3px 0;
  padding: 13px 9px;
}
nav b {
  font-size: 10px;
  color: #56634f;
  font-weight: 600;
}
nav button[aria-current="page"] {
  background: #dbe6d7;
  color: #1c513e;
  font-weight: 700;
}
aside {
  padding: 25px 22px;
  background: #fffefa;
  border-right: 1px solid var(--line);
  min-width: 0;
}
#editor > p,
.hint {
  font-size: 12px;
  color: #697466;
  margin: 8px 0 18px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 14px 0 0;
}
input:not([type="checkbox"]),
select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #ccd2c6;
  background: #fff;
  color: #243b33;
  border-radius: 5px;
  padding: 9px;
  margin-top: 6px;
}
input[type="checkbox"] {
  accent-color: var(--green);
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}
.fields label:only-child {
  grid-column: 1/-1;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.actions button {
  flex: 1;
  font-size: 12px;
}
.object-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.object-list button {
  font-size: 12px;
  padding: 8px;
}
.object-list .active {
  background: #dbe6d7;
  border-color: #518770;
}
.section-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #7c8876;
  margin: 24px 0 4px;
}
.workspace {
  padding: 25px 26px;
  min-width: 0;
}
.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.workspace-heading h2 {
  margin-bottom: 9px;
}
#status {
  font-size: 12px;
  color: #586b5d;
  min-height: 22px;
  margin-bottom: 8px;
}
#status.error {
  color: #a03523;
}
#draft-banner {
  font-size: 12px;
  padding: 10px;
  background: #fbebcb;
  color: #6b3c12;
}
.views {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
}
.view-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
}
.view-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 13px 15px;
}
.view-heading span {
  font-size: 11px;
  color: #56634f;
}
.view-heading button {
  padding: 5px 9px;
  font-size: 11px;
}
#plan {
  display: block;
  width: 100%;
  height: 350px;
  background: #fcfbf5;
}
#plan [role="button"] {
  cursor: pointer;
}
.view-note {
  font-size: 10px;
  color: #6d7769;
  margin: 0;
  padding: 12px 14px;
  min-height: 49px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  border-top: 1px solid #eff0e9;
}
.view-note label {
  margin: 0;
  font-size: 10px;
}
#stage {
  position: relative;
  height: 350px;
  width: 100%;
  overflow: hidden;
  touch-action: none;
}
.stage-lost {
  position: absolute;
  inset: auto 10px 10px;
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  background: #fbebcb;
  color: #6b3c12;
  font-size: 12px;
}
.stage-lost button {
  margin-top: 6px;
}
#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 16px;
  margin-top: 16px;
}
.selection-card,
.checks-card {
  background: #eef1e8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 17px;
}
.selection-card strong {
  display: block;
  font:
    21px Georgia,
    serif;
  margin-top: 10px;
}
.selection-card p {
  font-size: 12px;
  color: #56634f;
  margin-bottom: 0;
}
.checks-card .view-heading {
  padding: 0 0 12px;
}
#alerts {
  font-size: 12px;
  line-height: 1.5;
}
#alerts button {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 12px;
  color: #954429;
  background: #fff5e8;
  border: 0;
  margin: 5px 0;
  padding: 9px;
}
.scope {
  font-size: 11px;
  color: #5b6457;
  margin: 18px 0 0;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}
.swatch {
  padding: 4px;
  font-size: 10px;
  text-align: center;
}
.swatch img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  display: block;
  margin-bottom: 4px;
}
.swatch[aria-pressed="true"] {
  outline: 2px solid var(--green);
}
.variant-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.variant-row button {
  font-size: 11px;
  padding: 6px;
  margin: 7px 5px 0 0;
}
.summary-list {
  font-size: 12px;
  line-height: 1.6;
  padding-left: 16px;
}
.summary-list li {
  margin: 9px 0;
}
.compare {
  grid-column: 1/-1;
  margin-top: 16px;
  background: #fffefa;
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 10px;
}
.compare-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.compare svg {
  width: 100%;
  height: 210px;
}
.table-scroll {
  overflow: auto;
}
table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
  margin-top: 18px;
}
th,
td {
  padding: 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tr.different {
  background: #f8eed9;
}
.compare p {
  font-size: 12px;
}
#editor a {
  font-size: 12px;
  color: var(--green);
}
@media (min-width: 1600px) {
  main {
    grid-template-columns: 180px 315px minmax(0, 1fr);
  }
  #plan,
  #stage {
    height: 450px;
  }
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: 135px 250px minmax(0, 1fr);
  }
  .views {
    grid-template-columns: 1fr;
  }
  #plan,
  #stage {
    height: 285px;
  }
  .workspace {
    padding: 20px;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  header {
    padding: 18px 20px;
  }
}
@media (max-width: 760px) {
  header {
    padding: 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .brand {
    width: 38px;
    height: 38px;
    font-size: 27px;
    line-height: 36px;
  }
  h1 {
    font-size: 23px;
  }
  .eyebrow {
    font-size: 10px;
  }
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 0;
  }
  .header-actions .long-label {
    display: none;
  }
  #save-top {
    margin-left: auto;
  }
  .header-actions label {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .header-actions .long-label {
    display: none;
  }
  .header-actions select {
    width: auto;
    margin: 0;
  }
  main {
    display: flex;
    flex-direction: column;
  }
  nav {
    display: flex;
    overflow: auto;
    padding: 8px;
    border-right: 0;
    flex-shrink: 0;
  }
  nav button {
    width: auto;
    white-space: nowrap;
    padding: 10px;
  }
  aside {
    padding: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #editor h2 {
    margin: 0 0 10px;
  }
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workspace {
    padding: 16px;
  }
  #stage,
  #plan {
    height: 300px;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  .compare {
    padding: 12px;
  }
  .compare-plans {
    gap: 5px;
  }
  .compare svg {
    height: 160px;
  }
}

.fields label:has(input[type="text"]),
.fields label:has(select) {
  grid-column: 1/-1;
}
#editor #editor-error {
  color: #a03523;
  background: #fff1df;
  padding: 10px;
  border-radius: 5px;
}

.back-showroom {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--ink, #253d35);
  font-size: 12px;
  text-underline-offset: 3px;
}

[hidden] {
  display: none !important;
}
#save-state {
  padding: 6px 11px;
  border-radius: 999px;
  color: #754321;
  background: #f9efda;
  font-size: 12px;
  white-space: nowrap;
}
#save-state[data-saved="true"] {
  background: #e7eee3;
  color: #24523b;
}
.workspace-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 30px;
  background: #fffefa;
  border-bottom: 1px solid var(--line);
}
.workspace-links button {
  min-height: 44px;
}
#editor-feedback.error {
  color: #a03523;
  background: #fff1df;
  padding: 10px;
}
/* The editor is rebuilt in place: Chrome must not re-anchor the page on a removed control. */
#editor {
  overflow-anchor: none;
}
.field-error {
  color: #a03523;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  margin: 5px 0 0;
}
.plan-card {
  position: relative;
}
#draft-banner {
  position: absolute;
  top: 50px;
  left: 10px;
  right: 10px;
  z-index: 2;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(36, 59, 51, 0.18);
}
#editor,
#plan,
#stage {
  scroll-margin-top: 12px;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  background: white;
  color: #183f39;
  padding: 14px;
  transform: translateY(-180%);
}
.skip-link:focus {
  transform: none;
}
a:focus-visible {
  outline: 3px solid #146977;
  outline-offset: 3px;
}
/* Touch sizes for phones in portrait and in landscape (where the width exceeds 760 px). */
@media (max-width: 760px), (pointer: coarse) {
  .workspace-links {
    padding: 10px 14px;
  }
  .header-actions label {
    font-size: 12px;
  }
  #cutaway {
    width: 22px;
    height: 22px;
  }
  .view-note label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
  }
  button,
  .view-heading button,
  .variant-row button {
    min-height: 44px;
  }
  input:not([type="checkbox"]),
  select {
    font-size: 16px;
  }
  .view-note {
    font-size: 12px;
  }
  .view-note label {
    font-size: 12px;
  }
}
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .workspace-links {
    position: sticky;
    top: 0;
    z-index: 10;
    padding-block: 6px;
  }
  html:has(.workspace-links) {
    scroll-padding-top: 68px;
  }
}

.workshop-scope {
  margin: 12px 30px;
  max-width: 950px;
  font-size: 13px;
  color: #53644f;
}
.workshop-scope summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 24px;
}
.workshop-scope p {
  margin: 6px 0 0;
}
.furniture-choices {
  display: grid;
  gap: 10px;
  margin: 12px 0 20px;
}
.furniture-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f6f7f0;
}
.furniture-choice strong {
  font-size: 14px;
}
.furniture-choice p {
  font-size: 12px;
  margin: 6px 0 10px;
}
.furniture-choice button {
  width: 100%;
  min-height: 44px;
}
.furniture-choice button[aria-pressed="true"] {
  background: #246b57;
  color: white;
}
.step-navigation {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 12px;
  display: grid;
  gap: 8px;
}
.step-navigation .hint {
  margin: 0 0 4px;
}
.step-navigation button {
  text-align: left;
  min-height: 44px;
}
@media (max-width: 760px) {
  .workshop-scope {
    margin: 12px 16px;
  }
  .furniture-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.fields > .hint {
  grid-column: 1/-1;
}
.furniture-choice small {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
}

.scene-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 250px;
}

#move-element[aria-pressed="true"]{background:var(--green);color:white;border-color:var(--green)}
input[aria-invalid="true"],select[aria-invalid="true"]{border-color:#a43725;outline-color:#a43725}
#move-status{display:block;line-height:1.5}

.material-target {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #eef2e8;
  margin: 16px 0;
}
.material-target label { display: grid; gap: 7px; font-weight: 600; }
.material-target select { width: 100%; min-width: 0; }
.material-target h3 { margin: 14px 0 8px; }
.material-family { font-weight: 600; }
.applied-material { background: #e7eee2; padding: 12px; border-radius: 7px; font-size: 13px; }
#selection-actions[hidden] { display: none; }
#selection-actions button[aria-pressed="true"] { background: #dbe6d7; border-color: #518770; }

/* Quality pass: views, alerts and step buttons stay visible while a field is edited. */
#pin-3d,
#undo-bar {
  display: none;
}
@media (min-width: 1151px) {
  /* The step column keeps its colour below the sticky list. */
  main {
    background: linear-gradient(90deg, #eeefe6 154px, var(--line) 154px 155px, transparent 155px);
  }
  nav,
  .workspace {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow: auto;
  }
  #plan,
  #stage {
    height: clamp(240px, calc(100vh - 380px), 350px);
  }
  .workspace-links {
    padding-block: 6px;
  }
  .step-navigation {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: #fffefa;
    padding: 10px 0 14px;
    grid-template-columns: auto minmax(0, 1fr);
    box-shadow: 0 -12px 14px -14px rgba(36, 59, 51, 0.5);
  }
  .step-navigation .hint {
    grid-column: 1 / -1;
  }
  #next-step {
    grid-column: -2 / -1;
  }
  #previous-step:has(+ #next-step) .step-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  html {
    scroll-padding-bottom: 130px;
  }
}
@media (min-width: 1600px) {
  main {
    background: linear-gradient(90deg, #eeefe6 179px, var(--line) 179px 180px, transparent 180px);
  }
  #plan,
  #stage {
    height: clamp(240px, calc(100vh - 380px), 450px);
  }
}
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .workspace-links {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .workspace-links button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 6px;
    font-size: 14px;
  }
  #pin-3d,
  #undo-bar {
    display: block;
  }
  #pin-3d[aria-pressed="true"] {
    background: var(--green);
    color: white;
    border-color: var(--green);
  }
  /* Pinned preview: the 3D stays under the sticky bar while the form scrolls beneath. */
  html.preview-pinned {
    scroll-padding-top: calc(57px + 34vh + 58px);
  }
  html.preview-pinned .stage-card {
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    z-index: 9;
    border-radius: 0;
    border-width: 0 0 1px;
    box-shadow: 0 6px 14px rgba(36, 59, 51, 0.25);
  }
  html.preview-pinned .stage-card .view-heading {
    padding: 6px 10px;
  }
  html.preview-pinned .stage-card .view-heading h3 {
    display: none;
  }
  html.preview-pinned .scene-actions {
    max-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  html.preview-pinned #stage {
    height: 34vh;
  }
  html.preview-pinned .stage-card .view-note {
    display: none;
  }
}

/* Plan focus: an SVG outline is barely drawn, so the shape itself turns gold. */
#plan [data-select]:focus {
  outline: none;
}
#plan rect[data-select]:focus-visible,
#plan [data-select]:focus-visible > polygon:not([fill="transparent"]),
#plan [data-select]:focus-visible > .opening-line {
  stroke: #c5933a;
  stroke-width: 55px;
}
#plan [data-select]:focus-visible > .opening-line {
  stroke-width: 110px;
}
@media (min-width: 1151px) {
  .compare svg {
    height: 340px;
  }
}

/* Phone in landscape: compact header, pinned 3D beside the settings column. */
@media (pointer: coarse) and (max-height: 500px) and (min-width: 761px) {
  header {
    padding: 8px 16px;
  }
  .header-actions label {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .header-actions select {
    width: auto;
    margin: 0;
  }
  header .eyebrow {
    display: none;
  }
  .brand {
    width: 38px;
    height: 38px;
    font-size: 27px;
    line-height: 36px;
  }
  h1 {
    font-size: 21px;
    margin: 0;
  }
  /* The six steps are listed in the side column: the explanation is not repeated here. */
  .workshop-scope,
  #editor > .eyebrow {
    display: none;
  }
  header > div:not(.brand):not(.header-actions) {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 14px;
  }
  aside {
    padding: 14px 16px;
  }
  #editor h2 {
    margin: 0 0 10px;
  }
  .workspace-links button {
    flex: 0 1 auto;
    padding: 8px 14px;
  }
  html.preview-pinned {
    scroll-padding-top: 68px;
  }
  html.preview-pinned .stage-card {
    position: fixed;
    top: 57px;
    right: 0;
    bottom: 0;
    left: auto;
    width: calc(100vw - 405px);
    z-index: 9;
    border-radius: 0;
    box-shadow: -6px 0 14px rgba(36, 59, 51, 0.25);
  }
  html.preview-pinned .stage-card .view-heading h3,
  html.preview-pinned .stage-card .view-note {
    display: none;
  }
  html.preview-pinned .stage-card .view-heading {
    padding: 6px 10px;
  }
  html.preview-pinned .scene-actions {
    max-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  html.preview-pinned #stage {
    height: calc(100vh - 57px - 58px);
  }
}
@media (max-width: 760px) {
  header .eyebrow,
  #editor > .eyebrow {
    display: none;
  }
  h1 {
    font-size: 21px;
    margin: 0;
  }
  .workshop-scope {
    margin: 8px 16px;
  }
  nav {
    scroll-padding-inline: 16px;
  }
  nav.more-right {
    mask-image: linear-gradient(90deg, #000 80%, transparent);
  }
  nav.more-left {
    mask-image: linear-gradient(90deg, transparent, #000 14%);
  }
  nav.more-left.more-right {
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 80%, transparent);
  }
}
/* Printing the summary keeps the text and the plan, without the controls. */
@media print {
  .header-actions,
  .back-showroom,
  .skip-link,
  .workshop-scope,
  .workspace-links,
  nav,
  .step-navigation,
  #editor button,
  #editor .actions,
  #editor-feedback,
  #undo,
  #status,
  #draft-banner,
  .stage-card,
  .selection-card,
  .compare {
    display: none !important;
  }
  body,
  :root {
    background: white;
  }
  main {
    display: block;
    background: none;
  }
  nav,
  .workspace {
    position: static;
    max-height: none;
    overflow: visible;
  }
  aside {
    border: 0;
    padding: 0 0 12px;
  }
  .views,
  .bottom-grid {
    display: block;
  }
  #plan {
    height: 110mm;
  }
}

.starting-point {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #f6f7f0;
  margin: 4px 0 16px;
}
.starting-point .hint {
  margin: 6px 0 0;
}
.starting-point .actions {
  margin-top: 10px;
}
.wall-snap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 14px 0 10px;
  font-size: 12px;
}
.wall-snap span {
  width: 100%;
  font-weight: 600;
}
.wall-snap button {
  flex: 1;
  padding: 7px 8px;
  font-size: 12px;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #dbe6d7;
  color: #1c513e;
  font: 600 11px/1.6 Inter, ui-sans-serif, sans-serif;
  vertical-align: middle;
}
