File size: 22,762 Bytes
e967c28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ed466e
e967c28
4ed466e
 
 
e967c28
4ed466e
e967c28
4ed466e
 
 
 
 
 
 
 
 
 
 
e967c28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698ae88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e967c28
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
"""
UI styling β€” kept separate from app.py so you can change the LOOK without
touching any app logic. Edit THEME and CSS below; nothing here affects how the
tool works, only how it looks.

HOW TO ITERATE (see changes live, no redeploy, no tokens):
    1. Open a terminal in this project folder.
    2. Run:   .venv\\Scripts\\gradio app.py      (Windows)
              .venv/bin/gradio app.py            (mac/Linux)
    3. Open http://localhost:7860 in your browser.
    4. Edit THIS file, save -> it auto-reloads -> refresh the browser.
   (Use `gradio app.py`, not `python app.py`, so it hot-reloads on save.)
"""
import gradio as gr

# Keep dark-mode tokens identical to light so OS "dark preference" cannot
# flip the UI back to charcoal (this app is designed as a light surface).
_CANVAS = "#F0F1F3"
_SURFACE = "#F7F8FA"
_PANEL = "#FFFFFF"
_BORDER = "#D5DAE2"
# Darker text for readable contrast on light gray / white
_TEXT = "#1A2332"
_MUTED = "#3D4A5C"
# Darker blue-gray so WHITE label/button text meets contrast (~AA)
_BTN = "#4A6580"
_BTN_HOVER = "#3D5570"
_BTN_SECONDARY = "#D5DEE8"
_BTN_SECONDARY_HOVER = "#C5D0DC"

# Professional / sleek: light gray canvas, EB Garamond, cool blue-gray accents.
THEME = gr.themes.Soft(
    primary_hue="slate",
    secondary_hue="slate",
    neutral_hue="slate",
    spacing_size="lg",
    text_size="lg",
    radius_size="sm",
    font=[
        gr.themes.GoogleFont("EB Garamond", weights=(400, 500, 600, 700)),
        "Georgia",
        "Times New Roman",
        "serif",
    ],
    font_mono=[
        gr.themes.GoogleFont("IBM Plex Mono", weights=(400, 500)),
        "ui-monospace",
        "Consolas",
        "monospace",
    ],
).set(
    # Canvas β€” light gray (light + dark tokens matched)
    body_background_fill=_CANVAS,
    body_background_fill_dark=_CANVAS,
    background_fill_primary=_SURFACE,
    background_fill_primary_dark=_SURFACE,
    background_fill_secondary=_CANVAS,
    background_fill_secondary_dark=_CANVAS,
    block_background_fill=_PANEL,
    block_background_fill_dark=_PANEL,
    block_border_color=_BORDER,
    block_border_color_dark=_BORDER,
    border_color_primary=_BORDER,
    border_color_primary_dark=_BORDER,
    # Primary buttons β€” darker blue-gray + white text (readable)
    button_primary_background_fill=_BTN,
    button_primary_background_fill_hover=_BTN_HOVER,
    button_primary_background_fill_dark=_BTN,
    button_primary_background_fill_hover_dark=_BTN_HOVER,
    button_primary_text_color="#FFFFFF",
    button_primary_text_color_dark="#FFFFFF",
    button_primary_text_color_hover="#FFFFFF",
    button_primary_text_color_hover_dark="#FFFFFF",
    button_primary_border_color=_BTN,
    button_primary_border_color_dark=_BTN,
    button_primary_border_color_hover=_BTN_HOVER,
    button_primary_border_color_hover_dark=_BTN_HOVER,
    # Secondary / default buttons
    button_secondary_background_fill=_BTN_SECONDARY,
    button_secondary_background_fill_hover=_BTN_SECONDARY_HOVER,
    button_secondary_background_fill_dark=_BTN_SECONDARY,
    button_secondary_background_fill_hover_dark=_BTN_SECONDARY_HOVER,
    button_secondary_text_color=_TEXT,
    button_secondary_text_color_dark=_TEXT,
    button_secondary_border_color=_BTN_SECONDARY,
    button_secondary_border_color_dark=_BTN_SECONDARY,
    button_secondary_border_color_hover=_BTN_SECONDARY_HOVER,
    button_secondary_border_color_hover_dark=_BTN_SECONDARY_HOVER,
    # Text
    body_text_color=_TEXT,
    body_text_color_dark=_TEXT,
    body_text_color_subdued=_MUTED,
    body_text_color_subdued_dark=_MUTED,
    block_info_text_color=_MUTED,
    block_info_text_color_dark=_MUTED,
    # Labels match primary button: dark blue-gray + white
    block_label_background_fill=_BTN,
    block_label_background_fill_dark=_BTN,
    block_label_border_color=_BTN,
    block_label_border_color_dark=_BTN,
    block_label_text_color="#FFFFFF",
    block_label_text_color_dark="#FFFFFF",
    block_title_text_color=_TEXT,
    block_title_text_color_dark=_TEXT,
    # Checkbox / radio rows β€” dark text on light fill; white on selected dark chip
    checkbox_label_text_color=_TEXT,
    checkbox_label_text_color_dark=_TEXT,
    checkbox_label_text_color_selected="#FFFFFF",
    checkbox_label_text_color_selected_dark="#FFFFFF",
    checkbox_label_background_fill=_PANEL,
    checkbox_label_background_fill_dark=_PANEL,
    checkbox_label_background_fill_hover=_SURFACE,
    checkbox_label_background_fill_hover_dark=_SURFACE,
    checkbox_label_background_fill_selected=_BTN,
    checkbox_label_background_fill_selected_dark=_BTN,
    checkbox_label_border_color=_BORDER,
    checkbox_label_border_color_dark=_BORDER,
    checkbox_label_border_color_selected=_BTN,
    checkbox_label_border_color_selected_dark=_BTN,
    checkbox_background_color_selected=_BTN,
    checkbox_background_color_selected_dark=_BTN,
    # Inputs
    input_background_fill=_PANEL,
    input_background_fill_dark=_PANEL,
    input_border_color=_BORDER,
    input_border_color_dark=_BORDER,
    input_border_color_focus=_BTN,
    input_border_color_focus_dark=_BTN,
    input_placeholder_color=_MUTED,
    input_placeholder_color_dark=_MUTED,
    # Dataframe / table cells β€” light, never dark navy
    table_even_background_fill=_PANEL,
    table_even_background_fill_dark=_PANEL,
    table_odd_background_fill=_SURFACE,
    table_odd_background_fill_dark=_SURFACE,
    table_border_color=_BORDER,
    table_border_color_dark=_BORDER,
    table_text_color=_TEXT,
    table_text_color_dark=_TEXT,
    table_row_focus=_BTN_SECONDARY,
    table_row_focus_dark=_BTN_SECONDARY,
)

# Prefer light UI; strip a sticky dark preference if present.
JS = """
() => {
  try {
    document.documentElement.classList.remove("dark");
    document.body?.classList?.remove("dark");
    localStorage.setItem("theme", "light");
    localStorage.setItem("colorScheme", "light");
  } catch (e) {}
}
"""

CSS = f"""
gradio-app,
.gradio-container,
.gradio-container .main,
.gradio-container .wrap,
.gradio-container .fillable,
.gradio-container .contain {{
    background-color: {_CANVAS} !important;
    background: {_CANVAS} !important;
    color: {_TEXT} !important;
}}

.gradio-container {{
    max-width: 1280px !important;
    margin: 0 auto !important;
    padding: 1.75rem 1.5rem 3rem !important;
    font-family: "EB Garamond", Georgia, "Times New Roman", serif !important;
}}

/* Centered title frame */
.hero-frame {{
    max-width: 52rem !important;
    margin: 0.5rem auto 2rem !important;
    padding: 2rem 2.5rem 1.85rem !important;
    border: 1px solid {_BORDER} !important;
    background: {_PANEL} !important;
    text-align: center !important;
    box-shadow: none !important;
}}

.hero-frame .prose,
.hero-frame span.md.prose,
.hero-frame .markdown {{
    text-align: center !important;
    max-width: 40rem;
    margin-left: auto !important;
    margin-right: auto !important;
}}

.hero-frame h1 {{
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}}

.hero-frame p {{
    text-align: center !important;
    color: {_MUTED} !important;
    font-size: 1.08rem !important;
    line-height: 1.55 !important;
    margin: 0.85rem auto 0 !important;
}}

/* Crisp, flat primary actions β€” no heavy shadow */
button.primary,
.primary {{
    box-shadow: none !important;
    letter-spacing: 0.02em;
    min-height: 2.75rem !important;
    padding: 0.65rem 1.35rem !important;
    font-size: 1.05rem !important;
    background: {_BTN} !important;
    color: #FFFFFF !important;
    border-color: {_BTN} !important;
}}

button.primary:hover,
.primary:hover {{
    background: {_BTN_HOVER} !important;
    border-color: {_BTN_HOVER} !important;
    color: #FFFFFF !important;
}}

/* Tabs β€” dark text on light canvas */
.gradio-container button.selected {{
    color: {_TEXT} !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    border-bottom-color: {_BTN} !important;
}}

.tab-nav button,
.tab-nav button * {{
    font-family: "EB Garamond", Georgia, serif !important;
    font-size: 1.15rem !important;
    padding: 0.85rem 1.1rem !important;
    color: {_TEXT} !important;
    opacity: 1 !important;
}}

.tab-nav button.selected,
.tab-nav button.selected * {{
    color: {_TEXT} !important;
    border-bottom-color: {_BTN} !important;
    font-weight: 600 !important;
}}

/* Field labels β€” force white on blue chips (Soft theme sometimes uses body text color) */
.block .container > span,
.block .label-wrap,
.block .label-wrap span,
.block label.float,
.block label.float span,
.block .has-info,
.block span.has-info {{
    background: {_BTN} !important;
    color: #FFFFFF !important;
    border-color: {_BTN} !important;
}}

/* Empty dataframe title is div.label > p (not a <label>) β€” was white-on-light */
.block div.label > p,
.block .label > p,
.block .header-row .label p {{
    color: {_TEXT} !important;
    background: transparent !important;
    opacity: 1 !important;
}}

/* Result panels under Manifest: light boxes, not deep blue */
.result-panel,
.result-panel .table-container,
.result-panel .wrap,
.result-panel table,
.result-panel .empty,
.result-panel [class*="empty"] {{
    background: {_PANEL} !important;
    color: {_TEXT} !important;
}}

.result-panel .container > span,
.result-panel .label-wrap,
.result-panel .label-wrap span,
.result-panel .label,
.result-panel .label > p,
.result-panel label,
.result-panel label span,
.result-panel label.float,
.result-panel label.float span {{
    background: {_BTN_SECONDARY} !important;
    color: {_TEXT} !important;
    border-color: {_BORDER} !important;
}}

/* Dataframe empty stub / column bars β€” force light gray/white */
.table-container,
.table-wrap,
.dataframe-container,
table,
table thead,
table tbody,
table tr,
table th,
table td {{
    background-color: {_PANEL} !important;
    background: {_PANEL} !important;
    color: {_TEXT} !important;
    border-color: {_BORDER} !important;
}}

table thead th,
table th {{
    background: {_SURFACE} !important;
    color: {_TEXT} !important;
}}

/* Gradio empty dataframe placeholder strips */
.block .scroll-hide,
.block [class*="placeholder"],
.block .svelte-2balj6 {{
    background: {_PANEL} !important;
    color: {_MUTED} !important;
}}

/* Helper / info under inputs */
.info-text,
.block .info,
[class*="info-text"] {{
    color: {_MUTED} !important;
}}

/* Inputs & checkboxes stay dark-on-light */
input, textarea, select,
.wrap input, .wrap textarea {{
    color: {_TEXT} !important;
    background: {_PANEL} !important;
}}

.checkbox-container,
.checkbox-container * {{
    color: {_TEXT} !important;
}}

/* Selected radio/checkbox option β€” white text on dark blue-gray */
.checkbox-container.selected,
.checkbox-container.selected *,
label.selected,
label.selected *,
[class*="checkbox"].selected,
[class*="checkbox"].selected * {{
    color: #FFFFFF !important;
}}

/* Embedding source label chip (and similar) β€” always white on dark fill */
.block .container > span,
.block span.has-info {{
    color: #FFFFFF !important;
}}

/* Title β€” clear presence, not shouting */
.prose h1, .markdown h1, .prose > h1,
span.md.prose h1,
.hero-frame h1 {{
    font-weight: 600 !important;
    font-size: 2.35rem !important;
    letter-spacing: -0.02em;
    line-height: 1.2 !important;
    color: {_TEXT} !important;
    margin: 0 0 0.35rem !important;
}}

.prose h3, .markdown h3,
.gradio-container .chart-caption h3 {{
    font-family: "EB Garamond", Georgia, "Times New Roman", serif !important;
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.45rem !important;
    color: {_TEXT} !important;
}}
.gradio-container .chart-caption h3 {{
    margin-top: 0.85rem !important;
}}

.prose, .markdown, span.md.prose,
.prose p, .markdown p, span.md.prose p,
.prose strong, .markdown strong {{
    color: {_TEXT} !important;
}}

.prose p, .markdown p {{
    color: {_MUTED} !important;
}}

/* Inline code (repo ids, etc.) β€” light chip + dark text, never charcoal-on-charcoal */
.prose code, .markdown code, span.md.prose code,
.prose pre, .markdown pre, span.md.prose pre,
code, pre, kbd, samp {{
    background: {_SURFACE} !important;
    background-color: {_SURFACE} !important;
    color: {_TEXT} !important;
    -webkit-text-fill-color: {_TEXT} !important;
    border: 1px solid {_BORDER} !important;
    box-shadow: none !important;
}}
.prose code, .markdown code, span.md.prose code,
code, kbd, samp {{
    padding: 0.12em 0.4em !important;
    border-radius: 4px !important;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace !important;
    font-size: 0.92em !important;
}}
.prose pre, .markdown pre, span.md.prose pre,
pre {{
    padding: 0.75rem 1rem !important;
    border-radius: 6px !important;
}}

.hero-frame h1 {{
    color: {_TEXT} !important;
}}

/* Unselected radio options: dark text on light fill */
.gradio-container #embedding-source .checkbox-container:not(.selected),
.gradio-container #embedding-source .checkbox-container:not(.selected) * {{
    color: {_TEXT} !important;
    -webkit-text-fill-color: {_TEXT} !important;
}}

/* Selected radio options: white text on dark fill */
.gradio-container #embedding-source .checkbox-container.selected,
.gradio-container #embedding-source .checkbox-container.selected * {{
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF !important;
}}

/* Hide radio circles on chip-style pickers; keep clickable text labels */
.gradio-container #prompt-category input[type="radio"],
.gradio-container #embedding-source input[type="radio"] {{
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}}
.gradio-container #prompt-category label,
.gradio-container #embedding-source label {{
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    cursor: pointer !important;
}}

/* Local vs Hugging Face picker: center the "or" between columns */
.gradio-container .viz-or {{
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    min-height: 6rem !important;
    text-align: center !important;
    color: {_MUTED} !important;
}}
.gradio-container .viz-or p {{
    margin: 0 !important;
    color: {_MUTED} !important;
}}

/* Source panels: idle recedes, selected is framed + badged */
.gradio-container .viz-source {{
    position: relative !important;
    padding: 1rem 1.15rem 1.2rem !important;
    border: 1px solid {_BORDER} !important;
    border-radius: 8px !important;
    background: {_SURFACE} !important;
    opacity: 0.58 !important;
    box-shadow: none !important;
    overflow: visible !important;
    cursor: pointer;
}}
.gradio-container .viz-source.selected {{
    opacity: 1 !important;
    border-color: {_BTN} !important;
    background: {_PANEL} !important;
    box-shadow: inset 4px 0 0 0 {_BTN} !important;
}}
.gradio-container .viz-source-head {{
    align-items: center !important;
    margin-bottom: 0.35rem !important;
}}
.gradio-container .viz-source-head .prose,
.gradio-container .viz-source-head .markdown,
.gradio-container .viz-source-head p {{
    margin: 0 !important;
}}
.gradio-container .source-badge {{
    text-align: right !important;
    margin: 0 !important;
}}
.gradio-container .source-badge p,
.gradio-container .source-badge span,
.gradio-container .source-badge .prose,
.gradio-container .source-badge .markdown {{
    display: inline-block !important;
    margin: 0 !important;
    padding: 0.18rem 0.55rem !important;
    background: {_BTN} !important;
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF !important;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace !important;
    font-size: 0.72rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.07em !important;
    text-transform: uppercase !important;
    border-radius: 3px !important;
    border: none !important;
}}
.gradio-container .source-badge code {{
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
}}

/* Invisible overlay so clicking anywhere on a source card selects it.
   Gradio puts elem_classes on the <button> itself (no wrapper). */
.gradio-container .viz-source button.source-overlay {{
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
}}
.gradio-container .viz-source [role="combobox"],
.gradio-container .viz-source input,
.gradio-container .viz-source textarea,
.gradio-container .viz-source button:not(.source-overlay) {{
    position: relative !important;
    z-index: 4 !important;
}}

/* Chart captions sit above the figure β€” never as a chip on top of it */
.gradio-container .chart-caption {{
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}}
.gradio-container .chart-caption .prose,
.gradio-container .chart-caption .markdown,
.gradio-container .chart-caption p {{
    margin: 0 !important;
    background: transparent !important;
}}
.gradio-container .chart-card {{
    position: relative;
    margin: 0 0 1.75rem 0;
}}
.gradio-container .chart-svg-wrap svg {{
    width: 100% !important;
    height: auto !important;
    display: block;
    background: {_PANEL};
}}
.gradio-container .chart-dl {{
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0 !important;
    z-index: 6 !important;
    pointer-events: none !important;
    min-width: 8rem !important;
}}
.gradio-container .chart-card:hover .chart-dl {{
    opacity: 1 !important;
    pointer-events: auto !important;
}}
.gradio-container .chart-card:hover .chart-svg-wrap {{
    opacity: 0.78;
}}

/* Dataframe labels (TVD table) above the table, not over cells */
.gradio-container .chart-table label.float,
.gradio-container .chart-table .label-wrap {{
    position: static !important;
    transform: none !important;
    display: inline-block !important;
    margin: 0 0 0.5rem 0 !important;
    float: none !important;
}}

/* Playground: 10 labeled image cards */
.gradio-container .pg-card {{
    background: {_PANEL} !important;
    border: 1px solid {_BORDER} !important;
    border-radius: 8px !important;
    padding: 0.55rem 0.55rem 0.7rem !important;
    margin-bottom: 0.6rem !important;
    min-width: 0 !important;
}}
.gradio-container .pg-card .pg-thumb,
.gradio-container .pg-card .pg-thumb .image-container,
.gradio-container .pg-card .pg-thumb .image-frame {{
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    background: {_BTN_SECONDARY} !important;
    border-radius: 4px !important;
}}
.gradio-container .pg-card img {{
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 4px !important;
}}
.gradio-container .pg-card .label-wrap,
.gradio-container .pg-card label.float,
.gradio-container .pg-card .container > span {{
    background: {_BTN_SECONDARY} !important;
    color: {_TEXT} !important;
    border-color: {_BORDER} !important;
}}
.gradio-container .skin-chip {{
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    margin-top: 0.35rem !important;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace !important;
    font-size: 0.78rem !important;
    color: {_MUTED} !important;
}}
.gradio-container .skin-chip .swatch {{
    width: 1.05rem !important;
    height: 1.05rem !important;
    border-radius: 3px !important;
    border: 1px solid {_BORDER} !important;
    flex-shrink: 0 !important;
}}
.gradio-container .skin-chip.muted {{
    font-style: italic !important;
}}
.gradio-container .pg-disclaimer {{
    border: 1px solid {_BORDER} !important;
    background: {_SURFACE} !important;
    padding: 0.75rem 1rem !important;
    border-radius: 6px !important;
    margin: 0.5rem 0 1.25rem !important;
}}
.gradio-container .pg-disclaimer p {{
    margin: 0 !important;
    color: {_MUTED} !important;
    font-size: 0.98rem !important;
}}
.gradio-container .pg-tvd p {{
    color: {_TEXT} !important;
}}
.gradio-container .pg-loader-wrap {{
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}}
.gradio-container .pg-loader {{
    background: {_PANEL} !important;
    border: 1px solid {_BORDER} !important;
    border-radius: 8px !important;
    padding: 1rem 1.15rem 1.1rem !important;
    margin: 0.35rem 0 0.85rem 0 !important;
}}
.gradio-container .pg-loader-row {{
    display: flex !important;
    align-items: center !important;
    gap: 0.85rem !important;
}}
.gradio-container .pg-spinner {{
    width: 1.35rem !important;
    height: 1.35rem !important;
    border: 2px solid {_BORDER} !important;
    border-top-color: {_BTN} !important;
    border-radius: 50% !important;
    animation: pg-spin 0.8s linear infinite !important;
    flex-shrink: 0 !important;
}}
@keyframes pg-spin {{
    to {{ transform: rotate(360deg); }}
}}
.gradio-container .pg-loader-title {{
    font-size: 1.12rem !important;
    color: {_TEXT} !important;
    line-height: 1.3 !important;
}}
.gradio-container .pg-loader-eta {{
    margin-top: 0.15rem !important;
    color: {_MUTED} !important;
    font-size: 0.95rem !important;
}}
.gradio-container .pg-loader-track {{
    margin-top: 0.75rem !important;
    height: 0.45rem !important;
    background: {_BTN_SECONDARY} !important;
    border-radius: 999px !important;
    overflow: hidden !important;
}}
.gradio-container .pg-loader-fill {{
    height: 100% !important;
    background: {_BTN} !important;
    border-radius: 999px !important;
    transition: width 0.35s ease !important;
}}
"""