:root{
  --bg:#f2f1ef;
  --card:#ffffff;
  --text:#151515;
  --muted:#74716c;
  --dark:#0d0d0d;
  --blue:#8a6a3f;
  --green:#16a34a;
  --orange:#f59e0b;
  --red:#dc2626;
  --border:#d8d4cc;
  --metal:#343434;
  --wood:#b78652;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Arial, Helvetica, sans-serif;
  background:var(--bg);
  color:var(--text);
}
.app{
  max-width:1600px;
  margin:0 auto;
  padding:24px;
}
header{
  display:flex;
  justify-content:flex-start;
  gap:16px;
  align-items:center;
  margin-bottom:22px;
  padding:14px 0 18px;
  border-bottom:1px solid rgba(13,13,13,.12);
}
.brand{
  width:86px;
  min-width:86px;
}
.brand img{
  display:block;
  width:86px;
  height:auto;
}
.header-copy{
  flex:1;
}
h1{
  margin:0;
  font-size:28px;
  letter-spacing:0;
  text-transform:uppercase;
}
.trustup-top{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:8px;
  color:#f5a400;
  font-size:15px;
  font-weight:500;
  text-decoration:none;
}
.trustup-top img{
  display:block;
  width:24px;
  height:24px;
  border-radius:4px;
  object-fit:contain;
}
.trustup-stars{
  display:inline-flex;
  gap:2px;
}
.trustup-stars span{
  display:inline-grid;
  place-items:center;
  width:18px;
  height:18px;
  border-radius:3px;
  background:#f8b400;
  color:#ffffff;
  font-size:13px;
  line-height:1;
}
.trustup-score{
  color:#f5a400;
}
header p{margin:6px 0 0;color:var(--muted)}
.top-actions{
  display:flex;
  justify-content:flex-start;
  margin:-8px 0 18px;
}
.home-link{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:6px;
  background:#ffffff;
  color:#111827;
  font-size:13px;
  font-weight:700;
  text-decoration:none;
}
.home-link:hover{
  border-color:#111827;
}
.badge{
  background:var(--dark);
  color:white;
  padding:8px 12px;
  border-radius:6px;
  font-weight:bold;
  text-transform:uppercase;
  font-size:12px;
  letter-spacing:0;
}
.grid{
  display:grid;
  grid-template-columns:minmax(380px, 520px) minmax(360px, 1fr);
  gap:20px;
  align-items:start;
}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
  padding:20px;
  box-shadow:0 14px 35px rgba(16,13,10,.06);
  margin-bottom:20px;
}
.live-column{
  display:grid;
  gap:20px;
}
.sticky{
  position:sticky;
  top:20px;
}
h2{
  margin:0 0 16px;
  font-size:20px;
}
.form-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(220px,1fr));
  gap:14px;
}
.config-card{
  display:grid;
  gap:12px;
}
.config-card h2{
  margin-bottom:4px;
}
.config-group{
  border:1px solid var(--border);
  border-radius:8px;
  background:#fbfaf8;
  overflow:hidden;
}
.config-group summary{
  cursor:pointer;
  padding:13px 14px;
  font-weight:800;
  color:#111827;
  list-style:none;
  border-bottom:1px solid transparent;
}
.config-group summary::-webkit-details-marker{display:none}
.config-group summary::before{
  content:"+";
  display:inline-grid;
  place-items:center;
  width:19px;
  height:19px;
  margin-right:8px;
  border:1px solid #cfc8bb;
  border-radius:4px;
  color:#2f2d2a;
  font-weight:800;
  line-height:1;
}
.config-group[open] summary{
  border-bottom-color:var(--border);
}
.config-group[open] summary::before{
  content:"-";
}
.config-group .form-grid{
  padding:14px;
}
label{
  display:flex;
  flex-direction:column;
  min-width:0;
  font-weight:700;
  font-size:14px;
  gap:6px;
}
input,select,textarea{
  width:100%;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  padding:11px 12px;
  border:1px solid var(--border);
  border-radius:6px;
  font-size:15px;
  background:#f9f8f5;
  font-family:inherit;
}
select{
  overflow:hidden;
  text-overflow:ellipsis;
}
textarea{
  resize:vertical;
  min-height:86px;
  line-height:1.35;
}
input:focus,select:focus,textarea:focus{
  outline:2px solid rgba(138,106,63,.24);
  border-color:var(--blue);
}
input.field-invalid{
  border-color:#dc2626;
  background:#fff1f2;
  color:#991b1b;
}
input.field-invalid:focus{
  outline:2px solid rgba(220,38,38,.22);
  border-color:#dc2626;
}
.step-preview{
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:112px minmax(0,1fr);
  gap:14px;
  align-items:center;
  padding:12px;
  border:1px solid var(--border);
  background:#f9f8f5;
  border-radius:6px;
}
.option-check{
  grid-column:1 / -1;
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:9px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:6px;
  background:#f9f8f5;
  color:#1f2937;
}
.option-check input{
  width:16px;
  height:16px;
  margin:0;
  padding:0;
  flex:0 0 16px;
}
.option-check span{
  font-weight:700;
}
.step-preview-media{
  position:relative;
  width:112px;
  height:76px;
  border:1px solid #d9dde5;
  border-radius:6px;
  background:#ffffff;
  overflow:hidden;
}
.step-preview-media img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.step-preview-swatch{
  width:100%;
  height:100%;
  background:linear-gradient(135deg,#3b4046,#101214);
}
.step-preview span{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:4px;
}
.step-preview strong{
  display:block;
  font-size:15px;
  color:#111827;
}
.step-preview p{
  margin:5px 0 0;
  color:#4c4944;
  font-size:13px;
  line-height:1.35;
}
.results,.price{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:6px 18px;
}
.results div,.price div{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:9px 0;
  border-bottom:1px solid #edf0f5;
}
.results span,.price span{color:var(--muted)}
.price .total{
  font-size:20px;
  border-bottom:0;
  grid-column:1 / -1;
}
.price .total strong{color:var(--blue)}
.payment-card{
  margin-top:14px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:6px;
  background:#f9f8f5;
}
.payment-card h3{
  margin:0 0 10px;
  font-size:15px;
  color:#111827;
}
.payment-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.payment-grid div{
  padding:7px 0;
  border-bottom:1px solid #e8e4dc;
}
.payment-grid span{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:3px;
}
.payment-grid strong{
  font-size:15px;
  color:#111827;
}
.payment-card p{
  margin:10px 0;
  color:#4c4944;
  font-size:13px;
  line-height:1.35;
}
.customer-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  margin:10px 0 12px;
}
.customer-grid label{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
}
.customer-grid input,
.customer-grid textarea{
  margin-top:4px;
}
.customer-grid small{
  margin-top:-4px;
}
.trustup-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:8px 0 12px;
  padding:10px 12px;
  border:1px solid #d8d4cc;
  border-radius:6px;
  background:#fff;
  color:#111827;
  text-decoration:none;
}
.trustup-card strong{
  font-size:19px;
}
.trustup-card span{
  color:#4c4944;
  font-size:13px;
  font-weight:700;
}
.hp-field{
  position:absolute!important;
  left:-10000px!important;
  width:1px!important;
  height:1px!important;
  overflow:hidden!important;
}
.send-status{
  min-height:18px;
  margin:8px 0 0!important;
  font-size:13px!important;
  font-weight:700;
}
.send-status.ok{color:#166534}
.send-status.error{color:#991b1b}
.check-row{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  margin:8px 0;
  font-weight:500;
  color:#1f2937;
  line-height:1.35;
}
.check-row input{
  flex:0 0 16px;
  width:16px;
  height:16px;
  margin:0;
  padding:0;
  align-self:center;
}
.check-row span{display:block}
.payment-card button{
  margin-top:10px;
}
.payment-card button:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.status{
  padding:12px;
  border-radius:6px;
  font-weight:700;
  margin-bottom:14px;
  background:#f3eadf;
}
.status.ok{background:#dcfce7;color:#166534}
.status.warn{background:#fef3c7;color:#92400e}
.status.bad{background:#fee2e2;color:#991b1b}
hr{
  border:0;
  border-top:1px solid var(--border);
  margin:18px 0;
}
button{
  margin-top:18px;
  width:100%;
  border:0;
  background:var(--dark);
  color:white;
  padding:13px 16px;
  border-radius:6px;
  font-weight:700;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:0;
}
button:hover{opacity:.9}
.table-wrap{overflow:auto}
table{
  width:100%;
  border-collapse:collapse;
}
th,td{
  padding:10px;
  border-bottom:1px solid var(--border);
  text-align:right;
}
th:first-child,td:first-child{text-align:left}
thead th{
  background:var(--dark);
  color:white;
}
.muted{color:var(--muted)}
pre{
  white-space:pre-wrap;
  background:#f9f8f5;
  border:1px solid var(--border);
  padding:16px;
  border-radius:8px;
}
.hidden{display:none!important}
@media(max-width:900px){
  .grid,.form-grid,.plan-grid,.results,.price,.payment-grid{grid-template-columns:1fr}
  .sticky{position:static}
  .plan-panel-wide{grid-column:auto}
}


.preview-block{
  margin-top:8px;
}
.preview-block h3{
  margin:0 0 8px;
  font-size:16px;
}
.section-heading{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}
.section-heading h2{
  margin-bottom:2px;
}
.plan-card{
  padding:18px;
}
.plan-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
}
.plan-panel{
  margin:0;
  min-width:0;
}
.plan-panel-wide{
  grid-column:1 / -1;
}
.plan-panel figcaption{
  margin:0 0 7px;
  color:#111827;
  font-size:14px;
  font-weight:800;
}
#threePreview{
  width:100%;
  height:520px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(239,236,230,.92)),
    radial-gradient(circle at 78% 18%, rgba(183,134,82,.18), transparent 30%);
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
  position:relative;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  cursor:grab;
}
#threePreview:active{
  cursor:grabbing;
}
.preview-card{
  padding:18px;
}
.preview-meta{
  margin-top:10px;
}
.preview-meta p{
  margin:0;
  color:#4c4944;
  font-size:13px;
  line-height:1.35;
}
.small{
  font-size:12px;
  margin-top:8px;
}
.preview-stringer{
  fill:none;
  stroke:#111827;
  stroke-width:8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preview-stringer-back{
  fill:none;
  stroke:#4b5563;
  stroke-width:7;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preview-step{
  fill:#d1d5db;
  stroke:#6b7280;
  stroke-width:1.5;
}
.preview-step-wood{
  fill:#d8b079;
}
.preview-step-sheet{
  fill:#c7cbd1;
}
.preview-step-cb{
  fill:#b9c1cb;
}
.preview-landing{
  fill:#cbd5e1;
  stroke:#64748b;
  stroke-width:2;
}
.preview-railing{
  fill:none;
  stroke:#1f2937;
  stroke-width:3;
  stroke-linecap:round;
}
.preview-post{
  stroke:#1f2937;
  stroke-width:3;
}
.preview-text{
  fill:#374151;
  font-size:13px;
  font-family:Arial, Helvetica, sans-serif;
}


.preview-shadow{
  fill:rgba(15,23,42,.08);
}
.preview-stringer{
  fill:none;
  stroke:#111827;
  stroke-width:7;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preview-stringer-back{
  fill:none;
  stroke:#4b5563;
  stroke-width:6;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preview-riser{
  fill:#9ca3af;
  opacity:.34;
}
.preview-step{
  fill:#d1d5db;
  stroke:#4b5563;
  stroke-width:1.2;
}
.preview-step-wood{
  fill:#c89055;
}
.preview-step-sheet{
  fill:#b6beca;
}
.preview-step-cb{
  fill:#aeb8c4;
}
.preview-gridline{
  stroke:#64748b;
  stroke-width:.8;
  opacity:.6;
}
.preview-landing{
  fill:#cbd5e1;
  stroke:#475569;
  stroke-width:1.5;
}
.preview-landing-side{
  fill:#94a3b8;
  opacity:.5;
}
.preview-railing{
  fill:none;
  stroke:#111827;
  stroke-width:2.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.preview-post{
  stroke:#111827;
  stroke-width:2.4;
  stroke-linecap:round;
}
.preview-text{
  fill:#374151;
  font-size:13px;
  font-family:Arial, Helvetica, sans-serif;
}


.preview-controls{
  display:flex;
  gap:8px;
  margin-top:8px;
}
.mini-btn{
  width:auto;
  margin:0;
  padding:8px 10px;
  border-radius:9px;
  background:#e5e7eb;
  color:#111827;
  font-size:13px;
}
.mini-btn.active{
  background:#1f2937;
  color:white;
}


#threePreview canvas{
  width:100%!important;
  height:100%!important;
  display:block;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}

.field-note{
  color:#6b7280;
  font-size:12px;
  line-height:1.35;
  font-weight:400;
}

#pdfExportBtn{
  margin-top:10px;
  background:#8a6a3f;
}

header{position:relative;}

.plan-canvas{
  width:100%;
  height:auto;
  background:#ffffff;
  border:1px solid var(--border);
  border-radius:8px;
  display:block;
}
.plan-canvas.hidden{display:none;}


/* V21 — vues 2D CAD */
.preview-block h3{letter-spacing:.01em}
.plan-canvas{
  background:#fff;
  border:1px solid var(--border);
  border-radius:8px;
  width:100%;
  height:auto;
  box-shadow: inset 0 0 0 1px rgba(17,24,39,.025);
}
.audit-card{
  margin-top:16px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fbfaf8;
}
.audit-card summary{
  cursor:pointer;
  font-size:16px;
  font-weight:800;
  color:#111827;
  list-style:none;
}
.audit-card summary::-webkit-details-marker{
  display:none;
}
.audit-card summary::before{
  content:"+";
  display:inline-grid;
  place-items:center;
  width:18px;
  height:18px;
  margin-right:8px;
  border:1px solid var(--border);
  border-radius:4px;
  font-size:13px;
}
.audit-card[open] summary{
  margin-bottom:10px;
}
.audit-card[open] summary::before{
  content:"-";
}
#optionAuditList{margin:0;padding-left:18px;font-size:13px;line-height:1.45}
#optionAuditList li.ok{color:#166534}
#optionAuditList li.warn{color:#92400e}
#optionAuditList li.bad{color:#991b1b;font-weight:700}
.site-footer{
  padding:14px 0 4px;
  color:#6b7280;
  font-size:12px;
  text-align:center;
}
.site-footer p{
  margin:0;
}

@media(max-width:900px){
  .grid,
  .form-grid,
  .plan-grid,
  .results,
  .price{
    grid-template-columns:1fr;
  }
  .plan-panel-wide{
    grid-column:auto;
  }
  header{
    align-items:flex-start;
  }
  .brand,
  .brand img{
    width:68px;
    min-width:68px;
  }
  h1{
    font-size:22px;
  }
  #threePreview{
    height:380px;
  }
}
