Spaces:
Running

File size: 22,830 Bytes
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90c3d2f
b79966a
 
90c3d2f
b79966a
90c3d2f
 
b79966a
300581c
b79966a
 
 
300581c
90c3d2f
b79966a
 
 
 
 
 
 
300581c
b79966a
 
90c3d2f
b79966a
 
 
 
90c3d2f
300581c
 
b79966a
 
 
 
 
 
 
300581c
b79966a
 
90c3d2f
b79966a
 
 
 
 
300581c
b79966a
 
 
 
 
 
 
300581c
b79966a
300581c
b79966a
90c3d2f
300581c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b79966a
 
 
 
 
 
796d7c6
b79966a
 
 
 
 
 
 
 
 
 
796d7c6
b79966a
 
 
 
 
796d7c6
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796d7c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b79966a
 
 
 
 
 
f95742f
300581c
 
af3db1b
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90c3d2f
 
 
 
 
 
 
 
 
 
 
b79966a
 
 
 
90c3d2f
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796d7c6
 
 
 
b79966a
 
 
 
796d7c6
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796d7c6
b79966a
 
796d7c6
 
 
 
 
 
b79966a
 
 
 
 
796d7c6
 
 
b79966a
 
 
 
 
796d7c6
 
 
b79966a
 
 
 
796d7c6
b79966a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c52101
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RevenueViz: Financial Dashboard</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: {
                            500: '#6366f1',
                        },
                        secondary: {
                            500: '#ec4899',
                        }
                    }
                }
            }
        }
    </script>
    <style>
        .glow {
            box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
        }
        .data-card:hover {
            transform: translateY(-5px);
            transition: all 0.3s ease;
        }
        .chart-container {
            height: 400px;
        }
        #vanta-bg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.2;
        }
    </style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
    <div id="vanta-bg"></div>
    
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <header class="mb-12 text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-primary-500 to-secondary-500 text-transparent bg-clip-text">
                Dashboard Financeiro Loja de Afiliados
</h1>
            <p class="text-gray-400 max-w-2xl mx-auto">
                Dados atualizados dia 13 de Outubro
</p>
</header>
<!-- Key Metrics Cards -->
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
                <div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
                <div class="flex justify-between items-start">
                    <div>
                        <p class="text-gray-400 mb-1">Receita Total</p>
                        <h3 class="text-2xl font-bold">$27.06M</h3>
                        <p class="text-gray-400 text-sm">(Faturamento + Recuperação)</p>
                    </div>
                    <div class="bg-primary-500/20 p-2 rounded-lg">
                        <i data-feather="dollar-sign" class="text-primary-500"></i>
                    </div>
                </div>
                <div class="mt-4">
                    <div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
                        <div class="h-full bg-gradient-to-r from-primary-500 to-secondary-500" style="width: 100%"></div>
                    </div>
                </div>
</div>

            <div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
                <div class="flex justify-between items-start">
                    <div>
                        <p class="text-gray-400 mb-1">Margem Direta</p>
                        <h3 class="text-2xl font-bold">$1.84M</h3>
                        <p class="text-gray-400 text-sm">(6.8% do faturamento)</p>
                    </div>
                    <div class="bg-secondary-500/20 p-2 rounded-lg">
                        <i data-feather="trending-up" class="text-secondary-500"></i>
                    </div>
                </div>
                <div class="mt-4">
                    <div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
                        <div class="h-full bg-gradient-to-r from-secondary-500 to-primary-500" style="width: 68%"></div>
                    </div>
                </div>
</div>

            <div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
                <div class="flex justify-between items-start">
                    <div>
                        <p class="text-gray-400 mb-1">Taxa de Recuperação</p>
                        <h3 class="text-2xl font-bold">4.6%</h3>
                    </div>
                    <div class="bg-green-500/20 p-2 rounded-lg">
                        <i data-feather="repeat" class="text-green-500"></i>
                    </div>
                </div>
                <div class="mt-4">
                    <div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
                        <div class="h-full bg-gradient-to-r from-green-500 to-blue-500" style="width: 46%"></div>
                    </div>
                    <p class="text-gray-400 text-sm mt-2">+0.4% da semana passada</p>
                </div>
</div>

            <div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
                <div class="flex justify-between items-start">
                    <div>
                        <p class="text-gray-400 mb-1">Reembolsos + Chargeback</p>
                        <h3 class="text-2xl font-bold">6.2%</h3>
                    </div>
                    <div class="bg-red-500/20 p-2 rounded-lg">
                        <i data-feather="alert-triangle" class="text-red-500"></i>
                    </div>
                </div>
                <div class="mt-4">
                    <div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
                        <div class="h-full bg-gradient-to-r from-red-500 to-orange-500" style="width: 62%"></div>
                    </div>
                </div>
</div>
</div>

        <!-- Main Chart -->
        <div class="bg-gray-800 rounded-xl p-6 mb-12 border border-gray-700 glow">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-xl font-bold">Visão Geral do Desempenho Financeiro</h2>
<div class="flex space-x-2">
                    <button class="bg-primary-500 hover:bg-primary-600 px-3 py-1 rounded-lg text-sm transition-colors">Semanal</button>
</div>
            </div>
            <div class="chart-container">
                <canvas id="mainChart"></canvas>
            </div>
        </div>

        <!-- Secondary Charts -->
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-12">
            <div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow">
                <h3 class="text-lg font-bold mb-4">Receita vs Margem Direta</h3>
<div class="chart-container" style="height: 300px;">
                    <canvas id="revenueChart"></canvas>
                </div>
            </div>
            <div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow">
                <h3 class="text-lg font-bold mb-4">Custos como % do Faturamento</h3>
<div class="chart-container" style="height: 300px;">
                    <canvas id="costChart"></canvas>
                </div>
            </div>
        </div>

        <!-- Data Table -->
        <div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow overflow-x-auto">
                <h3 class="text-lg font-bold mb-4">Dados Semanais Detalhados</h3>
<table class="min-w-full divide-y divide-gray-700">
                <thead>
                    <tr>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Semana</th>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Receita</th>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">HelpGrid</th>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">SMS</th>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Recebível</th>
                        <th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Resultado Final</th>
</tr>
                </thead>
                <tbody class="divide-y divide-gray-700">
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">06 a 12.10</td>
                        <td class="px-4 py-3 whitespace-nowrap">$3.396M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$93.9K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$62.9K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$954.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$765.0K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">29 a 05.10</td>
                        <td class="px-4 py-3 whitespace-nowrap">$3.672M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$94.4K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$60.1K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$973.8K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$756.9K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">22 a 28.09</td>
                        <td class="px-4 py-3 whitespace-nowrap">$3.597M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$61.7K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$75.9K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$833.3K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$661.1K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">15 a 21.09</td>
                        <td class="px-4 py-3 whitespace-nowrap">$3.550M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$67.2K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$78.3K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$750.7K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$524.8K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">08 a 14.09</td>
                        <td class="px-4 py-3 whitespace-nowrap">$3.478M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$74.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$73.9K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$700.1K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$442.0K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">01 a 07.09</td>
                        <td class="px-4 py-3 whitespace-nowrap">$4.223M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$89.1K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$32.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$780.8K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$469.8K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">25 a 31.08</td>
                        <td class="px-4 py-3 whitespace-nowrap">$2.881M</td>
                        <td class="px-4 py-3 whitespace-nowrap">$63.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$0</td>
                        <td class="px-4 py-3 whitespace-nowrap">$478.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$286.7K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">18 a 24.08</td>
                        <td class="px-4 py-3 whitespace-nowrap">$906.6K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$12.3K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$0</td>
                        <td class="px-4 py-3 whitespace-nowrap">$162.2K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$69.5K</td>
                    </tr>
                    <tr>
                        <td class="px-4 py-3 whitespace-nowrap">11 a 17.08</td>
                        <td class="px-4 py-3 whitespace-nowrap">$405.1K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$10.5K</td>
                        <td class="px-4 py-3 whitespace-nowrap">$0</td>
                        <td class="px-4 py-3 whitespace-nowrap">$51.2K</td>
                        <td class="px-4 py-3 whitespace-nowrap text-primary-500">$8.7K</td>
                    </tr>
<!-- More rows... -->
                </tbody>
            </table>
        </div>
    </div>

    <script>
    </script>
    <script>
        // Initialize Vanta.js background
VANTA.GLOBE({
            el: "#vanta-bg",
            mouseControls: true,
            touchControls: true,
            gyroControls: false,
            minHeight: 200.00,
            minWidth: 200.00,
            scale: 1.00,
            scaleMobile: 1.00,
            color: 0x6366f1,
            backgroundColor: 0x111827,
            size: 0.8
        });

        // Initialize Feather Icons
        feather.replace();

        // Chart data
        const weeks = [
            '06-12.10', '29-05.10', '22-28.09', 
            '15-21.09', '08-14.09', '01-07.09', 
            '25-31.08', '18-24.08', '11-17.08'
        ];
        // Updated revenue calculation (faturamento + recuperação)
        const revenueData = [3396115 + 93944 + 62927, 
                            3672289 + 94357 + 60073, 
                            3597099 + 61731 + 75882, 
                            3549509 + 67172 + 78344, 
                            3478023 + 74485 + 73933, 
                            4223167 + 89118 + 32502, 
                            2880623 + 63483, 
                            906564 + 12322, 
                            405099 + 10539];
        
        const receivableData = [954534, 973781, 833303, 750733, 700088, 780824, 478496, 162175, 51183];
        const finalResultData = [765002, 756892, 661139, 524812, 442019, 469774, 286655, 69542, 8666];
        const helpGridData = [93944, 94357, 61731, 67172, 74485, 89118, 63483, 12322, 10539];
        const smsData = [62927, 60073, 75882, 78344, 73933, 32502, 0, 0, 0];
const costData = {
            refunds: [114223, 139911, 223912, 291876, 308076, 378223, 285723, 85849, 42778],
            chargeBacks: [70958, 155249, 193508, 231280, 326830, 439764, 310894, 112581, 42424],
            cartPanda: [288670, 312145, 305753, 301708, 295632, 358969, 244853, 77058, 34433],
            shipOffers: [346404, 371318, 309778, 371437, 406487, 432669, 255324, 104955, 53056]
        };

        // Main Chart
        const mainCtx = document.getElementById('mainChart').getContext('2d');
        new Chart(mainCtx, {
            type: 'line',
            data: {
                labels: weeks,
                datasets: [
                    {
                        label: 'Receita',
data: revenueData,
                        borderColor: '#6366f1',
                        backgroundColor: 'rgba(99, 102, 241, 0.1)',
                        borderWidth: 3,
                        tension: 0.3,
                        fill: true
                    },
                    {
                        label: 'Recebível',
data: receivableData,
                        borderColor: '#ec4899',
                        backgroundColor: 'rgba(236, 72, 153, 0.1)',
                        borderWidth: 3,
                        tension: 0.3,
                        fill: true
                    },
                    {
                        label: 'Resultado Final',
data: finalResultData,
                        borderColor: '#10b981',
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        borderWidth: 3,
                        tension: 0.3,
                        fill: true
                    }
                ]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'top',
                        labels: {
                            color: '#fff'
                        }
                    },
                    tooltip: {
                        mode: 'index',
                        intersect: false,
                        callbacks: {
                            label: function(context) {
                                return context.dataset.label + ': $' + context.raw.toLocaleString();
                            }
                        }
                    }
                },
                scales: {
                    x: {
                        grid: {
                            color: 'rgba(255, 255, 255, 0.1)'
                        },
                        ticks: {
                            color: '#fff'
                        }
                    },
                    y: {
                        grid: {
                            color: 'rgba(255, 255, 255, 0.1)'
                        },
                        ticks: {
                            color: '#fff',
                            callback: function(value) {
                                return '$' + (value / 1000).toFixed(0) + 'K';
                            }
                        }
                    }
                }
            }
        });
        // Revenue Chart
        const revenueCtx = document.getElementById('revenueChart').getContext('2d');
        new Chart(revenueCtx, {
            type: 'bar',
            data: {
                labels: weeks,
                datasets: [
                    {
                        label: 'Receita',
data: revenueData,
                        backgroundColor: 'rgba(99, 102, 241, 0.7)',
                        borderColor: '#6366f1',
                        borderWidth: 1
                    },
                    {
                        label: 'Margem Direta',
data: finalResultData,
                        backgroundColor: 'rgba(16, 185, 129, 0.7)',
                        borderColor: '#10b981',
                        borderWidth: 1
                    }
                ]
            },
options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'top',
                        labels: {
                            color: '#fff'
                        }
                    },
                    tooltip: {
                        callbacks: {
                            label: function(context) {
                                return context.dataset.label + ': $' + context.raw.toLocaleString();
                            }
                        }
                    }
                },
                scales: {
                    x: {
                        grid: {
                            color: 'rgba(255, 255, 255, 0.1)'
                        },
                        ticks: {
                            color: '#fff'
                        }
                    },
                    y: {
                        grid: {
                            color: 'rgba(255, 255, 255, 0.1)'
                        },
                        ticks: {
                            color: '#fff',
                            callback: function(value) {
                                return '$' + (value / 1000).toFixed(0) + 'K';
                            }
                        }
                    }
                }
            }
        });
        // Cost Chart
        const costCtx = document.getElementById('costChart').getContext('2d');
        new Chart(costCtx, {
            type: 'doughnut',
            data: {
                labels: ['Refunds', 'ChargeBacks', 'CartPanda', 'ShipOffers', 'Afiliados', 'Outros'],
                datasets: [{
                    data: [
                        (costData.refunds.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
                        (costData.chargeBacks.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
                        (costData.cartPanda.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
                        (costData.shipOffers.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
                        15.2, // Placeholder for affiliates percentage
                        8.5   // Placeholder for other costs percentage
                    ],
                    backgroundColor: [
                        'rgba(239, 68, 68, 0.7)',
                        'rgba(249, 115, 22, 0.7)',
                        'rgba(234, 179, 8, 0.7)',
                        'rgba(20, 184, 166, 0.7)',
                        'rgba(139, 92, 246, 0.7)',
                        'rgba(6, 182, 212, 0.7)'
                    ],
                    borderColor: [
                        '#ef4444',
                        '#f97316',
                        '#eab308',
                        '#14b8a6',
                        '#8b5cf6',
                        '#06b6d4'
                    ],
                    borderWidth: 1
                }]
            },
options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'right',
                        labels: {
                            color: '#fff'
                        }
                    },
                    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.toLocaleString() + ' (' + percentage + '%)';
                            }
                        }
                    }
                }
            }
        });
    </script>
</body>
</html>