:root {
  --gold: #b08a4f;
  --gold-dark: #8a6a38;
  --cream: #f6f1e8;
  --ink: #2b241a;
  --muted: #7d715f;
  --line: rgba(176, 138, 79, 0.25);
  --surface: rgba(253, 251, 246, 0.96);
  --green: #2e7d46;
  --red: #b3372e;
  --shadow: 0 24px 70px rgba(43, 36, 26, 0.18);
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 255, 255, 0.5), transparent 30%),
    linear-gradient(135deg, #efe7d8 0%, #e4d7c0 50%, #cdb894 100%);
  overflow: hidden;
}

button, input, select { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(360px, 1fr) minmax(320px, 400px);
  gap: 14px;
  width: 100vw;
  height: 100dvh;
  padding: 14px;
}

.panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  min-width: 54px;
  height: 38px;
  padding: 0 8px;
  border: 2px solid var(--gold);
  border-radius: 50% / 46%;
  color: var(--gold-dark);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--gold-dark);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: 19px; }
h2 { font-size: 21px; }

.control-section {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--gold-dark);
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-heading em {
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  text-transform: none;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #4d4335;
  font-size: 12.5px;
  font-weight: 700;
}

.field-label output { color: var(--ink); font-weight: 800; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.segmented.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.segment {
  min-height: 38px;
  border: 1px solid #d5c6ab;
  border-radius: 7px;
  color: #5a4d3a;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 160ms ease;
}

.segment:hover { border-color: var(--gold); transform: translateY(-1px); }

.segment.active {
  border-color: var(--gold-dark);
  color: #fff;
  background: var(--gold-dark);
}

.range { width: 100%; accent-color: var(--gold-dark); }

.range-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11.5px;
}

.select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d5c6ab;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  color: #4d4335;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.check-row input { width: 17px; height: 17px; accent-color: var(--gold-dark); }

.wood-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.swatch {
  position: relative;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 140ms ease, box-shadow 140ms ease;
  padding: 0;
  overflow: hidden;
}

.swatch span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 3px;
  background: rgba(255, 255, 255, 0.82);
  color: #3d3425;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swatch:hover { transform: translateY(-2px); }

.swatch.active {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 2px var(--gold), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.viewer-wrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  background: #efeae2;
  box-shadow: var(--shadow);
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-toolbar {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
}

.parts-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(43, 36, 26, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(43, 36, 26, 0.12);
}

.parts-button:hover { border-color: var(--gold); }

.parts-button span { color: var(--muted); font-weight: 700; }

.parts-panel {
  position: absolute;
  z-index: 5;
  top: 64px;
  left: 14px;
  width: 320px;
  max-height: 46%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(43, 36, 26, 0.12);
  border-radius: 10px;
  background: rgba(253, 251, 246, 0.97);
  box-shadow: 0 18px 50px rgba(43, 36, 26, 0.25);
  overflow: hidden;
}

.parts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 13px;
  color: var(--ink);
}

.panel-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.panel-close:hover { color: var(--ink); background: rgba(176, 138, 79, 0.15); }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.perfect { background: #2563c9; }
.dot.ok { background: #2e9e52; }
.dot.mid { background: #e09b2d; }
.dot.low { background: #cf4433; }

.parts-list {
  overflow: auto;
  scrollbar-width: thin;
  padding: 4px 0 8px;
}

.parts-cat {
  padding: 8px 12px 3px;
  color: var(--gold-dark);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.part-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: var(--ink);
}

.part-row:hover { background: rgba(176, 138, 79, 0.1); }

.part-row.active { background: rgba(176, 138, 79, 0.2); }

.part-row .ref-badge { min-width: 58px; text-align: center; }

.part-row .part-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.part-preview {
  position: absolute;
  z-index: 5;
  left: 14px;
  bottom: 96px;
  width: 250px;
  border: 1px solid rgba(43, 36, 26, 0.12);
  border-radius: 10px;
  background: rgba(253, 251, 246, 0.97);
  box-shadow: 0 18px 50px rgba(43, 36, 26, 0.25);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.preview-head strong {
  flex: 1;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.preview-canvas-wrap {
  position: relative;
}

#previewCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: transparent;
}

#previewDimsSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.preview-dims {
  padding: 7px 10px 3px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  font-family: Consolas, monospace;
}

.preview-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pill-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: none;
}

.pill-stack span {
  padding: 9px 12px;
  border: 1px solid rgba(43, 36, 26, 0.1);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(43, 36, 26, 0.08);
}

.pill-stack span.warn {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.tooltip {
  display: none;
  position: absolute;
  z-index: 4;
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(30, 25, 17, 0.92);
  color: #fff;
  font-size: 12.5px;
  pointer-events: none;
  max-width: 260px;
}

.tooltip b {
  color: #ecc987;
  margin-right: 6px;
  font-family: Consolas, monospace;
}

.viewer-hint {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 74px;
  margin: 0;
  text-align: center;
  color: rgba(43, 36, 26, 0.55);
  font-size: 11.5px;
  pointer-events: none;
}

.dimension-strip {
  position: absolute;
  z-index: 3;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dimension-strip div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(30, 25, 17, 0.85);
  color: #fff;
}

.dimension-strip span {
  display: block;
  color: #d9c8a8;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dimension-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.basket-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.basket-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.price-card {
  display: grid;
  gap: 5px;
  padding: 15px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, #3a3022, #58452c);
}

.price-card span,
.sale-price span {
  color: #d9c8a8;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.price-card strong { font-size: clamp(26px, 3.5vw, 36px); }

.price-card small { color: #cbbb9b; line-height: 1.4; font-size: 11.5px; }

.basket-list { display: grid; gap: 2px; }

.basket-cat {
  margin-top: 10px;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.basket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 6px;
  border-bottom: 1px solid rgba(176, 138, 79, 0.16);
  border-radius: 6px;
}

.basket-row.flash { animation: rowflash 1.6s ease; }

@keyframes rowflash {
  0%, 60% { background: rgba(176, 138, 79, 0.28); }
  100% { background: transparent; }
}

.basket-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.ref-badge {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(176, 138, 79, 0.16);
  color: var(--gold-dark);
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.basket-row strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.25;
}

.basket-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.basket-row b { color: var(--ink); font-size: 13px; white-space: nowrap; }

.price-edit {
  padding: 0 3px;
  border: none;
  border-bottom: 1px dashed var(--gold);
  border-radius: 3px;
  background: transparent;
  color: var(--gold-dark);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.price-edit:hover { background: rgba(176, 138, 79, 0.14); }

.price-edit.overridden { color: var(--green); border-bottom-color: var(--green); }

.margin-box, .notes-box {
  display: grid;
  gap: 9px;
  padding: 13px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.sale-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sale-price strong { color: var(--green); font-size: 19px; }

.export-row { display: flex; gap: 8px; flex-wrap: wrap; }

.action-button {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--gold-dark);
  border-radius: 7px;
  background: var(--gold-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms ease;
}

.action-button:hover { background: var(--gold); border-color: var(--gold); }

.action-button.ghost {
  background: transparent;
  color: var(--gold-dark);
}

.action-button.ghost:hover { background: rgba(176, 138, 79, 0.12); color: var(--gold-dark); }

.notes-box strong { color: var(--ink); font-size: 12.5px; }

.notes-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  body { overflow: auto; }

  .app-shell {
    grid-template-columns: 340px minmax(420px, 1fr);
    height: auto;
    min-height: 100dvh;
  }

  .panel-right { grid-column: 1 / -1; }

  .viewer-wrap {
    position: sticky;
    top: 14px;
    height: calc(100vh - 28px);
    min-height: 440px;
    align-self: start;
  }
}

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; padding: 10px; }

  .viewer-wrap { min-height: 500px; order: -1; }

  .dimension-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .wood-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Premium architectural studio treatment
   -------------------------------------------------------------------------- */

:root {
  --gold: #b8945c;
  --gold-dark: #896b3d;
  --cream: #f2f0eb;
  --ink: #191916;
  --muted: #77746d;
  --line: rgba(24, 24, 20, 0.1);
  --surface: rgba(248, 247, 243, 0.985);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
}

body {
  background:
    radial-gradient(circle at 50% -15%, rgba(167, 145, 111, 0.26), transparent 42%),
    #151513;
}

.app-shell {
  width: 100%;
  grid-template-columns: minmax(282px, 310px) minmax(430px, 1fr) minmax(310px, 350px);
  gap: 10px;
  padding: 10px;
}

.panel {
  gap: 0;
  padding: 0 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.25);
  scrollbar-color: rgba(137, 107, 61, 0.35) transparent;
}

.panel::-webkit-scrollbar,
.parts-list::-webkit-scrollbar { width: 6px; }

.panel::-webkit-scrollbar-thumb,
.parts-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(137, 107, 61, 0.32);
}

.brand-block {
  position: sticky;
  z-index: 3;
  top: 0;
  gap: 11px;
  margin: 0 -18px 6px;
  padding: 17px 18px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 247, 243, 0.96);
  backdrop-filter: blur(18px);
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(137, 107, 61, 0.52);
  border-radius: 50%;
  color: var(--gold-dark);
  background: linear-gradient(145deg, #fff, #ece7dc);
  box-shadow: inset 0 0 0 4px #f7f4ed, 0 5px 14px rgba(79, 59, 28, 0.12);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(137, 107, 61, 0.26);
  border-radius: 50%;
}

.brand-mark i {
  position: relative;
  z-index: 1;
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 600;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--gold-dark);
  font-size: 9px;
  letter-spacing: 0.12em;
}

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 { font-size: 21px; }
h2 { font-size: 25px; }

.control-section {
  gap: 9px;
  padding: 17px 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.control-section:last-child { border-bottom: 0; }

.section-heading {
  margin-bottom: 2px;
  color: #282721;
  font-size: 10.5px;
  letter-spacing: 0.11em;
}

.section-heading em {
  color: #98948a;
  font-size: 9.5px;
  letter-spacing: 0.01em;
}

.field-label {
  color: #4b4942;
  font-size: 11.5px;
  font-weight: 650;
}

.field-label output {
  padding: 2px 6px;
  border-radius: 5px;
  color: #fff;
  background: #26251f;
  font-size: 10.5px;
}

.segment {
  min-height: 36px;
  padding: 5px 6px;
  border-color: #d9d5ca;
  border-radius: 8px;
  color: #5b5850;
  background: #fff;
  font-size: 11.5px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.segment:hover {
  border-color: #a98a59;
  color: #24231e;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(88, 65, 29, 0.08);
}

.segment.active {
  border-color: #25241f;
  background: #25241f;
  box-shadow: 0 7px 18px rgba(22, 21, 18, 0.2);
}

.select {
  min-height: 39px;
  padding: 0 34px 0 11px;
  border-color: #d7d3c8;
  border-radius: 8px;
  color: #302f2a;
  background-color: #fff;
  font-size: 11.5px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 148, 92, 0.15);
}

.range {
  height: 18px;
  accent-color: #282720;
}

.range-meta { font-size: 9.5px; }

.check-row {
  min-height: 28px;
  color: #55524b;
  font-size: 11.5px;
  font-weight: 600;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: #282720;
}

.wood-row { gap: 6px; }

.swatch {
  height: 48px;
  border-width: 1px;
  border-color: rgba(0, 0, 0, 0.1);
  border-radius: 9px;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.swatch::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(97deg, transparent 0 7px, rgba(55, 25, 8, 0.12) 8px, transparent 9px 15px);
  mix-blend-mode: multiply;
}

.swatch span {
  z-index: 1;
  padding: 3px 2px;
  color: #292722;
  background: rgba(255, 255, 255, 0.82);
  font-size: 8.5px;
  backdrop-filter: blur(5px);
}

.swatch.active {
  border-color: #1f1f1b;
  box-shadow: 0 0 0 2px #f8f6f0, 0 0 0 3px #1f1f1b, 0 8px 20px rgba(0, 0, 0, 0.18);
}

.viewer-wrap {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: #cbc8c1;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.viewer-wrap::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), inset 0 -120px 120px -120px rgba(0,0,0,.45);
}

.viewer-toolbar {
  z-index: 4;
  top: 16px;
  left: 16px;
  right: 16px;
}

.parts-button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  color: #25241f;
  background: rgba(247, 246, 242, 0.84);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.13);
  backdrop-filter: blur(18px) saturate(1.2);
}

.parts-button { padding: 0 13px; }

.parts-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.icon-button {
  width: 40px;
  padding: 0;
  cursor: pointer;
}

.parts-button:hover,
.icon-button:hover {
  border-color: rgba(137, 107, 61, 0.65);
  background: rgba(255, 255, 255, 0.94);
  transform: translateY(-1px);
}

.mood-switch {
  display: flex;
  min-height: 40px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 10px;
  background: rgba(247, 246, 242, 0.72);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.11);
  backdrop-filter: blur(18px) saturate(1.2);
}

.mood-switch button {
  display: inline-flex;
  min-width: 62px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  color: #666159;
  background: transparent;
  font-size: 9.5px;
  font-weight: 750;
  cursor: pointer;
  transition: color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.mood-switch button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.mood-switch button.active {
  color: #25231e;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.11);
}

.viewer-wrap.evening .mood-switch {
  border-color: rgba(255, 187, 112, 0.24);
  background: rgba(21, 24, 29, 0.76);
}

.viewer-wrap.evening .mood-switch button { color: #aaa7a1; }
.viewer-wrap.evening .mood-switch button.active { color: #ffe3bd; background: rgba(255, 150, 71, 0.18); }
.viewer-wrap.evening .parts-button,
.viewer-wrap.evening .icon-button,
.viewer-wrap.evening .pill-stack span {
  border-color: rgba(255, 195, 128, 0.2);
  color: #f2e9dd;
  background: rgba(18, 21, 26, 0.75);
}

.viewer-wrap.evening .scene-signature { color: rgba(255, 215, 166, 0.55); }

.camera-dock {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 82px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(24, 24, 21, 0.76);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px) saturate(1.2);
  transform: translateX(-50%);
}

.camera-dock-label {
  padding: 0 7px 0 8px;
  color: #a9a397;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.camera-dock button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: #c7c2b9;
  background: transparent;
  font-size: 8.5px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.camera-dock button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.camera-dock button.active {
  color: #27241e;
  background: #f5efe4;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

.camera-dock button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.viewer-wrap.evening .camera-dock {
  border-color: rgba(255, 174, 94, 0.2);
  background: rgba(13, 16, 21, 0.8);
}

.viewer-wrap.evening .camera-dock button.active {
  color: #ffe5c1;
  background: rgba(255, 142, 61, 0.2);
}

.pill-stack span {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 9px;
  color: #302e29;
  background: rgba(247, 246, 242, 0.8);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(16px);
}

.parts-panel,
.part-preview {
  z-index: 6;
  border-color: rgba(255,255,255,.65);
  border-radius: 12px;
  background: rgba(248, 247, 243, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(20px);
}

.parts-panel { top: 66px; left: 16px; }
.part-preview { left: 16px; }

.scene-signature {
  position: absolute;
  z-index: 4;
  top: 70px;
  right: 17px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(31, 30, 27, 0.55);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  pointer-events: none;
}

.scene-signature span {
  width: 18px;
  height: 1px;
  background: currentColor;
}

.viewer-hint {
  z-index: 4;
  bottom: 130px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 8px rgba(0,0,0,.55);
}

.dimension-strip {
  z-index: 4;
  left: 16px;
  right: 16px;
  bottom: 16px;
  gap: 7px;
}

.dimension-strip div {
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(20, 20, 18, 0.8);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
}

.dimension-strip span {
  color: #b9ae9d;
  font-size: 8.5px;
  letter-spacing: 0.09em;
}

.dimension-strip strong {
  margin-top: 4px;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 500;
}

.panel-right { padding-top: 19px; }

.basket-head {
  margin: 0 -2px;
  padding: 1px 2px 17px;
}

.basket-head p:last-child {
  margin-top: 8px;
  font-size: 11px;
}

.price-card {
  position: sticky;
  z-index: 2;
  top: 0;
  margin: 14px 0 10px;
  padding: 17px;
  border: 1px solid rgba(211, 178, 126, 0.16);
  border-radius: 12px;
  background:
    radial-gradient(circle at 92% 5%, rgba(210, 173, 112, 0.22), transparent 42%),
    linear-gradient(145deg, #24231f, #373128);
  box-shadow: 0 14px 30px rgba(29, 25, 18, 0.18);
}

.price-card span { color: #c7b89f; font-size: 9.5px; letter-spacing: .09em; }
.price-card strong { font-family: Georgia, serif; font-size: clamp(28px, 3.2vw, 38px); font-weight: 500; }

.basket-cat {
  margin-top: 15px;
  color: #7d6239;
  font-size: 9.5px;
  letter-spacing: 0.1em;
}

.basket-row {
  padding: 10px 5px;
  border-bottom-color: rgba(20, 20, 18, 0.08);
}

.basket-row strong { font-size: 11.5px; }
.basket-row span { font-size: 10.5px; }
.basket-row b { font-size: 11.5px; }

.ref-badge {
  border: 1px solid rgba(137, 107, 61, 0.1);
  border-radius: 5px;
  background: rgba(184, 148, 92, 0.12);
  color: #775b31;
  font-size: 9.5px;
}

.tooltip {
  z-index: 7;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: rgba(22, 21, 18, 0.92);
  box-shadow: 0 12px 26px rgba(0,0,0,.2);
  backdrop-filter: blur(12px);
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 300px minmax(420px, 1fr); }
  .panel-right { padding-top: 19px; }
}

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; padding: 7px; gap: 7px; }
  .viewer-wrap { min-height: min(620px, calc(100dvh - 14px)); border-radius: 13px; }
  .scene-signature { display: none; }
  .pill-stack span { padding: 7px 8px; }
  .dimension-strip { left: 10px; right: 10px; bottom: 10px; }
  .mood-switch button { min-width: 38px; padding: 0 6px; }
  .mood-switch button { font-size: 0; }
  .mood-switch button svg { width: 16px; height: 16px; }
  .camera-dock { bottom: 118px; max-width: calc(100% - 18px); }
  .camera-dock-label { display: none; }
  .camera-dock button { padding: 0 7px; }
  .camera-dock button span { display: none; }
  .viewer-hint { bottom: 163px; padding: 0 45px; }
}

/* --------------------------------------------------------------------------
   Viewer tool states, price popover, toasts
   -------------------------------------------------------------------------- */

.icon-button.active {
  border-color: #25241f;
  color: #f5efe4;
  background: #25241f;
}

.icon-button.active:hover {
  border-color: #25241f;
  background: #35332c;
}

.viewer-wrap.evening .icon-button.active {
  border-color: rgba(255, 174, 94, 0.4);
  color: #ffe5c1;
  background: rgba(255, 142, 61, 0.24);
}

.export-row { padding-top: 12px; }

.action-button.danger { border-color: rgba(179, 55, 46, 0.4); color: var(--red); }
.action-button.danger:hover { border-color: var(--red); background: rgba(179, 55, 46, 0.08); color: var(--red); }

.price-pop {
  position: fixed;
  z-index: 40;
  width: 240px;
  padding: 12px 13px 13px;
  border: 1px solid rgba(24, 24, 20, 0.14);
  border-radius: 12px;
  background: #fdfcf9;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.price-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price-pop-head strong {
  font-size: 12px;
  font-family: Consolas, monospace;
  color: #6d5426;
}

.price-pop-head .panel-close { width: 26px; height: 26px; font-size: 18px; }

.price-pop p {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-pop-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.price-pop-row span { color: var(--muted); font-weight: 700; }

.price-pop-row input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #d7d3c8;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
}

.price-pop-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 148, 92, 0.16);
}

.price-pop-row input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(179, 55, 46, 0.15);
}

.price-pop-actions { display: flex; gap: 7px; }
.price-pop-actions .action-button { min-height: 34px; font-size: 12px; }

.toast-host {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(24, 23, 20, 0.92);
  color: #f3efe6;
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  animation: toast-in 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast.out { opacity: 0; transform: translateY(8px); transition: all 400ms ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------------------
   Client-ready print quote
   -------------------------------------------------------------------------- */

.print-sheet { display: none; }

@media print {
  body { overflow: visible; background: #fff; }
  .app-shell, .price-pop, .toast-host, .tooltip { display: none !important; }

  .print-sheet {
    display: block;
    padding: 4px 2px;
    color: #191712;
    font-size: 12px;
    font-family: Georgia, "Times New Roman", serif;
  }

  .print-sheet header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid #191712;
  }

  .print-sheet h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
  .print-sheet header p { margin: 4px 0 0; color: #6b6459; font-size: 11px; }
  .print-sheet .print-date { color: #6b6459; font-size: 11.5px; }

  .print-sheet table { width: 100%; border-collapse: collapse; }

  .print-sheet table.spec { margin-bottom: 18px; }
  .print-sheet table.spec th,
  .print-sheet table.spec td {
    padding: 5px 8px;
    border: 1px solid #ddd6c8;
    text-align: left;
    vertical-align: top;
  }
  .print-sheet table.spec th {
    width: 15%;
    background: #f4f0e7;
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #5c5342;
  }
  .print-sheet table.spec td { width: 35%; font-size: 12px; }

  .print-sheet table.bom th {
    padding: 6px 8px;
    border-bottom: 1.5px solid #191712;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    color: #5c5342;
  }
  .print-sheet table.bom td { padding: 5px 8px; border-bottom: 1px solid #e7e1d4; }
  .print-sheet table.bom td small { color: #837a6a; }
  .print-sheet table.bom td.ref { font-family: Consolas, monospace; font-size: 10.5px; white-space: nowrap; }
  .print-sheet table.bom td.num, .print-sheet table.bom th:nth-child(n+3) { text-align: right; white-space: nowrap; }
  .print-sheet table.bom tr.cat td {
    padding-top: 12px;
    border-bottom: 1px solid #b9ad94;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #7d6239;
  }
  .print-sheet table.bom tfoot td {
    padding-top: 10px;
    border-top: 2px solid #191712;
    border-bottom: none;
    font-size: 14px;
    font-weight: 700;
  }
  .print-sheet .fine { margin-top: 14px; color: #6b6459; font-size: 10px; line-height: 1.5; }
}
