-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool.html
More file actions
2030 lines (1827 loc) · 110 KB
/
Copy pathtool.html
File metadata and controls
2030 lines (1827 loc) · 110 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{config.companyName}} — Risk Assessment Wizard</title>
<style>
/* ===== RESET & BASE ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f8fafc;color:#1e293b;min-height:100vh}
button{cursor:pointer;font-family:inherit}
input,select,textarea{font-family:inherit}
a{color:var(--primary)}
/* ===== CSS VARS ===== */
:root{
--primary:{{config.primaryColor}};
--primary-dark:#1d4ed8;
--success:#22c55e;
--warning:#f59e0b;
--danger:#ef4444;
--dark-danger:#7f1d1d;
--surface:#ffffff;
--border:#e2e8f0;
--muted:#64748b;
--text:#1e293b;
}
/* ===== LAYOUT ===== */
.app-header{background:var(--primary);color:#fff;padding:12px 20px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.app-header-left{display:flex;align-items:center;gap:12px}
.app-logo{height:32px;width:auto;object-fit:contain}
.app-title{font-size:1rem;font-weight:700;line-height:1.2}
.app-subtitle{font-size:0.75rem;opacity:0.8}
.header-actions{display:flex;align-items:center;gap:8px}
.btn-start-over{background:rgba(255,255,255,0.15);border:1px solid rgba(255,255,255,0.3);color:#fff;padding:5px 10px;border-radius:6px;font-size:0.75rem;transition:background 0.15s}
.btn-start-over:hover{background:rgba(255,255,255,0.25)}
.app-main{max-width:900px;margin:0 auto;padding:24px 16px}
/* ===== WIZARD PROGRESS ===== */
.wizard-header{background:#fff;border:1px solid var(--border);border-radius:12px;padding:20px 24px;margin-bottom:20px}
.step-indicator{font-size:0.8rem;color:var(--muted);margin-bottom:8px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em}
.step-title{font-size:1.25rem;font-weight:700;color:var(--text);margin-bottom:12px}
.progress-track{background:#e2e8f0;height:6px;border-radius:3px;overflow:hidden}
.progress-fill{height:100%;background:var(--primary);border-radius:3px;transition:width 0.4s ease}
.step-dots{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}
.step-dot{width:28px;height:28px;border-radius:50%;border:2px solid var(--border);background:#fff;font-size:0.7rem;font-weight:700;color:var(--muted);display:flex;align-items:center;justify-content:center;transition:all 0.2s}
.step-dot.active{border-color:var(--primary);color:var(--primary)}
.step-dot.done{background:var(--primary);border-color:var(--primary);color:#fff}
/* ===== STEP PANELS ===== */
.step-panel{display:none;background:#fff;border:1px solid var(--border);border-radius:12px;padding:24px}
.step-panel.active{display:block}
/* ===== SECTION HEADERS ===== */
.section-title{font-size:1rem;font-weight:700;color:var(--text);margin-bottom:4px}
.section-desc{font-size:0.85rem;color:var(--muted);margin-bottom:16px}
.section-divider{border:none;border-top:1px solid var(--border);margin:20px 0}
/* ===== FORMS ===== */
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px}
.form-row.single{grid-template-columns:1fr}
.form-row.triple{grid-template-columns:1fr 1fr 1fr}
.field-group{display:flex;flex-direction:column;gap:4px}
.field-label{font-size:0.8rem;font-weight:600;color:#374151}
.field-required{color:var(--danger)}
.field-input{border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:0.9rem;background:#fff;transition:border-color 0.15s,box-shadow 0.15s;width:100%}
.field-input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,0.08)}
textarea.field-input{resize:vertical;min-height:80px}
.field-hint{font-size:0.75rem;color:var(--muted)}
/* ===== BUTTONS ===== */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:8px;font-size:0.875rem;font-weight:600;border:none;transition:all 0.15s;white-space:nowrap}
.btn-primary{background:var(--primary);color:#fff}
.btn-primary:hover{filter:brightness(1.1)}
.btn-secondary{background:#f1f5f9;color:#374151;border:1px solid var(--border)}
.btn-secondary:hover{background:#e2e8f0}
.btn-success{background:var(--success);color:#fff}
.btn-danger{background:var(--danger);color:#fff}
.btn-sm{padding:5px 10px;font-size:0.8rem}
.btn-icon{padding:6px;border-radius:6px}
.btn:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}
/* ===== IMPORT BUTTONS ===== */
.import-row{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}
.import-btn{background:#f0f9ff;border:1px solid #bae6fd;color:#0369a1;padding:8px 14px;border-radius:8px;font-size:0.85rem;font-weight:600;transition:all 0.15s}
.import-btn:hover{background:#e0f2fe;border-color:#7dd3fc}
/* ===== ACTIVITIES CHECKLIST ===== */
.activities-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.activity-checkbox{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;cursor:pointer;transition:all 0.15s;background:#fff}
.activity-checkbox:hover{border-color:var(--primary);background:#f0f9ff}
.activity-checkbox.checked{border-color:var(--primary);background:#eff6ff}
.activity-checkbox input[type=checkbox]{width:16px;height:16px;accent-color:var(--primary);flex-shrink:0}
.activity-label{font-size:0.85rem;color:var(--text)}
.activity-icon{font-size:1rem;flex-shrink:0}
.custom-activity-row{display:flex;gap:8px;margin-top:8px}
.custom-activity-row .field-input{flex:1}
/* ===== METHODOLOGY CARDS ===== */
.methodology-options{display:flex;flex-direction:column;gap:10px;margin-bottom:16px}
.method-card{display:flex;align-items:flex-start;gap:12px;padding:14px 16px;border:2px solid var(--border);border-radius:10px;cursor:pointer;transition:all 0.15s}
.method-card:hover{border-color:var(--primary)}
.method-card.selected{border-color:var(--primary);background:#eff6ff}
.method-card input[type=radio]{margin-top:2px;accent-color:var(--primary);flex-shrink:0;width:16px;height:16px}
.method-card-content{}
.method-card-title{font-size:0.875rem;font-weight:700;color:var(--text)}
.method-card-desc{font-size:0.8rem;color:var(--muted);margin-top:2px}
/* ===== VENUE CATEGORIES ===== */
.category-checklist{display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:320px;overflow-y:auto;padding:4px;margin-bottom:8px}
.category-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:6px;cursor:pointer;transition:all 0.15s;background:#fff}
.category-item:hover{border-color:var(--primary)}
.category-item.covered{border-color:#86efac;background:#f0fdf4}
.category-item input[type=checkbox]{accent-color:var(--success);width:14px;height:14px;flex-shrink:0}
.category-name{font-size:0.82rem;color:var(--text)}
/* ===== UPLOAD ZONE ===== */
.upload-zone{border:2px dashed var(--border);border-radius:10px;padding:28px;text-align:center;cursor:pointer;transition:all 0.15s;background:#fafafa}
.upload-zone:hover,.upload-zone.drag-over{border-color:var(--primary);background:#f0f9ff}
.upload-zone-icon{font-size:2.5rem;margin-bottom:8px}
.upload-zone-text{font-size:0.9rem;font-weight:600;color:var(--text)}
.upload-zone-sub{font-size:0.8rem;color:var(--muted);margin-top:4px}
.upload-zone-info{display:flex;align-items:center;gap:8px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:8px;padding:12px 14px;margin-top:12px;font-size:0.85rem}
/* ===== API KEY ROW ===== */
.api-key-section{background:#fafafa;border:1px solid var(--border);border-radius:10px;padding:16px;margin-bottom:16px}
.api-key-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.api-key-row label{font-size:0.85rem;font-weight:600;white-space:nowrap}
.api-key-row .field-input{flex:1;min-width:200px;font-family:monospace;font-size:0.8rem}
.api-status{font-size:0.8rem;font-weight:600;white-space:nowrap;padding:4px 8px;border-radius:6px}
.api-status.neutral{color:var(--muted);background:#f1f5f9}
.api-status.valid{color:#166534;background:#dcfce7}
.api-status.error{color:#991b1b;background:#fee2e2}
.api-status.pending{color:#92400e;background:#fef3c7}
.api-status.warning{color:#92400e;background:#fef3c7}
.api-note{font-size:0.78rem;color:var(--muted);margin-top:8px}
/* ===== EXTRACTION SUMMARY ===== */
.extraction-summary{background:#f0fdf4;border:1px solid #86efac;border-radius:10px;padding:16px;margin-bottom:16px}
.extraction-summary h3{font-size:0.95rem;font-weight:700;color:#166534;margin-bottom:10px}
.summary-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.summary-grid div{font-size:0.82rem;color:#374151}
.venue-category-card{border:1px solid var(--border);border-radius:8px;margin-bottom:6px;overflow:hidden}
.category-header-ai{display:flex;align-items:center;gap:8px;padding:10px 12px;cursor:pointer;background:#fff;transition:background 0.15s}
.category-header-ai:hover{background:#f8fafc}
.category-check{color:var(--success)}
.venue-rating{margin-left:auto;font-size:0.75rem;font-weight:700;padding:2px 6px;background:#f1f5f9;border-radius:4px}
.expand-icon{color:var(--muted);font-size:0.75rem;transition:transform 0.2s}
.expand-icon.open{transform:rotate(90deg)}
.category-detail{padding:10px 12px;background:#f8fafc;border-top:1px solid var(--border);font-size:0.82rem;color:#374151;display:none}
.deadlines-section{background:#fff9e6;border:1px solid #fde68a;border-radius:10px;padding:14px;margin-top:12px}
.deadlines-section h4{font-size:0.875rem;font-weight:700;color:#92400e;margin-bottom:8px}
.deadline-row{display:flex;align-items:center;gap:10px;padding:6px 0;border-bottom:1px solid #fde68a;font-size:0.82rem}
.deadline-row:last-child{border-bottom:none}
.deadline-timing{font-weight:700;color:#d97706;min-width:80px}
/* ===== STEP 3 — ACTIVITY CARDS ===== */
.activity-cards{display:flex;flex-direction:column;gap:10px}
.activity-card{border:1px solid var(--border);border-radius:10px;background:#fff;overflow:hidden}
.activity-card-header{display:flex;align-items:center;gap:10px;padding:12px 16px;background:#f8fafc;cursor:pointer}
.activity-card-icon{font-size:1.3rem}
.activity-card-title{font-size:0.9rem;font-weight:700;flex:1}
.activity-card-count{font-size:0.75rem;color:var(--muted);background:#e2e8f0;padding:2px 8px;border-radius:10px}
.activity-card-body{padding:12px 16px;display:none}
.task-list{display:flex;flex-direction:column;gap:6px}
.task-item{font-size:0.82rem;padding:6px 10px;background:#f1f5f9;border-radius:6px;color:#374151}
.activity-remove-btn{background:none;border:none;color:var(--muted);font-size:0.8rem;padding:2px 6px;border-radius:4px}
.activity-remove-btn:hover{color:var(--danger);background:#fee2e2}
.unmatched-section{margin-top:16px}
.unmatched-section .section-title{font-size:0.875rem;color:var(--muted)}
/* ===== STEP 4 — GAP ANALYSIS ===== */
.ai-mode-badge,.manual-mode-badge{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:20px;font-size:0.78rem;font-weight:700;margin-bottom:16px}
.ai-mode-badge{background:#ede9fe;color:#5b21b6}
.manual-mode-badge{background:#f1f5f9;color:#475569}
.ai-notes{background:#f0f9ff;border:1px solid #bae6fd;border-radius:8px;padding:12px;font-size:0.85rem;margin-bottom:16px;color:#0c4a6e}
.covered-section{margin-bottom:16px}
.section-toggle-header{display:flex;align-items:center;gap:8px;cursor:pointer;padding:12px 14px;background:#f0fdf4;border:1px solid #86efac;border-radius:8px;user-select:none}
.section-toggle-header h3{font-size:0.9rem;font-weight:700;color:#166534;flex:1}
.covered-count{font-size:0.78rem;font-weight:700;background:#dcfce7;color:#166534;padding:2px 8px;border-radius:10px}
.covered-list{display:flex;flex-wrap:wrap;gap:6px;padding:10px 14px;border:1px solid #86efac;border-top:none;border-radius:0 0 8px 8px;background:#f0fdf4}
.covered-tag{font-size:0.78rem;padding:3px 8px;background:#dcfce7;color:#166534;border-radius:6px}
.gaps-section{margin-bottom:16px}
.gaps-header{font-size:0.9rem;font-weight:700;color:#92400e;margin-bottom:10px;display:flex;align-items:center;gap:8px}
.risk-gap-card{border-radius:10px;border:2px solid var(--border);background:#fff;padding:14px;margin-bottom:10px;position:relative}
.risk-gap-card.high{border-color:#fca5a5;background:#fff5f5}
.risk-gap-card.medium{border-color:#fcd34d;background:#fffbeb}
.risk-gap-card.low{border-color:#86efac;background:#f0fdf4}
.risk-gap-card-header{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.priority-badge{font-size:0.72rem;font-weight:700;padding:2px 7px;border-radius:10px}
.priority-high{background:#fee2e2;color:#991b1b}
.priority-medium{background:#fef3c7;color:#92400e}
.priority-low{background:#dcfce7;color:#166534}
.ai-tag{font-size:0.7rem;background:#ede9fe;color:#5b21b6;padding:2px 6px;border-radius:10px;font-weight:700}
.risk-gap-title{font-size:0.9rem;font-weight:700;flex:1}
.btn-remove-gap{background:none;border:none;color:var(--muted);font-size:1rem;padding:2px 6px;border-radius:4px;margin-left:auto}
.btn-remove-gap:hover{color:var(--danger);background:#fee2e2}
.risk-trigger{font-size:0.78rem;color:var(--muted);margin-bottom:3px}
.risk-reasoning{font-size:0.82rem;color:#374151;font-style:italic;margin-bottom:5px}
.risk-hazard-preview{font-size:0.82rem;color:#374151}
.supplier-flag{font-size:0.78rem;color:#0369a1;margin-top:6px;background:#f0f9ff;padding:4px 8px;border-radius:6px;display:inline-block}
.add-risk-row{margin-top:12px}
/* ===== ADD RISK MODAL ===== */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:1000;display:flex;align-items:center;justify-content:center;padding:20px}
.modal{background:#fff;border-radius:12px;padding:24px;max-width:560px;width:100%;max-height:80vh;overflow-y:auto}
.modal-title{font-size:1rem;font-weight:700;margin-bottom:16px}
.template-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.template-option{padding:10px 12px;border:1px solid var(--border);border-radius:8px;cursor:pointer;transition:all 0.15s;font-size:0.85rem}
.template-option:hover{border-color:var(--primary);background:#f0f9ff}
.modal-footer{display:flex;gap:8px;justify-content:flex-end}
/* ===== STEP 5 — RISK SCORING ===== */
.risk-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;background:#f8fafc;border:1px solid var(--border);border-radius:8px;padding:10px 14px}
.risk-counter{font-size:0.85rem;font-weight:700;color:var(--text)}
.risk-nav-btns{display:flex;gap:8px}
.risk-title{font-size:1.1rem;font-weight:700;margin-bottom:16px;display:flex;align-items:center;gap:8px}
.scoring-section{}
.section-label{font-size:0.8rem;font-weight:700;color:#374151;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:8px}
.affected-table{width:100%;border-collapse:collapse;margin-bottom:4px;font-size:0.85rem}
.affected-table th{background:#f1f5f9;padding:6px 10px;text-align:left;font-size:0.78rem;font-weight:700;color:var(--muted);border:1px solid var(--border)}
.affected-table td{padding:6px 8px;border:1px solid var(--border);vertical-align:middle}
.affected-table select{border:1px solid var(--border);border-radius:6px;padding:4px 6px;font-size:0.82rem;background:#fff;width:100%}
.score-cell{text-align:center;font-weight:700}
.final-cell{text-align:center}
.add-party-row{margin-top:6px}
.add-party-input{display:flex;gap:8px;margin-top:6px}
.add-party-input .field-input{flex:1}
.risk-badge{display:inline-block;padding:3px 8px;border-radius:6px;font-size:0.78rem;font-weight:700;color:#fff}
.control-weight-options{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.weight-option{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--border);border-radius:8px;cursor:pointer;font-size:0.85rem;transition:all 0.15s}
.weight-option:hover{border-color:var(--primary)}
.weight-option.selected{border-color:var(--primary);background:#eff6ff}
.weight-option input[type=radio]{accent-color:var(--primary);width:14px;height:14px;flex-shrink:0}
.weight-value{font-weight:700;min-width:36px}
.weight-label{color:#374151}
.final-ratings-table{width:100%;border-collapse:collapse;font-size:0.85rem;margin-top:8px}
.final-ratings-table th{background:#f1f5f9;padding:6px 10px;font-size:0.78rem;font-weight:700;color:var(--muted);border:1px solid var(--border);text-align:left}
.final-ratings-table td{padding:8px 10px;border:1px solid var(--border);vertical-align:middle}
.final-action{font-size:0.78rem;color:var(--muted)}
.supplier-ra-section{margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}
.supplier-ra-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:8px}
.supplier-ra-row label{font-size:0.85rem;font-weight:600}
.supplier-ra-row select{border:1px solid var(--border);border-radius:8px;padding:6px 10px;font-size:0.85rem;background:#fff}
/* AI suggestions in Step 5 */
.ai-suggestion-block{background:#f5f3ff;border:1px solid #c4b5fd;border-radius:8px;padding:12px;margin-bottom:10px}
.ai-suggestion-header{display:flex;align-items:center;justify-content:space-between;font-size:0.82rem;font-weight:700;color:#5b21b6;margin-bottom:8px}
.suggestion-line{font-size:0.82rem;color:#4c1d95;padding:3px 0;border-bottom:1px solid #ddd6fe}
.suggestion-line:last-child{border:none}
.ai-score-hint{color:#7c3aed;font-size:0.7rem;margin-left:4px}
/* ===== STEP 6 — SUPPLIER REQUIREMENTS ===== */
.supplier-req-table{width:100%;border-collapse:collapse;font-size:0.85rem;margin-bottom:16px}
.supplier-req-table th{background:#f1f5f9;padding:8px 10px;font-size:0.78rem;font-weight:700;color:var(--muted);border:1px solid var(--border);text-align:left}
.supplier-req-table td{padding:8px 10px;border:1px solid var(--border);vertical-align:middle}
.supplier-req-table .action-cell{display:flex;gap:6px}
.email-preview-box{background:#f8fafc;border:1px solid var(--border);border-radius:8px;padding:16px;margin-top:12px;display:none}
.email-preview-header{font-size:0.8rem;font-weight:700;color:var(--muted);margin-bottom:8px}
.email-preview-meta{font-size:0.82rem;margin-bottom:8px}
.email-preview-meta span{font-weight:700}
.email-preview-body{font-size:0.85rem;white-space:pre-wrap;color:#374151;border:1px solid var(--border);border-radius:6px;padding:10px;background:#fff;min-height:80px;max-height:200px;overflow-y:auto}
.email-preview-actions{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.step6-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}
.ops-tracker-update-btn{background:#0f172a;color:#fff;border:none;padding:8px 16px;border-radius:8px;font-size:0.875rem;font-weight:700;cursor:pointer;transition:background 0.15s}
.ops-tracker-update-btn:hover{background:#1e293b}
/* ===== STEP 7 — REVIEW ===== */
.risk-summary-table{width:100%;border-collapse:collapse;font-size:0.85rem;margin-bottom:16px}
.risk-summary-table th{background:#f1f5f9;padding:8px 10px;font-size:0.78rem;font-weight:700;color:var(--muted);border:1px solid var(--border);text-align:left}
.risk-summary-table td{padding:8px 10px;border:1px solid var(--border);vertical-align:middle}
.risk-profile{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.profile-chip{padding:6px 14px;border-radius:20px;font-size:0.82rem;font-weight:700}
.profile-L{background:#dcfce7;color:#166534}
.profile-M{background:#fef3c7;color:#92400e}
.profile-H{background:#fee2e2;color:#991b1b}
.profile-U{background:#fecaca;color:#7f1d1d}
.warning-banner{background:#fef2f2;border:1px solid #fca5a5;border-radius:8px;padding:12px;margin-bottom:16px;font-size:0.875rem;color:#991b1b;font-weight:600}
.export-actions{display:flex;gap:10px;flex-wrap:wrap}
/* ===== WIZARD NAV ===== */
.wizard-nav{display:flex;align-items:center;justify-content:space-between;margin-top:24px;padding-top:16px;border-top:1px solid var(--border)}
/* ===== PROCESSING STATE ===== */
.processing-overlay{position:fixed;inset:0;background:rgba(15,23,42,0.7);z-index:999;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;color:#fff}
.processing-spinner{width:48px;height:48px;border:4px solid rgba(255,255,255,0.2);border-top-color:#fff;border-radius:50%;animation:spin 0.9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.processing-text{font-size:1rem;font-weight:600}
.processing-sub{font-size:0.85rem;opacity:0.8}
/* ===== TOAST ===== */
.toast-container{position:fixed;bottom:24px;right:24px;z-index:1001;display:flex;flex-direction:column;gap:8px}
.toast{background:#1e293b;color:#fff;padding:10px 16px;border-radius:8px;font-size:0.875rem;font-weight:500;max-width:360px;animation:slideIn 0.2s ease;box-shadow:0 4px 16px rgba(0,0,0,0.2)}
.toast.success{background:#166534}
.toast.error{background:#991b1b}
@keyframes slideIn{from{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}
/* ===== FALLBACK BANNER ===== */
.fallback-banner{background:#fef9c3;border:1px solid #fde047;border-radius:8px;padding:12px;margin-bottom:16px;display:flex;align-items:center;gap:10px;font-size:0.85rem}
.fallback-banner p{flex:1}
/* ===== PRINT STYLES ===== */
@media print{
.app-header,.wizard-header,.wizard-nav,.header-actions,.import-row,.export-actions,.btn-start-over,.step-panel:not(.active){display:none!important}
.step-panel.active{border:none;padding:0}
.print-table{width:100%;border-collapse:collapse;font-size:10pt}
.print-table th,.print-table td{border:1px solid #ccc;padding:4pt 6pt}
}
/* ===== RESPONSIVE ===== */
@media(max-width:640px){
.form-row,.form-row.triple{grid-template-columns:1fr}
.activities-grid{grid-template-columns:1fr}
.category-checklist{grid-template-columns:1fr}
.summary-grid{grid-template-columns:1fr}
}
</style>
</head>
<body>
<!-- EVENTHIVE_CONFIG will be injected here -->
<script>
window.EVENTHIVE_CONFIG = window.EVENTHIVE_CONFIG || {
companyName: "My Event Company",
primaryColor: "#2563eb",
logoUrl: "",
eventName: "Conference 2026",
eventDate: "2026-09-15",
venueName: "Convention Centre",
anthropicApiKey: "",
defaultMethodology: "PxSxW",
defaultCategories: []
};
</script>
<!-- HEADER -->
<header class="app-header">
<div class="app-header-left">
<script>if(EVENTHIVE_CONFIG.logoUrl){document.write('<img class="app-logo" src="'+EVENTHIVE_CONFIG.logoUrl+'" alt="logo">')}else{document.write('<div style="font-size:1.4rem">⚠️</div>')}</script>
<div>
<div class="app-title">Risk Assessment Wizard</div>
<div class="app-subtitle" id="header-event-name">{{config.companyName}}</div>
</div>
</div>
<div class="header-actions">
<button class="btn-start-over" onclick="startOver()">🔄 Start Over</button>
</div>
</header>
<!-- MAIN -->
<main class="app-main">
<!-- WIZARD PROGRESS HEADER -->
<div class="wizard-header">
<div class="step-indicator" id="step-indicator">Step 1 of 7</div>
<div class="step-title" id="step-title">Event Setup</div>
<div class="progress-track"><div class="progress-fill" id="progress-fill" style="width:14%"></div></div>
<div class="step-dots" id="step-dots"></div>
</div>
<!-- STEP 1: EVENT SETUP -->
<div class="step-panel active" id="step-1">
<div class="section-title">Import from existing tools</div>
<div class="section-desc">Load your event details and supplier list from tools you've already set up.</div>
<div class="import-row">
<button class="import-btn" onclick="importFromOpsTracker()">📥 Import from Ops Tracker</button>
<button class="import-btn" onclick="importFromCountdownPlanner()">📥 Import from Countdown Planner</button>
</div>
<hr class="section-divider">
<div class="section-title">Event Details</div>
<div class="section-desc">Basic information about your event.</div>
<div class="form-row">
<div class="field-group">
<label class="field-label">Event Name <span class="field-required">*</span></label>
<input class="field-input" id="s1-eventName" type="text" placeholder="e.g. AI Tech Summit 2026" oninput="state.eventName=this.value;saveState()">
</div>
<div class="field-group">
<label class="field-label">Event Date <span class="field-required">*</span></label>
<input class="field-input" id="s1-eventDate" type="date" oninput="state.eventDate=this.value;saveState()">
</div>
</div>
<div class="form-row">
<div class="field-group">
<label class="field-label">Venue Name</label>
<input class="field-input" id="s1-venueName" type="text" placeholder="e.g. Harrogate Convention Centre" oninput="state.venueName=this.value;saveState()">
</div>
<div class="field-group">
<label class="field-label">Event Type</label>
<select class="field-input" id="s1-eventType" onchange="state.eventType=this.value;saveState()">
<option value="conference">Conference</option>
<option value="tradeshow">Trade Show</option>
<option value="exhibition">Exhibition</option>
<option value="gala">Gala / Awards</option>
<option value="hybrid">Hybrid Event</option>
<option value="outdoor">Outdoor Event</option>
<option value="festival">Festival</option>
</select>
</div>
</div>
<div class="form-row triple">
<div class="field-group">
<label class="field-label">Expected Attendance</label>
<input class="field-input" id="s1-attendance" type="number" min="0" placeholder="0" oninput="state.expectedAttendance=parseInt(this.value)||0;saveState()">
</div>
<div class="field-group">
<label class="field-label">Number of Suppliers</label>
<input class="field-input" id="s1-suppliers" type="number" min="0" placeholder="0" oninput="state.numberOfSuppliers=parseInt(this.value)||0;saveState()">
</div>
<div class="field-group">
<label class="field-label">Number of Exhibitors</label>
<input class="field-input" id="s1-exhibitors" type="number" min="0" placeholder="0" oninput="state.numberOfExhibitors=parseInt(this.value)||0;saveState()">
</div>
</div>
<hr class="section-divider">
<div class="section-title">Event Activities</div>
<div class="section-desc">Check all activities taking place at your event. This drives the gap analysis in Step 4.</div>
<div class="activities-grid" id="activities-grid"></div>
<div class="custom-activity-row">
<input class="field-input" id="custom-activity-input" type="text" placeholder="Add a custom activity...">
<button class="btn btn-secondary btn-sm" onclick="addCustomActivity()">+ Add</button>
</div>
<div class="wizard-nav">
<div></div>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Venue Risk Assessment)</small></button>
</div>
</div>
<!-- STEP 2: VENUE RISK ASSESSMENT -->
<div class="step-panel" id="step-2">
<div class="section-title">Step 2: Venue Risk Assessment</div>
<div class="section-desc">Upload your venue's generic risk assessment PDF for AI-powered extraction, or manually select the scoring methodology and venue categories.</div>
<!-- API KEY -->
<div class="api-key-section">
<div class="api-key-row">
<label>🔑 Anthropic API Key:</label>
<input type="password" class="field-input" id="api-key-input" placeholder="sk-ant-..." onchange="validateApiKey()">
<span class="api-status neutral" id="api-key-status">⚪ Not configured</span>
</div>
<div class="api-note" id="api-note">Add your API key to enable AI-powered PDF analysis. <a href="#" onclick="switchToManualMode();return false">Skip and use manual templates →</a></div>
</div>
<!-- PDF UPLOAD -->
<div id="step2-content">
<div class="upload-zone" id="pdf-drop-zone" onclick="document.getElementById('pdf-input').click()">
<div class="upload-zone-icon">📄</div>
<div class="upload-zone-text">Drag & drop venue risk assessment PDF here</div>
<div class="upload-zone-sub">or click to browse (max 10MB)</div>
</div>
<input type="file" id="pdf-input" accept=".pdf" style="display:none" onchange="handlePdfFileSelect(this.files[0])">
<div style="text-align:center;padding:10px;color:var(--muted);font-size:0.85rem">— OR —</div>
<!-- MANUAL MODE -->
<div id="manual-mode-section">
<div class="section-title">Scoring Methodology</div>
<div class="section-desc">Select the risk scoring system to use for this assessment.</div>
<div class="methodology-options" id="methodology-options"></div>
<div class="section-title">Venue Hazard Categories</div>
<div class="section-desc">Check the categories your venue's risk assessment already covers. These will be shown as "covered" in the gap analysis.</div>
<div class="category-checklist" id="venue-category-checklist"></div>
</div>
</div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Event Activities)</small></button>
</div>
</div>
<!-- STEP 3: EVENT ACTIVITY INVENTORY -->
<div class="step-panel" id="step-3">
<div class="section-title">Step 3: Event Activity Inventory</div>
<div class="section-desc">Review your selected activities and any matching tasks from the Ops Tracker.</div>
<div id="step3-content"></div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Gap Analysis)</small></button>
</div>
</div>
<!-- STEP 4: GAP ANALYSIS -->
<div class="step-panel" id="step-4">
<div class="section-title">Step 4: Gap Analysis</div>
<div class="section-desc">Based on your event activities, here are the risks that need event-specific assessment beyond what the venue already covers.</div>
<div id="step4-content"><p style="color:var(--muted);font-size:0.85rem">Loading gap analysis...</p></div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Score Risks)</small></button>
</div>
</div>
<!-- STEP 5: RISK SCORING -->
<div class="step-panel" id="step-5">
<div class="section-title">Step 5: Score Risks</div>
<div id="step5-content"></div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Supplier Requirements)</small></button>
</div>
</div>
<!-- STEP 6: SUPPLIER REQUIREMENTS -->
<div class="step-panel" id="step-6">
<div class="section-title">Step 6: Supplier Requirements</div>
<div class="section-desc">Generate risk assessment requests for suppliers whose activities introduce event-specific risks.</div>
<div id="step6-content"></div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-primary" onclick="nextStep()">Next → <small>(Review & Export)</small></button>
</div>
</div>
<!-- STEP 7: REVIEW & EXPORT -->
<div class="step-panel" id="step-7">
<div class="section-title">Step 7: Review & Export</div>
<div class="section-desc">Your complete risk register. Export to CSV, save for the Risk Assessment Compiler, or print.</div>
<div id="step7-content"></div>
<div class="wizard-nav">
<button class="btn btn-secondary" onclick="prevStep()">← Back</button>
<button class="btn btn-success" onclick="finishWizard()">✓ Finish & Save for Compiler</button>
</div>
</div>
</main>
<!-- MODAL for adding risks -->
<div class="modal-overlay" id="add-risk-modal" style="display:none">
<div class="modal">
<div class="modal-title">Add a Risk Category</div>
<div class="section-desc">Select from common event-specific categories or add a custom one.</div>
<div class="template-list" id="add-risk-template-list"></div>
<div class="field-group" style="margin-bottom:12px">
<label class="field-label">Or describe a custom risk:</label>
<input class="field-input" id="custom-risk-input" type="text" placeholder="e.g. Inflatable structures">
</div>
<div class="modal-footer">
<button class="btn btn-secondary" onclick="closeModal()">Cancel</button>
<button class="btn btn-primary" onclick="addCustomRiskFromInput()">Add Risk</button>
</div>
</div>
</div>
<!-- PROCESSING OVERLAY -->
<div class="processing-overlay" id="processing-overlay" style="display:none">
<div class="processing-spinner"></div>
<div class="processing-text" id="processing-text">Analysing venue risk assessment...</div>
<div class="processing-sub" id="processing-sub">This may take 30–60 seconds</div>
</div>
<!-- TOAST CONTAINER -->
<div class="toast-container" id="toast-container"></div>
<script>
// ===== CONSTANTS & DATA =====
const STEP_META = [
{ title: 'Event Setup', pct: 14 },
{ title: 'Venue Risk Assessment', pct: 28 },
{ title: 'Event Activity Inventory', pct: 42 },
{ title: 'Gap Analysis', pct: 57 },
{ title: 'Score Risks', pct: 71 },
{ title: 'Supplier Requirements', pct: 85 },
{ title: 'Review & Export', pct: 100 }
];
const EVENT_ACTIVITIES = [
{ id: 'exhibition_stands_electrical', label: 'Exhibition stands with electrical equipment', icon: '🔌' },
{ id: 'live_demos', label: 'Live product demonstrations (robots, VR, moving parts)', icon: '🤖' },
{ id: 'food_beverage_sampling', label: 'Food and beverage sampling on stands', icon: '🍽️' },
{ id: 'conference_sessions_stage', label: 'Conference sessions with stage / AV build', icon: '🎤' },
{ id: 'pyrotechnics', label: 'Pyrotechnics or special effects', icon: '🎆' },
{ id: 'outdoor_activities', label: 'Outdoor activities', icon: '🌳' },
{ id: 'live_entertainment', label: 'Live entertainment / music', icon: '🎵' },
{ id: 'vip_security', label: 'VIP or high-security attendees', icon: '🛡️' },
{ id: 'overnight_build', label: 'Overnight build (24hr access required)', icon: '🌙' },
{ id: 'vehicles_in_hall', label: 'Vehicles in exhibition hall during build/breakdown', icon: '🚛' },
{ id: 'animals', label: 'Animals on site', icon: '🐕' },
{ id: 'water_features', label: 'Water features or ice', icon: '💧' },
{ id: 'drone_display', label: 'Drone or autonomous vehicle display', icon: '🚁' }
];
const STANDARD_VENUE_CATEGORIES = [
'Terrorism & National Emergencies',
'Security, Violence & Aggression',
'Crowd Control',
'Safe Evacuation',
'Fire',
'Power Failure',
'Floor Layout',
'Complex Structures',
'Stage Sets & Raised Platforms',
'Electrical: Installation, Testing & Commissioning',
'Electrical: Use & Adaptation',
'Electrical: Decommissioning & Removal',
'Gas Safety',
'Rigging',
'Heights / Working at Height / Access',
'Mechanical Lifting Equipment (inc. FLTs)',
'Slips, Trips, Falls',
'Transport & Vehicle Movement'
];
const METHODOLOGIES = {
'PxSxW': {
type: 'PxSxW', probabilityScale: 5, severityScale: 5,
bands: [
{ min: 1, max: 5, label: 'LOW', code: 'L', color: '#22c55e', action: 'Acceptable risk' },
{ min: 6, max: 11, label: 'MEDIUM', code: 'M', color: '#f59e0b', action: 'Acceptable risk but monitor daily' },
{ min: 12, max: 18, label: 'HIGH', code: 'H', color: '#ef4444', action: 'Implement changes / Immediate Action Required' },
{ min: 19, max: 25, label: 'UNACCEPTABLE', code: 'U', color: '#7f1d1d', action: 'Cease action immediately' }
],
controlWeights: [
{ value: 1.0, label: 'No effective measures / Verbal discipline' },
{ value: 0.75, label: 'Verbal induction / PPE / Written instruction' },
{ value: 0.50, label: 'Engineered solutions / Procedural control' },
{ value: 0.25, label: 'Permit to Work / Special Controls / Safe history' }
]
},
'PxS_5x5': {
type: 'PxS', probabilityScale: 5, severityScale: 5,
bands: [
{ min: 1, max: 6, label: 'LOW', code: 'L', color: '#22c55e', action: 'Acceptable — no further action' },
{ min: 7, max: 12, label: 'MEDIUM', code: 'M', color: '#f59e0b', action: 'Monitor and review controls' },
{ min: 13, max: 19, label: 'HIGH', code: 'H', color: '#ef4444', action: 'Immediate action required' },
{ min: 20, max: 25, label: 'UNACCEPTABLE', code: 'U', color: '#7f1d1d', action: 'Stop activity' }
],
controlWeights: null
},
'PxS_3x3': {
type: 'PxS', probabilityScale: 3, severityScale: 3,
bands: [
{ min: 1, max: 3, label: 'LOW', code: 'L', color: '#22c55e', action: 'Acceptable' },
{ min: 4, max: 6, label: 'MEDIUM', code: 'M', color: '#f59e0b', action: 'Review controls' },
{ min: 7, max: 9, label: 'HIGH', code: 'H', color: '#ef4444', action: 'Immediate action' }
],
controlWeights: null
}
};
const ACTIVITY_RISK_MAP = {
'exhibition_stands_electrical': { risks: ['exhibitor_electrical'], reason: 'Venue covers base electrical installation but exhibitor-supplied equipment needs separate assessment' },
'live_demos': { risks: ['live_tech_demos', 'exhibitor_electrical'], reason: 'Moving parts, electrical equipment, and public interaction zones not covered by venue baseline' },
'food_beverage_sampling': { risks: ['food_beverage'], reason: 'Venue requires exhibitor declarations — you need to manage collection, compliance, and on-stand hygiene' },
'conference_sessions_stage': { risks: ['custom_stage_build'], reason: 'Custom AV and stage builds beyond the venue\'s standard setup need structural and electrical assessment' },
'pyrotechnics': { risks: ['pyrotechnics_sfx'], reason: 'Explosives and flammable materials require specialist assessment, competent persons, and venue permits' },
'outdoor_activities': { risks: ['outdoor_activities'], reason: 'Weather exposure, ground conditions, and emergency access differ from indoor venue controls' },
'live_entertainment': { risks: ['live_entertainment'], reason: 'Crowd surge, noise levels, and performer safety beyond standard conference controls' },
'vip_security': { risks: ['vip_security'], reason: 'Threat assessment, secure zones, and close protection requirements beyond standard venue security' },
'overnight_build': { risks: ['overnight_build'], reason: 'Fatigue, reduced supervision, lone working, and different emergency response outside normal hours' },
'vehicles_in_hall': { risks: [], reason: null },
'animals': { risks: ['animals'], reason: 'Animal welfare, allergic reactions, unpredictable behaviour, and hygiene requirements' },
'water_features': { risks: ['water_features'], reason: 'Drowning risk, electrical safety near water, slip hazards, and Legionella considerations' },
'drone_display': { risks: ['drone_display'], reason: 'Airborne equipment in enclosed public space — CAA compliance, falling object risk, battery fire risk' }
};
const EVENT_RISK_TEMPLATES = {
'live_tech_demos': {
category: 'Live Technology Demonstrations',
defaultHazard: 'Exhibitors demonstrating technology with moving parts, electrical components, or interactive elements in public areas. Risk of injury from equipment malfunction, unexpected movement, or electrical fault.',
defaultAffectedParties: ['Visitors', 'Exhibitor staff', 'Venue staff'],
defaultControls: ['All demo areas cordoned off with minimum 1.5m barrier from public access', 'Emergency stop button accessible and clearly marked on all equipment with moving parts', 'Exhibitor must provide method statement and equipment-specific risk assessment 28 days prior', 'Demonstrator must be present at all times equipment is operational', 'Equipment to be powered down outside event open hours'],
defaultP: 3, defaultS: 3, priority: 'high'
},
'exhibitor_electrical': {
category: 'Exhibitor Electrical Equipment',
defaultHazard: 'Exhibitors bringing their own electrical equipment (screens, computers, lighting, custom installations) which may not meet venue electrical safety standards. Risk of electric shock, fire from overloaded circuits, or trip hazards from trailing cables.',
defaultAffectedParties: ['Visitors', 'Exhibitor staff', 'Venue staff', 'Venue contractors'],
defaultControls: ['All exhibitor electrical equipment must be PAT tested — certificates submitted with stand risk assessment', 'Maximum power draw per stand specified in exhibitor manual and enforced by venue electricians', 'No daisy-chaining of extension leads permitted', 'All cables to be covered with approved cable ramps or routed through trunking', 'Venue electricians to inspect exhibitor power connections before event opening'],
defaultP: 3, defaultS: 4, priority: 'medium'
},
'food_beverage': {
category: 'Food & Beverage Sampling',
defaultHazard: 'Exhibitors sampling food and beverages on stands. Risks include food poisoning from poor hygiene or temperature control, allergic reactions from unlabelled allergens, alcohol misuse, and slip hazards from spilled liquids.',
defaultAffectedParties: ['Visitors', 'Exhibitor staff', 'Venue staff'],
defaultControls: ['All exhibitors must submit food hygiene certificate (gained within previous 3 years) minimum 2 weeks prior', 'Food sampling declaration submitted to venue catering partner for review and approval', 'Sample sizes only — bite-sized portions with disposable utensils provided', 'Personal licensee required on stand for any alcohol service; serving staff must be over 18', 'High-risk foods stored at 1-9°C; hot food held at 63°C minimum', 'Allergen information clearly displayed at point of sampling', 'Non-slip floor covering required on service side of any food preparation area'],
defaultP: 3, defaultS: 4, priority: 'medium'
},
'custom_stage_build': {
category: 'Custom Stage Build',
defaultHazard: 'Construction of stage, set, or raised platform beyond venue standard configuration. Risk of falls during construction/dismantling, structural collapse, and injury to performers or audience from stage elements.',
defaultAffectedParties: ['Venue contractors', 'Venue staff', 'Visitors'],
defaultControls: ['Structural design plans including weight loadings submitted 28 days in advance', 'Structural engineer inspection and validation where stage exceeds 1600mm height', 'Handrails provided for all stages above 1600mm', 'Construction area cordoned off during build — no public access', 'Method statement for build and derig approved by venue event manager'],
defaultP: 3, defaultS: 5, priority: 'medium'
},
'pyrotechnics_sfx': {
category: 'Pyrotechnics & Special Effects',
defaultHazard: 'Use of pyrotechnics, smoke machines, haze, or other special effects. Risk of fire, burns, blast injury, and interference with venue fire detection systems.',
defaultAffectedParties: ['Venue staff', 'Venue contractors', 'Visitors'],
defaultControls: ['Only stage-specific pyrotechnics permitted — no loose powder mixing on site', 'Competent person appointed and present for all pyrotechnic operations', 'Manufacturer data sheets, quantities, and positions submitted to venue in advance', 'Key-protected firing device with operator maintaining direct line of sight', 'Minimum public clearance distances enforced per effect type', 'Fire detection isolation plan agreed with venue if smoke/haze effects used', 'Misfire protocol: circuit switched off until after performance'],
defaultP: 3, defaultS: 4, priority: 'high'
},
'outdoor_activities': {
category: 'Outdoor Activities',
defaultHazard: 'Activities taking place outside the main venue building. Risks include weather exposure, uneven ground, reduced emergency access, and limited shelter.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Venue contractors'],
defaultControls: ['Weather monitoring with contingency plan for high winds, heavy rain, or extreme heat', 'Ground conditions assessed and maintained — temporary flooring where required', 'Adequate lighting for evening activities', 'Clear emergency access routes maintained to outdoor areas', 'First aid point accessible within 2 minutes of outdoor activity area'],
defaultP: 3, defaultS: 3, priority: 'low'
},
'live_entertainment': {
category: 'Live Entertainment / Music',
defaultHazard: 'Live performances creating crowd management and noise challenges. Risk of crowd surge, hearing damage from prolonged noise exposure, and trip hazards from performance equipment.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Venue contractors'],
defaultControls: ['Sound levels monitored and limited — venue dB meters used for compliance', 'Front-of-stage barrier with stewards deployed in aisles', 'Crowd density monitored — capacity limits enforced per performance area', 'Hearing protection available for staff working near speakers', 'Performance area cables and equipment secured and covered'],
defaultP: 3, defaultS: 3, priority: 'medium'
},
'vip_security': {
category: 'VIP Security',
defaultHazard: 'Attendance by high-profile individuals requiring enhanced security. Risk of targeted threats, crowd management challenges around VIP movements, and disruption from protesters or activists.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Venue contractors', 'VIP individuals'],
defaultControls: ['Threat assessment completed with venue security and local police', 'Dedicated secure area with controlled access for VIP arrivals and departures', 'SIA-licensed close protection officers briefed on venue layout and evacuation routes', 'Advance sweep of VIP areas by security team', 'Communication plan between VIP security, venue security, and event management'],
defaultP: 2, defaultS: 5, priority: 'high'
},
'overnight_build': {
category: 'Overnight Build Operations',
defaultHazard: 'Construction and setup work taking place outside normal venue operating hours. Risks include fatigue-related incidents, lone working, reduced emergency response, and contractor supervision gaps.',
defaultAffectedParties: ['Venue contractors', 'Venue staff'],
defaultControls: ['Overnight work schedule approved by venue with minimum supervision ratios', 'No lone working permitted during overnight builds', 'Fatigue management: mandatory breaks and maximum shift lengths enforced', 'Venue security on site throughout with radio contact to all workers', 'Emergency lighting and first aid provision confirmed for overnight period'],
defaultP: 3, defaultS: 4, priority: 'medium'
},
'animals': {
category: 'Animals',
defaultHazard: 'Animals present on site for exhibition, demonstration, or therapy purposes. Risk of bites, kicks, allergic reactions, zoonotic disease, and animal welfare issues.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Animal handlers'],
defaultControls: ['Qualified animal handler present at all times', 'Barrier or enclosure preventing unsupervised public contact', 'Hand sanitiser stations at entry and exit of animal areas', 'Allergen warning signage clearly displayed', 'Veterinary contact details on file with event management'],
defaultP: 2, defaultS: 3, priority: 'low'
},
'water_features': {
category: 'Water Features / Ice',
defaultHazard: 'Water-based installations or ice features. Risk of drowning (even in shallow water), electrical safety near water, slip hazards, and Legionella from standing water.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Venue contractors'],
defaultControls: ['All electrical equipment near water protected to IP65 or higher rating', 'Barrier around any water feature exceeding 150mm depth', 'Non-slip surfacing around all water and ice features', 'Water quality tested and treatment regime in place', 'Continuous supervision during event open hours'],
defaultP: 2, defaultS: 4, priority: 'medium'
},
'drone_display': {
category: 'Drone / Autonomous Vehicle Display',
defaultHazard: 'Operation of drones, autonomous vehicles, or other remotely controlled equipment near public spaces. Risk of falling equipment, collision, battery fire, and interference with venue systems.',
defaultAffectedParties: ['Visitors', 'Venue staff', 'Exhibitor staff'],
defaultControls: ['CAA regulations compliance confirmed (if applicable for indoor use)', 'Netted or enclosed flight area with minimum 3m clearance from public', 'Qualified pilot with documented competency', 'Pre-flight checks documented for each session', 'Battery charging in designated area with fire extinguisher', 'Kill switch / return-to-home function tested before public sessions'],
defaultP: 3, defaultS: 4, priority: 'high'
}
};
const SUPPLIER_RA_TEMPLATES = {
'AV / Sound': {
requiredSections: ['Electrical safety — equipment PAT testing, cable management, power requirements', 'Rigging — suspension points, load assessments, fall zones', 'Noise — sound levels during build, rehearsal, and event open times', 'Manual handling — equipment load-in/out, lifting operations', 'Working at height — truss installation, speaker rigging, lighting rigs'],
submissionDeadline: '28 days before event',
additionalRequirements: ['PAT test certificates for all electrical equipment', 'Structural engineer sign-off for any rigging above 50kg', 'Method statement for build and derig']
},
'Catering': {
requiredSections: ['Food hygiene — preparation, storage temperatures, cross-contamination', 'Allergen management — labelling, segregation, staff training', 'Alcohol service — licensing, age verification, refusal procedures', 'Slip hazards — floor covering, spillage procedures', 'Manual handling — delivery, stock movement, equipment'],
submissionDeadline: '14 days before event',
additionalRequirements: ['Basic Food Hygiene Certificate (within previous 3 years)', 'Public and employee liability insurance certificate', 'Personal licence copy (if serving alcohol)', 'Food sampling declaration form']
},
'Electrics': {
requiredSections: ['Installation safety — circuit design, RCD protection, earthing', 'Cable management — routing, protection from vehicle traffic, trunking', 'Decommissioning — safe isolation, latent current in transformers', 'Emergency procedures — isolation points, on-call arrangements'],
submissionDeadline: '28 days before event',
additionalRequirements: ['Qualified electrician credentials', 'Electrical installation certificate (BS7671)', 'Method statement for installation and decommissioning']
},
'Furniture / Stands': {
requiredSections: ['Structural stability — stand construction, load bearing, anchoring', 'Working at height — construction and dismantling above 2m', 'Manual handling — component delivery, assembly, removal', 'Falling objects — overhead components, signage, lighting', 'Fire safety — material flammability ratings, exit clearance'],
submissionDeadline: '28 days before event',
additionalRequirements: ['Structural engineer sign-off (for stands over 4m or with upper levels)', 'Material fire rating certificates', 'Method statement for construction and dismantling']
},
'Security': {
requiredSections: ['Threat assessment — event-specific security risks', 'Access control — accreditation, bag search, entry procedures', 'Crowd management — pinch points, capacity monitoring, surge prevention', 'Emergency response — evacuation support, assembly point management', 'Violence and aggression — de-escalation procedures, incident response'],
submissionDeadline: '28 days before event',
additionalRequirements: ['SIA licence copies for all officers', 'Staff accreditation list', 'Radio communication plan']
},
'Logistics / Transport': {
requiredSections: ['Vehicle movement — speed limits, pedestrian separation, reversing', 'Loading operations — bay management, timing, vehicle permits', 'Manual handling — heavy/awkward loads, mechanical assistance', 'Fuel and emissions — vehicle storage, running engines indoors'],
submissionDeadline: '14 days before event',
additionalRequirements: ['Vehicle registration details and insurance', 'Driver competency certificates (for FLTs/MEWPs)', 'Access permit request with vehicle dimensions and weights']
},
'Live Demonstrations': {
requiredSections: ['Public interaction — barrier distances, emergency stop procedures', 'Equipment safety — moving parts, electrical, heat, lasers', 'Failure modes — what happens when the demo goes wrong', 'Supervision — staff qualifications, ratio to public', 'Insurance — specific product liability for demonstration equipment'],
submissionDeadline: '28 days before event',
additionalRequirements: ['Product liability insurance certificate', 'Equipment safety certifications', 'Method statement including emergency procedures', 'Staff competency evidence']
},
'Other': {
requiredSections: ['General hazard identification — all risks specific to your scope of work', 'Affected parties — who could be harmed and how', 'Control measures — what you will do to reduce each risk', 'Emergency procedures — your response to incidents within your scope'],
submissionDeadline: '21 days before event',
additionalRequirements: ['Public liability insurance certificate', 'Method statement for all on-site activities']
}
};
// ===== STATE =====
const DEFAULT_STATE = {
eventName: EVENTHIVE_CONFIG.eventName || '',
eventDate: EVENTHIVE_CONFIG.eventDate || '',
venueName: EVENTHIVE_CONFIG.venueName || '',
eventType: 'conference',
expectedAttendance: 0,
numberOfSuppliers: 0,
numberOfExhibitors: 0,
selectedActivities: [],
customActivities: {},
scoringMethodology: JSON.parse(JSON.stringify(METHODOLOGIES.PxSxW)),
venueHazards: [],
venueDocumentName: null,
venueDocumentDate: null,
venueRevisionDate: null,
venueResponsibleOfficer: null,
venueLegislation: [],
organiserObligations: [],
keyDeadlines: [],
eventRisks: [],
supplierRequirements: [],
suppliers: [],
importedTasks: [],
aiAdditionalNotes: null,
metadata: {
createdAt: null, updatedAt: null,
wizardStep: 1, completionPercentage: 0,
aiMode: false, lastAnalysedActivities: []
}
};
let state = {};
let currentStep = 1;
let currentRiskIndex = 0;
let pendingPdfBase64 = null;
// ===== UTILITIES =====
function uid(prefix) {
return (prefix || 'id') + '_' + Date.now().toString(36) + Math.random().toString(36).slice(2, 5);
}
function getRiskBand(score) {
const bands = state.scoringMethodology.bands;
return bands.find(b => score >= b.min && score <= b.max) || bands[bands.length - 1];
}
function formatRatingBadge(score) {
const band = getRiskBand(Math.round(score * 10) / 10);
const display = Math.round(score * 10) / 10;
return `<span class="risk-badge" style="background:${band.color}">${display}: ${band.code}</span>`;
}
function showToast(msg, type, duration) {
type = type || 'info'; duration = duration || 3500;
const tc = document.getElementById('toast-container');
const t = document.createElement('div');
t.className = 'toast' + (type === 'success' ? ' success' : type === 'error' ? ' error' : '');
t.textContent = msg;
tc.appendChild(t);
setTimeout(() => { if (t.parentNode) t.parentNode.removeChild(t); }, duration);
}
function downloadFile(content, filename, type) {
const blob = new Blob([content], { type: type || 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url; a.download = filename; a.click();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
function slugify(str) {
return (str || '').replace(/\W+/g, '_').toLowerCase();
}
function getStorageKey() {
const slug = slugify(state.eventName || EVENTHIVE_CONFIG.eventName || 'default');
return `eventhive_event_${slug}_risk`;
}
// ===== HOSTED BLOB SERVICE =====
let _riskHosted = false;
let _riskApiBase = null;
let _riskRecordId = null;
async function _ensureHosted() {
if (!EVENTHIVE_CONFIG.__hosted || !EVENTHIVE_CONFIG.__apiBase) return;
try {
const res = await fetch(EVENTHIVE_CONFIG.__apiBase + '/risk_state', { credentials: 'include' });
if (res.ok) { _riskHosted = true; _riskApiBase = EVENTHIVE_CONFIG.__apiBase; }
} catch(e) { console.warn('Risk Wizard hosted mode unavailable:', e); }
}
async function _hostedSaveRisk(toSave) {
if (!_riskHosted) return;
const body = JSON.stringify({ ...toSave, source: 'risk-wizard' });
try {
if (_riskRecordId) {
await fetch(_riskApiBase + '/risk_state/' + _riskRecordId, { method: 'PUT', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body });
} else {
const rec = await fetch(_riskApiBase + '/risk_state', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body }).then(r => r.ok ? r.json() : null);
if (rec && rec.id) _riskRecordId = rec.id;
}
} catch(e) { console.warn('hostedSaveRisk failed:', e); }
}
async function _hostedLoadRisk() {
if (!_riskHosted) return null;
try {
const recs = await fetch(_riskApiBase + '/risk_state', { credentials: 'include' }).then(r => r.ok ? r.json() : []);
if (recs && recs.length) {
const { id, _createdAt, _updatedAt, source, ...data } = recs[0];
_riskRecordId = id;
if (data.metadata && data.metadata.wizardStep) currentStep = data.metadata.wizardStep;
return data;
}
} catch(e) { console.warn('hostedLoadRisk failed:', e); }
return null;
}
// ===== STATE PERSISTENCE =====
function saveState() {
state.metadata.updatedAt = new Date().toISOString();
state.metadata.wizardStep = currentStep;
if (!state.metadata.createdAt) state.metadata.createdAt = new Date().toISOString();
const toSave = JSON.parse(JSON.stringify(state));
delete toSave.metadata.apiKey; // Never persist API key
if (_riskHosted) { _hostedSaveRisk(toSave).catch(()=>{}); return; }
localStorage.setItem(getStorageKey(), JSON.stringify(toSave));
}
function loadState() {
const slug = slugify(EVENTHIVE_CONFIG.eventName || 'default');
const key = `eventhive_event_${slug}_risk`;
const raw = localStorage.getItem(key);
if (!raw) return null;
try {
const parsed = JSON.parse(raw);
if (parsed.metadata && parsed.metadata.wizardStep) {
currentStep = parsed.metadata.wizardStep;
}
return parsed;
} catch (e) { return null; }
}
function startOver() {
if (!confirm('This will clear all risk assessment data for this event. Are you sure?')) return;
localStorage.removeItem(getStorageKey());
state = JSON.parse(JSON.stringify(DEFAULT_STATE));
currentStep = 1;
currentRiskIndex = 0;
pendingPdfBase64 = null;
renderStep(1);
showToast('Risk assessment cleared. Starting fresh.');
}
// ===== NAVIGATION =====
const stepValidators = {};
function validateStep(step) {
const v = stepValidators[step];
if (!v) return true;
return v();
}
function nextStep() {
if (!validateStep(currentStep)) return;
if (currentStep < 7) {
currentStep++;
renderStep(currentStep);
saveState();
}
}
function prevStep() {
if (currentStep > 1) {
currentStep--;
renderStep(currentStep);
saveState();
}
}
function renderStep(step) {
// Hide all panels
document.querySelectorAll('.step-panel').forEach(p => p.classList.remove('active'));
const panel = document.getElementById('step-' + step);
if (panel) panel.classList.add('active');
updateWizardHeader(step);
window.scrollTo({ top: 0, behavior: 'smooth' });
// Step-specific render
if (step === 1) renderStep1();
if (step === 2) renderStep2();
if (step === 3) renderStep3();
if (step === 4) renderStep4OnEntry();
if (step === 5) renderStep5();
if (step === 6) renderStep6();
if (step === 7) renderStep7();
}
function updateWizardHeader(step) {
const meta = STEP_META[step - 1];