/* social-data.jsx: Social constants (statuses, roles, default pillars) ported from Plan Social. The demo seed data is not used. */
(function () {
/* social-data.jsx — seed data, constants, localStorage helpers */
const _SSD_KEY = "social_planner_state_v2";

const _STATUS = {
  draft:  { key:'draft',  label:'Draft',         color:'#5A6473', bg:'#EDF1F7', dot:'#94A3B8' },
  needs:  { key:'needs',  label:'Needs Edit',    color:'#B45309', bg:'#FCEEDA', dot:'#F59E0B' },
  ready:  { key:'ready',  label:'Ready to Post', color:'#15803D', bg:'#E3F5E9', dot:'#22C55E' },
  posted: { key:'posted', label:'Posted',        color:'var(--b-primary)', bg:'var(--b-wash)', dot:'var(--b-primary)' },
};

const _STATUS_ORDER = ['draft','needs','ready','posted'];

/* Read   = view only (default for all members)
   Write  = generate AI + edit captions/briefs/images; can only toggle Draft <-> Needs Edit
   Action = Write + advance to Ready to Post, Publish, Mark Posted
            (publish/markPosted go to pendingAction awaiting Admin confirmation
            unless the actor is Admin - see isAdminAuthority in app.jsx)
   Admin  = Action + campaign setup + Team Roles + confirms Action's pending posts */
const _CAPS = {
  Read:   { view:true },
  Write:  { view:true, generate:true, edit:true },
  Action: { view:true, generate:true, edit:true, approve:true },
  Admin:  { view:true, generate:true, edit:true, approve:true, setup:true },
};

const _ROLES = ['Read','Write','Action','Admin'];

/* ── shared club members (roles are per-campaign in memberRoles) ─────────── */
const _MEMBERS = [
  { id:'u1', name:'Sam Whitfield',  initials:'SW', avatarColor:'#17458F' },
  { id:'u2', name:'Priya Nair',     initials:'PN', avatarColor:'#0E7490' },
  { id:'u3', name:'Tom Beck',       initials:'TB', avatarColor:'#B7791F' },
  { id:'u4', name:'Jess Lansdowne', initials:'JL', avatarColor:'#BE185D' },
];

/* ── default blank questionnaire shape — spread onto every pillar so the
   Setup UI always has a consistent shape to render, whether or not it's
   been filled in. Blank fields are a no-op for the AI prompt builder. ── */
const _BLANK_Q = () => ({ facts:'', hook:'', subEntities:'', cta:'', toneNote:'', deadline:'', avoid:'', sourceDocIds:[] });

/* ── default pillar set for a newly-approved campaign — used at approval time
   (firebase.jsx), not request time, since a campaign request only carries a
   name. Exported so both the demo and live stores can build the same starting
   scaffold without duplicating this list. ── */
const _DEFAULT_PILLARS = () => ([
  { id:'p_event',   label:'About the Event',    color:'#17458F',bg:'#E7EEF8', description:'', timing:[], questionnaire:_BLANK_Q() },
  { id:'p_support', label:'Community Impact',   color:'#0E7490',bg:'#DEF1F4', description:'', timing:[], questionnaire:_BLANK_Q() },
  { id:'p_tips',    label:'How to Get Involved',color:'#6D28D9',bg:'#EDE7FB', description:'', timing:[], questionnaire:_BLANK_Q() },
  { id:'p_story',   label:'Stories',            color:'#C2410C',bg:'#FAE7DB', description:'', timing:[], questionnaire:_BLANK_Q() },
]);

/* ── club-level brand kit (clubs/{clubId}.brandKit) — set once, reused by
   every campaign. Multi-tenant: each club document carries its own. ── */
const _BLANK_BRAND_KIT = () => ({
  logoUrl:'', logoName:'',
  primaryColor:'#17458F', secondaryColor:'#F7A81B',
  toneWords:'', standardHashtags:'', signOff:'', avoidWords:'',
});

/* ── per-campaign branding override — most campaigns just inherit the club
   brand kit (primary:'club'). An event with its own identity (e.g. a named
   fun run) can flip primary:'event' and describe in usageNote where the
   club brand should still appear, rather than the app trying to encode
   every placement rule itself. ── */
const _BLANK_BRANDING = () => ({
  primary:'club', // 'club' | 'event'
  eventLogoUrl:'', eventLogoName:'',
  eventPrimaryColor:'', eventSecondaryColor:'',
  usageNote:'',
});

/* ── campaign 1: Fun Run ─────────────────────────────────────────────────── */
/* NOTE 2026-08-05: rebuilt against Files/Fun Run Summary Document.docx — the
   prior seed (Jul 2026 date, 2/5km, Friends of Seaford Wetlands / Peninsula
   Health Foundation beneficiaries, Bendigo Bank/Bayside Toyota/Coastal Real
   Estate sponsors) was placeholder data that never matched the real event.
   "Aiden Graham" is a business despite the person-like name — confirmed
   2026-08-05, included as a sponsor below. */
const _C1 = {
  id: 'c_funrun',
  memberRoles: { u1:'Admin', u2:'Action', u3:'Write', u4:'Read' },
  config: {
    eventName:     'Seaford Wetlands Fun Run & Walk',
    facebookPage:     'Seaford Wetlands Fun Run & Walk',
    facebookPageId:   '',
    exclusions:       [],
    campaignStart:    '2026-09-28',
    webhookUrl:       'https://n8n.trackitonline.com/webhook/social-planner',
    facebookPushUrl:  'https://n8n.trackitonline.com/webhook/facebook-post-approve',
    eventWebsite:     'https://wetlandsfunrun.com.au',
    moreInfo: "Seaford Wetlands Fun Run & Walk — presented by Rotary Peninsula 2.0 and Seaford Little Athletics Club, 100% volunteer-run, 100% of profits to community/Rotary-approved projects. Tagline: 'Enjoy Environment & Community.' Core cause: local mental health support (Kindred Clubhouse, It's Okay Not to be Okay), plus Team Sports for All, Seaford Little Athletics, SES and Rotary Community Programs. Sunday 29 November 2026, approx. 8:30–10:30am, Seaford Wetlands. Distances: 2km Children's Run, 5km Run/Walk, 10km Run. Tone: warm, plain-spoken, community-run — never 'race' or corporate/elite framing. No invented statistics; if a figure isn't confirmed, describe it generically instead.",
    moreInfoDocs:     [],
    /* Worked example: the Fun Run has its own identity and leads on every graphic;
       the club brand kit (Rotary Peninsula 2.0) is deliberately secondary here —
       see usageNote for exactly where it still has to appear. */
    branding: {
      primary:'event',
      eventLogoUrl:'', eventLogoName:'',
      /* Confirmed 2026-08-14 against the live site (wetlandsfunrun.com.au) —
         gold header background + orange CTA accent. Replaces earlier
         placeholder teal/green that never matched the real site. */
      eventPrimaryColor:'#FFD13A', eventSecondaryColor:'#FAAA2F',
      usageNote:"Wetlands Fun Run branding leads on every post and graphic — its own logo and colours, not Rotary Peninsula's. Rotary Peninsula 2.0 and Seaford Little Athletics Club logos appear together, smaller, in the footer/sign-off of every graphic — and are the only logos shown on the launch announcement post and on sponsor thank-you posts (those two need the presenting clubs visible, not just the event brand).",
    },
    preferredDays: [1, 4],
    beneficiaries: [
      { id:'b1', name:'Kindred Clubhouse',              url:'', about:'Mental health support — one of three charities entrants can choose to fundraise for at signup; also a beneficiary of overall event profits.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'b2', name:"It's Okay Not to be Okay",       url:'', about:'Mental health awareness — direct-fundraising charity choice and profit-split beneficiary.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'b3', name:'Team Sports for All',            url:'', about:'Supports disadvantaged youth into community sports — direct-fundraising charity choice and profit-split beneficiary.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'b4', name:'Seaford Little Athletics Club',  url:'', about:'Event co-organiser and profit-split beneficiary.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'b5', name:'State Emergency Service (SES)',  url:'', about:'Profit-split beneficiary — local emergency response capability.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'b6', name:'Rotary Community Programs',      url:'', about:'Profit-split beneficiary — disaster relief, youth programs and domestic violence prevention initiatives.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
    ],
    sponsors: [
      { id:'s1', name:'Hyundai',              url:'', about:'Corporate partner — 2026 sponsorship tier to be confirmed.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'s2', name:'Aiden Graham',         url:'', about:'Corporate partner — 2026 sponsorship tier to be confirmed.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'s3', name:'Williamson Tyreco',    url:'', about:'Corporate partner — 2026 sponsorship tier to be confirmed.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'s4', name:'Central Dental',       url:'', about:'Corporate partner — 2026 sponsorship tier to be confirmed.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
      { id:'s5', name:'Exact Solutions',      url:'', about:'Corporate partner — 2026 sponsorship tier to be confirmed.', docUrl:'', docName:'', logoUrl:'', logoName:'' },
    ],
    referenceDocs: [
      { id:'rd1', name:'Wetlands Fun Run — Official Website', url:'https://wetlandsfunrun.com.au', docUrl:'', docName:'', pillarId:'', note:'Anchor voice + current event details — treat as more current than any prior-year sponsorship letter.', verifiedDate:'2026-08-05' },
      { id:'rd2', name:'2026 Event Summary Document', url:'', docUrl:'', docName:'', pillarId:'', note:'Master reference for beneficiary split, award prizes, fees and sponsorship tiers — currently held in Files/ locally, upload here once it lives in Drive/WorkDrive.', verifiedDate:'' },
    ],
    pillars: [
      { id:'p_about',     label:'About the Event & Organisers',      color:'#17458F', bg:'#E7EEF8',
        description:'What/why/where the Fun Run is, and its Rotary Peninsula 2.0 / Seaford Little Athletics Club partnership.',
        timing:['early','spread'], questionnaire:_BLANK_Q() },
      { id:'p_reg',       label:'Registration & Pricing',            color:'#B45309', bg:'#FCEEDA',
        description:'Entry fees, family bundle, and the Early Bird cutoff (5pm 1 November 2026).',
        timing:['early','near'], questionnaire:_BLANK_Q() },
      { id:'p_formats',   label:'Event Formats & Distances',         color:'#0E7490', bg:'#DEF1F4',
        description:"2km Children's Run, 5km Run/Walk, 10km Run, and age categories.",
        timing:['mid'], questionnaire:_BLANK_Q() },
      { id:'p_benefit',   label:'Beneficiary Impact',                color:'#BE185D', bg:'#FAE5EE',
        description:'Where the money goes — Kindred Clubhouse, It’s Okay Not to be Okay, Team Sports for All, Seaford Little Athletics, SES, Rotary Community Programs.',
        timing:['early','mid','spread'],
        questionnaire:{
          facts:"Net profits split across 6 orgs: Kindred Clubhouse, It's Okay Not to be Okay, Team Sports for All, Seaford Little Athletics Club, SES, Rotary Community Programs (disaster relief/youth/domestic violence prevention). Entrants can also choose ONE of Kindred Clubhouse / It's Okay Not to be Okay / Team Sports for All as their personal fundraising charity at signup. Source: 2026 Event Summary Document §3.",
          hook:"The run funds two things at once — a personal charity pick at signup, and a 6-way community split from net profits. Pick ONE org per post, don't list all six.",
          subEntities:"Kindred Clubhouse (mental health)\nIt's Okay Not to be Okay (mental health awareness)\nTeam Sports for All (disadvantaged youth into sport)\nSeaford Little Athletics Club\nSES (State Emergency Service)\nRotary Community Programs (disaster relief, youth programs, domestic violence prevention)",
          cta:"Register / choose this charity at signup",
          toneNote:"Sincere and specific — grounded in what the support actually does, not brand-adjacent language.",
          deadline:'',
          avoid:"Don't state a specific dollar amount going to any one beneficiary — the profit split isn't a fixed published amount per org. Don't imply Kindred Clubhouse is the only cause — it's the headline cause but not the sole one.",
          sourceDocIds:['rd2'],
        } },
      { id:'p_tips',      label:'Prep & Running Tips',               color:'#6D28D9', bg:'#EDE7FB',
        description:'Training, hydration, footwear and wetlands-trail advice for run or walk.',
        timing:['mid'], questionnaire:_BLANK_Q() },
      { id:'p_included',  label:"What's Included",                   color:'#15803D', bg:'#E3F5E9',
        description:'Medal, snacks and age-category trophies (U17, 17–34, 35–54, 55+).',
        timing:['mid','near'], questionnaire:_BLANK_Q() },
      { id:'p_teams',     label:'Family & Team Registration',        color:'#4338CA', bg:'#E7E5FB',
        description:'How families and teams enter together.',
        timing:['mid'], questionnaire:_BLANK_Q() },
      { id:'p_awards',    label:'Awards & Fundraising Incentives',   color:'#C2410C', bg:'#FAE7DB',
        description:'Team Total Distance, Highest Average Donation, Best Dressed prizes, and the live donation leaderboard.',
        timing:['near','spread'],
        questionnaire:{
          facts:"Team Total Distance Award $250 (highest combined km). Highest Average Donation $150 — Family Groups or Registered Teams only, total extra funds raised ÷ members. Best Dressed Individual ~$50 voucher. Best Dressed Group (Family/Team) ~$100 voucher. A live donation leaderboard is publicly visible. Source: 2026 Event Summary Document §4.",
          hook:"Highest Average Donation rewards small enthusiastic groups just as much as big teams — good angle for families who think 'we're too small to place.'",
          subEntities:"Team Total Distance ($250)\nHighest Average Donation, Family/Team ($150)\nBest Dressed Individual (~$50 voucher)\nBest Dressed Group, Family/Team (~$100 voucher)\nLive donation leaderboard",
          cta:"Register your team / check the leaderboard",
          toneNote:"Playful and competitive — the one pillar where more energy fits.",
          deadline:'Push hardest in the final 2 weeks before 29 November 2026.',
          avoid:"Don't confuse 'Highest Average Donation' with a raw fundraising total — it's explicitly divided by group size.",
          sourceDocIds:['rd2'],
        } },
      { id:'p_sponsor',   label:'Sponsors',                          color:'#B7791F', bg:'#FAEFD4',
        description:'Thanking Principal, Sponsor and Supporter tier partners.',
        timing:['spread'], questionnaire:_BLANK_Q() },
      { id:'p_volunteer', label:'Volunteers',                        color:'#0F766E', bg:'#DFF3F0',
        description:'Recognising and recruiting the volunteers who run the event.',
        timing:['spread'], questionnaire:_BLANK_Q() },
    ],
  },
  weeks: [
    { id:'w0', idx:0, pillarId:'p_about',     postsPerWeek:2, topicAndAngle:'Launch announcement — date, distances, location and how to enter', referenceUrl:'https://wetlandsfunrun.com.au' },
    { id:'w1', idx:1, pillarId:'p_reg',       postsPerWeek:2, topicAndAngle:'Entry fees, family bundle and the Early Bird cutoff (5pm 1 November 2026)', referenceUrl:'https://wetlandsfunrun.com.au' },
    { id:'w2', idx:2, pillarId:'p_benefit',   postsPerWeek:2, topicAndAngle:'Meet Kindred Clubhouse — one of three charities you can fundraise for at signup', referenceUrl:'' },
    { id:'w3', idx:3, pillarId:'p_formats',   postsPerWeek:2, topicAndAngle:"Course guide: 2km Children's Run, 5km Run/Walk, 10km Run — plus what's included", referenceUrl:'https://wetlandsfunrun.com.au' },
    { id:'w4', idx:4, pillarId:'p_tips',      postsPerWeek:2, topicAndAngle:'Race-day prep: hydration, footwear and wetlands-trail conditions', referenceUrl:'' },
    { id:'w5', idx:5, pillarId:'p_teams',     postsPerWeek:2, topicAndAngle:'Enter as a family or team — how it works', referenceUrl:'' },
    { id:'w6', idx:6, pillarId:'p_sponsor',   postsPerWeek:2, topicAndAngle:'Thank you to our Principal Partner sponsors', referenceUrl:'' },
    { id:'w7', idx:7, pillarId:'p_volunteer', postsPerWeek:2, topicAndAngle:'Meet the volunteers who make race day happen', referenceUrl:'' },
    { id:'w8', idx:8, pillarId:'p_awards',    postsPerWeek:2, topicAndAngle:'Final week — leaderboard update, Best Dressed and fundraising prizes', referenceUrl:'' },
  ],
  posts: [
    { id:'p0a', weekId:'w0', postNo:1, dayOffset:1, status:'posted', updatedBy:'Sam Whitfield',
      draftCaption:"🌿 SAVE THE DATE! The Seaford Wetlands Fun Run & Walk is back on Sunday 29 November 2026. Presented by Rotary Peninsula 2.0 and Seaford Little Athletics Club, it's a morning of running, walking and community along the Seaford Wetlands boardwalk. Choose your distance — 2km, 5km or 10km. Entries are open now at wetlandsfunrun.com.au. 🏃 Who's in? #WetlandsFunRun #RotaryPeninsula",
      mediaBrief:"Wide shot of the wetlands boardwalk at sunrise, warm natural light. Overlay event date. Landscape 1200×630.", mediaFileLink:"", reviewerNotes:'' },
    { id:'p0b', weekId:'w0', postNo:2, dayOffset:4, status:'posted', updatedBy:'Priya Nair',
      draftCaption:"🤝 Two local groups, one great morning. The Wetlands Fun Run & Walk is proudly run by volunteers from Rotary Peninsula 2.0 and Seaford Little Athletics Club — 100% volunteer-powered, with all profits going straight back into community projects. Sunday 29 November, Seaford Wetlands. More at wetlandsfunrun.com.au #WetlandsFunRun",
      mediaBrief:"Group photo of Rotary + Little Athletics volunteers together, casual and candid. Square 1080×1080.", mediaFileLink:"", reviewerNotes:'' },
    { id:'p1a', weekId:'w1', postNo:1, dayOffset:1, status:'ready', updatedBy:'Tom Beck',
      draftCaption:"🎟️ Early Bird pricing is open! Adult entry $45, Child (17 & under) $30, or bring the whole crew with a Family entry (2 adults + 4 children) for $120 — all before prices rise on 1 November. Register now for the 2km, 5km or 10km at wetlandsfunrun.com.au. See you Sunday 29 November! #WetlandsFunRun",
      mediaBrief:"Clean pricing graphic in event brand colours, simple and readable. Square 1080×1080.", mediaFileLink:"", reviewerNotes:'' },
    { id:'p1b', weekId:'w1', postNo:2, dayOffset:4, status:'ready', updatedBy:'Tom Beck',
      draftCaption:"👨‍👩‍👧‍👦 Bring the whole family! Our Family entry covers 2 adults and 4 children for one flat price — Early Bird rate ends 5pm, 1 November 2026. Walk it, run it, just show up together. Entries at wetlandsfunrun.com.au 💙 #WetlandsFunRun",
      mediaBrief:"Candid photo of a family finishing together, smiling, medals on. Square 1080×1080.", mediaFileLink:"", reviewerNotes:'' },
    { id:'p2a', weekId:'w2', postNo:1, dayOffset:1, status:'needs', updatedBy:'Tom Beck',
      draftCaption:"💙 Why we run: every entry supports local mental health initiatives, with Kindred Clubhouse as one of the causes you can choose to fundraise for at signup. It's a simple way to turn a Sunday morning into real support for your community. Register at wetlandsfunrun.com.au #WetlandsFunRun",
      mediaBrief:"Candid photo of Kindred Clubhouse representatives or a related community moment. Warm and friendly. Square 1080×1080.", mediaFileLink:"", reviewerNotes:"Good tone — can we also mention It's Okay Not to be Okay and Team Sports for All as the other two charity choices, so it doesn't read like Kindred Clubhouse is the only option? — Sam" },
    { id:'p2b', weekId:'w2', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p3a', weekId:'w3', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p3b', weekId:'w3', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p4a', weekId:'w4', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p4b', weekId:'w4', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p5a', weekId:'w5', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p5b', weekId:'w5', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p6a', weekId:'w6', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p6b', weekId:'w6', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p7a', weekId:'w7', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p7b', weekId:'w7', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p8a', weekId:'w8', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'p8b', weekId:'w8', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
  ],
};

/* ── campaign 2: Christmas Hamper Drive ──────────────────────────────────── */
const _C2 = {
  id: 'c_hamper',
  memberRoles: { u1:'Admin', u2:'Read', u3:'Read', u4:'Read' },
  config: {
    eventName:     'Christmas Hamper Drive',
    facebookPage:     'Rotary Club of Seaford',
    facebookPageId:   '',
    exclusions:       [],
    campaignStart:    '2026-10-05',
    webhookUrl:       '',
    facebookPushUrl:  '',
    preferredDays: [1, 4],
    branding: _BLANK_BRANDING(),
    beneficiaries: [
      { id:'b1', name:'Seaford Peninsula Foodbank', url:'' },
    ],
    sponsors: [],
    pillars: [
      { id:'p_news',    label:'Campaign News',    color:'#17458F', bg:'#E7EEF8' },
      { id:'p_impact',  label:'Community Impact', color:'#0E7490', bg:'#DEF1F4' },
      { id:'p_donor',   label:'Donor Thanks',     color:'#B7791F', bg:'#FAEFD4' },
      { id:'p_howto',   label:'How to Help',      color:'#6D28D9', bg:'#EDE7FB' },
    ],
  },
  weeks: [
    { id:'hw0', idx:0, pillarId:'p_news',   postsPerWeek:2, topicAndAngle:'Launch — collection points, donation drive dates and how to get involved', referenceUrl:'' },
    { id:'hw1', idx:1, pillarId:'p_impact',  postsPerWeek:2, topicAndAngle:'Spotlight on the families we support this Christmas', referenceUrl:'' },
    { id:'hw2', idx:2, pillarId:'p_howto',   postsPerWeek:2, topicAndAngle:'How to donate — drop-off locations and what to include in a hamper', referenceUrl:'' },
    { id:'hw3', idx:3, pillarId:'p_donor',   postsPerWeek:2, topicAndAngle:'', referenceUrl:'' },
  ],
  posts: [
    { id:'hp0a', weekId:'hw0', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp0b', weekId:'hw0', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp1a', weekId:'hw1', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp1b', weekId:'hw1', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp2a', weekId:'hw2', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp2b', weekId:'hw2', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp3a', weekId:'hw3', postNo:1, dayOffset:1, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
    { id:'hp3b', weekId:'hw3', postNo:2, dayOffset:4, status:'draft', updatedBy:'', draftCaption:'', mediaBrief:'', mediaFileLink:'', reviewerNotes:'' },
  ],
};

/* ── top-level state seed ────────────────────────────────────────────────── */
const _SEED = {
  currentUserId:    'u1',
  currentCampaignId:'c_funrun',
  clubName:         'Rotary Club of Seaford',
  clubBrandKit: {
    ..._BLANK_BRAND_KIT(),
    toneWords:'Warm, plain-spoken, community-run',
    standardHashtags:'#RotaryPeninsula',
    signOff:'— Rotary Peninsula 2.0',
    avoidWords:"Don't call any fundraising event a 'race' unless it's genuinely competitive. Don't state a dollar figure that hasn't been confirmed in writing.",
  },
  members:          _MEMBERS,
  campaigns:        [_C1, _C2],
  /* Social Media Planner's own Super Admin list — independent of Project Planner's
     superAdmins. Max 3, managed from the header. Sam Whitfield (u1) seeded first. */
  socialSuperAdmins: ['u1'],
  socialInvitations: [],
  /* UI state — shared across campaign switches */
  tab:          'planner',
  plannerView:  'table',
  expanded:     {},
  collapsed:    {},
  filterStatus: 'all',
  filterPillar: 'all',
  filterWeek:   'all',
};

/* ── mock AI data (keyed by pillar id) ──────────────────────────────────── */
const _GEN = {
  /* generic fallback — used when a campaign's pillar id has no dedicated entry below
     (e.g. a brand-new campaign, or the Hamper campaign's own pillar set) */
  p_event:     { caption:"📣 Save the date and spread the word — full details and how to get involved are coming soon. Stay tuned! #GetInvolved", brief:"Simple announcement graphic in your campaign's brand colours. Square 1080×1080." },
  p_about:     { caption:"📣 Save the date! The Seaford Wetlands Fun Run & Walk is back on Sunday 29 November 2026. Presented by Rotary Peninsula 2.0 and Seaford Little Athletics Club, pick your challenge — 2km, 5km or 10km along the Seaford Wetlands boardwalk. Entries are open now at wetlandsfunrun.com.au. 🎟️ Tag the mate you're dragging along! #WetlandsFunRun #RotaryPeninsula", brief:"Wide sunrise photo of the boardwalk with a couple of runners. Add event date + 'Entries Open' overlay. Landscape 1200×630." },
  p_reg:       { caption:"🎟️ Early Bird entries are open! Adult $45, Child (17 & under) $30, Family (2 adults + 4 children) $120 — all before prices rise on 1 November. Grab yours at wetlandsfunrun.com.au and lock in the lower rate. #WetlandsFunRun", brief:"Clean pricing graphic in event brand colours, simple and readable. Square 1080×1080." },
  p_formats:   { caption:"🏃 Which distance is yours? A 2km run for the kids, a 5km run or walk for everyone, or a 10km for the ones chasing a real challenge. All on the Seaford Wetlands trail. Pick yours at wetlandsfunrun.com.au #WetlandsFunRun", brief:"Simple map/graphic showing the three distance loops. Square 1080×1080." },
  p_benefit:   { caption:"💙 Where does your entry fee go? The Fun Run & Walk supports Kindred Clubhouse, It's Okay Not to be Okay and Team Sports for All — plus Seaford Little Athletics, SES and Rotary Community Programs. When you run, you give back. Be part of it on Sunday 29 November. 🔗 Entries at wetlandsfunrun.com.au #WetlandsFunRun", brief:"Candid photo of a beneficiary organisation's volunteers or program in action. Warm and friendly. Square 1080×1080." },
  p_tips:      { caption:"👟 Race-day ready in 3 steps: 1️⃣ Hydrate the day before, not just on the morning. 2️⃣ Wear shoes you've already broken in. 3️⃣ Arrive 30 minutes early to soak up the start-line buzz. See you Sunday 29 November! #WetlandsFunRun", brief:"Flat-lay of running shoes, water bottle, cap and race bib on timber decking. Bright and clean. Square 1080×1080." },
  p_included:  { caption:"🥇 Every finisher takes home a medal and race-day snacks — plus we're awarding trophies across four age categories: U17, 17–34, 35–54 and the new 55+ category. Sunday 29 November, Seaford Wetlands. #WetlandsFunRun", brief:"Flat-lay of the event medal and a snack pack. Bright and clean. Square 1080×1080." },
  p_teams:     { caption:"👨‍👩‍👧‍👦 Enter as a family or pull together a team — the Fun Run & Walk is more fun with company. Register everyone in one go at wetlandsfunrun.com.au and see you Sunday 29 November! #WetlandsFunRun", brief:"Candid photo of a family or team group finishing together, smiling. Square 1080×1080." },
  p_awards:    { caption:"🏆 Final stretch! Don't forget: $250 for the Team Total Distance award, $150 for Highest Average Donation (Family/Team), and vouchers for Best Dressed Individual and Group. Check the live leaderboard now at wetlandsfunrun.com.au #WetlandsFunRun", brief:"Energetic graphic listing the four award categories in event brand colours. Square 1080×1080." },
  p_sponsor:   { caption:"🙏 A huge THANK YOU to our 2026 Fun Run sponsors — local business backing local people, that's how community works. Sunday 29 November, Seaford Wetlands. #WetlandsFunRun", brief:"Sponsor logo card in event brand colours, or a photo of a partner business team. Square 1080×1080." },
  p_volunteer: { caption:"👋 None of this happens without our volunteers — marshalling the course, running registration, keeping the water stations flowing. Thank you for making Sunday 29 November possible. #WetlandsFunRun", brief:"Group portrait of volunteers in hi-vis on the boardwalk. Square 1080×1080." },
};

const _GEN2 = {
  p_tips: "👟 Getting race-ready is easier than you think! Hydrate the day before, slip on shoes you've already walked in, and arrive about 30 minutes early to enjoy the start-line buzz. 🎟️ Register now at wetlandsfunrun.com.au — see you Sunday 29 November! #WetlandsFunRun",
};

const _TOPICS = {
  /* generic fallback — mirrors the _GEN fallback above */
  p_event: [
    { topic:"Launch announcement — key dates and how to get involved", url:"" },
    { topic:"Why this campaign matters — the cause in one sentence",   url:"" },
    { topic:"How to help — the simplest first step for a supporter",   url:"" },
  ],
  p_about: [
    { topic:"Course reveal — the full boardwalk route, start line and finish-line area",                url:"https://wetlandsfunrun.com.au" },
    { topic:"Why Rotary Peninsula 2.0 and Seaford Little Athletics Club run this together",              url:"https://wetlandsfunrun.com.au" },
    { topic:"What makes the Seaford Wetlands setting different from a generic fun run",                  url:"" },
  ],
  p_reg: [
    { topic:"Early Bird pricing breakdown — Adult/Child/Family, and the 1 November cutoff",              url:"https://wetlandsfunrun.com.au" },
    { topic:"How to register — online entry walkthrough",                                                url:"https://wetlandsfunrun.com.au" },
    { topic:"Family entry spotlight — 2 adults + 4 children for one flat price",                         url:"" },
  ],
  p_formats: [
    { topic:"2km Children's Run — what to expect for younger entrants",                                  url:"" },
    { topic:"5km Run/Walk — why it suits both first-timers and regulars",                                url:"" },
    { topic:"10km Run — for the ones chasing a real challenge",                                          url:"" },
  ],
  p_benefit: [
    { topic:"Spotlight on Kindred Clubhouse and what mental health support looks like locally",          url:"" },
    { topic:"It's Okay Not to be Okay — raising awareness alongside the fundraising",                    url:"" },
    { topic:"Team Sports for All — helping disadvantaged youth into community sport",                    url:"" },
  ],
  p_tips: [
    { topic:"A beginner's plan for tackling the 5km — walk, run, or a mix of both",                      url:"" },
    { topic:"What to bring on the day — wetlands-trail conditions, footwear, hydration",                 url:"" },
    { topic:"Race-day kit list: what to pack and what not to forget",                                    url:"" },
  ],
  p_included: [
    { topic:"Every finisher gets a medal — a look at this year's design",                                url:"" },
    { topic:"Snack stations along the course and at the finish line",                                    url:"" },
    { topic:"New for 2026 — trophies across four age categories including 55+",                          url:"" },
  ],
  p_teams: [
    { topic:"How team registration works — sign up together in one go",                                  url:"" },
    { topic:"Family entry explained — 2 adults + 4 children, one price",                                 url:"" },
    { topic:"Rally your workplace or club into a team for race day",                                     url:"" },
  ],
  p_awards: [
    { topic:"Team Total Distance Award — $250 for the highest combined kilometres",                      url:"" },
    { topic:"Highest Average Donation — why small teams have just as good a shot at $150",               url:"" },
    { topic:"Best Dressed Individual and Group — vouchers up for grabs",                                 url:"" },
  ],
  p_sponsor: [
    { topic:"Introducing our Principal Partner sponsors for 2026",                                       url:"" },
    { topic:"Local business backing local people — why sponsors get involved",                           url:"" },
    { topic:"Behind the scenes: how sponsorship helps make race day possible",                           url:"" },
  ],
  p_volunteer: [
    { topic:"Meet the marshals keeping the course safe on race day",                                     url:"" },
    { topic:"Behind the registration desk — volunteers on race morning",                                 url:"" },
    { topic:"Why volunteers come back year after year",                                                  url:"" },
  ],
};

const _DAY_NAMES = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];

/* ── localStorage helpers ────────────────────────────────────────────────── */
function _loadState() {
  try {
    const raw = localStorage.getItem(_SSD_KEY);
    if (raw) return { ..._SEED, ...JSON.parse(raw) };
  } catch (e) {}
  return _SEED;
}

function _saveState(s) {
  try {
    localStorage.setItem(_SSD_KEY, JSON.stringify(s));
  } catch (e) {}
}

window.SocialData = {
  STATUS:       _STATUS,
  STATUS_ORDER: _STATUS_ORDER,
  CAPS:         _CAPS,
  ROLES:        _ROLES,
  defaultPillars: _DEFAULT_PILLARS,
  blankBranding:  _BLANK_BRANDING,
  GEN:          _GEN,
  GEN2:         _GEN2,
  TOPICS:       _TOPICS,
  DAY_NAMES:    _DAY_NAMES,
  SEED:         _SEED,
  loadState:    _loadState,
  saveState:    _saveState,
};

})();
