*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #1a2332;
  --navy2:   #243044;
  --orange:  #d4601a;
  --orange2: #e8722e;
  --smoke:   #f7f6f4;
  --stone:   #e8e5e0;
  --ash:     #9a9690;
  --ink:     #2c2c2c;
  --white:   #ffffff;
  --radius:  6px;
  --shadow:  0 2px 16px rgba(0,0,0,0.07);
  --trans:   all 0.22s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--smoke);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── HEADER ── */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--stone);
  padding: 0 40px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-tel {
  font-size: 0.82rem;
  color: var(--ash);
  letter-spacing: 0.01em;
}

.header-tel a { color: var(--navy); font-weight: 500; text-decoration: none; }

/* ── LAYOUT ── */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: calc(100vh - 60px);
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
  overflow: hidden;
}

/* ── LEFT: FORM PANEL ── */
.form-panel {
  padding: 40px 56px 80px;
  background: var(--white);
  border-right: 1px solid var(--stone);
  overflow-y: auto;
  min-width: 0;
  height: 100%;
}

.form-intro {
  margin-bottom: 44px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 10px;
}

.form-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 10px;
}

.form-sub {
  font-size: 0.9rem;
  color: var(--ash);
  line-height: 1.6;
  font-weight: 300;
}

/* ── SECTIONS ── */
.section {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--stone);
}

.section:last-of-type { border-bottom: none; }

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 20px;
}

/* ── DIMENSION INPUTS ── */
.dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}

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

.dim-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ash);
}

.dim-input-wrap {
  position: relative;
}

.dim-input {
  width: 100%;
  padding: 13px 36px 13px 14px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--smoke);
  outline: none;
  transition: var(--trans);
  -moz-appearance: textfield;
}

.dim-input::-webkit-outer-spin-button,
.dim-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.dim-input:focus {
  border-color: var(--navy);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,35,50,0.06);
}

.dim-input.has-value {
  border-color: var(--navy);
  background: var(--white);
}

.dim-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--ash);
  pointer-events: none;
}

.dim-hint {
  font-size: 0.72rem;
  color: var(--ash);
  margin-top: 6px;
  font-style: italic;
}

/* ── OPTION PILLS ── */
.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 10px 20px;
  border: 1.5px solid var(--stone);
  border-radius: 40px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ash);
  background: var(--smoke);
  cursor: pointer;
  transition: var(--trans);
  user-select: none;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--white);
}

.pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ── STEPPERS ── */
.stepper-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  background: var(--smoke);
}

.stepper-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stepper-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
}

.stepper-spec {
  font-size: 0.74rem;
  color: var(--ash);
  font-weight: 400;
}

.stepper-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--stone);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
}

.stepper-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--white);
}

.stepper-btn:active {
  transform: scale(0.92);
}

.stepper-val {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── TOGGLE GRID (add-ons) ── */
.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--trans);
  background: var(--smoke);
  user-select: none;
}

.toggle-card:hover {
  border-color: var(--navy);
  background: var(--white);
}

.toggle-card.active {
  border-color: var(--navy);
  background: var(--white);
}

.toggle-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--stone);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
  font-size: 0.65rem;
  color: transparent;
}

.toggle-card.active .toggle-box {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.toggle-text {}
.toggle-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  display: block;
}
.toggle-desc {
  font-size: 0.74rem;
  color: var(--ash);
  display: block;
  margin-top: 1px;
}

/* ── DOORS ── */
.door-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 36px;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.door-num {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  grid-column: 1/-1;
  margin-bottom: -4px;
}

.door-select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--smoke);
  outline: none;
  cursor: pointer;
  transition: var(--trans);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9690'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}

.door-select:focus { border-color: var(--navy); background-color: var(--white); }

.door-qty {
  width: 100%;
  padding: 11px 8px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--smoke);
  outline: none;
  cursor: pointer;
  transition: var(--trans);
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.door-remove {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
  align-self: flex-end;
}

.door-remove:hover { border-color: #c00; color: #c00; }

.add-door-btn {
  background: transparent;
  border: 1.5px dashed var(--stone);
  border-radius: var(--radius);
  padding: 10px;
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--ash);
  cursor: pointer;
  transition: var(--trans);
  margin-top: 4px;
}

.add-door-btn:hover { border-color: var(--navy); color: var(--navy); }

/* ── RIGHT: COST PANEL ── */
.cost-panel {
  background: var(--navy);
  color: var(--white);
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cost-inner {
  padding: 36px 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cost-header {
  margin-bottom: 28px;
}

.mob-expand-hint { display: none; }

.cost-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 8px;
}

.cost-total-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
  border-radius: 4px;
}

.cost-meta {
  transition: opacity 0.4s;
}

.cost-range-wrap {
  transition: opacity 0.4s;
}

.cost-range-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.cost-range-num {
  font-family: 'DM Serif Display', serif;
  font-size: 1.9rem;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cost-range-sep {
  font-size: 1.4rem;
  color: rgba(255,255,255,0.35);
  font-weight: 300;
}

.cost-range-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.cost-range-sqft {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
}

.cost-range-empty { }

.cost-total {
  font-family: 'DM Serif Display', serif;
  font-size: 2.6rem;
  color: var(--white);
  letter-spacing: -0.02em;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  line-height: 1;
}

.cost-gst {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
}

.cost-range {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
}

.cost-range span { color: rgba(255,255,255,0.7); }

/* ── LINE ITEMS ── */
.cost-lines {
  flex: 1;
  margin-bottom: 24px;
}

.cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 0.83rem;
  transition: opacity 0.3s;
}

.cost-line:last-child { border-bottom: none; }

.cost-line-label { color: rgba(255,255,255,0.6); }
.cost-line-note {
  display: block;
  font-size: 0.68rem;
  color: var(--orange);
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.4;
}

.cost-line-val {
  font-weight: 500;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

.line-range-sep {
  color: rgba(255,255,255,0.35);
  font-weight: 300;
}

.cost-line.inactive { opacity: 0.2; }

.cost-divider {
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 12px 0;
}

.cost-subtotals {
  padding-top: 4px;
}

.cost-subtotal-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.82rem;
}

.cost-subtotal-row .label { color: rgba(255,255,255,0.45); }
.cost-subtotal-row .val { color: rgba(255,255,255,0.7); }
.cost-subtotal-row.grand .label { color: var(--white); font-weight: 600; font-size: 0.9rem; }
.cost-subtotal-row.grand .val { color: var(--orange2); font-weight: 600; font-size: 0.9rem; }

/* ── GATE / LEAD CAPTURE ── */
.cost-gate {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.gate-locked {
  text-align: center;
}

.gate-lock-icon {
  font-size: 1.4rem;
  margin-bottom: 10px;
  opacity: 0.5;
}

.gate-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  margin-bottom: 4px;
  color: var(--white);
}

.gate-sub {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  margin-bottom: 16px;
}

.gate-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.06);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--white);
  outline: none;
  transition: var(--trans);
  margin-bottom: 8px;
}

.gate-input::placeholder { color: rgba(255,255,255,0.3); }
.gate-input:focus { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.1); }

.gate-btn {
  width: 100%;
  padding: 15px;
  background: var(--orange);
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: var(--trans);
  letter-spacing: 0.01em;
  margin-top: 4px;
}

.gate-btn:hover { background: var(--orange2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,96,26,0.35); }
.gate-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.gate-unlocked {
  background: rgba(212,96,26,0.12);
  border: 1px solid rgba(212,96,26,0.3);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.gate-unlocked-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--orange2);
  margin-bottom: 4px;
}

.gate-unlocked-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}

.gate-privacy {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 40px 0;
  opacity: 0.5;
}

.empty-icon { font-size: 2rem; margin-bottom: 10px; }
.empty-text { font-size: 0.82rem; color: rgba(255,255,255,0.5); line-height: 1.6; }

/* ── DISCLAIMER ── */
.cost-disclaimer {
  margin: 16px 0 8px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.disclaimer-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.cost-disclaimer p {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
  margin: 0;
}

.cost-disclaimer p strong {
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

/* ── MOBILE ── */
@media (max-width: 860px) {

  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .app {
    display: block;
    height: auto;
    overflow: visible;
    width: 100%;
  }

  .form-panel {
    padding: 28px 20px 200px;
    border-right: none;
    height: auto;
    overflow-y: visible;
    width: 100%;
    box-sizing: border-box;
  }

  /* Make the html background navy so any viewport gap shows the right colour */
  html { background: #1a2332; }

  /* Collapsed: fixed peek bar ONLY — sits at very bottom */
  .cost-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    top: auto;
    border-radius: 20px 20px 0 0;
    z-index: 200;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.25);
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Bleed navy colour below the panel into the device gesture bar area */
  .cost-panel::after {
    content: '';
    position: absolute;
    bottom: calc(-1 * env(safe-area-inset-bottom, 20px));
    left: 0; right: 0;
    height: calc(env(safe-area-inset-bottom, 20px) + 4px);
    background: var(--navy);
    pointer-events: none;
  }

  /* Open = partial drawer — shows breakdown without covering the whole form */
  .cost-panel.mob-open {
    height: 72vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    border-radius: 20px 20px 0 0;
  }

  .cost-inner {
    padding: 0 20px calc(32px + env(safe-area-inset-bottom, 16px));
    min-height: 90px;
  }

  /* Drag handle */
  .drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    margin: 14px auto 12px;
  }

  .cost-total { font-size: 2rem; }
  .cost-eyebrow { display: block; }
  .cost-meta { display: block; }

  /* Hide detail until open */
  .breakdown-gate-wrap,
  .cost-gate { display: none; }

  .cost-panel.mob-open .breakdown-gate-wrap,
  .cost-panel.mob-open .cost-gate { display: block; }

  /* Mobile expand hint — sits directly under the drag handle, always visible in the peek bar */
  .mob-expand-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0 0 10px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    animation: mobHintPulse 2.5s ease-in-out infinite;
  }
  @keyframes mobHintPulse {
    0%, 100% { opacity: 0.5; transform: translateY(0); }
    50%       { opacity: 1;   transform: translateY(-3px); }
  }
  .cost-panel.mob-open .mob-expand-hint { display: none; }

  .dim-grid { grid-template-columns: 1fr 1fr; }
  .toggle-grid { grid-template-columns: 1fr 1fr; }
  .header { padding: 0 20px; }
  .form-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .dim-grid { grid-template-columns: 1fr; }
  .toggle-grid { grid-template-columns: 1fr; }
  .cost-total { font-size: 1.8rem; }
}

@media (min-width: 861px) {
  .drag-handle { display: none; }
}

/* ── BREAKDOWN BLUR GATE ── */
/* Entire content sections are blurred — hint stays readable above */
.breakdown-locked #cost-lines,
.breakdown-locked #cost-divider,
.breakdown-locked #cost-subtotals,
.breakdown-locked #cost-disclaimer {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
  transition: filter 0.5s ease;
}

/* Clickable hint on desktop — whole blurred zone gets pointer cursor */
.breakdown-locked { cursor: pointer; }

.breakdown-unlocked #cost-lines,
.breakdown-unlocked #cost-divider,
.breakdown-unlocked #cost-subtotals,
.breakdown-unlocked #cost-disclaimer {
  filter: none;
  user-select: auto;
  pointer-events: auto;
  transition: filter 0.5s ease;
}

.breakdown-unlock-hint {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  text-align: center;
  margin: 8px 0 4px;
  letter-spacing: 0.01em;
}

/* Arrow sticks to the bottom of the visible cost panel no matter how tall
   the blurred content is — cost-panel is the scroll container */
.breakdown-scroll-arrow {
  position: sticky;
  bottom: 24px;
  text-align: center;
  z-index: 2;
  animation: arrowBounce 1.6s ease-in-out infinite;
  pointer-events: none;
}
.breakdown-scroll-arrow::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(255,255,255,0.45);
  border-bottom: 2px solid rgba(255,255,255,0.45);
  transform: rotate(45deg);
}
@keyframes arrowBounce {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%       { opacity: 0.7; transform: translateY(5px); }
}
.breakdown-unlocked .breakdown-scroll-arrow { display: none; }

.breakdown-unlock-hint strong {
  color: var(--orange2);
  font-weight: 600;
}

.breakdown-unlocked .breakdown-unlock-hint {
  display: none;
}

/* ── FOOTERS ── */
.form-footer {
  font-size: 0.68rem;
  color: var(--ash);
  text-align: center;
  padding: 24px 0 8px;
  letter-spacing: 0.04em;
  opacity: 0.6;
}

.cost-footer {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
  text-align: center;
  padding: 20px 0 16px;
  letter-spacing: 0.04em;
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section { animation: fadeIn 0.35s ease both; }
.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }
.section:nth-child(5) { animation-delay: 0.25s; }
.section:nth-child(6) { animation-delay: 0.3s; }

.cost-line { animation: fadeIn 0.25s ease both; }

