@vettvangur/ai-sdk 0.8.1 → 0.10.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.
package/dist/styles.css CHANGED
@@ -1,23 +1,74 @@
1
1
  /*
2
- * @vettvangur/ai-sdk/styles.css: an opt-in base for the elements the SDK renders. It holds the
3
- * mechanics a thread needs to behave, not a look: how things hide, pulse, divide, scroll and
4
- * switch. Colours, type and spacing stay with the host. Load it before the host's own styles; its
5
- * selectors are as plain as each rule allows, so a later host rule of the same weight wins.
2
+ * @vettvangur/ai-sdk/styles.css: an opt-in look for the chat, the window over every page and its
3
+ * launcher. It lays out the shell, draws everything the binding renders, and moves the window and
4
+ * the launcher in and out. Load it before the host's own styles; its selectors are as plain as each
5
+ * rule allows, so a later host rule of the same weight wins.
6
6
  *
7
- * Custom properties, set on the root or any ancestor:
8
- * --vv-ai-chat-dot-size the tool and typing dots (0.375rem)
9
- * --vv-ai-chat-dot-color the typing dots (currentColor)
10
- * --vv-ai-chat-divider-color the lines either side of a divider notice (currentColor)
11
- * --vv-ai-chat-divider-gap between a divider's text and its lines (0.625rem)
12
- * --vv-ai-survey-toggle-width the survey's switch (2.125rem)
13
- * --vv-ai-survey-toggle-height (1.25rem)
14
- * --vv-ai-survey-toggle-inset between the switch's edge and its knob (0.125rem)
15
- * --vv-ai-survey-toggle-off the switch's track when off (#9ca3af)
16
- * --vv-ai-survey-toggle-on the switch's track when on (currentColor)
17
- * --vv-ai-survey-toggle-knob the knob (#fff)
18
- * --vv-ai-chat-sheet-background the sheet an agent's button opens (#fff)
7
+ * A host themes it with the custom properties below, set on the root or any ancestor of the chat
8
+ * and the launcher, and restyles anything else by class. The shell's markup is the host's; the
9
+ * classes it carries are listed in the README.
19
10
  */
20
11
 
12
+ :where(:root) {
13
+ /* Colours */
14
+ --vv-ai-color-accent: #2563eb;
15
+ --vv-ai-color-accent-hover: #1d4ed8;
16
+ --vv-ai-color-on-accent: #fff;
17
+ --vv-ai-color-text: #374151;
18
+ --vv-ai-color-text-muted: #6b7280;
19
+ --vv-ai-color-text-subtle: #9ca3af;
20
+ --vv-ai-color-surface: #fff;
21
+ --vv-ai-color-surface-muted: #f1f4f8;
22
+ --vv-ai-color-surface-subtle: #f3f4f6;
23
+ --vv-ai-color-border: #e5e7eb;
24
+ --vv-ai-color-border-strong: #9ca3af;
25
+ --vv-ai-color-border-accent: #60a5fa;
26
+ --vv-ai-color-disabled: #d1d5db;
27
+ --vv-ai-color-success: #16a34a;
28
+ --vv-ai-color-error: #dc2626;
29
+ --vv-ai-color-error-surface: #fef2f2;
30
+ --vv-ai-color-error-border: #fca5a5;
31
+ /* An agent's initials, and the status dots in the window's header. */
32
+ --vv-ai-color-agent: #f59e0b;
33
+ --vv-ai-color-online: #5be38c;
34
+ --vv-ai-color-waiting: #ffc93d;
35
+
36
+ /* Type */
37
+ --vv-ai-font-heading: inherit;
38
+ --vv-ai-font-weight-bold: 700;
39
+
40
+ /* Shapes */
41
+ --vv-ai-radius: 0.3125rem;
42
+ --vv-ai-radius-l: 0.625rem;
43
+ --vv-ai-radius-bubble: 1rem;
44
+ --vv-ai-shadow-prompt: 0 0 0 0.1875rem rgb(0 0 0 / 0.04);
45
+ --vv-ai-focus-ring: 0 0 0 0.1875rem color-mix(in srgb, var(--vv-ai-color-accent) 15%, transparent);
46
+
47
+ /* The window and its launcher */
48
+ --vv-ai-chat-window-z: 1000;
49
+ --vv-ai-chat-window-width: 23.75rem;
50
+ --vv-ai-chat-window-height: 38.75rem;
51
+ --vv-ai-chat-window-inset: 1.25rem;
52
+ --vv-ai-chat-window-radius: 1rem;
53
+ --vv-ai-chat-window-shadow: 0 0.75rem 2.5rem rgb(16 40 80 / 0.18), 0 0.125rem 0.375rem rgb(16 40 80 / 0.08);
54
+ --vv-ai-chat-window-header: var(--vv-ai-color-accent);
55
+ --vv-ai-chat-window-header-agent: var(--vv-ai-color-accent-hover);
56
+ --vv-ai-chat-window-header-text: var(--vv-ai-color-on-accent);
57
+ --vv-ai-chat-window-header-muted: rgb(255 255 255 / 0.85);
58
+ --vv-ai-chat-window-header-hover: rgb(255 255 255 / 0.15);
59
+ /* An image in the circle beside each of the assistant's bubbles in the window. */
60
+ --vv-ai-chat-assistant-avatar: none;
61
+ --vv-ai-launcher-shadow: 0 0.375rem 1.25rem rgb(16 40 80 / 0.25);
62
+ --vv-ai-launcher-teaser-shadow: 0 0.5rem 1.5rem rgb(16 40 80 / 0.15);
63
+ --vv-ai-menu-shadow: 0 0.5rem 1.5rem rgb(16 40 80 / 0.18);
64
+
65
+ /* Motion: the window grows out of the launcher's corner as the launcher spins away. */
66
+ --vv-ai-chat-spring: cubic-bezier(0.34, 1.25, 0.64, 1);
67
+ --vv-ai-launcher-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
68
+ --vv-ai-launcher-wind-up: cubic-bezier(0.36, 0, 0.66, -0.56);
69
+ --vv-ai-chat-window-delay: 0.35s;
70
+ }
71
+
21
72
  /* What the binding shows and hides with `hidden` stays hidden whatever display a host gives it. */
22
73
  [data-ai-chat-send][hidden],
23
74
  [data-ai-chat-stop][hidden],
@@ -27,7 +78,297 @@
27
78
  display: none !important;
28
79
  }
29
80
 
30
- /* A tool's progress dot pulses until the tool is done; the agent's typing dots pulse in turn. */
81
+ /*
82
+ * The chat, pinned rather than sized. A `height: 100dvh` block in normal flow has its bottom edge
83
+ * decided by everything above it, and any error there hides the composer instead of moving it.
84
+ * Anchored to the viewport's edges, the top is the element `data-ai-chat-offset` names and the
85
+ * bottom is the viewport, raised by an on-screen keyboard.
86
+ */
87
+ .vv-ai-chat {
88
+ position: fixed;
89
+ top: var(--vv-ai-chat-offset, 0px);
90
+ right: 0;
91
+ bottom: var(--vv-ai-chat-keyboard, 0px);
92
+ left: 0;
93
+ display: flex;
94
+ flex-direction: column;
95
+ background: var(--vv-ai-color-surface);
96
+ }
97
+
98
+ /* Only the thread scrolls. */
99
+ body:has(.vv-ai-chat:not(.vv-ai-chat--window)) {
100
+ overflow: hidden;
101
+ }
102
+
103
+ /* The header: who answers on the left, the actions on the right. */
104
+ .vv-ai-chat__header {
105
+ flex-shrink: 0;
106
+ background: var(--vv-ai-color-surface);
107
+ border-bottom: 1px solid var(--vv-ai-color-border);
108
+ }
109
+
110
+ .vv-ai-chat__header-inner {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: space-between;
114
+ gap: 0.75rem;
115
+ width: 100%;
116
+ padding: 0.625rem 1.25rem;
117
+ }
118
+
119
+ .vv-ai-chat__identity {
120
+ display: flex;
121
+ align-items: center;
122
+ gap: 0.625rem;
123
+ min-width: 0;
124
+ margin: 0;
125
+ }
126
+
127
+ .vv-ai-chat__avatar {
128
+ flex-shrink: 0;
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ width: 2.25rem;
133
+ height: 2.25rem;
134
+ color: var(--vv-ai-color-on-accent);
135
+ background: var(--vv-ai-color-accent);
136
+ border-radius: 50%;
137
+ }
138
+
139
+ .vv-ai-chat__avatar svg {
140
+ width: 1.25rem;
141
+ height: 1.25rem;
142
+ }
143
+
144
+ .vv-ai-chat__name {
145
+ font-family: var(--vv-ai-font-heading);
146
+ font-size: 1.125rem;
147
+ line-height: 1.2;
148
+ font-weight: var(--vv-ai-font-weight-bold);
149
+ color: var(--vv-ai-color-text);
150
+ white-space: nowrap;
151
+ overflow: hidden;
152
+ text-overflow: ellipsis;
153
+ }
154
+
155
+ .vv-ai-chat__header-actions {
156
+ flex-shrink: 0;
157
+ display: flex;
158
+ align-items: center;
159
+ gap: 0.5rem;
160
+ }
161
+
162
+ .vv-ai-chat__reset {
163
+ flex-shrink: 0;
164
+ display: inline-flex;
165
+ align-items: center;
166
+ gap: 0.5rem;
167
+ padding: 0.5625rem 0.875rem;
168
+ font-family: inherit;
169
+ font-size: 0.875rem;
170
+ line-height: 1.5rem;
171
+ color: var(--vv-ai-color-accent);
172
+ background: var(--vv-ai-color-surface);
173
+ border: 1px solid var(--vv-ai-color-border);
174
+ border-radius: var(--vv-ai-radius-l);
175
+ cursor: pointer;
176
+ transition: border-color 0.15s ease, background-color 0.15s ease;
177
+ }
178
+
179
+ .vv-ai-chat__reset:hover {
180
+ background: var(--vv-ai-color-surface-muted);
181
+ border-color: var(--vv-ai-color-border-accent);
182
+ }
183
+
184
+ .vv-ai-chat__reset svg {
185
+ flex-shrink: 0;
186
+ width: 0.8125rem;
187
+ height: 0.8125rem;
188
+ }
189
+
190
+ /* The thread, its empty state centred in it until the first question. */
191
+ .vv-ai-chat__thread {
192
+ flex: 1;
193
+ min-height: 0;
194
+ overflow-y: auto;
195
+ overscroll-behavior: contain;
196
+ scroll-behavior: smooth;
197
+ }
198
+
199
+ /*
200
+ * Cards in the thread lay out by its width rather than the viewport's, with
201
+ * `@container vv-ai-chat-thread`, so they read the same in the small window as on a phone.
202
+ */
203
+ .vv-ai-chat__thread-inner {
204
+ display: flex;
205
+ flex-direction: column;
206
+ gap: 1.5rem;
207
+ min-height: 100%;
208
+ width: 100%;
209
+ max-width: 47.5rem;
210
+ margin: 0 auto;
211
+ padding: 2rem 1.25rem 2.5rem;
212
+ container: vv-ai-chat-thread / inline-size;
213
+ }
214
+
215
+ .vv-ai-chat__intro {
216
+ display: flex;
217
+ flex-direction: column;
218
+ gap: 1rem;
219
+ margin: auto 0;
220
+ padding: 1.25rem 0;
221
+ text-align: center;
222
+ }
223
+
224
+ .vv-ai-chat__intro-title {
225
+ color: var(--vv-ai-color-accent);
226
+ }
227
+
228
+ .vv-ai-chat__intro-text {
229
+ color: var(--vv-ai-color-text-muted);
230
+ }
231
+
232
+ .vv-ai-chat__suggestions {
233
+ display: flex;
234
+ flex-wrap: wrap;
235
+ justify-content: center;
236
+ gap: 0.625rem;
237
+ margin: 0;
238
+ padding: 0;
239
+ list-style: none;
240
+ }
241
+
242
+ /* The questions to start with, and the ones the server suggests asking next, drawn alike. */
243
+ .vv-ai-chat__suggestion,
244
+ .vv-ai-chat__follow-up {
245
+ padding: 0.625rem 1rem;
246
+ font-family: inherit;
247
+ font-size: 0.875rem;
248
+ line-height: 1.5rem;
249
+ color: var(--vv-ai-color-accent);
250
+ text-align: left;
251
+ background: var(--vv-ai-color-surface-muted);
252
+ border: 1px solid transparent;
253
+ border-radius: var(--vv-ai-radius-l);
254
+ cursor: pointer;
255
+ transition: border-color 0.15s ease, background-color 0.15s ease;
256
+ }
257
+
258
+ .vv-ai-chat__suggestion:hover,
259
+ .vv-ai-chat__follow-up:hover {
260
+ border-color: var(--vv-ai-color-border-accent);
261
+ }
262
+
263
+ .vv-ai-chat__follow-ups {
264
+ display: flex;
265
+ flex-wrap: wrap;
266
+ gap: 0.5rem;
267
+ }
268
+
269
+ /* A question on the right in the accent; an answer as prose across the column. */
270
+ .vv-ai-chat__message {
271
+ display: flex;
272
+ flex-direction: column;
273
+ gap: 0.625rem;
274
+ min-width: 0;
275
+ }
276
+
277
+ .vv-ai-chat__message--user {
278
+ align-items: flex-end;
279
+ }
280
+
281
+ .vv-ai-chat__text {
282
+ max-width: 100%;
283
+ padding: 0.875rem 1.125rem;
284
+ border-radius: var(--vv-ai-radius-l);
285
+ overflow-wrap: anywhere;
286
+ }
287
+
288
+ .vv-ai-chat__message--user .vv-ai-chat__text {
289
+ max-width: 35rem;
290
+ color: var(--vv-ai-color-on-accent);
291
+ background: var(--vv-ai-color-accent);
292
+ }
293
+
294
+ .vv-ai-chat__message--assistant .vv-ai-chat__text {
295
+ padding-right: 0;
296
+ padding-left: 0;
297
+ color: var(--vv-ai-color-text);
298
+ }
299
+
300
+ /* Markdown, without the page's own spacing, so a reply does not open with a blank line. */
301
+ .vv-ai-chat__text > :first-child {
302
+ margin-top: 0;
303
+ }
304
+
305
+ .vv-ai-chat__text > :last-child {
306
+ margin-bottom: 0;
307
+ }
308
+
309
+ .vv-ai-chat__text p {
310
+ margin: 0 0 0.75rem;
311
+ line-height: 1.6;
312
+ }
313
+
314
+ .vv-ai-chat__text ul,
315
+ .vv-ai-chat__text ol {
316
+ display: flex;
317
+ flex-direction: column;
318
+ gap: 0.375rem;
319
+ margin: 0 0 0.75rem;
320
+ padding-left: 1.375rem;
321
+ }
322
+
323
+ .vv-ai-chat__text ul {
324
+ list-style: disc;
325
+ }
326
+
327
+ .vv-ai-chat__text ol {
328
+ list-style: decimal;
329
+ }
330
+
331
+ .vv-ai-chat__text a {
332
+ color: var(--vv-ai-color-accent);
333
+ text-decoration: underline;
334
+ }
335
+
336
+ .vv-ai-chat__message--user .vv-ai-chat__text a {
337
+ color: var(--vv-ai-color-on-accent);
338
+ }
339
+
340
+ .vv-ai-chat__text code {
341
+ padding: 0.125rem 0.3125rem;
342
+ font-size: 0.9em;
343
+ background: var(--vv-ai-color-surface-subtle);
344
+ border-radius: var(--vv-ai-radius);
345
+ }
346
+
347
+ .vv-ai-chat__text strong {
348
+ font-weight: var(--vv-ai-font-weight-bold);
349
+ }
350
+
351
+ /* A tool's progress: a pill with a dot that pulses until the tool is done. */
352
+ .vv-ai-chat__tool {
353
+ display: inline-flex;
354
+ align-items: center;
355
+ align-self: flex-start;
356
+ gap: 0.5rem;
357
+ max-width: 100%;
358
+ padding: 0.375rem 0.75rem;
359
+ font-size: 0.875rem;
360
+ line-height: 1.5rem;
361
+ color: var(--vv-ai-color-text-muted);
362
+ background: var(--vv-ai-color-surface-subtle);
363
+ border-radius: 6.25rem;
364
+ overflow-wrap: anywhere;
365
+ }
366
+
367
+ .vv-ai-chat__tool-status {
368
+ margin-left: auto;
369
+ font-size: 0.75rem;
370
+ }
371
+
31
372
  .vv-ai-chat__tool-dot,
32
373
  .vv-ai-chat__typing-dot {
33
374
  flex-shrink: 0;
@@ -37,22 +378,19 @@
37
378
  animation: vv-ai-chat-pulse 1.2s ease-in-out infinite;
38
379
  }
39
380
 
40
- .vv-ai-chat__typing-dot {
41
- background: var(--vv-ai-chat-dot-color, currentColor);
42
- }
43
-
44
- .vv-ai-chat__typing-dot:nth-child(2) {
45
- animation-delay: 0.15s;
46
- }
47
-
48
- .vv-ai-chat__typing-dot:nth-child(3) {
49
- animation-delay: 0.3s;
381
+ .vv-ai-chat__tool-dot {
382
+ background: var(--vv-ai-color-accent);
50
383
  }
51
384
 
52
385
  .vv-ai-chat__tool--done .vv-ai-chat__tool-dot {
386
+ background: var(--vv-ai-color-success);
53
387
  animation: none;
54
388
  }
55
389
 
390
+ .vv-ai-chat__tool--failed .vv-ai-chat__tool-dot {
391
+ background: var(--vv-ai-color-error);
392
+ }
393
+
56
394
  @keyframes vv-ai-chat-pulse {
57
395
  0%,
58
396
  100% {
@@ -64,20 +402,123 @@
64
402
  }
65
403
  }
66
404
 
67
- /* The typing indicator's text is for screen readers; the dots show it. */
68
- .vv-ai-chat__typing-label {
69
- position: absolute;
70
- width: 1px;
71
- height: 1px;
72
- margin: -1px;
405
+ .vv-ai-chat__result {
406
+ display: flex;
407
+ flex-direction: column;
408
+ align-self: stretch;
409
+ gap: 0.75rem;
410
+ min-width: 0;
411
+ }
412
+
413
+ /* Several cards from one lookup, spaced like separate cards. */
414
+ .vv-ai-card-list {
415
+ display: flex;
416
+ flex-direction: column;
417
+ gap: 0.75rem;
418
+ }
419
+
420
+ .vv-ai-actions {
421
+ display: flex;
422
+ flex-wrap: wrap;
423
+ align-self: flex-start;
424
+ gap: 0.625rem;
425
+ }
426
+
427
+ .vv-ai-actions__action {
428
+ display: inline-flex;
429
+ align-items: center;
430
+ justify-content: center;
431
+ min-height: 2.75rem;
432
+ padding: 0.5rem 1.25rem;
433
+ font-family: inherit;
434
+ font-size: 0.875rem;
435
+ line-height: 1.5rem;
436
+ font-weight: var(--vv-ai-font-weight-bold);
437
+ color: var(--vv-ai-color-accent);
438
+ text-decoration: none;
439
+ background: var(--vv-ai-color-surface);
440
+ border: 1px solid var(--vv-ai-color-accent);
441
+ border-radius: var(--vv-ai-radius);
442
+ cursor: pointer;
443
+ }
444
+
445
+ .vv-ai-actions__action--primary {
446
+ color: var(--vv-ai-color-on-accent);
447
+ background: var(--vv-ai-color-accent);
448
+ }
449
+
450
+ .vv-ai-chat__error {
451
+ align-self: flex-start;
452
+ padding: 0.75rem 1rem;
453
+ color: var(--vv-ai-color-error);
454
+ background: var(--vv-ai-color-error-surface);
455
+ border: 1px solid var(--vv-ai-color-error-border);
456
+ border-radius: var(--vv-ai-radius);
457
+ }
458
+
459
+ /* Copy and the two ratings, under each finished answer. A check shows for two seconds after copying. */
460
+ .vv-ai-chat__reply-actions {
461
+ display: flex;
462
+ align-self: flex-start;
463
+ gap: 0.25rem;
464
+ margin-top: -0.25rem;
465
+ }
466
+
467
+ .vv-ai-chat__reply-action {
468
+ display: flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ width: 2rem;
472
+ height: 2rem;
73
473
  padding: 0;
74
- overflow: hidden;
75
- clip-path: inset(50%);
76
- white-space: nowrap;
474
+ color: var(--vv-ai-color-text-muted);
475
+ background: transparent;
77
476
  border: 0;
477
+ border-radius: var(--vv-ai-radius);
478
+ cursor: pointer;
479
+ transition: color 0.15s ease, background-color 0.15s ease;
480
+ }
481
+
482
+ .vv-ai-chat__reply-action:hover {
483
+ color: var(--vv-ai-color-accent);
484
+ background: var(--vv-ai-color-surface-muted);
485
+ }
486
+
487
+ .vv-ai-chat__reply-action[aria-pressed='true'] {
488
+ color: var(--vv-ai-color-accent);
489
+ }
490
+
491
+ .vv-ai-chat__reply-action svg {
492
+ width: 1rem;
493
+ height: 1rem;
494
+ }
495
+
496
+ .vv-ai-chat__reply-icon {
497
+ display: flex;
498
+ }
499
+
500
+ .vv-ai-chat__reply-icon--done,
501
+ .vv-ai-chat__reply-action[data-ai-chat-copied] .vv-ai-chat__reply-icon {
502
+ display: none;
503
+ }
504
+
505
+ .vv-ai-chat__reply-action[data-ai-chat-copied] .vv-ai-chat__reply-icon--done {
506
+ display: flex;
507
+ color: var(--vv-ai-color-success);
508
+ }
509
+
510
+ /*
511
+ * A live chat. Dividers mark who answers from here on: their text between two lines. The
512
+ * assistant's own notices about it read as plain text, and as its bubbles in the window.
513
+ */
514
+ .vv-ai-chat__notice {
515
+ max-width: 35rem;
516
+ margin: 0;
517
+ font-size: 0.875rem;
518
+ line-height: 1.5;
519
+ color: var(--vv-ai-color-text);
78
520
  }
79
521
 
80
- /* Who answers from here on: a divider, its text between two lines. */
81
522
  .vv-ai-chat__notice--started,
82
523
  .vv-ai-chat__notice--joined,
83
524
  .vv-ai-chat__notice--agent-ended,
@@ -86,6 +527,11 @@
86
527
  display: flex;
87
528
  align-items: center;
88
529
  gap: var(--vv-ai-chat-divider-gap, 0.625rem);
530
+ max-width: none;
531
+ padding: 0.375rem 0;
532
+ font-size: 0.6875rem;
533
+ line-height: 1.4;
534
+ color: var(--vv-ai-color-text-subtle);
89
535
  text-align: center;
90
536
  }
91
537
 
@@ -102,82 +548,1645 @@
102
548
  content: "";
103
549
  flex: 1;
104
550
  height: 1px;
105
- background: var(--vv-ai-chat-divider-color, currentColor);
551
+ background: var(--vv-ai-chat-divider-color, var(--vv-ai-color-border));
106
552
  }
107
553
 
108
- /* A wide table scrolls inside its own region, and the scroll does not carry on into the page. */
109
- .vv-ai-answer-card__table-region {
110
- max-width: 100%;
111
- overflow-x: auto;
112
- overscroll-behavior-x: contain;
554
+ /* The agent's messages: their name above an outlined bubble, their initials beside it. */
555
+ .vv-ai-chat__message--person {
556
+ display: grid;
557
+ grid-template-columns: 1.625rem minmax(0, 1fr);
558
+ column-gap: 0.5rem;
559
+ row-gap: 0.25rem;
560
+ justify-items: start;
113
561
  }
114
562
 
115
- /*
116
- * A page an agent's button opens, over the whole root, which needs a position for it to cover. The
117
- * frame fills what the header leaves.
118
- */
119
- .vv-ai-chat__sheet {
120
- position: absolute;
121
- inset: 0;
122
- z-index: 1;
563
+ .vv-ai-chat__initials {
564
+ grid-row: 2;
565
+ grid-column: 1;
566
+ align-self: end;
567
+ flex-shrink: 0;
123
568
  display: flex;
124
- flex-direction: column;
125
- background: var(--vv-ai-chat-sheet-background, #fff);
569
+ align-items: center;
570
+ justify-content: center;
571
+ width: 1.625rem;
572
+ height: 1.625rem;
573
+ font-size: 0.625rem;
574
+ font-weight: var(--vv-ai-font-weight-bold);
575
+ line-height: 1;
576
+ color: var(--vv-ai-color-on-accent);
577
+ background: var(--vv-ai-color-agent);
578
+ border-radius: 50%;
126
579
  }
127
580
 
128
- .vv-ai-chat__sheet-header {
129
- display: flex;
130
- align-items: center;
131
- justify-content: space-between;
581
+ .vv-ai-chat__sender {
582
+ grid-row: 1;
583
+ grid-column: 2;
584
+ padding: 0 0.25rem;
585
+ font-size: 0.6875rem;
586
+ line-height: 1.4;
587
+ color: var(--vv-ai-color-text-subtle);
132
588
  }
133
589
 
134
- .vv-ai-chat__sheet-frame {
135
- flex: 1;
136
- width: 100%;
137
- min-height: 0;
138
- border: 0;
590
+ .vv-ai-chat__message--person .vv-ai-chat__text {
591
+ grid-row: 2;
592
+ grid-column: 2;
593
+ max-width: 35rem;
594
+ padding: 0.625rem 0.875rem;
595
+ color: var(--vv-ai-color-text);
596
+ background: var(--vv-ai-color-surface);
597
+ border: 1px solid var(--vv-ai-color-border);
598
+ border-radius: var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) 0.25rem;
139
599
  }
140
600
 
141
- /*
142
- * The survey's yes-or-no question as a switch. The input selector outweighs a host's own rule for
143
- * every survey input, which would otherwise draw the switch as a text box.
144
- */
145
- .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"] {
146
- position: relative;
147
- flex-shrink: 0;
148
- width: var(--vv-ai-survey-toggle-width, 2.125rem);
149
- height: var(--vv-ai-survey-toggle-height, 1.25rem);
150
- margin: 0;
151
- padding: 0;
152
- cursor: pointer;
153
- appearance: none;
154
- background: var(--vv-ai-survey-toggle-off, #9ca3af);
155
- border: 0;
156
- border-radius: calc(var(--vv-ai-survey-toggle-height, 1.25rem) / 2);
157
- transition: background-color 0.2s ease;
601
+ /* A card's buttons in its bubble under the text; outside it, under the bubble or in its place. */
602
+ .vv-ai-chat__message--person .vv-ai-chat__text .vv-ai-actions {
603
+ margin-top: 0.25rem;
158
604
  }
159
605
 
160
- .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]::after {
161
- content: "";
162
- position: absolute;
163
- top: var(--vv-ai-survey-toggle-inset, 0.125rem);
164
- left: var(--vv-ai-survey-toggle-inset, 0.125rem);
165
- width: calc(var(--vv-ai-survey-toggle-height, 1.25rem) - 2 * var(--vv-ai-survey-toggle-inset, 0.125rem));
166
- height: calc(var(--vv-ai-survey-toggle-height, 1.25rem) - 2 * var(--vv-ai-survey-toggle-inset, 0.125rem));
167
- background: var(--vv-ai-survey-toggle-knob, #fff);
168
- border-radius: 50%;
169
- transition: transform 0.2s ease;
606
+ .vv-ai-chat__message--person > .vv-ai-actions {
607
+ grid-row: 3;
608
+ grid-column: 2;
170
609
  }
171
610
 
172
- .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]:checked {
173
- background: var(--vv-ai-survey-toggle-on, currentColor);
611
+ .vv-ai-chat__message--person:not(:has(> .vv-ai-chat__text)) > .vv-ai-actions {
612
+ grid-row: 2;
174
613
  }
175
614
 
176
- .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]:checked::after {
177
- transform: translateX(calc(var(--vv-ai-survey-toggle-width, 2.125rem) - var(--vv-ai-survey-toggle-height, 1.25rem)));
615
+ /* The agent typing: three dots in a bubble that pulse in turn. */
616
+ .vv-ai-chat__typing {
617
+ display: flex;
618
+ align-items: flex-end;
619
+ gap: 0.5rem;
178
620
  }
179
621
 
180
- @media (prefers-reduced-motion: reduce) {
622
+ .vv-ai-chat__typing-dots {
623
+ display: flex;
624
+ gap: 0.25rem;
625
+ padding: 0.75rem 0.875rem;
626
+ background: var(--vv-ai-color-surface);
627
+ border: 1px solid var(--vv-ai-color-border);
628
+ border-radius: var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) 0.25rem;
629
+ }
630
+
631
+ .vv-ai-chat__typing-dot {
632
+ background: var(--vv-ai-chat-dot-color, var(--vv-ai-color-border-strong));
633
+ }
634
+
635
+ .vv-ai-chat__typing-dot:nth-child(2) {
636
+ animation-delay: 0.15s;
637
+ }
638
+
639
+ .vv-ai-chat__typing-dot:nth-child(3) {
640
+ animation-delay: 0.3s;
641
+ }
642
+
643
+ /* The typing indicator's text is for screen readers; the dots show it. */
644
+ .vv-ai-chat__typing-label {
645
+ position: absolute;
646
+ width: 1px;
647
+ height: 1px;
648
+ margin: -1px;
649
+ padding: 0;
650
+ overflow: hidden;
651
+ clip-path: inset(50%);
652
+ white-space: nowrap;
653
+ border: 0;
654
+ }
655
+
656
+ /* While no agent has taken the chat yet. */
657
+ .vv-ai-chat__waiting {
658
+ display: flex;
659
+ flex-direction: column;
660
+ align-items: center;
661
+ gap: 0.5rem;
662
+ padding: 1.125rem;
663
+ text-align: center;
664
+ background: var(--vv-ai-color-surface-muted);
665
+ border-radius: 0.75rem;
666
+ }
667
+
668
+ .vv-ai-chat__waiting-title {
669
+ margin: 0;
670
+ font-size: 0.8125rem;
671
+ font-weight: var(--vv-ai-font-weight-bold);
672
+ line-height: 1.4;
673
+ color: var(--vv-ai-color-text);
674
+ }
675
+
676
+ .vv-ai-chat__waiting-text {
677
+ margin: 0;
678
+ font-size: 0.75rem;
679
+ line-height: 1.45;
680
+ color: var(--vv-ai-color-text-muted);
681
+ }
682
+
683
+ /* The composer: the input with the send button over its corner, and a disclaimer under it. */
684
+ .vv-ai-chat__composer {
685
+ position: relative;
686
+ flex-shrink: 0;
687
+ background: var(--vv-ai-color-surface);
688
+ border-top: 1px solid var(--vv-ai-color-border);
689
+ }
690
+
691
+ .vv-ai-chat__composer-inner {
692
+ width: 100%;
693
+ max-width: 47.5rem;
694
+ margin: 0 auto;
695
+ padding: 1rem 1.25rem 0.75rem;
696
+ }
697
+
698
+ .vv-ai-chat__prompt {
699
+ position: relative;
700
+ background: var(--vv-ai-color-surface);
701
+ border: 1px solid var(--vv-ai-color-border);
702
+ border-radius: var(--vv-ai-radius-l);
703
+ box-shadow: var(--vv-ai-shadow-prompt);
704
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
705
+ }
706
+
707
+ .vv-ai-chat__prompt:focus-within {
708
+ border-color: var(--vv-ai-color-accent);
709
+ box-shadow: var(--vv-ai-focus-ring);
710
+ }
711
+
712
+ /* Right padding keeps typed text clear of the send button. */
713
+ .vv-ai-chat__input {
714
+ display: block;
715
+ width: 100%;
716
+ min-height: 3.625rem;
717
+ max-height: 11.25rem;
718
+ padding: 1.0625rem 4rem 1.0625rem 1.125rem;
719
+ font-family: inherit;
720
+ font-size: 1rem;
721
+ line-height: 1.625rem;
722
+ color: var(--vv-ai-color-text);
723
+ background: transparent;
724
+ border: 0;
725
+ border-radius: var(--vv-ai-radius-l);
726
+ resize: none;
727
+ overflow-y: auto;
728
+ }
729
+
730
+ .vv-ai-chat__input:focus {
731
+ outline: none;
732
+ }
733
+
734
+ .vv-ai-chat__send {
735
+ position: absolute;
736
+ right: 0.5rem;
737
+ bottom: 0.5rem;
738
+ display: flex;
739
+ align-items: center;
740
+ justify-content: center;
741
+ width: 2.625rem;
742
+ height: 2.625rem;
743
+ color: var(--vv-ai-color-on-accent);
744
+ background: var(--vv-ai-color-accent);
745
+ border: 0;
746
+ border-radius: 50%;
747
+ cursor: pointer;
748
+ transition: background-color 0.15s ease;
749
+ }
750
+
751
+ .vv-ai-chat__send:hover:not(:disabled) {
752
+ background: var(--vv-ai-color-accent-hover);
753
+ }
754
+
755
+ .vv-ai-chat__send:disabled {
756
+ background: var(--vv-ai-color-border-strong);
757
+ cursor: default;
758
+ }
759
+
760
+ .vv-ai-chat__send svg {
761
+ width: 1.125rem;
762
+ height: 1.125rem;
763
+ }
764
+
765
+ .vv-ai-chat__send--stop {
766
+ background: var(--vv-ai-color-text);
767
+ }
768
+
769
+ .vv-ai-chat__send--stop svg {
770
+ width: 0.875rem;
771
+ height: 0.875rem;
772
+ }
773
+
774
+ /* Shown only once the message is close to the length the server accepts. */
775
+ .vv-ai-chat__counter {
776
+ display: none;
777
+ padding-top: 0.375rem;
778
+ font-size: 0.875rem;
779
+ line-height: 1.5rem;
780
+ color: var(--vv-ai-color-text-muted);
781
+ text-align: right;
782
+ }
783
+
784
+ .vv-ai-chat__counter[data-ai-chat-near-limit] {
785
+ display: block;
786
+ }
787
+
788
+ .vv-ai-chat__disclaimer {
789
+ max-width: 47.5rem;
790
+ margin: 0 auto;
791
+ padding: 0 1.25rem 0.875rem;
792
+ font-size: 0.875rem;
793
+ line-height: 1.5rem;
794
+ color: var(--vv-ai-color-text-subtle);
795
+ text-align: center;
796
+ }
797
+
798
+ /* A logo in the composer's corner, level with the disclaimer's last line. */
799
+ .vv-ai-chat__brand {
800
+ position: absolute;
801
+ right: 1.25rem;
802
+ bottom: 1rem;
803
+ display: flex;
804
+ }
805
+
806
+ .vv-ai-chat__brand svg {
807
+ width: 1.375rem;
808
+ height: auto;
809
+ }
810
+
811
+ /*
812
+ * A page an agent's button opens, such as a sign-in, over the whole root under a header like the
813
+ * window's. The root needs a position for it to cover, which it has.
814
+ */
815
+ .vv-ai-chat__sheet {
816
+ position: absolute;
817
+ inset: 0;
818
+ z-index: 1;
819
+ display: flex;
820
+ flex-direction: column;
821
+ background: var(--vv-ai-chat-sheet-background, var(--vv-ai-color-surface));
822
+ }
823
+
824
+ .vv-ai-chat__sheet-header {
825
+ display: flex;
826
+ align-items: center;
827
+ justify-content: space-between;
828
+ gap: 0.75rem;
829
+ padding: 0.875rem 0.75rem 0.875rem 1rem;
830
+ color: var(--vv-ai-chat-window-header-text);
831
+ background: var(--vv-ai-chat-window-header);
832
+ }
833
+
834
+ .vv-ai-chat__sheet-title {
835
+ min-width: 0;
836
+ margin: 0;
837
+ font-family: var(--vv-ai-font-heading);
838
+ font-size: 1rem;
839
+ line-height: 1.2;
840
+ font-weight: var(--vv-ai-font-weight-bold);
841
+ white-space: nowrap;
842
+ overflow: hidden;
843
+ text-overflow: ellipsis;
844
+ }
845
+
846
+ /* The close label is for screen readers; a cross shows it. */
847
+ .vv-ai-chat__sheet-close {
848
+ position: relative;
849
+ flex-shrink: 0;
850
+ width: 2rem;
851
+ height: 2rem;
852
+ padding: 0;
853
+ overflow: hidden;
854
+ font-size: 0;
855
+ color: inherit;
856
+ background: transparent;
857
+ border: 0;
858
+ border-radius: 0.5rem;
859
+ cursor: pointer;
860
+ transition: background-color 0.15s ease;
861
+ }
862
+
863
+ .vv-ai-chat__sheet-close::before {
864
+ content: "";
865
+ position: absolute;
866
+ inset: 0;
867
+ background: currentColor;
868
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / 1.125rem no-repeat;
869
+ }
870
+
871
+ .vv-ai-chat__sheet-close:hover,
872
+ .vv-ai-chat__sheet-close:focus-visible {
873
+ background-color: var(--vv-ai-chat-window-header-hover);
874
+ }
875
+
876
+ .vv-ai-chat__sheet-close:focus-visible {
877
+ outline: 2px solid currentColor;
878
+ outline-offset: 0;
879
+ }
880
+
881
+ .vv-ai-chat__sheet-frame {
882
+ flex: 1;
883
+ width: 100%;
884
+ min-height: 0;
885
+ border: 0;
886
+ }
887
+
888
+ @media (width < 36rem) {
889
+ .vv-ai-chat__sheet-header {
890
+ padding-top: calc(0.875rem + env(safe-area-inset-top, 0px));
891
+ }
892
+ }
893
+
894
+ /*
895
+ * The chat as a window over every other page, opened from the launcher. On a phone it takes the
896
+ * whole screen, raised by an on-screen keyboard like the full page; from 36rem up it floats in the
897
+ * launcher's corner. The assistant talks in bubbles here, so it reads as a speaker the way a person
898
+ * will once the window hands over.
899
+ *
900
+ * It grows out of the launcher's corner and springs a little past full size as the launcher spins
901
+ * away. Open, it is left unscaled: any scale would make it the containing block of its fixed
902
+ * children.
903
+ */
904
+ .vv-ai-chat--window {
905
+ top: 0;
906
+ z-index: var(--vv-ai-chat-window-z);
907
+ transform-origin: 100% 100%;
908
+ transition:
909
+ scale 0.45s var(--vv-ai-chat-spring) var(--vv-ai-chat-window-delay),
910
+ opacity 0.2s ease var(--vv-ai-chat-window-delay),
911
+ display 0.8s allow-discrete;
912
+ }
913
+
914
+ @starting-style {
915
+ .vv-ai-chat--window[data-ai-chat-open] {
916
+ scale: 0.3;
917
+ opacity: 0;
918
+ }
919
+ }
920
+
921
+ /* Closing, it shrinks back into the corner as the launcher pops back in. */
922
+ .vv-ai-chat--window:not([data-ai-chat-open]) {
923
+ display: none;
924
+ scale: 0.3;
925
+ opacity: 0;
926
+ transition:
927
+ scale 0.25s cubic-bezier(0.55, 0, 1, 0.45),
928
+ opacity 0.2s ease 0.05s,
929
+ display 0.25s allow-discrete;
930
+ }
931
+
932
+ @media (prefers-reduced-motion: reduce) {
933
+ .vv-ai-chat--window,
934
+ .vv-ai-chat--window:not([data-ai-chat-open]) {
935
+ transition: none;
936
+ }
937
+ }
938
+
939
+ @media (min-width: 36rem) {
940
+ .vv-ai-chat--window {
941
+ top: auto;
942
+ right: var(--vv-ai-chat-window-inset);
943
+ bottom: var(--vv-ai-chat-window-inset);
944
+ left: auto;
945
+ width: min(var(--vv-ai-chat-window-width), calc(100vw - 2 * var(--vv-ai-chat-window-inset)));
946
+ height: min(var(--vv-ai-chat-window-height), calc(100dvh - 2 * var(--vv-ai-chat-window-inset)));
947
+ border-radius: var(--vv-ai-chat-window-radius);
948
+ box-shadow: var(--vv-ai-chat-window-shadow);
949
+ overflow: hidden;
950
+ }
951
+ }
952
+
953
+ /* On a phone the open window covers the launcher, and the page behind it stays put. */
954
+ @media (width < 36rem) {
955
+ body:has(.vv-ai-chat--window[data-ai-chat-open]) {
956
+ overflow: hidden;
957
+ }
958
+
959
+ body:has(.vv-ai-chat--window[data-ai-chat-open]) .vv-ai-launcher {
960
+ display: none;
961
+ }
962
+ }
963
+
964
+ .vv-ai-chat--window .vv-ai-chat__header {
965
+ background: var(--vv-ai-chat-window-header);
966
+ border-bottom: 0;
967
+ }
968
+
969
+ @media (width < 36rem) {
970
+ .vv-ai-chat--window .vv-ai-chat__header {
971
+ padding-top: env(safe-area-inset-top, 0px);
972
+ }
973
+ }
974
+
975
+ .vv-ai-chat--window .vv-ai-chat__header-inner {
976
+ max-width: none;
977
+ gap: 0.75rem;
978
+ padding: 0.875rem 0.75rem 0.875rem 1rem;
979
+ }
980
+
981
+ .vv-ai-chat--window .vv-ai-chat__identity {
982
+ flex: 1;
983
+ gap: 0.75rem;
984
+ }
985
+
986
+ .vv-ai-chat--window .vv-ai-chat__avatar {
987
+ background: rgb(255 255 255 / 0.18);
988
+ }
989
+
990
+ .vv-ai-chat--window .vv-ai-chat__name {
991
+ font-size: 1rem;
992
+ color: var(--vv-ai-chat-window-header-text);
993
+ }
994
+
995
+ .vv-ai-chat__who {
996
+ display: flex;
997
+ flex-direction: column;
998
+ gap: 0.125rem;
999
+ min-width: 0;
1000
+ margin: 0;
1001
+ }
1002
+
1003
+ /* Online, waiting for an agent: a dot before the status. */
1004
+ .vv-ai-chat__status {
1005
+ display: flex;
1006
+ align-items: center;
1007
+ gap: 0.375rem;
1008
+ font-size: 0.75rem;
1009
+ line-height: 1.3;
1010
+ color: var(--vv-ai-chat-window-header-muted);
1011
+ white-space: nowrap;
1012
+ }
1013
+
1014
+ .vv-ai-chat__status::before {
1015
+ content: "";
1016
+ flex-shrink: 0;
1017
+ width: 0.4375rem;
1018
+ height: 0.4375rem;
1019
+ background: var(--vv-ai-color-online);
1020
+ border-radius: 50%;
1021
+ }
1022
+
1023
+ .vv-ai-chat__status--waiting::before {
1024
+ background: var(--vv-ai-color-waiting);
1025
+ }
1026
+
1027
+ .vv-ai-chat--window .vv-ai-chat__header-actions {
1028
+ gap: 0.25rem;
1029
+ }
1030
+
1031
+ /* The window's header buttons: icons on the header's colour. */
1032
+ .vv-ai-chat--window .vv-ai-chat__reset,
1033
+ .vv-ai-chat--window .vv-ai-chat__expand,
1034
+ .vv-ai-chat--window .vv-ai-chat__close,
1035
+ .vv-ai-chat--window .vv-ai-chat__menu-toggle {
1036
+ display: flex;
1037
+ align-items: center;
1038
+ justify-content: center;
1039
+ width: 2rem;
1040
+ height: 2rem;
1041
+ padding: 0;
1042
+ color: var(--vv-ai-chat-window-header-text);
1043
+ background: transparent;
1044
+ border: 0;
1045
+ border-radius: 0.5rem;
1046
+ cursor: pointer;
1047
+ transition: background-color 0.15s ease;
1048
+ }
1049
+
1050
+ /* Hover and focus both, to outrank a page's own link colours. */
1051
+ .vv-ai-chat--window .vv-ai-chat__reset:hover,
1052
+ .vv-ai-chat--window .vv-ai-chat__reset:focus-visible,
1053
+ .vv-ai-chat--window .vv-ai-chat__expand:hover,
1054
+ .vv-ai-chat--window .vv-ai-chat__expand:focus-visible,
1055
+ .vv-ai-chat--window .vv-ai-chat__close:hover,
1056
+ .vv-ai-chat--window .vv-ai-chat__close:focus-visible,
1057
+ .vv-ai-chat--window .vv-ai-chat__menu-toggle:hover,
1058
+ .vv-ai-chat--window .vv-ai-chat__menu-toggle:focus-visible {
1059
+ color: var(--vv-ai-chat-window-header-text);
1060
+ background: var(--vv-ai-chat-window-header-hover);
1061
+ }
1062
+
1063
+ .vv-ai-chat--window .vv-ai-chat__reset:focus-visible,
1064
+ .vv-ai-chat--window .vv-ai-chat__expand:focus-visible,
1065
+ .vv-ai-chat--window .vv-ai-chat__close:focus-visible,
1066
+ .vv-ai-chat--window .vv-ai-chat__menu-toggle:focus-visible {
1067
+ outline: 2px solid var(--vv-ai-chat-window-header-text);
1068
+ outline-offset: 0;
1069
+ }
1070
+
1071
+ .vv-ai-chat--window .vv-ai-chat__reset svg,
1072
+ .vv-ai-chat--window .vv-ai-chat__expand svg,
1073
+ .vv-ai-chat--window .vv-ai-chat__close svg {
1074
+ width: 1rem;
1075
+ height: 1rem;
1076
+ }
1077
+
1078
+ .vv-ai-chat--window .vv-ai-chat__close svg {
1079
+ height: auto;
1080
+ }
1081
+
1082
+ /* In the window the reset is an icon whose text is for screen readers. */
1083
+ .vv-ai-chat--window .vv-ai-chat__reset span {
1084
+ position: absolute;
1085
+ width: 1px;
1086
+ height: 1px;
1087
+ margin: -1px;
1088
+ padding: 0;
1089
+ overflow: hidden;
1090
+ clip: rect(0, 0, 0, 0);
1091
+ white-space: nowrap;
1092
+ border: 0;
1093
+ }
1094
+
1095
+ /* Nothing to start over from until the first question. */
1096
+ .vv-ai-chat--window:has(.vv-ai-chat__intro) .vv-ai-chat__reset {
1097
+ display: none;
1098
+ }
1099
+
1100
+ /* A phone already shows the window at full size. */
1101
+ @media (width < 36rem) {
1102
+ .vv-ai-chat--window .vv-ai-chat__expand {
1103
+ display: none;
1104
+ }
1105
+ }
1106
+
1107
+ /*
1108
+ * Who answers: the assistant; customer service while the visitor fills in the form and waits for
1109
+ * an agent; then the agent, in a darker header with their initials and a menu to end the chat.
1110
+ * `--ai`, `--waiting` and `--agent` on the header's names and statuses, `__avatar--agent` for the
1111
+ * initials.
1112
+ */
1113
+ .vv-ai-chat--window:not([data-ai-chat-live]) .vv-ai-chat__avatar--agent,
1114
+ .vv-ai-chat--window:not([data-ai-chat-live]) .vv-ai-chat__name--waiting,
1115
+ .vv-ai-chat--window:not([data-ai-chat-live]) .vv-ai-chat__name--agent,
1116
+ .vv-ai-chat--window:not([data-ai-chat-live]) .vv-ai-chat__status--waiting,
1117
+ .vv-ai-chat--window:not([data-ai-chat-live]) .vv-ai-chat__status--agent {
1118
+ display: none;
1119
+ }
1120
+
1121
+ .vv-ai-chat--window[data-ai-chat-mode='handover']:not([data-ai-chat-live]) .vv-ai-chat__name--waiting,
1122
+ .vv-ai-chat--window[data-ai-chat-mode='handover']:not([data-ai-chat-live]) .vv-ai-chat__status--waiting {
1123
+ display: inline;
1124
+ }
1125
+
1126
+ .vv-ai-chat--window[data-ai-chat-mode='handover']:not([data-ai-chat-live]) .vv-ai-chat__name--ai,
1127
+ .vv-ai-chat--window[data-ai-chat-mode='handover']:not([data-ai-chat-live]) .vv-ai-chat__status--ai {
1128
+ display: none;
1129
+ }
1130
+
1131
+ .vv-ai-chat--window[data-ai-chat-live='waiting'] .vv-ai-chat__avatar--agent,
1132
+ .vv-ai-chat--window[data-ai-chat-live='waiting'] .vv-ai-chat__name--ai,
1133
+ .vv-ai-chat--window[data-ai-chat-live='waiting'] .vv-ai-chat__name--agent,
1134
+ .vv-ai-chat--window[data-ai-chat-live='waiting'] .vv-ai-chat__status--ai,
1135
+ .vv-ai-chat--window[data-ai-chat-live='waiting'] .vv-ai-chat__status--agent {
1136
+ display: none;
1137
+ }
1138
+
1139
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__header {
1140
+ background: var(--vv-ai-chat-window-header-agent);
1141
+ }
1142
+
1143
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__avatar:not(.vv-ai-chat__avatar--agent),
1144
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__name--ai,
1145
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__name--waiting,
1146
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__status--ai,
1147
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__status--waiting {
1148
+ display: none;
1149
+ }
1150
+
1151
+ .vv-ai-chat--window[data-ai-chat-live] .vv-ai-chat__reset,
1152
+ .vv-ai-chat--window[data-ai-chat-live] .vv-ai-chat__expand,
1153
+ .vv-ai-chat--window:not([data-ai-chat-live='agent']) .vv-ai-chat__menu {
1154
+ display: none;
1155
+ }
1156
+
1157
+ .vv-ai-chat--window .vv-ai-chat__avatar--agent {
1158
+ font-size: 0.8125rem;
1159
+ font-weight: var(--vv-ai-font-weight-bold);
1160
+ line-height: 1;
1161
+ background: var(--vv-ai-color-agent);
1162
+ }
1163
+
1164
+ /* The menu, a `details[data-ai-chat-menu]` whose summary is the toggle. */
1165
+ .vv-ai-chat__menu {
1166
+ position: relative;
1167
+ }
1168
+
1169
+ .vv-ai-chat__menu-toggle {
1170
+ list-style: none;
1171
+ }
1172
+
1173
+ .vv-ai-chat__menu-toggle::-webkit-details-marker {
1174
+ display: none;
1175
+ }
1176
+
1177
+ .vv-ai-chat--window .vv-ai-chat__menu-toggle svg {
1178
+ width: 1.125rem;
1179
+ height: 1.125rem;
1180
+ }
1181
+
1182
+ .vv-ai-chat__menu-list {
1183
+ position: absolute;
1184
+ top: calc(100% + 0.25rem);
1185
+ right: 0;
1186
+ z-index: 1;
1187
+ min-width: 13.75rem;
1188
+ padding: 0.25rem;
1189
+ background: var(--vv-ai-color-surface);
1190
+ border-radius: 0.5rem;
1191
+ box-shadow: var(--vv-ai-menu-shadow);
1192
+ }
1193
+
1194
+ .vv-ai-chat__menu-item {
1195
+ display: block;
1196
+ width: 100%;
1197
+ padding: 0.625rem 0.75rem;
1198
+ font-size: 0.875rem;
1199
+ line-height: 1.4;
1200
+ text-align: left;
1201
+ color: var(--vv-ai-color-text);
1202
+ background: none;
1203
+ border: 0;
1204
+ border-radius: 0.375rem;
1205
+ cursor: pointer;
1206
+ }
1207
+
1208
+ .vv-ai-chat__menu-item:hover,
1209
+ .vv-ai-chat__menu-item:focus-visible {
1210
+ background: var(--vv-ai-color-surface-subtle);
1211
+ }
1212
+
1213
+ .vv-ai-chat--window .vv-ai-chat__thread-inner {
1214
+ gap: 0.75rem;
1215
+ max-width: none;
1216
+ padding: 1rem;
1217
+ }
1218
+
1219
+ .vv-ai-chat--window .vv-ai-chat__intro {
1220
+ align-items: center;
1221
+ gap: 0.625rem;
1222
+ margin: 0;
1223
+ padding: 1.75rem 0.5rem 0.5rem;
1224
+ }
1225
+
1226
+ .vv-ai-chat__intro-avatar {
1227
+ display: flex;
1228
+ align-items: center;
1229
+ justify-content: center;
1230
+ width: 3.5rem;
1231
+ height: 3.5rem;
1232
+ color: var(--vv-ai-color-on-accent);
1233
+ background: var(--vv-ai-color-accent);
1234
+ border-radius: 50%;
1235
+ }
1236
+
1237
+ .vv-ai-chat__intro-avatar svg {
1238
+ width: 1.75rem;
1239
+ height: 1.75rem;
1240
+ }
1241
+
1242
+ .vv-ai-chat--window .vv-ai-chat__intro-title {
1243
+ margin: 0;
1244
+ font-size: 1.375rem;
1245
+ line-height: 1.25;
1246
+ }
1247
+
1248
+ .vv-ai-chat--window .vv-ai-chat__intro-text {
1249
+ max-width: 18.75rem;
1250
+ margin: 0;
1251
+ font-size: 0.875rem;
1252
+ line-height: 1.5;
1253
+ }
1254
+
1255
+ .vv-ai-chat--window .vv-ai-chat__suggestions {
1256
+ flex-direction: column;
1257
+ gap: 0.5rem;
1258
+ width: 100%;
1259
+ padding-top: 0.75rem;
1260
+ }
1261
+
1262
+ .vv-ai-chat--window .vv-ai-chat__suggestions li {
1263
+ width: 100%;
1264
+ }
1265
+
1266
+ .vv-ai-chat--window .vv-ai-chat__suggestion,
1267
+ .vv-ai-chat--window .vv-ai-chat__follow-up {
1268
+ display: flex;
1269
+ align-items: center;
1270
+ justify-content: space-between;
1271
+ gap: 0.75rem;
1272
+ width: 100%;
1273
+ padding: 0.6875rem 0.875rem;
1274
+ font-size: 0.8125rem;
1275
+ line-height: 1.4;
1276
+ border-radius: 0.625rem;
1277
+ }
1278
+
1279
+ .vv-ai-chat__suggestion-icon {
1280
+ flex-shrink: 0;
1281
+ display: flex;
1282
+ }
1283
+
1284
+ .vv-ai-chat__suggestion-icon svg {
1285
+ width: auto;
1286
+ height: 0.625rem;
1287
+ }
1288
+
1289
+ .vv-ai-chat--window .vv-ai-chat__message {
1290
+ gap: 0.5rem;
1291
+ }
1292
+
1293
+ /* Room on the left for the avatar beside each answer, which the tool lines and cards line up with. */
1294
+ .vv-ai-chat--window .vv-ai-chat__message--assistant {
1295
+ padding-left: 2.125rem;
1296
+ }
1297
+
1298
+ .vv-ai-chat--window .vv-ai-chat__text {
1299
+ max-width: 17rem;
1300
+ padding: 0.625rem 0.875rem;
1301
+ font-size: 0.875rem;
1302
+ line-height: 1.5;
1303
+ }
1304
+
1305
+ .vv-ai-chat--window .vv-ai-chat__text p {
1306
+ margin-bottom: 0.5rem;
1307
+ line-height: 1.5;
1308
+ }
1309
+
1310
+ .vv-ai-chat--window .vv-ai-chat__text p:last-child {
1311
+ margin-bottom: 0;
1312
+ }
1313
+
1314
+ .vv-ai-chat--window .vv-ai-chat__message--user .vv-ai-chat__text {
1315
+ border-radius: var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) 0.25rem var(--vv-ai-radius-bubble);
1316
+ }
1317
+
1318
+ /* The assistant's answers, and what it says about a handover, in its bubbles beside its avatar. */
1319
+ .vv-ai-chat--window .vv-ai-chat__message--assistant .vv-ai-chat__text,
1320
+ .vv-ai-chat--window .vv-ai-chat__notice--connecting,
1321
+ .vv-ai-chat--window .vv-ai-chat__notice--closed,
1322
+ .vv-ai-chat--window .vv-ai-chat__notice--failed {
1323
+ position: relative;
1324
+ align-self: flex-start;
1325
+ padding: 0.625rem 0.875rem;
1326
+ background: var(--vv-ai-color-surface-muted);
1327
+ border-radius: var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) var(--vv-ai-radius-bubble) 0.25rem;
1328
+ }
1329
+
1330
+ .vv-ai-chat--window .vv-ai-chat__notice--connecting,
1331
+ .vv-ai-chat--window .vv-ai-chat__notice--closed,
1332
+ .vv-ai-chat--window .vv-ai-chat__notice--failed {
1333
+ max-width: 17rem;
1334
+ margin-left: 2.125rem;
1335
+ }
1336
+
1337
+ .vv-ai-chat--window .vv-ai-chat__message--assistant .vv-ai-chat__text::before,
1338
+ .vv-ai-chat--window .vv-ai-chat__notice--connecting::before,
1339
+ .vv-ai-chat--window .vv-ai-chat__notice--closed::before,
1340
+ .vv-ai-chat--window .vv-ai-chat__notice--failed::before {
1341
+ content: "";
1342
+ position: absolute;
1343
+ bottom: 0;
1344
+ left: -2.125rem;
1345
+ width: 1.625rem;
1346
+ height: 1.625rem;
1347
+ background: var(--vv-ai-color-accent) var(--vv-ai-chat-assistant-avatar) center / 0.875rem no-repeat;
1348
+ border-radius: 50%;
1349
+ }
1350
+
1351
+ .vv-ai-chat--window .vv-ai-chat__message--person {
1352
+ row-gap: 0.25rem;
1353
+ }
1354
+
1355
+ .vv-ai-chat--window .vv-ai-chat__message--person .vv-ai-chat__text {
1356
+ max-width: 17rem;
1357
+ }
1358
+
1359
+ .vv-ai-chat--window .vv-ai-chat__tool {
1360
+ padding: 0.3125rem 0.6875rem;
1361
+ font-size: 0.75rem;
1362
+ line-height: 1.4;
1363
+ }
1364
+
1365
+ .vv-ai-chat--window .vv-ai-chat__composer-inner {
1366
+ max-width: none;
1367
+ padding: 0.75rem 0.75rem 0.5rem;
1368
+ }
1369
+
1370
+ .vv-ai-chat--window .vv-ai-chat__prompt {
1371
+ border-radius: 0.75rem;
1372
+ box-shadow: none;
1373
+ }
1374
+
1375
+ .vv-ai-chat--window .vv-ai-chat__input {
1376
+ min-height: 2.875rem;
1377
+ max-height: 7.5rem;
1378
+ padding: 0.75rem 3rem 0.75rem 0.875rem;
1379
+ font-size: 0.875rem;
1380
+ line-height: 1.5;
1381
+ border-radius: 0.75rem;
1382
+ }
1383
+
1384
+ /* 16px keeps iOS from zooming in on focus. */
1385
+ @media (width < 36rem) {
1386
+ .vv-ai-chat--window .vv-ai-chat__input {
1387
+ font-size: 1rem;
1388
+ }
1389
+ }
1390
+
1391
+ .vv-ai-chat--window .vv-ai-chat__send {
1392
+ right: 0.375rem;
1393
+ bottom: 0.375rem;
1394
+ width: 2.125rem;
1395
+ height: 2.125rem;
1396
+ }
1397
+
1398
+ .vv-ai-chat--window .vv-ai-chat__send:disabled {
1399
+ background: var(--vv-ai-color-disabled);
1400
+ }
1401
+
1402
+ .vv-ai-chat--window .vv-ai-chat__send svg {
1403
+ width: 1rem;
1404
+ height: 1rem;
1405
+ }
1406
+
1407
+ /* Grey until there is something to send. */
1408
+ .vv-ai-chat--window .vv-ai-chat__prompt:has(.vv-ai-chat__input:placeholder-shown) .vv-ai-chat__send:not(.vv-ai-chat__send--stop) {
1409
+ background: var(--vv-ai-color-disabled);
1410
+ }
1411
+
1412
+ .vv-ai-chat--window .vv-ai-chat__send--stop svg {
1413
+ width: 0.75rem;
1414
+ height: 0.75rem;
1415
+ }
1416
+
1417
+ .vv-ai-chat--window .vv-ai-chat__disclaimer,
1418
+ .vv-ai-chat--window .vv-ai-chat__cancel {
1419
+ max-width: none;
1420
+ padding: 0 0.75rem 0.625rem;
1421
+ font-size: 0.6875rem;
1422
+ line-height: 1.4;
1423
+ }
1424
+
1425
+ @media (width < 36rem) {
1426
+ .vv-ai-chat--window .vv-ai-chat__disclaimer,
1427
+ .vv-ai-chat--window .vv-ai-chat__cancel {
1428
+ padding-bottom: max(0.625rem, env(safe-area-inset-bottom, 0px));
1429
+ }
1430
+ }
1431
+
1432
+ /* Both sides clear the logo in the corner, so the centred text stays centred. */
1433
+ .vv-ai-chat--window .vv-ai-chat__disclaimer {
1434
+ padding-inline: 2.5rem;
1435
+ }
1436
+
1437
+ .vv-ai-chat--window .vv-ai-chat__brand {
1438
+ right: 0.75rem;
1439
+ bottom: 0.6875rem;
1440
+ }
1441
+
1442
+ .vv-ai-chat--window .vv-ai-chat__brand svg {
1443
+ width: 1.125rem;
1444
+ }
1445
+
1446
+ @media (width < 36rem) {
1447
+ .vv-ai-chat--window .vv-ai-chat__brand {
1448
+ bottom: max(0.6875rem, env(safe-area-inset-bottom, 0px));
1449
+ }
1450
+ }
1451
+
1452
+ /* The footer ends the wait while no agent has taken the chat, and says who answers once one has. */
1453
+ .vv-ai-chat--window .vv-ai-chat__cancel {
1454
+ display: block;
1455
+ margin: 0 auto;
1456
+ color: var(--vv-ai-color-text-muted);
1457
+ background: none;
1458
+ border: 0;
1459
+ cursor: pointer;
1460
+ }
1461
+
1462
+ .vv-ai-chat--window .vv-ai-chat__cancel:hover,
1463
+ .vv-ai-chat--window .vv-ai-chat__cancel:focus-visible {
1464
+ color: var(--vv-ai-color-accent);
1465
+ text-decoration: underline;
1466
+ }
1467
+
1468
+ .vv-ai-chat--window[data-ai-chat-live] .vv-ai-chat__disclaimer:not(.vv-ai-chat__disclaimer--agent),
1469
+ .vv-ai-chat--window:not([data-ai-chat-live='agent']) .vv-ai-chat__disclaimer--agent,
1470
+ .vv-ai-chat--window[data-ai-chat-live='agent'] .vv-ai-chat__cancel {
1471
+ display: none;
1472
+ }
1473
+
1474
+ /*
1475
+ * The launcher: a round button in the window's corner, with a teaser above it on the first page of
1476
+ * a session. It pops in past full size and settles back, spinning a quarter turn; when the window
1477
+ * opens it winds up a little and spins away the other way. It sits over the window, so it is seen
1478
+ * shrinking away as the window opens on top of its corner.
1479
+ */
1480
+ .vv-ai-launcher {
1481
+ position: fixed;
1482
+ right: var(--vv-ai-chat-window-inset);
1483
+ bottom: var(--vv-ai-chat-window-inset);
1484
+ z-index: calc(var(--vv-ai-chat-window-z) + 1);
1485
+ display: flex;
1486
+ flex-direction: column;
1487
+ align-items: flex-end;
1488
+ gap: 0.875rem;
1489
+ }
1490
+
1491
+ .vv-ai-launcher__action {
1492
+ display: flex;
1493
+ align-items: center;
1494
+ justify-content: center;
1495
+ width: 3.5rem;
1496
+ height: 3.5rem;
1497
+ padding: 0;
1498
+ color: var(--vv-ai-color-on-accent);
1499
+ background: var(--vv-ai-color-accent);
1500
+ border: 0;
1501
+ border-radius: 50%;
1502
+ box-shadow: var(--vv-ai-launcher-shadow);
1503
+ cursor: pointer;
1504
+ transition:
1505
+ background-color 0.15s ease,
1506
+ scale 0.45s var(--vv-ai-launcher-spring),
1507
+ rotate 0.45s var(--vv-ai-launcher-spring),
1508
+ opacity 0.2s ease,
1509
+ display 0.45s allow-discrete;
1510
+ }
1511
+
1512
+ @starting-style {
1513
+ .vv-ai-launcher__action {
1514
+ scale: 0;
1515
+ rotate: -90deg;
1516
+ opacity: 0;
1517
+ }
1518
+ }
1519
+
1520
+ @media (min-width: 36rem) {
1521
+ .vv-ai-launcher__action {
1522
+ width: 3.75rem;
1523
+ height: 3.75rem;
1524
+ }
1525
+ }
1526
+
1527
+ /* Hover and focus both, to outrank a page's own link colours. */
1528
+ .vv-ai-launcher__action:hover,
1529
+ .vv-ai-launcher__action:focus-visible {
1530
+ color: var(--vv-ai-color-on-accent);
1531
+ background: var(--vv-ai-color-accent-hover);
1532
+ }
1533
+
1534
+ .vv-ai-launcher__action:focus-visible {
1535
+ outline: 2px solid var(--vv-ai-color-accent);
1536
+ outline-offset: 0.1875rem;
1537
+ }
1538
+
1539
+ .vv-ai-launcher__action[aria-expanded='true'] {
1540
+ display: none;
1541
+ scale: 0;
1542
+ rotate: 90deg;
1543
+ opacity: 0;
1544
+ transition-timing-function: ease, var(--vv-ai-launcher-wind-up), var(--vv-ai-launcher-wind-up), ease, linear;
1545
+ transition-delay: 0s, 0s, 0s, 0.25s, 0s;
1546
+ }
1547
+
1548
+ @media (prefers-reduced-motion: reduce) {
1549
+ .vv-ai-launcher__action {
1550
+ transition: background-color 0.15s ease;
1551
+ }
1552
+ }
1553
+
1554
+ .vv-ai-launcher__icon {
1555
+ display: flex;
1556
+ }
1557
+
1558
+ .vv-ai-launcher__icon svg {
1559
+ width: 1.625rem;
1560
+ height: 1.625rem;
1561
+ }
1562
+
1563
+ /* Not on phones, where it would cover the page. */
1564
+ .vv-ai-launcher__teaser {
1565
+ position: relative;
1566
+ display: none;
1567
+ max-width: 16.25rem;
1568
+ background: var(--vv-ai-color-surface);
1569
+ border-radius: 0.875rem 0.875rem 0.25rem 0.875rem;
1570
+ box-shadow: var(--vv-ai-launcher-teaser-shadow);
1571
+ }
1572
+
1573
+ @media (min-width: 36rem) {
1574
+ .vv-ai-launcher__teaser {
1575
+ display: block;
1576
+ }
1577
+ }
1578
+
1579
+ .vv-ai-launcher__teaser-open {
1580
+ display: flex;
1581
+ flex-direction: column;
1582
+ gap: 0.375rem;
1583
+ width: 100%;
1584
+ padding: 0.875rem 2.25rem 0.875rem 1rem;
1585
+ font-family: inherit;
1586
+ text-align: left;
1587
+ background: none;
1588
+ border: 0;
1589
+ border-radius: inherit;
1590
+ cursor: pointer;
1591
+ }
1592
+
1593
+ .vv-ai-launcher__teaser-title {
1594
+ font-size: 0.875rem;
1595
+ line-height: 1.3;
1596
+ font-weight: var(--vv-ai-font-weight-bold);
1597
+ color: var(--vv-ai-color-text);
1598
+ }
1599
+
1600
+ .vv-ai-launcher__teaser-text {
1601
+ font-size: 0.8125rem;
1602
+ line-height: 1.45;
1603
+ color: var(--vv-ai-color-text-muted);
1604
+ }
1605
+
1606
+ .vv-ai-launcher__teaser-dismiss {
1607
+ position: absolute;
1608
+ top: 0.375rem;
1609
+ right: 0.375rem;
1610
+ display: flex;
1611
+ align-items: center;
1612
+ justify-content: center;
1613
+ width: 1.75rem;
1614
+ height: 1.75rem;
1615
+ padding: 0;
1616
+ color: var(--vv-ai-color-text-subtle);
1617
+ background: none;
1618
+ border: 0;
1619
+ border-radius: var(--vv-ai-radius);
1620
+ cursor: pointer;
1621
+ }
1622
+
1623
+ .vv-ai-launcher__teaser-dismiss:hover {
1624
+ color: var(--vv-ai-color-text);
1625
+ background: var(--vv-ai-color-surface-subtle);
1626
+ }
1627
+
1628
+ .vv-ai-launcher__teaser-dismiss svg {
1629
+ width: 0.75rem;
1630
+ height: 0.75rem;
1631
+ }
1632
+
1633
+ /*
1634
+ * The form before a chat with a person starts, a card in the thread. Nested under the form so it
1635
+ * wins over a page's own input styles.
1636
+ */
1637
+ .vv-ai-survey {
1638
+ display: flex;
1639
+ flex-direction: column;
1640
+ gap: 0.75rem;
1641
+ width: 100%;
1642
+ padding: 1rem;
1643
+ background: var(--vv-ai-color-surface);
1644
+ border: 1px solid var(--vv-ai-color-border);
1645
+ border-radius: 0.75rem;
1646
+ }
1647
+
1648
+ .vv-ai-survey .vv-ai-survey__header {
1649
+ display: flex;
1650
+ flex-direction: column;
1651
+ gap: 0.25rem;
1652
+ }
1653
+
1654
+ .vv-ai-survey .vv-ai-survey__title {
1655
+ margin: 0;
1656
+ font-size: 0.9375rem;
1657
+ font-weight: var(--vv-ai-font-weight-bold);
1658
+ line-height: 1.3;
1659
+ color: var(--vv-ai-color-text);
1660
+ }
1661
+
1662
+ .vv-ai-survey .vv-ai-survey__intro {
1663
+ margin: 0;
1664
+ font-size: 0.75rem;
1665
+ line-height: 1.45;
1666
+ color: var(--vv-ai-color-text-muted);
1667
+ }
1668
+
1669
+ .vv-ai-survey .vv-ai-survey__field {
1670
+ display: flex;
1671
+ flex-direction: column;
1672
+ gap: 0.375rem;
1673
+ }
1674
+
1675
+ .vv-ai-survey .vv-ai-survey__label {
1676
+ font-size: 0.75rem;
1677
+ font-weight: var(--vv-ai-font-weight-bold);
1678
+ line-height: 1.4;
1679
+ color: var(--vv-ai-color-text);
1680
+ }
1681
+
1682
+ .vv-ai-survey .vv-ai-survey__label p {
1683
+ margin: 0;
1684
+ }
1685
+
1686
+ .vv-ai-survey .vv-ai-survey__label a {
1687
+ color: var(--vv-ai-color-accent);
1688
+ text-decoration: underline;
1689
+ }
1690
+
1691
+ .vv-ai-survey .vv-ai-survey__input {
1692
+ width: 100%;
1693
+ height: auto;
1694
+ padding: 0.5625rem 0.75rem;
1695
+ font-size: 0.8125rem;
1696
+ line-height: 1.4;
1697
+ color: var(--vv-ai-color-text);
1698
+ background-color: var(--vv-ai-color-surface);
1699
+ border: 1px solid var(--vv-ai-color-border);
1700
+ border-radius: 0.5rem;
1701
+ box-shadow: none;
1702
+ }
1703
+
1704
+ .vv-ai-survey .vv-ai-survey__input:focus-visible {
1705
+ outline: 2px solid var(--vv-ai-color-accent);
1706
+ outline-offset: 1px;
1707
+ }
1708
+
1709
+ .vv-ai-survey select.vv-ai-survey__input {
1710
+ padding-right: 2.125rem;
1711
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
1712
+ background-repeat: no-repeat;
1713
+ background-position: right 0.75rem center;
1714
+ }
1715
+
1716
+ .vv-ai-survey .vv-ai-survey__field--invalid .vv-ai-survey__input {
1717
+ border-color: var(--vv-ai-color-error);
1718
+ }
1719
+
1720
+ .vv-ai-survey .vv-ai-survey__prefilled {
1721
+ display: flex;
1722
+ align-items: center;
1723
+ gap: 0.25rem;
1724
+ margin: 0;
1725
+ font-size: 0.6875rem;
1726
+ line-height: 1.3;
1727
+ color: var(--vv-ai-color-success);
1728
+ }
1729
+
1730
+ .vv-ai-survey .vv-ai-survey__prefilled::before {
1731
+ content: "";
1732
+ width: 0.75rem;
1733
+ height: 0.75rem;
1734
+ background: currentColor;
1735
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
1736
+ }
1737
+
1738
+ /* The consent, a switch beside its text. */
1739
+ .vv-ai-survey .vv-ai-survey__field--toggle {
1740
+ display: grid;
1741
+ grid-template-columns: var(--vv-ai-survey-toggle-width, 2.125rem) 1fr;
1742
+ align-items: start;
1743
+ column-gap: 0.625rem;
1744
+ row-gap: 0.375rem;
1745
+ }
1746
+
1747
+ .vv-ai-survey .vv-ai-survey__field--toggle .vv-ai-survey__label {
1748
+ font-weight: normal;
1749
+ color: var(--vv-ai-color-text-muted);
1750
+ }
1751
+
1752
+ .vv-ai-survey .vv-ai-survey__field--toggle .vv-ai-survey__error {
1753
+ grid-column: 1 / -1;
1754
+ }
1755
+
1756
+ /*
1757
+ * The yes-or-no question as a switch. The input selector outweighs the rule for every survey
1758
+ * input, which would otherwise draw the switch as a text box.
1759
+ */
1760
+ .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"] {
1761
+ position: relative;
1762
+ flex-shrink: 0;
1763
+ width: var(--vv-ai-survey-toggle-width, 2.125rem);
1764
+ height: var(--vv-ai-survey-toggle-height, 1.25rem);
1765
+ margin: 0;
1766
+ padding: 0;
1767
+ cursor: pointer;
1768
+ appearance: none;
1769
+ background: var(--vv-ai-survey-toggle-off, var(--vv-ai-color-border-strong));
1770
+ border: 0;
1771
+ border-radius: calc(var(--vv-ai-survey-toggle-height, 1.25rem) / 2);
1772
+ transition: background-color 0.2s ease;
1773
+ }
1774
+
1775
+ .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]::after {
1776
+ content: "";
1777
+ position: absolute;
1778
+ top: var(--vv-ai-survey-toggle-inset, 0.125rem);
1779
+ left: var(--vv-ai-survey-toggle-inset, 0.125rem);
1780
+ width: calc(var(--vv-ai-survey-toggle-height, 1.25rem) - 2 * var(--vv-ai-survey-toggle-inset, 0.125rem));
1781
+ height: calc(var(--vv-ai-survey-toggle-height, 1.25rem) - 2 * var(--vv-ai-survey-toggle-inset, 0.125rem));
1782
+ background: var(--vv-ai-survey-toggle-knob, var(--vv-ai-color-surface));
1783
+ border-radius: 50%;
1784
+ transition: transform 0.2s ease;
1785
+ }
1786
+
1787
+ .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]:checked {
1788
+ background: var(--vv-ai-survey-toggle-on, var(--vv-ai-color-accent));
1789
+ }
1790
+
1791
+ .vv-ai-survey__field--toggle .vv-ai-survey__input[type="checkbox"]:checked::after {
1792
+ transform: translateX(calc(var(--vv-ai-survey-toggle-width, 2.125rem) - var(--vv-ai-survey-toggle-height, 1.25rem)));
1793
+ }
1794
+
1795
+ .vv-ai-survey .vv-ai-survey__field--invalid.vv-ai-survey__field--toggle .vv-ai-survey__input:not(:checked) {
1796
+ outline: 1px solid var(--vv-ai-color-error);
1797
+ }
1798
+
1799
+ .vv-ai-survey .vv-ai-survey__error {
1800
+ margin: 0;
1801
+ font-size: 0.6875rem;
1802
+ color: var(--vv-ai-color-error);
1803
+ }
1804
+
1805
+ .vv-ai-survey .vv-ai-survey__actions {
1806
+ display: flex;
1807
+ flex-direction: column;
1808
+ gap: 0.375rem;
1809
+ }
1810
+
1811
+ .vv-ai-survey .vv-ai-survey__submit {
1812
+ padding: 0.625rem 1rem;
1813
+ font-size: 0.875rem;
1814
+ font-weight: var(--vv-ai-font-weight-bold);
1815
+ color: var(--vv-ai-color-on-accent);
1816
+ background: var(--vv-ai-color-accent);
1817
+ border: 0;
1818
+ border-radius: 0.5rem;
1819
+ cursor: pointer;
1820
+ }
1821
+
1822
+ .vv-ai-survey .vv-ai-survey__submit:hover {
1823
+ background: var(--vv-ai-color-accent-hover);
1824
+ }
1825
+
1826
+ .vv-ai-survey .vv-ai-survey__submit:disabled {
1827
+ cursor: default;
1828
+ opacity: 0.6;
1829
+ }
1830
+
1831
+ .vv-ai-survey .vv-ai-survey__cancel {
1832
+ padding: 0.375rem;
1833
+ font-size: 0.75rem;
1834
+ color: var(--vv-ai-color-text-muted);
1835
+ background: none;
1836
+ border: 0;
1837
+ cursor: pointer;
1838
+ }
1839
+
1840
+ .vv-ai-survey .vv-ai-survey__cancel:hover {
1841
+ color: var(--vv-ai-color-text);
1842
+ }
1843
+
1844
+ .vv-ai-survey .vv-ai-survey__submit:focus-visible,
1845
+ .vv-ai-survey .vv-ai-survey__cancel:focus-visible {
1846
+ outline: 2px solid var(--vv-ai-color-accent);
1847
+ outline-offset: 2px;
1848
+ }
1849
+
1850
+ /*
1851
+ * Answer cards. The Markdown in __summary and __text is prose, styled by element as
1852
+ * .vv-ai-chat__text is. The headings, links and figures take the accent's darker shade.
1853
+ */
1854
+ .vv-ai-answer-card {
1855
+ display: flex;
1856
+ flex-direction: column;
1857
+ gap: 1.25rem;
1858
+ min-width: 0;
1859
+ padding: 1.25rem;
1860
+ font-size: 1rem;
1861
+ line-height: 1.625rem;
1862
+ color: var(--vv-ai-color-text);
1863
+ background: var(--vv-ai-color-surface);
1864
+ border: 1px solid var(--vv-ai-color-border);
1865
+ border-radius: var(--vv-ai-radius-l);
1866
+ overflow-wrap: anywhere;
1867
+ }
1868
+
1869
+ .vv-ai-answer-card__title {
1870
+ margin: 0;
1871
+ font-family: var(--vv-ai-font-heading);
1872
+ font-size: 1.375rem;
1873
+ line-height: 1.25;
1874
+ font-weight: var(--vv-ai-font-weight-bold);
1875
+ color: var(--vv-ai-color-accent-hover);
1876
+ }
1877
+
1878
+ @container vv-ai-chat-thread (min-width: 36rem) {
1879
+ .vv-ai-answer-card {
1880
+ padding: 1.875rem;
1881
+ }
1882
+
1883
+ .vv-ai-answer-card__title {
1884
+ font-size: 1.625rem;
1885
+ }
1886
+ }
1887
+
1888
+ .vv-ai-answer-card__section-title,
1889
+ .vv-ai-answer-card__sources-title {
1890
+ margin: 0;
1891
+ font-family: var(--vv-ai-font-heading);
1892
+ font-size: 1.125rem;
1893
+ line-height: 1.4;
1894
+ font-weight: var(--vv-ai-font-weight-bold);
1895
+ color: var(--vv-ai-color-accent-hover);
1896
+ }
1897
+
1898
+ .vv-ai-answer-card__summary p,
1899
+ .vv-ai-answer-card__text p {
1900
+ margin: 0 0 0.625rem;
1901
+ }
1902
+
1903
+ .vv-ai-answer-card__summary ul,
1904
+ .vv-ai-answer-card__summary ol,
1905
+ .vv-ai-answer-card__text ul,
1906
+ .vv-ai-answer-card__text ol {
1907
+ display: flex;
1908
+ flex-direction: column;
1909
+ gap: 0.625rem;
1910
+ margin: 0 0 0.625rem;
1911
+ padding-left: 1.25rem;
1912
+ }
1913
+
1914
+ .vv-ai-answer-card__summary ul,
1915
+ .vv-ai-answer-card__text ul {
1916
+ list-style: disc;
1917
+ }
1918
+
1919
+ .vv-ai-answer-card__summary ol,
1920
+ .vv-ai-answer-card__text ol {
1921
+ list-style: decimal;
1922
+ }
1923
+
1924
+ .vv-ai-answer-card__summary li,
1925
+ .vv-ai-answer-card__text li {
1926
+ padding-left: 0.25rem;
1927
+ }
1928
+
1929
+ .vv-ai-answer-card__summary li::marker,
1930
+ .vv-ai-answer-card__text li::marker {
1931
+ font-weight: var(--vv-ai-font-weight-bold);
1932
+ color: var(--vv-ai-color-accent-hover);
1933
+ }
1934
+
1935
+ .vv-ai-answer-card__summary a,
1936
+ .vv-ai-answer-card__text a {
1937
+ color: var(--vv-ai-color-accent-hover);
1938
+ text-decoration: underline;
1939
+ text-underline-offset: 0.1875rem;
1940
+ }
1941
+
1942
+ .vv-ai-answer-card__summary strong,
1943
+ .vv-ai-answer-card__text strong {
1944
+ font-weight: var(--vv-ai-font-weight-bold);
1945
+ }
1946
+
1947
+ .vv-ai-answer-card__summary > :last-child,
1948
+ .vv-ai-answer-card__text > :last-child {
1949
+ margin-bottom: 0;
1950
+ }
1951
+
1952
+ .vv-ai-answer-card__section,
1953
+ .vv-ai-answer-card__sources {
1954
+ display: flex;
1955
+ flex-direction: column;
1956
+ gap: 0.625rem;
1957
+ min-width: 0;
1958
+ }
1959
+
1960
+ .vv-ai-answer-card__section + .vv-ai-answer-card__section,
1961
+ .vv-ai-answer-card__section + .vv-ai-answer-card__details,
1962
+ .vv-ai-answer-card__details + .vv-ai-answer-card__section,
1963
+ .vv-ai-answer-card__details + .vv-ai-answer-card__details,
1964
+ .vv-ai-answer-card__sources {
1965
+ padding-top: 1.25rem;
1966
+ border-top: 1px solid var(--vv-ai-color-border);
1967
+ }
1968
+
1969
+ .vv-ai-answer-card__details .vv-ai-answer-card__section {
1970
+ padding-top: 0.625rem;
1971
+ }
1972
+
1973
+ .vv-ai-answer-card__details-summary {
1974
+ padding-block: 0.625rem;
1975
+ font-size: 0.875rem;
1976
+ line-height: 1.5rem;
1977
+ font-weight: var(--vv-ai-font-weight-bold);
1978
+ color: var(--vv-ai-color-accent-hover);
1979
+ cursor: pointer;
1980
+ }
1981
+
1982
+ .vv-ai-answer-card__facts {
1983
+ display: grid;
1984
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
1985
+ margin: 0;
1986
+ font-size: 0.875rem;
1987
+ line-height: 1.5rem;
1988
+ }
1989
+
1990
+ .vv-ai-answer-card__fact-label,
1991
+ .vv-ai-answer-card__fact-value {
1992
+ padding-block: 0.625rem;
1993
+ border-bottom: 1px solid var(--vv-ai-color-border);
1994
+ }
1995
+
1996
+ .vv-ai-answer-card__fact-label:nth-last-child(-n + 2),
1997
+ .vv-ai-answer-card__fact-value:nth-last-child(-n + 2) {
1998
+ border-bottom: 0;
1999
+ }
2000
+
2001
+ .vv-ai-answer-card__fact-label {
2002
+ font-weight: normal;
2003
+ color: var(--vv-ai-color-text-muted);
2004
+ }
2005
+
2006
+ .vv-ai-answer-card__fact-value {
2007
+ margin: 0;
2008
+ font-weight: var(--vv-ai-font-weight-bold);
2009
+ text-align: right;
2010
+ font-variant-numeric: tabular-nums;
2011
+ white-space: pre-line;
2012
+ }
2013
+
2014
+ /* The card's highlight: one headline figure rather than a row of facts. */
2015
+ .vv-ai-answer-card__highlight {
2016
+ display: flex;
2017
+ flex-direction: column;
2018
+ gap: 0.25rem;
2019
+ margin: 0;
2020
+ padding: 1.25rem;
2021
+ background: var(--vv-ai-color-surface-muted);
2022
+ border-radius: var(--vv-ai-radius);
2023
+ }
2024
+
2025
+ .vv-ai-answer-card__highlight .vv-ai-answer-card__fact-label,
2026
+ .vv-ai-answer-card__highlight .vv-ai-answer-card__fact-value {
2027
+ padding: 0;
2028
+ font-size: 0.875rem;
2029
+ line-height: 1.5rem;
2030
+ border: 0;
2031
+ }
2032
+
2033
+ .vv-ai-answer-card__highlight .vv-ai-answer-card__fact-value {
2034
+ font-family: var(--vv-ai-font-heading);
2035
+ font-size: 2rem;
2036
+ line-height: 1.2;
2037
+ color: var(--vv-ai-color-accent-hover);
2038
+ text-align: left;
2039
+ }
2040
+
2041
+ /* A wide table scrolls inside its own region, and the scroll does not carry on into the page. */
2042
+ .vv-ai-answer-card__table-region {
2043
+ max-width: 100%;
2044
+ overflow-x: auto;
2045
+ overscroll-behavior-x: contain;
2046
+ border: 1px solid var(--vv-ai-color-border);
2047
+ border-radius: var(--vv-ai-radius);
2048
+ }
2049
+
2050
+ .vv-ai-answer-card__table-region:focus-visible {
2051
+ outline: 2px solid var(--vv-ai-color-accent);
2052
+ outline-offset: 0.1875rem;
2053
+ }
2054
+
2055
+ .vv-ai-answer-card__table-hint {
2056
+ margin: 0;
2057
+ padding: 0.625rem;
2058
+ font-size: 0.875rem;
2059
+ line-height: 1.5rem;
2060
+ color: var(--vv-ai-color-text-muted);
2061
+ }
2062
+
2063
+ @container vv-ai-chat-thread (min-width: 36rem) {
2064
+ .vv-ai-answer-card__table-hint {
2065
+ display: none;
2066
+ }
2067
+ }
2068
+
2069
+ .vv-ai-answer-card__table {
2070
+ width: 100%;
2071
+ text-align: left;
2072
+ font-variant-numeric: tabular-nums;
2073
+ border: 0;
2074
+ border-collapse: collapse;
2075
+ }
2076
+
2077
+ .vv-ai-answer-card__table-header,
2078
+ .vv-ai-answer-card__table-cell {
2079
+ min-width: 6.875rem;
2080
+ padding: 0.625rem;
2081
+ font-size: 0.875rem;
2082
+ line-height: 1.5rem;
2083
+ vertical-align: top;
2084
+ white-space: pre-line;
2085
+ }
2086
+
2087
+ .vv-ai-answer-card__table-header {
2088
+ font-weight: var(--vv-ai-font-weight-bold);
2089
+ color: var(--vv-ai-color-accent-hover);
2090
+ background: var(--vv-ai-color-surface-muted);
2091
+ }
2092
+
2093
+ .vv-ai-answer-card__table-cell {
2094
+ font-weight: normal;
2095
+ }
2096
+
2097
+ .vv-ai-answer-card__links,
2098
+ .vv-ai-answer-card__actions,
2099
+ .vv-ai-answer-card__sources-list {
2100
+ display: flex;
2101
+ flex-wrap: wrap;
2102
+ gap: 0.625rem;
2103
+ margin: 0;
2104
+ padding: 0;
2105
+ list-style: none;
2106
+ }
2107
+
2108
+ .vv-ai-answer-card__links-item .vv-ai-answer-card__link,
2109
+ .vv-ai-answer-card__actions-item .vv-ai-answer-card__link {
2110
+ display: inline-flex;
2111
+ align-items: center;
2112
+ min-height: 2.75rem;
2113
+ padding: 0.625rem 1.25rem;
2114
+ font-size: 0.875rem;
2115
+ line-height: 1.5rem;
2116
+ font-weight: var(--vv-ai-font-weight-bold);
2117
+ color: var(--vv-ai-color-accent-hover);
2118
+ text-decoration: none;
2119
+ border: 1px solid var(--vv-ai-color-border);
2120
+ border-radius: var(--vv-ai-radius);
2121
+ }
2122
+
2123
+ .vv-ai-answer-card__links-item .vv-ai-answer-card__link:hover,
2124
+ .vv-ai-answer-card__actions-item .vv-ai-answer-card__link:hover {
2125
+ background: var(--vv-ai-color-surface-muted);
2126
+ border-color: var(--vv-ai-color-border-accent);
2127
+ }
2128
+
2129
+ .vv-ai-answer-card__actions-item:first-child .vv-ai-answer-card__link {
2130
+ color: var(--vv-ai-color-on-accent);
2131
+ background: var(--vv-ai-color-accent-hover);
2132
+ border-color: var(--vv-ai-color-accent-hover);
2133
+ }
2134
+
2135
+ .vv-ai-answer-card__actions-item:first-child .vv-ai-answer-card__link:hover {
2136
+ background: var(--vv-ai-color-accent);
2137
+ }
2138
+
2139
+ .vv-ai-answer-card__sources-list .vv-ai-answer-card__link {
2140
+ font-size: 0.875rem;
2141
+ line-height: 1.5rem;
2142
+ color: var(--vv-ai-color-text-muted);
2143
+ text-decoration: underline;
2144
+ text-underline-offset: 0.1875rem;
2145
+ }
2146
+
2147
+ .vv-ai-answer-card__sources-list .vv-ai-answer-card__link:hover {
2148
+ color: var(--vv-ai-color-accent-hover);
2149
+ }
2150
+
2151
+ /* Notes are plain text whose lines are separate notices. */
2152
+ .vv-ai-answer-card__note {
2153
+ margin: 0;
2154
+ padding-left: 1.25rem;
2155
+ font-size: 0.875rem;
2156
+ line-height: 1.5rem;
2157
+ color: var(--vv-ai-color-text-muted);
2158
+ white-space: pre-line;
2159
+ border-left: 2px solid var(--vv-ai-color-border-accent);
2160
+ }
2161
+
2162
+ .vv-ai-answer-card__source-note {
2163
+ margin: 0;
2164
+ font-size: 0.875rem;
2165
+ line-height: 1.5rem;
2166
+ color: var(--vv-ai-color-text-muted);
2167
+ }
2168
+
2169
+ /* The card drawn for a payload of plain fields: one block of facts per entry. */
2170
+ .vv-ai-answer-card__entries {
2171
+ display: flex;
2172
+ flex-direction: column;
2173
+ gap: 1.25rem;
2174
+ margin: 0;
2175
+ padding: 0;
2176
+ list-style: none;
2177
+ }
2178
+
2179
+ .vv-ai-answer-card__link:focus-visible,
2180
+ .vv-ai-answer-card__details-summary:focus-visible {
2181
+ outline: 2px solid var(--vv-ai-color-accent);
2182
+ outline-offset: 0.1875rem;
2183
+ }
2184
+
2185
+ @media (prefers-reduced-motion: reduce) {
2186
+ .vv-ai-chat__thread {
2187
+ scroll-behavior: auto;
2188
+ }
2189
+
181
2190
  .vv-ai-chat__tool-dot,
182
2191
  .vv-ai-chat__typing-dot {
183
2192
  animation: none;