:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --ink: #26372e;
  --muted: #777c71;
  --sage: #dfe5d6;
  --clay: #c77b5c;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 0 18px;
  font-size: 10px;
}

.button-dark {
  background: var(--ink);
  color: #fff;
}

.button-dark:hover {
  background: #455a4d;
}

.planner-page {
  min-height: 100vh;
}

.planner-app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 42px);
  border-bottom: 1px solid #e2e3da;
  background: rgb(247 245 239 / 96%);
}

.planner-app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
}

.planner-app-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #b9c3b4;
  border-radius: 50%;
  color: #63816e;
  font-family: var(--sans);
  font-size: 21px;
}

.planner-app-header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.planner-workspace,
.plan-output {
  max-width: 1440px;
  margin: 0 auto;
  padding-right: clamp(16px, 3vw, 42px);
  padding-left: clamp(16px, 3vw, 42px);
}

.planner-workspace {
  padding-top: 28px;
}

.planner-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
  padding: 28px;
  border: 1px solid #e3e3da;
  background: #fff;
  box-shadow: 0 8px 26px rgb(38 55 46 / 5%);
}

.planner-panel-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 4px;
}

.planner-rooms-heading {
  margin-top: 2px;
  padding-top: 18px;
  border-top: 1px solid #e3e3da;
}

.planner-field.room-count-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: min(100%, 360px);
  font-size: 13px;
}

.planner-step {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: #e8ede3;
  color: #63816e;
  font-size: 10px;
}

.planner-panel-heading h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
}

.planner-panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.planner-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  color: #4b554d;
  font-size: 10px;
  font-weight: 600;
}

.planner-field > span:first-child small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.planner-field select,
.input-with-unit {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dfe2d9;
  border-radius: 3px;
  background: #fbfbf8;
}

.planner-field select {
  padding: 0 12px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
}

.input-with-unit {
  display: flex;
  align-items: center;
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
}

.input-with-unit:focus-within,
.planner-field select:focus-visible {
  border-color: #83927c;
  outline: 2px solid rgb(131 146 124 / 20%);
  outline-offset: 1px;
}

.unit-suffix {
  min-width: 41px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-align: right;
}

.planner-input-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.planner-input-grid .planner-field {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.plot-area-value {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #dfe2d9;
  border-radius: 3px;
  padding: 0 12px;
  background: #fbfbf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.planner-wall-thickness {
  grid-column: 1 / -1;
  width: min(100%, 360px);
  margin-top: 2px;
}

.planner-error {
  grid-column: 1 / -1;
  margin: 0;
  color: #a23c2e;
  font-size: 11px;
}

.planner-error[hidden] {
  display: none;
}

.plan-output {
  padding-top: 70px;
  padding-bottom: 78px;
}

.planner-page.graph-mode-open {
  overflow: hidden;
}

.plan-output.is-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 18px 24px 12px;
  background: #f7f5ef;
}

.plan-output.is-fullscreen .plan-output-heading {
  flex: 0 0 auto;
  align-items: center;
  margin-bottom: 10px;
}

.plan-output.is-fullscreen .plan-output-heading h2 {
  font-size: 30px;
}

.plan-output.is-fullscreen .plan-output-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.plan-output.is-fullscreen .plan-summary {
  flex: 0 0 auto;
  margin-bottom: 9px;
}

.plan-output.is-fullscreen .wall-edit-toolbar {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.wall-edit-toolbar[hidden] {
  display: none;
}

.plan-output.is-fullscreen .build-instructions {
  flex: 0 0 auto;
  margin-bottom: 5px;
}

.plan-output.is-fullscreen .plan-canvas {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}

.plan-output.is-fullscreen .plan-legend {
  flex: 0 0 auto;
  padding-top: 8px;
}

.plan-output-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 17px;
}

.plan-output-heading .eyebrow {
  margin-bottom: 12px;
}

.plan-output-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 39px);
  font-weight: 400;
}

.plan-output-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-view-controls {
  display: inline-flex;
  border: 1px solid #d6dbd1;
  background: #fff;
}

.plan-history-controls {
  display: inline-flex;
  gap: 5px;
}

.plan-history-button {
  min-height: 32px;
  border: 1px solid #d6dbd1;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
}

.plan-history-button:hover:not(:disabled) {
  background: #e8ede3;
}

.plan-history-button:disabled {
  color: #a9b0a3;
  cursor: not-allowed;
}

.plan-view-button {
  min-width: 39px;
  min-height: 32px;
  border: 0;
  padding: 0 10px;
  background: transparent;
  color: #647066;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.plan-view-button.is-active {
  background: var(--ink);
  color: #fff;
}

.plan-angle-controls {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #647066;
  font-size: 10px;
}

.plan-angle-controls[hidden] {
  display: none;
}

.plan-angle-controls input {
  width: 82px;
  accent-color: var(--ink);
}

.plan-angle-controls output {
  min-width: 27px;
  color: var(--ink);
  font-weight: 600;
}

.wall-visibility-controls {
  display: inline-flex;
  border: 1px solid #d6dbd1;
  background: #fff;
}

.wall-visibility-controls[hidden] {
  display: none;
}

.wall-visibility-button {
  min-height: 32px;
  border: 0;
  padding: 0 9px;
  background: transparent;
  color: #647066;
  cursor: pointer;
  font-size: 10px;
}

.wall-visibility-button.is-active {
  background: var(--ink);
  color: #fff;
}

.plan-zoom-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d6dbd1;
  background: #fff;
}

.plan-zoom-button {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.plan-zoom-button:hover {
  background: #e8ede3;
}

.plan-zoom-button:disabled {
  color: #a9b0a3;
  cursor: not-allowed;
}

.plan-zoom-button:disabled:hover {
  background: transparent;
}

.plan-zoom-value {
  min-width: 52px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.plan-print-button {
  border: 1px solid #d6dbd1;
  padding: 10px 13px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
}

.plan-print-button:hover {
  background: #e8ede3;
}

.plan-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-bottom: 16px;
  color: #68736a;
  font-size: 10px;
}

.plan-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.wall-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
}

.wall-edit-label {
  margin-right: 3px;
  color: #647066;
  font-size: 10px;
  font-weight: 600;
}

.wall-edit-button {
  min-height: 30px;
  border: 1px solid #d6dbd1;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
}

.wall-edit-button:hover,
.wall-edit-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.plan-canvas.is-wall-editing {
  cursor: crosshair;
}

.room-schedule {
  grid-column: 1 / -1;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #e3e3da;
  background: #fff;
}

.room-schedule-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.room-schedule-heading h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
}

.room-schedule-heading p,
.room-schedule-empty {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.room-schedule-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.room-schedule-item {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 8px;
  border: 1px solid #e7e9e2;
  background: #fbfbf8;
}

.room-dimension-field {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: #647066;
  font-size: 13px;
}

.room-dimension-field input,
.room-dimension-field output {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  border: 1px solid #dfe2d9;
  border-radius: 3px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
}

.room-dimension-field output {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.room-dimension-field input:focus-visible {
  border-color: #83927c;
  outline: 2px solid rgb(131 146 124 / 20%);
  outline-offset: 1px;
}

.furnish-panel {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid #e1e2da;
  background: #fff;
}

.furnish-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.furnish-heading h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
}

.furnish-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.furnish-category {
  width: 170px;
  flex: 0 0 170px;
}

.furnish-category select {
  min-height: 36px;
}

.furniture-catalog-count {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.furniture-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding-right: 3px;
}

.furniture-card {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e4e6df;
  background: #fbfbf8;
}

.furniture-preview-shell {
  position: relative;
  width: 100%;
  height: 118px;
  flex: 0 0 100%;
  overflow: hidden;
  margin: 0;
  background: #f0f1eb;
}

.furniture-preview {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

.furniture-preview-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  background: #f0f1eb;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.furniture-preview-status[hidden] {
  display: none;
}

.furniture-preview-shell.is-error .furniture-preview-status {
  background: #f7f5ef;
  color: #8a3428;
}

.plan-3d-loading,
.plan-3d-error {
  margin: auto;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.plan-3d-error {
  color: #8a3428;
}

.plan-3d-renderer {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 430px;
  touch-action: none;
}

.furniture-swatch {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgb(38 55 46 / 20%);
  border-radius: 3px;
  background: var(--furniture-color);
  box-shadow: inset 0 -5px rgb(0 0 0 / 8%);
}

.furniture-card > div {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.furniture-card strong {
  overflow: hidden;
  color: #46534a;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.furniture-card small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  white-space: normal;
}

.furniture-card small a {
  color: #465b4d;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.furniture-retailer-links {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding-left: 32px;
}

.furniture-retailer-links a {
  color: #465b4d;
  font-size: 9px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.furniture-add,
.furniture-action {
  min-height: 28px;
  border: 1px solid #d6dbd1;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 9px;
}

.furniture-add:hover,
.furniture-action:hover {
  border-color: var(--ink);
  background: #e8ede3;
}

.furniture-inspector {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 9px 14px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid #e4e6df;
}

.furniture-inspector-bottom {
  margin: 0 0 12px;
  padding: 11px 16px;
  border: 1px solid #e4e6df;
  border-top: 0;
  background: #fff;
}

.furniture-inspector[hidden] {
  display: none;
}

.furniture-inspector > strong {
  align-self: center;
  margin-right: auto;
  color: var(--ink);
  font-size: 11px;
}

.furniture-inspector label {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 6px;
  color: #647066;
  font-size: 9px;
}

.furniture-inspector label output {
  color: var(--ink);
  text-align: right;
}

.furniture-inspector input {
  width: 125px;
  grid-column: 1 / -1;
  accent-color: var(--ink);
}

.furniture-delete {
  color: #9c4a3b;
}

.build-instructions {
  min-height: 15px;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.plan-canvas {
  height: min(68vh, 680px);
  min-height: 390px;
  overflow: auto;
  border: 1px solid #e1e2da;
  background-color: #fbfbf8;
  background-image: linear-gradient(#edf0e9 1px, transparent 1px), linear-gradient(90deg, #edf0e9 1px, transparent 1px);
  background-size: 24px 24px;
}

.plan-canvas svg {
  display: block;
  width: 100%;
  min-width: 580px;
  height: auto;
  margin: 0 auto;
  touch-action: none;
}

.plan-canvas[data-view="2d"] svg {
  cursor: crosshair;
}

.plan-canvas[data-view="3d"] .plan-3d-renderer {
  cursor: grab;
}

.plan-canvas[data-view="3d"].is-rotating .plan-3d-renderer {
  cursor: grabbing;
}

.plan-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 142px;
  padding: 4px;
  border: 1px solid #d6dbd1;
  background: #fff;
  box-shadow: 0 5px 18px rgb(25 37 29 / 18%);
}

.plan-context-menu[hidden] {
  display: none;
}

.plan-context-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  padding: 0 10px;
  background: transparent;
  color: #9c3e32;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
  text-transform: capitalize;
}

.plan-context-menu button:hover,
.plan-context-menu button:focus-visible {
  outline: 0;
  background: #f8e9e5;
}

.plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px 24px;
  padding-top: 13px;
  color: var(--muted);
  font-size: 9px;
}

.plan-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-wall {
  width: 17px;
  height: 5px;
  background: var(--ink);
}

.legend-room {
  width: 13px;
  height: 13px;
  border: 1px solid #cbd2c8;
}

.legend-living {
  background: #e5eee4;
}

.legend-bedroom {
  background: #e7eaf2;
}

.legend-door {
  width: 15px;
  height: 9px;
  border-top: 1px solid #c77b5c;
  border-right: 1px solid #c77b5c;
  border-radius: 0 9px 0 0;
}

.legend-main-door {
  width: 15px;
  height: 9px;
  border-top: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
  border-radius: 0 9px 0 0;
}

.legend-window {
  width: 15px;
  height: 5px;
  background: #54a4b4;
}

.legend-furniture {
  width: 13px;
  height: 11px;
  border: 1px solid #735b49;
  border-radius: 2px;
  background: #a77a5a;
}

@media (max-width: 640px) {
  .planner-app-header {
    min-height: 56px;
    padding-right: 5%;
    padding-left: 5%;
  }

  .planner-app-brand {
    font-size: 17px;
  }

  .planner-app-header p {
    max-width: 120px;
    font-size: 9px;
    text-align: right;
  }

  .planner-workspace,
  .plan-output {
    padding-right: 5%;
    padding-left: 5%;
  }

  .planner-controls {
    grid-template-columns: 1fr;
    gap: 17px;
    padding: 20px 17px;
  }

  .planner-panel-heading,
  .planner-error {
    grid-column: auto;
  }

  .planner-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .planner-input-grid .planner-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .room-schedule-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .room-dimension-field {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px;
    font-size: 10px;
  }

  .room-dimension-field input,
  .room-dimension-field output {
    min-height: 38px;
    padding: 0 7px;
    font-size: 10px;
  }

  .plan-output {
    padding-top: 52px;
    padding-bottom: 56px;
  }

  .plan-output.is-fullscreen {
    padding: 10px;
  }

  .plan-output.is-fullscreen .plan-output-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .plan-output.is-fullscreen .plan-output-heading h2 {
    font-size: 25px;
  }

  .plan-output.is-fullscreen .plan-output-actions {
    justify-content: flex-start;
    gap: 6px;
  }

  .plan-output.is-fullscreen .plan-summary {
    gap: 5px 12px;
    font-size: 9px;
  }

  .plan-output.is-fullscreen .wall-edit-toolbar {
    margin-bottom: 5px;
  }

  .plan-output.is-fullscreen .plan-canvas {
    min-height: 0;
  }

  .plan-output.is-fullscreen .plan-legend {
    gap: 7px 12px;
    font-size: 8px;
  }

  .plan-output-heading {
    align-items: flex-start;
  }

  .plan-output-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .plan-angle-controls {
    order: 1;
  }

  .wall-visibility-controls {
    order: 1;
  }

  .furnish-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .furnish-category {
    width: 100%;
    flex-basis: auto;
  }

  .furniture-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-canvas {
    height: min(65vh, 540px);
    min-height: 280px;
  }

  .plan-canvas svg {
    min-width: 580px;
  }

}

@media print {
  .planner-app-header,
  .furnish-panel,
  .build-instructions,
  .wall-edit-toolbar,
  .plan-legend,
  .plan-view-controls,
  .plan-history-controls,
  .plan-angle-controls,
  .wall-visibility-controls,
  .plan-zoom-controls,
  .plan-print-button {
    display: none !important;
  }

  .planner-workspace {
    max-width: none;
    padding: 0;
  }

  .planner-controls {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .planner-panel-heading:not(.planner-rooms-heading),
  .planner-input-grid,
  .planner-error,
  .room-count-picker {
    display: none !important;
  }

  .planner-rooms-heading {
    margin: 0;
    padding: 0 0 5mm;
    border: 0;
  }

  .room-schedule {
    margin: 0 0 6mm;
    padding: 0;
    border: 0;
  }

  body,
  .plan-output,
  .plan-canvas {
    background: #fff;
  }

  .plan-output {
    max-width: none;
    padding: 12mm;
  }

  .plan-canvas {
    height: auto;
    min-height: 0;
    border: 0;
  }

  .plan-canvas svg {
    min-width: 0;
    max-height: 240mm;
  }
}
