-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1093 lines (1040 loc) · 51.8 KB
/
Copy pathindex.html
File metadata and controls
1093 lines (1040 loc) · 51.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>Funki Office 365 Connector</title>
<!-- Office.js: required by Office Add-ins to talk to the host (Word/Excel/PPT/Outlook). -->
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
<!-- MSAL.js v3 via jsdelivr (alcdn.msauth.net is dead, returns 404+ORB-block).
v3.6+ is required for Nested App Authentication (createNestablePublicClientApplication),
which lets Outlook broker sign-in INSIDE the task pane instead of opening a browser. -->
<script src="https://cdn.jsdelivr.net/npm/@azure/msal-browser@3/lib/msal-browser.min.js"
crossorigin="anonymous"></script>
<!-- KaTeX: renders LaTeX math in chat bubbles. The auto-render extension scans an
element for $$...$$, \(...\) and \[...\] delimiters and replaces them with
formatted math (single-$ is intentionally NOT enabled — see conversations.js,
it collides with Excel cell refs like $A$1). defer keeps these off the path. -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css"
crossorigin="anonymous" />
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"
crossorigin="anonymous"></script>
<style>
/* Palette mirrors the Claude Excel taskpane reference — neutral-900 surface,
subtle hairline borders, white-accent primary actions. */
:root {
--bg: #171717;
--surface: #1f1f1f;
--surface-2: #262626;
--surface-hover: #303030;
--border: #2d2d2d;
--border-strong: #3a3a3a;
--text: #eeeeee;
--text-muted: #a3a3a3;
--text-dim: #6b6b6b;
--accent: #ffffff;
--accent-text: #0a0a0a;
--danger: #f87171;
--success: #22c55e;
--radius-lg: 20px;
--radius-md: 12px;
--radius-sm: 8px;
--drawer-w: 88%;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: -apple-system, system-ui, Inter, "Segoe UI", Roboto, Ubuntu, sans-serif;
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
overflow: hidden; /* drawer slides over; body never scrolls */
}
/* App is a vertical flex column: topbar | scroll-area | composer.
Composer is pinned bottom; only the scroll-area scrolls. This is what
gives the layout the reference's "chat-app" feel even in a narrow pane. */
.app {
display: flex;
flex-direction: column;
height: 100vh;
padding: 0;
}
/* --- Top bar: brand on left + icon row on right ---
Icon-button rhythm matches the reference (clock, plus, ⋯, info). */
.topbar {
display: flex;
align-items: center;
gap: 4px;
padding: 10px 12px;
border-bottom: 1px solid var(--border);
flex: 0 0 auto;
}
.topbar .brand-pill {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 4px 10px;
border: 1px solid var(--border);
border-radius: 999px;
font-size: 12px;
font-weight: 600;
color: var(--text-muted);
background: transparent;
}
.topbar .spacer { flex: 1; }
.icon-btn {
display: inline-grid;
place-items: center;
width: 32px; height: 32px;
background: transparent;
border: none;
border-radius: var(--radius-sm);
color: var(--text-muted);
cursor: pointer;
transition: background 0.12s, color 0.12s;
padding: 0;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; }
#user-chip {
font-size: 11.5px;
color: var(--text-muted);
margin-right: 4px;
max-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* --- Scroll area: holds either empty-state or transcript --- */
.scroll-area {
flex: 1 1 auto;
overflow-y: auto;
padding: 16px 12px;
min-height: 0; /* needed inside flex column for overflow to work */
}
/* --- Empty state (no messages yet): centered logo + suggested chips ---
Mirrors Claude's "Get started with these skills:" layout. */
.empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
text-align: center;
gap: 14px;
padding: 24px 8px;
}
.empty .logo-lg {
width: 44px; height: 44px;
border-radius: 11px;
background: var(--accent);
color: var(--accent-text);
display: grid; place-items: center;
font-weight: 700; font-size: 16px;
letter-spacing: -0.02em;
}
.empty h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.empty .sublabel { margin: 12px 0 4px; color: var(--text-muted); font-size: 12.5px; }
.chips {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
width: 100%;
max-width: 280px;
}
.chip {
background: var(--surface);
color: var(--text);
border: 1px solid var(--border);
border-radius: 999px;
padding: 8px 16px;
font: inherit;
font-size: 12.5px;
cursor: pointer;
transition: background 0.12s, border-color 0.12s;
}
.chip:hover { background: var(--surface-2); border-color: var(--border-strong); }
/* --- Transcript: message bubbles --- */
.msg {
padding: 10px 12px;
border-radius: var(--radius-md);
margin-bottom: 8px;
}
.msg:last-child { margin-bottom: 0; }
.msg-user { background: var(--surface); border: 1px solid var(--border); }
.msg-assistant { background: var(--surface-2); border: 1px solid var(--border); }
.msg-summary { background: transparent; border: 1px dashed var(--border); color: var(--text-muted); font-style: italic; }
.msg-pending-summary {
background: #2a2418;
border: 1px solid #6b5b2f;
color: var(--text);
}
.pending-actions { display: flex; gap: 8px; margin-top: 10px; }
.pending-actions button {
background: var(--surface); color: var(--text);
border: 1px solid var(--border); border-radius: var(--radius-sm);
padding: 6px 14px; font: inherit; font-size: 12px; cursor: pointer;
}
.pending-actions .accept { background: #2d5a2d; border-color: #3d7a3d; }
.pending-actions .reject { background: #5a2d2d; border-color: #7a3d3d; }
.pending-actions button:hover { filter: brightness(1.15); }
.pending-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.msg-author {
font-size: 10.5px; font-weight: 600;
color: var(--text-muted); margin-bottom: 4px;
text-transform: uppercase; letter-spacing: 0.05em;
}
.msg-body {
white-space: pre-wrap;
word-wrap: break-word;
font-size: 13.5px;
color: var(--text);
}
/* KaTeX display math (\[...\]) can be wider than the narrow task pane —
let it scroll horizontally instead of forcing the bubble to overflow.
white-space:normal so KaTeX's own line layout isn't broken by pre-wrap. */
.msg-body .katex-display {
overflow-x: auto;
overflow-y: hidden;
padding: 2px 0;
margin: 6px 0;
}
.msg-body .katex { white-space: normal; }
/* --- Tool-call panel (excel-query reads shown as a collapsible chain) ---
Mirrors the agent-tool UI: a "Read N queries" header that expands to a
list of rows, each row expandable to a Result card with the raw data. */
.tool-panel {
border: 1px solid var(--border);
background: var(--surface);
border-radius: var(--radius-md);
margin: 8px 0;
overflow: hidden;
font-size: 12.5px;
}
.tool-panel-header {
display: flex; align-items: center; gap: 8px;
width: 100%; text-align: left;
background: transparent; border: none; color: var(--text-muted);
padding: 9px 12px; cursor: pointer; font: inherit; font-weight: 600;
}
.tool-panel-header:hover { color: var(--text); }
.chev { display: inline-block; transition: transform 0.15s ease; flex: 0 0 auto; color: var(--text-muted); }
.tool-panel.open > .tool-panel-header .chev { transform: rotate(90deg); }
.tool-panel-rows { display: none; padding: 0 8px 6px; }
.tool-panel.open > .tool-panel-rows { display: block; }
.tool-row { border-top: 1px solid var(--border); }
.tool-row-head {
display: flex; align-items: center; gap: 8px;
width: 100%; text-align: left;
background: transparent; border: none; color: var(--text);
padding: 8px 4px; cursor: pointer; font: inherit;
}
.tool-row-head:hover { color: var(--text); }
.tool-row .status { flex: 0 0 auto; width: 16px; text-align: center; font-weight: 700; }
.tool-row .status.ok { color: var(--success); }
.tool-row .status.err { color: #e0795f; }
.tool-row .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-row.open > .tool-row-head .chev { transform: rotate(90deg); }
.tool-result {
display: none;
margin: 0 4px 8px 28px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg);
padding: 8px 10px;
}
.tool-row.open > .tool-result { display: block; }
.tool-result-title {
font-size: 10px; color: var(--text-muted);
text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.tool-result pre {
margin: 0; white-space: pre; overflow: auto;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 11px; color: var(--text); line-height: 1.45;
max-height: 260px;
}
/* Doc context banner — live dot, sits above the composer like a status line */
.banner {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 6px 10px;
font-size: 11.5px;
color: var(--text-muted);
margin: 0 12px 6px;
}
.banner.live::before {
content: "";
display: inline-block;
width: 6px; height: 6px;
background: var(--success);
border-radius: 50%;
margin-right: 6px;
vertical-align: middle;
}
/* Excel-only live selection chip — sits with the doc banner above the composer */
.selection-chip {
background: var(--surface);
border: 1px solid var(--border);
border-left: 2px solid var(--success);
border-radius: var(--radius-sm);
padding: 6px 10px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 11px;
color: var(--text-muted);
margin: 0 12px 6px;
}
/* Attachment tray — chips for files the user dropped/picked, shown above
the composer pill. Each chip has a tiny ✕ to remove it before send. */
.attachments-tray {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0 12px 6px;
}
.attachment-chip {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 4px 6px 4px 8px;
font-size: 11px;
color: var(--text);
max-width: 220px;
}
.attachment-chip .att-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 160px;
}
.attachment-chip .att-size { color: var(--text-muted); }
.attachment-chip .att-remove {
background: none;
border: none;
cursor: pointer;
color: var(--text-muted);
padding: 0 2px;
line-height: 1;
font-size: 14px;
}
.attachment-chip .att-remove:hover { color: var(--text); }
/* --- Composer: pill input, [+] on left, arrow-send on right ---
Matches reference layout. The textarea grows up to 4 lines then scrolls. */
.composer-shell {
flex: 0 0 auto;
padding: 8px 12px 12px;
border-top: 1px solid var(--border);
background: var(--bg);
}
.composer {
display: flex;
align-items: end;
gap: 6px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 8px 8px 8px 8px;
transition: border-color 0.15s;
position: relative;
}
.composer:focus-within { border-color: var(--border-strong); }
.composer .composer-icon-btn {
flex: 0 0 auto;
display: inline-grid;
place-items: center;
width: 32px; height: 32px;
background: transparent;
border: none;
border-radius: 999px;
color: var(--text-muted);
cursor: pointer;
padding: 0;
}
.composer .composer-icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.composer .composer-icon-btn svg { width: 18px; height: 18px; }
.composer textarea {
flex: 1 1 auto;
background: transparent;
color: var(--text);
border: none;
outline: none;
resize: none;
font: inherit;
font-size: 14px;
padding: 6px 4px;
max-height: 120px;
min-height: 22px;
line-height: 1.4;
}
.composer textarea::placeholder { color: var(--text-dim); }
.composer .send-btn {
background: var(--accent);
color: var(--accent-text);
border: none;
border-radius: 999px;
width: 32px; height: 32px;
display: inline-grid;
place-items: center;
cursor: pointer;
transition: opacity 0.15s, transform 0.05s;
padding: 0;
}
.composer .send-btn svg { width: 16px; height: 16px; }
.composer .send-btn:hover { opacity: 0.88; }
.composer .send-btn:active { transform: scale(0.95); }
.composer .send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
/* Sending state: dim the arrow + show pulse so user knows click = cancel. */
.composer .send-btn[data-state="sending"] {
background: var(--danger);
color: var(--accent-text);
animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.55; }
}
/* --- Action menu (popover from composer [+] button) ---
Lifts above the composer so we don't overflow the pane bottom. */
.action-menu {
position: absolute;
bottom: calc(100% + 6px);
left: 0;
background: var(--surface-2);
border: 1px solid var(--border-strong);
border-radius: var(--radius-md);
min-width: 200px;
padding: 4px;
box-shadow: 0 8px 24px rgba(0,0,0,0.4);
z-index: 50;
display: none;
}
.action-menu.open { display: block; }
.action-menu button {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
background: transparent;
color: var(--text);
border: none;
border-radius: var(--radius-sm);
padding: 8px 10px;
font: inherit;
font-size: 13px;
text-align: left;
cursor: pointer;
}
.action-menu button:hover:not(:disabled) { background: var(--surface-hover); }
.action-menu button:disabled { opacity: 0.4; cursor: not-allowed; }
.action-menu button svg { width: 16px; height: 16px; color: var(--text-muted); flex: 0 0 auto; }
/* --- Mode chip (compact picker for Plan / Ask / Edit / Auto) ---
Lives inside .composer between the textarea and send button. Uses the
same popover skeleton as .action-menu but anchors to its own button
(right-aligned) and shows a label+chevron rather than an icon-only
button so the active mode is always visible without a hover/title. */
.mode-chip-btn {
display: inline-flex;
align-items: center;
gap: 4px;
background: var(--surface-2);
color: var(--text);
border: 1px solid var(--border);
border-radius: 999px;
padding: 4px 8px 4px 10px;
font: inherit;
font-size: 12px;
line-height: 1;
cursor: pointer;
white-space: nowrap;
flex: 0 0 auto;
}
.mode-chip-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.mode-chip-btn svg { width: 10px; height: 10px; color: var(--text-muted); }
.mode-menu { left: auto; right: 0; min-width: 240px; }
.mode-menu .mm-row {
display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
text-align: left; line-height: 1.25;
}
.mode-menu .mm-title { font-size: 13px; font-weight: 600; }
.mode-menu .mm-desc { font-size: 11px; color: var(--text-muted); }
.mode-menu button.active { background: var(--surface-hover); }
.mode-menu button.active::after { content: "✓"; margin-left: auto; color: var(--text); }
/* Model chip: same skeleton as the mode chip, but model ids can be long so
the label truncates with an ellipsis to keep the composer row compact. */
.model-chip-btn .mode-chip-label {
max-width: 96px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Model menu can grow tall (many models) — cap height and scroll. */
.model-menu { max-height: 320px; overflow-y: auto; }
.model-menu .mm-empty {
padding: 10px 12px;
font-size: 12px;
color: var(--text-muted);
line-height: 1.35;
}
/* Sticky header row: "Model" label + refresh button, pinned while scrolling. */
.model-menu .mm-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 6px 6px 10px;
margin-bottom: 4px;
border-bottom: 1px solid var(--border);
position: sticky;
top: -4px; /* cancel the menu's 4px padding so it pins flush */
background: var(--surface-2);
font-size: 11px;
font-weight: 600;
letter-spacing: 0.02em;
text-transform: uppercase;
color: var(--text-muted);
z-index: 1;
}
/* Override the generic .action-menu button rule so refresh is a compact icon. */
.model-menu .mm-header .mm-refresh {
display: inline-grid;
place-items: center;
width: 24px;
height: 24px;
padding: 0;
border-radius: 6px;
background: transparent;
color: var(--text-muted);
}
.model-menu .mm-header .mm-refresh:hover { background: var(--surface-hover); color: var(--text); }
.model-menu .mm-header .mm-refresh svg { width: 14px; height: 14px; }
.model-menu .mm-header .mm-refresh.spinning { color: var(--accent); cursor: progress; }
.model-menu .mm-header .mm-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* --- Action preview card (Ask mode) ---
Bubble rendered in the transcript when mode="ask" gates a response
with action blocks. Lists each proposed action with its own Apply
chip + global Apply-all / Skip-all at the bottom. */
.action-preview {
border: 1px solid var(--border-strong);
background: var(--surface-2);
border-radius: var(--radius-md);
padding: 10px 12px;
margin: 8px 0;
font-size: 13px;
}
.action-preview .ap-title { font-weight: 600; margin-bottom: 8px; color: var(--text); }
.action-preview .ap-row {
display: flex; align-items: center; gap: 8px;
padding: 6px 0; border-top: 1px solid var(--border);
}
.action-preview .ap-row:first-of-type { border-top: none; }
.action-preview .ap-row.done { opacity: 0.5; }
.action-preview .ap-desc { flex: 1; color: var(--text); }
.action-preview .ap-chip {
background: var(--surface-hover); color: var(--text); border: 1px solid var(--border);
border-radius: 999px; padding: 3px 10px; font-size: 11px; cursor: pointer;
}
.action-preview .ap-chip:hover:not(:disabled) { border-color: var(--border-strong); }
.action-preview .ap-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.action-preview .ap-footer {
display: flex; gap: 8px; justify-content: flex-end;
margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.action-preview .ap-chip.primary {
background: var(--text); color: var(--bg); border-color: var(--text);
}
/* --- Slide-in history drawer ---
Slides over the chat from the right. Overlay catches outside-clicks.
transform-based slide keeps it 60fps inside the WebView2 host. */
.drawer-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.5);
opacity: 0;
pointer-events: none;
transition: opacity 0.18s ease;
z-index: 90;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
position: fixed;
top: 0; right: 0; bottom: 0;
width: var(--drawer-w);
max-width: 360px;
background: var(--bg);
border-left: 1px solid var(--border-strong);
transform: translateX(100%);
transition: transform 0.2s ease;
z-index: 100;
display: flex;
flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-bottom: 1px solid var(--border);
flex: 0 0 auto;
}
.drawer-header h2 {
margin: 0;
font-size: 14px;
font-weight: 600;
flex: 1;
}
.drawer-body {
flex: 1 1 auto;
overflow-y: auto;
padding: 8px 6px;
}
.thread-list {
list-style: none;
margin: 0;
padding: 0;
}
.thread-list li {
margin-bottom: 2px;
display: flex;
align-items: stretch;
gap: 2px;
}
.thread-list .thread-select {
flex: 1 1 auto;
min-width: 0;
text-align: left;
background: transparent;
color: var(--text);
border: none;
border-radius: var(--radius-sm);
padding: 8px 10px;
font: inherit;
font-size: 13px;
cursor: pointer;
display: flex;
flex-direction: column;
gap: 2px;
}
.thread-list .thread-select:hover { background: var(--surface); }
.thread-list .thread-select.active { background: var(--surface-2); border: 1px solid var(--border-strong); }
.thread-list .thread-delete {
flex: 0 0 auto;
background: transparent;
border: none;
color: var(--text-muted);
cursor: pointer;
padding: 0 10px;
border-radius: var(--radius-sm);
font-size: 14px;
line-height: 1;
opacity: 0.5;
transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.thread-list li:hover .thread-delete { opacity: 1; }
.thread-list .thread-delete:hover { color: var(--danger); background: var(--surface); }
.thread-list .thread-delete.armed {
opacity: 1;
color: var(--accent-text);
background: var(--danger);
}
.thread-list .thread-delete:disabled { opacity: 0.3; cursor: wait; }
.thread-list .thread-title {
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.thread-list .thread-meta {
font-size: 11px;
color: var(--text-muted);
}
.thread-list .thread-empty {
padding: 16px 12px;
color: var(--text-muted);
font-size: 12.5px;
text-align: center;
}
/* Status footer — small inline log line above composer, never pushes content */
#status {
font-size: 11px;
color: var(--text-muted);
min-height: 0;
padding: 0 12px;
max-height: 1.4em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#status:empty { display: none; }
/* --- Signed-out hero --- */
.signed-out-hero {
display: flex; flex-direction: column; align-items: center;
gap: 14px;
margin: 48px 16px 24px;
text-align: center;
}
.signed-out-hero .logo-lg {
width: 56px; height: 56px;
border-radius: 14px;
background: var(--accent);
color: var(--accent-text);
display: grid; place-items: center;
font-weight: 700; font-size: 18px;
}
.signed-out-hero h1 { margin: 0; font-size: 22px; font-weight: 600; }
.signed-out-hero p { margin: 0; color: var(--text-muted); font-size: 13px; max-width: 280px; }
.btn-primary {
background: var(--accent);
color: var(--accent-text);
border: none;
border-radius: 999px;
padding: 10px 20px;
font: inherit; font-weight: 600;
cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }
/* Visibility toggles driven by body.className from taskpane.js refreshUi() */
#admin-link { display: none; }
body.is-admin.signed-in #admin-link { display: inline-flex; }
.signed-out #signed-in-ui,
.signed-out #signed-in-ui-topbar,
.signed-out .composer-shell { display: none; }
.signed-in #signed-out-ui { display: none; }
.signed-in #signed-in-ui-topbar { display: flex; }
/* Scrollbar polish */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }
/* ================================================================
MOBILE UX — ≤ 520 px portrait (phone)
Summary of changes:
· .app uses 100dvh so the layout shrinks when the soft keyboard
opens (iOS Safari with 100vh leaves a gap).
· Touch targets ≥ 44 px — Apple HIG minimum.
· Textarea font = 16 px — prevents iOS from auto-zooming on focus.
· Model chip collapses to chevron-only (names are too long);
mode chip keeps its label (Plan/Ask/Edit are always short).
· Composer shell gains env(safe-area-inset-bottom) padding so the
input is never hidden by the iPhone home indicator bar.
· Action / mode / model menus stretch edge-to-edge for easy tapping.
· User email chip hidden in the topbar (saves ~100 px for icons).
================================================================ */
@media (max-width: 520px) {
/* Dynamic viewport height: shrinks when soft keyboard appears */
.app { height: 100dvh; }
/* Kill 300 ms tap delay everywhere */
button, a, [role="menuitem"] { touch-action: manipulation; }
/* ── Top bar ─────────────────────────────────────── */
.topbar { padding: 6px 8px; gap: 0; }
.topbar .brand-pill { padding: 3px 8px; font-size: 11px; }
#user-chip { display: none; }
.icon-btn { width: 44px; height: 44px; }
.icon-btn svg { width: 20px; height: 20px; }
/* ── Scroll / transcript area ────────────────────── */
.scroll-area { padding: 10px 8px; }
.msg { padding: 12px 14px; margin-bottom: 10px; }
.msg-body { font-size: 14.5px; line-height: 1.55; }
/* Stack pending-summary buttons vertically */
.pending-actions { flex-direction: column; }
.pending-actions button {
width: 100%; padding: 11px 14px;
font-size: 13.5px; text-align: center;
}
/* ── Empty state ─────────────────────────────────── */
.empty { gap: 12px; padding: 24px 12px; }
.empty h1 { font-size: 17px; }
.chips { max-width: 100%; }
.chip { width: 100%; padding: 11px 16px; font-size: 13.5px; }
/* ── Composer shell ─────────────────────────────── */
.composer-shell {
padding: 6px 8px;
/* safe-area-inset-bottom: covers the iPhone home-indicator bar */
padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
}
/* Context strip: remove side margins so they span full width */
.banner, .selection-chip, .attachments-tray {
margin-left: 0; margin-right: 0;
}
/* Status line: allow wrapping so long messages aren't clipped */
#status {
font-size: 12px; padding: 0 4px;
white-space: normal; max-height: none; line-height: 1.35;
}
/* ── Composer pill: 2-row grid ──────────────────────
Row 1 (chips): [Model name ▾ · · · ][Mode ▾]
Row 2 (input): [+][📎][textarea · · · ][↑]
Chips get their own full row so the model name is always
legible; the textarea gets all remaining width below. */
.composer {
display: grid;
grid-template-columns: 44px 44px 1fr 40px;
grid-template-rows: auto auto;
gap: 6px 4px;
padding: 8px;
align-items: center;
}
/* Row 1: model chip (left half) + mode chip (right half) */
#model-chip-btn {
grid-column: 1 / 3; grid-row: 1;
width: 100%; justify-content: flex-start;
font-size: 12.5px;
}
#mode-chip-btn {
grid-column: 3 / 5; grid-row: 1;
width: 100%; justify-content: space-between;
font-size: 12.5px;
}
/* Row 2: + | 📎 | textarea | send */
#composer-plus-btn { grid-column: 1; grid-row: 2; }
#composer-attach-btn { grid-column: 2; grid-row: 2; }
#prompt { grid-column: 3; grid-row: 2; }
#send-btn { grid-column: 4; grid-row: 2; }
/* Restore full model chip label — it now has its own half-row */
.model-chip-btn .mode-chip-label { display: inline; max-width: 100%; }
.model-chip-btn { padding: 6px 10px; min-width: unset; }
.mode-chip-btn:not(.model-chip-btn) { padding: 6px 10px; }
/* Subtle visual distinction: model chip gets a slightly stronger border */
#model-chip-btn { border-color: var(--border-strong); }
/* Icon buttons (+ and 📎) */
.composer .composer-icon-btn { width: 44px; height: 44px; }
.composer .composer-icon-btn svg { width: 20px; height: 20px; }
/* Textarea: 16 px prevents iOS auto-zoom on focus */
.composer textarea {
font-size: 16px;
max-height: 150px;
padding: 6px 4px;
width: 100%;
}
/* Send button */
.composer .send-btn { width: 40px; height: 40px; }
.composer .send-btn svg { width: 18px; height: 18px; }
/* ── Action / mode / model menus ─────────────────── */
/* Stretch edge-to-edge inside the composer box for easy tapping */
.action-menu { left: 0; right: 0; min-width: unset; width: auto; }
.mode-menu { left: 0; right: 0; min-width: unset; width: auto; }
.model-menu { max-height: 260px; }
.action-menu button { padding: 13px 14px; font-size: 14px; }
.action-menu button svg { width: 18px; height: 18px; }
.mode-menu .mm-title { font-size: 14px; }
.mode-menu .mm-desc { font-size: 12px; }
/* ── History drawer ───────────────────────────────── */
:root { --drawer-w: 94%; }
.drawer-header { padding: 12px; }
.thread-list .thread-select { padding: 14px 10px; font-size: 14px; }
.thread-list .thread-delete { padding: 0 16px; font-size: 18px; }
/* Slim scrollbar on touchscreens (mostly decorative) */
::-webkit-scrollbar { width: 3px; }
}
</style>
</head>
<body class="signed-out">
<div class="app">
<!-- === Top bar (signed-in chrome) === -->
<div class="topbar" id="signed-in-ui-topbar">
<span class="brand-pill">Beta</span>
<div class="spacer"></div>
<span id="user-chip"><span id="user-name"></span></span>
<!-- Admin link — shown only when /me reports isAdmin=true (body.is-admin class).
Opens admin dashboard in a new tab so the user doesn't lose their composer state. -->
<a id="admin-link" href="admin.html" target="_blank" rel="noopener" class="icon-btn" title="Admin · token usage" aria-label="Admin">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2l8 4v6c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10V6l8-4z"></path></svg>
</a>
<button id="history-btn" class="icon-btn" title="Conversation history" aria-label="History">
<!-- clock -->
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"></circle><path d="M12 7v5l3 2"></path></svg>
</button>
<button id="new-thread-btn" class="icon-btn" title="New conversation" aria-label="New conversation">
<!-- plus-in-circle -->
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"></circle><path d="M12 8v8M8 12h8"></path></svg>
</button>
<button id="signout-btn" class="icon-btn" title="Sign out" aria-label="Sign out">
<!-- sign-out -->
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
</button>
</div>
<!-- === Signed-out view === -->
<div id="signed-out-ui">
<div class="signed-out-hero">
<div class="logo-lg">OI</div>
<h1>Self-Hosted LLM</h1>
<p>Sign in with your Microsoft 365 account to let the LLM read and modify your Outlook, OneDrive, and Office files.</p>
<button id="signin-btn" class="btn-primary">Sign in to Microsoft 365</button>
</div>
</div>
<!-- === Signed-in view === -->
<div id="signed-in-ui" class="scroll-area">
<!-- Empty state: shown when transcript is empty. Toggled by JS. -->
<div class="empty" id="empty-state">
<div class="logo-lg">OI</div>
<h1>How can I help with this document?</h1>
<p class="sublabel">Get started with these prompts:</p>
<!-- Suggested-prompt chips. Populated host-aware by setSuggestedChips() in taskpane.js. -->
<div class="chips" id="suggested-chips"></div>
</div>
<!-- Latest LLM response / message transcript. JS appends .msg children
to this when messages exist; the empty state is auto-hidden. -->
<div id="response"></div>
</div>
<!-- === Composer + supporting context surfaces (always pinned bottom when signed in) === -->
<div class="composer-shell">
<!-- Doc context banner (auto-attached by primeDocumentContext) -->
<div class="banner live" id="doc-context-banner" style="display:none;"></div>
<!-- Excel-only live selection chip. Populated by setupExcelSelectionWatcher() in taskpane.js. -->
<div class="selection-chip" id="selection-indicator" style="display:none;"></div>
<!-- Attachment chips (filled when user picks files via the paperclip). -->
<div class="attachments-tray" id="attachments-tray" style="display:none;"></div>
<!-- Status (last action / error). Hidden when empty. -->
<div id="status"></div>
<div class="composer">
<button id="composer-plus-btn" class="composer-icon-btn" title="More actions" aria-label="Actions">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14"></path></svg>
</button>
<button id="composer-attach-btn" class="composer-icon-btn" title="Attach file" aria-label="Attach file">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>
</button>
<input type="file" id="composer-file-input" multiple style="display:none"
accept="image/*,application/pdf,text/plain,text/markdown,.md,text/csv,application/json">
<textarea id="prompt" placeholder="Reply" rows="1"></textarea>
<button id="model-chip-btn" class="mode-chip-btn model-chip-btn" type="button" title="Choose model" aria-haspopup="menu" aria-expanded="false">
<span class="mode-chip-label" id="model-chip-label">Model</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
</button>
<button id="mode-chip-btn" class="mode-chip-btn" type="button" title="Edit mode (click to change)" aria-haspopup="menu" aria-expanded="false">
<span class="mode-chip-label" id="mode-chip-label">Edit</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
</button>
<button id="send-btn" class="send-btn" title="Send (Enter — Shift+Enter for newline)" aria-label="Send">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"></line><polyline points="5 12 12 5 19 12"></polyline></svg>
</button>
<!-- Mode picker popover. Same skeleton as .action-menu but anchored
right (toward the send button) and showing 4 modes with descriptions.
State persisted in localStorage under "omc.taskpane-mode". -->
<div class="action-menu mode-menu" id="mode-menu" role="menu">
<button type="button" role="menuitemradio" data-mode="plan">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="13" y2="17"></line></svg>
<div class="mm-row"><div class="mm-title">Plan</div><div class="mm-desc">Explain only — no document edits</div></div>
</button>
<button type="button" role="menuitemradio" data-mode="ask">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>
<div class="mm-row"><div class="mm-title">Ask before edits</div><div class="mm-desc">Preview each change, you approve</div></div>
</button>
<button type="button" role="menuitemradio" data-mode="edit">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>
<div class="mm-row"><div class="mm-title">Edit automatically</div><div class="mm-desc">Apply edits to the active document</div></div>
</button>
</div>
<!-- Model picker popover. Rows are injected by model.js from GET /models
(the gateway's advertised chat models). Empty until first open, then
lazy-loaded. Selection persisted in localStorage "omc.taskpane-model". -->
<div class="action-menu mode-menu model-menu" id="model-menu" role="menu"></div>
<!-- Action menu popover. Toggled by composer-plus-btn. Action visibility
is host-aware (configureHostUi shows/hides Outlook items). -->
<div class="action-menu" id="action-menu" role="menu">
<button id="insert-btn" type="button" role="menuitem">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>
Insert response into document