/* ============================================================
   Bizia — Mock data
   Single source of truth for the prototype. Backend swaps
   these constants for real API responses later.
   window.DATA.*  +  helper formatters
   ============================================================ */
(function () {
  const money = (n) => '$' + n.toLocaleString('en-US');
  const k = (n) => n >= 1000 ? (n / 1000).toFixed(n % 1000 === 0 ? 0 : 1) + 'k' : '' + n;

  /* ---------- Website projects (6) — website-launch centric ---------- */
  const projects = [
    {
      id: 'amazebites', name: 'AmazeBites Cafe', type: 'Local restaurant', icon: 'briefcase',
      color: '#FF8A5B', domain: 'amazebites.cafe', domainStatus: 'connected', status: 'published',
      readiness: 92, pages: 6, lastPage: 'Home', hosting: 'Cloudflare Pages', hostingStatus: 'deployed',
      seoStatus: 'ready', seoScore: 88, gscStatus: 'verified', updated: '2h ago', plan: 'Growth',
      tagline: 'Neighbourhood brunch & specialty coffee', checklistDone: 8, checklistTotal: 9,
      ssl: true, prodUrl: 'amazebites.cafe',
    },
    {
      id: 'brightsmile', name: 'BrightSmile Dental', type: 'Dental clinic', icon: 'shield',
      color: '#12B8A6', domain: 'brightsmile.clinic', domainStatus: 'pending', status: 'draft',
      readiness: 64, pages: 7, lastPage: 'Services', hosting: 'Cloudflare Pages', hostingStatus: 'preview',
      seoStatus: 'partial', seoScore: 52, gscStatus: 'pending', updated: '1d ago', plan: 'Business',
      tagline: 'Gentle family & cosmetic dentistry', checklistDone: 5, checklistTotal: 9,
      ssl: false, prodUrl: '',
    },
    {
      id: 'elevate', name: 'Elevate Coaching', type: 'Coaching business', icon: 'trendUp',
      color: '#5B5CFF', domain: 'elevate.coach', domainStatus: 'connected', status: 'published',
      readiness: 96, pages: 5, lastPage: 'Programs', hosting: 'Vercel', hostingStatus: 'deployed',
      seoStatus: 'ready', seoScore: 94, gscStatus: 'verified', updated: '5h ago', plan: 'Growth',
      tagline: '1:1 leadership & career coaching', checklistDone: 9, checklistTotal: 9,
      ssl: true, prodUrl: 'elevate.coach',
    },
    {
      id: 'keystone', name: 'Keystone Realty', type: 'Real estate agent', icon: 'home',
      color: '#A855F7', domain: 'keystone-realty.com', domainStatus: 'connected', status: 'published',
      readiness: 81, pages: 8, lastPage: 'Listings', hosting: 'Netlify', hostingStatus: 'deployed',
      seoStatus: 'partial', seoScore: 71, gscStatus: 'verified', updated: '3d ago', plan: 'Business',
      tagline: 'Boutique residential real estate', checklistDone: 7, checklistTotal: 9,
      ssl: true, prodUrl: 'keystone-realty.com',
    },
    {
      id: 'northpeak', name: 'NorthPeak Agency', type: 'Digital agency', icon: 'zap',
      color: '#0EA5E9', domain: 'northpeak.studio', domainStatus: 'connected', status: 'draft',
      readiness: 73, pages: 6, lastPage: 'Work', hosting: 'Cloudflare Pages', hostingStatus: 'building',
      seoStatus: 'partial', seoScore: 60, gscStatus: 'not-started', updated: '6h ago', plan: 'Agency',
      tagline: 'Brand, web & growth studio', checklistDone: 6, checklistTotal: 9,
      ssl: true, prodUrl: '',
    },
    {
      id: 'lumina', name: 'Lumina Academy', type: 'School / academy', icon: 'star',
      color: '#F59E0B', domain: '', domainStatus: 'not-started', status: 'draft',
      readiness: 38, pages: 5, lastPage: 'Programs', hosting: 'Cloudflare Pages', hostingStatus: 'not-started',
      seoStatus: 'not-started', seoScore: 24, gscStatus: 'not-started', updated: '4d ago', plan: 'Starter',
      tagline: 'After-school STEM & arts programs', checklistDone: 3, checklistTotal: 9,
      ssl: false, prodUrl: '',
    },
  ];

  /* ---------- Templates (13) ---------- */
  const templates = [
    { id: 't-bistro', name: 'Bistro', category: 'Restaurant', tags: ['Menu', 'Reservations', 'Gallery'], accent: '#FF8A5B', recommended: true, premium: false, pairs: 'Local restaurant', features: ['Menu', 'Leads', 'Gallery'] },
    { id: 't-localpro', name: 'LocalPro', category: 'Local service', tags: ['Quote form', 'WhatsApp', 'Reviews'], accent: '#12B8A6', recommended: true, premium: false, pairs: 'Local service', features: ['Leads', 'WhatsApp', 'Reviews'] },
    { id: 't-clarity', name: 'Clarity', category: 'Clinic', tags: ['Booking', 'Services', 'Team'], accent: '#0EA5E9', recommended: true, premium: false, pairs: 'Dental clinic', features: ['Booking', 'Auth', 'Team'] },
    { id: 't-mentor', name: 'Mentor', category: 'Coaching', tags: ['Programs', 'Booking', 'Testimonials'], accent: '#5B5CFF', recommended: true, premium: true, pairs: 'Coaching business', features: ['Booking', 'Payments', 'Auth'] },
    { id: 't-estate', name: 'Estate', category: 'Real estate', tags: ['Listings', 'Map', 'Leads'], accent: '#A855F7', recommended: false, premium: true, pairs: 'Real estate agent', features: ['Listings', 'Leads', 'Map'] },
    { id: 't-studio', name: 'Studio', category: 'Agency', tags: ['Portfolio', 'Case studies', 'Contact'], accent: '#111827', recommended: false, premium: true, pairs: 'Digital agency', features: ['Portfolio', 'Leads'] },
    { id: 't-canvas', name: 'Canvas', category: 'Portfolio', tags: ['Gallery', 'About', 'Contact'], accent: '#EC4899', recommended: false, premium: false, pairs: 'Portfolio', features: ['Gallery'] },
    { id: 't-shopfront', name: 'Shopfront', category: 'E-commerce', tags: ['Catalog', 'Cart', 'Payments'], accent: '#16A34A', recommended: false, premium: true, pairs: 'E-commerce', features: ['Payments', 'Catalog', 'Auth'] },
    { id: 't-launchpad', name: 'Launchpad', category: 'SaaS', tags: ['Pricing', 'Features', 'Signup'], accent: '#6366F1', recommended: false, premium: true, pairs: 'SaaS', features: ['Auth', 'Pricing', 'Payments'] },
    { id: 't-scholar', name: 'Scholar', category: 'School', tags: ['Programs', 'Enroll', 'Calendar'], accent: '#F59E0B', recommended: false, premium: false, pairs: 'School / academy', features: ['Enroll', 'Leads', 'Calendar'] },
    { id: 't-vital', name: 'Vital', category: 'Salon', tags: ['Booking', 'Services', 'Gallery'], accent: '#D946EF', recommended: false, premium: false, pairs: 'Salon', features: ['Booking', 'Gallery'] },
    { id: 't-gather', name: 'Gather', category: 'Event', tags: ['Schedule', 'Tickets', 'Speakers'], accent: '#F43F5E', recommended: false, premium: true, pairs: 'Event', features: ['Tickets', 'Payments'] },
    { id: 't-cause', name: 'Cause', category: 'Nonprofit', tags: ['Donations', 'Story', 'Volunteer'], accent: '#0D9488', recommended: false, premium: false, pairs: 'Nonprofit', features: ['Donations', 'Leads'] },
  ];
  const templateCategories = ['Local service', 'Restaurant', 'School', 'Clinic', 'Salon', 'Agency', 'Portfolio', 'E-commerce', 'SaaS', 'Coaching', 'Real estate', 'Event', 'Nonprofit'];
  const templateFeatures = ['Booking', 'Leads', 'Payments', 'Auth', 'Gallery', 'WhatsApp', 'Menu', 'Catalog'];

  /* ---------- Domain suggestions (10) ---------- */
  const domains = [
    { name: 'amazebites.cafe', price: 22, renew: 22, badge: 'Exact match', badgeTone: 'primary', available: true },
    { name: 'amazebites.com', price: 12, renew: 14, badge: 'Best brand name', badgeTone: 'secondary', available: true },
    { name: 'amazebites.co', price: 28, renew: 30, badge: 'Shortest', badgeTone: 'info', available: true },
    { name: 'getamazebites.com', price: 12, renew: 14, badge: 'Cheapest long-term', badgeTone: 'success', available: true },
    { name: 'amazebites.cafe', price: 22, renew: 22, badge: '', badgeTone: 'neutral', available: false },
    { name: 'amazebites.coffee', price: 38, renew: 38, badge: 'Premium risk', badgeTone: 'warning', available: true },
    { name: 'amazebitescafe.com', price: 12, renew: 14, badge: '', badgeTone: 'neutral', available: true },
    { name: 'amaze.cafe', price: 45, renew: 45, badge: 'Premium risk', badgeTone: 'warning', available: true },
    { name: 'amazebites.shop', price: 8, renew: 32, badge: 'Cheapest long-term', badgeTone: 'success', available: true },
    { name: 'hellobites.com', price: 12, renew: 14, badge: 'Best brand name', badgeTone: 'secondary', available: true },
  ];

  /* ---------- Leads (8) ---------- */
  const leads = [
    { id: 'l1', name: 'Marcus Webb', stage: 'New', source: 'Website form', channel: 'globe', message: 'Looking to book the back room for a birthday of ~20 people next Saturday.', page: '/contact', device: 'iPhone 15', assigned: null, value: 480, when: '12m ago', email: 'marcus.w@gmail.com', phone: '+1 415 555 0192', notes: '' },
    { id: 'l2', name: 'Priya Natarajan', stage: 'New', source: 'WhatsApp CTA', channel: 'whatsapp', message: 'Do you cater corporate breakfasts? Need ~40 boxes.', page: '/menu', device: 'Android', assigned: 'Sara', value: 920, when: '46m ago', email: 'priya@brightworks.io', phone: '+1 408 555 0140', notes: 'High intent — repeat enquiry.' },
    { id: 'l3', name: 'Daniel Cho', stage: 'Contacted', source: 'Google Business', channel: 'google', message: 'Are you open on public holidays?', page: '/hours', device: 'Desktop', assigned: 'Sara', value: 0, when: '3h ago', email: 'dcho@outlook.com', phone: '+1 650 555 0177', notes: 'Sent hours + holiday schedule.' },
    { id: 'l4', name: 'Lena Fischer', stage: 'Contacted', source: 'Instagram', channel: 'instagram', message: 'Loved the brunch reel — can I reserve a window table for 2?', page: '/reservations', device: 'iPhone 14', assigned: 'Jon', value: 60, when: '5h ago', email: 'lena.f@icloud.com', phone: '+1 415 555 0118', notes: '' },
    { id: 'l5', name: 'Omar Haddad', stage: 'Quoted', source: 'Website form', channel: 'globe', message: 'Quote for weekly office coffee delivery (Mon–Fri).', page: '/catering', device: 'Desktop', assigned: 'Sara', value: 1450, when: '1d ago', email: 'omar@hexa.dev', phone: '+1 510 555 0166', notes: 'Sent proposal — $1,450/mo. Follow up Thu.' },
    { id: 'l6', name: 'Grace Liu', stage: 'Quoted', source: 'Referral', channel: 'users', message: 'Wedding dessert table for 80 guests in June.', page: '/events', device: 'iPad', assigned: 'Jon', value: 2100, when: '2d ago', email: 'grace.liu@gmail.com', phone: '+1 415 555 0133', notes: 'Tasting booked for next week.' },
    { id: 'l7', name: 'Tom Andersson', stage: 'Won', source: 'WhatsApp CTA', channel: 'whatsapp', message: 'Confirmed monthly pastry supply for our co-working space.', page: '/catering', device: 'Android', assigned: 'Sara', value: 3200, when: '4d ago', email: 'tom@deskhub.co', phone: '+1 408 555 0151', notes: 'Contract signed. $3,200/mo recurring.' },
    { id: 'l8', name: 'Bianca Rossi', stage: 'Lost', source: 'Website form', channel: 'globe', message: 'Needed gluten-free wedding cake on short notice.', page: '/events', device: 'iPhone 13', assigned: 'Jon', value: 0, when: '6d ago', email: 'bianca.r@gmail.com', phone: '+1 650 555 0124', notes: 'Could not meet date — referred a partner.' },
  ];
  const leadStages = ['New', 'Contacted', 'Quoted', 'Won', 'Lost'];

  /* ---------- Employees / e-cards (5) ---------- */
  const employees = [
    { id: 'e1', name: 'Sara Mendez', role: 'General Manager', dept: 'Operations', phone: '+1 415 555 0190', email: 'sara@amazebites.cafe', whatsapp: '+1 415 555 0190', linkedin: 'sara-mendez', booking: 'cal.com/sara', slug: 'sarah', scans: 312, color: '#5B5CFF' },
    { id: 'e2', name: 'Jon Reyes', role: 'Head Barista', dept: 'Floor', phone: '+1 415 555 0191', email: 'jon@amazebites.cafe', whatsapp: '+1 415 555 0191', linkedin: 'jon-reyes', booking: '', slug: 'jon', scans: 184, color: '#12B8A6' },
    { id: 'e3', name: 'Mia Tanaka', role: 'Events & Catering Lead', dept: 'Sales', phone: '+1 415 555 0192', email: 'mia@amazebites.cafe', whatsapp: '+1 415 555 0192', linkedin: 'mia-tanaka', booking: 'cal.com/mia', slug: 'sales', scans: 426, color: '#FF8A5B' },
    { id: 'e4', name: 'David Okoro', role: 'Pastry Chef', dept: 'Kitchen', phone: '+1 415 555 0193', email: 'david@amazebites.cafe', whatsapp: '', linkedin: 'david-okoro', booking: '', slug: 'david', scans: 97, color: '#A855F7' },
    { id: 'e5', name: 'Elena Costa', role: 'Marketing', dept: 'Marketing', phone: '+1 415 555 0194', email: 'elena@amazebites.cafe', whatsapp: '+1 415 555 0194', linkedin: 'elena-costa', booking: 'cal.com/elena', slug: 'elena', scans: 268, color: '#EC4899' },
  ];

  /* ---------- Social handles (6 platforms) ---------- */
  const social = [
    { platform: 'Instagram', icon: 'instagram', handle: '@amazebites.cafe', available: true, suggested: true, color: '#E1306C', followers: '—' },
    { platform: 'Facebook', icon: 'facebook', handle: '/amazebitescafe', available: true, suggested: true, color: '#1877F2', followers: '—' },
    { platform: 'LinkedIn', icon: 'linkedin', handle: '/amazebites', available: true, suggested: false, color: '#0A66C2', followers: '—' },
    { platform: 'X', icon: 'twitter', handle: '@amazebites', available: false, suggested: false, color: '#111827', followers: '—' },
    { platform: 'TikTok', icon: 'tiktok', handle: '@amazebites', available: true, suggested: true, color: '#111827', followers: '—' },
    { platform: 'YouTube', icon: 'youtube', handle: '@amazebitescafe', available: true, suggested: false, color: '#FF0000', followers: '—' },
  ];
  const socialBios = [
    "Neighbourhood brunch & specialty coffee ☕ Fresh-baked daily. Catering & events. Book a table below 👇",
    "AmazeBites Cafe — where mornings taste better. All-day brunch, single-origin coffee, house pastries. 📍 Downtown",
    "Good food, great people. Brunch • Coffee • Catering. Tap the link to reserve or order ahead.",
  ];
  const postIdeas = [
    'Behind-the-bar: pulling our signature espresso shot', 'Menu spotlight — the new maple-miso waffle',
    'Meet the team: 60 seconds with our head barista', 'Customer love: a wall of weekend reviews',
    '“How it’s made” reel of our morning pastry bake', 'Weekend specials announcement carousel',
    'Local partner feature: our coffee roaster', 'Catering case study: a 40-box office breakfast',
    'Time-lapse: setting up for brunch service', 'Poll: what should next month’s special be?',
  ];

  /* ---------- Integrations / infrastructure (7) ---------- */
  const infrastructure = [
    { key: 'hosting', simple: 'Where your website lives', tech: 'Hosting', provider: 'Cloudflare Pages', why: 'Fast global delivery with a generous free tier — perfect for a launch.', cost: 0, costLabel: '$0/mo', status: 'ready', icon: 'cloud', tone: 'secondary', upgrade: 'Upgrade to Pro at ~50k monthly visits.' },
    { key: 'database', simple: 'Where your leads & customer data are stored', tech: 'Database', provider: 'Supabase', alt: 'Neon', why: 'Managed Postgres with auth built in. Scales as you collect more leads.', cost: 0, costLabel: '$0/mo', status: 'ready', icon: 'database', tone: 'primary', upgrade: 'Free up to 500MB — upgrade when you exceed it.' },
    { key: 'auth', simple: 'Login for you, your team, or customers', tech: 'Authentication', provider: 'Clerk', why: 'Drop-in secure login. Only needed if you enable customer or team accounts.', cost: 0, costLabel: '$0/mo', status: 'optional', icon: 'lock', tone: 'accent', upgrade: 'Free up to 10k monthly active users.' },
    { key: 'email', simple: 'Sends confirmations & lead notifications', tech: 'Transactional email', provider: 'Resend', why: 'Reliable delivery for booking confirmations and lead alerts.', cost: 0, costLabel: '$0/mo', status: 'ready', icon: 'mail', tone: 'info', upgrade: 'Free up to 3,000 emails/mo.' },
    { key: 'storage', simple: 'Stores your images & uploads', tech: 'Object storage', provider: 'Cloudflare R2', why: 'Cheap, fast image storage with no egress fees.', cost: 0, costLabel: '$0/mo', status: 'ready', icon: 'box', tone: 'secondary', upgrade: 'Free up to 10GB stored.' },
    { key: 'analytics', simple: 'See how visitors use your site', tech: 'Product analytics', provider: 'PostHog', why: 'Privacy-friendly visitor insights and conversion tracking.', cost: 0, costLabel: '$0/mo', status: 'ready', icon: 'chart', tone: 'primary', upgrade: 'Free up to 1M events/mo.' },
    { key: 'payments', simple: 'Take payments & deposits online', tech: 'Payments', provider: 'Stripe', why: 'Industry standard. Add when you’re ready to sell or take deposits.', cost: 0, costLabel: '2.9% + 30¢', status: 'not-started', icon: 'dollar', tone: 'success', upgrade: 'No monthly fee — pay per transaction.' },
  ];

  /* ---------- Pricing plans (5) ---------- */
  const plans = [
    { id: 'free', name: 'Free Preview', price: 0, period: 'mo', tagline: 'Explore & generate a plan', cta: 'Current plan', highlight: false, limits: { sites: '1 draft', leads: 'Preview only', team: '1 seat' }, features: ['AI launch plan', '1 draft website', 'Template gallery', 'Bizia subdomain', 'Community support'] },
    { id: 'starter', name: 'Starter', price: 19, period: 'mo', tagline: 'Launch one simple site', cta: 'Choose Starter', highlight: false, limits: { sites: '1 site', leads: '100 leads/mo', team: '2 seats' }, features: ['Everything in Free', 'Publish 1 live site', 'Custom domain mapping', 'Lead inbox', 'WhatsApp CTA', 'Basic analytics'] },
    { id: 'growth', name: 'Growth', price: 49, period: 'mo', tagline: 'For growing local businesses', cta: 'Choose Growth', highlight: true, limits: { sites: '3 sites', leads: '1,000 leads/mo', team: '5 seats' }, features: ['Everything in Starter', 'Up to 3 sites', 'Customer login', '25 employee e-cards', 'Social kit builder', 'Full analytics + replays', 'Remove Bizia badge'] },
    { id: 'business', name: 'Business', price: 99, period: 'mo', tagline: 'Teams & multi-location', cta: 'Choose Business', highlight: false, limits: { sites: '10 sites', leads: '10,000 leads/mo', team: '15 seats' }, features: ['Everything in Growth', 'Up to 10 sites', 'Unlimited e-cards', 'Roles & permissions', 'Priority AI edits', 'A/B testing', 'Phone support'] },
    { id: 'agency', name: 'Agency', price: 249, period: 'mo', tagline: 'Build for clients', cta: 'Contact sales', highlight: false, limits: { sites: 'Unlimited', leads: 'Unlimited', team: 'Unlimited' }, features: ['Everything in Business', 'Unlimited client sites', 'White-label dashboard', 'Client billing', 'Shared brand kits', 'Dedicated manager'] },
  ];
  const addons = [
    { name: 'Extra employee e-cards', price: '$2 / card / mo' },
    { name: 'Additional site', price: '$15 / site / mo' },
    { name: 'Premium template pack', price: '$29 one-time' },
    { name: 'Priority AI builder', price: '$19 / mo' },
  ];

  /* ---------- Analytics sample data ---------- */
  const days = Array.from({ length: 14 }, (_, i) => {
    const d = new Date(); d.setDate(d.getDate() - (13 - i));
    return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
  });
  const analytics = {
    visitors: { total: 4820, delta: '+18%', dir: 'up', series: [220, 260, 240, 310, 290, 360, 420, 380, 440, 410, 480, 520, 560, 540] },
    leads: { total: 38, delta: '+9%', dir: 'up', series: [1, 3, 2, 4, 3, 5, 4, 2, 6, 3, 5, 7, 4, 6] },
    conversion: { total: '3.4%', delta: '+0.6%', dir: 'up', series: [2.1, 2.4, 2.2, 2.9, 2.6, 3.0, 3.3, 2.8, 3.6, 3.1, 3.4, 3.7, 3.5, 3.4] },
    ecardScans: { total: 1287, delta: '+24%', dir: 'up', series: [40, 55, 48, 70, 62, 85, 96, 78, 102, 88, 110, 124, 132, 118] },
    labels: days,
    topPages: [
      { label: '/ (Home)', value: 2140, icon: 'home' }, { label: '/menu', value: 1320, icon: 'grid' },
      { label: '/reservations', value: 640, icon: 'calendar' }, { label: '/catering', value: 410, icon: 'briefcase' },
      { label: '/contact', value: 310, icon: 'mail' },
    ],
    buttonClicks: [
      { label: 'Book a table', value: 612 }, { label: 'WhatsApp us', value: 488 },
      { label: 'View menu', value: 904 }, { label: 'Get directions', value: 356 }, { label: 'Call now', value: 221 },
    ],
    socialClicks: [
      { label: 'Instagram', value: 342, color: '#E1306C', icon: 'instagram' },
      { label: 'Facebook', value: 198, color: '#1877F2', icon: 'facebook' },
      { label: 'TikTok', value: 156, color: '#111827', icon: 'tiktok' },
      { label: 'YouTube', value: 64, color: '#FF0000', icon: 'youtube' },
    ],
    devices: [
      { label: 'Mobile', value: 64, color: '#5B5CFF' }, { label: 'Desktop', value: 29, color: '#12B8A6' }, { label: 'Tablet', value: 7, color: '#FFB454' },
    ],
    sources: [
      { label: 'Google', value: 1980, color: '#5B5CFF', icon: 'google' }, { label: 'Direct', value: 1240, color: '#12B8A6', icon: 'globe' },
      { label: 'Instagram', value: 820, color: '#EC4899', icon: 'instagram' }, { label: 'Referral', value: 480, color: '#FFB454', icon: 'users' }, { label: 'WhatsApp', value: 300, color: '#16A34A', icon: 'whatsapp' },
    ],
    recommendations: [
      { icon: 'zap', title: 'Your menu page converts 2.3× better', text: 'Add a “Book a table” button to the top of /menu — most visitors land there first.', tone: 'primary' },
      { icon: 'trendUp', title: 'WhatsApp leads are growing fast', text: 'WhatsApp now drives 31% of leads. Consider a floating WhatsApp button site-wide.', tone: 'secondary' },
      { icon: 'clock', title: 'Slow Tuesday mornings', text: 'Traffic dips Tue 9–11am. A timed social post could smooth out demand.', tone: 'accent' },
    ],
  };

  /* ---------- Publish / launch checklist (website-centric) ---------- */
  const checklist = [
    { id: 'c1', label: 'Generate website pages', simple: 'Bizia drafted your pages from your prompt', status: 'done', group: 'Build', optional: false },
    { id: 'c2', label: 'Review design & brand', simple: 'Colors, fonts and layout look right', status: 'done', group: 'Build', optional: false },
    { id: 'c3', label: 'Add SEO titles & descriptions', simple: 'Help Google understand each page', status: 'done', group: 'SEO', optional: false },
    { id: 'c4', label: 'Generate sitemap & robots.txt', simple: 'So search engines can find every page', status: 'done', group: 'SEO', optional: false },
    { id: 'c5', label: 'Connect your domain', simple: 'Point your web address to this website', status: 'done', group: 'Domain', optional: false },
    { id: 'c6', label: 'Set up hosting & deploy', simple: 'Put your website on fast global servers', status: 'done', group: 'Hosting', optional: false },
    { id: 'c7', label: 'Verify with Google Search Console', simple: 'Help Google find and index your site', status: 'in-progress', group: 'SEO', optional: false },
    { id: 'c8', label: 'Add a contact form', simple: 'Let visitors get in touch', status: 'done', group: 'Forms', optional: true },
    { id: 'c9', label: 'Publish & go live', simple: 'Make your website visible to the world', status: 'not-started', group: 'Publish', optional: false },
  ];

  /* ---------- Pages (for primary site builder) ---------- */
  const pages = [
    { id: 'home', name: 'Home', path: '/', status: 'published', sections: 6, seo: 'ready', updated: '2h ago', icon: 'home' },
    { id: 'about', name: 'About', path: '/about', status: 'published', sections: 4, seo: 'ready', updated: '1d ago', icon: 'info' },
    { id: 'menu', name: 'Menu', path: '/menu', status: 'published', sections: 5, seo: 'ready', updated: '3h ago', icon: 'grid' },
    { id: 'reservations', name: 'Reservations', path: '/reservations', status: 'published', sections: 3, seo: 'partial', updated: '2d ago', icon: 'calendar' },
    { id: 'gallery', name: 'Gallery', path: '/gallery', status: 'draft', sections: 2, seo: 'partial', updated: '4h ago', icon: 'image' },
    { id: 'contact', name: 'Contact', path: '/contact', status: 'published', sections: 3, seo: 'ready', updated: '1d ago', icon: 'mail' },
  ];

  /* ---------- Canvas sections for the Home page (builder) ---------- */
  const sections = [
    { id: 's-hero', type: 'Hero', label: 'Hero', locked: false },
    { id: 's-features', type: 'Highlights', label: 'Highlights', locked: false },
    { id: 's-menu', type: 'Menu preview', label: 'Menu preview', locked: false },
    { id: 's-about', type: 'About', label: 'About', locked: false },
    { id: 's-gallery', type: 'Gallery', label: 'Gallery', locked: false },
    { id: 's-cta', type: 'Booking CTA', label: 'Booking CTA', locked: false },
    { id: 's-footer', type: 'Footer', label: 'Footer', locked: true },
  ];

  /* ---------- Design & Brand ---------- */
  const design = {
    style: 'Warm & inviting',
    palette: [
      { name: 'Primary', hex: '#FF8A5B', role: 'Buttons & accents' },
      { name: 'Secondary', hex: '#2A2118', role: 'Headings & text' },
      { name: 'Surface', hex: '#FBF6EF', role: 'Page background' },
      { name: 'Accent', hex: '#12B8A6', role: 'Highlights' },
    ],
    fonts: [
      { name: 'Fraunde', role: 'Headings', sample: 'Aa', stack: 'Serif display', preview: 'Georgia, serif' },
      { name: 'Geist', role: 'Body & UI', sample: 'Aa', stack: 'Geometric sans', preview: 'var(--font-sans)' },
    ],
    radius: 'Rounded (14px)', spacing: 'Comfortable', logo: 'Wordmark',
    ctaStrategy: 'Lead every page with “Book a table”. Secondary CTA: “View menu”. Sticky WhatsApp button on mobile.',
  };

  /* ---------- SEO data ---------- */
  const seo = {
    score: 88,
    keywords: ['brunch cafe san francisco', 'specialty coffee downtown', 'weekend brunch reservations', 'cafe catering sf', 'best pancakes near me'],
    pages: [
      { page: 'Home', title: 'AmazeBites Cafe — Brunch & Specialty Coffee in San Francisco', desc: 'All-day brunch, single-origin coffee and house pastries in downtown SF. Book a table or order catering online.', slug: '/', status: 'ready', score: 94 },
      { page: 'Menu', title: 'Menu — AmazeBites Cafe | Brunch, Coffee & Pastries', desc: 'Explore our seasonal brunch menu, espresso drinks and fresh-baked pastries. Updated weekly.', slug: '/menu', status: 'ready', score: 90 },
      { page: 'Reservations', title: 'Book a Table — AmazeBites Cafe', desc: 'Reserve your table for weekend brunch at AmazeBites Cafe in downtown San Francisco.', slug: '/reservations', status: 'partial', score: 68 },
      { page: 'Gallery', title: '', desc: '', slug: '/gallery', status: 'missing', score: 30 },
      { page: 'Contact', title: 'Contact & Location — AmazeBites Cafe', desc: 'Find our hours, address and directions. Get in touch about catering and private events.', slug: '/contact', status: 'ready', score: 86 },
    ],
    sitemap: { status: 'generated', urls: 6, updated: '2h ago' },
    robots: { status: 'generated', updated: '2h ago' },
    og: { title: 'AmazeBites Cafe — Brunch & Specialty Coffee', desc: 'All-day brunch and single-origin coffee in downtown SF.', url: 'amazebites.cafe' },
    gsc: [
      { id: 'g1', label: 'Verify site ownership', simple: 'Prove to Google this website is yours', status: 'done' },
      { id: 'g2', label: 'Submit your sitemap', simple: 'Tell Google about all your pages', status: 'done' },
      { id: 'g3', label: 'Request indexing', simple: 'Ask Google to add your pages to search', status: 'in-progress' },
      { id: 'g4', label: 'Connect Google Analytics', simple: 'See visitor stats (optional)', status: 'not-started', optional: true },
    ],
    indexing: { indexed: 4, total: 6, status: 'Indexing in progress' },
  };

  /* ---------- Hosting & deployment ---------- */
  const hostingOptions = [
    { id: 'cloudflare', name: 'Cloudflare Pages', recommended: true, cost: '$0/mo', why: 'Fast global delivery, generous free tier, automatic SSL. Best for most launches.', logo: 'cloud', tone: 'secondary' },
    { id: 'vercel', name: 'Vercel', recommended: false, cost: '$0–20/mo', why: 'Great for dynamic sites and apps. Free hobby tier.', logo: 'zap', tone: 'primary' },
    { id: 'netlify', name: 'Netlify', recommended: false, cost: '$0–19/mo', why: 'Simple deploys with built-in forms. Free starter tier.', logo: 'box', tone: 'info' },
    { id: 'github', name: 'GitHub Pages', recommended: false, cost: '$0/mo', why: 'Free static hosting. Best for simple informational sites.', logo: 'folder', tone: 'neutral' },
  ];
  const deployment = {
    provider: 'Cloudflare Pages', status: 'deployed', buildStatus: 'success', buildTime: '38s',
    previewUrl: 'amazebites-cafe.bizia.app', prodUrl: 'amazebites.cafe', lastDeploy: '2h ago', commit: 'Update hero + menu copy',
    history: [
      { id: 'd1', msg: 'Update hero + menu copy', status: 'success', when: '2h ago', env: 'Production', time: '38s' },
      { id: 'd2', msg: 'Add reservations page', status: 'success', when: '1d ago', env: 'Production', time: '41s' },
      { id: 'd3', msg: 'Initial site generation', status: 'success', when: '3d ago', env: 'Preview', time: '52s' },
    ],
  };

  /* ---------- Domain mapping checklist ---------- */
  const domainMapping = [
    { id: 'm1', label: 'Domain purchased or connected', simple: 'You own amazebites.cafe', status: 'done' },
    { id: 'm2', label: 'Point domain to this website', simple: 'We updated your domain’s records for you', status: 'done' },
    { id: 'm3', label: 'Secure your site (SSL)', simple: 'The padlock & https that visitors trust', status: 'done' },
    { id: 'm4', label: 'Set up www and non-www', simple: 'Both amazebites.cafe and www.amazebites.cafe work', status: 'done' },
    { id: 'm5', label: 'Verify everything resolves', simple: 'Final check that your site loads everywhere', status: 'in-progress' },
  ];

  /* ---------- Forms ---------- */
  const forms = [
    { id: 'f-contact', name: 'Contact form', icon: 'mail', enabled: true, fields: ['Name', 'Email', 'Message'], dest: 'Leads inbox + email', submissions: 38, page: '/contact' },
    { id: 'f-reservation', name: 'Reservation request', icon: 'calendar', enabled: true, fields: ['Name', 'Date', 'Party size', 'Phone'], dest: 'Leads inbox + email', submissions: 64, page: '/reservations' },
    { id: 'f-catering', name: 'Catering quote', icon: 'briefcase', enabled: true, fields: ['Name', 'Email', 'Event details'], dest: 'Leads inbox', submissions: 21, page: '/catering' },
    { id: 'f-newsletter', name: 'Newsletter signup', icon: 'megaphone', enabled: false, fields: ['Email'], dest: 'Mailing list', submissions: 0, page: 'Footer' },
  ];
  const authOptions = [
    { id: 'none', label: 'No login (recommended)', simple: 'A simple, open website anyone can visit', icon: 'globe', active: true },
    { id: 'customer', label: 'Customer accounts', simple: 'Let customers sign in to book or order', icon: 'users', active: false },
    { id: 'team', label: 'Team / member-only pages', simple: 'Restrict pages to staff or members', icon: 'lock', active: false },
  ];

  /* ---------- Integrations (add-ons) ---------- */
  const integrations = [
    { key: 'analytics', name: 'Web Analytics', simple: 'See how many people visit your site', provider: 'PostHog', icon: 'chart', tone: 'primary', status: 'connected', category: 'Insights' },
    { key: 'payments', name: 'Payments', simple: 'Take payments & deposits online', provider: 'Stripe', icon: 'dollar', tone: 'success', status: 'not-started', category: 'Commerce' },
    { key: 'email', name: 'Email delivery', simple: 'Sends form confirmations', provider: 'Resend', icon: 'mail', tone: 'info', status: 'connected', category: 'Forms' },
    { key: 'social', name: 'Social kit', simple: 'Claim handles, bios & first posts', provider: 'Bizia', icon: 'megaphone', tone: 'secondary', status: 'available', category: 'Marketing', route: '/app/social-kit' },
    { key: 'ecards', name: 'Employee e-cards', simple: 'Digital business cards for your team', provider: 'Bizia', icon: 'idcard', tone: 'accent', status: 'available', category: 'Add-ons', route: '/app/ecards' },
    { key: 'leads', name: 'Leads & mini-CRM', simple: 'Track enquiries from your forms', provider: 'Bizia', icon: 'inbox', tone: 'primary', status: 'connected', category: 'Forms', route: '/app/leads' },
    { key: 'maps', name: 'Google Maps', simple: 'Show your location with directions', provider: 'Google', icon: 'pin', tone: 'danger', status: 'connected', category: 'Marketing' },
    { key: 'calendar', name: 'Booking calendar', simple: 'Let visitors book time slots', provider: 'Cal.com', icon: 'calendar', tone: 'info', status: 'not-started', category: 'Commerce' },
  ];

  /* ---------- Recent AI edits ---------- */
  const aiEdits = [
    { id: 'a1', text: 'Made the hero section more premium', when: '2h ago', section: 'Home · Hero', status: 'applied', user: 'Sara' },
    { id: 'a2', text: 'Added an appointment booking form', when: '2h ago', section: 'Reservations', status: 'applied', user: 'Sara' },
    { id: 'a3', text: 'Rewrote the about copy to feel warmer', when: '1d ago', section: 'About', status: 'applied', user: 'You' },
    { id: 'a4', text: 'Added SEO title & meta description to Menu', when: '1d ago', section: 'Menu · SEO', status: 'pending', user: 'You' },
    { id: 'a5', text: 'Generated a contact page with map', when: '3d ago', section: 'Contact', status: 'applied', user: 'Jon' },
  ];

  /* ---------- Website Plan (for AmazeBites) ---------- */
  const recommendation = {
    business: 'AmazeBites Cafe', type: 'Local restaurant',
    summary: 'A fast, mobile-first restaurant website that turns visitors into bookings — with your domain, hosting, SEO and publishing all set up automatically.',
    websiteType: { title: 'Conversion-focused restaurant site', why: 'Most visitors arrive on mobile from Google or Instagram and want the menu, hours, and a way to book fast.' },
    pages: [
      { name: 'Home', need: 'core' }, { name: 'About', need: 'core' }, { name: 'Menu', need: 'core' },
      { name: 'Reservations', need: 'core' }, { name: 'Gallery', need: 'core' }, { name: 'Contact', need: 'core' },
      { name: 'Catering', need: 'recommended' }, { name: 'Blog', need: 'optional' }, { name: 'Customer login', need: 'optional' },
    ],
    template: templates[0],
    design: {
      style: 'Warm & inviting',
      colors: ['#FF8A5B', '#2A2118', '#FBF6EF', '#12B8A6'],
      fonts: ['Fraunde (headings)', 'Geist (body)'],
      cta: 'Lead with “Book a table”, secondary “View menu”, sticky WhatsApp on mobile.',
    },
    seoKeywords: ['brunch cafe san francisco', 'specialty coffee downtown', 'weekend brunch reservations', 'cafe catering sf'],
    domains: [domains[1], domains[0], domains[3]],
    hosting: { provider: 'Cloudflare Pages', cost: '$0/mo', why: 'Fast global delivery with automatic SSL and a generous free tier.' },
    features: [
      { key: 'forms', label: 'Contact & reservation forms', need: 'recommended', icon: 'mail' },
      { key: 'seo', label: 'SEO + sitemap + robots.txt', need: 'core', icon: 'search' },
      { key: 'gsc', label: 'Google Search Console setup', need: 'core', icon: 'google' },
      { key: 'auth', label: 'Customer login', need: 'optional', icon: 'lock' },
      { key: 'payments', label: 'Online payments', need: 'optional', icon: 'dollar' },
    ],
    infraCost: 0, domainCost: 12, biziaPlan: plans[2], buildTime: '~2 min',
  };

  /* ---------- Prompt-to-website example (Create Website screen) ---------- */
  const createExample = {
    prompt: 'I run a dental clinic in Newark. Make me a modern website with services, appointment form, insurance info, location, reviews, and a contact page.',
    examples: [
      'A modern dental clinic in Newark with appointment booking',
      'A cozy brunch cafe with online reservations and a menu',
      'A real-estate agent site with listings and a contact form',
      'A coaching business with programs, testimonials and booking',
    ],
    plan: {
      name: 'BrightSmile Dental', type: 'Dental clinic', location: 'Newark, NJ',
      structure: [
        { name: 'Home', desc: 'Hero, trust badges, quick links', icon: 'home' },
        { name: 'Services', desc: 'Treatments with descriptions & prices', icon: 'grid' },
        { name: 'About', desc: 'Team, clinic story, credentials', icon: 'info' },
        { name: 'Insurance', desc: 'Accepted plans & payment options', icon: 'shield' },
        { name: 'Reviews', desc: 'Patient testimonials & ratings', icon: 'star' },
        { name: 'Appointments', desc: 'Booking form with date & time', icon: 'calendar' },
        { name: 'Location', desc: 'Map, hours & directions', icon: 'pin' },
        { name: 'Contact', desc: 'Phone, email & contact form', icon: 'mail' },
      ],
      style: 'Clean & modern', colors: ['#0EA5E9', '#0B3B5C', '#F4F9FC', '#12B8A6'],
      fonts: ['Plus Jakarta Sans (headings)', 'Geist (body)'],
      template: templates[2],
      domains: [
        { name: 'brightsmilenewark.com', price: 12, badge: 'Best brand name', badgeTone: 'secondary' },
        { name: 'brightsmile.clinic', price: 22, badge: 'Exact match', badgeTone: 'primary' },
        { name: 'newarkdental.co', price: 28, badge: 'Shortest', badgeTone: 'info' },
      ],
      features: ['Appointment form', 'Insurance info', 'Google Maps', 'Patient reviews', 'SEO + sitemap', 'Google Search Console'],
      cost: { infra: '$0/mo', domain: '$12/yr', plan: 'Growth — $49/mo' },
    },
  };

  /* ---------- Wizard option sets ---------- */
  const wizard = {
    types: [
      { id: 'restaurant', label: 'Restaurant / Cafe', icon: 'briefcase', desc: 'Menu, bookings & catering' },
      { id: 'service', label: 'Local service', icon: 'home', desc: 'Quotes & enquiries' },
      { id: 'clinic', label: 'Clinic / Health', icon: 'shield', desc: 'Appointments & services' },
      { id: 'coaching', label: 'Coaching', icon: 'trendUp', desc: 'Programs & 1:1 booking' },
      { id: 'realestate', label: 'Real estate', icon: 'home', desc: 'Listings & leads' },
      { id: 'agency', label: 'Agency / Studio', icon: 'zap', desc: 'Portfolio & contact' },
      { id: 'school', label: 'School / Academy', icon: 'star', desc: 'Programs & enrolment' },
      { id: 'shop', label: 'Online shop', icon: 'grid', desc: 'Products & payments' },
    ],
    goals: [
      { id: 'bookings', label: 'Get more bookings', icon: 'calendar', desc: 'Reservations & appointments' },
      { id: 'leads', label: 'Collect enquiries', icon: 'inbox', desc: 'Contact & quote forms' },
      { id: 'sell', label: 'Sell online', icon: 'dollar', desc: 'Take payments' },
      { id: 'inform', label: 'Just an online presence', icon: 'globe', desc: 'A simple, credible site' },
    ],
    features: [
      { id: 'leads', label: 'Lead inbox', simple: 'Collect enquiries from your site', icon: 'inbox', rec: true },
      { id: 'whatsapp', label: 'WhatsApp button', simple: 'Let customers message instantly', icon: 'whatsapp', rec: true },
      { id: 'booking', label: 'Online booking', simple: 'Take reservations or appointments', icon: 'calendar', rec: true },
      { id: 'menu', label: 'Menu / catalog', simple: 'Show what you offer', icon: 'grid', rec: true },
      { id: 'gallery', label: 'Photo gallery', simple: 'Show off your space & work', icon: 'image', rec: false },
      { id: 'payments', label: 'Online payments', simple: 'Take deposits or sell online', icon: 'dollar', rec: false },
      { id: 'login', label: 'Customer login', simple: 'Accounts for your customers', icon: 'lock', rec: false },
      { id: 'blog', label: 'Blog / updates', simple: 'Share news & posts', icon: 'edit', rec: false },
    ],
    designs: [
      { id: 'warm', label: 'Warm & inviting', desc: 'Earthy tones, friendly', swatch: ['#FF8A5B', '#FFB454', '#F4EDE4'] },
      { id: 'clean', label: 'Clean & modern', desc: 'Crisp, minimal, premium', swatch: ['#5B5CFF', '#111827', '#F7F8FC'] },
      { id: 'fresh', label: 'Fresh & natural', desc: 'Greens, calm, organic', swatch: ['#12B8A6', '#0E8C7E', '#E9FBF7'] },
      { id: 'bold', label: 'Bold & energetic', desc: 'High contrast, vivid', swatch: ['#111827', '#FFB454', '#FF8A5B'] },
    ],
  };

  window.DATA = {
    projects, templates, templateCategories, templateFeatures, domains, leads, leadStages,
    employees, social, socialBios, postIdeas, infrastructure, plans, addons, analytics,
    checklist, aiEdits, recommendation, wizard, createExample,
    pages, sections, design, seo, hostingOptions, deployment, domainMapping, forms, authOptions, integrations,
  };
  window.fmt = { money, k };
})();
