-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathteam-dashboard.html
More file actions
2930 lines (2716 loc) · 192 KB
/
Copy pathteam-dashboard.html
File metadata and controls
2930 lines (2716 loc) · 192 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 name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grasp — Team Dashboard</title>
<meta name="description" content="Grasp Team Dashboard — aggregate architecture health, health scores, and commit activity across multiple repos. Part of the Grasp code architecture suite.">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Crect width='34' height='34' rx='9' fill='%230a1e1e'/%3E%3Ccircle cx='14' cy='7' r='2.4' fill='%2300d4aa'/%3E%3Ccircle cx='6' cy='19' r='2' fill='%234d9fff' opacity='.9'/%3E%3Ccircle cx='22' cy='19' r='2' fill='%23a78bfa' opacity='.9'/%3E%3Ccircle cx='14' cy='14' r='3' fill='%2300d4aa'/%3E%3Cline x1='14' y1='11' x2='14' y2='9.4' stroke='%2300d4aa' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='11.4' y1='16' x2='8.2' y2='17.6' stroke='%234d9fff' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='16.6' y1='16' x2='19.8' y2='17.6' stroke='%23a78bfa' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M7.4 20.6 Q14 25 20.6 20.6' stroke='%2300d4aa' stroke-width='.9' fill='none' stroke-opacity='.4' stroke-linecap='round'/%3E%3Crect x='22' y='20' width='3' height='8' rx='1' fill='%2300d4aa' opacity='.9'/%3E%3Crect x='26' y='23' width='3' height='5' rx='1' fill='%234d9fff' opacity='.85'/%3E%3Crect x='30' y='25' width='3' height='3' rx='1' fill='%23a78bfa' opacity='.8'/%3E%3C/svg%3E">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
:root{
--bg0:#080d16;--bg1:#0d1523;--bg2:#131f2e;--bg3:#1a2a3d;--bg4:#213248;
--hover:#243650;
--t0:#e2e8f0;--t1:#dde2f4;--t2:#8892b0;--t3:#404870;
--acc:#00d4aa;--acc2:#00b894;--accbg:rgba(0,212,170,0.09);
--green:#22c55e;--orange:#f59e0b;--red:#ff5f5f;--blue:#4d9fff;--purple:#a78bfa;--cyan:#22d3ee;--pink:#f472b6;
--border:rgba(0,212,170,0.13);
--border2:rgba(148,163,184,0.05);
--card-bg:rgba(0,212,170,0.04);
--shadow:rgba(0,0,0,0.6);
--font:'JetBrains Mono',monospace;
}
/* ── Keyframes ── */
@keyframes topbar-glow{0%,100%{width:200px;opacity:.7}50%{width:360px;opacity:1}}
@keyframes logo-float{0%,100%{transform:translateY(0) scale(1)}50%{transform:translateY(-2px) scale(1.03)}}
@keyframes pulse-glow{0%,100%{box-shadow:0 0 8px rgba(0,212,170,.35),0 2px 10px rgba(0,212,170,.3)}50%{box-shadow:0 0 22px rgba(0,212,170,.65),0 2px 18px rgba(0,212,170,.5)}}
@keyframes slide-in-up{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@keyframes row-in{from{opacity:0;transform:translateX(-6px)}to{opacity:1;transform:translateX(0)}}
@keyframes shimmer{0%{background-position:200% center}100%{background-position:-200% center}}
@keyframes sweep{0%{transform:translateY(100vh);opacity:.06}100%{transform:translateY(-100%);opacity:0}}
@keyframes acc-border{0%,100%{border-color:rgba(0,212,170,.3)}50%{border-color:rgba(0,212,170,.7)}}
@keyframes card-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@keyframes dot-pulse{0%,100%{box-shadow:0 0 0 0 rgba(0,212,170,.7)}70%{box-shadow:0 0 0 7px rgba(0,212,170,0)}}
@keyframes spin{to{transform:rotate(360deg)}}
/* ── Body / background ── */
body{
font-family:var(--font);background:var(--bg0);color:var(--t1);
min-height:100vh;padding-bottom:26px;
background-image:
linear-gradient(rgba(0,212,170,.038) 1px,transparent 1px),
linear-gradient(90deg,rgba(0,212,170,.038) 1px,transparent 1px),
radial-gradient(circle,rgba(0,212,170,.022) 1px,transparent 1px);
background-size:32px 32px,32px 32px,64px 64px;
}
/* Sweep overlay */
body::after{
content:'';position:fixed;top:0;left:0;right:0;height:60%;
background:linear-gradient(180deg,rgba(0,212,170,.018) 0%,transparent 100%);
pointer-events:none;z-index:0;
animation:sweep 14s linear infinite;will-change:transform;
}
a{color:var(--acc);text-decoration:none;}
/* ── Topbar ── */
.topbar{
height:54px;
background:linear-gradient(180deg,var(--bg2) 0%,var(--bg1) 100%);
border-bottom:1px solid var(--border);
display:flex;align-items:center;padding:0 20px;gap:10px;
position:sticky;top:0;z-index:500;
overflow:visible;
}
.topbar::after{
content:'';position:absolute;bottom:0;left:0;height:1px;
background:linear-gradient(90deg,var(--acc),rgba(129,140,248,.5),transparent);
pointer-events:none;
animation:topbar-glow 4s ease-in-out infinite;
}
/* ── Logo ── */
.topbar-logo-wrap{display:flex;align-items:center;gap:10px;}
.logo-mark{
display:block;flex-shrink:0;
animation:logo-float 5s ease-in-out infinite;
filter:drop-shadow(0 0 7px rgba(0,212,170,.55));
}
.logo-text{
font-size:16px;font-weight:800;letter-spacing:-.5px;
background:linear-gradient(110deg,#fff 0%,var(--acc) 60%,#0099cc 100%);
-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;
}
.topbar-sub{font-size:10px;color:var(--t3);letter-spacing:.4px;}
/* ── Topbar right ── */
.topbar-right{margin-left:auto;display:flex;gap:6px;align-items:center;}
/* ── Buttons ── */
.btn{
font-family:var(--font);font-size:11px;padding:6px 14px;
border:none;border-radius:5px;cursor:pointer;white-space:nowrap;font-weight:700;
background:linear-gradient(135deg,var(--acc) 0%,var(--acc2) 100%);
color:#fff;
transition:all .18s;
animation:pulse-glow 2.8s ease-in-out infinite;
box-shadow:0 2px 12px rgba(0,212,170,.3);
position:relative;z-index:1;
display:inline-flex;align-items:center;gap:6px;line-height:1;
}
.btn>svg{flex-shrink:0;}
.btn:hover{opacity:.9;transform:translateY(-1px);box-shadow:0 4px 22px rgba(0,212,170,.5);animation:none;}
.btn:disabled{opacity:.4;cursor:not-allowed;transform:none;animation:none;}
.btn.secondary{
background:transparent;border:1px solid var(--border);
color:var(--t2);font-weight:500;
animation:none;box-shadow:none;
}
.btn.secondary:hover{border-color:rgba(0,212,170,.4);color:var(--t1);background:rgba(0,212,170,.06);transform:none;}
/* ── Workspace switcher ── */
.ws-wrap{position:relative;}
.ws-btn{
background:var(--bg2);border:1px solid var(--border);color:var(--t1);
font-size:11px;font-family:var(--font);padding:5px 10px;border-radius:5px;
cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;
transition:border-color .15s,box-shadow .15s;
}
.ws-btn:hover{border-color:rgba(0,212,170,.4);box-shadow:0 0 0 2px rgba(0,212,170,.1);}
.ws-dropdown{
position:absolute;top:calc(100% + 5px);right:0;min-width:210px;
background:var(--bg2);border:1px solid rgba(0,212,170,.2);
border-radius:9px;box-shadow:0 12px 40px rgba(0,0,0,.7),0 0 0 1px rgba(0,212,170,.06);
z-index:9000;padding:6px;
animation:slide-in-up .18s ease;
backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
}
.ws-item{display:flex;align-items:center;gap:6px;padding:7px 9px;border-radius:5px;cursor:pointer;font-size:11px;color:var(--t1);transition:background .1s;}
.ws-item:hover{background:rgba(0,212,170,.1);}
.ws-item.active{color:var(--acc);font-weight:700;}
.ws-item-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ws-item-del{color:var(--t3);font-size:11px;padding:1px 4px;border:none;background:none;cursor:pointer;border-radius:3px;transition:all .12s;}
.ws-item-del:hover{color:var(--red);background:rgba(255,95,95,.1);}
.ws-new-row{display:flex;gap:6px;padding:4px 0 2px;}
.ws-new-input{flex:1;background:var(--bg3);border:1px solid var(--border);color:var(--t1);font-size:11px;font-family:var(--font);padding:5px 8px;border-radius:5px;outline:none;transition:border-color .15s;}
.ws-new-input:focus{border-color:var(--acc);}
.ws-new-btn{background:linear-gradient(135deg,var(--acc),var(--acc2));color:#fff;border:none;border-radius:5px;padding:5px 10px;font-size:11px;cursor:pointer;font-weight:700;}
/* ── Container ── */
.container{max-width:1300px;margin:0 auto;padding:24px 20px;position:relative;z-index:1;}
/* ── Section title ── */
.section-title{
font-size:11px;font-weight:700;color:var(--t2);margin-bottom:14px;
text-transform:uppercase;letter-spacing:.1em;
display:flex;align-items:center;gap:8px;
}
.section-title::before{
content:'';width:3px;height:14px;flex-shrink:0;border-radius:2px;
background:linear-gradient(to bottom,var(--acc),var(--acc2));
box-shadow:0 0 8px rgba(0,212,170,.5);
}
/* ── Add bar / inputs ── */
.add-bar{display:flex;gap:8px;margin-bottom:22px;flex-wrap:wrap;}
.repo-input{
background:var(--bg1);border:1px solid var(--border);color:var(--t1);
font-family:var(--font);font-size:12px;padding:8px 14px;border-radius:6px;outline:none;
flex:1;min-width:200px;transition:border-color .18s,box-shadow .18s;
}
.repo-input:focus{border-color:var(--acc);box-shadow:0 0 0 2px rgba(0,212,170,.15);animation:acc-border 2.5s ease-in-out infinite;}
/* ── Auth bar ── */
.auth-bar{
display:flex;align-items:center;gap:8px;margin-bottom:18px;
padding:7px 12px;border-radius:6px;flex-wrap:wrap;
background:rgba(0,212,170,.05);border:1px solid rgba(0,212,170,.12);
font-size:10px;color:var(--t3);
}
.auth-mode-select{
background:var(--bg2);border:1px solid var(--border);color:var(--t1);
font-family:var(--font);font-size:10px;padding:3px 6px;border-radius:4px;
cursor:pointer;outline:none;
}
.auth-mode-select:focus{border-color:rgba(0,212,170,.4);}
.token-input{
background:var(--bg2);border:1px solid var(--border);color:var(--t2);
font-family:var(--font);font-size:10px;padding:3px 8px;border-radius:4px;
flex:1;min-width:160px;max-width:260px;outline:none;transition:border-color .15s;
}
.token-input:focus{border-color:rgba(0,212,170,.4);color:var(--t1);}
.auth-app-id{
background:var(--bg2);border:1px solid var(--border);color:var(--t2);
font-family:var(--font);font-size:10px;padding:3px 8px;border-radius:4px;
width:80px;outline:none;transition:border-color .15s;
}
.auth-app-id:focus{border-color:rgba(0,212,170,.4);color:var(--t1);}
.auth-key-btn{
background:none;border:1px solid rgba(0,212,170,.3);color:var(--acc2);
font-family:var(--font);font-size:9px;padding:3px 8px;border-radius:4px;
cursor:pointer;white-space:nowrap;transition:all .15s;
display:inline-flex;align-items:center;gap:5px;line-height:1;
}
.auth-key-btn>svg{flex-shrink:0;}
.auth-key-btn:hover{background:rgba(0,212,170,.12);color:#fff;}
.auth-key-btn.set{border-color:#22c55e;color:#22c55e;}
.auth-hint{font-size:9px;color:var(--t3);opacity:.7;white-space:nowrap;}
/* Private key modal */
.key-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:1000;display:flex;align-items:center;justify-content:center;}
.key-modal{background:var(--bg1);border:1px solid var(--border);border-radius:10px;padding:24px;width:480px;max-width:90vw;}
.key-modal-title{font-size:13px;font-weight:700;color:var(--t1);margin-bottom:4px;}
.key-modal-sub{font-size:10px;color:var(--t3);margin-bottom:14px;line-height:1.5;}
.key-modal textarea{width:100%;height:140px;background:var(--bg2);border:1px solid var(--border);color:var(--t2);font-family:monospace;font-size:9px;padding:8px;border-radius:6px;resize:vertical;outline:none;box-sizing:border-box;}
.key-modal textarea:focus{border-color:rgba(0,212,170,.4);}
.key-modal-btns{display:flex;gap:8px;margin-top:12px;justify-content:flex-end;}
/* ── Summary strip ── */
.summary-strip{
display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
gap:12px;margin-bottom:26px;
}
.summary-card{
background:var(--card-bg);border:1px solid var(--border);border-radius:10px;
padding:16px 18px;position:relative;overflow:hidden;
transition:border-color .2s,box-shadow .2s,transform .2s;
animation:card-in .4s ease both;
}
.summary-card::before{
content:'';position:absolute;top:0;left:0;width:3px;height:100%;
background:linear-gradient(to bottom,var(--acc),var(--acc2));
opacity:.7;border-radius:2px 0 0 2px;
}
.summary-card:hover{
border-color:rgba(0,212,170,.3);
box-shadow:0 4px 24px rgba(0,212,170,.12);
transform:translateY(-2px);
}
.summary-card .value{font-size:22px;font-weight:800;line-height:1;letter-spacing:-.5px;}
.summary-card .label{font-size:9px;color:var(--t3);margin-top:5px;text-transform:uppercase;letter-spacing:.06em;}
/* ── Repo table ── */
.repo-table{width:100%;border-collapse:collapse;margin-bottom:28px;}
.repo-table th{
font-size:9px;color:var(--t3);text-align:right;
padding:7px 12px;border-bottom:1px solid var(--border);
text-transform:uppercase;letter-spacing:.06em;font-weight:600;
}
.repo-table th:first-child{text-align:left;}
.repo-table td{font-size:11px;padding:9px 12px;border-bottom:1px solid var(--border);text-align:right;transition:background .1s;}
.repo-table td:first-child{text-align:left;}
.repo-table tbody tr{animation:row-in .25s ease both;}
.repo-table tbody tr:nth-child(1){animation-delay:.02s}
.repo-table tbody tr:nth-child(2){animation-delay:.05s}
.repo-table tbody tr:nth-child(3){animation-delay:.08s}
.repo-table tbody tr:nth-child(4){animation-delay:.11s}
.repo-table tbody tr:nth-child(5){animation-delay:.14s}
.repo-table tr:hover td{background:rgba(0,212,170,.05);}
/* ── Grade badges ── */
.grade{display:inline-block;width:22px;height:22px;border-radius:4px;font-size:11px;font-weight:700;text-align:center;line-height:22px;}
.grade-A{background:rgba(34,197,94,.18);color:#22c55e;box-shadow:0 0 8px rgba(34,197,94,.2);}
.grade-B{background:rgba(129,140,248,.18);color:#818cf8;box-shadow:0 0 8px rgba(129,140,248,.15);}
.grade-C{background:rgba(245,158,11,.18);color:#f59e0b;}
.grade-D,.grade-F{background:rgba(255,95,95,.18);color:#ff5f5f;}
/* ── Table controls ── */
.remove-btn{background:none;border:none;color:var(--t3);cursor:pointer;font-size:13px;padding:0 4px;transition:color .12s,transform .12s;}
.remove-btn:hover{color:var(--red);transform:scale(1.2);}
.grasp-badge{display:inline-block;font-size:8px;font-weight:700;letter-spacing:.04em;padding:1px 5px;border-radius:3px;background:rgba(0,212,170,.18);color:var(--acc2);border:1px solid rgba(0,212,170,.3);cursor:default;flex-shrink:0;}
.grasp-open-btn{background:none;border:1px solid rgba(0,212,170,.3);color:var(--acc2);cursor:pointer;font-size:9px;padding:2px 6px;border-radius:4px;transition:all .15s;white-space:nowrap;}
.grasp-open-btn:hover{background:rgba(0,212,170,.18);border-color:var(--acc);color:#fff;}
/* ── Repo cell layout ── */
.repo-name-line{display:flex;align-items:center;gap:5px;margin-bottom:3px;}
.repo-name-link{font-size:12px;font-weight:600;color:var(--t1);text-decoration:none;transition:color .12s;white-space:nowrap;}
.repo-name-link:hover{color:var(--acc2);}
.gh-arrow{color:var(--t3);font-size:10px;text-decoration:none;flex-shrink:0;transition:color .12s;line-height:1;}
.gh-arrow:hover{color:var(--acc2);}
.repo-meta-line{display:flex;align-items:center;gap:5px;margin-bottom:2px;flex-wrap:wrap;}
.repo-lang{font-size:9px;color:var(--t3);}
.repo-stars{font-size:9px;color:var(--t3);}
.repo-activity-line{display:flex;align-items:center;gap:6px;margin-top:3px;flex-wrap:wrap;}
.commit-pill{font-size:9px;color:var(--t3);white-space:nowrap;}
.commit-pill span{color:var(--t2);font-weight:600;}
.stale-btn{display:inline-flex;align-items:center;gap:3px;font-size:9px;font-weight:600;padding:1px 6px;border-radius:3px;background:rgba(245,158,11,.12);border:1px solid rgba(245,158,11,.3);color:#f59e0b;cursor:pointer;text-decoration:none;white-space:nowrap;transition:all .15s;}
.stale-btn:hover{background:rgba(245,158,11,.22);border-color:#f59e0b;color:#fbbf24;}
.ci-badge{display:inline-flex;align-items:center;gap:3px;font-size:9px;padding:1px 5px;border-radius:3px;font-weight:600;}
.ci-badge.pass{background:rgba(34,197,94,0.1);color:#22c55e;border:1px solid rgba(34,197,94,0.2);}
.ci-badge.fail{background:rgba(248,113,113,0.1);color:#f87171;border:1px solid rgba(248,113,113,0.2);}
.ci-badge.pending{background:rgba(245,158,11,0.1);color:#f59e0b;border:1px solid rgba(245,158,11,0.2);}
.activity-loading{font-size:9px;color:var(--t3);opacity:.5;}
.team-input{
background:none;border:none;border-bottom:1px solid transparent;
color:var(--t2);font-size:10px;font-family:var(--font);width:72px;
padding:2px 3px;outline:none;transition:all .15s;border-radius:0;
}
.team-input:hover{border-bottom-color:rgba(0,212,170,.3);}
.team-input:focus{border-bottom-color:var(--acc);background:rgba(0,212,170,.06);color:var(--t1);}
.notes-input{
background:none;border:none;border-bottom:1px solid transparent;
color:var(--t2);font-size:10px;font-family:var(--font);width:110px;
padding:2px 3px;outline:none;transition:all .15s;border-radius:0;
}
.notes-input:hover{border-bottom-color:rgba(0,212,170,.3);}
.notes-input:focus{border-bottom-color:var(--acc);background:rgba(0,212,170,.06);color:var(--t1);}
/* ── Status tags ── */
.status-tag{
border:none;border-radius:4px;cursor:pointer;font-size:9px;font-family:var(--font);
font-weight:700;padding:2px 7px;white-space:nowrap;
transition:transform .12s,opacity .12s,box-shadow .12s;letter-spacing:.02em;
}
.status-tag:hover{transform:scale(1.06);opacity:.9;}
.status-none{background:rgba(255,255,255,.06);color:var(--t3);}
.status-stable{background:rgba(34,197,94,.15);color:#22c55e;box-shadow:0 0 6px rgba(34,197,94,.12);}
.status-watch{background:rgba(245,158,11,.15);color:#f59e0b;box-shadow:0 0 6px rgba(245,158,11,.12);}
.status-in-refactor{background:rgba(77,159,255,.15);color:#4d9fff;box-shadow:0 0 6px rgba(77,159,255,.12);}
.status-deprecated{background:rgba(107,114,128,.15);color:#9ca3af;}
.status-blocked{background:rgba(255,95,95,.15);color:#ff5f5f;box-shadow:0 0 6px rgba(255,95,95,.12);}
/* ── Health bar ── */
.bar-cell{width:80px;}
.health-bar{height:5px;border-radius:3px;background:rgba(255,255,255,.05);}
.health-bar-fill{height:100%;border-radius:3px;transition:width .6s cubic-bezier(.22,1,.36,1);}
/* ── Loading / error rows ── */
.loading-row td{color:var(--t3);font-style:italic;}
.loading-row td span.shimmer{
display:inline-block;
background:linear-gradient(90deg,var(--bg2) 25%,rgba(0,212,170,.15) 50%,var(--bg2) 75%);
background-size:200% auto;
animation:shimmer 1.6s linear infinite;
border-radius:3px;width:200px;height:10px;vertical-align:middle;
}
.error-row td{color:var(--red);}
.repo-link{color:var(--t1);transition:color .15s;}
.repo-link:hover{color:var(--acc);}
/* ── Table scroll wrapper (horizontal scroll on small screens) ── */
.table-scroll-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
.table-scroll-wrap::-webkit-scrollbar{height:4px;}
.table-scroll-wrap::-webkit-scrollbar-track{background:transparent;}
.table-scroll-wrap::-webkit-scrollbar-thumb{background:rgba(0,212,170,.25);border-radius:2px;}
/* ── Charts ── */
.charts-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:28px;}
@media(max-width:700px){.charts-row{grid-template-columns:1fr;}}
/* ── Responsive breakpoints ── */
/* ≤1100px: compress container padding, hide some topbar buttons */
@media(max-width:1100px){
.container{padding:18px 14px;}
.topbar{padding:0 14px;gap:6px;}
.topbar-right .btn{font-size:10px;padding:5px 10px;}
}
/* ── More menu ── */
.more-menu-wrap{position:relative;display:none;}
.more-menu-btn{display:flex;width:28px;height:28px;padding:0;background:var(--bg3);border:1px solid var(--border);border-radius:4px;color:var(--t1);font-size:16px;cursor:pointer;align-items:center;justify-content:center;transition:all 0.15s;letter-spacing:1px;font-weight:700;flex-shrink:0;}
.more-menu-btn:hover{background:var(--bg4);border-color:rgba(0,212,170,0.38);color:var(--acc);}
.more-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:160px;background:var(--bg2);border:1px solid rgba(0,212,170,0.15);border-radius:8px;box-shadow:0 12px 40px rgba(0,0,0,0.6);z-index:1000;padding:4px;animation:slide-in-up 0.18s ease;}
.more-menu-item{display:flex;align-items:center;gap:8px;padding:7px 12px;border-radius:5px;font-size:11px;color:var(--t1);cursor:pointer;transition:all 0.12s;border:none;background:transparent;width:100%;text-align:left;font-family:inherit;font-weight:500;white-space:nowrap;}
.more-menu-item:hover{background:var(--hover);color:var(--acc);}
.more-menu-sep{height:1px;background:var(--border);margin:3px 0;}
/* ≤860px: topbar wraps, hide secondary buttons, show More */
@media(max-width:860px){
.topbar{flex-wrap:wrap;height:auto;padding:8px 12px;gap:6px;}
.topbar-logo-wrap{flex:0 0 auto;}
.topbar-right{flex-wrap:wrap;gap:4px;margin-left:auto;}
.topbar-right .btn.hide-sm{display:none;}
.more-menu-wrap{display:block;}
.container{padding:14px 10px;}
.add-bar{gap:6px;}
.repo-input{min-width:140px;}
.auth-bar{flex-wrap:wrap;}
}
/* ≤640px: stack add-bar, minimal topbar */
@media(max-width:640px){
.topbar-right .btn:not(.always-show-btn){display:none;}
.topbar-right a.btn{display:inline-flex;} /* keep Grasp link */
.add-bar{flex-direction:column;gap:8px;}
.add-bar .repo-input{width:100%;min-width:0;box-sizing:border-box;}
.add-bar .btn{width:100%;justify-content:center;}
.summary-strip{grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;}
.summary-card{padding:12px 14px;}
.container{padding:10px 8px;}
.auth-bar{flex-wrap:wrap;gap:6px;}
.token-input{min-width:120px;}
.charts-row{grid-template-columns:1fr;}
}
.chart-card{
background:var(--card-bg);border:1px solid var(--border);border-radius:10px;
padding:18px;transition:border-color .2s,box-shadow .2s;
animation:card-in .45s ease both;
}
.chart-card:hover{border-color:rgba(0,212,170,.25);box-shadow:0 4px 20px rgba(0,212,170,.08);}
.chart-title{font-size:10px;color:var(--t2);margin-bottom:14px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;}
/* ── Score bar chart ── */
.score-bars{display:flex;flex-direction:column;gap:9px;}
.score-bar-row{display:flex;align-items:center;gap:8px;font-size:10px;}
.score-bar-label{width:110px;color:var(--t2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0;}
.score-bar-track{flex:1;height:12px;background:rgba(255,255,255,.04);border-radius:6px;overflow:hidden;}
.score-bar-fill{height:100%;border-radius:6px;transition:width .7s cubic-bezier(.22,1,.36,1);}
.score-bar-num{width:32px;text-align:right;color:var(--t2);flex-shrink:0;font-weight:700;}
/* ── Issue breakdown ── */
.issue-list{display:flex;flex-direction:column;gap:8px;}
.issue-row{display:flex;align-items:center;gap:8px;font-size:10px;}
.issue-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;box-shadow:0 0 4px currentColor;}
.issue-name{flex:1;color:var(--t2);}
.issue-count{color:var(--t3);}
/* ── Empty state ── */
.empty{text-align:center;padding:72px 20px;color:var(--t3);}
.empty-icon{font-size:44px;margin-bottom:14px;animation:logo-float 3s ease-in-out infinite;}
.empty-sub{font-size:11px;margin-top:8px;color:var(--t3);}
.empty-title{font-size:14px;color:var(--t2);font-weight:600;margin-bottom:4px;}
/* ── Status bar ── */
.status-bar{
height:22px;
background:linear-gradient(90deg,var(--acc),var(--acc2),var(--acc));
background-size:200% 100%;
animation:shimmer 6s linear infinite;
display:flex;align-items:center;justify-content:flex-end;
padding:0 14px;font-size:9px;font-weight:700;font-family:var(--font);
gap:6px;color:rgba(0,0,0,.85);overflow:hidden;
position:fixed;bottom:0;left:0;right:0;z-index:100;
letter-spacing:.04em;
}
.status-bar span{opacity:.55;font-weight:400;}
/* ── Themes ── */
[data-theme="light"]{--bg0:#f8fafc;--bg1:#f1f5f9;--bg2:#e8f0f8;--bg3:#dde6f0;--bg4:#c8d8e8;--hover:#d5e2ef;--t0:#0f172a;--t1:#1e3a5f;--t2:#475569;--t3:#94a3b8;--acc:#00a884;--acc2:#008f70;--accbg:rgba(0,168,132,.08);--border:rgba(15,23,42,.09);--border2:rgba(15,23,42,.05);--card-bg:rgba(0,168,132,.04);}
[data-theme="matrix"]{--bg0:#000000;--bg1:#0a0f0a;--bg2:#0d140d;--bg3:#121b12;--t1:#00cc33;--t2:#00882a;--t3:#005511;--acc:#00ff41;--acc2:#00cc33;--border:rgba(0,255,65,.15);--card-bg:rgba(0,255,65,.04);}
[data-theme="amber"]{--bg0:#000000;--bg1:#0a0800;--bg2:#0f0e00;--bg3:#1a1500;--t1:#cc8a00;--t2:#886000;--t3:#554000;--acc:#ffb000;--acc2:#ffd060;--border:rgba(255,176,0,.18);--card-bg:rgba(255,176,0,.04);}
[data-theme="dracula"]{--bg0:#1e1f29;--bg1:#282a36;--bg2:#2d2f3f;--bg3:#363848;--t1:#d9d9d0;--t2:#6272a4;--t3:#44475a;--acc:#ff79c6;--acc2:#ff92d0;--border:rgba(98,114,164,.25);--card-bg:rgba(255,121,198,.04);}
[data-theme="nord"]{--bg0:#242933;--bg1:#2e3440;--bg2:#323846;--bg3:#3b4252;--t1:#d8dee9;--t2:#9da7b2;--t3:#616e7c;--acc:#88c0d0;--acc2:#a8d8e8;--border:rgba(236,239,244,.1);--card-bg:rgba(136,192,208,.04);}
[data-theme="tokyo"]{--bg0:#0d0e17;--bg1:#1a1b2e;--bg2:#1f2042;--bg3:#24264d;--t1:#9aa5ce;--t2:#6272a4;--t3:#414868;--acc:#7aa2f7;--acc2:#9bb5ff;--border:rgba(122,162,247,.12);--card-bg:rgba(122,162,247,.04);}
[data-theme="catppuccin"]{--bg0:#181825;--bg1:#1e1e2e;--bg2:#24273a;--bg3:#313244;--t1:#bac2de;--t2:#a6adc8;--t3:#6c7086;--acc:#cba6f7;--acc2:#ddb8ff;--border:rgba(203,166,247,.1);--card-bg:rgba(203,166,247,.04);}
[data-theme="gruvbox"]{--bg0:#1d2021;--bg1:#282828;--bg2:#3c3836;--bg3:#504945;--t1:#d5c4a1;--t2:#a89984;--t3:#7c6f64;--acc:#d79921;--acc2:#f0b030;--border:rgba(235,219,178,.12);--card-bg:rgba(215,153,33,.04);}
[data-theme="obsidian"]{--bg0:#0a0a0a;--bg1:#111111;--bg2:#161616;--bg3:#1c1c1c;--t1:#c9a84c;--t2:#9a7d35;--t3:#6b5520;--acc:#c9a84c;--acc2:#e8c060;--border:rgba(201,168,76,.18);--card-bg:rgba(201,168,76,.04);}
[data-theme="midnight"]{--bg0:#070a14;--bg1:#0a0f1e;--bg2:#0e1628;--bg3:#131e34;--t1:#b8c8ef;--t2:#6888cc;--t3:#3a5088;--acc:#4d9fff;--acc2:#70b8ff;--border:rgba(77,159,255,.12);--card-bg:rgba(77,159,255,.04);}
[data-theme="carbon"]{--bg0:#0f0f0f;--bg1:#161616;--bg2:#1c1c1c;--bg3:#262626;--t1:#c6c6c6;--t2:#8d8d8d;--t3:#525252;--acc:#0f62fe;--acc2:#4589ff;--border:rgba(82,82,82,.4);--card-bg:rgba(15,98,254,.04);}
[data-theme="noir"]{--bg0:#000000;--bg1:#0a0a0a;--bg2:#141414;--bg3:#1e1e1e;--t1:#cccccc;--t2:#888888;--t3:#444444;--acc:#ffffff;--acc2:#cccccc;--border:rgba(255,255,255,.12);--card-bg:rgba(255,255,255,.04);}
[data-theme="synthwave"]{--bg0:#0d0221;--bg1:#170a30;--bg2:#1e0f3f;--bg3:#271450;--t1:#d4a8ff;--t2:#9966cc;--t3:#663399;--acc:#ff2d87;--acc2:#ff80c0;--border:rgba(255,45,135,.2);--card-bg:rgba(255,45,135,.04);}
[data-theme="ocean"]{--bg0:#030d10;--bg1:#061520;--bg2:#0a1e2e;--bg3:#0e2740;--t1:#90d4ca;--t2:#4da8a0;--t3:#267870;--acc:#00dcc8;--acc2:#40ece0;--border:rgba(0,220,200,.12);--card-bg:rgba(0,220,200,.04);}
[data-theme="forest"]{--bg0:#0a120a;--bg1:#111b11;--bg2:#162316;--bg3:#1c2e1c;--t1:#a0c080;--t2:#6a8f50;--t3:#3d5a28;--acc:#7cba50;--acc2:#9ad270;--border:rgba(100,160,80,.15);--card-bg:rgba(124,186,80,.04);}
[data-theme="sunset"]{--bg0:#0f080e;--bg1:#1a1020;--bg2:#22162c;--bg3:#2e1d38;--t1:#ffaa88;--t2:#cc7755;--t3:#884422;--acc:#ff7755;--acc2:#ff9977;--border:rgba(255,119,85,.15);--card-bg:rgba(255,119,85,.04);}
[data-theme="hc"]{--bg0:#000000;--bg1:#000000;--bg2:#0a0a0a;--bg3:#111111;--t1:#ffffff;--t2:#ffff00;--t3:#ffee00;--acc:#ffff00;--acc2:#ffffaa;--border:rgba(255,255,0,.7);--card-bg:rgba(255,255,0,.06);}
[data-theme="solarized"]{--bg0:#fdf6e3;--bg1:#eee8d5;--bg2:#e3ddc8;--bg3:#d4cdb5;--t1:#002b36;--t2:#586e75;--t3:#657b83;--acc:#268bd2;--acc2:#4aa8e8;--border:rgba(7,54,66,.15);--card-bg:rgba(38,139,210,.06);}
[data-theme="matrix"] body::before{content:'';position:fixed;top:0;left:0;width:100%;height:100%;background:repeating-linear-gradient(0deg,transparent,transparent 3px,rgba(0,20,0,.18) 3px,rgba(0,20,0,.18) 4px);pointer-events:none;z-index:9998}
/* ── Theme button & picker ── */
.theme-btn-wrap{position:relative;display:inline-flex;}
.theme-btn{
background:transparent;border:1px solid var(--border);color:var(--t2);
font-family:var(--font);font-size:11px;padding:5px 9px;border-radius:5px;
cursor:pointer;transition:all .15s;
display:inline-flex;align-items:center;justify-content:center;line-height:1;
}
.theme-btn:hover{border-color:var(--acc);color:var(--t1);box-shadow:0 0 0 2px rgba(0,212,170,.1);}
.theme-picker{
position:absolute;top:calc(100% + 6px);right:0;width:180px;
background:var(--bg2);border:1px solid rgba(0,212,170,.18);
border-radius:9px;box-shadow:0 14px 44px rgba(0,0,0,.65);
z-index:2000;padding:4px;max-height:72vh;overflow-y:auto;
animation:slide-in-up .18s ease;
backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
}
.theme-pick-item{display:flex;align-items:center;gap:8px;width:100%;padding:5px 8px;background:none;border:none;border-radius:5px;cursor:pointer;color:var(--t2);font-size:11px;font-family:var(--font);text-align:left;transition:all .12s;}
.theme-pick-item:hover{background:rgba(0,212,170,.1);color:var(--t1);}
.theme-pick-item.active{background:rgba(0,212,170,.15);color:var(--acc);}
.theme-pick-swatch{width:10px;height:10px;border-radius:50%;flex-shrink:0;box-shadow:0 0 0 1px rgba(0,0,0,.2);}
.theme-pick-cat{font-size:8px;font-weight:700;color:var(--t3);text-transform:uppercase;letter-spacing:1px;padding:6px 8px 2px;cursor:default;}
/* ── Help FAB & modal ── */
.help-fab{
position:fixed;bottom:32px;right:16px;
background:linear-gradient(135deg,var(--acc),var(--acc2));
color:#fff;border:none;border-radius:20px;
padding:5px 13px;font-size:10px;font-weight:700;font-family:var(--font);
cursor:pointer;z-index:500;
box-shadow:0 2px 14px rgba(0,212,170,.45);
transition:all .15s;
animation:pulse-glow 3s ease-in-out infinite;
}
.help-fab:hover{opacity:1;transform:scale(1.05);animation:none;}
.kbd-fab{position:fixed;bottom:32px;right:72px;height:30px;width:30px;border-radius:50%;background:var(--bg2);border:1px solid var(--border);color:var(--t2);font-size:13px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:499;transition:all 0.2s;box-shadow:0 2px 8px rgba(0,0,0,0.3);font-family:var(--font);}
.kbd-fab:hover{transform:translateY(-2px);background:var(--bg3);color:var(--acc);box-shadow:0 6px 20px rgba(0,0,0,0.5);}
.kbd-popover{position:fixed;bottom:74px;right:16px;width:280px;background:rgba(20,22,30,0.93);border:1px solid var(--border);border-radius:10px;padding:14px 16px;color:var(--t1);font-size:11px;line-height:1.6;z-index:502;box-shadow:0 8px 32px rgba(0,0,0,0.55);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);font-family:var(--font);}
.kbd-popover-title{font-size:10px;font-weight:700;color:var(--acc);margin-bottom:8px;letter-spacing:0.5px;text-transform:uppercase;}
.kbd-row{display:flex;justify-content:space-between;gap:14px;padding:2px 0;}
.kbd-key{color:var(--t0);font-weight:600;white-space:nowrap;}
.kbd-desc{color:var(--t2);text-align:right;flex:1;}
.modal-overlay{
position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:1000;
display:flex;align-items:center;justify-content:center;padding:16px;
backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
}
.modal{
background:var(--bg1);border:1px solid rgba(0,212,170,.2);border-radius:13px;
width:100%;max-width:640px;max-height:88vh;display:flex;flex-direction:column;
box-shadow:0 24px 80px rgba(0,0,0,.85),0 0 0 1px rgba(0,212,170,.06);
animation:slide-in-up .22s ease;
}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);flex-shrink:0;}
.modal-title{font-size:13px;font-weight:700;color:var(--t1);}
.modal-close{background:none;border:none;color:var(--t3);font-size:18px;cursor:pointer;padding:0 4px;line-height:1;transition:color .12s;}
.modal-close:hover{color:var(--t1);}
.modal-body{overflow-y:auto;flex:1;padding:0;}
.modal-footer{padding:12px 18px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;flex-shrink:0;}
.modal-ok{
background:linear-gradient(135deg,var(--acc),var(--acc2));
color:#fff;border:none;border-radius:6px;padding:7px 20px;
font-size:11px;font-weight:700;font-family:var(--font);cursor:pointer;
transition:opacity .15s,transform .15s;
}
.modal-ok:hover{opacity:.85;transform:translateY(-1px);}
.help-section{padding:14px 18px;border-bottom:1px solid var(--border);}
.help-section:last-child{border-bottom:none;}
.help-section-title{font-size:10px;font-weight:700;color:var(--acc);text-transform:uppercase;letter-spacing:.08em;margin-bottom:9px;}
.help-kv{display:flex;align-items:baseline;gap:8px;padding:4px 0;border-bottom:1px solid rgba(255,255,255,.03);}
.help-kv:last-child{border-bottom:none;}
.help-key{font-size:10px;color:var(--t2);font-family:var(--font);flex-shrink:0;min-width:120px;}
.help-val{font-size:10px;color:var(--t3);line-height:1.5;}
.leaderboard { margin-top: 2rem; padding: 1rem 1.5rem; background: var(--card-bg, #1e293b); border-radius: 0.75rem; max-width: 480px; }
.leaderboard h3 { margin: 0 0 0.75rem; font-size: 1rem; color: var(--text, #f1f5f9); }
/* ── Live sync ── */
.sync-wrap{position:relative;display:inline-flex;align-items:center;}
.sync-btn{
background:transparent;border:1px solid var(--border);color:var(--t3);
font-family:var(--font);font-size:10px;padding:4px 9px;border-radius:5px;
cursor:pointer;transition:all .15s;white-space:nowrap;display:flex;align-items:center;gap:5px;
}
.sync-btn:hover{border-color:rgba(0,212,170,.4);color:var(--t1);}
.sync-btn.connected{border-color:rgba(34,197,94,.4);color:#22c55e;}
.sync-btn.connecting{border-color:rgba(245,158,11,.4);color:#f59e0b;}
.sync-dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex-shrink:0;}
.sync-dot.pulse{animation:dot-pulse 1.4s ease-in-out infinite;}
.sync-panel{
position:absolute;top:calc(100% + 5px);right:0;width:260px;
background:var(--bg2);border:1px solid rgba(0,212,170,.2);
border-radius:9px;box-shadow:0 12px 40px rgba(0,0,0,.7);
z-index:9000;padding:12px 14px;
animation:slide-in-up .18s ease;
backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
}
.sync-panel-title{font-size:10px;font-weight:700;color:var(--acc);text-transform:uppercase;letter-spacing:.08em;margin-bottom:10px;}
.sync-row{display:flex;align-items:center;gap:6px;margin-bottom:7px;}
.sync-label{font-size:10px;color:var(--t3);min-width:56px;}
.sync-input{flex:1;background:var(--bg3);border:1px solid var(--border);color:var(--t1);font-size:10px;font-family:var(--font);padding:4px 7px;border-radius:4px;outline:none;transition:border-color .15s;}
.sync-input:focus{border-color:var(--acc);}
.sync-connect-btn{width:100%;margin-top:4px;background:linear-gradient(135deg,var(--acc),var(--acc2));color:#fff;border:none;border-radius:5px;padding:6px;font-size:10px;font-weight:700;font-family:var(--font);cursor:pointer;transition:opacity .15s;}
.sync-connect-btn:hover{opacity:.85;}
.sync-disconnect-btn{width:100%;margin-top:4px;background:transparent;color:var(--red);border:1px solid rgba(255,95,95,.3);border-radius:5px;padding:5px;font-size:10px;font-weight:700;font-family:var(--font);cursor:pointer;transition:all .15s;}
.sync-disconnect-btn:hover{background:rgba(255,95,95,.1);}
.sync-presence{margin-top:8px;border-top:1px solid var(--border);padding-top:8px;}
.sync-presence-title{font-size:9px;color:var(--t3);margin-bottom:5px;}
.sync-peer{display:flex;align-items:center;gap:5px;font-size:10px;color:var(--t2);padding:2px 0;}
.sync-peer-dot{width:5px;height:5px;border-radius:50%;background:#22c55e;flex-shrink:0;}
.sync-peer.ro .sync-peer-dot{background:#f59e0b;}
.sync-share-row{margin-top:8px;border-top:1px solid var(--border);padding-top:8px;}
.sync-share-btn{width:100%;background:transparent;border:1px solid rgba(0,212,170,.3);color:var(--acc2);border-radius:5px;padding:5px;font-size:10px;font-family:var(--font);cursor:pointer;transition:all .15s;}
.sync-share-btn:hover{background:rgba(0,212,170,.1);color:#fff;}
.readonly-banner{
background:rgba(245,158,11,.1);border:1px solid rgba(245,158,11,.3);
border-radius:6px;padding:6px 14px;font-size:10px;color:#f59e0b;
text-align:center;margin-bottom:14px;display:none;
}
.readonly-banner.visible{display:block;}
.lb-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border, #334155); }
.lb-row:last-child { border-bottom: none; }
.lb-medal { font-size: 1.1rem; width: 1.5rem; text-align: center; }
.lb-repo { flex: 1; font-size: 0.85rem; color: var(--text-muted, #94a3b8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 0.9rem; font-weight: 600; }
/* ── Extra metric badges ── */
.badge-neutral{display:inline-block;padding:1px 5px;border-radius:3px;font-size:10px;background:rgba(148,163,184,.12);color:var(--t2);}
.badge-warn{display:inline-block;padding:1px 5px;border-radius:3px;font-size:10px;background:rgba(245,158,11,.15);color:#f59e0b;}
.badge-ok{display:inline-block;padding:1px 5px;border-radius:3px;font-size:10px;background:rgba(34,197,94,.15);color:#22c55e;}
.num-cell{text-align:right;}
/* ── DORA detail row ── */
.detail-row td{padding:0;border-bottom:1px solid var(--border);}
.repo-table tbody tr:not(.detail-row){cursor:pointer;}
</style>
</head>
<body>
<div class="topbar">
<div class="topbar-logo-wrap">
<svg class="logo-mark" viewBox="0 0 42 34" width="35" height="28" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<rect width="42" height="34" rx="9" fill="url(#db-lg-bg)"/>
<!-- graph nodes (shifted left) -->
<circle cx="14" cy="8" r="2.6" fill="#00d4aa"/>
<circle cx="6" cy="21" r="2.2" fill="#4d9fff" opacity="0.9"/>
<circle cx="22" cy="21" r="2.2" fill="#a78bfa" opacity="0.9"/>
<circle cx="14" cy="15" r="3.2" fill="url(#db-lg-center)"/>
<!-- edges -->
<line x1="14" y1="11.8" x2="14" y2="10.6" stroke="#00d4aa" stroke-width="1.5" stroke-linecap="round" opacity="0.9"/>
<line x1="11.2" y1="17.2" x2="8.2" y2="19.2" stroke="#4d9fff" stroke-width="1.5" stroke-linecap="round" opacity="0.8"/>
<line x1="16.8" y1="17.2" x2="19.8" y2="19.2" stroke="#a78bfa" stroke-width="1.5" stroke-linecap="round" opacity="0.8"/>
<path d="M7.6 22.8 Q14 27.4 20.4 22.8" stroke="rgba(0,212,170,0.35)" stroke-width="1" fill="none" stroke-linecap="round"/>
<!-- divider -->
<line x1="28" y1="6" x2="28" y2="28" stroke="rgba(255,255,255,0.07)" stroke-width="1"/>
<!-- bar chart (3 ascending bars) -->
<rect x="30" y="19" width="3.2" height="9" rx="1" fill="#00d4aa" opacity="0.9"/>
<rect x="34.6" y="15" width="3.2" height="13" rx="1" fill="#4d9fff" opacity="0.85"/>
<rect x="39.2" y="11" width="3.2" height="17" rx="1" fill="#a78bfa" opacity="0.8"/>
<defs>
<linearGradient id="db-lg-bg" x1="0" y1="0" x2="42" y2="34" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#0f2a2a"/>
<stop offset="100%" stop-color="#0a1628"/>
</linearGradient>
<radialGradient id="db-lg-center" cx="50%" cy="50%" r="50%">
<stop offset="0%" stop-color="#00d4aa"/>
<stop offset="100%" stop-color="#0077bb"/>
</radialGradient>
</defs>
</svg>
<div>
<div class="logo-text">grasp</div>
<div class="topbar-sub">Team Dashboard</div>
</div>
</div>
<div class="topbar-right">
<!-- Workspace switcher -->
<div class="ws-wrap" id="ws-wrap">
<button class="ws-btn" id="ws-btn" title="Workspaces — click to manage">
<span id="ws-name-label">Default</span> ▾
</button>
<div class="ws-dropdown" id="ws-dropdown" style="display:none;"></div>
</div>
<!-- Live sync button -->
<div class="sync-wrap" id="sync-wrap">
<button class="sync-btn" id="sync-btn" title="Live collaboration sync" onclick="toggleSyncPanel()">
<span class="sync-dot" id="sync-dot"></span>
<span id="sync-label">Sync</span>
</button>
<div class="sync-panel" id="sync-panel" style="display:none;"></div>
</div>
<a href="index.html" class="btn secondary always-show-btn" title="Open Grasp analyser"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>Grasp</a>
<button class="btn secondary hide-sm" onclick="shareWorkspace()" title="Copy shareable URL for this workspace"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>Share</button>
<button class="btn secondary hide-sm" onclick="reanalyzeAll()" title="Re-run analysis on all loaded repos"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/></svg>Re-analyze</button>
<button class="btn secondary hide-sm" onclick="exportCSV()" title="Export as CSV"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>CSV</button>
<button class="btn secondary hide-sm" onclick="exportJSON()" title="Export workspace as JSON"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>JSON</button>
<button class="btn secondary hide-sm" onclick="importJSON()" title="Import workspace from JSON file"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>Import</button>
<button class="btn secondary hide-sm" onclick="clearAll()"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>Clear</button>
<!-- More menu (visible ≤860px) -->
<div class="more-menu-wrap" id="more-wrap">
<button class="more-menu-btn" id="more-btn" title="More actions" aria-label="More actions" onclick="toggleMoreMenu()">···</button>
<div class="more-menu" id="more-menu" style="display:none;">
<button class="more-menu-item" onclick="shareWorkspace();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>Share</button>
<button class="more-menu-item" onclick="reanalyzeAll();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/></svg>Re-analyze all</button>
<div class="more-menu-sep"></div>
<button class="more-menu-item" onclick="exportCSV();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Download CSV</button>
<button class="more-menu-item" onclick="exportJSON();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Download JSON</button>
<button class="more-menu-item" onclick="importJSON();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>Import JSON</button>
<div class="more-menu-sep"></div>
<button class="more-menu-item" onclick="clearAll();closeMoreMenu()"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>Clear all repos</button>
</div>
</div>
<div class="theme-btn-wrap" id="theme-wrap">
<button class="theme-btn always-show-btn" id="theme-btn" title="Theme — click to cycle, hover for picker" aria-label="Theme"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 011.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg></button>
<div class="theme-picker" id="theme-picker" style="display:none;"></div>
</div>
</div>
</div>
<div class="container">
<!-- Read-only banner (shown when ?readonly=1) -->
<div class="readonly-banner" id="readonly-banner">👁 Read-only mode — you can view this workspace but cannot make changes</div>
<!-- Auth bar -->
<div class="auth-bar" id="auth-bar">
<span style="white-space:nowrap;color:var(--t3)">🔑 Auth</span>
<select class="auth-mode-select" id="auth-mode" onchange="onAuthModeChange(this.value)">
<option value="none">No Auth</option>
<option value="pat">GitHub Token (PAT)</option>
<option value="github_app">GitHub App</option>
<option value="gitlab">GitLab Token</option>
<option value="ghe">GitHub Enterprise</option>
<option value="bitbucket">Bitbucket</option>
<option value="azure">Azure DevOps</option>
<option value="gitea">Gitea</option>
</select>
<!-- GitHub PAT fields -->
<span id="auth-pat-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="token-input" class="token-input" type="password" placeholder="ghp_… personal access token" oninput="saveToken(this.value)">
<button class="auth-key-btn" onclick="clearToken()" style="font-size:9px">clear</button>
</span>
<!-- GitHub App fields -->
<span id="auth-app-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="app-id-input" class="auth-app-id" type="text" placeholder="App ID" oninput="saveAppId(this.value)">
<button class="auth-key-btn" id="key-btn" onclick="openKeyModal()"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg><span id="key-btn-text">Private key</span></button>
</span>
<!-- GitLab fields -->
<span id="auth-gitlab-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="gitlab-token-input" class="token-input" type="password" placeholder="glpat-… GitLab PAT" oninput="saveGitlabToken(this.value)">
<input id="gitlab-host-input" class="token-input" type="text" placeholder="self-hosted host (optional)" style="width:170px" oninput="saveGitlabHost(this.value)">
</span>
<!-- GitHub Enterprise fields -->
<span id="auth-ghe-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="ghe-token-input" class="token-input" type="password" placeholder="ghp_… GHE token" oninput="saveGheToken(this.value)">
<input id="ghe-host-input" class="token-input" type="text" placeholder="github.mycompany.com" style="width:170px" oninput="saveGheHost(this.value)">
</span>
<!-- Bitbucket fields -->
<span id="auth-bb-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="bb-username-input" class="token-input" type="text" placeholder="username" style="width:110px" oninput="saveBbUsername(this.value)">
<input id="bb-password-input" class="token-input" type="password" placeholder="app password" oninput="saveBbPassword(this.value)">
</span>
<!-- Azure DevOps fields -->
<span id="auth-azure-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="azure-pat-input" class="token-input" type="password" placeholder="Azure DevOps PAT" oninput="saveAzurePat(this.value)">
</span>
<!-- Gitea fields -->
<span id="auth-gitea-fields" style="display:none;align-items:center;gap:6px;flex-wrap:wrap">
<input id="gitea-token-input" class="token-input" type="password" placeholder="Gitea token" oninput="saveGiteaToken(this.value)">
<input id="gitea-host-input" class="token-input" type="text" placeholder="gitea.mycompany.com" style="width:170px" oninput="saveGiteaHost(this.value)">
</span>
<span id="auth-desc" class="auth-hint">60 req/hr · public repos only</span>
<button class="btn secondary" onclick="openLocalFolder()" title="Analyse a local folder" style="margin-left:auto;white-space:nowrap"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/></svg>Open Folder</button>
</div>
<!-- Private key modal -->
<div class="key-modal-overlay" id="key-modal-overlay" style="display:none" onclick="closeKeyModal(event)">
<div class="key-modal" onclick="event.stopPropagation()">
<div class="key-modal-title">🔐 GitHub App Private Key</div>
<div class="key-modal-sub">Paste the .pem private key from your GitHub App.<br>Stored in sessionStorage only — cleared when you close the tab. Never leaves your browser.</div>
<textarea id="key-textarea" placeholder="-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----"></textarea>
<div class="key-modal-btns">
<button class="btn secondary" onclick="closeKeyModal()">Cancel</button>
<button class="btn" onclick="savePrivateKey()">Save key</button>
</div>
</div>
</div>
<!-- Add repo -->
<div class="add-bar">
<input id="repo-input" class="repo-input" placeholder="owner/repo or GitHub URL… (GitLab via MCP)" onkeydown="if(event.key==='Enter')addRepo()">
<button class="btn" onclick="addRepo()"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>Add Repo</button>
<button class="btn secondary" onclick="addDefaults()"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.5 2l1.09 2.41L13 5.5l-2.41 1.09L9.5 9l-1.09-2.41L6 5.5l2.41-1.09L9.5 2z"/><path d="M19 9l.77 1.73L21.5 11.5l-1.73.77L19 14l-.77-1.73L16.5 11.5l1.73-.77L19 9z"/><path d="M14 17l.5 1.5 1.5.5-1.5.5-.5 1.5-.5-1.5L12 19l1.5-.5.5-1.5z"/></svg>Load examples</button>
</div>
<!-- Summary strip -->
<div id="summary-strip" class="summary-strip" style="display:none;"></div>
<!-- Empty state -->
<div id="empty-state" class="empty">
<div class="empty-icon">🏢</div>
<div class="empty-title">Add repos to get started</div>
<div class="empty-sub">Track health scores, team ownership, and trends across your entire portfolio</div>
<div class="empty-sub" style="margin-top:6px;font-size:10px;opacity:.6">Any public GitHub repo · Use a token for private repos</div>
</div>
<!-- Repo table -->
<div id="table-section" style="display:none;">
<div class="section-title">Repositories</div>
<div class="table-scroll-wrap">
<table class="repo-table" id="repo-table">
<thead>
<tr>
<th>Repository</th>
<th>Grade</th>
<th>Score</th>
<th class="bar-cell"></th>
<th>Trend</th>
<th>Score Trend</th>
<th>Files</th>
<th>Functions</th>
<th>Issues</th>
<th>Circular</th>
<th>Security</th>
<th title="Good pattern count">Patterns</th>
<th title="Env var issues">Env</th>
<th title="Feature flag count">Flags</th>
<th>Layers</th>
<th>Debt (days)</th>
<th>Owner</th>
<th>Status</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody id="repo-tbody"></tbody>
</table>
</div><!-- /.table-scroll-wrap -->
<div id="leaderboard-panel"></div>
</div>
<!-- Charts -->
<div id="charts-section" class="charts-row" style="display:none;">
<div class="chart-card">
<div class="chart-title">📊 Health Score by Repo</div>
<div id="score-chart" class="score-bars"></div>
</div>
<div class="chart-card">
<div class="chart-title">🐛 Issue Distribution</div>
<div id="issue-chart" class="issue-list"></div>
</div>
</div>
<!-- Registry -->
<div class="section-header" style="margin-top:32px;display:flex;align-items:center;justify-content:space-between">
<h2 style="font-size:14px;font-weight:700;color:var(--t0);margin:0">🗂️ Grasp Brain Registry</h2>
<button id="refresh-registry-btn" style="font-size:10px;padding:4px 10px;background:var(--bg1);border:1px solid var(--border);border-radius:6px;color:var(--t0);cursor:pointer;display:inline-flex;align-items:center;gap:5px;line-height:1"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/></svg>Refresh</button>
</div>
<div id="registry-panel" style="margin-top:10px;background:var(--bg1);border:1px solid var(--border);border-radius:10px;overflow:hidden">
<div id="registry-content" style="padding:16px;color:var(--t3);font-size:11px">
Connect Grasp Brain to see indexed repos here. Start with: <code>grasp analyze <path></code>
</div>
</div>
</div>
<script>
// ── State ─────────────────────────────────────────────────────────────────────
// Runtime repo rows: {id, name, status, data, error, owner, statusTag, notes, notesUpdatedAt, alertThreshold, scoreHistory}
var repos = [];
// ── Workspace Storage ─────────────────────────────────────────────────────────
// grasp_workspaces → [{id, name, createdAt}] (index)
// grasp_workspace_{id} → WorkspaceData (per workspace)
// grasp_active_workspace → active workspace id
var WS_PFX = 'grasp_workspace_';
var WS_IDX = 'grasp_workspaces';
var WS_ACT = 'grasp_active_workspace';
function loadWorkspaceIndex() { try { return JSON.parse(localStorage.getItem(WS_IDX) || '[]'); } catch(e) { return []; } }
function saveWorkspaceIndex(ix) { try { localStorage.setItem(WS_IDX, JSON.stringify(ix)); } catch(e) {} }
function getActiveWorkspaceId() { return localStorage.getItem(WS_ACT) || null; }
function setActiveWorkspaceId(id){ try { localStorage.setItem(WS_ACT, id); } catch(e) {} }
function loadWorkspace(id) { try { return JSON.parse(localStorage.getItem(WS_PFX + id) || 'null'); } catch(e) { return null; } }
function saveWorkspace(ws) { try { localStorage.setItem(WS_PFX + ws.id, JSON.stringify(ws)); } catch(e) {} }
function _makeRepoEntry(name, src) {
// src can be an existing WorkspaceData.repos entry to preserve team fields
return {
name: name,
owner: (src && src.owner) || '',
statusTag: (src && src.statusTag) || '',
notes: (src && src.notes) || '',
notesUpdatedAt: (src && src.notesUpdatedAt) || null,
alertThreshold: (src && src.alertThreshold) || null,
scoreHistory: (src && src.scoreHistory) || [],
commitHistory: (src && src.commitHistory) || []
};
}
function getOrCreateDefaultWorkspace() {
var idx = loadWorkspaceIndex();
var activeId = getActiveWorkspaceId();
// Load active workspace
if (activeId) { var ws = loadWorkspace(activeId); if (ws) return ws; }
// Fall back to first in index
if (idx.length) { var ws = loadWorkspace(idx[0].id); if (ws) { setActiveWorkspaceId(idx[0].id); return ws; } }
// Create default workspace — migrate from legacy grasp_dashboard key
var id = 'ws_' + Date.now();
var legacyNames = [];
try { var old = JSON.parse(localStorage.getItem('grasp_dashboard') || '[]'); if (Array.isArray(old)) legacyNames = old; } catch(e) {}
var ws = { id: id, name: 'Default', createdAt: Date.now(), repos: legacyNames.map(function(n){ return _makeRepoEntry(n, null); }) };
idx.push({ id: id, name: ws.name, createdAt: ws.createdAt });
saveWorkspaceIndex(idx);
saveWorkspace(ws);
setActiveWorkspaceId(id);
try { localStorage.removeItem('grasp_dashboard'); } catch(e) {}
return ws;
}
function getActiveWorkspace() {
var id = getActiveWorkspaceId();
if (id) { var ws = loadWorkspace(id); if (ws) return ws; }
return getOrCreateDefaultWorkspace();
}
// Persist the runtime repos array back into the active workspace
function saveState() {
var ws = getActiveWorkspace();
// Keep team-field data from persisted entries; merge current repo order
var stored = {};
ws.repos.forEach(function(e){ stored[e.name] = e; });
ws.repos = repos.map(function(r){ return _makeRepoEntry(r.name, stored[r.name] || r); });
saveWorkspace(ws);
}
// ── Team field helpers ─────────────────────────────────────────────────────────
function setRepoField(repoName, field, value) {
// Update runtime row
var row = repos.find(function(r){ return r.name === repoName; });
if (!row) return;
row[field] = value;
if (field === 'notes') row.notesUpdatedAt = Date.now();
// Persist
var ws = getActiveWorkspace();
var entry = ws.repos.find(function(e){ return e.name === repoName; });
if (entry) { entry[field] = value; if (field === 'notes') entry.notesUpdatedAt = row.notesUpdatedAt; }
saveWorkspace(ws);
}
function pushScoreHistory(repoName, score) {
var row = repos.find(function(r){ return r.name === repoName; });
var ws = getActiveWorkspace();
var entry = ws.repos.find(function(e){ return e.name === repoName; });
var hist = (entry && entry.scoreHistory) || (row && row.scoreHistory) || [];
hist.push({ score: score, ts: Date.now() });
if (hist.length > 10) hist = hist.slice(-10);
if (row) row.scoreHistory = hist;
if (entry) entry.scoreHistory = hist;
saveWorkspace(ws);
}
function pushCommitHistory(repoName, activity) {
if (!activity) return;
var row = repos.find(function(r){ return r.name === repoName; });
var ws = getActiveWorkspace();
var entry = ws.repos.find(function(e){ return e.name === repoName; });
var hist = (entry && entry.commitHistory) || (row && row.commitHistory) || [];
// Avoid duplicating same-day entries — only append if last entry was > 6 hours ago
var last = hist[hist.length - 1];
var now = Date.now();
if (!last || (now - last.ts) > 6 * 60 * 60 * 1000) {
hist.push({ c7d: activity.commits7d, c30d: activity.commits30d, ts: now });
if (hist.length > 14) hist = hist.slice(-14); // keep ~2 weeks of daily snapshots
if (row) row.commitHistory = hist;
if (entry) entry.commitHistory = hist;
saveWorkspace(ws);
} else {
// Update last entry in place (same day refresh)
last.c7d = activity.commits7d;
last.c30d = activity.commits30d;
if (row) row.commitHistory = hist;
if (entry) entry.commitHistory = hist;
saveWorkspace(ws);
}
}
// ── Status tag cycling ────────────────────────────────────────────────────────
var STATUS_CYCLE = ['stable', 'watch', 'in-refactor', 'deprecated', 'blocked', ''];
function cycleStatus(repoName) {
var row = repos.find(function(r){ return r.name === repoName; });
if (!row) return;
var idx = STATUS_CYCLE.indexOf(row.statusTag);
var next = STATUS_CYCLE[(idx + 1) % STATUS_CYCLE.length];
setRepoField(repoName, 'statusTag', next);
render();
}
// ── Workspace UI ──────────────────────────────────────────────────────────────
function renderWorkspaceLabel() {
var ws = getActiveWorkspace();
var el = document.getElementById('ws-name-label');
if (el) el.textContent = ws.name;
}
function buildWorkspaceDropdown() {
var dd = document.getElementById('ws-dropdown');
var idx = loadWorkspaceIndex();
var aid = getActiveWorkspaceId();
dd.innerHTML = '';
// List existing workspaces
idx.forEach(function(item) {
var div = document.createElement('div');
div.className = 'ws-item' + (item.id === aid ? ' active' : '');
div.innerHTML =
'<span class="ws-item-name">' + esc(item.name) + '</span>' +
(idx.length > 1 ? '<button class="ws-item-del" title="Delete workspace" onclick="deleteWorkspace(\'' + item.id + '\');event.stopPropagation()">✕</button>' : '');
div.onclick = function() { switchWorkspace(item.id); };
dd.appendChild(div);
});
// Divider + new workspace row
var sep = document.createElement('div');
sep.style.cssText = 'border-top:1px solid var(--border);margin:6px 0 4px;';
dd.appendChild(sep);
var row = document.createElement('div');
row.className = 'ws-new-row';
row.innerHTML = '<input class="ws-new-input" id="ws-new-name" placeholder="New workspace name…" onkeydown="if(event.key===\'Enter\')createWorkspace()"><button class="ws-new-btn" onclick="createWorkspace()">+</button>';
dd.appendChild(row);
}
function switchWorkspace(id) {
setActiveWorkspaceId(id);
repos = [];
hideWorkspaceDropdown();
var ws = getActiveWorkspace();
renderWorkspaceLabel();
ws.repos.forEach(function(entry){ addRepoByName(entry.name, entry); });
render();
}
function createWorkspace() {
var inp = document.getElementById('ws-new-name');
var name = (inp && inp.value.trim()) || 'Workspace';
var id = 'ws_' + Date.now();
var ws = { id: id, name: name, createdAt: Date.now(), repos: [] };
var idx = loadWorkspaceIndex();
idx.push({ id: id, name: name, createdAt: ws.createdAt });
saveWorkspaceIndex(idx);