File size: 31,846 Bytes
749845c
 
 
 
 
 
 
 
4946cad
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4299845
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
 
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4299845
 
 
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4299845
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
 
70cd94b
4946cad
 
 
 
 
 
70cd94b
4946cad
 
 
 
 
 
 
 
749845c
4946cad
 
749845c
 
 
4946cad
 
 
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
749845c
 
 
 
 
70cd94b
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70cd94b
749845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7eadbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4946cad
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
/* ==========================================================================
   OPSIOM — Interface de chat (v2 « Entrelacs »)
   Palette tirée du logo : prune profond, violet, orchidée, rose métallique.
   Thème clair par défaut, thème sombre via <html data-theme="dark">.
   Typographies : Instrument Serif (marque, titres) · Geist (interface) · Geist Mono (chiffres).
   ========================================================================== */

:root {
  --pop-rgb: 176,96,154; --red-rgb: 179,52,90; --green-rgb: 47,168,120; --amber-rgb: 201,138,30; --bg-rgb: 246,241,249;
  --bg: #F6F1F9;
  --side: #EDE5F3;
  --surface: #FFFFFF;
  --ink: #20102E;
  --ink2: #5B4A6E;
  --faint: #76668B;
  --line: rgba(48, 24, 72, .13);
  --hover: rgba(72, 24, 72, .07);
  --chip: rgba(72, 24, 72, .07);
  --ubg: #301848;
  --uink: #FFFFFF;
  --pop: #B0609A;
  --gtext: linear-gradient(100deg, #B0609A 0%, #5A2A82 100%);
  --grad: linear-gradient(135deg, #CF8FBF 0%, #8A52B0 50%, #4A2070 100%);
  --shadow: 0 14px 40px -14px rgba(72, 24, 72, .30), 0 1px 0 rgba(255, 255, 255, .9) inset;
  --code: #1E1030;
  --codeInk: #EDE4F5;
  --codeNote: #A890C0;
  --green: #2FA878;
  --amber: #C98A1E;
  --red: #B3345A;
  --ring: var(--pop);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --pop-rgb: 230,169,204; --red-rgb: 240,138,165; --green-rgb: 69,217,154; --amber-rgb: 240,197,106; --bg-rgb: 15,10,23;
  --bg: #0F0A17;
  --side: #140D1E;
  --surface: #1B1228;
  --ink: #F5EFFA;
  --ink2: #BBAECB;
  --faint: #9A8CAE;
  --line: rgba(255, 255, 255, .10);
  --hover: rgba(255, 255, 255, .06);
  --chip: rgba(255, 255, 255, .07);
  --ubg: #3A2262;
  --uink: #F5EFFA;
  --pop: #E6A9CC;
  --gtext: linear-gradient(100deg, #F0B5D6 0%, #A878D0 100%);
  --shadow: 0 18px 44px -14px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  --code: #0A0610;
  --codeNote: #9A86B3;
  --green: #45D99A;
  --amber: #F0C56A;
  --red: #F08AA5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--pop); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

.app-shell { display: flex; height: 100vh; height: 100dvh; }

/* ==========================================================================
   Sidebar
   ========================================================================== */
#sidebar {
  flex: 0 0 292px;
  width: 292px;
  height: 100%;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px 14px;
  min-height: 0;
}
#sidebar-backdrop { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 35; background: rgba(20, 8, 32, .5); }

#brand-row { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
#brand-mark { width: 34px; height: 34px; object-fit: contain; }
#brand-name { font-family: 'Instrument Serif', Georgia, serif; font-size: 30px; line-height: 1; letter-spacing: -.01em; flex: 1; }
#sidebar-close {
  display: none; width: 36px; height: 36px; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink2);
}
#sidebar-close:hover { background: var(--hover); }

#new-chat {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px;
  border: 0; border-radius: 14px; background: var(--ubg); color: var(--uink);
  font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow);
  transition: transform .2s, filter .2s;
}
#new-chat:hover { transform: translateY(-1px); filter: brightness(1.1); }
#new-chat span { flex: 1; text-align: left; }
#new-chat kbd {
  font-family: 'Geist Mono', monospace; font-size: 11px; opacity: .7;
  border: 1px solid currentColor; border-radius: 5px; padding: 1px 5px;
}

#history-search {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px;
  border-radius: 12px; background: var(--chip); color: var(--faint);
}
#history-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink);
}
#history-search input::placeholder { color: var(--faint); opacity: 1; }
#history-search:focus-within { outline: 2px solid var(--pop); outline-offset: 2px; }

#history { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#history-head { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
#history-title {
  font-family: 'Geist Mono', monospace; font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
#history-clear { border: 0; background: transparent; font-size: 12px; color: var(--faint); padding: 2px 4px; border-radius: 6px; }
#history-clear:hover { color: var(--red); }
#history-list {
  list-style: none; margin: 0 -4px; padding: 0 4px; flex: 0 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
#history-empty { margin: 0; padding: 4px 10px; font-size: 13px; line-height: 1.5; color: var(--faint); }

.history-item { position: relative; display: flex; align-items: center; border-radius: 10px; }
.history-item:hover { background: var(--hover); }
.history-item.active { background: var(--hover); }
.history-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; font-size: 14px; line-height: 1.3;
  color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-open::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: transparent;
}
.history-item.active .history-open { color: var(--ink); font-weight: 500; }
.history-item.active .history-open::before { background: var(--pop); }
.history-delete {
  flex: none; width: 30px; height: 30px; margin-right: 4px; border: 0; border-radius: 8px;
  background: transparent; color: var(--faint); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.history-item:hover .history-delete, .history-delete:focus-visible { opacity: 1; }
.history-delete:hover { color: var(--red); background: var(--hover); }
@media (hover: none) { .history-delete { opacity: 1; } }

/* Statut */
#system-card { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; font-size: 12.5px; color: var(--ink2); }
#status-line { display: flex; align-items: center; gap: 8px; }
.status-detail { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; }
.status-detail span:empty, .status-detail:has(span:empty) { display: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-pending { background: var(--faint); animation: pulse 1.4s infinite; }
.dot-online { background: var(--green); box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.25); }
.dot-offline { background: var(--red); box-shadow: 0 0 0 3px rgba(var(--red-rgb), 0.25); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* Quota : anneau */
#quota-card {
  --pct: 0;
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .2s;
}
#quota-card:hover { border-color: var(--pop); }
#quota-card:has(#quota-bar-fill.warn) { --ring: var(--amber); }
#quota-card:has(#quota-bar-fill.empty) { --ring: var(--red); }
#quota-ring {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--chip) 0);
  -webkit-mask: radial-gradient(circle, transparent 14.5px, #000 15px);
          mask: radial-gradient(circle, transparent 14.5px, #000 15px);
  transition: background .4s;
}
#quota-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
#quota-row { display: block; }
#quota-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink2); }
#quota-count { font-family: 'Geist Mono', monospace; font-size: 15px; color: var(--ink); }
#quota-count #quota-limit { color: var(--faint); }
#quota-count #quota-limit::before { content: " / "; }
#quota-bar-track { display: none; }

/* Plan */
#plan-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 4px; text-decoration: none; color: var(--ink2); font-size: 12.5px;
}
#plan-badge, #lab-badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--chip); color: var(--ink); font-size: 12px; font-weight: 500;
}
#plan-next-hint { color: var(--pop); font-weight: 500; }
#plan-card:hover #plan-next-hint { text-decoration: underline; }

/* Détails repliables (CLI, promo, admin) */
.sidebar-details { border-radius: 10px; font-size: 13.5px; color: var(--ink2); }
.sidebar-details summary {
  list-style: none; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.sidebar-details summary::-webkit-details-marker { display: none; }
.sidebar-details summary:hover { background: var(--hover); }
.sidebar-details summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s; margin: 0 3px 0 1px; opacity: .7;
}
.sidebar-details[open] summary::before { transform: rotate(45deg); }
.cli-promo-text { margin: 4px 10px 10px; font-size: 12.5px; line-height: 1.5; color: var(--faint); }
.cli-promo-code {
  display: flex; align-items: center; gap: 8px; margin: 0 6px 8px; padding: 8px 8px 8px 12px;
  border-radius: 10px; background: var(--code); color: var(--codeInk);
}
.cli-promo-code code { flex: 1; min-width: 0; font-family: 'Geist Mono', monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-promo-code em { font-style: normal; color: var(--codeNote); }
.cli-copy-btn { border: 0; background: transparent; color: #C9B8DC; width: 28px; height: 28px; border-radius: 7px; font-size: 14px; }
.cli-copy-btn:hover { background: rgba(255, 255, 255, .1); }
.cli-copy-btn.copied { color: #45D99A; }
.cli-promo-link { display: block; margin: 0 10px 8px; font-size: 13px; color: var(--pop); text-decoration: none; font-weight: 500; }
.cli-promo-link:hover { text-decoration: underline; }

#account-row { display: flex; align-items: center; gap: 11px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.avatar-chip {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none;
}
#account-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#logout-link { font-size: 12.5px; color: var(--faint); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
#logout-link:hover { background: var(--hover); color: var(--ink); }
.version-tag { display: none; }

/* ==========================================================================
   Panneau principal
   ========================================================================== */
#main-panel { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; position: relative; }

#topbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 28px; position: relative; z-index: 5; }
#topbar-left { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 12px; }
#sidebar-open {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink2); align-items: center; justify-content: center; flex: none;
}
#topbar-title { margin: 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- Bouton « + » : modèles (24M / 45M / 200M) et modes, dans un panneau ---- */
#plus-wrap { position: relative; }
#plus-toggle.plus-btn { width: auto; min-width: 40px; height: 40px; margin-bottom: 3px; padding: 0 12px; gap: 8px; border-radius: 20px; }   /* après .icon-btn : voir sa spécificité */
.plus-btn svg { flex: none; transition: transform .2s ease; }
.plus-btn[aria-expanded="true"] svg { transform: rotate(45deg); }
#plus-current { font-family: 'Geist Mono', monospace; font-size: 11.5px; color: var(--faint); }
#plus-current:empty { display: none; }
.plus-btn.is-mode #plus-current { color: var(--ink); }
#plus-panel {
  position: absolute; left: -4px; bottom: 68px; width: 270px; z-index: 20; padding: 12px;   /* s'ouvre vers le haut, au-dessus de la barre de saisie */
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; animation: rise .25s cubic-bezier(.2, .8, .2, 1) both;
}
#plus-panel[hidden] { display: none; }
.plus-title { margin: 2px 6px 0; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.plus-sep { width: 100%; height: 0; margin: 6px 0 2px; border: 0; border-top: 1px solid var(--line); }
#model-picker, #mode-picker { display: flex; flex-direction: column; gap: 2px; }
#model-picker[hidden], #mode-picker[hidden], .plus-sep[hidden], .plus-title[hidden] { display: none; }
.model-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 40px; padding: 0 12px;
  border: 0; border-radius: 11px; background: transparent; color: var(--ink2); font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .2s, color .2s;
}
.model-btn small { font-family: 'Geist Mono', monospace; font-size: 10.5px; opacity: .65; }
.model-btn:hover { background: var(--hover); color: var(--ink); }
.model-btn.active { background: var(--chip); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.model-btn.active small { opacity: .85; }

.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink2); display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
#theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: none; }

#settings-wrap { position: relative; }
#settings-panel {
  position: absolute; right: 0; top: 50px; width: 320px; z-index: 20; padding: 18px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; animation: rise .25s cubic-bezier(.2, .8, .2, 1) both;
}
#settings-panel-title { margin: 0; font-size: 14.5px; font-weight: 600; }
#settings-panel-hint { margin: 3px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--faint); }
.settings-row { display: flex; flex-direction: column; gap: 7px; }
.settings-row label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink2); }
.settings-val { font-family: 'Geist Mono', monospace; color: var(--ink); }
.settings-row input[type="range"] { width: 100%; accent-color: #9060A8; }
#settings-reset {
  align-self: flex-start; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; font-size: 13px; color: var(--ink2);
}
#settings-reset:hover { background: var(--hover); }

/* ---- Conversation ---- */
#conversation {
  flex: 1; min-height: 0; overflow-y: auto; position: relative;
  display: flex; flex-direction: column; gap: 32px;
  padding: 12px max(28px, calc((100% - 780px) / 2)) 40px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}

.bubble { position: relative; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.bubble.user {
  align-self: flex-end; max-width: 78%; padding: 13px 18px; border-radius: 22px 22px 6px 22px;
  background: var(--ubg); color: var(--uink); font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble.user .msg-action-btn {
  position: absolute; right: 100%; top: 50%; margin: -17px 8px 0 0;
}

.bubble.assistant {
  align-self: stretch; padding-left: 50px; font-size: 16.5px; line-height: 1.7; color: var(--ink);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; overflow-wrap: anywhere;
}
.bubble.assistant::before {
  content: ""; position: absolute; left: 0; top: -3px; width: 34px; height: 34px;
  background: url("../img/logo.png") center / contain no-repeat;
}
.bubble.assistant.notice::before { filter: grayscale(1) opacity(.45); }
.bubble.assistant.notice .msg-content { color: var(--ink2); font-style: italic; }
.bubble.assistant.error::before { filter: grayscale(1) opacity(.45); }
.bubble.assistant.error .msg-content { color: var(--red); }

.msg-content { flex: 0 0 100%; min-width: 0; }
.msg-content p { margin: 0 0 14px; }
.msg-content > *:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; }
.msg-content code {
  font-family: 'Geist Mono', monospace; font-size: .88em; background: var(--chip);
  padding: 2px 6px; border-radius: 6px;
}
.msg-content pre {
  margin: 0 0 14px; padding: 14px 16px; border-radius: 16px; background: var(--code);
  border: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin;
}
.msg-content pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.75; color: var(--codeInk); }
.msg-content ul, .msg-content ol { margin: 0 0 14px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; counter-reset: li; }
.msg-content li { position: relative; padding-left: 20px; margin: 0; }
.msg-content ul > li::before {
  content: ""; position: absolute; left: 0; top: .72em; width: 7px; height: 7px; border-radius: 50%; background: var(--grad);
}
.msg-content ol > li { counter-increment: li; }
.msg-content ol > li::before {
  content: counter(li) "."; position: absolute; left: 0; top: 0; font-family: 'Geist Mono', monospace; font-size: .85em; color: var(--pop);
}

.bubble-meta { font-family: 'Geist Mono', monospace; font-size: 11.5px; color: var(--faint); margin-right: 10px; margin-top: 2px; }
.msg-action-btn {
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--faint);
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s, background .2s;
}
.bubble:hover .msg-action-btn, .msg-action-btn:focus-visible { opacity: 1; }
.msg-action-btn:hover { background: var(--hover); color: var(--ink); }
.msg-action-btn.copied { color: var(--green); opacity: 1; }
@media (hover: none) { .msg-action-btn { opacity: 1; } }
#conversation.is-sending .msg-action-btn { pointer-events: none; opacity: 0; }

/* Réflexion : le nœud d'anneaux tourne */
.bubble.assistant.thinking { align-items: center; flex-wrap: nowrap; gap: 14px; padding-left: 0; }
.bubble.assistant.thinking::before { display: none; }
.wave {
  position: relative; flex: none; width: 34px; height: 34px; animation: spin 2.6s linear infinite;
}
.wave i, .wave::before, .wave::after {
  content: ""; position: absolute; left: 1px; right: 1px; top: 50%; height: 40%; margin-top: -20%;
  border: 1.4px solid var(--pop); border-radius: 50%; background: none;
}
.wave::before { transform: rotate(60deg); opacity: .75; }
.wave::after { transform: rotate(120deg); opacity: .5; }
.wave i { opacity: 1; }
.wave i:nth-child(n+2) { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.wave.wave-sm { width: 16px; height: 16px; margin: 6px 0 0 4px; flex: 0 0 auto; display: inline-block; animation-duration: 1.8s; }
.wave.wave-sm i, .wave.wave-sm::before, .wave.wave-sm::after { border-width: 1px; }
.typing-wave { flex: 0 0 100%; width: 16px; }

.think-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.think-text {
  font-size: 15.5px; animation: think-fade .4s ease-out;
  background: linear-gradient(90deg, var(--faint) 0%, var(--ink) 50%, var(--faint) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: think-fade .4s ease-out, shimmer 2.2s linear infinite;
}
.think-meta { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--faint); }
@keyframes think-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Accueil ---- */
#placeholder {
  margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 30px; padding: 12px 0;
}
.ph-hero { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
.ph-logo { width: 132px; height: 132px; object-fit: contain; filter: drop-shadow(0 22px 28px rgba(72, 24, 100, .35)); animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
#placeholder h2 {
  margin: 0; max-width: 760px; font-family: 'Instrument Serif', Georgia, serif; font-weight: 400;
  font-size: clamp(38px, 5vw, 60px); line-height: 1.04; letter-spacing: -.02em;
}
#placeholder h2 em { font-style: italic; }
#placeholder h2 em .w {
  background: var(--gtext); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .06em;
}
#placeholder p { margin: 0; max-width: 480px; font-size: 17px; line-height: 1.55; color: var(--ink2); }
.ph-cards { width: 100%; max-width: 760px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.suggestion {
  display: flex; gap: 14px; text-align: left; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), border-color .2s, box-shadow .25s;
}
.suggestion:nth-child(1) { animation-delay: .9s; } .suggestion:nth-child(2) { animation-delay: 1s; }
.suggestion:nth-child(3) { animation-delay: 1.1s; } .suggestion:nth-child(4) { animation-delay: 1.2s; }
.suggestion:hover { transform: translateY(-3px); border-color: var(--pop); box-shadow: var(--shadow); }
.sg-ico { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--chip); color: var(--pop); display: flex; align-items: center; justify-content: center; }
.sg-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sg-title { font-size: 15px; font-weight: 500; }
.sg-hint { font-size: 13.5px; line-height: 1.45; color: var(--ink2); }

/* Apparition des mots (utilisé par words.js) */
.w {
  display: inline-block; opacity: 0; transform: translateY(10px); filter: blur(6px);
  animation: word-in .7s cubic-bezier(.2, .7, .2, 1) forwards; animation-delay: var(--d, 0ms);
}
@keyframes word-in { to { opacity: 1; transform: none; filter: blur(0); } }

/* ---- Bandeau quota ---- */
.flash {
  margin: 0 auto 8px; width: calc(100% - 56px); max-width: 780px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; border: 1px solid transparent;
}
.flash.error { background: rgba(var(--red-rgb), 0.1)); border-color: rgba(var(--red-rgb), 0.35); color: var(--ink); }
#quota-banner-info { border: 0; background: transparent; color: var(--pop); font-weight: 500; font-size: 13px; text-decoration: underline; white-space: nowrap; }

/* ---- Composer ---- */
#composer-wrap { flex: none; padding: 6px 28px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#composer-row {
  width: 100%; max-width: 780px; display: flex; align-items: flex-end; gap: 10px; padding: 12px 12px 12px 12px;
  border-radius: 28px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .2s;
}
#composer-row:focus-within { border-color: var(--pop); }
#msg-input {
  flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit;
  font-size: 16.5px; line-height: 1.55; color: var(--ink); padding: 9px 0; max-height: 140px; overflow-y: auto;
}
#msg-input::placeholder { color: var(--faint); opacity: 1; }
#send-btn {
  flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; transition: transform .2s, filter .2s, opacity .2s;
}
#send-btn:hover:not(:disabled) { transform: scale(1.06); filter: brightness(1.08); }
#send-btn:disabled { background: var(--chip); color: var(--faint); cursor: not-allowed; }
.disclaimer { margin: 0; font-size: 12px; color: var(--faint); text-align: center; }

/* ---- Fenêtre quota ---- */
#quota-modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 8, 32, .55); backdrop-filter: blur(6px); animation: fade-in .2s both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
#quota-modal {
  position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; padding: 28px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 40px 90px -20px rgba(20, 8, 32, .6);
  animation: rise .3s cubic-bezier(.2, .8, .2, 1) both;
}
#quota-modal-close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: var(--faint); display: flex; align-items: center; justify-content: center;
}
#quota-modal-close:hover { background: var(--hover); color: var(--ink); }
#quota-modal-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--chip); color: var(--pop); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
#quota-modal-title { margin: 0 0 6px; font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 30px; letter-spacing: -.01em; }
#quota-modal-lead { margin: 0 0 20px; font-size: 14.5px; line-height: 1.55; color: var(--ink2); }
#quota-modal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quota-modal-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--chip); }
.quota-modal-stat span { font-size: 12px; color: var(--faint); }
.quota-modal-stat strong { font-family: 'Geist Mono', monospace; font-size: 18px; font-weight: 500; }
#quota-modal-bar-track { height: 8px; border-radius: 99px; background: var(--chip); overflow: hidden; margin-bottom: 18px; }
#quota-modal-bar-fill { height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width .5s; }
#quota-modal-bar-fill.warn { background: var(--amber); }
#quota-modal-bar-fill.empty { background: var(--red); }
#quota-modal-list { margin: 0 0 20px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink2); }
#quota-modal-list code { font-family: 'Geist Mono', monospace; font-size: .9em; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
#quota-modal-cta {
  display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 14px; background: var(--ubg); color: var(--uink);
  font-size: 14.5px; font-weight: 500; text-decoration: none;
}
#quota-modal-cta:hover { filter: brightness(1.1); }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 880px) {
  #sidebar-open { display: flex; }
  #sidebar-close { display: flex; }
  #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(320px, 86vw);
    box-shadow: 24px 0 60px rgba(20, 8, 32, .35); transform: translateX(-100%); transition: transform .22s ease; overflow-y: auto;
  }
  #sidebar.is-open { transform: translateX(0); }
  body.sidebar-open #sidebar-backdrop { display: block; }
  #topbar { padding: 12px 16px; }
  #topbar-controls { width: 100%; flex-wrap: nowrap; gap: 8px; }
  #plus-panel { width: min(270px, calc(100vw - 44px)); }
  #conversation { padding: 8px 16px 32px; gap: 26px; }
  #composer-wrap { padding: 6px 14px 12px; }
  .bubble.user { max-width: 86%; }
  .bubble.assistant { padding-left: 42px; font-size: 16px; }
  .bubble.assistant::before { width: 30px; height: 30px; }
  .bubble.user .msg-action-btn { display: none; }
  .ph-cards { grid-template-columns: 1fr; }
  .ph-logo { width: 96px; height: 96px; }
  #settings-panel { position: fixed; left: 16px; right: 16px; top: 120px; width: auto; }
  .flash { width: calc(100% - 28px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .w { opacity: 1; transform: none; filter: none; }
}

/* Compte illimité : pas de « / » devant une limite vide */
#quota-count #quota-limit:empty::before { content: none; }

/* ==========================================================================
   Correctifs sidebar : plus aucun chevauchement, défilement si l'écran est court
   ========================================================================== */
#sidebar { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#sidebar > * { flex: none; }
#sidebar > #history { flex: 1 1 auto; min-height: 150px; }
#history-list { flex: 1 1 auto; min-height: 0; }
#system-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 3px 12px; }
#status-line, .status-detail { flex: none; }
#quota-card { padding: 10px 12px; gap: 12px; }
#quota-ring { width: 40px; height: 40px; -webkit-mask: radial-gradient(circle, transparent 12px, #000 12.5px); mask: radial-gradient(circle, transparent 12px, #000 12.5px); }

/* Badges, résumés et liens avec icônes */
#plan-badge, #lab-badge { gap: 6px; }
#plan-next-hint { display: inline-flex; align-items: center; gap: 4px; }
.sidebar-details summary { gap: 10px; }
.sidebar-details summary .ic { opacity: .8; }
.sidebar-details summary::before { order: 3; margin: 0 4px 0 auto; }
.cli-promo-link { display: inline-flex; align-items: center; gap: 6px; }
#logout-link { display: inline-flex; align-items: center; gap: 7px; }
#quota-modal-cta { gap: 8px; }
.cli-copy-btn { display: flex; align-items: center; justify-content: center; }
#history-list:empty { display: none; }

/* Modèles en cours de chargement côté serveur : sélecteur grisé, réessai automatique */
#model-picker.pending { opacity: .55; pointer-events: none; }