/* The homelab shell and every page outside System Monitor.
   Twelve themes, picked in Settings (the list is in js/themes.js). Every
   theme sets the same tokens; anything it leaves out comes from Nord Night. */

@font-face { font-family: "Inter Variable"; font-weight: 100 900; src: url(/static/fonts/InterVariable.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fira Code"; font-weight: 400; src: url(/static/fonts/FiraCode-Regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fira Code"; font-weight: 500 700; src: url(/static/fonts/FiraCode-Medium.woff2) format("woff2"); font-display: swap; }

:root, [data-theme=night] {
  --font: "Inter Variable", Inter, system-ui, sans-serif; --mono: "Fira Code", ui-monospace, monospace; --meta-font: var(--font);
  --bg: #1b2029; --bg-glow: radial-gradient(1200px 600px at 80% -10%, #2b3a4f 0%, transparent 60%);
  --rail: rgba(22, 26, 34, .82); --line: #2c3442; --fg: #e5e9f0; --dim: #8b95a7; --faint: #5d6778;
  --card: linear-gradient(180deg, rgba(46, 54, 68, .78), rgba(36, 42, 54, .78)); --card-solid: #283040; --card-line: rgba(136, 192, 208, .10);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --field: #222833; --seg-on: #343d4d; --btn: #2f3746; --btn-line: #3b4555; --hover: rgba(136, 192, 208, .07);
  --accent: #88c0d0; --accent-fg: #1b2029; --accent-soft: rgba(136, 192, 208, .14);
  --ok: #a3be8c; --ok-soft: rgba(163, 190, 140, .15); --warn: #ebcb8b; --warn-soft: rgba(235, 203, 139, .15);
  --bad: #bf616a; --bad-soft: rgba(191, 97, 106, .16); --off: #616e88; --off-soft: rgba(97, 110, 136, .18);
  --sw-off: #3b4252; --nav-on: rgba(136, 192, 208, .14); --nav-on-fg: #8fd0e2; --nav-on-shadow: inset 2px 0 0 #88c0d0;
  --logo: linear-gradient(135deg, #88c0d0, #5e81ac); --logo-shadow: 0 4px 14px rgba(136, 192, 208, .35);
  --overlay: rgba(10, 12, 16, .6); --pop: #262d3a; --code-bg: #161a21;
  --chart: #88c0d0, #b48ead, #a3be8c, #ebcb8b, #d08770, #81a1c1; --chart-2: #b48ead;
  --r: 14px; --r-sm: 10px;
  --rail-solid: #161a22;
  /* project colours and card covers (see "project cards") */
  --pc-s: 62%; --pc-l: 70%; --cov-s: 42%; --cov-l1: 36%; --cov-l2: 24%; --cov-l3: 16%;
  --cov-dots: .22; --cov-glyph: .30; --cov-badge-l: 14%; --cov-shadow: .45;
  color-scheme: dark;
}

[data-theme=day] {
  --font: "Inter Variable", Inter, system-ui, sans-serif; --mono: "Fira Code", ui-monospace, monospace; --meta-font: var(--font);
  --bg: #f4f5f9; --bg-glow: none;
  --rail: #ffffff; --line: #e6e8ef; --fg: #161a23; --dim: #6b7280; --faint: #a1a7b5;
  --card: #ffffff; --card-solid: #ffffff; --card-line: #eceef4; --card-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --field: #ffffff; --seg-on: #f1f2f7; --btn: #ffffff; --btn-line: #e1e4ec; --hover: #f5f6fb;
  --accent: #5b5bd6; --accent-fg: #fff; --accent-soft: #eef0ff;
  --chart: #5b5bd6, #db2777, #059669, #d97706, #0891b2, #7c3aed; --chart-2: #db2777;
  --ok: #22a06b; --ok-soft: rgba(34, 160, 107, .14); --warn: #c98a00; --warn-soft: rgba(245, 165, 36, .16);
  --bad: #d64545; --bad-soft: rgba(214, 69, 69, .12); --off: #a1a7b5; --off-soft: rgba(161, 167, 181, .2);
  --sw-off: #d5d8e0; --nav-on: #eef0ff; --nav-on-fg: #4b4bc6; --nav-on-shadow: none;
  --logo: conic-gradient(from 200deg, #5b5bd6, #22a06b, #f5a524, #5b5bd6); --logo-shadow: 0 4px 12px rgba(91, 91, 214, .25);
  --overlay: rgba(20, 24, 34, .35); --pop: #ffffff; --code-bg: #f6f7fa;
  --r: 16px; --r-sm: 10px;
  --rail-solid: #ffffff;
  --pc-s: 58%; --pc-l: 46%; --cov-s: 75%; --cov-l1: 86%; --cov-l2: 92%; --cov-l3: 96%;
  --cov-dots: .28; --cov-glyph: .26; --cov-badge-l: 97%; --cov-shadow: .16;
  color-scheme: light;
}

[data-theme=term] {
  --font: "Fira Code", ui-monospace, monospace; --mono: "Fira Code", ui-monospace, monospace; --meta-font: var(--mono);
  --bg: #0a0e0c; --bg-glow: repeating-linear-gradient(0deg, rgba(57, 255, 136, .025) 0 1px, transparent 1px 3px);
  --rail: #0d1210; --line: #1d2a23; --fg: #d6f5e3; --dim: #5f8a72; --faint: #3d5a4a;
  --card: #0f1613; --card-solid: #0f1613; --card-line: #1f3a2c; --card-shadow: 0 0 0 1px rgba(57, 255, 136, .03), 0 0 22px rgba(57, 255, 136, .04);
  --field: #0d1310; --seg-on: #15241c; --btn: #102019; --btn-line: #24533a; --hover: #0f1c16;
  --accent: #39ff88; --accent-fg: #04140b; --accent-soft: rgba(57, 255, 136, .12);
  --chart: #39ff88, #ffd166, #5fb4ff, #ff8a80, #d17cff, #45e0c8; --chart-2: #ffd166;
  --ok: #39ff88; --ok-soft: rgba(57, 255, 136, .14); --warn: #ffb547; --warn-soft: rgba(255, 181, 71, .14);
  --bad: #ff5f5f; --bad-soft: rgba(255, 95, 95, .14); --off: #ffb547; --off-soft: rgba(255, 181, 71, .14);
  --sw-off: #1e2c25; --nav-on: #12261b; --nav-on-fg: #39ff88; --nav-on-shadow: inset 0 0 0 1px #24533a;
  --logo: #39ff88; --logo-shadow: 0 0 16px rgba(57, 255, 136, .6);
  --overlay: rgba(0, 0, 0, .7); --pop: #0f1613; --code-bg: #070a08;
  --r: 4px; --r-sm: 3px;
  --rail-solid: #0d1210;
  --pc-s: 100%; --pc-l: 61%; --cov-s: 60%; --cov-l1: 13%; --cov-l2: 8%; --cov-l3: 5%;
  --cov-dots: .28; --cov-glyph: .30; --cov-badge-l: 8%; --cov-shadow: .6;
  color-scheme: dark;
}
/* Terminal is green and only green: every project takes its hue. */
[data-theme=term] .pcard, [data-theme=term] .project { --h: 145 !important; }

[data-theme=mocha] {
  --bg: #1e1e2e; --bg-glow: radial-gradient(1100px 600px at 85% -10%, rgba(203, 166, 247, .16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(137, 180, 250, .10), transparent 60%);
  --rail: rgba(24, 24, 37, .86); --rail-solid: #181825; --line: #313244; --fg: #cdd6f4; --dim: #9399b2; --faint: #6c7086;
  --card: linear-gradient(180deg, rgba(49, 50, 68, .75), rgba(36, 37, 54, .75)); --card-solid: #262637; --card-line: rgba(203, 166, 247, .10);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --field: #181825; --seg-on: #313244; --btn: #313244; --btn-line: #45475a; --hover: rgba(203, 166, 247, .07);
  --accent: #cba6f7; --accent-fg: #1e1e2e; --accent-soft: rgba(203, 166, 247, .15);
  --ok: #a6e3a1; --ok-soft: rgba(166, 227, 161, .15); --warn: #f9e2af; --warn-soft: rgba(249, 226, 175, .15);
  --bad: #f38ba8; --bad-soft: rgba(243, 139, 168, .15); --off: #7f849c; --off-soft: rgba(127, 132, 156, .18);
  --sw-off: #45475a; --nav-on: rgba(203, 166, 247, .14); --nav-on-fg: #dbbefc; --nav-on-shadow: inset 2px 0 0 #cba6f7;
  --logo: linear-gradient(135deg, #cba6f7, #f5c2e7 50%, #89b4fa); --logo-shadow: 0 4px 14px rgba(203, 166, 247, .35);
  --overlay: rgba(10, 10, 18, .6); --pop: #24243a; --code-bg: #11111b;
  --chart: #cba6f7, #89b4fa, #a6e3a1, #f9e2af, #fab387, #f5c2e7; --chart-2: #89b4fa;
  --r: 16px; --r-sm: 11px;
  --pc-s: 75%; --pc-l: 78%; --cov-s: 40%; --cov-l1: 34%; --cov-l2: 22%; --cov-l3: 15%;
}

[data-theme=dracula] {
  --bg: #282a36; --bg-glow: radial-gradient(1100px 600px at 80% -10%, rgba(189, 147, 249, .18), transparent 60%), radial-gradient(800px 500px at 0% 105%, rgba(255, 121, 198, .08), transparent 60%);
  --rail: rgba(33, 34, 44, .88); --rail-solid: #21222c; --line: #383a4a; --fg: #f8f8f2; --dim: #a2a7c4; --faint: #6272a4;
  --card: linear-gradient(180deg, rgba(68, 71, 90, .62), rgba(52, 55, 70, .62)); --card-solid: #313341; --card-line: rgba(189, 147, 249, .13);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .28);
  --field: #21222c; --seg-on: #44475a; --btn: #343746; --btn-line: #44475a; --hover: rgba(189, 147, 249, .08);
  --accent: #bd93f9; --accent-fg: #21222c; --accent-soft: rgba(189, 147, 249, .16);
  --ok: #50fa7b; --ok-soft: rgba(80, 250, 123, .14); --warn: #f1fa8c; --warn-soft: rgba(241, 250, 140, .13);
  --bad: #ff5555; --bad-soft: rgba(255, 85, 85, .15); --off: #6272a4; --off-soft: rgba(98, 114, 164, .2);
  --sw-off: #44475a; --nav-on: rgba(189, 147, 249, .16); --nav-on-fg: #d6bcfa; --nav-on-shadow: inset 2px 0 0 #ff79c6;
  --logo: linear-gradient(135deg, #ff79c6, #bd93f9); --logo-shadow: 0 4px 14px rgba(255, 121, 198, .35);
  --overlay: rgba(15, 15, 22, .62); --pop: #2d2f3d; --code-bg: #1e1f29;
  --chart: #bd93f9, #ff79c6, #50fa7b, #f1fa8c, #8be9fd, #ffb86c; --chart-2: #ff79c6;
  --pc-s: 90%; --pc-l: 74%; --cov-s: 42%; --cov-l1: 36%; --cov-l2: 25%; --cov-l3: 18%;
}

[data-theme=gruvbox] {
  --bg: #282828; --bg-glow: radial-gradient(1100px 600px at 80% -10%, rgba(250, 189, 47, .09), transparent 60%);
  --rail: rgba(29, 32, 33, .92); --rail-solid: #1d2021; --line: #3c3836; --fg: #ebdbb2; --dim: #a89984; --faint: #7c6f64;
  --card: #32302f; --card-solid: #32302f; --card-line: #45403d; --card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 18px rgba(0, 0, 0, .3);
  --field: #1d2021; --seg-on: #3c3836; --btn: #3c3836; --btn-line: #504945; --hover: rgba(235, 219, 178, .06);
  --accent: #fabd2f; --accent-fg: #282828; --accent-soft: rgba(250, 189, 47, .14);
  --ok: #b8bb26; --ok-soft: rgba(184, 187, 38, .15); --warn: #fe8019; --warn-soft: rgba(254, 128, 25, .15);
  --bad: #fb4934; --bad-soft: rgba(251, 73, 52, .15); --off: #928374; --off-soft: rgba(146, 131, 116, .2);
  --sw-off: #504945; --nav-on: rgba(250, 189, 47, .12); --nav-on-fg: #fabd2f; --nav-on-shadow: inset 3px 0 0 #fe8019;
  --logo: linear-gradient(135deg, #fe8019, #fabd2f); --logo-shadow: 0 4px 14px rgba(254, 128, 25, .3);
  --overlay: rgba(12, 12, 12, .62); --pop: #32302f; --code-bg: #1d2021;
  --chart: #fabd2f, #83a598, #b8bb26, #fe8019, #d3869b, #8ec07c; --chart-2: #83a598;
  --r: 8px; --r-sm: 6px;
  --pc-s: 55%; --pc-l: 64%; --cov-s: 28%; --cov-l1: 30%; --cov-l2: 21%; --cov-l3: 15%;
}

[data-theme=tokyo] {
  --bg: #1a1b26; --bg-glow: radial-gradient(1200px 650px at 85% -15%, rgba(122, 162, 247, .18), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(187, 154, 247, .12), transparent 60%);
  --rail: rgba(22, 22, 30, .88); --rail-solid: #16161e; --line: #292e42; --fg: #c0caf5; --dim: #8f99c7; --faint: #565f89;
  --card: linear-gradient(180deg, rgba(36, 40, 59, .8), rgba(30, 32, 48, .8)); --card-solid: #222436; --card-line: rgba(122, 162, 247, .12);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .3);
  --field: #16161e; --seg-on: #2f3549; --btn: #24283b; --btn-line: #3b4261; --hover: rgba(122, 162, 247, .08);
  --accent: #7aa2f7; --accent-fg: #16161e; --accent-soft: rgba(122, 162, 247, .15);
  --ok: #9ece6a; --ok-soft: rgba(158, 206, 106, .15); --warn: #e0af68; --warn-soft: rgba(224, 175, 104, .15);
  --bad: #f7768e; --bad-soft: rgba(247, 118, 142, .15); --off: #565f89; --off-soft: rgba(86, 95, 137, .22);
  --sw-off: #3b4261; --nav-on: rgba(122, 162, 247, .15); --nav-on-fg: #8db0ff; --nav-on-shadow: inset 2px 0 0 #bb9af7;
  --logo: linear-gradient(135deg, #7aa2f7, #bb9af7 60%, #f7768e); --logo-shadow: 0 4px 16px rgba(122, 162, 247, .4);
  --overlay: rgba(8, 8, 14, .62); --pop: #1f2335; --code-bg: #13141c;
  --chart: #7aa2f7, #bb9af7, #9ece6a, #e0af68, #7dcfff, #f7768e; --chart-2: #bb9af7;
  --pc-s: 85%; --pc-l: 74%; --cov-s: 45%; --cov-l1: 30%; --cov-l2: 20%; --cov-l3: 13%;
}

[data-theme=oled] {
  --bg: #000000; --bg-glow: none;
  --rail: #000000; --rail-solid: #000000; --line: #1c1c1e; --fg: #f2f2f7; --dim: #8e8e93; --faint: #5a5a5f;
  --card: #0e0e10; --card-solid: #0e0e10; --card-line: #1f1f23; --card-shadow: none;
  --field: #0a0a0b; --seg-on: #1c1c1e; --btn: #141416; --btn-line: #2a2a2e; --hover: #121214;
  --accent: #0a84ff; --accent-fg: #ffffff; --accent-soft: rgba(10, 132, 255, .18);
  --ok: #30d158; --ok-soft: rgba(48, 209, 88, .16); --warn: #ffd60a; --warn-soft: rgba(255, 214, 10, .14);
  --bad: #ff453a; --bad-soft: rgba(255, 69, 58, .16); --off: #636366; --off-soft: rgba(99, 99, 102, .22);
  --sw-off: #2c2c2e; --nav-on: #0d1a2b; --nav-on-fg: #4da3ff; --nav-on-shadow: none;
  --logo: linear-gradient(135deg, #0a84ff, #5e5ce6); --logo-shadow: 0 4px 14px rgba(10, 132, 255, .35);
  --overlay: rgba(0, 0, 0, .75); --pop: #121214; --code-bg: #050505;
  --chart: #0a84ff, #bf5af2, #30d158, #ffd60a, #ff9f0a, #64d2ff; --chart-2: #bf5af2;
  --pc-s: 80%; --pc-l: 64%; --cov-s: 55%; --cov-l1: 20%; --cov-l2: 10%; --cov-l3: 4%; --cov-badge-l: 6%;
}

[data-theme=synth] {
  --bg: #140a26;
  --bg-glow: radial-gradient(1100px 520px at 50% 118%, rgba(255, 79, 216, .30), transparent 65%), radial-gradient(900px 500px at 92% -12%, rgba(45, 226, 230, .16), transparent 60%), linear-gradient(180deg, #1b0f33, #12091f);
  --rail: rgba(18, 9, 34, .82); --rail-solid: #140a26; --line: #34215a; --fg: #f5e9ff; --dim: #b39ddb; --faint: #7a62a8;
  --card: linear-gradient(180deg, rgba(48, 26, 86, .72), rgba(32, 17, 60, .72)); --card-solid: #231440; --card-line: rgba(255, 79, 216, .18);
  --card-shadow: 0 0 0 1px rgba(45, 226, 230, .04), 0 10px 30px rgba(10, 0, 30, .5), 0 0 26px -10px rgba(255, 79, 216, .35);
  --field: #120a22; --seg-on: #2c1a52; --btn: #22133f; --btn-line: #4a2c7a; --hover: rgba(255, 79, 216, .08);
  --accent: #ff4fd8; --accent-fg: #1a0b2e; --accent-soft: rgba(255, 79, 216, .16);
  --ok: #2de2a6; --ok-soft: rgba(45, 226, 166, .15); --warn: #ffd319; --warn-soft: rgba(255, 211, 25, .14);
  --bad: #ff5c7a; --bad-soft: rgba(255, 92, 122, .16); --off: #7a62a8; --off-soft: rgba(122, 98, 168, .22);
  --sw-off: #3a2566; --nav-on: rgba(255, 79, 216, .14); --nav-on-fg: #ff8be6; --nav-on-shadow: inset 2px 0 0 #2de2e6, 0 0 18px -6px rgba(255, 79, 216, .6);
  --logo: linear-gradient(160deg, #ffd319, #ff4fd8 55%, #2de2e6); --logo-shadow: 0 0 18px rgba(255, 79, 216, .6);
  --overlay: rgba(8, 2, 20, .66); --pop: #1d1036; --code-bg: #0e0719;
  --chart: #ff4fd8, #2de2e6, #ffd319, #2de2a6, #ff8f5a, #a78bfa; --chart-2: #2de2e6;
  --r: 14px; --r-sm: 10px;
  --pc-s: 95%; --pc-l: 70%; --cov-s: 70%; --cov-l1: 30%; --cov-l2: 17%; --cov-l3: 10%; --cov-dots: .3; --cov-badge-l: 12%;
}
/* A neon floor fading into the horizon, behind everything. */
[data-theme=synth] body::before {
  content: ""; position: fixed; left: -50%; right: -50%; bottom: -12%; height: 46%; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(255, 79, 216, .20) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 79, 216, .20) 1px, transparent 1px);
  background-size: 64px 40px; transform: perspective(320px) rotateX(62deg); transform-origin: bottom;
  -webkit-mask-image: linear-gradient(transparent, #000 75%); mask-image: linear-gradient(transparent, #000 75%);
}
[data-theme=synth] .shell { position: relative; z-index: 1; }
[data-theme=synth] .page-head h1, [data-theme=synth] .projhead h1 {
  background: linear-gradient(90deg, #ffd319, #ff4fd8 45%, #2de2e6); -webkit-background-clip: text; background-clip: text; color: transparent;
}

[data-theme=forest] {
  --bg: #232a2e; --bg-glow: radial-gradient(1100px 600px at 80% -10%, rgba(167, 192, 128, .12), transparent 60%), radial-gradient(800px 500px at 0% 110%, rgba(127, 187, 179, .08), transparent 60%);
  --rail: rgba(30, 35, 38, .88); --rail-solid: #1e2326; --line: #374145; --fg: #d3c6aa; --dim: #9da9a0; --faint: #7a8478;
  --card: linear-gradient(180deg, rgba(52, 63, 68, .78), rgba(45, 53, 59, .78)); --card-solid: #2d353b; --card-line: rgba(167, 192, 128, .10);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --field: #1e2326; --seg-on: #3d484d; --btn: #343f44; --btn-line: #475258; --hover: rgba(167, 192, 128, .07);
  --accent: #a7c080; --accent-fg: #1e2326; --accent-soft: rgba(167, 192, 128, .15);
  --ok: #83c092; --ok-soft: rgba(131, 192, 146, .15); --warn: #dbbc7f; --warn-soft: rgba(219, 188, 127, .15);
  --bad: #e67e80; --bad-soft: rgba(230, 126, 128, .16); --off: #7a8478; --off-soft: rgba(122, 132, 120, .2);
  --sw-off: #475258; --nav-on: rgba(167, 192, 128, .14); --nav-on-fg: #b9d293; --nav-on-shadow: inset 2px 0 0 #a7c080;
  --logo: linear-gradient(135deg, #a7c080, #83c092 50%, #7fbbb3); --logo-shadow: 0 4px 14px rgba(167, 192, 128, .3);
  --overlay: rgba(10, 14, 14, .6); --pop: #2b3339; --code-bg: #1a1f22;
  --chart: #a7c080, #7fbbb3, #dbbc7f, #e69875, #d699b6, #83c092; --chart-2: #7fbbb3;
  --pc-s: 42%; --pc-l: 68%; --cov-s: 24%; --cov-l1: 32%; --cov-l2: 23%; --cov-l3: 17%;
}

[data-theme=rose] {
  --bg: #faf4ed; --bg-glow: radial-gradient(1100px 600px at 85% -10%, rgba(215, 130, 126, .14), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(144, 122, 169, .10), transparent 60%);
  --rail: #fffaf3; --rail-solid: #fffaf3; --line: #ece2d8; --fg: #575279; --dim: #797593; --faint: #9893a5;
  --card: #fffaf3; --card-solid: #fffaf3; --card-line: #efe4da; --card-shadow: 0 1px 2px rgba(87, 82, 121, .05), 0 6px 18px rgba(87, 82, 121, .07);
  --field: #fffaf3; --seg-on: #f2e9e1; --btn: #fffaf3; --btn-line: #e6d9cd; --hover: #f6ede4;
  --accent: #907aa9; --accent-fg: #ffffff; --accent-soft: rgba(144, 122, 169, .14);
  --ok: #3f8f6b; --ok-soft: rgba(63, 143, 107, .13); --warn: #d58a22; --warn-soft: rgba(234, 157, 52, .16);
  --bad: #b4637a; --bad-soft: rgba(180, 99, 122, .13); --off: #9893a5; --off-soft: rgba(152, 147, 165, .2);
  --sw-off: #e4d9ce; --nav-on: #f2e9e1; --nav-on-fg: #6d5a8a; --nav-on-shadow: none;
  --logo: linear-gradient(135deg, #d7827e, #907aa9); --logo-shadow: 0 4px 12px rgba(144, 122, 169, .3);
  --overlay: rgba(87, 82, 121, .25); --pop: #fffaf3; --code-bg: #f4ede8;
  --chart: #907aa9, #d7827e, #286983, #ea9d34, #56949f, #b4637a; --chart-2: #d7827e;
  --r: 16px; --r-sm: 11px;
  --pc-s: 45%; --pc-l: 50%; --cov-s: 60%; --cov-l1: 86%; --cov-l2: 92%; --cov-l3: 96%;
  --cov-dots: .28; --cov-glyph: .26; --cov-badge-l: 97%; --cov-shadow: .16;
  color-scheme: light;
}

[data-theme=paper] {
  /* Warm paper, ink and terracotta; serif headings, like a printed page. */
  --bg: #f4f2ea; --bg-glow: url(/static/img/grain.svg);
  --rail: #edeadf; --rail-solid: #edeadf; --line: #e0dbcd; --fg: #1f1d1a; --dim: #6b665c; --faint: #a39d90;
  --card: #fbfaf5; --card-solid: #fbfaf5; --card-line: #e4dfd2;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 1px 2px rgba(60, 50, 30, .05), 0 8px 18px -10px rgba(60, 50, 30, .16);
  --field: #fffefa; --seg-on: #ebe7dc; --btn: #fffefa; --btn-line: #d9d3c4; --hover: #efebe1;
  --accent: #c15f3c; --accent-fg: #ffffff; --accent-soft: rgba(193, 95, 60, .11);
  --ok: #2f7d55; --ok-soft: rgba(47, 125, 85, .12); --warn: #b7791f; --warn-soft: rgba(183, 121, 31, .14);
  --bad: #b83a2e; --bad-soft: rgba(184, 58, 46, .11); --off: #a39d90; --off-soft: rgba(163, 157, 144, .2);
  --sw-off: #e3ded1; --nav-on: #fbfaf5; --nav-on-fg: #c15f3c; --nav-on-shadow: inset 2px 0 0 #c15f3c, 0 1px 2px rgba(60, 50, 30, .07);
  --logo: linear-gradient(135deg, #c15f3c, #e39a5e); --logo-shadow: 0 3px 10px rgba(193, 95, 60, .28);
  --overlay: rgba(40, 32, 20, .28); --pop: #fbfaf5; --code-bg: #f1eee5;
  --chart: #c15f3c, #3d6fa8, #5a8f5a, #c08a2e, #7e5aa2, #2f8a83; --chart-2: #3d6fa8;
  --r: 12px; --r-sm: 8px;
  --serif: Georgia, "Noto Serif", "DejaVu Serif", serif;
  --pc-s: 45%; --pc-l: 42%; --cov-s: 38%; --cov-l1: 87%; --cov-l2: 91%; --cov-l3: 95%;
  --cov-dots: .3; --cov-glyph: .22; --cov-badge-l: 98%; --cov-shadow: .14;
  color-scheme: light;
}
/* Paper sets its headings like a printed page: serif titles, italic section
   labels, and a few ink drawings (contour lines, sparkles) in the gaps. */
[data-theme=paper] .page-head h1, [data-theme=paper] .projhead h1, [data-theme=paper] .cadhead h2, [data-theme=paper] .pqhead h2, [data-theme=paper] .login h1,
[data-theme=paper] .hero h1, [data-theme=paper] .pcard .title b, [data-theme=paper] .table-head h2, [data-theme=paper] .chart-card h2,
[data-theme=paper] .drawer header h2, [data-theme=paper] .viewer > header h2, [data-theme=paper] .dialog h3 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.2px;
}
[data-theme=paper] .group > h3, [data-theme=paper] .eyebrow, [data-theme=paper] .details h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--dim);
}
[data-theme=paper] .nextstep .eyebrow { color: var(--pc); }
[data-theme=paper] body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--accent); opacity: .13;
  -webkit-mask: url(/static/img/topo.svg) right -140px top -120px / 980px auto no-repeat, url(/static/img/sparkles.svg) left 18% bottom 4% / 300px auto no-repeat;
          mask: url(/static/img/topo.svg) right -140px top -120px / 980px auto no-repeat, url(/static/img/sparkles.svg) left 18% bottom 4% / 300px auto no-repeat;
}
[data-theme=paper] .shell, [data-theme=paper] .login, [data-theme=synth] .login { position: relative; z-index: 1; }
[data-theme=paper] .hero::before {
  background: var(--accent); opacity: .16;
  -webkit-mask: url(/static/img/topo.svg) right -60px center / 720px auto no-repeat; mask: url(/static/img/topo.svg) right -60px center / 720px auto no-repeat;
}
[data-theme=paper] .hero::after {
  content: ""; position: absolute; right: 26px; top: 18px; width: 90px; height: 90px; z-index: -1; pointer-events: none; background: var(--accent); opacity: .5;
  -webkit-mask: url(/static/img/sparkles.svg) center / contain no-repeat; mask: url(/static/img/sparkles.svg) center / contain no-repeat;
}
[data-theme=paper] .cover::before {
  background: hsl(var(--h) var(--pc-s) var(--pc-l) / .32);
  -webkit-mask: url(/static/img/topo.svg) center / 560px auto; mask: url(/static/img/topo.svg) center / 560px auto;
}
[data-theme=paper] .rail { border-right-color: var(--line); }
[data-theme=paper] .rail a.nav.on { font-weight: 600; }
[data-theme=paper] .btn.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 6px -2px rgba(193, 95, 60, .45); }
[data-theme=paper] ::selection { background: rgba(193, 95, 60, .2); }
[data-theme=paper] * { scrollbar-color: #d4cdbd transparent; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: .86em; }


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

.shell { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
.rail {
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 12px; background: var(--rail); border-right: 1px solid var(--line);
  overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 15px; letter-spacing: .2px; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--logo); box-shadow: var(--logo-shadow); flex: none; }
.rail a.nav {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--dim); font-weight: 500; text-decoration: none;
}
.rail a.nav:hover { background: var(--hover); color: var(--fg); }
.rail a.nav svg { width: 19px; height: 19px; flex: none; }
.rail a.nav.on { background: var(--nav-on); color: var(--nav-on-fg); box-shadow: var(--nav-on-shadow); }
.rail .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); }
.topbar { display: none; }
#view { min-width: 0; min-height: 0; overflow: auto; }
#view.mon-host { overflow: hidden; }
.page { padding: 30px 36px 40px; max-width: 1500px; }

/* ---------- page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
[data-theme=term] .page-head h1 { font-weight: 600; letter-spacing: 0; }
[data-theme=term] .page-head h1::before { content: "> "; color: var(--accent); }
.page-head .sub { color: var(--dim); margin-top: 4px; }
.tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search { display: flex; align-items: center; width: 240px; padding: 0 14px; height: 38px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; }
.search input::placeholder { color: var(--dim); }
.search:focus-within { border-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: calc(var(--r-sm) - 3px); color: var(--dim); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed=true] { background: var(--seg-on); color: var(--fg); box-shadow: var(--card-shadow); }

section.group { margin-bottom: 24px; }
.group > h3, .eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); margin: 0 0 10px 2px; }

/* ---------- cards, buttons, switches ---------- */

.card { border-radius: var(--r); background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--card-shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: calc(var(--r-sm) - 2px); border: 1px solid var(--btn-line); background: var(--btn);
  font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; border-color: var(--btn-line); }
.btn.ghost { background: none; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--fg); background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.lg { height: 38px; padding: 0 18px; font-size: 14px; }
.btn svg { width: 15px; height: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.off { background: var(--off); box-shadow: 0 0 0 4px var(--off-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { width: 30px; height: 17px; border-radius: 9px; background: var(--sw-off); position: relative; transition: background .2s; flex: none; }
.switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { left: 15px; }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.off { background: var(--off-soft); color: var(--dim); }
.empty { color: var(--dim); padding: 30px; text-align: center; }
.meter { height: 8px; border-radius: 4px; background: var(--sw-off); overflow: hidden; }
.meter > div { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s ease; }
.meter.warn > div { background: var(--warn); }
.meter.bad > div { background: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; text-align: right; font-family: var(--meta-font); }

/* ---------- services ---------- */

.svc { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.svc .top { display: flex; align-items: center; gap: 11px; }
.svc .names { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.svc .names b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme=term] .svc .names b { font-weight: 500; }
.svc .names code { color: var(--dim); font-size: 11.5px; }
.svc p { color: var(--dim); margin: 0 0 4px 21px; font-size: 13px; }
.svc .bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-left: 21px; flex-wrap: wrap; }
.svc .meta { display: flex; gap: 12px; font-size: 12px; color: var(--dim); font-family: var(--meta-font); white-space: nowrap; }
.svc .btns { display: flex; gap: 6px; }
.svc.inactive { opacity: .82; }
.svc.failed { border-color: var(--bad); }
.svc.busy { opacity: .6; pointer-events: none; }
.rows .card { border-radius: var(--r-sm); }
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 14px minmax(0, 1.4fr) minmax(0, 2fr) 90px auto; align-items: center; gap: 12px; padding: 9px 14px; }
.row .name { display: flex; flex-direction: column; min-width: 0; }
.row .name b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .name code, .row .desc { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 12px; color: var(--dim); text-align: right; font-family: var(--meta-font); }

/* ---------- log viewer (drawer) ---------- */

.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: flex; justify-content: flex-end; }
.drawer { width: min(860px, 100%); height: 100%; background: var(--pop); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .3); }
.drawer header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 17px; margin: 0; flex: 1; min-width: 0; }
.drawer header h2 code { color: var(--dim); font-weight: 400; margin-left: 8px; }
.logs { flex: 1; overflow: auto; margin: 0; padding: 12px 18px; background: var(--code-bg); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.logs .t { color: var(--faint); }
.logs .err { color: var(--bad); }
.logs .wrn { color: var(--warn); }

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

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.theme-card { padding: 0; overflow: hidden; cursor: pointer; text-align: left; border-width: 2px; }
.theme-card[aria-pressed=true] { border-color: var(--accent); }
/* Each preview carries its own data-theme, so it is drawn with that
   theme's real colours: menu, background and four project cards. */
.theme-card .preview { height: 132px; display: grid; grid-template-columns: 52px 1fr; color: var(--fg); }
.theme-card .preview .pr { border-right: 1px solid var(--line); background: var(--rail-solid); padding: 10px 8px; display: flex; flex-direction: column; gap: 7px; }
.theme-card .preview .pr i { display: block; height: 6px; border-radius: 3px; background: var(--btn-line); }
.theme-card .preview .pr i.logo { width: 16px; height: 16px; border-radius: 5px; background: var(--logo); box-shadow: var(--logo-shadow); margin-bottom: 4px; }
.theme-card .preview .pr i:nth-child(2) { background: var(--accent); }
.theme-card .preview .pm { background: var(--bg-glow), var(--bg); padding: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; align-content: start; }
.theme-card .preview .pm b { display: block; grid-column: 1 / -1; height: 9px; width: 46%; border-radius: 3px; background: var(--fg); opacity: .85; }
.theme-card .preview .pm span { height: 41px; border-radius: calc(var(--r) * .5); background: var(--card-solid); border: 1px solid var(--card-line); position: relative; overflow: hidden; }
.theme-card .preview .pm span::before { content: ""; position: absolute; inset: 0 0 52% 0; background: linear-gradient(135deg, hsl(var(--h) var(--cov-s) var(--cov-l1)), hsl(var(--h) var(--cov-s) var(--cov-l3))); }
.theme-card .preview .pm span::after { content: ""; position: absolute; left: 6px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--card-solid); border: 2px solid hsl(var(--h) var(--pc-s) var(--pc-l)); }
.theme-card .preview[data-theme=term] .pm span { --h: 145 !important; }
.theme-card .info { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.theme-card .info b { font-weight: 600; }
.theme-card .info small { display: block; color: var(--dim); font-weight: 400; font-size: 12.5px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.settings-grid .card { padding: 16px 18px; }

/* ---------- storage ---------- */

.drives { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; margin-bottom: 26px; }
.drive { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.drive.root { border-color: var(--accent); }
.drive .head { display: flex; align-items: flex-start; gap: 14px; }
.drive .head svg { width: 34px; height: 34px; flex: none; color: var(--accent); }
.drive .head .t { flex: 1; min-width: 0; }
.drive .head b { font-size: 16px; font-weight: 600; display: block; }
.drive .head small { color: var(--dim); }
.drive .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.drive .stat { padding: 10px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); }
.drive .stat small { display: block; color: var(--dim); font-size: 11.5px; }
.drive .stat b { font-size: 16px; font-weight: 600; font-family: var(--meta-font); }
.drive .parts { display: flex; flex-direction: column; gap: 10px; }
.drive .part .legend { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; gap: 10px; }
.drive .part .legend span:last-child { color: var(--dim); font-family: var(--meta-font); white-space: nowrap; }
.stalls { font-size: 12.5px; }
.stalls ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow: auto; }
.stalls li { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); }
.stalls li b { color: var(--fg); font-weight: 500; }
.usage-layout { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 20px; align-items: start; }
.sunburst { width: 100%; aspect-ratio: 1; }
.sunburst path { stroke: var(--bg); stroke-width: 1; cursor: pointer; transition: opacity .15s; }
.sunburst path:hover { opacity: .8; }
.sunburst text { fill: var(--fg); font: 600 15px var(--font); }
.sunburst .sub { fill: var(--dim); font-weight: 400; font-size: 12px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.crumbs button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.crumbs button:hover { background: var(--hover); }
.biglist { display: flex; flex-direction: column; gap: 2px; }
.biglist button { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.biglist button:hover { background: var(--hover); }
.biglist .sw { width: 12px; height: 12px; border-radius: 3px; }
.biglist .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biglist .s { color: var(--dim); font-family: var(--meta-font); font-size: 12.5px; }
.cleanup { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cleanup .card { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.cleanup .card b { font-size: 20px; font-family: var(--meta-font); }
.cleanup .card p { margin: 0 0 6px; color: var(--dim); font-size: 13px; flex: 1; }

/* ---------- dialogs, menus, toasts (themed pages) ---------- */

.dialog-backdrop { position: fixed; inset: 0; z-index: 80; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--pop); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); width: min(440px, 100%); }
.dialog .msg { display: flex; gap: 14px; padding: 20px 20px 8px; }
.dialog .msg .big { width: 36px; height: 36px; flex: none; color: var(--warn); }
.dialog h3 { margin: 0 0 6px; font-size: 16px; }
.dialog p { margin: 0; color: var(--dim); }
.dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 18px; }
.dialog .buttons .btn { height: 34px; padding: 0 16px; }
.dialog .buttons .btn:not(.danger):not(.primary) { background: var(--btn); }
.menu { position: fixed; z-index: 70; min-width: 190px; background: var(--pop); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); padding: 4px; }
.menu button, .menu label { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 12px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.menu button:hover, .menu label:hover { background: var(--hover); }
.menu svg { width: 16px; height: 16px; flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
/* --toast-lift lets a page with its own bottom chrome push toasts clear of it.
   The Stream page sets it to the height of its control bar plus the on-screen
   keyboard, which otherwise sat underneath a toast telling you about them. */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + var(--toast-lift, 0px)); transform: translateX(-50%); background: var(--pop); color: var(--fg); border: 1px solid var(--line); padding: 10px 16px; border-radius: var(--r-sm); max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.banner { position: fixed; z-index: 50; top: 12px; left: 50%; transform: translateX(-50%); background: var(--warn); color: #1b2029; padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }


/* ---------- progress ring ---------- */

.pring { position: relative; flex: none; display: grid; place-items: center; }
.pring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.pring circle { fill: none; }
.pring .tr { stroke: var(--sw-off); }
.pring .br { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.pring.done .br { stroke: var(--ok); }
.pring.paused .br { stroke: var(--warn); }
.pring.outdated .br, .pring.unknown .br { stroke: var(--off); }
.pring b { position: relative; font-weight: 700; font-family: var(--meta-font); letter-spacing: -.3px; }
.pring b small { font-size: .55em; font-weight: 600; color: var(--dim); margin-left: 1px; }

/* ---------- home ---------- */

.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 26px 28px; margin-bottom: 24px; isolation: isolate;
  background: radial-gradient(700px 320px at 100% 0%, var(--accent-soft), transparent 70%), radial-gradient(500px 260px at 0% 120%, var(--accent-soft), transparent 70%), var(--card-solid); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--accent-soft) 1.2px, transparent 1.7px); background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(110deg, transparent 35%, #000 100%); mask-image: linear-gradient(110deg, transparent 35%, #000 100%); }
.hero .hi { min-width: 0; flex: 1 1 380px; }
.hero h1 { font-size: 32px; letter-spacing: -.6px; margin: 0; }
[data-theme=term] .hero h1::before { content: "> "; color: var(--accent); }
[data-theme=synth] .hero h1 { background: linear-gradient(90deg, #ffd319, #ff4fd8 45%, #2de2e6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { color: var(--dim); margin-top: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--off-soft); color: var(--dim); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.mcrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.mcrow:empty { display: none; }
.mcchip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; text-decoration: none; font-size: 13px;
  background: var(--field); border: 1px solid var(--line); transition: border-color .15s; }
.mcchip:hover { border-color: var(--accent); }
.mcchip .dot { width: 8px; height: 8px; box-shadow: none; }
.mcchip span:last-child { color: var(--dim); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.quick a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--r-sm); text-decoration: none; font-size: 13px; font-weight: 500;
  color: var(--fg); background: var(--btn); border: 1px solid var(--btn-line); transition: border-color .15s, transform .15s; }
.quick a:hover { border-color: var(--accent); transform: translateY(-1px); }
.quick svg { width: 16px; height: 16px; color: var(--accent); }
.gauges { display: flex; gap: 14px; }
.gauge { position: relative; width: 92px; height: 92px; display: grid; place-items: center; align-content: center; text-align: center; }
.gauge svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 6; }
.gauge .tr { stroke: var(--sw-off); }
.gauge .br { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .8s ease, stroke .3s; }
.gauge.warn .br { stroke: var(--warn); }
.gauge.bad .br { stroke: var(--bad); }
.gauge b { position: relative; font-size: 19px; font-weight: 700; font-family: var(--meta-font); line-height: 1.1; }
.gauge small { position: relative; color: var(--dim); font-size: 11px; }
.gauge b i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--dim); margin-left: 2px; }
.headlink { display: flex; justify-content: space-between; }
.headlink a { color: var(--accent); text-decoration: none; text-transform: none; letter-spacing: 0; font-weight: 500; }
.hello h1 { font-size: 30px; }
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-left: 4px solid var(--accent); border-radius: var(--r-sm); }
.alert.bad { border-left-color: var(--bad); }
.alert.warn { border-left-color: var(--warn); }
.alert.info { border-left-color: var(--off); }
.alert .txt { flex: 1; min-width: 0; }
.alert b { display: block; font-weight: 600; }
.alert span { color: var(--dim); font-size: 13px; }
.alert a { white-space: nowrap; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; }
.calm { padding: 16px 18px; display: flex; align-items: center; gap: 12px; color: var(--dim); }

/* ---------- project cards ---------- */

/* Each project has a hue (--h, from its name). The theme decides how strong
   it is: --pc-s/--pc-l for its colour, --cov-* for the card's cover. */
.pcard, .project { --pc: hsl(var(--h) var(--pc-s) var(--pc-l)); --pc-soft: hsl(var(--h) var(--pc-s) var(--pc-l) / .16); }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pcard {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.pcard:hover { transform: translateY(-3px); border-color: hsl(var(--h) var(--pc-s) var(--pc-l) / .55);
  box-shadow: var(--card-shadow), 0 14px 34px -14px hsl(var(--h) var(--pc-s) 45% / .55); }
.pcard .body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.cover {
  position: relative; height: 128px; overflow: hidden; flex: none; isolation: isolate;
  background:
    radial-gradient(90% 130% at 100% 0%, hsl(calc(var(--h) - 16) var(--cov-s) var(--cov-l1) / .95), transparent 62%),
    radial-gradient(70% 100% at 0% 100%, hsl(calc(var(--h) + 16) var(--cov-s) var(--cov-l2)), transparent 72%),
    linear-gradient(135deg, hsl(var(--h) var(--cov-s) var(--cov-l2)), hsl(var(--h) var(--cov-s) var(--cov-l3)));
}
.cover::before { /* a faint dot grid, like a cutting mat */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(hsl(var(--h) var(--pc-s) var(--pc-l) / var(--cov-dots)) 1.1px, transparent 1.6px);
  background-size: 14px 14px; -webkit-mask-image: linear-gradient(160deg, #000 10%, transparent 80%); mask-image: linear-gradient(160deg, #000 10%, transparent 80%);
}
.cover .glyph svg { position: absolute; right: -10px; bottom: -30px; width: 150px; height: 150px; stroke-width: 1.1;
  color: hsl(var(--h) var(--pc-s) var(--pc-l) / var(--cov-glyph)); transform: rotate(-10deg); transition: transform .4s ease; }
.pcard:hover .cover .glyph svg { transform: rotate(-4deg) scale(1.05); }
.cover .badge { position: absolute; left: 12px; top: 12px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
  color: var(--pc); background: hsl(var(--h) var(--pc-s) var(--cov-badge-l) / .55); border: 1px solid hsl(var(--h) var(--pc-s) var(--pc-l) / .3);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.cover .badge svg { width: 17px; height: 17px; }
.cover .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: transform .4s ease; }
.pcard:hover .cover .photo { transform: scale(1.04); }
.cover .parts { position: absolute; inset: 8px 8px 0 40px; display: flex; align-items: center; justify-content: center; }
.cover .parts img { height: 84%; width: auto; max-width: 46%; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, var(--cov-shadow))); transition: transform .35s ease; }
.cover .parts img:nth-child(1) { order: 2; height: 112%; max-width: 52%; z-index: 2; }
.cover .parts img:nth-child(2) { order: 1; margin-right: -9%; transform: translateY(6%); }
.cover .parts img:nth-child(3) { order: 3; margin-left: -9%; transform: translateY(6%); }
.pcard:hover .cover .parts img:nth-child(1) { transform: translateY(-4px) scale(1.04); }
.pcard.outdated .cover, .pcard.unknown .cover { filter: grayscale(.9); }
.pcard.outdated, .pcard.unknown { opacity: .6; }
.pcard.outdated:hover { opacity: .9; }

.ringhold { flex: none; border-radius: 50%; padding: 4px; background: var(--card-solid); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45); position: relative; z-index: 1; }
.pcard .pring.active .br, .project .pring.active .br { stroke: var(--pc); }
.pcard .title { display: flex; align-items: flex-start; gap: 12px; margin-top: -31px; }
.pcard .title .t { flex: 1; min-width: 0; padding-top: 37px; }
.pcard .title b { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .title small { display: flex; align-items: center; gap: 8px; margin-top: 3px; color: var(--faint); font-size: 12px; font-family: var(--meta-font); white-space: nowrap; }
.pcard .title small .chip { font-size: 11px; padding: 1px 8px; }
.pcard .next { color: var(--dim); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; line-height: 1.5; }
.pcard .next em { font-style: normal; font-weight: 650; font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase; color: var(--pc);
  background: var(--pc-soft); padding: 2px 6px; border-radius: 5px; margin-right: 7px; vertical-align: 1px; }
.pcard .foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
  color: var(--dim); font-size: 12px; font-family: var(--meta-font); white-space: nowrap; }
.pcard .foot .sp { flex: 1; }
.pcard .foot > span { display: inline-flex; align-items: center; gap: 5px; }
.pcard .foot svg { width: 14px; height: 14px; }
.pcard .foot .rev { color: var(--pc); }
.tbar { display: inline-block; width: 54px; height: 5px; border-radius: 3px; background: var(--sw-off); overflow: hidden; }
.tbar i { display: block; height: 100%; border-radius: 3px; background: var(--pc, var(--accent)); transition: width .4s ease; }
.tbar.big { display: block; width: auto; height: 6px; margin: 10px 4px 6px; }

/* ---------- project page ---------- */

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); text-decoration: none; margin-bottom: 14px; font-size: 13px; }
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--fg); }
.projhead { padding: 0; overflow: hidden; margin-bottom: 16px; }
.projhead .cover { height: 190px; }
.projhead .cover .parts { inset: 14px 18% 4px; }
.projhead .cover .glyph svg { width: 230px; height: 230px; bottom: -50px; right: 4%; }
.projhead .cover .badge { width: 36px; height: 36px; left: 18px; top: 16px; }
.projhead .info { display: flex; align-items: flex-start; gap: 18px; padding: 0 24px; margin-top: -56px; }
.projhead .info .t { flex: 1; min-width: 0; padding-top: 66px; }
.projhead h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.5px; line-height: 1.15; }
.projhead .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--dim); font-size: 13px; }
.projhead .basis { color: var(--dim); margin: 14px 24px 0; max-width: 900px; }
.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 16px 24px 20px; }
.pstat { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); min-width: 0; }
.pstat > svg { width: 30px; height: 30px; padding: 6px; border-radius: 8px; flex: none; color: var(--pc); background: var(--pc-soft); }
.pstat div { min-width: 0; }
.pstat small { display: block; color: var(--dim); font-size: 11.5px; }
.pstat b { display: block; font-weight: 600; font-family: var(--meta-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nextstep { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 22px; border-color: hsl(var(--h) var(--pc-s) var(--pc-l) / .55);
  background: linear-gradient(100deg, var(--pc-soft), transparent 70%), var(--card-solid); }
.nextstep .arrow { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--pc); color: var(--card-solid); }
.nextstep .arrow svg { width: 20px; height: 20px; transform: rotate(180deg); stroke-width: 2.4; }
.nextstep .eyebrow { margin: 0; color: var(--pc); }
.nextstep b { display: block; font-size: 16.5px; font-weight: 600; margin-top: 3px; }
.pgrid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 22px; }
.pgrid > .card { padding: 16px 18px; }
.cardhead { display: flex; justify-content: space-between; }
.cardhead span:last-child { text-transform: none; letter-spacing: 0; font-family: var(--meta-font); color: var(--faint); }
.todos { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.todos li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: 6px; }
.todos li:hover { background: var(--hover); }
.todos input[type=checkbox] { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--pc); flex: none; cursor: pointer; }
.todos li.done span { color: var(--faint); text-decoration: line-through; }
.todos li span { flex: 1; }
.todos li button { opacity: 0; border: 0; background: none; color: var(--dim); cursor: pointer; padding: 0 4px; }
.todos li:hover button { opacity: 1; }
.addtodo { display: flex; gap: 8px; margin-top: 10px; }
.addtodo input { flex: 1; height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field); outline: 0; }
.addtodo input:focus { border-color: var(--pc); }
.commits { list-style: none; margin: 10px 0 0; padding: 0 0 0 4px; display: flex; flex-direction: column; font-size: 13px; position: relative; }
.commits::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--line); }
.commits li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 0 5px 16px; position: relative; }
.commits li::before { content: ""; position: absolute; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--card-solid); border: 2px solid var(--faint); }
.commits li:first-child::before { border-color: var(--pc); background: var(--pc); }
.commits li code { color: var(--pc); font-size: 11.5px; }
.commits li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commits li time { color: var(--faint); font-family: var(--meta-font); font-size: 12px; }
.filehead { display: flex; justify-content: space-between; align-items: center; }
.filehead .btn { text-transform: none; letter-spacing: 0; }
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ftile { padding: 0; overflow: hidden; display: flex; flex-direction: column; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.ftile:hover { border-color: var(--pc, var(--accent)); transform: translateY(-2px); }
.ftile .thumb { height: 120px; display: grid; place-items: center; background: var(--field); border-bottom: 1px solid var(--line); color: var(--dim); overflow: hidden; }
.ftile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ftile .thumb img.part3d { object-fit: contain; padding: 8px; }
.ftile .thumb svg { width: 38px; height: 38px; }
.ftile .meta { padding: 10px 12px; }
.ftile .meta b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftile .meta small { color: var(--dim); font-size: 12px; }
.ftile.missing { opacity: .5; cursor: default; }

/* the CAD panel */
.cadpanel { margin-bottom: 26px; }
.cadhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cadhead .t { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cadhead h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.cadhead .chip.tool { color: var(--pc); background: var(--pc-soft); font-family: var(--mono); font-size: 11.5px; }
.cadhead .dim { color: var(--dim); font-size: 13px; }
.cadhead .acts { display: flex; gap: 8px; }
.cadrev { padding: 14px 16px; margin-bottom: 18px; }
.cadrev .now { display: flex; align-items: center; gap: 12px; }
.cadrev .now > svg { width: 34px; height: 34px; padding: 7px; border-radius: 50%; flex: none; color: var(--pc); background: var(--pc-soft); }
.cadrev .now .t { flex: 1; min-width: 0; }
.cadrev .now small { display: block; color: var(--dim); font-size: 12px; }
.cadrev .now b { display: block; font-weight: 600; }
.cadrev .now > code { color: var(--pc); background: var(--pc-soft); padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.cadrev .flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0 46px; }
.cadrev .flags svg { width: 13px; height: 13px; }
.revs { margin: 10px 0 0 46px; font-size: 13px; }
.revs summary { cursor: pointer; color: var(--dim); }
.revs summary:hover { color: var(--fg); }
.revs ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.revs li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
.revs li code { color: var(--dim); }
.revs li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.revs li time { color: var(--faint); font-size: 12px; font-family: var(--meta-font); }
.cadgroup { margin-bottom: 16px; }
.cadgroup h4 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px 2px; font-size: 14px; font-weight: 650; }
.cadgroup h4 small { color: var(--faint); font-weight: 400; font-size: 12px; }
.partgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.part { padding: 0; overflow: hidden; display: flex; flex-direction: column; text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.part:hover { transform: translateY(-3px); border-color: hsl(var(--h) var(--pc-s) var(--pc-l) / .6); box-shadow: var(--card-shadow), 0 12px 26px -14px hsl(var(--h) var(--pc-s) 45% / .6); }
.part .pic { position: relative; aspect-ratio: 1 / .82; display: grid; place-items: center; color: var(--faint);
  background: radial-gradient(70% 70% at 50% 60%, hsl(var(--h) var(--cov-s) var(--cov-l2) / .9), transparent 75%), var(--field); border-bottom: 1px solid var(--line); }
.part .pic img { width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, var(--cov-shadow))); transition: transform .3s ease; }
.part:hover .pic img { transform: scale(1.06) rotate(-2deg); }
.part .pic > svg { width: 36px; height: 36px; }
.part .tags { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; }
.part .tags .chip { font-size: 10.5px; padding: 1px 7px; }
.part .meta { padding: 9px 11px 11px; }
.part .meta b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part .meta small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--dim); font-size: 12px; }
.part.spare { opacity: .8; }

/* pictures being drawn on the homelab: a soft shimmer until they arrive */
.pic:not(.loaded)::after, .cover.cad:not(.loaded)::after, .thumb:not(.loaded):has(img.part3d)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, hsl(var(--h, 210) var(--pc-s) var(--pc-l) / .10) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: shimmer 1.4s linear infinite;
}
.thumb { position: relative; }
@keyframes shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
@media (prefers-reduced-motion: reduce) { .pic::after, .cover::after, .thumb::after { animation: none !important; } }

/* ---------- print queue + printer (prints.js) ---------- */
.printq { --pc: hsl(var(--h) var(--pc-s) var(--pc-l)); --pc-soft: hsl(var(--h) var(--pc-s) var(--pc-l) / .16); margin-bottom: 26px; }
.pqhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pqhead .t { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.pqhead h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.pqhead .left { color: var(--dim); font-size: 13px; font-family: var(--meta-font); }
.pqinfo { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 12px; color: var(--dim); font-size: 13px; }
.pqinfo p { display: flex; gap: 8px; align-items: flex-start; margin: 0; max-width: 70ch; }
.pqinfo svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--pc); }
.pqinfo .first { color: var(--fg); }
.pqinfo .first svg { color: var(--warn); }
.printq .plates { display: grid; gap: 10px; }
.plate { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 14px 16px; }
.plate .pnum { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: var(--card-solid); background: var(--pc); font-family: var(--meta-font); }
.plate .pnum svg { width: 18px; height: 18px; stroke-width: 2.4; }
.plate.blocked .pnum, .plate.skipped .pnum { background: var(--off-soft); color: var(--dim); }
.plate.done .pnum { background: var(--ok-soft); color: var(--ok); }
.plate.blocked, .plate.skipped { opacity: .85; }
.plate .pbody { min-width: 0; display: grid; gap: 7px; }
.plate header { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.plate h4 { margin: 0; font-size: 15.5px; font-weight: 600; flex: 0 1 auto; min-width: 0; }
.plate .chips { display: inline-flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; }
.plate .chip.now { color: var(--pc); background: var(--pc-soft); }
.plate .chip svg { width: 13px; height: 13px; }
.plate .tick { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--field); font-size: 12.5px; color: var(--dim); cursor: pointer; white-space: nowrap; }
.plate .tick:hover { border-color: var(--pc); color: var(--fg); }
.plate .tick input { width: 17px; height: 17px; margin: 0; accent-color: var(--pc); cursor: pointer; }
.plate.done .tick { color: var(--ok); }
.plate p { margin: 0; font-size: 13px; }
.plate .settings { display: flex; gap: 8px; align-items: flex-start; font-family: var(--mono); font-size: 12.5px; color: var(--fg);
  background: var(--field); border: 1px solid var(--line); padding: 6px 10px; border-radius: var(--r-sm); }
.plate .settings svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--pc); }
.plate .facts { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--dim); font-family: var(--meta-font); }
.plate .facts span, .plate .waiting { display: inline-flex; align-items: center; gap: 6px; }
.plate .facts svg, .plate .waiting svg { width: 14px; height: 14px; }
.plate .waiting { color: var(--warn); }
.plate .note { color: var(--dim); max-width: 80ch; }
.plate .pics { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.plate .pic { position: relative; overflow: hidden; width: 112px; padding: 0 0 6px; border-radius: var(--r-sm); border: 1px solid var(--line); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; color: var(--faint); font: inherit; transition: transform .18s ease, border-color .18s ease;
  background: radial-gradient(70% 70% at 50% 45%, hsl(var(--h) var(--cov-s) var(--cov-l2) / .9), transparent 75%), var(--field); }
.plate .pic:hover { transform: translateY(-2px); border-color: var(--pc); }
.plate .pic img, .plate .pic > svg { width: 84px; height: 76px; object-fit: contain; margin-top: 4px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, var(--cov-shadow))); }
.plate .pic > svg { width: 30px; padding: 23px 0; }
.plate .pic small { font-size: 11px; color: var(--dim); max-width: 100%; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plate .when { color: var(--faint); font-size: 12px; }
.printq details { margin-top: 12px; }
.printq details summary { cursor: pointer; color: var(--dim); font-size: 13px; font-weight: 600; padding: 6px 2px; }
.printq details .plates { margin-top: 8px; }

.card.printer { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 0; overflow: hidden; margin-bottom: 18px; }
.card.printer .cam[hidden] + .pinfo { grid-column: 1 / -1; }
.card.printer .cam { position: relative; background: #000; min-height: 190px; display: grid; place-items: center; }
.card.printer .cam img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.card.printer .cam.live img { opacity: 1; }
.card.printer .cam span { position: absolute; color: #bbb; font-size: 12.5px; }
.card.printer .cam.live span { display: none; }
.pinfo { padding: 18px 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.ptop { display: flex; align-items: center; gap: 12px; }
.ptop > div { min-width: 0; flex: 1; }
.ptop small { display: block; color: var(--dim); font-size: 12px; }
.ptop b { display: block; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptop .pct { font-size: 26px; font-weight: 700; font-family: var(--meta-font); flex: none; }
.pico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); }
.pico svg { width: 22px; height: 22px; }
.pword.printing, .pword.preparing { color: var(--accent); }
.pword.paused, .pword.failed { color: var(--warn); }
.pword.finished { color: var(--ok); }
.pbar { height: 8px; border-radius: 99px; background: var(--field); overflow: hidden; border: 1px solid var(--line); }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }
.pfacts { display: flex; gap: 6px 18px; flex-wrap: wrap; margin: 0; color: var(--dim); font-size: 13px; font-family: var(--meta-font); }
.pfacts span { display: inline-flex; align-items: center; gap: 6px; }
.pfacts svg { width: 15px; height: 15px; }
.psay, .pstage { margin: 0; color: var(--dim); font-size: 13.5px; max-width: 70ch; }
.psay a { color: var(--accent); }
.perr { display: flex; gap: 8px; margin: 0; color: var(--bad); font-size: 13px; }
.perr svg { width: 16px; height: 16px; flex: none; }

.card.offer { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 18px; flex-wrap: wrap;
  border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: linear-gradient(100deg, var(--ok-soft), transparent 70%), var(--card-solid); }
.card.offer .pico { color: var(--ok); background: var(--ok-soft); }
.card.offer .t { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; }
.card.offer p { margin: 0; color: var(--dim); font-size: 13.5px; }
.card.offer p b { color: var(--fg); }
.card.offer select { max-width: 100%; height: 32px; border-radius: var(--r-sm); background: var(--field); color: var(--fg); border: 1px solid var(--line); padding: 0 8px; font: inherit; font-size: 13px; }
.card.offer .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.nextprint { --pc: hsl(var(--h) var(--pc-s) var(--pc-l)); display: grid; grid-template-columns: 76px 1fr minmax(0, 300px); gap: 14px; align-items: center; padding: 12px 16px 12px 12px; }
.nextprint .npic { position: relative; width: 76px; height: 66px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--pc); overflow: hidden;
  background: radial-gradient(70% 70% at 50% 45%, hsl(var(--h) var(--cov-s) var(--cov-l2) / .9), transparent 75%), var(--field); border: 1px solid var(--line); }
.nextprint .npic img { width: 62px; height: 56px; object-fit: contain; }
.nextprint .npic > svg { width: 28px; height: 28px; }
.nextprint .t { min-width: 0; display: grid; gap: 2px; }
.nextprint .t b { font-size: 15.5px; font-weight: 600; }
.nextprint .t small { color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nextprint .t p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.npl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--dim); }
.npl > span { display: inline-flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npl svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.npl b { font-family: var(--meta-font); color: var(--fg); }
.npl small { grid-column: 1 / -1; color: var(--dim); }
.npl .pbar { grid-column: 1 / -1; height: 6px; }

.printer-setup { padding: 16px 18px; max-width: 760px; }
.printer-setup .pstatus { margin: 0 0 12px; font-size: 13.5px; }
.printer-setup .pstatus a { color: var(--accent); }
.codeform { display: flex; gap: 8px; flex-wrap: wrap; }
.codeform input { flex: 0 1 240px; min-width: 0; height: 34px; padding: 0 12px; border-radius: var(--r-sm); background: var(--field); color: var(--fg);
  border: 1px solid var(--line); outline: 0; font-family: var(--mono); letter-spacing: 1px; }
.codeform input:focus { border-color: var(--accent); }

@media (max-width: 760px) {
  .card.printer { grid-template-columns: 1fr; }
  .card.printer .cam { min-height: 0; aspect-ratio: 16 / 9; }
  .card.printer .cam:not(.live) { aspect-ratio: auto; min-height: 44px; }
  .plate { grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 12px; }
  .plate .pnum { width: 26px; height: 26px; font-size: 12.5px; }
  .plate .pnum svg { width: 15px; height: 15px; }
  .plate .tick { margin-left: 0; }
  .plate .pic { width: calc(50% - 4px); }
  .nextprint { grid-template-columns: 60px 1fr; }
  .nextprint .npic { width: 60px; height: 54px; }
  .nextprint [data-npl] { grid-column: 1 / -1; }
}

/* ---------- viewer ---------- */

.viewer-backdrop { position: fixed; inset: 0; z-index: 75; background: var(--overlay); display: flex; padding: 24px; }
.viewer { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--pop); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.viewer > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer > header h2 { flex: 1; min-width: 0; font-size: 15.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer > header h2 small { color: var(--dim); font-weight: 400; margin-left: 8px; font-family: var(--mono); font-size: 12px; }
.viewer .body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.viewer .body.center { display: grid; place-items: center; padding: 20px; }
.viewer .body img.full { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .body .sheet { display: block; background: #fff; padding: 12px; margin: 16px auto; max-width: min(1400px, 96%); border-radius: 6px; }
.viewer .body .sheet img { width: 100%; display: block; }
.viewer iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.viewer iframe.assembly { position: absolute; inset: 0; background: var(--code-bg); }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.viewer pre.code { margin: 0; padding: 16px 18px; font: 12.5px/1.6 var(--mono); background: var(--code-bg); min-height: 100%; tab-size: 4; }
.viewer pre.code code.hljs { background: none; padding: 0; }
.viewer .nav-arrows { position: absolute; inset: 0; pointer-events: none; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; }
.viewer .nav-arrows button { pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--pop); cursor: pointer; font-size: 20px; }
.stage3d { position: absolute; inset: 0; }
.stage3d .canvas3d { position: absolute; inset: 0; }
.loading3d { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--dim); background: var(--pop); }
.loading3d img { width: min(380px, 70vw); height: auto; opacity: .9; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.viewer .hint { z-index: 2; }
.viewer .nav-arrows { z-index: 2; }
.viewer .hint { position: absolute; left: 14px; bottom: 12px; color: var(--dim); font-size: 12px; background: var(--pop); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.scad-split { display: grid; grid-template-rows: minmax(260px, 55%) 1fr; height: 100%; }
.scad-split .pic { display: grid; place-items: center; background: var(--field); border-bottom: 1px solid var(--line); padding: 10px; min-height: 0; }
.scad-split .pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.scad-split .src { overflow: auto; min-height: 0; }
.browse { list-style: none; margin: 0; padding: 8px; }
.browse li button { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.browse li button:hover { background: var(--hover); }
.browse li svg { width: 18px; height: 18px; color: var(--dim); }
.browse li small { color: var(--dim); font-family: var(--meta-font); }

/* ---------- Clawd (clawd.js): what the Claude sessions are doing ---------- */
.cl-bot { position: relative; display: inline-block; flex: none; line-height: 0; }
.cl-bot svg { display: block; overflow: hidden; }
.cl-bot .cl-bang { display: none; position: absolute; right: -7px; top: -9px; font: 800 13px/1 var(--mono); font-style: normal; color: var(--warn); }
.cl-bot[data-state="waiting"]:not([data-mode="clawde"]) .cl-bang { display: block; animation: cl-bang .9s steps(1) infinite; }
.cl-bot[data-state="none"] svg { filter: grayscale(1); opacity: .45; }
.cl-shadow { fill: rgba(0, 0, 0, .28); }
.cl-poof { fill: var(--dim); }
@keyframes cl-bang { 50% { opacity: 0; } }
.rail .cl-corner { margin-top: auto; display: flex; align-items: flex-end; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--dim); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.rail .cl-corner .cl-say { padding-bottom: 4px; }
.rail .cl-corner:hover { background: var(--hover); }
.rail .cl-corner + .foot { margin-top: 0; }
.cl-corner[data-state="busy"] .cl-say { color: var(--fg); }
.cl-corner[data-state="waiting"] .cl-say { color: var(--warn); }
.cl-top { display: none; }
.cl-pop { position: fixed; z-index: 80; max-height: 60vh; overflow: auto; padding: 8px; background: var(--pop);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.cl-pop header { padding: 4px 6px 8px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.cl-pop ul, .cl-list { list-style: none; margin: 0; }
.cl-pop ul { padding: 0; }
.cl-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 4px 6px; }
.cl-pop .cl-row + .cl-row { border-top: 1px solid var(--line); }
.cl-t { display: flex; flex-direction: column; min-width: 0; }
.cl-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-t small { font-size: 12px; color: var(--dim); }
.cl-row[data-state="busy"] small { color: var(--accent); }
.cl-row[data-state="waiting"] small { color: var(--warn); }
.cl-empty { color: var(--dim); }
.cl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 16px; padding: 10px 14px; }
@media (max-width: 760px) {
  .topbar .cl-top { display: grid; width: 56px; margin-left: auto; }
  .topbar .cl-top + #search-btn { margin-left: 0; }
  .cl-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .cl-bot .cl-bang { animation: none; } }

/* ---------- part notes (notes.js): draw on a part, send it to Claude ---------- */
.pn-layer { position: absolute; inset: 0; z-index: 5; }
.pn-ink { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.pn-bar, .pn-form { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(580px, calc(100% - 24px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; background: var(--pop);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.pn-tip { flex: 1 1 200px; color: var(--dim); font-size: 13px; }
.pn-acts { display: flex; gap: 8px; margin-left: auto; }
.pn-form { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.pn-form textarea { width: 100%; min-height: 72px; resize: vertical; padding: 8px 10px; font: inherit; font-size: 14px; color: var(--fg);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); }
.pn-to { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--dim); }
.pn-to select { flex: 1; width: 0; min-width: 0; height: 32px; padding: 0 8px; font: inherit; color: var(--fg); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--r-sm); }
.pn-why { margin: 0; font-size: 12px; color: var(--dim); }
.pn-pins { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.pn-pin, .pn-num { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: #ff453a; color: #fff;
  font: 600 12px/20px var(--mono); text-align: center; padding: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); flex: none; }
.pn-pin { position: absolute; margin: -12px 0 0 -12px; cursor: pointer; pointer-events: auto; }
.pn-pin[hidden] { display: none; }
.pn-card { position: absolute; top: 12px; right: 12px; z-index: 6; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px);
  overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--pop);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.pn-card header { display: flex; align-items: center; gap: 8px; }
.pn-st { flex: 1; min-width: 0; font-size: 12.5px; color: var(--dim); }
.pn-st b { color: var(--fg); font-weight: 600; }
.pn-card p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.pn-pic img { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); }
.pn-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--dim); }
.pn-noting .nav-arrows, .pn-noting .hint { display: none; }

/* ---------- markdown ---------- */

.prose { max-width: 820px; margin: 0 auto; padding: 26px 30px 60px; line-height: 1.65; font-size: 15px; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.25; margin: 1.6em 0 .55em; letter-spacing: -.2px; }
.prose h1 { font-size: 28px; margin-top: .2em; }
.prose h2 { font-size: 21px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 17px; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote { margin: 0 0 1em; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; border-radius: 8px; }
.prose code { background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; overflow: auto; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--field); }
.prose blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; color: var(--dim); }
.prose ul.contains-task-list { list-style: none; padding-left: 4px; }
.prose li.task-list-item input { accent-color: var(--accent); margin-right: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

@media (max-width: 760px) {
  .pgrid { grid-template-columns: 1fr; }
  .viewer-backdrop { padding: 0; }
  .viewer { border-radius: 0; }
  .prose { padding: 18px 16px 50px; }
  .projhead h1 { font-size: 24px; }
  .projhead .cover { height: 150px; }
  .projhead .cover .parts { inset: 10px 4% 2px; }
  .projhead .info { padding: 0 16px; gap: 12px; margin-top: -46px; }
  .projhead .info .t { padding-top: 52px; }
  .projhead .info .pring { width: 84px !important; height: 84px !important; }
  .projhead .basis { margin: 12px 16px 0; }
  .pstats { grid-template-columns: 1fr 1fr; padding: 14px 16px 16px; gap: 8px; }
  .pcards { grid-template-columns: 1fr; }
  .partgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cadrev .flags, .revs { margin-left: 0; }
  .cadrev .now > svg, .cadrev .now > code { display: none; }
  .pstat b { white-space: normal; }
  .pstat > svg { width: 26px; height: 26px; padding: 5px; }
}

/* ---------- phone ---------- */

@media (max-width: 760px),
       (orientation: landscape) and (max-height: 560px) and (pointer: coarse) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #view { grid-row: 2; } /* even when the top bar is hidden (System Monitor) */
  .topbar {
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--rail);
  }
  .topbar button { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; border-radius: var(--r-sm); }
  .topbar button svg { width: 22px; height: 22px; }
  .topbar b { font-size: 16px; font-weight: 600; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--rail-solid);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
  }
  .shell.nav-open .rail { transform: none; }
  /* The open menu is solid and the page behind it dims, so its items are
     easy to read whatever the page shows. */
  .shell::after { content: ""; position: fixed; inset: 0; z-index: 39; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .shell.nav-open::after { opacity: 1; }
  .page { padding: 18px 14px 30px; }
  .page-head h1 { font-size: 24px; }
  .hero { padding: 20px 18px; gap: 18px; }
  .hero h1 { font-size: 26px; }
  .gauges { width: 100%; justify-content: space-around; }
  .gauge { width: 84px; height: 84px; }
  .search { width: 100%; }
  .tools { width: 100%; }
  .cards, .drives { grid-template-columns: 1fr; }
  .drive .stats { grid-template-columns: repeat(2, 1fr); }
  .usage-layout { grid-template-columns: 1fr; }
  .row { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .row .desc, .row .meta { display: none; }
  .drawer { width: 100%; }
}

/* ---------- Minecraft ---------- */

.dot.sleep { background: #81a1c1; box-shadow: 0 0 0 4px rgba(129, 161, 193, .18); }
.mcswitch button { display: inline-flex; align-items: center; gap: 9px; padding: 7px 16px; }
.mcswitch .dot { width: 8px; height: 8px; box-shadow: none; }
.mchero { padding: 20px 22px; margin-bottom: 16px; }
.mctop { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mcid h2 { margin: 8px 0 2px; font-size: 24px; letter-spacing: -.3px; }
.mcid .meta { color: var(--dim); font-size: 13px; font-family: var(--meta-font); }
.mcstate { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.mcstate .dot { width: 8px; height: 8px; }
.mcstate.ok { color: var(--ok); } .mcstate.warn { color: var(--warn); } .mcstate.bad { color: var(--bad); }
.mcactions { display: flex; gap: 8px; flex-wrap: wrap; }
.mcstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.mcstats .stat { background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; min-width: 0; }
.mcstats small { display: block; color: var(--dim); font-size: 12px; margin-bottom: 4px; }
.mcstats b { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mcstats b span { font-size: 14px; color: var(--dim); font-weight: 500; }
.mcstats b.ok { color: var(--ok); } .mcstats b.warn { color: var(--warn); } .mcstats b.bad { color: var(--bad); }
.mcstats .who { color: var(--dim); font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcstats .who span + span::before { content: ", "; }
.mcstats .meter { margin-top: 9px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; margin-left: 8px; font-size: 13px; }
.mcboot { margin-top: 16px; display: grid; gap: 6px; color: var(--dim); font-size: 13px; }
.mcboot .bar { height: 6px; border-radius: 3px; background: var(--sw-off); overflow: hidden; }
.mcboot .bar i { display: block; height: 100%; background: var(--warn); border-radius: 3px; transition: width 1s linear; }
.mcnote { margin: 14px 0 0; color: var(--dim); font-size: 13px; }
.mcnote.bad { color: var(--bad); }
.mctabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.mctabs a { padding: 10px 14px; color: var(--dim); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.mctabs a:hover { color: var(--fg); }
.mctabs a.on { color: var(--fg); border-bottom-color: var(--accent); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cardhead .eyebrow, .cardhead .sub { margin: 0; color: var(--dim); }
.mcgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.mcgrid > .card { padding: 16px 18px; min-width: 0; }
.mcgrid > .wide { grid-column: 1 / -1; }
.chartbox { min-height: 180px; }
.chartbox .u-legend { font-size: 12px; color: var(--dim); }
.online { display: flex; flex-wrap: wrap; gap: 8px; }
.online .calm { padding: 6px 0; }
.pchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.pchip:hover { border-color: var(--accent); }
.mchead { border-radius: 6px; image-rendering: pixelated; flex: none; background: var(--field); }
.mchead.letter { display: inline-grid; place-items: center; font-weight: 700; color: var(--accent); background: var(--accent-soft); font-size: 13px; }
.ptops { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; color: var(--dim); font-size: 13px; margin-top: 8px; }
.ptops p { margin: 0; flex: 1 1 260px; }
.ptops ol, .toplist { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; min-width: 200px; }
.ptops li, .toplist li { display: flex; justify-content: space-between; gap: 16px; }
.ptops li b, .toplist li b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.heapval { display: flex; align-items: baseline; gap: 10px; }
.heapval b { font-size: 26px; }
.heapval span { color: var(--dim); font-size: 13px; }
.memcard input[type=range] { width: 100%; accent-color: var(--accent); margin: 12px 0 2px; }
.heaprow { display: flex; justify-content: space-between; color: var(--dim); }
.hint { color: var(--dim); font-size: 12.5px; margin: 8px 0; }
.console { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.contools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.contools input[type=search] { flex: 1 1 180px; min-width: 0; height: 34px; padding: 0 12px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); outline: 0; }
.conout { height: min(62vh, 640px); overflow: auto; background: var(--code-bg); border-radius: var(--r-sm); border: 1px solid var(--line); padding: 10px 12px; font: 12px/1.55 var(--mono); }
.conout .ln { white-space: pre-wrap; word-break: break-word; color: var(--fg); opacity: .86; }
.conout .ln.warn { color: var(--warn); opacity: 1; }
.conout .ln.bad { color: var(--bad); opacity: 1; }
.conout .ln.chat { color: var(--accent); opacity: 1; }
.conout .ln.mine { color: var(--fg); opacity: 1; font-weight: 600; margin-top: 4px; }
.conout .ln.reply { color: var(--ok); opacity: 1; padding-left: 14px; }
.conout .ln.sys { color: var(--dim); text-align: center; margin: 6px 0; }
.conout[data-filter=chat] .ln:not(.chat):not(.mine):not(.reply) { display: none; }
.conout[data-filter=problems] .ln:not(.warn):not(.bad):not(.mine):not(.reply) { display: none; }
.conin { display: flex; align-items: center; gap: 8px; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 4px 4px 12px; }
.conin span { color: var(--accent); font-family: var(--mono); }
.conin input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font: 13px var(--mono); height: 32px; }
.conin:focus-within { border-color: var(--accent); }
.console .hint { margin: 0 2px; }
.chat { padding: 14px 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chipcheck input { position: absolute; opacity: 0; pointer-events: none; }
.chipcheck span { display: inline-block; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); font-size: 12.5px; cursor: pointer; }
.chipcheck input:checked + span { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chipcheck input:focus-visible + span { outline: 2px solid var(--accent); }
.chatlog { max-height: 64vh; overflow: auto; display: grid; gap: 2px; }
.daysep { text-align: center; color: var(--dim); font-size: 12px; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 1px; }
.msg { display: grid; grid-template-columns: 44px 20px 1fr; gap: 10px; align-items: start; padding: 5px 6px; border-radius: 6px; }
.msg:hover { background: var(--hover); }
.msg time { color: var(--dim); font: 12px var(--mono); padding-top: 2px; }
.msg span { min-width: 0; overflow-wrap: anywhere; }
.msg i { font-style: normal; color: var(--dim); }
.msg.death span { color: var(--bad); } .msg.death b { color: var(--fg); }
.msg.adv span { color: var(--warn); } .msg.adv b { color: inherit; }
.msg.join span, .msg.leave span { color: var(--dim); }
.plist, .blist { display: grid; gap: 8px; }
.plist { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--fg); text-decoration: none; }
.prow:hover { border-color: var(--accent); }
.prow .t { flex: 1; min-width: 0; }
.prow .t b { display: block; overflow: hidden; text-overflow: ellipsis; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.prow .r { text-align: right; font-size: 12.5px; color: var(--dim); display: grid; }
.phead { display: flex; align-items: center; gap: 18px; padding: 18px 20px; margin-bottom: 14px; flex-wrap: wrap; }
.phead h2 { margin: 0 0 6px; font-size: 24px; }
.phead .t { flex: 1 1 200px; }
.phead .kv { display: grid; grid-template-columns: repeat(4, auto); gap: 6px 26px; }
.phead .kv small { display: block; color: var(--dim); font-size: 12px; }
.phead .kv b { font-weight: 600; text-transform: capitalize; }
.whisper { display: flex; gap: 8px; margin-bottom: 12px; }
.whisper input { flex: 1; min-width: 0; height: 34px; padding: 0 12px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); outline: 0; }
.whisper input:focus { border-color: var(--accent); }
.pactions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pactions select { height: 32px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); padding: 0 8px; color: var(--fg); }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 14px; }
.statgrid div { background: var(--field); border-radius: var(--r-sm); padding: 8px 10px; }
.statgrid b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.statgrid small { color: var(--dim); font-size: 12px; }
.toplists { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.toplist li span { text-transform: capitalize; color: var(--dim); }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.recent li { display: grid; grid-template-columns: 210px 1fr; gap: 10px; }
.recent time { color: var(--dim); font-family: var(--meta-font); }
.tablecard { padding: 0; overflow: hidden; }
.tablewrap { overflow-x: auto; }
.mctable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mctable th { text-align: left; font-weight: 600; color: var(--dim); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
.mctable th.asc::after { content: " ↑"; color: var(--accent); }
.mctable th.desc::after { content: " ↓"; color: var(--accent); }
.mctable td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mctable td:first-child { display: flex; align-items: center; gap: 10px; }
.mctable td a { color: var(--fg); text-decoration: none; font-weight: 500; }
.mctable td a:hover { color: var(--accent); }
.mctable tr:last-child td { border-bottom: 0; }
.mctable .rank { width: 22px; color: var(--dim); text-align: right; }
.mctable small { color: var(--dim); }
.extlist { max-height: 70vh; overflow: auto; }
.ext { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.ext:last-child { border-bottom: 0; }
.ext .t { flex: 1; min-width: 0; }
.ext .ver { margin-left: 8px; color: var(--dim); font: 12px var(--mono); }
.ext p { margin: 2px 0 0; color: var(--dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.brow small { display: block; color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.files { padding: 12px 14px; }
.files .crumbs a { color: var(--accent); text-decoration: none; padding: 2px 4px; border-radius: 4px; }
.files .crumbs a:hover { background: var(--hover); }
.files .crumbs > span { color: var(--faint); }
.files .browse { padding: 0; }
.files .browse li button { grid-template-columns: 22px 1fr auto 90px; }
.files .browse li small:last-child { text-align: right; }
.viewer textarea.editor { display: block; width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 16px 18px; background: var(--code-bg); color: var(--fg); font: 12.5px/1.6 var(--mono); tab-size: 2; white-space: pre; }

@media (max-width: 760px) {
  .mchero { padding: 16px; }
  .mcstats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mcstats .stat:first-child { grid-column: 1 / -1; }
  .mcstats b { font-size: 20px; }
  .mcactions { width: 100%; }
  .mcactions .btn { flex: 1; justify-content: center; height: 38px; }
  .mcgrid { grid-template-columns: 1fr; }
  .page-head .tools, .mcswitch { width: 100%; }
  .mcswitch button { flex: 1; justify-content: center; }
  .plist { grid-template-columns: 1fr; }
  .phead .kv { grid-template-columns: 1fr 1fr; width: 100%; }
  .recent li { grid-template-columns: 1fr; gap: 0; }
  .conout { height: 56vh; font-size: 11px; }
  .files .browse li button { grid-template-columns: 22px 1fr auto; }
  .files .browse li small:last-child { display: none; }
  .cardhead .search { width: 100%; }
}

/* ---------- Terminal ---------- */

#view.fill { overflow: hidden; }
.termpage { height: 100%; display: flex; flex-direction: column; padding: 16px 20px; gap: 10px; box-sizing: border-box; }
.termbar { display: flex; align-items: center; gap: 8px; }
.termtabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.termtab { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 12px; height: 34px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); color: var(--dim); cursor: pointer; white-space: nowrap; max-width: 260px; }
.termtab span { overflow: hidden; text-overflow: ellipsis; font: 12.5px var(--mono); }
.termtab.on { color: var(--fg); border-color: var(--accent); background: var(--seg-on); }
.termtab.dead span { text-decoration: line-through; opacity: .6; }
.termtab button { border: 0; background: none; color: var(--dim); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; }
.termtab button:hover { background: var(--hover); color: var(--fg); }
.termstage { flex: 1; min-height: 0; position: relative; border-radius: var(--r); overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); }
.termhost { position: absolute; inset: 8px 4px 4px 10px; }
.termhost .xterm { height: 100%; }
.termhost .xterm-viewport { scrollbar-width: thin; }
.termkeys { display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.termkeys button { flex: none; min-width: 44px; height: 38px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--btn); color: var(--fg); font: 14px var(--mono); }
.termkeys button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

@media (max-width: 760px), (pointer: coarse) {
  .termkeys { display: flex; }
}
@media (max-width: 760px) {
  .termpage { padding: 8px 8px 10px; }
  .termhost { inset: 4px 2px 2px 6px; }
}

/* ---------- Apps ---------- */

.apptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.apptile { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.apptile .top { display: flex; gap: 12px; align-items: center; }
.appicon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.appicon svg { width: 22px; height: 22px; }
.apptile .t b { display: block; font-size: 15.5px; }
.light { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.light .dot { width: 7px; height: 7px; box-shadow: none; }
.light.ok { color: var(--ok); } .light.bad { color: var(--bad); } .light.warn { color: var(--warn); }
.apptile p { margin: 0; color: var(--dim); font-size: 13.5px; flex: 1; }
.apptile em { font-style: normal; color: var(--warn); }
.apptile .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.others { padding: 4px 0; }
.other { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.other:last-child { border-bottom: 0; }
.other .t { flex: 1; min-width: 0; }
.other code { color: var(--dim); font-size: 12px; }
.other small { display: block; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launchers { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.launcher { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px; cursor: pointer; color: var(--fg); font: inherit; }
.launcher:hover { border-color: var(--accent); }
.launcher:disabled { opacity: .5; }
.launcher img, .launcher svg { width: 40px; height: 40px; }
.launcher span { font-size: 13px; text-align: center; }
@media (max-width: 760px) { .apptiles { grid-template-columns: 1fr; } .launchers { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Activity ---------- */

.actchips { margin-bottom: 14px; }
.actlist { padding: 6px 12px 12px; }
.act { display: grid; grid-template-columns: 44px 12px 1fr auto; gap: 10px; align-items: start; padding: 7px 6px; border-radius: 6px; }
.act:hover { background: var(--hover); }
.act time { color: var(--dim); font: 12px var(--mono); padding-top: 2px; }
.act .dot { width: 7px; height: 7px; box-shadow: none; margin-top: 6px; }
.act .t { min-width: 0; overflow-wrap: anywhere; }
.act .t small { display: block; color: var(--bad); font-size: 12.5px; margin-top: 2px; }
.act.bad .t > span { color: var(--bad); }
@media (max-width: 760px) {
  .act { grid-template-columns: 40px 10px 1fr; }
  .act .chip { grid-column: 3; justify-self: start; }
}

/* ---------- Network ---------- */

.netstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.netstats .stat { padding: 14px 16px; display: grid; gap: 3px; min-width: 0; }
.netstats small { color: var(--dim); font-size: 12px; }
.netstats b { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.netstats span { color: var(--dim); font-size: 12.5px; }
.netstats .linkbtn { margin: 0; text-align: left; }
.exposed { padding: 4px 0; }
.route { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.route:last-child { border-bottom: 0; }
.route .chip { justify-self: start; }
.route .t { min-width: 0; }
.route .t b { display: block; }
.route .t a { color: var(--dim); font: 12px var(--mono); text-decoration: none; overflow-wrap: anywhere; }
.route .t a:hover { color: var(--accent); }
.route small { color: var(--dim); font-size: 12.5px; text-align: right; }
.dev { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.dev:last-of-type { border-bottom: 0; }
.dev .dot { width: 8px; height: 8px; box-shadow: none; }
.dev small { display: block; color: var(--dim); font-size: 12px; }
.dev .r { text-align: right; font-size: 13px; }
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .down { fill: var(--accent); }
svg.bars .up { fill: var(--chart-2, #b48ead); opacity: .85; }
svg.bars text { fill: var(--dim); font-size: 10.5px; text-anchor: middle; }
svg.bars text.ymax { text-anchor: start; }
svg.bars g:hover rect { opacity: .7; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; margin-top: 6px; }
.legend .k { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--accent); }
.legend .k.up { background: var(--chart-2, #b48ead); margin-left: 10px; }
.netaddr { padding: 16px 18px; margin-top: 4px; }
.kvrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; }
.kvrow small { display: block; color: var(--dim); font-size: 12px; }
.kvrow b { font-weight: 550; overflow-wrap: anywhere; }
.kvrow .mono { font: 12.5px var(--mono); }
@media (max-width: 760px) {
  .netstats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .route { grid-template-columns: 1fr; gap: 4px; }
  .route small { text-align: left; }
}

/* ---------- Files ---------- */

.files-page { position: relative; }
.fbrowser { padding: 0; overflow: hidden; }
.fbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fbar .crumbs { margin: 0; font-size: 14px; }
.fbar .crumbs a { color: var(--accent); text-decoration: none; padding: 2px 5px; border-radius: 5px; }
.fbar .crumbs a:hover { background: var(--hover); }
.fbar .crumbs > span { color: var(--faint); }
.fbar-tools { display: flex; align-items: center; gap: 12px; }
.flist { max-height: 62vh; overflow: auto; }
.frow { display: grid; grid-template-columns: 22px minmax(0, 1fr) 90px 110px 34px; gap: 12px; align-items: center; padding: 7px 16px; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.frow:hover, .frow:focus-visible { background: var(--hover); outline: 0; }
.frow svg { width: 18px; height: 18px; color: var(--dim); }
.frow .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .s, .frow .m { color: var(--dim); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.frow .more { border: 0; background: none; color: var(--dim); font-size: 18px; border-radius: 6px; height: 28px; cursor: pointer; }
.frow .more:hover { background: var(--seg-on); color: var(--fg); }
.ffoot { padding: 8px 16px; color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); }
.uploads { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; background: var(--field); }
.upl { display: grid; grid-template-columns: minmax(0, 1fr) 160px 130px; gap: 12px; align-items: center; font-size: 13px; }
.upl .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl .s { color: var(--dim); text-align: right; font-size: 12px; }
.upl.done .meter > div { background: var(--ok); }
.upl.failed .meter > div { background: var(--bad); }
.upl.failed .s { color: var(--bad); }
.dropzone { position: fixed; inset: 0; z-index: 70; background: var(--overlay); display: grid; place-items: center; pointer-events: none; }
.dropzone > div { padding: 30px 40px; border: 2px dashed var(--accent); border-radius: var(--r); background: var(--pop); font-size: 16px; }
.share { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.share:last-child { border-bottom: 0; }
.share .t { flex: 1; min-width: 0; }
.share .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share small { color: var(--dim); font-size: 12px; }
.share.dead { opacity: .55; }
.clip textarea { width: 100%; min-height: 120px; resize: vertical; box-sizing: border-box; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field); color: var(--fg); padding: 10px 12px; font: 13px var(--mono); outline: 0; }
.clip textarea:focus { border-color: var(--accent); }
.clip .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.field { width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field); color: var(--fg); outline: 0; }
.field:focus { border-color: var(--accent); }
@media (max-width: 760px) {
  .frow { grid-template-columns: 22px minmax(0, 1fr) 70px 34px; }
  .frow .m { display: none; }
  .upl { grid-template-columns: 1fr 90px; }
  .upl .s { display: none; }
}

/* ---------- Command palette ---------- */

.palette-btn { display: flex; align-items: center; gap: 8px; width: 100%; margin: 4px 0 12px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field); color: var(--dim); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.palette-btn:hover { border-color: var(--accent); color: var(--fg); }
.palette-btn svg { width: 15px; height: 15px; flex: none; }
.palette-btn span { flex: 1; }
kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--card-solid); color: var(--dim); }
#search-btn { display: none; }
.palette-backdrop { position: fixed; inset: 0; z-index: 85; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: min(640px, 100%); background: var(--pop); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.pin { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pin svg { width: 18px; height: 18px; color: var(--dim); flex: none; }
.pin input { flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: none; color: var(--fg); font-size: 16px; }
.pres { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.pres li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.pres li svg { width: 17px; height: 17px; color: var(--dim); flex: none; }
.pres li .t { flex: 1; min-width: 0; }
.pres li b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres li small { display: block; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres li .kind { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.pres li[aria-selected=true] { background: var(--accent-soft); }
.pres li[aria-selected=true] svg { color: var(--accent); }
.pres li.none { color: var(--dim); justify-content: center; cursor: default; }
.pfoot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.pfoot kbd { margin-right: 3px; }
@media (max-width: 760px) {
  #search-btn { display: grid; margin-left: auto; }
  .palette-btn kbd { display: none; }
  .palette-backdrop { padding-top: 10px; }
  .palette { max-height: 80vh; }
}

/* ---------- Notifications (Settings) ---------- */

.notif { padding: 16px 18px; }
.notif-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.notif-head p { margin: 4px 0 0; color: var(--dim); font-size: 13.5px; max-width: 60ch; }
.notif-head .acts { display: flex; gap: 8px; }
.notif .kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 20px; margin-top: 16px; }
.notif .kinds .switch { font-size: 13.5px; color: var(--fg); }

/* ---------- Updates ---------- */

.uphero { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.uptop { display: flex; gap: 36px; flex-wrap: wrap; }
.uptop small { display: block; color: var(--dim); font-size: 12px; }
.uptop b { font-size: 22px; font-weight: 650; }
.uptop b.warn { color: var(--warn); } .uptop b.ok { color: var(--ok); }
.uptop span { display: block; color: var(--dim); font-size: 12.5px; }
.uptop .linkbtn { margin: 0; display: block; }
.uphero .acts, .uphead .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.uplist { padding: 0; }
.uphead { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.uphead p { margin: 0; color: var(--dim); font-size: 13.5px; max-width: 70ch; }
.uphead b.warn { color: var(--warn); }
.uprow { display: grid; grid-template-columns: minmax(160px, 1fr) auto minmax(0, 1.2fr); gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.uprow:last-child { border-bottom: 0; }
.uprow .tags { display: flex; gap: 5px; }
.uprow code { color: var(--dim); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.boots { padding: 0; }
.applog { padding: 14px 16px; margin-bottom: 14px; }
.applog pre { margin: 8px 0 0; max-height: 300px; overflow: auto; background: var(--code-bg); border-radius: var(--r-sm); padding: 10px 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; }
.alert code { font: 12px var(--mono); background: var(--field); padding: 1px 6px; border-radius: 4px; }
@media (max-width: 760px) {
  .uprow { grid-template-columns: 1fr; gap: 2px; }
  .uprow code { text-align: left; }
  .uptop { gap: 20px; }
}

/* Right-click menus */
.menu button.danger { color: var(--bad); }
.menu button:disabled { opacity: .45; cursor: default; }
.menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }


/* ---------- System Monitor ---------- */

/* The header and tabs stay put; the tab's own content scrolls (Overview,
   History) or fills the rest with its table (Applications, Processes). */
.mon { height: 100%; display: flex; flex-direction: column; padding-bottom: 0; max-width: none; }
.mon-head { margin-bottom: 14px; flex: none; }
.mon-head .sub { display: flex; align-items: center; gap: 8px; }
.mon-head .sub::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.mon-actions { display: flex; gap: 8px; align-items: center; }
.mon-tabs { flex: none; display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.mon-tabs::-webkit-scrollbar { display: none; }
.mon-tabs a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; color: var(--dim); text-decoration: none; font-weight: 500;
  white-space: nowrap; border-bottom: 2px solid transparent; border-radius: var(--r-sm) var(--r-sm) 0 0; transition: color .15s, background .15s; }
.mon-tabs a:hover { color: var(--fg); background: var(--hover); }
.mon-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.mon-tabs svg { width: 17px; height: 17px; }
.mon-page { flex: 1; min-height: 0; overflow: auto; margin: 0 -36px; padding: 0 36px 36px; }
.mon-page.fit { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 24px; }
.mon-page.fit > .table-card, .mon-page.fit > .split { flex: 1; min-height: 0; }
.ico-svg.sm { width: 12px; height: 12px; }

/* overview: four live tiles */
.mtiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.mtile { --mc: var(--accent); position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 182px; padding: 14px 16px 0; }
.mtile header, .mnet header, .mdisks header { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mtile header > svg, .mnet header > svg, .mdisks header > svg { width: 32px; height: 32px; padding: 7px; border-radius: 10px; flex: none;
  color: var(--mc, var(--m0)); background: color-mix(in srgb, var(--mc, var(--m0)) 15%, transparent); }
.mtile header b, .mnet header b, .mdisks header b { font-weight: 650; font-size: 14px; white-space: nowrap; }
.mtile header small, .mnet header small, .mdisks header small { margin-left: auto; color: var(--dim); font-size: 12px; font-family: var(--meta-font);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.mval { min-width: 0; }
.mval b { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1; font-family: var(--meta-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mval b i { font-style: normal; font-size: 16px; font-weight: 600; color: var(--dim); margin-left: 2px; }
.mval small { display: block; color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mval .warnline { font-size: 17px; color: var(--warn); letter-spacing: 0; }
.mring { width: 54px; height: 54px; flex: none; transform: rotate(-90deg); }
.mring circle { fill: none; stroke-width: 5; }
.mring .tr { stroke: var(--sw-off); }
.mring .br { stroke: var(--mc); stroke-linecap: round; transition: stroke-dasharray .6s ease, stroke .3s; }
.mtile.hot .mring .br { stroke: var(--bad); }
.mtile.hot .mval b { color: var(--bad); }
.mtile.none .mval b { color: var(--dim); }
.cores { display: flex; align-items: stretch; gap: 2px; height: 24px; margin-top: 10px; }
.cores i { flex: 1; display: flex; align-items: flex-end; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, var(--mc) 13%, transparent); }
.cores i b { display: block; width: 100%; border-radius: 2px; background: var(--mc); transition: height .6s ease; }
.trend { display: block; flex: none; width: calc(100% + 32px); height: 52px; margin: auto -16px 0; }
.trend path[class^="l"] { fill: none; stroke-width: 1.7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mtile .trend .a0 { fill: color-mix(in srgb, var(--mc) 20%, transparent); }
.mtile .trend .l0 { stroke: var(--mc); }
.mpair .trend .a0 { fill: color-mix(in srgb, var(--m0) 18%, transparent); }
.mpair .trend .l0 { stroke: var(--m0); }
.mpair .trend .a1 { fill: color-mix(in srgb, var(--m1) 14%, transparent); }
.mpair .trend .l1 { stroke: var(--m1); }

.mpair { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.mnet, .mdisks { display: flex; flex-direction: column; overflow: hidden; min-height: 210px; padding: 14px 16px 0; }
.mnet header > svg { --mc: var(--m0); }
.flows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.flow .k { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; }
.flow .k svg { width: 15px; height: 15px; }
.flow .k0 svg, .mdisks .k0 { color: var(--m0); }
.flow .k1 svg, .mdisks .k1 { color: var(--m1); }
.flow b { display: block; margin-top: 2px; font-size: 24px; font-weight: 700; letter-spacing: -.5px; font-family: var(--meta-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mnet footer { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; color: var(--faint); font: 12px var(--mono); min-width: 0; }
.mnet footer span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dlist { display: flex; flex-direction: column; gap: 11px; margin: 14px 0 12px; }
.disk .dl { display: flex; align-items: baseline; gap: 10px; font-size: 13px; min-width: 0; }
.disk .dl b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.disk .dl span { margin-left: auto; color: var(--dim); font-size: 12px; font-family: var(--meta-font); white-space: nowrap; }
.disk .dl em { width: 38px; text-align: right; font-style: normal; font-weight: 650; font-family: var(--meta-font); }
.disk.full .dl em { color: var(--bad); }
.dbar { height: 7px; margin-top: 5px; border-radius: 4px; background: var(--sw-off); overflow: hidden; }
.dbar i { display: block; height: 100%; border-radius: 4px; transition: width .6s ease; }
.mapps.table-card { height: 470px; }

/* tables (applications, processes) */
.table-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; container-type: inline-size; }
.table-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table-head h2 { flex: 1; margin: 0 6px 0 4px; font-size: 15px; font-weight: 650; }
.table-head .search { width: 230px; height: 34px; padding: 0 10px; gap: 8px; color: var(--dim); }
.table-head .search svg { width: 16px; height: 16px; flex: none; }
.table-head .sp { flex: 1; }
.table-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.btn.icon-only { width: 30px; padding: 0; justify-content: center; }
.btn[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.danger-ghost:not(:disabled) { color: var(--bad); }
.btn.danger-ghost:not(:disabled):hover { border-color: var(--bad); background: var(--bad-soft); }
.table-wrap { flex: 1; min-height: 0; overflow: auto; }
table.dtable { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
table.dtable th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 10px; background: var(--card-solid); border-bottom: 1px solid var(--line);
  color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; text-align: right; white-space: nowrap; cursor: pointer; user-select: none; }
table.dtable th.name { text-align: left; }
table.dtable th:hover { color: var(--fg); }
table.dtable th .arrow svg { width: 12px; height: 12px; margin-left: 3px; vertical-align: -1px; color: var(--accent); stroke-width: 2.4; }
table.dtable td { position: relative; height: 36px; padding: 0 10px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--meta-font); font-variant-numeric: tabular-nums; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
table.dtable td.name { text-align: left; font-family: var(--font); font-weight: 500; }
table.dtable tbody tr:hover td { background: var(--hover); }
table.dtable tbody tr.selected td { background: var(--accent-soft); }
table.dtable tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.dtable .app-icon { width: 22px; height: 22px; margin-right: 10px; vertical-align: -6px; border-radius: 5px; }
table.dtable .app-icon.blank { display: inline-block; background: var(--field); border: 1px solid var(--line); }
table.dtable .indent { display: inline-block; }
table.dtable .twisty { display: inline-block; width: 16px; text-align: center; color: var(--dim); cursor: pointer; }
table.dtable th.pick, table.dtable td.pick { padding: 0; text-align: center; }
table.dtable .pick input { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--accent); cursor: pointer; }
table.dtable .spark { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 8px; overflow: visible; }
table.dtable .spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: .75; vector-effect: non-scaling-stroke; }
@container (max-width: 640px) {
  .table-head .btn > span { display: none; }
  .table-head .btn { width: 32px; padding: 0; justify-content: center; }
  .table-head .btn .ico-svg.sm { display: none; }
  .table-head h2 { display: none; }
  .table-head .search { flex: 1; width: auto; min-width: 0; }
}
@media (pointer: coarse) {
  table.dtable td { height: 42px; }
  table.dtable .pick input { width: 20px; height: 20px; }
}
.pick-bar { display: none; }

/* applications: the table and the details panel */
.split { display: flex; gap: 14px; min-height: 0; }
.split > .table-card { flex: 1; min-width: 0; }
.details { width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.details .head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 650; }
.details .head > span:not(.app-icon) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.details .head .app-icon { width: 28px; height: 28px; flex: none; border-radius: 7px; }
.details .head .app-icon.blank { background: var(--field); border: 1px solid var(--line); }
.details .body { flex: 1; overflow-y: auto; padding: 4px 14px 14px; }
.details h3 { margin: 14px 0 6px; color: var(--dim); font-size: 11.5px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.details h3 small { margin-left: 6px; color: var(--faint); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.details .empty { padding: 30px 14px; }
.procbox { display: flex; flex-direction: column; max-height: 320px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.proc-acts { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; }
.proc-acts > span { flex: 1; color: var(--dim); font-size: 12.5px; }

/* history */
.mcharts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { min-width: 0; padding: 14px 16px 8px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 650; }
.chart-card h2 svg { width: 18px; height: 18px; color: var(--accent); }
.chart-card .note { margin: -4px 0 6px; color: var(--dim); font-size: 12px; }
.chart-card .plot { min-height: 180px; }
.mon .u-legend { font-size: 12px; color: var(--dim); text-align: left; }
.mon .u-legend .u-series:first-child { display: none; }
.mon .u-legend .u-marker { border-radius: 3px; }
.mon .u-legend .u-value { font-family: var(--meta-font); color: var(--fg); }

@media (max-width: 1100px) {
  .mtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .hide-phone { display: none !important; }
  .mon-page { margin: 0 -14px; padding: 0 14px 24px; }
  .mon-page.fit { padding-bottom: 0; margin: 0 -14px; }
  .mon-page.fit > .table-card, .mon-page.fit .split > .table-card { border-radius: 0; border-left: 0; border-right: 0; }
  .mon-head { margin-bottom: 8px; }
  .mon-tabs { margin-bottom: 12px; }
  .mon-tabs a { padding: 9px 10px; }
  .mtiles { gap: 10px; margin-bottom: 10px; }
  .mtile { min-height: 158px; padding: 12px 12px 0; }
  .mtile header > svg { width: 28px; height: 28px; padding: 6px; }
  .mtile header small { display: none; }
  .mval b { font-size: 24px; }
  .mring { width: 40px; height: 40px; }
  .trend { width: calc(100% + 24px); margin: auto -12px 0; height: 44px; }
  .mpair { grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
  .mcharts { grid-template-columns: 1fr; gap: 10px; }
  .mapps.table-card { height: 430px; }
  .details { position: fixed; inset: 0; z-index: 70; width: auto; border-radius: 0; border: 0; }
  .pick-bar.on { display: flex; align-items: center; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card-solid); }
  .pick-bar > span { flex: 1; font-weight: 600; }
}

/* Voice test: one line at a time, big enough to use one-handed on the phone. */
.voicetest { max-width: 620px; }
.voicetest .seg { margin-bottom: 14px; }
.vt-card { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.vt-count { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.vt-say { margin: 0; font-size: clamp(22px, 6vw, 30px); line-height: 1.25; font-weight: 600; text-wrap: balance; }
.vt-rec { min-height: 76px; border-radius: var(--r); border: 0; background: var(--accent); color: var(--accent-fg); font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.vt-rec.live { background: var(--bad); color: #fff; }
.vt-rec:disabled { opacity: .6; cursor: default; }
.vt-meter { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.vt-meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.vt-note { min-height: 20px; color: var(--dim); font-size: 14px; }
.vt-note.bad { color: var(--bad); }
.vt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.vt-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.vt-dots button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--btn-line); background: none; color: var(--dim); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.vt-dots button.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.vt-dots button.cur { border-color: var(--accent); color: var(--fg); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ======================= Stream page ======================= */
/* The homelab desktop, inside the dashboard. Built for a phone held upright
   first and the Chromebook second. Once the picture is live the chrome gets
   out of the way: the bar fades after a few seconds and comes back on a
   touch, because the thing Te came for is the desktop, not the buttons. */

.streampage { padding: 0; height: 100%; }

.streamwrap {
  position: relative;
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  background: #000;
  overscroll-behavior: none;
  --chrome: 1;            /* 1 visible, 0 faded out */
}
.streamwrap.hidechrome { --chrome: 0; cursor: none; }

/* ---- the picture ---- */

.stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: grid; place-items: center; overflow: hidden;
  touch-action: none; overscroll-behavior: contain;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(136, 192, 208, .05), transparent 70%), #000;
}
.stage canvas {
  /* Fill the stage exactly and let object-fit letterbox the picture inside.
     The obvious version -- width/height auto with max-width/max-height 100% --
     overflowed: max-width won, the aspect ratio set the height from it, and
     the percentage max-height did not clamp it back. In landscape that made a
     1920x1080 picture 515px tall in a 412px box, hanging 103px off the bottom,
     which is what "overshoots" looked like. */
  /* Absolute against the stage, which is position: relative, because that
     containing block is always definite. A percentage height on a grid item
     whose row is content-sized resolves to auto, and then the intrinsic
     1920x1080 ratio sets the height from the width -- which is how it ended
     up 515px tall in a 412px box. */
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; background: #000;
  /* Without this a swipe is a page gesture: the browser claims the pointer
     after the first move, fires pointercancel, and the cursor stops dead
     after one small jump. It is the whole reason the trackpad felt broken. */
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  /* Letterbox rather than stretch: a squashed desktop is worse than bars. */
  object-fit: contain;
  transition: filter .25s ease, transform .25s ease;
}
.streamwrap[data-live="0"] .stage canvas { opacity: 0; }
/* A reconnect keeps the last frame underneath and frosts it, so dropping a
   quality step reads as a pause instead of a crash. */
.stage.frosted canvas { opacity: 1; filter: blur(14px) saturate(.6) brightness(.5); transform: scale(1.03); }
.stage.locked { cursor: none; }

/* ---- health chip ---- */

.hud {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 999px;
  background: rgba(10, 12, 16, .62);
  border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-family: var(--mono); font-size: 11.5px; color: #dfe6ef;
  white-space: nowrap; pointer-events: none;
  opacity: calc(.35 + .65 * var(--chrome));
  transition: opacity .3s ease;
}
.hud .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--off); flex: 0 0 auto; }
.hud .pip[data-level="good"] { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hud .pip[data-level="ok"]   { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.hud .pip[data-level="bad"]  { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

/* ---- the overlay: start, connecting, ended ---- */

.sheet {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; padding: 24px;
  background: rgba(8, 10, 14, .55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet[hidden] { display: none; }
.sheet .panel {
  width: min(420px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 24px;
  text-align: center;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--r); box-shadow: var(--card-shadow);
}
.sheet .eyebrow {
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--dim); font-weight: 600;
}
.sheet h2 {
  margin: 0; font-size: 23px; font-weight: 650; color: var(--fg); line-height: 1.25;
  /* Never split a hostname at its hyphen: "homelab-admin" over two lines
     reads as two different machines. */
  overflow-wrap: normal; word-break: keep-all; hyphens: none;
}
.sheet .note { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--dim); max-width: 34ch; }
.sheet .hint { font-size: 12px; color: var(--faint); }
/* Software decode is worth noticing before you start, not after the phone
   has warmed up and you are wondering why the picture stutters. */
.sheet .hint.soft { color: var(--warn); }
.sheet .go {
  margin-top: 6px; padding: 12px 26px; min-height: 46px;
  background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: 999px;
  font: 650 15px/1 var(--font); cursor: pointer;
  box-shadow: 0 6px 20px rgba(136, 192, 208, .28);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.sheet .go:hover { filter: brightness(1.07); box-shadow: 0 8px 26px rgba(136, 192, 208, .38); }
.sheet .go:active { transform: translateY(1px) scale(.985); }

/* Connecting: a quiet ring rather than a spinner that implies a hang. */
.sheet.busy .panel::before {
  content: ""; width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--card-line); border-top-color: var(--accent);
  animation: streamspin .9s linear infinite;
}
@keyframes streamspin { to { transform: rotate(360deg); } }

/* ---- the control bar ---- */

.bar {
  flex: 0 0 auto; position: relative; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  background: var(--rail-solid); border-top: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  touch-action: pan-x;
  opacity: var(--chrome);
  transform: translateY(calc((1 - var(--chrome)) * 100%));
  transition: opacity .25s ease, transform .25s ease;
}
.bar::-webkit-scrollbar { display: none; }
.streamwrap.hidechrome .bar { pointer-events: none; }
.bar .grp { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.bar .grp.quality { margin-inline: auto; }

.ib {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 0 13px; flex: 0 0 auto;
  background: var(--btn); color: var(--fg);
  border: 1px solid var(--btn-line); border-radius: 999px;
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ib svg { width: 17px; height: 17px; flex: 0 0 auto; }
.ib:hover { background: var(--seg-on); }
.ib.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ib.danger { color: var(--bad); border-color: rgba(191, 97, 106, .4); }
.ib.danger:hover { background: var(--bad-soft); }

/* The drop button says where you are, so the bar needs no separate readout. */
.ib.drop span { font-variant-numeric: tabular-nums; }
.ib.drop.floor { opacity: .55; }

/* Quality as a segmented control, on the start panel where there is room for
   all four steps. In the bar it pushed Sound and Fullscreen off a phone. */
.sheet .quality { margin: 4px 0 2px; }
.speedrow {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; margin-top: 2px;
}
.speedrow > span { font-size: 12px; color: var(--dim); }
.speedrow[hidden] { display: none; }
.quality {
  background: var(--field); border: 1px solid var(--btn-line);
  border-radius: 999px; padding: 3px; gap: 2px;
}
.seg {
  display: inline-flex; align-items: baseline; gap: 3px;
  min-height: 34px; padding: 0 11px;
  background: transparent; color: var(--dim);
  border: none; border-radius: 999px;
  font: 500 12.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg i { font-style: normal; font-size: 10.5px; opacity: .7; }
.seg:hover { color: var(--fg); }
.seg.on { background: var(--seg-on); color: var(--fg); font-weight: 650; }

/* ---- on-screen keyboard ---- */
/* Every key is ours, so nothing is missing and it is the same on both
   devices. Modifiers are sticky because you cannot hold Ctrl on glass:
   one tap arms for the next key, two taps lock it down. */

.kbdsheet {
  flex: 0 0 auto; position: relative; z-index: 3;
  background: var(--rail-solid); border-top: 1px solid var(--line);
  padding: 0 4px 4px;
  animation: kbdup .18s ease;
}
.kbdsheet[hidden] { display: none; }
@keyframes kbdup { from { transform: translateY(14px); opacity: 0; } }
.kbdsheet .grab {
  display: block; width: 44px; height: 4px; margin: 7px auto;
  background: var(--faint); border: none; border-radius: 999px;
  cursor: pointer; padding: 0; opacity: .6;
}
.kbdsheet .grab:hover { opacity: 1; }

.kbd { display: flex; flex-direction: column; gap: 5px; max-width: 820px; margin: 0 auto; }
.kbdrow { display: flex; gap: 5px; }
.kbd .key {
  flex: 1 1 0; min-width: 0;
  /* 44px is the smallest target a thumb reliably hits. */
  min-height: 44px; padding: 0 2px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--btn); color: var(--fg);
  border: 1px solid var(--btn-line); border-radius: 9px;
  font: 500 15px/1 var(--font); cursor: pointer;
  /* A keyboard must not scroll the page, select text or fire a magnifier. */
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s ease, transform .06s ease;
}
.kbd .key:active { background: var(--seg-on); transform: translateY(1px); }
.kbd .key.mod { font-size: 12.5px; color: var(--dim); }
.kbd .key.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* Locked has to read differently from armed, or you cannot tell why Ctrl
   is behaving as though it is stuck. */
.kbd .key.locked {
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 700;
}

@media (max-width: 760px) {
  .bar { gap: 5px; padding-inline: 7px; }
  .bar .grp { gap: 5px; }
  .bar .grp.quality { margin-inline: 0; }
  /* Six controls will not fit a phone with six words next to them, and a bar
     that scrolls hides Fullscreen behind a gesture nobody will discover. So
     the two universally understood glyphs lose their labels and everything
     else keeps its word, including the quality, which is the one you need to
     read rather than recognise. */
  /* Measured, not guessed: at 412px the six controls plus Stop came to 416,
     so this is the pixel that makes them all fit rather than hiding one
     behind a sideways scroll. */
  .ib { padding: 0 8px; font-size: 11.5px; gap: 5px; }
  .ib svg { width: 18px; height: 18px; }
  .ib[data-act="kbd"] span,
  .ib[data-act="audio"] span,
  .ib[data-act="full"] span,
  /* Stop keeps only its red square. The input mode gets the word instead,
     because "Trackpad" versus "Touch" is the distinction worth reading and a
     red square is already unambiguous. */
  .ib[data-act="stop"] span { display: none; }
  .ib[data-act="kbd"], .ib[data-act="audio"],
  .ib[data-act="full"], .ib[data-act="stop"] { padding: 0 11px; }
  .seg { padding: 0 9px; }
  .kbd .key { min-height: 41px; font-size: 14px; border-radius: 8px; }
  .kbd, .kbdrow { gap: 4px; }
  .hud { font-size: 10.5px; padding: 5px 9px; }
  .sheet .panel { padding: 22px 18px; }
  .sheet h2 { font-size: 20px; }
}

/* Fullscreen: the wrap becomes the screen. Stated explicitly, and in
   percentages -- 100vh on a phone is the LARGE viewport including browser
   chrome, so it overshoots the real fullscreen height. */
.streamwrap:fullscreen { width: 100%; height: 100%; background: #000; }
.streamwrap:fullscreen .stage { position: absolute; inset: 0; }

/* ---- landscape on a phone ---- */
/* A phone on its side is only ~400px tall, and a 60px bar plus a 240px
   keyboard would leave almost nothing for the picture. So both float over
   the stream instead of taking height from it, the keys get shorter, and
   the picture keeps the whole screen. The bar fades on its own anyway, so
   most of the time there is nothing on top of the desktop at all. */
@media (orientation: landscape) and (max-height: 560px) {
  /* The bar floats, because it fades away on its own and the picture should
     have the whole screen when it does. The keyboard does NOT float: it stays
     in the layout so the picture shrinks above it and you can still see what
     you are typing into, which is the entire point of having it open. */
  .bar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
    background: rgba(14, 17, 23, .82);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, .07);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }
  /* Letting the keyboard push the picture up left 137px of desktop on a
     412px-tall screen, which is useless. So it floats, and it is translucent:
     you keep the whole picture and can still see roughly what is behind the
     keys. The keys themselves stay solid enough to read and hit. */
  .kbdsheet {
    position: absolute; left: 0; right: 0; bottom: 46px; z-index: 4;
    background: rgba(14, 17, 23, .45);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px 12px 0 0; padding-bottom: 2px;
  }
  .kbdsheet .grab { margin: 4px auto; }
  .kbd .key { background: rgba(47, 55, 70, .88); }
  .kbd .key.mod { background: rgba(47, 55, 70, .62); }
  .stage { position: absolute; inset: 0; }
  /* A toast lifted over a floating bar lands in the middle of the picture, so
     in landscape it goes to the top instead. The health chip moves to the left
     and the toast is capped, so the two do not sit on each other. */
  .toast { bottom: auto; top: 44px; max-width: 55%; }
  .hud { right: auto; left: 8px; top: 8px; }

  /* Six rows of 44px will not fit 400px of height. */
  .kbd .key { min-height: 30px; font-size: 13px; border-radius: 6px; }
  .kbd, .kbdrow { gap: 3px; }
  .kbd .key.mod { font-size: 11px; }

  .ib { min-height: 34px; }
  .seg { min-height: 28px; }
  .hud { top: 6px; right: 8px; }

  /* The start panel has to clear the floating bar AND the keyboard, or Start
     ends up underneath them and cannot be pressed. */
  .sheet { padding: 10px 16px 60px; align-items: center; overflow: auto; }
  .sheet .quality { flex-wrap: wrap; justify-content: center; }
  .sheet .panel { padding: 14px 18px; gap: 7px; }
  .sheet h2 { font-size: 18px; }
  .sheet .go { min-height: 40px; padding: 10px 22px; margin-top: 2px; }
  .sheet .note, .sheet .hint { font-size: 11.5px; }
  .speedrow { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar, .hud, .stage canvas, .kbdsheet, .sheet .go { transition: none; animation: none; }
}
