/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }

:root {
  --bg: #f2f2f2;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #ddd;
  --accent: #2a2a2a;
  --dot-active: #333;
  --dot-inactive: #bbb;
  /* Configurator only — square panels and controls (see landing.css for marketing) */
  --radius: 0;
  --radius-sm: 0;
  --app-max-width: 880px;
  /* Same as .two-panel — keeps header stepper aligned over the right (config) column */
  --two-panel-gap: 22px;
  --step-inline-padding: 28px;
  --font-sans: 'Sora', sans-serif;
  --font-display: 'Albert Sans', sans-serif;
  /* Align with landing.css — serious red, not UI pink */
  --form-error: #b03030;
  /* Configure step panes: outgoing fade, then incoming (delay + fade) */
  --step-pane-out-duration: 0.38s;
  --step-pane-out-ease: ease;
  --step-pane-in-duration: 0.44s;
  --step-pane-in-delay: 0.18s;
  --step-pane-in-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* ~1% shrink/grow — keep motion barely perceptible */
  --step-pane-inactive-scale: 0.99;
}

html {
  height: 100%;
  font-size: 15px;
  overflow-x: hidden;
  max-width: 100%;
}

/* UA styles (esp. WebKit) often round <button>; configurator cards stay square */
button {
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 10px clamp(16px, 4vw, 40px);
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
}

/* Primary display titles — template pick + product name in the panel */
h2.product-title,
.template-card-label {
  font-family: var(--font-display);
}

/* ── App Shell ───────────────────────────────────────────── */
.app {
  /* 100% of body content box — avoid 100vw/90vw (scrollbar + padding overflow) */
  width: 100%;
  max-width: var(--app-max-width);
  margin-left: auto;
  margin-right: auto;
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header / Stepper ────────────────────────────────────── */
.header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--two-panel-gap);
  padding: 10px var(--step-inline-padding);
  flex-shrink: 0;
  min-width: 0;
}

.logo-link {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.logo {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

.stepper {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
}

.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50% !important;
  background: var(--dot-inactive);
  transition: all .25s ease;
}

.step-item.active .step-dot,
.step-item.completed .step-dot {
  width: 20px;
  height: 20px;
  background: var(--dot-active);
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color .25s ease;
  white-space: nowrap;
}

.step-item.active .step-label,
.step-item.completed .step-label {
  color: var(--text);
}

.step-line {
  width: 48px;
  height: 1px;
  background: var(--dot-inactive);
  margin: 0 4px;
  margin-bottom: 12px;
  transition: background .25s ease;
}

.step-line.active {
  background: var(--dot-active);
}

/* ── Main / Steps ────────────────────────────────────────── */
.main {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  overflow-x: hidden;
  overflow-y: hidden;
}

.configure-origin-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px var(--step-inline-padding) 8px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.configure-origin-footer__text {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.3;
  text-align: center;
}

/* Stacked in one grid cell so inactive panes can crossfade (no display:none). */
.step-content {
  grid-area: 1 / 1;
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px var(--step-inline-padding) 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  transform: scale(var(--step-pane-inactive-scale));
  transform-origin: center center;
  transition:
    opacity var(--step-pane-out-duration) var(--step-pane-out-ease),
    transform var(--step-pane-out-duration) var(--step-pane-out-ease),
    visibility 0s linear var(--step-pane-out-duration);
}

.step-content.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
  transform: scale(1);
  transition:
    opacity var(--step-pane-in-duration) var(--step-pane-in-ease) var(--step-pane-in-delay),
    transform var(--step-pane-in-duration) var(--step-pane-in-ease) var(--step-pane-in-delay),
    visibility 0s linear 0s;
}

#step-0.step-content.active,
#step-1.step-content.active,
#step-2.step-content.active,
#step-3.step-content.active {
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .step-content {
    transform: none;
    transition-duration: 0.04s;
    transition-delay: 0s !important;
  }
  .step-content.active {
    transition-duration: 0.04s;
    transition-delay: 0s !important;
  }
}

/* ── Step 1: Template ────────────────────────────────────── */
.template-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 36px;
  flex: 1;
  min-height: 0;
}

.template-cards {
  display: flex;
  gap: 28px;
  flex-shrink: 0;
}

.template-card {
  width: 220px;
  border: 1.5px solid var(--border);
  border-radius: 0;
  padding: 20px 16px 16px;
  cursor: pointer;
  background: var(--card);
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: inherit;
  color: inherit;
}

.template-card:hover {
  border-color: #aaa;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}


.template-img {
  width: 100%;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.motor-svg { width: 140px; height: auto; }

.template-card-sep {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 12px 0 12px;
}

.template-card-label {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.template-card-label strong {
  font-weight: 800;
  font-size: 1.2rem;
}

.template-prompt {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 15rem);
}

.template-prompt p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ── Two-Panel Layout (Steps 2-4) ────────────────────────── */
.two-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: var(--two-panel-gap);
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.product-panel {
  background: var(--card);
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.product-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  flex: 1;
  min-height: 0;
}

.product-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

/* Wrap specs + dim: `display:contents` on desktop + flex order restores motor-between layout */
.product-specs-stack {
  display: contents;
}

@media (min-width: 901px) {
  #step-1 .product-panel-inner > .product-title,
  #step-3 .product-panel-inner > .product-title {
    order: 0;
  }
  #step-1 .product-specs-stack .specs-block,
  #step-3 .product-specs-stack .specs-block {
    order: 1;
  }
  #step-1 .product-panel-inner > .motor-renders,
  #step-3 .product-panel-inner > .motor-renders {
    order: 2;
  }
  #step-1 .product-specs-stack .dim-table,
  #step-3 .product-specs-stack .dim-table {
    order: 3;
  }
  #step-3 .product-specs-stack .btn-download-step {
    order: 4;
  }
  #step-3 .product-panel-inner > .summary-addons {
    order: 5;
  }
}

.specs-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.specs-icon {
  font-size: 0.85rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  filter: grayscale(1) brightness(0.4);
}

.specs-table {
  border-collapse: collapse;
  width: 100%;
}

.specs-table td { padding: 3px 0; font-size: 0.78rem; }
.spec-l { color: var(--text-secondary); font-weight: 500; padding-right: 20px; }
.spec-r { font-weight: 600; text-align: right; transition: opacity 0.22s ease; }

.dim-table { margin-top: 4px; }

#step-1 .product-specs-stack .dim-table,
#step-3 .product-specs-stack .dim-table {
  margin-top: 12px;
}

.motor-renders {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.compact-renders { margin-top: -4px; }

.motor-renders--finishing {
  padding-top: 14px;
}

/* Add-ons: omit POWER and TORQUE in the product card (JS still updates hidden cells). */
#step-2 .specs-block .specs-table tr:has(#a-sp-power),
#step-2 .specs-block .specs-table tr:has(#a-sp-torque) {
  display: none;
}

/* Add-ons / Finishing left column: `font-size` on inner is adjusted by JS to fit (no scroll). */
#step-2 .product-panel-inner,
#step-3 .product-panel-inner {
  font-size: 15px;
  overflow: hidden;
  gap: 0.67em;
}

#step-2 .product-panel-inner .product-title,
#step-3 .product-panel-inner .product-title {
  font-size: 1.05em;
}

#step-2 .product-panel-inner .specs-table td,
#step-3 .product-panel-inner .specs-table td {
  font-size: 0.78em;
}

#step-2 .product-panel-inner .spec-l,
#step-3 .product-panel-inner .spec-l {
  padding-right: 1.33em;
}

#step-2 .product-panel-inner .specs-table .spec-r,
#step-3 .product-panel-inner .specs-table .spec-r {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#step-2 .product-panel-inner .specs-icon,
#step-3 .product-panel-inner .specs-icon {
  width: 2.4em;
  height: 2.4em;
}

#step-2 .product-panel-inner .top-view-label,
#step-3 .product-panel-inner .top-view-label {
  font-size: 0.6em;
}

#step-3 .product-panel-inner .motor-detail-svg {
  max-width: 14.67em;
  max-height: min(26vh, 11.2em);
  width: 100%;
  height: auto;
}

/* Add-ons: larger previews than Finishing */
#step-2 .product-panel-inner .motor-detail-svg {
  max-width: min(100%, 18em);
  max-height: min(36vh, 14em);
  width: 100%;
  height: auto;
}

#step-3 .product-panel-inner .addon-motor-svg {
  width: 4.8em;
  height: 4.8em;
  max-width: 4.8em;
  max-height: 4.8em;
}

#step-2 .product-panel-inner .addon-motor-svg {
  width: 6.4em;
  height: 6.4em;
  max-width: 6.4em;
  max-height: 6.4em;
}

#step-2 .product-panel-inner .motor-renders--finishing,
#step-3 .product-panel-inner .motor-renders--finishing {
  padding-top: 0.93em;
}

#step-3 .product-panel-inner .summary-addon-row {
  font-size: 0.72em;
  min-width: 0;
}

#step-3 .product-panel-inner .summary-addon-row > span {
  min-width: 0;
}

#step-3 .product-panel-inner .summary-addon-label {
  font-size: 1.042em;
  font-weight: 600;
}

#step-3 .product-panel-inner .btn-download-step {
  font-size: 0.62em;
}

.motor-detail-svg {
  display: block;
  width: 100%;
  max-width: 220px;
  max-height: min(28vh, 168px);
  height: auto;
}

.motor-render-top-view .motor-detail-svg { max-width: 76px; max-height: 76px; }

.addon-motor-svg { display: block; }

.addon-views-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.motor-render-top-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.top-view-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Config Panel (right side) ───────────────────────────── */
.config-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 0 22px;
  box-shadow: -1px 0 0 var(--border);
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
}

/* Scrollable form area; flex:1 fills extra row height so .btn-next stays flush with
   the product panel when one column is taller (grid row height = max of both). */
.config-panel-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finishing-panel .config-panel-body {
  gap: 10px;
}

.panel-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.config-specs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.config-spec {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.config-spec span { color: var(--text-secondary); font-weight: 500; }
.config-spec strong { font-weight: 700; font-size: 0.85rem; }

/* ── Parameter rows (editable specs) ──────────────────────── */
.param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
  min-width: 0;
}

.param-row:last-child { border-bottom: none; }

.lock-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  border-radius: 0;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  padding: 0;
  margin-left: auto;
}

.lock-btn:hover:not(:disabled) { color: #666; background: #f0f0f0; }
.lock-btn.locked { color: #333; }
.lock-btn.blocked { opacity: 0.25; cursor: not-allowed; }

.param-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  letter-spacing: 0.02em;
}

.param-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.param-input {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  width: 88px;
  text-align: right;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  background: var(--card);
  color: var(--text);
  -moz-appearance: textfield;
}

.param-input:focus { border-color: #999; }
.param-input::-webkit-inner-spin-button,
.param-input::-webkit-outer-spin-button { opacity: 1; }
.param-input:disabled {
  background: #f5f5f5;
  color: #888;
  border-color: var(--border);
  cursor: not-allowed;
}
.param-input.derived {
  background: #f0f4ff;
  color: #6a7faa;
  border-color: #d0daf0;
  border-style: dashed;
}
.param-row.derived .param-label { color: #8a9cc0; }
.slider-row.derived label { color: #8a9cc0; }

/* ── Motor option cards ─────────────────────────────────────── */
.motor-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
  min-width: 0;
}
.motor-options:empty { display: none; }

.option-card {
  border: 1.5px solid var(--border);
  border-radius: 0;
  padding: 8px 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: var(--card);
}
.option-card:hover { border-color: #999; }
.option-card.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.option-label {
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 2px;
}
.option-desc {
  font-size: 0.62rem;
  color: var(--text-secondary);
  margin: 0 0 6px;
}
.option-specs {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.option-spec {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
}
.option-spec span { color: var(--text-secondary); }
.option-spec strong { font-weight: 600; }

.option-price {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}
.option-price .option-price-unit {
  font-weight: 400;
  font-size: 0.62rem;
  color: var(--text-secondary);
}

.param-unit {
  font-size: 0.68rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.slider-num {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  width: 64px;
  text-align: right;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  background: var(--card);
  color: var(--text);
  -moz-appearance: textfield;
}

.slider-num:focus { border-color: #999; }
.slider-num::-webkit-inner-spin-button,
.slider-num::-webkit-outer-spin-button { opacity: 1; }
.slider-num:disabled {
  background: #f5f5f5;
  color: #888;
  border-color: var(--border);
  cursor: not-allowed;
}
.slider-num.derived {
  background: #f0f4ff;
  color: #6a7faa;
  border-color: #d0daf0;
  border-style: dashed;
}

input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.mode-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}

.warnings-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.warning-item {
  font-size: 0.72rem;
  line-height: 1.35;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0;
  padding: 8px 10px;
}

/* ── Dimension Visual ────────────────────────────────────── */
.voltage-slider-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.dim-visual-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dim-svg {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slider-row label {
  font-size: 0.75rem;
  font-weight: 600;
  width: 50px;
  flex-shrink: 0;
}

.slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #ddd;
  border-radius: 0;
  outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50% !important;
  background: var(--accent);
  cursor: pointer;
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50% !important;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.slider-val {
  font-size: 0.75rem;
  font-weight: 600;
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Add-ons ─────────────────────────────────────────────── */
.addon-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.addon-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.addon-visual { flex-shrink: 0; }
.addon-motor-svg { width: 72px; height: 72px; }

.addon-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.addon-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.addon-row h4 { font-size: 0.8rem; font-weight: 700; width: 50px; flex-shrink: 0; }

.addon-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.addon-field label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.addon-field select {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--card);
  cursor: pointer;
  outline: none;
}

.addon-field select:focus { border-color: #999; }

.addon-subgroup { display: flex; flex-direction: column; gap: 8px; }
.addon-inline-row { display: flex; align-items: center; gap: 14px; }
.addon-field--range { gap: 8px; }
.addon-field--range input[type="range"] {
  width: 80px;
  accent-color: #555;
  cursor: pointer;
}
.addon-field--range input[type="number"] {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  width: 52px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--card);
  color: inherit;
  outline: none;
  text-align: right;
  -moz-appearance: textfield;
}
.addon-field--range input[type="number"]::-webkit-inner-spin-button,
.addon-field--range input[type="number"]::-webkit-outer-spin-button { opacity: 1; }
.addon-field--range input[type="number"]:focus { border-color: #999; }
.top-bcr-unit {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Checkbox add-ons */
.addon-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity .2s;
}

.addon-check:hover { opacity: 0.75; }

.addon-check input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  margin-top: 1px;
}

.addon-check input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.addon-check input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.addon-check-text { display: flex; flex-direction: column; gap: 2px; }
.addon-check-text strong { font-size: 0.8rem; font-weight: 600; }
.addon-check-text em { font-size: 0.7rem; font-style: normal; color: var(--text-secondary); }

.addon-warning {
  font-size: 0.72rem;
  line-height: 1.35;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0;
  padding: 8px 10px;
  margin-top: 2px;
}

/* ── Finishing Panel ─────────────────────────────────────── */
.finishing-panel { gap: 10px; }

.price-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 500;
}

.price-row.sub { padding-left: 8px; color: var(--text-secondary); font-size: 0.72rem; }

.price-row.total-unit {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  font-weight: 700;
}

.price-row.price-total {
  font-size: 0.9rem;
  font-weight: 800;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1.5px solid var(--text);
}

/* Volume pricing */
.volume-pricing {
  background: var(--bg);
  border-radius: 0;
  padding: 6px 10px;
}

.vol-header, .vol-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
  font-size: 0.7rem;
}

.vol-header { color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.vol-values { font-weight: 700; font-size: 0.75rem; }
.vol-values span.active-tier { color: var(--accent); text-decoration: underline; }

/* Quantity */
.quantity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quantity-row label { font-size: 0.8rem; font-weight: 600; }

.quantity-row input {
  font-family: var(--font-sans);
  width: 88px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 0;
  padding: 6px 10px;
  outline: none;
}

.quantity-row input:focus { border-color: #999; }

.lead-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.lead-time span:last-child { font-weight: 600; color: var(--text); }

.order-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Summary add-ons on left panel */
.summary-addons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.summary-addon-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}

.summary-addon-label { font-weight: 600; font-size: 0.75rem; }

.addon-check-icon {
  background: var(--accent);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── Download Step File button (product panel) ──────────── */
.btn-download-step {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 8px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 0;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  letter-spacing: 0.02em;
}

.btn-download-step svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.btn-download-step:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-next {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 0;
  padding: 8px 20px;
  cursor: pointer;
  transition: background .2s, color .2s;
  align-self: center;
  flex-shrink: 0;
}

.btn-next:hover { background: #f0f0f0; }

.btn-checkout {
  align-self: stretch;
  text-align: center;
}

/* ── Availability Modal ──────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-card {
  background: var(--card);
  border-radius: 0;
  padding: 40px 32px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.modal-card[hidden] { display: none; }

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-btn-primary {
  margin-top: 8px;
  padding: 13px 20px;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--accent);
  border-radius: 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.modal-btn-primary:hover { background: #f0f0f0; }

.modal-btn-secondary {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s;
}

.modal-btn-secondary:hover { color: var(--text); }

.modal-card--form {
  max-width: 460px;
  width: 100%;
  min-width: 0;
  padding: 32px;
  text-align: left;
  box-sizing: border-box;
}

.modal-card--form .modal-title { text-align: left; }
.modal-card--form .modal-body  { text-align: left; margin-bottom: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.form-row > .form-group {
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
}

.form-group .required { color: var(--form-error); }

.form-group input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
  min-width: 0;
}

.form-group input:focus { border-color: var(--accent); }

.form-group input.is-invalid {
  border-color: var(--form-error);
}

.form-group .field-error {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--form-error);
  padding-left: 10px;
  border-left: 2px solid var(--form-error);
  margin-top: 1px;
}

#notify-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  min-width: 0;
}

.notify-form-status {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-body);
}

.notify-form-status[data-variant='error'] {
  color: var(--form-error);
  padding-left: 10px;
  border-left: 2px solid var(--form-error);
  margin-top: 1px;
}

.notify-form-status:empty {
  display: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --step-inline-padding: 20px;
    --two-panel-gap: 20px;
  }

  /* One continuous scroll: product card then tool panes (no nested viewport trap) */
  html {
    height: auto;
    min-height: 100%;
  }

  body {
    padding: 12px;
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app {
    max-height: none;
    overflow: visible;
  }

  .main {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .step-content {
    max-height: none;
    min-height: 0;
    padding: 28px var(--step-inline-padding) 20px;
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: auto;
  }

  #step-0.step-content.active,
  #step-1.step-content.active,
  #step-2.step-content.active,
  #step-3.step-content.active {
    min-height: 0;
  }

  .config-panel {
    overflow: visible;
  }

  .config-panel-body {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: visible;
  }

  .header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
    padding: 14px var(--step-inline-padding);
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
  }

  .logo-link {
    grid-column: 1;
    justify-self: center;
  }

  .stepper {
    grid-column: 1;
    justify-self: center;
    justify-content: center;
  }
  .logo { height: 20px; }
  .step-line { width: 32px; }

  .template-layout {
    flex-direction: column;
    gap: 20px;
    justify-content: flex-start;
    align-items: stretch;
  }

  .template-prompt {
    order: -1;
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .template-prompt p {
    text-align: center;
    width: 100%;
  }

  .template-cards {
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: 10px;
    flex-shrink: 1;
  }

  .template-card {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    padding: 10px 6px 8px;
  }

  .template-img {
    height: 76px;
  }

  #step-0 .motor-svg {
    width: min(100%, 86px);
    height: auto;
  }

  .template-card-sep {
    margin: 8px 0;
  }

  .template-card-label {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .template-card-label strong {
    font-size: 0.88rem;
  }

  .two-panel {
    grid-template-columns: 1fr;
    min-height: 0;
    align-content: start;
  }

  .product-panel {
    overflow: visible;
    min-height: auto;
  }

  /* Product panel (Customize / Add-ons / Finishing): fit specs + renders in card width */
  #step-1 .product-panel-inner,
  #step-2 .product-panel-inner,
  #step-3 .product-panel-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 44%);
    gap: 8px 10px;
    padding: 11px 12px;
    align-items: start;
    min-width: 0;
    flex: 0 1 auto;
    min-height: auto;
    overflow: visible;
  }

  #step-1 .product-title,
  #step-2 .product-title,
  #step-3 .product-title {
    grid-column: 1 / -1;
    font-size: 0.92rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  #step-1 .product-title br,
  #step-2 .product-title br,
  #step-3 .product-title br {
    display: none;
  }

  #step-2 .specs-block {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    align-self: start;
  }

  #step-1 .product-specs-stack,
  #step-3 .product-specs-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    align-self: start;
    width: 100%;
  }

  #step-1 .product-specs-stack .specs-block,
  #step-3 .product-specs-stack .specs-block {
    width: 100%;
  }

  #step-1 .specs-table,
  #step-2 .product-panel-inner .specs-table,
  #step-3 .product-panel-inner .specs-table {
    table-layout: fixed;
  }

  #step-1 .specs-icon,
  #step-2 .product-panel-inner .specs-icon,
  #step-3 .product-panel-inner .specs-icon {
    width: 28px;
    height: 28px;
  }

  #step-1 .specs-table td,
  #step-2 .product-panel-inner .specs-table td,
  #step-3 .product-panel-inner .specs-table td {
    font-size: 0.68rem;
    padding: 2px 0;
  }

  #step-1 .spec-l,
  #step-2 .product-panel-inner .spec-l,
  #step-3 .product-panel-inner .spec-l {
    padding-right: 8px;
  }

  #step-1 .spec-r,
  #step-2 .product-panel-inner .spec-r,
  #step-3 .product-panel-inner .spec-r {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #step-1 .motor-renders,
  #step-2 .motor-renders,
  #step-3 .motor-renders {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  #step-3 .motor-renders--finishing {
    padding-top: 0;
  }

  #step-1 .motor-render-side-view,
  #step-2 .motor-render-side-view,
  #step-3 .motor-render-side-view {
    width: 100%;
    display: flex;
    justify-content: center;
    min-width: 0;
  }

  #step-1 .motor-detail-svg,
  #step-2 .product-panel-inner .motor-detail-svg,
  #step-3 .product-panel-inner .motor-detail-svg {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: min(32vh, 140px);
  }

  #step-2 .addon-views-column,
  #step-3 .addon-views-column {
    flex-direction: row;
    flex-shrink: 1;
    min-width: 0;
    gap: 6px;
  }

  #step-3 .product-panel-inner .addon-motor-svg {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
  }

  #step-2 .product-panel-inner .top-view-label,
  #step-3 .product-panel-inner .top-view-label {
    font-size: 0.55rem;
  }

  /* Add-ons mobile: no spec/dim tables; only top/bottom renders under title */
  #step-2 .specs-block,
  #step-2 .dim-table {
    display: none;
  }

  #step-2 .motor-render-side-view {
    display: none;
  }

  #step-2 .motor-renders {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
  }

  #step-2 .product-panel-inner .addon-motor-svg {
    width: 76px;
    height: 76px;
    max-width: 76px;
    max-height: 76px;
  }

  /* Divider under KV; padding-top = space between line and HEIGHT row */
  #step-1 .product-specs-stack .dim-table,
  #step-3 .product-specs-stack .dim-table {
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    box-sizing: border-box;
    width: 100%;
  }

  #step-1 .product-specs-stack .specs-table:not(.dim-table) tr:last-child td,
  #step-3 .product-specs-stack .specs-table:not(.dim-table) tr:last-child td {
    padding-bottom: 4px;
  }

  #step-3 .motor-renders {
    grid-row: 2;
    align-self: start;
  }

  #step-3 .product-specs-stack .dim-table {
    margin-left: 38px;
    width: calc(100% - 38px);
    max-width: calc(100% - 38px);
  }

  #step-3 .dim-table td {
    padding: 1px 0;
  }

  #step-3 .dim-table .spec-l {
    width: 42%;
    padding-right: 6px;
  }

  #step-3 .dim-table .spec-r {
    width: 58%;
    text-align: right;
  }

  #step-3 .summary-addons {
    grid-column: 1 / -1;
    min-width: 0;
    gap: 2px;
    padding-top: 4px;
  }

  #step-3 .product-specs-stack .btn-download-step {
    align-self: start;
    margin-top: 14px;
    margin-left: 38px;
    width: fit-content;
    max-width: calc(100% - 38px);
    box-sizing: border-box;
  }

  #step-3 .product-panel-inner .summary-addon-row {
    font-size: 0.58rem;
    gap: 4px;
    align-items: baseline;
    line-height: 1.25;
  }

  #step-3 .dim-table #f-top,
  #step-3 .dim-table #f-bottom {
    text-align: right;
    white-space: nowrap;
    min-width: 0;
  }

  #step-3 .product-panel-inner .btn-download-step {
    font-size: 0.58rem;
  }

  /* Finishing: more vertical breathing room on mobile */
  #step-3 .two-panel {
    gap: 28px;
  }

  #step-3.step-content {
    padding-bottom: 28px;
  }

  #step-3 .product-panel-inner {
    gap: 14px 12px;
    padding: 14px 14px;
  }

  #step-3 .product-specs-stack {
    gap: 8px;
  }

  #step-3 .product-panel-inner .specs-table td {
    padding: 4px 0;
  }

  #step-3 .product-specs-stack .dim-table {
    margin-top: 12px;
  }

  #step-3 .dim-table td {
    padding: 4px 0;
  }

  #step-3 .motor-renders {
    gap: 10px;
  }

  #step-3 .addon-views-column {
    gap: 10px;
  }

  #step-3 .summary-addons {
    gap: 8px;
    padding-top: 14px;
  }

  #step-3 .finishing-panel {
    gap: 14px;
  }

  #step-3 .finishing-panel .config-panel-body {
    gap: 14px;
  }

  .config-panel {
    box-shadow: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 20px;
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal-card--form {
    padding: 26px 18px 22px;
  }

}

