*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #333;
  font-size: 15px;
  line-height: 1.5;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding-bottom: 48px;
}

/* ─── Canvas ─────────────────────────────────────────────── */
.canvas-wrapper {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid #e2e2e2;
  padding: 10px 18px 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

.canvas-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.canvas-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.layout-badge {
  font-size: 12px;
  background: #eef3fc;
  color: #3a72c8;
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 500;
}

#canvas-warnings { margin-top: 4px; }

.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #888;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
}
.canvas-placeholder.visible {
  display: flex;
}
.canvas-placeholder-sub {
  font-size: 14px;
  color: #aaa;
}

.warning {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #795548;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  margin-bottom: 3px;
}

/* ─── Wizard ─────────────────────────────────────────────── */
.wizard-wrapper {
  background: #fff;
  border-radius: 14px;
  padding: 26px 30px;
  margin: 20px 16px 0;
  box-shadow: 0 1px 5px rgba(0,0,0,.07);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #ebebeb;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4a90d9;
  border-radius: 3px;
  transition: width .35s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

/* ─── Field block ─────────────────────────────────────────── */
.field-block { min-height: 130px; }

.field-label {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.field-help {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #999;
  margin-top: 2px;
}

.field-error {
  color: #d32f2f;
  font-size: 13px;
  margin: 5px 0 8px;
}

/* Select */
.select-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.opt-btn {
  padding: 9px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  transition: border-color .15s, background .15s;
}
.opt-btn:hover { border-color: #4a90d9; background: #f0f6ff; }
.opt-btn.active {
  border-color: #4a90d9;
  background: #e8f0fb;
  color: #1a5ca8;
  font-weight: 600;
}

/* Option description — short customer-friendly text under the option row.
 * Updates on hover/click to help the client compare materials without
 * phoning a salesperson. */
.opt-description {
  margin-top: 14px;
  padding: 10px 14px;
  background: #f6f3ec;
  border-left: 3px solid #c8b896;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #4a4538;
  min-height: 20px;
}

/* Dimension step — form + hint side by side */
.dim-step-layout {
  display: flex;
  align-items: center;
  gap: 16px;
}
.dim-step-form { flex: 1; min-width: 0; }
.dim-step-hint {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 8px;
  padding-top: 24px;
  align-self: flex-start;
}
.dim-step-hint svg { max-width: 320px; height: auto; overflow: visible; }
@media (max-width: 640px) {
  .dim-step-layout { flex-direction: column; gap: 10px; }
  .dim-step-hint { justify-content: center; padding-left: 0; }
  .dim-step-hint svg { max-width: 240px; }
}

/* Number */
.num-input {
  display: block;
  margin-top: 14px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 18px;
  width: 220px;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.num-input:focus { outline: none; border-color: #4a90d9; }
.num-input.invalid { border-color: #e53935; }

/* Multiselect */
.multi-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.check-label:hover { border-color: #4a90d9; background: #f0f6ff; }
.check-label input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }
.check-label.checked {
  border-color: #4a90d9;
  background: #e8f0fb;
  color: #1a5ca8;
}

/* Field done */
.field-done {
  color: #2e7d32;
  font-size: 15px;
  padding: 16px 0;
}

/* ─── Nav buttons ─────────────────────────────────────────── */
.nav-btns {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.nav-btn {
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
}
.nav-btn.primary { background: #4a90d9; color: #fff; }
.nav-btn.primary:hover { background: #2f78c8; }
.nav-btn.secondary { background: #f0f0f0; color: #555; border: 1px solid #ddd; }
.nav-btn.secondary:hover { background: #e4e4e4; }

/* ─── Calc button ─────────────────────────────────────────── */
.calc-row {
  margin-top: 26px;
  border-top: 1px solid #f0f0f0;
  padding-top: 20px;
}

.calc-btn {
  width: 100%;
  padding: 15px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  letter-spacing: .01em;
}
.calc-btn:hover:not(:disabled) { background: #1e9651; }
.calc-btn:disabled { background: #c8c8c8; cursor: not-allowed; }

/* ─── API error ───────────────────────────────────────────── */
.api-error {
  background: #fdecea;
  border: 1px solid #f5c6c2;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #b71c1c;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.api-error-block {
  background: #fdecea;
  border: 1px solid #f5c6c2;
  border-radius: 10px;
  padding: 24px;
  color: #b71c1c;
  text-align: center;
  line-height: 1.7;
}

.loading {
  color: #bbb;
  font-size: 14px;
  padding: 24px 0;
}

/* ─── Result ──────────────────────────────────────────────── */
#result { margin: 20px 16px 0; }

.result-card {
  background: #fff;
  border-radius: 14px;
  padding: 30px;
  box-shadow: 0 1px 5px rgba(0,0,0,.07);
}

.result-title {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.result-price {
  font-size: 40px;
  font-weight: 700;
  color: #2e7d32;
  margin-bottom: 28px;
  letter-spacing: -.01em;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 28px;
}
.result-table th {
  text-align: left;
  padding: 9px 12px;
  background: #f7f8fa;
  border-bottom: 2px solid #e8e8e8;
  color: #666;
  font-weight: 600;
}
.result-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f2f2f2;
  color: #333;
}
.result-table td:not(:first-child) { text-align: right; }
.result-table th:not(:first-child) { text-align: right; }
.result-table tr:last-child td { border-bottom: none; }
.result-table tfoot td {
  font-weight: 700;
  border-top: 2px solid #e8e8e8;
  color: #2e7d32;
  font-size: 15px;
}

/* WhatsApp block */
.wa-block { margin-top: 24px; }
.wa-label { font-size: 12px; color: #999; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.wa-text {
  width: 100%;
  height: 96px;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  resize: none;
  color: #333;
  background: #fafafa;
}
.copy-btn {
  margin-top: 8px;
  padding: 8px 20px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}
.copy-btn:hover { background: #1db954; }

/* WhatsApp capture form */
.wa-capture-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}
.wa-capture-desc {
  font-size: 14px;
  color: #555;
  line-height: 1.55;
  margin-bottom: 20px;
}
.wa-capture-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #999;
}
.wa-phone-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wa-phone-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #d0d0d0;
  border-radius: 10px;
  font-size: 16px;
  color: #1a1a1a;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s;
}
.wa-phone-input:focus {
  outline: none;
  border-color: #25d366;
}
.wa-phone-error {
  font-size: 13px;
  color: #d32f2f;
}
.wa-send-btn {
  width: 100%;
  padding: 14px 20px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.wa-send-btn:hover { background: #1db954; }
.tg-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.tg-send-btn {
  width: 100%;
  padding: 14px 20px;
  background: #229ED9;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.tg-send-btn:hover { background: #1a8bbf; }
.tg-send-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.result-divider {
  text-align: center;
  font-size: 13px;
  color: #999;
  margin: 16px 0 12px;
  position: relative;
}
.result-divider::before,
.result-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: #e0e0e0;
}
.result-divider::before { left: 0; }
.result-divider::after  { right: 0; }
