/* Leo Admin — the portal's design system.
   Values come from leo-spec design/tokens/tokens.json (v0.4.0); derived
   shades (accessible button fills, tinted pill backgrounds) are noted where
   they differ. No web fonts: Inter if installed, else the system UI font.
   No inline styles anywhere (CSP style-src 'self'). */

/* ------------------------------------------------------------------ tokens */

:root {
  /* brand (tokens: color.brand) */
  --brand: #ff6b35;
  --brand-pressed: #e85a26;
  --brand-disabled: #ffb89c;
  --brand-secondary: #1f3a5f;
  --brand-accent: #3dcfe0;

  /* semantic (tokens: color.semantic) */
  --success: #2dbe60;
  --warning: #f4a623;
  --danger: #e5453f;
  --info: #3dcfe0;

  /* spacing (tokens: spacing) */
  --sp-xxs: 2px;
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;
  --sp-xxxl: 48px;
  --sp-xxxxl: 64px;

  /* radius (tokens: radius) */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* type (tokens: typography) */
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --fs-display-sm: 24px;
  --lh-display-sm: 28px;
  --fs-title-lg: 20px;
  --lh-title-lg: 24px;
  --fs-title-md: 17px;
  --lh-title-md: 22px;
  --fs-title-sm: 15px;
  --lh-title-sm: 20px;
  --fs-body: 15px;
  --lh-body: 22px;
  --fs-body-sm: 13px;
  --lh-body-sm: 18px;
  --fs-caption: 12px;
  --lh-caption: 16px;
  --fs-table: 14px;
  --fs-metric: 32px;
  --fs-metric-md: 20px;

  /* motion (tokens: motion) */
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0, 0, 0, 1);

  /* layers (tokens: z_index) */
  --z-sticky: 100;
  --z-overlay: 1000;
  --z-modal: 2000;
  --z-toast: 3000;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --content-max: 1200px;
  --target: 44px;

  color-scheme: light;
  /* surfaces (tokens: color.surface / color.text, light) */
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f3f4f7;
  --surface-hover: #f5f6f8;
  --border: #e5e7eb;
  --border-strong: #d3d7de;
  --divider: #f0f1f4;
  --text: #0e1116;
  --text-2: #5a6273;
  --text-3: #667080; /* tokens: #8A92A1 (3.1:1); darkened to ≥ 4.5:1 on every light surface */
  --text-inverse: #ffffff;

  /* actions: brand orange, darkened so white text reaches 4.5:1 */
  --primary: #c4461a;
  --primary-hover: #a93b14;
  --primary-fg: #ffffff;
  --accent-text: #b23f12;
  --accent-soft: #fff1eb;
  --focus: #c4461a;
  --field-focus: #1f3a5f;
  --field-ring: rgba(31, 58, 95, 0.16);
  --danger-fill: #c8302a;
  --danger-fill-hover: #a82621;
  --danger-text: #b42520;
  --danger-soft: #fdeceb;
  --danger-border: #f5c2bf;

  /* status tones (tinted from color.semantic / color.event, light) */
  --live-fg: #17723a;
  --live-bg: #e7f6ed;
  --live-bd: #bfe6cd;
  --test-fg: #1a5fd0;
  --test-bg: #eaf1fc;
  --test-bd: #c5d8f6;
  --halted-fg: #8a5c00;
  --halted-bg: #fff4d6;
  --halted-bd: #f3d98f;
  --muted-fg: #57606a;
  --muted-bg: #f0f1f4;
  --muted-bd: #dfe2e7;
  --info-fg: #0b6c7a;
  --info-bg: #e7f8fa;
  --info-bd: #b9e9ef;

  --role-owner-fg: #b23f12;
  --role-owner-bg: #fff1eb;
  --role-admin-fg: #6a32c9;
  --role-admin-bg: #f3edfd;
  --role-fw-fg: #0e6f7a;
  --role-fw-bg: #e6f6f7;
  --role-viewer-fg: #4b5563;
  --role-viewer-bg: #f0f1f4;
  --role-ci-fg: #1f3a5f;
  --role-ci-bg: #e9eef5;

  /* elevation (tokens: elevation) */
  --shadow-card: 0 1px 3px rgba(14, 17, 22, 0.06), 0 1px 2px rgba(14, 17, 22, 0.04);
  --shadow-popup: 0 8px 24px rgba(14, 17, 22, 0.16), 0 4px 8px rgba(14, 17, 22, 0.08);
  --shadow-modal: 0 20px 64px rgba(14, 17, 22, 0.24), 0 8px 24px rgba(14, 17, 22, 0.12);
  --scrim: rgba(14, 17, 22, 0.45);
  --skeleton-a: #eceef2;
  --skeleton-b: #f6f7f9;
}

/* dark (tokens: color.surface / color.text, dark) — the system's choice unless
   the toggle chose light; and the toggle's dark choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #1a1f26;
    --surface-raised: #222831;
    --surface-sunken: #141920;
    --surface-hover: #212730;
    --border: #2d3340;
    --border-strong: #3b4250;
    --divider: #1f252e;
    --text: #f1f3f5;
    --text-2: #a8b0bd;
    --text-3: #8b94a5; /* tokens: #6E778A; lightened to ≥ 4.5:1 on every dark surface */
    --text-inverse: #0e1116;
    --primary: #ff6b35;
    --primary-hover: #ff8a5c;
    --primary-fg: #0e1116;
    --accent-text: #ff8a5c;
    --accent-soft: rgba(255, 107, 53, 0.14);
    --focus: #ff8a5c;
    --field-focus: #9cb8de;
    --field-ring: rgba(156, 184, 222, 0.22);
    --danger-fill: #f0544e;
    --danger-fill-hover: #ff6b66;
    --danger-text: #ff7b75;
    --danger-soft: rgba(229, 69, 63, 0.14);
    --danger-border: rgba(229, 69, 63, 0.4);
    --live-fg: #5fd68a;
    --live-bg: rgba(45, 190, 96, 0.14);
    --live-bd: rgba(45, 190, 96, 0.35);
    --test-fg: #79a8f7;
    --test-bg: rgba(47, 129, 247, 0.15);
    --test-bd: rgba(47, 129, 247, 0.38);
    --halted-fg: #e3b341;
    --halted-bg: rgba(210, 153, 34, 0.15);
    --halted-bd: rgba(210, 153, 34, 0.4);
    --muted-fg: #a8b0bd;
    --muted-bg: rgba(139, 148, 158, 0.14);
    --muted-bd: rgba(139, 148, 158, 0.3);
    --info-fg: #6fdeeb;
    --info-bg: rgba(61, 207, 224, 0.12);
    --info-bd: rgba(61, 207, 224, 0.35);
    --role-owner-fg: #ff9a72;
    --role-owner-bg: rgba(255, 107, 53, 0.15);
    --role-admin-fg: #c3a0fb;
    --role-admin-bg: rgba(163, 113, 247, 0.16);
    --role-fw-fg: #4fd1dc;
    --role-fw-bg: rgba(20, 184, 196, 0.15);
    --role-viewer-fg: #b7bfcc;
    --role-viewer-bg: rgba(139, 148, 158, 0.16);
    --role-ci-fg: #9cb8de;
    --role-ci-bg: rgba(87, 132, 196, 0.18);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-popup: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4);
    --scrim: rgba(0, 0, 0, 0.6);
    --skeleton-a: #222831;
    --skeleton-b: #2a313c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #1a1f26;
  --surface-raised: #222831;
  --surface-sunken: #141920;
  --surface-hover: #212730;
  --border: #2d3340;
  --border-strong: #3b4250;
  --divider: #1f252e;
  --text: #f1f3f5;
  --text-2: #a8b0bd;
  --text-3: #8b94a5;
  --text-inverse: #0e1116;
  --primary: #ff6b35;
  --primary-hover: #ff8a5c;
  --primary-fg: #0e1116;
  --accent-text: #ff8a5c;
  --accent-soft: rgba(255, 107, 53, 0.14);
  --focus: #ff8a5c;
  --field-focus: #9cb8de;
  --field-ring: rgba(156, 184, 222, 0.22);
  --danger-fill: #f0544e;
  --danger-fill-hover: #ff6b66;
  --danger-text: #ff7b75;
  --danger-soft: rgba(229, 69, 63, 0.14);
  --danger-border: rgba(229, 69, 63, 0.4);
  --live-fg: #5fd68a;
  --live-bg: rgba(45, 190, 96, 0.14);
  --live-bd: rgba(45, 190, 96, 0.35);
  --test-fg: #79a8f7;
  --test-bg: rgba(47, 129, 247, 0.15);
  --test-bd: rgba(47, 129, 247, 0.38);
  --halted-fg: #e3b341;
  --halted-bg: rgba(210, 153, 34, 0.15);
  --halted-bd: rgba(210, 153, 34, 0.4);
  --muted-fg: #a8b0bd;
  --muted-bg: rgba(139, 148, 158, 0.14);
  --muted-bd: rgba(139, 148, 158, 0.3);
  --info-fg: #6fdeeb;
  --info-bg: rgba(61, 207, 224, 0.12);
  --info-bd: rgba(61, 207, 224, 0.35);
  --role-owner-fg: #ff9a72;
  --role-owner-bg: rgba(255, 107, 53, 0.15);
  --role-admin-fg: #c3a0fb;
  --role-admin-bg: rgba(163, 113, 247, 0.16);
  --role-fw-fg: #4fd1dc;
  --role-fw-bg: rgba(20, 184, 196, 0.15);
  --role-viewer-fg: #b7bfcc;
  --role-viewer-bg: rgba(139, 148, 158, 0.16);
  --role-ci-fg: #9cb8de;
  --role-ci-bg: rgba(87, 132, 196, 0.18);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-popup: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4);
  --scrim: rgba(0, 0, 0, 0.6);
  --skeleton-a: #222831;
  --skeleton-b: #2a313c;
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.has-overlay {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: var(--fs-display-sm);
  line-height: var(--lh-display-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--fs-title-md);
  line-height: var(--lh-title-md);
  font-weight: 600;
}

h3 {
  font-size: var(--fs-title-sm);
  line-height: var(--lh-title-sm);
  font-weight: 600;
}

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-lg);
  top: -100px;
  z-index: var(--z-toast);
  background: var(--surface);
  color: var(--text);
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popup);
}

.skip-link:focus {
  top: var(--sp-sm);
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
}

.nowrap {
  white-space: nowrap;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-xl);
}

.grid-main-side {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: var(--sp-xl);
  align-items: start;
}

@media (max-width: 1100px) {
  .grid-main-side,
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-lg) var(--sp-md);
  gap: var(--sp-lg);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-title-md);
  letter-spacing: -0.01em;
  min-height: var(--target);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-sub {
  font-weight: 500;
  color: var(--text-2);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-sm) var(--sp-md) var(--sp-xs);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  min-height: var(--target);
  padding: 0 var(--sp-md);
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  border-top: 1px solid var(--divider);
  padding-top: var(--sp-md);
}

.me-card {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm);
  border-radius: var(--r-md);
  min-width: 0;
}

.me-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.me-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-role {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  color: var(--text-2);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-actions .nav-link {
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 0 var(--sp-xxl);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  display: none;
}

.topbar .menu-btn {
  display: none;
}

.crumbs {
  flex: 1 1 auto;
  min-width: 0;
}

.crumbs ol {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  min-width: 0;
}

.crumbs li + li::before {
  content: "/";
  color: var(--text-3);
  padding: 0 var(--sp-xs);
}

.crumbs a {
  color: var(--text-2);
  text-decoration: none;
  padding: var(--sp-xs) 2px;
}

.crumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.crumbs [aria-current] {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid var(--halted-bd);
  background: var(--halted-bg);
  color: var(--halted-fg);
  flex: none;
}

.env-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.env-badge.env-prod {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.env-badge.env-local,
.env-badge.env-test {
  border-color: var(--muted-bd);
  background: var(--muted-bg);
  color: var(--muted-fg);
}

.content {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--sp-xxl));
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-xxl) var(--sp-xxxxl);
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  margin-bottom: var(--sp-xl);
}

.page-head h1:focus {
  outline: none;
}

.page-sub {
  margin-top: var(--sp-xs);
  color: var(--text-2);
}

.page-actions {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.drawer-scrim {
  display: none;
}

@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 86vw);
    z-index: var(--z-overlay);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }

  .app.nav-open .sidebar {
    transform: none;
    visibility: visible;
    box-shadow: var(--shadow-modal);
    transition: transform var(--dur) var(--ease);
  }

  .app.nav-open .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: calc(var(--z-overlay) - 1);
  }

  .topbar {
    padding: 0 var(--sp-lg) 0 var(--sp-sm);
  }

  .topbar .brand {
    display: flex;
    font-size: var(--fs-title-sm);
  }

  .topbar .menu-btn {
    display: inline-flex;
  }

  .topbar .crumbs {
    display: none;
  }

  .topbar-spacer {
    flex: 1;
  }

  .content {
    padding: var(--sp-lg) var(--sp-lg) var(--sp-xxxl);
  }

  .page-crumbs {
    display: block;
  }
}

@media (min-width: 900px) {
  .page-crumbs {
    display: none;
  }

  .topbar-spacer {
    display: none;
  }
}

.page-crumbs {
  margin-bottom: var(--sp-sm);
}

.page-crumbs:has(li:only-child),
.page-crumbs:empty {
  display: none !important;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: var(--target);
  padding: 0 var(--sp-lg);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.85;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 1px 2px rgba(14, 17, 22, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled:not([aria-busy="true"]),
.btn-primary[aria-disabled="true"],
.btn-danger:disabled:not([aria-busy="true"]) {
  background: var(--surface-sunken);
  color: var(--text-2);
  border-color: var(--border-strong);
  box-shadow: none;
  opacity: 1;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(14, 17, 22, 0.05);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger-fill);
  color: #fff;
}

:root[data-theme="dark"] .btn-danger {
  color: #0e1116;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-danger {
    color: #0e1116;
  }
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-fill-hover);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-link {
  background: none;
  border: 0;
  padding: 0 var(--sp-xs);
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--sp-md);
  font-size: 13px;
}

.btn-icon {
  padding: 0;
  width: var(--target);
}

.btn-icon.btn-sm {
  width: 36px;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 52px;
  font-size: var(--fs-body);
  padding: 0 var(--sp-xl);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ pills, chips, tags */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid;
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.pill .pill-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.pill-live,
.pill-active {
  color: var(--live-fg);
  background: var(--live-bg);
  border-color: var(--live-bd);
}

.pill-live .pill-icon {
  fill: currentColor;
  stroke: none;
  width: 12px;
  height: 12px;
}

.pill-test {
  color: var(--test-fg);
  background: var(--test-bg);
  border-color: var(--test-bd);
}

.pill-halted {
  color: var(--halted-fg);
  background: var(--halted-bg);
  border-color: var(--halted-bd);
}

.pill-withdrawn,
.pill-deactivated {
  color: var(--muted-fg);
  background: var(--muted-bg);
  border-color: var(--muted-bd);
}

.pill-lg {
  height: 30px;
  font-size: 13px;
  padding: 0 12px 0 10px;
}

.chip-role {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  font-size: var(--fs-caption);
  font-weight: 600;
  white-space: nowrap;
  color: var(--role-viewer-fg);
  background: var(--role-viewer-bg);
}

.role-owner {
  color: var(--role-owner-fg);
  background: var(--role-owner-bg);
}

.role-admin {
  color: var(--role-admin-fg);
  background: var(--role-admin-bg);
}

.role-firmware_manager {
  color: var(--role-fw-fg);
  background: var(--role-fw-bg);
}

.role-ci_publisher {
  color: var(--role-ci-fg);
  background: var(--role-ci-bg);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-caption);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.tag .icon {
  width: 13px;
  height: 13px;
}

.tag-prod {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.tag-info {
  color: var(--info-fg);
  background: var(--info-bg);
  border-color: var(--info-bd);
}

.tag-warning {
  color: var(--halted-fg);
  background: var(--halted-bg);
  border-color: var(--halted-bd);
}

.tag-success {
  color: var(--live-fg);
  background: var(--live-bg);
  border-color: var(--live-bd);
}

.tag-accent {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ------------------------------------------------------------------ cards & tiles */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-lg) var(--sp-xl) 0;
  flex-wrap: wrap;
}

.card-titles {
  min-width: 8em;
  flex: 1 1 0;
}

.card-title {
  font-size: var(--fs-title-sm);
  line-height: var(--lh-title-sm);
  font-weight: 600;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.card-desc {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  margin-top: -4px;
}

.card-actions {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.card-body {
  padding: var(--sp-lg) var(--sp-xl) var(--sp-xl);
}

.card-body > .table-wrap {
  margin: 0 calc(-1 * var(--sp-xl)) calc(-1 * var(--sp-xl));
  border: 0;
  border-top: 1px solid var(--divider);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.card-flush > .card-body {
  padding: 0;
}

.card-flush > .card-body > .table-wrap {
  margin: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.card-danger {
  border-color: var(--danger-border);
}

.card-danger .card-title {
  color: var(--danger-text);
}

.card-hero {
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-lg) var(--sp-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.stat-link {
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.stat-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-popup);
  text-decoration: none;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  font-weight: 500;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  color: var(--text-2);
}

.stat-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-live .stat-icon {
  background: var(--live-bg);
  color: var(--live-fg);
}

.stat-live .stat-icon .icon {
  fill: currentColor;
  stroke: none;
  width: 12px;
  height: 12px;
}

@media (max-width: 600px) {
  .stat-row {
    gap: var(--sp-sm);
  }

  .stat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px var(--sp-md);
    padding: var(--sp-md) var(--sp-lg);
  }

  .stat-value {
    justify-content: flex-end;
    font-size: var(--fs-title-md);
  }

  .stat-sub {
    grid-column: 1 / -1;
  }
}

.stat-test .stat-icon {
  background: var(--test-bg);
  color: var(--test-fg);
}

.stat-halted .stat-icon {
  background: var(--halted-bg);
  color: var(--halted-fg);
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: var(--sp-md);
  flex-wrap: wrap;
  font-size: var(--fs-metric-md);
  line-height: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  min-width: 0;
}

.stat-value-lg {
  font-size: var(--fs-metric);
  line-height: 36px;
}

.stat-sub {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  align-items: center;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.avatar-machine {
  background: var(--role-ci-bg);
  color: var(--role-ci-fg);
  border-radius: 10px;
}

.avatar-machine .icon {
  width: 60%;
  height: 60%;
}

.deflist {
  margin: 0;
  display: grid;
  gap: 0;
}

.deflist-row {
  display: grid;
  grid-template-columns: minmax(110px, 30%) minmax(0, 1fr);
  gap: var(--sp-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
  align-items: center;
}

.deflist-row:last-child {
  border-bottom: 0;
}

.deflist dt {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
}

.deflist dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.deflist dd code {
  font-size: 13px;
}

@media (max-width: 520px) {
  .deflist-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

.callout {
  display: flex;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  border: 1px solid var(--info-bd);
  background: var(--info-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
}

.callout-icon {
  color: var(--info-fg);
  padding-top: 1px;
}

.callout-icon .icon {
  width: 18px;
  height: 18px;
}

.callout-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.callout-actions {
  margin-top: var(--sp-sm);
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.callout-warning {
  border-color: var(--halted-bd);
  background: var(--halted-bg);
}

.callout-warning .callout-icon {
  color: var(--halted-fg);
}

.callout-danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.callout-danger .callout-icon {
  color: var(--danger-text);
}

.callout-success {
  border-color: var(--live-bd);
  background: var(--live-bg);
}

.callout-success .callout-icon {
  color: var(--live-fg);
}

.tabs {
  display: flex;
  gap: var(--sp-xs);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-xl);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  min-height: var(--target);
  padding: 0 var(--sp-md);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.tab-count {
  font-size: var(--fs-caption);
  color: var(--text-2);
  background: var(--surface-sunken);
  border-radius: var(--r-pill);
  padding: 0 7px;
  line-height: 18px;
}

/* ------------------------------------------------------------------ skeletons & empty */

.skeleton {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }

  .spinner {
    animation-duration: 1.2s !important;
  }
}

.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line {
  height: 14px;
}

.skeleton-line.is-short {
  width: 60%;
}

.skeleton-tile {
  height: 112px;
  border-radius: var(--r-lg);
}

.skeleton-table {
  display: flex;
  flex-direction: column;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: var(--sp-xl);
  padding: 18px var(--sp-lg);
  border-bottom: 1px solid var(--divider);
}

.skeleton-cell {
  height: 14px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-sm);
  padding: var(--sp-xxl) var(--sp-lg);
  color: var(--text-2);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-2);
  margin-bottom: var(--sp-xs);
}

.empty-title {
  color: var(--text);
  font-weight: 600;
}

.empty-body {
  max-width: 46ch;
  font-size: 14px;
}

.empty .btn {
  margin-top: var(--sp-sm);
}

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
}

.field-optional {
  font-weight: 400;
  color: var(--text-2);
}

.field-hint {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
}

.field-error,
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger-text);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: 500;
}

.field-error .icon,
.form-error .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.form-error {
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  font-size: 14px;
  line-height: 20px;
}

.input {
  width: 100%;
  min-height: var(--target);
  padding: 0 var(--sp-md);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input::placeholder {
  color: var(--text-3);
}

.input:hover {
  border-color: var(--text-3);
}

.input:focus {
  outline: none;
  border-color: var(--field-focus);
  box-shadow: 0 0 0 3px var(--field-ring);
}

.input:disabled {
  background: var(--surface-sunken);
  color: var(--text-2);
  cursor: not-allowed;
  opacity: 1;
}

.input:focus-visible {
  outline: none;
}

.input[readonly] {
  background: var(--surface-sunken);
}

.has-error .input {
  border-color: var(--danger-text);
}

.textarea {
  padding: 10px var(--sp-md);
  min-height: 96px;
  resize: vertical;
  line-height: 22px;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-lg);
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-section-title {
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  font-weight: 600;
  margin-top: var(--sp-sm);
}

.radio-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.radio-cards legend {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: var(--sp-sm);
  padding: 0;
}

.radio-card {
  display: flex;
  gap: var(--sp-md);
  align-items: flex-start;
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.radio-card:hover {
  border-color: var(--border-strong);
}

.radio-card:has(input:checked) {
  border-color: var(--focus);
  background: var(--accent-soft);
}

.radio-card:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.radio-card:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.6;
}

.radio-card input {
  margin: 3px 0 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex: none;
}

.radio-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.radio-card-title {
  font-weight: 600;
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  flex-wrap: wrap;
}

.radio-card-desc {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  gap: 2px;
}

.segmented button {
  min-height: 38px;
  padding: 0 var(--sp-lg);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.segmented button[aria-pressed="true"],
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

/* ------------------------------------------------------------------ filters */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
  margin-bottom: var(--sp-lg);
}

.toolbar .search {
  flex: 1 1 260px;
  max-width: 360px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  font-weight: 500;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.chip.is-on {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.chip .chip-check {
  width: 14px;
  height: 14px;
  stroke-width: 2.6;
  margin-left: -4px;
}

.chip-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  font-weight: 500;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  padding-left: 38px;
}

/* ------------------------------------------------------------------ tables */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The header sticks inside the table's own scroll box; long lists get a
   box no taller than the window, so the header stays in view. */
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (min-width: 900px) {
  .table-wrap.is-tall {
    max-height: calc(100vh - var(--topbar-h) - 40px);
  }
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-table);
  line-height: 20px;
}

.table th {
  text-align: left;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px var(--sp-lg);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table thead tr th:first-child {
  border-top-left-radius: var(--r-lg);
}

.table thead tr th:last-child {
  border-top-right-radius: var(--r-lg);
}

.card .table thead tr th {
  border-radius: 0;
}

.table td {
  padding: 12px var(--sp-lg);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .is-end {
  text-align: right;
}

.table tbody tr {
  transition: background var(--dur-fast) var(--ease);
}

.table tbody tr:not(.is-empty):hover {
  background: var(--surface-hover);
}

.table-clickable tbody tr:not(.is-empty) {
  cursor: pointer;
}

.table tr.is-dim td {
  color: var(--text-2);
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 6px 4px;
  margin: -6px -4px;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  border-radius: var(--r-sm);
}

.th-sort:hover,
.th-sort.is-active {
  color: var(--text);
}

.th-sort-icon {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}

.th-sort.is-active .th-sort-icon {
  opacity: 1;
}

.row-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-md);
  min-width: 0;
  max-width: 100%;
}

.row-link:hover {
  text-decoration: none;
}

.row-link:hover .cell-title {
  text-decoration: underline;
}

.cell-person {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  min-width: 0;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cell-title {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.stat-value .version {
  font-size: 22px;
  font-weight: 700;
}

.version-lg {
  font-size: 28px;
  line-height: 34px;
}

.factor-icons {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.factor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.factor .icon {
  width: 16px;
  height: 16px;
}

.factor-on {
  color: var(--live-fg);
}

.factor-none {
  color: var(--halted-fg);
}

.table-foot {
  display: flex;
  justify-content: center;
  padding: var(--sp-lg);
  border-top: 1px solid var(--divider);
  color: var(--text-2);
  font-size: var(--fs-body-sm);
}

.show-below-md {
  display: none;
}

@media (max-width: 899px) {
  .hide-below-md {
    display: none;
  }

  .show-below-md {
    display: block;
  }

  .table td,
  .table th {
    padding-left: var(--sp-md);
    padding-right: var(--sp-md);
  }
}

@media (max-width: 1100px) {
  .hide-below-lg {
    display: none;
  }
}

/* ------------------------------------------------------------------ hash & copy */

.hash {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
}

.hash-text {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn.is-copied {
  color: var(--live-fg);
}

.link-reveal {
  display: flex;
  gap: var(--sp-sm);
}

.link-box {
  flex: 1;
  min-width: 0;
  padding: var(--sp-md);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

.link-reveal .btn {
  align-self: flex-start;
}

@media (max-width: 520px) {
  .link-reveal {
    flex-direction: column;
  }
}

/* ------------------------------------------------------------------ overlays */

.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
}

.overlay-drawer {
  justify-content: flex-end;
  padding: 0;
}

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.overlay.is-open .overlay-scrim {
  opacity: 1;
}

.overlay.is-leaving .overlay-scrim {
  opacity: 0;
}

.modal,
.drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  outline: none;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.modal-sm {
  width: min(460px, 100%);
}

.modal-md {
  width: min(560px, 100%);
}

.modal-lg {
  width: min(760px, 100%);
}

.overlay.is-open .modal {
  opacity: 1;
  transform: none;
}

.overlay.is-leaving .modal {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.drawer {
  height: 100%;
  width: min(560px, 100vw);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
}

.drawer-lg {
  width: min(680px, 100vw);
}

.overlay.is-open .drawer {
  transform: none;
}

.overlay.is-leaving .drawer {
  transform: translateX(100%);
}

.modal-head,
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-xl) var(--sp-xl) var(--sp-md);
}

.drawer-head {
  border-bottom: 1px solid var(--divider);
  padding-bottom: var(--sp-lg);
}

.modal-head .btn-icon,
.drawer-head .btn-icon {
  margin: -8px -10px 0 0;
}

.modal-title,
.drawer-title {
  font-size: var(--fs-title-lg);
  line-height: var(--lh-title-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-desc,
.drawer-desc {
  margin-top: var(--sp-xs);
  color: var(--text-2);
  font-size: 14px;
}

.modal-body {
  padding: 0 var(--sp-xl) var(--sp-xl);
  overflow-y: auto;
}

.drawer-body {
  flex: 1;
  padding: var(--sp-xl);
  overflow-y: auto;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  padding: var(--sp-lg) var(--sp-xl);
  border-top: 1px solid var(--divider);
  background: var(--surface-raised);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-top: var(--sp-xs);
}

.consequence {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

@media (max-width: 520px) {
  .overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
  }
}

.stepup {
  align-items: stretch;
}

.stepup-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.stepup-badge .icon {
  width: 28px;
  height: 28px;
}

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  right: var(--sp-xl);
  bottom: var(--sp-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-sm) var(--sp-md) var(--sp-lg);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popup);
  font-size: 14px;
  line-height: 20px;
  animation: toast-in var(--dur) var(--ease-out);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.toast-icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: #ff7b75;
}

.toast-text {
  flex: 1;
  padding-top: 0;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.7;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.toast-close .icon {
  width: 16px;
  height: 16px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 520px) {
  .toasts {
    left: var(--sp-lg);
    right: var(--sp-lg);
    bottom: var(--sp-lg);
    max-width: none;
  }
}

/* ------------------------------------------------------------------ dashboard */

.hello {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.placeholder-panel {
  display: flex;
  align-items: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl);
}

.placeholder-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-text);
  flex: none;
}

.placeholder-art .icon {
  width: 32px;
  height: 32px;
}

@media (max-width: 520px) {
  .placeholder-panel {
    align-items: flex-start;
    gap: var(--sp-md);
    padding: var(--sp-lg);
  }

  .placeholder-art {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .placeholder-art .icon {
    width: 22px;
    height: 22px;
  }

  .placeholder-panel p {
    font-size: 14px;
    line-height: 20px;
  }
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-xl);
  align-items: start;
}

@media (max-width: 520px) {
  .tile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.model-block + .model-block {
  margin-top: var(--sp-lg);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--divider);
}

.model-name {
  font-weight: 600;
  margin-bottom: var(--sp-sm);
}

.kv-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 6px 0;
  flex-wrap: wrap;
}

.kv-line .k {
  color: var(--text-2);
  font-size: 14px;
}

.kv-line .v {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.kv-line a {
  text-decoration: none;
  color: var(--text);
}

.kv-line a:hover .version,
.kv-line a.version:hover {
  text-decoration: underline;
}

.big-number {
  font-size: var(--fs-metric);
  line-height: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.number-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}

.number-pair > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 14px;
  min-height: 36px;
  text-decoration: none;
}

.card-link .icon {
  width: 16px;
  height: 16px;
}

.card-link:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ activity & timeline */

.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.activity li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--sp-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.activity li:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-2);
}

.activity-icon .icon {
  width: 16px;
  height: 16px;
}

.activity-icon.area-firmware {
  background: var(--test-bg);
  color: var(--test-fg);
}

.activity-icon.area-account,
.activity-icon.area-me {
  background: var(--role-admin-bg);
  color: var(--role-admin-fg);
}

.activity-icon.area-auth {
  background: var(--live-bg);
  color: var(--live-fg);
}

.activity-text {
  font-size: 14px;
  line-height: 20px;
  min-width: 0;
}

.activity-text strong {
  font-weight: 600;
}

.activity-meta {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline li {
  position: relative;
  padding: 0 0 var(--sp-lg) 28px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: -2px;
  width: 2px;
  background: var(--divider);
}

.timeline li:last-child::before {
  display: none;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--text-3);
  box-shadow: 0 0 0 1px var(--border);
}

.timeline-dot.tone-live {
  background: var(--success);
}

.timeline-dot.tone-test {
  background: #2f81f7;
}

.timeline-dot.tone-halted {
  background: var(--warning);
}

.timeline-dot.tone-withdrawn {
  background: var(--text-2);
}

.timeline-title {
  font-weight: 600;
  font-size: 14px;
}

.timeline-meta {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
}

.timeline-note {
  margin-top: 4px;
  font-size: 14px;
  padding: 6px 10px;
  background: var(--surface-sunken);
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ firmware */

.model-switch {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.release-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  margin-bottom: var(--sp-xl);
}

.release-title {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.release-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-top: var(--sp-sm);
  color: var(--text-2);
  font-size: 14px;
}

.release-meta .dot-sep::before {
  content: "·";
  padding: 0 2px;
}

.notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 24px;
}

.notes-empty {
  color: var(--text-2);
  font-style: italic;
}

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  min-height: 72px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--focus);
  background: var(--accent-soft);
}

.dropzone:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  flex: none;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.dropzone-title {
  font-weight: 600;
  font-size: 14px;
}

.dropzone-sub {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--live-bd);
  background: var(--live-bg);
}

.dropzone.has-file .dropzone-icon {
  color: var(--live-fg);
}

.dropzone .hash {
  position: relative;
  z-index: 1;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

progress {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  overflow: hidden;
  color: var(--primary);
}

progress::-webkit-progress-bar {
  background: var(--surface-sunken);
  border-radius: var(--r-pill);
}

progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: var(--r-pill);
  transition: width var(--dur) var(--ease);
}

progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: var(--r-pill);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-2);
}

.checklist li {
  display: flex;
  gap: var(--sp-sm);
  align-items: flex-start;
}

.checklist .icon {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--live-fg);
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-md);
}

.outcome {
  padding: var(--sp-md);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
}

.outcome-n {
  font-size: var(--fs-metric-md);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.outcome-k {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

/* ------------------------------------------------------------------ admins */

.profile-head {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  margin-bottom: var(--sp-xl);
}

.profile-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 260px;
}

.profile-email {
  color: var(--text-2);
  overflow-wrap: anywhere;
  font-weight: 400;
  font-size: 15px;
  line-height: 22px;
}

.page-head h1 .cell-person {
  align-items: flex-start;
  gap: var(--sp-lg);
}

.page-head h1 .profile-tags {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: 400;
  letter-spacing: 0;
}

.profile-tags {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-top: var(--sp-xs);
}

.perm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.perm-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: var(--sp-sm);
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 20px;
}

.perm-item .icon {
  width: 16px;
  height: 16px;
}

.perm-item.is-on .icon {
  color: var(--live-fg);
}

.perm-item.is-off {
  color: var(--text-3);
}

.perm-item.is-added {
  background: var(--live-bg);
}

.perm-item.is-removed {
  background: var(--danger-soft);
  color: var(--text);
}

.perm-item.is-removed .icon {
  color: var(--danger-text);
}

.perm-change {
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.perm-item.is-added .perm-change {
  color: var(--live-fg);
}

.perm-item.is-removed .perm-change {
  color: var(--danger-text);
}

.matrix th,
.matrix td {
  text-align: center;
}

.matrix th:first-child,
.matrix td:first-child {
  text-align: left;
}

.matrix tbody th {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-table);
  line-height: 20px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border-bottom: 1px solid var(--divider);
  white-space: normal;
}

.matrix tbody tr:last-child th {
  border-bottom: 0;
}

.matrix .yes {
  color: var(--live-fg);
}

.matrix .no {
  color: var(--text-3);
}

.matrix .icon {
  width: 18px;
  height: 18px;
}

.matrix-perm {
  display: flex;
  flex-direction: column;
}

.matrix-perm code {
  font-size: 12px;
  color: var(--text-2);
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-list li {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.session-list li:last-child {
  border-bottom: 0;
}

.session-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  color: var(--text-2);
  flex: none;
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-lg);
  flex-wrap: wrap;
}

.danger-row + .danger-row {
  border-top: 1px solid var(--divider);
  padding-top: var(--sp-lg);
  margin-top: var(--sp-lg);
}

.danger-row p {
  color: var(--text-2);
  font-size: 14px;
  max-width: 60ch;
}

.self-note {
  margin-bottom: var(--sp-xl);
}

/* ------------------------------------------------------------------ audit */

.audit-row-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  cursor: pointer;
}

.audit-row-toggle:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.audit-row-toggle .icon {
  width: 16px;
  height: 16px;
  transition: transform var(--dur-fast) var(--ease);
}

.audit-row-toggle[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}

.audit-detail td {
  background: var(--surface-sunken);
  padding-top: var(--sp-md);
  padding-bottom: var(--sp-lg);
}

.json {
  margin: 0;
  padding: var(--sp-md) var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 19px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
}

.json .j-key {
  color: var(--accent-text);
}

.json .j-str {
  color: var(--live-fg);
}

.json .j-num {
  color: var(--test-fg);
}

.json .j-lit {
  color: var(--role-admin-fg);
}

.action-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

/* ------------------------------------------------------------------ my account */

.passkey-list,
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.passkey-list li {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.passkey-list li:last-child {
  border-bottom: 0;
}

.totp-setup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--sp-xl);
  align-items: start;
}

@media (max-width: 620px) {
  .totp-setup {
    grid-template-columns: minmax(0, 1fr);
  }
}

.qr-box {
  width: 196px;
  padding: 8px;
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  justify-self: center;
}

.qr {
  display: block;
  width: 100%;
  height: auto;
}

.setup-key {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.setup-key code {
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  font-size: 14px;
}

.strength {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.strength-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: 120px;
}

.strength-bar span {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.strength[data-level="1"] .strength-bar span:nth-child(-n + 1) {
  background: var(--danger);
}

.strength[data-level="2"] .strength-bar span:nth-child(-n + 2) {
  background: var(--warning);
}

.strength[data-level="3"] .strength-bar span:nth-child(-n + 3) {
  background: var(--success);
}

.strength[data-level="4"] .strength-bar span {
  background: var(--success);
}

/* ------------------------------------------------------------------ auth pages */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-xxxl);
  background: radial-gradient(1200px 600px at 20% 110%, rgba(255, 107, 53, 0.55), transparent 60%), radial-gradient(800px 500px at 110% -10%, rgba(61, 207, 224, 0.28), transparent 60%), linear-gradient(160deg, #1f3a5f, #0e1116 70%);
  color: #f1f3f5;
}

.auth-art .brand {
  color: #fff;
}

.auth-art .brand-sub {
  color: rgba(255, 255, 255, 0.7);
}

.auth-ridge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 46%;
  color: rgba(255, 255, 255, 0.07);
}

.auth-quote {
  position: relative;
  max-width: 34ch;
  font-size: var(--fs-title-lg);
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-quote p + p {
  margin-top: var(--sp-md);
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  padding: var(--sp-xl);
  background: var(--bg);
}

.auth-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sp-sm);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl) 0;
}

.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

.auth-card h1 {
  font-size: 28px;
  line-height: 34px;
}

.auth-lede {
  color: var(--text-2);
  margin-top: var(--sp-sm);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  color: var(--text-3);
  font-size: var(--fs-body-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-foot {
  color: var(--text-2);
  font-size: var(--fs-body-sm);
  text-align: center;
}

.auth .brand-mobile {
  display: none;
}

.code-input {
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: 0.5em;
  text-align: center;
  min-height: 60px;
  padding-left: 0.5em;
  font-variant-numeric: tabular-nums;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.stepper {
  display: flex;
  gap: var(--sp-sm);
  list-style: none;
  margin: 0;
  padding: 0;
}

.stepper li {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-caption);
  color: var(--text-3);
  font-weight: 600;
}

.stepper li::before {
  content: "";
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.stepper li.is-done,
.stepper li.is-current {
  color: var(--text);
}

.stepper li.is-done::before {
  background: var(--success);
}

.stepper li.is-current::before {
  background: var(--brand);
}

@media (max-width: 899px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-art {
    display: none;
  }

  .auth .brand-mobile {
    display: flex;
    margin-right: auto;
  }

  .auth-top {
    justify-content: space-between;
  }

  .auth-panel {
    padding: var(--sp-lg);
  }

  .auth-main {
    align-items: flex-start;
    padding-top: var(--sp-xxl);
  }
}

/* ------------------------------------------------------------------ boot / fatal */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-2);
}

.boot-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.noscript {
  padding: var(--sp-xl);
  text-align: center;
}

.table .col-toggle {
  width: 48px;
  padding-right: 0;
}

.table tr.is-expandable {
  cursor: pointer;
}
