File size: 76,105 Bytes
a787dd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Quản trị báo cáo - Hệ thống kho hàng</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3b82f6',
                        secondary: '#10b981',
                        danger: '#ef4444',
                        warning: '#f59e0b',
                        info: '#06b6d4',
                        dark: '#1e293b',
                    }
                }
            }
        }
    </script>
    <style>
        /* Hide inventory sections when daily report is active */
        #dailyReportContent:not(.hidden) ~ .inventory-sections {
            display: none;
        }
        
        .chart-container {
            position: relative;
            height: 300px;
            width: 100%;
        }
        
        .sidebar {
            transition: all 0.3s ease;
        }
        
        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-100%);
                position: absolute;
                z-index: 100;
                height: 100vh;
            }
            
            .sidebar.active {
                transform: translateX(0);
            }
        }
        
        /* Custom scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        
        ::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }
        
        ::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 10px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }
        
        /* Animation for cards */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .animate-fade-in {
            animation: fadeIn 0.3s ease-out forwards;
        }
        
        /* Loading spinner */
        .spinner {
            width: 24px;
            height: 24px;
            border: 3px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
    </style>
</head>
<body class="bg-gray-100 font-sans">
    <div class="flex h-screen overflow-hidden">
        <!-- Sidebar -->
        <div class="sidebar bg-white w-64 border-r border-gray-200 flex flex-col">
            <div class="p-4 border-b border-gray-200">
                <h1 class="text-xl font-bold text-primary flex items-center">
                    <i class="fas fa-warehouse mr-2"></i>
                    KHO HÀNG ABC
                </h1>
                <p class="text-xs text-gray-500">Hệ thống quản trị báo cáo</p>
            </div>
            
            <div class="flex-1 overflow-y-auto">
                <div class="p-4">
                    <h2 class="text-sm uppercase font-semibold text-gray-500 mb-2">Báo cáo tổng quan</h2>
                    <ul class="space-y-1 mb-6 pb-4 border-b border-gray-200">
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md bg-blue-50 text-primary">
                                <i class="fas fa-calendar-day mr-2"></i>
                                Báo cáo hàng ngày
                            </a>
                        </li>
                    </ul>
                    
                    <h2 class="text-sm uppercase font-semibold text-gray-500 mb-2">Báo cáo tồn kho</h2>
                    <ul class="space-y-1">
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-boxes mr-2 text-orange-500"></i>
                                <span class="text-orange-500">Tồn kho theo khách hàng</span>
                            </a>
                        </li>
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-warehouse mr-2 text-amber-600"></i>
                                <span class="text-amber-600">Tồn kho theo kho</span>
                            </a>
                        </li>
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-store mr-2 text-yellow-500"></i>
                                <span class="text-yellow-500">Smart Store</span>
                            </a>
                        </li>
                    </ul>
                    
                    <h2 class="text-sm uppercase font-semibold text-gray-500 mt-4 mb-2">Báo cáo tài chính</h2>
                    <ul class="space-y-1">
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-file-invoice-dollar mr-2 text-emerald-500"></i>
                                <span class="text-emerald-500">Công nợ</span>
                            </a>
                        </li>
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-chart-line mr-2 text-green-600"></i>
                                <span class="text-green-600">Doanh thu</span>
                            </a>
                        </li>
                        <li>
                            <a href="#" class="flex items-center px-3 py-2 text-sm font-medium rounded-md hover:bg-gray-100">
                                <i class="fas fa-coins mr-2 text-lime-500"></i>
                                <span class="text-lime-500">Lợi nhuận</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
            
            <div class="p-4 border-t border-gray-200">
                <div class="flex items-center">
                    <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User" class="w-8 h-8 rounded-full mr-2">
                    <div>
                        <p class="text-sm font-medium">Admin User</p>
                        <p class="text-xs text-gray-500">Quản trị hệ thống</p>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Main Content -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- Header -->
            <header class="bg-white border-b border-gray-200">
                <div class="flex items-center justify-between px-6 py-4">
                    <div class="flex items-center">
                        <button id="sidebarToggle" class="md:hidden mr-4 text-gray-500">
                            <i class="fas fa-bars"></i>
                        </button>
                        <h2 class="text-lg font-semibold text-gray-800">
                            <i class="fas fa-boxes mr-2 text-primary"></i>
                            Báo cáo tồn kho theo khách hàng
                        </h2>
                    </div>
                    
                    <div class="flex items-center space-x-4">
                        <div class="relative">
                            <input type="text" placeholder="Tìm kiếm..." class="pl-8 pr-4 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                            <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
                        </div>
                        <button class="p-2 rounded-full hover:bg-gray-100 relative">
                            <i class="fas fa-bell text-gray-500"></i>
                            <span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
                        </button>
                    </div>
                </div>
            </header>
            
            <!-- Dashboard Content -->
            <main class="flex-1 overflow-y-auto p-6">
                <!-- Daily Report Content -->
                <div id="dailyReportContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 border-l-4 border-blue-500 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">📦 Báo cáo hàng ngày</h1>
                        <p class="text-sm text-gray-500">Thống kê hoạt động xe trong ngày</p>
                    </div>
                    
                    <!-- KPI cards -->
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                            <p class="text-sm text-gray-500">🚛 Lượt xe vào hôm nay</p>
                            <h2 class="text-3xl font-bold text-blue-600">36</h2>
                            <div class="flex items-center mt-2">
                                <span class="text-xs text-green-500 bg-green-50 px-2 py-1 rounded-full">
                                    <i class="fas fa-arrow-up mr-1"></i> 12%
                                </span>
                                <span class="text-xs text-gray-500 ml-2">so với hôm qua</span>
                            </div>
                        </div>
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                            <p class="text-sm text-gray-500">⚖️ Tổng khối lượng hôm nay</p>
                            <h2 class="text-3xl font-bold text-green-600">182,360 kg</h2>
                            <div class="flex items-center mt-2">
                                <span class="text-xs text-red-500 bg-red-50 px-2 py-1 rounded-full">
                                    <i class="fas fa-arrow-down mr-1"></i> 5%
                                </span>
                                <span class="text-xs text-gray-500 ml-2">so với hôm qua</span>
                            </div>
                        </div>
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                            <p class="text-sm text-gray-500">⏱️ Thời gian trung bình</p>
                            <h2 class="text-3xl font-bold text-purple-600">42 phút</h2>
                            <div class="flex items-center mt-2">
                                <span class="text-xs text-green-500 bg-green-50 px-2 py-1 rounded-full">
                                    <i class="fas fa-arrow-down mr-1"></i> 8%
                                </span>
                                <span class="text-xs text-gray-500 ml-2">so với hôm qua</span>
                            </div>
                        </div>
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                            <p class="text-sm text-gray-500">👷 Nhân viên làm việc</p>
                            <h2 class="text-3xl font-bold text-amber-600">12</h2>
                            <div class="flex items-center mt-2">
                                <span class="text-xs text-gray-500">Đang hoạt động</span>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Charts & Top data -->
                    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
                        <!-- Simplified Weight Chart -->
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200 col-span-2">
                            <div class="flex items-center justify-between mb-2">
                                <p class="font-semibold">📊 Trọng lượng hàng theo thời gian</p>
                                <select id="weightTimeRange" class="border border-gray-300 rounded-md px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                                    <option>Hôm nay</option>
                                    <option>7 ngày</option>
                                    <option>30 ngày</option>
                                </select>
                            </div>
                            <div class="chart-container">
                                <canvas id="weightChart"></canvas>
                            </div>
                        </div>
                        
                        <!-- Top hàng nặng -->
                        <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                            <p class="font-semibold mb-2">🏆 Top 5 xe có hàng nặng nhất</p>
                            <ul class="text-sm space-y-3">
                                <li class="flex items-center">
                                    <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full mr-2">1</span>
                                    <span>51C-123.45</span>
                                    <span class="ml-auto font-medium">10,200 kg</span>
                                </li>
                                <li class="flex items-center">
                                    <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full mr-2">2</span>
                                    <span>51D-678.90</span>
                                    <span class="ml-auto font-medium">9,850 kg</span>
                                </li>
                                <li class="flex items-center">
                                    <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full mr-2">3</span>
                                    <span>60A-123.78</span>
                                    <span class="ml-auto font-medium">9,740 kg</span>
                                </li>
                                <li class="flex items-center">
                                    <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full mr-2">4</span>
                                    <span>61B-332.18</span>
                                    <span class="ml-auto font-medium">9,300 kg</span>
                                </li>
                                <li class="flex items-center">
                                    <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full mr-2">5</span>
                                    <span>50F-999.99</span>
                                    <span class="ml-auto font-medium">9,100 kg</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <!-- Table recent trucks -->
                    <div class="bg-white rounded-2xl shadow p-4 hover:shadow-md transition-shadow duration-200">
                        <div class="flex items-center justify-between mb-4">
                            <p class="font-semibold">🕑 Xe vào gần đây</p>
                            <button class="text-sm text-primary hover:text-blue-700 flex items-center">
                                <i class="fas fa-sync-alt mr-1"></i> Làm mới
                            </button>
                        </div>
                        <div class="overflow-auto">
                            <table class="table-auto w-full text-sm">
                                <thead>
                                    <tr class="bg-gray-100">
                                        <th class="p-2 text-left">Biển số</th>
                                        <th class="p-2 text-left">Giờ vào</th>
                                        <th class="p-2 text-left">Trọng lượng</th>
                                        <th class="p-2 text-left">Nhân viên</th>
                                        <th class="p-2 text-left">Trạng thái</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="border-t hover:bg-gray-50">
                                        <td class="p-2">51C-123.45</td>
                                        <td class="p-2">09:15</td>
                                        <td class="p-2">10,200 kg</td>
                                        <td class="p-2">Nguyễn Văn A</td>
                                        <td class="p-2">
                                            <span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded-full">Hoàn thành</span>
                                        </td>
                                    </tr>
                                    <tr class="border-t hover:bg-gray-50">
                                        <td class="p-2">51D-678.90</td>
                                        <td class="p-2">09:45</td>
                                        <td class="p-2">9,850 kg</td>
                                        <td class="p-2">Trần Thị B</td>
                                        <td class="p-2">
                                            <span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded-full">Hoàn thành</span>
                                        </td>
                                    </tr>
                                    <tr class="border-t hover:bg-gray-50">
                                        <td class="p-2">60A-123.78</td>
                                        <td class="p-2">10:15</td>
                                        <td class="p-2">9,740 kg</td>
                                        <td class="p-2">Lê Văn C</td>
                                        <td class="p-2">
                                            <span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-0.5 rounded-full">Đang xử lý</span>
                                        </td>
                                    </tr>
                                    <tr class="border-t hover:bg-gray-50">
                                        <td class="p-2">61B-332.18</td>
                                        <td class="p-2">10:30</td>
                                        <td class="p-2">9,300 kg</td>
                                        <td class="p-2">Phạm Thị D</td>
                                        <td class="p-2">
                                            <span class="bg-blue-100 text-blue-800 text-xs px-2 py-0.5 rounded-full">Chờ kiểm tra</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                
                <!-- Customer Inventory Report -->
                <div id="customerInventoryContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-orange-500 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">📊 Tồn kho theo khách hàng</h1>
                        <p class="text-sm text-gray-500">Thống kê chi tiết tồn kho theo từng khách hàng</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="customerInventoryChart"></canvas>
                    </div>
                </div>
                
                <!-- Warehouse Inventory Report -->
                <div id="warehouseInventoryContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-amber-600 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">🏭 Tồn kho theo tổng kho</h1>
                        <p class="text-sm text-gray-500">Thống kê tồn kho phân bổ theo các kho</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="warehouseInventoryChart"></canvas>
                    </div>
                </div>
                
                <!-- Smart Store Report -->
                <div id="smartStoreContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-yellow-500 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">🛍️ Smart Store Remaining</h1>
                        <p class="text-sm text-gray-500">Thống kê hàng tồn tại các cửa hàng Smart Store</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="smartStoreChart"></canvas>
                    </div>
                </div>
                
                <!-- Debt Report -->
                <div id="debtContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-emerald-500 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">💰 Công nợ khách hàng</h1>
                        <p class="text-sm text-gray-500">Thống kê công nợ theo từng khách hàng</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="debtChart"></canvas>
                    </div>
                </div>
                
                <!-- Revenue Report -->
                <div id="revenueContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-green-600 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">📈 Doanh thu theo kho</h1>
                        <p class="text-sm text-gray-500">Thống kê doanh thu phân bổ theo các kho</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="warehouseRevenueChart"></canvas>
                    </div>
                </div>
                
                <!-- Profit Report -->
                <div id="profitContent" class="bg-white rounded-lg shadow-sm p-6 mb-6 hidden border-l-4 border-lime-500 animate-fade-in">
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold">👥 Doanh thu theo khách hàng</h1>
                        <p class="text-sm text-gray-500">Thống kê doanh thu theo từng khách hàng</p>
                    </div>
                    <div class="chart-container">
                        <canvas id="customerRevenueChart"></canvas>
                    </div>
                </div>
                
                <!-- Inventory Sections (Hidden in Daily Report) -->
                <div class="inventory-sections">
                <div class="inventory-sections">
                    <!-- Filters -->
                    <div class="bg-white rounded-lg shadow-sm p-4 mb-6">
                        <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Kho hàng</label>
                                <select class="w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                                    <option>Tất cả kho</option>
                                    <option>Kho miền Bắc</option>
                                    <option>Kho miền Trung</option>
                                    <option>Kho miền Nam</option>
                                </select>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Khách hàng</label>
                                <select class="w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                                    <option>Tất cả khách hàng</option>
                                    <option>Công ty A</option>
                                    <option>Công ty B</option>
                                    <option>Công ty C</option>
                                </select>
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Từ ngày</label>
                                <input type="date" class="w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Đến ngày</label>
                                <input type="date" class="w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                            </div>
                        </div>
                        <div class="flex justify-end mt-4 space-x-2">
                            <button class="bg-gray-200 text-gray-700 px-4 py-2 rounded-md text-sm font-medium hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400">
                                <i class="fas fa-redo mr-2"></i> Đặt lại
                            </button>
                            <button class="bg-primary text-white px-4 py-2 rounded-md text-sm font-medium hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                                <i class="fas fa-filter mr-2"></i> Lọc dữ liệu
                            </button>
                        </div>
                    </div>
                    
                    <!-- Summary Cards -->
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
                        <div class="bg-white rounded-lg shadow-sm p-4 border-l-4 border-primary hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between">
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Tổng tồn kho</p>
                                    <p class="text-2xl font-bold mt-1">1,245</p>
                                </div>
                                <div class="bg-blue-50 p-3 rounded-full">
                                    <i class="fas fa-box text-primary text-xl"></i>
                                </div>
                            </div>
                            <p class="text-xs text-green-500 mt-2">
                                <i class="fas fa-arrow-up mr-1"></i> 12% so với tháng trước
                            </p>
                        </div>
                                                
                        <div class="bg-white rounded-lg shadow-sm p-4 border-l-4 border-secondary hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between">
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Khách hàng</p>
                                    <p class="text-2xl font-bold mt-1">28</p>
                                </div>
                                <div class="bg-green-50 p-3 rounded-full">
                                    <i class="fas fa-users text-secondary text-xl"></i>
                                </div>
                            </div>
                            <p class="text-xs text-green-500 mt-2">
                                <i class="fas fa-arrow-up mr-1"></i> 3 khách hàng mới
                            </p>
                        </div>
                                                
                        <div class="bg-white rounded-lg shadow-sm p-4 border-l-4 border-warning hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between">
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Hàng sắp hết</p>
                                    <p class="text-2xl font-bold mt-1">56</p>
                                </div>
                                <div class="bg-yellow-50 p-3 rounded-full">
                                    <i class="fas fa-exclamation-triangle text-warning text-xl"></i>
                                </div>
                            </div>
                            <p class="text-xs text-red-500 mt-2">
                                <i class="fas fa-arrow-up mr-1"></i> 5% so với tháng trước
                            </p>
                        </div>
                                                
                        <div class="bg-white rounded-lg shadow-sm p-4 border-l-4 border-danger hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between">
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Hàng quá hạn</p>
                                    <p class="text-2xl font-bold mt-1">12</p>
                                </div>
                                <div class="bg-red-50 p-3 rounded-full">
                                    <i class="fas fa-calendar-times text-danger text-xl"></i>
                                </div>
                            </div>
                            <p class="text-xs text-green-500 mt-2">
                                <i class="fas fa-arrow-down mr-1"></i> 2% so với tháng trước
                            </p>
                        </div>
                    </div>
                    
                    <!-- Charts -->
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
                        <div class="bg-white rounded-lg shadow-sm p-4 hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between mb-4">
                                <h3 class="font-medium">Tồn kho theo khách hàng</h3>
                                <select id="timeRangeSelect" class="border border-gray-300 rounded-md px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                                    <option>7 ngày</option>
                                    <option>30 ngày</option>
                                    <option>3 tháng</option>
                                    <option>6 tháng</option>
                                </select>
                            </div>
                            <div class="chart-container">
                                <canvas id="customerInventoryChart"></canvas>
                            </div>
                        </div>
                                                
                        <div class="bg-white rounded-lg shadow-sm p-4 hover:shadow-md transition-shadow duration-200">
                            <div class="flex items-center justify-between mb-4">
                                <h3 class="font-medium">Phân bổ tồn kho</h3>
                                <select id="distributionSelect" class="border border-gray-300 rounded-md px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary">
                                    <option>Theo kho</option>
                                    <option>Theo loại hàng</option>
                                    <option>Theo khu vực</option>
                                </select>
                            </div>
                            <div class="chart-container">
                                <canvas id="inventoryDistributionChart"></canvas>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Data Table -->
                    <div class="bg-white rounded-lg shadow-sm overflow-hidden mb-6 hover:shadow-md transition-shadow duration-200">
                        <div class="flex items-center justify-between p-4 border-b border-gray-200">
                            <h3 class="font-medium">Chi tiết tồn kho</h3>
                            <div class="flex space-x-2">
                                <button class="bg-gray-100 text-gray-700 px-3 py-1 rounded-md text-sm font-medium hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-300">
                                    <i class="fas fa-print mr-1"></i> In
                                </button>
                                <button class="bg-primary text-white px-3 py-1 rounded-md text-sm font-medium hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                                    <i class="fas fa-download mr-1"></i> Xuất Excel
                                </button>
                            </div>
                        </div>
                        <div class="overflow-x-auto">
                            <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Khách hàng</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Mã hàng</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tên hàng</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Kho</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Số lượng</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ĐVT</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">HSD</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Trạng thái</th>
                                    </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Công ty A</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">SP001</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Bột giặt OMO</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kho miền Bắc</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">245</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Thùng</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15/12/2023</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Tốt</span>
                                        </td>
                                    </tr>
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Công ty B</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">SP002</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Nước rửa chén Sunlight</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kho miền Nam</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">180</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Thùng</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">20/11/2023</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Sắp hết</span>
                                        </td>
                                    </tr>
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Công ty C</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">SP003</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Dầu gội Clear</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kho miền Trung</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">320</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Thùng</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">05/01/2024</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Tốt</span>
                                        </td>
                                    </tr>
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Công ty A</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">SP004</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Sữa tươi Vinamilk</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kho miền Bắc</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">150</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Thùng</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">25/10/2023</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Hết hạn</span>
                                        </td>
                                    </tr>
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Công ty D</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">SP005</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kẹo dẻo Hồng Hà</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Kho miền Nam</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">90</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Thùng</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">30/09/2023</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Hết hạn</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="bg-gray-50 px-6 py-3 flex items-center justify-between border-t border-gray-200">
                            <div class="text-sm text-gray-500">
                                Hiển thị <span class="font-medium">1</span> đến <span class="font-medium">5</span> của <span class="font-medium">1245</span> kết quả
                            </div>
                            <div class="flex space-x-2">
                                <button class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
                                    Trước
                                </button>
                                <button class="px-3 py-1 border border-primary bg-primary text-white rounded-md text-sm font-medium">
                                    1
                                </button>
                                <button class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
                                    2
                                </button>
                                <button class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
                                    3
                                </button>
                                <button class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
                                    Sau
                                </button>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Recent Activities -->
                    <div class="bg-white rounded-lg shadow-sm p-4 hover:shadow-md transition-shadow duration-200">
                        <h3 class="font-medium mb-4">Hoạt động gần đây</h3>
                        <div class="space-y-4">
                            <div class="flex">
                                <div class="flex-shrink-0 mr-3">
                                    <div class="bg-blue-100 p-2 rounded-full">
                                        <i class="fas fa-ship text-primary"></i>
                                    </div>
                                </div>
                                <div class="flex-1 border-b border-gray-200 pb-4">
                                    <div class="flex items-center justify-between">
                                        <p class="text-sm font-medium text-gray-900">Nhập hàng từ cảng</p>
                                        <span class="text-xs text-gray-500">2 giờ trước</span>
                                    </div>
                                    <p class="text-sm text-gray-500 mt-1">Đã nhập 50 container hàng hóa từ cảng Hải Phòng vào kho miền Bắc</p>
                                </div>
                            </div>
                                                        
                            <div class="flex">
                                <div class="flex-shrink-0 mr-3">
                                    <div class="bg-green-100 p-2 rounded-full">
                                        <i class="fas fa-truck text-secondary"></i>
                                    </div>
                                </div>
                                <div class="flex-1 border-b border-gray-200 pb-4">
                                    <div class="flex items-center justify-between">
                                        <p class="text-sm font-medium text-gray-900">Xuất hàng cho khách</p>
                                        <span class="text-xs text-gray-500">5 giờ trước</span>
                                    </div>
                                    <p class="text-sm text-gray-500 mt-1">Xuất 20 thùng hàng cho Công ty A từ kho miền Bắc</p>
                                </div>
                            </div>
                                                        
                            <div class="flex">
                                <div class="flex-shrink-0 mr-3">
                                    <div class="bg-yellow-100 p-2 rounded-full">
                                        <i class="fas fa-exclamation-triangle text-warning"></i>
                                    </div>
                                </div>
                                <div class="flex-1">
                                    <div class="flex items-center justify-between">
                                        <p class="text-sm font-medium text-gray-900">Cảnh báo tồn kho</p>
                                        <span class="text-xs text-gray-500">1 ngày trước</span>
                                    </div>
                                    <p class="text-sm text-gray-500 mt-1">5 mặt hàng sắp hết tồn kho tại kho miền Nam</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </main>
        </div>
    </div>

    <script>
        // Toggle sidebar on mobile
        document.getElementById('sidebarToggle').addEventListener('click', function() {
            document.querySelector('.sidebar').classList.toggle('active');
        });
        
        // Close sidebar when clicking outside on mobile
        document.addEventListener('click', function(event) {
            const sidebar = document.querySelector('.sidebar');
            const sidebarToggle = document.getElementById('sidebarToggle');
            
            if (window.innerWidth <= 768 && 
                !sidebar.contains(event.target) && 
                event.target !== sidebarToggle && 
                !sidebarToggle.contains(event.target)) {
                sidebar.classList.remove('active');
            }
        });
        
        // Global chart variables
        let customerInventoryChart;
        let inventoryDistributionChart;
        let warehouseInventoryChart;
        let smartStoreChart;
        let debtChart;
        let warehouseRevenueChart;
        let customerRevenueChart;
        let weightChart;

        // Sample data for different time ranges and tabs
        const tabData = {
            'Báo cáo hàng ngày': {
                'Hôm nay': {
                    labels: ['6h', '8h', '10h', '12h', '14h', '16h', '18h'],
                    data: [25000, 45000, 60000, 75000, 90000, 110000, 125000]
                },
                '7 ngày': {
                    labels: ['Thứ 2', 'Thứ 3', 'Thứ 4', 'Thứ 5', 'Thứ 6', 'Thứ 7', 'Chủ nhật'],
                    data: [120000, 135000, 142000, 126000, 160000, 182000, 172000]
                },
                '30 ngày': {
                    labels: Array.from({length: 30}, (_, i) => `Ngày ${i+1}`),
                    data: Array.from({length: 30}, () => Math.floor(Math.random() * 200000) + 100000)
                }
            },
            'Tồn kho theo khách hàng': {
                '7 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C', 'Công ty D', 'Công ty E'],
                    data: [245, 180, 320, 150, 90]
                },
                '30 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C', 'Công ty D', 'Công ty E', 'Công ty F'],
                    data: [500, 350, 420, 280, 150, 200]
                }
            },
            'Tồn kho theo tổng kho': {
                '7 ngày': {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam'],
                    data: [1200, 800, 1500]
                },
                '30 ngày': {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam', 'Kho Tây Nguyên'],
                    data: [4500, 2800, 5200, 1500]
                }
            },
            'Smart Store Remaining': {
                '7 ngày': {
                    labels: ['Store Hà Nội', 'Store HCM', 'Store Đà Nẵng'],
                    data: [350, 420, 280]
                },
                '30 ngày': {
                    labels: ['Store Hà Nội', 'Store HCM', 'Store Đà Nẵng', 'Store Hải Phòng'],
                    data: [1500, 1800, 1200, 800]
                }
            },
            'Công nợ': {
                '7 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C'],
                    data: [50000000, 35000000, 42000000]
                },
                '30 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C', 'Công ty D'],
                    data: [150000000, 120000000, 180000000, 80000000]
                }
            },
            'Doanh thu theo kho': {
                '7 ngày': {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam'],
                    data: [120000000, 80000000, 150000000]
                },
                '30 ngày': {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam'],
                    data: [450000000, 280000000, 520000000]
                }
            },
            'Doanh thu theo khách hàng': {
                '7 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C'],
                    data: [80000000, 65000000, 90000000]
                },
                '30 ngày': {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C', 'Công ty D'],
                    data: [250000000, 180000000, 300000000, 150000000]
                }
            }
        };

        // Sample data for different distribution types
        const distributionData = {
            'Theo kho': {
                labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam', 'Smart Store'],
                data: [35, 25, 30, 10]
            },
            'Theo loại hàng': {
                labels: ['Hàng tiêu dùng', 'Hàng điện tử', 'Hàng thực phẩm', 'Hàng may mặc'],
                data: [40, 20, 25, 15]
            },
            'Theo khu vực': {
                labels: ['Miền Bắc', 'Miền Trung', 'Miền Nam'],
                data: [45, 20, 35]
            }
        };

        // Format number as VND currency
        function formatVND(num) {
            return new Intl.NumberFormat('vi-VN').format(num) + 'đ';
        }

        // Format weight in kg
        function formatWeight(kg) {
            if (kg >= 1000) {
                return (kg / 1000).toFixed(1) + ' tấn';
            }
            return kg + ' kg';
        }

        // Update weight chart based on time range
        function updateWeightChart() {
            const timeRange = document.getElementById('weightTimeRange').value;
            const data = tabData['Báo cáo hàng ngày'][timeRange];
            
            weightChart.data.labels = data.labels;
            weightChart.data.datasets[0].data = data.data;
            weightChart.update();
        }

        // Update chart based on active tab and time range
        function updateChart() {
            const activeTab = document.querySelector('.sidebar a.bg-blue-50').textContent.trim();
            const timeRange = document.getElementById('timeRangeSelect')?.value || '7 ngày';
            
            const data = tabData[activeTab][timeRange];
            
            let chart;
            if (activeTab === 'Tồn kho theo khách hàng') {
                chart = customerInventoryChart;
            } else if (activeTab === 'Tồn kho theo tổng kho') {
                chart = warehouseInventoryChart;
            } else if (activeTab === 'Smart Store') {
                chart = smartStoreChart;
            } else if (activeTab === 'Công nợ') {
                chart = debtChart;
            } else if (activeTab === 'Doanh thu theo kho') {
                chart = warehouseRevenueChart;
            } else if (activeTab === 'Doanh thu theo khách hàng') {
                chart = customerRevenueChart;
            } else {
                chart = customerInventoryChart;
            }
            
            if (chart) {
                if (activeTab.includes('Doanh thu') || activeTab.includes 'Công nợ') {
                    // Format as currency for financial tabs
                    chart.data.datasets[0].label = activeTab.includes('Doanh thu') ? 'Doanh thu (VND)' : 'Công nợ (VND)';
                    chart.options.scales.y.ticks.callback = function(value) {
                        return formatVND(value);
                    };
                    chart.options.plugins.tooltip.callbacks.label = function(context) {
                        return context.dataset.label + ': ' + formatVND(context.raw);
                    };
                } else {
                    // Format as quantity for inventory tabs
                    chart.data.datasets[0].label = 'Số lượng';
                    chart.options.scales.y.ticks.callback = function(value) {
                        return value + (activeTab.includes('Smart Store') ? ' sản phẩm' : ' thùng');
                    };
                    chart.options.plugins.tooltip.callbacks.label = function(context) {
                        return context.dataset.label + ': ' + context.raw + (activeTab.includes('Smart Store') ? ' sản phẩm' : ' thùng');
                    };
                }
                
                chart.data.labels = data.labels;
                chart.data.datasets[0].data = data.data;
                chart.update();
            }
        }

        // Update inventory distribution chart
        function updateInventoryDistributionChart(distributionType) {
            const data = distributionData[distributionType];
            inventoryDistributionChart.data.labels = data.labels;
            inventoryDistributionChart.data.datasets[0].data = data.data;
            inventoryDistributionChart.update();
        }

        // Initialize charts
        document.addEventListener('DOMContentLoaded', function() {
            // Weight Chart
            const weightCtx = document.getElementById('weightChart').getContext('2d');
            weightChart = new Chart(weightCtx, {
                type: 'line',
                data: {
                    labels: ['6h', '8h', '10h', '12h', '14h', '16h', '18h'],
                    datasets: [{
                        label: 'Tổng trọng lượng',
                        data: [25000, 45000, 60000, 75000, 90000, 110000, 125000],
                        borderColor: '#3b82f6',
                        backgroundColor: 'rgba(59, 130, 246, 0.1)',
                        tension: 0.4,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return 'Trọng lượng: ' + formatWeight(context.raw);
                                }
                            }
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            ticks: {
                                callback: function(value) {
                                    return formatWeight(value);
                                }
                            }
                        }
                    }
                }
            });

            // Customer Inventory Chart (Bar)
            const customerCtx = document.getElementById('customerInventoryChart').getContext('2d');
            customerInventoryChart = new Chart(customerCtx, {
                type: 'bar',
                data: {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C', 'Công ty D', 'Công ty E'],
                    datasets: [{
                        label: 'Tồn kho (thùng)',
                        data: [245, 180, 320, 150, 90],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(99, 102, 241, 0.7)',
                            'rgba(245, 158, 11, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(99, 102, 241, 1)',
                            'rgba(245, 158, 11, 1)',
                            'rgba(239, 68, 68, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.dataset.label + ': ' + context.raw + ' thùng';
                                }
                            }
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            ticks: {
                                callback: function(value) {
                                    return value + ' thùng';
                                }
                            }
                        }
                    }
                }
            });

            // Warehouse Inventory Chart
            const warehouseCtx = document.getElementById('warehouseInventoryChart').getContext('2d');
            warehouseInventoryChart = new Chart(warehouseCtx, {
                type: 'bar',
                data: {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam'],
                    datasets: [{
                        label: 'Tồn kho (thùng)',
                        data: [1200, 800, 1500],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(239, 68, 68, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });

            // Smart Store Chart
            const smartStoreCtx = document.getElementById('smartStoreChart').getContext('2d');
            smartStoreChart = new Chart(smartStoreCtx, {
                type: 'bar',
                data: {
                    labels: ['Store Hà Nội', 'Store HCM', 'Store Đà Nẵng'],
                    datasets: [{
                        label: 'Tồn kho (sản phẩm)',
                        data: [350, 420, 280],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(239, 68, 68, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });

            // Debt Chart
            const debtCtx = document.getElementById('debtChart').getContext('2d');
            debtChart = new Chart(debtCtx, {
                type: 'bar',
                data: {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C'],
                    datasets: [{
                        label: 'Công nợ (VND)',
                        data: [50000000, 35000000, 42000000],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(239, 68, 68, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.dataset.label + ': ' + formatVND(context.raw);
                                }
                            }
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            ticks: {
                                callback: function(value) {
                                    return formatVND(value);
                                }
                            }
                        }
                    }
                }
            });

            // Warehouse Revenue Chart
            const warehouseRevenueCtx = document.getElementById('warehouseRevenueChart').getContext('2d');
            warehouseRevenueChart = new Chart(warehouseRevenueCtx, {
                type: 'bar',
                data: {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam'],
                    datasets: [{
                        label: 'Doanh thu (VND)',
                        data: [120000000, 80000000, 150000000],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(239, 68, 68, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    return context.dataset.label + ': ' + formatVND(context.raw);
                                }
                            }
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            ticks: {
                                callback: function(value) {
                                    return formatVND(value);
                                }
                            }
                        }
                    }
                }
            });

            // Customer Revenue Chart
            const customerRevenueCtx = document.getElementById('customerRevenueChart').getContext('2d');
            customerRevenueChart = new Chart(customerRevenueCtx, {
                type: 'bar',
                data: {
                    labels: ['Công ty A', 'Công ty B', 'Công ty C'],
                    datasets: [{
                        label: 'Doanh thu (VND)',
                        data: [80000000, 65000000, 90000000],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)'
                        ],
        borderColor: [
            'rgba(59, 130, 246, 1)',
            'rgba(16, 185, 129, 1)',
            'rgba(239, 68, 68, 1)'
        ],
        borderWidth: 1
    }]
},
options: {
    responsive: true,
    maintainAspectRatio: false,
    plugins: {
        legend: {
            display: false
        },
        tooltip: {
            callbacks: {
                label: function(context) {
                    return context.dataset.label + ': ' + formatVND(context.raw);
                }
            }
        }
    },
    scales: {
        y: {
            beginAtZero: true,
            ticks: {
                callback: function(value) {
                    return formatVND(value);
                }
            }
        }
    }
}
            });

            // Inventory Distribution Chart (Doughnut)
            const distributionCtx = document.getElementById('inventoryDistributionChart').getContext('2d');
            inventoryDistributionChart = new Chart(distributionCtx, {
                type: 'doughnut',
                data: {
                    labels: ['Kho miền Bắc', 'Kho miền Trung', 'Kho miền Nam', 'Smart Store'],
                    datasets: [{
                        label: 'Phân bổ tồn kho',
                        data: [35, 25, 30, 10],
                        backgroundColor: [
                            'rgba(59, 130, 246, 0.7)',
                            'rgba(16, 185, 129, 0.7)',
                            'rgba(239, 68, 68, 0.7)',
                            'rgba(245, 158, 11, 0.7)'
                        ],
                        borderColor: [
                            'rgba(59, 130, 246, 1)',
                            'rgba(16, 185, 129, 1)',
                            'rgba(239, 68, 68, 1)',
                            'rgba(245, 158, 11, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'right',
                        },
                        tooltip: {
                            callbacks: {
                                label: function(context) {
                                    const label = context.label || '';
                                    const value = context.raw || 0;
                                    const total = context.dataset.data.reduce((a, b) => a + b, 0);
                                    const percentage = Math.round((value / total) * 100);
                                    return `${label}: ${value}% (${percentage}% tổng kho)`;
                                }
                            }
                        }
                    }
                }
            });

            // Add event listeners
            if (document.getElementById('timeRangeSelect')) {
                document.getElementById('timeRangeSelect').addEventListener('change', updateChart);
            }

            if (document.getElementById('distributionSelect')) {
                document.getElementById('distributionSelect').addEventListener('change', function() {
                    updateInventoryDistributionChart(this.value);
                });
            }

            if (document.getElementById('weightTimeRange')) {
                document.getElementById('weightTimeRange').addEventListener('change', updateWeightChart);
            }
        });

        // Add active class to clicked nav items and show corresponding content
        const navItems = document.querySelectorAll('.sidebar a');
        navItems.forEach(item => {
            item.addEventListener('click', function(e) {
                e.preventDefault();
                navItems.forEach(i => i.classList.remove('bg-blue-50', 'text-primary'));
                this.classList.add('bg-blue-50', 'text-primary');

                // Update main title
                const mainTitle = document.querySelector('header h2');
                const iconClass = this.querySelector('i').className.split(' ')[1];
                const textColor = this.querySelector('span')?.className.includes('text-') ? 
                    this.querySelector('span').className.match(/text-(.*?)-|text-(.*?)\s/)[1] || 'primary' : 
                    'primary';

                mainTitle.innerHTML = `<i class="fas ${iconClass} mr-2 text-${textColor}"></i> ${this.textContent.trim()}`;

                // Hide all content sections
                document.querySelectorAll('[id$="Content"]').forEach(section => {
                    section.classList.add('hidden');
                });

                // Show the corresponding content section
                const tabText = this.textContent.trim();
                let contentId;

                switch(tabText) {
                    case 'Tồn kho theo khách hàng':
                        contentId = 'customerInventoryContent';
                        break;
                    case 'Tồn kho theo kho':
                        contentId = 'warehouseInventoryContent';
                        break;
                    case 'Smart Store':
                        contentId = 'smartStoreContent';
                        break;
                    case 'Công nợ':
                        contentId = 'debtContent';
                        break;
                    case 'Doanh thu':
                        contentId = 'revenueContent';
                        break;
                    case 'Lợi nhuận':
                        contentId = 'profitContent';
                        break;
                    case 'Báo cáo hàng ngày':
                    default:
                        contentId = 'dailyReportContent';
                }

                document.getElementById(contentId).classList.remove('hidden');

                // Update chart if needed
                if (typeof updateChart === 'function') {
                    updateChart();
                }
            });
        });

        // Initialize by showing daily report
        document.querySelector('.sidebar a.bg-blue-50').click();

        // Add loading effect to buttons
        document.querySelectorAll('button').forEach(button => {
            button.addEventListener('click', function() {
                if (this.classList.contains('bg-primary') || this.classList.contains('bg-gray-200')) {
                    const originalContent = this.innerHTML;
                    this.innerHTML = `<span class="spinner"></span> ${this.textContent.trim()}`;
                    this.disabled = true;

                    // Simulate loading
                    setTimeout(() => {
                        this.innerHTML = originalContent;
                        this.disabled = false;
                    }, 1500);
                }
            });
        });
    </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=dangchauky/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>