:root {
  --primary: #0B3C5D;
  --primary-dark: #092E4C;
  --accent: #F2C94C;
  --accent-dark: #D1AD3A;
  --gold: #F2C94C;
  --gold-light: #F7D980;

  --white: #FFFFFF;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --navy: #0B3C5D;
  --navy-light: #145A7E;
  --text: #2F2F2F;
  --muted: #5F6D7A;
  --line: #DDE3EA;
  --gray-light: #EFF2F7;
  --gray-border: #E2E8EF;

  --warn-bg: #FFF8E6;
  --warn-border: #F5D38A;
  --warn-text: #7A5F1F;

  --success-bg: #E8F5E9;
  --success-text: #166534;
  --success-border: #B7D8B4;

  --info-bg: #EBF3FF;
  --info-text: #113A63;
  --info-border: #C6D9ED;

  --shadow: 0 18px 45px rgba(11, 31, 58, 0.08);
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #EAF3FB 0%, #FFFFFF 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.55;
}

.page {
  width: 100%;
  padding: 24px 18px 48px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(11, 31, 58, 0.08);
  overflow: hidden;
  border: 1px solid rgba(11, 60, 93, 0.08);
}

/* HERO */
.hero {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 36px 30px;
  text-align: left;
}

.hero h1 {
  margin: 0 0 12px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/*
 * One heading in the DOM.
 * Below 960px: two balanced lines (same phrase breaks as desktop), nowrap + fluid size to fit narrow screens.
 * ≥ 960px: unchanged desktop block further down (do not alter those rules).
 */
.hero h1.hero-title {
  font-size: 2rem;
  line-height: 1.1;
}

.hero-title-line {
  display: block;
  line-height: 1.12;
}

@media (max-width: 959px) {
  /* Avoid clipping long nowrap lines against .card { overflow: hidden } */
  .page .container .card {
    overflow-x: visible;
    overflow-y: hidden;
  }

  .hero h1.hero-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12em;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: clamp(0.95rem, 3.5vw + 0.55rem, 1.75rem);
    line-height: 1.15;
  }

  /* First phrase stays one line; second can wrap so nothing is cut off */
  .hero-title-line:first-child {
    white-space: nowrap;
  }

  .hero-title-line:last-child {
    white-space: normal;
    max-width: 100%;
    overflow-wrap: break-word;
    text-wrap: pretty;
  }

  .hero-title-line + .hero-title-line {
    margin-top: 0;
  }
}

.hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 770px;
}

.hero-micro {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.96rem;
  line-height: 1.7;
}

.hero-powered {
  margin-top: 18px;
  color: var(--navy);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 18px 40px rgba(11, 31, 58, 0.16);
}

.hero-logo {
  max-height: 60px;
  width: auto;
  display: inline-block;
}

/* CONTENT */
.content {
  padding: 28px 22px 30px;
}

/* STEPS */
.step {
  display: none;
  animation: fadeIn 0.18s ease;
}

.step.active,
.step-panel.active {
  display: block;
}

.step-panel {
  display: none;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step h2,
.section-title,
#results h2 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(11, 60, 93, 0.12);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}

.section-subtitle,
.results-intro,
.small-note,
p {
  color: #475569;
}

.section-subtitle {
  margin: 0 0 14px;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* GLOBAL SECTION */
.global-section {
  background: #FBFCFF;
  border: 1px solid rgba(11, 60, 93, 0.08);
  border-radius: 16px;
  padding: 20px 18px;
  margin: 20px 0;
  box-shadow: 0 12px 30px rgba(11, 31, 58, 0.05);
}

.global-section .section-title {
  margin-bottom: 10px;
}

.global-section .section-subtitle {
  margin: 0 0 14px;
  font-size: 0.94rem;
  line-height: 1.55;
}

.global-section label {
  margin-top: 0;
}

/* FIELDS */
label {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--gray-border);
  background: var(--white);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15.8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

input,
select {
  min-height: 52px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[type="file"] {
  padding: 12px;
  min-height: auto;
  background: var(--white);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(11, 60, 93, 0.12);
}

.step > label,
.step > input,
.step > select,
.step > textarea {
  display: block;
}

.step > label:not(:first-of-type) {
  margin-top: 14px;
}

/* RESULT / SECTION BOXES */
#results {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 14px;
  margin-top: 10px;
}

#results.hidden {
  display: none !important;
}

#results p {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.55;
}

#materials,
#labor,
#total {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

#total {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.working-price-card {
  background: linear-gradient(135deg, #fff9ec 0%, #fff3d7 100%);
  border: 1px solid #e8c87f;
  border-radius: 18px;
  padding: 18px 16px;
  margin: 14px 0 10px;
  text-align: center;
}

.working-price-label {
  font-size: .95rem;
  color: #6b4d12;
  margin-bottom: 8px;
  font-weight: 700;
}

.working-price-value {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.working-price-note {
  font-size: .9rem;
  line-height: 1.5;
  color: #6b7280;
  margin-bottom: 14px;
}

/* HELPERS */
.hidden {
  display: none !important;
}

/* STEPPER */
.stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.step-pill {
  min-width: 0;
  border-radius: 999px;
  padding: 12px 14px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: #EAF3FB;
  color: var(--navy);
  border: 1px solid rgba(11, 60, 93, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.step-pill.done {
  background: var(--accent);
  color: #0F172A;
  border-color: rgba(242, 201, 76, 0.6);
}

@media (max-width: 640px) {
  .stepper {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .step-pill {
    font-size: 0.72rem;
    padding: 10px 12px;
  }
}

/* PROJECT SELECTOR */
.selector-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.selector-trigger {
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  min-height: 58px;
}

.selector-trigger:hover {
  background: #fafcff;
}

.selector-trigger strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
}

.selector-trigger span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.selector-chevron {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.selector-shell.open .selector-chevron {
  transform: rotate(180deg);
}

.selector-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #fcfdff;
}

.selector-shell.open .selector-panel {
  display: block;
}

.accordion-group + .accordion-group {
  margin-top: 10px;
}

.accordion-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
}

.accordion-button > div:first-child > div:first-child {
  font-size: 0.98rem;
  font-weight: 700;
}

.accordion-button:hover {
  background: #f8fafc;
}

.accordion-button .meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.accordion-button .acc-icon {
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.accordion-group.open .accordion-button .acc-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 10px 4px 0;
}

.accordion-group.open .accordion-content {
  display: block;
}

.project-option {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-option.selectable {
  cursor: pointer;
}

.project-option.selectable:hover {
  border-color: #94a3b8;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.project-option.active {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15, 42, 68, 0.08);
  background: #f8fafc;
}

.project-option h4 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.project-option p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.badge {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.badge.live {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.selected-project {
  margin-top: 14px;
  background: #E8F3FF;
  border: 1px solid rgba(17, 58, 99, 0.16);
  color: var(--navy);
  border-radius: 16px;
  padding: 14px;
  font-size: 0.94rem;
  line-height: 1.55;
  display: none;
}

.selected-project.show {
  display: block;
}

.validation {
  margin-top: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.93rem;
  display: none;
}

.validation.active {
  display: block;
}

/* CTA / RESULTS DETAILS */
.cta-panel {
  margin-top: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 14px;
}

.cta-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.breakdown {
  margin-top: 18px;
}

.breakdown h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--text);
}

.breakdown ul {
  margin: 0;
  padding-left: 20px;
}

.breakdown li {
  margin-bottom: 8px;
  color: var(--muted);
}

.disclaimer {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* COMPLETION */
.completion-screen {
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 18px;
  text-align: center;
  min-height: 340px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.completion-screen.active {
  display: flex;
}

.completion-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.8rem;
  font-weight: 900;
}

.completion-icon.hot {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.completion-icon.done {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.completion-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  align-items: center;
}

/* CHECKBOX CARDS */
.checkbox-card-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.checkbox-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: auto;
  margin: 0;
  flex-shrink: 0;
  appearance: auto;
  -webkit-appearance: checkbox;
  box-shadow: none;
  border: none;
  padding: 0;
}

.checkbox-card label {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.micro-educational {
  margin-top: 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.micro-educational a {
  color: var(--warn-text);
  font-weight: 700;
}

/* PLUMBING TEMPLATE BLOCKS */
#plumbingBasicsSection > div,
#plumbingDetailsSection > div {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 14px;
}

#plumbingBasicsSection > div label:first-of-type,
#plumbingDetailsSection > div label:first-of-type {
  margin-top: 0;
}

#plumbingBasicsSection > div label:not(:first-of-type),
#plumbingDetailsSection > div label:not(:first-of-type) {
  margin-top: 14px;
}

#plumbingBasicsSection > div .small-note,
#plumbingDetailsSection > div .small-note {
  margin-top: 8px;
}

/* BUTTON SYSTEM */
.btn {
  width: 100%;
  min-height: 52px;
  padding: 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(11, 31, 58, 0.28);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #0f172a;
  font-weight: 700;
  border: none;
}

.btn-gold:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(200, 162, 74, 0.6);
}

.btn-muted {
  background: #eef1f5;
  color: var(--navy);
  border: 1px solid var(--gray-border);
}

.btn-muted:hover {
  background: #e3e7ec;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  background: #ffffff;
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.cta-panel .actions {
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  align-items: center;
}

.actions-split {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* RESPONSIVE */
@media (min-width: 640px) {
  .page {
    padding: 24px 18px 48px;
  }

  .hero {
    padding: 34px 28px;
  }

  .content {
    padding: 26px 22px 28px;
  }

  .checkbox-card-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .completion-actions {
    flex-direction: row;
    justify-content: center;
    max-width: none;
  }

  .completion-actions .btn {
    width: auto;
    min-width: 180px;
  }

  .cta-panel .actions-split {
    flex-direction: row;
    justify-content: center;
  }

  .cta-panel .actions-split .btn {
    width: auto;
    min-width: 170px;
  }

  .actions-split {
    flex-direction: row;
  }

  .actions-split .btn {
    width: auto;
    min-width: 170px;
  }

  #plumbingBasicsSection > div,
  #plumbingDetailsSection > div {
    padding: 18px 16px;
  }
}

@media (min-width: 960px) {
  .page {
    padding: 34px 24px 60px;
  }

  .hero {
    padding: 40px 34px;
  }

  .hero h1.hero-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.06em;
    font-size: clamp(1.55rem, 1.25vw + 1.35rem, 2.4rem);
  }

  .hero-title-line {
    white-space: nowrap;
  }

  .hero-title-line + .hero-title-line {
    margin-top: 0;
  }

  .content {
    padding: 30px 28px 32px;
  }

  .step h2,
  #results h2 {
    font-size: 1.15rem;
  }

  .global-section {
    padding: 18px 18px;
  }

  #plumbingBasicsSection > div,
  #plumbingDetailsSection > div {
    padding: 20px 18px;
  }
}
