/* kitchen.binarybridge.ca - planner UI styles (Phase 2 / Step 2A)
   Carries forward the workshop-blueprint aesthetic from the library page.
   Responsive: desktop = library left, canvas right. Mobile = canvas full,
   library in a bottom sheet behind a floating add button. */

:root {
  --paper:      #f4f1ea;
  --paper-card: #fbfaf6;
  --ink:        #1f2a37;
  --ink-soft:   #5b6675;
  --ink-faint:  #8b94a0;
  --line:       #d8d3c6;
  --line-soft:  #e6e2d8;
  --blueprint:  #2c4a63;
  --brass:      #b07a2c;
  --brass-soft: #e8d5b0;
  --canvas-bg:  #fdfcf7;
  --canvas-grid: #ebe6d8;
  --wall:       #1f2a37;
  --shadow:     0 1px 2px rgba(31, 42, 55, 0.06);
  --shadow-md:  0 6px 24px rgba(31, 42, 55, 0.12);
  --radius:     10px;

  --lib-w-desktop: 320px;
  --lib-w-tablet:  280px;
  --header-h:      62px;
  --total-w:       240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

button { font: inherit; cursor: pointer; }
input  { font: inherit; }

/* ---------- top bar ------------------------------------------------------ */

/* ── Topbar ──────────────────────────────────────────────────────────── */
.topbar {
  height: 78px;
  background: #1a2535 !important;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  flex-shrink: 0;
  overflow: hidden;
}
/* Force all topbar children to be visible on dark bg */
.topbar, .topbar * {
  color: inherit;
}
.topbar-h1,
.topbar .topbar-h1 { display: none; }
.topbar-sub,
.topbar .topbar-sub { color: rgba(255,255,255,0.6) !important; font-size: 10px; }
.room-summary,
.topbar .room-summary { color: rgba(255,255,255,0.65) !important; }
.topbar .room-summary b { color: #ffffff !important; font-weight: 700; }
.topbar-user-name,
.topbar .topbar-user-name { color: rgba(255,255,255,0.8) !important; }
.tb-btn-ghost,
.topbar .tb-btn-ghost { color: rgba(255,255,255,0.8) !important; }
.tb-btn-ghost:hover,
.topbar .tb-btn-ghost:hover { color: #ffffff !important; }
.tb-btn-ghost:disabled,
.topbar .tb-btn-ghost:disabled { color: rgba(255,255,255,0.25) !important; }

/* Brand */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 8px;
  flex-shrink: 0;
}
.topbar-logo-wrap {
  background: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.topbar-logo {
  height: 56px;
  width: auto;
  display: block;
}
.topbar-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.topbar-h1 {
  display: none;
}
.topbar-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45) !important;
  font-weight: 400;
}

/* Room summary */
.room-summary {
  font-size: 12px;
  color: rgba(255,255,255,0.6) !important;
  font-weight: 500;
  white-space: nowrap;
  margin: 0 4px;
}
.room-summary b { color: #ffffff !important; font-weight: 700; }

.topbar-spacer { flex: 1; }

/* Button groups */
.topbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.1);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Base button */
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, opacity 0.12s;
  flex-shrink: 0;
}

/* Ghost — subtle for secondary actions */
.tb-btn-ghost {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.1);
}
.tb-btn-ghost:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.tb-btn-ghost:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Primary — Save & Share */
.tb-btn-primary {
  background: #2c6fad;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}
.tb-btn-primary:hover { background: #235a8f; }
.tb-btn-primary:disabled { opacity: 0.5; cursor: default; }

/* Sign out — subtle red tint */
.tb-signout {
  background: rgba(220,53,69,0.12) !important;
  color: rgba(255,120,130,0.9) !important;
  border-color: rgba(220,53,69,0.2) !important;
}
.tb-signout:hover {
  background: rgba(220,53,69,0.22) !important;
  color: #ff8a94 !important;
}

/* User area */
.topbar-user-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2c6fad;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ---------- root layout -------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--lib-w-desktop) 1fr;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
}

/* ---------- library panel ------------------------------------------------ */

.library-panel {
  background: var(--paper-card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.library-panel .panel-head {
  position: sticky;
  top: 0;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 10px;
  z-index: 2;
}
.library-panel .panel-head h2 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
}
.library-panel .panel-head .hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}

.colors-strip {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
  flex-shrink: 0;
}
.colors-strip .label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
  margin-bottom: 10px;
}
.colors-strip .row {
  display: flex;
  gap: 6px;
}

/* Glossy color swatch button */
.color-pick {
  flex: 1;
  min-width: 0;
  border: 2px solid transparent;
  background: none;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.color-pick:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}
.color-pick:active { transform: scale(0.96); }
.color-pick.selected {
  border-color: var(--blueprint);
  box-shadow: 0 0 0 3px rgba(44,74,99,0.25);
}

/* Glossy swatch — tall rectangle with realistic gloss */
.color-swatch-glossy {
  position: relative;
  height: 52px;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.15);
  border-bottom: none;
}
/* Top half bright shine — simulates light source from above */
.color-swatch-glossy::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(180deg, rgba(255,255,255,0.58) 0%, rgba(255,255,255,0.06) 100%);
  border-radius: 10px 10px 0 0;
}
/* Bottom shadow — depth under the gloss */
.color-swatch-glossy::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 28%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.14));
}
/* Hide the old shine div if present */
.color-swatch-shine { display: none; }

.color-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  padding: 4px 2px 1px;
  background: var(--paper-card);
  border: 1px solid rgba(0,0,0,0.1);
  border-top: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.color-label-ar {
  font-size: 8px;
  color: var(--ink-soft);
  text-align: center;
  padding: 0 2px 4px;
  background: var(--paper-card);
  border: 1px solid rgba(0,0,0,0.1);
  border-top: none;
  border-radius: 0 0 10px 10px;
  direction: rtl;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.color-label:not(:last-child) { border-radius: 0; }
.color-label:last-child, .color-label-ar { border-radius: 0 0 10px 10px; }
.color-pick.selected .color-label,
.color-pick.selected .color-label-ar {
  background: rgba(44,74,99,0.07);
  border-color: var(--blueprint);
  color: var(--blueprint);
}



.cab-types {
  padding: 6px 0 16px;
}

/* Collapsible type group */
/* ---------- catalog v2 — group header + size chip grid ------------------- */

.cab-group-v2 {
  border-bottom: 1px solid var(--line-soft);
}

.cab-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.1s;
  user-select: none;
}
.cab-group-head:hover { background: rgba(44,74,99,0.05); }
.cab-group-head svg { flex-shrink: 0; opacity: 0.75; }

.cab-group-label {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.cab-group-count {
  font-size: 10px;
  color: var(--ink-faint);
  background: var(--line-soft);
  border-radius: 8px;
  padding: 1px 6px;
}
.cab-group-chevron {
  font-size: 11px;
  color: var(--ink-faint);
  transition: transform 0.18s;
}
.cab-group-chevron::after { content: '›'; }
.cab-group-v2.open .cab-group-chevron { transform: rotate(90deg); }
.cab-group-v2.open .cab-group-head { background: rgba(44,74,99,0.04); }

/* Size chip grid: fixed 3-column layout */
.cab-size-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 4px 10px 12px;
}
.cab-group-v2.open .cab-size-grid { display: grid; }

/* Individual size chip — horizontal row with large icon */
.cab-size-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--paper-card);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  cursor: default;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.08s;
  user-select: none;
  min-width: 0;
  text-align: left;
}
.cab-size-chip:hover {
  border-color: var(--blueprint);
  background: rgba(44, 74, 99, 0.04);
  box-shadow: 0 2px 8px rgba(44,74,99,0.1);
}
.cab-size-chip.selected {
  border-color: var(--blueprint);
  background: rgba(44, 74, 99, 0.12);
  box-shadow: 0 0 0 2.5px rgba(44,74,99,0.25);
}
.cab-size-chip:active { transform: scale(0.96); }

.chip-icon {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  border-radius: 7px;
  border: 1px solid var(--line);
}
.chip-icon svg {
  display: block;
  width: 50px;
  height: 50px;
}

.chip-label {
  flex: 1;
  text-align: left;
  min-width: 0;
  line-height: 1.25;
  width: 100%;
}
.chip-width {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-dims {
  font-size: 9px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.chip-price {
  font-size: 10px;
  color: var(--blueprint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- canvas area -------------------------------------------------- */

#stage {
  position: absolute;
  inset: 0;
}

/* dimensions form overlay - shown until room is set */

.dim-form {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(244, 241, 234, 0.85);
  backdrop-filter: blur(6px);
}
.dim-form .card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  width: min(420px, 92%);
}
.dim-form h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dim-form .lead {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.dim-form .field { margin-bottom: 14px; }
.dim-form label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
  margin-bottom: 6px;
}
.dim-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.dim-form input:focus {
  outline: none;
  border-color: var(--blueprint);
}
.dim-form .row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dim-form .err {
  font-size: 12px;
  color: #9a3b2c;
  margin-top: 8px;
  min-height: 18px;
}
.dim-form .btn {
  width: 100%;
  margin-top: 12px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.dim-form .btn:hover { background: var(--blueprint); }

/* running total in top right */

.total-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  background: var(--ink);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}
.total-badge:hover { background: var(--blueprint); }
.total-toggle-icon {
  font-size: 9px;
  color: rgba(255,255,255,0.6);
}
.total-badge .label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-weight: 700;
}
.total-badge .amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.total-badge .amount .cur {
  font-size: 9px;
  color: rgba(255,255,255,0.65);
  font-weight: 600;
  margin-right: 3px;
}
.total-badge .sub {
  display: none;
}

/* edit-room button beside the total */

.edit-room {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: var(--shadow);
  z-index: 10;
  display: none;
}
.edit-room.shown { display: inline-block; }
.edit-room:hover { border-color: var(--blueprint); }
.edit-room.active {
  background: var(--blueprint);
  color: #fff;
  border-color: var(--blueprint);
}

/* mobile add-cabinet floating button */

.fab-add {
  display: none;
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 25;
}
.fab-add:hover { background: var(--blueprint); }

/* mobile bottom-sheet overlay */

.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.4);
  z-index: 40;
}
.sheet-backdrop.shown { display: block; }

/* ---------- responsive -------------------------------------------------- */

@media (max-width: 1023px) {
  .app { grid-template-columns: var(--lib-w-tablet) 1fr; }
}


/* ---------- states ------------------------------------------------------ */

.state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.state.err { color: #9a3b2c; }

/* ---------- placed items sidebar ----------------------------------------- */

.placed-chip {
  display: none; /* chip style removed — using full card instead */
}

.placed-section {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.placed-list {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
}

.placed-empty {
  padding: 14px 16px;
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
}

.placed-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.placed-row:last-child { border-bottom: none; }
.placed-row:hover { background: rgba(44, 74, 99, 0.04); }
.placed-row.selected { background: rgba(176, 122, 44, 0.07); }

.placed-icon { display: flex; align-items: center; justify-content: center; }
.placed-info { min-width: 0; }
.placed-code { font-size: 10px; color: var(--blueprint); font-weight: 700; letter-spacing: 0.05em; }
.placed-name { font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placed-price { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.placed-rm {
  background: none; border: none; color: var(--ink-faint);
  font-size: 16px; line-height: 1; padding: 2px 4px;
  cursor: pointer; border-radius: 4px;
}
.placed-rm:hover { background: rgba(154, 59, 44, 0.1); color: #9a3b2c; }

/* ---------- context menu ------------------------------------------------- */

.ctx-menu {
  position: fixed;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.10);
  padding: 6px;
  z-index: 2000;
  min-width: 210px;
  max-width: 240px;
  animation: ctxIn 0.12s ease;
}
@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.94) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.ctx-header {
  font-size: 12px; font-weight: 700;
  color: var(--blueprint);
  padding: 4px 10px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctx-section {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  padding: 4px 10px 1px;
  text-transform: uppercase;
}
.ctx-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none;
  text-align: left; padding: 7px 10px;
  font-size: 13px; font-family: inherit;
  color: var(--ink); border-radius: 7px;
  cursor: pointer; transition: background 0.08s;
}
.ctx-menu button:hover { background: rgba(44,74,99,0.07); }
.ctx-menu button.ctx-active {
  color: var(--blueprint);
  background: rgba(44,74,99,0.08);
}
.ctx-menu button.ctx-delete { color: #c0392b; }
.ctx-menu button.ctx-delete:hover { background: rgba(192,57,43,0.08); }
.ctx-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.ctx-tick { margin-left: auto; font-size: 12px; color: var(--blueprint); min-width: 14px; text-align: right; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 2px; opacity: 0.5; }

/* ---------- drop zone hint ----------------------------------------------- */

.canvas-area.drag-over::after {
  content: 'Drop cabinet here';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--blueprint);
  background: rgba(44, 74, 99, 0.06);
  pointer-events: none;
  letter-spacing: 0.05em;
}


/* ---------- elevation panel --------------------------------------------- */

.elevation-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 260px;
  background: var(--paper-card);
  border-top: 2px solid var(--ink);
  z-index: 15;
  display: none;
  flex-direction: column;
}
.elevation-panel.open { display: flex; }

.elev-head {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  height: 38px;
}
.elev-head .elev-title {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--blueprint);
  margin-right: 16px;
  white-space: nowrap;
}
.elev-tabs { display: flex; gap: 2px; }
.elev-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px 5px 0 0;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-transform: capitalize;
}
.elev-tab:hover { color: var(--ink); border-color: var(--line); }
.elev-tab.active {
  color: var(--ink);
  border-color: var(--line);
  border-bottom-color: var(--paper-card);
  background: var(--paper-card);
}
.elev-spacer { flex: 1; }
.elev-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.elev-close:hover { color: var(--ink); background: var(--line-soft); }

#elevation-canvas {
  flex: 1;
  width: 100%;
  display: block;
}

.btn-elevation {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
}
.btn-elevation:hover { border-color: var(--blueprint); color: var(--blueprint); }
.elevation-panel.open ~ .btn-elevation { bottom: 276px; }

/* ---------- quote button + overlay -------------------------------------- */

.btn-quote {
  position: absolute;
  bottom: 16px;
  left: 170px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
  letter-spacing: 0.03em;
}
.btn-quote:hover { background: var(--blueprint); }
.elevation-panel.open ~ .btn-elevation,
.elevation-panel.open ~ .btn-quote { bottom: 276px; }

.quote-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.quote-overlay .card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  width: min(440px, 94%);
}
.quote-overlay h2 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.quote-overlay .lead { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
.quote-overlay .field { margin-bottom: 13px; }
.quote-overlay label {
  display: block;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--blueprint); font-weight: 700; margin-bottom: 5px;
}
.quote-overlay input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; background: #fff;
}
.quote-overlay input:focus { outline: none; border-color: var(--blueprint); }
.quote-overlay .err { font-size: 12px; color: #9a3b2c; min-height: 18px; margin-top: 6px; }
.quote-overlay .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quote-overlay .btn-submit {
  flex: 1; background: var(--ink); color: var(--paper);
  border: none; border-radius: 6px; padding: 11px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.quote-overlay .btn-submit:hover { background: var(--blueprint); }
.quote-overlay .btn-submit:disabled { opacity: 0.6; cursor: default; }
.quote-overlay .btn-cancel {
  flex: 1; background: none; border: 1px solid var(--line);
  color: var(--ink-soft); border-radius: 6px; padding: 11px;
  font-size: 14px; cursor: pointer;
}
.quote-overlay .btn-cancel:hover { border-color: var(--ink-soft); color: var(--ink); }

.quote-success-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blueprint);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-width: 90%;
  text-align: center;
}


/* ---------- resizable split canvas layout -------------------------------- */

.canvas-area {
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
  height: 100%;
}

/* Left half: top view + front view stacked */
.plan-half {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  flex: 0 0 50%;  /* default 50% — overridden by JS drag */
  min-width: 200px;
  border-right: none;  /* divider-v provides the border */
}

/* Vertical divider between left column and 3D */
.divider-v {
  flex: 0 0 5px;
  background: var(--line);
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background 0.1s;
}
.divider-v:hover, .divider-v.dragging { background: var(--blueprint); }
.divider-v::after {
  content: '';
  position: absolute;
  inset: 0 -4px;  /* wider hit area */
}

/* Horizontal divider between top view and front view */
.divider-h {
  flex: 0 0 5px;
  background: var(--line);
  cursor: row-resize;
  position: relative;
  z-index: 5;
  transition: background 0.1s;
}
.divider-h:hover, .divider-h.dragging { background: var(--blueprint); }
.divider-h::after {
  content: '';
  position: absolute;
  inset: -4px 0;  /* taller hit area */
}

/* Right half: 3D view */
.elev-half {
  flex: 1 1 0;
  min-width: 200px;
  position: relative;
  overflow: hidden;
}
#iso-canvas {
  cursor: grab;
}
#iso-canvas:active { cursor: grabbing; }

/* View label + reset button on iso half */
.iso-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
}
.iso-view-btn {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.iso-view-btn:hover { border-color: var(--blueprint); color: var(--blueprint); }
.iso-view-btn.active { background: var(--blueprint); color: #fff; border-color: var(--blueprint); }
.iso-reset-btn {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--ink-faint);
  cursor: pointer;
}
.iso-reset-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* Section labels */
.half-label {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
}

/* Move overlays to be relative to plan-half */
.plan-half .dim-form   { position: absolute; inset: 0; }
.plan-half .edit-room  { position: absolute; }
.plan-half .fab-add    { position: absolute; }

/* Quote button on iso half */
.iso-half .btn-quote {
  position: absolute;
  bottom: 16px;
  right: 16px;
  left: auto;
}

/* Hide old elevation toggle — iso is always visible now */
.btn-elevation { display: none !important; }
#elevation-panel { display: none !important; }

/* Responsive: stack on tablet */
@media (max-width: 1023px) {
  .app { grid-template-columns: var(--lib-w-tablet) 1fr; }
  .canvas-area { flex-direction: column; }
  .plan-half { flex: 0 0 50% !important; border-right: none; border-bottom: 1px solid var(--line); }
  .divider-v { display: none; }
  .elev-half { flex: 1 1 0; }
}


/* =========================================================================
   Phase 5 - Setup Wizard
   ========================================================================= */

.wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(6px);
}

.wiz-wrap {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 32px 36px;
  width: min(560px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
}

/* Progress indicator */
.wiz-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}
.wiz-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper-card);
  color: var(--ink-faint);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wiz-dot.active { border-color: var(--blueprint); color: var(--blueprint); background: #fff; }
.wiz-dot.done   { border-color: var(--blueprint); background: var(--blueprint); color: #fff; }
.wiz-prog-line  { height: 2px; width: 48px; background: var(--line); flex-shrink: 0; }
.wiz-prog-line.done { background: var(--blueprint); }

.wiz-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 6px;
}
.wiz-lead {
  font-size: 14px; color: var(--ink-soft);
  margin-bottom: 24px;
}
.wiz-err {
  font-size: 12px; color: #9a3b2c;
  min-height: 18px; margin: 8px 0;
}

/* Color grid - Step 1 */
.wiz-color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.wiz-color-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
  background: var(--paper-card);
}
.wiz-color-card:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.wiz-color-card.selected { border-color: var(--brass); border-width: 2px; }
.wiz-swatch {
  height: 56px;
  border-radius: 6px;
  border: 1px solid rgba(31,42,55,0.12);
  margin-bottom: 8px;
}
.wiz-color-name {
  font-size: 12px; font-weight: 600;
  color: var(--ink);
}

/* Room dimensions - Step 2 */
.wiz-dim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 4px;
}
.wiz-field { display: flex; flex-direction: column; }
.wiz-label {
  font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--blueprint);
  font-weight: 700; margin-bottom: 6px;
}
.wiz-input {
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 15px; background: #fff;
  font-variant-numeric: tabular-nums;
}
.wiz-input:focus { outline: none; border-color: var(--blueprint); }

/* Layout grid - Step 3 */
.wiz-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.wiz-layout-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  background: var(--paper-card);
}
.wiz-layout-card:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.wiz-layout-card.selected { border-color: var(--brass); }
.wiz-diagram {
  height: 72px; display: flex;
  align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.wiz-diagram svg { width: 72px; height: 54px; }
.wiz-layout-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.wiz-layout-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

/* Nav buttons */
.wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.wiz-btn-back {
  background: none; border: 1px solid var(--line);
  color: var(--ink-soft); border-radius: 7px;
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  touch-action: manipulation;
}
.wiz-btn-back:hover { border-color: var(--ink-soft); color: var(--ink); }
.wiz-btn-next {
  background: var(--ink); color: var(--paper);
  border: none; border-radius: 7px;
  padding: 11px 22px; font-size: 14px;
  font-weight: 700; cursor: pointer;
  letter-spacing: 0.02em;
  touch-action: manipulation;
}
.wiz-btn-next:hover { background: var(--blueprint); }

/* Redesign button in toolbar */
.btn-redesign {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.btn-redesign:hover { border-color: var(--blueprint); color: var(--blueprint); }

@media (max-width: 500px) {
  .wiz-color-grid   { grid-template-columns: 1fr 1fr; }
  .wiz-layout-grid  { grid-template-columns: 1fr 1fr; }
  .wiz-wrap         { padding: 24px 20px; }
}

/* =========================================================================
   Phase 5 Revised — Top/Front 2D split layout
   ========================================================================= */

.half-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  height: 38px;
  flex-shrink: 0;
  gap: 8px;
}
.half-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--blueprint);
  white-space: nowrap;
  position: static !important;
}
.wall-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.wall-tab {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
}
.wall-tab:hover { border-color: var(--blueprint); color: var(--blueprint); }
.wall-tab.active { background: var(--blueprint); color: #fff; border-color: var(--blueprint); }

.plan-half {
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--line);
}
.plan-half-top, .plan-half-bottom {
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  min-height: 80px;
}
.plan-half-top  { flex: 2 1 0; }
.plan-half-bottom { flex: 1 1 0; background: var(--paper); }
.plan-half-top #stage { flex: 1; position: relative; min-height: 0; }
#elev-canvas-left { flex: 1; display: block; width: 100%; min-height: 0; }
.wall-tabs-left { margin-left: auto; }

.elev-half {
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
#elev-canvas { flex: 1; display: block; width: 100%; }

.elev-half .btn-quote {
  position: absolute; bottom: 12px; right: 12px; left: auto; z-index: 10;
}
.half-toolbar .edit-room {
  position: static !important; display: inline-block !important;
  font-size: 11px; padding: 4px 10px; margin: 0;
}
.btn-elevation, #elevation-panel { display: none !important; }


/* --- 2D/3D view toggle -------------------------------------------------- */
.view-toggle {
  display: flex;
  background: var(--line-soft);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.view-toggle-btn {
  background: none;
  border: none;
  border-radius: 5px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn.active {
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31,42,55,0.10);
}

/* Both canvases fill the same area */
.right-canvas {
  position: absolute;
  top: 38px; /* below toolbar */
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: calc(100% - 38px);
}

/* ISO controls in toolbar */
.iso-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.iso-view-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
}
.iso-view-btn.active { background: var(--blueprint); color:#fff; border-color:var(--blueprint); }
.iso-reset-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 8px;
  font-size: 13px; color: var(--ink-faint); cursor: pointer;
}
.iso-reset-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ---------- placement mode ------------------------------------------------ */

.placement-tooltip {
  position: fixed;
  z-index: 2000;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.02em;
}
.placement-tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 12px;
  width: 8px; height: 8px;
  background: var(--ink);
  transform: rotate(45deg);
}

.placement-qty-badge {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: var(--blueprint);
  color: #fff;
  font-size: 12px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 8px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
}
.qty-label { font-weight: 700; opacity: 0.8; }
.qty-value { font-size: 18px; font-weight: 700; background: rgba(255,255,255,0.2); padding: 0 8px; border-radius: 6px; }
.qty-hint  { font-size: 10px; opacity: 0.75; }

/* Highlight catalog items as clickable */
.cab-item { cursor: pointer; }
.cab-item:hover { background: rgba(44, 74, 99, 0.06); }

/* ---------- cabinet selection detail popup ------------------------------- */

.cab-detail-popup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 12px 12px;
  padding: 12px;
  background: var(--paper-card);
  border: 1.5px solid var(--blueprint);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(44,74,99,0.15);
  animation: popupIn 0.15s ease;
}
@keyframes popupIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cab-detail-preview {
  flex-shrink: 0;
  width: 72px; height: 72px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
}
.cab-detail-info { flex: 1; min-width: 0; }
.cab-detail-name {
  font-size: 12px; font-weight: 700;
  color: var(--ink); line-height: 1.3;
  margin-bottom: 3px;
}
.cab-detail-dims {
  font-size: 11px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.cab-detail-price {
  font-size: 13px; font-weight: 700;
  color: var(--blueprint);
  margin-bottom: 6px;
}
.cab-detail-hint {
  font-size: 10px; color: var(--ink-faint);
  line-height: 1.4;
}
.cab-detail-hint kbd {
  display: inline-block;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 9px;
  font-family: inherit;
  color: var(--ink-soft);
}

/* =========================================================================
   Mobile tab catalog (max-width: 767px)
   ========================================================================= */

.mob-tab-bar {
  display: none; /* shown by JS on mobile */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
  gap: 2px;
  flex-shrink: 0;
}
.mob-tab-bar::-webkit-scrollbar { display: none; }

.mob-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 7px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
  color: var(--ink-soft);
}
.mob-tab svg { opacity: 0.6; transition: opacity 0.15s; }
.mob-tab.active {
  border-bottom-color: var(--blueprint);
  color: var(--blueprint);
}
.mob-tab.active svg { opacity: 1; }
.mob-tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Mobile tab panel — horizontal scroll row of chips */
.mob-tab-panel {
  display: none;  /* shown on mobile only via media query */
  flex-direction: row;
  gap: 10px;
  padding: 12px 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mob-tab-panel::-webkit-scrollbar { display: none; }

/* Mobile chips — larger, portrait orientation */
.mob-chip {
  flex-shrink: 0;
  width: 86px !important;
  padding: 12px 8px 10px !important;
  border-radius: 12px !important;
  gap: 6px !important;
}
.mob-chip .chip-icon {
  max-height: 64px !important;
}
.mob-chip .chip-width {
  font-size: 12px !important;
}
.mob-chip .chip-price {
  font-size: 11px !important;
}


/* =========================================================================
   MOBILE LAYOUT — max-width 767px
   All mobile overrides are consolidated here. Desktop is unaffected.
   ========================================================================= */

@media (max-width: 767px) {

  /* ---- Topbar --------------------------------------------------------- */
  .topbar {
    padding: 0 12px;
    height: 48px;
    gap: 8px;
  }
  .topbar h1 { font-size: 15px; }
  .topbar .sub { display: none; }
  .topbar .room-summary { font-size: 11px; }
  .btn-redesign { display: none; }   /* too cluttered on mobile */
  .btn-save-share { padding: 5px 10px; font-size: 11px; }
  .btn-link { display: none; }

  /* ---- App grid ------------------------------------------------------- */
  .app {
    grid-template-columns: 1fr;
    /* canvas area fills everything below topbar */
  }

  /* ---- Canvas area: single pane, managed by JS showScreen() ----------- */
  .canvas-area {
    flex-direction: column;
    height: calc(100dvh - 48px - 58px); /* topbar + bottom nav */
  }

  /* Dividers hidden on mobile — JS hides them too */
  .divider-v, .divider-h { display: none !important; }

  /* Both halves fill full space when shown, hidden by default */
  .plan-half {
    flex: 1 1 100% !important;
    min-width: 0;
    border-right: none;
    border-bottom: none;
  }
  .plan-half-top { flex: 1 1 0; }
  .plan-half-bottom { display: none; } /* front view hidden on mobile */

  .elev-half {
    flex: 1 1 100% !important;
    min-width: 0;
    display: none; /* shown by JS when 3D tab is active */
  }

  /* ---- Half toolbars -------------------------------------------------- */
  .half-toolbar {
    padding: 6px 10px;
    gap: 6px;
  }
  .half-label { font-size: 10px; }
  .edit-room { padding: 4px 8px; font-size: 10px; }

  /* ---- Running total (inside 3D pane) -------------------------------- */
  .placed-section {
    bottom: 10px;
    left: 10px;
  }
  .total-badge { padding: 6px 10px; gap: 6px; }
  .total-badge .label { display: none; }
  .total-badge .amount { font-size: 14px; }
  .total-badge .sub { display: none; }

  /* ---- 3D view controls ----------------------------------------------- */
  .iso-controls { gap: 4px; }
  .iso-view-btn { padding: 4px 8px; font-size: 11px; }
  .iso-reset-btn { padding: 4px 7px; }

  /* ---- Quote button in 3D pane ---------------------------------------- */
  .btn-quote {
    bottom: 10px;
    right: 10px;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* ---- Library panel: bottom sheet ------------------------------------ */
  .library-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 72vh;
    border-right: none;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .library-panel.open { transform: translateY(0); }

  /* Drag handle at top of sheet */
  .library-panel .panel-head {
    border-radius: 16px 16px 0 0;
    padding: 10px 16px 8px;
    flex-shrink: 0;
  }
  .library-panel .panel-head::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--line);
    border-radius: 2px;
    margin: 0 auto 8px;
  }
  .library-panel .panel-head h2 { font-size: 14px; margin: 0; }
  .library-panel .panel-head .hint { font-size: 11px; }

  /* Colors strip compact */
  .colors-strip { padding: 6px 14px; flex-shrink: 0; }
  .colors-strip .label { font-size: 10px; }
  .color-pick { padding: 3px 6px; font-size: 11px; }
  .color-pick .chip { width: 18px; height: 18px; }

  /* Desktop accordion hidden on mobile */
  .cab-group-v2 { display: none !important; }

  /* Mobile tab bar */
  .mob-tab-bar {
    display: flex !important;
    flex-shrink: 0;
  }

  /* Cabinet types container fills remaining sheet space */
  .cab-types {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Mobile tab panel fills the space and scrolls horizontally */
  .mob-tab-panel {
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    padding: 14px 12px 20px;
    min-height: 140px;
  }

  /* Show active mobile panel */
  .mob-tab-panel.active { display: flex !important; }


    

  /* ---- Backdrop -------------------------------------------------------- */
  .sheet-backdrop.shown {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
  }

  /* ---- Wizard --------------------------------------------------------- */
  .wiz-wrap { padding: 20px 16px; }
  .wiz-dim-row { flex-direction: column; gap: 10px; }

  /* ---- Quote modal ----------------------------------------------------- */
  .quote-overlay .card { padding: 20px 16px; max-height: 92vh; }

  /* ---- Placement toast ------------------------------------------------ */
  .placement-qty-badge { bottom: 66px; font-size: 11px; }

  /* ---- FAB add button (hidden — catalog tab replaces it) -------------- */
  .fab-add { display: none; }

  /* ---- Detail popup --------------------------------------------------- */
  .cab-detail-popup { margin: 0 8px 8px; }
}
* kitchen.binarybridge.ca - planner UI styles (Phase 2 / Step 2A)
   Carries forward the workshop-blueprint aesthetic from the library page.
   Responsive: desktop = library left, canvas right. Mobile = canvas full,
   library in a bottom sheet behind a floating add button. */

:root {
  --paper:      #f4f1ea;
  --paper-card: #fbfaf6;
  --ink:        #1f2a37;
  --ink-soft:   #5b6675;
  --ink-faint:  #8b94a0;
  --line:       #d8d3c6;
  --line-soft:  #e6e2d8;
  --blueprint:  #2c4a63;
  --brass:      #b07a2c;
  --brass-soft: #e8d5b0;
  --canvas-bg:  #fdfcf7;
  --canvas-grid: #ebe6d8;
  --wall:       #1f2a37;
  --shadow:     0 1px 2px rgba(31, 42, 55, 0.06);
  --shadow-md:  0 6px 24px rgba(31, 42, 55, 0.12);
  --radius:     10px;

  --lib-w-desktop: 320px;
  --lib-w-tablet:  280px;
  --header-h:      62px;
  --total-w:       240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

button { font: inherit; cursor: pointer; }
input  { font: inherit; }

/* ---------- top bar ------------------------------------------------------ */

.topbar {
  height: var(--header-h);
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  background: var(--paper);
  position: relative;
  z-index: 30;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.005em;
  flex-shrink: 0;
}
.topbar .sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  border: 1px solid var(--blueprint);
  border-radius: 4px;
  padding: 4px 9px;
  flex-shrink: 0;
}
.topbar .spacer { flex: 1; }

.topbar .room-summary {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.topbar .room-summary b { color: var(--ink); font-weight: 600; }

.topbar .btn-link {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
}
.topbar .btn-link:hover { border-color: var(--ink-soft); color: var(--ink); }

.btn-save-share {
  background: var(--blueprint);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn-save-share:hover   { background: #1e3a5f; }
.btn-save-share:disabled { opacity: 0.6; cursor: default; }

/* Share modal */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  backdrop-filter: blur(6px);
}
.share-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  width: min(440px, 94vw);
}
.share-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.share-lead {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.share-link-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 13px;
  background: var(--paper);
  color: var(--blueprint);
  font-weight: 600;
  min-width: 0;
}
.share-copy-btn {
  background: var(--blueprint);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.share-copy-btn:hover { background: #1e3a5f; }
.share-note {
  font-size: 11px;
  color: var(--ink-faint);
  margin: 0 0 18px;
}
.share-close-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.12s;
}
.share-close-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ---------- root layout -------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--lib-w-desktop) 1fr;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
}

/* ---------- library panel ------------------------------------------------ */

.library-panel {
  background: var(--paper-card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.library-panel .panel-head {
  position: sticky;
  top: 0;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 10px;
  z-index: 2;
}
.library-panel .panel-head h2 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
}
.library-panel .panel-head .hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}

.colors-strip {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
}
.colors-strip .label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
  margin-bottom: 10px;
}
.colors-strip .row {
  display: flex;
  gap: 8px;
}
.color-pick {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: 6px;
  padding: 6px 4px 5px;
  text-align: center;
  font-size: 10px;
  color: var(--ink-soft);
  transition: border-color 0.15s, transform 0.15s;
}
.color-pick .chip {
  height: 26px;
  border-radius: 4px;
  border: 1px solid rgba(31, 42, 55, 0.15);
  margin-bottom: 4px;
}
.color-pick:hover { border-color: var(--ink-soft); }
.color-pick.selected {
  border-color: var(--brass);
  border-width: 2px;
  padding: 5px 3px 4px;
  color: var(--ink);
}

.cab-types {
  padding: 6px 0 16px;
}

/* Collapsible type group */
/* ---------- catalog v2 — group header + size chip grid ------------------- */

.cab-group-v2 {
  border-bottom: 1px solid var(--line-soft);
}

.cab-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.1s;
  user-select: none;
}
.cab-group-head:hover { background: rgba(44,74,99,0.05); }
.cab-group-head svg { flex-shrink: 0; opacity: 0.75; }

.cab-group-label {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.cab-group-count {
  font-size: 10px;
  color: var(--ink-faint);
  background: var(--line-soft);
  border-radius: 8px;
  padding: 1px 6px;
}
.cab-group-chevron {
  font-size: 11px;
  color: var(--ink-faint);
  transition: transform 0.18s;
}
.cab-group-chevron::after { content: '›'; }
.cab-group-v2.open .cab-group-chevron { transform: rotate(90deg); }
.cab-group-v2.open .cab-group-head { background: rgba(44,74,99,0.04); }

/* Size chip grid: fixed 3-column layout */
.cab-size-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 4px 10px 12px;
}
.cab-group-v2.open .cab-size-grid { display: grid; }

/* Individual size chip — horizontal row with large icon */
.cab-size-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--paper-card);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  cursor: default;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.08s;
  user-select: none;
  min-width: 0;
  text-align: left;
}
.cab-size-chip:hover {
  border-color: var(--blueprint);
  background: rgba(44, 74, 99, 0.04);
  box-shadow: 0 2px 8px rgba(44,74,99,0.1);
}
.cab-size-chip.selected {
  border-color: var(--blueprint);
  background: rgba(44, 74, 99, 0.12);
  box-shadow: 0 0 0 2.5px rgba(44,74,99,0.25);
}
.cab-size-chip:active { transform: scale(0.96); }

.chip-icon {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  border-radius: 7px;
  border: 1px solid var(--line);
}
.chip-icon svg {
  display: block;
  width: 50px;
  height: 50px;
}

.chip-label {
  flex: 1;
  text-align: left;
  min-width: 0;
  line-height: 1.25;
  width: 100%;
}
.chip-width {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-dims {
  font-size: 9px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.chip-price {
  font-size: 10px;
  color: var(--blueprint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- canvas area -------------------------------------------------- */

#stage {
  position: absolute;
  inset: 0;
}

/* dimensions form overlay - shown until room is set */

.dim-form {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(244, 241, 234, 0.85);
  backdrop-filter: blur(6px);
}
.dim-form .card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  width: min(420px, 92%);
}
.dim-form h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dim-form .lead {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.dim-form .field { margin-bottom: 14px; }
.dim-form label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blueprint);
  font-weight: 700;
  margin-bottom: 6px;
}
.dim-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.dim-form input:focus {
  outline: none;
  border-color: var(--blueprint);
}
.dim-form .row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dim-form .err {
  font-size: 12px;
  color: #9a3b2c;
  margin-top: 8px;
  min-height: 18px;
}
.dim-form .btn {
  width: 100%;
  margin-top: 12px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.dim-form .btn:hover { background: var(--blueprint); }

/* running total in top right */

.total-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  background: var(--ink);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}
.total-badge:hover { background: var(--blueprint); }
.total-toggle-icon {
  font-size: 9px;
  color: rgba(255,255,255,0.6);
}
.total-badge .label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-weight: 700;
}
.total-badge .amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.total-badge .amount .cur {
  font-size: 9px;
  color: rgba(255,255,255,0.65);
  font-weight: 600;
  margin-right: 3px;
}
.total-badge .sub {
  display: none;
}

/* edit-room button beside the total */

.edit-room {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: var(--shadow);
  z-index: 10;
  display: none;
}
.edit-room.shown { display: inline-block; }
.edit-room:hover { border-color: var(--blueprint); }
.edit-room.active {
  background: var(--blueprint);
  color: #fff;
  border-color: var(--blueprint);
}

/* mobile add-cabinet floating button */

.fab-add {
  display: none;
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 25;
}
.fab-add:hover { background: var(--blueprint); }

/* mobile bottom-sheet overlay */

.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.4);
  z-index: 40;
}
.sheet-backdrop.shown { display: block; }

/* ---------- responsive -------------------------------------------------- */

@media (max-width: 1023px) {
  .app { grid-template-columns: var(--lib-w-tablet) 1fr; }
}


/* ---------- states ------------------------------------------------------ */

.state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.state.err { color: #9a3b2c; }

/* ---------- placed items sidebar ----------------------------------------- */

.placed-chip {
  display: none; /* chip style removed — using full card instead */
}

.placed-section {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.placed-list {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
}

.placed-empty {
  padding: 14px 16px;
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
}

.placed-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.placed-row:last-child { border-bottom: none; }
.placed-row:hover { background: rgba(44, 74, 99, 0.04); }
.placed-row.selected { background: rgba(176, 122, 44, 0.07); }

.placed-icon { display: flex; align-items: center; justify-content: center; }
.placed-info { min-width: 0; }
.placed-code { font-size: 10px; color: var(--blueprint); font-weight: 700; letter-spacing: 0.05em; }
.placed-name { font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placed-price { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.placed-rm {
  background: none; border: none; color: var(--ink-faint);
  font-size: 16px; line-height: 1; padding: 2px 4px;
  cursor: pointer; border-radius: 4px;
}
.placed-rm:hover { background: rgba(154, 59, 44, 0.1); color: #9a3b2c; }

/* ---------- context menu ------------------------------------------------- */

/* ---------- drop zone hint ----------------------------------------------- */

.canvas-area.drag-over::after {
  content: 'Drop cabinet here';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--blueprint);
  background: rgba(44, 74, 99, 0.06);
  pointer-events: none;
  letter-spacing: 0.05em;
}


/* ---------- elevation panel --------------------------------------------- */

.elevation-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 260px;
  background: var(--paper-card);
  border-top: 2px solid var(--ink);
  z-index: 15;
  display: none;
  flex-direction: column;
}
.elevation-panel.open { display: flex; }

.elev-head {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  height: 38px;
}
.elev-head .elev-title {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--blueprint);
  margin-right: 16px;
  white-space: nowrap;
}
.elev-tabs { display: flex; gap: 2px; }
.elev-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px 5px 0 0;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-transform: capitalize;
}
.elev-tab:hover { color: var(--ink); border-color: var(--line); }
.elev-tab.active {
  color: var(--ink);
  border-color: var(--line);
  border-bottom-color: var(--paper-card);
  background: var(--paper-card);
}
.elev-spacer { flex: 1; }
.elev-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.elev-close:hover { color: var(--ink); background: var(--line-soft); }

#elevation-canvas {
  flex: 1;
  width: 100%;
  display: block;
}

.btn-elevation {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
}
.btn-elevation:hover { border-color: var(--blueprint); color: var(--blueprint); }
.elevation-panel.open ~ .btn-elevation { bottom: 276px; }

/* ---------- quote button + overlay -------------------------------------- */

.btn-quote {
  position: absolute;
  bottom: 16px;
  left: 170px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
  letter-spacing: 0.03em;
}
.btn-quote:hover { background: var(--blueprint); }
.elevation-panel.open ~ .btn-elevation,
.elevation-panel.open ~ .btn-quote { bottom: 276px; }

.quote-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.quote-overlay .card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  width: min(440px, 94%);
}
.quote-overlay h2 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.quote-overlay .lead { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
.quote-overlay .field { margin-bottom: 13px; }
.quote-overlay label {
  display: block;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--blueprint); font-weight: 700; margin-bottom: 5px;
}
.quote-overlay input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; background: #fff;
}
.quote-overlay input:focus { outline: none; border-color: var(--blueprint); }
.quote-overlay .err { font-size: 12px; color: #9a3b2c; min-height: 18px; margin-top: 6px; }
.quote-overlay .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quote-overlay .btn-submit {
  flex: 1; background: var(--ink); color: var(--paper);
  border: none; border-radius: 6px; padding: 11px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.quote-overlay .btn-submit:hover { background: var(--blueprint); }
.quote-overlay .btn-submit:disabled { opacity: 0.6; cursor: default; }
.quote-overlay .btn-cancel {
  flex: 1; background: none; border: 1px solid var(--line);
  color: var(--ink-soft); border-radius: 6px; padding: 11px;
  font-size: 14px; cursor: pointer;
}
.quote-overlay .btn-cancel:hover { border-color: var(--ink-soft); color: var(--ink); }

.quote-success-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blueprint);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-width: 90%;
  text-align: center;
}


/* ---------- resizable split canvas layout -------------------------------- */

.canvas-area {
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
  height: 100%;
}

/* Left half: top view + front view stacked */
.plan-half {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  flex: 0 0 50%;  /* default 50% — overridden by JS drag */
  min-width: 200px;
  border-right: none;  /* divider-v provides the border */
}

/* Vertical divider between left column and 3D */
.divider-v {
  flex: 0 0 5px;
  background: var(--line);
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background 0.1s;
}
.divider-v:hover, .divider-v.dragging { background: var(--blueprint); }
.divider-v::after {
  content: '';
  position: absolute;
  inset: 0 -4px;  /* wider hit area */
}

/* Horizontal divider between top view and front view */
.divider-h {
  flex: 0 0 5px;
  background: var(--line);
  cursor: row-resize;
  position: relative;
  z-index: 5;
  transition: background 0.1s;
}
.divider-h:hover, .divider-h.dragging { background: var(--blueprint); }
.divider-h::after {
  content: '';
  position: absolute;
  inset: -4px 0;  /* taller hit area */
}

/* Right half: 3D view */
.elev-half {
  flex: 1 1 0;
  min-width: 200px;
  position: relative;
  overflow: hidden;
}
#iso-canvas {
  cursor: grab;
}
#iso-canvas:active { cursor: grabbing; }

/* View label + reset button on iso half */
.iso-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
}
.iso-view-btn {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.iso-view-btn:hover { border-color: var(--blueprint); color: var(--blueprint); }
.iso-view-btn.active { background: var(--blueprint); color: #fff; border-color: var(--blueprint); }
.iso-reset-btn {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--ink-faint);
  cursor: pointer;
}
.iso-reset-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* Section labels */
.half-label {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
}

/* Move overlays to be relative to plan-half */
.plan-half .dim-form   { position: absolute; inset: 0; }
.plan-half .edit-room  { position: absolute; }
.plan-half .fab-add    { position: absolute; }

/* Quote button on iso half */
.iso-half .btn-quote {
  position: absolute;
  bottom: 16px;
  right: 16px;
  left: auto;
}

/* Hide old elevation toggle — iso is always visible now */
.btn-elevation { display: none !important; }
#elevation-panel { display: none !important; }

/* Responsive: stack on tablet */
@media (max-width: 1023px) {
  .app { grid-template-columns: var(--lib-w-tablet) 1fr; }
  .canvas-area { flex-direction: column; }
  .plan-half { flex: 0 0 50% !important; border-right: none; border-bottom: 1px solid var(--line); }
  .divider-v { display: none; }
  .elev-half { flex: 1 1 0; }
}


/* =========================================================================
   Phase 5 - Setup Wizard
   ========================================================================= */

.wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(6px);
}

.wiz-wrap {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 32px 36px;
  width: min(560px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
}

/* Progress indicator */
.wiz-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}
.wiz-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper-card);
  color: var(--ink-faint);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wiz-dot.active { border-color: var(--blueprint); color: var(--blueprint); background: #fff; }
.wiz-dot.done   { border-color: var(--blueprint); background: var(--blueprint); color: #fff; }
.wiz-prog-line  { height: 2px; width: 48px; background: var(--line); flex-shrink: 0; }
.wiz-prog-line.done { background: var(--blueprint); }

.wiz-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 6px;
}
.wiz-lead {
  font-size: 14px; color: var(--ink-soft);
  margin-bottom: 24px;
}
.wiz-err {
  font-size: 12px; color: #9a3b2c;
  min-height: 18px; margin: 8px 0;
}

/* Color grid - Step 1 */
.wiz-color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.wiz-color-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
  background: var(--paper-card);
}
.wiz-color-card:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.wiz-color-card.selected { border-color: var(--brass); border-width: 2px; }
.wiz-swatch {
  height: 56px;
  border-radius: 6px;
  border: 1px solid rgba(31,42,55,0.12);
  margin-bottom: 8px;
}
.wiz-color-name {
  font-size: 12px; font-weight: 600;
  color: var(--ink);
}

/* Room dimensions - Step 2 */
.wiz-dim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 4px;
}
.wiz-field { display: flex; flex-direction: column; }
.wiz-label {
  font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--blueprint);
  font-weight: 700; margin-bottom: 6px;
}
.wiz-input {
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 15px; background: #fff;
  font-variant-numeric: tabular-nums;
}
.wiz-input:focus { outline: none; border-color: var(--blueprint); }

/* Layout grid - Step 3 */
.wiz-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.wiz-layout-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  background: var(--paper-card);
}
.wiz-layout-card:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.wiz-layout-card.selected { border-color: var(--brass); }
.wiz-diagram {
  height: 72px; display: flex;
  align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.wiz-diagram svg { width: 72px; height: 54px; }
.wiz-layout-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.wiz-layout-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

/* Nav buttons */
.wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.wiz-btn-back {
  background: none; border: 1px solid var(--line);
  color: var(--ink-soft); border-radius: 7px;
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  touch-action: manipulation;
}
.wiz-btn-back:hover { border-color: var(--ink-soft); color: var(--ink); }
.wiz-btn-next {
  background: var(--ink); color: var(--paper);
  border: none; border-radius: 7px;
  padding: 11px 22px; font-size: 14px;
  font-weight: 700; cursor: pointer;
  letter-spacing: 0.02em;
  touch-action: manipulation;
}
.wiz-btn-next:hover { background: var(--blueprint); }

/* Redesign button in toolbar */
.btn-redesign {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.btn-redesign:hover { border-color: var(--blueprint); color: var(--blueprint); }

@media (max-width: 500px) {
  .wiz-color-grid   { grid-template-columns: 1fr 1fr; }
  .wiz-layout-grid  { grid-template-columns: 1fr 1fr; }
  .wiz-wrap         { padding: 24px 20px; }
}

/* =========================================================================
   Phase 5 Revised — Top/Front 2D split layout
   ========================================================================= */

.half-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  height: 38px;
  flex-shrink: 0;
  gap: 8px;
}
.half-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--blueprint);
  white-space: nowrap;
  position: static !important;
}
.wall-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.wall-tab {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
}
.wall-tab:hover { border-color: var(--blueprint); color: var(--blueprint); }
.wall-tab.active { background: var(--blueprint); color: #fff; border-color: var(--blueprint); }

.plan-half {
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--line);
}
.plan-half-top, .plan-half-bottom {
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  min-height: 80px;
}
.plan-half-top  { flex: 2 1 0; }
.plan-half-bottom { flex: 1 1 0; background: var(--paper); }
.plan-half-top #stage { flex: 1; position: relative; min-height: 0; }
#elev-canvas-left { flex: 1; display: block; width: 100%; min-height: 0; }
.wall-tabs-left { margin-left: auto; }

.elev-half {
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
#elev-canvas { flex: 1; display: block; width: 100%; }

.elev-half .btn-quote {
  position: absolute; bottom: 12px; right: 12px; left: auto; z-index: 10;
}
.half-toolbar .edit-room {
  position: static !important; display: inline-block !important;
  font-size: 11px; padding: 4px 10px; margin: 0;
}
.btn-elevation, #elevation-panel { display: none !important; }


/* --- 2D/3D view toggle -------------------------------------------------- */
.view-toggle {
  display: flex;
  background: var(--line-soft);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.view-toggle-btn {
  background: none;
  border: none;
  border-radius: 5px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn.active {
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31,42,55,0.10);
}

/* Both canvases fill the same area */
.right-canvas {
  position: absolute;
  top: 38px; /* below toolbar */
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: calc(100% - 38px);
}

/* ISO controls in toolbar */
.iso-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.iso-view-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
}
.iso-view-btn.active { background: var(--blueprint); color:#fff; border-color:var(--blueprint); }
.iso-reset-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 8px;
  font-size: 13px; color: var(--ink-faint); cursor: pointer;
}
.iso-reset-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ---------- placement mode ------------------------------------------------ */

.placement-tooltip {
  position: fixed;
  z-index: 2000;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  letter-spacing: 0.02em;
}
.placement-tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 12px;
  width: 8px; height: 8px;
  background: var(--ink);
  transform: rotate(45deg);
}

.placement-qty-badge {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: var(--blueprint);
  color: #fff;
  font-size: 12px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 8px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
}
.qty-label { font-weight: 700; opacity: 0.8; }
.qty-value { font-size: 18px; font-weight: 700; background: rgba(255,255,255,0.2); padding: 0 8px; border-radius: 6px; }
.qty-hint  { font-size: 10px; opacity: 0.75; }

/* Highlight catalog items as clickable */
.cab-item { cursor: pointer; }
.cab-item:hover { background: rgba(44, 74, 99, 0.06); }

/* ---------- cabinet selection detail popup ------------------------------- */

.cab-detail-popup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 12px 12px;
  padding: 12px;
  background: var(--paper-card);
  border: 1.5px solid var(--blueprint);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(44,74,99,0.15);
  animation: popupIn 0.15s ease;
}
@keyframes popupIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cab-detail-preview {
  flex-shrink: 0;
  width: 72px; height: 72px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
}
.cab-detail-info { flex: 1; min-width: 0; }
.cab-detail-name {
  font-size: 12px; font-weight: 700;
  color: var(--ink); line-height: 1.3;
  margin-bottom: 3px;
}
.cab-detail-dims {
  font-size: 11px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.cab-detail-price {
  font-size: 13px; font-weight: 700;
  color: var(--blueprint);
  margin-bottom: 6px;
}
.cab-detail-hint {
  font-size: 10px; color: var(--ink-faint);
  line-height: 1.4;
}
.cab-detail-hint kbd {
  display: inline-block;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 9px;
  font-family: inherit;
  color: var(--ink-soft);
}

/* =========================================================================
   Mobile tab catalog (max-width: 767px)
   ========================================================================= */

.mob-tab-bar {
  display: none; /* shown by JS on mobile */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
  gap: 2px;
  flex-shrink: 0;
}
.mob-tab-bar::-webkit-scrollbar { display: none; }

.mob-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 7px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
  color: var(--ink-soft);
}
.mob-tab svg { opacity: 0.6; transition: opacity 0.15s; }
.mob-tab.active {
  border-bottom-color: var(--blueprint);
  color: var(--blueprint);
}
.mob-tab.active svg { opacity: 1; }
.mob-tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Mobile tab panel — horizontal scroll row of chips */
.mob-tab-panel {
  display: none;  /* shown on mobile only via media query */
  flex-direction: row;
  gap: 10px;
  padding: 12px 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mob-tab-panel::-webkit-scrollbar { display: none; }

/* Mobile chips — larger, portrait orientation */
.mob-chip {
  flex-shrink: 0;
  width: 86px !important;
  padding: 12px 8px 10px !important;
  border-radius: 12px !important;
  gap: 6px !important;
}
.mob-chip .chip-icon {
  max-height: 64px !important;
}
.mob-chip .chip-width {
  font-size: 12px !important;
}
.mob-chip .chip-price {
  font-size: 11px !important;
}


/* =========================================================================
   MOBILE LAYOUT — max-width 767px
   All mobile overrides are consolidated here. Desktop is unaffected.
   ========================================================================= */


@media (max-width: 767px) {

  /* ---- Topbar --------------------------------------------------------- */
  .topbar {
    padding: 0 12px;
    height: 48px;
    gap: 8px;
  }
  .topbar h1 { font-size: 15px; }
  .topbar .sub { display: none; }
  .topbar .room-summary { font-size: 11px; }
  .btn-redesign { display: none; }   /* too cluttered on mobile */
  .btn-save-share { padding: 5px 10px; font-size: 11px; }
  .btn-link { display: none; }

  /* ---- App grid ------------------------------------------------------- */
  .app {
    grid-template-columns: 1fr;
    /* canvas area fills everything below topbar */
  }

  /* ---- Canvas area: single pane, managed by JS showScreen() ----------- */
  .canvas-area {
    flex-direction: column;
    height: calc(100dvh - 48px - 58px); /* topbar + bottom nav */
  }

  /* Dividers hidden on mobile — JS hides them too */
  .divider-v, .divider-h { display: none !important; }

  /* Both halves fill full space when shown, hidden by default */
  .plan-half {
    flex: 1 1 100% !important;
    min-width: 0;
    border-right: none;
    border-bottom: none;
  }
  .plan-half-top { flex: 1 1 0; }
  .plan-half-bottom { display: none; } /* front view hidden on mobile */

  .elev-half {
    flex: 1 1 100% !important;
    min-width: 0;
    display: none; /* shown by JS when 3D tab is active */
  }

  /* ---- Half toolbars -------------------------------------------------- */
  .half-toolbar {
    padding: 6px 10px;
    gap: 6px;
  }
  .half-label { font-size: 10px; }
  .edit-room { padding: 4px 8px; font-size: 10px; }

  /* ---- Running total (inside 3D pane) -------------------------------- */
  .placed-section {
    bottom: 10px;
    left: 10px;
  }
  .total-badge { padding: 6px 10px; gap: 6px; }
  .total-badge .label { display: none; }
  .total-badge .amount { font-size: 14px; }
  .total-badge .sub { display: none; }

  /* ---- 3D view controls ----------------------------------------------- */
  .iso-controls { gap: 4px; }
  .iso-view-btn { padding: 4px 8px; font-size: 11px; }
  .iso-reset-btn { padding: 4px 7px; }

  /* ---- Quote button in 3D pane ---------------------------------------- */
  .btn-quote {
    bottom: 10px;
    right: 10px;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* ---- Library panel: bottom sheet ------------------------------------ */
  .library-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 72vh;
    border-right: none;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .library-panel.open { transform: translateY(0); }

  /* Drag handle at top of sheet */
  .library-panel .panel-head {
    border-radius: 16px 16px 0 0;
    padding: 10px 16px 8px;
    flex-shrink: 0;
  }
  .library-panel .panel-head::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--line);
    border-radius: 2px;
    margin: 0 auto 8px;
  }
  .library-panel .panel-head h2 { font-size: 14px; margin: 0; }
  .library-panel .panel-head .hint { font-size: 11px; }

  /* Colors strip compact */
  .colors-strip { padding: 6px 14px; flex-shrink: 0; }
  .colors-strip .label { font-size: 10px; }
  .color-pick { padding: 3px 6px; font-size: 11px; }
  .color-pick .chip { width: 18px; height: 18px; }

  /* Desktop accordion hidden on mobile */
  .cab-group-v2 { display: none !important; }

  /* Mobile tab bar */
  .mob-tab-bar {
    display: flex !important;
    flex-shrink: 0;
  }

  /* Cabinet types container fills remaining sheet space */
  .cab-types {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Mobile tab panel fills the space and scrolls horizontally */
  .mob-tab-panel {
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    padding: 14px 12px 20px;
    min-height: 140px;
  }

    

  /* ---- Backdrop -------------------------------------------------------- */
  .sheet-backdrop.shown {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
  }

  /* ---- Wizard --------------------------------------------------------- */
  .wiz-wrap { padding: 20px 16px; }
  .wiz-dim-row { flex-direction: column; gap: 10px; }

  /* ---- Quote modal ----------------------------------------------------- */
  .quote-overlay .card { padding: 20px 16px; max-height: 92vh; }

  /* ---- Placement toast ------------------------------------------------ */
  .placement-qty-badge { bottom: 66px; font-size: 11px; }

  /* ---- FAB add button (hidden — catalog tab replaces it) -------------- */
  .fab-add { display: none; }

  /* ---- Detail popup --------------------------------------------------- */
  .cab-detail-popup { margin: 0 8px 8px; }

}


/* Override: show on mobile */
@media (max-width: 767px) {
  
}

/* ==========================================================================
   Mobile bottom navigation bar
   Base: hidden (desktop). Shown only on mobile via media query below.
   ========================================================================== */

.mob-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: var(--paper-card);
  border-top: 1px solid var(--line);
  z-index: 300;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.mob-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 0 4px;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mob-nav-btn svg { stroke: currentColor; }
.mob-nav-btn.active { color: var(--blueprint); }
.mob-nav-btn:active { transform: scale(0.92); }

@media (max-width: 767px) {
  .mob-nav { display: flex; }
}

/* ==========================================================================
   Mobile cabinet action sheet
   ========================================================================== */

.mob-action-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
}

.mob-action-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}

.mob-action-card {
  position: relative;
  width: 100%;
  background: var(--paper-card);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 32px;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.mob-action-handle {
  width: 36px; height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.mob-action-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mob-action-buttons {
  display: flex;
  gap: 10px;
}

.mob-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.mob-action-btn:active { transform: scale(0.95); background: var(--line-soft); }

.mob-action-icon {
  font-size: 22px;
  line-height: 1;
}

.mob-action-rotate { color: var(--blueprint); border-color: rgba(44,74,99,0.3); }
.mob-action-rotate:active { background: rgba(44,74,99,0.08); }

.mob-action-delete { color: #c0392b; border-color: rgba(192,57,43,0.3); }
.mob-action-delete .mob-action-icon { font-size: 20px; }
.mob-action-delete:active { background: rgba(192,57,43,0.08); }

.mob-action-close { color: var(--ink-soft); }

/* Action sheet sits above placement UI */
.mob-action-sheet { z-index: 2100; }

/* Hide placement qty badge on mobile when not needed */
@media (max-width: 767px) {
  .placement-qty-badge { z-index: 499; }   /* below action sheet */
  .placement-tooltip   { z-index: 499; }
}

/* ---- Stacked cabinet picker -------------------------------------------- */
.stack-picker {
  position: fixed;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  padding: 4px;
  z-index: 2000;
  min-width: 190px;
  animation: ctxIn 0.12s ease;
}
.stack-picker-hdr {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 5px 10px 3px;
}
.stack-picker-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.08s;
}
.stack-picker-item:hover { background: rgba(44,74,99,0.07); }
.stack-picker-item.active { background: rgba(44,74,99,0.1); color: var(--blueprint); font-weight: 600; }
.stack-type-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stack-type-tag.base { background: rgba(176,122,44,0.15); color: #7a520c; }
.stack-type-tag.wall { background: rgba(44,74,99,0.15);  color: var(--blueprint); }
.stack-type-tag.tall { background: rgba(80,60,120,0.15); color: #3d2d6b; }
.stack-name { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack-dims { font-size: 10px; color: var(--ink-faint); flex-shrink: 0; }

/* ---- Ruler mode active button ------------------------------------------ */
.edit-room#btn-ruler.active {
  background: #b07a2c;
  color: #fff;
  border-color: #b07a2c;
  animation: ruler-pulse 2s ease-in-out infinite;
}
@keyframes ruler-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(176,122,44,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(176,122,44,0); }
}

/* ---- Ruler mode banner -------------------------------------------------- */
.ruler-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #b07a2c;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  z-index: 50;
  flex-shrink: 0;
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.ruler-banner-icon { font-size: 16px; flex-shrink: 0; }
.ruler-banner span { flex: 1; }
.ruler-banner-exit {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.12s;
}
.ruler-banner-exit:hover { background: rgba(255,255,255,0.35); }

/* ---- Print button ------------------------------------------------------ */
.btn-print {
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.btn-print:hover { border-color: var(--blueprint); background: rgba(44,74,99,0.06); }

/* ---- Print styles ------------------------------------------------------ */
/* ---- Print styles -------------------------------------------------------- */
#print-3d-wrap { display: none; }

@media print {
  * { visibility: hidden !important; }

  .plan-half-top,
  .plan-half-top canvas,
  .elev-half,
  #iso-canvas { visibility: visible !important; }

  .half-toolbar, .placed-section, .btn-quote,
  .plan-half-bottom, .ruler-banner, .gap-banner,
  .fab-add, .placement-tooltip, .ctx-menu,
  .stack-picker, .elev-half .half-toolbar,
  .iso-controls, .iso-reset-btn,
  .total-badge, .placed-list { display: none !important; visibility: hidden !important; }

  body, html { margin: 0 !important; padding: 0 !important; background: #fff !important; }

  .plan-half-top {
    position: fixed !important;
    left: 2mm !important; top: 2mm !important;
    width: 47% !important;
    height: calc(100vh - 4mm) !important;
    overflow: hidden !important;
  }

  .plan-half-top canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
  }

  .elev-half {
    position: fixed !important;
    left: 51% !important; top: 2mm !important;
    width: 47% !important;
    height: calc(100vh - 4mm) !important;
    overflow: hidden !important;
  }

  #iso-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: contain !important;
  }

  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;

  @page { margin: 0; size: A4 landscape; }
}

/* ---- Undo / Redo buttons ----------------------------------------------- */
.btn-undo {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
}
.btn-undo:hover:not(:disabled) { border-color: var(--blueprint); background: rgba(44,74,99,0.06); }
.btn-undo:disabled { opacity: 0.35; cursor: default; }

/* ---- Gap warning banner ------------------------------------------------ */
.gap-banner {
  display: flex; align-items: center; gap: 10px;
  background: #7a3a1a; color: #fff;
  font-size: 12px; font-weight: 600; padding: 6px 14px;
  z-index: 50; flex-shrink: 0; animation: slideDown 0.2s ease;
}
.gap-banner-icon { font-size: 14px; }
.gap-banner-msg  { flex: 1; }
.gap-banner-fix, .gap-banner-close {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
  color: #fff; padding: 3px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.gap-banner-fix:hover, .gap-banner-close:hover { background: rgba(255,255,255,0.35); }

/* ---- Cabinet count badge ---------------------------------------------- */
.cat-count-badge {
  font-size: 11px; font-weight: 700; color: var(--blueprint);
  background: rgba(44,74,99,0.12); padding: 1px 7px; border-radius: 10px;
  margin-left: 6px;
}

/* ---- Dims overlay button ----------------------------------------------- */
.edit-room#btn-dims.active {
  background: var(--blueprint); color: #fff; border-color: var(--blueprint);
}

/* ---- Quote design name ------------------------------------------------- */
#q-design-name {
  font-size: 13px; color: var(--ink);
  padding: 8px 12px; border: 1.5px solid var(--line);
  border-radius: 8px; width: 100%; font-family: inherit;
  background: var(--paper-card); margin-bottom: 2px;
}
#q-design-name:focus { outline: none; border-color: var(--blueprint); }

/* ---- Catalog section dividers ------------------------------------------ */
.cat-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 4px;
  margin-top: 4px;
}
.cat-section-divider::before,
.cat-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.cat-section-divider-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blueprint);
  white-space: nowrap;
  background: var(--paper-card);
  padding: 0 4px;
}
.cat-section-divider:first-child {
  margin-top: 0;
  padding-top: 8px;
}

/* ---- Chip label redesign ---------------------------------------------- */
.chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-dims {
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 1px;
}
.chip-price {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass);
  margin-top: 2px;
}

/* ---- Print preview overlay -------------------------------------------- */
#print-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #f4f1ea;
  display: flex;
  flex-direction: column;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.pp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #2c4a63;
  color: #fff;
  flex-shrink: 0;
}
.pp-title {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.pp-hints {
  font-size: 11px;
  opacity: 0.7;
  flex: 1;
  text-align: center;
}
.pp-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pp-btn {
  padding: 7px 16px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.pp-btn:hover { background: rgba(255,255,255,0.3); }
.pp-print { background: #b07a2c !important; border-color: #b07a2c !important; }
.pp-print:hover { background: #8a5c1a !important; }
.pp-close { background: rgba(255,80,80,0.3) !important; }

.pp-body {
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}
.pp-panel {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  border: 1.5px solid #d8d3c6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pp-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #2c4a63;
  padding: 8px 12px 4px;
  flex-shrink: 0;
}
.pp-fp-img {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.pp-fp-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.pp-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.pp-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* When printing from the preview overlay */
@media print {
  * { visibility: hidden !important; }

  #print-preview-overlay { visibility: visible !important; }
  #print-preview-overlay * { visibility: visible !important; }

  .pp-toolbar  { display: none !important; }
  .pp-body     { padding: 0 !important; gap: 4px !important; }
  .pp-panel    { border: none !important; border-radius: 0 !important; }
  .pp-label    { padding: 2px 4px !important; font-size: 8px !important; }

  body, html   { margin: 0 !important; padding: 0 !important; }
  #print-preview-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: #fff !important;
  }

  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;

  @page { margin: 4mm; size: A4 landscape; }
}

/* ---- Topbar user info -------------------------------------------------- */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-left: 4px;
}
.topbar-user-icon { font-size: 13px; }
.topbar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-logout-btn {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(176,122,44,0.85);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}
.topbar-logout-btn:hover { background: #b07a2c; }

/* ── Free version banner ─────────────────────────────────────── */
.free-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, #fff6e6 0%, #fef0d6 100%);
  border-bottom: 1px solid #f0c06a;
  padding: 8px 16px;
  font-size: 12.5px;
  color: #5a4520;
  flex-shrink: 0;
}
.free-banner-icon { font-size: 14px; }
.free-banner-text { flex: 1; }
.free-banner-text b { color: #1f2a37; font-weight: 800; }
.free-banner-text a {
  color: #b07a2c;
  text-decoration: none;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
}
.free-banner-text a:hover { text-decoration: underline; }
.free-banner-close {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #8b7a4a;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}
.free-banner-close:hover { background: rgba(139,122,74,0.15); color: #5a4520; }
