@x12i/ai 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1225 @@
1
+ /*
2
+ * @x12i/ai styles.
3
+ *
4
+ * Tokens only: no hard-coded colors, spacing or font sizes (a test enforces
5
+ * this). It builds on the kit variables and on the kit's own component
6
+ * styles, so load them first:
7
+ *
8
+ * @import "@x12i/themes/themes.css";
9
+ * @import "@x12i/ui/styles.css";
10
+ * @import "@x12i/ai/styles.css";
11
+ *
12
+ * Every selector sits inside :where(), so it has zero specificity and any app
13
+ * class overrides it without a specificity fight. Components expose styling
14
+ * hooks as data attributes (data-kit="ai-*", data-state, data-role, ...).
15
+ * Layout uses logical properties, so right-to-left works without extra CSS.
16
+ */
17
+
18
+ /* ------------------------------------------------------------ Shared bits */
19
+
20
+ :where([data-kit="ai-glyph"]) {
21
+ flex: none;
22
+ inline-size: var(--kit-size-icon-sm);
23
+ block-size: var(--kit-size-icon-sm);
24
+ stroke-width: var(--kit-icon-stroke-width);
25
+ }
26
+
27
+ :where([data-kit="ai-glyph"][data-size="xs"]) {
28
+ inline-size: var(--kit-size-icon-xs);
29
+ block-size: var(--kit-size-icon-xs);
30
+ }
31
+
32
+ :where([data-kit="ai-glyph"][data-size="md"]) {
33
+ inline-size: var(--kit-size-icon-md);
34
+ block-size: var(--kit-size-icon-md);
35
+ }
36
+
37
+ :where([data-kit="ai-glyph"][data-size="lg"]) {
38
+ inline-size: var(--kit-size-icon-lg);
39
+ block-size: var(--kit-size-icon-lg);
40
+ }
41
+
42
+ /* Arrows that point along the reading direction mirror in right-to-left. */
43
+ :where([data-kit="ai-glyph"][data-flip]:dir(rtl)) {
44
+ transform: scaleX(-1);
45
+ }
46
+
47
+ /* Disclosure buttons (reasoning, sources, tool calls): plain buttons that look like a line of text. */
48
+ :where(
49
+ [data-kit="ai-reasoning-trigger"],
50
+ [data-kit="ai-sources-trigger"],
51
+ [data-kit="ai-tool-call-trigger"]
52
+ ) {
53
+ box-sizing: border-box;
54
+ display: inline-flex;
55
+ align-items: center;
56
+ gap: var(--kit-space-2);
57
+ min-block-size: var(--kit-size-target-min);
58
+ margin: 0;
59
+ padding-block: var(--kit-space-1);
60
+ padding-inline: var(--kit-space-2);
61
+ border: var(--kit-border-width-default) solid transparent;
62
+ border-radius: var(--kit-radius-control);
63
+ background: transparent;
64
+ color: var(--kit-color-text-secondary);
65
+ font-family: var(--kit-font-family-sans);
66
+ font-size: var(--kit-text-label-size);
67
+ font-weight: var(--kit-text-label-weight);
68
+ line-height: var(--kit-text-label-line-height);
69
+ text-align: start;
70
+ cursor: pointer;
71
+ -webkit-tap-highlight-color: transparent;
72
+ }
73
+
74
+ :where(
75
+ [data-kit="ai-reasoning-trigger"],
76
+ [data-kit="ai-sources-trigger"],
77
+ [data-kit="ai-tool-call-trigger"]
78
+ ):hover {
79
+ color: var(--kit-color-text-primary);
80
+ background: color-mix(in srgb, var(--kit-color-text-primary) 6%, transparent);
81
+ }
82
+
83
+ /* Panels use the `hidden` attribute; a display value must not undo it. */
84
+ :where([data-kit$="-panel"][hidden]) {
85
+ display: none;
86
+ }
87
+
88
+ /* Every focusable piece of the chat shows the kit's focus ring. */
89
+ :where(
90
+ [data-kit="ai-reasoning-trigger"],
91
+ [data-kit="ai-sources-trigger"],
92
+ [data-kit="ai-tool-call-trigger"],
93
+ [data-kit="ai-citation"],
94
+ [data-kit="ai-source-link"],
95
+ [data-kit="ai-markdown-link"],
96
+ [data-kit="ai-attachment"] a,
97
+ [data-kit="ai-prompt-commands"] [role="option"]
98
+ ):focus-visible {
99
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
100
+ outline-offset: var(--kit-space-0-5);
101
+ }
102
+
103
+ /* Scrollable areas that become keyboard-focusable get the ring inside their edge. */
104
+ :where(
105
+ [data-kit="ai-conversation-scroller"],
106
+ [data-kit="ai-code-block"] pre,
107
+ [data-kit="ai-json-view"] pre,
108
+ [data-kit="ai-markdown-table"],
109
+ [data-kit="ai-message"],
110
+ [data-kit="ai-source"]
111
+ ):focus-visible {
112
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
113
+ outline-offset: calc(var(--kit-border-width-focus) * -1);
114
+ }
115
+
116
+ /* ---------------------------------------------------------------- Thread */
117
+
118
+ :where([data-kit="ai-chat-thread"]) {
119
+ --_measure: calc(var(--kit-size-56) * 14);
120
+
121
+ box-sizing: border-box;
122
+ display: flex;
123
+ flex-direction: column;
124
+ min-block-size: 0;
125
+ block-size: 100%;
126
+ background: var(--kit-color-bg-canvas);
127
+ color: var(--kit-color-text-primary);
128
+ font-family: var(--kit-font-family-sans);
129
+ font-size: var(--kit-text-body-size);
130
+ font-weight: var(--kit-text-body-weight);
131
+ line-height: var(--kit-text-body-line-height);
132
+ }
133
+
134
+ :where([data-kit="ai-conversation"]) {
135
+ --_measure: calc(var(--kit-size-56) * 14);
136
+
137
+ position: relative;
138
+ display: flex;
139
+ flex: 1 1 auto;
140
+ flex-direction: column;
141
+ min-block-size: 0;
142
+ }
143
+
144
+ :where([data-kit="ai-conversation-scroller"]) {
145
+ flex: 1 1 auto;
146
+ min-block-size: 0;
147
+ overflow-y: auto;
148
+ overscroll-behavior: contain;
149
+ }
150
+
151
+ :where([data-kit="ai-conversation-content"]) {
152
+ box-sizing: border-box;
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: var(--kit-space-6);
156
+ inline-size: 100%;
157
+ max-inline-size: var(--_measure);
158
+ margin-inline: auto;
159
+ padding-block: var(--kit-space-6);
160
+ padding-inline: var(--kit-space-4);
161
+ }
162
+
163
+ :where([data-kit="ai-message-list"]) {
164
+ display: flex;
165
+ flex-direction: column;
166
+ gap: var(--kit-space-6);
167
+ }
168
+
169
+ :where([data-kit="ai-pending"]) {
170
+ padding-inline: var(--kit-space-2);
171
+ color: var(--kit-color-text-tertiary);
172
+ }
173
+
174
+ :where([data-kit="ai-jump-to-latest"]) {
175
+ position: absolute;
176
+ inset-inline: 0;
177
+ inset-block-end: var(--kit-space-3);
178
+ display: flex;
179
+ justify-content: center;
180
+ pointer-events: none;
181
+ z-index: var(--kit-z-sticky);
182
+ }
183
+
184
+ :where([data-kit="ai-jump-to-latest"] > *) {
185
+ pointer-events: auto;
186
+ background-color: var(--kit-color-bg-surface);
187
+ box-shadow: var(--kit-shadow-raised);
188
+ }
189
+
190
+ :where([data-kit="ai-chat-composer"]) {
191
+ box-sizing: border-box;
192
+ display: grid;
193
+ gap: var(--kit-space-2);
194
+ inline-size: 100%;
195
+ max-inline-size: var(--_measure);
196
+ margin-inline: auto;
197
+ padding-block: var(--kit-space-2) var(--kit-space-3);
198
+ padding-inline: var(--kit-space-4);
199
+ }
200
+
201
+ :where([data-kit="ai-disclaimer"]) {
202
+ margin: 0;
203
+ color: var(--kit-color-text-tertiary);
204
+ font-size: var(--kit-text-caption-size);
205
+ line-height: var(--kit-text-caption-line-height);
206
+ text-align: center;
207
+ }
208
+
209
+ /* ---------------------------------------------------------------- Empty */
210
+
211
+ :where([data-kit="ai-empty-thread"]) {
212
+ display: flex;
213
+ flex-direction: column;
214
+ align-items: center;
215
+ gap: var(--kit-space-3);
216
+ padding-block: var(--kit-space-12);
217
+ text-align: center;
218
+ }
219
+
220
+ :where([data-kit="ai-empty-icon"]) {
221
+ display: inline-flex;
222
+ color: var(--kit-color-accent-default);
223
+ }
224
+
225
+ :where([data-kit="ai-empty-title"]) {
226
+ margin: 0;
227
+ font-size: var(--kit-text-h3-size);
228
+ font-weight: var(--kit-text-h3-weight);
229
+ line-height: var(--kit-text-h3-line-height);
230
+ }
231
+
232
+ :where([data-kit="ai-empty-description"]) {
233
+ margin: 0;
234
+ color: var(--kit-color-text-secondary);
235
+ }
236
+
237
+ /* ------------------------------------------------------------ Suggestions */
238
+
239
+ :where([data-kit="ai-suggestions"] > ul) {
240
+ display: flex;
241
+ flex-wrap: wrap;
242
+ justify-content: center;
243
+ gap: var(--kit-space-2);
244
+ margin: 0;
245
+ padding: 0;
246
+ list-style: none;
247
+ }
248
+
249
+ /* --------------------------------------------------------------- Message */
250
+
251
+ :where([data-kit="ai-message"]) {
252
+ display: flex;
253
+ align-items: flex-start;
254
+ gap: var(--kit-space-3);
255
+ inline-size: 100%;
256
+ min-inline-size: 0;
257
+ }
258
+
259
+ /* The user's messages sit at the end of the line (the right in LTR, the left in RTL). */
260
+ :where([data-kit="ai-message"][data-role="user"]) {
261
+ justify-content: flex-end;
262
+ }
263
+
264
+ :where([data-kit="ai-message"][data-role="system"]) {
265
+ justify-content: center;
266
+ color: var(--kit-color-text-secondary);
267
+ font-size: var(--kit-text-caption-size);
268
+ line-height: var(--kit-text-caption-line-height);
269
+ }
270
+
271
+ :where([data-kit="ai-message-avatar"]) {
272
+ display: inline-flex;
273
+ flex: none;
274
+ }
275
+
276
+ :where([data-kit="ai-message-main"]) {
277
+ display: flex;
278
+ flex-direction: column;
279
+ gap: var(--kit-space-2);
280
+ min-inline-size: 0;
281
+ max-inline-size: 100%;
282
+ }
283
+
284
+ :where([data-kit="ai-message"][data-role="user"] > [data-kit="ai-message-main"]) {
285
+ align-items: flex-end;
286
+ max-inline-size: 85%;
287
+ }
288
+
289
+ :where([data-kit="ai-message"][data-role="assistant"] > [data-kit="ai-message-main"]) {
290
+ flex: 1 1 auto;
291
+ }
292
+
293
+ :where([data-kit="ai-message-header"]) {
294
+ display: flex;
295
+ flex-wrap: wrap;
296
+ align-items: center;
297
+ gap: var(--kit-space-2);
298
+ color: var(--kit-color-text-secondary);
299
+ font-size: var(--kit-text-caption-size);
300
+ line-height: var(--kit-text-caption-line-height);
301
+ }
302
+
303
+ :where([data-kit="ai-message-author"]) {
304
+ color: var(--kit-color-text-primary);
305
+ font-weight: var(--kit-font-weight-semibold);
306
+ }
307
+
308
+ :where([data-kit="ai-message-content"]) {
309
+ display: flex;
310
+ flex-direction: column;
311
+ gap: var(--kit-space-3);
312
+ min-inline-size: 0;
313
+ max-inline-size: 100%;
314
+ overflow-wrap: anywhere;
315
+ }
316
+
317
+ :where([data-kit="ai-message"][data-role="user"] [data-kit="ai-message-content"]) {
318
+ padding-block: var(--kit-space-2);
319
+ padding-inline: var(--kit-space-4);
320
+ border-radius: var(--kit-radius-panel);
321
+ background: var(--kit-color-accent-subtle);
322
+ }
323
+
324
+ :where([data-kit="ai-message-text"]) {
325
+ margin: 0;
326
+ white-space: pre-wrap;
327
+ }
328
+
329
+ :where([data-kit="ai-message-part"]) {
330
+ min-inline-size: 0;
331
+ }
332
+
333
+ :where([data-kit="ai-message-status"], [data-kit="ai-message-usage"]) {
334
+ margin: 0;
335
+ color: var(--kit-color-text-tertiary);
336
+ font-size: var(--kit-text-caption-size);
337
+ line-height: var(--kit-text-caption-line-height);
338
+ }
339
+
340
+ :where([data-kit="ai-message-status"][data-status="stopped"]) {
341
+ color: var(--kit-color-text-secondary);
342
+ font-style: italic;
343
+ }
344
+
345
+ :where([data-kit="ai-message-edited"], [data-kit="ai-message-time"]) {
346
+ color: var(--kit-color-text-tertiary);
347
+ }
348
+
349
+ /* Message editor */
350
+
351
+ :where([data-kit="ai-message-editor"]) {
352
+ display: flex;
353
+ flex-direction: column;
354
+ gap: var(--kit-space-2);
355
+ inline-size: 100%;
356
+ min-inline-size: calc(var(--kit-size-56) * 4);
357
+ }
358
+
359
+ :where([data-kit="ai-message-editor"] textarea) {
360
+ box-sizing: border-box;
361
+ inline-size: 100%;
362
+ min-block-size: var(--kit-size-control-md);
363
+ block-size: var(--_ai-height, auto);
364
+ max-block-size: calc(var(--_ai-max-rows, 12) * 1lh);
365
+ padding-block: var(--kit-space-2);
366
+ padding-inline: var(--kit-space-3);
367
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
368
+ border-radius: var(--kit-radius-control);
369
+ background: var(--kit-color-bg-surface);
370
+ color: var(--kit-color-text-primary);
371
+ font: inherit;
372
+ resize: none;
373
+ }
374
+
375
+ :where([data-kit="ai-message-editor"] textarea):focus-visible {
376
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
377
+ outline-offset: var(--kit-space-0-5);
378
+ }
379
+
380
+ :where([data-kit="ai-message-editor-actions"]) {
381
+ display: flex;
382
+ flex-wrap: wrap;
383
+ gap: var(--kit-space-2);
384
+ justify-content: flex-end;
385
+ }
386
+
387
+ /* ------------------------------------------------------- Message actions */
388
+
389
+ :where([data-kit="ai-message-actions"]) {
390
+ color: var(--kit-color-text-secondary);
391
+ }
392
+
393
+ :where([data-kit="ai-branch-nav"]) {
394
+ display: inline-flex;
395
+ align-items: center;
396
+ }
397
+
398
+ :where([data-kit="ai-branch-position"]) {
399
+ min-inline-size: var(--kit-size-24);
400
+ text-align: center;
401
+ font-size: var(--kit-text-caption-size);
402
+ font-variant-numeric: tabular-nums;
403
+ }
404
+
405
+ :where([data-kit="ai-copy"]) {
406
+ display: inline-flex;
407
+ }
408
+
409
+ :where([data-kit="ai-copy"][data-state="copied"]) {
410
+ color: var(--kit-color-status-success-foreground);
411
+ }
412
+
413
+ /* -------------------------------------------------------------- Markdown */
414
+
415
+ :where([data-kit="ai-markdown"]) {
416
+ display: flex;
417
+ flex-direction: column;
418
+ gap: var(--kit-space-3);
419
+ min-inline-size: 0;
420
+ max-inline-size: 100%;
421
+ }
422
+
423
+ /* The blocks of one reply flow like one document. */
424
+ :where([data-kit="ai-markdown"] > *) {
425
+ display: flex;
426
+ flex-direction: column;
427
+ gap: var(--kit-space-3);
428
+ min-inline-size: 0;
429
+ }
430
+
431
+ :where([data-kit="ai-markdown"] :is(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6, hr, pre)) {
432
+ margin: 0;
433
+ }
434
+
435
+ :where([data-kit="ai-markdown"] :is(h1, h2, h3)) {
436
+ font-size: var(--kit-text-h3-size);
437
+ font-weight: var(--kit-text-h3-weight);
438
+ line-height: var(--kit-text-h3-line-height);
439
+ }
440
+
441
+ :where([data-kit="ai-markdown"] h4) {
442
+ font-size: var(--kit-text-h4-size);
443
+ font-weight: var(--kit-text-h4-weight);
444
+ line-height: var(--kit-text-h4-line-height);
445
+ }
446
+
447
+ :where([data-kit="ai-markdown"] :is(h5, h6)) {
448
+ font-size: var(--kit-text-label-size);
449
+ font-weight: var(--kit-text-label-weight);
450
+ line-height: var(--kit-text-label-line-height);
451
+ }
452
+
453
+ :where([data-kit="ai-markdown"] :is(ul, ol)) {
454
+ padding-inline-start: var(--kit-space-6);
455
+ }
456
+
457
+ :where([data-kit="ai-markdown"] li) {
458
+ margin-block: var(--kit-space-1);
459
+ }
460
+
461
+ :where([data-kit="ai-markdown"] :is(ul, ol) :is(ul, ol)) {
462
+ margin-block-start: var(--kit-space-1);
463
+ }
464
+
465
+ :where([data-kit="ai-markdown"] .contains-task-list) {
466
+ padding-inline-start: 0;
467
+ list-style: none;
468
+ }
469
+
470
+ :where([data-kit="ai-markdown"] .task-list-item > input) {
471
+ margin-inline: 0 var(--kit-space-2);
472
+ }
473
+
474
+ :where([data-kit="ai-markdown"] blockquote) {
475
+ padding-inline-start: var(--kit-space-3);
476
+ border-inline-start: var(--kit-border-width-emphasis) solid var(--kit-color-border-strong);
477
+ color: var(--kit-color-text-secondary);
478
+ }
479
+
480
+ :where([data-kit="ai-markdown"] hr) {
481
+ inline-size: 100%;
482
+ border: 0;
483
+ border-block-start: var(--kit-border-width-default) solid var(--kit-color-border-default);
484
+ }
485
+
486
+ :where([data-kit="ai-markdown"] :not(pre) > code) {
487
+ padding-block: var(--kit-space-0-5);
488
+ padding-inline: var(--kit-space-1);
489
+ border-radius: var(--kit-radius-4);
490
+ background: color-mix(in srgb, var(--kit-color-text-primary) 8%, transparent);
491
+ font-family: var(--kit-font-family-mono);
492
+ font-size: var(--kit-text-code-size);
493
+ font-weight: var(--kit-text-code-weight);
494
+ unicode-bidi: isolate;
495
+ }
496
+
497
+ :where([data-kit="ai-markdown-link"], [data-kit="ai-source-link"]) {
498
+ color: var(--kit-color-text-link);
499
+ text-decoration: underline;
500
+ }
501
+
502
+ :where([data-kit="ai-markdown-link"][data-blocked], [data-kit="ai-source-link"][data-inert]) {
503
+ color: inherit;
504
+ text-decoration: none;
505
+ }
506
+
507
+ :where([data-kit="ai-markdown-image"]) {
508
+ max-inline-size: 100%;
509
+ block-size: auto;
510
+ border-radius: var(--kit-radius-control);
511
+ }
512
+
513
+ :where([data-kit="ai-markdown-image"][data-blocked]) {
514
+ color: var(--kit-color-text-secondary);
515
+ font-style: italic;
516
+ }
517
+
518
+ :where([data-kit="ai-markdown-table"]) {
519
+ max-inline-size: 100%;
520
+ overflow-x: auto;
521
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
522
+ border-radius: var(--kit-radius-control);
523
+ }
524
+
525
+ :where([data-kit="ai-markdown-table"] table) {
526
+ inline-size: 100%;
527
+ border-collapse: collapse;
528
+ font-size: var(--kit-text-label-size);
529
+ }
530
+
531
+ :where([data-kit="ai-markdown-table"] :is(th, td)) {
532
+ padding-block: var(--kit-space-2);
533
+ padding-inline: var(--kit-space-3);
534
+ border-block-end: var(--kit-border-width-default) solid var(--kit-color-border-subtle);
535
+ text-align: start;
536
+ vertical-align: top;
537
+ }
538
+
539
+ :where([data-kit="ai-markdown-table"] th) {
540
+ background: var(--kit-color-bg-raised);
541
+ font-weight: var(--kit-font-weight-semibold);
542
+ white-space: nowrap;
543
+ }
544
+
545
+ :where([data-kit="ai-markdown-table"] tr:last-child > td) {
546
+ border-block-end: 0;
547
+ }
548
+
549
+ :where([data-kit="ai-markdown"] [data-footnotes]) {
550
+ padding-block-start: var(--kit-space-2);
551
+ border-block-start: var(--kit-border-width-default) solid var(--kit-color-border-subtle);
552
+ color: var(--kit-color-text-secondary);
553
+ font-size: var(--kit-text-caption-size);
554
+ line-height: var(--kit-text-caption-line-height);
555
+ }
556
+
557
+ /* The "Footnotes" heading is for assistive technology only. */
558
+ :where([data-kit="ai-markdown"] [data-footnote-label]) {
559
+ position: absolute;
560
+ inline-size: var(--kit-border-width-default);
561
+ block-size: var(--kit-border-width-default);
562
+ margin: calc(var(--kit-border-width-default) * -1);
563
+ padding: 0;
564
+ overflow: hidden;
565
+ clip-path: inset(50%);
566
+ white-space: nowrap;
567
+ border: 0;
568
+ }
569
+
570
+ /* Citation chips */
571
+
572
+ :where([data-kit="ai-citation"]) {
573
+ box-sizing: border-box;
574
+ display: inline-flex;
575
+ align-items: center;
576
+ justify-content: center;
577
+ min-inline-size: var(--kit-size-16);
578
+ block-size: var(--kit-size-16);
579
+ margin-inline: var(--kit-space-0-5);
580
+ padding-inline: var(--kit-space-1);
581
+ border-radius: var(--kit-radius-pill);
582
+ background: var(--kit-color-accent-subtle);
583
+ color: var(--kit-color-accent-11);
584
+ font-size: var(--kit-font-size-12);
585
+ font-weight: var(--kit-font-weight-semibold);
586
+ font-variant-numeric: tabular-nums;
587
+ line-height: 1;
588
+ text-decoration: none;
589
+ vertical-align: text-top;
590
+ }
591
+
592
+ :where(a[data-kit="ai-citation"]):hover {
593
+ background: var(--kit-color-accent-4);
594
+ }
595
+
596
+ :where([data-kit="ai-citation"][data-inert]) {
597
+ background: color-mix(in srgb, var(--kit-color-text-primary) 8%, transparent);
598
+ color: var(--kit-color-text-secondary);
599
+ }
600
+
601
+ /* ------------------------------------------------------------ Code block */
602
+
603
+ :where([data-kit="ai-code-block"], [data-kit="ai-json-view"]) {
604
+ overflow: hidden;
605
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
606
+ border-radius: var(--kit-radius-control);
607
+ background: var(--kit-color-bg-surface);
608
+ }
609
+
610
+ :where([data-kit="ai-code-block-header"], [data-kit="ai-json-view-header"]) {
611
+ display: flex;
612
+ align-items: center;
613
+ justify-content: space-between;
614
+ gap: var(--kit-space-2);
615
+ padding-block: var(--kit-space-0-5);
616
+ padding-inline: var(--kit-space-3) var(--kit-space-1);
617
+ border-block-end: var(--kit-border-width-default) solid var(--kit-color-border-subtle);
618
+ background: var(--kit-color-bg-raised);
619
+ color: var(--kit-color-text-secondary);
620
+ font-size: var(--kit-text-caption-size);
621
+ line-height: var(--kit-text-caption-line-height);
622
+ }
623
+
624
+ :where([data-kit="ai-code-block-language"], [data-kit="ai-json-view-label"]) {
625
+ font-family: var(--kit-font-family-mono);
626
+ }
627
+
628
+ :where([data-kit="ai-code-block"] pre, [data-kit="ai-json-view"] pre) {
629
+ margin: 0;
630
+ padding: var(--kit-space-3);
631
+ overflow-x: auto;
632
+ color: var(--kit-color-text-primary);
633
+ font-family: var(--kit-font-family-mono);
634
+ font-size: var(--kit-text-code-size);
635
+ font-weight: var(--kit-text-code-weight);
636
+ line-height: var(--kit-text-code-line-height);
637
+ tab-size: 2;
638
+ white-space: pre;
639
+ }
640
+
641
+ :where([data-kit="ai-json-view"] pre) {
642
+ max-block-size: calc(var(--kit-size-56) * 6);
643
+ overflow-y: auto;
644
+ }
645
+
646
+ /* ------------------------------------------------------------- Reasoning */
647
+
648
+ :where([data-kit="ai-reasoning"]) {
649
+ display: flex;
650
+ flex-direction: column;
651
+ align-items: flex-start;
652
+ }
653
+
654
+ :where([data-kit="ai-reasoning-panel"]) {
655
+ align-self: stretch;
656
+ margin-inline-start: var(--kit-space-3);
657
+ padding-inline-start: var(--kit-space-3);
658
+ border-inline-start: var(--kit-border-width-emphasis) solid var(--kit-color-border-subtle);
659
+ color: var(--kit-color-text-secondary);
660
+ font-size: var(--kit-text-label-size);
661
+ line-height: var(--kit-text-label-line-height);
662
+ }
663
+
664
+ /* ------------------------------------------------------------- Tool call */
665
+
666
+ :where([data-kit="ai-tool-call"]) {
667
+ display: flex;
668
+ flex-direction: column;
669
+ gap: var(--kit-space-2);
670
+ padding: var(--kit-space-1);
671
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
672
+ border-radius: var(--kit-radius-panel);
673
+ background: var(--kit-color-bg-surface);
674
+ }
675
+
676
+ :where([data-kit="ai-tool-call"][data-state="needs-approval"]) {
677
+ border-color: var(--kit-color-status-warning-border);
678
+ }
679
+
680
+ :where([data-kit="ai-tool-call"][data-state="failed"], [data-kit="ai-tool-call"][data-state="denied"]) {
681
+ border-color: var(--kit-color-status-danger-border);
682
+ }
683
+
684
+ :where([data-kit="ai-tool-call-trigger"]) {
685
+ inline-size: 100%;
686
+ color: var(--kit-color-text-primary);
687
+ }
688
+
689
+ :where([data-kit="ai-tool-call-trigger"] > :last-child) {
690
+ margin-inline-start: auto;
691
+ }
692
+
693
+ :where([data-kit="ai-tool-call-name"]) {
694
+ font-family: var(--kit-font-family-mono);
695
+ font-size: var(--kit-text-code-size);
696
+ unicode-bidi: isolate;
697
+ }
698
+
699
+ :where([data-kit="ai-tool-call-duration"]) {
700
+ color: var(--kit-color-text-tertiary);
701
+ font-size: var(--kit-text-caption-size);
702
+ font-variant-numeric: tabular-nums;
703
+ }
704
+
705
+ :where([data-kit="ai-tool-call-error"]) {
706
+ margin: 0;
707
+ padding-inline: var(--kit-space-2);
708
+ color: var(--kit-color-status-danger-foreground);
709
+ font-size: var(--kit-text-label-size);
710
+ line-height: var(--kit-text-label-line-height);
711
+ }
712
+
713
+ :where([data-kit="ai-tool-call-error"][data-aborted]) {
714
+ color: var(--kit-color-text-secondary);
715
+ }
716
+
717
+ :where([data-kit="ai-tool-call-note"], [data-kit="ai-tool-call-empty"]) {
718
+ margin: 0;
719
+ padding-inline: var(--kit-space-2);
720
+ color: var(--kit-color-text-secondary);
721
+ font-size: var(--kit-text-label-size);
722
+ }
723
+
724
+ :where([data-kit="ai-tool-call-panel"]) {
725
+ display: flex;
726
+ flex-direction: column;
727
+ gap: var(--kit-space-2);
728
+ padding: var(--kit-space-2);
729
+ }
730
+
731
+ :where([data-kit="ai-tool-call-panel"][hidden]) {
732
+ display: none;
733
+ }
734
+
735
+ /* ------------------------------------------------------ Approval prompt */
736
+
737
+ :where([data-kit="ai-approval-prompt"]) {
738
+ display: flex;
739
+ flex-direction: column;
740
+ gap: var(--kit-space-3);
741
+ margin: var(--kit-space-1);
742
+ padding: var(--kit-space-3);
743
+ border: var(--kit-border-width-emphasis) solid var(--kit-color-status-warning-border);
744
+ border-radius: var(--kit-radius-control);
745
+ background: var(--kit-color-status-warning-background);
746
+ color: var(--kit-color-status-warning-foreground);
747
+ }
748
+
749
+ /* The prompt takes focus when it appears, so it shows the ring whenever it has focus. */
750
+ :where([data-kit="ai-approval-prompt"]):focus {
751
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
752
+ outline-offset: var(--kit-space-0-5);
753
+ }
754
+
755
+ :where([data-kit="ai-approval-title"]) {
756
+ margin: 0;
757
+ font-weight: var(--kit-font-weight-semibold);
758
+ }
759
+
760
+ :where([data-kit="ai-approval-description"], [data-kit="ai-approval-no-input"]) {
761
+ margin: 0;
762
+ font-size: var(--kit-text-label-size);
763
+ line-height: var(--kit-text-label-line-height);
764
+ }
765
+
766
+ :where([data-kit="ai-approval-prompt"] [data-kit="ai-json-view"]) {
767
+ color: var(--kit-color-text-primary);
768
+ }
769
+
770
+ :where([data-kit="ai-approval-reason"]) {
771
+ display: flex;
772
+ flex-direction: column;
773
+ gap: var(--kit-space-1);
774
+ font-size: var(--kit-text-label-size);
775
+ }
776
+
777
+ :where([data-kit="ai-approval-reason"] input) {
778
+ box-sizing: border-box;
779
+ inline-size: 100%;
780
+ min-block-size: var(--kit-size-control-md);
781
+ padding-inline: var(--kit-space-3);
782
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
783
+ border-radius: var(--kit-radius-control);
784
+ background: var(--kit-color-bg-surface);
785
+ color: var(--kit-color-text-primary);
786
+ font: inherit;
787
+ }
788
+
789
+ :where([data-kit="ai-approval-reason"] input):focus-visible {
790
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
791
+ outline-offset: var(--kit-space-0-5);
792
+ }
793
+
794
+ :where([data-kit="ai-approval-buttons"]) {
795
+ display: flex;
796
+ flex-wrap: wrap;
797
+ gap: var(--kit-space-2);
798
+ }
799
+
800
+ /* --------------------------------------------------------------- Sources */
801
+
802
+ :where([data-kit="ai-sources"]) {
803
+ display: flex;
804
+ flex-direction: column;
805
+ align-items: flex-start;
806
+ }
807
+
808
+ :where([data-kit="ai-sources-panel"]) {
809
+ align-self: stretch;
810
+ }
811
+
812
+ :where([data-kit="ai-sources-list"]) {
813
+ display: grid;
814
+ gap: var(--kit-space-2);
815
+ margin: var(--kit-space-1) 0 0;
816
+ padding: 0;
817
+ list-style: none;
818
+ }
819
+
820
+ :where([data-kit="ai-source"]) {
821
+ display: flex;
822
+ gap: var(--kit-space-3);
823
+ padding: var(--kit-space-2);
824
+ border: var(--kit-border-width-default) solid var(--kit-color-border-subtle);
825
+ border-radius: var(--kit-radius-control);
826
+ background: var(--kit-color-bg-surface);
827
+ }
828
+
829
+ :where([data-kit="ai-source-index"]) {
830
+ box-sizing: border-box;
831
+ display: inline-flex;
832
+ flex: none;
833
+ align-items: center;
834
+ justify-content: center;
835
+ inline-size: var(--kit-size-20);
836
+ block-size: var(--kit-size-20);
837
+ border-radius: var(--kit-radius-full);
838
+ background: var(--kit-color-accent-subtle);
839
+ color: var(--kit-color-accent-11);
840
+ font-size: var(--kit-font-size-12);
841
+ font-weight: var(--kit-font-weight-semibold);
842
+ font-variant-numeric: tabular-nums;
843
+ }
844
+
845
+ :where([data-kit="ai-source-body"]) {
846
+ display: flex;
847
+ flex-direction: column;
848
+ min-inline-size: 0;
849
+ font-size: var(--kit-text-label-size);
850
+ line-height: var(--kit-text-label-line-height);
851
+ }
852
+
853
+ :where([data-kit="ai-source-link"]) {
854
+ display: inline-flex;
855
+ align-items: center;
856
+ gap: var(--kit-space-1);
857
+ overflow-wrap: anywhere;
858
+ }
859
+
860
+ :where([data-kit="ai-source-host"]) {
861
+ color: var(--kit-color-text-tertiary);
862
+ font-size: var(--kit-text-caption-size);
863
+ }
864
+
865
+ :where([data-kit="ai-source-snippet"]) {
866
+ margin: var(--kit-space-1) 0 0;
867
+ color: var(--kit-color-text-secondary);
868
+ }
869
+
870
+ /* ----------------------------------------------------------- Attachments */
871
+
872
+ :where([data-kit="ai-attachments"]) {
873
+ display: flex;
874
+ flex-wrap: wrap;
875
+ gap: var(--kit-space-2);
876
+ margin: 0;
877
+ padding: 0;
878
+ list-style: none;
879
+ }
880
+
881
+ :where([data-kit="ai-attachment"][data-kind="image"] img) {
882
+ display: block;
883
+ max-inline-size: calc(var(--kit-size-56) * 4);
884
+ max-block-size: calc(var(--kit-size-56) * 4);
885
+ border: var(--kit-border-width-default) solid var(--kit-color-border-subtle);
886
+ border-radius: var(--kit-radius-control);
887
+ object-fit: cover;
888
+ }
889
+
890
+ :where([data-kit="ai-attachment-link"]) {
891
+ display: inline-flex;
892
+ align-items: center;
893
+ gap: var(--kit-space-2);
894
+ padding-block: var(--kit-space-1);
895
+ padding-inline: var(--kit-space-3);
896
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
897
+ border-radius: var(--kit-radius-pill);
898
+ background: var(--kit-color-bg-surface);
899
+ color: var(--kit-color-text-primary);
900
+ font-size: var(--kit-text-label-size);
901
+ text-decoration: none;
902
+ }
903
+
904
+ :where([data-kit="ai-attachment-size"]) {
905
+ color: var(--kit-color-text-tertiary);
906
+ font-size: var(--kit-text-caption-size);
907
+ }
908
+
909
+ /* -------------------------------------------------------------- Indicator */
910
+
911
+ :where([data-kit="ai-streaming-indicator"]) {
912
+ display: inline-flex;
913
+ align-items: center;
914
+ gap: var(--kit-space-1);
915
+ block-size: var(--kit-size-16);
916
+ }
917
+
918
+ :where([data-kit="ai-streaming-dot"]) {
919
+ inline-size: var(--kit-space-2);
920
+ block-size: var(--kit-space-2);
921
+ border-radius: var(--kit-radius-full);
922
+ background: currentcolor;
923
+ opacity: 0.3;
924
+ animation: ai-pulse var(--kit-duration-slow) var(--kit-easing-standard) infinite alternate;
925
+ }
926
+
927
+ :where([data-kit="ai-streaming-dot"]:nth-child(2)) {
928
+ animation-delay: var(--kit-duration-base);
929
+ }
930
+
931
+ :where([data-kit="ai-streaming-dot"]:nth-child(3)) {
932
+ animation-delay: calc(var(--kit-duration-base) * 2);
933
+ }
934
+
935
+ @keyframes ai-pulse {
936
+ from {
937
+ opacity: 0.3;
938
+ }
939
+
940
+ to {
941
+ opacity: 1;
942
+ }
943
+ }
944
+
945
+ /* ----------------------------------------------------------- Error banner */
946
+
947
+ :where([data-kit="ai-error-banner"]) {
948
+ display: flex;
949
+ align-items: flex-start;
950
+ gap: var(--kit-space-3);
951
+ padding: var(--kit-space-3);
952
+ border: var(--kit-border-width-default) solid var(--kit-color-status-danger-border);
953
+ border-radius: var(--kit-radius-panel);
954
+ background: var(--kit-color-status-danger-background);
955
+ color: var(--kit-color-status-danger-foreground);
956
+ }
957
+
958
+ :where([data-kit="ai-error-banner"][data-kind="rate-limit"]) {
959
+ border-color: var(--kit-color-status-warning-border);
960
+ background: var(--kit-color-status-warning-background);
961
+ color: var(--kit-color-status-warning-foreground);
962
+ }
963
+
964
+ :where([data-kit="ai-error-icon"]) {
965
+ display: inline-flex;
966
+ flex: none;
967
+ }
968
+
969
+ :where([data-kit="ai-error-body"]) {
970
+ display: flex;
971
+ flex: 1 1 auto;
972
+ flex-direction: column;
973
+ gap: var(--kit-space-1);
974
+ min-inline-size: 0;
975
+ }
976
+
977
+ :where([data-kit="ai-error-body"] > p) {
978
+ margin: 0;
979
+ }
980
+
981
+ :where([data-kit="ai-error-title"]) {
982
+ font-weight: var(--kit-font-weight-semibold);
983
+ }
984
+
985
+ :where([data-kit="ai-error-description"], [data-kit="ai-error-detail"]) {
986
+ font-size: var(--kit-text-label-size);
987
+ line-height: var(--kit-text-label-line-height);
988
+ }
989
+
990
+ :where([data-kit="ai-error-detail"]) {
991
+ color: var(--kit-color-text-secondary);
992
+ overflow-wrap: anywhere;
993
+ }
994
+
995
+ :where([data-kit="ai-error-actions"]) {
996
+ display: flex;
997
+ flex-wrap: wrap;
998
+ gap: var(--kit-space-2);
999
+ margin-block-start: var(--kit-space-2);
1000
+ }
1001
+
1002
+ /* ---------------------------------------------------------------- Prompt */
1003
+
1004
+ :where([data-kit="ai-prompt-input"]) {
1005
+ position: relative;
1006
+ box-sizing: border-box;
1007
+ display: flex;
1008
+ flex-direction: column;
1009
+ gap: var(--kit-space-2);
1010
+ padding: var(--kit-space-2);
1011
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
1012
+ border-radius: var(--kit-radius-panel);
1013
+ background: var(--kit-color-bg-surface);
1014
+ }
1015
+
1016
+ /* The box shows the ring while its text field has focus; the field itself draws none, so it is not doubled. */
1017
+ :where([data-kit="ai-prompt-input"]):focus-within {
1018
+ border-color: var(--kit-color-border-focus);
1019
+ outline: var(--kit-border-width-focus) solid var(--kit-color-border-focus);
1020
+ outline-offset: var(--kit-space-0-5);
1021
+ }
1022
+
1023
+ :where([data-kit="ai-prompt-input"][data-disabled]) {
1024
+ background: var(--kit-color-bg-raised);
1025
+ color: var(--kit-color-text-disabled);
1026
+ }
1027
+
1028
+ :where([data-kit="ai-prompt-row"]) {
1029
+ display: flex;
1030
+ align-items: flex-end;
1031
+ gap: var(--kit-space-2);
1032
+ }
1033
+
1034
+ :where([data-kit="ai-prompt-textarea"]) {
1035
+ box-sizing: border-box;
1036
+ flex: 1 1 auto;
1037
+ min-inline-size: 0;
1038
+ min-block-size: var(--kit-size-control-md);
1039
+ block-size: var(--_ai-height, auto);
1040
+ max-block-size: calc(var(--_ai-max-rows, 8) * 1lh);
1041
+ margin: 0;
1042
+ padding-block: var(--kit-space-2);
1043
+ padding-inline: var(--kit-space-2);
1044
+ border: 0;
1045
+ outline: var(--kit-border-width-focus) solid transparent;
1046
+ background: transparent;
1047
+ color: var(--kit-color-text-primary);
1048
+ font: inherit;
1049
+ line-height: var(--kit-text-body-line-height);
1050
+ overflow-y: auto;
1051
+ resize: none;
1052
+ }
1053
+
1054
+ :where([data-kit="ai-prompt-textarea"])::placeholder {
1055
+ color: var(--kit-color-text-tertiary);
1056
+ }
1057
+
1058
+ :where([data-kit="ai-prompt-meta"]) {
1059
+ display: flex;
1060
+ align-items: center;
1061
+ justify-content: space-between;
1062
+ gap: var(--kit-space-3);
1063
+ padding-inline: var(--kit-space-2);
1064
+ color: var(--kit-color-text-tertiary);
1065
+ font-size: var(--kit-text-caption-size);
1066
+ line-height: var(--kit-text-caption-line-height);
1067
+ }
1068
+
1069
+ :where([data-kit="ai-prompt-counter"]) {
1070
+ margin-inline-start: auto;
1071
+ font-variant-numeric: tabular-nums;
1072
+ }
1073
+
1074
+ :where([data-kit="ai-prompt-counter"][data-limit]) {
1075
+ color: var(--kit-color-status-danger-foreground);
1076
+ font-weight: var(--kit-font-weight-semibold);
1077
+ }
1078
+
1079
+ :where([data-kit="ai-prompt-attachments"]) {
1080
+ display: flex;
1081
+ flex-wrap: wrap;
1082
+ gap: var(--kit-space-2);
1083
+ margin: 0;
1084
+ padding: 0;
1085
+ list-style: none;
1086
+ }
1087
+
1088
+ :where([data-kit="ai-prompt-attachment"]) {
1089
+ display: inline-flex;
1090
+ align-items: center;
1091
+ gap: var(--kit-space-2);
1092
+ max-inline-size: 100%;
1093
+ padding-block: var(--kit-space-0-5);
1094
+ padding-inline: var(--kit-space-3) var(--kit-space-1);
1095
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
1096
+ border-radius: var(--kit-radius-pill);
1097
+ background: var(--kit-color-bg-raised);
1098
+ font-size: var(--kit-text-label-size);
1099
+ }
1100
+
1101
+ :where([data-kit="ai-prompt-attachment"][data-status="error"]) {
1102
+ border-color: var(--kit-color-status-danger-border);
1103
+ color: var(--kit-color-status-danger-foreground);
1104
+ }
1105
+
1106
+ :where([data-kit="ai-prompt-attachment-name"]) {
1107
+ min-inline-size: 0;
1108
+ overflow: hidden;
1109
+ text-overflow: ellipsis;
1110
+ white-space: nowrap;
1111
+ }
1112
+
1113
+ :where([data-kit="ai-prompt-attachment-size"], [data-kit="ai-prompt-attachment-status"]) {
1114
+ color: var(--kit-color-text-tertiary);
1115
+ font-size: var(--kit-text-caption-size);
1116
+ }
1117
+
1118
+ :where([data-kit="ai-prompt-commands"]) {
1119
+ position: absolute;
1120
+ inset-inline: 0;
1121
+ inset-block-end: 100%;
1122
+ z-index: var(--kit-z-dropdown);
1123
+ box-sizing: border-box;
1124
+ max-block-size: calc(var(--kit-size-56) * 4);
1125
+ margin: 0 0 var(--kit-space-1);
1126
+ padding: var(--kit-space-1);
1127
+ overflow-y: auto;
1128
+ border: var(--kit-border-width-default) solid var(--kit-color-border-default);
1129
+ border-radius: var(--kit-radius-overlay);
1130
+ background: var(--kit-color-bg-raised);
1131
+ box-shadow: var(--kit-shadow-overlay);
1132
+ list-style: none;
1133
+ }
1134
+
1135
+ :where([data-kit="ai-prompt-commands"] [role="option"]) {
1136
+ display: flex;
1137
+ align-items: baseline;
1138
+ gap: var(--kit-space-3);
1139
+ padding-block: var(--kit-space-2);
1140
+ padding-inline: var(--kit-space-3);
1141
+ border-radius: var(--kit-radius-control);
1142
+ cursor: pointer;
1143
+ }
1144
+
1145
+ :where([data-kit="ai-prompt-commands"] [role="option"][aria-selected="true"]) {
1146
+ background: var(--kit-color-accent-subtle);
1147
+ }
1148
+
1149
+ :where([data-kit="ai-prompt-command-name"]) {
1150
+ font-family: var(--kit-font-family-mono);
1151
+ font-size: var(--kit-text-code-size);
1152
+ }
1153
+
1154
+ :where([data-kit="ai-prompt-command-description"]) {
1155
+ color: var(--kit-color-text-secondary);
1156
+ font-size: var(--kit-text-caption-size);
1157
+ }
1158
+
1159
+ :where([data-kit="ai-prompt-drop"]) {
1160
+ position: absolute;
1161
+ inset: 0;
1162
+ display: grid;
1163
+ place-items: center;
1164
+ border: var(--kit-border-width-emphasis) dashed var(--kit-color-accent-default);
1165
+ border-radius: inherit;
1166
+ background: color-mix(in srgb, var(--kit-color-bg-surface) 88%, transparent);
1167
+ color: var(--kit-color-accent-11);
1168
+ font-weight: var(--kit-font-weight-semibold);
1169
+ pointer-events: none;
1170
+ }
1171
+
1172
+ /* ------------------------------------------------------------ Preferences */
1173
+
1174
+ @media (prefers-reduced-motion: reduce) {
1175
+ :where([data-kit="ai-streaming-dot"]) {
1176
+ opacity: 0.6;
1177
+ animation: none;
1178
+ }
1179
+ }
1180
+
1181
+ @media (forced-colors: active) {
1182
+ :where([data-kit="ai-message"][data-role="user"] [data-kit="ai-message-content"]) {
1183
+ border: var(--kit-border-width-default) solid CanvasText;
1184
+ }
1185
+
1186
+ :where([data-kit="ai-citation"], [data-kit="ai-source-index"]) {
1187
+ border: var(--kit-border-width-default) solid ButtonText;
1188
+ }
1189
+
1190
+ :where([data-kit="ai-streaming-dot"]) {
1191
+ background: CanvasText;
1192
+ opacity: 1;
1193
+ }
1194
+
1195
+ :where([data-kit="ai-prompt-commands"] [role="option"][aria-selected="true"]) {
1196
+ outline: var(--kit-border-width-focus) solid Highlight;
1197
+ outline-offset: calc(var(--kit-border-width-focus) * -1);
1198
+ }
1199
+
1200
+ :where([data-kit="ai-prompt-drop"]) {
1201
+ border-color: Highlight;
1202
+ background: Canvas;
1203
+ color: CanvasText;
1204
+ }
1205
+
1206
+ :where(
1207
+ [data-kit="ai-tool-call"],
1208
+ [data-kit="ai-approval-prompt"],
1209
+ [data-kit="ai-error-banner"],
1210
+ [data-kit="ai-code-block"],
1211
+ [data-kit="ai-json-view"],
1212
+ [data-kit="ai-markdown-table"],
1213
+ [data-kit="ai-prompt-input"]
1214
+ ) {
1215
+ border-color: CanvasText;
1216
+ }
1217
+
1218
+ :where([data-kit="ai-prompt-input"]):focus-within {
1219
+ border-color: Highlight;
1220
+ }
1221
+
1222
+ :where([data-kit="ai-markdown"] :not(pre) > code) {
1223
+ border: var(--kit-border-width-default) solid CanvasText;
1224
+ }
1225
+ }