:root {
  --bg: #FAFAF5;
  --fg: #1C1C18;
  --accent: #4A6741;
  --amber: #D97706;
  --muted: #6B6B60;
  --surface: #FFFFFF;
  --border: #E4E4DA;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Navigation */
.nav {
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.nav-logo { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--fg); }
.nav-tagline { font-size: 14px; color: var(--muted); }
.nav-cta {
  margin-left: auto;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.nav-cta:hover { opacity: 0.85; }

/* Hero */
.hero { padding: 100px 40px 80px; }
.hero-inner { max-width: 1100px; margin: 0 auto; }
.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  max-width: 800px;
  letter-spacing: -0.02em;
}
.hero-sub {
  margin-top: 28px;
  font-size: 18px;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
}

/* Stats */
.stats { background: var(--fg); color: var(--bg); padding: 48px 40px; }
.stats-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 0; }
.stat { flex: 1; text-align: center; }
.stat-number { display: block; font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -0.03em; }
.stat-label { display: block; font-size: 13px; color: rgba(250,250,245,0.6); margin-top: 6px; }
.stat-divider { width: 1px; height: 60px; background: rgba(250,250,245,0.15); flex-shrink: 0; }

/* Features */
.features { padding: 100px 40px; }
.features-inner { max-width: 1100px; margin: 0 auto; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--fg);
  letter-spacing: -0.02em;
  max-width: 600px;
  margin-bottom: 60px;
}
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  transition: box-shadow 0.2s ease;
}
.feature-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.06); }
.feature-icon { color: var(--accent); margin-bottom: 20px; }
.feature-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; color: var(--fg); }
.feature-card p { font-size: 14px; color: var(--muted); line-height: 1.65; }

/* Process */
.process { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 100px 40px; }
.process-inner { max-width: 1100px; margin: 0 auto; }
.process-steps { display: flex; align-items: center; gap: 0; margin-top: 60px; }
.step { flex: 1; }
.step-number { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--amber); letter-spacing: 0.05em; display: block; margin-bottom: 16px; }
.step h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; color: var(--fg); }
.step p { font-size: 15px; color: var(--muted); line-height: 1.65; max-width: 280px; }
.step-connector { width: 80px; flex-shrink: 0; height: 1px; background: var(--border); margin: 0 24px; position: relative; top: -20px; }

/* Closing */
.closing { padding: 120px 40px; }
.closing-inner { max-width: 1100px; margin: 0 auto; }
.closing-headline {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  letter-spacing: -0.02em;
  max-width: 760px;
}
.closing-sub { margin-top: 28px; font-size: 18px; color: var(--muted); max-width: 480px; line-height: 1.7; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 48px 40px; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; }
.footer-logo { font-family: var(--font-display); font-size: 18px; font-weight: 700; display: block; margin-bottom: 12px; }
.footer p { font-size: 14px; color: var(--muted); max-width: 360px; line-height: 1.6; }
.footer-links { font-size: 13px; color: var(--muted); }

/* Mobile */
@media (max-width: 768px) {
  .nav { padding: 16px 24px; }
  .hero { padding: 64px 24px 56px; }
  .hero-headline { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .stats { padding: 40px 24px; }
  .stats-inner { flex-direction: column; gap: 32px; }
  .stat-divider { width: 48px; height: 1px; }
  .features { padding: 72px 24px; }
  .features-grid { grid-template-columns: 1fr; gap: 20px; }
  .process { padding: 72px 24px; }
  .process-steps { flex-direction: column; gap: 40px; }
  .step-connector { display: none; }
  .step p { max-width: 100%; }
  .closing { padding: 80px 24px; }
  .closing-headline { font-size: 28px; }
  .footer { padding: 40px 24px; }
  .footer-inner { flex-direction: column; }
}
/* ── Estimate Builder ── */
.page-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 40px 80px;
}
.estimate-header { margin-bottom: 40px; }
.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-sub { margin-top: 10px; font-size: 16px; color: var(--muted); }

.form-section { margin-bottom: 36px; }
.section-heading {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--fg);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label, .label-block {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input, .form-group select, textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg);
  background: var(--surface);
  transition: border-color 0.15s;
  width: 100%;
}
.form-group input:focus, .form-group select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,103,65,0.12);
}
textarea { resize: vertical; min-height: 80px; }

/* Items table */
.items-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.items-thead {
  display: grid;
  grid-template-columns: 1fr 80px 110px 130px 100px 40px;
  gap: 0;
  padding: 10px 16px;
  background: #F4F4EE;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 110px 130px 100px 40px;
  gap: 0;
  align-items: center;
  border-top: 1px solid var(--border);
}
.item-row input, .item-row select {
  padding: 12px 14px;
  border: none;
  border-right: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg);
  background: var(--surface);
  width: 100%;
  outline: none;
}
.item-row input:last-of-type { border-right: none; }
.item-row input:focus, .item-row select:focus {
  background: #F8FAF7;
  box-shadow: inset 0 0 0 2px var(--accent);
  z-index: 1;
  position: relative;
}
.f-total {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  background: #F8FAF7;
  border-right: 1px solid var(--border);
}
.btn-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-remove:hover { background: #FEE2E2; color: #DC2626; }

.btn-add-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-add-row:hover { border-color: var(--accent); color: var(--accent); }

/* Totals */
.totals-block {
  background: #F4F4EE;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 380px;
  margin-left: auto;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: var(--muted);
  padding: 8px 0;
}
.total-row.total-final {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

/* Actions */
.form-actions { display: flex; gap: 16px; align-items: center; padding-top: 8px; }
.btn-secondary {
  padding: 12px 24px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--fg); color: var(--fg); }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

/* ── Estimate Customer View ── */
.view-container { max-width: 720px; margin: 0 auto; padding: 56px 40px 80px; }
.view-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #F0F7EE;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.view-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.view-business { margin-top: 8px; font-size: 16px; color: var(--muted); }
.view-table {
  margin-top: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.view-thead {
  display: grid;
  grid-template-columns: 1fr 80px 130px 100px;
  padding: 10px 20px;
  background: #F4F4EE;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.view-row {
  display: grid;
  grid-template-columns: 1fr 80px 130px 100px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  align-items: center;
}
.view-row:first-of-type { border-top: none; }
.view-item-name { font-weight: 500; color: var(--fg); }
.view-item-unit { font-size: 13px; color: var(--muted); }
.view-price { font-weight: 500; }
.view-total { font-weight: 600; text-align: right; }

.view-totals {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.view-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  font-size: 15px;
}
.view-totals-row.head { background: #F4F4EE; font-weight: 600; font-size: 17px; color: var(--fg); }
.view-totals-row.head .view-totals-val { font-family: var(--font-display); }

.view-notes {
  margin-top: 32px;
  background: #F8F8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}
.view-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.view-powered { font-size: 12px; }
.view-powered a { color: var(--accent); text-decoration: none; }
.error-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 12px;
  padding: 28px;
  color: #DC2626;
  font-size: 16px;
  text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
  .page-container, .view-container { padding: 32px 20px 60px; }
  .form-row { grid-template-columns: 1fr; }
  .items-thead { grid-template-columns: 1fr 60px 90px 110px 80px 32px; font-size: 10px; gap: 0; padding: 8px 12px; }
  .item-row { grid-template-columns: 1fr 60px 90px 110px 80px 32px; }
  .item-row input, .item-row select { padding: 10px 10px; font-size: 13px; }
  .f-total { padding: 10px 8px; font-size: 13px; }
  .btn-remove { padding: 6px; }
  .totals-block { max-width: 100%; }
  .form-actions { flex-direction: column-reverse; }
  .btn-secondary, .btn-primary { text-align: center; width: 100%; justify-content: center; }
  .view-thead { grid-template-columns: 1fr 60px 110px 80px; font-size: 10px; }
  .view-row { grid-template-columns: 1fr 60px 110px 80px; font-size: 14px; }
  .view-footer { flex-direction: column; gap: 12px; align-items: flex-start; }
}
