/* ===== data.jsx — seed data ===== */
(function () {
  // Users
  const users = [
    { id: 'u-1', name: 'Marco Bianchi', email: 'marco@firsteck.bio', role: 'admin',   avatar: 'MB', active: true,  last_login: '2026-05-28' },
    { id: 'u-2', name: 'Giulia Romano', email: 'giulia@firsteck.bio', role: 'manager', avatar: 'GR', active: true,  last_login: '2026-05-27' },
    { id: 'u-3', name: '李 文 (Wen Li)', email: 'wen@firsteck.bio', role: 'manager', avatar: '李', active: true,  last_login: '2026-05-26' },
    { id: 'u-4', name: 'Davide Conti',  email: 'davide@firsteck.bio', role: 'viewer',  avatar: 'DC', active: true,  last_login: '2026-05-20' },
    { id: 'u-5', name: 'Sara Greco',    email: 'sara@firsteck.bio', role: 'viewer',  avatar: 'SG', active: false, last_login: '2026-03-12' },
  ];

  // Suppliers (vendors who sell us reagents/devices)
  const suppliers = [
    { id: 's-1', name: 'Merck Italia (Sigma-Aldrich)', short: 'Merck', country: 'IT', city: 'Milano', contact: 'Andrea Pellegrini', email: 'a.pellegrini@merckgroup.com', phone: '+39 02 33203 1', vat: 'IT11649140157', payment_terms: 'Net 30', tags: ['reagent', 'antibody'], archived: false, created: '2024-08-12' },
    { id: 's-2', name: 'Thermo Fisher Scientific',     short: 'Thermo', country: 'IT', city: 'Rodano',  contact: 'Lucia Marini', email: 'lucia.marini@thermofisher.com', phone: '+39 02 95059 1', vat: 'IT12835820158', payment_terms: 'Net 45', tags: ['reagent', 'device'], archived: false, created: '2024-08-12' },
    { id: 's-3', name: 'Qiagen S.r.l.',                 short: 'Qiagen', country: 'IT', city: 'Milano', contact: 'Roberto Ferri', email: 'r.ferri@qiagen.com', phone: '+39 02 33430411', vat: 'IT12345678901', payment_terms: 'Net 30', tags: ['reagent'], archived: false, created: '2024-09-03' },
    { id: 's-4', name: 'Bio-Rad Laboratories',          short: 'Bio-Rad', country: 'IT', city: 'Segrate', contact: 'Federica Costa', email: 'federica_costa@bio-rad.com', phone: '+39 02 21609 1', vat: 'IT09876543210', payment_terms: 'Net 30', tags: ['reagent', 'device'], archived: false, created: '2024-10-14' },
    { id: 's-5', name: 'Eppendorf Italia',              short: 'Eppendorf', country: 'IT', city: 'Milano', contact: 'Matteo Russo', email: 'russo.m@eppendorf.it', phone: '+39 02 55404 1', vat: 'IT04567891230', payment_terms: 'Net 60', tags: ['device'], archived: false, created: '2024-11-02' },
    { id: 's-6', name: 'Roche Diagnostics',             short: 'Roche', country: 'IT', city: 'Monza', contact: 'Chiara Bruno', email: 'chiara.bruno@roche.com', phone: '+39 039 2817 1', vat: 'IT07654321098', payment_terms: 'Net 30', tags: ['reagent'], archived: false, created: '2025-01-08' },
    { id: 's-7', name: 'VWR International (Avantor)',   short: 'VWR', country: 'IT', city: 'Milano', contact: 'Stefano Greco', email: 's.greco@vwr.com', phone: '+39 02 33203 411', vat: 'IT03456789120', payment_terms: 'Net 30', tags: ['reagent', 'consumable'], archived: false, created: '2025-02-19' },
    { id: 's-8', name: 'Beckman Coulter (archiviato)',  short: 'Beckman', country: 'IT', city: 'Cassina',  contact: 'Paolo Neri', email: 'p.neri@beckman.com', phone: '+39 02 95392 1', vat: 'IT02345678901', payment_terms: 'Net 45', tags: ['device'], archived: true, created: '2024-06-01' },
  ];

  // Customers (labs / clinics we ship to)
  const customers = [
    { id: 'c-1', name: 'Ospedale San Raffaele',         short: 'San Raffaele', country: 'IT', city: 'Milano',  contact: 'Dr. Antonio Conti',      email: 'a.conti@hsr.it',      phone: '+39 02 2643 1', vat: 'IT10115570158', tags: ['ospedale', 'oncologia'], archived: false, created: '2024-08-15' },
    { id: 'c-2', name: 'Policlinico Gemelli',           short: 'Gemelli',     country: 'IT', city: 'Roma',    contact: 'Dr.ssa Elena Moretti',    email: 'e.moretti@policlinicogemelli.it', phone: '+39 06 30151', vat: 'IT13109681000', tags: ['ospedale'], archived: false, created: '2024-08-15' },
    { id: 'c-3', name: 'Istituto Europeo di Oncologia', short: 'IEO',         country: 'IT', city: 'Milano',  contact: 'Dr. Luca Esposito',       email: 'luca.esposito@ieo.it', phone: '+39 02 5748 9111', vat: 'IT08691440153', tags: ['ricerca', 'oncologia'], archived: false, created: '2024-09-01' },
    { id: 'c-4', name: 'IRCCS Humanitas',                short: 'Humanitas', country: 'IT', city: 'Rozzano', contact: 'Dr.ssa Valeria Ricci',    email: 'valeria.ricci@humanitas.it', phone: '+39 02 8224 1', vat: 'IT10125660155', tags: ['ricerca'], archived: false, created: '2024-09-22' },
    { id: 'c-5', name: 'Università degli Studi di Milano', short: 'UniMI', country: 'IT', city: 'Milano',  contact: 'Prof. Giorgio Galli',     email: 'g.galli@unimi.it', phone: '+39 02 5031 1', vat: 'IT03064870151', tags: ['università'], archived: false, created: '2024-10-10' },
    { id: 'c-6', name: 'Centro Diagnostico Italiano',    short: 'CDI', country: 'IT', city: 'Milano',  contact: 'Dr. Marco Lombardi',      email: 'm.lombardi@cdi.it', phone: '+39 02 4838 1', vat: 'IT04793180155', tags: ['diagnostica'], archived: false, created: '2024-11-04' },
    { id: 'c-7', name: 'BioLab Firenze',                 short: 'BioLab FI', country: 'IT', city: 'Firenze', contact: 'Dr.ssa Anna Marchetti', email: 'a.marchetti@biolab-fi.it', phone: '+39 055 2380 1', vat: 'IT05673820488', tags: ['privato'], archived: false, created: '2025-01-20' },
    { id: 'c-8', name: 'Lab Privato Genova',             short: 'Lab GE', country: 'IT', city: 'Genova',  contact: 'Dr. Paolo Vitali',        email: 'p.vitali@labge.it', phone: '+39 010 5531', vat: 'IT01345670108', tags: ['privato'], archived: false, created: '2025-03-08' },
  ];

  // Reagent Products (SKU catalog)
  const reagent_products = [
    { id: 'rp-1', name: 'Allergen Panel ELISA Kit',     code: 'ALG-96',  supplier_id: 's-1', cat_no: 'RAG-1042', tests_per_box: 96, unit: 'kit',    low_threshold: 3, storage: '2–8 °C', tags: ['ELISA', 'allergen'] },
    { id: 'rp-2', name: 'PCR Master Mix 2×',            code: 'PMM-2X',  supplier_id: 's-2', cat_no: 'TFS-4304437', tests_per_box: 200, unit: 'kit', low_threshold: 4, storage: '-20 °C', tags: ['PCR'] },
    { id: 'rp-3', name: 'Anti-CD3 Antibody Clone OKT3', code: 'CD3-OKT3', supplier_id: 's-1', cat_no: 'M-MAB16-100', tests_per_box: 100, unit: 'vial', low_threshold: 2, storage: '4 °C', tags: ['antibody', 'flow'] },
    { id: 'rp-4', name: 'DNA Extraction Kit (Spin Column)', code: 'DNA-EXT', supplier_id: 's-3', cat_no: 'QGN-69504', tests_per_box: 50, unit: 'kit', low_threshold: 3, storage: 'RT', tags: ['DNA', 'extraction'] },
    { id: 'rp-5', name: 'COVID-19 Antigen Rapid Test',  code: 'COV-AG',  supplier_id: 's-6', cat_no: 'ROC-9901230', tests_per_box: 25, unit: 'kit', low_threshold: 5, storage: '2–30 °C', tags: ['rapid', 'covid'] },
    { id: 'rp-6', name: 'Glucose Assay Kit',            code: 'GLU-KIT', supplier_id: 's-1', cat_no: 'M-MAK263', tests_per_box: 100, unit: 'kit', low_threshold: 2, storage: '2–8 °C', tags: ['assay'] },
    { id: 'rp-7', name: 'TaqMan Probe SARS-CoV-2',      code: 'TQM-SCV2', supplier_id: 's-2', cat_no: 'TFS-A47532', tests_per_box: 200, unit: 'kit', low_threshold: 3, storage: '-20 °C', tags: ['PCR', 'taqman'] },
    { id: 'rp-8', name: 'Insulin ELISA Kit',            code: 'INS-ELI', supplier_id: 's-4', cat_no: 'BR-10-1113-01', tests_per_box: 96, unit: 'kit', low_threshold: 2, storage: '2–8 °C', tags: ['ELISA'] },
    { id: 'rp-9', name: 'Trypsin-EDTA 0.25%',           code: 'TRP-EDTA', supplier_id: 's-2', cat_no: 'TFS-25200056', tests_per_box: 10, unit: 'btl', low_threshold: 6, storage: '-20 °C', tags: ['cell culture'] },
    { id: 'rp-10', name: 'Cell Lysis Buffer',           code: 'LYS-BUF', supplier_id: 's-7', cat_no: 'VWR-101447-024', tests_per_box: 20, unit: 'btl', low_threshold: 4, storage: 'RT', tags: ['buffer'] },
  ];

  // Reagent Batches
  const reagent_batches = [
    { id: 'rb-1',  product_id: 'rp-1', lot: 'L240712A', supplier_id: 's-1', received: '2024-07-15', expiry: '2026-07-15', received_boxes: 12, on_hand_boxes: 7, on_hand_atoms: 3, location: 'FB · A-1-04', cost_per_box: 480, last_movement: '2026-05-22' },
    { id: 'rb-2',  product_id: 'rp-1', lot: 'L250118C', supplier_id: 's-1', received: '2025-01-22', expiry: '2027-01-22', received_boxes: 10, on_hand_boxes: 10, on_hand_atoms: 0, location: 'FB · A-1-05', cost_per_box: 495, last_movement: '2025-01-22' },
    { id: 'rb-3',  product_id: 'rp-2', lot: 'TF-2024-119', supplier_id: 's-2', received: '2024-11-30', expiry: '2026-06-15', received_boxes: 8,  on_hand_boxes: 2, on_hand_atoms: 50, location: 'FB · -20 freezer 2', cost_per_box: 320, last_movement: '2026-05-15' },
    { id: 'rb-4',  product_id: 'rp-3', lot: 'M250203', supplier_id: 's-1', received: '2025-02-10', expiry: '2026-08-10', received_boxes: 5, on_hand_boxes: 1, on_hand_atoms: 20, location: 'FB · 4°C R-2', cost_per_box: 720, last_movement: '2026-05-12' },
    { id: 'rb-5',  product_id: 'rp-4', lot: 'QG-2503-77', supplier_id: 's-3', received: '2025-03-04', expiry: '2027-03-04', received_boxes: 6, on_hand_boxes: 5, on_hand_atoms: 0, location: 'FB · B-2-02', cost_per_box: 280, last_movement: '2026-04-10' },
    { id: 'rb-6',  product_id: 'rp-5', lot: 'RC-COV-411', supplier_id: 's-6', received: '2025-04-11', expiry: '2026-04-11', received_boxes: 30, on_hand_boxes: 4, on_hand_atoms: 12, location: 'FB · C-1-01', cost_per_box: 95, last_movement: '2026-04-29' },
    { id: 'rb-7',  product_id: 'rp-7', lot: 'TF-TQ-9912', supplier_id: 's-2', received: '2025-05-08', expiry: '2026-07-30', received_boxes: 4, on_hand_boxes: 4, on_hand_atoms: 0, location: 'FB · -20 freezer 1', cost_per_box: 410, last_movement: '2025-05-08' },
    { id: 'rb-8',  product_id: 'rp-6', lot: 'M250520', supplier_id: 's-1', received: '2025-05-20', expiry: '2027-05-20', received_boxes: 8, on_hand_boxes: 8, on_hand_atoms: 0, location: 'FB · A-2-03', cost_per_box: 165, last_movement: '2025-05-20' },
    { id: 'rb-9',  product_id: 'rp-8', lot: 'BR-2506-12', supplier_id: 's-4', received: '2025-06-12', expiry: '2026-12-12', received_boxes: 4, on_hand_boxes: 3, on_hand_atoms: 0, location: 'FB · B-1-04', cost_per_box: 520, last_movement: '2026-03-18' },
    { id: 'rb-10', product_id: 'rp-9', lot: 'TF-TR-808', supplier_id: 's-2', received: '2025-08-08', expiry: '2026-08-08', received_boxes: 20, on_hand_boxes: 14, on_hand_atoms: 0, location: 'FB · -20 freezer 2', cost_per_box: 48, last_movement: '2026-05-10' },
    { id: 'rb-11', product_id: 'rp-10', lot: 'VWR-2024-04', supplier_id: 's-7', received: '2024-04-01', expiry: '2027-04-01', received_boxes: 10, on_hand_boxes: 8, on_hand_atoms: 0, location: 'FB · A-3-01', cost_per_box: 22, last_movement: '2025-05-03' }, // STALE
    { id: 'rb-12', product_id: 'rp-2', lot: 'TF-2023-444', supplier_id: 's-2', received: '2024-02-15', expiry: '2025-12-31', received_boxes: 6, on_hand_boxes: 1, on_hand_atoms: 30, location: 'FB · -20 freezer 2', cost_per_box: 305, last_movement: '2026-04-18' }, // EXPIRED
  ];

  // Reagent Outflows (取货)
  const reagent_outflows = [
    { id: 'ro-1', batch_id: 'rb-1', customer_id: 'c-1', taken_at: '2026-05-22', taken_boxes: 1, taken_atoms: 0, due_at: '2026-06-22', returned_at: null, returned_boxes: 0, returned_atoms: 0, by_user: 'u-2', note: '常规补给' },
    { id: 'ro-2', batch_id: 'rb-3', customer_id: 'c-3', taken_at: '2026-04-10', taken_boxes: 1, taken_atoms: 0, due_at: '2026-05-10', returned_at: null, returned_boxes: 0, returned_atoms: 0, by_user: 'u-3', note: '试用，未还' }, // OUTFLOW_OVER
    { id: 'ro-3', batch_id: 'rb-4', customer_id: 'c-2', taken_at: '2026-05-12', taken_boxes: 0, taken_atoms: 20, due_at: '2026-06-12', returned_at: null, returned_boxes: 0, returned_atoms: 0, by_user: 'u-2', note: '' },
    { id: 'ro-4', batch_id: 'rb-5', customer_id: 'c-4', taken_at: '2026-04-10', taken_boxes: 1, taken_atoms: 0, due_at: '2026-05-10', returned_at: '2026-05-08', returned_boxes: 1, returned_atoms: 0, by_user: 'u-3', note: '已归还' },
    { id: 'ro-5', batch_id: 'rb-6', customer_id: 'c-5', taken_at: '2026-04-29', taken_boxes: 2, taken_atoms: 12, due_at: '2026-05-29', returned_at: null, returned_boxes: 0, returned_atoms: 0, by_user: 'u-2', note: '' },
    { id: 'ro-6', batch_id: 'rb-10', customer_id: 'c-6', taken_at: '2026-05-10', taken_boxes: 2, taken_atoms: 0, due_at: '2026-05-25', returned_at: null, returned_boxes: 0, returned_atoms: 0, by_user: 'u-3', note: '' }, // OUTFLOW_OVER
    { id: 'ro-7', batch_id: 'rb-1', customer_id: 'c-1', taken_at: '2026-03-12', taken_boxes: 2, taken_atoms: 0, due_at: '2026-04-12', returned_at: '2026-04-10', returned_boxes: 2, returned_atoms: 0, by_user: 'u-2', note: '' },
    { id: 'ro-8', batch_id: 'rb-2', customer_id: 'c-7', taken_at: '2026-02-20', taken_boxes: 1, taken_atoms: 0, due_at: '2026-03-20', returned_at: '2026-03-18', returned_boxes: 1, returned_atoms: 0, by_user: 'u-3', note: '' },
  ];

  // Device Products (Models)
  const device_products = [
    { id: 'dp-1', name: 'Centrifuge 5810 R',         model: 'EP-5810R',  brand: 'Eppendorf',    supplier_id: 's-5', category: 'centrifuge', list_price: 9800, image: null },
    { id: 'dp-2', name: 'Real-Time PCR System',      model: 'QS-7Flex',  brand: 'Applied Biosystems', supplier_id: 's-2', category: 'pcr', list_price: 32500, image: null },
    { id: 'dp-3', name: 'Microplate Reader',         model: 'iMark-680', brand: 'Bio-Rad',       supplier_id: 's-4', category: 'reader', list_price: 8200, image: null },
    { id: 'dp-4', name: '-80 °C Upright Freezer',    model: 'TSX-600',   brand: 'Thermo Fisher', supplier_id: 's-2', category: 'storage', list_price: 14200, image: null },
    { id: 'dp-5', name: 'Pipette Multi-channel 12',  model: 'EP-Xplorer-12', brand: 'Eppendorf', supplier_id: 's-5', category: 'pipette', list_price: 1280, image: null },
    { id: 'dp-6', name: 'Biosafety Cabinet Class II', model: 'BSC-2A',    brand: 'Thermo Fisher', supplier_id: 's-2', category: 'safety', list_price: 11500, image: null },
    { id: 'dp-7', name: 'Vortex Mixer',              model: 'VX-100',    brand: 'VWR',           supplier_id: 's-7', category: 'mixer', list_price: 480, image: null },
  ];

  // Device Units (per-SN)
  const device_units = [
    { id: 'du-1', product_id: 'dp-1', sn: '5810R-2024-0091', purchased: '2024-09-15', warranty_until: '2026-09-15', status: 'AT_CUSTOMER', cur_holder: { kind: 'customer', id: 'c-3' }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-2', product_id: 'dp-1', sn: '5810R-2024-0093', purchased: '2024-09-15', warranty_until: '2026-09-15', status: 'IN_STOCK',     cur_holder: { kind: 'fb',       id: null }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-3', product_id: 'dp-2', sn: 'QS7-2024-1145',   purchased: '2024-10-04', warranty_until: '2027-10-04', status: 'AT_CUSTOMER', cur_holder: { kind: 'customer', id: 'c-1' }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-4', product_id: 'dp-2', sn: null,              purchased: '2025-02-18', warranty_until: '2028-02-18', status: 'IN_STOCK',     cur_holder: { kind: 'fb',       id: null }, fault_note: null, sent_to_repair_at: null, has_sn: false }, // missing SN
    { id: 'du-5', product_id: 'dp-3', sn: 'IM680-23-440',     purchased: '2023-11-22', warranty_until: '2025-11-22', status: 'FAULT', cur_holder: { kind: 'supplier', id: 's-4' }, fault_note: '光源故障，读数不稳', sent_to_repair_at: '2026-02-10', has_sn: true }, // FAULT + REPAIR_OVER
    { id: 'du-6', product_id: 'dp-3', sn: 'IM680-24-221',     purchased: '2024-06-11', warranty_until: '2026-06-11', status: 'AT_CUSTOMER', cur_holder: { kind: 'customer', id: 'c-4' }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-7', product_id: 'dp-4', sn: 'TSX-600-22-0044',  purchased: '2022-04-04', warranty_until: '2025-04-04', status: 'FAULT', cur_holder: { kind: 'fb', id: null }, fault_note: '压缩机异响 — 待送修', sent_to_repair_at: null, has_sn: true },
    { id: 'du-8', product_id: 'dp-5', sn: 'XP12-25-009',      purchased: '2025-03-01', warranty_until: '2027-03-01', status: 'IN_STOCK', cur_holder: { kind: 'fb', id: null }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-9', product_id: 'dp-5', sn: 'XP12-25-010',      purchased: '2025-03-01', warranty_until: '2027-03-01', status: 'AT_CUSTOMER', cur_holder: { kind: 'customer', id: 'c-2' }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-10', product_id: 'dp-6', sn: 'BSC2A-2024-018',  purchased: '2024-05-20', warranty_until: '2027-05-20', status: 'AT_CUSTOMER', cur_holder: { kind: 'customer', id: 'c-5' }, fault_note: null, sent_to_repair_at: null, has_sn: true },
    { id: 'du-11', product_id: 'dp-7', sn: null,              purchased: '2025-04-15', warranty_until: '2026-04-15', status: 'IN_STOCK', cur_holder: { kind: 'fb', id: null }, fault_note: null, sent_to_repair_at: null, has_sn: false }, // missing SN
    { id: 'du-12', product_id: 'dp-7', sn: 'VX-100-25-882',    purchased: '2025-04-15', warranty_until: '2026-04-15', status: 'IN_STOCK', cur_holder: { kind: 'fb', id: null }, fault_note: null, sent_to_repair_at: null, has_sn: true },
  ];

  // Device Transfers — chain per unit
  const device_transfers = [
    // du-1: FB → A (c-1) → B (c-3)
    { id: 'dt-1',  unit_id: 'du-1', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-1' }, date: '2024-10-01', by_user: 'u-2', note: '初次配置交付' },
    { id: 'dt-2',  unit_id: 'du-1', from: { kind: 'customer', id: 'c-1' }, to:   { kind: 'customer', id: 'c-3' }, date: '2025-08-12', by_user: 'u-3', note: '院内转借至 IEO' },
    // du-3: FB → c-1
    { id: 'dt-3',  unit_id: 'du-3', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-1' }, date: '2024-10-20', by_user: 'u-2', note: 'PCR 实验室配置' },
    // du-5: FB → c-4 → c-4 (fault) → supplier (repair)
    { id: 'dt-4',  unit_id: 'du-5', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-4' }, date: '2023-12-01', by_user: 'u-1', note: '' },
    { id: 'dt-5',  unit_id: 'du-5', from: { kind: 'customer', id: 'c-4' }, to:   { kind: 'fb',       id: null }, date: '2026-01-22', by_user: 'u-2', note: '故障返厂前先回 FB 检查' },
    { id: 'dt-6',  unit_id: 'du-5', from: { kind: 'fb', id: null },        to:   { kind: 'supplier', id: 's-4' }, date: '2026-02-10', by_user: 'u-2', note: '送修 — Bio-Rad 维修中心' },
    // du-6: FB → c-4
    { id: 'dt-7',  unit_id: 'du-6', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-4' }, date: '2024-07-15', by_user: 'u-2', note: '' },
    // du-7: FB → c-6 → FB (broken)
    { id: 'dt-8',  unit_id: 'du-7', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-6' }, date: '2022-05-10', by_user: 'u-1', note: '' },
    { id: 'dt-9',  unit_id: 'du-7', from: { kind: 'customer', id: 'c-6' }, to:   { kind: 'fb',       id: null }, date: '2026-03-22', by_user: 'u-2', note: '客户报修 — 召回 FB' },
    // du-9: FB → c-2
    { id: 'dt-10', unit_id: 'du-9', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-2' }, date: '2025-04-02', by_user: 'u-3', note: '' },
    // du-10: FB → c-2 → c-5
    { id: 'dt-11', unit_id: 'du-10', from: { kind: 'fb', id: null },        to:   { kind: 'customer', id: 'c-2' }, date: '2024-06-15', by_user: 'u-1', note: '' },
    { id: 'dt-12', unit_id: 'du-10', from: { kind: 'customer', id: 'c-2' }, to:   { kind: 'customer', id: 'c-5' }, date: '2025-09-30', by_user: 'u-2', note: '院校协议转借' },
  ];

  // Activity log (recent)
  const activity = [
    { id: 'a-1',  kind: 'outflow',  ts: '2026-05-28T10:14:00', actor: 'u-2', text: '取出 1 盒 Allergen Panel ELISA Kit (L240712A) → 圣拉斐尔医院', ref: 'rb-1' },
    { id: 'a-2',  kind: 'transfer', ts: '2026-05-27T16:42:00', actor: 'u-3', text: '设备 5810R-2024-0091 由圣拉斐尔转至 IEO', ref: 'du-1' },
    { id: 'a-3',  kind: 'receive',  ts: '2026-05-27T09:08:00', actor: 'u-2', text: '入库批次 M250520 · Glucose Assay Kit · 8 盒', ref: 'rb-8' },
    { id: 'a-4',  kind: 'fault',    ts: '2026-05-26T14:30:00', actor: 'u-2', text: '标记 TSX-600-22-0044 为故障 — 压缩机异响', ref: 'du-7' },
    { id: 'a-5',  kind: 'return',   ts: '2026-05-26T11:02:00', actor: 'u-3', text: '客户归还 1 盒 CD3-OKT3 → 批次 M250203', ref: 'rb-4' },
    { id: 'a-6',  kind: 'outflow',  ts: '2026-05-25T15:12:00', actor: 'u-2', text: '取出 2 盒 + 12 test COVID-19 Antigen → UniMI', ref: 'rb-6' },
    { id: 'a-7',  kind: 'transfer', ts: '2026-05-24T10:00:00', actor: 'u-3', text: '设备 XP12-25-010 配置至 Gemelli', ref: 'du-9' },
    { id: 'a-8',  kind: 'edit',     ts: '2026-05-23T17:45:00', actor: 'u-1', text: '更新供货商 Eppendorf Italia 联系方式', ref: 's-5' },
    { id: 'a-9',  kind: 'receive',  ts: '2026-05-22T08:30:00', actor: 'u-2', text: '入库批次 L250118C · Allergen ELISA · 10 盒', ref: 'rb-2' },
  ];

  // Search index (will be assembled by store)
  Object.assign(window, {
    SEED: {
      users, suppliers, customers,
      reagent_products, reagent_batches, reagent_outflows,
      device_products, device_units, device_transfers,
      activity,
    },
  });
})();
