// Per-role configuration: description, pills, process steps, events, conversations, runs, findings.

const ROLE_CONFIG = {
  pm: {
    description: "A Product Manager owns the strategic evolution of a product — identifying valuable opportunities, prioritizing initiatives, aligning stakeholders, coordinating execution, and validating business outcomes. Operates on strategy, epic, roadmap, and KPI levels; not primarily implementation-focused.",
    pills: { schedules: 5, events: 2, confidence: "High" },
    capabilities: [
      { label: "Estimate idea → draft spec", icon: "lab" },
      { label: "Verify implementation completeness", icon: "check" },
      { label: "Propose next top 3 roadmap priorities", icon: "story" },
      { label: "Run risk pass on epic", icon: "search" },
      { label: "Analyze current sprint progress", icon: "calendar" },
      { label: "Detect dependency conflicts across squads", icon: "hierarchy" },
      { label: "Create release notes", icon: "file" },
      { label: "Post-release review", icon: "circle-dot" },
      { label: "Draft executive update — this sprint", icon: "message" },
      { label: "Write customer changelog", icon: "edit" },
    ],
    processSubtitle: "The Product Manager value chain — five operating modes from discovery to alignment.",
    steps: [
      { id: "discover", title: "Discover", icon: "discover", accent: "#3b5cf6",
        desc: "Understand problems, opportunities, market pressure, and user pain. Coordinate analysts, support, and sales to surface signal.",
        actions: [
          { label: "Gather top 10 current feature requests", icon: "wand" },
          { label: "Summarize new support tickets this week", icon: "wand" },
          { label: "Summarize last month competitor releases", icon: "wand" },
        ],
        entityActions: [
          { label: "Estimate idea and create draft spec:", picker: "idea", placeholder: "Story in state Idea" },
          { label: "Verify implementation completeness:", picker: "doneStory", placeholder: "Story in state Done" },
        ],
        skills: ["Customer Feedback Synthesizer", "Competitive Watch", "Support Pattern Miner", "Productboard Connector"],
      },
      { id: "prioritize", title: "Prioritize", icon: "prioritize", accent: "#8b5cf6",
        desc: "Decide what matters. Define strategic initiatives, balance ROI / value / risk, and align stakeholders on the quarterly bets.",
        actions: [
          { label: "Propose next top 3 roadmap priorities", icon: "wand" },
          { label: "Score backlog ideas by RICE", icon: "wand" },
          { label: "Draft Q3 strategic themes", icon: "wand" },
        ],
        entityActions: [
          { label: "Estimate idea:", picker: "idea", placeholder: "Story in state Idea" },
          { label: "Run risk pass on epic:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["RICE Scorer", "Trade-off Brief", "Strategy Drafter"],
      },
      { id: "orchestrate", title: "Orchestrate", icon: "orchestrate", accent: "#0e7c66",
        desc: "Ensure strategic execution. Coordinate roadmaps, releases, and cross-team dependencies; spot risk early.",
        actions: [
          { label: "Analyze current sprint progress", icon: "wand" },
          { label: "Detect dependency conflicts across squads", icon: "wand" },
          { label: "Generate weekly delivery forecast", icon: "wand" },
          { label: "Draft escalation note for blocked epic", icon: "wand" },
        ],
        entityActions: [
          { label: "Status snapshot for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Sprint health for team:", picker: "team", placeholder: "Choose a team…" },
        ],
        skills: ["Sprint Pulse", "Delivery Forecaster", "Dependency Mapper", "Capacity Planner"],
      },
      { id: "measure", title: "Measure", icon: "measure", accent: "#d97706",
        desc: "Track outcome quality. Monitor adoption, NPS, churn, release stability, and bug load — turn signal into corrections.",
        actions: [
          { label: "Create current release notes", icon: "wand" },
          { label: "Diagnose adoption drop on Feature X", icon: "wand" },
          { label: "Surface this week's bug-trend regressions", icon: "wand" },
          { label: "Compare NPS shift to last release", icon: "wand" },
        ],
        entityActions: [
          { label: "KPI deep-dive for metric:", picker: "metric", placeholder: "Choose a KPI…" },
          { label: "Post-release review for:", picker: "release", placeholder: "Choose a release…" },
        ],
        skills: ["KPI Reporter", "Adoption Analyzer", "Bug Trend Watch", "Release Notes Writer"],
      },
      { id: "align", title: "Align", icon: "align", accent: "#ec4899",
        desc: "Keep the organization aligned. Communicate to execs, customers, and GTM; manage expectations and own the narrative.",
        actions: [
          { label: "Draft executive update — this sprint", icon: "wand" },
          { label: "Write customer changelog (plain English)", icon: "wand" },
          { label: "Prep GTM brief for next launch", icon: "wand" },
        ],
        entityActions: [
          { label: "Stakeholder email for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Executive deck for theme:", picker: "theme", placeholder: "Choose a theme…" },
        ],
        skills: ["Exec Brief Writer", "Launch Comms Pack", "Stakeholder Email"],
      },
    ],
    events: [
      { kind: "schedule", title: "Daily sprint summary", desc: "Every day at 17:00 — composes a one-page sprint pulse with risks, blockers, and delivery delta.", lastRun: "today · 17:00" },
      { kind: "schedule", title: "Daily bug summary", desc: "Every day at 09:00 — top regressions, critical opens, and SLA-at-risk tickets.", lastRun: "today · 09:00" },
    ],
    conversations: [
      { title: "Risk analysis for chat update", subtitle: "TEK-345 · risk score 68/100", time: "today · 11:20" },
      { title: "Q3 roadmap prioritization", subtitle: "12 epics scored", time: "yesterday" },
      { title: "Adoption drop investigation — Inline Comments", subtitle: "-14% WoW", time: "2d ago" },
      { title: "Productboard idea triage", subtitle: "8 ideas, 3 promoted", time: "3d ago" },
    ],
    runs: [
      { trigger: "Schedule", title: "Daily sprint summary", subtitle: "Sprint 42 · 7 risks flagged", time: "today · 17:00", status: "ok" },
      { trigger: "Event", title: "Story TEK-411 → Done", subtitle: "Acceptance criteria validated", time: "today · 14:42", status: "ok" },
      { trigger: "Schedule", title: "Daily bug summary", subtitle: "2 critical · 4 high", time: "today · 09:00", status: "attention" },
      { trigger: "Event", title: "New idea posted in Productboard", subtitle: "Auto-classified · theme: Onboarding", time: "yesterday · 16:18", status: "ok" },
    ],
    findings: [
      { severity: "high", source: "Story TEK-123 → Done", title: "Done story missing avatar visualization & test coverage",
        body: "TEK-123 was marked Done but the required avatar visualization in the role card isn't implemented, and there are no tests covering the role-creation flow. Likely missed during scope cut for release 2026.5.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Change state to In Progress" }], time: "today · 14:42" },
      { severity: "high", source: "Daily bug run", title: "Two S1 bugs surfaced on the new release",
        body: "Daily bug run discovered two critical (S1) level bugs on release 2026.5: TBG-003 (composer pastes file as text on Safari 17) and TBG-019 (widget panel resize handle blocks chat scroll on touchpads).",
        actions: [{ label: "Open conversation", primary: true }, { label: "Perform analysis" }], time: "today · 09:00" },
      { severity: "low", source: "New idea event", title: "Idea: Add dark mode",
        body: "Marked as duplicate and linked with existing story TEK-187. Comment thread merged into the existing discussion.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Show Story TEK-204" }], time: "yesterday · 16:18" },
      { severity: "low", source: "New idea event", title: "Idea: Add Slack integration",
        body: "Added to TEK-522 · Integrations. Auto-tagged with theme 'Distribution'. RICE estimate proposed (R8 · I7 · C5 · E5).",
        actions: [{ label: "Open conversation", primary: true }, { label: "Show Story TEK-209" }], time: "yesterday · 11:04" },
    ],
  },

  po: {
    description: "A Product Owner owns the backlog and the sprint cadence. Translates strategy into stories, sequences delivery, makes the day-to-day trade-offs with the team, and validates that what ships matches what was specified. Operates on stories, epics, sprints, releases, components; close to engineering, decisive on scope.",
    pills: { schedules: 6, events: 3, confidence: "High" },
    capabilities: [
      { label: "Find stories missing acceptance criteria", icon: "search" },
      { label: "Suggest splits for the top epic", icon: "hierarchy" },
      { label: "Propose sprint goal from current backlog", icon: "story" },
      { label: "Compute team capacity for next sprint", icon: "grid" },
      { label: "Highlight blocked stories in this sprint", icon: "circle-dot" },
      { label: "Forecast sprint completion probability", icon: "calendar" },
      { label: "Verify acceptance criteria awaiting review", icon: "check" },
      { label: "List Done stories without merged PRs", icon: "code" },
      { label: "Generate sprint review summary", icon: "file" },
      { label: "Draft demo script from delivered stories", icon: "message" },
    ],
    processSubtitle: "The Product Owner cadence — five operating modes from backlog refinement to sprint close.",
    steps: [
      { id: "refine", title: "Refine", icon: "discover", accent: "#3b5cf6",
        desc: "Groom the backlog. Tighten acceptance criteria, split oversized stories, attach references, and keep stories ready for planning.",
        actions: [
          { label: "Find stories missing acceptance criteria", icon: "wand" },
          { label: "Detect oversized stories in the backlog", icon: "wand" },
          { label: "Suggest splits for the top epic", icon: "wand" },
          { label: "Pull dangling stories with no epic link", icon: "wand" },
        ],
        entityActions: [
          { label: "Refine story:", picker: "story", placeholder: "Choose a story…" },
          { label: "Re-estimate story:", picker: "story", placeholder: "Choose a story…" },
        ],
        skills: ["Story Refiner", "Acceptance Criteria Coach", "Backlog Hygiene", "Estimate Suggestor"],
      },
      { id: "plan", title: "Plan", icon: "prioritize", accent: "#8b5cf6",
        desc: "Build the sprint. Match scope to team capacity, sequence by dependencies, lock the sprint goal.",
        actions: [
          { label: "Propose sprint goal from current backlog", icon: "wand" },
          { label: "Compute team capacity for next sprint", icon: "wand" },
          { label: "List dependencies that must land first", icon: "wand" },
          { label: "Draft sprint plan from ready stories", icon: "wand" },
        ],
        entityActions: [
          { label: "Pull-in stories for sprint:", picker: "sprint", placeholder: "Choose a sprint…" },
          { label: "Capacity check for team:", picker: "team", placeholder: "Choose a team…" },
        ],
        skills: ["Sprint Planner", "Capacity Calculator", "Dependency Mapper", "Goal Drafter"],
      },
      { id: "execute", title: "Execute", icon: "orchestrate", accent: "#0e7c66",
        desc: "Run the sprint. Track flow, unblock the team, keep scope honest, react to slippage.",
        actions: [
          { label: "Highlight blocked stories in this sprint", icon: "wand" },
          { label: "Detect scope creep this sprint", icon: "wand" },
          { label: "Forecast sprint completion probability", icon: "wand" },
          { label: "List stories at risk of carry-over", icon: "wand" },
        ],
        entityActions: [
          { label: "Daily standup brief for team:", picker: "team", placeholder: "Choose a team…" },
          { label: "Slippage analysis for sprint:", picker: "sprint", placeholder: "Choose a sprint…" },
        ],
        skills: ["Sprint Pulse", "Blocker Watch", "Scope Drift Detector", "Carry-over Predictor"],
      },
      { id: "validate", title: "Validate", icon: "measure", accent: "#d97706",
        desc: "Accept what is done. Check acceptance criteria, reconcile with PRs and docs, confirm tests are in place before closing.",
        actions: [
          { label: "Verify acceptance criteria on stories awaiting review", icon: "wand" },
          { label: "List Done stories without merged PRs", icon: "wand" },
          { label: "List Done stories without an updated Confluence page", icon: "wand" },
          { label: "Flag Done stories with missing test references", icon: "wand" },
        ],
        entityActions: [
          { label: "Acceptance review for story:", picker: "story", placeholder: "Choose a story…" },
          { label: "Done-readiness check for epic:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["Acceptance Verifier", "PR/Story Reconciler", "Doc Coverage Checker", "Test Coverage Checker"],
      },
      { id: "close", title: "Close", icon: "align", accent: "#ec4899",
        desc: "Close the sprint cleanly. Produce demo notes, retro inputs, and a clean handoff for the next cycle.",
        actions: [
          { label: "Generate sprint review summary", icon: "wand" },
          { label: "Draft demo script from delivered stories", icon: "wand" },
          { label: "Surface retro signals from sprint runs", icon: "wand" },
          { label: "Carry unfinished stories to next sprint with reasons", icon: "wand" },
        ],
        entityActions: [
          { label: "Sprint review summary for:", picker: "sprint", placeholder: "Choose a sprint…" },
          { label: "Retro inputs for team:", picker: "team", placeholder: "Choose a team…" },
        ],
        skills: ["Demo Scripter", "Retro Inputs", "Sprint Wrap Writer"],
      },
    ],
    events: [
      { kind: "schedule", title: "Daily sprint summary", desc: "Every day at 17:00 — composes a one-page sprint pulse with risks, blockers, and delivery delta.", lastRun: "today · 17:00" },
      { kind: "schedule", title: "Daily bug summary", desc: "Every day at 09:00 — top regressions, critical opens, and SLA-at-risk tickets.", lastRun: "today · 09:00" },
    ],
    conversations: [
      { title: "Sprint 42 planning — capacity vs commitment", subtitle: "+18% over capacity", time: "today · 09:10" },
      { title: "Acceptance review TEK-388", subtitle: "2 criteria untested", time: "yesterday" },
      { title: "Carry-over root cause — TEK-411", subtitle: "blocked on Retrieval squad", time: "2d ago" },
      { title: "Backlog cleanup — dangling stories", subtitle: "23 stories without epic", time: "3d ago" },
    ],
    runs: [
      { trigger: "Schedule", title: "Daily standup brief", subtitle: "Sprint 42 · 3 blockers", time: "today · 08:30", status: "ok" },
      { trigger: "Schedule", title: "Sprint health pulse", subtitle: "9 of 14 stories on track", time: "today · 17:00", status: "attention" },
      { trigger: "Event", title: "Scope drift detected", subtitle: "Sprint 42 +18%", time: "today · 11:02", status: "attention" },
      { trigger: "Event", title: "Done-without-PR flag", subtitle: "TEK-204", time: "yesterday · 14:55", status: "attention" },
    ],
    findings: [
      { severity: "high", source: "Sprint health pulse", title: "Sprint 42 capacity exceeded by 18%",
        body: "Committed scope is 18% above team's last-3-sprint average velocity. Carry-over risk on TEK-411, TEK-388, TEK-204.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open sprint plan" }], time: "today · 17:00" },
      { severity: "high", source: "Done-without-PR event", title: "TEK-204 marked Done without merged PR",
        body: "Story state is Done but no PR is linked or merged on the Composer repo. Likely premature closing.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Change state to In Review" }], time: "yesterday · 14:55" },
      { severity: "medium", source: "Carry-over event", title: "Three carry-overs from same upstream dep",
        body: "TEK-411, TEK-419, TEK-422 all blocked on Retrieval squad's TEK-401. Consider sequencing change.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open Retrieval squad" }], time: "Fri · 17:00" },
      { severity: "low", source: "Refinement scan", title: "4 ready stories missing acceptance criteria",
        body: "Stories marked Ready for planning but acceptance criteria field is empty.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Auto-draft criteria" }], time: "today · 10:14" },
    ],
  },

  ss: {
    description: "A Support Specialist is the first line for customer issues. Triages incoming reports, reproduces problems, owns time-to-resolution, escalates to engineering with structured context, and feeds patterns back to product. Operates on tickets, customers, accounts, components, releases.",
    pills: { schedules: 6, events: 3, confidence: "High" },
    capabilities: [
      { label: "Triage tickets opened in last 12h", icon: "circle-dot" },
      { label: "Detect duplicates among open tickets", icon: "copy" },
      { label: "Generate repro steps from ticket", icon: "lab" },
      { label: "Pull recent error logs for component", icon: "search" },
      { label: "Draft customer reply for ticket", icon: "message" },
      { label: "Suggest workaround from known issues", icon: "wand" },
      { label: "Create bug story from ticket with repro", icon: "file" },
      { label: "Find component owner for routing", icon: "hierarchy" },
      { label: "Cluster this week's tickets by theme", icon: "grid" },
      { label: "Draft weekly support digest", icon: "edit" },
    ],
    processSubtitle: "The Support Specialist loop — from triage to closing the feedback loop with product.",
    steps: [
      { id: "triage", title: "Triage", icon: "discover", accent: "#3b5cf6",
        desc: "Sort what came in. Classify severity, deduplicate, assign category and component, set SLA expectations.",
        actions: [
          { label: "Triage tickets opened in last 12h", icon: "wand" },
          { label: "Detect duplicates among open tickets", icon: "wand" },
          { label: "Re-classify mis-categorized tickets", icon: "wand" },
          { label: "Surface SLA-at-risk tickets", icon: "wand" },
        ],
        entityActions: [
          { label: "Triage ticket:", picker: "ticket", placeholder: "Choose a ticket…" },
          { label: "Bulk triage for account:", picker: "account", placeholder: "Choose an account…" },
        ],
        skills: ["Severity Classifier", "Duplicate Finder", "Component Tagger", "SLA Watcher"],
      },
      { id: "reproduce", title: "Reproduce", icon: "prioritize", accent: "#8b5cf6",
        desc: "Reproduce the customer's problem. Pull logs, identify environment, isolate steps, confirm scope.",
        actions: [
          { label: "Generate repro steps from ticket description", icon: "wand" },
          { label: "Pull recent error logs for affected component", icon: "wand" },
          { label: "Confirm reproduction on latest release", icon: "wand" },
          { label: "Identify if issue is env-specific or universal", icon: "wand" },
        ],
        entityActions: [
          { label: "Reproduce ticket:", picker: "ticket", placeholder: "Choose a ticket…" },
          { label: "Log pull for component:", picker: "component", placeholder: "Choose a component…" },
        ],
        skills: ["Repro Scripter", "Log Sleuth", "Env Diff", "Release Comparator"],
      },
      { id: "resolve", title: "Resolve", icon: "orchestrate", accent: "#0e7c66",
        desc: "Close what can be closed. Apply or document a workaround, confirm with the customer, schedule follow-up.",
        actions: [
          { label: "Draft customer reply for ticket", icon: "wand" },
          { label: "Suggest workaround from known-issues database", icon: "wand" },
          { label: "Send status update to top 5 open tickets", icon: "wand" },
          { label: "Close resolved tickets with summary", icon: "wand" },
        ],
        entityActions: [
          { label: "Draft reply for ticket:", picker: "ticket", placeholder: "Choose a ticket…" },
          { label: "Customer comms summary for account:", picker: "account", placeholder: "Choose an account…" },
        ],
        skills: ["Reply Drafter", "Workaround Library", "Resolution Summarizer"],
      },
      { id: "escalate", title: "Escalate", icon: "measure", accent: "#d97706",
        desc: "Hand off cleanly to engineering. Create a Jira bug with full reproduction, link to ticket and component, propose severity.",
        actions: [
          { label: "Create bug story from ticket with full repro", icon: "wand" },
          { label: "Link existing tickets to in-progress bug", icon: "wand" },
          { label: "Find component owner for routing", icon: "wand" },
          { label: "Generate severity rationale", icon: "wand" },
        ],
        entityActions: [
          { label: "Escalate ticket to engineering:", picker: "ticket", placeholder: "Choose a ticket…" },
          { label: "Owner lookup for component:", picker: "component", placeholder: "Choose a component…" },
        ],
        skills: ["Bug Drafter", "Ticket-to-Story Linker", "Owner Router", "Severity Justifier"],
      },
      { id: "feedback", title: "Feedback", icon: "align", accent: "#ec4899",
        desc: "Close the loop with product. Aggregate ticket patterns, propose product changes, send the weekly digest.",
        actions: [
          { label: "Cluster this week's tickets by theme", icon: "wand" },
          { label: "Propose top 3 product changes from patterns", icon: "wand" },
          { label: "Draft weekly support digest for product team", icon: "wand" },
          { label: "Surface tickets blocked on missing docs", icon: "wand" },
        ],
        entityActions: [
          { label: "Pattern analysis for component:", picker: "component", placeholder: "Choose a component…" },
          { label: "Pattern analysis for release:", picker: "release", placeholder: "Choose a release…" },
        ],
        skills: ["Ticket Theme Clusterer", "Product Suggestion Drafter", "Support Digest Writer", "Doc Gap Detector"],
      },
    ],
    events: [
      { kind: "schedule", title: "Daily sprint summary", desc: "Every day at 17:00 — composes a one-page sprint pulse with risks, blockers, and delivery delta.", lastRun: "today · 17:00" },
      { kind: "schedule", title: "Daily bug summary", desc: "Every day at 09:00 — top regressions, critical opens, and SLA-at-risk tickets.", lastRun: "today · 09:00" },
    ],
    conversations: [
      { title: "Acme Corp ticket cluster — composer", subtitle: "7 tickets · same root cause", time: "today · 11:40" },
      { title: "Repro: Safari paste bug — TBG-003", subtitle: "Reproduced on 17.x", time: "today · 09:55" },
      { title: "Escalation prep — widget resize blocker", subtitle: "TBG-019 · severity S1", time: "yesterday" },
      { title: "Weekly support digest week 22", subtitle: "47 tickets · 5 themes", time: "Mon · 09:00" },
    ],
    runs: [
      { trigger: "Schedule", title: "Morning triage", subtitle: "14 new tickets · 2 high", time: "today · 08:00", status: "ok" },
      { trigger: "Schedule", title: "SLA watch", subtitle: "1 SLA at risk", time: "today · 16:00", status: "attention" },
      { trigger: "Event", title: "Pattern cluster", subtitle: "Onboarding theme +9", time: "today · 12:30", status: "ok" },
      { trigger: "Event", title: "Escalation drafted", subtitle: "TBG-019 · S1 to Composer team", time: "yesterday · 15:10", status: "ok" },
    ],
    findings: [
      { severity: "high", source: "SLA watch", title: "Two SLA breaches imminent",
        body: "TKT-9120 (Acme · composer paste) and TKT-9105 (Contoso · widget resize) cross SLA in <2h. Both have draft replies pending review.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Send draft reply" }], time: "today · 16:00" },
      { severity: "high", source: "Pattern cluster", title: "Pattern: 7 tickets on composer paste in Safari",
        body: "All 7 tickets reproduce on Safari 17.x with the same paste-as-text symptom. Likely single root cause — escalation candidate.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Draft escalation" }], time: "today · 12:30" },
      { severity: "medium", source: "Reopened event", title: "4 tickets reopened on same component",
        body: "Auth component had 4 reopened tickets this week, different customers. Resolution quality regression candidate.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open Auth component" }], time: "yesterday · 11:18" },
      { severity: "low", source: "Doc gap detector", title: "Workaround library missing entry",
        body: "Inline reasoning component has 3 tickets with identical workaround. Add to library to deflect future tickets.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Add to workaround library" }], time: "Mon · 09:00" },
    ],
  },

  pmm: {
    description: "A Product Marketing Manager owns positioning, messaging, and go-to-market. Crafts launches, enables sales, and runs the feedback loop between customer language and product communication. Operates on releases, epics, themes, personas, channels, assets, and customer signal.",
    pills: { schedules: 5, events: 3, confidence: "Medium" },
    capabilities: [
      { label: "Summarize last month's competitor releases", icon: "search" },
      { label: "Cluster customer language in last 50 calls", icon: "grid" },
      { label: "Draft positioning brief for next release", icon: "file" },
      { label: "Map features to persona benefits", icon: "hierarchy" },
      { label: "Draft launch blog for next release", icon: "edit" },
      { label: "Build sales deck outline for epic", icon: "story" },
      { label: "Generate launch checklist for next release", icon: "check" },
      { label: "Brief sales for launch week", icon: "message" },
      { label: "Compare adoption per persona for last launch", icon: "circle-dot" },
      { label: "Compute win-rate delta after last launch", icon: "calendar" },
    ],
    processSubtitle: "The Product Marketing rhythm — from listening to the market to measuring narrative performance.",
    steps: [
      { id: "listen", title: "Listen", icon: "discover", accent: "#3b5cf6",
        desc: "Read the market and the customer. Track competitor positioning, customer language, win/loss patterns, and analyst signal.",
        actions: [
          { label: "Summarize last month's competitor releases", icon: "wand" },
          { label: "Cluster customer language in last 50 calls", icon: "wand" },
          { label: "List win/loss patterns from this quarter", icon: "wand" },
          { label: "Pull sales objections by theme", icon: "wand" },
        ],
        entityActions: [
          { label: "Persona drill-down:", picker: "persona", placeholder: "Choose a persona…" },
          { label: "Channel scan:", picker: "channel", placeholder: "Choose a channel…" },
        ],
        skills: ["Competitor Watch", "Voice-of-Customer", "Win/Loss Analyst", "Objection Miner"],
      },
      { id: "position", title: "Position", icon: "prioritize", accent: "#8b5cf6",
        desc: "Decide what to say and to whom. Sharpen positioning for releases and personas, tie features to outcomes.",
        actions: [
          { label: "Draft positioning brief for next release", icon: "wand" },
          { label: "Map features to persona benefits", icon: "wand" },
          { label: "Score current value props against competitors", icon: "wand" },
          { label: "Propose 3 message angles for upcoming epic", icon: "wand" },
        ],
        entityActions: [
          { label: "Positioning brief for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Persona-feature map for epic:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["Positioning Drafter", "Value-Prop Scorer", "Persona Mapper"],
      },
      { id: "produce", title: "Produce", icon: "orchestrate", accent: "#0e7c66",
        desc: "Build the collateral. Launch posts, sales decks, customer-facing pages, internal enablement.",
        actions: [
          { label: "Draft launch blog for next release", icon: "wand" },
          { label: "Build sales deck outline for epic", icon: "wand" },
          { label: "Write customer-facing changelog", icon: "wand" },
          { label: "Draft email announcement for top accounts", icon: "wand" },
        ],
        entityActions: [
          { label: "Asset pack for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Enablement kit for epic:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["Launch Blog Writer", "Sales Deck Builder", "Changelog Writer", "Email Drafter"],
      },
      { id: "launch", title: "Launch", icon: "measure", accent: "#d97706",
        desc: "Run the launch. Coordinate channels, enable sales, ensure docs and pricing are aligned at GA.",
        actions: [
          { label: "Generate launch checklist for next release", icon: "wand" },
          { label: "Verify documentation coverage for release", icon: "wand" },
          { label: "Schedule sequenced posts across channels", icon: "wand" },
          { label: "Brief sales for launch week", icon: "wand" },
        ],
        entityActions: [
          { label: "Launch plan for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Sales brief for epic:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["Launch Checklist", "Doc Coverage Checker", "Channel Scheduler", "Sales Briefer"],
      },
      { id: "measure", title: "Measure", icon: "align", accent: "#ec4899",
        desc: "Track narrative performance. Adoption per persona, channel engagement, message resonance, sales win rate post-launch.",
        actions: [
          { label: "Compare adoption per persona for last launch", icon: "wand" },
          { label: "Score message resonance from inbound traffic", icon: "wand" },
          { label: "Compute win-rate delta after last launch", icon: "wand" },
          { label: "Identify top channel for last release", icon: "wand" },
        ],
        entityActions: [
          { label: "Launch debrief for release:", picker: "release", placeholder: "Choose a release…" },
          { label: "Message performance for theme:", picker: "theme", placeholder: "Choose a theme…" },
        ],
        skills: ["Persona Adoption Analyzer", "Message Resonance Scorer", "Win-rate Tracker", "Channel Performance Analyzer"],
      },
    ],
    events: [
      { kind: "schedule", title: "Daily sprint summary", desc: "Every day at 17:00 — composes a one-page sprint pulse with risks, blockers, and delivery delta.", lastRun: "today · 17:00" },
      { kind: "schedule", title: "Daily bug summary", desc: "Every day at 09:00 — top regressions, critical opens, and SLA-at-risk tickets.", lastRun: "today · 09:00" },
    ],
    conversations: [
      { title: "Positioning brief — release 2026.6", subtitle: "3 message angles drafted", time: "today · 14:25" },
      { title: "Competitor scan week 22", subtitle: "3 competitor moves", time: "Mon · 08:00" },
      { title: "Launch blog draft — Inline Comments", subtitle: "v3 · awaiting review", time: "yesterday" },
      { title: "Win/loss Q2 — top 3 objections", subtitle: "12 deals analyzed", time: "3d ago" },
    ],
    runs: [
      { trigger: "Schedule", title: "Weekly market scan", subtitle: "3 competitor moves", time: "Mon · 08:00", status: "ok" },
      { trigger: "Schedule", title: "Launch checklist", subtitle: "Release 2026.6 · 4 gaps", time: "today · 10:00", status: "attention" },
      { trigger: "Event", title: "Doc coverage check", subtitle: "2 missing pages", time: "today · 10:05", status: "attention" },
      { trigger: "Event", title: "Channel scheduler", subtitle: "8 posts queued for launch", time: "yesterday · 16:40", status: "ok" },
    ],
    findings: [
      { severity: "high", source: "Launch readiness check", title: "Release 2026.6 GA in 7 days, 4 launch-pack gaps",
        body: "Missing: launch blog v-final, sales one-pager, top-account email, persona-feature map. Doc coverage at 78%.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open launch plan" }], time: "today · 10:00" },
      { severity: "high", source: "Competitor event", title: "Competitor X launched matching feature",
        body: "Positioning brief needs refresh — current copy emphasizes capability parity rather than differentiation.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Refresh positioning" }], time: "today · 09:12" },
      { severity: "medium", source: "Post-launch debrief", title: "Persona ICP-2 adoption flat after last launch",
        body: "Message resonance score 38/100 for ICP-2. Inbound traffic from blog low; suggest rework of casual-creator angle.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open persona ICP-2" }], time: "2d ago" },
      { severity: "low", source: "Doc coverage check", title: "Doc page missing for new export endpoint",
        body: "Release 2026.6 introduces export limits; no Confluence page or changelog entry yet.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Draft changelog" }], time: "today · 10:05" },
    ],
  },

  ba: {
    description: "A Business Analyst bridges business and engineering. Elicits requirements from stakeholders, models domain logic and processes, writes the specs that turn strategy into buildable stories, and verifies what is built matches intent. Operates on epics, stories, components, processes, requirements, and Confluence as the source of truth.",
    pills: { schedules: 6, events: 3, confidence: "High" },
    capabilities: [
      { label: "Summarize stakeholder interview transcripts", icon: "message" },
      { label: "Extract requirements from ticket cluster", icon: "search" },
      { label: "Generate process map for current workflow", icon: "hierarchy" },
      { label: "Compile domain glossary from Confluence", icon: "file" },
      { label: "Split epic into draft stories", icon: "story" },
      { label: "Generate acceptance criteria for story", icon: "check" },
      { label: "Compare implementation to spec for story", icon: "code" },
      { label: "Detect spec drift across implementation", icon: "circle-dot" },
      { label: "Update Confluence page for changed component", icon: "edit" },
      { label: "Draft decision log entry from sprint", icon: "grid" },
    ],
    processSubtitle: "The Business Analyst workflow — from eliciting requirements to keeping the source of truth current.",
    steps: [
      { id: "elicit", title: "Elicit", icon: "discover", accent: "#3b5cf6",
        desc: "Gather raw requirements. Interview stakeholders, mine tickets, extract from existing docs, surface implicit constraints.",
        actions: [
          { label: "Summarize stakeholder interview transcripts", icon: "wand" },
          { label: "Extract requirements from ticket cluster", icon: "wand" },
          { label: "Detect implicit constraints in current backlog", icon: "wand" },
          { label: "List open questions for upcoming epic", icon: "wand" },
        ],
        entityActions: [
          { label: "Requirement gathering for epic:", picker: "epic", placeholder: "Choose an epic…" },
          { label: "Interview summary:", picker: "interview", placeholder: "Choose an interview…" },
        ],
        skills: ["Interview Summarizer", "Ticket-to-Requirement Extractor", "Constraint Detector", "Open-Question Lister"],
      },
      { id: "model", title: "Model", icon: "prioritize", accent: "#8b5cf6",
        desc: "Build the picture. Process maps, data models, entity relationships, domain glossary.",
        actions: [
          { label: "Generate process map for current workflow", icon: "wand" },
          { label: "Build data model from existing schemas", icon: "wand" },
          { label: "Draft ERD for epic", icon: "wand" },
          { label: "Compile domain glossary from Confluence", icon: "wand" },
        ],
        entityActions: [
          { label: "Process map for process:", picker: "process", placeholder: "Choose a process…" },
          { label: "Data model for component:", picker: "component", placeholder: "Choose a component…" },
        ],
        skills: ["Process Mapper", "Data Modeler", "ERD Drafter", "Glossary Compiler"],
      },
      { id: "specify", title: "Specify", icon: "orchestrate", accent: "#0e7c66",
        desc: "Write the spec. Split epics into stories with acceptance criteria, edge cases, and dependency notes.",
        actions: [
          { label: "Split epic into draft stories", icon: "wand" },
          { label: "Generate acceptance criteria for story", icon: "wand" },
          { label: "List edge cases for current story", icon: "wand" },
          { label: "Draft Confluence spec page from epic", icon: "wand" },
        ],
        entityActions: [
          { label: "Spec draft for epic:", picker: "epic", placeholder: "Choose an epic…" },
          { label: "Story split for:", picker: "epic", placeholder: "Choose an epic…" },
        ],
        skills: ["Story Splitter", "Acceptance Criteria Drafter", "Edge-Case Lister", "Confluence Spec Writer"],
      },
      { id: "validate", title: "Validate", icon: "measure", accent: "#d97706",
        desc: "Verify what is built. Compare implementation to spec, run trace checks, confirm acceptance criteria are testable and tested.",
        actions: [
          { label: "Compare implementation to spec for story", icon: "wand" },
          { label: "List stories with untestable acceptance criteria", icon: "wand" },
          { label: "Detect spec drift across implementation", icon: "wand" },
          { label: "Trace requirement → story → PR → test", icon: "wand" },
        ],
        entityActions: [
          { label: "Implementation diff vs spec:", picker: "story", placeholder: "Choose a story…" },
          { label: "Trace check for requirement:", picker: "requirement", placeholder: "Choose a requirement…" },
        ],
        skills: ["Spec-vs-Code Comparator", "Acceptance Testability Checker", "Spec Drift Detector", "Requirement Tracer"],
      },
      { id: "document", title: "Document", icon: "align", accent: "#ec4899",
        desc: "Keep the source of truth current. Update Confluence, decision logs, runbooks, and onboarding material.",
        actions: [
          { label: "Update Confluence page for changed component", icon: "wand" },
          { label: "Draft decision log entry from sprint", icon: "wand" },
          { label: "Generate runbook from closed incident", icon: "wand" },
          { label: "Refresh onboarding doc for new module", icon: "wand" },
        ],
        entityActions: [
          { label: "Update page:", picker: "page", placeholder: "Choose a Confluence page…" },
          { label: "Doc audit for component:", picker: "component", placeholder: "Choose a component…" },
        ],
        skills: ["Confluence Updater", "Decision Logger", "Runbook Generator", "Onboarding Doc Refresher"],
      },
    ],
    events: [
      { kind: "schedule", title: "Daily sprint summary", desc: "Every day at 17:00 — composes a one-page sprint pulse with risks, blockers, and delivery delta.", lastRun: "today · 17:00" },
      { kind: "schedule", title: "Daily bug summary", desc: "Every day at 09:00 — top regressions, critical opens, and SLA-at-risk tickets.", lastRun: "today · 09:00" },
    ],
    conversations: [
      { title: "Epic TEK-522 spec draft — multi-tenant SSO", subtitle: "7 stories proposed", time: "today · 13:10" },
      { title: "Process map — onboarding v3", subtitle: "3 process gaps flagged", time: "yesterday" },
      { title: "Spec-vs-code on TEK-345", subtitle: "2 drifts found", time: "today · 10:02" },
      { title: "Decision log — Q2 architecture choices", subtitle: "5 decisions recorded", time: "Mon" },
    ],
    runs: [
      { trigger: "Schedule", title: "Daily spec drift scan", subtitle: "2 drifts found", time: "today · 10:00", status: "attention" },
      { trigger: "Schedule", title: "Weekly doc audit", subtitle: "6 stale pages", time: "Fri · 14:00", status: "attention" },
      { trigger: "Event", title: "Story split — TEK-530", subtitle: "7 stories drafted", time: "yesterday · 15:55", status: "ok" },
      { trigger: "Event", title: "Requirement trace — REQ-118", subtitle: "3 gaps · 1 story missing", time: "Tue · 14:00", status: "attention" },
    ],
    findings: [
      { severity: "high", source: "Daily spec drift scan", title: "TEK-345 implementation diverges from spec",
        body: "Two acceptance criteria are not satisfied in the merged code: AC-3 (audit log retention) and AC-5 (export limits). Spec and code must be reconciled before release.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Reopen story" }], time: "today · 10:00" },
      { severity: "high", source: "Weekly doc audit", title: "Confluence onboarding page is 3 versions behind code",
        body: "Onboarding v3 process page references old API surface. New endpoints from releases 2026.4 and 2026.5 are not documented.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Open page" }], time: "Fri · 14:00" },
      { severity: "medium", source: "Specify check", title: "Epic TEK-518 has 4 untestable acceptance criteria",
        body: "Criteria use subjective terms (\"feels fast\", \"user friendly\"). Rewrite required before stories can enter In Progress.",
        actions: [{ label: "Open conversation", primary: true }, { label: "Auto-draft testable criteria" }], time: "today · 11:20" },
      { severity: "low", source: "Glossary scan", title: "Domain glossary missing 6 terms used in last sprint",
        body: "Terms appearing in stories but not in glossary: \"tenant scope\", \"role token\", \"channel asset\", \"persona map\", \"theme key\", \"capacity envelope\".",
        actions: [{ label: "Open conversation", primary: true }, { label: "Add to glossary" }], time: "today · 09:30" },
    ],
  },
};

// Auto-id everything so render code can use stable keys
for (const cfg of Object.values(ROLE_CONFIG)) {
  cfg.events = cfg.events.map((e, i) => ({ id: `${e.kind[0]}${i}`, icon: e.kind === "event" ? "circle-dot" : "calendar", color: e.kind === "event" ? "#3b5cf6" : "#0e7c66", ...e }));
  cfg.conversations = cfg.conversations.map((e, i) => ({ id: `c${i}`, ...e }));
  cfg.runs = cfg.runs.map((e, i) => ({ id: `r${i}`, ...e }));
  cfg.findings = cfg.findings.map((e, i) => ({ id: `f${i}`, ...e }));
}
