// All services from the brief + per-category configs that drive scene content.
// Each category template defines: atlas target, AR tags, estimate fields, line items, qualifier chat.
// Specific services can override.

const SERVICE_LIST = [
  // Trades — residential mechanical
  ['HVAC','hvac'], ['Plumbing','plumbing'], ['Electrical','electrical'],
  ['Roofing','roofing'], ['Roofing Inspections','roofing'], ['Roofing Drone Inspections','roofing'],
  ['Solar Installation','solar'], ['Solar Panel Cleaning','solar'], ['Generator Installation','solar'],
  ['EV Charger Installation','solar'], ['Energy Audits','solar'], ['Green Home Upgrades','solar'],
  ['Smart Irrigation Systems','outdoor'], ['Home Automation Installation','security'],
  // Outdoor
  ['Tree Service','tree'], ['Tree Trimming','tree'], ['Stump Grinding','tree'],
  ['Landscaping','landscape'], ['Lawn Care','landscape'], ['Landscape Lighting','landscape'],
  ['Outdoor Lighting','landscape'], ['Holiday Light Installation','landscape'],
  ['Christmas Light Removal','landscape'], ['Irrigation / Sprinklers','outdoor'],
  ['Fertilization Services','landscape'], ['Artificial Turf Installation','landscape'],
  ['Outdoor Pest Barriers','pest'], ['Mosquito Control','pest'],
  ['Snow Removal','outdoor'], ['Emergency Storm Cleanup','emergency'], ['Emergency Tree Removal','emergency'],
  // Pest
  ['Pest Control','pest'], ['Wildlife Removal','pest'], ['Bee Removal','pest'],
  // Pools
  ['Pool Service','pool'], ['Pool Installation','pool'],
  // Cleaning
  ['Cleaning Services','cleaning'], ['Maid Services','cleaning'], ['Pressure Washing','cleaning'],
  ['Window Cleaning','cleaning'], ['Gutter Cleaning','cleaning'], ['Soft Washing','cleaning'],
  ['Roof Soft Wash','cleaning'], ['Carpet Cleaning','cleaning'], ['Tile & Grout Cleaning','cleaning'],
  ['Upholstery Cleaning','cleaning'], ['Mattress Cleaning','cleaning'], ['Dryer Vent Cleaning','cleaning'],
  ['Air Duct Cleaning','cleaning'], ['Odor Removal','cleaning'], ['Post-Construction Cleanup','cleaning'],
  ['Mobile Detailing','cleaning'],
  // Gutters & siding & exterior
  ['Gutter Installation','exterior'], ['Junk Removal','cleaning'], ['Moving Services','cleaning'],
  ['Painting','exterior'], ['Drywall Repair','remodel'], ['Wallpaper Installation','remodel'],
  ['Flooring Installation','remodel'], ['Tile Installation','remodel'], ['Carpet Installation','remodel'],
  ['Epoxy Flooring','remodel'], ['Cabinet Refinishing','remodel'],
  // Handyman
  ['Handyman Services','handyman'], ['Appliance Repair','handyman'],
  ['Garage Door Repair','handyman'], ['Garage Door Installation','handyman'],
  ['Locksmith','handyman'], ['Furniture Assembly','handyman'], ['Moving Labor','handyman'],
  ['Storage Services','handyman'], ['Audio / Home Theater Installation','security'],
  // Security
  ['Home Security','security'], ['Smart Home Installation','security'],
  ['Internet / Cable Installation','security'], ['CCTV Installation','security'],
  ['AI Home Monitoring Services','security'], ['Blinds & Shades Installation','remodel'],
  ['Window Tinting','exterior'],
  // Construction & hardscape
  ['Fence Installation','masonry'], ['Fence Repair','masonry'],
  ['Deck Building','masonry'], ['Patio Installation','masonry'],
  ['Concrete Services','masonry'], ['Asphalt / Paving','masonry'],
  ['Masonry','masonry'], ['Retaining Walls','masonry'], ['Hardscaping','masonry'],
  ['Outdoor Kitchens','masonry'], ['Pergolas & Gazebos','masonry'],
  ['Screened Enclosures','masonry'], ['Sunrooms','masonry'],
  ['Water Feature Installation','masonry'],
  // Exterior
  ['Siding Installation','exterior'], ['Window Installation','exterior'],
  ['Door Installation','exterior'], ['Glass Repair','exterior'],
  ['Insulation Services','exterior'], ['Acoustic Installation','remodel'],
  // Restoration
  ['Water Damage Restoration','restoration'], ['Fire Damage Restoration','restoration'],
  ['Mold Remediation','restoration'], ['Biohazard Cleanup','restoration'],
  ['Crawlspace Encapsulation','restoration'], ['Foundation Repair','restoration'],
  ['Hoarding Cleanup','restoration'], ['Lead Paint Removal','restoration'],
  ['Asbestos Removal','restoration'], ['Radon Mitigation','restoration'],
  ['Restoration & Reconstruction','restoration'],
  // Septic, plumbing extended
  ['Septic Services','plumbing'], ['Drain Cleaning','plumbing'], ['Sewer Line Repair','plumbing'],
  ['Excavation','masonry'], ['Leak Detection','plumbing'], ['Water Treatment','plumbing'],
  // Chimney & fireplace
  ['Chimney Sweep','cleaning'], ['Fireplace Services','remodel'],
  // Kitchen / bath / remodel
  ['Cabinet Installation','remodel'], ['Countertop Installation','remodel'],
  ['Kitchen Remodeling','remodel'], ['Bathroom Remodeling','remodel'],
  ['Whole Home Remodeling','remodel'], ['Home Additions','remodel'],
  ['Sauna / Spa Installation','remodel'], ['Closet Organization Systems','remodel'],
  // Inspections / staging
  ['Home Inspections','inspect'], ['Real Estate Prep Services','inspect'],
  ['Staging Services','inspect'], ['Interior Design','inspect'],
  // Marine / specialty
  ['Dock / Marine Services','specialty'], ['Boat Lift Installation','specialty'],
  // Demo / disaster
  ['Demolition','masonry'], ['Hurricane Prep Services','emergency'],
  ['Disaster Recovery Services','emergency'], ['Boarding Up Services','emergency'],
  ['Temporary Power Services','emergency'],
  // Commercial build / specialty
  ['Commercial Buildouts','commercial'], ['Tiny Home Builders','specialty'],
  ['Barndominium Builders','specialty'], ['Shed Installation','specialty'],
  ['Barn Builders','specialty'], ['Pole Barn Construction','specialty'],
  ['Retrofitting Services','remodel'],
  // Emergency
  ['Emergency Plumbing','emergency'], ['Emergency HVAC','emergency'],
  ['Emergency Electrical','emergency'], ['Emergency Roofing','emergency'],
  ['Emergency Locksmith','emergency'], ['Emergency Water Extraction','emergency'],
  // Commercial
  ['Commercial Cleaning','commercial'], ['Commercial Landscaping','commercial'],
  ['Commercial HVAC','commercial'], ['Commercial Plumbing','commercial'],
  ['Commercial Electrical','commercial'], ['Commercial Roofing','commercial'],
  ['Commercial Pest Control','commercial'], ['Commercial Kitchen Hood Cleaning','commercial'],
  ['Commercial Glass Services','commercial'], ['Property Maintenance','commercial'],
  ['Facility Maintenance','commercial'], ['Janitorial Services','commercial'],
  ['Restaurant Equipment Repair','commercial'],
  ['Porta Potty Rental','commercial'], ['Dumpster Rental','commercial'],
  ['Parking Lot Striping','commercial'], ['Sign Installation','commercial'],
  ['Awning Installation','commercial'], ['Warehouse Maintenance','commercial'],
  ['Industrial Cleaning','commercial'], ['Industrial Electrical','commercial'],
  ['Industrial HVAC','commercial'], ['Industrial Plumbing','commercial'],
  // Maintenance
  ['Elevator Maintenance','commercial'], ['Escalator Maintenance','commercial'],
].map(([name, cat]) => ({ id: name.toLowerCase().replace(/[^a-z0-9]+/g,'-'), name, cat }));

const SERVICE_CATEGORIES = [
  { id:'all',         label:'All trades' },
  { id:'hvac',        label:'HVAC' },
  { id:'plumbing',    label:'Plumbing' },
  { id:'electrical',  label:'Electrical' },
  { id:'roofing',     label:'Roofing' },
  { id:'solar',       label:'Solar & energy' },
  { id:'exterior',    label:'Exterior' },
  { id:'outdoor',     label:'Outdoor' },
  { id:'landscape',   label:'Landscaping' },
  { id:'tree',        label:'Tree' },
  { id:'pool',        label:'Pool' },
  { id:'pest',        label:'Pest' },
  { id:'cleaning',    label:'Cleaning' },
  { id:'restoration', label:'Restoration' },
  { id:'remodel',     label:'Remodel' },
  { id:'masonry',     label:'Concrete & hardscape' },
  { id:'handyman',    label:'Handyman' },
  { id:'security',    label:'Smart home' },
  { id:'inspect',     label:'Inspection & prep' },
  { id:'emergency',   label:'Emergency' },
  { id:'commercial',  label:'Commercial' },
  { id:'specialty',   label:'Specialty' },
];

/* ============================================================
   CATEGORY TEMPLATES — defaults per category. Specific service overrides come below.
   ============================================================ */
const CAT_DEFAULTS = {
  hvac: {
    atlas: { label:'Home footprint', value:'2,184 sq ft', detail:'2-story · 4 bed' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'17%', y:'72%', label:'Outdoor unit · 3-ton' },
      { x:'48%', y:'20%', label:'Air handler · attic' },
      { x:'56%', y:'52%', label:'Returns · 2' },
      { x:'80%', y:'62%', label:'Thermostat · Nest' },
    ],
    fields: [
      { id:'tonnage',  name:'System tonnage', kind:'number' },
      { id:'seer',     name:'SEER rating',    kind:'select' },
      { id:'duct',     name:'Ductwork',       kind:'toggle' },
      { id:'install',  name:'Install type',   kind:'select' },
      { id:'permit',   name:'Permit req',     kind:'toggle' },
      { id:'finance',  name:'Financing',      kind:'select' },
    ],
    lines: [
      ['Carrier 3-ton condenser', '$3,200'],
      ['Air handler + coil',      '$1,840'],
      ['Refrigerant lineset',     '$420'],
      ['Ductwork modifications',  '$680'],
      ['Labor · 2-man crew · 1d', '$1,400'],
      ['Permit + inspection',     '$285'],
    ],
    subtotal: 7825, tax: 645, total: 8470, deposit: 2118,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Dan — saw the form. AC blowing warm since Saturday? That whole week has been brutal, I bet you're cooked." },
      { who:'them', text:"Yeah we slept downstairs last two nights. Kids are wrecked." },
      { who:'bot',  text:"Yeah no thanks, I'd be losing it too. System looks 18ish from the photo — R-22 era. Honestly at that age it's almost always cheaper to replace than chase another leak. Want me to send a tech today to scope it both ways?" },
      { who:'them', text:"Replace if it's anywhere close, I'm done with band-aids. We've got a HELOC if it matters." },
      { who:'bot',  text:"Smart. We can do a 16-SEER variable-speed for 8–12 depending on duct condition — financing is 0% for 60 months too if HELOC is annoying. You + your wife both deciding or are you good to greenlight?" },
      { who:'them', text:"We're both signers but she trusts me on this stuff. Just want it cold by Friday." },
      { who:'bot',  text:"Friday is doable. Crew can do install Thursday if quote lands tomorrow morning. Ok if I have Marcus there at 4 today?" },
      { who:'them', text:"Yes please. Code is 4429." },
    ],
    qualifyChecks: [
      ['Budget','$8–12k',4],['Timeline','This week',6],['Decider','Confirmed',8],['Financing','HELOC',4]
    ],
  },
  plumbing: {
    atlas: { label:'Plumbing layout', value:'5 fixtures', detail:'2 baths · kitchen' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'20%', y:'62%', label:'Water heater · 50gal' },
      { x:'80%', y:'62%', label:'Main shutoff' },
      { x:'48%', y:'78%', label:'Slab leak · suspected' },
      { x:'55%', y:'45%', label:'PEX retrofit · ok' },
    ],
    fields: [
      { id:'fixtures', name:'Fixtures', kind:'number' },
      { id:'material', name:'Pipe material', kind:'select' },
      { id:'access',   name:'Access', kind:'select' },
      { id:'permit',   name:'Permit req', kind:'toggle' },
      { id:'tier',     name:'Tier', kind:'select' },
    ],
    lines: [
      ['Water heater · 50gal',     '$1,240'],
      ['Expansion tank + valves',  '$220'],
      ['Repipe section · PEX',     '$780'],
      ['Labor · master + helper',  '$1,150'],
      ['Permit + haul-off',        '$185'],
    ],
    subtotal: 3575, tax: 295, total: 3870, deposit: 967,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Sarah — leak under the kitchen sink? Caught your message at 11pm. Anyone in danger right now or is it just messy?" },
      { who:'them', text:"Just messy. We shut the main off but the basement ceiling is bowing." },
      { who:'bot',  text:"Ok good call on the main. Bowing ceiling usually means water sat for a while — you're going to want to call your insurance carrier in the morning too. Who do you have?" },
      { who:'them', text:"State Farm. Should I file now or wait till you're out?" },
      { who:'bot',  text:"File now. Photos of the bowed area + the source. We can be your contractor of record and handle the adjuster ourselves — makes it way smoother. Tech can be there at 7am, sound ok?" },
      { who:'them', text:"7 is good. We'll be up. Probably need a repipe section too, the original galv is 60 years old." },
      { who:'bot',  text:"Sounds right. We'll PEX that section while we're in the wall, save you a second trip. You renting or own?" },
      { who:'them', text:"Own. Just me on the title." },
    ],
    qualifyChecks: [
      ['Urgency','Same-day',4],['Scope','Repipe + WH',6],['Insurance','Filing',8],['Decider','Confirmed',4]
    ],
  },
  electrical: {
    atlas: { label:'Service panel', value:'200A', detail:'Single-phase · main' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'82%', y:'58%', label:'Panel · Square D' },
      { x:'20%', y:'55%', label:'Sub-panel · garage' },
      { x:'52%', y:'45%', label:'Open neutrals · 3' },
      { x:'18%', y:'72%', label:'EV stub · 240v' },
    ],
    fields: [
      { id:'amps',     name:'Panel amperage', kind:'select' },
      { id:'circuits', name:'Circuits',       kind:'number' },
      { id:'permit',   name:'Permit req',     kind:'toggle' },
      { id:'mast',     name:'Service mast',   kind:'toggle' },
      { id:'tier',     name:'Tier',           kind:'select' },
    ],
    lines: [
      ['200A panel + meter',       '$1,460'],
      ['Service drop coordination','$420'],
      ['Branch circuit rework',    '$880'],
      ['Labor · journeyman · 1d',  '$1,180'],
      ['Permit + utility fees',    '$320'],
    ],
    subtotal: 4260, tax: 350, total: 4610, deposit: 1153,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Jess — breakers tripping when you run the dryer? Annoying. How often does it pop, like every load or only sometimes?" },
      { who:'them', text:"Every load if AC is running. Pretty much done with it." },
      { who:'bot',  text:"Yeah you're overloading a circuit. House is from the 70s I bet. Couple options here — we can split the dryer onto its own 30A or just upgrade the panel to 200A while we're in there. The panel is the real fix." },
      { who:'them', text:"We're also getting an EV next month so honestly upgrade probably makes more sense." },
      { who:'bot',  text:"Ok now we're talking. 200A + EV stub = around 4–5k all-in with permit. Are you Mariana the homeowner or is there someone else on title?" },
      { who:'them', text:"Just us. We bought last year. Timing is open, we just want it done right." },
      { who:'bot',  text:"Love that. Mike can swing by Tuesday morning for a panel + run estimate. We'll handle the permit + utility coord. Cool?" },
      { who:'them', text:"Cool. 9am works." },
    ],
    qualifyChecks: [
      ['Load type','EV + appliances',4],['Budget','Open',6],['Permit','Required',8],['Decider','Couple',4]
    ],
  },
  roofing: {
    atlas: { label:'Roof', value:'2,418 sq ft', detail:'6/12 pitch · 2 layers' },
    arBg: 'roof-closeup',
    satBg: 'roof',
    arTags: [
      { x:'50%', y:'18%', label:'Ridge · 38 lf' },
      { x:'22%', y:'48%', label:'Valley · 22 lf' },
      { x:'72%', y:'40%', label:'Vent stack · 3' },
      { x:'58%', y:'68%', label:'Skylight · 1' },
    ],
    fields: [
      { id:'pitch',    name:'Roof pitch',     kind:'select' },
      { id:'sqft',     name:'Square footage', kind:'number' },
      { id:'material', name:'Shingle line',   kind:'select' },
      { id:'layers',   name:'Tear-off layers',kind:'number' },
      { id:'decking',  name:'Decking repair', kind:'toggle' },
      { id:'tier',     name:'Tier',           kind:'select' },
    ],
    lines: [
      ['Tear-off (2 layers)',     '$2,800'],
      ['GAF Timberline HDZ',      '$5,940'],
      ['Underlayment + ice',      '$1,180'],
      ['Decking repair (est)',    '$640'],
      ['Labor · 3-man crew',      '$4,100'],
      ['Permit + dump',           '$485'],
    ],
    subtotal: 15145, tax: 1250, total: 16395, deposit: 4099,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Mike — got your photos. That bedroom ceiling looks rough. Tuesday's storm caught a lot of folks 😕 you good for now or do we need to tarp tonight?" },
      { who:'them', text:"Tarped it ourselves but it's already leaking again. Wife's pretty rattled." },
      { who:'bot',  text:"Yeah, it'll get worse before the front passes. We can have a crew there by 6 to do a real tarp — no charge, on us. Who's on title?" },
      { who:'them', text:"Both of us. Insurance is State Farm." },
      { who:'bot',  text:"Perfect, we work with State Farm constantly. I'll prep the supplement so the adjuster doesn't lowball — they've been doing that since the April storms. Timeline?" },
      { who:'them', text:"ASAP. Kids' room is right under the leak." },
      { who:'bot',  text:"Got it. Real tarp tonight, full quote tomorrow, install start of next week if you greenlight. Sound good?" },
      { who:'them', text:"Yes please. Thank you." },
    ],
    qualifyChecks: [
      ['Cause','Storm',4],['Insurance','State Farm',6],['Timeline','ASAP',8],['Decider','Confirmed',4]
    ],
  },
  solar: {
    atlas: { label:'Roof solar zone', value:'820 sq ft usable', detail:'South-facing · 18° tilt' },
    arBg: 'roof-closeup',
    satBg: 'roof',
    arTags: [
      { x:'50%', y:'28%', label:'24 panel layout' },
      { x:'22%', y:'52%', label:'Inverter · garage' },
      { x:'78%', y:'40%', label:'Service panel · 200A' },
      { x:'52%', y:'68%', label:'Battery · 13.5 kWh' },
    ],
    fields: [
      { id:'panels',  name:'Panel count',    kind:'number' },
      { id:'tilt',    name:'Roof tilt',      kind:'select' },
      { id:'battery', name:'Battery',        kind:'toggle' },
      { id:'inv',     name:'Inverter type',  kind:'select' },
      { id:'permit',  name:'Permit + AHJ',   kind:'toggle' },
      { id:'finance', name:'Financing',      kind:'select' },
    ],
    lines: [
      ['24 × 400W panels',         '$8,400'],
      ['Enphase microinverters',   '$3,840'],
      ['Powerwall 3 · 13.5 kWh',   '$11,500'],
      ['Racking + balance',        '$1,640'],
      ['Labor · 4-man · 2d',       '$4,800'],
      ['Permit + interconnect',    '$1,200'],
    ],
    subtotal: 31380, tax: 0, total: 31380, deposit: 7845,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Tom — looked at your roof from satellite, you've got a nice south-facing slope. What's pushing solar — the bill, outages, or both?" },
      { who:'them', text:"Honestly both. Got hit with $480 last month and we lost power three times during ice season." },
      { who:'bot',  text:"Yeah Texas grid is a coin flip these days. With battery you'd ride those out no problem. Roof age?" },
      { who:'them', text:"Replaced 3 years ago. Architectural shingles." },
      { who:'bot',  text:"Perfect, no re-roof penalty. I'm looking at 24 panels + a Powerwall 3 for you, comes out around 31k before the 30% fed credit so ~22 net. Financing or cash?" },
      { who:'them', text:"Probably the 7-yr loan. What's the wait time?" },
      { who:'bot',  text:"AHJ here is averaging 18 days on permits, install day is a day, interconnect another 2 weeks. So 6 weeks start to finish if we book Friday. Want me to pencil that in?" },
      { who:'them', text:"Yes, let's lock it." },
    ],
    qualifyChecks: [
      ['Motivation','Bills + outage',4],['Roof','New',6],['Battery','Yes',8],['Financing','Loan',4]
    ],
  },
  outdoor: {
    atlas: { label:'Yard footprint', value:'8,640 sq ft', detail:'Front + back · sloped' },
    arBg: 'yard',
    satBg: 'yard',
    arTags: [
      { x:'25%', y:'38%', label:'Zone 1 · turf' },
      { x:'70%', y:'35%', label:'Zone 2 · beds' },
      { x:'45%', y:'62%', label:'Slope · drainage' },
      { x:'78%', y:'68%', label:'Hose bib · 60 psi' },
    ],
    fields: [
      { id:'zones',   name:'Zones',         kind:'number' },
      { id:'sqft',    name:'Area · sq ft',  kind:'number' },
      { id:'soil',    name:'Soil type',     kind:'select' },
      { id:'access',  name:'Access',        kind:'select' },
      { id:'tier',    name:'Tier',          kind:'select' },
    ],
    lines: [
      ['Zone valves · 6',          '$840'],
      ['Drip + spray heads',       '$620'],
      ['Trenching + sleeving',     '$980'],
      ['Smart controller',         '$240'],
      ['Labor · 2-man · 2d',       '$1,640'],
    ],
    subtotal: 4320, tax: 0, total: 4320, deposit: 1080,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Pat — saw half your zones are dead, that's annoying right at the start of the season. How old is the existing system?" },
      { who:'them', text:"Original to the house, so 2003. Heads are sun-baked, controller is shot." },
      { who:'bot',  text:"Yeah at that age it's basically a full retrofit. Good news is we can re-use the trenching since the main lines are still ok. You looking for smart control too — Rachio or Hydrawise?" },
      { who:'them', text:"Rachio. My neighbor has one and I'm jealous." },
      { who:'bot',  text:"😂 fair. We'll spec a Rachio 12-zone with weather skip. Need it done before summer kicks in? July is when our calendar gets ugly." },
      { who:'them', text:"Yeah, before Memorial Day if possible. Lawn is already stressing." },
      { who:'bot',  text:"Doable. Carlos can walk it Wednesday morning, you'd have a quote in your inbox by lunch. Cool?" },
      { who:'them', text:"Cool. I'll be home Wed." },
    ],
    qualifyChecks: [
      ['Type','Retrofit',4],['Smart','Rachio',6],['Yard','~0.2 ac',8],['Timeline','Spring',4]
    ],
  },
  landscape: {
    atlas: { label:'Landscape area', value:'12,400 sq ft', detail:'Front + back · fenced' },
    arBg: 'yard',
    satBg: 'yard',
    arTags: [
      { x:'24%', y:'58%', label:'Turf · 4,200 sf' },
      { x:'70%', y:'52%', label:'Bed · 320 sf' },
      { x:'26%', y:'26%', label:'Tree · oak 28"' },
      { x:'58%', y:'72%', label:'Path · flagstone' },
    ],
    fields: [
      { id:'sqft',    name:'Yard · sq ft',   kind:'number' },
      { id:'mow',     name:'Mow frequency',  kind:'select' },
      { id:'beds',    name:'Beds',           kind:'number' },
      { id:'fert',    name:'Fertilization',  kind:'toggle' },
      { id:'plan',    name:'Service tier',   kind:'select' },
    ],
    lines: [
      ['Weekly mow + edge',        '$220 / visit'],
      ['Bed maintenance',          '$140 / visit'],
      ['Spring fert program',      '$380'],
      ['Aerate + overseed',        '$540'],
      ['Pre-emergent · 2 apps',    '$220'],
    ],
    subtotal: 1500, tax: 0, total: 1500, deposit: 375,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Maya — looking at your aerial, that's a solid lot. Are you looking for ongoing mow/maintenance or a one-time clean-up?" },
      { who:'them', text:"Both honestly. It's been neglected since we moved in last year, then weekly after." },
      { who:'bot',  text:"Got it. We'll do a deep cut + bed reset day 1, then keep it on a weekly cadence. Pets? Anything we should know about — fence gates, kid stuff?" },
      { who:'them', text:"Two dogs, but we'll bring them in. Side gate has a sticky latch." },
      { who:'bot',  text:"Noted. We bag waste on first visit. Are you interested in the fert program too? Lawn is going to fight us if we don't feed it." },
      { who:'them', text:"Yeah include that. Want it to actually look good." },
      { who:'bot',  text:"Perfect. Day-1 starts at $540, weekly is $220. I'll send the agreement so you can sign from your phone — ok if we start Tuesday?" },
      { who:'them', text:"Tuesday works." },
    ],
    qualifyChecks: [
      ['Cadence','Weekly',4],['Area','12k sf',6],['Pets','Yes',8],['Add-ons','Fert',4]
    ],
  },
  tree: {
    atlas: { label:'Tree count', value:'4 trees', detail:'2 oak · 1 maple · 1 pine' },
    arBg: 'yard',
    satBg: 'yard',
    arTags: [
      { x:'28%', y:'22%', label:'Oak · 38" · over roof' },
      { x:'72%', y:'24%', label:'Maple · 22" · clear' },
      { x:'45%', y:'72%', label:'Stump · pine · 18"' },
      { x:'75%', y:'68%', label:'Access · driveway' },
    ],
    fields: [
      { id:'count',  name:'Tree count',    kind:'number' },
      { id:'height', name:'Tallest · ft',  kind:'number' },
      { id:'access', name:'Crane access',  kind:'select' },
      { id:'stump',  name:'Stump removal', kind:'toggle' },
      { id:'haul',   name:'Haul-off',      kind:'toggle' },
    ],
    lines: [
      ['Oak removal · 38" dbh',    '$2,400'],
      ['Maple trim · 22" crown',   '$680'],
      ['Stump grind · 18"',        '$240'],
      ['Crane day rate',           '$1,800'],
      ['Haul + chip',              '$420'],
    ],
    subtotal: 5540, tax: 0, total: 5540, deposit: 1385,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Greg — 38\" oak leaning over the house? That's the kind of call we don't put off. Any active damage or just preventive?" },
      { who:'them', text:"Preventive. Last storm cracked a big limb but it didn't drop. Roof is fine for now." },
      { who:'bot',  text:"Yeah, you got lucky. We'll need a crane on this one — 38\" trunk leaning is a controlled drop only. Driveway has a clear shot?" },
      { who:'them', text:"Yes, no overhead lines on that side. Neighbors are aware." },
      { who:'bot',  text:"Great. Crane day is $1800, removal $2400, stump grind $240 — about $4,600 plus haul. Insurance involved or out of pocket?" },
      { who:'them', text:"Out of pocket. Just want it done before the next storm." },
      { who:'bot',  text:"Smart. Forecast is dry til Thursday — we can be in and out Wednesday in one day. Lock it in?" },
      { who:'them', text:"Lock it in. 50% deposit ok?" },
    ],
    qualifyChecks: [
      ['Scope','Removal',4],['Size','60 ft / 38"',6],['Access','Crane',8],['Pay','Cash',4]
    ],
  },
  pool: {
    atlas: { label:'Pool footprint', value:'18 × 36 ft', detail:'In-ground · gunite' },
    arBg: 'pool',
    satBg: 'pool',
    arTags: [
      { x:'50%', y:'52%', label:'Pool · 28,000 gal' },
      { x:'20%', y:'40%', label:'Pump · single-speed' },
      { x:'80%', y:'40%', label:'Heater · gas · old' },
      { x:'50%', y:'82%', label:'Deck · flagstone' },
    ],
    fields: [
      { id:'gal',    name:'Gallons',        kind:'number' },
      { id:'shape',  name:'Shape',          kind:'select' },
      { id:'equip',  name:'Equipment pkg',  kind:'select' },
      { id:'auto',   name:'Auto-cleaner',   kind:'toggle' },
      { id:'tier',   name:'Service tier',   kind:'select' },
    ],
    lines: [
      ['Weekly chemistry + skim',  '$180 / visit'],
      ['Equipment rebuild',        '$1,420'],
      ['Variable-speed pump',      '$1,640'],
      ['Heater · 400k BTU',        '$3,200'],
      ['Labor · install · 1d',     '$840'],
    ],
    subtotal: 7280, tax: 0, total: 7280, deposit: 1820,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Alex — pump died mid-season, that's painful. How old is the equipment pad overall?" },
      { who:'them', text:"Pad is from 2012. Pump went last week, heater was already on its last leg honestly." },
      { who:'bot',  text:"Yeah you don't want to limp the heater through another season. Quick math: variable-speed pump qualifies for the energy rebate here, save you ~$300. Want me to file that for you or do you have a guy?" },
      { who:'them', text:"File it. I don't even know who to send it to." },
      { who:'bot',  text:"Easy. We bundle pump + heater install + paperwork — $7,200ish all-in, rebate hits your check ~6 weeks. Are you also wanting to add automation, or just like-for-like?" },
      { who:'them', text:"Throw in automation. My phone runs everything else, may as well." },
      { who:'bot',  text:"Love it. Pentair has a $480 IntelliCenter that pairs with the new pump. Available Saturday for install day?" },
      { who:'them', text:"Saturday is great." },
    ],
    qualifyChecks: [
      ['Scope','Install + service',4],['Size','28k gal',6],['Rebate','VS pump',8],['Decider','Confirmed',4]
    ],
  },
  pest: {
    atlas: { label:'Treatment perimeter', value:'182 lf', detail:'House + outbuilding' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'30%', y:'25%', label:'Entry · soffit' },
      { x:'18%', y:'75%', label:'Sub-area access' },
      { x:'78%', y:'72%', label:'Termite tubes · 2' },
      { x:'52%', y:'80%', label:'Bait stations · 4' },
    ],
    fields: [
      { id:'type',     name:'Pest type',     kind:'select' },
      { id:'perim',    name:'Perimeter · lf', kind:'number' },
      { id:'rooms',    name:'Rooms · interior', kind:'number' },
      { id:'cadence',  name:'Cadence',       kind:'select' },
      { id:'warranty', name:'Warranty',      kind:'toggle' },
    ],
    lines: [
      ['Initial perimeter treatment','$380'],
      ['Bait stations × 6',         '$240'],
      ['Sub-area dust',             '$180'],
      ['Quarterly service',         '$120 / visit'],
      ['Warranty · 12 mo',          '$140'],
    ],
    subtotal: 1060, tax: 0, total: 1060, deposit: 265,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Sam — ants in the kitchen + a roach last week, yeah that's not just a one-off. House age?" },
      { who:'them', text:"1962. Crawl space, not slab. The previous owners said pest was 'never an issue' 🙄" },
      { who:'bot',  text:"Classic. Crawl is usually where the party starts — we'll need sub-area access. We do a perimeter + interior treatment plus 6 bait stations, $380 first visit, then $120 quarterly to keep them gone." },
      { who:'them', text:"Quarterly is fine. Kids and dog though — are the products safe?" },
      { who:'bot',  text:"All EPA-approved for pets. We let it dry 2 hours before re-entry, that's it. Want the 12-mo warranty? We re-treat free if anything comes back." },
      { who:'them', text:"Yes please. When can you come out?" },
      { who:'bot',  text:"Friday afternoon work? Carlos can be there 1–3. We'll text you a 30-min window day-of." },
      { who:'them', text:"1–3 Friday works." },
    ],
    qualifyChecks: [
      ['Pest','Ants + roach',4],['Property','1962 crawl',6],['Cadence','Quarterly',8],['Decider','Confirmed',4]
    ],
  },
  cleaning: {
    atlas: { label:'Cleanable area', value:'2,400 sq ft', detail:'3 bed · 2.5 bath' },
    arBg: 'kitchen',
    satBg: 'house',
    arTags: [
      { x:'35%', y:'30%', label:'Kitchen · deep' },
      { x:'72%', y:'30%', label:'Bath × 2.5' },
      { x:'40%', y:'72%', label:'Floors · 1,640 sf' },
      { x:'72%', y:'70%', label:'Windows · 18 ext' },
    ],
    fields: [
      { id:'sqft',    name:'Sq ft',         kind:'number' },
      { id:'bed',     name:'Bedrooms',      kind:'number' },
      { id:'bath',    name:'Bathrooms',     kind:'number' },
      { id:'tier',    name:'Tier',          kind:'select' },
      { id:'cad',     name:'Cadence',       kind:'select' },
    ],
    lines: [
      ['Initial deep clean',       '$420'],
      ['Inside windows · 18',      '$180'],
      ['Appliance interior',       '$120'],
      ['Bi-weekly maintenance',    '$220 / visit'],
      ['Supplies + travel',        '$45'],
    ],
    subtotal: 985, tax: 0, total: 985, deposit: 246,
    measureMode: 'records',
    qualifyChat: [
      { who:'bot',  text:"Hey Lila — thanks for the request. 2,400 sf with a 1-year-old and a goldendoodle, am I reading that right? 😂" },
      { who:'them', text:"😂 yes. The dog sheds enough for two more dogs. Bi-weekly please, I can't keep up." },
      { who:'bot',  text:"Trust me, we know that life. We'd want to do an initial deep clean first — $420 — then $220 bi-weekly to maintain. Any eco/scent sensitivities since baby is around?" },
      { who:'them', text:"Yes — fragrance-free if possible. Hardwood + tile floors, no carpet." },
      { who:'bot',  text:"All Method/Ecover, no perfumes. Easy. Same crew every visit so they learn your house. You want windows inside the first time too? $180 add-on for 18." },
      { who:'them', text:"Add the windows. Also can you do the inside of the oven once?" },
      { who:'bot',  text:"Of course — oven interior is $120. So $720 first visit, $220 ongoing. Thursday 9am ok for the first one?" },
      { who:'them', text:"Thursday is great." },
    ],
    qualifyChecks: [
      ['Cadence','Bi-weekly',4],['Size','2,400 sf',6],['Pets','Yes',8],['Products','Eco',4]
    ],
  },
  exterior: {
    atlas: { label:'Exterior wall area', value:'1,840 sq ft', detail:'4 elevations · 2-story' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'45%', y:'45%', label:'Front · 480 sf' },
      { x:'18%', y:'30%', label:'Trim · 220 lf' },
      { x:'78%', y:'18%', label:'Rot · soffit NE' },
      { x:'58%', y:'62%', label:'Shutters · 8' },
    ],
    fields: [
      { id:'sqft',    name:'Wall · sq ft',  kind:'number' },
      { id:'mat',     name:'Material',       kind:'select' },
      { id:'prep',    name:'Prep level',     kind:'select' },
      { id:'tier',    name:'Tier',           kind:'select' },
      { id:'warranty',name:'Warranty',       kind:'select' },
    ],
    lines: [
      ['Pressure wash + prep',     '$640'],
      ['Caulk + minor repair',     '$420'],
      ['Sherwin Williams · 2 coat','$2,840'],
      ['Trim + shutters',          '$680'],
      ['Labor · 3-man · 3d',       '$3,600'],
    ],
    subtotal: 8180, tax: 670, total: 8850, deposit: 2212,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Brian — 12 years since last paint? Yeah, your trim is going to be the bigger job than the field. Any rot or soft spots you've spotted?" },
      { who:'them', text:"Soffit on the north side is bad. Rest looks ok from the ground." },
      { who:'bot',  text:"That's what we'd guess. We'll bid soffit repair as a line so it's broken out. Are you going dark or staying light? Selling or staying?" },
      { who:'them', text:"Selling in May. Realtor said Tricorn Black with Greek Villa trim. Trying to make it pop in listings." },
      { who:'bot',  text:"Smart move — those two are everywhere right now and they actually photograph great. SW Emerald in satin, 2 coats, $8,800ish. Want me to throw in shutters too while we're up there?" },
      { who:'them', text:"Yes do the shutters. 8 of them." },
      { who:'bot',  text:"Got it. Crew is 3 days, pressure wash day 1. Can we start the week of the 12th to hit your listing date?" },
      { who:'them', text:"12th works perfectly." },
    ],
    qualifyChecks: [
      ['Scope','Full exterior',4],['Repair','Soffit',6],['Timeline','Before May',8],['Color','Picked',4]
    ],
  },
  remodel: {
    atlas: { label:'Project footprint', value:'186 sq ft', detail:'Kitchen · L-shape' },
    arBg: 'kitchen',
    satBg: 'house',
    arTags: [
      { x:'30%', y:'40%', label:'Cabinets · 18 boxes' },
      { x:'62%', y:'55%', label:'Counter · 64 sf' },
      { x:'30%', y:'72%', label:'Plumbing · re-route' },
      { x:'68%', y:'30%', label:'Backsplash · 38 sf' },
    ],
    fields: [
      { id:'scope',   name:'Scope',         kind:'select' },
      { id:'sqft',    name:'Sq ft',         kind:'number' },
      { id:'cab',     name:'Cabinets',      kind:'select' },
      { id:'tops',    name:'Countertop',    kind:'select' },
      { id:'permit',  name:'Permit req',    kind:'toggle' },
      { id:'tier',    name:'Tier',          kind:'select' },
    ],
    lines: [
      ['Demo + haul',              '$1,840'],
      ['Cabinets · Shaker maple',  '$11,400'],
      ['Quartz counters · 64 sf',  '$5,120'],
      ['Tile backsplash',          '$1,840'],
      ['Plumbing + electrical',    '$3,200'],
      ['Labor · GC + crew',        '$8,400'],
    ],
    subtotal: 31800, tax: 2625, total: 34425, deposit: 8606,
    measureMode: 'records',
    qualifyChat: [
      { who:'bot',  text:"Hey Nora — kitchen remodel, full gut. Pulled the floor plan from county records, looks like a 14\u00d716 L-shape. Are you opening anything up to the dining room?" },
      { who:'them', text:"Yes — the half-wall has to go. Want a real island and we hate the cramped feel." },
      { who:'bot',  text:"Good news, the half-wall is non-load-bearing per the original permit. So no header, just demo. That saves you about $3k right there." },
      { who:'them', text:"Oh wow ok. What's a realistic budget? We're targeting 30–45k." },
      { who:'bot',  text:"Doable. Shaker cabinets + quartz + tile backsplash + new plumbing/electrical lands around $34k turnkey. If you go semi-custom cabinets it can push to $42. What's driving the budget, ROI or just done with it?" },
      { who:'them', text:"Selling in 18 months. Want to enjoy it first, then have it boost the sale." },
      { who:'bot',  text:"Got it — we'll spec for resale neutral on finishes. 6 weeks from contract to done. Can we walk it Saturday?" },
      { who:'them', text:"Sat morning works." },
    ],
    qualifyChecks: [
      ['Scope','Full gut',4],['Walls','Removing 1',6],['Budget','$30–45k',8],['Timeline','6 wk',4]
    ],
  },
  masonry: {
    atlas: { label:'Concrete area', value:'620 sq ft', detail:'Driveway + walkway' },
    arBg: 'driveway',
    satBg: 'driveway',
    arTags: [
      { x:'50%', y:'48%', label:'Driveway · 480 sf' },
      { x:'25%', y:'72%', label:'Walkway · 140 sf' },
      { x:'72%', y:'62%', label:'Slope · drainage' },
      { x:'50%', y:'80%', label:'Apron · expand' },
    ],
    fields: [
      { id:'sqft',    name:'Sq ft',         kind:'number' },
      { id:'thick',   name:'Thickness · in',kind:'number' },
      { id:'mix',     name:'Mix · psi',     kind:'select' },
      { id:'finish',  name:'Finish',        kind:'select' },
      { id:'rebar',   name:'Rebar',         kind:'toggle' },
    ],
    lines: [
      ['Demo + dispose',           '$1,640'],
      ['Form + grade',             '$1,180'],
      ['Concrete · 620 sf · 4"',   '$3,840'],
      ['Rebar + control joints',   '$520'],
      ['Labor · 3-man · 2d',       '$2,400'],
    ],
    subtotal: 9580, tax: 0, total: 9580, deposit: 2395,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Carlos — driveway looks rough from the aerial, lots of spider cracking. Settling or just age?" },
      { who:'them', text:"Original 1989 pour. We had a leak under the slab last year, dug it up, never fully patched right." },
      { who:'bot',  text:"Yeah a patch over a sub-grade issue never holds. We'd want to tear out + repour the whole 620sf with proper compaction. Stamped or just broom finish?" },
      { who:'them', text:"Broom. Don't want anything fancy." },
      { who:'bot',  text:"Smart, broom holds up. 4-inch slab, fiber + rebar, $9,580. Adding the apron is another $1,200 if you want to widen for the second car — your aerial shows you've grown out of it." },
      { who:'them', text:"Add the apron. Wife's been asking." },
      { who:'bot',  text:"Hah. Weather window opens next week — we'd pour Wed, cure 7 days, drive on it the 14th. Sound right?" },
      { who:'them', text:"Let's do it." },
    ],
    qualifyChecks: [
      ['Scope','Tear + pour',4],['Size','620 sf',6],['Finish','Broom',8],['Timeline','Spring',4]
    ],
  },
  handyman: {
    atlas: { label:'Task list', value:'8 tasks', detail:'1 visit · half day' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'72%', y:'32%', label:'Shelves · 4' },
      { x:'52%', y:'42%', label:'TV mount · 65"' },
      { x:'28%', y:'52%', label:'Door · sticking' },
      { x:'30%', y:'72%', label:'Toilet · running' },
    ],
    fields: [
      { id:'tasks',   name:'Task count',    kind:'number' },
      { id:'hours',   name:'Est hours',     kind:'number' },
      { id:'matl',    name:'Materials',     kind:'toggle' },
      { id:'rate',    name:'Rate · hr',     kind:'select' },
      { id:'visit',   name:'Visit count',   kind:'number' },
    ],
    lines: [
      ['Mount TV + cable mgmt',    '$140'],
      ['Install 4 shelves',        '$220'],
      ['Door planing + strike',    '$80'],
      ['Toilet fill valve',        '$110'],
      ['Trip + materials',         '$65'],
    ],
    subtotal: 615, tax: 0, total: 615, deposit: 154,
    measureMode: 'photos',
    qualifyChat: [
      { who:'bot',  text:"Hey Joel — got your photos and the list. 8 tasks, looks like one solid half-day. Any of these need permits or am I free to send a tech?" },
      { who:'them', text:"None of them. TV mount, 4 shelves, sticky door, running toilet, leaky faucet, ceiling fan swap, gate latch, light fixture." },
      { who:'bot',  text:"Sweet, all bread and butter. Hourly is $95 with a 2hr min, but this list is more value as a flat $615. Materials on us up to $50, anything past that I'll text for approval." },
      { who:'them', text:"That works. Last guy nickel-and-dimed us, hated it." },
      { who:'bot',  text:"Won't do that. We hate it too. Drew is solid — 25 yrs in the trade, brings his own bits. He'll be at your place Friday 9am, done by 1." },
      { who:'them', text:"Wife's home Friday so that's perfect. Any pre-work I need to do?" },
      { who:'bot',  text:"Just pull the new fixtures out of boxes if you have them, otherwise Drew brings standard hardware. Should we Venmo or card on file?" },
      { who:'them', text:"Card on file. Pay when done." },
    ],
    qualifyChecks: [
      ['Tasks','8',4],['Permit','None',6],['Specialty','Toilet',8],['Day','Fri',4]
    ],
  },
  security: {
    atlas: { label:'Coverage area', value:'12 zones', detail:'House + perimeter' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'18%', y:'22%', label:'Front cam · 4K' },
      { x:'58%', y:'45%', label:'NVR · closet' },
      { x:'50%', y:'62%', label:'Doorbell · wired' },
      { x:'78%', y:'30%', label:'Sensors · 8' },
    ],
    fields: [
      { id:'cams',    name:'Cameras',        kind:'number' },
      { id:'sensors', name:'Door/window',    kind:'number' },
      { id:'nvr',     name:'NVR storage',    kind:'select' },
      { id:'mon',     name:'Monitoring',     kind:'toggle' },
      { id:'integrate',name:'Smart hub',     kind:'select' },
    ],
    lines: [
      ['4K cameras × 6',           '$2,400'],
      ['Network video recorder',   '$680'],
      ['Doorbell + chime',         '$320'],
      ['Sensors × 8 + hub',        '$640'],
      ['Labor · install · 1d',     '$1,180'],
      ['Monitoring · 12 mo',       '$420'],
    ],
    subtotal: 5640, tax: 465, total: 6105, deposit: 1526,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey Tara — just closed on the place, congrats! Adding security from scratch?" },
      { who:'them', text:"Yeah, prior owner had nothing. We've got a 3-yr-old and want peace of mind." },
      { who:'bot',  text:"Smart. We'd do 6 cameras + perimeter sensors + a doorbell, $5,640. The whole system runs through one app. Do you want it pairing with HomeKit, Google, or Alexa?" },
      { who:'them', text:"Apple Home please. Everything else in the house is Apple." },
      { who:'bot',  text:"Easy — we'll spec HomeKit-secure cams. Monitoring is $35/mo if you want 24/7, or you can self-monitor for free. Are you closing soon or already in?" },
      { who:'them', text:"Move in next Friday." },
      { who:'bot',  text:"Perfect. We can install Saturday after move-in so we don't trip over boxes. Sound good?" },
      { who:'them', text:"Yes — Saturday locked." },
    ],
    qualifyChecks: [
      ['Scope','Full alarm',4],['Cameras','6',6],['Hub','Apple',8],['Timeline','2 wk',4]
    ],
  },
  restoration: {
    atlas: { label:'Affected area', value:'480 sq ft', detail:'Cat 3 · gray water' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'52%', y:'45%', label:'Source · supply line' },
      { x:'30%', y:'58%', label:'Drywall · 380 sf' },
      { x:'52%', y:'78%', label:'Subfloor · saturated' },
      { x:'78%', y:'58%', label:'Mold · suspected' },
    ],
    fields: [
      { id:'cat',     name:'Water category', kind:'select' },
      { id:'sqft',    name:'Affected sf',    kind:'number' },
      { id:'rooms',   name:'Rooms',          kind:'number' },
      { id:'mold',    name:'Mold testing',   kind:'toggle' },
      { id:'tier',    name:'Insurance tier', kind:'select' },
    ],
    lines: [
      ['Emergency extract + dry',  '$1,840'],
      ['Drywall remove · 380 sf',  '$1,420'],
      ['Containment + HEPA',       '$680'],
      ['Antimicrobial treatment',  '$520'],
      ['Labor · 24/7 monitoring',  '$2,800'],
      ['Mold testing + report',    '$420'],
    ],
    subtotal: 7680, tax: 0, total: 7680, deposit: 0,
    measureMode: 'claim',
    qualifyChat: [
      { who:'bot',  text:"Hey Rachel — supply line under the kitchen, sounds like a long night. Is the water off and is anyone safe?" },
      { who:'them', text:"Water's off. We're staying with my mom tonight. Kid has asthma so we don't want to sleep in it." },
      { who:'bot',  text:"100% the right call. Mold is the real worry with asthma in the picture. We're certified for IICRC restoration so we'll do containment + HEPA filtration from the jump. Insurance carrier?" },
      { who:'them', text:"State Farm. Already called them, claim is open." },
      { who:'bot',  text:"Good — we work direct with State Farm, we'll bill them so you don't have to chase reimbursement. Our crew can be there in 90 min to start extraction. Sound ok?" },
      { who:'them', text:"Yes please. Anything I need to do first?" },
      { who:'bot',  text:"Just send me a photo of the source area and the worst-affected room. We'll bring everything else. You signing as the homeowner or is your husband decision-maker too?" },
      { who:'them', text:"Both of us. I'll loop him in on text." },
    ],
    qualifyChecks: [
      ['Cause','Supply line',4],['Insurance','State Farm',6],['Filed','Yes',8],['Sensitive','Asthma',4]
    ],
  },
  inspect: {
    atlas: { label:'Inspection scope', value:'2,400 sq ft', detail:'4 bed · 2-story' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'50%', y:'18%', label:'Roof · age 12' },
      { x:'18%', y:'72%', label:'HVAC · 18 yr' },
      { x:'50%', y:'82%', label:'Foundation · settle' },
      { x:'80%', y:'62%', label:'Electrical · 100A' },
    ],
    fields: [
      { id:'sqft',    name:'Sq ft',         kind:'number' },
      { id:'rooms',   name:'Rooms',         kind:'number' },
      { id:'crawl',   name:'Crawl/basement',kind:'toggle' },
      { id:'pool',    name:'Pool',          kind:'toggle' },
      { id:'tier',    name:'Tier',          kind:'select' },
    ],
    lines: [
      ['Whole-home inspection',    '$485'],
      ['Termite/wood-destroying',  '$95'],
      ['Sewer scope',              '$220'],
      ['Pool & equipment',         '$140'],
      ['Detailed report + photos', 'included'],
    ],
    subtotal: 940, tax: 0, total: 940, deposit: 940,
    measureMode: 'records',
    qualifyChat: [
      { who:'bot',  text:"Hey Liam — under contract, congrats! What's your option period look like, what are we working with?" },
      { who:'them', text:"9 days from today. Agent wants results back by day 7 so we can negotiate." },
      { who:'bot',  text:"Tight but doable. Day-2 from now, you'd have a 60-page report in your inbox same day. Standard whole-home is $485. You'll probably want add-ons given the age — sewer scope?" },
      { who:'them', text:"Yeah the house is 1968. Definitely sewer." },
      { who:'bot',  text:"Yes, do it. Termite + pool too if you have either. The seller's report will not cover those." },
      { who:'them', text:"Add termite and pool. Place has both." },
      { who:'bot',  text:"$940 total. Inspector is Marcus, 24 years. Who's your agent? We'll cc them on the report." },
      { who:'them', text:"Jordan at Compass." },
    ],
    qualifyChecks: [
      ['Side','Buyer',4],['Deadline','9 d',6],['Add-ons','3',8],['Referral','Compass',4]
    ],
  },
  emergency: {
    atlas: { label:'Emergency scope', value:'On-site < 90m', detail:'24/7 dispatch' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'30%', y:'52%', label:'Active leak · supply' },
      { x:'52%', y:'70%', label:'Shutoff located' },
      { x:'50%', y:'40%', label:'Damage · 220 sf' },
      { x:'78%', y:'58%', label:'Power · safe' },
    ],
    fields: [
      { id:'urgency', name:'Urgency',        kind:'select' },
      { id:'eta',     name:'On-site ETA',    kind:'select' },
      { id:'after',   name:'After-hours',    kind:'toggle' },
      { id:'service', name:'Trip + diag',    kind:'select' },
      { id:'pay',     name:'Pay on arrival', kind:'toggle' },
    ],
    lines: [
      ['Emergency dispatch fee',   '$185'],
      ['After-hours rate',         '$320'],
      ['Diagnostic + temp fix',    '$240'],
      ['Materials · standard',     '$180'],
      ['Labor · 2 hr min',         '$420'],
    ],
    subtotal: 1345, tax: 110, total: 1455, deposit: 1455,
    measureMode: 'dispatch',
    qualifyChat: [
      { who:'bot',  text:"Is anyone in immediate danger right now? Water, gas, electrical?" },
      { who:'them', text:"No, no one's hurt. Water everywhere though, ceiling is dripping into the living room." },
      { who:'bot',  text:"Ok good. Main shutoff — do you know where it is and is it accessible?" },
      { who:'them', text:"In the garage. Just turned it off." },
      { who:'bot',  text:"Perfect, you did the right thing. Power on the wet circuits?" },
      { who:'them', text:"Killed the breaker for the kitchen + living room. Rest is up." },
      { who:'bot',  text:"Smart. Marcus is 38 min out with a van full of stuff. After-hours rate is $320, total likely $1,300–1,500 depending on what's behind the wall. Pay-on-arrival, Apple Pay or card. Cool?" },
      { who:'them', text:"Yes — Apple Pay. Just get here." },
    ],
    qualifyChecks: [
      ['Safety','Safe',4],['Contained','Yes',6],['Power','Off',8],['Payment','ApplePay',4]
    ],
  },
  commercial: {
    atlas: { label:'Building footprint', value:'18,400 sq ft', detail:'2 floors · CMU' },
    arBg: 'commercial',
    satBg: 'commercial',
    arTags: [
      { x:'30%', y:'18%', label:'RTU · 8' },
      { x:'74%', y:'58%', label:'Loading dock' },
      { x:'50%', y:'78%', label:'Sprinkler riser' },
      { x:'20%', y:'58%', label:'BMS · panel' },
    ],
    fields: [
      { id:'sqft',    name:'Building sf',   kind:'number' },
      { id:'floors',  name:'Floors',        kind:'number' },
      { id:'cad',     name:'Service cadence',kind:'select' },
      { id:'cert',    name:'COI · req',     kind:'toggle' },
      { id:'tier',    name:'Tier',          kind:'select' },
    ],
    lines: [
      ['Monthly service · 8 RTU',  '$1,820 / mo'],
      ['Coil cleaning · spring',   '$680'],
      ['Belt + filter program',    '$420'],
      ['Emergency response · 4 hr','included'],
      ['COI + W-9 + MSA',          'included'],
    ],
    subtotal: 2920, tax: 0, total: 2920, deposit: 0,
    measureMode: 'satellite',
    qualifyChat: [
      { who:'bot',  text:"Hey David — facility manager at Crestwood? I see your contract with the current vendor wraps in March. Are you exploring or committed to a switch?" },
      { who:'them', text:"Exploring. They've been ok but response time is killing us. AC went out for 3 hours last week." },
      { who:'bot',  text:"Yeah 3 hours is unacceptable for a 100% occupied building. Our SLA is 4-hr emergency, you'd never see that. Single tenant or split?" },
      { who:'them', text:"Single tenant, all office. 18,400 sf, 8 RTUs on the roof." },
      { who:'bot',  text:"Got it. $1,820/mo full coverage including parts under $250. CFO sign-off needed I assume?" },
      { who:'them', text:"Yeah, Mark needs to see the proposal. He cares about uptime SLA more than price." },
      { who:'bot',  text:"Perfect, that's our pitch exactly. I'll have a proposal with the SLA terms in your inbox by EOD tomorrow. Want to walk the rooftop with our lead tech Friday?" },
      { who:'them', text:"Friday at 10. I'll meet you on the roof." },
    ],
    qualifyChecks: [
      ['Role','Facility mgr',4],['Building','18.4k sf',6],['Contract','Mar end',8],['Sign-off','CFO',4]
    ],
  },
  specialty: {
    atlas: { label:'Project scope', value:'Custom', detail:'Field measure required' },
    arBg: 'house-mech',
    satBg: 'house',
    arTags: [
      { x:'30%', y:'40%', label:'Site · access ok' },
      { x:'66%', y:'34%', label:'Materials · spec' },
      { x:'48%', y:'66%', label:'Utilities · marked' },
      { x:'72%', y:'58%', label:'HOA · approved' },
    ],
    fields: [
      { id:'scope',   name:'Scope',         kind:'select' },
      { id:'sqft',    name:'Footprint sf',  kind:'number' },
      { id:'matl',    name:'Materials',     kind:'select' },
      { id:'permit',  name:'Permit',        kind:'toggle' },
      { id:'tier',    name:'Tier',          kind:'select' },
    ],
    lines: [
      ['Site prep + design',       '$1,840'],
      ['Materials · spec',         '$6,400'],
      ['Foundation + framing',     '$4,200'],
      ['Finish + trim',            '$2,800'],
      ['Labor · GC + crew',        '$5,600'],
    ],
    subtotal: 20840, tax: 1720, total: 22560, deposit: 5640,
    measureMode: 'records',
    qualifyChat: [
      { who:'bot',  text:"Hey Megan — outbuilding in the backyard, fun project. What's the use — office, gym, art studio?" },
      { who:'them', text:"Office. WFH and the house is too loud with the kids. Want it permitted so we can pull comps later." },
      { who:'bot',  text:"Smart, permitting protects resale. 280 sf puts you just under the threshold for setback variance in your zone, so we're good without HOA approval. What's the budget like?" },
      { who:'them', text:"20–30k all-in. Has to feel real, not a shed." },
      { who:'bot',  text:"Got it — mini-split, real electrical, insulated walls. Comes in around 22.5 with the permit. Site is flat I assume from the aerial?" },
      { who:'them', text:"Mostly. Slight slope on the back side, nothing crazy." },
      { who:'bot',  text:"Easy. We can break ground in June for August move-in. Want to come into the office this week to look at finish samples?" },
      { who:'them', text:"Tuesday or Wednesday after 4." },
    ],
    qualifyChecks: [
      ['Scope','Outbuilding',4],['Size','280 sf',6],['Budget','$20–30k',8],['Timeline','Summer',4]
    ],
  },
};

/* ============================================================
   SERVICE-SPECIFIC OVERRIDES — fine-tune for a handful of headliners.
   ============================================================ */
const SERVICE_OVERRIDES = {
  'Pool Installation': {
    atlas: { label:'Pool design area', value:'18 × 36 ft', detail:'Gunite · in-ground' },
    lines: [
      ['Excavation + spoils',      '$8,400'],
      ['Steel + plumbing',         '$6,200'],
      ['Gunite shell',             '$14,800'],
      ['Tile + coping',            '$5,400'],
      ['Plaster + start-up',       '$4,800'],
      ['Equipment + automation',   '$7,200'],
    ],
    subtotal: 46800, tax: 0, total: 46800, deposit: 11700,
  },
  'EV Charger Installation': {
    atlas: { label:'Run from panel', value:'42 ft', detail:'Wall-mount · garage' },
    lines: [
      ['Tesla Wall Connector',     '$580'],
      ['50A breaker + wire · 42ft','$420'],
      ['Conduit + boxes',          '$180'],
      ['Labor · journeyman · 4h',  '$540'],
      ['Permit + inspection',      '$185'],
    ],
    subtotal: 1905, tax: 155, total: 2060, deposit: 515,
  },
  'Mold Remediation': {
    atlas: { label:'Contaminated area', value:'320 sq ft', detail:'Basement · cat 3' },
  },
  'Kitchen Remodeling': {}, // uses remodel default
  'Bathroom Remodeling': {
    atlas: { label:'Bathroom footprint', value:'92 sq ft', detail:'Primary bath' },
    lines: [
      ['Demo + haul',              '$1,200'],
      ['Tile · floor + shower',    '$3,800'],
      ['Vanity + tops · 72"',      '$2,400'],
      ['Glass shower · frameless', '$2,600'],
      ['Plumbing + electrical',    '$2,400'],
      ['Labor · GC + crew',        '$5,200'],
    ],
    subtotal: 17600, tax: 1450, total: 19050, deposit: 4762,
  },
  'Generator Installation': {
    atlas: { label:'Generator pad', value:'4 × 6 ft', detail:'Side yard · gas-fed' },
  },
  'Window Cleaning': {
    atlas: { label:'Window count', value:'24 windows', detail:'Interior + exterior' },
  },
  'Pressure Washing': {
    atlas: { label:'Washable area', value:'2,840 sq ft', detail:'Drive + walks + siding' },
  },
  'Snow Removal': {
    atlas: { label:'Plowable area', value:'1,800 sq ft', detail:'Drive + walks' },
  },
  'Holiday Light Installation': {
    atlas: { label:'Linear feet', value:'182 lf', detail:'Roofline + bushes' },
  },
};

function getServiceConfig(serviceName) {
  const entry = SERVICE_LIST.find(s => s.name === serviceName) || SERVICE_LIST[0];
  const base = CAT_DEFAULTS[entry.cat] || CAT_DEFAULTS.specialty;
  const ov = SERVICE_OVERRIDES[serviceName] || {};
  return {
    ...base,
    ...ov,
    name: entry.name,
    cat: entry.cat,
    catLabel: (SERVICE_CATEGORIES.find(c=>c.id===entry.cat) || {}).label || 'Service',
  };
}

Object.assign(window, { SERVICE_LIST, SERVICE_CATEGORIES, CAT_DEFAULTS, SERVICE_OVERRIDES, getServiceConfig });
