rustio-admin 0.1.1

Django Admin, but for Rust. A small, focused admin framework.
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
/* rustio-admin — single hand-written stylesheet.
 *
 * Six-variable theme; project overrides via Admin::theme(...) and
 * its `_theme.html` partial that injects `:root { --rio-* … }`.
 * Mobile-first, three breakpoints. Dark palette flips via the
 * combination of `prefers-color-scheme: dark` and an explicit
 * `data-rio-theme="dark"` attribute on `<html>`.
 *
 * Self-hosted fonts (SIL OFL-1.1, see /static/fonts/LICENSE.txt):
 *
 *   Latin / UI    — Geist Variable (wght 100..900)
 *   Code          — Geist Mono Variable (wght 100..900)
 *   Arabic UI     — Tajawal 400 / 500 / 700
 *                   (compact surfaces: buttons, sidebar, tables, badges)
 *   Arabic body   — Noto Naskh Arabic Variable (wght 400..700)
 *                   (paragraphs, descriptions, long-form copy)
 *
 * The font binaries are baked into the rustio-admin binary; no CDN
 * round-trip, no FOUT, no GDPR/tracking surface. Browsers select
 * which Arabic face to load via `unicode-range` + the per-element
 * `font-family` resolution rules in §1.b below.
 */

/* ============================================================
 * 0. @font-face — self-hosted, OFL-1.1
 * ============================================================ */

/* Geist (variable Latin) ------------------------------------- */
@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2-variations"),
       url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2-variations"),
       url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Tajawal (Arabic UI: compact surfaces) ---------------------- */
/* Three static weights — Tajawal has no public variable axis. The
 * unicode-range filters fetches to Arabic codepoints only. */
@font-face {
  font-family: "Tajawal";
  src: url("/static/fonts/Tajawal-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}
@font-face {
  font-family: "Tajawal";
  src: url("/static/fonts/Tajawal-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}
@font-face {
  font-family: "Tajawal";
  src: url("/static/fonts/Tajawal-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}

/* Noto Naskh Arabic (Arabic paragraph body) ------------------ */
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/static/fonts/NotoNaskhArabic-Variable.woff2") format("woff2-variations"),
       url("/static/fonts/NotoNaskhArabic-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}

/* ============================================================
 * 1.a. Color / spacing tokens
 * ============================================================ */

:root {
  /* The six theme tokens (also injected by _theme.html so a project
   * override survives the cascade). Defaults match AdminTheme::default().
   *
   * Brand accent — `#A0341A` (deep crimson, "Andalusian red"). Reserved
   * for affordances: primary buttons, focus rings, active state, links,
   * brand emblem. Never flood-filled across page chrome — surfaces stay
   * neutral so the accent retains its weight as a call-to-action. */
  --rio-accent: #A0341A;
  --rio-accent-rgb: 160 52 26;
  --rio-bg: #ebeef4;            /* deeper page bg — surfaces now visibly pop */
  --rio-surface: #ffffff;
  --rio-surface-2: #f5f7fb;     /* secondary surface (table head, hovered row) */
  --rio-text: #0a0e1a;          /* near-black body text */
  --rio-text-muted: #3d4452;    /* darker — strong reading contrast on surface */
  --rio-text-subtle: #5e6577;   /* metadata + breadcrumbs */
  --rio-border: #cdd3df;        /* darker for visible separation against bg */
  --rio-border-strong: #b8c0cf; /* card outlines, table dividers */

  /* Derived tokens — colors carry meaning across the UI. Info-bg now
   * reads as a soft warm wash instead of cobalt so it harmonises with
   * the crimson accent rather than fighting it. */
  --rio-success: #15803d;
  --rio-warning: #b45309;
  --rio-danger: #b91c1c;
  --rio-success-bg: #ecfdf5;
  --rio-warning-bg: #fffbeb;
  --rio-danger-bg: #fef2f2;
  --rio-info-bg: #fdf3ef;

  /* Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 px. */
  --rio-s1: 0.25rem;
  --rio-s2: 0.5rem;
  --rio-s3: 0.75rem;
  --rio-s4: 1rem;
  --rio-s5: 1.5rem;
  --rio-s6: 2rem;
  --rio-s7: 3rem;

  --rio-radius: 10px;
  --rio-radius-sm: 6px;
  --rio-radius-lg: 14px;
  --rio-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --rio-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.10);

  --rio-sidebar-w: 240px;
  --rio-topbar-h: 56px;

  /* ----------------------------------------------------------
   * 1.b. Typography tokens — three families, consistent scale.
   * ---------------------------------------------------------- */

  /* Latin UI — Geist leads, then Inter / Plex Sans, then platform UI. */
  --rio-font-sans:
    "Geist",
    "Inter",
    "IBM Plex Sans",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;

  /* Arabic UI — compact admin surfaces (buttons, navbars, sidebar
   * labels, table cells, badges, form labels). Tajawal first; Noto
   * Naskh as a graceful fallback so Arabic text never lands on a
   * Latin face. */
  --rio-font-arabic:
    "Tajawal",
    "Noto Naskh Arabic",
    system-ui,
    sans-serif;

  /* Arabic body — long-form copy, descriptions, settings/help pages.
   * Noto Naskh has higher x-height + softer terminals → reads better
   * in long paragraphs than Tajawal. */
  --rio-font-arabic-body:
    "Noto Naskh Arabic",
    "Tajawal",
    serif;

  /* Code — Geist Mono, then JetBrains/Plex Mono, then platform mono. */
  --rio-font-mono:
    "Geist Mono",
    "JetBrains Mono",
    "IBM Plex Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    "Liberation Mono",
    monospace;

  /* Size scale — rem-based, 16px html root.
   * Floor on small text is 13px (--rio-fs-xs); body lands at 16px. */
  --rio-font-size-base: 1rem;        /* 16px — the body baseline */
  --rio-fs-xs:    0.8125rem;          /* 13px — smallest helper text */
  --rio-fs-sm:    0.875rem;           /* 14px — dense table/form helpers */
  --rio-fs-md:    0.9375rem;          /* 15px — sidebar / nav / table cells */
  --rio-fs-base:  1rem;               /* 16px — body, button label */
  --rio-fs-lg:    1.0625rem;          /* 17px — main prose body */
  --rio-fs-xl:    1.25rem;            /* 20px — section h3 */
  --rio-fs-h3:    1.375rem;           /* 22px */
  --rio-fs-h2:    1.625rem;           /* 26px */
  --rio-fs-h1:    2.125rem;           /* 34px */
  --rio-fs-display: 2.5rem;           /* 40px — hero / login title */

  /* Line heights — tuned per script. Arabic needs more leading because
   * Naskh letterforms hang above and below the baseline. */
  --rio-lh-tight:  1.25;              /* h1/h2/h3, big display */
  --rio-lh-ui:     1.45;              /* dense UI: buttons, tags, table */
  --rio-lh-body:   1.6;               /* English paragraph body */
  --rio-lh-arabic: 1.9;               /* Arabic paragraph body */

  /* Weights — opt-in via tokens so the design system can tune
   * regular/medium/semibold/bold without touching every site. */
  --rio-fw-regular:  400;
  --rio-fw-medium:   500;
  --rio-fw-semibold: 600;
  --rio-fw-bold:     700;

  /* Tracking (Latin only — Arabic resets to 0 in §1.c). Geist is
   * drawn for slight negative tracking on display sizes. */
  --rio-tracking-display: -0.022em;
  --rio-tracking-heading: -0.012em;
  --rio-tracking-body:    -0.003em;
  --rio-tracking-tabular: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --rio-bg: #0b1120;
    --rio-surface: #161e2e;
    --rio-text: #f1f5f9;          /* crisper than the old #e5e7eb */
    --rio-text-muted: #c0c8d6;    /* AAA contrast vs surface */
    --rio-text-subtle: #8d97ab;
    --rio-border: #2d384c;
    --rio-success-bg: #064e3b;
    --rio-warning-bg: #422006;
    --rio-danger-bg: #450a0a;
    --rio-info-bg: #3a1308;
    --rio-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --rio-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

html[data-rio-theme="dark"] {
  --rio-bg: #0b1120;
  --rio-surface: #161e2e;
  --rio-text: #f1f5f9;
  --rio-text-muted: #c0c8d6;
  --rio-text-subtle: #8d97ab;
  --rio-border: #2d384c;
  --rio-success-bg: #064e3b;
  --rio-warning-bg: #422006;
  --rio-danger-bg: #450a0a;
  --rio-info-bg: #3a1308;
  --rio-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --rio-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}
html[data-rio-theme="light"] {
  --rio-bg: #ebeef4;
  --rio-surface: #ffffff;
  --rio-surface-2: #f5f7fb;
  --rio-text: #0a0e1a;
  --rio-text-muted: #3d4452;
  --rio-text-subtle: #5e6577;
  --rio-border: #cdd3df;
  --rio-border-strong: #b8c0cf;
}

/* ============================================================
 * 1.c. Reset + base typography
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Set the html root font-size explicitly — a few browsers / user
 * preferences ship a non-16px default, and our scale assumes 16px. */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  /* Tab character width in code blocks. */
  tab-size: 2;
}

body {
  font-family: var(--rio-font-sans);
  font-size: var(--rio-font-size-base);   /* 16px */
  line-height: var(--rio-lh-body);        /* 1.6 */
  font-weight: var(--rio-fw-regular);
  color: var(--rio-text);
  background: var(--rio-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Safe global features — kerning + contextual alternates apply
   * cleanly to every script. Stylistic alternates (Geist's ss01/ss03/
   * cv11) are opted-in via .rio-latin so they never interfere with
   * Tajawal / Noto Naskh / CJK shaping. */
  font-feature-settings: "kern", "calt";
  font-variant-ligatures: common-ligatures;
  letter-spacing: var(--rio-tracking-body);
}

/* Latin-only display polish — auto-applies to Latin headings.
 * Geist's "ss01" + "ss03" + "cv11" tighten figure widths and swap
 * single-storey alternates so headings feel like a designed face. */
.rio-latin,
h1, h2, h3, h4,
.rio-list-title, .rio-form-title, .rio-dash-greeting, .rio-auth-title {
  font-feature-settings: "kern", "calt", "ss01", "ss03", "cv11";
}

/* ============================================================
 * 1.d. Arabic-aware typography
 * ------------------------------------------------------------
 * Two contexts:
 *   - UI surfaces  → Tajawal      (compact, geometric, dense UI)
 *   - Body / prose → Noto Naskh   (humanist, paragraph-y)
 * Both unicode-range trigger only on Arabic codepoints, so no
 * Latin-only page pays the download cost.
 * ============================================================ */

/* Arabic UI context — anything tagged lang="ar" or dir="rtl" defaults
 * to Tajawal. Strip Latin-tuned tracking + stylistic alternates so
 * Arabic shaping isn't disrupted. */
:lang(ar),
[dir="rtl"],
[dir="rtl"] *,
.rio-arabic,
.rio-arabic * {
  font-family: var(--rio-font-arabic);
  letter-spacing: 0 !important;
  font-feature-settings: "kern" !important;
  line-height: var(--rio-lh-ui);
}

/* Arabic body context — paragraphs, descriptions, help text.
 * Switch to Noto Naskh + extra leading. Opt-in via lang="ar" on a
 * <p> / blockquote / .rio-prose container, or via .rio-arabic-body. */
p:lang(ar),
li:lang(ar),
blockquote:lang(ar),
.rio-prose:lang(ar),
.rio-prose:lang(ar) p,
.rio-prose:lang(ar) li,
.rio-arabic-body,
.rio-arabic-body * {
  font-family: var(--rio-font-arabic-body);
  line-height: var(--rio-lh-arabic);
  font-size: var(--rio-fs-lg);
  font-weight: var(--rio-fw-regular);
}

/* ============================================================
 * 1.e. Headings, links, paragraphs, code
 * ============================================================ */

h1, h2, h3, h4 {
  margin: 0 0 var(--rio-s3);
  line-height: var(--rio-lh-tight);
  letter-spacing: var(--rio-tracking-heading);
  color: var(--rio-text);
}
h1 {
  font-size: var(--rio-fs-h1);            /* 34px */
  font-weight: var(--rio-fw-bold);
  letter-spacing: var(--rio-tracking-display);
}
h2 {
  font-size: var(--rio-fs-h2);            /* 26px */
  font-weight: var(--rio-fw-semibold);
}
h3 {
  font-size: var(--rio-fs-h3);            /* 22px */
  font-weight: var(--rio-fw-semibold);
}
h4 {
  font-size: var(--rio-fs-md);            /* 15px — section subtitle */
  font-weight: var(--rio-fw-semibold);
  letter-spacing: 0;
}

/* Arabic-tagged headings — keep the size scale, drop the negative
 * tracking. Tajawal carries enough weight for display sizes. */
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) h4,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
h1:lang(ar), h2:lang(ar), h3:lang(ar), h4:lang(ar) {
  letter-spacing: 0;
  font-family: var(--rio-font-arabic);
  font-weight: var(--rio-fw-bold);
}

p { margin: 0 0 var(--rio-s4); }

a { color: var(--rio-accent); text-decoration: none; font-weight: var(--rio-fw-medium); }
a:hover { text-decoration: underline; }

code, kbd, samp {
  font-family: var(--rio-font-mono);
  font-size: 0.875em;                     /* relative to context */
  font-variant-ligatures: none;           /* "==" stays as 2 glyphs */
  font-feature-settings: "kern";
  background: rgba(var(--rio-accent-rgb) / 0.07);
  padding: 0.05em 0.35em;
  border-radius: var(--rio-radius-sm);
  letter-spacing: 0;
}
pre {
  font-family: var(--rio-font-mono);
  font-size: var(--rio-fs-sm);            /* 14px */
  line-height: 1.6;
  font-variant-ligatures: none;
  font-feature-settings: "kern";
  background: var(--rio-surface);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius);
  padding: var(--rio-s3) var(--rio-s4);
  overflow-x: auto;
  margin: 0 0 var(--rio-s4);
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

/* ============================================================
 * 1.f. Utility classes for typography
 * ============================================================ */

/* Tabular numerals on data — IDs, counts, timestamps. */
.rio-num, [data-tabular] { font-variant-numeric: tabular-nums; }

/* Strong, content-grade prose container (settings/help pages). */
.rio-prose {
  font-size: var(--rio-fs-lg);            /* 17px */
  line-height: var(--rio-lh-body);        /* 1.6 */
  max-width: 68ch;
}
.rio-prose p { margin: 0 0 var(--rio-s4); }
.rio-prose:lang(ar) p { line-height: var(--rio-lh-arabic); }

/* Force a specific size on muted / hint text — never below 13px. */
.rio-text-xs { font-size: var(--rio-fs-xs); }
.rio-text-sm { font-size: var(--rio-fs-sm); }
.rio-text-md { font-size: var(--rio-fs-md); }

/* Force-dense line-height for chip / badge / tag-like surfaces. */
.rio-tight { line-height: var(--rio-lh-ui); }

/* Mobile readability bump — push body up to 17px below 600px so
 * thumb-typing forms and reading copy stays comfortable. */
@media (max-width: 600px) {
  html { font-size: 16.5px; }
  .rio-prose { font-size: var(--rio-fs-lg); }
}

/* ============================================================
 * 2. Shell — topbar / sidebar / main / footer
 * ============================================================ */

.rio-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.rio-banner {
  padding: var(--rio-s2) var(--rio-s4);
  text-align: center;
  font-weight: 600;
  font-size: var(--rio-fs-sm);
}
.rio-banner--demo {
  background: var(--rio-warning-bg);
  color: var(--rio-warning);
  border-bottom: 1px solid var(--rio-border);
}

.rio-topbar {
  display: flex;
  align-items: center;
  gap: var(--rio-s4);
  padding: 0 var(--rio-s4);
  height: var(--rio-topbar-h);
  background: var(--rio-surface);
  border-bottom: 1px solid var(--rio-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.rio-topbar-brand {
  font-weight: var(--rio-fw-bold);
  font-size: var(--rio-fs-lg);                 /* 17px */
  color: var(--rio-text);
  letter-spacing: var(--rio-tracking-heading);
}
.rio-topbar-brand:hover { text-decoration: none; }
.rio-topbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--rio-s4);
  flex-wrap: wrap;
}
.rio-topbar-identity {
  color: var(--rio-text-muted);
  font-size: var(--rio-fs-md);                 /* 15px */
  font-weight: var(--rio-fw-regular);
}
.rio-topbar-link {
  color: var(--rio-text-muted);
  font-size: var(--rio-fs-md);
  font-weight: var(--rio-fw-medium);
}
.rio-topbar-link:hover { color: var(--rio-text); }
.rio-topbar-logout { display: inline; }
.rio-sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  padding: var(--rio-s1) var(--rio-s2);
  color: var(--rio-text);
  cursor: pointer;
}
.rio-theme-toggle {
  background: none;
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  padding: 0.45rem 0.8rem;
  font-size: var(--rio-fs-xs);                 /* 13px floor */
  font-weight: var(--rio-fw-medium);
  color: var(--rio-text-muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.rio-theme-toggle:hover {
  border-color: rgb(var(--rio-accent-rgb));
  color: var(--rio-text);
}

.rio-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.rio-sidebar {
  background: var(--rio-surface);
  border-right: 1px solid var(--rio-border);
  padding: var(--rio-s5) var(--rio-s4);
}
.rio-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.rio-sidebar-section {
  font-size: var(--rio-fs-xs);                 /* 13px floor */
  font-weight: var(--rio-fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rio-text-subtle);
  margin: var(--rio-s5) 0 var(--rio-s2);
  padding: 0 0.6rem;
}
.rio-sidebar-section:first-child { margin-top: 0; }
.rio-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--rio-radius-sm);
  color: var(--rio-text);
  font-size: var(--rio-fs-md);                 /* 15px */
  font-weight: var(--rio-fw-medium);
  line-height: var(--rio-lh-ui);
  transition: background 0.12s, color 0.12s;
}
.rio-sidebar-link:hover {
  background: rgba(var(--rio-accent-rgb) / 0.08);
  color: rgb(var(--rio-accent-rgb));
  text-decoration: none;
}
.rio-sidebar-link .rio-icon {
  width: 17px;
  height: 17px;
  color: var(--rio-text-subtle);
  transition: color 0.12s;
}
.rio-sidebar-link:hover .rio-icon { color: rgb(var(--rio-accent-rgb)); }

.rio-main {
  padding: var(--rio-s5);
  min-width: 0;
}

.rio-footer {
  padding: var(--rio-s3) var(--rio-s4);
  text-align: center;
  font-size: var(--rio-fs-sm);
  color: var(--rio-text-muted);
  border-top: 1px solid var(--rio-border);
}

/* ============================================================
 * 3. Page chrome — headers, breadcrumbs, cards
 * ============================================================ */

.rio-page-header {
  margin-bottom: var(--rio-s5);
}
.rio-breadcrumbs {
  font-size: var(--rio-fs-sm);
  color: var(--rio-text-muted);
  margin-bottom: var(--rio-s2);
}
.rio-breadcrumbs a { color: var(--rio-text-muted); }
.rio-breadcrumbs a:hover { color: var(--rio-accent); }
.rio-page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rio-s4);
  flex-wrap: wrap;
}

.rio-card {
  background: var(--rio-surface);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius);
  padding: var(--rio-s5);
  margin-bottom: var(--rio-s5);
  box-shadow: var(--rio-shadow);
}
.rio-card-section {
  margin-top: var(--rio-s5);
  padding-top: var(--rio-s4);
  border-top: 1px solid var(--rio-border);
}
.rio-empty {
  padding: var(--rio-s5);
  text-align: center;
  color: var(--rio-text-muted);
}
.rio-meta {
  color: var(--rio-text-muted);
  font-size: var(--rio-fs-sm);
}

/* ============================================================
 * 4. Buttons
 * ============================================================ */

.rio-button {
  display: inline-flex;
  align-items: center;
  gap: var(--rio-s1);
  padding: var(--rio-s2) var(--rio-s4);
  background: var(--rio-surface);
  color: var(--rio-text);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  font-size: var(--rio-fs-md);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 150ms ease;
}
.rio-button:hover { opacity: 0.85; text-decoration: none; }
.rio-button:disabled { opacity: 0.5; cursor: not-allowed; }
.rio-button--primary {
  background: var(--rio-accent);
  color: #fff;
  border-color: var(--rio-accent);
}
.rio-button--primary:hover { color: #fff; }
.rio-button--danger {
  background: var(--rio-danger);
  color: #fff;
  border-color: var(--rio-danger);
}
.rio-button--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--rio-text-muted);
}
.rio-button--ghost:hover { color: var(--rio-text); background: rgba(var(--rio-accent-rgb) / 0.05); }
.rio-button--danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--rio-danger);
}
.rio-button--danger-ghost:hover { background: var(--rio-danger-bg); }

/* ============================================================
 * 5. Forms — fieldsets, fields, inputs
 * ============================================================ */

.rio-form { margin: 0; }
.rio-fieldset {
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius);
  padding: var(--rio-s5);
  margin: 0 0 var(--rio-s5);
  background: var(--rio-surface);
}
.rio-fieldset > legend {
  font-weight: 600;
  padding: 0 var(--rio-s2);
  color: var(--rio-text);
}
.rio-fieldset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--rio-s4);
}

.rio-field {
  display: flex;
  flex-direction: column;
  gap: var(--rio-s1);
}
.rio-field--full { grid-column: 1 / -1; }
.rio-field-label {
  font-weight: 500;
  font-size: var(--rio-fs-md);
  color: var(--rio-text);
}
.rio-required {
  color: var(--rio-danger);
  margin-left: var(--rio-s1);
}
.rio-field-hint {
  margin: 0;
  font-size: var(--rio-fs-xs);
  color: var(--rio-text-muted);
}
.rio-field-errors {
  list-style: none;
  margin: var(--rio-s1) 0 0;
  padding: 0;
  color: var(--rio-danger);
  font-size: var(--rio-fs-sm);
}

.rio-input,
.rio-textarea,
.rio-select {
  width: 100%;
  padding: var(--rio-s2) var(--rio-s3);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  background: var(--rio-bg);
  color: var(--rio-text);
  font: inherit;
}
.rio-input:focus,
.rio-textarea:focus,
.rio-select:focus {
  outline: none;
  border-color: var(--rio-accent);
  box-shadow: 0 0 0 3px rgba(var(--rio-accent-rgb) / 0.18);
}
.rio-input:disabled,
.rio-textarea:disabled,
.rio-select:disabled {
  background: var(--rio-bg);
  color: var(--rio-text-muted);
  cursor: not-allowed;
}
.rio-textarea { font-family: var(--rio-font-sans); resize: vertical; }

.rio-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--rio-s2);
  cursor: pointer;
}
.rio-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--rio-accent);
}
.rio-checkbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--rio-s2);
}

.rio-form-actions {
  display: flex;
  gap: var(--rio-s2);
  flex-wrap: wrap;
  margin-top: var(--rio-s4);
}

/* ============================================================
 * 6. Tables
 * ============================================================ */

.rio-table {
  width: 100%;
  border-collapse: collapse;
}
.rio-table th, .rio-table td {
  padding: var(--rio-s2) var(--rio-s3);
  text-align: left;
  border-bottom: 1px solid var(--rio-border);
}
.rio-table th {
  font-weight: 600;
  font-size: var(--rio-fs-sm);
  color: var(--rio-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rio-th--number, .rio-td--number { text-align: right; font-variant-numeric: tabular-nums; }
.rio-th--checkbox, .rio-td--checkbox { text-align: center; }
.rio-th--actions, .rio-td--actions { width: 1%; white-space: nowrap; }
.rio-table--striped tbody tr:nth-child(odd) { background: rgba(var(--rio-accent-rgb) / 0.03); }
.rio-table--striped tbody tr:hover { background: rgba(var(--rio-accent-rgb) / 0.08); }

/* Sortable headers — wrap the label in a link; arrow surfaces in the
 * active direction. Header looks identical to a non-sortable cell
 * until the user is hovering / has clicked. */
.rio-th-sort {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.rio-th-sort:hover { color: var(--rio-accent); text-decoration: none; }
.rio-th--sort-asc .rio-th-sort,
.rio-th--sort-desc .rio-th-sort { color: var(--rio-accent); }

.rio-list { padding: 0; }
.rio-list .rio-table { margin: 0; }
.rio-list .rio-table th:first-child,
.rio-list .rio-table td:first-child { padding-left: var(--rio-s5); }
.rio-list .rio-table th:last-child,
.rio-list .rio-table td:last-child { padding-right: var(--rio-s5); }

/* Definition lists for the user profile show-grid. */
.rio-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--rio-s2) var(--rio-s5);
  margin: 0;
}
.rio-dl dt { font-weight: 600; color: var(--rio-text-muted); }
.rio-dl dd { margin: 0; }

/* ============================================================
 * 7. Filters / search / pagination
 * ============================================================ */

.rio-search-bar {
  display: flex;
  gap: var(--rio-s2);
  margin-bottom: var(--rio-s4);
}
.rio-search-input {
  flex: 1;
  padding: var(--rio-s2) var(--rio-s3);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  background: var(--rio-surface);
  color: var(--rio-text);
  font: inherit;
}
.rio-search-input:focus {
  outline: none;
  border-color: var(--rio-accent);
}

.rio-filters {
  background: var(--rio-surface);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius);
  padding: var(--rio-s4);
  margin-bottom: var(--rio-s4);
}
.rio-filters-title {
  font-size: var(--rio-fs-xs);
  text-transform: uppercase;
  color: var(--rio-text-muted);
  margin: 0 0 var(--rio-s2);
}
.rio-filter-group { margin-bottom: var(--rio-s2); }
.rio-filter-group summary {
  cursor: pointer;
  font-weight: 600;
  padding: var(--rio-s1) 0;
}
.rio-filter-options {
  list-style: none;
  margin: var(--rio-s2) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--rio-s1);
}
.rio-filter-chip {
  display: inline-block;
  padding: var(--rio-s1) var(--rio-s3);
  background: var(--rio-bg);
  color: var(--rio-text);
  border: 1px solid var(--rio-border);
  border-radius: 999px;
  font-size: var(--rio-fs-sm);
}
.rio-filter-chip:hover { text-decoration: none; border-color: var(--rio-accent); }
.rio-filter-chip--active {
  background: var(--rio-accent);
  color: #fff;
  border-color: var(--rio-accent);
}

.rio-pagination {
  display: flex;
  align-items: center;
  gap: var(--rio-s3);
  margin-top: var(--rio-s4);
  padding-top: var(--rio-s3);
}
.rio-pagination-link {
  padding: var(--rio-s1) var(--rio-s3);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius-sm);
  font-size: var(--rio-fs-md);
  color: var(--rio-text);
}
.rio-pagination-link:hover { text-decoration: none; border-color: var(--rio-accent); }

/* ============================================================
 * 8. Pills / flashes / timeline / tabs
 * ============================================================ */

.rio-pill {
  display: inline-block;
  padding: var(--rio-s1) var(--rio-s3);
  border-radius: 999px;
  font-size: var(--rio-fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rio-pill--badge-success { background: var(--rio-success-bg); color: var(--rio-success); }
.rio-pill--badge-neutral { background: var(--rio-bg); color: var(--rio-text-muted); border: 1px solid var(--rio-border); }
.rio-pill--badge-danger  { background: var(--rio-danger-bg);  color: var(--rio-danger); }
.rio-pill--badge-warning { background: var(--rio-warning-bg); color: var(--rio-warning); }

.rio-flash {
  padding: var(--rio-s3) var(--rio-s4);
  border-radius: var(--rio-radius);
  margin-bottom: var(--rio-s4);
}
.rio-flash--success { background: var(--rio-success-bg); color: var(--rio-success); }
.rio-flash--error   { background: var(--rio-danger-bg);  color: var(--rio-danger); }
.rio-flash--warning { background: var(--rio-warning-bg); color: var(--rio-warning); }
.rio-flash--info    { background: var(--rio-info-bg);    color: var(--rio-accent); }
.rio-flash ul { margin: var(--rio-s2) 0 0; padding-left: var(--rio-s5); }

.rio-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--rio-s2);
}
.rio-timeline-item {
  padding: var(--rio-s2) var(--rio-s3);
  border-left: 3px solid var(--rio-border);
  background: var(--rio-bg);
  border-radius: 0 var(--rio-radius-sm) var(--rio-radius-sm) 0;
}
.rio-timeline-item--success { border-left-color: var(--rio-success); }
.rio-timeline-item--info    { border-left-color: var(--rio-accent); }
.rio-timeline-item--warning { border-left-color: var(--rio-warning); }
.rio-timeline-item--error   { border-left-color: var(--rio-danger); }
.rio-timeline-item--muted   { border-left-color: var(--rio-border); }

.rio-tabs {
  display: flex;
  gap: var(--rio-s1);
  border-bottom: 1px solid var(--rio-border);
  margin-bottom: var(--rio-s4);
  flex-wrap: wrap;
}
.rio-tab {
  padding: var(--rio-s2) var(--rio-s4);
  color: var(--rio-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.rio-tab:hover { color: var(--rio-text); text-decoration: none; }
.rio-tab--active {
  color: var(--rio-accent);
  border-bottom-color: var(--rio-accent);
  font-weight: 600;
}

/* ============================================================
 * 9. Confirm-delete + error pages + login
 * ============================================================ */

.rio-confirm h2 { font-size: 1rem; margin-top: var(--rio-s4); }
.rio-confirm-section { margin-top: var(--rio-s4); }
.rio-cascade-list {
  list-style: disc;
  padding-left: var(--rio-s5);
  color: var(--rio-text-muted);
}

.rio-error { text-align: center; }
.rio-error-status {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  color: var(--rio-text-muted);
  font-variant-numeric: tabular-nums;
}

.rio-login {
  max-width: 360px;
  margin: var(--rio-s7) auto;
  background: var(--rio-surface);
  border: 1px solid var(--rio-border);
  border-radius: var(--rio-radius);
  padding: var(--rio-s6);
  box-shadow: var(--rio-shadow-lg);
}
.rio-login-title { text-align: center; margin-bottom: var(--rio-s5); }
.rio-form--login .rio-button { width: 100%; justify-content: center; }

/* ============================================================
 * 10. Icons
 * ============================================================ */

.rio-icon {
  display: inline-block;
  vertical-align: -2px;
  width: 1em;
  height: 1em;
}

/* ============================================================
 * 11. Responsive — mobile-first
 * ============================================================ */

/* Tables overflow horizontally on narrow screens. */
.rio-list, .rio-card { overflow-x: auto; }

/* Mobile: sidebar collapsed off-canvas behind a hamburger. */
.rio-sidebar {
  display: none;
  position: fixed;
  inset: var(--rio-topbar-h) 0 0 0;
  z-index: 20;
  width: 80vw;
  max-width: 320px;
  border-right: 1px solid var(--rio-border);
  box-shadow: var(--rio-shadow-lg);
  overflow-y: auto;
}
.rio-shell[data-sidebar="open"] .rio-sidebar { display: block; }
.rio-sidebar-toggle { display: inline-flex; }

/* Tablet: two-column layout, sidebar pinned. */
@media (min-width: 768px) {
  .rio-layout { grid-template-columns: var(--rio-sidebar-w) 1fr; }
  .rio-sidebar {
    display: block;
    position: static;
    width: auto;
    max-width: none;
    box-shadow: none;
  }
  .rio-sidebar-toggle { display: none; }
  .rio-fieldset-grid { grid-template-columns: 1fr 1fr; }
  .rio-checkbox-list { grid-template-columns: 1fr 1fr; }
}

/* Desktop: wider sidebar, more padding. */
@media (min-width: 1280px) {
  :root { --rio-sidebar-w: 280px; }
  .rio-main { padding: var(--rio-s6) var(--rio-s7); }
  .rio-checkbox-list { grid-template-columns: 1fr 1fr 1fr; }
}

/* Print: drop the chrome. */
@media print {
  .rio-topbar, .rio-sidebar, .rio-footer, .rio-form-actions, .rio-page-actions a { display: none !important; }
  .rio-card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}