/* Oculi design system. Dark by default; light via [data-theme="light"].
   Tokens first (color, type, space, motion), then base, layout, components, utilities.
   Area stylesheets (area-*.css) must use these tokens — no one-off colors, durations or font sizes. */
:root {
  /* surfaces: calm cool greys, one soft accent, quiet 1px lines */
  --bg: #121417;
  --bg-2: #15171a;
  --panel: #1a1d21;
  --panel-2: #1f2227;
  --hover: #252930;
  --border: #2a2e34;
  --border-2: #363b42;
  --text: #e6e9ec;
  --text-strong: #f5f6f8;
  --text-2: #c9d0d8;
  --muted: #aab2bb;             /* text-2 → muted → faint: three distinct levels (≈1.4:1 apart) */
  --faint: #8a939e;             /* ≥4.5:1 on panel, panel-2 and hover */
  --accent: #93b7ec;
  --accent-2: #a9c7f1;
  --primary: #bcd2ee;
  --primary-hover: #d2e1f5;
  --on-primary: #13202f;
  --accent-bg: color-mix(in srgb, var(--accent) 13%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 24%, transparent);
  --ok: #86c09f;
  --ok-bg: color-mix(in srgb, #86c09f 14%, transparent);
  --warn: #e9b872;
  --warn-bg: color-mix(in srgb, #e9b872 14%, transparent);
  --bad: #e99090;
  --bad-bg: color-mix(in srgb, #e99090 14%, transparent);
  --info: #8cc7e0;
  --info-bg: color-mix(in srgb, #8cc7e0 13%, transparent);
  --field: #15171a;
  --field-border: #4a505a;      /* ≥3:1 against fields and panels (WCAG 1.4.11) */
  --btn-bg: var(--panel-2);
  --btn-bg-hover: var(--hover);
  --btn-shadow: none;
  --check-bg: var(--field);
  --backdrop: #06080ab8;
  --shadow: 0 12px 32px #0009, 0 1px 3px #0006;
  --shadow-1: none;
  /* chart series (validated for both themes) */
  --s1: #93b7ec; --s2: #86c09f; --s3: #e9b872; --s4: #e99090; --s5: #b6a4f4; --s6: #7fcfcf; --s7: #ee9cc4; --s8: #c9cf8a;
  /* shape */
  --radius: 8px;
  --radius-s: 6px;
  --radius-l: 12px;
  --sidebar: 228px;
  --topbar: 48px;
  /* type scale */
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Cantarell", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --fs-1: 11px;  /* captions, badges */
  --fs-2: 12px;  /* labels, secondary */
  --fs-3: 13px;  /* body */
  --fs-4: 15px;  /* section titles */
  --fs-5: 19px;  /* page titles */
  --fs-6: 24px;  /* big numbers */
  --fs-kpi: 22px; /* KPI tile values */
  /* motion: short, eased, never in the way */
  --dur-1: .12s; /* hover, press, color */
  --dur-2: .18s; /* enter/exit of small overlays */
  --dur-3: .3s;  /* layout-ish changes, bars */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  /* spacing: a strict 4px scale. Components never set outer margins; containers own the gaps. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  /* component metrics (density switches these) */
  --gap: 16px;          /* between page sections / grid tracks */
  --gap-s: 8px;         /* inside groups */
  --pad: 14px;          /* card padding */
  --cell-y: 8px;        /* table cell vertical padding */
  --cell-x: 12px;
  --ctl-h: 32px;        /* buttons and inputs */
  --ctl-h-s: 28px;
  --nav-h: 28px;        /* sidebar rows */
  --content-pad: 20px;
  /* z-index ladder: menus sit above layers (a menu opened from the palette must be visible) */
  --z-sticky: 20; --z-drawer: 90; --z-modal: 100; --z-layer: 180; --z-menu: 190; --z-toast: 200;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
/* density */
:root[data-density="compact"] { --gap: 12px; --gap-s: 6px; --pad: 10px; --cell-y: 5px; --cell-x: 10px; --ctl-h: 28px; --ctl-h-s: 24px; --nav-h: 26px; --content-pad: 14px; }
/* text size: scales the type ramp (and with it most of the interface) */
:root[data-fs="14"] { --fs-1: 12px; --fs-2: 13px; --fs-3: 14px; --fs-4: 16px; --fs-5: 20px; --fs-6: 26px; }
:root[data-fs="15"] { --fs-1: 12.5px; --fs-2: 14px; --fs-3: 15px; --fs-4: 17px; --fs-5: 22px; --fs-6: 28px; }
/* accents (dark values; light values below). Each pair keeps AA contrast on its theme's surfaces. */
:root[data-accent="violet"] { --accent: #b6a4f4; --accent-2: #c6b8f7; --primary: #cdbff8; --primary-hover: #ddd3fb; --on-primary: #1e1636; }
:root[data-accent="teal"]   { --accent: #7fcfcf; --accent-2: #9adada; --primary: #a8e0e0; --primary-hover: #c2eaea; --on-primary: #0f2626; }
:root[data-accent="green"]  { --accent: #8fcfa8; --accent-2: #a5d9b8; --primary: #a9dcbd; --primary-hover: #c3e8d1; --on-primary: #10261a; }
:root[data-accent="amber"]  { --accent: #f39a5e; --accent-2: #f6b083; --primary: #f5a874; --primary-hover: #f8bf98; --on-primary: #2d1a0b; } /* orange: never mistaken for --warn */
:root[data-accent="pink"]   { --accent: #ee9cc4; --accent-2: #f3b9d6; --primary: #f3b9d6; --primary-hover: #f7d0e3; --on-primary: #2e1020; }

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-2: #eef0f3;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --hover: #eef1f4;
  --border: #e3e6ea;
  --border-2: #d0d5dc;
  --text: #1c2026;
  --text-strong: #0f1216;
  --text-2: #2f3640;
  --muted: #4a525c;
  --faint: #656d77;             /* ≥4.5:1 on bg-2; 1.5:1 below muted */
  --accent: #2c66c8;
  --accent-2: #2459b2;
  --primary: #2c66c8;
  --primary-hover: #2459b2;
  --on-primary: #ffffff;
  --ok: #22784a; --ok-bg: color-mix(in srgb, #22784a 10%, transparent);
  --warn: #8f5b0b; --warn-bg: color-mix(in srgb, #8f5b0b 10%, transparent);
  --bad: #b83c3c; --bad-bg: color-mix(in srgb, #b83c3c 9%, transparent);
  --info: #17688f; --info-bg: color-mix(in srgb, #17688f 9%, transparent);
  --field: #ffffff;
  --field-border: #b4bbc5;
  --btn-bg: var(--panel);
  --btn-bg-hover: var(--hover);
  --btn-shadow: var(--shadow-1);
  --backdrop: #0f141c5c;
  --shadow: 0 12px 32px #0f141c1f, 0 1px 3px #0f141c1a;
  --shadow-1: 0 1px 2px #0f141c0f;
  --s1: #2c66c8; --s2: #22865a; --s3: #a86c08; --s4: #c94c4c; --s5: #6a4fd3; --s6: #0f7b7b; --s7: #c1407f; --s8: #6b7212;
  color-scheme: light;
}
:root[data-theme="light"][data-accent="violet"] { --accent: #6a4fd3; --accent-2: #5a40bd; --primary: #6a4fd3; --primary-hover: #5a40bd; --on-primary: #fff; }
:root[data-theme="light"][data-accent="teal"]   { --accent: #0e7676; --accent-2: #0b6262; --primary: #0e7676; --primary-hover: #0b6262; --on-primary: #fff; }
:root[data-theme="light"][data-accent="green"]  { --accent: #22784a; --accent-2: #1b6440; --primary: #22784a; --primary-hover: #1b6440; --on-primary: #fff; }
:root[data-theme="light"][data-accent="amber"]  { --accent: #b4560f; --accent-2: #9a490c; --primary: #b4560f; --primary-hover: #9a490c; --on-primary: #fff; }
:root[data-theme="light"][data-accent="pink"]   { --accent: #b33a76; --accent-2: #9a3065; --primary: #b33a76; --primary-hover: #9a3065; --on-primary: #fff; }
/* reduce-motion preference set in the app (the OS setting is handled at the end of this file) */
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fs-3)/1.45 var(--font); font-synthesis: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-size-adjust: 100%; }
/* theme switch: the new theme is revealed in a circle from where you clicked (prefs.js sets --vt-x/--vt-y), via View
   Transitions (charts included). No cross-fade: dark and light averaged together is a muddy grey frame. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal var(--dur-3) var(--ease-out); }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0%)); } to { clip-path: circle(150vmax at var(--vt-x, 100%) var(--vt-y, 0%)); } }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-2); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; color: var(--text-strong); }
h1 { font-size: var(--fs-5); letter-spacing: -.02em; }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-3); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-2) 0; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
::placeholder { color: var(--faint); opacity: 1; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* fields show focus with their own ring; no second outline stacked on top */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
svg { flex: none; }
.icon { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ layout */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding-left: var(--safe-l); }
.brand { display: flex; align-items: center; gap: 9px; padding: 14px 16px; font-weight: 700; font-size: var(--fs-4); letter-spacing: -.02em; color: var(--text-strong); }
.brand:hover { text-decoration: none; }
.brand svg { width: 24px; height: 24px; }
.proj-switch { margin: 4px 10px 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); box-shadow: var(--shadow-1); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); width: calc(100% - 20px); text-align: left; transition: border-color var(--dur-1) var(--ease); }
.proj-switch:hover { border-color: var(--border-2); }
.proj-switch small { display: block; color: var(--muted); font-size: var(--fs-1); }
.proj-switch svg { width: 14px; height: 14px; color: var(--muted); }
.nav { padding: 4px 8px 16px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav::-webkit-scrollbar-thumb { border-color: var(--bg-2); }
@property --fade-t { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --fade-b { syntax: '<length>'; inherits: false; initial-value: 0px; }
@keyframes y-fade { from { --fade-t: 0px; --fade-b: 24px; } 8% { --fade-t: 24px; } 92% { --fade-b: 24px; } to { --fade-t: 24px; --fade-b: 0px; } }
@supports (animation-timeline: scroll()) {
  .nav { -webkit-mask-image: linear-gradient(transparent, #000 var(--fade-t), #000 calc(100% - var(--fade-b)), transparent);
    mask-image: linear-gradient(transparent, #000 var(--fade-t), #000 calc(100% - var(--fade-b)), transparent); animation: y-fade linear both; animation-timeline: scroll(self block); }
}
.nav-group { padding-top: var(--sp-3); }
.nav-label { padding: 0 10px 4px; font-size: var(--fs-1); font-weight: 600; color: var(--faint); letter-spacing: .02em; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 10px; min-height: var(--nav-h); border-radius: var(--radius-s); color: var(--text-2); font-weight: 500; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--text-strong); }
.nav a.active svg { color: var(--accent-2); opacity: 1; }
.nav a svg { width: 16px; height: 16px; opacity: .85; }
.nav a .count { margin-left: auto; font-size: var(--fs-1); padding: 0 6px; border-radius: 9px; background: var(--bad-bg); color: var(--bad); }
.sidebar-foot { padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-2); }
.sidebar-foot .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .grow > div:first-child { color: var(--text); font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 0 calc(var(--content-pad) + var(--safe-r)) 0 calc(var(--content-pad) + var(--safe-l)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--border); }
.topbar .title { font-weight: 600; font-size: var(--fs-3); display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; color: var(--text); }
.topbar .title .crumb { color: var(--muted); font-weight: 500; }
.topbar .title .sep { color: var(--faint); }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.zoom-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px; background: var(--accent-bg); color: var(--accent-2); font-size: var(--fs-2); font-weight: 600; animation: pop-in var(--dur-2) var(--ease-out); }
.zoom-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 2px 6px; border-radius: 10px; font-weight: 600; }
.zoom-chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; display: inline-block; }
.live-dot.off { background: var(--faint); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.content { padding: var(--content-pad) calc(var(--content-pad) + var(--safe-r)) calc(var(--content-pad) + var(--sp-2) + var(--safe-b)) calc(var(--content-pad) + var(--safe-l)); max-width: 1680px; width: 100%; container-type: inline-size; container-name: content; }
/* the page container owns vertical rhythm: sections are spaced by one gap, never by their own margins */
.page { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
/* id-strength on purpose: beats .mt/.mb and per-area margins so the gap is the only spacing between sections */
#content > .page > * { margin-top: 0; margin-bottom: 0; }
#content > .page > :empty { display: none; }   /* empty slots (e.g. a banner with nothing to say) take no gap */
.scrim { display: none; }
/* keyboard: the first Tab stop jumps past the sidebar to the page */
.skip-link { position: fixed; z-index: var(--z-toast); top: var(--sp-2); left: var(--sp-2); transform: translateY(-200%); }
.skip-link:focus-visible { transform: none; }
/* the top-bar title steps aside while the page's own H1 is on screen (no doubled title), and returns as you scroll */
.topbar .title.dup > * { display: none; }
.topbar .title > * { animation: fade var(--dur-2) var(--ease); }

/* ------------------------------------------------------------------ grid helpers */
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack.tight { gap: var(--gap-s); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-s); }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--gap); align-items: start; }
.grid.stretch, .split.stretch { align-items: stretch; }
/* a stretched track holding a stack of cards: the last card absorbs the extra height, so no hole opens beneath */
.grid.stretch > .stack > .card:last-child { flex: 1; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* KPI rows: auto-fit (no empty tracks); kpiRow() sets --cols for even rows (8 tiles → 4+4, not 6+2) */
.kpis { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpis.fixed { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.kpis.fixed > :last-child { grid-column: span var(--last-span, 1); }
.span2 { grid-column: span 2; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-2); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: var(--gap); }
.mb { margin-bottom: var(--gap); }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin: 0; }
.page-head p { margin: var(--sp-1) 0 0; color: var(--muted); }
/* outside .page (modals, hosted pages) a page-head still needs a gap below it */
:not(.page) > .page-head { margin-bottom: var(--gap); }
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); } .tone-info { color: var(--info); } .tone-muted { color: var(--muted); }
/* toned KPI / stat values: beat the components' own text-strong colour */
.kpi .k-value.tone-ok, .stat .stat-v.tone-ok { color: var(--ok); } .kpi .k-value.tone-warn, .stat .stat-v.tone-warn { color: var(--warn); } .kpi .k-value.tone-bad, .stat .stat-v.tone-bad { color: var(--bad); }

/* ------------------------------------------------------------------ cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.card .card { box-shadow: none; }
/* a card directly inside a card body reads as a nested box: flatten it into the parent */
.card-b > .card { border: 0; background: none; border-radius: 0; }
.card-b > .card > .card-h, .card-b > .card > .card-b { padding-left: 0; padding-right: 0; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) 10px; padding: var(--pad) var(--pad) 0; min-height: 38px; }
.card-h h3 { font-size: var(--fs-3); font-weight: 600; color: var(--text-strong); letter-spacing: -.005em; }
.card-h .spacer { flex: 1; }
.card-b { padding: var(--sp-3) var(--pad) var(--pad); }
.card-h + .card-b { padding-top: var(--sp-3); }
.card-b:first-child { padding-top: var(--pad); }
.card-b.flush { padding: 0; }
.card-b.flush > .table-wrap { padding-top: 4px; }
.card.pad { padding: var(--pad); }
a.card.hoverable, .card.hoverable { color: inherit; }
a.card.hoverable:hover, .card.hoverable:hover { border-color: var(--border-2); background: var(--panel-2); text-decoration: none; }

.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: var(--sp-3) var(--pad); min-width: 0; position: relative; overflow: hidden; transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.kpi .k-label { color: var(--muted); font-size: var(--fs-2); font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-value { font-size: var(--fs-kpi); font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.kpi .k-value small { font-size: var(--fs-3); color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi .k-sub { font-size: var(--fs-1); color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 28px; opacity: .5; pointer-events: none; }
.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }
a.kpi { color: inherit; display: block; }
a.kpi:hover { border-color: var(--border-2); background: var(--panel-2); text-decoration: none; }

/* statline: hairline strip of stats for detail-page headers (servers/errors/players). Page summaries use .kpis. */
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.statline > .stat { padding: var(--sp-3) var(--pad); box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); min-width: 0; }
/* stat: a compact label/value pair (inside cards, headers) */
.stat .stat-l { font-size: var(--fs-1); color: var(--muted); white-space: nowrap; }
.stat .stat-v { font-size: var(--fs-4); font-weight: 650; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; color: var(--text-strong); white-space: nowrap; }
.stat.lg .stat-v { font-size: var(--fs-6); letter-spacing: -.02em; }

/* ------------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl-h); padding: 0 var(--sp-3); border-radius: var(--radius-s); border: 1px solid var(--border-2); background: var(--btn-bg); box-shadow: var(--btn-shadow); color: var(--text); font: 600 var(--fs-2)/1 var(--font); cursor: pointer; white-space: nowrap; flex: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform .08s var(--ease); }
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.btn > svg:first-child:not(:only-child) { margin-left: -2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: none; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); box-shadow: none; }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 20%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: var(--ctl-h-s); padding: 0 10px; font-size: var(--fs-2); }
.btn.icon { width: var(--ctl-h); padding: 0; }
.btn.sm.icon { width: var(--ctl-h-s); }
.btn.busy, .btn.busy:hover { position: relative; color: transparent; }
.btn.busy::after { content: ""; position: absolute; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; flex-wrap: wrap; }
.btn-group .btn { border-radius: 0; margin-left: -1px; box-shadow: none; }
.btn-group .btn:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
/* the one "selected button" recipe (segmented controls, pickers): .btn.on */
.btn.on, .btn-group .btn.on { background: var(--accent-bg); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: none; position: relative; z-index: 1; }

input, select, textarea { color: var(--text); background: var(--field); border: 1px solid var(--field-border); border-radius: var(--radius-s); padding: 6px 10px; height: var(--ctl-h); outline: none; min-width: 0; transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
textarea { height: auto; min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[readonly] { background: var(--bg-2); }
input[type="radio"] { height: auto; width: auto; accent-color: var(--accent); }
/* checkbox: drawn to match the theme (native ones are grey squares in dark mode) */
input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; padding: 0; margin: 0; border: 1px solid var(--field-border); border-radius: 4px; background: var(--field) center / 12px 12px no-repeat; cursor: pointer; vertical-align: middle; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { background-color: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
:root:not([data-theme="light"]) input[type="checkbox"]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313202f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
input[type="checkbox"]:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='white' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E"); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: .45; cursor: default; }
.switch input[type="checkbox"] { width: 100%; height: 100%; border: 0; background: none; }
input[type="range"] { padding: 0; accent-color: var(--accent); border: 0; background: none; box-shadow: none; }
input[type="date"], input[type="datetime-local"] { color-scheme: inherit; }
/* selects: no vertical padding (the fixed height clipped 15px text in compact density), a stroked chevron like every other dropdown */
select { padding-top: 0; padding-bottom: 0; padding-right: 28px; appearance: none; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aab2bb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px 14px; }
:root[data-theme="light"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a525c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: var(--fs-2); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-1); color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.search { position: relative; }
.search input { padding-left: 30px; width: 100%; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.switch { position: relative; width: 34px; height: 20px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 20px; pointer-events: none; transition: background-color var(--dur-2) var(--ease); }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px #0003; transition: transform var(--dur-2) var(--ease); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th { text-align: left; font-weight: 500; font-size: var(--fs-1); color: var(--muted); padding: var(--cell-y) var(--cell-x); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--panel); }
/* long tables opt in: the wrapper scrolls vertically, so the sticky header has something to stick to */
.table-wrap.scroll { max-height: 70vh; overflow: auto; }
.table-wrap.scroll .t th { position: sticky; top: 0; z-index: 1; }
.t th .th-btn { border: 0; background: none; padding: 0; margin: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 3px; }
.t th .th-btn:hover { color: var(--text); }
.t th .th-btn .arrow { opacity: 0; font-size: 10px; transition: opacity var(--dur-1); }
.t th[aria-sort] .th-btn .arrow { opacity: 1; color: var(--text-2); }
.t th.r .th-btn { flex-direction: row-reverse; }
.t td { padding: var(--cell-y) var(--cell-x); border-bottom: 1px solid var(--border); vertical-align: middle; transition: background-color var(--dur-1); }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--hover); }
/* a selected row keeps its fill while hovered (hover deepens it a little) */
.t tbody tr.selected td { background: var(--accent-bg); }
.t tbody tr.selected:hover td { background: color-mix(in srgb, var(--accent) 19%, transparent); }
.t tr.clickable { cursor: pointer; }
.t td.r, .t th.r { text-align: right; white-space: nowrap; }
.t td.mono, .t td .mono, .t td .jobid { font-size: var(--fs-2); white-space: nowrap; }
h1.jobid, h2.jobid { overflow-wrap: anywhere; min-width: 0; }
.t.compact td { padding: calc(var(--cell-y) - 3px) var(--cell-x); }
.player-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; color: inherit; }
.player-cell:hover { text-decoration: none; }
.player-cell:hover .pc-name { text-decoration: underline; }
.player-cell .pc-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-cell .pc-sub { color: var(--faint); font-size: var(--fs-1); white-space: nowrap; }

/* ------------------------------------------------------------------ badges, tags */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 5px; font-size: var(--fs-1); font-weight: 600; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-bg); color: var(--accent-2); }
.badge .dot { width: 6px; height: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); } .dot.off { background: var(--faint); }
.lvl { font-family: var(--mono); font-size: var(--fs-1); font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.lvl-0 { color: var(--faint); } .lvl-1 { color: var(--info); background: var(--info-bg); } .lvl-2 { color: var(--warn); background: var(--warn-bg); } .lvl-3 { color: var(--bad); background: var(--bad-bg); }
.bar { height: 5px; border-radius: 5px; background: var(--hover); overflow: hidden; min-width: 50px; }
.bar > i { display: block; height: 100%; background: var(--accent-2); border-radius: 5px; transition: width var(--dur-3) var(--ease); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

/* list-item: one row recipe for side lists, pickers, trees (selected = filled pill) */
.list { display: flex; flex-direction: column; gap: 1px; }
.list-item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--nav-h); padding: 4px 10px; border: 0; border-radius: var(--radius-s); background: none; color: var(--text-2); font: inherit; text-align: left; cursor: pointer; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.list-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.list-item.on, .list-item[aria-selected="true"] { background: var(--accent-bg); color: var(--text-strong); }
.list-item .meta { margin-left: auto; color: var(--faint); font-size: var(--fs-1); }
/* chip: filter / tag pill (toggleable with .on) */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1) 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 13px; background: var(--btn-bg); color: var(--text-2); font: 500 var(--fs-2)/1 var(--font); white-space: nowrap; cursor: pointer; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
/* only buttons/links are interactive chips; a plain span is a static label */
span.chip { cursor: default; }
span.chip:hover { background: var(--btn-bg); border-color: var(--border-2); color: var(--text-2); }
.chip:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.chip.on { background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-2); }
.chip svg { width: 13px; height: 13px; }

/* edge fade for sideways-scrolling strips (tabs, sort strips, chip rows, phone action rows): the side with more to
   scroll fades out. Scroll-driven, so a strip that fits shows no fade at all. */
@property --fade-l { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --fade-r { syntax: '<length>'; inherits: false; initial-value: 0px; }
@keyframes x-fade { from { --fade-l: 0px; --fade-r: 28px; } 6% { --fade-l: 28px; } 94% { --fade-r: 28px; } to { --fade-l: 28px; --fade-r: 0px; } }
@supports (animation-timeline: scroll()) {
  .tabs, .t-cards .t thead tr, .hub-items, .hub-chips, .filters > .chips, .svc-index, .page-head > :last-child:not(:first-child) {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
    animation: x-fade linear both; animation-timeline: scroll(self inline);
  }
}

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); overflow-x: auto; scrollbar-width: none; }
/* inside a stack the parent's gap already spaces the tabs: no extra margin (containers own spacing) */
.stack > .tabs { margin-bottom: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 8px 12px; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: 500 var(--fs-3) var(--font); white-space: nowrap; transition: color var(--dur-1) var(--ease), border-color var(--dur-2) var(--ease); }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .on { color: var(--text-strong); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ charts */
.chart-wrap { min-width: 0; }
.chart { position: relative; width: 100%; min-height: 60px; }
.chart .u-legend { display: none; }
.chart .u-over .u-cursor-x { border-right: 1px dashed var(--border-2); }
.chart .u-over .u-cursor-pt { border-width: 2px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 2px 2px 0; min-height: 20px; font-size: var(--fs-1); color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; border-radius: 3px; transition: opacity var(--dur-1); }
.chart-legend span.off { opacity: .4; }
.chart-legend span:focus-visible { outline-offset: 1px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-tip { position: absolute; z-index: 10; pointer-events: none; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 8px 10px; font-size: var(--fs-2); min-width: 150px; white-space: nowrap; }
.chart-tip .tt { color: var(--muted); margin-bottom: 4px; font-size: var(--fs-1); }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.chart-tip .tr b { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-empty { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: var(--fs-2); position: absolute; inset: 0; }
.chart .u-over .u-select { background: var(--accent-bg); }

/* ------------------------------------------------------------------ overlays */
.modal-bg { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; animation: fade var(--dur-2) var(--ease); }
.modal { background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-l); box-shadow: var(--shadow); width: 100%; max-width: 520px; animation: rise var(--dur-2) var(--ease-out); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.modal-b { padding: 16px 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
.drawer-bg { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--backdrop); animation: fade var(--dur-2) var(--ease); }
.drawer { position: fixed; z-index: calc(var(--z-modal) + 1); top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--panel); border-left: 1px solid var(--border-2); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide-in var(--dur-3) var(--ease-out); padding-bottom: var(--safe-b); }
.drawer.wide { width: min(860px, 100vw); }
.drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-b { padding: 16px 18px; overflow-y: auto; flex: 1; }
.toasts { position: fixed; z-index: var(--z-toast); right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel); border: 1px solid var(--border-2); border-left: 3px solid var(--accent-2); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 10px 14px; animation: rise var(--dur-2) var(--ease-out); }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.menu { position: absolute; z-index: var(--z-menu); background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; min-width: 200px; max-height: 70vh; overflow-y: auto; transform-origin: top left; animation: pop-in var(--dur-1) var(--ease-out); }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: var(--sp-2); padding: 6px 10px; min-height: 32px; border: 0; background: none; color: var(--text); text-align: left; border-radius: 5px; cursor: pointer; outline: none; font-size: var(--fs-3); }
.menu button:disabled { opacity: .45; cursor: default; }
.menu button.danger, .menu button.danger svg { color: var(--bad); }
.menu .mi-pad { width: 15px; flex: none; }
.menu .mi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .mi-hint { color: var(--faint); font-size: var(--fs-2); }
.menu .mi-kbd { margin-left: var(--sp-3); }
.menu .mi-keys { display: inline-flex; gap: 3px; margin-left: var(--sp-3); }
.menu .mi-keys .mi-kbd { margin-left: 0; }
.menu .mi-sub { margin-left: var(--sp-2); width: 13px; height: 13px; color: var(--faint); }
.menu.sub { min-width: 180px; }
.menu button svg { width: 15px; height: 15px; color: var(--muted); }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu .on { background: var(--hover); text-decoration: none; }
.menu .on::after { content: "✓"; margin-left: var(--sp-2); color: var(--accent-2); font-size: var(--fs-2); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu .lbl { padding: 6px 10px 2px; font-size: var(--fs-1); font-weight: 600; color: var(--faint); }
.leaving { animation: leave var(--dur-1) var(--ease) forwards !important; pointer-events: none; }
/* alias for area styles that used the old name */
@keyframes menu-in { from { opacity: 0; transform: scale(.97) translateY(-2px); } }
.drawer.leaving { animation: slide-out var(--dur-2) var(--ease) forwards !important; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.99); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(-2px); } }
@keyframes leave { to { opacity: 0; transform: translateY(4px); } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes slide-out { to { transform: translateX(24px); opacity: 0; } }

/* ------------------------------------------------------------------ misc */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.empty > svg { width: 32px; height: 32px; color: var(--faint); margin-bottom: var(--sp-1); }
.empty h3 { color: var(--text-2); }
.empty .mt { margin-top: var(--sp-2); }
.empty .row { justify-content: center; }
/* ui.filterSheet(): phones fold a filter bar behind one button + bottom sheet */
.filters-btn { display: none; }
.filters-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-primary); font-size: var(--fs-1); line-height: 18px; text-align: center; }
.filter-sheet > * { width: 100%; max-width: none; }
.filter-sheet .btn-group { display: flex; }
.filter-sheet .btn-group > .btn { flex: 1; }
@media (max-width: 760px) {
  .filters.has-sheet { flex-wrap: nowrap; }
  .filters.has-sheet > :not(.search):not(.filters-btn) { display: none; }
  .filters.has-sheet > .search { flex: 1 1 0; min-width: 0; }
  .filters-btn { display: inline-flex; flex: none; gap: var(--sp-1); }
}
.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, var(--hover) 45%, var(--panel-2) 65%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-s); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk-page { display: flex; flex-direction: column; gap: var(--gap); animation: fade var(--dur-3) var(--ease) .15s both; }
.sk-title { height: 22px; width: 180px; }
.sk-kpi { height: 74px; border-radius: var(--radius); }
.sk-chart { height: 236px; border-radius: var(--radius); }
.sk-row { height: 34px; }
/* ui.openCloudSetup(): the one "connect Roblox Open Cloud" card (ui.problem renders it for opencloud_missing) */
.setup-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-4); align-items: start; padding: var(--sp-1) 2px; }
.setup-card p { margin: 0; }
.setup-card-icon { width: 44px; height: 44px; border-radius: var(--radius-l); display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
.setup-card-icon svg { width: 22px; height: 22px; }
.setup-scopes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-1); }
.setup-scopes > span { margin-right: var(--sp-1); }
.scope-chip { display: inline-block; max-width: 100%; white-space: nowrap; font: var(--fs-1)/1.6 var(--mono); padding: 0 6px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg-2); color: var(--text-2); vertical-align: baseline; }
.setup-inline { display: flex; gap: var(--sp-2); align-items: baseline; }
.setup-inline > svg { flex: none; align-self: center; color: var(--accent); }
.setup-steps { margin: var(--sp-1) 0; padding-left: 18px; color: var(--text-2); display: grid; gap: var(--sp-1); }
@container content (max-width: 560px) { .setup-card { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .setup-card { grid-template-columns: minmax(0, 1fr); } }
.err-box { background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); border-radius: var(--radius-s); padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note { background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); border-radius: var(--radius-s); padding: 10px 12px; color: var(--text-2); }
.note.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
pre.code { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px; overflow: auto; margin: 0; max-height: 480px; line-height: 1.55; white-space: pre; }
pre.code.wrap { white-space: pre-wrap; word-break: break-word; }
/* JSON: syntax colours (jsonPretty) and the JSON editor textarea (jsonEditor) */
.j-key { color: var(--accent-2); } .j-str { color: var(--ok); } .j-num { color: var(--warn); } .j-bool, .j-null { color: var(--s5); }
textarea.json-edit { font-family: var(--mono); font-size: var(--fs-2); min-height: 320px; tab-size: 2; white-space: pre; }
@media (pointer: coarse) { textarea.json-edit { font-size: 16px; } }
.copy-wrap { position: relative; }
.copy-wrap .btn { position: absolute; top: 6px; right: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--hover); flex: none; object-fit: cover; }
.avatar.sm { width: 20px; height: 20px; }
.avatar.lg { width: 64px; height: 64px; }
.avatar.xl { width: 56px; height: 56px; }
.loader { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; justify-content: center; padding: 60px; }
.logline { display: grid; grid-template-columns: 150px 52px minmax(0, 1fr); gap: 10px; padding: 3px 12px; font-family: var(--mono); font-size: var(--fs-2); border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.logline:hover { background: var(--hover); }
.logline .msg { white-space: pre-wrap; word-break: break-word; }
.logline .src { color: var(--faint); }
.logline .srv { white-space: nowrap; display: inline-block; font-family: var(--mono); }
.waterfall .wf-row { display: grid; grid-template-columns: 260px 1fr 80px; gap: 10px; align-items: center; padding: 4px 0; font-size: var(--fs-2); }
.waterfall .wf-bar { position: relative; height: 14px; }
.waterfall .wf-bar i { position: absolute; top: 0; height: 100%; border-radius: 3px; background: var(--accent); min-width: 2px; }
.waterfall .wf-bar i.err { background: var(--bad); }
.heat td { text-align: center; font-size: var(--fs-1); padding: 6px 4px; }
.tag-input { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--field-border); border-radius: var(--radius-s); background: var(--field); min-height: 32px; }
.tag-input input { border: 0; background: none; height: 22px; padding: 0 4px; flex: 1; min-width: 80px; box-shadow: none; }
.editor { font-family: var(--mono); font-size: var(--fs-3); min-height: 90px; width: 100%; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.type-confirm input { font-family: var(--mono); }
.paged-more { display: flex; justify-content: center; padding: 10px; }

/* auth / install */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(900px 480px at 50% -10%, var(--accent-bg), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }
.auth-card .brand { justify-content: center; font-size: var(--fs-5); padding: 0 0 18px; }
.auth-card > .card { box-shadow: var(--shadow); }
.pw-field { position: relative; }
.pw-field input { width: 100%; padding-right: 40px; }
.pw-field .pw-reveal { position: absolute; right: 4px; bottom: calc((var(--ctl-h) - var(--ctl-h-s)) / 2); color: var(--muted); }
.pw-field .pw-reveal[aria-pressed="true"] { color: var(--accent-2); }

/* ------------------------------------------------------------------ motion: page entry (first render only) */
.page-enter { animation: page-in var(--dur-2) var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.flash { animation: flash .9s var(--ease); }
@keyframes flash { 0% { color: var(--accent-2); } 100% { color: inherit; } }
.row-new td { animation: row-in .6s var(--ease); }
@keyframes row-in { from { background: var(--accent-bg); } }

/* ------------------------------------------------------------------ responsive */
/* grids follow the space the content actually has (sidebar open or collapsed), not the window */
@container content (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .kpis.fixed { grid-template-columns: repeat(var(--cols-md, min(var(--cols, 4), 4)), minmax(0, 1fr)); }
  .kpis.fixed > :last-child { grid-column: span var(--last-span-md, 1); }
}
@container content (max-width: 860px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { --content-pad: 14px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: var(--z-drawer); left: 0; top: 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform var(--dur-3) var(--ease-out); box-shadow: var(--shadow); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--backdrop); animation: fade var(--dur-2) var(--ease); }
  body.no-scroll { overflow: hidden; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { gap: 6px; }
  .topbar .range-label { display: none; }
  .content { padding-bottom: calc(24px + var(--safe-b)); }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .kpis, .kpis.fixed { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .kpis.fixed > :last-child { grid-column: span var(--last-span-sm, 1); }
  .kpi { padding: 10px 12px 11px; }
  :root { --fs-kpi: 18px; }
  .logline { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .logline .msg { font-family: var(--font); font-size: var(--fs-3); }
  .waterfall .wf-row { grid-template-columns: 120px 1fr 60px; }
  .hide-sm { display: none !important; }
  .page-head h1 { font-size: var(--fs-4); }
  /* header actions: one tidy row that scrolls sideways instead of stacking buttons */
  .page-head > :last-child:not(:first-child) { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .page-head > :last-child:not(:first-child)::-webkit-scrollbar { display: none; }
  .page-head > :last-child:not(:first-child) > .btn.primary { order: -1; }   /* the main action is never the clipped one */
  .page-head > :last-child:not(:first-child) > .fold-hidden { display: none; }   /* system/headfold.js: folded into ⋯ */
  .page-head > :last-child:not(:first-child) > .fold-more { order: 99; margin-left: auto; }
  .chart-tip { max-width: 70vw; }
  /* modals become bottom sheets with full-width actions */
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: var(--radius-l) var(--radius-l) 0 0; border-bottom: 0; max-height: 92dvh; overflow: auto; padding-bottom: var(--safe-b); animation: sheet-in .26s var(--ease-out); }
  .modal-f .btn { flex: 1; }
}
@keyframes sheet-in { from { transform: translateY(32px); opacity: 0; } }

/* touch: every target at least 40px, inputs at 16px (iOS zooms the page on smaller focused fields) */
@media (pointer: coarse) {
  :root { --ctl-h: 40px; --ctl-h-s: 40px; --nav-h: 40px; }
  input, select, textarea { font-size: 16px; }
  /* buttons and segmented controls sit next to 16px fields: match their size (13px beside 16px read as two systems) */
  .btn, .btn.sm { font-size: 15px; }
  .btn.sm { padding: 0 12px; }
  :root .chip { height: 40px; padding: 0 14px; }   /* :root beats per-area .chip sizes */
  .tabs a, .tabs button { padding: 11px 14px; }
  .menu button, .menu a { min-height: 44px; font-size: 15px; }
  .t th .th-btn { min-height: 40px; } /* touch: sortable headers meet the 40px target too */
  .btn-group .btn { min-width: 44px; }
  .list-item { min-height: 40px; }
  .switch { width: 44px; height: 26px; }
  .switch span::before { width: 20px; height: 20px; }
  .switch input:checked + span::before { transform: translateX(18px); }
  input[type="checkbox"] { width: 20px; height: 20px; }
  .zoom-chip { height: 32px; }
  .chart-legend span { min-height: 28px; }
  .brand-row .btn { opacity: 1; }
  :root .swatch { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

/* hairline list of rows inside a flush card (error samples, feeds) instead of boxes inside a box */
.sample-list > * { border: 0; border-radius: 0; background: none; border-bottom: 1px solid var(--border); padding: var(--cell-y) var(--pad); }
.sample-list > :last-child { border-bottom: 0; }
.sample-list > .expandable:hover { background: var(--hover); }

/* table column that takes the remaining width and truncates its content (column cls: "fill") */
.t td.fill { width: 100%; max-width: 0; }
.t td.fill > a.ellipsis, .t td.fill > .ellipsis { display: block; }

/* ------------------------------------------------------------------ system layer: sidebar rail, pins, palette, menus, shortcuts, settings hub */
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); color: var(--muted); font: 500 var(--fs-1)/1 var(--font); }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding-right: var(--sp-2); }
.brand-row .btn { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.sidebar:hover .brand-row .btn, .brand-row .btn:focus-visible { opacity: 1; }
.cmdk { display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--ctl-h-s); min-width: 220px; padding: 0 6px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--field); color: var(--faint); font: 500 var(--fs-2) var(--font); cursor: pointer; transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.cmdk:hover { border-color: var(--border-2); color: var(--muted); }
.cmdk .cmdk-label { flex: 1; text-align: left; }
.cmdk svg { width: 14px; height: 14px; }
.proj-initial { display: none; }
:root[data-sidebar="collapsed"] .proj-initial { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--accent-bg); color: var(--accent-2); font-weight: 700; font-size: var(--fs-2); }
/* collapsed rail: icons only, labels as tooltips */
:root[data-sidebar="collapsed"] { --sidebar: 56px; }
:root[data-sidebar="collapsed"] .sidebar .brand-name, :root[data-sidebar="collapsed"] .sidebar .nav-text, :root[data-sidebar="collapsed"] .sidebar .nav-label,
:root[data-sidebar="collapsed"] .sidebar .proj-switch .grow, :root[data-sidebar="collapsed"] .sidebar .proj-switch svg, :root[data-sidebar="collapsed"] .sidebar-foot .grow { display: none; }
:root[data-sidebar="collapsed"] .brand-row { flex-direction: column; padding: 0; }
:root[data-sidebar="collapsed"] .brand { padding: 14px 16px 6px; }
:root[data-sidebar="collapsed"] .brand-row .btn { opacity: 1; }
:root[data-sidebar="collapsed"] .proj-switch { justify-content: center; margin: 4px 8px 8px; width: auto; height: 32px; padding: 0; }
:root[data-sidebar="collapsed"] .nav { padding: 4px 8px 16px; }
:root[data-sidebar="collapsed"] .nav a { justify-content: center; padding: 0; min-height: 34px; }
:root[data-sidebar="collapsed"] .nav a .count { position: absolute; top: 2px; right: 4px; margin: 0; padding: 0 4px; font-size: 10px; line-height: 14px; }
:root[data-sidebar="collapsed"] .nav-group { padding-top: var(--sp-2); border-top: 1px solid transparent; }
:root[data-sidebar="collapsed"] .nav-group + .nav-group { border-top-color: var(--border); margin-top: var(--sp-2); }
:root[data-sidebar="collapsed"] .sidebar-foot { flex-direction: column; padding: 8px 0 calc(8px + var(--safe-b)); }
/* keyboard row cursor (j / k) */
.t tbody tr.row-cursor td, .t tbody tr.row-cursor:hover td { background: var(--accent-bg); }
.t tr.row-cursor td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
#content .row-cursor:not(tr) { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
time[data-ts] { font-variant-numeric: tabular-nums; }
:root[data-keyseq="g"] .cmdk::after { content: "g …"; color: var(--accent-2); font: 600 var(--fs-1) var(--font); }

/* layers (palette, cheat sheet) */
.layer-bg { position: fixed; inset: 0; z-index: var(--z-layer); background: var(--backdrop); animation: fade var(--dur-2) var(--ease); }
.palette { position: fixed; z-index: calc(var(--z-layer) + 1); left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); max-height: min(560px, 76vh); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-l); box-shadow: var(--shadow); overflow: hidden; animation: pal-in var(--dur-2) var(--ease-out); }
@keyframes pal-in { from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.985); } }
.palette.leaving { animation: pal-out var(--dur-1) var(--ease) forwards !important; }
@keyframes pal-out { to { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(.99); } }
.pal-head { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3); border-bottom: 1px solid var(--border); }
.pal-head > svg { width: 17px; height: 17px; color: var(--muted); }
.palette .pal-head .pal-input { flex: 1; height: 50px; border: 0; box-shadow: none; outline: none; background: none; font-size: var(--fs-4); padding: 0; }
.pal-crumb { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 5px; background: var(--accent-bg); color: var(--accent-2); font-weight: 600; font-size: var(--fs-2); white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.pal-crumb svg { width: 12px; height: 12px; }
.pal-list { overflow-y: auto; padding: var(--sp-1) var(--sp-2) var(--sp-2); flex: 1; overscroll-behavior: contain; }
.pal-sec { padding: var(--sp-3) var(--sp-2) var(--sp-1); font-size: var(--fs-1); font-weight: 600; color: var(--faint); }
.pal-item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-s); cursor: pointer; color: var(--text); }
.pal-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.pal-item.on { background: var(--hover); }
.pal-item.on svg { color: var(--accent-2); }
.pal-item.danger .pal-label { color: var(--bad); }
.pal-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-label mark { background: none; color: var(--accent-2); font-weight: 600; }
.pal-sub { color: var(--faint); font-size: var(--fs-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.pal-keys { display: inline-flex; gap: 3px; }
.pal-more { display: inline-flex; opacity: 0; }
.pal-item.on .pal-more { opacity: 1; }
.pal-empty { padding: var(--sp-7) var(--sp-4); text-align: center; color: var(--muted); }
.pal-foot { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border); color: var(--faint); font-size: var(--fs-1); }
.pal-foot span { display: inline-flex; align-items: center; gap: 3px; }
.pal-status { color: var(--muted); }
.pal-esc { margin-left: auto; }
/* touch: no keyboard, so no key hints */
@media (pointer: coarse) { .pal-keys, .pal-foot, .pal-esc { display: none; } }
.cheatsheet { position: fixed; z-index: calc(var(--z-layer) + 1); left: 50%; top: 8vh; transform: translateX(-50%); width: min(860px, calc(100vw - 24px)); max-height: 84vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: var(--sp-4) var(--sp-5) var(--sp-5); animation: pal-in var(--dur-2) var(--ease-out); outline: none; }
.cheatsheet.leaving { animation: pal-out var(--dur-1) var(--ease) forwards !important; }
.cs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.cs-grid { columns: 3 220px; column-gap: var(--sp-6); }
.cs-group { break-inside: avoid; padding-bottom: var(--sp-5); }
.cs-group:has(> .cs-row:nth-of-type(13)) { break-inside: auto; }   /* the long Go to list may continue in the next column */
.cs-group h3 { break-after: avoid; }
.cs-row { break-inside: avoid; }
.cs-group h3 { font-size: var(--fs-2); color: var(--muted); margin-bottom: var(--sp-2); }
.cs-or { color: var(--faint); font-size: var(--fs-1); padding: 0 2px; align-self: center; }
.cs-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 3px 0; font-size: var(--fs-2); }
.cs-keys { display: inline-flex; gap: 3px; flex: none; }
.cs-foot { margin-top: var(--sp-1); }

/* settings hub */
.hub { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--sp-7); align-items: start; }
.hub-nav { position: sticky; top: calc(var(--topbar) + var(--content-pad)); display: flex; flex-direction: column; gap: var(--sp-3); max-height: calc(100dvh - var(--topbar) - 2 * var(--content-pad)); overflow-y: auto; }
.hub-nav .search input { height: var(--ctl-h-s); }
.hub-group { display: flex; flex-direction: column; gap: 1px; }
.hub-group + .hub-group { padding-top: var(--sp-3); }
.hub-label { padding: 0 10px var(--sp-1); font-size: var(--fs-1); font-weight: 600; color: var(--faint); }
.hub-sec, .hub-items a, .hub-hit { display: flex; align-items: center; gap: 10px; min-height: var(--nav-h); padding: 4px 10px; border-radius: var(--radius-s); color: var(--text-2); font-weight: 500; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.hub-sec svg { width: 16px; height: 16px; opacity: .85; }
.hub-sec:hover, .hub-items a:hover, .hub-hit:hover { background: var(--hover); color: var(--text); text-decoration: none; }
/* one selection look: the active section is the filled pill (like the sidebar); the active item inside it is
   strong text with an accent tick on the item rail — never a second pill */
.hub-sec.on { background: var(--accent-bg); color: var(--text-strong); }
.hub-sec.on svg { color: var(--accent-2); opacity: 1; }
.hub-items { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 var(--sp-1) 18px; padding-left: var(--sp-2); border-left: 1px solid var(--border); }
.hub-items a { font-weight: 450; font-size: var(--fs-2); min-height: 26px; color: var(--muted); }
.hub-items a { position: relative; }
.hub-items a.on { color: var(--text-strong); font-weight: 550; }
.hub-items a.on::before { content: ""; position: absolute; left: calc(-1 * var(--sp-2) - 1px); top: 5px; bottom: 5px; width: 2px; border-radius: 1px; background: var(--accent); }
.hub-up, .hub-chips { display: none; }
.hub-hit { flex-direction: column; align-items: flex-start; gap: 0; padding: 5px 10px; }
.hub-none { padding: var(--sp-2) 10px; }
.hub-main { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.hub-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.hub-head p { margin: var(--sp-1) 0 0; color: var(--muted); }
.hub-picker { display: flex; align-items: center; gap: var(--sp-2); }
.hub-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-2); }
.hub-back svg { width: 13px; height: 13px; }
.hub-back:hover { color: var(--text); text-decoration: none; }
.hub-picker select { height: var(--ctl-h-s); }
/* hosted pages: the hub supplies the heading and the section navigation */
.hub-embed > .page-head, .hub-embed > .mg-layout > .mg-sidetabs { display: none; }
.hub-embed > .mg-layout { display: block; }
.hub-embed.only-tab > .tabs { display: none; }
.hub-embed > :first-child { margin-top: 0; }
.hub-embed { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.hub-embed > * { margin-top: 0; margin-bottom: 0; }
.hub-embed > :empty { display: none; }

/* preference controls */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: var(--ctl-h); flex-wrap: wrap; }
.pref-label { color: var(--text-2); font-weight: 500; }
.pref-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--border-2); cursor: pointer; padding: 0; transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--text-strong); }
/* swatches show the exact accent each choice applies in the current theme */
.swatch[data-swatch="blue"] { background: #93b7ec; } .swatch[data-swatch="violet"] { background: #b6a4f4; } .swatch[data-swatch="teal"] { background: #7fcfcf; }
.swatch[data-swatch="green"] { background: #8fcfa8; } .swatch[data-swatch="amber"] { background: #f39a5e; } .swatch[data-swatch="pink"] { background: #ee9cc4; }
:root[data-theme="light"] .swatch[data-swatch="blue"] { background: #2c66c8; } :root[data-theme="light"] .swatch[data-swatch="violet"] { background: #6a4fd3; }
:root[data-theme="light"] .swatch[data-swatch="teal"] { background: #0e7676; } :root[data-theme="light"] .swatch[data-swatch="green"] { background: #22784a; }
:root[data-theme="light"] .swatch[data-swatch="amber"] { background: #b4560f; } :root[data-theme="light"] .swatch[data-swatch="pink"] { background: #b33a76; }
.pin-list { display: flex; flex-direction: column; gap: 2px; }
.pin-row { display: flex; align-items: center; gap: var(--sp-2); padding: 2px 4px 2px 8px; border-radius: var(--radius-s); }
.pin-row:hover { background: var(--hover); }
.pin-row > svg { color: var(--muted); }
.kbd-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px var(--sp-6); }
.kbd-table .kbd-item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 4px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-2); }
.kbd-keys { display: inline-flex; gap: 3px; }

@media (max-width: 1100px) { .cmdk { min-width: 0; } .cmdk .cmdk-label, .cmdk kbd { display: none; } }
@media (max-width: 760px) {
  :root[data-sidebar="collapsed"] { --sidebar: 228px; }
  /* drill-in: /settings is the section list; a section is its page with a back chevron and its items as chips */
  .hub { grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
  .hub-nav { position: static; max-height: none; }
  .hub:not(.at-root) > .hub-nav, .hub.at-root > .hub-main { display: none; }
  .hub.at-root .hub-sec.on { background: none; color: var(--text-2); }   /* the list itself: nothing is open yet */
  .hub.at-root .hub-sec.on svg { color: inherit; }
  .hub-items { display: none; }
  .hub-sec { min-height: 44px; }
  .hub-up { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; min-height: 40px; margin: calc(-1 * var(--sp-2)) 0 calc(-1 * var(--sp-3)) -6px; padding: 0 6px; color: var(--accent-2); font-weight: 500; }
  .hub-up svg { width: 18px; height: 18px; }
  .hub-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: calc(-1 * var(--sp-1)) 0 0; }
  .hub-chips:empty { display: none; }
  .hub-chips::-webkit-scrollbar { display: none; }
  .hub-chips .chip { flex: none; }
  .palette { top: 6vh; }
  .pal-foot span:not(.pal-status) { display: none; }
}

/* ------------------------------------------------------------------ mobile ergonomics */
/* tables as cards: table(..., {cards: true}) / liveTable(..., {cards: true}). Below 640px of *table* width every
   row is a compact card: [select] title · badge · action on the first line, labelled stats (meta) on the second.
   Slots come from column.card (title | badge | action | sub | meta | hide); unslotted cells are meta. */
.table-wrap.t-cards { container: tcards / inline-size; }
@container tcards (max-width: 640px) {
  .t-cards table.t, .t-cards .t tbody { display: block; }
  /* the header becomes a sideways row of sort buttons (plus select-all) */
  .t-cards .t thead { display: block; border-bottom: 1px solid var(--border); }
  .t-cards .t thead tr { display: flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); overflow-x: auto; scrollbar-width: none; }
  .t-cards .t thead tr::-webkit-scrollbar { display: none; }
  .t-cards .t th { display: block; flex: none; width: auto !important; padding: var(--sp-1); border: 0; background: none; }
  .t-cards .t th:not(:has(.th-btn, input)), .t-cards .t th[data-card="hide"] { display: none; }
  .t-cards .t th.sel-col { padding: 0 var(--sp-1) 0 var(--sp-1); }
  .t-cards .t tbody tr { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); transition: background-color var(--dur-1); }
  .t-cards .t tbody tr:last-child { border-bottom: 0; }
  .t-cards .t tbody tr:has(> td.sel-col) { padding-left: calc(var(--sp-3) + 36px); }
  .t-cards .t td { padding: 0; border: 0; text-align: left; min-width: 0; }
  /* row states paint the card, not its cells */
  .t-cards .t tbody tr:hover td, .t-cards .t tr.selected td, .t-cards .t tbody tr.row-cursor td { background: none; box-shadow: none; }
  .t-cards .t tbody tr:hover { background: var(--hover); }
  .t-cards .t tbody tr.selected { background: var(--accent-bg); }
  .t-cards .t tbody tr.selected:hover { background: color-mix(in srgb, var(--accent) 19%, transparent); }
  .t-cards .t tbody tr.row-cursor { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
  .t-cards .t td.fill { width: auto; max-width: none; }
  /* slots */
  .t-cards .t td { order: 6; display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-2); color: var(--text-2); white-space: nowrap; }
  .t-cards .t td[data-label]:not([data-card])::before, .t-cards .t td[data-card="meta"][data-label]::before { content: attr(data-label); color: var(--faint); }
  .t-cards .t td.sel-col { position: absolute; left: calc(var(--sp-1) + var(--sp-2)); top: calc(var(--sp-2) + var(--fs-3) * .725); transform: translateY(-50%); width: auto; }   /* centred on the title line */
  .t-cards .t td[data-card="title"] { order: 1; flex: 1 1 0; display: block; font-size: var(--fs-3); color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .t-cards .t td[data-card="badge"] { order: 2; }
  .t-cards .t td[data-card="action"] { order: 3; margin: calc(-1 * var(--sp-1)) calc(-1 * var(--sp-2)) calc(-1 * var(--sp-1)) 0; }
  .t-cards .t tbody tr::after { content: ""; order: 4; flex-basis: 100%; height: 0; }
  .t-cards .t td[data-card="sub"] { order: 5; flex-basis: 100%; display: block; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
  .t-cards .t td[data-card="hide"] { display: none; }
  .t-cards .t td[colspan] { flex: 1; display: block; text-align: center; }
}
/* detail-page stat strips on phones: three narrower columns instead of a tall two-column slab */
@media (max-width: 760px) {
  .statline { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .statline > .stat { padding: var(--sp-2) var(--sp-3); }
}
/* select checkbox hit area: the whole cell, 40px square on touch */
.sel-hit { display: grid; place-items: center start; cursor: pointer; }   /* start: lines up with the header's select-all box */
@media (pointer: coarse) {
  .sel-hit { width: 40px; height: 40px; margin: -10px -10px; place-items: center; }
  .t-cards .t th .th-btn { min-height: 40px; padding: 0 var(--sp-2); }
}

/* short ids (job ids): one line, monospace, tap to copy */
.short-id { display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border: 0; border-radius: var(--radius-s); background: var(--hover); color: var(--text-2); font: 500 var(--fs-2) var(--mono); white-space: nowrap; cursor: copy; flex: none; transition: background-color var(--dur-1) var(--ease); }
.short-id:hover { background: var(--border-2); color: var(--text); }
.short-id .icon { width: .85em; height: .85em; margin-left: 5px; color: var(--muted); }
@media (pointer: coarse) { .short-id { height: 40px; padding: 0 12px; } }

/* menus on phones: bottom sheets (ui.js openMenu adds .sheet under (max-width: 760px) and (pointer: coarse)) */
.menu-scrim { position: fixed; inset: 0; z-index: calc(var(--z-menu) - 1); background: var(--backdrop); animation: fade var(--dur-2) var(--ease); }
.menu-scrim.leaving { animation: fade-out-scrim var(--dur-1) var(--ease) forwards !important; }
@keyframes fade-out-scrim { to { opacity: 0; } }
.menu.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-width: 0; max-height: 72dvh; border-radius: var(--radius-l) var(--radius-l) 0 0; border-bottom: 0;
  padding: var(--sp-1) calc(var(--sp-2) + var(--safe-r)) calc(var(--sp-2) + var(--safe-b)) calc(var(--sp-2) + var(--safe-l)); overscroll-behavior: contain; transform-origin: bottom center; animation: sheet-in .26s var(--ease-out); }
.menu.sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: var(--sp-1) auto var(--sp-2); border-radius: 2px; background: var(--border-2); }
.menu.sheet.sub { z-index: calc(var(--z-menu) + 1); }
.menu.sheet:focus { outline: none; }
.menu.sheet .lbl { padding: var(--sp-1) var(--sp-3) var(--sp-2); }
.menu.sheet.leaving { animation: sheet-out var(--dur-2) var(--ease) forwards !important; }
@keyframes sheet-out { to { transform: translateY(24px); opacity: 0; } }

/* long-press opens the context menu on touch: no iOS callout / text selection on entity rows and links */
@media (pointer: coarse) {
  [data-entity], .t tbody tr.clickable { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* sticky bottom action bar for detail pages on phones: h('div.action-dock', btn…). Hidden above 760px
   (the page head carries the same actions there); the page reserves room so nothing hides under it. */
.action-dock { display: none; }
@media (max-width: 760px) {
  .action-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); display: flex; gap: var(--sp-2); padding: var(--sp-2) calc(var(--sp-3) + var(--safe-r)) calc(var(--sp-2) + var(--safe-b)) calc(var(--sp-3) + var(--safe-l));
    background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); border-top: 1px solid var(--border); animation: rise var(--dur-2) var(--ease-out); }
  .action-dock > .btn { flex: 1 1 0; min-width: 0; height: 44px; padding: 0 var(--sp-2); }
  .action-dock > .btn.icon { flex: none; width: 44px; }
  /* smallest phones: labels only, so "Message server" still fits */
  @media (max-width: 360px) { .action-dock > .btn:not(.icon) > .icon { display: none; } }
  .page:has(> .action-dock) { padding-bottom: calc(44px + var(--sp-4) + var(--safe-b)); }
  body:has(.action-dock) .toasts { bottom: calc(44px + var(--sp-6) + var(--safe-b)); }
  /* a selection's bulk bar takes the same spot */
  .page:has(.bulkbar.float:not([hidden])) > .action-dock { display: none; }
}

/* the icon-only search button (palette) keeps a square touch target */
@media (max-width: 1100px) {
  .topbar .cmdk { min-width: var(--ctl-h-s); justify-content: center; padding: 0; border-color: transparent; background: none; color: var(--muted); }
  .topbar .cmdk:hover { background: var(--hover); color: var(--text); }
}
/* top bar on phones: time range + refresh fold into one ⋯ menu (app.js .topbar-more) */
.topbar .topbar-more { display: none; }
/* the range button never reflows the bar: a zoomed window truncates (full text in its title) */
.topbar .range-label { display: inline-block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .range-chip { gap: 4px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.topbar .range-chip svg:last-child { width: 12px; height: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .topbar .topbar-more { display: inline-flex; }
  .topbar .range-tool { display: none; }
}
