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
/* Vendored from kejadlen/gloss @ fb134aa388f33f6b5971724505e06fc5631636f4, 2026-10-13.
   Gloss ships this as plain CSS meant to be copied into a consuming
   project (see install.md) — there is no build step to run here.
   Refresh with `rake gloss:vendor GLOSS=/path/to/gloss/checkout`. */

/* Button
   No border, no ornament — hierarchy is ink density, not an outline. A
   STAMP (primary, dark, danger) is a solid block of colour; a QUIET action
   (default, ghost) carries no fill at rest and picks up a flat tint of the
   stock on hover, the same gesture as a CardRow. Variants: default, primary,
   dark, ghost, danger. Sizes: sm, md (default), lg — padding and font step
   only, weight and radius stay put.

   The default used to pad itself with --gl-space-xs/-s, which are the rungs
   a layout reaches for between two controls, not inside one: on a wide
   viewport they grew the default button taller than the large one. Every
   size now sits one rung further down the same scale — see the block at
   the bottom.

   The contract is the element itself: a bare <button> is styled directly, no
   class required. An <a> that acts like a button (navigates rather than
   changes something — see the Button page's "Links that act like buttons")
   opts in with a single `.btn` class, since a bare `a` selector would catch
   every ordinary prose link on the site. `:not(.icon-button)` keeps this
   block from leaking onto IconButton, which shares the <button> tag but is
   an entirely different shape. */

button:not(.icon-button),
a.btn {
  --_bg: transparent;
  --_fg: var(--gl-color-text-primary);
  --_pad-y: var(--gl-space-2xs);
  --_pad-x: var(--gl-space-xs);
  --_font: var(--gl-step--1);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gl-space-2xs);
  padding: var(--_pad-y) var(--_pad-x);
  border: none;
  border-radius: var(--gl-radius-md);
  background: var(--_bg);
  color: var(--_fg);
  font-family: var(--gl-font-mono);
  font-size: var(--_font);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--gl-dur-fast) var(--gl-ease),
              color var(--gl-dur-fast) var(--gl-ease),
              filter var(--gl-dur-fast) var(--gl-ease);
}

/* Quiet variants (default, ghost) carry no fill at rest; hovering picks up
   a flat tint of the stock instead of darkening a border that isn't there.
   Tabs are <button>s too but own their hover (tabs.css): this rule's
   specificity would otherwise paint the selected segment the colour of its
   own track until the pointer left it. */
:is(button:not(.icon-button), a.btn):not([role="tab"]):not([data-variant="primary"]):not([data-variant="dark"]):not([data-variant="danger"]):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--gl-color-surface-fill);
  color: var(--gl-color-text-primary);
}

/* Stamp variants (primary, dark, danger) are already ink — hovering just
   darkens the fill in place. */
:is(button:not(.icon-button), a.btn)[data-variant="primary"]:hover:not(:disabled):not([aria-disabled="true"]),
:is(button:not(.icon-button), a.btn)[data-variant="dark"]:hover:not(:disabled):not([aria-disabled="true"]),
:is(button:not(.icon-button), a.btn)[data-variant="danger"]:hover:not(:disabled):not([aria-disabled="true"]) { filter: brightness(0.96); }
:is(button:not(.icon-button), a.btn)[data-variant="primary"]:active:not(:disabled):not([aria-disabled="true"]),
:is(button:not(.icon-button), a.btn)[data-variant="dark"]:active:not(:disabled):not([aria-disabled="true"]),
:is(button:not(.icon-button), a.btn)[data-variant="danger"]:active:not(:disabled):not([aria-disabled="true"]) { filter: brightness(0.92); }

button:not(.icon-button):disabled,
:is(button:not(.icon-button), a.btn)[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

:is(button:not(.icon-button), a.btn)[data-variant="primary"] {
  --_bg: var(--gl-color-accent);
  --_fg: var(--gl-color-accent-fg);
}

/* Reserved for the single most-committing action in a view — a final Save,
   never a whole row of them. */
:is(button:not(.icon-button), a.btn)[data-variant="dark"] {
  --_bg: var(--gl-color-text-primary);
  --_fg: var(--gl-color-surface-page);
}

/* Same quiet block as default, one step further back: text-secondary at
   rest instead of text-primary. */
:is(button:not(.icon-button), a.btn)[data-variant="ghost"] {
  --_fg: var(--gl-color-text-secondary);
}

/* The source hardcodes this label white rather than deriving it — danger
   is not "on a filled accent surface", so --gl-color-accent-fg is reused
   here only because its resolved value is the same literal white, not
   because the two roles are the same thing. */
:is(button:not(.icon-button), a.btn)[data-variant="danger"] {
  --_bg: var(--gl-color-danger);
  --_fg: var(--gl-color-accent-fg);
}

/* Each size is one step of the space scale wide and, at the ends, one step
   of the type scale. Medium and large share a rung vertically and part on
   type size, which is what keeps them in order at every viewport width: the
   scale is fluid, so two sizes that differed only by which fluid rung they
   padded with could — and did — cross over on a wide screen. */
:is(button:not(.icon-button), a.btn)[data-size="sm"] { --_pad-y: var(--gl-space-3xs); --_pad-x: var(--gl-space-2xs); --_font: 0.8125rem; }
:is(button:not(.icon-button), a.btn)[data-size="lg"] { --_pad-x: var(--gl-space-s); --_font: var(--gl-step-0); }

:is(button:not(.icon-button), a.btn)[data-block] { width: 100%; }

/* Button group — [role="group"] is already the correct ARIA role for a
   toolbar of related buttons, so it doubles as the styling hook for free.
   A hairline divider stands in for the border the buttons themselves no
   longer carry — without one, two adjacent quiet buttons would read as a
   single wide button. */
[role="group"] {
  display: inline-flex;
  isolation: isolate;
}
[role="group"] > button { border-radius: 0; }
[role="group"] > button:first-child { border-start-start-radius: var(--gl-radius-md); border-end-start-radius: var(--gl-radius-md); }
[role="group"] > button:last-child { border-start-end-radius: var(--gl-radius-md); border-end-end-radius: var(--gl-radius-md); }
[role="group"] > button + button { border-inline-start: 1px solid var(--gl-color-border-hairline); }
[role="group"] > button:hover,
[role="group"] > button:focus-visible { z-index: 1; }

/* IconButton — a square icon-only button. Always needs an aria-label; it
   becomes both the accessible name and the native tooltip. There is no
   attribute that distinguishes "a button that is only an icon" from a plain
   Button, so this is the one sanctioned class in this file.

   The box is not a number of its own: it is written the way Button's height
   arrives — two rungs of padding around one 1.15 line of the label type it
   would carry if it had a label. So the two are the same height at every
   viewport width, and stay that way when the scale is retuned, instead of a
   fixed square drifting away from a fluid button. */
.icon-button {
  --_pad: var(--gl-space-2xs);
  --_line: var(--gl-step--1);
  --_size: calc(2 * var(--_pad) + 1.15 * var(--_line));
  --_bg: transparent;
  --_fg: var(--gl-color-text-secondary);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--_size);
  height: var(--_size);
  padding: 0;
  flex: none;
  border: none;
  border-radius: var(--gl-radius-md);
  background: var(--_bg);
  color: var(--_fg);
  cursor: pointer;
  transition: background-color var(--gl-dur-fast) var(--gl-ease),
              color var(--gl-dur-fast) var(--gl-ease);
}
.icon-button:hover:not(:disabled) { background: var(--gl-color-surface-fill); }
.icon-button:disabled { opacity: 0.5; cursor: default; }

/* Same two overrides Button's own sm and lg make, so the pairs stay level. */
.icon-button[data-size="sm"] { --_pad: var(--gl-space-3xs); --_line: 0.8125rem; }
.icon-button[data-size="lg"] { --_line: var(--gl-step-0); }

/* No border on either variant — "outline" keeps its name for API
   compatibility, but reads as a raised fill instead of a bordered box. */
.icon-button[data-variant="outline"] { --_bg: var(--gl-color-surface-fill); --_fg: var(--gl-color-text-primary); }
.icon-button[data-variant="accent"]  { --_bg: var(--gl-color-accent-soft); --_fg: var(--gl-color-accent-ink); }
/* Field
   The labeled field wrapper — a <label> that wraps its own caption text
   together with the control, so the association is native and needs no
   `for`/`id` pair. The caption is mono, uppercase, tracked — the same
   catalog-label convention as Badge and type-label.

   A <label> is reused for three different shapes across this system (this
   wrapper, Checkbox/Radio's row, Switch's row), so it cannot be styled bare
   without one shape leaking into another. Field is the one of the three with
   no distinguishing attribute of its own, so it gets the sanctioned class;
   Checkbox/Radio tell themselves apart structurally instead (see below). */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--gl-space-2xs);
  min-width: 0;
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gl-color-text-secondary);
}

/* Hint and error read the native fine-print element. `role="alert"` is a
   real live-region role for validation text, so it doubles as the selector
   that turns a hint red. */
.field > small {
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--2);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--gl-color-text-tertiary);
}
.field > small[role="alert"] { color: var(--gl-color-danger); }

/* Input / Select — bordered, matched to each other exactly. Both tags ARE
   the component, so they are styled bare; nothing else on this site uses a
   text input or a select. Inline padding is the xs rung less the border;
   block padding is a full xs rung, so a control stands a touch taller than
   a default Button. */
input:not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  padding: var(--gl-space-xs) calc(var(--gl-space-xs) - 1px);
  line-height: 1.15;
  background: var(--gl-color-surface-card);
  border: 1px solid var(--gl-color-border-default);
  border-radius: var(--gl-radius-sm);
  color: var(--gl-color-text-primary);
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--1);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  outline: none;
  transition: border-color var(--gl-dur-fast) var(--gl-ease),
              box-shadow var(--gl-dur-fast) var(--gl-ease);
}
input::placeholder { color: var(--gl-color-text-tertiary); }

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  border-color: var(--gl-color-accent);
  box-shadow: 0 0 0 2px var(--gl-color-accent-soft);
}

input:not([type="checkbox"]):not([type="radio"]):disabled,
select:disabled {
  opacity: 0.5;
  cursor: default;
}

/* The chevron is the one flagged color exception in this component set:
   CSS cannot point a data-URI background-image at a custom property, so its
   stroke is a literal hex rather than a var(--gl-*) reference. It is picked
   to match --gl-color-text-secondary and commented here so it is not
   mistaken for a stray color. */
select {
  appearance: none;
  padding-inline-end: var(--gl-space-l);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235f5d59' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--gl-space-xs) center;
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--gl-color-danger);
  background-color: var(--gl-color-danger-bg);
}

/* Checkbox / Radio — the real native controls, tinted with accent-color
   instead of a hand-drawn box. This is not just a rename: it deletes the
   custom SVG-checkmark markup entirely and lets the browser draw its own
   (platform-appropriate) check and dot. `role="switch"` is excluded here so
   Switch — a checkbox playing a different role — can style itself below
   without this rule fighting it. A <label> wrapping a checkbox/radio is told
   apart from Field's <label> structurally: it :has() one as a direct child,
   no class required. */
input[type="checkbox"]:not([role="switch"]),
input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--gl-color-accent);
  cursor: pointer;
}
input[type="checkbox"]:not([role="switch"]):focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--gl-color-accent);
  outline-offset: 2px;
}

label:has(> input[type="checkbox"]:not([role="switch"])),
label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: var(--gl-space-2xs);
  cursor: pointer;
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--1);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--gl-color-text-primary);
}
label:has(> input:disabled) { cursor: default; opacity: 0.5; }

/* Switch — for on/off settings only, never a substitute for Checkbox.
   `input[type="checkbox"][role="switch"]` is real ARIA (the correct role for
   a toggle), not an invented hook, but the visual track+thumb needs a second
   element for the thumb's independent position and transition — more than
   `appearance: none` plus pseudo-elements on the input itself can cleanly
   carry — so `.switch` is a deliberate, documented fallback class rather
   than a first choice. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--gl-space-2xs);
  cursor: pointer;
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--1);
  color: var(--gl-color-text-primary);
}
.switch input[role="switch"] { position: absolute; opacity: 0; width: 2.25rem; height: 1.25rem; margin: 0; }

.switch span {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: var(--gl-radius-full);
  background: var(--gl-color-border-default);
  transition: background-color var(--gl-dur-base) var(--gl-ease);
}
.switch span::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: var(--gl-radius-full);
  background: var(--gl-color-accent-fg);
  box-shadow: var(--gl-shadow-sm);
  transition: translate var(--gl-dur-base) var(--gl-ease);
}
.switch input[role="switch"]:checked + span { background: var(--gl-color-accent); }
.switch input[role="switch"]:checked + span::after { translate: 1rem 0; }
.switch input[role="switch"]:focus-visible + span { outline: 2px solid var(--gl-color-accent); outline-offset: 2px; }
.switch:has(input:disabled) { cursor: default; opacity: 0.5; }

/* Rows of fields — used by the settings-form pattern. `<form>`/`<fieldset>`
   are the elements that already mean this, so they are styled bare. A row
   grouping two fields side by side has no element of its own, so it keeps
   one plain class. */
form {
  display: flex;
  flex-direction: column;
  gap: var(--gl-space-s);
  max-width: 28rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--gl-space-xs);
}
/* Vertically stacked fields — the other half of form layout alongside
   .form-row's side-by-side pair. */
.field-stack { display: flex; flex-direction: column; gap: var(--gl-space-s); }
fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--gl-space-2xs);
  margin: 0;
  padding: 0;
  border: 0;
}
fieldset > legend {
  padding: 0 0 var(--gl-space-2xs);
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gl-color-text-secondary);
}
/* Badge
   A catalog mark, not a tinted pill: a small ink square in the tone colour
   plus mono uppercase text, on no background. No border, no radius — status
   reads as a marginal annotation on the row it belongs to, not a control.

   A <span> is too generic to style globally — it is used all over running
   prose for unrelated reasons — so Badge gets the one sanctioned class this
   shape needs. Tone is an attribute, not a modifier class. */

.badge {
  --_fg: var(--gl-color-text-secondary);

  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--_fg);
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  line-height: 1;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  flex: none;
  background: var(--_fg);
}

.badge[data-tone="accent"]  { --_fg: var(--gl-color-accent-ink); }
.badge[data-tone="success"] { --_fg: var(--gl-color-success); }
.badge[data-tone="danger"]  { --_fg: var(--gl-color-danger); }

.badge-set {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gl-space-2xs);
}

/* Tag
   A removable mono chip for freeform tags — locations, categories.
   `[data-dashed]` renders an "add tag" affordance instead of a value. Same
   reasoning as Badge: <span> is too generic to select bare, so Tag gets one
   class. The remove control is a real <button>, styled through the
   descendant selector rather than a class of its own. */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border: none;
  border-radius: var(--gl-radius-sm);
  background: var(--gl-color-surface-fill);
  color: var(--gl-color-text-secondary);
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--2);
  line-height: 1;
}

.tag[data-dashed] {
  background: transparent;
  border-style: dashed;
  color: var(--gl-color-text-tertiary);
  cursor: pointer;
}

.tag button {
  all: unset;
  cursor: pointer;
  color: var(--gl-color-text-tertiary);
  line-height: 1;
  font-size: 0.75rem;
}
.tag button:hover { color: var(--gl-color-text-primary); }

.tag-set {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
/* Card
   Flat surface, no border, radius-lg. `--gl-color-surface-card` is one
   neutral step lighter than the page around it — that tonal step, not an
   outline, is what marks the edge. `[data-elevated]` is opt-in and reserved
   for the one focused/primary card in a view — a dialog, the primary
   capture card — flat is the default everywhere else.

   A <div>/<article> is too generic to select bare, so Card keeps one
   sanctioned class. When Card's job is holding a list of rows — the common
   case, entry lists, task lists, settings rows — it is a real <ul class="
   card">, and CardRow is a bare <li> underneath it: no second class needed,
   the row look comes from the `.card > li` descendant selector alone. The
   first row's top border is removed automatically so callers never have to
   override it by hand. */

.card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--gl-color-surface-card);
  border: none;
  border-radius: var(--gl-radius-lg);
  box-shadow: none;
  overflow: hidden;
}

.card[data-elevated] { box-shadow: var(--gl-shadow-float); }

.card > li {
  display: flex;
  align-items: center;
  gap: var(--gl-space-xs);
  padding: var(--gl-space-xs) var(--gl-space-s);
  border-top: 1px solid var(--gl-color-border-hairline);
  color: var(--gl-color-text-primary);
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--1);
}
.card > li:first-child { border-top: none; }

/* A row whose ENTIRE content is wrapped in a real <button> or <a> — the
   accessible way to make a row clickable — fills the row edge-to-edge and
   picks up a hover fill and pointer cursor. `:only-child` is what tells this
   apart from a row that merely contains a small button among other content
   (a leading checkbox next to a title and a trailing value, say): only a
   button/anchor that IS the row's one and only child means "the whole row
   is the control." */
.card > li:has(> button:only-child),
.card > li:has(> a:only-child) {
  padding: 0;
}
.card > li > button:only-child,
.card > li > a:only-child {
  all: unset;
  display: flex;
  align-items: center;
  gap: var(--gl-space-xs);
  width: 100%;
  padding: var(--gl-space-xs) var(--gl-space-s);
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color var(--gl-dur-fast) var(--gl-ease);
}
.card > li > button:only-child:hover,
.card > li > a:only-child:hover { background: var(--gl-color-surface-fill); }

/* Documentation-only extras: a body/footer pair and a responsive grid, used
   by the prose pages (rationale.md, index.md, refusals.md) to show a Card
   as a plain content tile rather than a data row. Neither is part of
   Card's props — they exist because a content tile's inner layout has no
   element of its own to hang a selector on. .card-body ul is the same idea
   applied to a checklist tile (refusals.md) instead of a single paragraph. */
.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--gl-space-2xs);
  padding: var(--gl-space-m);
}
.card-body h3 { margin: 0; font: 600 var(--gl-step-0)/1.3 var(--gl-font-sans); }
.card-body p,
.card-body ul { margin: 0; color: var(--gl-color-text-secondary); font-size: var(--gl-step--1); }
.card-body ul { padding-left: 1.125em; }
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gl-space-xs);
  margin-top: auto;
  padding: var(--gl-space-xs) var(--gl-space-m);
  border-top: 1px solid var(--gl-color-border-hairline);
  background: var(--gl-color-surface-fill);
}

.card[data-link] { transition: box-shadow var(--gl-dur-fast) var(--gl-ease); }
.card[data-link]:hover { box-shadow: var(--gl-shadow-sm); }
.card[data-link]:focus-within { outline: 2px solid var(--gl-color-accent); outline-offset: 2px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--gl-space-s);
}

/* Avatar — lives here because it almost never appears outside a card or a
   row (the Loop dashboard's initials chip, Archive's file-type chip). A
   <span> is too generic for a bare selector, so it keeps one class. */
.avatar {
  --_size: 1.875rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--_size);
  height: var(--_size);
  flex: none;
  border-radius: var(--gl-radius-full);
  background: var(--gl-color-accent-soft);
  color: var(--gl-color-accent-ink);
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--2);
  font-weight: 600;
  overflow: hidden;
}
.avatar[data-square] { border-radius: var(--gl-radius-md); background: var(--gl-color-surface-fill); color: var(--gl-color-text-secondary); border: 1px solid var(--gl-color-border-hairline); }
.avatar[data-size="sm"] { --_size: 1.5rem; }
.avatar[data-size="lg"] { --_size: 2.25rem; }
/* Tooltip — a dark mono label on hover, positioned above the child. Pure CSS:
   the trigger and bubble are siblings inside one relatively-positioned span,
   shown on :hover/:focus-within so it works from the keyboard too.

   `[role="tooltip"]` is the correct ARIA role for the bubble itself, so it
   doubles as the styling hook — zero classes there. The wrapping span has no
   attribute of its own, but it does not need one: `:has()` picks out "a span
   that contains a [role=tooltip] bubble" precisely, without reaching for a
   class on an otherwise-generic element. */
span:has(> [role="tooltip"]) {
  position: relative;
  display: inline-flex;
}

[role="tooltip"] {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--gl-radius-sm);
  background: var(--gl-color-text-primary);
  color: var(--gl-color-surface-page);
  font-family: var(--gl-font-mono);
  /* 11px is the source's own literal choice — smaller than --gl-step--2, the
     smallest step on the scale, because a tooltip is meant to read as a
     glance-only aside rather than body text. */
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.4;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--gl-dur-fast) var(--gl-ease);
}
span:has(> [role="tooltip"]):hover > [role="tooltip"],
span:has(> [role="tooltip"]):focus-within > [role="tooltip"] {
  opacity: 1;
  visibility: visible;
}

/* Toast — the real pattern used for delete confirmations: a flat bar with an
   optional destructive action and a dismiss. `[data-fixed]` pins it
   bottom-right for real use; without it the toast stays in document flow for
   documentation. `role="status"` is the correct live-region role for a
   transient status message, so it is both the accessibility hook and the
   style selector — no base class needed. The action and dismiss buttons are
   plain <button>s told apart by `aria-label="Dismiss"`, an attribute they
   need anyway for the icon-only close control. */
[role="status"] {
  display: flex;
  align-items: center;
  gap: var(--gl-space-xs);
  min-width: 20rem;
  padding: var(--gl-space-xs) var(--gl-space-s);
  background: var(--gl-color-surface-card);
  border: 1px solid var(--gl-color-border-default);
  border-radius: var(--gl-radius-md);
  box-shadow: var(--gl-shadow-float);
  color: var(--gl-color-text-primary);
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--2);
}
[role="status"][data-fixed] {
  position: fixed;
  inset-block-end: var(--gl-space-s);
  inset-inline-end: var(--gl-space-s);
  z-index: 60;
}
[role="status"] > span { flex: 1; }
[role="status"] button {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  color: var(--gl-color-danger);
}
[role="status"] button[aria-label="Dismiss"] {
  color: var(--gl-color-text-tertiary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
}
[role="status"] button[aria-label="Dismiss"]:hover { color: var(--gl-color-text-primary); }

/* Dialog — the native <dialog> element: a centered modal, flat surface, no
   colored header, hairline dividers between title/body/footer. A <header>
   holds the title and a <footer> holds the actions, matching the elements
   the tag already wants; everything else in between is the body, styled by
   excluding those two rather than by a class of its own.

   `.dialog-demo` scopes a static, always-open example to its own preview
   container instead of the viewport, so it can sit safely inside a
   documentation page — this is a doc-only affordance, not part of Dialog's
   contract. It relies on the browser's own dialog centering: the UA
   stylesheet already gives an open <dialog> `position: absolute; inset: 0;
   margin: auto`, which centers it inside the nearest positioned ancestor —
   here, `.dialog-demo` itself. A real `.showModal()` call gets the genuine
   viewport-fixed overlay and `::backdrop` for free; a plain `open` attribute
   (used here so the demo renders without JavaScript) does not paint a
   backdrop at all, since `::backdrop` only exists for a dialog shown
   modally — wire the real open/close state and call `.showModal()` in the
   consuming app. */
.dialog-demo {
  position: relative;
  min-height: 20rem;
  background: var(--gl-color-surface-fill);
  border-radius: var(--gl-radius-lg);
}

dialog {
  width: 26rem;
  max-width: calc(100% - (2 * var(--gl-space-s)));
  height: fit-content;
  padding: 0;
  background: var(--gl-color-surface-card);
  border: 1px solid var(--gl-color-border-hairline);
  border-radius: var(--gl-radius-lg);
  box-shadow: var(--gl-shadow-float);
  color: var(--gl-color-text-primary);
  overflow: hidden;
}
dialog::backdrop {
  background: rgba(20, 18, 14, 0.35);
}
dialog > header {
  padding: var(--gl-space-s) var(--gl-space-m);
  border-bottom: 1px solid var(--gl-color-border-hairline);
  font-family: var(--gl-font-sans);
  font-weight: 600;
  font-size: var(--gl-step-0);
  color: var(--gl-color-text-primary);
}
dialog > footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--gl-space-2xs);
  padding: var(--gl-space-s) var(--gl-space-m);
  border-top: 1px solid var(--gl-color-border-hairline);
}
dialog > *:not(header):not(footer) {
  padding: var(--gl-space-m);
  margin: 0;
  color: var(--gl-color-text-primary);
  font-size: var(--gl-step--1);
}
/* Tabs
   Follows the real WAI-ARIA tabs pattern: a `[role="tablist"]` of
   `[role="tab"]` buttons controlling `[role="tabpanel"]`s. Those roles are
   required for the pattern to be accessible in the first place, so they
   double as the entire styling contract — no classes at all for the base
   shape. The keyboard wiring lives in assets/js/system.js and is
   variant-agnostic — it only cares about `[data-tabs]` / `[role=tab]`.

   Two real variants: `underline` (mono labels over a hairline, the selected
   one marked by a short accent bar — primary section nav, the default) and
   `segmented` (pill track, active segment lifts to the surface — filters
   like All · Overdue · Upcoming, never primary navigation), chosen with `data-variant="segmented"` on the tablist since
   neither has a natural attribute of its own. */

/* Every rule below the list container pairs [role="tablist"] with
   [role="tab"] rather than styling [role="tab"] alone — Tab buttons are
   still literal <button> elements, so the compound selector's extra
   specificity is what keeps Button's base styling (button.css) from
   winning the cascade on shared properties like padding and background. */

[role="tablist"] {
  display: flex;
  gap: var(--gl-space-3xs);
  border-bottom: var(--gl-border-w) solid var(--gl-color-border-hairline);
}

/* Underline. Mono labels standing on the hairline, with a 2px accent bar
   drawn over the hairline under the selected label. Hover fills the tab
   with surface-fill-2, squared off at the bottom so it reads as a tab
   standing on the line rather than a floating pill. It is one step darker
   than the surface-fill a quiet Button uses, because at ~1.1:1 that one
   all but vanished on the card; hover also darkens the label to
   text-primary. The bar is a pseudo-element, not a border, so it lies flat
   instead of inheriting the button's radius and curling up at the ends.
   Scoped away from segmented, which shares the element but none of this
   shape. */
[role="tablist"]:not([data-variant="segmented"]) [role="tab"] {
  position: relative;
  padding: var(--gl-space-3xs) var(--gl-space-2xs);
  background: none;
  border: 0;
  border-radius: var(--gl-radius-sm) var(--gl-radius-sm) 0 0;
  color: var(--gl-color-text-secondary);
  font-family: var(--gl-font-mono);
  font-size: var(--gl-step--1);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.15;
  cursor: pointer;
  transition: background-color var(--gl-dur-fast) var(--gl-ease), color var(--gl-dur-fast) var(--gl-ease);
}
[role="tablist"]:not([data-variant="segmented"]) [role="tab"]::after {
  content: "";
  position: absolute;
  inset-inline: var(--gl-space-2xs);
  bottom: calc(-1 * var(--gl-border-w));
  height: 2px;
  background: transparent;
  transition: background-color var(--gl-dur-fast) var(--gl-ease);
}
[role="tablist"]:not([data-variant="segmented"]) [role="tab"]:hover {
  background: var(--gl-color-surface-fill-2);
  color: var(--gl-color-text-primary);
}
[role="tablist"]:not([data-variant="segmented"]) [role="tab"][aria-selected="true"] {
  color: var(--gl-color-text-primary);
}
[role="tablist"]:not([data-variant="segmented"]) [role="tab"][aria-selected="true"]::after {
  background: var(--gl-color-accent);
}

[role="tablist"][data-variant="segmented"] {
  display: inline-flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  border-bottom: 0;
  background: var(--gl-color-surface-fill);
  border-radius: var(--gl-radius-md);
}
[role="tablist"][data-variant="segmented"] [role="tab"] {
  all: unset;
  cursor: pointer;
  padding: 0.375rem 0.875rem;
  border-radius: var(--gl-radius-sm);
  font-family: var(--gl-font-sans);
  font-size: var(--gl-step--1);
  font-weight: 550;
  color: var(--gl-color-text-secondary);
  transition: background-color var(--gl-dur-fast) var(--gl-ease), color var(--gl-dur-fast) var(--gl-ease);
}
[role="tablist"][data-variant="segmented"] [role="tab"]:hover { color: var(--gl-color-text-primary); }
[role="tablist"][data-variant="segmented"] [role="tab"][aria-selected="true"] {
  color: var(--gl-color-text-primary);
  background: var(--gl-color-surface-card);
  box-shadow: var(--gl-shadow-sm);
}

[role="tabpanel"] { padding-top: var(--gl-space-s); }
[role="tabpanel"][hidden] { display: none; }
[role="tabpanel"]:focus-visible { outline-offset: 4px; }