:root {
  --black: #0d0d0d;
  --ink: #1a1a1a;
  --muted: #6d6860;
  --line: #e7e2d9;
  --line-2: #d8d1c4;
  --paper: #ffffff;
  --sand: #f7f4ef;
  --gold: #b48a3c;
  --gold-d: #96712c;
  --gold-l: #f3ead8;
  --ok: #2f6b3f;
  --err: #b3261e;
  --err-bg: #fbeceb;
  --warn-bg: #fdf6e6;
  --radius: 10px;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-d); }
[hidden] { display: none !important; }

/* ---------- top bar */
.topbar { display: flex; align-items: center; gap: 18px; background: var(--black); color: #fff; padding: 10px 22px; min-height: 68px; border-bottom: 3px solid var(--gold); }
.brand img { display: block; height: 52px; width: auto; filter: invert(1); }
.topbar-title { flex: 1; min-width: 0; border-left: 1px solid #ffffff2e; padding-left: 18px; }
.topbar-title .eyebrow { display: block; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.topbar-title h1 { margin: 0; font: 600 24px/1.1 var(--serif); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-phone { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 14px; border: 1px solid #ffffff40; border-radius: 999px; white-space: nowrap; }
.topbar-phone:hover { border-color: var(--gold); color: var(--gold); }
.topbar-phone svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- layout */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; height: 740px; border-bottom: 1px solid var(--line); }
.stage { position: relative; min-width: 0; background: #dfe6ea; overflow: hidden; }
.viewer { position: absolute; inset: 0; }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--paper); }

/* ---------- viewer overlays */
.ov { position: absolute; z-index: 2; }
.ov-tl { top: 14px; left: 14px; }
.ov-tr { top: 14px; right: 14px; }
.ov-bl { left: 14px; bottom: 14px; }
.chip { display: inline-block; background: #0d0d0dd9; color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: .02em; backdrop-filter: blur(4px); }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; background: #ffffffeb; border: 1px solid #0000001a; border-radius: 999px; padding: 7px 13px 7px 10px; cursor: pointer; font-size: 13px; font-weight: 600; box-shadow: 0 2px 8px #0000001a; }
.icon-btn:hover { background: #fff; border-color: var(--gold); }
.icon-btn svg { width: 16px; height: 16px; fill: var(--ink); }
.price-pill { background: var(--black); color: #fff; border-radius: 12px; padding: 10px 16px; box-shadow: 0 6px 22px #0000003a; border-left: 4px solid var(--gold); }
.pp-label { display: block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.pp-value { display: block; font: 600 22px/1.15 var(--serif); letter-spacing: .01em; }
.hint { right: 14px; bottom: 14px; font-size: 12px; color: #1a1a1aaa; background: #ffffffb3; padding: 4px 10px; border-radius: 999px; }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; z-index: 3; pointer-events: none;
  opacity: 0; transition: opacity .2s; font-weight: 600; font-size: 14px; }
.loading.on { opacity: 1; }
.loading span { background: #fffffff0; padding: 8px 14px; border-radius: 999px; box-shadow: 0 2px 10px #00000022; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #ffffff; border-top-color: var(--gold); animation: spin .8s linear infinite; box-shadow: 0 0 0 1px #0000000f; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; padding: 14px 18px; border-radius: 10px; max-width: 80%; text-align: center; font-size: 14px; z-index: 3; }

/* ---------- stepper */
.steps { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line); background: var(--sand); }
.step-tab { appearance: none; border: 0; background: none; padding: 12px 2px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.step-tab .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-2); background: #fff; font-size: 12px; color: var(--muted); }
.step-tab.done .n { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-tab.active { color: var(--ink); }
.step-tab.active .n { background: var(--gold); border-color: var(--gold); color: #fff; }
.step-tab.active::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 3px; background: var(--gold); border-radius: 3px 3px 0 0; }
.step-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.step-body { flex: 1; overflow-y: auto; padding: 22px 24px 28px; min-height: 0; }
.step-body h2 { font: 600 27px/1.15 var(--serif); margin: 0 0 4px; letter-spacing: .005em; }
.step-body .lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fff; }
.step-count { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

/* ---------- buttons */
.btn { appearance: none; border: 1.5px solid transparent; border-radius: 8px; padding: 11px 20px; font-weight: 700; font-size: 14px; letter-spacing: .02em; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--black); color: #fff; }
.btn-primary:hover { background: #2a2a2a; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-d); }
.btn-ghost { background: #fff; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-block { width: 100%; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.btn-add { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px dashed var(--line-2); background: #fff; padding: 9px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn-add:hover { border-color: var(--gold); color: var(--gold-d); }
.btn-add b { font-size: 17px; line-height: 1; color: var(--gold); }

/* ---------- start cards */
.cards { display: grid; gap: 12px; }
.card-opt { appearance: none; text-align: left; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; padding: 14px 16px; cursor: pointer; display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: center; transition: border-color .15s, box-shadow .15s; }
.card-opt:hover { border-color: var(--line-2); box-shadow: 0 4px 14px #0000000d; }
.card-opt.sel { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-l); }
.card-ico { width: 54px; height: 54px; border-radius: 8px; background: var(--sand); display: grid; place-items: center; }
.card-ico svg { width: 38px; height: 38px; }
.card-opt h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card-opt p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sand); border: 1px solid var(--line); color: var(--ink); }
.badge.gold { background: var(--gold-l); border-color: #e6d5b2; color: var(--gold-d); }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }

/* ---------- fields */
.field { margin-bottom: 18px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.field label, .lbl { font-weight: 700; font-size: 13.5px; }
.field .help { font-size: 12px; color: var(--muted); }
.range-row { display: grid; grid-template-columns: 1fr 92px; gap: 12px; align-items: center; }
.num { display: flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff; overflow: hidden; }
.num:focus-within { border-color: var(--gold); }
.num input { width: 100%; border: 0; padding: 8px 4px 8px 10px; outline: none; background: none; font-weight: 600; min-width: 0; -moz-appearance: textfield; }
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num span { padding: 0 9px 0 2px; color: var(--muted); font-size: 13px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--gold) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 1px 4px #0003; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
input[type=range]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
select, .input, textarea { width: 100%; border: 1.5px solid var(--line-2); border-radius: 8px; padding: 9px 10px; background: #fff; outline: none; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
select:focus, .input:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 84px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.stat { background: var(--sand); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font: 600 19px/1.1 var(--serif); }
.stat span { font-size: 11.5px; color: var(--muted); letter-spacing: .03em; }
.locked { background: var(--warn-bg); border: 1px solid #efdcae; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }

/* ---------- segmented */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--line-2); border-radius: 8px; overflow: hidden; width: 100%; }
.seg button { appearance: none; border: 0; background: #fff; padding: 8px 6px; font-weight: 600; font-size: 13px; cursor: pointer; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- item cards (openings / lean-tos) */
.items { display: grid; gap: 12px; }
.item { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; background: #fff; }
.item.bad { border-color: #e6a9a4; background: #fffafa; }
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.item-ico { width: 32px; height: 32px; border-radius: 7px; background: var(--sand); display: grid; place-items: center; flex: none; }
.item-ico svg { width: 20px; height: 20px; }
.item-title { flex: 1; font-weight: 700; font-size: 14px; }
.item-title small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.x-btn { appearance: none; border: 0; background: none; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 20px; line-height: 1; color: var(--muted); }
.x-btn:hover { background: var(--err-bg); color: var(--err); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.mini label, .mini .lbl { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; letter-spacing: .02em; }
.mt { margin-top: 10px; }
.err-msg { color: var(--err); font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.err-msg:empty { display: none; }
.empty { text-align: center; color: var(--muted); padding: 18px; border: 1.5px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.readonly-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.readonly-list li { padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; display: flex; justify-content: space-between; gap: 10px; }
.readonly-list li:first-child { border-top: 0; }
.readonly-list li span:last-child { color: var(--muted); }

/* ---------- colors */
.color-group { margin-bottom: 20px; }
.color-group .field-head b { font-weight: 600; color: var(--gold-d); font-size: 13px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 7px; }
.sw { appearance: none; position: relative; aspect-ratio: 1; border-radius: 8px; border: 1px solid #00000026; cursor: pointer; padding: 0; box-shadow: inset 0 -6px 10px #0000001a; }
.sw.on { outline: 2.5px solid var(--gold); outline-offset: 2px; }
.sw.on::after { content: ""; position: absolute; left: 50%; top: 46%; width: 7px; height: 13px; border: solid var(--ck, #fff); border-width: 0 2.5px 2.5px 0; transform: translate(-50%, -50%) rotate(45deg); }
.sw:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* ---------- summary & quote */
#summaryTop { margin-top: 14px; }
.price-card { background: var(--black); color: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; border-top: 4px solid var(--gold); }
.price-card .pc-label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.price-card .pc-value { font: 600 34px/1.1 var(--serif); margin: 4px 0 6px; }
.price-card ul { margin: 8px 0 0; padding-left: 16px; color: #ffffffb8; font-size: 12px; }
.price-card li { margin: 2px 0; }
.specs { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 13.5px; }
.specs th { text-align: left; font-weight: 600; color: var(--muted); padding: 7px 10px 7px 0; width: 42%; vertical-align: top; }
.specs td { padding: 7px 0; font-weight: 600; }
.specs tr + tr th, .specs tr + tr td { border-top: 1px solid var(--line); }
details.notes { background: var(--sand); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 18px; }
details.notes summary { cursor: pointer; font-weight: 700; }
details.notes ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.quote h3 { font: 600 23px/1.2 var(--serif); margin: 6px 0 4px; }
.quote .grid2 { margin-bottom: 10px; }
.quote .mini { margin-bottom: 10px; }
.req { color: var(--gold-d); }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.form-err { background: var(--err-bg); color: var(--err); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.success { text-align: center; padding: 26px 10px; }
.success .ok-ico { width: 58px; height: 58px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; font-size: 30px; }
.success h3 { font: 600 26px/1.2 var(--serif); margin: 0 0 6px; }
.success p { color: var(--muted); margin: 0 0 16px; }
.fine { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 12px 22px; font-size: 12px; color: var(--muted); background: var(--sand); }

/* ---------- tablet / phone */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .stage { aspect-ratio: 4 / 3; max-height: 460px; width: 100%; }
  .panel { border-left: 0; }
  .step-body { overflow: visible; padding: 18px 16px 22px; }
  .step-nav { padding: 12px 16px; }
}
@media (max-width: 560px) {
  .topbar { padding: 8px 14px; gap: 12px; min-height: 58px; }
  .brand img { height: 36px; }
  .topbar-title { padding-left: 12px; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-title .eyebrow { font-size: 9.5px; }
  .topbar-phone { padding: 8px; border-radius: 50%; }
  .topbar-phone span { display: none; }
  .stage { aspect-ratio: 1 / 0.9; }
  .step-tab { font-size: 0; padding: 10px 0 9px; gap: 0; }
  .step-tab.active { font-size: 11px; gap: 3px; }
  .icon-btn span { display: none; }
  .icon-btn { padding: 8px; }
  .hint { display: none; }
  .pp-value { font-size: 18px; }
  .price-pill { padding: 8px 12px; }
  .chip { font-size: 12px; }
  .step-body h2 { font-size: 24px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .range-row { grid-template-columns: 1fr 84px; }
  .price-card .pc-value { font-size: 28px; }
  .foot { padding: 12px 16px; }
  .card-opt { grid-template-columns: 44px 1fr; gap: 12px; padding: 12px; }
  .card-ico { width: 44px; height: 44px; }
  .card-ico svg { width: 30px; height: 30px; }
}
