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

:root {
  --font-ui: "Segoe UI Variable", "Segoe UI", -apple-system, "Inter", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .08), 0 4px 16px rgb(0 0 0 / .10);
  --shadow-2: 0 8px 40px rgb(0 0 0 / .35);
  --sidebar-w: 280px;
  --content-w: 50rem;
}

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0c;
  --bg-raised: #141412;
  --bg-hover: #1d1d19;
  --bg-active: #24241f;
  --surface: #171715;
  --surface-2: #1e1e1a;
  --border: #2b2b25;
  --border-strong: #3b3b33;
  --text: #f2efe2;
  --text-2: #b8b5a4;
  --text-3: #807d6f;
  --cream: #f2efe2;
  --accent: #f2efe2;          /* primary action = cream on dark */
  --accent-ink: #12120e;       /* text on accent */
  --accent-soft: rgb(242 239 226 / .10);
  --gold: #d9c887;
  --danger: #ef5f66;
  --danger-soft: rgb(239 95 102 / .12);
  --ok: #64c088;
  --code-bg: #111110;
  --code-header: #1a1a17;
  --sel: rgb(217 200 135 / .25);
  --sy-key: #d8a657; --sy-str: #a9b665; --sy-num: #d3869b; --sy-com: #83816f;
  --sy-fn: #7daea3;  --sy-tag: #ea6962; --sy-attr: #d8a657; --sy-punc: #9d9a8a;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f3;
  --bg-raised: #f3f1e8;
  --bg-hover: #edebdf;
  --bg-active: #e5e2d3;
  --surface: #ffffff;
  --surface-2: #f6f4ec;
  --border: #e0ddcf;
  --border-strong: #c9c5b2;
  --text: #191912;
  --text-2: #5c5a4c;
  --text-3: #8f8c7b;
  --cream: #f2efe2;
  --accent: #191912;           /* primary action = black on light */
  --accent-ink: #f5f2e5;
  --accent-soft: rgb(25 25 18 / .07);
  --gold: #93803d;
  --danger: #d13438;
  --danger-soft: rgb(209 52 56 / .10);
  --ok: #1f7a46;
  --code-bg: #f4f2e9;
  --code-header: #eceadd;
  --sel: rgb(147 128 61 / .22);
  --shadow-1: 0 1px 2px rgb(40 38 25 / .06), 0 4px 14px rgb(40 38 25 / .08);
  --shadow-2: 0 8px 40px rgb(40 38 25 / .18);
  --sy-key: #9a6c00; --sy-str: #587028; --sy-num: #a3446f; --sy-com: #9a977f;
  --sy-fn: #2f7a6d;  --sy-tag: #bb4a3f; --sy-attr: #9a6c00; --sy-punc: #6f6c5a;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--sel); }

/* ---------- custom scrollbars (whole app) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; border: 2px solid transparent; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-s);
  border: 1px solid transparent; background: transparent; color: var(--text);
  cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .05s ease, opacity .12s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-outline { border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-danger { color: var(--danger); border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { padding: 7px; border-radius: var(--radius-s); line-height: 0; }

.icon { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.8; fill: none;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); color: var(--text); outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 86px; font-family: inherit; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 18px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--bg-raised); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 99px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.chip.ok .dot { background: var(--ok); }
.chip.bad .dot { background: var(--danger); }

.badge { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
         padding: 2px 8px; border-radius: 5px; background: var(--accent-soft); color: var(--text-2); }

.switch { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--bg-active);
            border: 1px solid var(--border-strong); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
                   border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); background: var(--accent-ink); }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--gold);
  box-shadow: var(--shadow-1); border-radius: var(--radius-s);
  padding: 10px 14px; font-size: 13.5px; max-width: 340px;
  animation: toast-in .18s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgb(0 0 0 / .55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-m); box-shadow: var(--shadow-2);
  width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  animation: pop-in .16s ease;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
.modal.modal-lg { width: min(1060px, 100%); height: min(760px, 92vh); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px;
              border-bottom: 1px solid var(--border); font-weight: 700; }
.modal-head .spacer, .spacer { flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border);
              display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   Auth screen
   ============================================================ */
#auth-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.auth-card { width: min(400px, 100%); text-align: center; }
.auth-card .logo-mark { width: 84px; height: 84px; margin: 0 auto 6px; display: block; }
.auth-card h1 { font-size: 26px; margin: 6px 0 2px; letter-spacing: -.3px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 26px; font-size: 14px; }
.auth-box { text-align: left; }
.auth-tabs { display: flex; background: var(--bg-raised); border: 1px solid var(--border);
             border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 8px; border: 0; background: transparent; border-radius: 8px;
  cursor: pointer; font-weight: 600; color: var(--text-2);
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.auth-box .btn-primary { width: 100%; padding: 11px; margin-top: 6px; font-size: 14.5px; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.auth-alt { text-align: center; margin-top: 4px; }
.auth-link { color: var(--text-2); font-weight: 500; font-size: 12.5px; padding: 4px 8px; }
.auth-link:hover { color: var(--text); background: transparent; text-decoration: underline; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3);
                font-size: 12px; margin: 12px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn { width: 100%; padding: 10px; border: 1px solid var(--border-strong);
              background: var(--surface); font-weight: 600; }
.google-btn:hover { background: var(--bg-hover); }

/* ============================================================
   App shell
   ============================================================ */
#app-view { display: none; height: 100vh; }
#app-view.on { display: flex; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column;
  background: var(--bg-raised); border-right: 1px solid var(--border);
  transition: margin-left .18s ease;
}
.sidebar.hidden { margin-left: calc(-1 * var(--sidebar-w)); }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; }
.sb-head img { width: 30px; height: 30px; border-radius: 8px; }
.sb-head .name { font-weight: 800; letter-spacing: -.2px; font-size: 16px; }
.sb-new {
  margin: 8px 12px; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: transparent; cursor: pointer; font-weight: 600; color: var(--text);
}
.sb-new:hover { background: var(--bg-hover); }
.sb-search { position: relative; margin: 2px 12px 8px; }
.sb-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
                   width: 15px; height: 15px; color: var(--text-3); }
.sb-search input {
  width: 100%; padding: 7px 10px 7px 32px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border); outline: none;
  font-size: 13.5px;
}
.sb-search input:focus { border-color: var(--border-strong); }
.sb-list { flex: 1; overflow-y: auto; padding: 2px 8px 10px; }
.sb-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
            color: var(--text-3); padding: 12px 8px 4px; }
.conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; position: relative;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text); }
.conv-item.active { background: var(--bg-active); color: var(--text); }
.conv-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .pin { color: var(--gold); width: 13px; height: 13px; }
.conv-item .more { opacity: 0; padding: 3px; border-radius: 6px; border: 0; background: transparent;
                   cursor: pointer; color: var(--text-3); line-height: 0; }
.conv-item:hover .more { opacity: 1; }
.conv-item .more:hover { background: var(--bg-active); color: var(--text); }
.sb-foot { border-top: 1px solid var(--border); padding: 10px 12px; }
.sb-user { display: flex; align-items: center; gap: 10px; width: 100%;
           padding: 7px 9px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; }
.sb-user:hover { background: var(--bg-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.modo-mark { font-size: 12px; color: var(--text-3); margin: -18px 0 22px; }
.modo-mark a { color: var(--gold); text-decoration: none; font-weight: 600; }
.modo-mark a:hover { text-decoration: underline; }
.sb-user .who { flex: 1; text-align: left; min-width: 0; }
.sb-user .who .u { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .who .e { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  position: fixed; z-index: 250; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); box-shadow: var(--shadow-2); padding: 5px;
  animation: pop-in .12s ease;
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; border-radius: 7px;
  cursor: pointer; font-size: 13.5px; color: var(--text); text-align: left;
}
.menu button:hover { background: var(--bg-hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }

/* ---------- main column ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  position: relative; z-index: 5;
}
.mode-pills { display: flex; background: var(--bg-raised); border: 1px solid var(--border);
              border-radius: 99px; padding: 3px; gap: 2px; }
.mode-pills button {
  padding: 5px 13px; border: 0; border-radius: 99px; background: transparent;
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.mode-pills button.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- thread ---------- */
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread-inner { max-width: var(--content-w); margin: 0 auto; padding: 26px 20px 10px; }

.empty-state { text-align: center; padding: 9vh 20px 0; }
.empty-state img { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 14px; }
.empty-state h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.3px; }
.empty-state p { color: var(--text-2); margin: 0 0 24px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
               gap: 10px; max-width: 620px; margin: 0 auto; }
.suggestions button {
  text-align: left; padding: 12px 14px; border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 13.5px; color: var(--text-2); line-height: 1.4;
}
.suggestions button:hover { border-color: var(--border-strong); color: var(--text); }
.suggestions b { display: block; color: var(--text); margin-bottom: 2px; }

.msg { display: flex; gap: 12px; margin-bottom: 26px; }
.msg .m-avatar { margin-top: 2px; }
.msg .m-avatar img { width: 28px; height: 28px; border-radius: 8px; display: block; }
.msg .m-body { flex: 1; min-width: 0; }
.msg .m-name { font-weight: 700; font-size: 13px; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; }
.msg .m-name .meta { font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.msg.user .m-content {
  background: var(--bg-active); border-radius: var(--radius-m);
  padding: 10px 14px; display: inline-block; max-width: 100%;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.msg .m-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .12s; }
.msg:hover .m-actions, .msg .m-actions.stay { opacity: 1; }
.m-actions .btn-icon { color: var(--text-3); }
.m-actions .btn-icon:hover { color: var(--text); background: var(--bg-hover); }
.m-actions .btn-icon.sel-up { color: var(--ok); }
.m-actions .btn-icon.sel-down { color: var(--danger); }

.cursor-blink {
  display: inline-block; width: 8px; height: 15px; margin-left: 2px;
  background: var(--text); vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.status-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin: 4px 0 10px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.sources a {
  font-size: 12px; text-decoration: none; color: var(--text-2);
  background: var(--bg-raised); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 99px; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sources a:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------- markdown ---------- */
.md { overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 8px; line-height: 1.3; letter-spacing: -.2px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 16.5px; } .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 24px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin-bottom: 0; }
.md blockquote {
  margin: 0 0 12px; padding: 6px 14px;
  border-left: 3px solid var(--border-strong); color: var(--text-2);
  background: var(--bg-raised); border-radius: 0 8px 8px 0;
}
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.md code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--accent-soft); border-radius: 5px; padding: 1.5px 5px;
}
.md table { border-collapse: collapse; margin: 0 0 14px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; font-size: 13.5px; text-align: left; }
.md th { background: var(--bg-raised); font-weight: 700; }

/* ---------- code blocks ---------- */
.codeblock {
  margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius-m);
  overflow: hidden; background: var(--code-bg);
}
.cb-head {
  display: flex; align-items: center; gap: 8px;
  background: var(--code-header); border-bottom: 1px solid var(--border);
  padding: 6px 8px 6px 14px; font-size: 12px;
}
.cb-head .cb-name { font-family: var(--font-mono); font-weight: 600; color: var(--text-2); }
.cb-head .cb-lang { color: var(--text-3); text-transform: lowercase; }
.cb-head .btn-sm { color: var(--text-2); }
.cb-head .btn-sm:hover { color: var(--text); background: var(--bg-hover); }
.codeblock pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  tab-size: 2;
}
.tok-key { color: var(--sy-key); } .tok-str { color: var(--sy-str); }
.tok-num { color: var(--sy-num); } .tok-com { color: var(--sy-com); font-style: italic; }
.tok-fn  { color: var(--sy-fn); }  .tok-tag { color: var(--sy-tag); }
.tok-attr{ color: var(--sy-attr);} .tok-punc{ color: var(--sy-punc); }

/* ---------- composer ---------- */
.composer-wrap { padding: 8px 16px 18px; }
.composer {
  max-width: var(--content-w); margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-l); box-shadow: var(--shadow-1);
  padding: 10px 12px 8px; transition: border-color .12s;
}
.composer:focus-within { border-color: var(--text-3); }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: none; outline: none;
  max-height: 220px; padding: 4px 6px; font-size: 15px; line-height: 1.5;
}
.composer-bar { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.comp-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 5px 10px; border-radius: 99px; border: 1px solid var(--border);
  background: transparent; cursor: pointer;
}
.comp-toggle.on { color: var(--gold); border-color: var(--gold); }
.send-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.send-btn.stop { background: var(--danger); color: #fff; }
.foot-note { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 10px; }

/* ---------- files drawer ---------- */
.files-drawer {
  width: 300px; flex: none; border-left: 1px solid var(--border);
  background: var(--bg-raised); display: none; flex-direction: column;
}
.files-drawer.on { display: flex; }
.fd-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px;
           border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.fd-list { flex: 1; overflow-y: auto; padding: 8px; }
.file-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2);
}
.file-item:hover { background: var(--bg-hover); color: var(--text); }
.file-item .f-name { flex: 1; font-family: var(--font-mono); font-size: 12.5px;
                     overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .more { opacity: 0; border: 0; background: transparent; cursor: pointer;
                   color: var(--text-3); padding: 3px; border-radius: 6px; line-height: 0; }
.file-item:hover .more { opacity: 1; }
.fd-actions { padding: 10px; border-top: 1px solid var(--border); display: grid; gap: 8px; }

/* preview iframe */
.preview-frame { flex: 1; border: 0; width: 100%; background: #fff; border-radius: 0 0 var(--radius-m) var(--radius-m); }
.file-view pre { margin: 0; }

/* ============================================================
   Dashboard
   ============================================================ */
.dash { display: flex; height: 100vh; }
.dash-nav {
  width: 240px; flex: none; background: var(--bg-raised);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 10px;
}
.dash-nav .sb-head { padding: 0 6px 12px; }
.dash-nav button.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; background: transparent; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); text-align: left;
}
.dash-nav button.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.dash-nav button.nav-item.active { background: var(--bg-active); color: var(--text); }
.dash-main { flex: 1; overflow-y: auto; }
.dash-page { max-width: 980px; margin: 0 auto; padding: 28px 28px 60px; }
.dash-page h1 { font-size: 24px; letter-spacing: -.3px; margin: 0 0 4px; }
.dash-page .sub { color: var(--text-2); margin: 0 0 24px; }
.dash-section { margin-bottom: 28px; }
.dash-section h3 { font-size: 15px; margin: 0 0 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { padding: 16px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat .l { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.chart-card canvas { width: 100%; height: 220px; display: block; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
          color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl code { font-family: var(--font-mono); font-size: 12.5px; background: var(--accent-soft);
            padding: 2px 7px; border-radius: 5px; }

.api-card { margin-bottom: 12px; }
.api-card .top { display: flex; align-items: flex-start; gap: 12px; }
.api-card h4 { margin: 0; font-size: 15.5px; }
.api-card .desc { color: var(--text-2); font-size: 13px; margin: 3px 0 0; }
.api-card .endpoint { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2);
                      background: var(--code-bg); border: 1px solid var(--border);
                      padding: 7px 10px; border-radius: 8px; margin-top: 12px;
                      display: flex; align-items: center; gap: 8px; overflow-x: auto; white-space: nowrap; }
.api-card .meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.key-reveal {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--code-bg); border: 1px dashed var(--gold);
  padding: 12px 14px; border-radius: 10px; margin: 10px 0;
  word-break: break-all; user-select: all;
}

.dl-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.dl-row:last-child { border-bottom: 0; }
.dl-row .info { flex: 1; min-width: 0; }
.dl-row .info b { font-size: 14px; }
.dl-row .info .d { font-size: 12.5px; color: var(--text-2); }
.progress { height: 6px; border-radius: 99px; background: var(--bg-active); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .3s; }

.docs-block { font-family: var(--font-mono); font-size: 12.5px; background: var(--code-bg);
              border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
              overflow-x: auto; white-space: pre; line-height: 1.6; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .files-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 100; box-shadow: var(--shadow-2); }
  .dash-nav { width: 64px; }
  .dash-nav .nav-item span, .dash-nav .sb-head .name { display: none; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; box-shadow: var(--shadow-2); }
  .sidebar.hidden { margin-left: 0; transform: translateX(-100%); }
  .mode-pills button { padding: 5px 9px; }
}