/* =========================================================
   Template-flow pages — Home · Size · Material · Quote
   ========================================================= */

/* Root: pin to the viewport. Inner regions (.tf-picker-scroll, .sz-scroll, …)
   own their own scroll, so the page itself never needs to scroll. */
.tf-page {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--color-background);
}

.tf-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  /* Drives onboarding header inner, picker inner, and picker foot inner so
     they all share the same centered width. Home (has utility bar) uses the
     narrower picker cap; size/material/quote use a wider cap for the form +
     preview layout below. */
  --content-w: min(96vw, 1180px);
}
.tf-stage:has(.tf-home) {
  --content-w: min(94vw, 980px);
}

.tf-artboard {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  background: var(--color-surface);
}

/* =========================================================
   Shared brand / logo lockup
   ========================================================= */
.tf-brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tf-brand-lockup svg {
  display: block;
}
.tf-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-text);
}
.tf-wordmark em {
  color: var(--color-primary);
  font-style: normal;
}

/* =========================================================
   Shared buttons
   ========================================================= */
.tf-btn {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    background var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std);
  text-decoration: none;
}
.tf-btn:hover {
  border-color: var(--color-border-strong);
}
.tf-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-light);
}
.tf-btn.ghost:hover {
  color: var(--color-text);
  background: var(--color-background);
}
.tf-btn-primary {
  background: var(--color-primary);
  color: white;
  border: 1px solid var(--color-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  padding: 11px 22px;
  border-radius: 12px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    background var(--dur-fast) var(--ease-std),
    transform var(--dur-fast) var(--ease-std);
  text-decoration: none;
}
.tf-btn-primary:hover {
  background: var(--color-primary-dark);
}
.tf-btn-primary:active {
  transform: translateY(1px);
}
.tf-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.tf-btn-primary svg {
  width: 14px;
  height: 14px;
}

/* =========================================================
   Shared progress stepper
   ========================================================= */
.tf-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-light);
}
.tf-progress .step {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tf-progress .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
}
.tf-progress .step.on .dot {
  background: var(--color-primary);
  width: 8px;
  height: 8px;
}
.tf-progress .step.done .dot {
  background: var(--color-text);
}
.tf-progress .step.on,
.tf-progress .step.done {
  color: var(--color-text);
  font-weight: 500;
}
.tf-progress .line {
  flex: 0 0 20px;
  height: 1px;
  background: var(--color-border);
}

/* =========================================================
   Home — single-column shape picker (header + content + foot)
   ========================================================= */
.tf-home {
  background: var(--color-background);
  padding: 0;
}

.tf-picker {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-background);
}
.tf-picker-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.tf-picker-scroll::-webkit-scrollbar {
  display: none;
}
.tf-picker-inner {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 24px);
  max-width: var(--content-w);
  width: 100%;
  margin: 0 auto;
  padding: clamp(20px, 4.5vh, 40px) clamp(20px, 3vw, 40px)
    clamp(16px, 3.5vh, 32px);
}

.tf-picker-hd {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}
.tf-picker-hd h1 {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin: 0;
}
.tf-picker-hd p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text-light);
  margin: 0;
  padding-bottom: 10px;
  max-width: 60ch;
}

.tf-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tf-tile {
  position: relative;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition:
    border-color var(--dur-std) var(--ease-std),
    background var(--dur-std) var(--ease-std),
    box-shadow var(--dur-std) var(--ease-std);
}
.tf-tile:hover {
  border-color: var(--color-border-strong);
}
.tf-tile.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: 0 0 0 1px var(--color-primary);
}
.tf-tile .preview {
  aspect-ratio: 16 / 9;
  background: var(--color-background);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.tf-tile .preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(29, 42, 35, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29, 42, 35, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
}
.tf-tile .preview > svg {
  position: relative;
  z-index: 1;
}

.tf-tile.scratch {
  border-style: dashed;
  border-color: var(--color-border-strong);
  background: var(--color-background);
  box-shadow: none;
}
.tf-tile.scratch .preview {
  background: var(--color-surface);
  border: 1.5px dashed var(--color-border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-light);
}
.tf-tile.scratch .preview::before {
  display: none;
}
.tf-tile.scratch .preview svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.tf-tile.scratch .scratch-label {
  padding: 0 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-light);
}
.tf-tile.scratch:hover {
  border-color: var(--color-primary);
}
.tf-tile.scratch:hover .preview {
  border-color: var(--color-primary);
  color: var(--color-text);
}
.tf-tile.scratch:hover .scratch-label {
  color: var(--color-text);
}
.tf-tile.scratch.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.tf-tile.scratch.is-active .preview {
  border-color: var(--color-primary);
  background: rgba(34, 39, 43, 0.08);
  color: var(--color-text);
}
.tf-tile.scratch.is-active .scratch-label {
  color: var(--color-text);
}

/* Footer bar — props on the left, next-hint + Continue on the right */
.tf-picker-foot {
  padding: 14px 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.tf-picker-foot-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 clamp(20px, 3vw, 40px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.tf-foot-selected {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.tf-foot-selected-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-primary);
  border-radius: 6px;
  background: var(--color-primary-soft);
  padding: 4px;
  box-sizing: border-box;
  display: inline-flex;
}
.tf-foot-selected-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}
.tf-foot-selected-text {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
}
.tf-foot-selected-text strong {
  color: var(--color-text);
  font-weight: 600;
}
.tf-foot-selected-sub {
  font-size: 12px;
  color: var(--color-text-light);
}
.tf-foot-cta {
  display: flex;
  align-items: center;
  gap: 16px;
}
/* Step indicator (right slot in OnboardingHeader on step 1) */
.of-step-indicator {
  font-size: 12px;
  color: var(--color-text-light);
  white-space: nowrap;
}
.of-step-indicator strong {
  color: var(--color-text);
  font-weight: 600;
}

/* =========================================================
   Stage header (used on /size, /material, /quote)
   ========================================================= */
.tf-stage-hd {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.tf-stage-hd .back {
  font-size: 12px;
  color: var(--color-text-light);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1px;
}
.tf-stage-hd .back:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}
.tf-stage-hd .tf-brand-lockup .tf-wordmark {
  font-size: 17px;
}

/* =========================================================
   Onboarding flow header (Size · Material · Quote)
   ========================================================= */
.of-hd {
  height: 72px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.of-hd-inner {
  height: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 clamp(20px, 3vw, 40px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 16px;
}

.of-hd-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}
.of-hd-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}
.of-hd-right:empty {
  display: none;
}

.of-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  background: transparent;
  border: 0;
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-std);
}
.of-back:hover {
  background: var(--color-background);
}
.of-back.is-disabled {
  color: var(--color-text-light);
  opacity: 0.4;
  pointer-events: none;
}

.of-brand {
  border-left: 1px solid var(--color-border);
  padding-left: 18px;
  gap: 8px;
}
.of-hd-left > .of-brand:first-child {
  border-left: 0;
  padding-left: 0;
}
.of-brand .tf-wordmark {
  font-size: 20px;
}

.of-crumbs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.of-crumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 18px 4px 4px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-light);
  background: transparent;
  border: 0;
  text-decoration: none;
  cursor: default;
  transition:
    background var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.of-crumb.is-done {
  color: var(--color-text);
  cursor: pointer;
}
.of-crumb.is-done:hover {
  background: var(--color-background);
}
.of-crumb.is-current {
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.of-crumb-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: transparent;
  color: var(--color-text-light);
  border: 1.5px solid var(--color-border);
  flex-shrink: 0;
}
.of-crumb.is-done .of-crumb-badge {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}
.of-crumb.is-current .of-crumb-badge {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-text);
}
.of-crumb-badge svg {
  width: 11px;
  height: 11px;
}

.of-saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-light);
  white-space: nowrap;
}
.of-saved-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f9e6f;
}

.of-help {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-light);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    color var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std);
}
.of-help:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

@media (max-width: 820px) {
  .of-hd {
    height: 60px;
  }
  .of-hd-inner {
    padding: 0 16px;
    gap: 8px;
  }
  .of-brand .tf-wordmark {
    font-size: 17px;
  }
  .of-crumb-label {
    display: none;
  }
  .of-crumb {
    padding: 4px;
  }
  .of-crumb.is-current {
    padding-right: 12px;
  }
  .of-crumb.is-current .of-crumb-label {
    display: inline;
  }
  .of-saved {
    display: none;
  }
}

/* =========================================================
   Size page — hero + two cards + sticky footer
   Class prefix: sz-*
   ========================================================= */
.tf-page.sz-page .tf-stage {
  background: var(--color-background);
  --content-w: min(96vw, 1320px);
}

.sz-layout {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-background);
}
.sz-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sz-inner {
  max-width: var(--content-w);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: clamp(20px, 4vh, 40px) clamp(20px, 3vw, 48px) 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.sz-col-left {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 28px);
  min-width: 0;
  min-height: 0;
}

.sz-hero {
  max-width: 760px;
  flex-shrink: 0;
}
.sz-hero h1 {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin: 0;
}

.sz-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 20px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.sz-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}
.sz-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std);
}
.sz-back:hover {
  border-color: var(--color-border-strong);
}
.sz-back svg {
  width: 14px;
  height: 14px;
}

.sz-plan-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  font-weight: 600;
}

.sz-plan-card {
  padding: 0;
  border: 0;
  background: transparent;
}
.sz-plan-canvas {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.sz-form-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.sz-form-card .sz-field-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

/* Single-column dimension fields */
.sz-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.sz-field {
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-std);
}
.sz-field:hover {
  border-color: var(--color-border-strong);
}
.sz-field.is-focus {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.sz-field-k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-light);
  transition: color var(--dur-fast) var(--ease-std);
}
.sz-field.is-focus .sz-field-k {
  color: var(--color-text);
}
.sz-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sz-field-num {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}
.sz-field-v {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: transparent;
  border: 0;
  padding: 0;
  width: auto;
  font-family: inherit;
}
.sz-field-v:focus {
  outline: none;
}
.sz-field-u {
  font-size: 12px;
  color: var(--color-text-light);
}
.sz-stepper {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.sz-stepper button {
  all: unset;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.sz-stepper button:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.sz-stepper button:active {
  background: var(--color-background);
}

/* Sticky footer */
.sz-foot {
  flex-shrink: 0;
}
.sz-foot-inner {
  max-width: var(--content-w);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 18px clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sz-foot-left {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.sz-foot-thumb {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-primary);
  border-radius: 8px;
  background: var(--color-primary-soft);
  padding: 5px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sz-foot-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}
.sz-foot-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text-light);
  flex-wrap: wrap;
}
.sz-foot-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.sz-foot-stat strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.sz-foot-stat.is-label strong {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: normal;
}
.sz-foot-stat .u {
  color: var(--color-text-light);
}
.sz-foot-stats .sep {
  color: var(--color-border);
  font-weight: 300;
}
.sz-foot-right {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
@media (max-width: 1024px) {
  .sz-scroll {
    overflow-y: auto;
  }
  .sz-cards {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
  }
  .sz-form-card .sz-field-grid {
    flex: 0 0 auto;
    overflow: visible;
  }
  .sz-plan-canvas {
    min-height: 360px;
  }
}
@media (max-width: 640px) {
  .sz-foot-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .sz-foot-right {
    justify-content: space-between;
  }
  .sz-hero h1 {
    font-size: 30px;
  }
}

/* =========================================================
   Material page — reuses sz-* hero/cards/footer with a single
   scrollable form card on the left and plan canvas on the right.
   ========================================================= */
.tf-page.mt-page .tf-stage {
  background: var(--color-background);
  --content-w: min(96vw, 1320px);
}
.sz-cards.mt-cards,
.sz-page .sz-cards,
.q-page .sz-cards {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 2.5fr);
}
.mt-form-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 0;
}
.mt-form-card > * {
  padding: 18px 20px;
}
.mt-form-card > * + * {
  border-top: 1px solid var(--color-border);
}
.mt-form-card > h2 {
  display: none;
}
@media (max-width: 1024px) {
  .mt-form-card {
    flex: 0 0 auto;
    overflow: visible;
  }
}

.mt-selected {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  animation: mt-selected-in 320ms var(--ease-std) both;
}
@keyframes mt-selected-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.tf-product-list,
.tf-filter-strip {
  animation: mt-picker-in 280ms var(--ease-std) both;
}
@keyframes mt-picker-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.mt-selected-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #fafafa;
  flex-shrink: 0;
}
.mt-selected-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mt-selected-supplier {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text);
}
.mt-selected-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.mt-selected-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 2px;
}
.mt-selected-price {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.mt-change-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition:
    border-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.mt-change-btn svg {
  width: 16px;
  height: 16px;
}
.mt-change-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

/* =========================================================
   Size / Material / Quote — form + preview layout
   ========================================================= */
.tf-split {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: 100%;
}
.tf-split.tf-split-quote {
  grid-template-columns: 1fr 420px;
}

.tf-form {
  padding: 36px 40px 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow-y: auto;
}
.tf-form .tf-wordmark {
  font-size: 24px;
}
.tf-form-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tf-form h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
.tf-form-lede {
  font-size: 13.5px;
  color: var(--color-text-light);
  line-height: 1.5;
  max-width: 44ch;
  margin-top: 4px;
}

.tf-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.tf-field {
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  transition: border-color var(--dur-fast) var(--ease-std);
  cursor: pointer;
}
.tf-field.focus {
  border-color: var(--color-primary);
}
.tf-field-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.tf-field .k {
  font-size: 11px;
  color: var(--color-text-light);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tf-field .row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}

.tf-field .num-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  min-width: 0;
}
.tf-field input.v {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: transparent;
  border: 0;
  padding: 0;
  width: auto;
  font-family: inherit;
}
.tf-field input.v:focus {
  outline: none;
}
.tf-field .u {
  font-size: 11px;
  color: var(--color-text-light);
}
.tf-field .stepper {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.tf-field .stepper button {
  all: unset;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.tf-field .stepper button:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.tf-field .stepper button:active {
  background: var(--color-background);
}

.tf-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.tf-summary-card .kpi {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.tf-summary-card .kpi .n {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.tf-summary-card .kpi .u {
  font-size: 12px;
  color: var(--color-text-light);
}

.tf-form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
  margin: 0 -40px;
  background: var(--color-surface);
  z-index: 1;
}
.tf-form-foot-hint {
  font-size: 12px;
  color: var(--color-text-light);
}
.tf-form-foot-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Right preview pane */
.tf-preview {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(
    ellipse at 50% 0%,
    rgba(34, 39, 43, 0.04),
    transparent 60%
  ),
    var(--color-surface);
}
.tf-preview-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.tf-preview-hd h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.tf-preview-hd .meta {
  font-size: 11px;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tf-canvas {
  flex: 1;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(to right, rgba(29, 42, 35, 0.05) 1px, transparent 1px) 0 0
    / 32px 32px,
    linear-gradient(to bottom, rgba(29, 42, 35, 0.05) 1px, transparent 1px) 0 0
    / 32px 32px,
    #fafafa;
  border: 1px solid var(--color-border);
  min-height: 0;
}
.tf-canvas .corner-l {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 10px;
  color: var(--color-text-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tf-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Preview SVG styling (strokes use user units — viewBox is in mm) */
.tf-canvas .shape-fill {
  fill: rgba(34, 39, 43, 0.1);
  stroke: var(--color-primary);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
/* Neutral-bordered preview (used on /material where the deck colour is the
   product colour and an accent border would clash). */
.tf-canvas--neutral .shape-fill {
  stroke: var(--color-border);
}
.tf-canvas .dim-line,
.tf-canvas .dim-tick {
  stroke: var(--color-text);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: stroke var(--dur-fast) var(--ease-std);
}
.tf-canvas .dim-line.active,
.tf-canvas .dim-tick.active {
  stroke: var(--color-primary);
  stroke-width: 1.5;
}

/* SVG layout overlay — boards + edge boards rendered from ShapeLayout.
   Colours mirror lib/colors.ts CANVAS_COLORS so the plan view reads as the
   same product as the design view. */
.tf-svg-overlay .tf-board-fill,
.tf-svg-overlay .tf-breaker-fill,
.tf-svg-overlay .tf-edge-board-fill {
  fill: rgba(34, 39, 43, 0.18); /* default tint when no fillColor supplied */
}
.tf-svg-overlay .tf-board-gap-line {
  fill: none;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tf-svg-overlay .tf-board-gap-fill {
  fill: rgba(0, 0, 0, 0.06);
  stroke: none;
}
.tf-svg-overlay .tf-breaker-join-line {
  fill: none;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tf-svg-overlay .tf-edge-board-fill {
  stroke: none;
}
.tf-svg-overlay .tf-edge-board-inner-gap-line {
  fill: none;
  stroke: rgba(0, 0, 0, 0.3);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tf-svg-overlay .tf-edge-board-join-line,
.tf-svg-overlay .tf-edge-board-mitre-line {
  fill: none;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tf-shape-preview {
  position: relative;
  width: 100%;
  height: 100%;
}
.tf-shape-preview > svg {
  width: 100%;
  height: 100%;
  display: block;
}
.tf-dim-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tf-dim-label {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  white-space: nowrap;
  line-height: 1.35;
  pointer-events: auto;
  cursor: default;
  transition:
    background var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.tf-dim-label.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  font-weight: 700;
}

/* =========================================================
   Material page extras
   ========================================================= */
/* Filter strip — three labelled dropdowns in a row */
.tf-filter-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.tf-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tf-filter-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
}
.tf-filter-field select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 7px 26px 7px 10px;
  cursor: pointer;
  width: 100%;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-light) 50%),
    linear-gradient(-45deg, transparent 50%, var(--color-text-light) 50%);
  background-position:
    calc(100% - 12px) 50%,
    calc(100% - 8px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  transition:
    border-color var(--dur-fast) var(--ease-std),
    box-shadow var(--dur-fast) var(--ease-std);
}
.tf-filter-field select:hover {
  border-color: var(--color-border-strong);
}
.tf-filter-field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

@media (max-width: 540px) {
  .tf-filter-strip {
    grid-template-columns: 1fr;
  }
  .tf-filter-field:last-child {
    grid-column: auto;
  }
}

/* Dense product row list — two stacked lines per row so columns stay stable
   regardless of how many colour swatches a product has. */
.tf-product-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tf-product-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition:
    border-color var(--dur-fast) var(--ease-std),
    background var(--dur-fast) var(--ease-std);
}
.tf-product-row:hover {
  border-color: var(--color-border-strong);
}
.tf-product-row.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.tf-product-row .row-thumb {
  width: 48px;
  height: 48px;
  border-radius: 7px;
  border: 1px solid var(--color-border);
  background: #fafafa;
  flex-shrink: 0;
}
.tf-product-row .row-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tf-product-row .row-id {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.tf-product-row .row-supplier {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  white-space: nowrap;
}
.tf-product-row.is-active .row-supplier {
  color: var(--color-text);
}
.tf-product-row .row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-product-row .row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-light);
  min-width: 0;
}
.tf-product-row .row-dim {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tf-product-row .row-dim .dim-v {
  color: var(--color-text-light);
}
.tf-product-row .row-dim .dim-u {
  font-size: 11px;
}
.tf-product-row .row-divider {
  color: var(--color-border);
  user-select: none;
}
.tf-product-row .row-swatches {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.tf-product-row .row-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: inline-block;
  flex-shrink: 0;
}
.tf-product-row .row-count {
  font-size: 12px;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
}
.tf-product-row .row-price {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.tf-product-row .row-price-v {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.tf-product-row .row-price-u {
  font-size: 11px;
  color: var(--color-text-light);
}

.tf-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.tf-section-head .tf-label-eyebrow {
  margin-bottom: 0;
}
.tf-section-head-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.tf-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tf-color-chip {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 0;
  outline: none;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  transition:
    box-shadow var(--dur-fast) var(--ease-std),
    transform var(--dur-fast) var(--ease-std);
}
.tf-color-chip:hover {
  transform: translateY(-1px);
}
.tf-color-chip.is-active {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.tf-segment {
  display: flex;
  gap: 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--color-background);
}
.tf-segment-option {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-light);
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-std),
    background-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.tf-segment-option:hover {
  color: var(--color-text);
}
.tf-segment-option.is-active {
  border-color: var(--color-primary);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 700;
}

.tf-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
}
.tf-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.tf-label-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* Pill rows — used for material type & supplier */
.tf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tf-pill {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    border-color var(--dur-fast) var(--ease-std),
    background var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std);
}
.tf-pill:hover:not(:disabled):not(.is-active) {
  border-color: var(--color-border-strong);
}
.tf-pill.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-text);
}
.tf-pill.is-disabled,
.tf-pill:disabled {
  color: var(--color-text-light);
  background: var(--color-background);
  border-style: dashed;
  cursor: not-allowed;
  opacity: 0.65;
}
.tf-pill-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Segmented variant: pills sit edge-to-edge */
.tf-pills-segmented {
  gap: 0;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 4px;
}
.tf-pills-segmented .tf-pill {
  flex: 1 1 0;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: transparent;
}
.tf-pills-segmented .tf-pill:hover:not(:disabled):not(.is-active) {
  background: var(--color-surface);
}
.tf-pills-segmented .tf-pill.is-active {
  background: var(--color-surface);
  color: var(--color-text);
}
.tf-pills-segmented .tf-pill.is-disabled,
.tf-pills-segmented .tf-pill:disabled {
  background: transparent;
  border: 0;
}

/* Empty-state hint shown inside otherwise-collapsed sections */
.tf-empty-hint {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-light);
  font-style: italic;
  padding: 8px 2px;
}

/* Advanced (collapsible) settings section */
.tf-advanced {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-background);
}
.tf-advanced[open] {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
}
.tf-advanced-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.tf-advanced-summary::-webkit-details-marker {
  display: none;
}
.tf-advanced-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
.tf-advanced-hint {
  font-size: 12px;
  color: var(--color-text-light);
}
.tf-advanced-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-light);
  transition: transform var(--dur-fast) var(--ease-std);
}
.tf-advanced[open] .tf-advanced-chevron {
  transform: rotate(180deg);
}
.tf-advanced-body {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tf-advanced-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =========================================================
   Quote page — full-page summary
   ========================================================= */
.tf-quote-hero {
  padding: 36px 40px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--color-border);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--color-surface);
}
.tf-quote-hero .tf-wordmark {
  font-size: 24px;
}
.tf-quote-hero h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.tf-quote-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tf-quote-facts .fact {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--color-background);
}
.tf-quote-facts .fact .k {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tf-quote-facts .fact .v {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.tf-quote-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--color-primary-soft);
  border: 1.5px solid rgba(34, 39, 43, 0.3);
  border-radius: 12px;
}
.tf-quote-total .k {
  font-size: 13px;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.tf-quote-total .v {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.tf-quote-bom {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  background: var(--color-surface);
  overflow-y: auto;
}
.tf-quote-bom h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px 0;
}

.tf-bom-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.tf-bom-table td {
  padding: 6px 0;
  vertical-align: top;
}
.tf-bom-table td.value {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tf-bom-sub td:first-child {
  padding-left: 1.2em;
  color: var(--color-text-light);
  font-size: 12px;
}
.tf-bom-total td {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  font-weight: 600;
}

.tf-quote-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: auto -40px 0;
  padding: 16px 40px;
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  z-index: 1;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1280px) {
  .tf-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 820px) {
  .tf-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .tf-picker-inner {
    padding: 32px 20px 28px;
    gap: 20px;
  }
  .tf-picker-hd h1 {
    font-size: 34px;
  }
  .tf-picker-foot-inner {
    padding: 0 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .tf-foot-cta {
    justify-content: space-between;
  }
  .tf-split {
    grid-template-columns: 1fr;
    height: auto;
  }
  .tf-split.tf-split-quote {
    grid-template-columns: 1fr;
  }
  .tf-form {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
  .tf-quote-hero {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
}

/* =========================================================
   Quote page — reuses sz-* hero/cards/footer with a single
   scrollable form card on the left (material → shopping list →
   CTAs → fineprint) and the plan canvas on the right.
   Class prefix: q-*
   ========================================================= */
.tf-page.q-page .tf-stage {
  background: var(--color-background);
  --content-w: min(96vw, 1320px);
}

.q-layout.is-refreshing {
  opacity: 0.97;
  transition: opacity var(--dur-fast) var(--ease-std);
}

.q-form-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 14px;
}
@media (max-width: 1024px) {
  .q-form-card {
    flex: 0 0 auto;
    overflow: visible;
  }
}

/* ---------- Material card ---------- */
.q-material-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.q-material-swatch {
  flex: 0 0 auto;
}
.q-material-chip {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
}
.q-material-body {
  flex: 1 1 auto;
  min-width: 0;
}
.q-material-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.q-material-meta {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 2px;
}
/* ---------- Quick stats ---------- */
.q-quick-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.q-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.q-stat-k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
  font-weight: 500;
}
.q-stat-v {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Column 2: Shopping list (merged price card) ---------- */
.q-shopping-card {
  display: flex;
  flex-direction: column;
}
.q-shopping-head {
  margin-bottom: 6px;
}
.q-shopping-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.q-shopping-lede {
  margin: 4px 0 0;
  color: var(--color-text-light);
  font-size: 12.5px;
  line-height: 1.5;
}
.q-section-empty {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--color-text-light);
}

.q-shopping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.q-shopping-table tr + tr td {
  border-top: 1px solid var(--color-border);
}
.q-shopping-table td {
  padding: 8px 0;
  vertical-align: top;
}
.q-shopping-name {
  font-weight: 500;
}
.q-shopping-qty {
  text-align: right;
  white-space: nowrap;
  padding-left: 12px !important;
  font-variant-numeric: tabular-nums;
}
.q-shopping-price {
  text-align: right;
  white-space: nowrap;
  padding-left: 12px !important;
  font-variant-numeric: tabular-nums;
}

/* ---------- Cards inside the scrollable left column ---------- */
.q-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px;
}

/* All-in total — final row inside the merged shopping card. */
.q-allin-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 6px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--color-text-light);
}
.q-allin-total {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.q-allin-incgst {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-light);
  margin-top: 2px;
}
/* Hire builder card — primary CTA. */
.q-builders-h {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.q-builders-body {
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
}

/* Brand-orange primary CTA — reserved for builder lead. */
.q-button-primary {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-std),
    transform var(--dur-fast) var(--ease-std);
}
.q-button-primary:hover {
  background: var(--color-primary-dark);
}
.q-button-primary:active {
  transform: translateY(1px);
}
.q-button-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* DIY card — intentionally low-key. */
.q-diy-body {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
}
.q-diy-btn {
  width: 100%;
  justify-content: center;
}

/* Disclaimers — single muted fine-print cluster. */
.q-fineprint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--color-text-light);
  line-height: 1.5;
}
.q-fineprint p {
  margin: 0;
}

/* ---------- Loading / error states ---------- */
.q-loading,
.q-error {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  padding: 0 24px;
}
.q-loading h2,
.q-error h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.q-loading p,
.q-error p {
  margin: 0 0 16px;
  color: var(--color-text-light);
}

/* ---------- Lead modal ---------- */
.q-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 28, 22, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.q-dialog {
  position: relative;
  background: var(--color-surface);
  border-radius: 14px;
  padding: 28px;
  max-width: 460px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(16, 28, 22, 0.25);
}
.q-dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--color-text-light);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  line-height: 1;
}
.q-dialog-close:hover {
  background: var(--color-background);
  color: var(--color-text);
}
.q-dialog h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.q-dialog-lede {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.q-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.q-form-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--color-text-light);
}
.q-form-row input,
.q-form-row select {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--dur-fast) var(--ease-std);
}
.q-form-row input:focus,
.q-form-row select:focus {
  outline: none;
  border-color: var(--color-text);
}
.q-form-radio {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 0;
  padding: 0;
  margin: 0;
}
.q-form-radio legend {
  padding: 0;
  margin-bottom: 4px;
}
.q-form-radio label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.q-form-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--color-error);
}
.q-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}
.q-form-actions .q-button-primary {
  width: auto;
  flex: 1 1 auto;
}

.q-dialog-success {
  text-align: center;
  padding: 12px 0;
}
.q-dialog-success h3 {
  margin-bottom: 10px;
}
.q-dialog-success p {
  margin: 0 0 18px;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 540px) {
  .q-stat-v {
    font-size: 14px;
  }
}

/* =========================================================
   Refresh: display face for page headings, phones
   ========================================================= */
.tf-page h1,
.tf-page h2,
.dialog-header h3,
.settings-header h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Below tablet width every funnel step is one column (the page-specific
   two-column rules above out-rank the shared .sz-cards one). */
@media (max-width: 1024px) {
  .sz-cards.mt-cards,
  .sz-page .sz-cards,
  .q-page .sz-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  /* Logo mark only, so the step pills have room. */
  .of-brand .tf-wordmark {
    display: none;
  }
  .sz-foot-right .tf-btn-primary {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    padding-inline: 14px;
    font-size: 14px;
  }
  .sz-foot-right .sz-back {
    padding-inline: 14px;
  }
  .tf-tile.scratch .preview {
    gap: 6px;
    padding: 8px;
  }
  .mt-selected {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .mt-selected-thumb {
    width: 48px;
    height: 48px;
  }
  .mt-change-btn {
    grid-column: 1 / -1;
  }
  .mt-selected-meta {
    flex-wrap: wrap;
    gap: 2px 12px;
  }
}
