:root {
  color-scheme: light;
  --ink: #07120d;
  --ink-soft: #425149;
  --forest: #063c24;
  --forest-deep: #03291a;
  --lime: #39c80e;
  --lime-dark: #249800;
  --lime-soft: #e8f8e1;
  --canvas: #f3f5ef;
  --paper: #fbfcf8;
  --white: #ffffff;
  --line: rgba(7, 18, 13, .12);
  --line-strong: rgba(7, 18, 13, .2);
  --muted: #68746d;
  --warning: #b66d00;
  --warning-bg: #fff3dc;
  --danger: #bd332b;
  --shadow-sm: 0 1px 2px rgba(7, 18, 13, .04), 0 4px 18px rgba(7, 18, 13, .035);
  --shadow-lg: 0 24px 70px rgba(3, 41, 26, .18);
  --radius: 24px;
  --radius-sm: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(57, 200, 14, .08), transparent 26rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.35;
  padding-bottom: calc(166px + var(--safe-bottom));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; touch-action: manipulation; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(251, 252, 248, .9);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 760px;
  height: 72px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-logo { width: 92px; height: 42px; object-fit: contain; object-position: left center; }
.header-title { display: flex; flex-direction: column; min-width: 0; }
.header-title strong { font-size: 17px; line-height: 1.1; letter-spacing: -.02em; }

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.eyebrow.accent { color: var(--lime-dark); }

.save-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(57, 200, 14, .11); }
.save-state.saving .save-dot { background: #aeb7b1; box-shadow: none; }

.app-shell { max-width: 760px; margin: 0 auto; padding: 20px 16px 42px; }

.intro { padding: 18px 4px 14px; }
.intro h1 { margin: 8px 0 10px; font-size: clamp(36px, 10vw, 56px); line-height: .96; letter-spacing: -.065em; font-weight: 850; }
.intro h1 em { color: var(--lime-dark); font-style: normal; }
.intro p { margin: 0; max-width: 520px; color: var(--ink-soft); font-size: 15px; }

.panel {
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 14px 0;
  padding: 18px;
}

.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-heading.standalone { padding: 22px 4px 6px; margin-bottom: 10px; }
.section-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}
.section-heading h2 { margin: 0; font-size: 19px; line-height: 1.1; letter-spacing: -.035em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.field-grid { display: grid; gap: 12px; }
.field { display: block; }
.field > span, .control-label > span { display: block; margin: 0 0 7px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  font-size: 16px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field input:focus { background: #fff; border-color: var(--lime-dark); box-shadow: 0 0 0 4px rgba(57, 200, 14, .12); }
.field input::placeholder { color: #909a94; }

.address-wrap { position: relative; }
.address-wrap > input { padding-right: 58px; }
.field-note { margin: 9px 2px 0; color: var(--muted); font-size: 11px; }
.icon-button { display: inline-grid; place-items: center; border: 0; background: transparent; padding: 0; }
.location-button { position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; color: var(--forest); background: var(--lime-soft); border-radius: 12px; }
.icon-button svg, .button svg, .service-icon svg, .summary-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.address-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 35;
  overflow: hidden;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.address-list.open { display: block; }
.address-item { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.address-item:last-child { border-bottom: 0; }
.address-item:active { background: var(--lime-soft); }
.address-item svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--lime-dark); }
.address-item small { display: block; margin-top: 2px; color: var(--muted); }

.control-block { margin-top: 17px; }
.control-block:first-of-type { margin-top: 0; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.control-label > span { margin: 0; }
.control-label small { color: var(--muted); font-size: 10px; text-align: right; }

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
  background: #e9ece7;
  border: 1px solid rgba(7, 18, 13, .04);
  border-radius: 14px;
}
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented button {
  min-height: 44px;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 750;
}
.segmented button.selected { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(7, 18, 13, .12); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.service-icon, .summary-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--forest);
  background: var(--lime-soft);
  border-radius: 12px;
}
.switch-copy { min-width: 0; flex: 1; }
.switch-copy strong, .switch-copy small { display: block; }
.switch-copy strong { font-size: 14px; }
.switch-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { position: absolute; inset: 0; background: #c8cfca; border-radius: 999px; transition: background .2s; }
.switch > span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(7, 18, 13, .22); transition: transform .2s; }
.switch input:checked + span { background: var(--lime-dark); }
.switch input:checked + span::after { transform: translateX(20px); }

.chips { display: flex; gap: 8px; }
.chips button {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}
.chips button.selected { color: #fff; background: var(--forest); border-color: var(--forest); }

.side-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(16px);
}
.side-tabs button {
  min-height: 44px;
  padding: 7px 3px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
}
.side-tabs button.selected { color: #fff; background: var(--forest); box-shadow: 0 4px 12px rgba(6, 60, 36, .18); }

.side-card { display: none; margin-top: 10px; }
.side-card.selected { display: block; animation: card-in .22s ease both; }
@keyframes card-in { from { opacity: 0; transform: translateY(5px); } }
.side-card-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 6px; }
.side-card-header h3 { margin: 0; font-size: 27px; line-height: 1; letter-spacing: -.055em; }
.side-card-header span { color: var(--muted); font-size: 11px; }

.count-row { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.count-row:last-child { border-bottom: 0; }
.count-row.compact { min-height: 66px; }
.row-icon { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; color: var(--forest); background: var(--lime-soft); border-radius: 12px; }
.row-icon svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.count-copy { min-width: 0; flex: 1; }
.count-copy strong, .count-copy small { display: block; }
.count-copy strong { font-size: 14px; letter-spacing: -.01em; }
.count-copy small { margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.3; }
.stepper { display: grid; grid-template-columns: 44px 44px 44px; align-items: center; flex: 0 0 auto; }
.stepper button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--forest);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 23px;
  font-weight: 450;
  line-height: 1;
}
.stepper button:active { background: var(--lime-soft); transform: scale(.96); }
.stepper input { width: 44px; height: 44px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; text-align: center; font-size: 18px; font-weight: 820; }

.collapsible-panel { padding: 0 18px; }
details > summary { min-height: 72px; display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
summary > span:nth-child(2) { flex: 1; min-width: 0; }
summary strong, summary small { display: block; }
summary strong { font-size: 14px; }
summary small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.chevron { display: grid; place-items: center; color: var(--muted); transition: transform .2s; }
.chevron svg { width: 19px; height: 19px; }
details[open] .chevron { transform: rotate(180deg); }
.details-body { padding: 0 0 10px; }

.estimate-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(251, 252, 248, .94);
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 44px rgba(7, 18, 13, .10);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  padding-bottom: var(--safe-bottom);
}
.dock-status { min-height: 28px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 14px; color: var(--ink-soft); background: rgba(7, 18, 13, .04); font-size: 10px; font-weight: 750; text-align: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca69f; }
.dock-status.good .status-dot { background: var(--lime-dark); }
.dock-status.warning { color: #7a4900; background: var(--warning-bg); }
.dock-status.warning .status-dot { background: var(--warning); }
.dock-status.danger { color: var(--danger); background: #fff0ed; }
.dock-status.danger .status-dot { background: var(--danger); }
.dock-main { max-width: 760px; margin: 0 auto; padding: 8px 16px 7px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.dock-price small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.dock-price strong { display: block; margin-top: -1px; color: var(--forest); font-size: 32px; line-height: 1; letter-spacing: -.045em; }
.dock-metrics { display: flex; gap: 16px; text-align: right; }
.dock-metrics span { min-width: 60px; }
.dock-metrics small, .dock-metrics b { display: block; }
.dock-metrics small { color: var(--muted); font-size: 9px; }
.dock-metrics b { margin-top: 1px; font-size: 13px; }
.dock-actions { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: .72fr 1.28fr; gap: 9px; padding: 0 16px 11px; }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.button.primary { color: #fff; background: var(--forest); box-shadow: 0 6px 18px rgba(6, 60, 36, .18); }
.button.primary:active { background: var(--forest-deep); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }

.sheet { display: none; position: fixed; inset: 0; z-index: 80; align-items: flex-end; justify-content: center; }
.sheet.open { display: flex; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 18, 11, .52); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); animation: fade-in .2s ease both; }
.sheet-pane { position: relative; z-index: 1; width: min(100%, 680px); max-height: min(90vh, 860px); overflow: auto; overscroll-behavior: contain; padding: 10px 18px calc(18px + var(--safe-bottom)); background: var(--paper); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg); animation: sheet-in .28s cubic-bezier(.2,.9,.3,1) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(32px); opacity: .8; } }
.sheet-handle { width: 38px; height: 5px; margin: 0 auto 10px; background: #d0d6d2; border-radius: 999px; }
.sheet-header { position: sticky; top: -10px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 12px; background: rgba(251, 252, 248, .95); backdrop-filter: blur(14px); }
.sheet-header h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: -.05em; }
.close-button { width: 44px; height: 44px; color: var(--ink-soft); background: #e9ece7; border-radius: 50%; }
.close-button svg { width: 18px; height: 18px; }
.sheet-intro { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.sheet-actions { position: sticky; bottom: -18px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 9px; margin: 14px -2px 0; padding: 10px 2px calc(2px + var(--safe-bottom)); background: linear-gradient(transparent, var(--paper) 18%); }
.approval-note { margin: 8px 4px 0; color: var(--muted); font-size: 10px; text-align: center; }

.line-item { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.line-item small { color: var(--muted); }
.total-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-weight: 800; }
.total-line.major { font-size: 18px; }
.profit-value { color: var(--lime-dark); }
.soft-rule { height: 1px; margin: 5px 0; background: var(--line); border: 0; }
.notice { margin: 9px 0; padding: 11px 12px; color: #774800; background: var(--warning-bg); border: 1px solid rgba(182, 109, 0, .18); border-radius: 13px; font-size: 11px; font-weight: 650; }
.rate-pill { padding: 5px 9px; color: #fff; background: var(--forest); border-radius: 999px; font-size: 11px; }

.proposal-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); }
.proposal-brand { padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--forest); }
.proposal-brand img { width: 120px; height: 52px; padding: 5px 8px; object-fit: contain; background: #fff; border-radius: 12px; }
.proposal-brand span { color: rgba(255,255,255,.72); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; text-align: right; }
.proposal-body { padding: 18px; }
.proposal-for { margin-bottom: 18px; color: var(--muted); font-size: 11px; }
.proposal-for strong { display: block; margin-top: 3px; color: var(--ink); font-size: 17px; }
.proposal-section-label { margin: 0 0 6px; color: var(--lime-dark); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .14em; }
.proposal-list { list-style: none; padding: 0; margin: 0; }
.proposal-list li { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.proposal-list li svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--forest); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.offer-card { margin: 15px 0; padding: 12px; color: var(--forest); background: var(--lime-soft); border: 1px solid rgba(57, 200, 14, .22); border-radius: 14px; font-size: 11px; font-weight: 700; }
.proposal-price { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 2px solid var(--ink); }
.proposal-price span { color: var(--muted); font-size: 11px; font-weight: 700; }
.proposal-price strong { color: var(--forest); font-size: 34px; line-height: 1; letter-spacing: -.05em; }
.proposal-price del { margin-right: 7px; color: var(--muted); font-size: 15px; }
.proposal-trust { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.trust-item { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.trust-item svg { width: 17px; height: 17px; color: var(--lime-dark); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.proposal-contact { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: calc(172px + var(--safe-bottom)); z-index: 100; max-width: calc(100% - 32px); padding: 11px 15px; color: #fff; background: var(--ink); border-radius: 999px; box-shadow: 0 10px 35px rgba(7, 18, 13, .26); font-size: 12px; font-weight: 750; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 660px) {
  body { padding-bottom: 154px; }
  .app-shell { padding-left: 22px; padding-right: 22px; }
  .field-grid { grid-template-columns: .8fr 1.2fr; }
  .setup-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
  .setup-panel .section-heading { grid-column: 1 / -1; margin-bottom: 0; }
  .setup-panel .salesperson-block { grid-column: 1 / -1; }
  .setup-panel .control-block { margin-top: 0; }
  .switch-row { margin-top: 0; }
  .referral-block { margin-top: 0; }
  .dock-main, .dock-actions { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 380px) {
  .header-inner { padding-left: 14px; padding-right: 14px; }
  .brand-logo { width: 82px; }
  .header-title .eyebrow { display: none; }
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .panel { padding: 15px; border-radius: 21px; }
  .count-row { gap: 8px; }
  .row-icon { width: 34px; height: 34px; }
  .stepper { grid-template-columns: 38px 38px 38px; }
  .stepper button { width: 38px; height: 40px; }
  .stepper input { width: 38px; }
  .dock-main, .dock-actions { padding-left: 10px; padding-right: 10px; }
  .dock-metrics { gap: 8px; }
  .button { padding-left: 11px; padding-right: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}
