:root {
  --bg: #f4f1ec;
  --surface: #fff;
  --border: #d8d2c8;
  --text: #1a1814;
  --muted: #6b6560;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --danger: #9b2226;
  --shadow: 0 1px 3px rgba(26, 24, 20, 0.08);
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1rem 1.5rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-left: auto;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent);
}

.nav-user {
  font-size: 0.85rem;
  color: var(--muted);
}

.nav-logout-form {
  margin: 0;
  display: inline;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
}

.account-banner--suggest {
  background: #fde4c8;
  border-bottom: 1px solid #e8a04a;
  color: var(--text);
}

.account-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.account-banner-text {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.45;
}

.account-banner--suggest .account-banner-link {
  font-weight: 600;
  color: #b45309;
  text-decoration: none;
  white-space: nowrap;
}

.account-banner--suggest .account-banner-link:hover {
  color: #92400e;
  text-decoration: underline;
}

.account-banner-dismiss-form {
  margin: 0;
  flex-shrink: 0;
}

.account-banner-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  border-radius: 4px;
}

.account-banner-dismiss:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.messages-wrap {
  padding-top: 0.75rem;
  padding-bottom: 0;
}

.message {
  margin: 0 0 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.message-success {
  background: rgba(45, 106, 79, 0.12);
  color: var(--accent-hover);
}

.message-error {
  background: rgba(155, 34, 38, 0.1);
  color: var(--danger);
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
}

.site-copyright {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.tagline {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero h1 {
  margin-top: 0;
  font-size: 1.75rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pricing-card-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.pricing-price {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.5rem 0;
}

.pricing-limits {
  margin: 0.75rem 0 1rem;
  padding-left: 1.1rem;
}

.pricing-badge {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.project-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.project-form input[type="text"],
.project-form input[type="number"],
.inline-label input,
.inline-label select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.dims-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { background: var(--bg); }

.btn-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.project-list-name {
  flex: 1 1 10rem;
  min-width: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.project-list-owner {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: var(--muted, #5c574f);
}

.badge-you {
  background: rgba(45, 106, 79, 0.15);
  color: var(--accent, #2d6a4f);
}

.project-list-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.project-list-actions a {
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: none;
}

.btn-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.btn-link-danger {
  color: #b33;
}

.project-delete-form {
  margin: 0;
}

.toolbar-delete-form {
  display: inline-flex;
  margin: 0;
}


/* Designer layout */
.designer-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px);
  max-width: none;
  padding: 0;
}

.designer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.designer-toolbar h1 {
  margin: 0;
  font-size: 1.1rem;
}

/* Toolbar controls: label + field on one row, same height as buttons */
.designer-toolbar .inline-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  white-space: nowrap;
}

.designer-toolbar .inline-label input,
.designer-toolbar .inline-label select {
  display: block;
  margin-top: 0;
  width: auto;
}

.designer-toolbar .btn,
.designer-toolbar .inline-label input[type="text"],
.designer-toolbar .inline-label input[type="number"],
.designer-toolbar .inline-label .hp-select {
  height: 2.125rem;
  box-sizing: border-box;
}

.designer-toolbar .btn {
  padding: 0 0.75rem;
  flex-shrink: 0;
}

.designer-toolbar .inline-label input[type="text"],
.designer-toolbar .inline-label input[type="number"],
.designer-toolbar .inline-label .hp-select {
  padding: 0.35rem 0.5rem;
  line-height: 1.2;
}

.designer-toolbar .toolbar-dim input[type="number"] {
  width: 4.75rem;
  min-width: 4.75rem;
}

.toolbar-room-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.toolbar-fields,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-actions {
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
}

.toolbar-room-meta .save-status {
  display: inline-flex;
  align-items: center;
  min-height: 2.125rem;
}

.inline-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.inline-label input,
.inline-label select {
  width: auto;
  min-width: 7rem;
}

.save-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.save-status.ok { color: var(--accent); }
.save-status.err { color: var(--danger); }

.toolbar-room-meta .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.storey-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.storey-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.storey-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.storey-tab:hover {
  border-color: var(--accent);
}

.storey-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.storey-tab.is-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.storey-tab-close {
  opacity: 0.75;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 0.1rem;
}

.storey-tab-close:hover {
  opacity: 1;
}

.storey-tab-add {
  flex-shrink: 0;
  min-width: 2.25rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.designer-body {
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  flex: 1;
  min-height: 0;
}

.palette {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.palette-sidebar-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.palette-sidebar-tab {
  flex: 1;
  margin: 0;
  padding: 0.55rem 0.5rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.palette-sidebar-tab:hover {
  color: var(--text);
}

.palette-sidebar-tab.is-active,
.palette-sidebar-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.palette-tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.palette-tab-panel.is-active {
  display: flex;
}

.palette-tab-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem 1rem;
}

.palette-plan-section + .palette-plan-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inspector {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}

.palette-header {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.palette-mode-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Unified dropdown styling (Catalogue / toolbar / forms) */
.hp-select,
select.palette-mode-select {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: inherit;
}

.hp-select {
  text-transform: none;
  letter-spacing: normal;
}

.palette-mode-select,
.project-form select.hp-select {
  width: 100%;
}

.toolbar-center .inline-label .hp-select {
  min-width: 8.5rem;
}

.project-form select.hp-select {
  display: block;
  margin-top: 0.25rem;
}

.palette-hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.palette-search {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.palette-search::placeholder {
  color: var(--muted);
}

#unit-palette > .palette-search {
  margin: 0.35rem 1rem 0.5rem;
  width: calc(100% - 2rem);
}

.palette-item.palette-search-hidden {
  display: none !important;
}

.palette-group.palette-search-empty {
  display: none;
}

.palette-search-empty {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  text-align: center;
  color: var(--muted);
}

.palette-panels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem 1rem 1rem;
}

.palette-panel-shape .hint {
  margin: 0;
}

.inspector {
  border-right: none;
  border-left: 1px solid var(--border);
}

.palette h2,
.inspector h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.palette-group {
  margin-bottom: 0.75rem;
}

.palette-group summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

.palette-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.palette-item {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  font-size: 0.85rem;
}

.palette-item:hover {
  border-color: var(--accent);
}

.palette-item:active { cursor: grabbing; }

.palette-item-dims {
  color: var(--muted);
  font-size: 0.75rem;
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #e8e4dc;
}

.canvas-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.canvas-meta-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  margin-left: auto;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.zoom-controls .zoom-btn {
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.zoom-controls .zoom-level-btn {
  min-width: 3.25rem;
  padding: 0 0.4rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.canvas-scroll {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.house-canvas,
.room-canvas {
  position: relative;
  margin: 0 auto;
  box-sizing: border-box;
  overflow: visible;
}

.trace-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.trace-image-wrap {
  position: absolute;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: move;
  overflow: visible;
}

.trace-image-wrap img.trace-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.trace-resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.trace-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.trace-status {
  margin: 0 0 0.65rem;
}

.trace-upload-btn {
  display: inline-block;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.trace-opacity-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  width: 100%;
}

.trace-opacity-label input[type="range"] {
  flex: 1;
  min-width: 0;
}

.trace-visible-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0.5rem;
  font-size: 0.85rem;
}

.trace-tool-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.trace-calibrate-form {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.trace-calibrate-length {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.trace-calibrate-length input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.trace-calibrate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.trace-calibrate-hint {
  margin: 0 0 0.35rem;
}

.trace-calibrate-overlay {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 25;
  cursor: crosshair;
  pointer-events: auto;
  overflow: visible;
}

body.trace-calibrating .rooms-layer,
body.trace-calibrating .trace-image-wrap {
  pointer-events: none;
}

body.trace-calibrating .trace-image-wrap {
  cursor: crosshair;
}

.trace-calibrate-svg {
  display: block;
  overflow: visible;
  pointer-events: none;
}

.trace-calibrate-svg line {
  stroke: #c1121f;
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.trace-calibrate-svg circle {
  fill: #c1121f;
  stroke: #fff;
  stroke-width: 2;
}

.trace-calibrate-svg .trace-calibrate-label {
  fill: #c1121f;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}

.rooms-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.editor-chrome {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
}

.editor-chrome .room-outline {
  position: absolute;
  inset: 0;
}

.editor-chrome .units-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
}

.editor-chrome .openings-layer {
  z-index: 14;
}

.room-editor {
  position: absolute;
  box-sizing: border-box;
  overflow: visible;
  z-index: 2;
}

/* Focused room above overlaps; inactive rooms don't block handles underneath. */
.room-editor:not(.room-editor-focused) {
  pointer-events: none;
}

.room-editor-focused {
  z-index: 40;
  pointer-events: auto;
}

.room-editor .room-outline {
  position: relative;
  box-sizing: border-box;
}

.room-editor .units-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 16;
}

.room-editor > .openings-layer {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 20;
}

.room-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 2px;
  z-index: 30;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.room-resize-handle:hover {
  transform: scale(1.1);
}

.toolbar-room-meta .room-name-label input[type="text"] {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 11rem;
}

.area-summary {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.area-summary h2 {
  margin-top: 0;
}

.area-summary-storey-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
}

.area-summary-storey-total {
  font-weight: 600;
}

.area-summary-building-total {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top-width: 2px;
  font-size: 0.95rem;
}

.area-summary-plot {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.area-summary-plot-total {
  font-weight: 600;
}

.area-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.area-summary-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 4px;
}

.area-summary-list li:hover {
  color: var(--accent);
}

.area-summary-list li.is-active {
  font-weight: 600;
  color: var(--accent);
}

.area-summary-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-summary-value {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.area-summary-list li.is-active .area-summary-value {
  color: inherit;
}

.area-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0.65rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.inspector-area-line {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.inspector-shape-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}

.inspector-subhead {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.designer-readonly .room-resize-handle {
  display: none;
}

.room-editor-focused .room-outline {
  border-width: 3px;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15);
}

.room-editor:not(.room-editor-focused) .room-outline {
  border: 2px solid rgba(26, 24, 20, 0.35);
  opacity: 0.92;
}

.house-canvas:has(#storey-walls-layer) .room-outline {
  box-shadow: none;
}

.room-outline.room-outline-edges {
  border: none;
  box-shadow: none;
}

.room-editor-focused .room-outline.room-outline-edges {
  border: none;
  box-shadow: none;
}

.room-wall-edge {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  background: rgba(26, 24, 20, 0.38);
}

.room-editor-focused .room-wall-edge {
  background: var(--accent);
}

.room-wall-edge-north {
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.room-editor-focused .room-wall-edge-north,
.room-editor-focused .room-wall-edge-south {
  height: 3px;
}

.room-wall-edge-south {
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.room-wall-edge-west {
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
}

.room-wall-edge-east {
  top: 0;
  bottom: 0;
  right: 0;
  width: 2px;
}

.room-editor-focused .room-wall-edge-west,
.room-editor-focused .room-wall-edge-east {
  width: 3px;
}

.room-wall-edge.shared {
  opacity: 0;
  visibility: hidden;
}

#storey-walls-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  /* Above inactive room floors; below focused room (40) and its openings. */
  z-index: 8;
}

.storey-walls-svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

#shared-walls-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 5;
}

.shared-wall-segment {
  position: absolute;
  background: rgba(26, 24, 20, 0.55);
  box-shadow: 0 0 0 1px rgba(26, 24, 20, 0.15);
}

.room-editor-focused ~ .shared-wall-segment,
.room-editor-focused .shared-wall-segment {
  background: rgba(45, 106, 79, 0.65);
}

.room-polygon-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.room-polygon-fill {
  fill: none;
  stroke: none;
}

.room-polygon-edge-stroke {
  vector-effect: non-scaling-stroke;
}

.room-outline.shape-edit-mode {
  cursor: crosshair;
}

.shape-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.inspector-shape-tools {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.inspector-shape-selection {
  margin: 0.35rem 0 0.5rem;
}

.wall-select-svg {
  position: absolute;
  inset: 0;
  z-index: 21;
  pointer-events: none;
  overflow: visible;
}

.wall-select-stroke {
  stroke: #e9c46a;
  stroke-width: 6;
  stroke-linecap: round;
}

.room-editor > .wall-length-labels {
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  overflow: visible;
}

.wall-length-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: #1a1814;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(45, 106, 79, 0.45);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

.room-editor-focused .wall-length-label {
  border-color: var(--accent);
}

.polygon-vertices-layer {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.polygon-vertex {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  pointer-events: auto;
}

.polygon-vertex.selected {
  background: #e9c46a;
  transform: scale(1.15);
}

.polygon-vertex:active {
  cursor: grabbing;
}

.polygon-wall-handles-layer {
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
}

.polygon-wall-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 2px;
  background: #5c7cfa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  pointer-events: auto;
  transform: rotate(var(--wall-handle-angle, 0deg));
}

.polygon-wall-handle.selected {
  background: #e9c46a;
  transform: rotate(var(--wall-handle-angle, 0deg)) scale(1.12);
}

.polygon-wall-handle:active {
  cursor: grabbing;
}

.polygon-wall-handle.is-open {
  background: rgba(193, 18, 31, 0.85);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(193, 18, 31, 0.35);
}

.designer-readonly .polygon-wall-handle {
  display: none;
}

.room-outline-polygon .room-wall-edge {
  display: none;
}

.room-editor .room-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(26, 24, 20, 0.22);
  text-align: center;
  pointer-events: none;
  z-index: 3;
  user-select: none;
}

.room-editor-focused .room-label {
  color: rgba(45, 106, 79, 0.4);
}

/* Corner base: SVG L-polygon; full bbox kept for drag/select */
.placed-unit-corner {
  contain: none !important;
  background: transparent !important;
  border: none !important;
  padding: 0;
  overflow: visible;
}

.placed-unit-corner-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.placed-unit-corner-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px;
  pointer-events: none;
  user-select: none;
}

.placed-unit-corner.selected .placed-unit-corner-svg polygon {
  stroke: var(--accent, #2d6a4f);
  stroke-width: 3;
}

.placed-unit-boxing {
  border: 1px dashed rgba(26, 24, 20, 0.45);
  box-sizing: border-box;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(26, 24, 20, 0.06) 4px,
    rgba(26, 24, 20, 0.06) 8px
  );
  font-size: 0.62rem;
  line-height: 1.15;
  padding: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-boxing-hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
}

.room-editor.room-dragging .room-outline {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  opacity: 1;
}

.room-editor.room-dragging .room-label {
  color: rgba(26, 24, 20, 0.35);
}

.room-drag-tooltip {
  position: fixed;
  z-index: 2000;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  background: rgba(26, 24, 20, 0.92);
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.room-block {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(26, 24, 20, 0.3);
  border-radius: 4px;
  cursor: pointer;
  overflow: visible;
}

.room-block-header {
  display: block;
  width: 100%;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: grab;
  box-sizing: border-box;
  border-radius: 2px 2px 0 0;
  background: rgba(0, 0, 0, 0.25);
}

.room-block-header:active {
  cursor: grabbing;
}

.floor-context-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.context-room {
  position: absolute;
  border: 2px solid rgba(26, 24, 20, 0.25);
  border-radius: 4px;
  opacity: 0.55;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: opacity 0.15s;
}

.context-room:hover {
  opacity: 0.85;
  border-color: rgba(26, 24, 20, 0.5);
  z-index: 2;
}

.context-room-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  padding: 0.25rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.active-room {
  position: absolute;
  z-index: 10;
  box-sizing: border-box;
}

.active-room .units-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
}

.active-room .openings-layer {
  z-index: 14;
}

.active-room-label {
  position: absolute;
  top: 4px;
  left: 6px;
  z-index: 12;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.room-outline-active {
  position: absolute;
  inset: 0;
  border-width: 3px;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15);
  overflow: visible;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.room-outline {
  position: relative;
  background:
    linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px),
    #faf8f5;
  background-size: var(--grid-px, 5px) var(--grid-px, 5px);
  border: 2px solid var(--text);
  box-shadow: var(--shadow);
}

.finishes-panel .finish-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
}

.finishes-panel .finish-field .hp-select {
  width: 100%;
}

.guides-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.snap-guide {
  position: absolute;
  background: var(--accent);
  opacity: 0.75;
  pointer-events: none;
}

.snap-guide-v {
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
}

.snap-guide-h {
  left: 0;
  right: 0;
  height: 2px;
  margin-top: -1px;
}

.units-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.placed-unit {
  position: absolute;
  pointer-events: auto;
  border: 2px solid rgba(26, 24, 20, 0.35);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px;
  cursor: move;
  user-select: none;
  contain: layout style;
}

body.designer-dragging {
  user-select: none;
}

body.designer-dragging .room-label {
  opacity: 0.35;
}

.placed-unit[data-category="base"] { background: rgba(45, 106, 79, 0.35); }
.placed-unit[data-category="wall"] { background: rgba(69, 123, 157, 0.35); }
.placed-unit[data-category="tall"] { background: rgba(102, 78, 124, 0.35); }
.placed-unit[data-category="appliance"] { background: rgba(193, 102, 48, 0.35); }
.placed-unit[data-category="hob"],
.placed-unit[data-category="sink"],
.placed-unit[data-category="tap"],
.placed-unit[data-category="cooker"] {
  background: transparent;
}

.placed-unit.placed-unit-appliance {
  background: #faf9f6 !important;
  padding: 0;
  overflow: hidden;
  color: #1a1814;
  display: block;
  contain: none;
  border: 2px solid #1a1814;
  box-sizing: border-box;
}

.placed-unit-appliance-graphic,
.placed-unit.placed-unit-appliance .placed-unit-appliance-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: #faf9f6;
}

.placed-unit-appliance-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  font-size: clamp(6px, 1.4vw, 10px);
  line-height: 1.1;
  text-align: center;
  padding: 1px 3px 2px;
  background: rgba(250, 249, 246, 0.92);
  border-top: 1px solid rgba(26, 24, 20, 0.2);
  pointer-events: none;
}
.placed-unit[data-category="island"] { background: rgba(45, 106, 79, 0.2); border-style: dashed; }
.placed-unit[data-category="bed"] { color: #1a1814; }
.placed-unit[data-category="seating"] { color: #1a1814; }
.placed-unit[data-category="table"] { color: #1a1814; }
.placed-unit[data-category="storage"] { color: #fff; }
.placed-unit[data-category="bath"] { color: #1a1814; }
.placed-unit[data-category="shower"] { color: #fff; }
.placed-unit[data-category="toilet"] { color: #1a1814; }
.placed-unit[data-category="basin"] { color: #1a1814; }
.placed-unit[data-category="bathroom_furniture"] { color: #fff; }
.placed-unit[data-category="stairs"] {
  color: #fff;
  background-color: rgba(124, 111, 100, 0.55) !important;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(255, 255, 255, 0.22) 6px,
    rgba(255, 255, 255, 0.22) 10px
  );
  border-color: rgba(60, 50, 45, 0.65);
}

.placed-unit[data-category="mezzanine"] {
  color: #fff;
  background-color: rgba(156, 102, 68, 0.5) !important;
  border-style: double;
  border-width: 3px;
}

.placed-unit[data-category="platform"] {
  color: #fff;
  background-color: rgba(90, 125, 140, 0.5) !important;
  border-style: dashed;
}

.inspector-stairs-fields {
  margin-top: -0.35rem;
}

.inspector-structure-fields {
  display: block;
  margin-bottom: 0.75rem;
}

.inspector-structure-footprint-tools {
  margin-bottom: 0.75rem;
}

.inspector-structure-footprint-tools .inspector-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.placed-unit-structure {
  overflow: visible;
  box-sizing: border-box;
}

.placed-unit-structure .structure-polygon-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.structure-polygon-vertices-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.structure-polygon-vertices-layer .structure-polygon-vertex {
  pointer-events: auto;
}

.inspector-dims {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.inspector-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.inspector-field input[type="text"],
.inspector-field input[type="number"] {
  width: 100%;
  padding: 0.35rem 0.4rem;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  box-sizing: border-box;
}

.inspector-field input[type="text"]:focus,
.inspector-field input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.15);
}

#inspector-room > .inspector-field {
  margin-bottom: 0.75rem;
}

.inspector-color {
  margin-bottom: 0.75rem;
}

.inspector-color input[type="color"] {
  width: 100%;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.color-swatch:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

.placed-unit.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.35);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  z-index: 12;
}

.placed-unit.hidden-layer {
  opacity: 0.15;
  pointer-events: none;
}

.inspector-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.inspector-dl dt {
  color: var(--muted);
  font-weight: 600;
}

.inspector-name {
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.canvas-hint kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.75rem;
}

.canvas-hint {
  padding: 0.5rem 0.75rem;
  margin: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* 3D preview modal */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(26, 24, 20, 0.55);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(26, 24, 20, 0.2);
  width: min(960px, 100%);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#preview-3d-modal.modal-overlay {
  align-items: flex-start;
  justify-content: center;
  padding-top: 1.25rem;
}

.modal-panel-3d {
  position: relative;
  resize: both;
  overflow: hidden;
  width: min(1100px, calc(100vw - 2rem));
  height: min(720px, calc(100vh - 2.5rem));
  min-width: 520px;
  min-height: 360px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
}

.modal-panel-3d::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.55;
  background: linear-gradient(
    135deg,
    transparent 0 45%,
    var(--border) 45% 50%,
    var(--muted) 50% 100%
  );
  border-radius: 0 0 3px 0;
}

.modal-panel-share {
  width: min(28rem, 100%);
}

.snapshots-create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.snapshots-label-field {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.snapshots-list-heading {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.snapshots-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
}

.snapshots-list-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.snapshots-list-item:last-child {
  border-bottom: none;
}

.snapshots-list-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.snapshots-list-meta {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.78rem;
}

.snapshots-list-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.snapshots-modal-status.snapshots-status-error {
  color: var(--danger, #c1121f);
}

.btn-danger-text {
  color: var(--danger, #c1121f);
}

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
}

.modal-hint {
  margin: 0;
  padding: 0.5rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.preview-3d-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0.55rem 1.25rem;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.preview-3d-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.preview-3d-option input {
  margin: 0;
}

.preview-3d-error {
  margin: 1rem 1.25rem;
  padding: 0.75rem 1rem;
  background: #fde8e8;
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.9rem;
}

.preview-3d-canvas {
  flex: 1;
  min-height: 280px;
  height: auto;
  background: #d8d2c8;
  position: relative;
}

.preview-3d-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.preview-3d-canvas canvas:active {
  cursor: grabbing;
}

.preview-3d-canvas canvas:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* On-screen walk pad (3D preview + mobile viewer) */
.preview-3d-walk-pad {
  position: absolute;
  left: max(0.75rem, env(safe-area-inset-left, 0px));
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  z-index: 6;
  width: 8.75rem;
  height: 8.75rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0.3rem;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.walk-pad-btn {
  pointer-events: auto;
  touch-action: none;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.65rem;
  background: rgba(18, 22, 26, 0.32);
  color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease,
    transform 0.08s ease;
}

.walk-pad-btn:hover {
  background: rgba(18, 22, 26, 0.42);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
}

.walk-pad-btn.is-active {
  background: rgba(255, 255, 255, 0.38);
  color: rgba(18, 22, 26, 0.92);
  border-color: rgba(255, 255, 255, 0.55);
  transform: scale(0.94);
}

.walk-pad-arrow {
  display: block;
  width: 0;
  height: 0;
  border-left: 0.45rem solid transparent;
  border-right: 0.45rem solid transparent;
  border-bottom: 0.7rem solid currentColor;
  opacity: 0.92;
}

.walk-pad-left .walk-pad-arrow {
  transform: rotate(-90deg);
}

.walk-pad-right .walk-pad-arrow {
  transform: rotate(90deg);
}

.walk-pad-down .walk-pad-arrow {
  transform: rotate(180deg);
}

.walk-pad-auto {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}

.walk-pad-auto.is-active {
  background: rgba(45, 106, 79, 0.55);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}

.walk-path-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.walk-path-line {
  fill: none;
  stroke: #c45c26;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 10 8;
  opacity: 0.92;
}

.walk-path-handle {
  fill: #fff;
  stroke: #c45c26;
  stroke-width: 2.5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.walk-path-handle-start {
  fill: #2d6a4f;
  stroke: #1b4332;
}

.walkpath-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.garden-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body.designer-garden-mode .garden-layer {
  z-index: 15;
  pointer-events: auto !important;
}

.garden-boundary {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed rgba(45, 106, 79, 0.55);
  border-radius: 2px;
  pointer-events: none;
}

body.designer-garden-mode .garden-boundary.garden-boundary-editable {
  pointer-events: auto !important;
  cursor: default;
}

.garden-site-move-handle {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #2d6a4f;
  cursor: move;
  pointer-events: none;
  z-index: 5;
  color: #2d6a4f;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.garden-site-move-handle::before {
  content: "✥";
}

body.designer-garden-mode .garden-site-move-handle,
body.designer-garden-mode .garden-resize-handle,
body.designer-garden-mode .garden-item {
  pointer-events: auto !important;
  touch-action: none;
}

body.designer-garden-mode .garden-boundary.is-selected {
  border-color: rgba(45, 106, 79, 0.95);
  border-style: solid;
  box-shadow: 0 0 0 1px rgba(45, 106, 79, 0.25);
}

.garden-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 2px;
  background: #fff;
  border: 2px solid #2d6a4f;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 4;
}

.garden-resize-nw { left: 0; top: 0; cursor: nwse-resize; }
.garden-resize-n { left: 50%; top: 0; cursor: ns-resize; }
.garden-resize-ne { left: 100%; top: 0; cursor: nesw-resize; }
.garden-resize-e { left: 100%; top: 50%; cursor: ew-resize; }
.garden-resize-se { left: 100%; top: 100%; cursor: nwse-resize; }
.garden-resize-s { left: 50%; top: 100%; cursor: ns-resize; }
.garden-resize-sw { left: 0; top: 100%; cursor: nesw-resize; }
.garden-resize-w { left: 0; top: 50%; cursor: ew-resize; }

.garden-site-hint {
  margin-top: 0.5rem;
  line-height: 1.45;
}

.garden-item {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  pointer-events: none;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.88;
}

.garden-shed-designs {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.garden-shed-design-list .palette-shed-design.is-pending-place {
  outline: 2px solid var(--accent, #2d6a4f);
  outline-offset: 2px;
}

.garden-item.garden-vehicle {
  border-radius: 6px 6px 2px 2px;
}

.garden-item.garden-surface {
  z-index: 1;
  border-style: dashed;
  opacity: 0.95;
}

.garden-item:not(.garden-surface) {
  z-index: 2;
}

.garden-item.garden-surface.is-selected {
  z-index: 7;
}

.garden-item.garden-surface.is-selected .garden-resize-handle {
  z-index: 8;
}

.garden-item.is-selected {
  outline: 3px solid #2d6a4f;
  outline-offset: 1px;
  z-index: 6;
}

.garden-item-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.65);
  pointer-events: none;
  text-align: center;
  padding: 2px 4px;
  line-height: 1.2;
}

.garden-settings .inline-label {
  display: block;
  margin-bottom: 0.65rem;
}

.ruler-layer {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}

.ruler-line {
  fill: none;
  stroke: #20639b;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 12 8;
  opacity: 0.95;
}

.ruler-handle {
  fill: #ffffff;
  stroke: #20639b;
  stroke-width: 2.5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.ruler-segment-label,
.ruler-total-label {
  font-size: 12px;
  fill: #182026;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 3px;
  paint-order: stroke fill;
  font-weight: 600;
}

body.designer-walkpath-mode .room-editor {
  pointer-events: none;
}

body.designer-ruler-mode .room-editor {
  pointer-events: none;
}

body.designer-garden-mode .room-editor {
  pointer-events: none;
}

body.designer-walkpath-mode .storey-tab,
body.designer-walkpath-mode .palette,
body.designer-walkpath-mode .canvas-meta,
body.designer-walkpath-mode .zoom-controls {
  pointer-events: auto;
}

body.designer-ruler-mode .storey-tab,
body.designer-ruler-mode .palette,
body.designer-ruler-mode .canvas-meta,
body.designer-ruler-mode .zoom-controls {
  pointer-events: auto;
}

@media (pointer: fine) and (min-width: 900px) {
  .preview-3d-walk-pad {
    opacity: 0.72;
  }

  .preview-3d-walk-pad:hover {
    opacity: 1;
  }
}

/* 3D preview — full screen on phones (desktop min-width breaks small viewports) */
@media (max-width: 768px) {
  #preview-3d-modal.modal-overlay {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  #preview-3d-modal .modal-panel-3d {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    min-width: 0 !important;
    min-height: 0 !important;
    resize: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  #preview-3d-modal .modal-panel-3d::after {
    display: none;
  }

  #preview-3d-modal .modal-header {
    flex-shrink: 0;
    padding: 0.5rem 0.65rem;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    gap: 0.5rem;
    z-index: 12;
    background: var(--surface);
  }

  #preview-3d-modal .modal-header h2 {
    font-size: 1rem;
    flex: 1;
    min-width: 0;
  }

  #preview-3d-modal .modal-close {
    min-width: 2.85rem;
    min-height: 2.85rem;
    padding: 0.35rem 0.75rem;
    font-size: 1.65rem;
    flex-shrink: 0;
  }

  #preview-3d-modal .modal-hint {
    display: none;
  }

  #preview-3d-modal .preview-3d-error {
    flex-shrink: 0;
    margin: 0.5rem 0.65rem;
  }

  #preview-3d-modal .preview-3d-canvas {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
  }

  #preview-3d-modal .preview-3d-close-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: max(0.65rem, env(safe-area-inset-right, 0px));
    bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
    z-index: 1100;
    min-height: 2.85rem;
    padding: 0.45rem 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }

  #preview-3d-modal .preview-3d-walk-pad {
    left: max(0.5rem, env(safe-area-inset-left, 0px));
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    width: 7.25rem;
    height: 7.25rem;
  }
}

.preview-3d-close-fab {
  display: none;
}

.modal-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  font-family: inherit;
  line-height: 1.2;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

/* Room tabs */
.room-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.room-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid transparent;
}

.room-tab:hover { background: var(--bg); color: var(--text); }

.room-tab-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.room-tabs-overview { margin-right: 0.5rem; }

.mode-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mode-buttons {
  display: flex;
  gap: 0.25rem;
}

.mode-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.mode-btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.room-outline.wall-place-mode {
  cursor: crosshair;
  box-shadow: inset 0 0 0 3px rgba(45, 106, 79, 0.25);
}

.openings-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: visible;
}

.wall-opening {
  position: absolute;
  pointer-events: auto;
  border-radius: 2px;
  cursor: grab;
  touch-action: none;
}

.wall-opening:active {
  cursor: grabbing;
}

.wall-opening.opening-door {
  background: transparent;
  border: none;
  overflow: visible;
}

.wall-opening.opening-door.opening-door-fallback {
  background: rgba(92, 64, 51, 0.35);
  border: 2px solid #5c4033;
}

.door-swing-svg {
  display: block;
  overflow: visible;
  pointer-events: none;
}

.door-swing-svg .door-gap {
  stroke: #3d2b1f;
  stroke-width: 3;
  stroke-linecap: butt;
}

.door-swing-svg .door-arc {
  fill: none;
  stroke: #5c4033;
  stroke-width: 2;
}

.door-swing-svg .door-leaf {
  stroke: #5c4033;
  stroke-width: 1.25;
  stroke-dasharray: none;
}

.wall-opening.opening-door.selected .door-swing-svg .door-arc,
.wall-opening.opening-door.selected .door-swing-svg .door-gap,
.wall-opening.opening-door.selected .door-swing-svg .door-leaf {
  stroke: var(--accent);
}

.wall-opening.opening-door.selected .door-swing-svg .door-gap {
  stroke-width: 3.5;
}

.wall-opening.opening-window {
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  pointer-events: auto;
}

.wall-opening.opening-window .window-glass-svg {
  display: block;
  overflow: visible;
  pointer-events: none;
}

.window-glass-svg .window-jamb {
  fill: #4f6272;
  stroke: #dce8f0;
  stroke-width: 0.45;
  paint-order: stroke fill;
}

.window-glass-svg .window-rail {
  fill: #4f6272;
  stroke: none;
}

.window-glass-svg .window-glass-pane {
  fill: rgba(110, 178, 232, 0.82);
  stroke: rgba(55, 115, 170, 0.55);
  stroke-width: 0.4;
}

.window-glass-svg .window-outer-frame {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 0.65;
}

.window-glass-svg .window-glare {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.85;
  stroke-linecap: round;
}

.wall-opening.opening-window.selected .window-jamb,
.wall-opening.opening-window.selected .window-rail {
  fill: #3d6a5a;
  stroke: var(--accent);
}

.wall-opening.opening-window.selected .window-outer-frame {
  stroke: var(--accent);
  stroke-width: 1.1;
}

.wall-opening.opening-window.selected .window-glass-pane {
  fill: rgba(130, 200, 235, 0.88);
  stroke: var(--accent);
}

.wall-opening.opening-window.selected {
  z-index: 9;
}

.wall-opening.selected:not(.opening-window) {
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 9;
}


.palette-opening {
  cursor: grab;
}

.palette-opening:active {
  cursor: grabbing;
}

.palette-opening.selected {
  border-color: var(--accent);
  background: rgba(45, 106, 79, 0.12);
}

.palette-add-room {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border-top: none;
  background: transparent;
}

.palette-add-room h2,
.trace-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.palette-tab-plan .project-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.palette-tab-plan .project-form .dims-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.room-tab {
  font-family: inherit;
  cursor: pointer;
}

/* Floor plan overview */
.floor-plan-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px);
  max-width: none;
  padding: 0;
}

.floor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.floor-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
}

.floor-sidebar {
  margin: 0;
  border-radius: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}

.floor-sidebar h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
}

.floor-room-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.floor-room-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.floor-room-list a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.floor-canvas-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #e8e4dc;
}

.floor-scroll {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.floor-canvas {
  position: relative;
  min-width: 400px;
  min-height: 400px;
  background:
    linear-gradient(to right, rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 25px 25px;
}

.floor-room {
  position: absolute;
  border: 2px solid rgba(26, 24, 20, 0.45);
  border-radius: 4px;
  opacity: 0.82;
  cursor: move;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.floor-room:hover { opacity: 0.95; }

.floor-room-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  padding: 0.25rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ——— Landing page ——— */
.landing-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.landing-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2.5rem 0 3rem;
}

.landing-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.landing-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  font-weight: 700;
}

.landing-lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 32rem;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.floor-plan-mock {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(26, 24, 20, 0.12);
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}

.mock-room {
  position: absolute;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.mock-kitchen {
  left: 8%;
  top: 12%;
  width: 42%;
  height: 38%;
  background: #2d6a4f;
}

.mock-bedroom {
  left: 54%;
  top: 12%;
  width: 38%;
  height: 38%;
  background: #8ecae6;
}

.mock-living {
  left: 8%;
  top: 54%;
  width: 84%;
  height: 36%;
  background: #457b9d;
}

.landing-features {
  padding: 2rem 0;
}

.landing-features > h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.feature-icon {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.feature-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.landing-bottom-cta {
  text-align: center;
  margin-top: 2rem;
}

.landing-bottom-cta h2 {
  margin-top: 0;
}

.landing-bottom-cta .btn {
  margin: 0 0.35rem;
}

/* ——— Auth pages ——— */
.auth-page {
  max-width: 420px;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.auth-card h1 {
  margin-top: 0;
}

.auth-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.auth-form ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.field-error {
  display: block;
  color: var(--danger);
  font-weight: 500;
  font-size: 0.85rem;
}

.field-help {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
  font-size: 0.9rem;
}

.auth-footer {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
}

.settings-list-item {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.settings-list-item:hover {
  border-color: var(--accent);
  background: rgba(45, 106, 79, 0.06);
}

.settings-list-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.settings-list-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
}

.settings-list-item-danger:hover {
  border-color: var(--danger);
  background: rgba(180, 50, 50, 0.06);
}

.settings-list-item-danger .settings-list-title {
  color: var(--danger);
}

.settings-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.settings-checkbox-label input {
  width: auto;
  margin-top: 0.2rem;
}

.settings-subheading {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.totp-steps {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.totp-steps li {
  margin-bottom: 0.35rem;
}

.totp-qr-wrap {
  text-align: center;
  margin: 1rem 0;
}

.totp-secret {
  word-break: break-all;
  font-size: 0.9rem;
}

.totp-secret code {
  font-family: ui-monospace, monospace;
}

/* ——— Sharing ——— */
.shared-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(45, 106, 79, 0.12);
  border-bottom: 1px solid rgba(45, 106, 79, 0.25);
  font-size: 0.9rem;
}

.shared-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.badge-shared {
  background: rgba(45, 106, 79, 0.15);
  color: var(--accent);
}

.share-intro {
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.share-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  cursor: pointer;
}

.share-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.share-mode-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1.25rem;
  background: var(--bg);
}

.share-mode-fieldset:disabled {
  opacity: 0.55;
}

.share-legend {
  padding: 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.share-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

.share-mode-option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.share-link-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1rem;
}

.share-link-hint {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 0.2rem;
  margin-bottom: 0;
}

#share-links-wrap {
  margin-bottom: 0.5rem;
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text);
}

.share-link-row input:focus {
  outline: 2px solid rgba(45, 106, 79, 0.35);
  border-color: var(--accent);
}

.share-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-top: 1rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.share-modal-status {
  margin: 1rem 0 0;
  min-height: 1.25rem;
}

.share-modal-status:not(:empty) {
  padding: 0.5rem 0.65rem;
  background: rgba(45, 106, 79, 0.08);
  border-radius: 6px;
  color: var(--accent);
}

.designer-readonly .palette-item {
  cursor: default;
  opacity: 0.85;
}

.designer-readonly .room-block-header {
  cursor: default;
}

@media (max-width: 768px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
  .landing-hero-visual {
    order: -1;
    max-width: 400px;
    margin: 0 auto;
  }
  .header-inner .tagline {
    display: none;
  }
}

@media (max-width: 900px) {
  .designer-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .palette { border-right: none; border-bottom: 1px solid var(--border); max-height: 220px; }
  .inspector { border-left: none; border-top: 1px solid var(--border); }
  .floor-body { grid-template-columns: 1fr; }
  .floor-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* —— Mobile editor (phones) —— */
.mobile-sheet-backdrop,
.mobile-sheet-header,
.mobile-editor-bar {
  display: none;
}

.canvas-hint-mobile {
  display: none;
}

.palette-item.is-pending-place {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: rgba(45, 106, 79, 0.12);
}

@media (max-width: 768px) {
  .designer-layout {
    height: calc(100dvh - 52px);
  }

  .designer-mobile-active .designer-toolbar {
    padding: 0.45rem 0.65rem;
    gap: 0.4rem;
  }

  .designer-mobile-active .designer-toolbar .toolbar-center {
    display: none;
  }

  .designer-mobile-active .toolbar-room-meta .toolbar-fields {
    display: none;
  }

  .designer-mobile-active .designer-toolbar h1 {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
  }

  .designer-mobile-active .toolbar-actions {
    border-left: none;
    padding-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 55vw;
  }

  .designer-mobile-active .storey-bar {
    padding: 0.3rem 0.65rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .designer-mobile-active .designer-body {
    display: block;
    position: relative;
    min-height: 0;
    padding-bottom: 3.85rem;
  }

  .designer-mobile-active .palette,
  .designer-mobile-active .inspector {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 3.25rem;
    z-index: 200;
    width: auto;
    max-height: min(72dvh, 560px);
    margin: 0;
    transform: translateY(calc(100% + 4rem));
    transition: transform 0.24s ease;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-bottom: none;
    overflow: hidden;
  }

  .designer-mobile-active .palette.is-mobile-open,
  .designer-mobile-active .inspector.is-mobile-open {
    transform: translateY(0);
  }

  .designer-mobile-active .canvas-wrap {
    min-height: calc(100dvh - 11rem);
  }

  .designer-mobile-active .canvas-scroll {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
  }

  .designer-mobile-active .canvas-hint-desktop {
    display: none;
  }

  .designer-mobile-active .canvas-hint-mobile {
    display: block;
    margin: 0;
    padding: 0.35rem 0.65rem 0.5rem;
    font-size: 0.75rem;
  }

  .mobile-sheet-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(20, 18, 16, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .mobile-sheet-backdrop[hidden] {
    display: none !important;
  }

  .mobile-sheet-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
  }

  .mobile-sheet-title {
    font-weight: 700;
    font-size: 0.95rem;
  }

  .designer-mobile-active .mobile-editor-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.2rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 210;
    padding: 0.35rem 0.45rem;
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
  }

  .mobile-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 2.75rem;
    padding: 0.25rem 0.15rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-bar-btn[aria-expanded="true"] {
    background: rgba(45, 106, 79, 0.15);
    color: var(--accent);
  }

  .mobile-bar-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .designer-mobile-active .palette-item,
  .designer-mobile-active .palette-opening {
    min-height: 2.75rem;
    padding: 0.45rem 0.6rem;
  }

  .designer-mobile-active .inspector-actions .btn {
    min-height: 2.75rem;
    flex: 1;
  }

  .designer-mobile-active .inspector-field input,
  .designer-mobile-active .inspector-field select {
    min-height: 2.5rem;
    font-size: 16px;
  }
}

.mobile-editor-bar:not(:has(#btn-mobile-fit)) {
  grid-template-columns: repeat(3, 1fr);
}

.mobile-mode-tabs,
.mobile-place-banner {
  display: none;
}

@media (max-width: 768px) {
  .designer-mobile-active .mobile-mode-tabs {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 3.2rem;
    z-index: 205;
    padding: 0.35rem 0.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.06);
  }

  .mobile-mode-tabs[hidden] {
    display: none !important;
  }

  .mobile-bar-btn,
  .mobile-mode-tab {
    touch-action: manipulation;
  }

  .mobile-mode-tab {
    flex: 0 0 auto;
    min-height: 2.35rem;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
  }

  .mobile-mode-tab.is-active,
  .mobile-mode-tab[aria-selected="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .mobile-place-banner[hidden] {
    display: none !important;
  }

  .designer-mobile-active .mobile-place-banner.is-place-active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    top: calc(var(--hp-mobile-place-top, 57px) + env(safe-area-inset-top, 0px));
    z-index: 220;
    padding: 0.45rem 0.65rem;
    background: var(--accent-hover);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-size: 0.82rem;
    font-weight: 600;
    touch-action: manipulation;
  }

  /* Avoid stacking the placement bar over account suggestion banners */
  body.designer-mobile-placing .account-banners {
    visibility: hidden;
    pointer-events: none;
  }

  .designer-mobile-active .mobile-place-banner #mobile-place-cancel {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
  }

  .designer-mobile-active .designer-body {
    padding-bottom: 3.85rem;
  }

  .designer-mobile-active.designer-mobile-mode-tabs .designer-body {
    padding-bottom: 6.5rem;
  }

  .mobile-place-crosshair {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
  }

  .mobile-place-crosshair-line {
    position: absolute;
    background: rgba(45, 106, 79, 0.55);
  }

  .mobile-place-crosshair-v {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
  }

  .mobile-place-crosshair-h {
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    transform: translateY(-50%);
  }

  .designer-mobile-active .canvas-wrap.canvas-place-mode .canvas-scroll {
    cursor: crosshair;
  }

  .designer-mobile-active .placed-unit.unit-long-press-active {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(45, 106, 79, 0.25);
  }

  .designer-mobile-active .palette.is-mobile-open,
  .designer-mobile-active .inspector.is-mobile-open {
    bottom: 5.85rem;
  }
}

/* Shed designer */
.shed-palette-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.shed-palette .palette-panels {
  flex: none;
  min-height: auto;
  overflow: visible;
}

.shed-designer-body {
  grid-template-columns: 260px 1fr 300px;
}

.shed-designer-body .shed-canvas-wrap {
  flex: 1;
  min-width: 0;
  min-height: 320px;
  background: #faf8f4;
  position: relative;
  display: flex;
  flex-direction: column;
}

.shed-canvas-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.shed-plan-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.shed-plan-subtitle {
  font-size: 0.78rem;
}

.shed-designer-body .shed-canvas-wrap #shed-canvas {
  flex: 1;
  min-height: 0;
}

@media print {
  .site-header,
  .account-banners,
  .designer-toolbar,
  .shed-palette,
  .shed-inspector {
    display: none !important;
  }

  main.designer-layout {
    height: auto;
  }

  .shed-designer-body {
    display: block !important;
  }

  .shed-designer-body .shed-canvas-wrap {
    min-height: 95vh;
    background: #fff;
  }
}

.shed-designer-body #shed-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.shed-wireframe-mode {
  background: #fff;
}

.shed-structure-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0 0.75rem 1rem;
}

.shed-advanced-details {
  margin-top: 0.25rem;
}

.shed-advanced-details summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

.dims-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dims-inline input {
  width: 4.5rem;
}

.shed-bom-heading {
  margin-top: 1.25rem;
}

.shed-bom-wrap {
  overflow: auto;
  max-height: 40vh;
  margin-top: 0.5rem;
}

.shed-bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.shed-bom-table th,
.shed-bom-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  vertical-align: top;
}

.shed-bom-table th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #666);
}

.shed-bom-qty {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.shed-bom-cost-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.shed-bom-cost-row td {
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text-muted, #666);
}

.shed-bom-cost-total td {
  border-top: 2px solid rgba(0, 0, 0, 0.15);
}

.shed-bom-cost-hint td {
  font-size: 0.8rem;
  color: var(--text-muted, #666);
  font-style: italic;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.inspector-field-wide {
  grid-column: 1 / -1;
}

.timber-pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.timber-pricing-table th,
.timber-pricing-table td {
  padding: 0.25rem 0.35rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.timber-pricing-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted, #666);
}

.timber-pricing-table input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.timber-pricing-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
}

.timber-section-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.shed-join-warnings {
  margin: 0.25rem 0 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #fff8e6;
  border: 1px solid #e6c84a;
  border-radius: 6px;
  font-size: 0.8rem;
}

.shed-join-warning {
  margin: 0;
}

.shed-join-warning + .shed-join-warning {
  margin-top: 0.45rem;
}

.shed-join-warning strong {
  color: #8a6116;
}

.shed-bom-length-col,
.shed-bom-rate-col {
  white-space: nowrap;
  font-size: 0.85rem;
}

.palette-item-active {
  outline: 2px solid var(--accent, #2d6a4f);
  background: rgba(45, 106, 79, 0.08);
}
