File size: 57,307 Bytes
6ecbb25
 
 
 
 
91e6e5f
6ecbb25
91e6e5f
6ecbb25
91e6e5f
 
6ecbb25
91e6e5f
 
 
6ecbb25
91e6e5f
 
 
 
6ecbb25
91e6e5f
 
6ecbb25
91e6e5f
 
 
6ecbb25
91e6e5f
 
 
 
 
6ecbb25
 
 
 
91e6e5f
6ecbb25
91e6e5f
 
 
 
 
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
 
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
 
 
6ecbb25
 
 
 
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
6ecbb25
 
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
6ecbb25
 
 
91e6e5f
 
 
 
 
 
 
 
 
 
6ecbb25
 
91e6e5f
 
6ecbb25
 
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
6ecbb25
91e6e5f
 
 
 
 
 
 
 
 
 
6ecbb25
 
91e6e5f
 
 
 
 
 
6ecbb25
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8D Problem Solving Template</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .discipline-card {
            transition: all 0.3s ease;
        }
        .discipline-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .discipline-header {
            background-size: 200% auto;
            background-position: right center;
            transition: all 0.5s ease;
        }
        .discipline-header:hover {
            background-position: left center;
        }
        .required:after {
            content: " *";
            color: #ef4444;
        }
        [contenteditable="true"]:focus {
            outline: none;
            background-color: #f8fafc;
            border-radius: 4px;
            box-shadow: 0 0 0 2px #3b82f6;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8 max-w-6xl">
        <!-- Header -->
        <header class="mb-8 text-center">
            <h1 class="text-4xl font-bold text-gray-800 mb-2">
                <i class="fas fa-bug mr-2 text-red-500"></i> 8D Problem Solving
            </h1>
            <p class="text-lg text-gray-600">Structured approach to identify, correct, and eliminate recurring problems</p>
            <div class="mt-4 bg-blue-50 border-l-4 border-blue-500 p-4 text-left">
                <p class="text-blue-700"><i class="fas fa-info-circle mr-2"></i> Complete each discipline in sequence. Fields marked with <span class="text-red-500">*</span> are required.</p>
            </div>
        </header>

        <!-- Basic Information -->
        <div class="bg-white rounded-xl shadow-md p-6 mb-8">
            <h2 class="text-2xl font-semibold mb-4 text-gray-800">
                <i class="fas fa-file-signature mr-2 text-blue-500"></i> Problem Report
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Problem Title</label>
                    <input type="text" id="problem-title" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Brief problem description">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Reported By</label>
                    <input type="text" id="reported-by" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Name of reporter">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Date Reported</label>
                    <input type="date" id="date-reported" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Priority</label>
                    <select id="priority" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        <option value="low">Low</option>
                        <option value="medium">Medium</option>
                        <option value="high">High</option>
                        <option value="critical">Critical</option>
                    </select>
                </div>
                <div class="md:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Problem Description</label>
                    <div id="problem-description" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Detailed problem description (5W2H)"></div>
                </div>
            </div>
        </div>

        <!-- 8 Disciplines Container -->
        <div id="disciplines-container" class="space-y-8">
            <!-- D1: Establish the Team -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-blue-500 to-blue-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-blue-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">1</div>
                        <h2 class="text-2xl font-semibold">Establish the Team</h2>
                    </div>
                    <p class="mt-2 text-blue-100">Form a cross-functional team with product/process knowledge</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2 required">Team Members</label>
                        <div id="team-members-container" class="space-y-3">
                            <div class="team-member flex items-center space-x-3">
                                <input type="text" placeholder="Name" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <input type="text" placeholder="Role" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <input type="text" placeholder="Department" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <button type="button" class="remove-member text-red-500 hover:text-red-700">
                                    <i class="fas fa-times"></i>
                                </button>
                            </div>
                        </div>
                        <button type="button" id="add-team-member" class="mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium">
                            <i class="fas fa-plus-circle mr-1"></i> Add Team Member
                        </button>
                    </div>
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1 required">Team Leader</label>
                        <input type="text" id="team-leader" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Name of team leader">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-1">Team Meeting Schedule</label>
                        <input type="text" id="meeting-schedule" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="E.g., Weekly on Mondays at 10:00 AM">
                    </div>
                </div>
            </div>

            <!-- D2: Define the Problem -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-purple-500 to-purple-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-purple-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">2</div>
                        <h2 class="text-2xl font-semibold">Define the Problem</h2>
                    </div>
                    <p class="mt-2 text-purple-100">Describe the problem in measurable terms (quantify)</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-1 required">Problem Statement</label>
                        <div id="problem-statement" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Use the 5W2H method (Who, What, When, Where, Why, How, How many)"></div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1 required">Is/Is Not Analysis</label>
                            <div id="is-isnot" contenteditable="true" class="w-full min-h-[150px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="What the problem IS vs. what it IS NOT"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Quantitative Data</label>
                            <div id="quantitative-data" contenteditable="true" class="w-full min-h-[150px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Measurements, defect rates, frequencies, etc."></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- D3: Develop Interim Containment Actions -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-amber-500 to-amber-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-amber-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">3</div>
                        <h2 class="text-2xl font-semibold">Interim Containment Actions</h2>
                    </div>
                    <p class="mt-2 text-amber-100">Implement and verify temporary fixes to contain the problem</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2 required">Containment Actions</label>
                        <div id="containment-actions-container" class="space-y-4">
                            <div class="containment-action border border-gray-200 rounded-lg p-4">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Action Description</label>
                                        <input type="text" placeholder="Describe the containment action" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                                        <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                                        <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                                        <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                            <option value="planned">Planned</option>
                                            <option value="in-progress">In Progress</option>
                                            <option value="completed">Completed</option>
                                            <option value="verified">Verified</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Effectiveness</label>
                                        <input type="text" placeholder="% reduction in problem" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="mt-3 flex justify-end">
                                    <button type="button" class="remove-action text-red-500 hover:text-red-700 text-sm">
                                        <i class="fas fa-trash mr-1"></i> Remove Action
                                    </button>
                                </div>
                            </div>
                        </div>
                        <button type="button" id="add-containment-action" class="mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium">
                            <i class="fas fa-plus-circle mr-1"></i> Add Containment Action
                        </button>
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-1">Verification of Effectiveness</label>
                        <div id="containment-verification" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="How effectiveness was measured and verified"></div>
                    </div>
                </div>
            </div>

            <!-- D4: Identify Root Cause -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-green-500 to-green-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-green-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">4</div>
                        <h2 class="text-2xl font-semibold">Identify Root Cause</h2>
                    </div>
                    <p class="mt-2 text-green-100">Identify all potential causes and isolate the root cause(s)</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2 required">Root Cause Analysis Methods Used</label>
                        <div class="flex flex-wrap gap-3">
                            <label class="inline-flex items-center">
                                <input type="checkbox" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
                                <span class="ml-2">5 Whys</span>
                            </label>
                            <label class="inline-flex items-center">
                                <input type="checkbox" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
                                <span class="ml-2">Fishbone Diagram</span>
                            </label>
                            <label class="inline-flex items-center">
                                <input type="checkbox" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
                                <span class="ml-2">FMEA</span>
                            </label>
                            <label class="inline-flex items-center">
                                <input type="checkbox" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
                                <span class="ml-2">Pareto Analysis</span>
                            </label>
                            <label class="inline-flex items-center">
                                <input type="checkbox" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
                                <span class="ml-2">Other:</span>
                                <input type="text" class="ml-2 px-2 py-1 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 w-32">
                            </label>
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1 required">Potential Causes</label>
                            <div id="potential-causes" contenteditable="true" class="w-full min-h-[150px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="List all potential causes identified"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1 required">Root Cause(s)</label>
                            <div id="root-causes" contenteditable="true" class="w-full min-h-[150px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Verified root cause(s) with evidence"></div>
                        </div>
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 mb-1">Evidence Supporting Root Cause</label>
                        <div id="root-cause-evidence" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Data, tests, or observations that confirm the root cause"></div>
                    </div>
                </div>
            </div>

            <!-- D5: Develop Permanent Corrective Actions -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-red-500 to-red-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-red-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">5</div>
                        <h2 class="text-2xl font-semibold">Permanent Corrective Actions</h2>
                    </div>
                    <p class="mt-2 text-red-100">Develop, verify, and select the best permanent solutions</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2 required">Proposed Corrective Actions</label>
                        <div id="corrective-actions-container" class="space-y-4">
                            <div class="corrective-action border border-gray-200 rounded-lg p-4">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Action Description</label>
                                        <input type="text" placeholder="Describe the corrective action" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                                        <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                                        <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                                        <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                            <option value="proposed">Proposed</option>
                                            <option value="approved">Approved</option>
                                            <option value="in-progress">In Progress</option>
                                            <option value="implemented">Implemented</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Expected Effectiveness</label>
                                        <input type="text" placeholder="% improvement expected" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="mt-3">
                                    <label class="block text-sm font-medium text-gray-700 mb-1">Verification Method</label>
                                    <input type="text" placeholder="How effectiveness will be verified" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                </div>
                                <div class="mt-3 flex justify-end">
                                    <button type="button" class="remove-corrective-action text-red-500 hover:text-red-700 text-sm">
                                        <i class="fas fa-trash mr-1"></i> Remove Action
                                    </button>
                                </div>
                            </div>
                        </div>
                        <button type="button" id="add-corrective-action" class="mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium">
                            <i class="fas fa-plus-circle mr-1"></i> Add Corrective Action
                        </button>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Cost-Benefit Analysis</label>
                            <div id="cost-benefit" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Cost vs. benefits of implementing the solution"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Risk Assessment</label>
                            <div id="risk-assessment" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Potential risks of implementing the solution"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- D6: Implement and Validate Permanent Corrective Actions -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-indigo-500 to-indigo-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-indigo-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">6</div>
                        <h2 class="text-2xl font-semibold">Implement & Validate</h2>
                    </div>
                    <p class="mt-2 text-indigo-100">Implement the permanent solution and verify effectiveness</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2">Implementation Plan</label>
                        <div id="implementation-steps-container" class="space-y-4">
                            <div class="implementation-step border border-gray-200 rounded-lg p-4">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Step Description</label>
                                        <input type="text" placeholder="Describe the implementation step" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                                        <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
                                        <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
                                        <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                                        <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                            <option value="planned">Planned</option>
                                            <option value="in-progress">In Progress</option>
                                            <option value="completed">Completed</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="mt-3 flex justify-end">
                                    <button type="button" class="remove-implementation-step text-red-500 hover:text-red-700 text-sm">
                                        <i class="fas fa-trash mr-1"></i> Remove Step
                                    </button>
                                </div>
                            </div>
                        </div>
                        <button type="button" id="add-implementation-step" class="mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium">
                            <i class="fas fa-plus-circle mr-1"></i> Add Implementation Step
                        </button>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1 required">Validation Method</label>
                            <div id="validation-method" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="How effectiveness will be measured"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1 required">Validation Results</label>
                            <div id="validation-results" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Data showing the solution works"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- D7: Prevent Recurrence -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-pink-500 to-pink-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-pink-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">7</div>
                        <h2 class="text-2xl font-semibold">Prevent Recurrence</h2>
                    </div>
                    <p class="mt-2 text-pink-100">Modify systems to prevent recurrence of this and similar problems</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-2">System Changes</label>
                        <div id="system-changes-container" class="space-y-4">
                            <div class="system-change border border-gray-200 rounded-lg p-4">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Change Description</label>
                                        <input type="text" placeholder="Describe the system change" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Affected Documents</label>
                                        <input type="text" placeholder="Procedures, work instructions, etc." class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                                        <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                                        <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                    </div>
                                </div>
                                <div class="mt-3 flex justify-end">
                                    <button type="button" class="remove-system-change text-red-500 hover:text-red-700 text-sm">
                                        <i class="fas fa-trash mr-1"></i> Remove Change
                                    </button>
                                </div>
                            </div>
                        </div>
                        <button type="button" id="add-system-change" class="mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium">
                            <i class="fas fa-plus-circle mr-1"></i> Add System Change
                        </button>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Training Provided</label>
                            <div id="training-provided" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Training conducted to support changes"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Similar Processes Checked</label>
                            <div id="similar-processes" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Other areas where similar problems might occur"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- D8: Congratulate the Team -->
            <div class="discipline-card bg-white rounded-xl shadow-md overflow-hidden">
                <div class="discipline-header bg-gradient-to-r from-teal-500 to-teal-600 p-6 text-white">
                    <div class="flex items-center">
                        <div class="bg-white text-teal-600 rounded-full w-10 h-10 flex items-center justify-center font-bold text-xl mr-4">8</div>
                        <h2 class="text-2xl font-semibold">Congratulate the Team</h2>
                    </div>
                    <p class="mt-2 text-teal-100">Recognize the collective efforts of the team</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-700 mb-1 required">Team Recognition</label>
                        <div id="team-recognition" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="How the team will be recognized for their efforts"></div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Lessons Learned</label>
                            <div id="lessons-learned" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Key takeaways from this problem-solving process"></div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Opportunities for Improvement</label>
                            <div id="improvement-opportunities" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="How the problem-solving process could be improved"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Completion Section -->
        <div class="bg-white rounded-xl shadow-md p-6 mt-8">
            <h2 class="text-2xl font-semibold mb-4 text-gray-800">
                <i class="fas fa-check-circle mr-2 text-green-500"></i> Completion
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Closed By</label>
                    <input type="text" id="closed-by" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Name of person closing the report">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1 required">Close Date</label>
                    <input type="date" id="close-date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                </div>
                <div class="md:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Final Comments</label>
                    <div id="final-comments" contenteditable="true" class="w-full min-h-[100px] px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Any final comments or observations"></div>
                </div>
            </div>
            <div class="mt-6 flex justify-end space-x-4">
                <button type="button" id="save-draft" class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500">
                    <i class="fas fa-save mr-2"></i> Save Draft
                </button>
                <button type="button" id="submit-report" class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
                    <i class="fas fa-paper-plane mr-2"></i> Submit Report
                </button>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Add team member
            document.getElementById('add-team-member').addEventListener('click', function() {
                const container = document.getElementById('team-members-container');
                const memberDiv = document.createElement('div');
                memberDiv.className = 'team-member flex items-center space-x-3';
                memberDiv.innerHTML = `
                    <input type="text" placeholder="Name" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    <input type="text" placeholder="Role" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    <input type="text" placeholder="Department" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    <button type="button" class="remove-member text-red-500 hover:text-red-700">
                        <i class="fas fa-times"></i>
                    </button>
                `;
                container.appendChild(memberDiv);
                
                // Add event listener to remove button
                memberDiv.querySelector('.remove-member').addEventListener('click', function() {
                    container.removeChild(memberDiv);
                });
            });

            // Add containment action
            document.getElementById('add-containment-action').addEventListener('click', function() {
                const container = document.getElementById('containment-actions-container');
                const actionDiv = document.createElement('div');
                actionDiv.className = 'containment-action border border-gray-200 rounded-lg p-4';
                actionDiv.innerHTML = `
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Action Description</label>
                            <input type="text" placeholder="Describe the containment action" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                            <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                            <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                            <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <option value="planned">Planned</option>
                                <option value="in-progress">In Progress</option>
                                <option value="completed">Completed</option>
                                <option value="verified">Verified</option>
                            </select>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Effectiveness</label>
                            <input type="text" placeholder="% reduction in problem" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="mt-3 flex justify-end">
                        <button type="button" class="remove-action text-red-500 hover:text-red-700 text-sm">
                            <i class="fas fa-trash mr-1"></i> Remove Action
                        </button>
                    </div>
                `;
                container.appendChild(actionDiv);
                
                // Add event listener to remove button
                actionDiv.querySelector('.remove-action').addEventListener('click', function() {
                    container.removeChild(actionDiv);
                });
            });

            // Add corrective action
            document.getElementById('add-corrective-action').addEventListener('click', function() {
                const container = document.getElementById('corrective-actions-container');
                const actionDiv = document.createElement('div');
                actionDiv.className = 'corrective-action border border-gray-200 rounded-lg p-4';
                actionDiv.innerHTML = `
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Action Description</label>
                            <input type="text" placeholder="Describe the corrective action" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                            <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                            <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                            <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <option value="proposed">Proposed</option>
                                <option value="approved">Approved</option>
                                <option value="in-progress">In Progress</option>
                                <option value="implemented">Implemented</option>
                            </select>
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Expected Effectiveness</label>
                            <input type="text" placeholder="% improvement expected" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="mt-3">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Verification Method</label>
                        <input type="text" placeholder="How effectiveness will be verified" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    </div>
                    <div class="mt-3 flex justify-end">
                        <button type="button" class="remove-corrective-action text-red-500 hover:text-red-700 text-sm">
                            <i class="fas fa-trash mr-1"></i> Remove Action
                        </button>
                    </div>
                `;
                container.appendChild(actionDiv);
                
                // Add event listener to remove button
                actionDiv.querySelector('.remove-corrective-action').addEventListener('click', function() {
                    container.removeChild(actionDiv);
                });
            });

            // Add implementation step
            document.getElementById('add-implementation-step').addEventListener('click', function() {
                const container = document.getElementById('implementation-steps-container');
                const stepDiv = document.createElement('div');
                stepDiv.className = 'implementation-step border border-gray-200 rounded-lg p-4';
                stepDiv.innerHTML = `
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Step Description</label>
                            <input type="text" placeholder="Describe the implementation step" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                            <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
                            <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
                            <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                            <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                                <option value="planned">Planned</option>
                                <option value="in-progress">In Progress</option>
                                <option value="completed">Completed</option>
                            </select>
                        </div>
                    </div>
                    <div class="mt-3 flex justify-end">
                        <button type="button" class="remove-implementation-step text-red-500 hover:text-red-700 text-sm">
                            <i class="fas fa-trash mr-1"></i> Remove Step
                        </button>
                    </div>
                `;
                container.appendChild(stepDiv);
                
                // Add event listener to remove button
                stepDiv.querySelector('.remove-implementation-step').addEventListener('click', function() {
                    container.removeChild(stepDiv);
                });
            });

            // Add system change
            document.getElementById('add-system-change').addEventListener('click', function() {
                const container = document.getElementById('system-changes-container');
                const changeDiv = document.createElement('div');
                changeDiv.className = 'system-change border border-gray-200 rounded-lg p-4';
                changeDiv.innerHTML = `
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-3">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Change Description</label>
                            <input type="text" placeholder="Describe the system change" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Affected Documents</label>
                            <input type="text" placeholder="Procedures, work instructions, etc." class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Responsible</label>
                            <input type="text" placeholder="Person responsible" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Target Date</label>
                            <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                        </div>
                    </div>
                    <div class="mt-3 flex justify-end">
                        <button type="button" class="remove-system-change text-red-500 hover:text-red-700 text-sm">
                            <i class="fas fa-trash mr-1"></i> Remove Change
                        </button>
                    </div>
                `;
                container.appendChild(changeDiv);
                
                // Add event listener to remove button
                changeDiv.querySelector('.remove-system-change').addEventListener('click', function() {
                    container.removeChild(changeDiv);
                });
            });

            // Save draft button
            document.getElementById('save-draft').addEventListener('click', function() {
                alert('Draft saved successfully!');
                // In a real application, you would save the data to a database or localStorage
            });

            // Submit report button
            document.getElementById('submit-report').addEventListener('click', function() {
                // Validate required fields
                const requiredFields = document.querySelectorAll('[required]');
                let isValid = true;
                
                requiredFields.forEach(field => {
                    if (field.tagName === 'INPUT' || field.tagName === 'TEXTAREA') {
                        if (!field.value.trim()) {
                            isValid = false;
                            field.classList.add('border-red-500');
                        } else {
                            field.classList.remove('border-red-500');
                        }
                    } else if (field.contentEditable === 'true') {
                        if (!field.textContent.trim()) {
                            isValid = false;
                            field.classList.add('border-red-500');
                        } else {
                            field.classList.remove('border-red-500');
                        }
                    }
                });
                
                if (!isValid) {
                    alert('Please fill in all required fields marked with *');
                    return;
                }
                
                alert('8D Report submitted successfully!');
                // In a real application, you would submit the data to a server
            });

            // Set current date for date-reported if empty
            const dateReported = document.getElementById('date-reported');
            if (!dateReported.value) {
                const today = new Date();
                dateReported.value = today.toISOString().split('T')[0];
            }

            // Set current date for close-date if empty
            const closeDate = document.getElementById('close-date');
            if (!closeDate.value) {
                const today = new Date();
                closeDate.value = today.toISOString().split('T')[0];
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=cltservices/teste" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>