/* PL/NTH planner — high-end brand UI (dark editorial chrome, bright 3D view). */
:root {
  /* Brand palette — light editorial chrome: paper #f7f5eb + green #645b3d.
     Depth comes from opacity/tints of these, never from a third accent hue. */
  --brown: #fbfaf4;        /* panel chrome (now paper) */
  --brown-deep: #f7f5eb;   /* topbar / deepest (cream tint) */
  --brown-soft: #ffffff;   /* cards / inputs (cream tint) */
  --charcoal: #f7f5eb;
  --cream: #645b3d;        /* body text / accent (now green) */
  --cream-hi: #574f35;     /* headings (deep olive) */
  --dim: #8f8768;          /* muted text (olive tint) */
  --paper: #f7f5eb;        /* light surfaces (the 3D bg matches) */
  --line: rgba(100,91,61,0.18);
  --line-strong: rgba(100,91,61,0.34);
  --brass: #645b3d;        /* accent = green */
  --muted: #8f8768;
  --red: #b1493d;
  --green: #5c7d46;
  --amber: #645b3d;
  --offwhite: #ffffff;     /* panel surface (genuinely off-white now) */
  --serif: "Playfair Display", "Hoefler Text", Georgia, "Times New Roman", serif;
  --panel-w: 322px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* keyboard accessibility: a consistent cream focus ring everywhere */
:focus-visible { outline: 2px solid rgba(100,91,61,0.85); outline-offset: 2px; }
.quote-sheet :focus-visible, #planOverlay :focus-visible { outline-color: rgba(100,91,61,0.7); }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--brown);
  color: var(--cream);
  font-size: 14px;
  overflow: hidden;
}
#app { position: fixed; inset: 0; }
/* stage sits BETWEEN the side panels so the room is never hidden under them */
#stage { position: absolute; top: 58px; left: var(--panel-w); right: var(--panel-w); bottom: 0; background: var(--brown-deep); }
#stage canvas { display: block; touch-action: none; width: 100% !important; height: 100% !important; }

/* ---- top brand bar ---- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--brown-deep);
  border-bottom: 1px solid var(--line-strong); z-index: 20;
}
/* wordmark — matched to the PL/NTH website logo: bold, tight tracking, solid
   brass slash, on the deep-brown chrome. */
.brand { font-size: 23px; font-weight: 800; letter-spacing: 0.14em; color: var(--cream-hi); font-family: ui-sans-serif, "Helvetica Neue", Helvetica, Arial, sans-serif; }
.brand .slash { color: var(--brass); font-weight: 600; margin: 0 0.01em; }
.brand .sub { font-size: 9.5px; letter-spacing: 0.22em; color: var(--dim); text-transform: uppercase; margin-left: 16px; font-weight: 500; }
/* the product wordmark — PL/NNER, sister mark to PL/NTH */
.brand .sub.brandmark { color: var(--cream); font-weight: 800; font-size: 23px; letter-spacing: 0.14em; opacity: 0.85; margin-left: 2px; }
.brand .sub.brandmark .slash { opacity: 0.5; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-actions button { text-transform: uppercase; letter-spacing: 0.09em; font-size: 10.5px; }

/* the guided-designer entry point — a special, always-visible invitation */
.topbar-guided {
  background: var(--cream);
  color: var(--brown-deep) !important; border: 1px solid rgba(100,91,61,0.15);
  font-weight: 600; box-shadow: 0 2px 10px rgba(100,91,61,0.25);
  position: relative;
}
.topbar-guided:hover { filter: brightness(0.96); box-shadow: 0 3px 14px rgba(100,91,61,0.35); }

/* Home / Trade mode switch */
.mode-switch {
  display: inline-flex; background: #ffffff; border: 1px solid var(--line);
  border-radius: 7px; padding: 3px; gap: 2px; margin-left: 20px;
}
.mode-switch button {
  background: transparent; color: var(--dim); border: none; cursor: pointer;
  padding: 6px 17px; font-size: 11px; letter-spacing: 0.1em; border-radius: 5px; text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.mode-switch button:hover { color: var(--cream); }
.mode-switch button.active { background: var(--cream); color: var(--brown-deep); }

/* trade panel hidden by default; toggled by body.mode-trade */
#tradePanel { display: none; }
body.mode-trade #stage,
body.mode-trade #leftPanel,
body.mode-trade #rightPanel,
body.mode-trade #viewControls,
body.mode-trade #planOverlay,
body.mode-trade #quoteOverlay,
body.mode-trade #emptyState,
body.mode-trade #selbar { display: none !important; }
body.mode-trade #tradePanel {
  display: block; position: absolute; top: 58px; left: 0; right: 0; bottom: 0;
  overflow-y: auto; background: var(--brown); color: var(--cream);
}
/* trade panel runs dark like the rest of the app */
#tradePanel .trade-title { color: var(--cream-hi); }
#tradePanel .unit-card, #tradePanel .trade-order, #tradePanel .breakdown { background: var(--brown-soft); border-color: var(--line); }
#tradePanel .unit-head, #tradePanel .unit-foot { background: #ffffff; border-color: var(--line); }
#tradePanel input, #tradePanel select { background: var(--brown-deep) !important; color: var(--cream) !important; border-color: var(--line) !important; }
#tradePanel .unit-rows th { color: var(--dim); border-color: var(--line); }
#tradePanel .unit-rows td { border-color: var(--line); }
#tradePanel .unit-rows .muted, #tradePanel .breakdown .muted, #tradePanel .unit-foot span { color: var(--dim); }
#tradePanel .unit-foot strong { color: var(--cream-hi); }
#tradePanel .breakdown th { background: var(--brown-deep); color: var(--cream); }
#tradePanel .breakdown td { border-color: var(--line); }
#tradePanel .grand { background: var(--brown-deep); }
#tradePanel .trade-head { border-color: var(--brass); }

/* ---- buttons ---- */
button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  background: var(--cream); color: var(--brown-deep); border: none;
  padding: 8px 13px; border-radius: 6px; letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, filter 0.15s;
}
/* hover DARKENS whatever the button already is — a solid olive button gets
   deeper, a light one gets a shade of grey. (The old rule flipped the
   background to white, which made paper-text buttons vanish on hover.) */
button:hover { filter: brightness(0.94); }
button.ghost { background: transparent; color: var(--cream); border: 1px solid var(--line-strong); }
button.ghost:hover { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }
button.sm { padding: 5px 10px; font-size: 12px; }
button.danger { background: transparent; color: var(--red); border: 1px solid rgba(217,117,106,0.5); }
button.danger:hover { background: var(--red); color: #fff; }
button.cta { background: var(--brass); color: var(--brown-deep); }
button.cta:hover { background: var(--cream-hi); filter: none; }

/* ---- side panels ---- */
.panel {
  position: absolute; top: 58px; bottom: 0; width: var(--panel-w);
  background: var(--brown); border-right: 1px solid var(--line-strong);
  display: flex; flex-direction: column; z-index: 15; color: var(--cream);
}
#leftPanel { left: 0; }
#rightPanel { right: 0; border-right: none; border-left: 1px solid var(--line-strong); }
.panel-head {
  padding: 13px 16px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--dim); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-body { overflow-y: auto; padding: 14px 16px; flex: 1; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 14px; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--brown-soft); color: var(--cream);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(190,183,157,0.7); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* collapsible setup dropdowns (room size / floorplan / floor & walls) */
.setup-drop { border: 1px solid var(--line); border-radius: 9px; margin-bottom: 9px; background: var(--brown-soft); padding: 0 14px; }
.setup-drop > summary {
  cursor: pointer; list-style: none; margin: 0 -14px; padding: 11px 14px;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--cream); display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-radius: 9px; transition: background 0.15s;
}
.setup-drop > summary:hover { background: rgba(100,91,61,0.04); }
.setup-drop[open] > summary { border-radius: 9px 9px 0 0; }
.setup-drop > summary::-webkit-details-marker { display: none; }
.setup-drop > summary::after { content: '⌄'; color: var(--dim); font-size: 15px; flex: 0 0 auto; }
/* live value summary on each dropdown bar — see your setup without opening it */
.sd-val {
  flex: 1 1 auto; min-width: 0; margin-left: auto; text-align: right;
  font-weight: 400; font-size: 10.5px; text-transform: none; letter-spacing: 0.02em;
  color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sd-val:empty { display: none; }
.setup-drop[open] > summary::after { content: '⌃'; }
.setup-drop[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.setup-drop > *:last-child { margin-bottom: 14px; }

/* left panel: BUILD / ROOM segmented tabs (styled like the mode-switch) */
#leftBody { display: flex; flex-direction: column; }
.lp-tabs {
  display: flex; background: #ffffff; border: 1px solid var(--line);
  border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 12px; flex: 0 0 auto;
}
.lp-tabs button {
  flex: 1; background: transparent; color: var(--dim); border: none; cursor: pointer;
  padding: 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  border-radius: 6px; text-transform: uppercase; transition: background 0.15s, color 0.15s;
}
.lp-tabs button:hover { color: var(--cream); }
.lp-tabs button.active { background: var(--cream); color: var(--brown-deep); }
#leftBody.tab-room #tabBuild { display: none; }
#leftBody:not(.tab-room) #tabRoom { display: none; }
/* gentle crossfade when switching CABINETS ⇄ ROOM */
#tabBuild, #tabRoom { animation: tabIn 0.18s ease; }
@keyframes tabIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
#tabBuild .cabinets-head { margin-top: 2px; }
#tabRoom .setup-divider { border-top: none; padding-top: 2px; margin-top: 0; }
.setup-divider {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 6px 0 10px; padding-top: 14px; border-top: 1px solid var(--line);
}
.setup-divider span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--cream); }
.setup-divider em { font-size: 10px; font-style: normal; color: var(--dim); letter-spacing: 0.02em; }

/* the cabinet catalogue is the hero of the left panel */
.cabinets-head {
  font-family: var(--serif); font-size: 24px; font-weight: 500; font-style: italic; letter-spacing: 0.01em; color: var(--cream-hi);
  margin: 20px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--brass);
}
.cabinets-head span { font-family: ui-sans-serif, system-ui, sans-serif; font-style: normal; font-size: 11px; font-weight: 400; color: var(--dim); letter-spacing: 0.02em; margin-left: 8px; }

/* section titles inside the scrolling left panel */
.section-title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim);
  font-weight: 600; padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.section-title.catalogue-title { margin-top: 18px; }
.section-note { text-transform: none; letter-spacing: 0; font-weight: 400; float: right; }

/* room dimensions: plan + fields side by side */
.space-setup { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 8px; }
.space-setup > * { min-width: 0; }
.space-plan { background: var(--brown-deep); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.space-plan svg { width: 100%; height: auto; display: block; }
.space-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.dim { margin-bottom: 0; min-width: 0; }
.field.dim label { font-size: 10px; }
.field.dim input { padding: 6px 8px; width: 100%; min-width: 0; }

/* room style */
.room-style { margin-top: 16px; }
.rs-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); margin: 12px 0 6px; }
.rs-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.rs-sw { background: none; border: 2px solid transparent; border-radius: 7px; padding: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rs-sw:hover { background: rgba(100,91,61,0.06); }
.rs-chip { width: 100%; height: 26px; border-radius: 5px; border: 1px solid rgba(100,91,61,0.18); }
.rs-sw.chip-only { padding: 2px; }
.rs-sw.chip-only .rs-chip { height: 30px; }
.rs-name { font-size: 9.5px; color: var(--dim); }
.rs-sw.active { border-color: var(--brass); }
.rs-sw.active .rs-name { color: var(--cream); font-weight: 600; }
.rs-toggles { display: flex; gap: 16px; padding: 4px 2px; flex-wrap: wrap; }
.rs-toggle { font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--cream); }

/* appliance cards read as "not Plinth" */
.cat-item.is-appliance { background: rgba(100,91,61,0.07); border-style: dashed; }
.cat-item.is-appliance .ci-meta em { font-style: normal; color: var(--brass); }

/* catalogue groups */
.cat-group { margin-bottom: 10px; }
.cat-group > summary {
  cursor: pointer; padding: 8px; font-weight: 600; letter-spacing: 0.06em;
  font-size: 12.5px; text-transform: uppercase; color: var(--cream);
  list-style: none; border-bottom: 1px solid var(--line); user-select: none;
  position: sticky; top: -14px; background: var(--brown); z-index: 2;
  display: flex; align-items: center; gap: 9px; transition: color 0.15s;
}
.cat-group > summary::-webkit-details-marker { display: none; }
.cat-group > summary::after { content: '+'; margin-left: auto; color: var(--dim); font-weight: 400; }
.cat-group[open] > summary::after { content: '–'; }
/* small line-art glyph on each family header (drawn from a representative unit) */
.cat-fam-ico { flex: 0 0 24px; width: 24px; height: 24px; opacity: 0.9; }
.cat-fam-ico svg { width: 100%; height: 100%; display: block; }
/* the icons are drawn for 78px tiles — thicken their strokes at header size */
.cat-fam-ico svg rect, .cat-fam-ico svg line, .cat-fam-ico svg path, .cat-fam-ico svg circle { stroke-width: 3.4; }
.cat-count {
  display: inline-block; margin-left: 8px; font-weight: 400; font-size: 11px;
  color: var(--dim); background: rgba(100,91,61,0.09); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 7px; vertical-align: middle;
}

/* catalogue: a clean 2-up grid of cards, each a cream line-art elevation */
.cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 11px 2px 4px;
}
.cat-item {
  text-align: center; font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px 9px; background: var(--brown-soft);
  border: 1px solid var(--line); border-radius: 10px; color: var(--cream);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.cat-item:hover { border-color: var(--brass); box-shadow: 0 6px 16px rgba(0,0,0,0.32); transform: translateY(-2px); }
.cat-item:active { transform: translateY(0) scale(0.99); transition-duration: 0.06s; }
.cat-thumb {
  width: 100%; height: 78px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.cat-thumb svg { width: auto; height: 100%; max-width: 100%; display: block; }
.cat-item .ci-code { font-weight: 700; font-size: 12px; letter-spacing: 0.04em; color: var(--cream-hi); }
.cat-item .ci-desc {
  font-size: 11px; color: var(--cream); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-item .ci-meta { font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; margin-top: 2px; }

/* finishes (cabinet colour — the product, kept prominent) */
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.swatch { cursor: pointer; border: 2px solid transparent; border-radius: 8px; padding: 4px; text-align: center; transition: border-color 0.15s, transform 0.15s; }
.swatch:hover { transform: translateY(-1px); }
.swatch .chip { width: 100%; height: 40px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15); box-shadow: inset 0 -6px 10px rgba(0,0,0,0.12); }
.swatch .sw-name { font-size: 10px; margin-top: 4px; color: var(--dim); letter-spacing: 0.02em; }
.swatch.active { border-color: var(--brass); }
.swatch.active .chip { box-shadow: inset 0 -6px 10px rgba(0,0,0,0.12), 0 0 0 2px var(--brown), 0 0 0 3px var(--brass); }
.swatch.active .sw-name { color: var(--cream); font-weight: 600; }
.fin-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin: 14px 0 7px; }
.fin-group-label:first-child { margin-top: 2px; }

/* cost */
.cost-line {
  display: flex; justify-content: space-between; padding: 6px 4px; margin: 0 -4px;
  border-bottom: 1px solid var(--line); font-size: 12px; gap: 8px;
  border-radius: 4px; transition: background 0.15s;
  font-variant-numeric: tabular-nums;
}
.cost-line:hover { background: rgba(100,91,61,0.05); }
.cost-line .cl-desc { color: var(--dim); }
.cost-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--brass); font-weight: 600; font-size: 14px; color: var(--cream-hi); }
.cost-total span:last-child { font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: 0.01em; }
.cost-delivery { font-size: 12px; color: var(--cream); margin-top: 8px; padding: 8px 10px; background: rgba(100,91,61,0.07); border: 1px solid rgba(100,91,61,0.28); border-radius: 6px; }
.cost-delivery strong { color: var(--brass); }
.cost-note { font-size: 10px; color: var(--dim); margin-top: 8px; line-height: 1.5; }

/* selected item bar */
#selbar {
  /* contextual toolbar at the TOP of the stage — never collides with the
     view controls at the bottom, however far they wrap */
  position: absolute; top: 70px; bottom: auto; left: 50%; transform: translateX(-50%);
  background: var(--brown-deep); color: var(--cream); border-radius: 9px;
  padding: 8px 12px; display: none; gap: 10px; align-items: center; z-index: 18;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); font-size: 13px; border: 1px solid var(--line);
}
#selbar.show { display: flex; animation: selbarIn 0.18s ease; }
@keyframes selbarIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#selLabel { font-weight: 600; white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
#selbar button { background: rgba(100,91,61,0.12); color: var(--cream); }
#selbar button:hover { background: rgba(255,255,255,0.24); }
#selbar select {
  background: rgba(100,91,61,0.12); color: var(--cream);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
  padding: 5px 8px; font-size: 12px; max-width: 240px; cursor: pointer;
}
#selbar select option { background: var(--brown-deep, #fffdf4); color: var(--cream); }

.hint { font-size: 11px; color: var(--dim); line-height: 1.6; }
kbd {
  font-family: inherit; font-size: 10px; background: var(--brown-soft); color: var(--cream);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

/* floating view controls — ONE toolbar with labeled clusters (View / Navigate / Output),
   bottom-left of the 3D stage. Wraps inside the stage, never over the panels. */
#viewControls {
  position: absolute; left: calc(var(--panel-w) + 16px); right: auto;
  max-width: calc(100% - 2 * var(--panel-w) - 32px);
  bottom: 16px; z-index: 14;
  display: flex; gap: 0; align-items: stretch; flex-wrap: wrap;
  background: rgba(255,255,255,0.94); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 7px 6px 8px;
  backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.vc-group { display: flex; flex-direction: column; gap: 5px; padding: 0 10px; }
.vc-group + .vc-group { border-left: 1px solid var(--line); }
.vc-label {
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--dim); padding-left: 2px; user-select: none;
}
.vc-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vc-btn {
  background: rgba(255,255,255,0.94); color: var(--cream); border: 1px solid var(--line-strong);
  padding: 8px 12px; border-radius: 7px; font-size: 12px;
}
#viewControls .vc-btn {
  background: rgba(100,91,61,0.07); border-color: transparent;
  box-shadow: none; padding: 7px 11px;
}
.vc-btn:hover { background: var(--brown-deep); border-color: var(--brass); }
#viewControls .vc-btn:hover { background: rgba(100,91,61,0.16); border-color: transparent; }
.vc-btn.active, #viewControls .vc-btn.active { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }
.vc-btn:disabled { opacity: 0.35; cursor: default; }
.vc-btn:disabled:hover, #viewControls .vc-btn:disabled:hover { background: rgba(100,91,61,0.07); border-color: transparent; }
#viewControls .view-switch { box-shadow: none; backdrop-filter: none; background: #ffffff; border-color: var(--line); }

/* live dimensions chip while dragging a cabinet */
#dimChip {
  position: fixed; z-index: 60; display: none; pointer-events: none;
  background: rgba(255,255,255,0.94); color: var(--cream);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 10px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  font-variant-numeric: tabular-nums;
}
#dimChip b { font-weight: 700; }
#dimChip small { opacity: 0.65; }

/* compare tray — up to three kept ideas, top-right of the stage */
#ideaTray {
  position: absolute; top: 70px; right: calc(var(--panel-w) + 16px); z-index: 17;
  display: none; flex-direction: column; gap: 8px; align-items: flex-end;
}
#ideaTray .tray-label { font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.idea-thumb {
  position: relative; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px;
  overflow: hidden; background: var(--brown-deep); cursor: pointer; width: 128px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35); transition: transform 0.15s ease, border-color 0.15s;
}
.idea-thumb:hover { transform: translateY(-2px); border-color: var(--cream); }
.idea-thumb img { display: block; width: 100%; height: 76px; object-fit: cover; }
.idea-thumb span {
  position: absolute; right: 4px; bottom: 4px; background: rgba(100,91,61,0.85); color: var(--cream);
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
}
@media (max-width: 820px) { #ideaTray { right: 8px; top: 104px; } }

/* branded generation flash — "Sketching your kitchen…" */
#wzFlash {
  position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center;
  background: rgba(100,91,61,0.45); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
#wzFlash.show { opacity: 1; }
#wzFlash span {
  font-family: var(--serif); font-style: italic; font-size: 30px; color: var(--cream);
  text-shadow: 0 2px 16px rgba(0,0,0,0.45); animation: flashPulse 0.9s ease infinite alternate;
}
@keyframes flashPulse { from { opacity: 0.7; } to { opacity: 1; } }

/* rule-violation flag while dragging (e.g. cabinet over a window) */
#ruleFlag {
  position: fixed; z-index: 61; display: none; pointer-events: none;
  background: var(--red, #b1392b); color: #fff;
  border-radius: 7px; padding: 6px 10px; font-size: 12px; font-weight: 600;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* segmented view switch */
.view-switch {
  display: inline-flex; background: rgba(255,255,255,0.94); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 3px; gap: 2px; backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.view-switch button {
  background: transparent; color: var(--dim); border: none; cursor: pointer;
  padding: 6px 11px; font-size: 11.5px; letter-spacing: 0.06em; border-radius: 6px;
  text-transform: uppercase; transition: background 0.15s, color 0.15s;
}
.view-switch button:hover { color: var(--cream); }
.view-switch button.active { background: var(--cream); color: var(--brown-deep); }

/* wall fit */
#wallFit { margin-bottom: 12px; }
.wf-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.wf-tab {
  flex: 1; background: var(--brown-soft); color: var(--dim); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 4px; font-size: 11px; letter-spacing: 0.03em; cursor: pointer;
}
.wf-tab:hover { border-color: var(--brass); color: var(--cream); }
.wf-tab.active { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }
.wf-bar { height: 8px; background: #ffffff; border-radius: 5px; overflow: hidden; margin: 2px 0 5px; }
.wf-bar > div { height: 100%; background: var(--green); transition: width 0.2s; }
.wf-bar.over > div { background: var(--red); width: 100% !important; }
.wf-stats { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.wf-fill {
  width: 100%; margin-top: 8px; padding: 8px; cursor: pointer;
  background: var(--brass); color: var(--brown-deep); border: none; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.wf-fill:hover { filter: brightness(1.08); }

/* click-a-wall popup */
.wall-menu {
  position: fixed; z-index: 50; min-width: 140px; padding: 6px;
  background: var(--brown-deep); border: 1px solid var(--brass); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); display: flex; flex-direction: column; gap: 3px;
}
.wall-menu .wm-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); padding: 4px 8px 2px; }
.wall-menu button {
  text-align: left; background: none; border: none; color: var(--cream); cursor: pointer;
  font-size: 13px; padding: 7px 10px; border-radius: 6px;
}
.wall-menu button:hover { background: var(--brown-soft); color: var(--cream-hi); }

/* wall show/hide toggles */
.wall-toggles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.wall-toggles button {
  padding: 7px 2px; cursor: pointer; font-size: 11px; border-radius: 6px;
  background: var(--brown-deep); color: var(--dim); border: 1px solid var(--line);
}
.wall-toggles button.on { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }

/* doors & windows manager */
.op-add { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.op-wall { width: 100%; padding: 7px 8px; border-radius: 6px; background: var(--brown-soft); color: var(--cream); border: 1px solid var(--line); font-family: inherit; font-size: 12px; }
.op-btns { display: flex; gap: 6px; }
.op-btns button {
  flex: 1; padding: 8px 4px; cursor: pointer; font-size: 11px; font-weight: 600;
  background: var(--brown-soft); color: var(--cream); border: 1px solid var(--line); border-radius: 6px;
}
.op-btns button:hover { border-color: var(--brass); color: var(--cream-hi); }
.op-row { background: var(--brown-soft); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 7px; }
.op-head { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--cream); }
.op-del { background: none; border: none; color: var(--dim); font-size: 16px; cursor: pointer; line-height: 1; padding: 0 2px; }
.op-del:hover { color: var(--red); }
.op-controls { display: grid; grid-template-columns: 1fr 56px; gap: 8px; align-items: center; margin-top: 8px; }
.op-controls input[type=range] { width: 100%; min-width: 0; }
.op-w { padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-deep); color: var(--cream); font-size: 12px; min-width: 0; width: 100%; }
.op-dist { font-size: 10px; color: var(--dim); margin-top: 5px; font-variant-numeric: tabular-nums; }
.op-mini { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--dim); }
.op-mini input { width: 100%; min-width: 0; padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-deep); color: var(--cream); font-size: 12px; }
.op-win { grid-template-columns: 1fr 1fr; }

/* guided setup wizard — one scrolling card, sticky CTA footer, editorial type */
#wizard { position: fixed; inset: 0; z-index: 70; background: rgba(70,63,42,0.42); display: none; align-items: center; justify-content: center; padding: 20px; }
#wizard.show { display: flex; }
.wz-card {
  position: relative; width: 100%; max-width: 600px; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, var(--brown), var(--brown-deep)); color: var(--cream);
  border: 1px solid rgba(100,91,61,0.3); border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
}
.wz-scroll { overflow-y: auto; padding: 32px 32px 16px; min-height: 0; }
.wz-x { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--dim); font-size: 22px; cursor: pointer; line-height: 1; z-index: 2; }
.wz-x:hover { color: var(--cream); }
.wz-eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--brass); }
.wz-card h2 { font-family: var(--serif); font-style: italic; font-size: 30px; font-weight: 500; color: var(--cream-hi); margin: 8px 0 4px; letter-spacing: 0.005em; }
.wz-sub { font-size: 13px; color: var(--dim); margin: 0 0 8px; line-height: 1.55; max-width: 46ch; }
/* each step is a quiet section under a hairline divider */
.wz-sec { padding: 20px 0 4px; margin-top: 16px; border-top: 1px solid var(--line); }
.wz-sec:last-child { padding-bottom: 8px; }
.wz-step { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.wz-n {
  display: inline-flex; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--cream); background: transparent;
  align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; transform: translateY(-2px);
}
.wz-lead { font-family: var(--serif); font-style: italic; font-size: 19px; font-weight: 500; color: var(--cream-hi); letter-spacing: 0.005em; white-space: nowrap; }
.wz-step .wz-hint { font-size: 11px; color: var(--dim); letter-spacing: 0; line-height: 1.4; }
/* shape cards: plan glyph + name + one-liner */
.wz-shapes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.wz-shape {
  text-align: left; cursor: pointer; background: var(--brown-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 3px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.wz-shape:hover { border-color: var(--line-strong); }
.wz-shape.on { border-color: var(--cream); background: var(--brown); box-shadow: 0 0 0 1px var(--cream) inset; }
.wz-glyph { display: block; width: 52px; margin-bottom: 8px; }
.wz-glyph svg { display: block; width: 100%; height: auto; }
.wz-glyph .g-room { fill: none; stroke: rgba(100,91,61,0.32); stroke-width: 1.2; }
.wz-glyph .g-run { fill: none; stroke: rgba(100,91,61,0.75); stroke-width: 3.4; stroke-linecap: round; }
.wz-glyph .g-isl { fill: rgba(100,91,61,0.75); }
.wz-shape.on .g-run { stroke: var(--cream-hi); }
.wz-shape.on .g-isl { fill: var(--cream-hi); }
.wz-shape.on .g-room { stroke: rgba(100,91,61,0.5); }
.wz-shape-name { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--cream-hi); }
.wz-shape-desc { font-size: 10px; color: var(--dim); line-height: 1.35; }
.wz-sizes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.wz-sizes label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); display: flex; flex-direction: column; gap: 4px; }
.wz-sizes input { width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--brown-soft); color: var(--cream); font-size: 13px; min-width: 0; font-variant-numeric: tabular-nums; }
/* step 3: live top-down room diagram beside the wall controls */
.wz-doorgrid { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 16px; align-items: start; }
.wz-map { background: #ffffff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.wz-map svg { display: block; width: 100%; height: auto; }
.wz-map .g-wall { stroke: rgba(100,91,61,0.35); stroke-width: 1.6; stroke-linecap: square; }
.wz-map .g-wall.on { stroke: var(--cream-hi); stroke-width: 2.4; }
.wz-map .g-cab { fill: rgba(100,91,61,0.10); stroke: rgba(100,91,61,0.28); stroke-width: 0.7; }
.wz-map .g-win { stroke: var(--cream); stroke-width: 3; opacity: 0.85; }
.wz-map .g-door { stroke: var(--cream-hi); stroke-width: 1.8; stroke-linecap: round; }
.wz-map .g-arc { fill: none; stroke: rgba(100,91,61,0.55); stroke-width: 1; stroke-dasharray: 3 2.5; }
.wz-map .g-lab { fill: rgba(100,91,61,0.45); font: 600 7.5px ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; }
.wz-map .g-lab.on { fill: var(--cream-hi); }
.wz-map .g-winlab { letter-spacing: 0.08em; font-weight: 500; fill: rgba(100,91,61,0.4); }
.wz-map .g-dim { fill: rgba(100,91,61,0.4); font: 500 8px ui-sans-serif, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.wz-doorctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wz-doors { display: grid; grid-template-columns: repeat(4, 1fr); }
.wz-doorpos { grid-template-columns: 1.4fr 1fr; }
.wz-note { font-size: 11px; color: var(--dim); line-height: 1.55; margin: 0; }
/* appliance interview (wizard step 4) — segmented choices, one design language */
.wz-appl { display: flex; flex-direction: column; gap: 8px; }
.wz-appl-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; }
.wz-appl-lab { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
.wz-seg { display: flex; background: #ffffff; border: 1px solid var(--line); border-radius: 7px; padding: 3px; gap: 2px; }
.wz-seg button { flex: 1; background: transparent; color: var(--dim); border: none; cursor: pointer; padding: 7px 8px; font-size: 11.5px; border-radius: 5px; transition: background 0.15s, color 0.15s; }
.wz-seg button:hover { color: var(--cream); }
.wz-seg button.on { background: var(--cream); color: var(--brown-deep); font-weight: 600; }
/* finishes — bigger paint chips, the chosen one ringed in cream */
.wz-finishes { display: flex; flex-wrap: wrap; gap: 8px; }
.wz-fin {
  display: flex; align-items: center; gap: 7px; cursor: pointer; background: var(--brown-soft);
  border: 1px solid var(--line); border-radius: 24px; padding: 4px 12px 4px 4px;
  font-size: 11.5px; color: var(--cream); transition: border-color 0.15s;
}
.wz-fin:hover { background: var(--brown-soft); border-color: var(--line-strong); }
.wz-fin span { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.25); }
.wz-fin.on { border-color: var(--cream); color: var(--cream-hi); font-weight: 600; }
.wz-fin.on span { box-shadow: 0 0 0 2px var(--brown-deep), 0 0 0 3.5px var(--cream); }
/* sticky footer inside the card — the CTA never scrolls away */
.wz-foot {
  flex: 0 0 auto; display: flex; gap: 16px; align-items: center;
  padding: 14px 32px; border-top: 1px solid var(--line-strong);
  background: #ffffff;
}
.wz-skip { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.wz-skip:hover { color: var(--cream); }
.wz-build { margin-left: auto; padding: 12px 24px; font-weight: 600; }

/* share + book CTAs */
.share-row { display: flex; gap: 8px; margin-top: 8px; }
.share-row button { flex: 1; }
.book-cta {
  display: block; text-align: center; margin-top: 8px; padding: 11px; border-radius: 7px;
  background: var(--brass); color: var(--brown-deep); font-weight: 700; font-size: 13px;
  text-decoration: none; letter-spacing: 0.02em;
}
.book-cta:hover { filter: brightness(1.07); }

/* budget target + over/under */
.budget-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.budget-row label { font-size: 11px; color: var(--dim); white-space: nowrap; }
.budget-row label span { opacity: 0.7; }
.budget-row input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--brown-soft); color: var(--cream); font-size: 13px; }
.budget-readout { margin-top: 7px; font-size: 12px; padding: 7px 10px; border-radius: 6px; display: none; }
.budget-readout.under, .budget-readout.over { display: block; }
.budget-readout.under { background: rgba(74,122,58,0.16); border: 1px solid rgba(74,122,58,0.5); color: #bfe0ad; }
.budget-readout.over { background: rgba(204,112,102,0.14); border: 1px solid rgba(204,112,102,0.5); color: #e8b6ae; }

/* what's included / next steps */
.incl-drop { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--brown-soft); padding: 0 12px; }
.incl-drop > summary { cursor: pointer; list-style: none; padding: 10px 0; font-size: 12px; font-weight: 600; color: var(--cream); display: flex; justify-content: space-between; }
.incl-drop > summary::-webkit-details-marker { display: none; }
.incl-drop > summary::after { content: '⌄'; color: var(--dim); }
.incl-drop[open] > summary::after { content: '⌃'; }
.incl-list { margin: 0 0 10px; padding-left: 18px; font-size: 11.5px; color: var(--cream); line-height: 1.6; }
.incl-list li { margin-bottom: 2px; }
.incl-next { font-size: 11.5px; color: var(--dim); line-height: 1.55; padding-bottom: 12px; }
.incl-next strong { color: var(--cream); }

/* loose accessories (qty steppers) */
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border-bottom: none; }
.acc-info { font-size: 11.5px; color: var(--cream); line-height: 1.35; }
.acc-info strong { color: var(--cream-hi); }
.acc-info em { display: block; font-style: normal; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.acc-step { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.acc-step button {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1;
  background: var(--brown-soft); color: var(--cream); border: 1px solid var(--line);
}
.acc-step button:hover { border-color: var(--brass); color: var(--cream-hi); }
.acc-qty { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cream); }
.acc-row.has .acc-qty { color: var(--brass); font-weight: 700; }

/* cornice accessory picker */
.cornice-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.cornice-opt {
  cursor: pointer; background: var(--brown-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 5px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; transition: border-color 0.15s, background 0.15s;
}
.cornice-opt:hover { border-color: var(--brass); }
.cornice-opt.active { border-color: var(--brass); background: var(--brown); }
.co-cap { width: 100%; height: 26px; }
.co-cap svg { width: 100%; height: 100%; display: block; }
.co-name { font-size: 10.5px; color: var(--cream); text-align: center; line-height: 1.2; }
.co-rate { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cornice-readout { margin-top: 10px; font-size: 11.5px; color: var(--cream); line-height: 1.45; }
.cornice-readout em { color: var(--dim); font-style: normal; }

/* live design warnings */
#warnings { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.warn-item {
  display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; line-height: 1.4;
  padding: 8px 10px; border-radius: 6px; border: 1px solid;
}
.warn-ico {
  flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%; text-align: center;
  font-size: 11px; font-weight: 700; line-height: 16px; font-style: italic;
}
.warn-error { background: rgba(177,57,43,0.14); border-color: rgba(177,57,43,0.5); color: #e8b6ae; }
.warn-error .warn-ico { background: var(--red); color: #fff; font-style: normal; }
.warn-warn { background: rgba(100,91,61,0.08); border-color: rgba(100,91,61,0.35); color: var(--cream); }
.warn-warn .warn-ico { background: var(--brass); color: var(--brown-deep); }

/* quick-start template cards */
.qs-grid { display: flex; flex-direction: column; gap: 7px; }
.qs-card {
  text-align: left; cursor: pointer; background: var(--brown-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; transition: border-color 0.15s, background 0.15s;
}
.qs-card:hover { border-color: var(--brass); background: var(--brown); }
.qs-name { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--cream-hi); }
.qs-desc { font-size: 11px; color: var(--dim); line-height: 1.35; }

/* room style sliders */
.rs-slider { margin-top: 10px; }
.rs-slider label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin-bottom: 4px; }
.rs-slider input[type=range] { width: 100%; accent-color: var(--brass); }
.rs-dim { display: grid; grid-template-columns: 1fr 70px; gap: 8px; align-items: center; }
.rs-dim .dim-in {
  font-family: inherit; font-size: 13px; padding: 6px 8px; text-align: center;
  border: 1px solid var(--line); border-radius: 4px; background: var(--brown-soft); color: var(--cream);
  font-variant-numeric: tabular-nums;
}

/* onboarding overlay shown over the empty room */
#emptyState {
  position: absolute; top: 58px; left: var(--panel-w); right: var(--panel-w); bottom: 0; z-index: 14;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
#emptyState .es-card {
  position: relative; pointer-events: auto;
  background: linear-gradient(180deg, rgba(255,253,244,0.97), rgba(243,239,226,0.97));
  border: 1px solid rgba(100,91,61,0.3); border-radius: 18px;
  padding: 30px 34px 28px; max-width: 380px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45); color: var(--cream);
  backdrop-filter: blur(3px); animation: esIn 0.35s ease;
}
@keyframes esIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#emptyState .es-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--brass); margin-bottom: 8px;
}
#emptyState .es-card h3 { margin: 0 0 4px; font-family: var(--serif); font-style: italic; font-size: 27px; font-weight: 500; color: var(--cream-hi); }
/* three steps as a horizontal mini-timeline: cream number circles joined by hairlines */
#emptyState .es-tour { display: flex; align-items: flex-start; justify-content: center; margin: 22px 0 4px; }
#emptyState .es-t-step { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--cream); line-height: 1.45; }
#emptyState .es-t-step p { margin: 9px 4px 0; color: var(--dim); }
#emptyState .es-t-step p strong { color: var(--cream); font-weight: 600; }
#emptyState .es-t-step .n {
  display: block; width: 28px; height: 28px; margin: 0 auto; border-radius: 50%;
  background: var(--cream); color: var(--brown-deep); line-height: 28px; font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
#emptyState .es-t-line { flex: 0 0 26px; height: 1px; background: var(--line-strong); margin-top: 14px; }
#emptyState .es-cta {
  margin-top: 20px; width: 100%; padding: 12px; font-size: 13.5px; font-weight: 600;
  letter-spacing: 0.04em; border-radius: 8px;
}
#emptyState .es-blank { margin-top: 10px; }
#emptyState .es-blank button {
  background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 11.5px; text-decoration: underline; text-underline-offset: 3px; padding: 4px 6px;
}
#emptyState .es-blank button:hover { color: var(--cream); }
#emptyState .es-close {
  position: absolute; top: 12px; right: 14px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(100,91,61,0.06); border: 1px solid rgba(100,91,61,0.12);
  color: var(--cream); font-size: 17px; line-height: 1; cursor: pointer; transition: background 0.15s, color 0.15s;
}
#emptyState .es-close:hover { background: var(--brass); color: var(--brown-deep); border-color: var(--brass); }
#emptyState.hidden { display: none; }

/* technical floor-plan overlay */
#planOverlay {
  position: absolute; top: 56px; left: var(--panel-w); right: var(--panel-w); bottom: 0;
  z-index: 17; background: #fff; display: none; flex-direction: column;
}
#planOverlay.show { display: flex; }
.plan-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--offwhite);
}
.plan-title { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.plan-actions { display: flex; gap: 8px; }
.plan-host { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; background: #fff; }
.plan-host svg { width: 100%; height: 100%; max-width: 1100px; }

/* ---- branded quote / spec sheet ---- */
#quoteOverlay {
  position: absolute; top: 56px; left: var(--panel-w); right: var(--panel-w); bottom: 0;
  z-index: 18; background: #d8cdb8; display: none; flex-direction: column;
}
#quoteOverlay.show { display: flex; }
.quote-host { flex: 1; overflow: auto; padding: 24px; display: flex; justify-content: center; }
.quote-sheet {
  width: 100%; max-width: 760px; background: #fbf7ee; color: #574f35;
  padding: 40px 44px; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  font-family: ui-sans-serif, system-ui, Arial, sans-serif; font-size: 12.5px; line-height: 1.5;
  align-self: flex-start;
}
.q-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #574f35; padding-bottom: 14px; }
.q-brand { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: 0.06em; color: #574f35; }
.q-brand span { color: #8f8768; }  /* slash must read on the cream sheet */
.q-headmeta { text-align: right; }
.q-title { font-family: var(--serif); font-style: italic; font-size: 22px; color: #574f35; }
.q-sub { font-size: 11px; color: #8f8768; letter-spacing: 0.04em; }
.q-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin: 20px 0 8px; }
.q-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; color: #a49b7e; margin-bottom: 3px; }
.q-val { font-size: 14px; color: #574f35; font-weight: 600; }
.q-val .q-chip { display: inline-block; width: 11px; height: 11px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.15); margin-right: 5px; vertical-align: -1px; }
.q-dim { font-size: 11px; color: #8f8768; }
.q-hero { margin: 14px 0 4px; position: relative; }
.q-hero img { display: block; width: 100%; border-radius: 4px; border: 1px solid #e2d8c2; }
.q-hero-cap { display: block; margin-top: 5px; font-size: 10px; color: #7d7558; font-style: italic; }
.q-plan { margin: 16px 0; border: 1px solid #e2d8c2; background: #fff; padding: 10px; }
.q-plan svg { width: 100%; height: auto; max-height: 360px; display: block; }
.q-schedule h3 { font-family: var(--serif); font-style: italic; font-size: 16px; margin: 18px 0 8px; color: #574f35; font-weight: 500; }
.q-schedule h3.q-appl span { font-family: ui-sans-serif, sans-serif; font-style: normal; font-size: 11px; color: #a49b7e; font-weight: 400; }
.q-schedule table { width: 100%; border-collapse: collapse; }
.q-schedule th { text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: #a49b7e; border-bottom: 1px solid #d8ccb4; padding: 4px 6px; }
.q-schedule td { padding: 5px 6px; border-bottom: 1px solid #efe7d5; }
.q-code { font-weight: 600; color: #574f35; white-space: nowrap; }
.q-dims { color: #8f8768; font-variant-numeric: tabular-nums; }
.q-num { text-align: right; font-variant-numeric: tabular-nums; }
.q-totals { margin-top: 16px; border-top: 2px solid #574f35; padding-top: 12px; }
.q-tline { display: flex; justify-content: space-between; padding: 3px 0; color: #5c5535; }
.q-grand { font-family: var(--serif); font-size: 18px; color: #574f35; font-weight: 600; }
.q-delivery { margin-top: 8px; background: rgba(100,91,61,0.06); border: 1px solid rgba(100,91,61,0.22); border-radius: 5px; padding: 8px 10px; font-size: 12px; color: #4c452b; }
.q-foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid #e2d8c2; font-size: 10px; color: #a49b7e; line-height: 1.5; }

@media print {
  body * { visibility: hidden !important; }
  #planOverlay.show, #planOverlay.show *,
  #quoteOverlay.show, #quoteOverlay.show * { visibility: visible !important; }
  #planOverlay.show, #quoteOverlay.show { position: fixed; inset: 0; display: flex !important; background: #fff; }
  .plan-toolbar { display: none !important; }
  .quote-host { overflow: visible !important; padding: 0 !important; }
  .quote-sheet { box-shadow: none !important; max-width: none !important; }
}
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--brown); color: var(--cream); padding: 10px 18px;
  border-radius: 6px; font-size: 13px; z-index: 9999; box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

/* ---- post-build results bar (non-blocking, after the wizard generates) ---- */
.wz-result {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(140%);
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; z-index: 50;
  max-width: min(920px, 94vw);
  background: var(--brown); color: var(--cream); border: 1px solid var(--line-strong);
  padding: 9px 12px 9px 16px; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .25s ease;
}
.wz-result-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wz-budgetline { font-size: 12px; padding: 6px 8px; border-radius: 6px; background: rgba(100,91,61,0.07); }
.wz-budgetline.ok { border-left: 3px solid var(--green, #4a7a3a); }
.wz-budgetline.over { border-left: 3px solid var(--red, #b1392b); }
.wz-why { display: flex; flex-wrap: wrap; gap: 6px; }
.wz-chip {
  background: rgba(100,91,61,0.08); color: var(--cream); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; font-size: 10.5px; cursor: pointer; text-align: left;
}
.wz-chip:hover { background: rgba(100,91,61,0.18); }
.wz-chip.on { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }
.wz-result.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.wz-result-msg { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--cream-hi); margin-right: 4px; }
.wz-result button.sm { padding: 7px 12px; font-size: 12px; border-radius: 6px; }
.wz-result-go { margin-left: auto; }     /* the primary action pins to the row's right end */
/* the rationale folds away behind one quiet line until asked for */
.wz-whyd summary {
  font-size: 11px; color: var(--dim); cursor: pointer; list-style: none; user-select: none;
}
.wz-whyd summary::-webkit-details-marker { display: none; }
.wz-whyd summary:hover { color: var(--cream); }
.wz-whyd[open] summary { margin-bottom: 6px; }
/* while the result bar is up, the view controls step aside (nothing hides under it) */
body.wz-reviewing #viewControls, body.wz-reviewing #selbar {
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
@media (max-width: 640px) { .wz-result { flex-wrap: wrap; max-width: 92vw; justify-content: center; } }

/* ---- Cloud account modal ---- */
#cloudModal { position: fixed; inset: 0; z-index: 60; background: rgba(70,63,42,0.42); display: none; align-items: center; justify-content: center; }
#cloudModal.show { display: flex; }
.cloud-card { position: relative; background: var(--brown); border: 1px solid var(--line-strong); color: var(--cream); border-radius: 12px; padding: 28px 28px 24px; width: 380px; max-width: 92vw; box-shadow: 0 24px 70px rgba(0,0,0,0.5); }
.cloud-card h3 { margin: 0 0 4px; font-family: var(--serif); font-style: italic; font-size: 22px; font-weight: 500; color: var(--cream-hi); }
.cloud-sub { font-size: 12px; color: var(--dim); margin: 0 0 16px; }
.cloud-x { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 22px; color: var(--dim); cursor: pointer; padding: 0; }
.cloud-tabs { display: flex; gap: 4px; background: #ffffff; border: 1px solid var(--line); border-radius: 7px; padding: 3px; margin-bottom: 14px; }
.cloud-tabs button { flex: 1; background: none; border: none; padding: 7px; font-size: 12px; border-radius: 5px; cursor: pointer; color: var(--dim); }
.cloud-tabs button.active { background: var(--cream); color: var(--brown-deep); }
#cloudModal form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin-bottom: 12px; }
#cloudModal input { font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-soft); color: var(--cream); }
#cloudModal .cta { width: 100%; padding: 11px; }
.cloud-foot { text-align: right; margin-top: 8px; }
.cloud-msg { font-size: 12px; margin-top: 10px; color: var(--muted); }
.cloud-msg.err { color: var(--red); }
.cloud-msg.ok { color: var(--green); }
.cloud-save { display: flex; gap: 8px; margin-bottom: 14px; }
.cloud-save input { flex: 1; }
.cloud-list { max-height: 260px; overflow-y: auto; }
.design-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.design-row em { color: var(--muted); font-style: normal; font-size: 11px; }
.linkbtn { background: none; border: none; color: var(--green); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.linkbtn.danger { color: var(--red); }

/* on-brand confirm/alert dialogs (dialog.js) — same paper card as the modal */
#uiDialog, #dxfGate { position: fixed; inset: 0; z-index: 80; background: rgba(70,63,42,0.42); display: none; align-items: center; justify-content: center; }
#uiDialog.show, #dxfGate.show { display: flex; }
#dxfGate input { font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-soft); color: var(--cream); width: 100%; margin: 2px 0 4px; }
#dxfGate .gate-err { font-size: 12px; color: var(--red); min-height: 16px; margin: 0 0 8px; }
.dlg-card { width: 340px; }
.dlg-msg { margin-bottom: 18px; line-height: 1.5; white-space: pre-line; max-height: 40vh; overflow-y: auto; }
.dlg-btns { display: flex; gap: 10px; justify-content: flex-end; }
.dlg-btns .cta { padding: 10px 22px; }
.dlg-btns .dlg-cancel {
  background: none; border: 1px solid var(--line-strong); color: var(--cream);
  border-radius: 7px; padding: 10px 18px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.dlg-btns .dlg-cancel:hover { border-color: var(--cream); }
.dlg-btns .dlg-danger { background: var(--red); border-color: var(--red); color: #fff; }

/* ---- Trade spec-sheet ---- */
.trade-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 24px 60px; }
.trade-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; border-bottom: 2px solid var(--brown); padding-bottom: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.trade-title { font-size: 22px; font-weight: 500; letter-spacing: 0.28em; color: var(--charcoal); }
.trade-title span { font-weight: 400; color: var(--muted); font-size: 14px; letter-spacing: 0.16em; }
.trade-title .slash { color: var(--muted); font-weight: 300; }
.trade-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; margin-top: 4px; }
/* the 1-2-3 flow strip: how a trade order comes together */
.trade-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.trade-steps .ts { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--cream); letter-spacing: 0.03em; }
.trade-steps .ts em {
  font-style: normal; font-weight: 700; font-size: 10px;
  width: 17px; height: 17px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--cream); color: var(--brown-deep);
}
.trade-steps .ts-sep { color: var(--dim); font-size: 11px; }
.trade-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.trade-meta label, .trade-fields label, .unit-head-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.trade-meta input, .trade-meta select, .trade-fields input, .unit-head-fields input, .unit-head-fields select, .unit-rows input, .unit-rows select {
  font-family: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--brown);
}
.trade-meta input { width: 240px; }

.unit-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.unit-head { background: var(--cream); padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.unit-head-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.unit-head-fields .sm input { width: 70px; }
.unit-rows { width: 100%; border-collapse: collapse; margin: 6px 0; }
.unit-rows th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 14px; border-bottom: 1px solid var(--line); font-weight: 500; }
.unit-rows td { padding: 6px 14px; border-bottom: 1px solid #f0ead9; vertical-align: middle; }
.unit-rows td.num, .unit-rows th.num { text-align: right; font-variant-numeric: tabular-nums; }
.unit-rows .qty { width: 56px; text-align: center; }
.unit-rows select { min-width: 280px; }
.unit-rows .muted { color: var(--muted); font-style: italic; text-align: center; }
.unit-card > button[data-act="u-addrow"] { margin: 0 14px 12px; }
.unit-foot { display: flex; gap: 22px; justify-content: flex-end; padding: 12px 16px; background: var(--cream); border-top: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.unit-foot span { color: var(--muted); }
.unit-foot strong { color: var(--brown); font-size: 15px; }

.trade-totals { margin-top: 24px; }
.trade-totals h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 10px; }
.breakdown { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.breakdown th { background: var(--brown); color: var(--cream); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 9px 12px; text-align: left; font-weight: 500; }
.breakdown td { padding: 8px 12px; border-bottom: 1px solid #f0ead9; font-size: 13px; }
.breakdown td.num, .breakdown th.num { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown .muted { color: var(--muted); font-style: italic; }
.grand { background: var(--brown); color: var(--cream); border-radius: 8px; padding: 18px 22px; margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.grand .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; display: block; }
.grand .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grand .hi .v { font-size: 26px; }

/* ---- spec check strip (under each unit's order table) ---- */
.spec-wrap { margin: 0 14px 10px; }
.spec-strip { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; background: rgba(100,91,61,0.07); }
.spec-strip.spec-clear { color: var(--green); border-color: rgba(134,165,100,0.45); letter-spacing: 0.04em; }
.spec-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin-bottom: 6px; }
.spec-item { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; color: var(--cream); }
.spec-item + .spec-item { border-top: 1px solid var(--line); }
.spec-lv { flex: 0 0 44px; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-align: center; border-radius: 3px; padding: 1px 0; }
.spec-error .spec-lv { color: #fff; background: var(--red); }
.spec-warn .spec-lv { color: #33301c; background: #d9a441; }
.spec-info .spec-lv { color: var(--cream); background: rgba(100,91,61,0.16); }
.spec-error > span:last-child { color: var(--red); }
.spec-warn > span:last-child { color: #e4c284; }
.spec-info > span:last-child { color: var(--dim); }

/* ---- delivery phasing ---- */
.phasing { margin-top: 18px; }
.ph-controls { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.ph-check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.ph-max { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.ph-max input { width: 64px; text-align: center; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--line); }
.ph-note { font-size: 11px; color: var(--dim); margin-top: 8px; }

.trade-order { margin-top: 24px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.trade-fields { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.trade-fields input { width: 240px; }
.trade-note { font-size: 11px; color: var(--muted); margin-top: 10px; }
#tAddUnit { margin-bottom: 8px; }

/* mobile: full-bleed stage, panels as labelled bottom sheets (one at a time),
   compact scrollable toolbars — the planner stays fully usable on a phone */
.panel-toggle { display: none; }
@media (max-width: 820px) {
  :root { --panel-w: 100%; }
  /* full-bleed stage AND overlays (these anchor to --panel-w on desktop) */
  #stage, #emptyState, #planOverlay, #quoteOverlay { left: 0; right: 0; }
  #stage { top: 52px; bottom: 0; }

  /* compact top bar; actions scroll horizontally instead of wrapping */
  #topbar { height: 52px; padding: 0 10px; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  #topbar::-webkit-scrollbar { display: none; }
  #topbar .brand { font-size: 16px; flex: 0 0 auto; }
  #topbar .brand .sub:not(.brandmark), #buildTag { display: none !important; }
  #topbar .brand .sub.brandmark { margin-left: 8px; }
  .mode-switch, .topbar-actions { flex: 0 0 auto; }
  .topbar-actions button { padding: 6px 9px; font-size: 11px; }

  /* view controls: one thumb-scrollable strip above the sheet tabs */
  #viewControls {
    left: 8px; right: 8px; max-width: none; bottom: 46px; flex-wrap: nowrap; overflow-x: auto;
    padding: 5px 4px 6px; border-radius: 10px; scrollbar-width: none;
  }
  #viewControls::-webkit-scrollbar { display: none; }
  #viewControls .vc-btn { flex: 0 0 auto; padding: 8px 10px; font-size: 11px; }
  .vc-group { flex: 0 0 auto; padding: 0 8px; }
  .vc-label { display: none; }
  .vc-row { flex-wrap: nowrap; }
  .view-switch { flex: 0 0 auto; }

  /* panels: bottom sheets that hide to a labelled tab; JS keeps one open */
  .panel {
    top: auto; bottom: 0; width: 100%; height: 58vh; border: none; z-index: 30;
    border-top: 1px solid var(--line-strong); transition: transform 0.25s ease;
    border-radius: 14px 14px 0 0; box-shadow: 0 -12px 32px rgba(0,0,0,0.3);
  }
  #leftPanel, #rightPanel { left: 0; right: 0; }
  .panel.collapsed { transform: translateY(100%); box-shadow: none; }
  .panel-toggle {
    display: block; position: absolute; top: -34px; height: 34px;
    background: var(--brown-deep); color: var(--cream);
    border: 1px solid var(--line-strong); border-bottom: none;
    border-radius: 9px 9px 0 0; padding: 7px 14px; font-size: 12px; z-index: 31;
  }
  #leftPanel .panel-toggle { left: 10px; right: auto; }
  #rightPanel .panel-toggle { right: 10px; left: auto; }

  /* selected-cabinet bar: top lane on mobile too, full width, wrapping */
  #selbar { left: 8px; right: 8px; top: 58px; bottom: auto; transform: none; flex-wrap: wrap; justify-content: center; }
  #selbar.show { animation: none; }
  #selbar select { max-width: 100%; }

  /* wizard + result bar fit small screens */
  .wz-card { max-height: 92dvh; }
  .wz-scroll { padding: 24px 20px 12px; }
  .wz-foot { padding: 12px 20px; }
  .wz-shapes { grid-template-columns: 1fr 1fr; }
  .wz-doors { grid-template-columns: 1fr 1fr; }
  .wz-doorgrid { grid-template-columns: 1fr; }
  .wz-map { max-width: 260px; }
  .wz-result { bottom: 88px; max-height: 46dvh; overflow-y: auto; }

  /* overlays' toolbars wrap on narrow screens */
  .plan-toolbar { flex-wrap: wrap; gap: 6px; }
  .quote-host { padding: 10px; }
  .quote-sheet { padding: 22px 18px; }
}

/* ---- Trade: unit designs, DXF/CSV exports (W2W-34) ---- */
.trade-exports { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.unit-head-btns { display: flex; gap: 8px; align-items: flex-end; }
.unit-design {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(100,91,61,0.07);
}
.unit-thumb {
  width: 190px; flex: 0 0 auto; border: 1px solid var(--line-strong);
  border-radius: 6px; overflow: hidden; background: #fff;
}
.unit-thumb svg { display: block; width: 100%; height: auto; }
.unit-design-meta { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--cream); padding-top: 2px; }
.unit-design-meta strong { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 14px; color: var(--cream-hi); }
.unit-design-meta button { align-self: flex-start; }
.unit-design-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.unit-design-btns button { align-self: auto; }
/* the not-yet-designed invitation — the loudest thing on an empty unit card */
.unit-design-empty { border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 12px; background: rgba(255,255,255,0.03); }
.unit-design-empty .unit-design-meta span { color: var(--muted); max-width: 60ch; line-height: 1.5; }
.unit-thumb-empty { display: flex; align-items: center; justify-content: center; background: rgba(100,91,61,0.04); }
.unit-thumb-empty svg { width: 80%; height: auto; }
.unit-thumb-empty .ue-room { fill: none; stroke: var(--dim); stroke-width: 1.5; }
.unit-thumb-empty .ue-run { fill: none; stroke: var(--dim); stroke-width: 3; stroke-dasharray: 4 3; opacity: 0.8; }
.unit-thumb-empty .ue-isl { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0.7; }

/* persistent banner while designing a trade unit in Home mode */
#designBanner {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px;
  background: var(--brown-deep, #fffdf4); color: var(--cream, #645b3d);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); font-size: 13px;
}
#designBanner strong { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: 0.01em; color: var(--cream-hi); }
#designBanner button {
  border: none; border-radius: 6px; padding: 6px 13px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  background: var(--cream, #645b3d); color: var(--brown-deep, #fffdf4);
}
#designBanner button.db-ghost { background: transparent; color: var(--cream, #645b3d); border: 1px solid var(--line-strong); font-weight: 400; }
#designBanner button:hover { opacity: 0.9; }

/* ---- Trade visual cabinet picker ---- */
.pick-btn {
  display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: 460px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--brown-deep); color: var(--cream); cursor: pointer;
  font-family: inherit; font-size: 13px; text-align: left;
}
.pick-btn:hover { border-color: var(--cream); }
.pick-btn strong { color: var(--cream-hi); }
.pick-btn.empty { border-style: dashed; }
.pick-empty { color: var(--dim); font-style: italic; }
.pick-glyph { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 3px; padding: 2px 5px; min-width: 26px; min-height: 34px; }
.pick-glyph svg { display: block; }
.pick-glyph.pick-acc { color: var(--muted); font-size: 8px; letter-spacing: 0.1em; }
.pick-chip-txt { line-height: 1.3; }

#pickModal {
  position: fixed; inset: 0; z-index: 70; background: rgba(70,63,42,0.42);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pick-panel {
  display: flex; flex-direction: column; width: 880px; max-width: 96vw; max-height: 86vh;
  background: var(--brown); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 16px 16px 14px; box-shadow: 0 24px 70px rgba(0,0,0,0.5); color: var(--cream);
}
.pick-top { display: flex; gap: 10px; align-items: center; }
#pickSearch {
  flex: 1; font-family: inherit; font-size: 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--brown-deep); color: var(--cream);
}
#pickSearch::placeholder { color: var(--dim); }
.pick-x { background: none; border: none; color: var(--dim); font-size: 18px; cursor: pointer; padding: 4px 6px; }
.pick-x:hover { color: var(--cream); }
.pick-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.pick-fchip {
  background: rgba(100,91,61,0.08); color: var(--cream); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.pick-fchip:hover { background: rgba(100,91,61,0.16); }
.pick-fchip.on { background: var(--cream); color: var(--brown-deep); border-color: var(--cream); }
.pick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px;
  overflow-y: auto; padding: 2px; align-content: start;
}
.pick-item {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 9px; cursor: pointer;
  background: var(--brown-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--cream); font-family: inherit; text-align: center;
}
.pick-item:hover { border-color: var(--cream); background: rgba(100,91,61,0.06); }
.pick-item.sel { outline: 2px solid var(--cream); outline-offset: -1px; }
.pick-item .pi-draw {
  display: flex; align-items: flex-end; justify-content: center; height: 104px;
  background: #fff; border-radius: 5px; padding: 5px; overflow: hidden;
}
.pick-item .pi-draw svg { max-width: 100%; max-height: 96px; }
.pick-item .pi-draw.pi-acc { align-items: center; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }
.pick-item .pi-code { font-weight: 700; font-size: 13px; color: var(--cream-hi); margin-top: 5px; }
.pick-item .pi-code em { font-style: normal; font-weight: 400; font-size: 10px; color: var(--dim); letter-spacing: 0.06em; }
.pick-item .pi-desc { font-size: 11px; color: var(--cream); }
.pick-item .pi-dims { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.pick-item .pi-price { font-size: 12px; color: var(--cream-hi); margin-top: 2px; }
.pick-none { grid-column: 1 / -1; color: var(--dim); font-style: italic; padding: 22px; text-align: center; }

/* ---- W2W-42: cloud trade projects, share links, approval view ---- */
.trade-cloud { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
#tcloudModal {
  position: fixed; inset: 0; z-index: 70; background: rgba(70,63,42,0.42);
  display: flex; align-items: center; justify-content: center;
}
#tcloudModal .cloud-list { margin-top: 4px; }

/* read-only approval view (?tshare=…) */
.approval-banner {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  background: var(--brown-deep, #fffdf4); color: var(--cream, #645b3d);
  border: 1px solid var(--brass); border-radius: 9px;
  padding: 12px 16px; margin-bottom: 18px; font-size: 13px;
}
.approval-banner strong { color: var(--cream-hi); }
.approval-banner .ab-lock { font-size: 15px; }
.approval-banner .ab-sub { color: var(--muted); font-size: 12px; }
.approval-meta .ap-val {
  font-size: 15px; color: var(--cream-hi); font-family: var(--serif);
  font-style: italic; text-transform: none; letter-spacing: 0.01em;
}
.approve-box {
  margin-top: 22px; padding: 20px; border: 1px solid var(--brass); border-radius: 10px;
  background: rgba(100,91,61,0.07);
}
.approve-box h3 { margin: 0 0 4px; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 20px; color: var(--cream-hi); }
.approve-box form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.approve-box form label {
  display: flex; flex-direction: column; gap: 4px; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.approve-box form input {
  font-family: inherit; font-size: 14px; padding: 9px 10px; width: 220px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--brown-soft); color: var(--cream);
}
.approve-done { font-size: 14px; color: var(--green); line-height: 1.5; }

/* hide everything editable/exportable while approving */
body.approval-mode #modeSwitch,
body.approval-mode .topbar-actions,
body.approval-mode .unit-head-btns,
body.approval-mode [data-act="u-addrow"],
body.approval-mode [data-act="r-del"],
body.approval-mode [data-act="u-dxf"],
body.approval-mode #tAddUnit { display: none !important; }
body.approval-mode .pick-btn { pointer-events: none; opacity: 1; }
body.approval-mode .unit-rows input:disabled,
body.approval-mode .trade-meta input:disabled,
body.approval-mode .trade-meta select:disabled { opacity: 0.85; }

/* ---- W2W-43: real trade orders + status tracking ---- */
#tOrderModal, #homeOrderModal {
  position: fixed; inset: 0; z-index: 72; background: rgba(70,63,42,0.42);
  display: flex; align-items: center; justify-content: center;
}

/* W2W-75: copyable email-fallback card (dialog.js mailFallback) */
.dlg-mail { width: 420px; max-width: calc(100vw - 32px); }
.dlg-mailbody {
  width: 100%; box-sizing: border-box; height: 180px; resize: vertical;
  margin-top: 10px; padding: 10px 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #2e2a18; background: #fffdf6;
  border: 1px solid rgba(100,91,61,0.35); border-radius: 8px;
}
.dlg-mail .dlg-btns { align-items: center; }
/* the mailto is an <a>, so button.cta styles don't reach it — restyle to match */
.dlg-maillink {
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brass); color: var(--brown-deep);
  padding: 10px 22px; border-radius: 8px; font: inherit; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.dlg-maillink:hover { background: var(--cream-hi); }
.order-modal { width: 440px; text-align: center; }
.order-modal .cloud-sub { line-height: 1.5; }
.order-modal-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.order-no-big {
  font-size: 34px; font-weight: 700; letter-spacing: 0.12em; color: var(--cream-hi);
  font-variant-numeric: tabular-nums; margin: 14px 0 10px;
  border: 1px solid var(--brass); border-radius: 10px; padding: 14px 10px;
  background: #ffffff;
}
.order-email-alt { margin-top: 14px; color: var(--dim); text-decoration: underline; }

/* the ORDERS view */
.orders-wrap .trade-head { align-items: center; }
.orders-empty {
  text-align: center; padding: 60px 20px; border: 1px dashed var(--line-strong);
  border-radius: 12px; color: var(--dim); background: rgba(100,91,61,0.07);
}
.orders-empty h3 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 22px; color: var(--cream-hi); margin: 0 0 8px; }
.orders-empty p { max-width: 440px; margin: 0 auto 16px; font-size: 13px; line-height: 1.5; }
.order-card {
  background: var(--brown-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px;
}
.order-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.order-no { font-weight: 700; letter-spacing: 0.1em; color: var(--cream-hi); font-variant-numeric: tabular-nums; }
.order-proj { color: var(--cream); font-family: var(--serif); font-style: italic; }
.order-date { color: var(--dim); font-size: 12px; }
.order-grand { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--cream-hi); }
.status-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--cream);
}
.st-submitted { background: rgba(100,91,61,0.10); }
.st-confirmed { background: rgba(100,91,61,0.22); color: var(--cream-hi); }
.st-in_production { background: rgba(217,164,65,0.28); border-color: rgba(217,164,65,0.5); color: #e4c284; }
.st-shipped { background: rgba(134,165,100,0.22); border-color: rgba(134,165,100,0.5); color: var(--green); }
.st-delivered { background: var(--green); border-color: var(--green); color: #252213; }
.st-cancelled { background: rgba(204,112,102,0.2); border-color: rgba(204,112,102,0.5); color: var(--red); }
.order-phases { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.phase-chip {
  display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px;
  color: var(--cream); background: rgba(100,91,61,0.07);
}
.phase-chip em { font-style: normal; font-weight: 700; text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.08em; }
.phase-chip.st-in_production { background: rgba(217,164,65,0.16); }
.phase-chip.st-shipped { background: rgba(134,165,100,0.16); }
.phase-chip.st-delivered { background: rgba(134,165,100,0.34); }
.phase-chip.st-delivered em, .phase-chip.st-shipped em { color: var(--green); }
.phase-chip.st-in_production em { color: #e4c284; }
.status-sel {
  font-family: inherit; font-size: 11px; padding: 3px 6px; border-radius: 5px;
  background: var(--brown-deep); color: var(--cream); border: 1px solid var(--brass);
}
.order-detail { margin-top: 12px; }
.order-detail summary { cursor: pointer; font-size: 12px; color: var(--dim); }
.order-detail summary:hover { color: var(--cream); }

/* the DOCS HUB on each order card */
.order-docs { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.order-docs summary {
  cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--dim); text-transform: uppercase;
}
.order-docs summary:hover { color: var(--cream); }
.doc-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; }
.doc-btns button[disabled] { opacity: 0.4; cursor: not-allowed; }
.doc-log { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; background: rgba(100,91,61,0.07); }
.doc-log-row {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px;
  color: var(--cream); padding: 4px 0; border-bottom: 1px solid var(--line);
}
.doc-log-row:last-child { border-bottom: none; }
.doc-log-date { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.doc-log-empty { font-size: 11.5px; color: var(--dim); padding: 2px 0; }
.order-ut { margin: 12px 0 4px; }
.order-ut-head { font-size: 12px; color: var(--cream-hi); margin-bottom: 6px; font-weight: 600; }

/* order-check modal — same dressing as the account modal */
#orderCheckModal { position: fixed; inset: 0; z-index: 60; background: rgba(70,63,42,0.42); display: none; align-items: center; justify-content: center; }
#orderCheckModal.show { display: flex; }
#orderCheckModal form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin-bottom: 12px; }
#orderCheckModal input { font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-soft); color: var(--cream); }
#orderCheckModal .cta { width: 100%; padding: 11px; }

/* opening edit popup (extends the wall menu) */
.op-menu { min-width: 190px; }
.op-menu .om-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.op-menu .om-row input { width: 88px; font-family: inherit; font-size: 13px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--brown-soft); color: var(--cream); text-align: right; }
.op-menu #omDelete { color: #c86a5a; }
