BREP_plm 0.22.0

The next.BREP.io PLM server for the Rust B-rep CAD kernel: parts, revisions, lifecycle, checkout, BOMs and configurable workflows over an embedded SQLite store, with a browser UI and the document API the CAD app stores through.
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
/* The PLM page. One stylesheet, no framework, no web font: the server serves
   three static files and nothing fetches anything else. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #6a737d;
  --line: #d9dee4;
  --accent: #2f6feb;
  --danger: #b62324;
  --ok: #1a7f37;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --panel: #1c2024;
    --ink: #e6e9ed;
    --muted: #97a0aa;
    --line: #2e343b;
    --accent: #5a8cf0;
    --danger: #e5534b;
    --ok: #4ac26b;
  }
}

* { box-sizing: border-box; }

a { color: var(--accent); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.mono, code, textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* -- sign in ------------------------------------------------------------ */

.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 420px;
  width: 100%;
  display: grid;
  gap: 12px;
}

.card h1, .card h2 { margin: 0 0 4px; font-size: 18px; }

label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; color: var(--ink); }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  width: 100%;
}

textarea { min-height: 280px; resize: vertical; font-size: 12.5px; }

button {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.link { background: none; border: none; color: var(--accent); padding: 2px 6px; text-align: left; }
button.danger { background: var(--danger); }
/* A text button that warns: red text, never a red block. */
button.link.danger { background: none; color: var(--danger); }

/* -- shell -------------------------------------------------------------- */

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

header nav { display: flex; gap: 4px 14px; flex-wrap: wrap; min-width: 0; }
header a { white-space: nowrap; }
header a { color: var(--ink); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
header a:hover { border-bottom-color: var(--line); }
header a.current { border-bottom-color: var(--accent); }
.who { color: var(--muted); font-size: 13px; }

.view { padding: 20px; max-width: 1100px; margin: 0 auto; }
.view h1 { font-size: 20px; margin: 0 0 4px; }
.view h2 { font-size: 16px; margin: 20px 0 8px; }
.back { color: var(--accent); text-decoration: none; font-size: 13px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 360px; }

.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 12px 20px 0;
}
.error:empty { display: none; }

.empty { color: var(--muted); padding: 24px 0; text-align: center; }
p.more { text-align: center; margin: 12px 0; }

/* -- tables ------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td .number { font-family: ui-monospace, monospace; }

.state {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.state-draft    { color: var(--accent); border-color: var(--accent); }
.state-inreview { color: #b5820b; border-color: #b5820b; }
.state-released { color: var(--ok); border-color: var(--ok); }
.state-superseded, .state-obsolete { color: var(--muted); }

/* -- dialog ------------------------------------------------------------- */

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  min-width: min(440px, 92vw);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { display: grid; gap: 12px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 4px 0 0; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }

/* -- small pieces ------------------------------------------------------ */

input.short { max-width: 180px; }
textarea.short-area { min-height: 90px; }
.badge {
  display: inline-block;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge-family { color: #8250df; border-color: #8250df; }
.badge-template { color: #b5820b; border-color: #b5820b; }
.mode-fields { display: grid; gap: 12px; }

.warn {
  color: #9a6700;
  background: color-mix(in srgb, #d4a72c 12%, transparent);
  border: 1px solid color-mix(in srgb, #d4a72c 45%, transparent);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}
@media (prefers-color-scheme: dark) { .warn { color: #e3b341; } }

/* -- scripts ------------------------------------------------------------ */

table.hooks { margin: 10px 0; }
.scripts { display: grid; grid-template-columns: 240px 1fr; gap: 16px; margin-top: 16px; }
.scripts aside { min-width: 0; }
.file-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 60px;
}
.file-list li button {
  width: 100%;
  text-align: left;
  background: none;
  color: var(--ink);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  padding: 5px 8px;
  overflow-wrap: anywhere;
}
.file-list li button.current { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.file-list li.empty { color: var(--muted); padding: 8px; font-size: 13px; }
.script-editor { min-width: 0; }
/* `font: inherit` on form controls outranks the monospace rule above; code
   is edited in a code font. */
.script-editor textarea, input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.script-editor textarea { tab-size: 2; }
.script-editor textarea#script-text { min-height: 320px; }
.run-grid { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; }
.output {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  margin: 0;
}
.output.bad { border-color: var(--danger); }

/* -- catalog ------------------------------------------------------------ */

/* Wide tables scroll inside their own box, never the page. */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap table { min-width: 100%; }
select.narrow { width: auto; max-width: 240px; }
.catalog { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-top: 16px; }
.catalog aside { min-width: 0; display: grid; gap: 16px; align-content: start; }
.catalog .card { max-width: none; }
.tree {
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 60px;
}
.tree li button {
  width: 100%;
  display: flex;
  gap: 8px;
  text-align: left;
  background: none;
  color: var(--ink);
  padding: 5px 8px;
}
.tree li button.current { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tree li button .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.tree li.empty { color: var(--muted); padding: 8px; font-size: 13px; }
.category-panel { min-width: 0; }
.category-panel h2 { margin: 0; }
.category-panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.cat-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.attr-editor input, .attr-editor select { padding: 5px 7px; }
/* Narrow screens scroll the editor sideways rather than squeezing its inputs
   to a few characters. */
.attr-editor input:not([type=checkbox]) { min-width: 110px; }
.attr-editor select { min-width: 100px; }
.catalog .card h2 { margin: 0 0 4px; }
.attr-editor td { padding: 6px 8px; }
.attr-editor input[type=checkbox] { width: auto; }
a.button-link { color: var(--accent); text-decoration: none; font-size: 13px; }

.attr-form { display: grid; gap: 12px; }
.attr-form:empty { display: none; }
.attr-form .unit { display: flex; gap: 8px; align-items: center; }
.attr-form .unit span { color: var(--muted); white-space: nowrap; }
.req { color: var(--danger); }
.inert { border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; }
.inert label.inline { display: flex; margin: 4px 0; color: var(--muted); }
.inert label.inline input { width: auto; }

.details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 12px; margin: 14px 0; }
.details h2 { margin: 0; }
.details .toolbar { margin: 8px 0 0; }
.attrs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0 0; }
.attrs dt { color: var(--muted); }
.summary-attributes { width: 100%; max-width: 34rem; }
.summary-attributes .attrs { grid-template-columns: 9rem minmax(0, 1fr); align-items: center; }
.summary-attributes .attrs dt { overflow-wrap: anywhere; }
.summary-attributes .attrs dt label { margin: 0; }
.summary-attributes .attrs dd { min-width: 0; }
.summary-revision-choice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.summary-revision-choice select { width: auto; margin: 0; }
@media (max-width: 600px) {
  .summary-attributes .attrs { grid-template-columns: 7rem minmax(0, 1fr); gap: 4px 8px; }
}

.part-attribute-input { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 6px; }
.attribute-lock { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.part-attribute-input input, .part-attribute-input select { background: var(--panel); }
.part-attribute-input.is-read-only input, .part-attribute-input.is-read-only select { background: var(--bg); color: var(--muted); opacity: 1; cursor: default; }
.attrs dd { margin: 0; }
.attrs .missing { color: var(--danger); }
.attrs .inert-value { color: var(--muted); text-decoration: line-through; }
.tag {
  display: inline-block;
  padding: 0 8px;
  margin: 0 4px 2px 0;
  border-radius: 999px;
  font-size: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--ink);
  cursor: pointer;
  border: none;
}

@media (max-width: 800px) {
  .scripts, .run-grid, .catalog, .cat-fields { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .view { padding: 14px; }
  th, td { padding: 7px 8px; }
  header { padding: 10px 14px; }
}

/* -- settings ----------------------------------------------------------- */

.card.settings { max-width: 640px; }
label.check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; color: var(--ink); font-size: 14px; }
label.check input { width: auto; margin-top: 3px; }
.note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px 12px;
  margin: 8px 0;
}

/* -- sourcing ----------------------------------------------------------- */

.sourcing { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 12px; margin: 14px 0; }
.sourcing h2 { margin: 0; }
.sourcing > .toolbar { margin: 8px 0 0; }
.mp { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.mp:first-of-type { border-top: 0; }
.mp > .toolbar { flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.mp.preferred { border-left: 3px solid var(--ok); padding-left: 10px; }
.badge-preferred { color: var(--ok); border-color: var(--ok); }
.badge-nrnd { color: #b5820b; border-color: #b5820b; }
.badge-obsolete { color: var(--danger); border-color: var(--danger); }
table.offers { font-size: 13px; }
.break { white-space: nowrap; margin-right: 8px; }
.breaks { display: grid; gap: 8px; }
.break-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
input.tiny { width: 6em; }
.companies { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.companies > section { min-width: 0; }
.companies h2 { margin: 8px 0; }
.companies a, .sourcing a { color: var(--accent); }
.company-add { margin-top: 10px; }
.company-add input { max-width: 260px; }
@media (max-width: 800px) {
  .companies { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .row3 { grid-template-columns: 1fr; }
}

/* -- families, templates and the bake queue ------------------------------ */

label.inline-select { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
label.inline-select select { width: auto; max-width: 220px; }
.details h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
ul.plain a { color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spin-form { display: grid; gap: 12px; margin: 8px 0; }
.spin-form .toolbar { margin: 0; }
#fam-table td { white-space: nowrap; }
#fam-table td.note-cell { white-space: normal; min-width: 180px; font-size: 12.5px; color: var(--muted); }
#fam-table a, #bake-rows a { color: var(--accent); }
label.button-like {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  width: max-content;
}
label.button-like:hover { background: var(--bg); }
.report {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
}
.report.bad { border-left-color: var(--danger); }
.report ul { margin: 6px 0 0; padding-left: 18px; }
.st {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.st-current, .st-done { color: var(--ok); border-color: var(--ok); }
.st-new, .st-pending, .st-unstamped { color: var(--accent); border-color: var(--accent); }
.st-stale, .st-claimed { color: #b5820b; border-color: #b5820b; }
.st-blocked, .st-failed { color: var(--danger); border-color: var(--danger); }
.revision-context { margin-top: 6px; font-size: 12px; max-width: 260px; }
.revision-context details { margin-top: 4px; }
.revision-context summary, .revision-advanced summary { cursor: pointer; color: var(--muted); }
.revision-advanced { display: inline-block; margin: 4px; text-align: left; }
@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
}
/* A document key is one long unbreakable token; at phone width it wraps
   rather than widening the page. */
#editor-key { overflow-wrap: anywhere; }

/* -- structure: BOM, uses list, diff, where-used -------------------------- */

.tabs { display: flex; gap: 4px; margin: 10px 0 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab {
  background: none;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 6px 10px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
table.bom { font-size: 13px; }
table.bom th, table.bom td { padding: 6px 8px; }
table.bom td { white-space: nowrap; }
table.bom td.name { white-space: normal; min-width: 160px; }
table.bom td.num, table.bom th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.bom .pos { color: var(--muted); font-family: ui-monospace, monospace; }
table.bom .attrs-line { display: block; color: var(--muted); font-size: 12px; }
table.bom tr.assembly td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
table.bom a, #wu-rows a, #diff-rows a, .uses-editor a { color: var(--accent); }
.flag-chip {
  display: inline-block;
  padding: 0 6px;
  margin-left: 2px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #9a6700;
  border: 1px solid color-mix(in srgb, #d4a72c 60%, transparent);
  background: color-mix(in srgb, #d4a72c 12%, transparent);
  white-space: nowrap;
  cursor: help;
}
@media (prefers-color-scheme: dark) { .flag-chip { color: #e3b341; } }
.floating { color: var(--muted); font-size: 12px; }
.bom-totals { font-weight: 600; margin: 8px 0 0; }
.bom-totals .muted { font-weight: normal; }
#bom-warnings ul { margin: 4px 0 0; padding-left: 18px; }
.uses-editor input { padding: 5px 7px; }
.uses-editor input.rev { width: 6em; }
.uses-editor input.qty { width: 6em; }
.uses-editor input.unit { width: 5em; }
.uses-editor input.find { width: 4em; }
.uses-editor input.ref { min-width: 110px; }
.uses-add { margin: 10px 0 0; max-width: 520px; }
ul.results { margin-top: 4px; }
ul.results li button {
  width: 100%;
  text-align: left;
  background: none;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 5px 8px;
}
ul.results li button:hover { background: var(--bg); }
.change-added { color: var(--ok); }
.change-removed { color: var(--danger); }
.change-changed { color: #b5820b; }

/* -- account and security ---------------------------------------------- */
.account { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.account .card { margin: 0; }
.token-form { max-width: 520px; margin-top: 16px; }
.secret { max-width: 720px; border-color: color-mix(in srgb, #d4a72c 60%, transparent); }
.secret code { display: block; margin: 8px 0; padding: 8px; overflow-wrap: anywhere; user-select: all; }

/* -- the audit log ------------------------------------------------------- */
table.audit td { vertical-align: top; }
table.audit td.when { white-space: nowrap; }
table.audit .via { color: var(--muted); font-size: 12px; }
table.audit .action { font-weight: 600; }
table.audit .changes { font-size: 13px; }
table.audit .changes div { overflow-wrap: anywhere; }
table.audit .changes .field { color: var(--muted); }
table.audit .changes .arrow { color: var(--muted); padding: 0 4px; }
.audit-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
.audit-filter .toolbar { grid-column: 1 / -1; margin: 0; }

/* -- review and discussion ---------------------------------------------- */

.review-open     { color: #b5820b; border-color: #b5820b; }
.review-approved { color: var(--ok); border-color: var(--ok); }
.review-rejected { color: var(--danger); border-color: var(--danger); }
.review-withdrawn { color: var(--muted); }
header nav a .count {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 6px;
  margin-left: 2px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.round {
  border: 1px solid var(--line);
  border-left: 3px solid #b5820b;
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 8px 0;
}
.round .toolbar { flex-wrap: wrap; gap: 8px; margin: 0; }
.round ul { margin: 6px 0; }
.round ul.reviewers li, .round ul.decisions li { padding: 2px 0; }
.decide { display: grid; gap: 6px; margin-top: 8px; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 4px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
ul.thread { margin: 0; padding: 0; }
ul.thread ul.thread { margin-left: 18px; padding-left: 10px; border-left: 2px solid var(--line); }
ul.thread > li { padding: 6px 0; }
.comment-form { display: grid; gap: 6px; margin-top: 8px; }
.comment-form textarea, .decide textarea, #sb-note { min-height: 70px; font-family: inherit; font-size: 14px; }
table.overrides td { vertical-align: middle; }
table.overrides input:not([type=checkbox]), table.overrides select { min-width: 8em; }
details > summary { cursor: pointer; color: var(--muted); margin: 6px 0; }

/* -- replace everywhere --------------------------------------------------- */

dialog.wide { width: min(880px, 94vw); max-width: 94vw; }
dialog.wide .table-wrap { max-height: 42vh; overflow: auto; }
th { position: relative; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.result-written, .result-created { color: var(--ok, inherit); }
.result-refused { color: var(--danger, #b3261e); }

/* -- attachments ----------------------------------------------------------- */

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin: 10px 0; text-align: center;
}
.drop p { margin: 4px 0; }
.drop.over { border-color: var(--accent, #2f6fdf); background: color-mix(in srgb, var(--accent, #2f6fdf) 8%, transparent); }
.drop-options { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; }
.file-pick { color: var(--accent, #2f6fdf); text-decoration: underline; cursor: pointer; display: inline; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.thumb { max-width: 64px; max-height: 40px; vertical-align: middle; border: 1px solid var(--line); border-radius: 3px; margin-right: 6px; }
.att-preview { margin: 10px 0; text-align: center; }
.att-preview img { max-width: 100%; max-height: 60vh; border: 1px solid var(--line); border-radius: var(--radius); }
.crumbs button.link { padding: 2px 2px; }
.plain-list { list-style: none; padding: 0; margin: 6px 0; max-height: 40vh; overflow: auto; }
.plain-list li { padding: 2px 0; }
.ws-make { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-make input { width: 14em; margin: 0; }

/* Thumbnails (P9): a square picture of the part, or a neutral box when there
   is none. The pictures have a transparent background, so the box is what
   the model sits on in either theme. */
.thumb {
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  object-fit: contain;
  flex: none;
}
.thumb-xs { width: 28px; height: 28px; margin-right: 6px; }
.thumb-sm { width: 44px; height: 44px; }
.thumb-lg { width: 128px; height: 128px; }
.thumb-none {
  background:
    linear-gradient(135deg, transparent 46%, var(--line) 46%, var(--line) 54%, transparent 54%),
    var(--bg);
}
.thumb-cell { width: 52px; padding-right: 0; }
.rev-label { display: inline-flex; align-items: center; }
.part-head { display: flex; align-items: center; gap: 16px; }
.part-head h1 { margin: 0; }

/* Engineering layout: persistent navigation, object list and properties.
   All surfaces retain the shared BREP palette, including the dark theme. */
#shell { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; overflow: hidden; }
.application-header { grid-column: 1 / -1; display: block; position: relative; padding: 0; }
.titlebar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; min-height: 48px; }
.titlebar strong { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.app-mark { display: inline-grid; place-items: center; width: 25px; height: 25px; background: var(--accent); color: var(--panel); border-radius: var(--radius); }
.application-title, .perspective-label { color: var(--muted); font-size: 12px; }
.commandbar { display: flex; align-items: center; gap: 4px; padding: 3px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.commandbar button, .titlebar button { padding: 3px 10px; font-size: 12px; }
.command-divider { height: 20px; border-left: 1px solid var(--line); margin: 0 8px; }
.command-menu { position: relative; }
.command-menu summary { padding: 3px 10px; cursor: pointer; list-style: none; }
.command-menu summary::-webkit-details-marker { display: none; }
.command-menu summary:hover, .command-menu[open] summary { background: var(--panel); }
.command-menu > div { position: absolute; top: 100%; left: 0; min-width: 190px; padding: 5px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 6px 16px #0002; z-index: 20; }
.command-menu a, .command-menu button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0; border-radius: 0; background: transparent; color: var(--ink); text-decoration: none; font-size: 13px; }
.command-menu a:hover, .command-menu button:hover { background: var(--bg); }
.navigator { grid-column: 1; grid-row: 2; width: 225px; min-width: 175px; max-width: 380px; resize: horizontal; overflow: auto; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.pane-title { padding: 7px 12px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.navigator nav { padding: 10px 0; }
.navigator details { margin-bottom: 10px; }
.navigator summary { padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.navigator a { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 5px 12px 5px 32px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; font-size: 13px; }
.navigator a::before { content: 'â—‡'; color: var(--muted); font-size: 14px; width: 16px; text-align: center; }
.navigator a[data-icon=folder]::before { content: 'â–±'; }
.navigator a[data-icon=inbox]::before { content: 'â–¤'; }
.navigator a[data-icon=part]::before { content: 'â–§'; }
.navigator a[data-icon=queue]::before { content: '≡'; }
.navigator a:hover { background: var(--bg); }
.navigator a.current { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); }
.navigator-note { margin-top: auto; padding: 16px; font-size: 12px; color: var(--muted); }
.navigator-note span { font-size: 11px; }
.navigator-collapsed .navigator { display: none; }
.navigator-collapsed { grid-template-columns: 0 minmax(0, 1fr) !important; }
.work-area { grid-column: 2; grid-row: 2; min-width: 0; overflow: auto; }
.view { max-width: none; margin: 0; padding: 14px 16px 24px; }
.toolbar { gap: 8px; margin: 10px 0; }
.toolbar input, .toolbar select, .toolbar button { padding: 5px 8px; }
th, td { padding: 6px 9px; }
th { text-transform: none; letter-spacing: normal; }
#view-parts > .table-wrap { height: 42vh; min-height: 180px; overflow: auto; resize: vertical; border: 1px solid var(--line); background: var(--panel); }
#view-parts table { border: 0; overflow: visible; }
#view-parts thead { position: sticky; top: 0; z-index: 1; }
#parts-rows tr { cursor: pointer; }
#parts-rows tr:hover { background: var(--bg); }
#parts-rows tr.selected { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
#parts-rows tr.selected td:first-child { box-shadow: inset 3px 0 var(--accent); }
#parts-rows .thumb-sm { width: 30px; height: 30px; }
#parts-rows .thumb-cell { width: 42px; }
#parts-rows .inspect-part { font-size: 12px; }
.selection-pane { border: 1px solid var(--line); background: var(--panel); margin-top: 12px; }
.selection-pane .pane-title span { font-weight: 400; margin-left: 8px; }
#selection-content { display: flex; flex-wrap: wrap; gap: 20px 40px; padding: 18px; min-height: 190px; }
.selection-empty { color: var(--muted); margin: auto; font-size: 13px; }
.selection-object { display: flex; gap: 18px; min-width: 260px; align-items: center; }
.selection-object .thumb-lg { width: 110px; height: 110px; }
.selection-object h2 { margin: 0 0 4px; font-size: 16px; }
.selection-object p { margin: 0 0 12px; }
.selection-object a { color: var(--accent); }
.property-grid { display: grid; grid-template-columns: 130px minmax(100px, 1fr); align-content: start; gap: 5px 20px; font-size: 12px; margin: 0; }
.property-grid dt { color: var(--muted); }
.property-grid dd { margin: 0; overflow-wrap: anywhere; }
.object-tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); margin-top: 18px; }
.object-tabs button { border-radius: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 9px 16px; white-space: nowrap; }
.object-tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); background: var(--panel); }
.object-panel:not(.active) { display: none; }
.object-panel.active { margin-top: 0; padding-top: 8px; }
#part-thumb .thumb-lg { width: 192px; height: 192px; max-width: none; max-height: none; }
.statusbar { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; padding: 4px 12px; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 11px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .navigator { width: 180px; min-width: 155px; }
  .application-title { display: none; }
  .titlebar .who { max-width: 35vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 600px) {
  .navigator { width: 145px; min-width: 130px; }
  .navigator a { padding-left: 12px; font-size: 12px; }
  .navigator a::before { display: none; }
  .view { padding: 10px; }
  .perspective-label, .titlebar .who, .statusbar span:last-child { display: none; }
  .commandbar { padding: 3px; gap: 0; }
  .command-menu summary { padding: 3px 6px; }
  .selection-object { min-width: 0; flex-wrap: wrap; }
  #selection-content { padding: 12px; }
  .property-grid { grid-template-columns: 1fr; gap: 3px; }
  .property-grid dd { margin-bottom: 8px; }
}


/* Account and administration are accessed from the user avatar. */
.titlebar .user-menu { flex: none; }
.user-menu > summary { display: flex; align-items: center; gap: 5px; padding: 0; border-radius: 999px; }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); overflow: hidden; }
.user-chevron { color: var(--muted); padding-right: 4px; }
.user-menu > .user-menu-panel { left: auto; right: 0; top: calc(100% + 9px); width: 260px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 70px); overflow-y: auto; padding: 6px; border-radius: var(--radius); }
.user-menu-identity { display: grid; gap: 3px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.user-menu-identity strong { display: block; font-size: 14px; }
.titlebar .user-menu .who { display: block; max-width: none; white-space: normal; font-size: 12px; }
.user-menu-panel > a, .user-menu-admin > a, .user-menu-signout > button { padding: 7px 12px; border-radius: 3px; }
.user-menu-admin { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 5px; }
.user-menu-admin h2 { padding: 6px 12px 3px; margin: 0; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.user-menu-signout { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 5px; }

.import-steps { display: flex; flex-wrap: wrap; gap: 24px; padding: 12px 0; list-style: none; border-bottom: 1px solid var(--line); }
#view-native-import fieldset { border: 1px solid var(--line); padding: 16px; margin: 16px 0; min-width: 0; }
#view-native-import legend { font-weight: 600; }
#view-native-import .toolbar { flex-wrap: wrap; }
.import-table input, .import-table select { min-width: 135px; max-width: 240px; width: 100%; }
.import-table small { display: block; max-width: 260px; overflow-wrap: anywhere; color: var(--muted); padding-top: 5px; }
#ni-result-rows li { margin: 8px 0; overflow-wrap: anywhere; }
.import-tree, .import-tree ul { list-style: none; margin: 4px 0; padding-left: 18px; overflow-wrap: anywhere; }
.import-tree { padding-left: 0; }
.import-tree small { color: var(--muted); }
#ni-conflict-rows li { margin: 6px 0; overflow-wrap: anywhere; }

/* Responsive selection/detail workbench. Home is the user's navigation tree;
   there is no second, permanent navigation rail. */
#shell { grid-template-columns: minmax(0, 1fr); }
.work-area { grid-column: 1; min-width: 0; }
.top-nav { display: flex; flex: 1; align-items: center; flex-wrap: wrap; gap: 4px; padding: 0; }
.top-nav > a { padding: 8px 12px; border-radius: 5px; }
.top-nav > a.current { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); border-color: var(--accent); }
.top-nav .command-menu > div { left: auto; right: 0; }
.top-nav summary, .top-nav > button { min-height: 36px; }
.view, .toolbar, .detail-pane, .master-list { min-width: 0; }
.master-detail { display: grid; grid-template-columns: minmax(240px, 36%) minmax(0, 1fr); gap: 18px; align-items: start; }
.master-list, .detail-pane { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.master-list { padding: 8px; }
.detail-pane { padding: 20px; }
.detail-pane h2 { margin: 0 0 8px; font-size: 20px; overflow-wrap: anywhere; }
.detail-pane h3 { font-size: 14px; margin: 20px 0 8px; }
.detail-pane p, .detail-pane a, .detail-pane li { overflow-wrap: anywhere; }
.detail-back { display: none; }
.list-hint { margin: 4px 8px 12px; font-size: 12px; color: var(--muted); }
#home-tree { --tree-axis: 20px; --tree-branch: 18px; --tree-guide: var(--muted); }
#home-tree [role=group] { margin-left: var(--tree-axis); padding-left: var(--tree-branch); }
#home-tree [role=treeitem], #home-tree .tree-row { position: relative; }
#home-tree [role=group] > [role=treeitem]:not(:last-child)::before,
#home-tree [role=group] > [role=treeitem] > .tree-row::before {
  content: ""; position: absolute; left: calc(-1 * var(--tree-branch)); top: 0;
  bottom: 0; border-left: 1px dotted var(--tree-guide); pointer-events: none;
}
#home-tree [role=group] > [role=treeitem] > .tree-row::before { bottom: 50%; }
#home-tree [role=group] > [role=treeitem] > .tree-row::after {
  content: ""; position: absolute; left: calc(-1 * var(--tree-branch)); top: 50%;
  width: var(--tree-branch); border-top: 1px dotted var(--tree-guide); pointer-events: none;
}
.tree-stem { position: absolute; left: var(--tree-axis); top: 50%; bottom: 0;
  border-left: 1px dotted var(--tree-guide); pointer-events: none; }
.tree-row { display: flex; align-items: center; min-height: 42px; gap: 6px; padding: 3px 5px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; }
.tree-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.tree-icon { width: 20px; height: 20px; flex: 0 0 20px; color: var(--muted); }
.tree-icon-part { color: var(--accent); }
.tree-icon-folder { color: #b68b32; }
.tree-toggle { position: relative; z-index: 1; flex: 0 0 28px; padding: 2px; min-height: 32px; background: transparent; color: var(--ink); }
.tree-spacer { width: 28px; flex: 0 0 28px; }
.tree-row .state { padding: 1px 5px; font-size: 10px; }
[role=treeitem][aria-selected=true] > .tree-row { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border-color: var(--accent); }
[role=treeitem]:focus-visible { outline: none; }
[role=treeitem]:focus-visible > .tree-row { outline: 2px solid var(--accent); outline-offset: -2px; }
.tree-row:hover { background: var(--bg); }
.tree-row.drop-target { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); outline: 2px dashed var(--accent); }
.tree-empty { font-size: 12px; color: var(--muted); margin: 8px; }
.detail-heading { display: flex; gap: 16px; align-items: center; }
.folder-properties { display: grid; gap: 10px; max-width: 420px; margin: 8px 0 12px; }
.folder-properties > button { justify-self: start; }
.folder-properties input[readonly] { background: transparent; border-color: transparent; padding-left: 0; }
.detail-heading .thumb-lg { width: 64px; height: 64px; flex: 0 0 64px; }
.detail-heading > div { min-width: 0; }
.detail-heading p { margin: 4px 0; }
.revision-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.detail-properties { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr); gap: 7px 14px; font-size: 13px; }
.detail-properties dt { color: var(--muted); }
.detail-properties dd { margin: 0; overflow-wrap: anywhere; }
.detail-files { list-style: none; padding: 0; }
.detail-files li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.detail-files li > :first-child { flex: 1; min-width: 0; }
.detail-files small { color: var(--muted); }
.detail-preview { max-width: 100%; max-height: 350px; object-fit: contain; margin-top: 16px; }
.detail-pane details { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-pane details summary { cursor: pointer; font-size: 13px; font-weight: 600; min-height: 24px; }
.detail-pane details label { margin-top: 12px; }
.detail-pane details > button { margin: 10px 0; }
.selection-review { padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.detail-pane textarea { min-height: 84px; }
.inbox-item { display: flex; flex-direction: column; align-items: start; gap: 7px; width: 100%; text-align: left; padding: 14px; background: var(--panel); color: var(--ink); border: 1px solid transparent; border-bottom-color: var(--line); }
.inbox-item > * { overflow-wrap: anywhere; max-width: 100%; }
.inbox-item small { color: var(--muted); }
.inbox-item[aria-pressed=true] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
#catalog-layout .selection-pane { margin: 0; }
#catalog-layout .pane-title { display: none; }
#selection-content { display: block; padding: 0; min-height: 240px; }
.catalog-list .table-wrap { overflow: visible; }
.catalog-list table, .catalog-list tbody { display: block; width: 100%; border: 0; }
.catalog-list thead { display: none; }
.catalog-list tr { display: grid; grid-template-columns: 24px 96px minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 4px 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.catalog-list td { display: block; padding: 0; border: 0; min-width: 0; }
.catalog-list td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; align-self: start; padding-top: 4px; }
.catalog-list td:nth-child(2) { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
.catalog-list td:nth-child(3) { grid-column: 3; grid-row: 1; align-self: start; font-size: 13px; }
.catalog-list td:nth-child(4) { grid-column: 3; grid-row: 2; align-self: start; }
.catalog-list td:nth-child(10) { grid-column: 3; grid-row: 3; align-self: end; text-align: right; }
.catalog-list td:nth-child(5), .catalog-list td:nth-child(6), .catalog-list td:nth-child(7), .catalog-list td:nth-child(8), .catalog-list td:nth-child(9) { display: none; }
.catalog-list td::before { display: none !important; }
#parts-rows .thumb-cell { width: auto; }
.part-tile-preview { position: relative; display: block; width: 96px; height: 96px; }
.part-tile-preview > a { display: block; line-height: 0; }
#parts-rows .part-tile-preview .thumb { display: block; width: 96px; height: 96px; max-width: none; max-height: none; margin: 0; }
.part-tile-lock { position: absolute; left: 100%; top: 0; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: #d4a72c; }
.part-tile-identity { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.part-tile-name { display: block; font-size: 14px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
@container (max-width: 320px) {
  .catalog-list tr { grid-template-columns: 20px 64px minmax(0, 1fr); gap: 4px 8px; }
  .part-tile-preview { width: 64px; height: 80px; }
  #parts-rows .part-tile-preview .thumb { width: 64px; height: 80px; }
}
/* Container-sized cards cover both phones and narrow detail panes. */
.table-wrap { container-type: inline-size; min-width: 0; max-width: 100%; }
table { table-layout: fixed; }
th, td { overflow-wrap: anywhere; }
td.actions { white-space: normal; }
input, select, textarea { min-width: 0; max-width: 100%; }
.toolbar > *, .row2 > *, .row3 > * { min-width: 0; }
.object-tabs { flex-wrap: wrap; overflow: visible; }
.object-tabs button { white-space: normal; flex: 0 1 auto; }
.bom-scroll { max-width: 100%; overflow-x: auto; }
.bom-scroll table { min-width: 520px; table-layout: auto; }
#bom-panel table { table-layout: auto; }
@container (max-width: 850px) {
  .table-wrap:not(#bom-wrap):not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table,
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > tbody { display: block; border: 0; }
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > thead { display: none; }
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > tbody > tr { display: block; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 6px; }
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > tbody > tr > td { display: grid; grid-template-columns: minmax(75px, 30%) minmax(0, 1fr); gap: 8px; width: auto; padding: 7px 0; border: 0; text-align: left; white-space: normal; }
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > tbody > tr > td::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  .table-wrap:not(#bom-panel .table-wrap):not(.catalog-list .table-wrap) > table > tbody > tr > td > * { max-width: 100%; min-width: 0; }
}
@media (max-width: 720px) {
  .master-detail { display: block; }
  .master-detail > .detail-pane { display: none; }
  .master-detail.detail-open > .master-list { display: none; }
  .master-detail.detail-open > .detail-pane { display: block; }
  .detail-back { display: inline-block; margin-bottom: 16px; min-height: 44px; }
  .detail-pane { padding: 14px; }
  .view { padding: 12px; }
  .titlebar { padding: 4px 12px; gap: 4px 8px; flex-wrap: wrap; }
  .titlebar > .user-menu { margin-left: auto; }
  .application-title, #shell-back, .statusbar { display: none; }
  .top-nav { order: 1; flex-basis: 100%; padding: 0; gap: 2px; }
  .top-nav > a, .top-nav summary { padding: 10px 8px; font-size: 13px; min-height: 44px; }
  .top-nav > button { min-width: 40px; min-height: 44px; padding: 6px; }
  .top-nav .spacer { display: none; }
  .top-nav .command-menu > div { min-width: 200px; }
  .toolbar { align-items: stretch; }
  .toolbar .spacer { display: none; }
  .toolbar > input, .toolbar > select, .toolbar > label { flex: 1 1 160px; max-width: 100%; }
  .toolbar button, button.link, a.button-link { min-height: 40px; }
  .row2, .row3 { display: grid; grid-template-columns: minmax(0, 1fr); }
  .part-head { flex-wrap: wrap; }
  .part-head h1 { min-width: 0; overflow-wrap: anywhere; }
  .tree-row { min-height: 46px; }
  .tree-toggle { min-height: 40px; flex-basis: 30px; }
  #home-tree { --tree-axis: 21px; --tree-branch: 12px; }
  .object-tabs button { padding: 10px 8px; }
  dialog { width: calc(100% - 24px); max-width: calc(100% - 24px); min-width: 0; max-height: calc(100dvh - 24px); padding: 14px; }
  dialog form, dialog menu { min-width: 0; flex-wrap: wrap; }
  .import-table input, .import-table select { min-width: 0; }
}

/* Preserve hierarchy at every depth; scroll very deep trees inside their pane. */
#home-tree { overflow-x: auto; }
#home-tree .tree-row { min-width: 150px; }

/* Constrain side-by-side browsers to the available shell height. Each pane
   owns its overflow; a wheel at its boundary must not move the other pane. */
.split-view, .split-view-wide { padding-bottom: 0; }
.view > [role=status]:empty, #home-status:empty { display: none; }
#view-workspace { padding: 0; }
#home-layout { gap: 0; }
@media (min-width: 721px) {
  .work-area:has(> .split-view:not([hidden])) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .split-view:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
  .split-view > :not(.master-detail) { flex-shrink: 0; }
  .split-view > .master-detail { flex: 1; min-height: 0; overflow: hidden; align-items: stretch; }
  .master-detail > .master-list, .master-detail > .detail-pane { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}
@media (min-width: 801px) {
  .work-area:has(> .split-view-wide:not([hidden])) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .split-view-wide:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
  .split-view-wide > :not(.catalog):not(.scripts):not(.companies) { flex-shrink: 0; }
  .split-view-wide > :is(.catalog,.scripts,.companies) { flex: 1; min-height: 0; overflow: hidden; }
  /* Give dynamic split panes their own compositor scroll hit-test region. */
  .split-view-wide > :is(.catalog,.scripts,.companies) > * { transform: translateZ(0); min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .scripts-help { max-height: 25vh; overflow: auto; }
}

/* Open documents/pages stay reachable while either content pane scrolls. */
#shell { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.work-area { grid-row: 3; }
.open-pages { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: nowrap; min-width: 0; min-height: 42px; overflow-x: auto; background: var(--panel); border-bottom: 1px solid var(--line); }
.open-page { display: flex; flex: 0 0 auto; align-items: stretch; border-right: 1px solid var(--line); border-bottom: 2px solid transparent; }
.open-page.active { background: var(--bg); border-bottom-color: var(--accent); }
.open-page button { border: 0; border-radius: 0; background: transparent; color: var(--ink); margin: 0; }
.open-page-select { display: flex; align-items: center; gap: 8px; max-width: 280px; padding: 10px 12px; }
.open-page-select > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-page-close { padding: 6px 10px; font-size: 18px; }
.open-page button:hover { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.open-page button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.open-page-icon { display: inline-block; flex: 0 0 14px; width: 14px; height: 16px; border: 1.5px solid var(--muted); border-radius: 2px; }
.open-page-icon.folder { height: 11px; border-color: #b38325; position: relative; }
.open-page-icon.folder::before { content: ''; position: absolute; width: 6px; height: 3px; left: -1.5px; top: -5px; border: 1.5px solid #b38325; border-bottom: 0; border-radius: 2px 2px 0 0; }
.open-page-icon.part { width: 18px; height: 18px; flex-basis: 18px; border: 0; color: var(--accent); }
.open-page-icon.part svg { display: block; width: 18px; height: 18px; }
@media (max-width: 720px) { .open-page-select { max-width: 210px; } .open-page button { min-height: 44px; } }

.open-page-select[draggable=true] { cursor: grab; }
.open-page.dragging { opacity: .55; }
.open-page.drop-before { box-shadow: inset 3px 0 var(--accent); }
.open-page.drop-after { box-shadow: inset -3px 0 var(--accent); }

.file-document-content { min-width: 0; }
.selection-document { margin-top: 1rem; min-width: 0; }
.selection-document .document-pdf { height: 650px; }
.document-pdf { width: 100%; height: calc(100dvh - 230px); min-height: 350px; border: 1px solid var(--line); background: var(--panel); }
.document-image { max-width: 100%; max-height: 75vh; object-fit: contain; }
.markdown-source { width: 100%; min-height: 600px; font-family: ui-monospace,monospace; }
.document-modes [aria-pressed=true] { background: var(--accent); color: var(--panel); }
.markdown-visual { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }

/* BOM release problems stay on their rows, outside the table's document flow. */
.bom-warning-column { width: 28px; min-width: 28px; padding: 3px; text-align: center; }
.bom-warning-icon { border: 0; background: transparent; color: #9a6700; padding: 2px 4px; font-size: 16px; line-height: 1; }
.bom-warning-icon:hover { background: var(--bg); }
@media (prefers-color-scheme: dark) { .bom-warning-icon { color: #e3b341; } }
#bom-warning-dialog { max-width: min(560px, calc(100vw - 32px)); }
#bom-warning-dialog li { overflow-wrap: anywhere; }

/* Table tree: ancestry determines guides; column configuration stays independent. */
.bom-tree-controls { flex-wrap: wrap; gap: 8px; }
.bom-tree-cell { position: relative; padding: 0 8px 0 0 !important; white-space: nowrap; }
.bom-tree-entry { display: flex; align-items: center; min-height: 34px; }
.bom-tree-guide { position: static; width: 20px; flex: 0 0 20px; align-self: stretch; }
.bom-tree-guide.continues::before, .bom-tree-guide.elbow::before { content: ''; position: absolute; left: calc(20px * var(--bom-guide-index) + 10px); top: 0; bottom: 0; border-left: 1px solid var(--line); }
.bom-tree-guide.elbow.last::before { bottom: 50%; }
.bom-tree-guide.elbow::after { content: ''; position: absolute; left: calc(20px * var(--bom-guide-index) + 10px); width: 10px; top: 50%; border-top: 1px solid var(--line); }
.bom-tree-toggle, .bom-tree-spacer { width: 20px; flex: 0 0 20px; }
.bom-tree-toggle { border: 0; padding: 2px 0; background: transparent; color: var(--ink); }
.bom-tree-toggle:hover { background: var(--bg); }
.bom-tree-icon { width: 19px; height: 19px; margin: 0 6px 0 3px; flex: 0 0 19px; color: var(--accent); }

.bom-column-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 16px; margin: 16px 0; }
.bom-column-picker label { display: grid; gap: 6px; margin: 0; }
.bom-column-picker select { width: 100%; min-height: 320px; }
.bom-column-transfer { display: grid; gap: 10px; align-self: center; }
.bom-column-picker .toolbar { margin: 10px 0 0; }
@media (max-width: 600px) { .bom-column-picker { grid-template-columns: minmax(0,1fr); } .bom-column-transfer { display: flex; } }

table.bom th { overflow-wrap: normal; word-break: normal; }
/* An editable BOM cell keeps room for its value; the table scrolls sideways instead. */
table.bom [data-bom-field]:not([type=checkbox]) { min-width: 9rem; }
/* On a phone the BOM controls must not push the table below the fold: one
   tight wrap for the toolbar, the depth controls left to a wider screen, and
   the save hint in small type. */
@media (max-width: 640px) {
  #tab-bom > .toolbar { margin: 6px 0; gap: 6px 12px; }
  #tab-bom > .bom-tree-controls:empty { display: none; }
  #tab-bom > .toolbar .spacer { display: none; }
  .bom-tree-controls label.inline-select, .bom-tree-controls [data-bom-expand-to] { display: none; }
  #bom-edit-status { margin: 4px 0; font-size: 12px; }
  #bom-edit-status:empty { display: none; }
}
/* Phone tap targets: every control at least 24x24 CSS px (WCAG 2.5.8). A
   box inside its label is tapped through the label and keeps its size. */
@media (max-width: 640px) {
  .view input:is([type=checkbox], [type=radio]):not(label input) { width: 24px; min-width: 24px; height: 24px; margin: 0; flex: none; }
  .view td a[href], .view a.back { display: inline-block; padding: 3px 0; min-height: 24px; }
  .bom-warning-icon { min-width: 28px; min-height: 28px; }
  .view input[type=file] { min-height: 32px; }
}
#bc-form { width: 100%; max-width: none; }
#bc-form > label:first-child { max-width: 480px; }
#bc-form > .admin-only:not([hidden]) { display: flex; align-items: center; gap: 8px; }
#bc-form > label input[type=checkbox] { width: auto; margin: 0; }


/* Every two-pane page uses the same draggable, keyboard-accessible divider. */
.resizable-panes > .split-pane { min-width: 0; max-width: none; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.resizable-panes > .split-pane > h2:first-child { margin-top: 0; font-size: 18px; }
.resizable-panes > label.split-pane { align-content: start; }
.resizable-panes.split-panes-active { display: grid; grid-template-columns: var(--split-columns) !important; column-gap: 0 !important; align-items: stretch; }
.resizable-panes.split-panes-active > :not(.pane-divider) { min-width: 0; }
.resizable-panes > .pane-divider { display: none; }
.resizable-panes.split-panes-active > .pane-divider {
  display: block; align-self: stretch; position: relative; width: 10px; min-width: 0; min-height: 80px;
  padding: 0; margin: 0; cursor: col-resize; touch-action: none; user-select: none;
  background: transparent; overflow: visible !important; transform: none !important;
}
.pane-divider::before { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: var(--line); }
.pane-divider::after { content: ''; position: absolute; top: calc(50% - 18px); left: 3px; width: 4px; height: 36px; border-radius: 2px; background: var(--muted); }
.pane-divider:hover::before, .pane-divider:focus-visible::before, .pane-divider.dragging::before { background: var(--accent); }
.pane-divider:hover::after, .pane-divider:focus-visible::after, .pane-divider.dragging::after { background: var(--accent); }
.resizable-panes .split-middle { margin-inline: 8px; }
body.resizing-panes, body.resizing-panes * { cursor: col-resize !important; user-select: none !important; }

/* Native Markdown editor uses the same tokens and scalable icons as PLM. */
.plm-markdown-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; background: var(--bg); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.plm-markdown-toolbar button { display: inline-flex; justify-content: center; align-items: center; width: 32px; height: 32px; padding: 5px; color: var(--ink); }
.plm-markdown-toolbar button svg { width: 20px; height: 20px; }
.plm-markdown-toolbar button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); border-color: var(--accent); }
.plm-markdown-toolbar .format-bold { font-weight: 750; }
.plm-markdown-toolbar .format-italic { font-style: italic; }
.plm-markdown-toolbar .format-strikeThrough { text-decoration: line-through; }
.plm-markdown-toolbar select { width: auto; max-width: 140px; height: 32px; padding: 3px 6px; }
.plm-markdown-toolbar-separator { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.plm-markdown-content { min-height: 520px; padding: 24px; line-height: 1.65; overflow-wrap: anywhere; outline: none; }
.plm-markdown-content[contenteditable="true"]:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.plm-markdown-content p { margin: 0 0 1em; }
.plm-markdown-content h1, .plm-markdown-content h2, .plm-markdown-content h3, .plm-markdown-content h4, .plm-markdown-content h5, .plm-markdown-content h6 { margin: 1em 0 .5em; line-height: 1.3; color: var(--ink); }
.plm-markdown-content h1 { font-size: 2em; }
.plm-markdown-content h2 { font-size: 1.6em; }
.plm-markdown-content h3 { font-size: 1.3em; }
.plm-markdown-content h4 { font-size: 1.15em; }
.plm-markdown-content h5, .plm-markdown-content h6 { font-size: 1em; }
.plm-markdown-content > :first-child { margin-top: 0; }
.plm-markdown-content > :last-child { margin-bottom: 0; }
.plm-markdown-content ul, .plm-markdown-content ol { padding-left: 2em; margin: .5em 0 1em; }
.plm-markdown-content li > p { margin: 0; }
.plm-markdown-content li[data-task] { list-style: none; position: relative; }
.plm-markdown-content li > input[type="checkbox"] { width: auto; position: absolute; left: -1.6em; top: .35em; margin: 0; }
.plm-markdown-content blockquote { border-left: 3px solid var(--accent); padding: 0 0 0 16px; margin: 1em 0; color: var(--muted); }
.plm-markdown-content code { background: var(--bg); padding: 2px 4px; border-radius: 3px; }
.plm-markdown-content pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: var(--radius); }
.plm-markdown-content pre code { padding: 0; background: transparent; }
.plm-markdown-content table { width: 100%; border-collapse: collapse; margin: 1em 0; table-layout: auto; }
.plm-markdown-content th, .plm-markdown-content td { padding: 8px 10px; border: 1px solid var(--line); height: auto; white-space: normal; color: var(--ink); }
.plm-markdown-content th { background: var(--bg); text-align: left; }
.plm-markdown-content [data-align="center"] { text-align: center; }
.plm-markdown-content [data-align="right"] { text-align: right; }
.plm-markdown-content img { max-width: 100%; height: auto; }
.plm-markdown-content hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.plm-markdown-dialog { width: min(440px, calc(100vw - 32px)); }

.setup-steps { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; padding-left: 1.5rem; }
.setup-steps [aria-current="step"] { font-weight: bold; color: var(--accent, #338acb); }
.setup-content { max-width: 850px; }
.setup-content > label { display: block; margin: .8rem 0; }
.setup-content textarea { width: 100%; box-sizing: border-box; }
.setup-content input:not([type="checkbox"]), .setup-content select { display: block; min-width: 240px; }
#sw-result { white-space: pre-wrap; overflow-wrap: anywhere; }

.workflow-list {display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:1rem;}
.workflow-list article {border:1px solid #8885;padding:1rem;border-radius:8px;}
.wf-toolbar { gap: 16px; }
.wf-toolbar h1 { margin: 4px 0 0; }
#wf-saved { color: var(--muted); font-size: 13px; }
.wf-section { margin: 18px 0; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.wf-section h2, #wf-properties h2 { margin: 0 0 8px; font-size: 16px; }
.wf-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wf-section-heading p { margin: 0 0 12px; }
.workflow-meta { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.workflow-meta label { min-width: 0; }
.workflow-meta small { font-size: 12px; }
.workflow-meta select[multiple] { height: 100px; }
#view-workflow-editor .wf-checkbox { display: flex; align-items: center; gap: 8px; color: var(--ink); min-height: 36px; }
#view-workflow-editor input[type=checkbox] { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.wf-canvas-tip { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; margin: 8px 0 16px; font-size: 13px; }
.workflow-editor-layout { display: grid; grid-template-columns: 166px minmax(0,1fr) 280px; gap: 16px; align-items: start; }
#wf-palette { display: flex; flex-direction: column; gap: 6px; }
#wf-palette h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
#wf-palette button { text-align: left; cursor: grab; padding: 8px 10px; background: var(--bg); border-color: var(--line); color: var(--ink); }
#wf-palette button:active { cursor: grabbing; }
#wf-palette button:hover { border-color: var(--accent); }
#wf-palette strong, #wf-palette small { display: block; }
#wf-palette small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.workflow-canvas-scroll { overflow: auto; height: 680px; max-height: 75vh; min-height: 380px; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(var(--line) 1px,transparent 1px) var(--bg); background-size: 20px 20px; }
#wf-canvas { position: relative; min-width: 620px; min-height: 720px; }
#wf-paths { position: absolute; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#wf-paths path { fill: none; stroke: var(--accent); stroke-width: 2; }
#wf-paths text { font-size: 12px; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.workflow-node { position: absolute; width: 200px; height: 112px; color: var(--ink); }
.workflow-node.selected { outline: 2px solid var(--accent); outline-offset: 5px; }
.wf-node-shape { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
.wf-node-shape :is(rect,polygon) { fill:var(--panel); stroke:var(--accent); stroke-width:2; }
.wf-node-handle { position:relative; padding: 28px 26px; text-align:center; cursor:move; touch-action:none; height:100%; overflow:hidden; }
.wf-node-handle strong,.wf-node-handle small { display:block; overflow:hidden; text-overflow:ellipsis; }
.wf-node-handle strong { font-size:13px; line-height:17px; max-height:34px; }
.wf-node-handle small { color:var(--muted); font-size:10px; margin-bottom:4px; white-space:nowrap; }
.wf-decision .wf-node-handle { padding:32px 44px; }
.wf-decision .wf-node-handle small { font-size:9px; }
.wf-port { position:absolute; left:83px; z-index:2; width:34px; height:24px; border:2px solid var(--accent); border-radius:12px; background:var(--panel); padding:0; color:var(--accent); font-size:9px; font-weight:700; line-height:20px; touch-action:none; user-select:none; cursor:crosshair; }
.wf-port.input { top:-12px; }.wf-port.output { bottom:-12px; }
.wf-port.connecting, .wf-port.connect-target:hover { background: var(--accent); color: white; box-shadow: 0 0 0 4px var(--line); }
.wf-port.connect-target { outline: 2px dashed var(--accent); outline-offset: 3px; }
#wf-properties { padding: 16px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.wf-empty { margin-top: 24px; font-size: 13px; }
.wf-empty p { color: var(--muted); }
#wf-properties label,#wf-start-form label,#wf-task-forms label { display: grid; gap: 6px; margin: 14px 0; }
#wf-properties input:not([type=checkbox]),#wf-properties select,#wf-properties textarea,#wf-start-form input,#wf-start-form select,#wf-task-forms textarea,#wf-task-forms input:not([type=checkbox]),#wf-task-forms select { display: block; width: 100%; }
#wf-node-code { font-family: monospace; }
#wf-properties small { display: block; overflow-wrap: anywhere; font-size: 12px; }
.wf-keyboard-hint { margin: 12px 0 0; font-size: 12px; }
#wf-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,320px),1fr)); gap: 16px; }
#wf-fields fieldset { min-width: 0; margin: 8px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
#wf-fields legend { padding: 0 6px; font-weight: 600; }
#wf-fields label { display: grid; gap: 4px; margin: 10px 0; }
#wf-fields input,#wf-fields select { display: block; width: 100%; }
#view-workflow-editor :is(button,a,input,select,textarea,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.workflow-help { max-width: 880px; margin: 40px auto; padding: 0 24px 48px; }
.workflow-help h1 { font-size: 30px; }
.workflow-help h2 { margin-top: 32px; scroll-margin-top: 20px; }
.workflow-help nav { display: flex; flex-wrap: wrap; gap: 16px; }
.workflow-help table { width: 100%; }
.workflow-help td { white-space: normal; }
#wf-start-form,#wf-task-forms form {max-width:750px;border:1px solid #8885;padding:1rem;margin:1rem 0;}
.workflow-progress {display:flex;flex-wrap:wrap;gap:1rem;padding:1rem;list-style:none;}
.workflow-progress li {border:1px solid #8885;padding:.5rem;min-width:140px;}
.workflow-progress span,.workflow-progress small {display:block;}
@media(max-width:1200px) {
  .workflow-meta { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .workflow-editor-layout { grid-template-columns: 150px minmax(0,1fr); }
  #wf-properties { grid-column: 1 / -1; }
}
@media(max-width:650px) {
  .wf-section { padding: 12px; }
  .workflow-meta { grid-template-columns: 1fr; }
  .workflow-editor-layout { grid-template-columns: minmax(0,1fr); }
  #wf-palette { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  #wf-palette h3 { grid-column: 1 / -1; }
  #wf-palette button { padding: 8px; }
  .workflow-canvas-scroll { height: 380px; }
  .wf-canvas-tip { align-items: start; flex-direction: column; }
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.pagination label { display: flex; align-items: center; gap: 6px; margin: 0; }
.pagination select { width: auto; }

/* Unloaded views never expose controls from the previously opened part. */
[data-part-pending] > :not(.part-load-status),
[data-part-loading] > :not(.part-load-status) { display: none; }

#wf-paths .wf-connection-preview { stroke-dasharray: 6 4; stroke-width: 3; }
.workflow-node.connection-hover { outline: 3px solid var(--ok); outline-offset: 4px; }

/* Make path editing discoverable on the canvas. */
.wf-save-error { padding: 12px; border: 1px solid var(--accent); border-radius: 6px; background: var(--panel); overflow-wrap: anywhere; }
#wf-paths .wf-path-hit { stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
.wf-edit-path text { pointer-events: all; cursor: pointer; }
.wf-edit-path:hover path:not(.wf-path-hit), .wf-edit-path:focus-visible path:not(.wf-path-hit) { stroke-width: 4; }

.wf-run-chart { height:460px; margin:20px 0; }
.wf-run-chart .wf-node-handle { cursor:default; }
.wf-run-paths { position:absolute; inset:0; pointer-events:none; }
.wf-run-paths path { fill:none; stroke:var(--accent); stroke-width:2; }
.wf-run-paths text { font-size:12px; fill:var(--ink); paint-order:stroke; stroke:var(--bg); stroke-width:4px; }
.wf-untaken { opacity:.35; }
.wf-step-skipped { opacity:.45; }
.wf-step-waiting .wf-node-shape :is(rect,polygon) { stroke:var(--accent); stroke-width:3; }
.wf-step-failed .wf-node-shape :is(rect,polygon) { stroke:var(--bad); stroke-width:3; }
.wf-step-done .wf-node-shape :is(rect,polygon) { stroke:var(--ok); }

.wf-choice-port { transform:translate(-50%,-50%); width:auto; min-width:40px; max-width:120px; height:26px; padding:0 8px; line-height:22px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.wf-run-canvas { position:relative; }
#wf-paths .wf-arrowhead,.wf-run-paths .wf-arrowhead { fill:var(--accent); stroke:none; }

#wf-paths .wf-edit-path.selected path:not(.wf-path-hit) { stroke-width:4; stroke:var(--accent); }

/* The active workflow tab owns scrolling; diagram size follows its contents. */
#view-workflow-editor .workflow-editor-layout { grid-template-columns:166px minmax(var(--wf-canvas-width,620px),1fr) 280px; }
#view-workflow-editor .workflow-canvas-scroll { overflow:visible; height:auto; max-height:none; min-height:0; }
#view-workflow-editor #wf-canvas { min-height:0; }
#view-workflow-editor :is(#wf-palette,#wf-properties) { position:sticky; top:12px; align-self:start; max-height:calc(100dvh - 140px); overflow-y:auto; background:var(--panel); z-index:2; }
#view-workflow-editor #wf-properties { grid-column:auto; }
@media(max-width:1200px) {
  #view-workflow-editor .workflow-editor-layout { grid-template-columns:150px minmax(var(--wf-canvas-width,620px),1fr) 240px; }
}
@media(max-width:650px) {
  #view-workflow-editor .workflow-editor-layout { grid-template-columns:minmax(0,1fr); }
  #view-workflow-editor :is(#wf-palette,#wf-properties) { position:static; max-height:none; overflow:visible; }
}

.wf-run-chart { height:auto; max-height:none; overflow:visible; }

/* The desktop sign-in confirm card (/desktop-link). */
.desktop-link-code { font-family: ui-monospace, monospace; font-size: 22px; letter-spacing: 0.2em; }
#desktop-link .actions { display: flex; gap: 10px; }
#desktop-link-result.ok { color: var(--ink); font-weight: 600; }
#desktop-link-result:empty { display: none; }
#desktop-link .error { margin: 0; }

/* -- manufacturing: tools library and the jobs floor queue ---------------- */

.tool-picture { width: 48px; height: 48px; object-fit: contain; display: block; }
.jobs-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.job-card { text-align: left; padding: 14px; min-height: 64px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }
.job-steps { padding-left: 1.4em; display: grid; gap: 10px; }
.job-steps li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.job-steps li.signed { opacity: .75; }
.job-steps li.current { border-color: var(--accent); }
.job-sign { display: grid; gap: 8px; margin-top: 8px; }
.job-sign button { min-height: 44px; }

/* The Home tree's and part pages' right-click menu (Copy, Cut, Paste). */
.context-menu { position: fixed; z-index: 1000; min-width: 220px; max-width: min(360px, calc(100vw - 8px)); padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); display: grid; }
.context-menu button { background: transparent; color: var(--ink); border: 0; border-radius: 4px; text-align: left; padding: 7px 10px; font-size: 13px; min-height: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-menu button:hover:not(:disabled), .context-menu button:focus-visible { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); outline: none; }
.context-menu button:disabled { color: var(--muted); }
.context-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }