File size: 59,193 Bytes
97aca1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Relatório MVICENTE Advocacia - LYON CORRETORA</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @page {
            size: A4;
            margin: 10mm;
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .blue-gradient {
            background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
        }
        .scrollable-table-container {
            position: relative;
            overflow: auto;
            max-height: 70vh;
        }
        .scrollable-table {
            overflow: visible;
        }
        .sticky-header th {
            position: sticky;
            top: 0;
            z-index: 10;
            background-color: #1e40af;
            color: white;
            text-align: center;
            vertical-align: middle;
        }
        .hover-row:hover {
            background-color: #f0f9ff;
        }
        .text-xxs {
            font-size: 0.65rem;
        }
        .rotate-text {
            writing-mode: vertical-rl;
            transform: rotate(180deg);
            white-space: nowrap;
        }
        .monetary {
            text-align: right;
            font-family: 'Courier New', monospace;
        }
        .row-page {
            width: 210mm;
            height: 297mm;
            padding: 15mm;
            box-sizing: border-box;
            background: white;
            margin: 0 auto;
            box-shadow: 0 0 5px rgba(0,0,0,0.1);
            position: relative;
            overflow: hidden;
        }
        .row-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 10px;
        }
        .row-table th {
            background-color: #1e40af;
            color: white;
            text-align: left;
            padding: 8px;
            font-size: 12px;
            width: 30%;
        }
        .row-table td {
            border: 1px solid #ddd;
            padding: 8px;
            font-size: 12px;
            width: 70%;
        }
        .row-table tr:nth-child(even) {
            background-color: #f8fafc;
        }
        @media print {
            body * {
                visibility: hidden;
            }
            #printableArea, #printableArea * {
                visibility: visible;
            }
            #printableArea {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
            }
            .no-print {
                display: none !important;
            }
            .row-page {
                page-break-after: always;
                box-shadow: none;
                margin: 0;
                padding: 15mm;
            }
        }
        .hidden-row-pages {
            position: absolute;
            left: -9999px;
            top: -9999px;
            width: 210mm;
            height: 297mm;
        }
        .cda-list {
            max-height: 80px;
            overflow-y: auto;
            padding: 4px;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            background-color: #f8fafc;
        }
        .cda-item {
            padding: 2px 0;
            font-size: 0.75rem;
            border-bottom: 1px solid #e2e8f0;
        }
        .cda-item:last-child {
            border-bottom: none;
        }
        .summary-card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .summary-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .progress-bar {
            height: 6px;
            border-radius: 3px;
            background-color: #e2e8f0;
            overflow: hidden;
        }
        .progress-value {
            height: 100%;
            background-color: #3b82f6;
            transition: width 0.5s ease;
        }
        .tooltip {
            position: relative;
            display: inline-block;
        }
        .tooltip .tooltip-text {
            visibility: hidden;
            width: 200px;
            background-color: #1e40af;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            margin-left: -100px;
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 0.8rem;
        }
        .tooltip:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }
        .badge {
            display: inline-block;
            padding: 0.25em 0.5em;
            font-size: 0.75em;
            font-weight: 600;
            line-height: 1;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: 0.25rem;
        }
        .badge-primary {
            color: #fff;
            background-color: #3b82f6;
        }
        .badge-success {
            color: #fff;
            background-color: #10b981;
        }
        .badge-warning {
            color: #fff;
            background-color: #f59e0b;
        }
        .badge-danger {
            color: #fff;
            background-color: #ef4444;
        }
        .badge-info {
            color: #fff;
            background-color: #06b6d4;
        }
        /* Password protection styles */
        #password-protection {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }
        .password-box {
            background-color: white;
            padding: 2rem;
            border-radius: 0.5rem;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            max-width: 400px;
            width: 90%;
            text-align: center;
        }
        .password-box h2 {
            color: #1e40af;
            margin-bottom: 1.5rem;
            font-size: 1.5rem;
        }
        .password-input {
            width: 100%;
            padding: 0.75rem;
            border: 2px solid #e2e8f0;
            border-radius: 0.375rem;
            font-size: 1rem;
            margin-bottom: 1rem;
            transition: border-color 0.2s;
        }
        .password-input:focus {
            outline: none;
            border-color: #3b82f6;
        }
        .password-btn {
            background-color: #3b82f6;
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 0.375rem;
            font-size: 1rem;
            cursor: pointer;
            transition: background-color 0.2s;
            width: 100%;
        }
        .password-btn:hover {
            background-color: #2563eb;
        }
        .error-message {
            color: #ef4444;
            margin-top: 0.5rem;
            font-size: 0.875rem;
            display: none;
        }
        .table-cell {
            white-space: normal !important;
            word-wrap: break-word;
        }
        .table-cell.cda-cell {
            white-space: nowrap !important;
            overflow-x: auto;
        }
    </style>
</head>
<body class="bg-gray-50 text-gray-800">
    <!-- Password Protection -->
    <div id="password-protection">
        <div class="password-box">
            <h2>Acesso Restrito</h2>
            <p class="mb-4 text-gray-600">Por favor, insira a senha para acessar este relatório</p>
            <input type="password" id="password-input" class="password-input" placeholder="Digite a senha">
            <p id="error-message" class="error-message">Senha incorreta. Tente novamente.</p>
            <button id="password-btn" class="password-btn">
                <i class="fas fa-lock mr-2"></i> Acessar
            </button>
        </div>
    </div>

    <!-- Main Content (hidden until password is entered) -->
    <div id="mainContent" class="hidden">
        <div id="printableArea" class="max-w-7xl mx-auto p-6 bg-white shadow-lg rounded-lg">
            <!-- Header -->
            <header class="blue-gradient text-white rounded-t-lg p-6 mb-6">
                <div class="flex flex-col">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <div class="flex items-center">
                                <div class="bg-white p-2 rounded-lg mr-4">
                                    <svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
                                    </svg>
                                </div>
                                <div>
                                    <h1 class="text-3xl font-bold">MVICENTE ADVOCACIA</h1>
                                    <h2 class="text-xl mt-2">RELATÓRIO DE NEGOCIAÇÕES TRIBUTÁRIAS ATIVAS</h2>
                                </div>
                            </div>
                        </div>
                        <div class="text-right">
                            <div class="text-xl font-semibold">
                                <i class="fas fa-calendar-alt mr-2"></i>
                                <span id="current-date"></span>
                            </div>
                            <div class="mt-2 text-sm bg-blue-700 px-3 py-1 rounded-full inline-block">
                                <i class="fas fa-lock mr-1"></i> CONFIDENCIAL
                            </div>
                        </div>
                    </div>
                    <div class="bg-blue-700 p-3 rounded-lg flex items-center">
                        <div class="mr-3">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-blue-200" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
                            </svg>
                        </div>
                        <div>
                            <p class="font-medium">LYON CORRETORA DE SEGUROS LTDA.</p>
                            <p class="text-blue-200 text-sm">55.223.077/0001-12</p>
                        </div>
                    </div>
                </div>
            </header>

            <!-- Summary Cards -->
            <div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6 no-print">
                <div class="summary-card bg-blue-50 border-l-4 border-blue-500 p-4 rounded-lg relative">
                    <div class="absolute top-2 right-2">
                        <span class="badge badge-primary">DÍVIDA</span>
                    </div>
                    <h3 class="text-xs font-semibold text-blue-800 uppercase">Valor Total Dívida</h3>
                    <p class="text-2xl font-bold text-blue-900 monetary">R$ 374.709,11</p>
                    <div class="mt-2">
                        <div class="flex justify-between text-xs text-blue-600">
                            <span>Consolidado</span>
                            <span>60.2%</span>
                        </div>
                        <div class="progress-bar mt-1">
                            <div class="progress-value" style="width: 60.2%"></div>
                        </div>
                    </div>
                </div>
                <div class="summary-card bg-green-50 border-l-4 border-green-500 p-4 rounded-lg relative">
                    <div class="absolute top-2 right-2">
                        <span class="badge badge-success">CONSOLIDAÇÃO</span>
                    </div>
                    <h3 class="text-xs font-semibold text-green-800 uppercase">Valor Consolidado</h3>
                    <p class="text-2xl font-bold text-green-900 monetary">R$ 225.395,20</p>
                    <div class="mt-2">
                        <div class="flex justify-between text-xs text-green-600">
                            <span>Desconto</span>
                            <span>39.8%</span>
                        </div>
                        <div class="progress-bar mt-1">
                            <div class="progress-value bg-green-500" style="width: 39.8%"></div>
                        </div>
                    </div>
                </div>
                <div class="summary-card bg-yellow-50 border-l-4 border-yellow-500 p-4 rounded-lg relative">
                    <div class="absolute top-2 right-2">
                        <span class="badge badge-warning">ECONÔMICO</span>
                    </div>
                    <h3 class="text-xs font-semibold text-yellow-800 uppercase">Desconto Total</h3>
                    <p class="text-2xl font-bold text-yellow-900 monetary">R$ 149.313,91</p>
                    <div class="mt-2">
                        <div class="flex justify-between text-xs text-yellow-600">
                            <span>Benefício</span>
                            <span>100%</span>
                        </div>
                        <div class="progress-bar mt-1">
                            <div class="progress-value bg-yellow-500" style="width: 100%"></div>
                        </div>
                    </div>
                </div>
                <div class="summary-card bg-indigo-50 border-l-4 border-indigo-500 p-4 rounded-lg relative">
                    <div class="absolute top-2 right-2">
                        <span class="badge badge-info">FLUXO</span>
                    </div>
                    <h3 class="text-xs font-semibold text-indigo-800 uppercase">Valor Entrada</h3>
                    <p class="text-2xl font-bold text-indigo-900 monetary">R$ 18.409,32</p>
                    <div class="mt-2">
                        <div class="flex justify-between text-xs text-indigo-600">
                            <span>Saldo</span>
                            <span>91.8%</span>
                        </div>
                        <div class="progress-bar mt-1">
                            <div class="progress-value bg-indigo-500" style="width: 8.2%"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Filters (hidden in print) -->
            <div class="mb-4 no-print">
                <div class="flex flex-col md:flex-row md:items-center md:justify-between bg-gray-100 p-3 rounded-lg">
                    <div class="mb-2 md:mb-0">
                        <label for="search" class="block text-sm font-medium text-gray-700 mb-1">Buscar:</label>
                        <div class="relative">
                            <input type="text" id="search" placeholder="Pesquisar por conta, CDA..." 
                                   class="pl-8 pr-4 py-2 border border-gray-300 rounded-lg w-full md:w-64 focus:ring-blue-500 focus:border-blue-500">
                            <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                <i class="fas fa-search text-gray-400"></i>
                            </div>
                        </div>
                    </div>
                    <div class="flex space-x-2">
                        <div>
                            <label for="modalidade" class="block text-sm font-medium text-gray-700 mb-1">Modalidade:</label>
                            <select id="modalidade" class="pl-3 pr-8 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500">
                                <option value="">Todas</option>
                                <option value="Lei 12.996/2014">Lei 12.996/2014</option>
                                <option value="0014">0014 - PERT</option>
                            </select>
                        </div>
                        <div>
                            <label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status:</label>
                            <select id="status" class="pl-3 pr-8 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500">
                                <option value="">Todos</option>
                                <option value="deferida">Deferida e Consolidada</option>
                                <option value="parcelamento">Em Parcelamento</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Main Table (hidden in print) -->
            <div class="mb-8 no-print">
                <div class="flex flex-col md:flex-row md:justify-between md:items-center mb-4">
                    <h2 class="text-xl font-semibold text-blue-900 mb-2 md:mb-0">
                        <i class="fas fa-table mr-2"></i>Detalhamento das Transações
                    </h2>
                    <div class="flex flex-col sm:flex-row sm:space-x-2 space-y-2 sm:space-y-0">
                        <button onclick="exportToPDF()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
                            <i class="fas fa-file-pdf mr-2"></i>Exportar PDF
                        </button>
                        <button onclick="exportToExcel()" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
                            <i class="fas fa-file-excel mr-2"></i>Exportar Excel
                        </button>
                        <button onclick="printReport()" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
                            <i class="fas fa-print mr-2"></i>Imprimir
                        </button>
                    </div>
                </div>

                <div class="scrollable-table-container">
                    <table class="min-w-full divide-y divide-gray-200 border border-gray-200 scrollable-table">
                        <thead class="bg-blue-600 text-white sticky-header">
                            <tr>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">REF</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">CONTA</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">MODAL</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">SUBMOD</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">SITUAÇÃO</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">N. CDA</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">DÍVIDA</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">CONSOL</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">% DESC</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. DESC</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST TOTAL</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">% ENT</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. ENT</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST ENT</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT 1</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT F</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. SALDO</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST SALDO</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO 1</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO F</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ATUAL</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">ORIENTAÇÃO</th>
                                <th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center no-print">AÇÕES</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200" id="tableBody">
                            <!-- Rows will be generated here -->
                        </tbody>
                    </table>
                </div>
            </div>

            <!-- Individual Row Pages (hidden on screen, visible in print) -->
            <div id="rowPages" class="hidden-row-pages">
                <!-- Row pages will be generated here -->
            </div>

            <!-- Footer -->
            <footer class="blue-gradient text-white rounded-b-lg p-4 text-center text-sm">
                <div class="flex flex-col md:flex-row md:justify-between items-center">
                    <div class="mb-2 md:mb-0">
                        <p>MVICENTE Advocacia - Relatório gerado em <span id="current-date-footer"></span></p>
                    </div>
                    <div>
                        <p class="text-blue-100">Este documento é confidencial e destinado exclusivamente ao uso da diretoria</p>
                    </div>
                    <div class="mt-2 md:mt-0">
                        <span class="bg-blue-700 px-3 py-1 rounded-full text-xs">
                            <i class="fas fa-shield-alt mr-1"></i> Documento protegido
                        </span>
                    </div>
                </div>
            </footer>
        </div>
    </div>

    <!-- Modal for detailed view -->
    <div id="detailModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-screen overflow-y-auto">
            <div class="flex justify-between items-center border-b border-gray-200 px-6 py-4">
                <h3 class="text-xl font-semibold text-gray-800">Detalhes da Negociação</h3>
                <button onclick="closeModal()" class="text-gray-500 hover:text-gray-700">
                    <i class="fas fa-times"></i>
                </button>
            </div>
            <div class="p-6" id="modalContent">
                <!-- Modal content will be loaded here -->
            </div>
            <div class="border-t border-gray-200 px-6 py-4 flex justify-end">
                <button onclick="closeModal()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
                    Fechar
                </button>
            </div>
        </div>
    </div>

    <script>
        // Password protection
        const CORRECT_PASSWORD = "LYON25";
        const passwordProtection = document.getElementById('password-protection');
        const passwordInput = document.getElementById('password-input');
        const passwordBtn = document.getElementById('password-btn');
        const errorMessage = document.getElementById('error-message');
        const mainContent = document.getElementById('mainContent');

        function checkPassword() {
            const enteredPassword = passwordInput.value.trim();
            
            if (enteredPassword === CORRECT_PASSWORD) {
                // Hide password protection and show main content
                passwordProtection.style.display = 'none';
                mainContent.classList.remove('hidden');
                
                // Generate the report
                generateReport();
            } else {
                // Show error message
                errorMessage.style.display = 'block';
                passwordInput.focus();
            }
        }

        // Add event listeners for password protection
        passwordBtn.addEventListener('click', checkPassword);
        passwordInput.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                checkPassword();
            }
        });

        // Focus password input on page load
        passwordInput.focus();

        // Data for the report
        const reportData = [
            {
                ref: "1",
                conta: "S/N",
                modalidade: "Lei 12.996/2014",
                submodalidade: "PGFN – Débitos Previdenciários–Parcelamento",
                situacao: "EM PARCELAMENTO",
                cda: ["39.494.661-8", "43.234.725-9"],
                valorDivida: "17.791,97",
                valorConsolidado: "14.115,91",
                percDesconto: "20,66%",
                valorDesconto: "3.676,06",
                qPrestTotal: "135",
                percEntrada: "5,00%",
                valorEntrada: "705,79",
                qPrestEntrada: "1",
                valorPrestEntrada: "705,79",
                vPrestEnt1: "30/12/2014",
                vPrestEntF: "30/12/2014",
                valorSaldo: "13.410,12",
                qPrestSaldo: "134",
                valorPrestSaldo: "100,08",
                vPrestSaldo1: "30/01/2015",
                vPrestSaldoF: "28/02/2026",
                valorPrestAtual: "197,61",
                orientacao: "PAGAMENTOS EM DIA / MANTER",
                linkDocumento: "https://drive.google.com/file/d/1mpwxS7R46BoRvmtL69Z9i_kONqXpOXMh/view?usp=sharing"
            },
            {
                ref: "2",
                conta: "S/N",
                modalidade: "Lei 12.996/2014",
                submodalidade: "RFB – Débitos Previdenciários–Parcelamento",
                situacao: "EM PARCELAMENTO",
                cda: ["N/C"],
                valorDivida: "24.079,35",
                valorConsolidado: "21.231,16",
                percDesconto: "11,83%",
                valorDesconto: "2.848,19",
                qPrestTotal: "180",
                percEntrada: "5,00%",
                valorEntrada: "1.061,65",
                qPrestEntrada: "1",
                valorPrestEntrada: "1.061,65",
                vPrestEnt1: "30/12/2014",
                vPrestEntF: "30/12/2014",
                valorSaldo: "20.169,51",
                qPrestSaldo: "179",
                valorPrestSaldo: "112,68",
                vPrestSaldo1: "30/01/2015",
                vPrestSaldoF: "30/11/2029",
                valorPrestAtual: "222,50",
                orientacao: "PAGAMENTOS EM DIA / MANTER",
                linkDocumento: "https://drive.google.com/file/d/1nJ0dI-jahBDdCuIN4u8AwevDm9kd0c2v/view?usp=sharing"
            },
            {
                ref: "3",
                conta: "1627874",
                modalidade: "0014 - PROGRAMA ESPECIAL DE REGULARIZACAO TRIBUTARIA - PERT - DEMAIS DEBITOS",
                submodalidade: "0026 - DEMAIS DEBITOS ATE 15 MILHOES - ENTRADA E SALDO A VISTA OU ATE 145 MESES - NOV-2017",
                situacao: "DEFERIDA E CONSOLIDADA",
                cda: ["80 6 09 030887", "80 6 11 122994", "80 6 11 122995", "80 6 13 079598", "80 2 13 038143", "80 6 13 079599", "80 6 14 066770", "80 2 14 039888", "80 6 14 066771"],
                valorDivida: "332.837,79",
                valorConsolidado: "190.048,13",
                percDesconto: "42,90%",
                valorDesconto: "142.789,66",
                qPrestTotal: "147",
                percEntrada: "5,00%",
                valorEntrada: "16.641,88",
                qPrestEntrada: "2",
                valorPrestEntrada: "8.320,94",
                vPrestEnt1: "30/11/2017",
                vPrestEntF: "30/12/2017",
                valorSaldo: "173.406,25",
                qPrestSaldo: "145",
                valorPrestSaldo: "1.195,91",
                vPrestSaldo1: "30/01/2018",
                vPrestSaldoF: "30/01/2030",
                valorPrestAtual: "1.902,33",
                orientacao: "PAGAMENTOS EM DIA / MANTER",
                linkDocumento: "https://drive.google.com/file/d/1CvO-IvmFsSr7Wb8YDyo_xCWmV2tcLMGT/view?usp=sharing"
            }
        ];

        // Set current date
        const now = new Date();
        const options = { day: '2-digit', month: '2-digit', year: 'numeric' };
        const formattedDate = now.toLocaleDateString('pt-BR', options);
        
        document.getElementById('current-date').textContent = formattedDate;
        document.getElementById('current-date-footer').textContent = formattedDate;

        // Format monetary values for Excel
        function formatCurrencyForExcel(value) {
            if (value === "-") return value;
            // Remove dots (thousands separator) and replace comma with dot (decimal separator)
            return parseFloat(value.replace(/\./g, '').replace(',', '.'));
        }

        // Generate CDA list HTML
        function generateCDAList(cdaItems) {
            if (Array.isArray(cdaItems)) {
                return `<div class="cda-list">${cdaItems.map(item => `<div class="cda-item">${item}</div>`).join('')}</div>`;
            }
            return cdaItems; // fallback if not an array
        }

        // Show modal with details
        function showDetails(rowData) {
            const modal = document.getElementById('detailModal');
            const modalContent = document.getElementById('modalContent');
            
            modalContent.innerHTML = `
                <div class="mb-6">
                    <h4 class="text-lg font-semibold text-blue-800 mb-2">Detalhes da Negociação #${rowData.ref}</h4>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <h5 class="font-medium text-blue-700 mb-2">Informações Básicas</h5>
                            <p><span class="font-medium">Conta:</span> ${rowData.conta}</p>
                            <p><span class="font-medium">Modalidade:</span> ${rowData.modalidade}</p>
                            <p><span class="font-medium">Submodalidade:</span> ${rowData.submodalidade}</p>
                            <p><span class="font-medium">Situação:</span> ${rowData.situacao}</p>
                        </div>
                        <div class="bg-green-50 p-4 rounded-lg">
                            <h5 class="font-medium text-green-700 mb-2">Valores</h5>
                            <p><span class="font-medium">Dívida:</span> <span class="monetary">${rowData.valorDivida}</span></p>
                            <p><span class="font-medium">Consolidado:</span> <span class="monetary">${rowData.valorConsolidado}</span></p>
                            <p><span class="font-medium">Desconto:</span> ${rowData.percDesconto} (<span class="monetary">${rowData.valorDesconto}</span>)</p>
                        </div>
                    </div>
                </div>
                
                <div class="mb-6">
                    <h5 class="font-medium text-gray-700 mb-2">CDAs Vinculadas</h5>
                    <div class="cda-list max-h-60 overflow-y-auto">
                        ${Array.isArray(rowData.cda) ? 
                          rowData.cda.map(item => `<div class="cda-item p-2 border-b border-gray-200 last:border-b-0">${item}</div>`).join('') : 
                          `<div class="p-2">${rowData.cda}</div>`}
                    </div>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                    <div class="bg-yellow-50 p-4 rounded-lg">
                        <h5 class="font-medium text-yellow-700 mb-2">Entrada</h5>
                        <p><span class="font-medium">Valor:</span> <span class="monetary">${rowData.valorEntrada}</span> (${rowData.percEntrada})</p>
                        <p><span class="font-medium">Prestações:</span> ${rowData.qPrestEntrada} x <span class="monetary">${rowData.valorPrestEntrada}</span></p>
                        <p><span class="font-medium">1ª Prestação:</span> ${rowData.vPrestEnt1}</p>
                        <p><span class="font-medium">Última Prestação:</span> ${rowData.vPrestEntF}</p>
                    </div>
                    <div class="bg-purple-50 p-4 rounded-lg">
                        <h5 class="font-medium text-purple-700 mb-2">Saldo</h5>
                        <p><span class="font-medium">Valor:</span> <span class="monetary">${rowData.valorSaldo}</span></p>
                        <p><span class="font-medium">Prestações:</span> ${rowData.qPrestSaldo} x <span class="monetary">${rowData.valorPrestSaldo}</span></p>
                        <p><span class="font-medium">1ª Prestação:</span> ${rowData.vPrestSaldo1}</p>
                        <p><span class="font-medium">Última Prestação:</span> ${rowData.vPrestSaldoF}</p>
                    </div>
                </div>
                
                <div class="bg-gray-50 p-4 rounded-lg">
                    <h5 class="font-medium text-gray-700 mb-2">Resumo Financeiro</h5>
                    <div class="flex justify-between items-center">
                        <div>
                            <p class="text-sm">Total a pagar:</p>
                            <p class="text-xl font-bold monetary">${rowData.valorConsolidado}</p>
                        </div>
                        <div class="text-right">
                            <p class="text-sm">Economia:</p>
                            <p class="text-xl font-bold monetary">${rowData.valorDesconto}</p>
                        </div>
                    </div>
                    <div class="mt-4">
                        <p class="text-sm font-medium">Prestação Atual:</p>
                        <p class="text-lg monetary">${rowData.valorPrestAtual}</p>
                    </div>
                </div>
                
                <div class="mt-4 bg-blue-50 p-4 rounded-lg">
                    <h5 class="font-medium text-blue-700 mb-2">Orientações</h5>
                    <p>${rowData.orientacao}</p>
                    <div class="mt-3">
                        <a href="${rowData.linkDocumento}" target="_blank" class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
                            <i class="fas fa-file-alt mr-2"></i> Gerar Documento
                        </a>
                    </div>
                </div>
            `;
            
            modal.classList.remove('hidden');
        }

        // Close modal
        function closeModal() {
            document.getElementById('detailModal').classList.add('hidden');
        }

        // Filter table rows
        function filterTable() {
            const searchInput = document.getElementById('search').value.toLowerCase();
            const modalidadeFilter = document.getElementById('modalidade').value;
            const statusFilter = document.getElementById('status').value;
            
            const rows = document.querySelectorAll('#tableBody tr');
            
            rows.forEach(row => {
                const rowData = row.getAttribute('data-row');
                const rowObj = JSON.parse(rowData);
                
                const matchesSearch = 
                    rowObj.conta.toLowerCase().includes(searchInput) || 
                    rowObj.cda.toString().toLowerCase().includes(searchInput);
                
                const matchesModalidade = 
                    modalidadeFilter === '' || 
                    rowObj.modalidade.includes(modalidadeFilter);
                
                const matchesStatus = 
                    statusFilter === '' || 
                    (statusFilter === 'deferida' && rowObj.situacao.includes('DEFERIDA')) ||
                    (statusFilter === 'parcelamento' && rowObj.situacao.includes('PARCELAMENTO'));
                
                if (matchesSearch && matchesModalidade && matchesStatus) {
                    row.classList.remove('hidden');
                } else {
                    row.classList.add('hidden');
                }
            });
        }

        // Print the report
        function printReport() {
            window.print();
        }

        // Generate the report
        function generateReport() {
            const tableBody = document.getElementById('tableBody');
            const rowPagesContainer = document.getElementById('rowPages');

            // Clear existing content
            tableBody.innerHTML = '';
            rowPagesContainer.innerHTML = '';

            // Generate main table rows and individual pages
            reportData.forEach((row, index) => {
                // Add row to main table
                const tableRow = document.createElement('tr');
                tableRow.className = index % 2 === 0 ? 'hover-row' : 'hover-row bg-gray-50';
                tableRow.setAttribute('data-row', JSON.stringify(row));

                tableRow.innerHTML = `
                    <td class="px-3 py-4 text-sm font-medium text-blue-600 table-cell">${row.ref}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.conta}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.modalidade}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.submodalidade}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.situacao}</td>
                    <td class="px-3 py-4 text-xs cda-cell">
                        <div class="max-w-xs overflow-auto h-20">${generateCDAList(row.cda)}</div>
                    </td>
                    <td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorDivida}</td>
                    <td class="px-3 py-4 text-sm font-medium text-green-600 monetary table-cell">${row.valorConsolidado}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.percDesconto}</td>
                    <td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorDesconto}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.qPrestTotal}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.percEntrada}</td>
                    <td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorEntrada}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.qPrestEntrada}</td>
                    <td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestEntrada}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.vPrestEnt1}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.vPrestEntF}</td>
                    <td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorSaldo}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.qPrestSaldo}</td>
                    <td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestSaldo}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.vPrestSaldo1}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.vPrestSaldoF}</td>
                    <td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestAtual}</td>
                    <td class="px-3 py-4 text-sm table-cell">${row.orientacao}</td>
                    <td class="px-3 py-4 text-sm no-print">
                        <button onclick="showDetails(${JSON.stringify(row).replace(/"/g, '&quot;')})" class="text-blue-600 hover:text-blue-800 mr-2 tooltip">
                            <i class="fas fa-eye"></i>
                            <span class="tooltip-text">Visualizar detalhes</span>
                        </button>
                        <a href="${row.linkDocumento}" target="_blank" class="text-green-600 hover:text-green-800 tooltip">
                            <i class="fas fa-file-alt"></i>
                            <span class="tooltip-text">Gerar documento</span>
                        </a>
                    </td>
                `;

                tableBody.appendChild(tableRow);

                // Create individual page for this row
                const rowPage = document.createElement('div');
                rowPage.className = 'row-page';

                rowPage.innerHTML = `
                    <div class="mb-4">
                        <div class="flex items-center mb-2">
                            <div class="bg-blue-100 p-2 rounded-lg mr-3">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
                                </svg>
                            </div>
                            <div>
                                <h1 class="text-2xl font-bold text-blue-800">MVICENTE ADVOCACIA</h1>
                                <h2 class="text-lg">RELATÓRIO DE NEGOCIAÇÕES TRIBUTÁRIAS ATIVAS</h2>
                            </div>
                        </div>
                        <div class="bg-blue-700 text-white p-2 rounded-lg text-sm">
                            <p>LYON CORRETORA DE SEGUROS LTDA. - 55.223.077/0001-12</p>
                            <p class="mt-1">Data: ${formattedDate}</p>
                        </div>
                    </div>
                    
                    <div class="mb-4">
                        <h3 class="text-lg font-semibold border-b border-gray-200 pb-2">Detalhes da Transação #${row.ref}</h3>
                    </div>
                    
                    <table class="row-table">
                        <tr>
                            <th>Referência</th>
                            <td>${row.ref}</td>
                        </tr>
                        <tr>
                            <th>Conta Nº</th>
                            <td>${row.conta}</td>
                        </tr>
                        <tr>
                            <th>Modalidade</th>
                            <td>${row.modalidade}</td>
                        </tr>
                        <tr>
                            <th>Submodalidade</th>
                            <td>${row.submodalidade}</td>
                        </tr>
                        <tr>
                            <th>Situação</th>
                            <td>${row.situacao}</td>
                        </tr>
                        <tr>
                            <th>N. CDA</th>
                            <td><div style="max-height: 120px; overflow-y: auto;">${generateCDAList(row.cda)}</div></td>
                        </tr>
                        <tr>
                            <th>Valor Dívida</th>
                            <td class="monetary">${row.valorDivida}</td>
                        </tr>
                        <tr>
                            <th>Valor Consolidado</th>
                            <td class="monetary">${row.valorConsolidado}</td>
                        </tr>
                        <tr>
                            <th>% Desconto</th>
                            <td>${row.percDesconto}</td>
                        </tr>
                        <tr>
                            <th>Valor Desconto</th>
                            <td class="monetary">${row.valorDesconto}</td>
                        </tr>
                        <tr>
                            <th>Qtd. Prestações Total</th>
                            <td>${row.qPrestTotal}</td>
                        </tr>
                        <tr>
                            <th>% Entrada</th>
                            <td>${row.percEntrada}</td>
                        </tr>
                        <tr>
                            <th>Valor Entrada</th>
                            <td class="monetary">${row.valorEntrada}</td>
                        </tr>
                        <tr>
                            <th>Qtd. Prestações Entrada</th>
                            <td>${row.qPrestEntrada}</td>
                        </tr>
                        <tr>
                            <th>Valor Prestação Entrada</th>
                            <td class="monetary">${row.valorPrestEntrada}</td>
                        </tr>
                        <tr>
                            <th>1ª Prestação Entrada</th>
                            <td>${row.vPrestEnt1}</td>
                        </tr>
                        <tr>
                            <th>Última Prestação Entrada</th>
                            <td>${row.vPrestEntF}</td>
                        </tr>
                        <tr>
                            <th>Valor Saldo</th>
                            <td class="monetary">${row.valorSaldo}</td>
                        </tr>
                        <tr>
                            <th>Qtd. Prestações Saldo</th>
                            <td>${row.qPrestSaldo}</td>
                        </tr>
                        <tr>
                            <th>Valor Prestação Saldo</th>
                            <td class="monetary">${row.valorPrestSaldo}</td>
                        </tr>
                        <tr>
                            <th>1ª Prestação Saldo</th>
                            <td>${row.vPrestSaldo1}</td>
                        </tr>
                        <tr>
                            <th>Última Prestação Saldo</th>
                            <td>${row.vPrestSaldoF}</td>
                        </tr>
                        <tr>
                            <th>Valor Prestação Atual</th>
                            <td class="monetary">${row.valorPrestAtual}</td>
                        </tr>
                        <tr>
                            <th>Orientação</th>
                            <td>${row.orientacao}</td>
                        </tr>
                    </table>
                    
                    <div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div class="bg-blue-50 p-3 rounded-lg">
                            <h4 class="font-medium text-blue-700 mb-2">Cronograma de Pagamentos</h4>
                            <p><span class="font-medium">Entrada:</span> ${row.qPrestEntrada} parcelas de <span class="monetary">${row.valorPrestEntrada}</span></p>
                            <p><span class="font-medium">Saldo:</span> ${row.qPrestSaldo} parcelas de <span class="monetary">${row.valorPrestSaldo}</span></p>
                            <p class="mt-2"><span class="font-medium">Prestação Atual:</span> <span class="monetary">${row.valorPrestAtual}</span></p>
                        </div>
                        <div class="bg-green-50 p-3 rounded-lg">
                            <h4 class="font-medium text-green-700 mb-2">Resumo Financeiro</h4>
                            <p><span class="font-medium">Total Consolidado:</span> <span class="monetary">${row.valorConsolidado}</span></p>
                            <p><span class="font-medium">Economia Total:</span> <span class="monetary">${row.valorDesconto}</span></p>
                            <div class="mt-3">
                                <a href="${row.linkDocumento}" target="_blank" class="inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700">
                                    <i class="fas fa-file-alt mr-2"></i> Gerar Documento
                                </a>
                            </div>
                        </div>
                    </div>
                    
                    <div class="mt-4 text-sm text-gray-600">
                        <p>MVICENTE Advocacia - Relatório gerado em ${formattedDate}</p>
                        <p>Este documento é confidencial e destinado exclusivamente ao uso da diretoria</p>
                    </div>
                `;

                rowPagesContainer.appendChild(rowPage);
            });

            // Add total row to main table
            const totalRow = document.createElement('tr');
            totalRow.className = 'bg-blue-50 font-bold';

            totalRow.innerHTML = `
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800" colspan="6">TOTAL</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">374.709,11</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">225.395,20</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">149.313,91</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">18.409,32</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">10.088,38</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm" colspan="2"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">206.985,88</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">1.408,66</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm" colspan="2"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">2.322,43</td>
                <td class="px-3 py-4 whitespace-nowrap text-sm"></td>
                <td class="px-3 py-4 whitespace-nowrap text-sm no-print"></td>
            `;

            tableBody.appendChild(totalRow);

            // Add event listeners to filters
            document.getElementById('search').addEventListener('input', filterTable);
            document.getElementById('modalidade').addEventListener('change', filterTable);
            document.getElementById('status').addEventListener('change', filterTable);
        }

        // Export to PDF with each row on a separate page
        async function exportToPDF() {
            const { jsPDF } = window.jspdf;
            const pdf = new jsPDF('p', 'mm', 'a4');
            
            // Show loading indicator
            const loading = document.createElement('div');
            loading.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
            loading.innerHTML = `
                <div class="bg-white p-6 rounded-lg shadow-xl text-center">
                    <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4"></div>
                    <p class="text-lg font-medium">Gerando PDF...</p>
                    <p class="text-sm text-gray-600 mt-1">Por favor, aguarde</p>
                </div>
            `;
            document.body.appendChild(loading);

            // Get all row pages
            const rowPages = document.querySelectorAll('.row-page');
            
            // Process each page sequentially
            for (let i = 0; i < rowPages.length; i++) {
                if (i > 0) {
                    pdf.addPage();
                }
                
                const page = rowPages[i];
                
                // Temporarily position the page for capture
                page.style.position = 'absolute';
                page.style.left = '0';
                page.style.top = '0';
                page.style.width = '210mm';
                page.style.height = '297mm';
                page.style.zIndex = '9999';
                document.body.appendChild(page);
                
                // Create canvas from the page
                const canvas = await html2canvas(page, {
                    scale: 2,
                    logging: false,
                    useCORS: true,
                    allowTaint: true,
                    scrollX: 0,
                    scrollY: 0
                });
                
                // Remove the page from view
                document.body.removeChild(page);
                page.style.position = '';
                page.style.left = '';
                page.style.top = '';
                page.style.width = '';
                page.style.height = '';
                page.style.zIndex = '';
                
                const imgData = canvas.toDataURL('image/png');
                const imgProps = pdf.getImageProperties(imgData);
                const pdfWidth = pdf.internal.pageSize.getWidth() - 20;
                const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
                
                pdf.addImage(imgData, 'PNG', 10, 10, pdfWidth, pdfHeight);
            }
            
            // Remove loading indicator
            document.body.removeChild(loading);
            
            // Save the PDF
            pdf.save(`Relatorio_Negociacoes_Tributarias_Lyon_Corretora_${formattedDate.replace(/\//g, '-')}.pdf`);
        }

        // Export to Excel with Brazilian currency formatting
        function exportToExcel() {
            const table = document.querySelector('table');
            
            // Clone the table to avoid modifying the original
            const tableClone = table.cloneNode(true);
            
            // Remove action column from export
            const actionColumns = tableClone.querySelectorAll('.no-print');
            actionColumns.forEach(col => col.remove());
            
            // Process monetary values for Excel
            const monetaryCells = tableClone.querySelectorAll('.monetary');
            monetaryCells.forEach(cell => {
                if (cell.textContent !== "-") {
                    const numericValue = formatCurrencyForExcel(cell.textContent);
                    cell.setAttribute('data-num', numericValue);
                }
            });
            
            // Convert to workbook
            const workbook = XLSX.utils.table_to_book(tableClone, {raw: true});
            
            // Apply number formatting
            const ws = workbook.Sheets[workbook.SheetNames[0]];
            
            // Find all columns with monetary values (we'll check for data-num attribute)
            const range = XLSX.utils.decode_range(ws['!ref']);
            for (let C = range.s.c; C <= range.e.c; ++C) {
                const header = XLSX.utils.encode_col(C) + "1";
                if (ws[header] && (ws[header].v.includes("DÍVIDA") || 
                    ws[header].v.includes("CONSOL") || 
                    ws[header].v.includes("V. DESC") || 
                    ws[header].v.includes("V. ENT") || 
                    ws[header].v.includes("V. PREST") || 
                    ws[header].v.includes("SALDO") ||
                    ws[header].v.includes("ATUAL"))) {
                    
                    for (let R = range.s.r + 1; R <= range.e.r; ++R) {
                        const cell = XLSX.utils.encode_col(C) + (R + 1);
                        if (ws[cell] && ws[cell].v !== "-") {
                            // Apply Brazilian currency format
                            ws[cell].z = '"R$"#,##0.00;[Red]\-"R$"#,##0.00';
                        }
                    }
                }
            }
            
            // Save the Excel file
            XLSX.writeFile(workbook, `Relatorio_Negociacoes_Tributarias_Lyon_Corretora_${formattedDate.replace(/\//g, '-')}.xlsx`);
        }
    </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=maralvic/rellyon" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>