/* =============================================================================
   PXCRFT Hub — application stylesheet
   No build step. Colours are addressed exclusively through tokens. No colour
   value appears in component rules. No transform / size change in hover, focus,
   active or click rules — only colour transitions (0.3s ease).
   ========================================================================== */

/* ----------------------------------------------------------------- fonts -- */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/roboto-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/roboto-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/roboto-condensed-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/roboto-condensed-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('/assets/fonts/roboto-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('/assets/fonts/roboto-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* Brand accent (branding-pxcrft-hub.md) */
  --accent: #AD2588;
  --accent-hover: #9F227D;
  --accent-press: #911F72;
  --accent-soft: rgba(173, 37, 136, 0.1);
  --accent-line: rgba(173, 37, 136, 0.22);
  --accent-glow: rgba(173, 37, 136, 0.35);
  --on-accent: #ffffff;

  /* Surfaces */
  --surface-0: #ffffff;
  --surface-1: #f5f6f8;
  --surface-2: #eceef2;
  --surface-3: #e2e5ea;
  --surface-sunken: #f0f1f4;

  /* Lines */
  --line: rgba(18, 22, 31, 0.10);
  --line-strong: rgba(18, 22, 31, 0.16);
  --hairline: rgba(18, 22, 31, 0.08);

  /* Text (four steps, hierarchy through contrast) */
  --text-0: #14171d;
  --text-1: #363b45;
  --text-2: #676e7b;
  --text-3: #98a0ad;

  /* Status tones — soft fill + darker same-family text */
  --tone-neutral-bg: #eceef2;   --tone-neutral-fg: #4a5160;
  --tone-active-bg: var(--accent-soft); --tone-active-fg: var(--accent-press);
  --tone-success-bg: #e2f3ea;   --tone-success-fg: #1f7a4d;
  --tone-waiting-bg: #fbeede;   --tone-waiting-fg: #9a6412;
  --tone-critical-bg: #fbe4e4;  --tone-critical-fg: #b02525;

  /* Destructive */
  --danger: #c53030;
  --danger-hover: #b02525;
  --danger-press: #9b1f1f;
  --danger-fill: #a51f1f;

  /* Focus ring */
  --focus: rgba(173, 37, 136, 0.45);
  --focus-ring: 0 0 0 3px var(--focus);

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(18, 22, 31, 0.06), 0 1px 1px rgba(18, 22, 31, 0.04);
  --shadow-2: 0 4px 16px rgba(18, 22, 31, 0.08), 0 1px 3px rgba(18, 22, 31, 0.06);
  --shadow-3: 0 18px 50px rgba(18, 22, 31, 0.16), 0 4px 14px rgba(18, 22, 31, 0.08);

  /* Radii */
  --r-surface: 12px;
  --r-control: 8px;
  --r-pill: 999px;

  /* Spacing scale (4px grid) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* Sizing */
  --control-h: 44px;
  --sidebar-w: 340px;
  --sidebar-w-collapsed: 72px;
  --row-h: 44px;

  --font-sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Roboto Condensed', var(--font-sans);
  --font-mono: 'Roboto Mono', ui-monospace, 'SFMono-Regular', monospace;

  --ease: 0.3s ease;
}

/* Dark theme block — deliberately kept lean; not built yet. Only the accent
   soft/line tones differ, per branding. Everything is token-driven so the rest
   can follow later without touching component rules. */
:root[data-theme="dark"] {
  --accent-soft: rgba(173, 37, 136, 0.18);
  --accent-line: rgba(173, 37, 136, 0.32);
}

/* ----------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--surface-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; color: inherit; }
input, textarea, select, button { font-family: inherit; }
img, svg { vertical-align: middle; }

/* Links inside the application are never underlined, in any state. */
a { color: var(--accent); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--accent-hover); text-decoration: none; }

/* Focus rings are always visible on interactive elements. Never removed. */
:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-control);
}

/* Native controls used only as invisible value carriers. */
.px-check__native, .px-radio__native, .px-switch__native {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}

::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3); border-radius: 999px;
  border: 3px solid var(--surface-1);
}

/* --------------------------------------------------------------- layout --- */
.px-app { display: flex; min-height: 100vh; align-items: flex-start; }

.px-sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 auto;
  width: var(--sidebar-w);
  height: 100vh;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  transition: width var(--ease);
}
/* Floating: an inner surface with radius and a gap to three edges. */
.px-sidebar::before {
  content: "";
  position: absolute;
  inset: var(--s-4) 0 var(--s-4) var(--s-4);
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  box-shadow: var(--shadow-2);
  z-index: -1;
}
.px-sidebar > * { position: relative; }

.px-sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
  min-height: var(--control-h);
}
.px-brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  color: var(--text-0); font-weight: 600; font-size: 16px;
}
.px-brand:hover { color: var(--text-0); }
.px-brand__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-control);
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-press));
  box-shadow: 0 4px 12px var(--accent-glow);
  font-size: 15px;
}
.px-brand__name { white-space: nowrap; }

.px-sidebar__collapse {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; background: transparent;
  color: var(--text-3); border-radius: var(--r-control); cursor: pointer;
  transition: color var(--ease), background-color var(--ease);
}
.px-sidebar__collapse:hover { color: var(--text-1); background: var(--surface-2); }

.px-sidebar__body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.px-sidebar__foot {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding-top: var(--s-3); border-top: 1px solid var(--hairline);
}

.px-navgroup { margin-bottom: var(--s-5); }
.px-navgroup__label {
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 11px;
  color: var(--text-3);
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
}
.px-navgroup__items { display: flex; flex-direction: column; gap: var(--s-1); }

.px-navitem {
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--control-h); padding: 0 var(--s-3);
  border-radius: var(--r-control); color: var(--text-1);
  white-space: nowrap; overflow: hidden;
  transition: background-color var(--ease), color var(--ease);
}
.px-navitem:hover { background: var(--surface-2); color: var(--text-0); }
.px-navitem.is-active { background: var(--accent-soft); color: var(--accent-press); }
.px-navitem__icon {
  flex: 0 0 auto; width: 20px; text-align: center; font-size: 16px;
  color: currentColor;
}
.px-navitem__label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }

.px-userchip {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-control);
}
.px-userchip__info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.px-userchip__name { color: var(--text-0); font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-userchip__email { color: var(--text-3); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-userchip__logout { flex: 0 0 auto; }

/* Collapsed sidebar (desktop) */
.px-app[data-sidebar="collapsed"] .px-sidebar { width: var(--sidebar-w-collapsed); }
.px-app[data-sidebar="collapsed"] .px-brand__name,
.px-app[data-sidebar="collapsed"] .px-navitem__label,
.px-app[data-sidebar="collapsed"] .px-navgroup__label,
.px-app[data-sidebar="collapsed"] .px-userchip__info,
.px-app[data-sidebar="collapsed"] .px-sidebar__collapse { display: none; }
.px-app[data-sidebar="collapsed"] .px-navitem,
.px-app[data-sidebar="collapsed"] .px-userchip { justify-content: center; padding: 0; }
.px-app[data-sidebar="collapsed"] .px-sidebar__head { justify-content: center; }

.px-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.px-topbar {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 var(--s-8); min-height: 0;
}
.px-hamburger { display: none; }
.px-content {
  flex: 1 1 auto; width: 100%;
  padding: var(--s-8) var(--s-10) var(--s-10);
}

/* A left-aligned reading column for forms and single-object detail pages. The
   content area itself stays full width (tables, lists, dashboard use it); only
   forms and prose are held to a comfortable measure so controls are "so breit
   wie sinnvoll, nicht so breit wie moeglich". Left-aligned, never centred. */
.px-narrow { width: 100%; max-width: 900px; }

/* Single controls are held to a sensible measure. Inside a multi-column grid the
   cell is narrower than this cap, so fields still fill their column; only a
   lone, full-width field is prevented from stretching absurdly wide. */
.px-field__control, .px-select, .px-datefield { max-width: 560px; }

.px-scrim { display: none; }

/* --------------------------------------------------------- typography ----- */
.px-pagehead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); margin-bottom: var(--s-8);
}
.px-pagehead__title { font-size: 26px; font-weight: 600; color: var(--text-0); letter-spacing: -0.01em; }
.px-pagehead__sub { color: var(--text-2); margin-top: var(--s-1); }
.px-pagehead__actions { display: flex; gap: var(--s-2); flex: 0 0 auto; }

.px-section { margin-bottom: var(--s-8); }
.px-section__head { margin-bottom: var(--s-4); }
.px-section__title { font-size: 17px; font-weight: 600; color: var(--text-0); }
.px-section__desc { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.px-section + .px-section { border-top: 1px solid var(--hairline); padding-top: var(--s-8); }

.px-muted { color: var(--text-2); }
.px-mono { font-family: var(--font-mono); font-variant-ligatures: none; }
.px-num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- buttons -- */
.px-btn {
  --btn-bg: var(--accent);
  --btn-bg-hover: var(--accent-hover);
  --btn-bg-press: var(--accent-press);
  --btn-fg: var(--on-accent);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--control-h); padding: 0 var(--s-5);
  border: 1px solid transparent; border-radius: var(--r-control);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.px-btn:hover { background: var(--btn-bg-hover); }
.px-btn:active { background: var(--btn-bg-press); }
.px-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.px-btn__icon { display: inline-flex; font-size: 15px; }
.px-btn--sm { height: 36px; padding: 0 var(--s-3); font-size: 13px; }
.px-btn--lg { height: 48px; padding: 0 var(--s-6); font-size: 15px; }
.px-btn--block { display: flex; width: 100%; }

.px-btn--secondary {
  --btn-bg: var(--surface-0); --btn-bg-hover: var(--surface-2); --btn-bg-press: var(--surface-3);
  --btn-fg: var(--text-1);
  border-color: var(--line-strong);
}
.px-btn--ghost {
  --btn-bg: transparent; --btn-bg-hover: var(--surface-2); --btn-bg-press: var(--surface-3);
  --btn-fg: var(--text-1);
}
.px-btn--danger {
  --btn-bg: var(--danger); --btn-bg-hover: var(--danger-hover); --btn-bg-press: var(--danger-press);
  --btn-fg: #fff;
}
.px-btn--subtle {
  --btn-bg: var(--accent-soft); --btn-bg-hover: var(--accent-line); --btn-bg-press: var(--accent-line);
  --btn-fg: var(--accent-press);
}

/* Loading: spinner shown, label dimmed, width unchanged. */
.px-btn__spinner {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor; opacity: 0; display: none;
  animation: px-spin 0.7s linear infinite;
}
.px-btn.is-loading .px-btn__spinner { display: block; opacity: 1; }
.px-btn.is-loading .px-btn__label,
.px-btn.is-loading .px-btn__icon { opacity: 0; }
@keyframes px-spin { to { transform: rotate(360deg); } }

.px-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h); height: var(--control-h);
  border: 1px solid transparent; border-radius: var(--r-control);
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 16px;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}
.px-iconbtn:hover { background: var(--surface-2); color: var(--text-0); }
.px-iconbtn:active { background: var(--surface-3); }
.px-iconbtn--bordered { border-color: var(--line-strong); background: var(--surface-0); }

/* ----------------------------------------------------------- hold button -- */
.px-holdbtn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--control-h); padding: 0 var(--s-5);
  border: 1px solid transparent; border-radius: var(--r-control);
  background: var(--danger); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--ease);
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.px-holdbtn:hover { background: var(--danger-hover); }
/* Only the background fills, left→right, in a darker red. Size & content stay. */
.px-holdbtn__fill {
  position: absolute; inset: 0; width: 0;
  background: var(--danger-fill); z-index: 0;
}
.px-holdbtn.is-holding .px-holdbtn__fill { width: 100%; }
.px-holdbtn__content { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: var(--s-2); }

/* ---------------------------------------------------------------- fields -- */
.px-field { display: block; }
.px-field__label {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-1);
  margin-bottom: var(--s-2);
}
.px-field__req { color: var(--accent); margin-left: 2px; }
.px-field__control { position: relative; display: block; }

.px-input {
  width: 100%; height: var(--control-h);
  padding: 0 var(--s-4); border: 1px solid var(--line-strong);
  border-radius: var(--r-control); background: var(--surface-0);
  color: var(--text-0); font-size: 14px;
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}
.px-input::placeholder { color: var(--text-3); }
.px-input:hover { border-color: var(--text-3); }
.px-input:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: var(--focus-ring); }
.px-input--icon { padding-left: 44px; }
.px-input--trailing { padding-right: 44px; }
.px-input--area { height: auto; min-height: 96px; padding: var(--s-3) var(--s-4); resize: vertical; line-height: 1.5; }
.px-input.is-invalid { border-color: var(--danger); }
.px-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(197,48,48,0.28); }

/* Icons in fields: absolutely positioned, exactly centred, 14px from the edge,
   16px, muted, never move on focus/typing/error. */
.px-field__icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 16px; color: var(--text-3); pointer-events: none; line-height: 1;
}
.px-field__icon--lead { left: 14px; }
.px-field__icon--trail { right: 14px; }

/* Reserved message slot so an error never shifts a neighbouring field. */
.px-field__message { min-height: 18px; margin-top: var(--s-1); padding: 0 2px; }
.px-field__help { font-size: 12px; color: var(--text-2); }
.px-field__error { font-size: 12px; color: var(--danger); }

.px-search { max-width: 360px; }

/* --------------------------------------------------------------- select --- */
.px-select { position: relative; }
.px-select__button {
  width: 100%; height: var(--control-h);
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-4); border: 1px solid var(--line-strong);
  border-radius: var(--r-control); background: var(--surface-0);
  color: var(--text-0); font-size: 14px; text-align: left; cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.px-select__button:hover { border-color: var(--text-3); }
.px-select__button[aria-expanded="true"] { border-color: var(--accent); box-shadow: var(--focus-ring); }
.px-select__icon { color: var(--text-2); display: inline-flex; }
.px-select__value { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-select__value--placeholder { color: var(--text-3); }
.px-select__chevron { color: var(--text-3); flex: 0 0 auto; transition: color var(--ease); }

.px-select__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 100%; margin: 0; padding: var(--s-1); list-style: none;
  background: color-mix(in srgb, var(--surface-0) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--r-control);
  box-shadow: var(--shadow-3); max-height: 320px; overflow-y: auto;
}
.px-option {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-2); height: 40px; border-radius: 6px;
  color: var(--text-1); cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}
.px-option:hover, .px-option.is-active { background: var(--surface-2); color: var(--text-0); }
.px-option__icon { width: 20px; text-align: center; color: var(--text-2); }
.px-option__label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-option__check { color: var(--accent); opacity: 0; }
.px-option.is-selected .px-option__check { opacity: 1; }

/* --------------------------------------------------------- check / radio -- */
.px-check, .px-radio {
  display: inline-flex; align-items: flex-start; gap: var(--s-3);
  cursor: pointer; padding: var(--s-1) 0; min-height: 28px;
}
.px-check__box {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface-0); color: transparent; font-size: 11px;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.px-check__native:checked + .px-check__box {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.px-check__native:focus-visible + .px-check__box { box-shadow: var(--focus-ring); }
.px-check:hover .px-check__box { border-color: var(--text-3); }
.px-check__text { display: flex; flex-direction: column; }
.px-check__label { color: var(--text-1); font-size: 14px; }
.px-check__help, .px-radio__help { color: var(--text-3); font-size: 12px; }

.px-radiogroup { display: flex; flex-direction: column; gap: var(--s-4); }
.px-radio__dot {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface-0); position: relative;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.px-radio__dot::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  opacity: 0; transition: opacity var(--ease);
}
.px-radio__native:checked + .px-radio__dot { border-color: var(--accent); }
.px-radio__native:checked + .px-radio__dot::after { opacity: 1; }
.px-radio__native:focus-visible + .px-radio__dot { box-shadow: var(--focus-ring); }
.px-radio:hover .px-radio__dot { border-color: var(--text-3); }
.px-radio__text { display: flex; flex-direction: column; }
.px-radio__label { color: var(--text-1); font-size: 14px; }

/* --------------------------------------------------------------- switch --- */
.px-switch { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.px-switch__track {
  position: relative; width: 44px; height: 26px; flex: 0 0 auto;
  background: var(--surface-3); border-radius: var(--r-pill);
  transition: background-color var(--ease), box-shadow var(--ease);
}
.px-switch__thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-1);
  transition: left var(--ease);
}
.px-switch__native:checked + .px-switch__track { background: var(--accent); }
.px-switch__native:checked + .px-switch__track .px-switch__thumb { left: 21px; }
.px-switch__native:focus-visible + .px-switch__track { box-shadow: var(--focus-ring); }
.px-switch__label { color: var(--text-1); font-size: 14px; }

/* ----------------------------------------------------------- segmented ---- */
.px-segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-sunken); border-radius: var(--r-control);
}
.px-segmented__seg {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 36px; padding: 0 var(--s-4); border: 0; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: 6px;
  transition: background-color var(--ease), color var(--ease);
}
.px-segmented__seg:hover { color: var(--text-0); }
.px-segmented__seg.is-active { background: var(--surface-0); color: var(--text-0); box-shadow: var(--shadow-1); }

/* --------------------------------------------------------- date picker ---- */
.px-datefield { position: relative; }
.px-datefield__button { display: flex; align-items: center; text-align: left; cursor: pointer; }
.px-datefield__text { flex: 1 1 auto; }
.px-datefield__text.is-placeholder { color: var(--text-3); }

.px-calendar {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 300px; padding: var(--s-3);
  background: color-mix(in srgb, var(--surface-0) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--r-surface);
  box-shadow: var(--shadow-3);
}
.px-calendar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-2); }
.px-calendar__title { font-weight: 600; color: var(--text-0); font-size: 14px; }
.px-calendar__nav {
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-2);
  border-radius: 6px; cursor: pointer; transition: background-color var(--ease), color var(--ease);
}
.px-calendar__nav:hover { background: var(--surface-2); color: var(--text-0); }
.px-calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.px-calendar__dow { text-align: center; font-size: 11px; color: var(--text-3); padding: var(--s-1) 0; }
.px-calendar__day {
  aspect-ratio: 1; border: 0; background: transparent; color: var(--text-1);
  border-radius: 6px; cursor: pointer; font-size: 13px;
  transition: background-color var(--ease), color var(--ease);
}
.px-calendar__day:hover { background: var(--surface-2); }
.px-calendar__day.is-outside { color: var(--text-3); }
.px-calendar__day.is-today { color: var(--accent-press); font-weight: 600; }
.px-calendar__day.is-selected { background: var(--accent); color: #fff; }
.px-calendar__day.is-selected:hover { background: var(--accent-hover); }

/* --------------------------------------------------------- icon picker ---- */
.px-iconpicker { border: 1px solid var(--line); border-radius: var(--r-surface); padding: var(--s-3); background: var(--surface-0); }
.px-iconpicker__head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.px-iconpicker__preview {
  width: var(--control-h); height: var(--control-h); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-press);
  border-radius: var(--r-control); font-size: 18px;
}
.px-iconpicker__manual { flex: 1 1 auto; }
.px-iconpicker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: var(--s-1); }
.px-iconpicker__cell {
  aspect-ratio: 1; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: var(--surface-1); color: var(--text-2);
  border-radius: var(--r-control); cursor: pointer; font-size: 16px;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}
.px-iconpicker__cell:hover { background: var(--surface-2); color: var(--text-0); }
.px-iconpicker__cell.is-active { background: var(--accent-soft); color: var(--accent-press); border-color: var(--accent-line); }

/* -------------------------------------------------------- badges / pills -- */
.px-badge, .px-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.px-badge { padding: 5px 12px; border-radius: var(--r-control); }
.px-pill { padding: 5px 14px; border-radius: var(--r-pill); }
.px-badge__icon, .px-pill__icon { font-size: 10px; }
.px-badge--neutral, .px-pill--neutral { background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }
.px-badge--active, .px-pill--active { background: var(--tone-active-bg); color: var(--tone-active-fg); }
.px-badge--success, .px-pill--success { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.px-badge--waiting, .px-pill--waiting { background: var(--tone-waiting-bg); color: var(--tone-waiting-fg); }
.px-badge--critical, .px-pill--critical { background: var(--tone-critical-bg); color: var(--tone-critical-fg); }

/* --------------------------------------------------------------- tables --- */
.px-tablewrap { width: 100%; overflow-x: auto; }
.px-table { width: 100%; border-collapse: collapse; }
.px-th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3);
  padding: 0 var(--s-3) var(--s-2); white-space: nowrap;
}
.px-td {
  padding: 0 var(--s-3); height: var(--row-h); color: var(--text-1); font-size: 14px;
  border: 0; vertical-align: middle;
}
.px-cell--right { text-align: right; font-variant-numeric: tabular-nums; }
.px-cell--center { text-align: center; }
.px-tr { border-radius: var(--r-control); transition: background-color var(--ease); }
.px-tr:hover { background: var(--surface-2); }
.px-tr--link { cursor: pointer; }
/* Rounded row hover without border spill */
.px-tr td:first-child { border-top-left-radius: var(--r-control); border-bottom-left-radius: var(--r-control); }
.px-tr td:last-child { border-top-right-radius: var(--r-control); border-bottom-right-radius: var(--r-control); }

/* Optional grid variant — never the default. */
.px-table--grid .px-td { border-bottom: 1px solid var(--hairline); }
.px-table--grid .px-th { border-bottom: 1px solid var(--line); }

/* ------------------------------------------------------------ pagination -- */
.px-pagination { display: inline-flex; align-items: center; gap: var(--s-1); margin-top: var(--s-5); }
.px-page {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 var(--s-2); border-radius: var(--r-control);
  color: var(--text-1); font-size: 14px; font-variant-numeric: tabular-nums;
  transition: background-color var(--ease), color var(--ease);
}
.px-page:hover { background: var(--surface-2); color: var(--text-0); }
.px-page.is-active { background: var(--accent-soft); color: var(--accent-press); font-weight: 600; }
.px-page.is-disabled { color: var(--text-3); }
.px-page--gap { color: var(--text-3); }

/* ---------------------------------------------------------- empty state --- */
.px-empty {
  position: relative; text-align: center;
  padding: 72px var(--s-6); overflow: hidden;
}
.px-empty__glow {
  position: absolute; top: 20%; left: 50%; width: 320px; height: 200px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, var(--accent-glow), transparent 70%);
  filter: blur(60px); opacity: 0.5; pointer-events: none;
}
.px-empty__icon { position: relative; font-size: 56px; color: var(--accent); margin-bottom: var(--s-4); }
.px-empty__title { position: relative; font-size: 18px; font-weight: 600; color: var(--text-0); margin-bottom: var(--s-2); }
.px-empty__text { position: relative; color: var(--text-2); max-width: 420px; margin: 0 auto var(--s-5); }
.px-empty__action { position: relative; display: inline-flex; gap: var(--s-2); }

/* -------------------------------------------------------------- skeleton -- */
.px-skeleton { display: flex; flex-direction: column; gap: var(--s-3); }
.px-skeleton__line, .px-skeleton__cell {
  height: 14px; border-radius: 6px; background: var(--surface-2);
  animation: px-pulse 1.4s ease-in-out infinite;
}
.px-skeleton__line:nth-child(2) { width: 82%; }
.px-skeleton__line:nth-child(3) { width: 64%; }
.px-skeleton--table { gap: var(--s-2); }
.px-skeleton__row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-4); align-items: center; height: var(--row-h); }
.px-skeleton__cell { height: 16px; }
@keyframes px-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* --------------------------------------------------------------- toaster -- */
.px-toaster {
  position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 90;
  display: flex; flex-direction: column; gap: var(--s-2);
  width: min(380px, calc(100vw - 32px));
}
.px-toast {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-control);
  background: color-mix(in srgb, var(--surface-0) 94%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line); box-shadow: var(--shadow-3);
  opacity: 0; transition: opacity var(--ease);
}
.px-toast.is-in { opacity: 1; }
.px-toast__icon { font-size: 16px; margin-top: 1px; }
.px-toast--success .px-toast__icon { color: var(--tone-success-fg); }
.px-toast--error .px-toast__icon { color: var(--danger); }
.px-toast--info .px-toast__icon { color: var(--accent); }
.px-toast__body { flex: 1 1 auto; min-width: 0; }
.px-toast__text { color: var(--text-1); font-size: 14px; }
.px-toast__copy {
  flex: 0 0 auto; width: 30px; height: 30px; border: 0; background: transparent;
  color: var(--text-3); border-radius: 6px; cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}
.px-toast__copy:hover { background: var(--surface-2); color: var(--text-1); }
.px-toast__copy .px-toast__done { display: none; color: var(--tone-success-fg); }
.px-toast__copy.is-done .px-toast__idle { display: none; }
.px-toast__copy.is-done .px-toast__done { display: inline; }
.px-toast__bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--accent); transform-origin: left; transform: scaleX(1);
}
.px-toast.is-running .px-toast__bar { animation: px-toastbar linear forwards; }
.px-toast.is-paused .px-toast__bar { animation-play-state: paused; }
@keyframes px-toastbar { to { transform: scaleX(0); } }

/* -------------------------------------------------------------- tooltip --- */
.px-tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: #14171d; color: #f5f6f8; font-size: 12px; line-height: 1.4;
  padding: 6px 10px; border-radius: var(--r-control);
  box-shadow: var(--shadow-2); max-width: 280px;
  opacity: 0; transition: opacity 0.12s ease;
}
.px-tooltip.is-visible { opacity: 1; }

/* --------------------------------------------------------------- overlay -- */
.px-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--s-8) var(--s-4); overflow-y: auto;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  opacity: 0; transition: opacity var(--ease);
}
.px-overlay.is-open { opacity: 1; }
.px-overlay::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 50% at 50% 40%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  filter: blur(80px); pointer-events: none;
}
.px-dialog {
  position: relative; z-index: 1; width: 1100px; max-width: 92vw;
  margin: auto 0; padding: var(--s-8);
  background: color-mix(in srgb, var(--surface-0) 92%, transparent);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--r-surface);
  box-shadow: var(--shadow-3);
}
.px-dialog--confirm { width: 520px; }
.px-dialog__close {
  position: absolute; top: var(--s-4); right: var(--s-4);
  width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-3);
  border-radius: var(--r-control); cursor: pointer; font-size: 16px;
  transition: background-color var(--ease), color var(--ease);
}
.px-dialog__close:hover { background: var(--surface-2); color: var(--text-1); }
.px-dialog__title { font-size: 20px; font-weight: 600; color: var(--text-0); margin-bottom: var(--s-5); padding-right: var(--s-8); }
.px-dialog__body { color: var(--text-1); }
.px-dialog__actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-8); }

/* ---------------------------------------------------------------- forms --- */
.px-form { display: flex; flex-direction: column; gap: var(--s-5); }
.px-formrow { display: grid; gap: var(--s-4); align-items: start; }
.px-formrow--2 { grid-template-columns: 1fr 1fr; }
.px-formrow--3 { grid-template-columns: 1fr 1fr 1fr; }
.px-formrow--2-1 { grid-template-columns: 2fr 1fr; }
.px-fieldset { display: flex; flex-direction: column; gap: var(--s-5); }
.px-formactions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-3); }
.px-inline { display: inline-flex; align-items: center; gap: var(--s-2); }

/* Card — only for a single, delimitable object (a metric, a selectable entry). */
.px-card {
  background: var(--surface-0); border: 1px solid var(--line);
  border-radius: var(--r-surface); padding: var(--s-5);
}
/* auto-fill (not auto-fit): a lone card keeps its track width instead of
   stretching across the whole row. */
.px-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); }
.px-metric__label { font-size: 13px; color: var(--text-2); }
.px-metric__value { font-size: 28px; font-weight: 600; color: var(--text-0); font-variant-numeric: tabular-nums; margin-top: var(--s-1); }

/* ------------------------------------------------------------- bare pages - */
.px-bare {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--s-6); background:
    radial-gradient(60% 60% at 50% 0%, var(--accent-soft), transparent 60%),
    var(--surface-1);
}
.px-bare__wrap { width: 100%; max-width: 440px; }
.px-authcard {
  background: color-mix(in srgb, var(--surface-0) 94%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--r-surface);
  box-shadow: var(--shadow-2); padding: var(--s-8);
}
.px-authcard--wide { max-width: 560px; }
.px-auth__brand { display: inline-flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-6); }
.px-auth__title { font-size: 22px; font-weight: 600; color: var(--text-0); }
.px-auth__sub { color: var(--text-2); margin-top: var(--s-1); margin-bottom: var(--s-6); }

/* --------------------------------------------------------------- setup ---- */
.px-steps { display: flex; gap: var(--s-2); margin-bottom: var(--s-6); }
.px-step { flex: 1 1 0; display: flex; flex-direction: column; gap: var(--s-2); }
.px-step__bar { height: 4px; border-radius: 999px; background: var(--surface-3); transition: background-color var(--ease); }
.px-step.is-done .px-step__bar, .px-step.is-current .px-step__bar { background: var(--accent); }
.px-step__label { font-size: 11px; color: var(--text-3); font-family: var(--font-cond); text-transform: uppercase; letter-spacing: 0.06em; }
.px-step.is-current .px-step__label { color: var(--accent-press); }

.px-envblock {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--r-control); padding: var(--s-4); white-space: pre-wrap;
  word-break: break-all; color: var(--text-1);
}

/* ------------------------------------------------------------- utilities -- */
.px-stack { display: flex; flex-direction: column; gap: var(--s-4); }
.px-row { display: flex; align-items: center; gap: var(--s-3); }
.px-row--wrap { flex-wrap: wrap; }
.px-spacer { flex: 1 1 auto; }
.px-hint {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4); border-radius: var(--r-control);
  background: var(--accent-soft); color: var(--text-1);
  max-width: 720px;
}
.px-hint__icon { color: var(--accent); font-size: 16px; margin-top: 2px; }
.px-divider { height: 1px; background: var(--hairline); border: 0; margin: var(--s-6) 0; }

.px-datalist { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-6); }
.px-datalist dt { color: var(--text-2); font-size: 13px; }
.px-datalist dd { margin: 0; color: var(--text-0); font-size: 14px; }

.px-freshness { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--text-3); font-size: 12px; }
.px-freshness__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tone-success-fg); }
.px-freshness__dot--stale { background: var(--tone-waiting-fg); }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 900px) {
  .px-sidebar {
    position: fixed; top: 0; left: 0; z-index: 70; height: 100vh;
    width: 100vw; padding: var(--s-4);
    transform: translateX(-100%); transition: transform var(--ease);
  }
  .px-sidebar::before { inset: var(--s-4); }
  .px-app[data-sidebar="open"] .px-sidebar { transform: translateX(0); }
  .px-app[data-sidebar="collapsed"] .px-sidebar { width: 100vw; }
  .px-hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; top: var(--s-4); right: var(--s-4); z-index: 75;
    width: var(--control-h); height: var(--control-h);
    border: 1px solid var(--line); border-radius: var(--r-control);
    background: color-mix(in srgb, var(--surface-0) 90%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    color: var(--text-1); cursor: pointer; font-size: 18px;
  }
  .px-hamburger__close { display: none; }
  .px-app[data-sidebar="open"] .px-hamburger__open { display: none; }
  .px-app[data-sidebar="open"] .px-hamburger__close { display: inline; }
  .px-app[data-sidebar="open"] .px-scrim {
    display: block; position: fixed; inset: 0; z-index: 65; background: transparent;
  }
  /* Leave room for the fixed hamburger (top-right). */
  .px-content { padding: 72px var(--s-5) var(--s-10); }
  .px-topbar { padding: 0; }
  .px-formrow--2, .px-formrow--3, .px-formrow--2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .px-overlay { padding: 0; }
  .px-dialog, .px-dialog--confirm { width: 100vw; max-width: 100vw; min-height: 100vh; border-radius: 0; margin: 0; }
  .px-toaster { right: var(--s-3); left: var(--s-3); bottom: var(--s-3); width: auto; }
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
