// AUTOMATION PLATFORM — Master Data Layer
// Exposed as window.AUTO_DATA — unified tasks / workflows / events / triggers

const AUTO_DATA = {
  kpis: {
    activeTasks: 214,
    myTasks: 18,
    dueThisWeek: 42,
    overdue: 8,
    workflowsDefined: 28,
    workflowsActive: 12,
    activeRuns: 34,
    runsSucceededYtd: 1_842,
    runsFailedYtd: 24,
    successRatePct: 98.7,
    eventsPerDay: 1_240,
    triggersActive: 32,
    integrationsConnected: 14,
    templatesAvailable: 22,
    avgRunMinutes: 8.4,
    auditEventsYtd: 48_420,
  },

  // ── TASKS (50 shown representative) ──
  tasks: [
    { id: 'T-2841', title: 'Finalize Daubert motion — Dr. Harlan methodology rebuttal', matter: 'Redstone v. Meridian', matterId: 'M-2024-0312', assignee: 'L. Torres', priority: 'P0', status: 'In Progress', dueDate: '2026-04-25', created: '2026-04-10', workflow: 'MSJ-Opposition-Workflow', tags: ['daubert','expert','brief'], estHours: 14, spentHours: 8 },
    { id: 'T-2840', title: 'Review PSR objections — Barnwell',                         matter: 'US v. Barnwell',         matterId: 'M-2025-0721', assignee: 'L. Torres', priority: 'P0', status: 'In Progress', dueDate: '2026-05-28', created: '2026-04-18', workflow: 'Sentencing-Workflow', tags: ['psr','sentencing','objections'], estHours: 8, spentHours: 2 },
    { id: 'T-2839', title: 'Second-level review — Pacific Shipping Tranche 3',          matter: 'Pacific Shipping',       matterId: 'M-2024-0456', assignee: 'L. Torres', priority: 'P1', status: 'In Progress', dueDate: '2026-04-24', created: '2026-04-08', workflow: 'Review-Pipeline',    tags: ['review','privilege','qc'], estHours: 22, spentHours: 14 },
    { id: 'T-2838', title: 'Draft Motion to Compel — 6 withheld FBI 302s',             matter: 'US v. Harrell',          matterId: 'M-2025-0384', assignee: 'L. Torres', priority: 'P0', status: 'Completed', dueDate: '2026-02-24', created: '2026-02-14', workflow: 'Brady-Compel-Workflow', tags: ['brady','compel','302s'], estHours: 12, spentHours: 13 },
    { id: 'T-2837', title: 'Issue litigation hold — Marshall Employment (6 custodians)',matter: 'Marshall Employment',    matterId: 'M-2024-0261', assignee: 'J. Park',    priority: 'P1', status: 'Waiting', dueDate: '2026-04-22', created: '2026-04-20', workflow: 'Litigation-Hold-Issuance', tags: ['hold','preservation'], estHours: 3, spentHours: 2 },
    { id: 'T-2836', title: 'Conflict check — Whitfield referral',                       matter: 'Pending Intake',         matterId: null,          assignee: 'L. Torres', priority: 'P0', status: 'To Do',      dueDate: '2026-04-22', created: '2026-04-19', workflow: 'New-Matter-Intake',        tags: ['conflict','intake'], estHours: 2, spentHours: 0 },
    { id: 'T-2835', title: 'Prepare Franks hearing outline',                             matter: 'US v. Miller',           matterId: 'M-2025-0302', assignee: 'J. Park',    priority: 'P0', status: 'In Progress', dueDate: '2026-05-07', created: '2026-04-18', workflow: 'Hearing-Prep-Workflow', tags: ['franks','hearing','prep'], estHours: 16, spentHours: 4 },
    { id: 'T-2834', title: 'Review Markman brief v4 — partner sign-off',                matter: 'Blackwell IP',           matterId: 'M-2024-0611', assignee: 'M. Kirkland', priority: 'P1', status: 'To Do', dueDate: '2026-04-23', created: '2026-04-19', workflow: 'Partner-Review',      tags: ['markman','partner-review'], estHours: 2, spentHours: 0 },
    { id: 'T-2833', title: 'Collection ingestion QC — Chen iPhone imaging',             matter: 'US v. Chen',             matterId: 'M-2026-0042', assignee: 'S. Chen',     priority: 'P1', status: 'In Progress', dueDate: '2026-04-24', created: '2026-04-17', workflow: 'Collection-Intake',   tags: ['esi','qc','mobile'], estHours: 4, spentHours: 2 },
    { id: 'T-2832', title: 'Client call — Harrell plea-decision meeting',              matter: 'US v. Harrell',          matterId: 'M-2025-0384', assignee: 'M. Kirkland', priority: 'P0', status: 'Scheduled', dueDate: '2026-04-30', created: '2026-04-18', workflow: null,                tags: ['client-call','plea'], estHours: 2, spentHours: 0 },
    { id: 'T-2831', title: 'File pre-bill PB-4812 (Redstone — March)',                  matter: 'Redstone v. Meridian',   matterId: 'M-2024-0312', assignee: 'M. Kirkland', priority: 'P2', status: 'Waiting', dueDate: '2026-04-25', created: '2026-04-02', workflow: 'Pre-Bill-Approval',   tags: ['pre-bill','billing'], estHours: 1, spentHours: 0 },
    { id: 'T-2830', title: 'Coordinate deposition transcript — Bishop',                 matter: 'Redstone v. Meridian',   matterId: 'M-2024-0312', assignee: 'K. Walsh',    priority: 'P2', status: 'Completed', dueDate: '2026-04-17', created: '2026-04-16', workflow: 'Deposition-Workflow', tags: ['deposition','transcript'], estHours: 2, spentHours: 2 },
    { id: 'T-2829', title: 'Upload expert CV — Dr. Mitchell',                             matter: 'Redstone v. Meridian',   matterId: 'M-2024-0312', assignee: 'K. Walsh',    priority: 'P3', status: 'Completed', dueDate: '2026-03-28', created: '2026-03-27', workflow: null,                tags: ['expert','upload'], estHours: 1, spentHours: 1 },
    { id: 'T-2828', title: 'Calendar prep — Oral arg D.C. Cir. detention',             matter: 'US v. Chen',             matterId: 'M-2026-0042', assignee: 'M. Kirkland', priority: 'P0', status: 'In Progress', dueDate: '2026-04-27', created: '2026-04-12', workflow: 'Oral-Arg-Prep',       tags: ['oral-arg','appellate'], estHours: 16, spentHours: 10 },
    { id: 'T-2827', title: 'Privilege review batch — Sterling APAC',                    matter: 'Sterling Pharma FCPA',   matterId: 'M-2024-0701', assignee: 'L. Torres', priority: 'P1', status: 'In Progress', dueDate: '2026-04-29', created: '2026-04-15', workflow: 'Review-Pipeline',    tags: ['privilege','fcpa'], estHours: 18, spentHours: 8 },
    { id: 'T-2826', title: 'Produce response to DOJ CID',                                matter: 'Sterling Pharma FCPA',   matterId: 'M-2024-0701', assignee: 'M. Kirkland', priority: 'P0', status: 'Blocked', dueDate: '2026-04-24', created: '2026-03-28', workflow: 'DOJ-Response',       tags: ['doj','cid','blocked'], estHours: 24, spentHours: 18 },
    { id: 'T-2825', title: 'Update conflict-check database — NovaTech',                 matter: 'NovaTech Merger Review', matterId: 'M-2024-0230', assignee: 'K. Walsh',    priority: 'P3', status: 'Completed', dueDate: '2026-04-14', created: '2026-04-12', workflow: 'New-Matter-Intake', tags: ['intake','conflict'], estHours: 1, spentHours: 1 },
    { id: 'T-2824', title: 'Draft response to Rule 37 sanctions motion',                matter: 'Redstone v. Meridian',   matterId: 'M-2024-0312', assignee: 'L. Torres', priority: 'P1', status: 'To Do', dueDate: '2026-05-05', created: '2026-04-18', workflow: null,                tags: ['sanctions','opposition'], estHours: 14, spentHours: 0 },
    { id: 'T-2823', title: 'Witness prep — Felix Wong deposition',                       matter: 'Pacific Shipping',       matterId: 'M-2024-0456', assignee: 'S. Chen',     priority: 'P1', status: 'In Progress', dueDate: '2026-05-13', created: '2026-04-10', workflow: 'Deposition-Workflow', tags: ['witness-prep','deposition'], estHours: 8, spentHours: 2 },
    { id: 'T-2822', title: 'Cite-check batch — Barnwell Rule 33 motion',                matter: 'US v. Barnwell',         matterId: 'M-2025-0721', assignee: 'J. Park',    priority: 'P2', status: 'To Do', dueDate: '2026-04-27', created: '2026-04-19', workflow: 'Cite-Check-Batch',   tags: ['cite-check','rule-33'], estHours: 4, spentHours: 0 },
  ],

  // ── WORKFLOW DEFINITIONS ──
  workflows: [
    { id: 'WF-001', name: 'New-Matter-Intake',          category: 'Intake',      steps: 7,  activeRuns: 3, totalRuns: 142, successRate: 99.3, avgMinutes: 32, owner: 'Knowledge Management', status: 'Active', description: 'Conflict check → client intake forms → engagement letter → matter number → team provisioning → billing setup → kick-off meeting.' },
    { id: 'WF-002', name: 'Litigation-Hold-Issuance',   category: 'Preservation',steps: 5,  activeRuns: 2, totalRuns: 48,  successRate: 100,  avgMinutes: 18, owner: 'eDiscovery',          status: 'Active', description: 'Identify custodians → draft hold memo → send via acknowledged-email → auto-reminders → compliance audit trail.' },
    { id: 'WF-003', name: 'MSJ-Opposition-Workflow',    category: 'Motion',      steps: 12, activeRuns: 2, totalRuns: 18,  successRate: 97.2, avgMinutes: 380,owner: 'Litigation',          status: 'Active', description: 'Research memo → outline → draft → cite-check → partner review → client review → revisions → filing → service.' },
    { id: 'WF-004', name: 'Brady-Compel-Workflow',      category: 'Motion',      steps: 6,  activeRuns: 1, totalRuns: 12,  successRate: 98.4, avgMinutes: 180,owner: 'Criminal Defense',    status: 'Active', description: 'Identify gap → draft request → meet-and-confer → escalate to motion → argue → track ruling.' },
    { id: 'WF-005', name: 'Review-Pipeline',             category: 'Review',     steps: 8,  activeRuns: 4, totalRuns: 384, successRate: 98.9, avgMinutes: 22, owner: 'eDiscovery',          status: 'Active', description: 'First-level → TAR seed → QC 10% → privilege review → hot-doc escalation → second-level → production stage.' },
    { id: 'WF-006', name: 'Pre-Bill-Approval',           category: 'Billing',    steps: 4,  activeRuns: 8, totalRuns: 212, successRate: 99.5, avgMinutes: 14, owner: 'Billing Ops',          status: 'Active', description: 'Time-entry cutoff → partner review → write-down application → client portal publish.' },
    { id: 'WF-007', name: 'Hearing-Prep-Workflow',       category: 'Hearing',    steps: 9,  activeRuns: 3, totalRuns: 86,  successRate: 100,  avgMinutes: 240,owner: 'Litigation',          status: 'Active', description: 'Exhibit binder → witness outline → opening script → moot court → travel logistics → client briefing.' },
    { id: 'WF-008', name: 'Oral-Arg-Prep',               category: 'Hearing',    steps: 8,  activeRuns: 4, totalRuns: 62,  successRate: 96.8, avgMinutes: 420,owner: 'Litigation',          status: 'Active', description: 'Draft outline → moot round 1 → revisions → moot round 2 → final briefing → courtroom logistics.' },
    { id: 'WF-009', name: 'Sentencing-Workflow',         category: 'Sentencing', steps: 10, activeRuns: 2, totalRuns: 34,  successRate: 100,  avgMinutes: 320,owner: 'Criminal Defense',    status: 'Active', description: 'PSR review → objections draft → sentencing memo → letters of support → allocution prep → hearing.' },
    { id: 'WF-010', name: 'Deposition-Workflow',         category: 'Discovery',  steps: 7,  activeRuns: 3, totalRuns: 124, successRate: 99.2, avgMinutes: 180,owner: 'Litigation',          status: 'Active', description: 'Topic list → exhibit prep → witness prep → transcript request → summary → designations.' },
    { id: 'WF-011', name: 'Cite-Check-Batch',            category: 'Brief',      steps: 5,  activeRuns: 2, totalRuns: 246, successRate: 97.8, avgMinutes: 48, owner: 'Knowledge Management', status: 'Active', description: 'Extract cites → Shepard batch → treatment flags → partner review → apply fixes.' },
    { id: 'WF-012', name: 'Partner-Review',              category: 'Governance', steps: 4,  activeRuns: 1, totalRuns: 412, successRate: 100,  avgMinutes: 60, owner: 'Partnership',          status: 'Active', description: 'Route → review → redline → sign-off.' },
    { id: 'WF-013', name: 'DOJ-Response',                category: 'Regulatory', steps: 11, activeRuns: 1, totalRuns: 6,   successRate: 83.3, avgMinutes: 860,owner: 'White Collar',         status: 'Active', description: 'CID intake → scope negotiation → privilege-clearance → Bates-numbered production → chain of custody.' },
    { id: 'WF-014', name: 'Collection-Intake',           category: 'eDiscovery', steps: 8,  activeRuns: 2, totalRuns: 184, successRate: 99.4, avgMinutes: 38, owner: 'eDiscovery',          status: 'Active', description: 'Source validation → chain of custody → SHA-256 hash → Relativity stage → ingest QC → process queue.' },
    { id: 'WF-015', name: 'Client-Newsletter-Quarterly', category: 'Client',    steps: 3,  activeRuns: 1, totalRuns: 24,  successRate: 100,  avgMinutes: 12, owner: 'Marketing',            status: 'Active', description: 'Draft → partner approval → send via Marketo.' },
    { id: 'WF-016', name: 'Associate-Review-Assignment', category: 'Staffing',  steps: 5,  activeRuns: 0, totalRuns: 84,  successRate: 98.8, avgMinutes: 15, owner: 'Associate Committee',  status: 'Draft',  description: 'Workload poll → capacity check → matter match → assignment → acknowledgement.' },
  ],

  // ── WORKFLOW RUNS (active instances) ──
  workflowRuns: [
    { id: 'RUN-8421', workflow: 'Review-Pipeline',         matter: 'Pacific Shipping',      startedBy: 'S. Chen',      startedAt: '2026-04-20 09:14', currentStep: 'QC 10% sample', progress: 62, expectedEnd: '2026-04-24 14:00', status: 'Running' },
    { id: 'RUN-8420', workflow: 'MSJ-Opposition-Workflow', matter: 'Redstone v. Meridian',  startedBy: 'M. Kirkland',  startedAt: '2026-02-14 08:00', currentStep: 'Partner Review', progress: 88, expectedEnd: '2026-04-24 18:00', status: 'Running' },
    { id: 'RUN-8419', workflow: 'Litigation-Hold-Issuance',matter: 'Marshall Employment',   startedBy: 'J. Park',      startedAt: '2026-04-20 10:02', currentStep: 'Send acknowledged email', progress: 60, expectedEnd: '2026-04-22 17:00', status: 'Running' },
    { id: 'RUN-8418', workflow: 'Pre-Bill-Approval',        matter: 'Redstone v. Meridian',  startedBy: 'Billing Ops',  startedAt: '2026-04-15 11:30', currentStep: 'Partner Review', progress: 75, expectedEnd: '2026-04-25 17:00', status: 'Waiting' },
    { id: 'RUN-8417', workflow: 'Oral-Arg-Prep',            matter: 'US v. Chen',            startedBy: 'M. Kirkland',  startedAt: '2026-04-08 09:00', currentStep: 'Moot Round 2', progress: 78, expectedEnd: '2026-04-27 17:00', status: 'Running' },
    { id: 'RUN-8416', workflow: 'Brady-Compel-Workflow',    matter: 'US v. Harrell',         startedBy: 'L. Torres',     startedAt: '2026-02-14 08:00', currentStep: 'Track ruling', progress: 95, expectedEnd: 'Pending court', status: 'Waiting' },
    { id: 'RUN-8415', workflow: 'DOJ-Response',             matter: 'Sterling Pharma FCPA',  startedBy: 'M. Kirkland',  startedAt: '2026-03-28 09:00', currentStep: 'Privilege clearance', progress: 54, expectedEnd: '2026-05-15 17:00', status: 'Blocked' },
    { id: 'RUN-8414', workflow: 'Sentencing-Workflow',      matter: 'US v. Barnwell',        startedBy: 'L. Torres',     startedAt: '2026-04-10 10:00', currentStep: 'Sentencing memo drafting', progress: 68, expectedEnd: '2026-05-28 17:00', status: 'Running' },
    { id: 'RUN-8413', workflow: 'Hearing-Prep-Workflow',    matter: 'US v. Miller',          startedBy: 'J. Park',       startedAt: '2026-04-18 09:00', currentStep: 'Exhibit binder', progress: 40, expectedEnd: '2026-05-07 17:00', status: 'Running' },
    { id: 'RUN-8412', workflow: 'Deposition-Workflow',      matter: 'Pacific Shipping',      startedBy: 'S. Chen',       startedAt: '2026-04-12 10:00', currentStep: 'Witness prep', progress: 52, expectedEnd: '2026-05-13 17:00', status: 'Running' },
    { id: 'RUN-8411', workflow: 'Collection-Intake',        matter: 'US v. Chen',            startedBy: 'S. Chen',       startedAt: '2026-04-17 11:00', currentStep: 'Relativity stage', progress: 72, expectedEnd: '2026-04-24 14:00', status: 'Running' },
    { id: 'RUN-8410', workflow: 'New-Matter-Intake',        matter: 'Whitfield referral',    startedBy: 'K. Walsh',      startedAt: '2026-04-19 14:00', currentStep: 'Conflict check', progress: 14, expectedEnd: '2026-04-22 17:00', status: 'Running' },
  ],

  // ── EVENTS (event log with types) ──
  eventTypes: [
    { id: 'EV-T-001', name: 'matter.created',              category: 'Matter',         count30d: 48,  triggersCount: 4 },
    { id: 'EV-T-002', name: 'matter.stage.changed',        category: 'Matter',         count30d: 284, triggersCount: 6 },
    { id: 'EV-T-003', name: 'hold.issued',                 category: 'Preservation',   count30d: 12,  triggersCount: 3 },
    { id: 'EV-T-004', name: 'hold.acknowledged',           category: 'Preservation',   count30d: 58,  triggersCount: 2 },
    { id: 'EV-T-005', name: 'collection.completed',        category: 'eDiscovery',     count30d: 42,  triggersCount: 4 },
    { id: 'EV-T-006', name: 'document.uploaded',           category: 'DMS',            count30d: 12_420, triggersCount: 3 },
    { id: 'EV-T-007', name: 'motion.filed',                category: 'Motion',         count30d: 38,  triggersCount: 5 },
    { id: 'EV-T-008', name: 'ruling.received',             category: 'Motion',         count30d: 34,  triggersCount: 4 },
    { id: 'EV-T-009', name: 'deadline.approaching',        category: 'Calendar',       count30d: 142, triggersCount: 8 },
    { id: 'EV-T-010', name: 'prebill.ready',               category: 'Billing',        count30d: 52,  triggersCount: 3 },
    { id: 'EV-T-011', name: 'invoice.sent',                category: 'Billing',        count30d: 48,  triggersCount: 2 },
    { id: 'EV-T-012', name: 'payment.received',            category: 'Billing',        count30d: 38,  triggersCount: 2 },
    { id: 'EV-T-013', name: 'email.received.from.client',  category: 'Communication',  count30d: 1_820, triggersCount: 4 },
    { id: 'EV-T-014', name: 'court.order.scraped',         category: 'Integration',    count30d: 124, triggersCount: 3 },
    { id: 'EV-T-015', name: 'hearing.scheduled',           category: 'Calendar',       count30d: 62,  triggersCount: 5 },
  ],

  recentEvents: [
    { id: 'EV-104821', type: 'motion.filed',          at: '2026-04-20 10:55', source: 'Motions Platform', payload: 'M-9019 Sterling Protective Order',         triggeredRuns: 2 },
    { id: 'EV-104820', type: 'ruling.received',       at: '2026-04-20 10:42', source: 'Court (PACER scraper)', payload: 'R-101 Miller Franks — Granted',        triggeredRuns: 3 },
    { id: 'EV-104819', type: 'deadline.approaching',  at: '2026-04-20 10:14', source: 'Calendar engine',  payload: 'M-9021 Redstone Daubert — 23 days out',    triggeredRuns: 1 },
    { id: 'EV-104818', type: 'hold.acknowledged',     at: '2026-04-20 10:02', source: 'Hold engine',      payload: 'HOLD-2025-19 Marshall custodian #4',       triggeredRuns: 0 },
    { id: 'EV-104817', type: 'prebill.ready',         at: '2026-04-20 09:58', source: 'Billing engine',   payload: 'PB-4812 Redstone March — $412,800',        triggeredRuns: 1 },
    { id: 'EV-104816', type: 'document.uploaded',     at: '2026-04-20 09:42', source: 'DMS (iManage)',    payload: 'FI-137 iPhone imaging report',              triggeredRuns: 2 },
    { id: 'EV-104815', type: 'collection.completed',  at: '2026-04-20 09:20', source: 'Collection Ops',   payload: 'COL-8419 Google Workspace — A. Iyer',      triggeredRuns: 1 },
    { id: 'EV-104814', type: 'email.received.from.client', at: '2026-04-20 09:14', source: 'Exchange webhook', payload: 'S. Okafor — status update query',      triggeredRuns: 1 },
    { id: 'EV-104813', type: 'hearing.scheduled',     at: '2026-04-20 09:08', source: 'Court calendar',   payload: 'HRG-007 Miller Franks — May 8',           triggeredRuns: 3 },
    { id: 'EV-104812', type: 'court.order.scraped',   at: '2026-04-20 08:56', source: 'PACER scraper',    payload: 'SDNY 1:25-cr-00384 Order denying sever',   triggeredRuns: 2 },
    { id: 'EV-104811', type: 'payment.received',      at: '2026-04-20 08:30', source: 'Finance system',   payload: 'INV-2026-0834 $488,500 — Sterling',         triggeredRuns: 1 },
    { id: 'EV-104810', type: 'matter.stage.changed',  at: '2026-04-20 08:12', source: 'Matter engine',    payload: 'M-2024-0215 Greenfield → Discovery',       triggeredRuns: 2 },
  ],

  // ── TRIGGERS (automation rules) ──
  triggers: [
    { id: 'TR-001', name: 'Ruling received → update motion status + notify',             kind: 'Event',             on: 'ruling.received',            action: 'Update motion status; notify billing partner; log in matter timeline', enabled: true,  firedToday: 3, firedYtd: 104, avgRunMs: 840, target: 'Motions Platform' },
    { id: 'TR-002', name: 'Litigation hold — send reminder to unack\'d custodians',      kind: 'Schedule (cron)',    on: 'Daily 09:00 ET',             action: 'For each active hold, send reminder to custodians with ack pending', enabled: true,  firedToday: 1, firedYtd: 128, avgRunMs: 2_400, target: 'Discovery Platform' },
    { id: 'TR-003', name: 'Client email received → create task for matter lead',          kind: 'Email received',     on: 'Inbox: client @ domain in contacts', action: 'Parse email; create task assigned to matter lead; notify in Teams', enabled: true,  firedToday: 8, firedYtd: 1_842, avgRunMs: 120, target: 'Tasks' },
    { id: 'TR-004', name: 'Deadline approaching ≤ 7d → escalate to partner',              kind: 'Deadline',           on: 'deadline.approaching (urgency=high)', action: 'Notify billing partner via Slack + email; create review task', enabled: true,  firedToday: 2, firedYtd: 412, avgRunMs: 90, target: 'Tasks' },
    { id: 'TR-005', name: 'New matter created → kick off intake workflow',                kind: 'Event',              on: 'matter.created',             action: 'Launch WF-001 New-Matter-Intake workflow', enabled: true,  firedToday: 1, firedYtd: 48, avgRunMs: 180, target: 'Workflows' },
    { id: 'TR-006', name: 'PACER scraper hit → log event + notify paralegal',              kind: 'Webhook',            on: 'POST /webhook/pacer',        action: 'Ingest ruling; log event; notify paralegal', enabled: true,  firedToday: 4, firedYtd: 286, avgRunMs: 340, target: 'Courts' },
    { id: 'TR-007', name: 'Pre-bill ready → notify billing partner',                      kind: 'Event',              on: 'prebill.ready',              action: 'Notify partner in billing dashboard; create review task', enabled: true,  firedToday: 2, firedYtd: 212, avgRunMs: 60, target: 'Billing' },
    { id: 'TR-008', name: 'Trust balance < reserve floor → alert compliance',              kind: 'Event',              on: 'trust.balance.below.reserve',action: 'Alert compliance officer; flag for next reconciliation', enabled: true,  firedToday: 0, firedYtd: 4, avgRunMs: 42, target: 'Trust (IOLTA)' },
    { id: 'TR-009', name: 'Negative-treatment citation flagged → flag brief cites',        kind: 'Event',              on: 'citation.treatment.changed', action: 'Scan active briefs; flag cites in motions platform', enabled: true,  firedToday: 1, firedYtd: 18, avgRunMs: 720, target: 'Motions Platform' },
    { id: 'TR-010', name: 'Conflict check passes → send engagement letter',                kind: 'Event',              on: 'conflict.check.passed',      action: 'Generate + send engagement letter via DocuSign', enabled: true,  firedToday: 1, firedYtd: 48, avgRunMs: 1_420, target: 'Intake' },
    { id: 'TR-011', name: 'Invoice aged 60+ days → escalation to collections',             kind: 'Schedule (cron)',    on: 'Weekly Mon 08:00',           action: 'Enumerate invoices 60d+; assign to collections queue', enabled: true,  firedToday: 0, firedYtd: 52, avgRunMs: 220, target: 'Collections' },
    { id: 'TR-012', name: 'Hearing scheduled → block calendar + create prep task',         kind: 'Event',              on: 'hearing.scheduled',          action: 'Block attorney calendars; create hearing-prep task; book conference room', enabled: true,  firedToday: 2, firedYtd: 62, avgRunMs: 540, target: 'Calendar' },
    { id: 'TR-013', name: 'Matter stage → Trial Prep → staff up',                           kind: 'Matter stage change',on: 'matter.stage.changed (Trial Prep)', action: 'Notify matter lead; run associate-availability workflow', enabled: true,  firedToday: 0, firedYtd: 14, avgRunMs: 180, target: 'Staffing' },
    { id: 'TR-014', name: 'Document uploaded with PII → flag for review',                  kind: 'Document trigger',   on: 'document.uploaded (PII detected)', action: 'Add redaction task; notify privacy officer', enabled: true,  firedToday: 5, firedYtd: 284, avgRunMs: 720, target: 'DMS' },
    { id: 'TR-015', name: 'Compliance calendar — annual certifications',                    kind: 'Schedule (cron)',    on: 'Annually Jan 01',            action: 'Generate compliance certification tasks for all partners', enabled: true,  firedToday: 0, firedYtd: 1, avgRunMs: 3_200, target: 'Compliance' },
  ],

  // ── INTEGRATIONS (connectors) ──
  integrations: [
    { id: 'INT-001', name: 'Microsoft 365 (Exchange)', kind: 'Email',        status: 'Connected', connectedAt: '2024-09-12', events30d: 48_420, lastSync: '2 min ago',   scope: 'OAuth · read/send · 42 mailboxes' },
    { id: 'INT-002', name: 'Microsoft 365 (SharePoint)',kind: 'File Share',   status: 'Connected', connectedAt: '2024-09-12', events30d: 18_420, lastSync: '5 min ago',   scope: 'Graph API · 14 matter sites' },
    { id: 'INT-003', name: 'Microsoft Teams',           kind: 'Chat',         status: 'Connected', connectedAt: '2024-10-02', events30d: 6_420,  lastSync: '1 min ago',   scope: 'Bot framework · notifications' },
    { id: 'INT-004', name: 'Slack (Enterprise Grid)',   kind: 'Chat',         status: 'Connected', connectedAt: '2024-11-18', events30d: 2_140,  lastSync: '3 min ago',   scope: 'Bot · 14 channels' },
    { id: 'INT-005', name: 'iManage (DMS)',             kind: 'DMS',          status: 'Connected', connectedAt: '2024-08-04', events30d: 12_820, lastSync: '6 min ago',   scope: 'API · document events' },
    { id: 'INT-006', name: 'Relativity One',             kind: 'DMS',          status: 'Connected', connectedAt: '2024-07-20', events30d: 4_840,  lastSync: '12 min ago',  scope: 'REST API · workspace events' },
    { id: 'INT-007', name: 'SAP (Finance)',              kind: 'Finance',      status: 'Connected', connectedAt: '2024-10-14', events30d: 1_240,  lastSync: '1h ago',      scope: 'IDoc · invoice + payment' },
    { id: 'INT-008', name: 'DocuSign',                   kind: 'Identity',     status: 'Connected', connectedAt: '2025-01-08', events30d: 84,     lastSync: '4h ago',      scope: 'Webhook · envelope completed' },
    { id: 'INT-009', name: 'PACER Court Scraper',        kind: 'API',          status: 'Connected', connectedAt: '2024-09-02', events30d: 412,    lastSync: '18 min ago',  scope: 'Scheduled scrape · 28 dockets' },
    { id: 'INT-010', name: 'Jira',                       kind: 'Ticketing',    status: 'Connected', connectedAt: '2025-02-10', events30d: 284,    lastSync: '32 min ago',  scope: 'Webhook · ticket events' },
    { id: 'INT-011', name: 'PagerDuty',                  kind: 'Notification', status: 'Connected', connectedAt: '2024-12-04', events30d: 42,     lastSync: '2h ago',      scope: 'Events · critical alerts' },
    { id: 'INT-012', name: 'Okta SSO',                   kind: 'Identity',     status: 'Connected', connectedAt: '2024-06-14', events30d: 1_280,  lastSync: '1 min ago',   scope: 'OAuth · identity events' },
    { id: 'INT-013', name: 'Outlook Calendar',           kind: 'Calendar',     status: 'Connected', connectedAt: '2024-09-12', events30d: 1_820,  lastSync: '2 min ago',   scope: 'Graph API · hearing events' },
    { id: 'INT-014', name: 'Marketo (Marketing)',        kind: 'Notification', status: 'Connected', connectedAt: '2024-12-20', events30d: 24,     lastSync: '8h ago',      scope: 'API · newsletter dispatch' },
    { id: 'INT-015', name: 'Clio (legacy)',              kind: 'DMS',          status: 'Paused',    connectedAt: '2023-03-08', events30d: 0,      lastSync: '2 weeks ago', scope: 'Migration in progress' },
  ],

  // ── TEMPLATES (workflow templates) ──
  templates: [
    { id: 'TPL-001', name: 'New Matter Intake — Litigation',           category: 'Intake',       description: 'Conflict check → client forms → engagement letter → matter number → team provisioning.',                              usedCount: 142, steps: 7 },
    { id: 'TPL-002', name: 'New Matter Intake — Transactional',         category: 'Intake',       description: 'Conflict check → deal-structure forms → engagement letter → data room → team provisioning.',                          usedCount: 34,  steps: 6 },
    { id: 'TPL-003', name: 'Litigation Hold Issuance',                  category: 'Preservation', description: 'Custodian identification → hold memo → send acknowledged-email → reminders → audit log.',                              usedCount: 48,  steps: 5 },
    { id: 'TPL-004', name: 'MSJ Opposition Workflow',                   category: 'Motion',       description: 'Research → outline → draft → cite-check → partner review → client review → revisions → filing.',                     usedCount: 18,  steps: 12 },
    { id: 'TPL-005', name: 'Brady Compel Workflow',                     category: 'Motion',       description: 'Identify gap → draft request → meet-and-confer → motion → argue → track ruling.',                                      usedCount: 12,  steps: 6 },
    { id: 'TPL-006', name: 'Document Review Pipeline',                  category: 'Review',       description: 'First-level → TAR seed → QC 10% → privilege review → hot-doc escalation → second-level → production stage.',         usedCount: 384, steps: 8 },
    { id: 'TPL-007', name: 'Deposition Preparation',                    category: 'Discovery',    description: 'Topic list → exhibit prep → witness prep → transcript request → summary → designations.',                              usedCount: 124, steps: 7 },
    { id: 'TPL-008', name: 'Oral Argument Prep',                         category: 'Hearing',      description: 'Draft outline → moot round 1 → revisions → moot round 2 → final briefing → courtroom logistics.',                     usedCount: 62,  steps: 8 },
    { id: 'TPL-009', name: 'Sentencing Memo Workflow',                   category: 'Sentencing',   description: 'PSR review → objections → sentencing memo → letters of support → allocution prep → hearing.',                         usedCount: 34,  steps: 10 },
    { id: 'TPL-010', name: 'Discovery Response (RFPs)',                   category: 'Discovery',   description: 'Review → identify custodians → collection → privilege review → Bates → production.',                                   usedCount: 84,  steps: 8 },
    { id: 'TPL-011', name: 'Citation Check Batch',                       category: 'Brief',       description: 'Extract cites → Shepard batch → treatment flags → partner review → apply fixes.',                                      usedCount: 246, steps: 5 },
    { id: 'TPL-012', name: 'Partner Review — Standard',                  category: 'Governance',  description: 'Route → review → redline → sign-off.',                                                                                   usedCount: 412, steps: 4 },
    { id: 'TPL-013', name: 'DOJ / SEC Response',                          category: 'Regulatory',  description: 'CID intake → scope negotiation → privilege-clearance → Bates-numbered production → chain of custody.',                 usedCount: 6,   steps: 11 },
    { id: 'TPL-014', name: 'Collection Intake + Chain of Custody',       category: 'eDiscovery',  description: 'Source validation → chain of custody → SHA-256 hash → Relativity stage → ingest QC → process queue.',                usedCount: 184, steps: 8 },
    { id: 'TPL-015', name: 'Pre-Bill Approval',                           category: 'Billing',    description: 'Time-entry cutoff → partner review → write-down application → client portal publish.',                                   usedCount: 212, steps: 4 },
    { id: 'TPL-016', name: 'Trust Reconciliation — Three-Way',            category: 'Compliance', description: 'Bank statement pull → book balance → client-ledger reconciliation → variance report → sign-off.',                     usedCount: 48,  steps: 5 },
    { id: 'TPL-017', name: 'Cite-Checker — Post-Opinion Update',          category: 'Research',    description: 'Monitor opinion releases → flag affected cites → update brief bank.',                                                   usedCount: 24,  steps: 3 },
    { id: 'TPL-018', name: 'Weekly Status Report — Partner',              category: 'Governance', description: 'Auto-compile matter status → partner review → send to clients.',                                                         usedCount: 84,  steps: 4 },
  ],

  // ── ANALYTICS ──
  analytics: {
    runsByOutcome: [
      { outcome: 'Succeeded',  count: 1_842, pct: 98.7 },
      { outcome: 'Cancelled',  count: 18,    pct: 1.0 },
      { outcome: 'Failed',     count: 24,    pct: 1.3 },
    ],
    runsByWorkflow: [
      { workflow: 'Review-Pipeline',              runs: 384, successPct: 98.9 },
      { workflow: 'Partner-Review',                runs: 412, successPct: 100 },
      { workflow: 'Cite-Check-Batch',              runs: 246, successPct: 97.8 },
      { workflow: 'Pre-Bill-Approval',             runs: 212, successPct: 99.5 },
      { workflow: 'Collection-Intake',             runs: 184, successPct: 99.4 },
      { workflow: 'New-Matter-Intake',             runs: 142, successPct: 99.3 },
      { workflow: 'Deposition-Workflow',           runs: 124, successPct: 99.2 },
      { workflow: 'Hearing-Prep-Workflow',         runs: 86,  successPct: 100 },
      { workflow: 'Oral-Arg-Prep',                 runs: 62,  successPct: 96.8 },
      { workflow: 'Litigation-Hold-Issuance',      runs: 48,  successPct: 100 },
    ],
    daily14: [
      { d: 'D-13', runs: 88 },  { d: 'D-12', runs: 92 },  { d: 'D-11', runs: 104 },
      { d: 'D-10', runs: 98 },  { d: 'D-9',  runs: 112 }, { d: 'D-8',  runs: 108 },
      { d: 'D-7',  runs: 96 },  { d: 'D-6',  runs: 118 }, { d: 'D-5',  runs: 124 },
      { d: 'D-4',  runs: 134 }, { d: 'D-3',  runs: 142 }, { d: 'D-2',  runs: 148 },
      { d: 'D-1',  runs: 156 }, { d: 'D-0',  runs: 162 },
    ],
    tasksByAssignee: [
      { name: 'L. Torres',    open: 28, completed: 142, overdue: 2, avgCloseHrs: 14 },
      { name: 'M. Kirkland',  open: 22, completed: 186, overdue: 1, avgCloseHrs: 18 },
      { name: 'J. Park',      open: 18, completed: 98,  overdue: 2, avgCloseHrs: 8 },
      { name: 'S. Chen',      open: 14, completed: 86,  overdue: 1, avgCloseHrs: 10 },
      { name: 'A. Petrov',    open: 10, completed: 62,  overdue: 0, avgCloseHrs: 12 },
      { name: 'R. Vasquez',   open: 8,  completed: 48,  overdue: 1, avgCloseHrs: 16 },
      { name: 'K. Walsh',     open: 6,  completed: 142, overdue: 1, avgCloseHrs: 4 },
    ],
  },

  // ── SCRIPTS (custom code) ──
  scripts: [
    { id: 'SC-001', name: 'cite-extract-and-shepardize.js',        language: 'JavaScript (Node 20)', linesOfCode: 142,  owner: 'Knowledge Management', lastRun: '12 min ago', status: 'Active',  description: 'Extracts citations from a brief via regex + LexisNexis SDK; batches treatment lookups.' },
    { id: 'SC-002', name: 'redact-pii-detector.py',                 language: 'Python 3.11',           linesOfCode: 220,  owner: 'eDiscovery',            lastRun: '3 min ago',  status: 'Active',  description: 'Uses spaCy + custom patterns to detect SSNs, DOBs, account numbers; queues redaction tasks.' },
    { id: 'SC-003', name: 'deadline-calculator-frcp.js',             language: 'JavaScript (Node 20)', linesOfCode: 98,   owner: 'Calendar Ops',         lastRun: '1h ago',     status: 'Active',  description: 'Computes FRCP-compliant deadlines given matter events; supports exclusions (weekends/holidays).' },
    { id: 'SC-004', name: 'trust-three-way-reconcile.py',             language: 'Python 3.11',           linesOfCode: 184,  owner: 'Billing Ops',          lastRun: '1d ago',     status: 'Active',  description: 'Reconciles bank, book, and client-ledger balances for IOLTA accounts; flags variances.' },
    { id: 'SC-005', name: 'matter-status-weekly.ts',                 language: 'TypeScript',            linesOfCode: 246,  owner: 'Partnership',           lastRun: 'Yesterday',  status: 'Active',  description: 'Generates weekly status reports per matter from activity stream; emails matter leads.' },
    { id: 'SC-006', name: 'conflict-check-ltr.js',                    language: 'JavaScript (Node 20)', linesOfCode: 124,  owner: 'Intake',               lastRun: '3h ago',     status: 'Active',  description: 'Searches MATTERS + historical client DB for name collisions; produces conflict report.' },
    { id: 'SC-007', name: 'motion-filing-webhook-handler.ts',        language: 'TypeScript',            linesOfCode: 68,   owner: 'Motions Platform',     lastRun: '10 min ago', status: 'Active',  description: 'Receives PACER webhooks; parses docket entries; writes to motion status feed.' },
    { id: 'SC-008', name: 'tar-sampling-stats.py',                    language: 'Python 3.11',           linesOfCode: 312,  owner: 'eDiscovery',            lastRun: 'Hourly',      status: 'Active',  description: 'Computes precision/recall/F1 on TAR models; generates statistical-validity reports for court.' },
  ],

  // ── AUDIT LOG (compliance-grade) ──
  audit: [
    { id: 'A-842014', at: '2026-04-20 10:58', actor: 'L. Torres',        action: 'trigger.enable',         object: 'TR-014 PII-flag trigger',                  outcome: 'success', hash: '9a8b7c6d' },
    { id: 'A-842013', at: '2026-04-20 10:42', actor: 'System',            action: 'workflow.run.complete',   object: 'RUN-8419 Litigation-Hold-Issuance',        outcome: 'success', hash: '1a2b3c4d' },
    { id: 'A-842012', at: '2026-04-20 10:28', actor: 'M. Kirkland',      action: 'task.status.change',      object: 'T-2832 Harrell plea-decision meeting',    outcome: 'success', hash: '4d5e6f7a' },
    { id: 'A-842011', at: '2026-04-20 10:14', actor: 'K. Walsh',          action: 'task.create',             object: 'T-2836 Conflict check — Whitfield',       outcome: 'success', hash: '8b9c0d1e' },
    { id: 'A-842010', at: '2026-04-20 10:02', actor: 'System',            action: 'trigger.fire',             object: 'TR-001 Ruling received',                   outcome: 'success', hash: '2f3a4b5c' },
    { id: 'A-842009', at: '2026-04-20 09:58', actor: 'System',            action: 'integration.sync',         object: 'INT-002 SharePoint · 1,840 events',       outcome: 'success', hash: '6d7e8f9a' },
    { id: 'A-842008', at: '2026-04-20 09:42', actor: 'Okta SSO',          action: 'user.login',              object: 'L. Torres · MFA challenge passed',        outcome: 'success', hash: '1b2c3d4e' },
    { id: 'A-842007', at: '2026-04-20 09:20', actor: 'System',            action: 'trigger.fire',             object: 'TR-005 New matter → intake workflow',     outcome: 'success', hash: '5f6a7b8c' },
    { id: 'A-842006', at: '2026-04-20 09:08', actor: 'System',            action: 'script.run',              object: 'SC-001 cite-extract-and-shepardize.js',   outcome: 'success', hash: '9d0e1f2a' },
    { id: 'A-842005', at: '2026-04-20 08:54', actor: 'S. Chen',           action: 'workflow.start',           object: 'RUN-8421 Review-Pipeline',                outcome: 'success', hash: '3b4c5d6e' },
    { id: 'A-842004', at: '2026-04-20 08:30', actor: 'System',            action: 'webhook.receive',          object: 'INT-008 DocuSign envelope completed',     outcome: 'success', hash: '7f8a9b0c' },
    { id: 'A-842003', at: '2026-04-20 08:12', actor: 'M. Kirkland',      action: 'trigger.create',          object: 'TR-016 Custom ruling-alert (draft)',       outcome: 'success', hash: '2d3e4f5a' },
    { id: 'A-842002', at: '2026-04-20 08:02', actor: 'System',            action: 'workflow.run.failure',     object: 'RUN-8410 DOJ-Response step 4',           outcome: 'failed',  hash: '6b7c8d9e' },
    { id: 'A-842001', at: 'Yesterday 17:42', actor: 'System',            action: 'trigger.fire',             object: 'TR-011 Invoice aged 60+ days',            outcome: 'success', hash: '0a1b2c3d' },
    { id: 'A-842000', at: 'Yesterday 17:22', actor: 'S. Chen',           action: 'integration.reconnect',    object: 'INT-007 SAP Finance — OAuth refresh',     outcome: 'success', hash: '4e5f6a7b' },
  ],

  // ── ACTIVITY (platform chatter) ──
  activity: [
    { id: 'AU-A-001', time: '10:55 AM',  actor: 'M. Kirkland',       action: 'Fired trigger', target: 'TR-007 Pre-bill ready — notified partner',        severity: 'info' },
    { id: 'AU-A-002', time: '10:42 AM',  actor: 'System',            action: 'Workflow completed', target: 'RUN-8419 Litigation-Hold-Issuance (100%)',  severity: 'info' },
    { id: 'AU-A-003', time: '10:28 AM',  actor: 'L. Torres',         action: 'Task completed', target: 'T-2838 Motion to Compel — Brady',                severity: 'info' },
    { id: 'AU-A-004', time: '10:14 AM',  actor: 'System',            action: 'Workflow run failed', target: 'RUN-8410 DOJ-Response step 4 — retry queued', severity: 'warn' },
    { id: 'AU-A-005', time: '09:58 AM',  actor: 'PACER scraper',     action: 'Event ingested', target: 'court.order.scraped — 4 new orders',             severity: 'info' },
    { id: 'AU-A-006', time: '09:42 AM',  actor: 'Automation Ops',    action: 'Trigger enabled', target: 'TR-014 PII-flag trigger — activated',           severity: 'info' },
    { id: 'AU-A-007', time: '09:20 AM',  actor: 'Okta SSO',          action: 'User identity refreshed', target: '28 users re-authenticated',              severity: 'info' },
    { id: 'AU-A-008', time: '09:08 AM',  actor: 'System',            action: 'Cron fired', target: 'TR-002 Litigation hold reminders — 14 sent',        severity: 'info' },
    { id: 'AU-A-009', time: '08:54 AM',  actor: 'S. Chen',           action: 'Workflow started', target: 'RUN-8421 Review-Pipeline · Pacific Shipping',  severity: 'info' },
    { id: 'AU-A-010', time: '08:30 AM',  actor: 'Finance webhook',   action: 'Event ingested', target: 'payment.received — $488,500 Sterling',           severity: 'info' },
    { id: 'AU-A-011', time: 'Yesterday', actor: 'System',            action: 'Schedule missed', target: 'TR-011 Invoice aged check — 2-hr delay',        severity: 'warn' },
    { id: 'AU-A-012', time: 'Yesterday', actor: 'Script Ops',        action: 'Script updated', target: 'SC-002 redact-pii-detector.py v2.4',             severity: 'info' },
  ],

  // ═══════════════════════════════════════════════════════════════════════════
  // ENTERPRISE EXTENSIONS — Reliability · Governance · Authoring · Ops
  // ═══════════════════════════════════════════════════════════════════════════

  // ── RELIABILITY KPIs ──
  reliabilityKpis: {
    slaTargetMet: 98.2, slaBreaches30d: 6, errorBudgetRemainingPct: 72, mttrMin: 14,
    dlqDepth: 18, dlqOldestMinutes: 84, dlqRedrivenYtd: 412, dlqDiscardedYtd: 12,
    activeTraces: 34, p50Ms: 840, p95Ms: 4_210, p99Ms: 12_400,
    queueDepth: 42, queueOldestMin: 3, throttledPerHour: 14, backpressureActive: 2,
    dependencyNodes: 98, dependencyEdges: 214, criticalPaths: 6,
  },

  // ── SLA TARGETS ──
  slaTargets: [
    { id: 'SLA-01', workflow: 'MSJ-Opposition-Workflow',  target: 'p95 < 12h',  actualP95: '9h 48m', attainmentPct: 99.1, breaches30d: 1, errorBudgetPct: 84, owner: 'Litigation',        status: 'Healthy',  priority: 'P0' },
    { id: 'SLA-02', workflow: 'Review-Pipeline',            target: 'p95 < 35m',  actualP95: '28m',    attainmentPct: 99.4, breaches30d: 0, errorBudgetPct: 96, owner: 'eDiscovery',        status: 'Healthy',  priority: 'P0' },
    { id: 'SLA-03', workflow: 'Pre-Bill-Approval',         target: 'p95 < 20m',  actualP95: '17m',    attainmentPct: 99.8, breaches30d: 0, errorBudgetPct: 98, owner: 'Billing Ops',       status: 'Healthy',  priority: 'P1' },
    { id: 'SLA-04', workflow: 'DOJ-Response',               target: 'p95 < 6h',   actualP95: '8h 12m', attainmentPct: 92.3, breaches30d: 3, errorBudgetPct: 12, owner: 'Regulatory',        status: 'At Risk',  priority: 'P0' },
    { id: 'SLA-05', workflow: 'Litigation-Hold-Issuance',  target: 'p95 < 30m',  actualP95: '18m',    attainmentPct: 100,  breaches30d: 0, errorBudgetPct: 100,owner: 'eDiscovery',        status: 'Healthy',  priority: 'P0' },
    { id: 'SLA-06', workflow: 'Brady-Compel-Workflow',     target: 'p95 < 4h',   actualP95: '3h 12m', attainmentPct: 98.4, breaches30d: 0, errorBudgetPct: 78, owner: 'Criminal Defense',  status: 'Healthy',  priority: 'P0' },
    { id: 'SLA-07', workflow: 'Hearing-Prep-Workflow',     target: 'p95 < 6h',   actualP95: '4h 10m', attainmentPct: 100,  breaches30d: 0, errorBudgetPct: 100,owner: 'Litigation',        status: 'Healthy',  priority: 'P1' },
    { id: 'SLA-08', workflow: 'Cite-Check-Batch',          target: 'p95 < 90m',  actualP95: '112m',   attainmentPct: 94.8, breaches30d: 2, errorBudgetPct: 34, owner: 'Knowledge Mgmt',    status: 'At Risk',  priority: 'P1' },
  ],

  // ── DEAD-LETTER QUEUE ──
  dlq: [
    { id: 'DLQ-0184', runId: 'RUN-8410', workflow: 'DOJ-Response',         step: 'step 4 — CID payload upload', failedAt: '2026-04-20 08:02', errorCode: 'INT_504_GATEWAY_TIMEOUT', errorMessage: 'SAP Finance upstream timed out after 30s', attempts: 3, quarantineMin: 168, lastAttempt: '2026-04-20 08:38', nextRetryAt: '2026-04-20 11:00', canRedrive: true, canDiscard: true, severity: 'error' },
    { id: 'DLQ-0183', runId: 'RUN-8408', workflow: 'Review-Pipeline',      step: 'step 6 — privilege OCR',       failedAt: '2026-04-19 22:14', errorCode: 'OCR_TESSERACT_OOM',       errorMessage: 'OCR worker exhausted memory on 482MB PDF', attempts: 5, quarantineMin: 820, lastAttempt: '2026-04-20 02:40', nextRetryAt: null, canRedrive: true, canDiscard: true, severity: 'error' },
    { id: 'DLQ-0182', runId: 'RUN-8399', workflow: 'Cite-Check-Batch',     step: 'step 2 — Shepard API',         failedAt: '2026-04-19 16:40', errorCode: 'LEXIS_RATE_LIMIT',        errorMessage: 'Lexis API 429 — 3x backoff exhausted',      attempts: 4, quarantineMin: 1_040, lastAttempt: '2026-04-19 18:22', nextRetryAt: null, canRedrive: true, canDiscard: true, severity: 'warn' },
    { id: 'DLQ-0181', runId: 'RUN-8391', workflow: 'Pre-Bill-Approval',    step: 'step 3 — Client portal push',  failedAt: '2026-04-19 09:12', errorCode: 'CLIENT_PORTAL_AUTH',      errorMessage: 'Portal rejected bearer token (rotation)',   attempts: 2, quarantineMin: 1_490, lastAttempt: '2026-04-19 09:30', nextRetryAt: null, canRedrive: true, canDiscard: false, severity: 'warn' },
    { id: 'DLQ-0180', runId: 'RUN-8384', workflow: 'New-Matter-Intake',    step: 'step 5 — iManage workspace',   failedAt: '2026-04-18 14:08', errorCode: 'IMANAGE_CONFLICT',        errorMessage: 'Workspace ID collision — duplicate client code', attempts: 2, quarantineMin: 2_700, lastAttempt: '2026-04-18 14:18', nextRetryAt: null, canRedrive: false, canDiscard: true, severity: 'error' },
    { id: 'DLQ-0179', runId: 'RUN-8372', workflow: 'DOJ-Response',         step: 'step 2 — email notify',        failedAt: '2026-04-18 08:42', errorCode: 'SMTP_BOUNCE',             errorMessage: 'Recipient mailbox full (alt: doj.escalation)', attempts: 3, quarantineMin: 3_090, lastAttempt: '2026-04-18 09:04', nextRetryAt: null, canRedrive: true, canDiscard: true, severity: 'warn' },
    { id: 'DLQ-0178', runId: 'RUN-8368', workflow: 'Deposition-Workflow',  step: 'step 4 — transcript ingest',   failedAt: '2026-04-17 19:34', errorCode: 'SCHEMA_VALIDATION',       errorMessage: 'Transcript JSON missing speaker tags',      attempts: 2, quarantineMin: 4_260, lastAttempt: '2026-04-17 19:48', nextRetryAt: null, canRedrive: false, canDiscard: true, severity: 'error' },
  ],

  // ── TRACES (per-run step spans) ──
  traces: [
    { id: 'TRC-8420', runId: 'RUN-8420', workflow: 'Review-Pipeline',  started: '2026-04-20 10:12', total: 1842, status: 'In Progress', spans: [
      { name: 'First-level',     start: 0,    duration: 240, color: 'lime',    status: 'ok' },
      { name: 'TAR seed',        start: 240,  duration: 180, color: 'cobalt',  status: 'ok' },
      { name: 'QC 10%',          start: 420,  duration: 140, color: 'violet',  status: 'ok' },
      { name: 'Privilege review',start: 560,  duration: 420, color: 'amber',   status: 'slow' },
      { name: 'Hot-doc escalate',start: 980,  duration: 80,  color: 'fuchsia', status: 'ok' },
      { name: 'Second-level',    start: 1060, duration: 520, color: 'teal',    status: 'running' },
      { name: 'Production stage',start: 1580, duration: 262, color: 'emerald', status: 'queued' },
    ]},
    { id: 'TRC-8419', runId: 'RUN-8419', workflow: 'Litigation-Hold-Issuance', started: '2026-04-20 10:42', total: 1080, status: 'Succeeded', spans: [
      { name: 'Identify custodians', start: 0,   duration: 120, color: 'lime',    status: 'ok' },
      { name: 'Draft hold memo',     start: 120, duration: 240, color: 'cobalt',  status: 'ok' },
      { name: 'Send acknowledged',   start: 360, duration: 480, color: 'violet',  status: 'ok' },
      { name: 'Auto-reminders',      start: 840, duration: 140, color: 'amber',   status: 'ok' },
      { name: 'Audit trail',         start: 980, duration: 100, color: 'emerald', status: 'ok' },
    ]},
    { id: 'TRC-8410', runId: 'RUN-8410', workflow: 'DOJ-Response', started: '2026-04-20 07:58', total: 680, status: 'Failed', spans: [
      { name: 'Assemble CID payload', start: 0,   duration: 220, color: 'lime',    status: 'ok' },
      { name: 'email notify',         start: 220, duration: 80,  color: 'cobalt',  status: 'ok' },
      { name: 'privilege log sync',   start: 300, duration: 120, color: 'violet',  status: 'ok' },
      { name: 'CID payload upload',   start: 420, duration: 260, color: 'crimson', status: 'failed' },
    ]},
  ],

  // ── SCHEDULER / QUEUES ──
  queues: [
    { id: 'Q-high',    name: 'High priority',    concurrency: 8,  depth: 4,  oldestMin: 1,  throttledHr: 2,  backpressure: false, workers: 8, waitAvgMs: 420,  owner: 'Automation Ops' },
    { id: 'Q-default', name: 'Default',          concurrency: 16, depth: 22, oldestMin: 2,  throttledHr: 8,  backpressure: false, workers: 16,waitAvgMs: 1_240,owner: 'Automation Ops' },
    { id: 'Q-batch',   name: 'Batch (nightly)',  concurrency: 4,  depth: 14, oldestMin: 12, throttledHr: 4,  backpressure: true,  workers: 4, waitAvgMs: 4_810,owner: 'Automation Ops' },
    { id: 'Q-critical',name: 'Critical path',    concurrency: 12, depth: 2,  oldestMin: 0,  throttledHr: 0,  backpressure: false, workers: 12,waitAvgMs: 120,  owner: 'Automation Ops' },
    { id: 'Q-lowprio', name: 'Low priority',     concurrency: 2,  depth: 0,  oldestMin: 0,  throttledHr: 0,  backpressure: false, workers: 2, waitAvgMs: 8_420,owner: 'Automation Ops' },
  ],

  // ── RUN CONTROLS (interventions) ──
  runControls: [
    { id: 'RUN-8420', workflow: 'Review-Pipeline',   state: 'Running',   checkpointsMade: 4,  elapsedMin: 34, remainingMin: 14, wipLimit: 4,  wipInUse: 4, canPause: true, canCancel: true, canCheckpoint: true, note: 'At 68% — privilege step taking longer than p95.' },
    { id: 'RUN-8415', workflow: 'Oral-Arg-Prep',     state: 'Paused',    checkpointsMade: 2,  elapsedMin: 140,remainingMin: 280,wipLimit: 2,  wipInUse: 1, canPause: false, canCancel: true, canCheckpoint: true, note: 'Paused by M. Kirkland pending partner review.' },
    { id: 'RUN-8408', workflow: 'DOJ-Response',      state: 'Retrying',  checkpointsMade: 3,  elapsedMin: 220,remainingMin: 60, wipLimit: 1,  wipInUse: 1, canPause: true, canCancel: true, canCheckpoint: false, note: 'Retry 2/5 after upstream timeout.' },
    { id: 'RUN-8401', workflow: 'Hearing-Prep-Workflow', state: 'Running',checkpointsMade: 5, elapsedMin: 88, remainingMin: 132,wipLimit: 3,  wipInUse: 3, canPause: true, canCancel: true, canCheckpoint: true, note: 'Within p95. Check-pointed at step 4.' },
    { id: 'RUN-8392', workflow: 'Review-Pipeline',   state: 'Stuck',     checkpointsMade: 6,  elapsedMin: 410,remainingMin: 0,  wipLimit: 4,  wipInUse: 4, canPause: true, canCancel: true, canCheckpoint: false, note: 'No progress for 42 min — timeout override recommended.' },
  ],

  // ── DEPENDENCY GRAPH ──
  dependencyNodes: [
    { id: 'N-wf-MSJ',    label: 'MSJ-Opposition-Workflow',  type: 'workflow',  criticality: 'P0', x: 20, y: 15 },
    { id: 'N-wf-Rev',    label: 'Review-Pipeline',           type: 'workflow',  criticality: 'P0', x: 50, y: 15 },
    { id: 'N-wf-PreBill',label: 'Pre-Bill-Approval',         type: 'workflow',  criticality: 'P1', x: 80, y: 15 },
    { id: 'N-tr-Cron',   label: 'TR-002 Cron: hold reminders',type: 'trigger', criticality: 'P0', x: 20, y: 55 },
    { id: 'N-tr-Wh',     label: 'TR-007 Webhook: pre-bill',  type: 'trigger',   criticality: 'P1', x: 80, y: 55 },
    { id: 'N-ev-court',  label: 'court.order.scraped',        type: 'event',    criticality: 'P0', x: 35, y: 38 },
    { id: 'N-ev-pay',    label: 'payment.received',            type: 'event',    criticality: 'P1', x: 65, y: 38 },
    { id: 'N-int-Sap',   label: 'SAP Finance',                 type: 'integration', criticality: 'P0', x: 50, y: 80 },
    { id: 'N-int-iMg',   label: 'iManage',                      type: 'integration', criticality: 'P0', x: 25, y: 80 },
    { id: 'N-int-Okta',  label: 'Okta SSO',                     type: 'integration', criticality: 'P0', x: 75, y: 80 },
  ],
  dependencyEdges: [
    { from: 'N-tr-Cron',   to: 'N-wf-MSJ',    label: 'fires' },
    { from: 'N-ev-court',  to: 'N-wf-MSJ',    label: 'triggers' },
    { from: 'N-ev-court',  to: 'N-wf-Rev',    label: 'triggers' },
    { from: 'N-ev-pay',    to: 'N-wf-PreBill',label: 'triggers' },
    { from: 'N-tr-Wh',     to: 'N-wf-PreBill',label: 'fires' },
    { from: 'N-wf-MSJ',    to: 'N-int-iMg',   label: 'writes' },
    { from: 'N-wf-Rev',    to: 'N-int-iMg',   label: 'reads' },
    { from: 'N-wf-PreBill',to: 'N-int-Sap',   label: 'writes' },
    { from: 'N-wf-MSJ',    to: 'N-int-Okta',  label: 'auth' },
    { from: 'N-wf-Rev',    to: 'N-int-Okta',  label: 'auth' },
  ],

  // ── GOVERNANCE KPIs ──
  governanceKpis: {
    versionsTracked: 428, pendingChanges: 8, approvalsInQueue: 14, approvalsSlaBreached: 1,
    policyRules: 42, policyViolations30d: 3, policyViolationsOpen: 0,
    usersWithAccess: 92, privilegedRoles: 7, orphanPermissions: 4,
    complianceFrameworks: 6, controlsMapped: 148, controlsPassing: 146, openFindings: 2,
    iacExports: 118, iacImports: 42,
  },

  // ── CHANGE LOG / VERSIONS ──
  versions: [
    { id: 'V-4812', artifact: 'MSJ-Opposition-Workflow', type: 'workflow',    version: 'v14', changedOn: '2026-04-19 16:22', changedBy: 'M. Kirkland', linesAdded: 24, linesRemoved: 8,  status: 'Published', approvedBy: 'J. Halperin', summary: 'Added partner-review gate after cite-check step.' },
    { id: 'V-4811', artifact: 'TR-016 Custom ruling-alert', type: 'trigger',  version: 'v2',  changedOn: '2026-04-20 08:12', changedBy: 'M. Kirkland', linesAdded: 18, linesRemoved: 0,  status: 'Draft',     approvedBy: null,          summary: 'New ruling-alert trigger against PACER feed.' },
    { id: 'V-4810', artifact: 'Review-Pipeline',          type: 'workflow',   version: 'v22', changedOn: '2026-04-18 11:40', changedBy: 'S. Chen',      linesAdded: 12, linesRemoved: 16, status: 'Published', approvedBy: 'J. Halperin', summary: 'Replaced tesseract OCR with Azure Document AI.' },
    { id: 'V-4809', artifact: 'INT-007 SAP Finance',       type: 'integration',version: 'v8', changedOn: '2026-04-18 10:02', changedBy: 'Platform Ops', linesAdded: 4,  linesRemoved: 4,  status: 'Published', approvedBy: 'J. Halperin', summary: 'Rotated OAuth client secret; updated scopes.' },
    { id: 'V-4808', artifact: 'SC-002 redact-pii-detector', type: 'script',   version: 'v2.4',changedOn: '2026-04-17 15:12', changedBy: 'Script Ops',   linesAdded: 48, linesRemoved: 12, status: 'Published', approvedBy: 'L. Torres',  summary: 'Added SSN-with-dash format + address heuristic.' },
    { id: 'V-4807', artifact: 'DOJ-Response',               type: 'workflow', version: 'v9',  changedOn: '2026-04-15 09:22', changedBy: 'M. Kirkland', linesAdded: 36, linesRemoved: 4,  status: 'Pending Approval', approvedBy: null, summary: 'Added CID timeline tracking.' },
    { id: 'V-4806', artifact: 'Cite-Check-Batch',           type: 'workflow', version: 'v6',  changedOn: '2026-04-12 14:08', changedBy: 'Knowledge Mgmt',linesAdded:  8, linesRemoved: 2,  status: 'Published', approvedBy: 'J. Halperin', summary: 'Retry logic for Lexis 429s.' },
    { id: 'V-4805', artifact: 'TR-011 Invoice aged',         type: 'trigger',  version: 'v3', changedOn: '2026-04-10 08:38', changedBy: 'Billing Ops',  linesAdded:  6, linesRemoved: 2,  status: 'Rolled Back', approvedBy: 'M. Kirkland',summary: 'Reverted — caused duplicate client emails.' },
  ],

  // ── APPROVAL CHAINS ──
  approvals: [
    { id: 'APR-204', subject: 'Enable integration: INT-016 Westlaw Prompt', requestedBy: 'J. Park',      requestedOn: '2026-04-20 09:12', stages: [{role:'Owner',name:'J. Park',status:'approved'},{role:'Security',name:'InfoSec',status:'approved'},{role:'Partner',name:'M. Kirkland',status:'pending'}], deadline: '2026-04-21 17:00', risk: 'Medium', status: 'Pending', slaLeftHr: 8 },
    { id: 'APR-203', subject: 'Publish workflow v9: DOJ-Response',           requestedBy: 'M. Kirkland', requestedOn: '2026-04-19 14:08', stages: [{role:'Owner',name:'M. Kirkland',status:'approved'},{role:'Compliance',name:'J. Halperin',status:'approved'},{role:'Partner',name:'Senior Partner',status:'pending'}], deadline: '2026-04-21 12:00', risk: 'High', status: 'Pending', slaLeftHr: 20 },
    { id: 'APR-202', subject: 'Rotate secret: SAP Finance OAuth',              requestedBy: 'Platform Ops',requestedOn: '2026-04-18 09:02', stages: [{role:'Owner',name:'Platform Ops',status:'approved'},{role:'Security',name:'InfoSec',status:'approved'},{role:'Partner',name:'M. Kirkland',status:'approved'}], deadline: '2026-04-18 17:00', risk: 'High', status: 'Approved', slaLeftHr: 0 },
    { id: 'APR-201', subject: 'Deploy trigger: Auto-escalate P0 bench rulings',requestedBy: 'J. Park',    requestedOn: '2026-04-17 15:42', stages: [{role:'Owner',name:'J. Park',status:'approved'},{role:'Partner',name:'M. Kirkland',status:'rejected'}], deadline: '2026-04-18 17:00', risk: 'High', status: 'Rejected', slaLeftHr: 0 },
    { id: 'APR-200', subject: 'Add RBAC role: External Counsel (read-only)',   requestedBy: 'InfoSec',     requestedOn: '2026-04-16 11:22', stages: [{role:'Security',name:'InfoSec',status:'approved'},{role:'Partner',name:'M. Kirkland',status:'approved'}], deadline: '2026-04-18 17:00', risk: 'Low', status: 'Approved', slaLeftHr: 0 },
    { id: 'APR-199', subject: 'Purge DLQ entry DLQ-0178 (schema mismatch)',    requestedBy: 'Automation Ops',requestedOn: '2026-04-20 10:20', stages: [{role:'Owner',name:'Automation Ops',status:'approved'},{role:'Compliance',name:'J. Halperin',status:'pending'}], deadline: '2026-04-22 17:00', risk: 'Medium', status: 'Pending', slaLeftHr: 52 },
    { id: 'APR-198', subject: 'Publish marketplace template: FOIA Request Kit',requestedBy: 'L. Torres',   requestedOn: '2026-04-19 11:02', stages: [{role:'Owner',name:'L. Torres',status:'approved'},{role:'Knowledge Mgmt',name:'Knowledge Mgmt',status:'approved'},{role:'Partner',name:'M. Kirkland',status:'pending'}], deadline: '2026-04-22 12:00', risk: 'Low', status: 'Pending', slaLeftHr: 46 },
  ],

  // ── POLICY RULES ──
  policies: [
    { id: 'POL-001', name: 'All triggers must have audit log',                      category: 'Compliance',    severity: 'High',    scope: 'All triggers',     matches: 32, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Enforced at save-time.' },
    { id: 'POL-002', name: 'No workflow may deploy to prod without partner sign-off',category: 'Change',      severity: 'Critical', scope: 'Workflows',        matches: 28, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Blocks publish without APR approval.' },
    { id: 'POL-003', name: 'Secrets must rotate every 90 days',                     category: 'Security',      severity: 'Critical', scope: 'Credentials',     matches: 24, violations: 2,                                                   enabled: true, lastReviewed: '2026-04-12', note: '2 secrets nearing expiry — notified owners.' },
    { id: 'POL-004', name: 'Integration scopes must be least-privilege',            category: 'Security',      severity: 'High',    scope: 'Integrations',     matches: 14, violations: 1,                                                   enabled: true, lastReviewed: '2026-04-05', note: '1 scope flagged — ticket opened.' },
    { id: 'POL-005', name: 'PII-producing runs must log to DLP sink',               category: 'Privacy',       severity: 'High',    scope: 'Runs + Scripts',   matches: 18, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Enforced via runtime hook.' },
    { id: 'POL-006', name: 'Cross-border data transfer requires DPA attestation',   category: 'Privacy',       severity: 'Critical', scope: 'Integrations',    matches:  4, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Annual DPA renewal tracked.' },
    { id: 'POL-007', name: 'Workflow retries bounded by exponential backoff ≤ 5x',  category: 'Reliability',   severity: 'Medium',  scope: 'Workflows',        matches: 28, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Library-enforced.' },
    { id: 'POL-008', name: 'All scripts must pass SAST before publish',              category: 'Security',      severity: 'High',    scope: 'Scripts',          matches:  8, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Semgrep CI gate.' },
    { id: 'POL-009', name: 'Draft workflows auto-archive after 60 days inactivity', category: 'Hygiene',       severity: 'Low',     scope: 'Workflows',        matches: 12, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Cron scan weekly.' },
    { id: 'POL-010', name: 'External-counsel role cannot trigger production',        category: 'Access',        severity: 'Critical', scope: 'RBAC',            matches:  6, violations: 0,                                                   enabled: true, lastReviewed: '2026-04-12', note: 'Enforced by RBAC matrix.' },
  ],

  // ── RBAC ROLES + USERS ──
  rbacRoles: [
    { id: 'ROLE-01', name: 'Platform Admin',     users: 3,  permissions: 64, scope: 'All tenants',    sensitive: true,  lastReviewed: '2026-04-12' },
    { id: 'ROLE-02', name: 'Automation Engineer',users: 8,  permissions: 38, scope: 'Workflows + scripts', sensitive: true, lastReviewed: '2026-04-12' },
    { id: 'ROLE-03', name: 'Reviewer (Attorney)',users: 42, permissions: 18, scope: 'Own matters',    sensitive: false, lastReviewed: '2026-04-12' },
    { id: 'ROLE-04', name: 'Paralegal',          users: 24, permissions: 14, scope: 'Own matters',    sensitive: false, lastReviewed: '2026-04-12' },
    { id: 'ROLE-05', name: 'Partner (Sign-off)', users: 9,  permissions: 28, scope: 'All matters',    sensitive: true,  lastReviewed: '2026-04-12' },
    { id: 'ROLE-06', name: 'External Counsel',    users: 4,  permissions: 8,  scope: 'Guest matters',   sensitive: false, lastReviewed: '2026-04-12' },
    { id: 'ROLE-07', name: 'Compliance Auditor', users: 2,  permissions: 22, scope: 'Read-only all',   sensitive: true,  lastReviewed: '2026-04-12' },
  ],
  rbacTenants: [
    { id: 'TEN-01', name: 'Litigation',        users: 38, workflows: 12, workflowsPrivate: 4, integrations: 6, storage: '1.8 TB', owner: 'M. Kirkland' },
    { id: 'TEN-02', name: 'Criminal Defense',  users: 18, workflows:  8, workflowsPrivate: 2, integrations: 4, storage: '820 GB', owner: 'M. Kirkland' },
    { id: 'TEN-03', name: 'Regulatory',         users: 14, workflows:  6, workflowsPrivate: 3, integrations: 5, storage: '640 GB', owner: 'J. Halperin' },
    { id: 'TEN-04', name: 'IP Litigation',      users: 12, workflows:  4, workflowsPrivate: 1, integrations: 3, storage: '480 GB', owner: 'M. Kirkland' },
    { id: 'TEN-05', name: 'Billing Ops',         users:  8, workflows:  2, workflowsPrivate: 0, integrations: 2, storage:  '60 GB', owner: 'Billing Ops' },
    { id: 'TEN-06', name: 'Knowledge Mgmt',      users:  6, workflows:  4, workflowsPrivate: 1, integrations: 3, storage: '120 GB', owner: 'Knowledge Mgmt' },
  ],

  // ── COMPLIANCE FRAMEWORKS ──
  complianceFrameworks: [
    { id: 'CF-01', name: 'SOC 2 Type II',   controlsTotal: 64, controlsPassing: 64, findings: 0, lastAudit: '2026-02-10', nextAudit: '2027-02-10', auditor: 'BDO',     status: 'Certified' },
    { id: 'CF-02', name: 'ISO 27001',        controlsTotal: 114,controlsPassing: 113,findings: 1, lastAudit: '2026-01-14', nextAudit: '2026-10-14', auditor: 'BSI',     status: 'Certified' },
    { id: 'CF-03', name: 'ISO 27701 (PII)',  controlsTotal: 49, controlsPassing: 49, findings: 0, lastAudit: '2026-02-22', nextAudit: '2027-02-22', auditor: 'BSI',     status: 'Certified' },
    { id: 'CF-04', name: 'SOX ITGC',          controlsTotal: 28, controlsPassing: 28, findings: 0, lastAudit: '2026-03-18', nextAudit: '2026-09-18', auditor: 'Deloitte',status: 'Certified' },
    { id: 'CF-05', name: 'HIPAA Security',    controlsTotal: 54, controlsPassing: 53, findings: 1, lastAudit: '2026-02-28', nextAudit: '2027-02-28', auditor: 'HITRUST', status: 'Conditional' },
    { id: 'CF-06', name: 'NIST 800-53 Mod',   controlsTotal: 42, controlsPassing: 42, findings: 0, lastAudit: '2026-03-02', nextAudit: '2027-03-02', auditor: 'Firm InfoSec', status: 'Aligned' },
  ],

  // ── IaC EXPORTS (sample) ──
  iacExports: [
    { id: 'IAC-0118', artifact: 'MSJ-Opposition-Workflow', type: 'workflow', format: 'YAML', exportedOn: '2026-04-19 16:30', exportedBy: 'M. Kirkland', bytes: 8_240, gitRef: 'repo/autop/MSJ.yml@v14' },
    { id: 'IAC-0117', artifact: 'Review-Pipeline',          type: 'workflow', format: 'YAML', exportedOn: '2026-04-18 12:14', exportedBy: 'S. Chen',     bytes: 12_480,gitRef: 'repo/autop/Review.yml@v22' },
    { id: 'IAC-0116', artifact: 'TR-016',                   type: 'trigger',  format: 'JSON', exportedOn: '2026-04-20 08:24', exportedBy: 'M. Kirkland', bytes: 1_840, gitRef: 'repo/autop/triggers/TR-016.json@draft' },
    { id: 'IAC-0115', artifact: 'INT-007 SAP Finance',       type: 'integration', format: 'YAML', exportedOn: '2026-04-18 10:14', exportedBy: 'Platform Ops', bytes: 2_240, gitRef: 'repo/autop/integrations/sap.yml@v8' },
    { id: 'IAC-0114', artifact: 'POL-003 secrets rotation', type: 'policy',   format: 'YAML', exportedOn: '2026-04-12 09:00', exportedBy: 'InfoSec',      bytes: 640,   gitRef: 'repo/autop/policies/secrets.yml@v3' },
  ],

  // ── SECRETS VAULT ──
  secrets: [
    { id: 'SEC-0042', name: 'sap.oauth.client_secret',     category: 'OAuth',      owner: 'Platform Ops',  vault: 'Azure KV — prod',   lastRotated: '2026-04-18', rotateEvery: 90, expiresIn: 87, accesses30d: 412, scopes: ['finance.read','finance.write'],     status: 'Healthy' },
    { id: 'SEC-0041', name: 'lexis.api.token',               category: 'API Key',   owner: 'Knowledge Mgmt',vault: 'Azure KV — prod',  lastRotated: '2026-03-01', rotateEvery: 90, expiresIn: 39, accesses30d: 2_840,scopes: ['shepardize','cite-lookup'],            status: 'Due Soon' },
    { id: 'SEC-0040', name: 'okta.saml.private_key',         category: 'Cert/Key',  owner: 'InfoSec',       vault: 'HSM — prod',        lastRotated: '2026-01-20', rotateEvery: 180,expiresIn: 98, accesses30d: 12_420,scopes: ['sso.idp'],                           status: 'Healthy' },
    { id: 'SEC-0039', name: 'imanage.api.token',              category: 'API Key',   owner: 'eDiscovery',    vault: 'Azure KV — prod',  lastRotated: '2026-02-14', rotateEvery: 90, expiresIn: 24, accesses30d: 4_820,scopes: ['workspace.read','workspace.write'], status: 'Due Soon' },
    { id: 'SEC-0038', name: 'docusign.integration_key',       category: 'OAuth',    owner: 'Platform Ops',  vault: 'Azure KV — prod',  lastRotated: '2026-03-28', rotateEvery: 90, expiresIn: 66, accesses30d: 620,  scopes: ['envelope.send','envelope.read'],     status: 'Healthy' },
    { id: 'SEC-0037', name: 'pacer.scraper.creds',            category: 'Basic',    owner: 'Knowledge Mgmt',vault: 'Azure KV — prod',  lastRotated: '2026-01-12', rotateEvery: 60, expiresIn: -4, accesses30d: 8_420,scopes: ['docket.read'],                        status: 'Expired' },
    { id: 'SEC-0036', name: 'slack.webhook.partner-alerts',   category: 'Webhook',  owner: 'Automation Ops',vault: 'Azure KV — prod',  lastRotated: '2026-03-05', rotateEvery: 365,expiresIn: 319,accesses30d: 412,  scopes: ['messages.write'],                      status: 'Healthy' },
    { id: 'SEC-0035', name: 'clio.api.token',                 category: 'API Key',  owner: 'Billing Ops',   vault: 'Azure KV — prod',  lastRotated: '2026-04-01', rotateEvery: 90, expiresIn: 70, accesses30d: 1_240,scopes: ['billing.read','billing.write'],      status: 'Healthy' },
    { id: 'SEC-0034', name: 'azure.devai.key',                category: 'API Key',  owner: 'eDiscovery',    vault: 'Azure KV — prod',  lastRotated: '2026-04-18', rotateEvery: 90, expiresIn: 88, accesses30d: 18_420,scopes: ['document.read','ocr'],              status: 'Healthy' },
    { id: 'SEC-0033', name: 'westlaw.api.token',              category: 'API Key',  owner: 'Knowledge Mgmt',vault: 'Azure KV — prod',  lastRotated: '2026-02-01', rotateEvery: 90, expiresIn: 12, accesses30d: 3_240,scopes: ['cite-lookup','citator'],             status: 'Due Soon' },
  ],

  // ── COST ATTRIBUTION ──
  costKpis: { mtd: 42_820, ytd: 284_200, avgRunCost: 0.84, projectedEoyPct: 104, savingsYtd: 128_400, chargebackRecovered: 241_800 },
  costByWorkflow: [
    { workflow: 'Review-Pipeline',       runs: 384, mtd: 12_480, ytd: 84_200, avgRunCost: 2.12, trend: '+8%' },
    { workflow: 'MSJ-Opposition-Workflow',runs: 18,  mtd:  4_820, ytd: 28_400, avgRunCost: 18.40,trend: '+18%' },
    { workflow: 'Pre-Bill-Approval',      runs: 212, mtd:  1_820, ytd: 12_420, avgRunCost: 0.42, trend: '-4%' },
    { workflow: 'DOJ-Response',            runs: 6,   mtd:  3_840, ytd: 18_200, avgRunCost: 42.10,trend: '+32%' },
    { workflow: 'Hearing-Prep-Workflow',   runs: 14,  mtd:  2_840, ytd: 18_400, avgRunCost: 14.80,trend: '+6%' },
    { workflow: 'Litigation-Hold-Issuance',runs: 24,  mtd:    420, ytd:  3_640, avgRunCost: 0.24, trend: '-2%' },
    { workflow: 'Cite-Check-Batch',        runs: 84,  mtd:  1_240, ytd:  9_420, avgRunCost: 0.88, trend: '+4%' },
    { workflow: 'Oral-Arg-Prep',           runs: 12,  mtd:  3_820, ytd: 24_000, avgRunCost: 18.20,trend: '+9%' },
  ],
  costByTenant: [
    { tenant: 'Litigation',       mtd: 18_420, ytd: 124_200, runs: 482, chargeback: 'Enabled' },
    { tenant: 'Criminal Defense', mtd:  6_820, ytd:  48_200, runs: 188, chargeback: 'Enabled' },
    { tenant: 'Regulatory',        mtd:  9_240, ytd:  62_800, runs:  86, chargeback: 'Enabled' },
    { tenant: 'IP Litigation',     mtd:  4_820, ytd:  28_400, runs:  62, chargeback: 'Enabled' },
    { tenant: 'Billing Ops',        mtd:  1_820, ytd:  12_420, runs: 212, chargeback: 'Internal' },
    { tenant: 'Knowledge Mgmt',     mtd:  1_700, ytd:   8_180, runs: 118, chargeback: 'Internal' },
  ],
  licenses: [
    { vendor: 'Azure AI / OpenAI',    product: 'GPT-4o reasoning',    commit: 'Enterprise',    utilizationPct: 82, mtdSpend: 12_800, capMtd: 15_000, status: 'Healthy' },
    { vendor: 'Lexis',                product: 'Shepard API',          commit: 'Tier 3',        utilizationPct: 94, mtdSpend:  4_200, capMtd:  4_500, status: 'Near Cap' },
    { vendor: 'Westlaw',              product: 'Citator',              commit: 'Tier 3',        utilizationPct: 62, mtdSpend:  2_840, capMtd:  4_600, status: 'Healthy' },
    { vendor: 'DocuSign',             product: 'Envelopes',            commit: '1000/mo',       utilizationPct: 84, mtdSpend:    840, capMtd:  1_000, status: 'Healthy' },
    { vendor: 'iManage',              product: 'Work 10 seats',        commit: '60 seats',      utilizationPct: 92, mtdSpend:  4_820, capMtd:  5_240, status: 'Near Cap' },
    { vendor: 'Smarsh',               product: 'Enterprise archive',   commit: 'Unlimited',      utilizationPct: 0,  mtdSpend:  3_200, capMtd:  3_200, status: 'Healthy' },
  ],

  // ── AUTHORING — Event Schemas ──
  eventSchemas: [
    { id: 'SCH-001', event: 'court.order.scraped',  version: 'v3', owner: 'Knowledge Mgmt',  consumers: 4, breaking: false, lastChanged: '2026-03-18', fields: 14, deprecated: 0, tests: 28, valid: true },
    { id: 'SCH-002', event: 'payment.received',      version: 'v5', owner: 'Billing Ops',     consumers: 3, breaking: false, lastChanged: '2026-03-22', fields: 18, deprecated: 2, tests: 32, valid: true },
    { id: 'SCH-003', event: 'matter.stage.changed',  version: 'v4', owner: 'Litigation',      consumers: 6, breaking: true,  lastChanged: '2026-04-10', fields: 11, deprecated: 3, tests: 18, valid: true },
    { id: 'SCH-004', event: 'document.signed',        version: 'v2', owner: 'Litigation',      consumers: 5, breaking: false, lastChanged: '2026-02-14', fields:  9, deprecated: 0, tests: 14, valid: true },
    { id: 'SCH-005', event: 'pii.detected',           version: 'v2', owner: 'Compliance',       consumers: 4, breaking: false, lastChanged: '2026-03-02', fields:  7, deprecated: 0, tests: 22, valid: true },
    { id: 'SCH-006', event: 'review.batch.completed', version: 'v6', owner: 'eDiscovery',       consumers: 3, breaking: false, lastChanged: '2026-04-04', fields: 16, deprecated: 1, tests: 28, valid: true },
    { id: 'SCH-007', event: 'deposition.scheduled',   version: 'v1', owner: 'Litigation',       consumers: 2, breaking: false, lastChanged: '2026-01-18', fields: 12, deprecated: 0, tests: 14, valid: true },
    { id: 'SCH-008', event: 'ruling.published',       version: 'v1', owner: 'Knowledge Mgmt',  consumers: 5, breaking: false, lastChanged: '2026-04-08', fields: 10, deprecated: 0, tests: 18, valid: true },
    { id: 'SCH-009', event: 'trigger.fired',          version: 'v2', owner: 'Platform Ops',     consumers: 8, breaking: false, lastChanged: '2026-01-08', fields:  8, deprecated: 0, tests: 24, valid: true },
    { id: 'SCH-010', event: 'hold.acknowledged',      version: 'v1', owner: 'eDiscovery',       consumers: 2, breaking: false, lastChanged: '2026-02-01', fields:  6, deprecated: 0, tests: 12, valid: true },
  ],

  // ── AUTHORING — A/B Variants ──
  variants: [
    { id: 'AB-012', base: 'Review-Pipeline v22', variant: 'Review-Pipeline v23-canary', allocationPct: 10, runsBase: 348, runsVariant: 36, p95Base: '28m', p95Variant: '24m', successBase: 98.9, successVariant: 99.4, delta: '+0.5pp', status: 'Canary', recommendation: 'Promote', owner: 'S. Chen' },
    { id: 'AB-011', base: 'MSJ-Opposition v13',   variant: 'MSJ-Opposition v14',         allocationPct: 50, runsBase:  9,  runsVariant:  9,  p95Base: '9h 48m',p95Variant:'9h 12m',successBase: 97.2,successVariant: 98.4, delta: '+1.2pp', status: 'Promoted', recommendation: 'Done', owner: 'M. Kirkland' },
    { id: 'AB-010', base: 'Cite-Check v5',        variant: 'Cite-Check v6-retry',         allocationPct: 20, runsBase:  68,  runsVariant: 16, p95Base: '112m',  p95Variant: '84m',  successBase: 94.8, successVariant: 98.1, delta: '+3.3pp', status: 'Canary', recommendation: 'Promote', owner: 'Knowledge Mgmt' },
    { id: 'AB-009', base: 'DOJ-Response v8',      variant: 'DOJ-Response v9-timeline',    allocationPct:  5, runsBase:   6,  runsVariant:  1, p95Base: '8h 12m',p95Variant:'9h 42m',successBase: 92.3,successVariant: 100,   delta: '—',     status: 'Canary', recommendation: 'Hold — underpowered', owner: 'M. Kirkland' },
    { id: 'AB-008', base: 'Intake v6',             variant: 'Intake v7-fastpath',          allocationPct:  0, runsBase: 142, runsVariant: 48, p95Base: '32m',   p95Variant: '28m',   successBase: 99.3, successVariant: 99.2, delta: '-0.1pp', status: 'Ended',  recommendation: 'Reject', owner: 'Knowledge Mgmt' },
  ],

  // ── AUTHORING — Marketplace ──
  marketplaceTemplates: [
    { id: 'MKT-041', name: 'FOIA Request Kit',                 publisher: 'L. Torres (internal)', version: 'v2.0', installs: 12, rating: 4.8, ratings: 18, tenants: ['Litigation','Regulatory'],        certified: true,  status: 'Published' },
    { id: 'MKT-040', name: 'Daubert Motion Pack',               publisher: 'Litigation (team)',   version: 'v3.1', installs: 28, rating: 4.9, ratings: 42, tenants: ['Litigation','Criminal Defense'],   certified: true,  status: 'Published' },
    { id: 'MKT-039', name: 'Sentencing Memo Accelerator',       publisher: 'M. Kirkland',          version: 'v1.4', installs: 14, rating: 4.6, ratings: 22, tenants: ['Criminal Defense'],                certified: true,  status: 'Published' },
    { id: 'MKT-038', name: 'Privilege-Review Starter',          publisher: 'eDiscovery (team)',    version: 'v2.2', installs: 42, rating: 4.8, ratings: 38, tenants: ['Litigation','Regulatory'],         certified: true,  status: 'Published' },
    { id: 'MKT-037', name: 'DOJ CID Response Suite',            publisher: 'Regulatory (team)',    version: 'v1.1', installs:  8, rating: 4.4, ratings:  8, tenants: ['Regulatory'],                      certified: true,  status: 'Published' },
    { id: 'MKT-036', name: 'Pre-Bill Fast-Path',                 publisher: 'Billing Ops',          version: 'v1.8', installs: 18, rating: 4.7, ratings: 12, tenants: ['Billing Ops','Litigation'],         certified: true,  status: 'Published' },
    { id: 'MKT-035', name: 'Oral Argument Moot Round',          publisher: 'Litigation (team)',    version: 'v1.0', installs:  6, rating: 4.9, ratings:  8, tenants: ['Litigation'],                      certified: false, status: 'Draft' },
    { id: 'MKT-034', name: 'Rule 30(b)(6) Prep Pack',            publisher: 'Litigation (team)',    version: 'v1.2', installs: 14, rating: 4.5, ratings: 11, tenants: ['Litigation'],                      certified: true,  status: 'Published' },
  ],

  // ── OPS — HITL INBOX ──
  hitlInbox: [
    { id: 'HITL-148', title: 'Review flagged hot-doc before promotion',           workflow: 'Review-Pipeline',    runId: 'RUN-8420', waitingFor: 'L. Torres', slaLeftMin: 32,  priority: 'P0', batch: 1, createdAt: '2026-04-20 10:28', escalatesTo: 'M. Kirkland', status: 'Waiting' },
    { id: 'HITL-147', title: 'Approve CID payload package before DOJ transfer',    workflow: 'DOJ-Response',       runId: 'RUN-8408', waitingFor: 'M. Kirkland', slaLeftMin: 180,  priority: 'P0', batch: 1, createdAt: '2026-04-20 08:12', escalatesTo: 'Senior Partner', status: 'Waiting' },
    { id: 'HITL-146', title: 'Confirm witness list — Bishop depo exhibits',        workflow: 'Deposition-Workflow',runId: 'RUN-8404', waitingFor: 'S. Chen',    slaLeftMin: 420, priority: 'P1', batch: 1, createdAt: '2026-04-19 16:40', escalatesTo: 'L. Torres', status: 'Waiting' },
    { id: 'HITL-145', title: 'Sign off on pre-bill batch PB-4812 (38 entries)',    workflow: 'Pre-Bill-Approval',   runId: 'RUN-8400', waitingFor: 'M. Kirkland', slaLeftMin: 60,   priority: 'P1', batch: 38, createdAt: '2026-04-20 09:12', escalatesTo: 'Partner (on-call)', status: 'Waiting' },
    { id: 'HITL-144', title: 'Approve partner review of Markman brief v4',         workflow: 'Partner-Review',      runId: 'RUN-8395', waitingFor: 'M. Kirkland', slaLeftMin: -40,  priority: 'P1', batch: 1, createdAt: '2026-04-19 12:00', escalatesTo: 'Senior Partner', status: 'Overdue' },
    { id: 'HITL-143', title: 'Approve litigation hold — 6 new custodians',          workflow: 'Litigation-Hold-Issuance', runId: 'RUN-8390', waitingFor: 'J. Halperin', slaLeftMin: 240, priority: 'P0', batch: 6, createdAt: '2026-04-20 08:00', escalatesTo: 'M. Kirkland', status: 'Waiting' },
    { id: 'HITL-142', title: 'Confirm FCPA production boundary — Sterling APAC',    workflow: 'DOJ-Response',       runId: 'RUN-8385', waitingFor: 'M. Kirkland', slaLeftMin: 600,  priority: 'P0', batch: 1, createdAt: '2026-04-20 07:30', escalatesTo: 'Senior Partner', status: 'Waiting' },
    { id: 'HITL-141', title: 'Sign sentencing memo final — Barnwell',              workflow: 'Sentencing-Workflow', runId: 'RUN-8380', waitingFor: 'L. Torres', slaLeftMin: 1_200, priority: 'P0', batch: 1, createdAt: '2026-04-19 14:00', escalatesTo: 'M. Kirkland', status: 'Waiting' },
  ],
};

window.AUTO_DATA = AUTO_DATA;
