/* =============================================================================================================
   qa-agent Enterprise - design system
   Tokens -> base -> app shell -> layout -> components -> charts -> content (markdown) -> views -> motion ->
   responsive -> reduced motion. Light is the default theme; dark comes from [data-theme=dark] or, when the user
   picked "system", from prefers-color-scheme. Class names and tokens are documented in qa_agent/ui/README.md.
   ============================================================================================================= */

/* ------------------------------------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  /* surfaces */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f0f3f7;
  --surface-sunken: #eceff4;
  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(244, 246, 249, .82);
  --border: #e2e7ee;
  --border-subtle: #edf0f4;
  --border-strong: #ccd4df;
  /* text (all >= 4.5:1 on --surface and --bg) */
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #5f6b7d;
  --text-inverse: #ffffff;
  /* brand */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-press: #1e40af;
  --accent: #2563eb;
  --accent-text: #1d4ed8;
  --accent-soft: #edf3ff;
  --accent-soft-2: #dce7fe;
  --brand-grad: linear-gradient(135deg, #2563eb 0%, #6d4fe0 100%);
  --danger: #c62f2f;
  --danger-hover: #a92424;
  /* status marks (charts, dots, bars): validated set, see README "Colour" */
  --st-passed: #0b6b4f;
  --st-failed: #ef6461;
  --st-error: #ef6461;
  --st-flaky: #8b5cf6;
  --st-warning: #d98a00;
  --st-skipped: #98a2b3;
  --st-running: #2a78d6;
  --st-critical: #c62f2f;
  --st-major: #e0703f;
  --st-minor: #d98a00;
  --st-info: #2a78d6;
  /* status badges: text on tint, >= 4.5:1 */
  --passed-bg: #e6f6f0; --passed-fg: #0a6448;
  --failed-bg: #fdecec; --failed-fg: #b02121;
  --flaky-bg: #f2edfe; --flaky-fg: #5b2fc0;
  --warning-bg: #fdf3e0; --warning-fg: #8a4a00;
  --skipped-bg: #eef1f5; --skipped-fg: #4b5768;
  --running-bg: #eaf2fe; --running-fg: #1d4fc4;
  --info-bg: #e6f4f7; --info-fg: #0b5d70;
  --neutral-bg: #eef1f5; --neutral-fg: #475569;
  --accent-bg: #edf3ff; --accent-fg: #1d4ed8;
  /* categorical chart slots (fixed order, validated) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --chart-grid: #e8ecf1;
  --chart-axis: #c4ccd8;
  --chart-track: #eceff4;
  --spark: #94a3b8;
  /* code */
  --code-bg: #f8fafc;
  --code-fg: #1e293b;
  --code-key: #1d4ed8;
  --code-str: #0a6448;
  --code-num: #b4460d;
  --code-kw: #7c3aed;
  /* tooltip */
  /* log console: always dark, AA on its own background in both themes */
  --console-bg: #0b0f17; --console-bar: #111723; --console-border: #1d2535; --console-fg: #d5dbe5; --console-muted: #8f9bb0;
  --console-title: #b4bdcc; --console-hover: #1c2433; --console-accent: #93bcff; --console-focus: #6ea0ff;
  --tooltip-bg: #0f172a;
  --tooltip-fg: #f1f5f9;
  /* skeleton */
  --sk-1: #eceff4;
  --sk-2: #f6f8fb;
  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Noto Sans Hebrew", "PingFang SC", "Hiragino Sans", "Yu Gothic", "Microsoft YaHei", "Noto Sans CJK JP", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Noto Sans Hebrew", "PingFang SC", "Hiragino Sans", "Yu Gothic", "Microsoft YaHei", "Noto Sans CJK JP", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK JP", "Noto Sans Mono", "Yu Gothic", "Microsoft YaHei", monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 22px; --fs-3xl: 28px;
  /* spacing (4px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  /* radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 9px; --r-lg: 14px; --r-xl: 18px; --r-full: 999px;
  /* elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 6px 16px -4px rgba(15, 23, 42, .10), 0 2px 4px -2px rgba(15, 23, 42, .06);
  --shadow-lg: 0 14px 34px -10px rgba(15, 23, 42, .20), 0 4px 10px -4px rgba(15, 23, 42, .08);
  --shadow-xl: 0 28px 70px -16px rgba(15, 23, 42, .35), 0 8px 20px -8px rgba(15, 23, 42, .12);
  --focus: #2563eb;                       /* the one focus outline colour (>= 3:1 on every surface) */
  --focus-ring: 0 0 0 2px var(--focus);   /* legacy: views that still draw a ring get a solid 2 px one */
  --focus-ring-danger: 0 0 0 2px var(--focus);
  --scrim: rgba(15, 23, 42, .45);
  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --dur-fast: 120ms; --dur: 200ms; --dur-slow: 320ms;
  /* layout */
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  --content-max: 1320px;
}

/* dark: explicit choice, or the system setting when the user picked "system" (no data-theme attribute) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d13; --surface: #11151e; --surface-2: #151a24; --surface-3: #1b212d; --surface-sunken: #0d1118;
  --sidebar-bg: #0d1118; --topbar-bg: rgba(10, 13, 19, .78);
  --border: #222a37; --border-subtle: #1a202b; --border-strong: #2e3747;
  --text: #e9edf4; --text-2: #b6c0cf; --text-3: #97a2b4; --text-inverse: #0b0f17;
  --primary: #2f6fed; --primary-hover: #3d7bf2; --primary-press: #255fd6;
  --accent: #5b93ff; --accent-text: #8db7ff; --accent-soft: rgba(76, 141, 255, .14); --accent-soft-2: rgba(76, 141, 255, .26);
  --brand-grad: linear-gradient(135deg, #3b74f0 0%, #7a5cf0 100%);
  --danger: #d23f3f; --danger-hover: #df5050;
  --st-passed: #5bd0a6; --st-failed: #d63c3c; --st-error: #d63c3c; --st-flaky: #a78bfa; --st-warning: #c98500; --st-skipped: #5d6678;
  --st-running: #3987e5; --st-critical: #d94848; --st-major: #d9713f; --st-minor: #c98500; --st-info: #3987e5;
  --passed-bg: rgba(18, 165, 130, .15); --passed-fg: #5fd4ae;
  --failed-bg: rgba(217, 72, 72, .17); --failed-fg: #ff9a9a;
  --flaky-bg: rgba(167, 139, 250, .16); --flaky-fg: #cbbcff;
  --warning-bg: rgba(201, 133, 0, .17); --warning-fg: #f4bd55;
  --skipped-bg: rgba(148, 163, 184, .13); --skipped-fg: #b0bac8;
  --running-bg: rgba(57, 135, 229, .17); --running-fg: #93bcff;
  --info-bg: rgba(56, 189, 214, .14); --info-fg: #86d9ea;
  --neutral-bg: rgba(148, 163, 184, .13); --neutral-fg: #b6c0cf;
  --accent-bg: rgba(76, 141, 255, .14); --accent-fg: #8db7ff;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --chart-grid: #1f2633; --chart-axis: #364154; --chart-track: #1d2430; --spark: #64748b;
  --code-bg: #0d1118; --code-fg: #d9e0ea; --code-key: #8db7ff; --code-str: #6fdcb4; --code-num: #f5a97a; --code-kw: #c4a7ff;
  --tooltip-bg: #263044; --tooltip-fg: #f1f5f9;
  --sk-1: #181e29; --sk-2: #212836;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .03);
  --shadow-xl: 0 30px 80px -16px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .04);
  --focus: #6ea0ff; --focus-ring: 0 0 0 2px var(--focus);
  --scrim: rgba(2, 4, 8, .62);
}
@media (prefers-color-scheme: dark) {
  /* generated copy of the block above (keep identical) */
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0a0d13; --surface: #11151e; --surface-2: #151a24; --surface-3: #1b212d; --surface-sunken: #0d1118;
    --sidebar-bg: #0d1118; --topbar-bg: rgba(10, 13, 19, .78);
    --border: #222a37; --border-subtle: #1a202b; --border-strong: #2e3747;
    --text: #e9edf4; --text-2: #b6c0cf; --text-3: #97a2b4; --text-inverse: #0b0f17;
    --primary: #2f6fed; --primary-hover: #3d7bf2; --primary-press: #255fd6;
    --accent: #5b93ff; --accent-text: #8db7ff; --accent-soft: rgba(76, 141, 255, .14); --accent-soft-2: rgba(76, 141, 255, .26);
    --brand-grad: linear-gradient(135deg, #3b74f0 0%, #7a5cf0 100%);
    --danger: #d23f3f; --danger-hover: #df5050;
    --st-passed: #5bd0a6; --st-failed: #d63c3c; --st-error: #d63c3c; --st-flaky: #a78bfa; --st-warning: #c98500; --st-skipped: #5d6678;
    --st-running: #3987e5; --st-critical: #d94848; --st-major: #d9713f; --st-minor: #c98500; --st-info: #3987e5;
    --passed-bg: rgba(18, 165, 130, .15); --passed-fg: #5fd4ae;
    --failed-bg: rgba(217, 72, 72, .17); --failed-fg: #ff9a9a;
    --flaky-bg: rgba(167, 139, 250, .16); --flaky-fg: #cbbcff;
    --warning-bg: rgba(201, 133, 0, .17); --warning-fg: #f4bd55;
    --skipped-bg: rgba(148, 163, 184, .13); --skipped-fg: #b0bac8;
    --running-bg: rgba(57, 135, 229, .17); --running-fg: #93bcff;
    --info-bg: rgba(56, 189, 214, .14); --info-fg: #86d9ea;
    --neutral-bg: rgba(148, 163, 184, .13); --neutral-fg: #b6c0cf;
    --accent-bg: rgba(76, 141, 255, .14); --accent-fg: #8db7ff;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --chart-grid: #1f2633; --chart-axis: #364154; --chart-track: #1d2430; --spark: #64748b;
    --code-bg: #0d1118; --code-fg: #d9e0ea; --code-key: #8db7ff; --code-str: #6fdcb4; --code-num: #f5a97a; --code-kw: #c4a7ff;
    --tooltip-bg: #263044; --tooltip-fg: #f1f5f9;
    --sk-1: #181e29; --sk-2: #212836;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
    --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .03);
    --shadow-xl: 0 30px 80px -16px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .04);
    --focus: #6ea0ff; --focus-ring: 0 0 0 2px var(--focus);
    --scrim: rgba(2, 4, 8, .62);
  }
}

/* ------------------------------------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
html.has-overlay { overflow: hidden; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); line-height: 1.25; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { vertical-align: middle; }
svg.icon { flex: none; }
hr { border: 0; height: 1px; background: var(--border); margin: var(--sp-6) 0; }
::selection { background: var(--accent-soft-2); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
/* ONE focus indicator everywhere: a 2 px outline (survives forced colours), >= 3:1 on both themes */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; cursor: pointer; }
:not(pre) > code {
  font-family: var(--font-mono); font-size: max(var(--fs-xs), .9em); padding: 1px var(--sp-2); border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border-subtle); color: var(--text); word-break: break-word;
}

/* ------------------------------------------------------------------------------------------------ app shell */
.skip-link {
  position: fixed; inset-inline-start: 12px; top: -60px; z-index: 400; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md);
  background: var(--primary); color: #fff; font-weight: 600; transition: top var(--dur);
}
.skip-link:focus { top: 12px; }
.route-progress {
  position: fixed; top: 0; inset-inline-start: 0; height: 2px; width: 0; z-index: 500; pointer-events: none;
  background: var(--brand-grad); box-shadow: 0 0 8px rgba(37, 99, 235, .5); opacity: 0;
}
.route-progress.is-loading { opacity: 1; animation: route-load 8s cubic-bezier(.1, .7, .2, 1) forwards; }
.route-progress.is-done { width: 100% !important; animation: none; opacity: 0; transition: width .2s ease-out, opacity .3s .15s; }
@keyframes route-load { from { width: 0; } to { width: 85%; } }

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--dur-slow) var(--ease-out); }
.is-collapsed .app { --sidebar-w: var(--sidebar-w-collapsed); }

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3) var(--sp-3); background: var(--sidebar-bg); border-inline-end: 1px solid var(--border); overflow: hidden auto; z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 44px; padding: 0; padding-inline: var(--sp-2) 2px; }
.brand { display: flex; align-items: center; gap: var(--sp-3); color: var(--text); min-width: 0; border-radius: var(--r-md); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: var(--brand-grad); box-shadow: 0 4px 12px -2px rgba(55, 80, 230, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; white-space: nowrap; transition: opacity var(--dur); }
.brand-text b { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.brand-text small { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-2); }
.nav-section {
  padding: var(--sp-4) var(--sp-3) var(--sp-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap; overflow: hidden; transition: opacity var(--dur);
}
.nav-link {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); height: 40px; padding: 0 var(--sp-3); border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: var(--fs-md); white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast);
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link .icon { color: var(--text-3); transition: color var(--dur-fast), transform var(--dur) var(--ease-spring); }
.nav-link:hover .icon { color: var(--text); transform: scale(1.06); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); }
.nav-link.is-active .icon { color: var(--accent-text); }
.nav-link.is-active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--accent);
}
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--dur); }
.nav-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); height: 20px; min-width: 20px; padding: 0 var(--sp-2); border-radius: var(--r-full);
  background: var(--running-bg); color: var(--running-fg); font-size: var(--fs-xs); font-weight: 700;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); }
.sidebar-card {
  padding: var(--sp-3); border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2);
}
.sidebar-card b { display: block; color: var(--text); font-size: var(--fs-sm); margin-bottom: 2px; }
.sidebar-hint { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2); color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.sidebar-collapse .icon { transition: transform var(--dur-slow) var(--ease-out); }
.is-collapsed .sidebar-collapse .icon { transform: scaleX(-1); }
.is-collapsed .brand-text, .is-collapsed .nav-label, .is-collapsed .nav-section, .is-collapsed .sidebar-card, .is-collapsed .sidebar-hint { opacity: 0; pointer-events: none; }
.is-collapsed .nav-section { height: 12px; padding: 0; }
.is-collapsed .nav-link { justify-content: center; padding: 0; gap: 0; }
.is-collapsed .nav-label { width: 0; flex: 0; }
.is-collapsed .nav-badge { position: absolute; top: 4px; inset-inline-end: 6px; height: 16px; min-width: 16px; padding: 0 var(--sp-1); font-size: var(--fs-xs); }
.is-collapsed .nav-badge .live-dot { display: none; }
.is-collapsed .sidebar-head { flex-direction: column; gap: var(--sp-2); padding: 0; }
.is-collapsed .brand-text { display: none; }

/* top bar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-6);
  background: var(--topbar-bg); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .topbar-toggle { display: none; }
.crumbs { flex: 1; min-width: 0; }
.crumbs ol { display: flex; align-items: center; gap: var(--sp-1); list-style: none; margin: 0; padding: 0; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; font-size: var(--fs-md); color: var(--text-3); }
.crumbs li:last-child { color: var(--text); font-weight: 600; }
.crumbs li span, .crumbs li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36ch; }
.crumbs a { color: var(--text-3); border-radius: var(--r-xs); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumb-sep { color: var(--border-strong); }
.search-trigger {
  display: flex; align-items: center; gap: var(--sp-2); width: 300px; height: 38px; padding: 0; padding-inline: var(--sp-3) var(--sp-2); border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; font-size: var(--fs-md);
  box-shadow: var(--shadow-xs); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger:focus-visible { border-color: var(--focus); }
.search-trigger .search-label { flex: 1; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 34px; padding: 0; padding-inline: var(--sp-2) var(--sp-3); border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  white-space: nowrap; max-width: 260px; transition: border-color var(--dur-fast), background var(--dur-fast);
}
.ai-pill:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ai-pill .ai-pill-text { overflow: hidden; text-overflow: ellipsis; }
.ai-pill .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-skipped); flex: none; }
.ai-pill.is-on .status-dot { background: var(--st-passed); box-shadow: 0 0 0 3px var(--passed-bg); }
.ai-pill.is-off .status-dot { background: var(--st-warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.ai-pill.is-error .status-dot { background: var(--st-failed); box-shadow: 0 0 0 3px var(--failed-bg); }
.ai-pill.is-loading .status-dot { animation: blink 1.2s ease-in-out infinite; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-1); }

.conn-banner {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); font-weight: 600;
  background: var(--failed-bg); color: var(--failed-fg); border-bottom: 1px solid var(--border); animation: rise-in var(--dur) var(--ease-out);
}
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--sp-6) var(--sp-8) calc(var(--sp-10) * 2); outline: none; view-transition-name: content; }
.view { min-width: 0; }
.nav-scrim { display: none; }
/* shown by theme-init.js when the app script could not be downloaded (P-SHELL-01); the router replaces it */
.boot-error { max-width: 640px; margin: var(--sp-10) auto; }
.boot-error-title { margin: 0 0 var(--sp-2); font-size: var(--fs-xl); font-weight: 600; }
.boot-error p { color: var(--text-2); }
.boot-error p:last-child { margin: var(--sp-4) 0 0; }
/* the raw error behind "Details" on the view error card */
.error-details { margin: 0 auto var(--sp-4); max-width: 560px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.error-details-text { margin: var(--sp-2) 0 0; padding: var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border);
  font: var(--fs-xs)/1.5 var(--font-mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

/* ------------------------------------------------------------------------------------------------ layout */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4) var(--sp-6); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.page-header > div:first-child { min-width: 0; }
.page-title { margin: 0; font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.025em; line-height: 1.2; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.page-subtitle { margin: var(--sp-2) 0 0; color: var(--text-2); font-size: var(--fs-lg); max-width: 76ch; }
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-8) 0 var(--sp-4); font-size: var(--fs-xl); font-weight: 600; }
.section-title:first-child { margin-top: 0; }
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--sp-4)); min-width: 0; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--sp-2)); }
.split { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-good { color: var(--passed-fg); } .text-bad { color: var(--failed-fg); } .text-warn { color: var(--warning-fg); }
.mono { font-family: var(--font-mono); font-size: max(var(--fs-xs), .92em); }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.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; }
.divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; border: 0; }

/* ------------------------------------------------------------------------------------------------ buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-hover: var(--surface-3);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 36px; padding: 0 var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-md); font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none; text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform 80ms;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--primary-hover);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .14), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-primary:active { background: var(--primary-press); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--danger-hover); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--text-2); --btn-hover: var(--surface-3); box-shadow: none; }
.btn-ghost:hover { color: var(--text); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-border: transparent; --btn-hover: var(--accent-soft-2); box-shadow: none; }
.btn-danger-soft { --btn-bg: var(--failed-bg); --btn-fg: var(--failed-fg); --btn-border: transparent; --btn-hover: var(--failed-bg); box-shadow: none; }
.btn-danger-soft:hover { filter: brightness(.97); }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); gap: var(--sp-2); border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-xs); gap: var(--sp-1); border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-lg); border-radius: 11px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-inline-end-color: transparent; animation: spin .7s linear infinite;
}
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn + .btn { margin-inline-start: -1px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn-bordered { border-color: var(--border); background: var(--surface); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); display: flex; align-items: baseline; gap: var(--sp-1); }
.field-req { color: var(--failed-fg); }
.field-optional { margin-inline-start: var(--sp-1); font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.field-hint { margin: 0; font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }
.field-error { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--failed-fg); }
.form-grid { display: grid; gap: var(--sp-4) var(--sp-5); grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.form-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-5); }
.input {
  width: 100%; height: 38px; padding: 0 var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: var(--fs-md); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover:not(:disabled):not(:focus) { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.input:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.input:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.input[aria-invalid="true"], .has-error .input { border-color: var(--st-failed); }
.input[aria-invalid="true"]:focus, .has-error .input:focus { outline-color: var(--focus); }
textarea.input { height: auto; min-height: 96px; padding: var(--sp-2) var(--sp-3); line-height: 1.5; resize: vertical; }
textarea.input-mono, .input-mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
select.input {
  appearance: none; padding-inline-end: var(--sp-10); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { height: 32px; font-size: var(--fs-sm); padding: 0 var(--sp-2); }
.input-group { position: relative; display: flex; align-items: stretch; min-width: 0; }
.input-group > .input { flex: 1; min-width: 0; }
.password-field > .input { padding-inline-end: var(--sp-12); font-family: var(--font-mono); letter-spacing: .02em; }
.password-field > .input:placeholder-shown { font-family: var(--font-sans); letter-spacing: 0; }
/* passwordInput({credential: false}): a text field masked like a password, so browsers have no password field to fill */
.input-masked:not(:placeholder-shown):not(.is-revealed) { -webkit-text-security: disc; }
.input-addon-btn {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-3); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast);
}
.input-addon-btn:hover { background: var(--surface-3); color: var(--text); }
.input-addon-btn:focus-visible { outline-offset: -2px; }
.input-with-icon { position: relative; }
.input-with-icon > .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-with-icon > .input { padding-inline-start: var(--sp-10); }
.check { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-md); }
.check input { margin-top: 2px; }
.check small { display: block; color: var(--text-3); font-size: var(--fs-sm); }

.switch { position: relative; display: inline-flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; user-select: none; }
.switch input { position: absolute; inset-inline-start: 0; top: 0; width: 38px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  position: relative; flex: none; width: 38px; height: 22px; margin-top: 1px; border-radius: var(--r-full); background: var(--border-strong);
  transition: background var(--dur) var(--ease-out), box-shadow var(--dur-fast);
}
.switch-thumb {
  position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform var(--dur-slow) var(--ease-spring);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(calc(16px * var(--dir-sign))); }
.switch input:focus-visible { outline: none; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-label { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.switch-text small { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip-check { position: relative; display: inline-flex; }
.chip-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-check-box {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-full);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.chip-check:hover .chip-check-box { border-color: var(--accent); color: var(--text); }
.chip-check-mark { width: 0; opacity: 0; margin-inline-end: calc(-1 * var(--sp-2)); transition: width var(--dur) var(--ease-out), opacity var(--dur), margin var(--dur); }
.chip-check input:checked + .chip-check-box { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:checked + .chip-check-box .chip-check-mark { width: 13px; opacity: 1; margin-inline-end: 0; }
.chip-check input:focus-visible { outline: none; }
.chip-check input:focus-visible + .chip-check-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip-check input:disabled + .chip-check-box { opacity: .5; }

.segmented { display: inline-flex; gap: 2px; padding: var(--sp-1); border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.segmented-option { position: relative; flex: none; }
.segmented-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented-option > span, .segmented > button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 30px; padding: 0 var(--sp-3); border-radius: 8px; border: 0;
  background: transparent; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.segmented-option input:checked + span, .segmented > button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-option input:focus-visible { outline: none; }
.segmented-option input:focus-visible + span, .segmented > button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.segmented-sm .segmented-option > span { height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-sm); }

.option-cards { display: grid; gap: var(--sp-3); grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.option-card { position: relative; display: block; cursor: pointer; min-width: 0; }
.option-card input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.option-card-body {
  display: flex; align-items: flex-start; gap: var(--sp-3); height: 100%; padding: var(--sp-4) var(--sp-4); border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color var(--dur), background var(--dur), box-shadow var(--dur), transform var(--dur) var(--ease-out);
}
.option-card:hover .option-card-body { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.option-card input:checked ~ .option-card-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.option-card input:focus-visible { outline: none; }
.option-card input:focus-visible ~ .option-card-body { outline: 2px solid var(--focus); outline-offset: 2px; }
.option-card.is-disabled { opacity: .55; cursor: not-allowed; }
.option-card-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); transition: background var(--dur), color var(--dur); }
.option-card input:checked ~ .option-card-body .option-card-icon { background: var(--primary); color: #fff; }
.option-card-text { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; padding-inline-end: var(--sp-4); }
.option-card-text b { font-size: var(--fs-md); font-weight: 600; }
.option-card-text small { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.option-card-badge { margin-inline-start: auto; }
.option-card-check {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; transform: scale(0); transition: transform var(--dur-slow) var(--ease-spring); pointer-events: none;
}
.option-card input:checked ~ .option-card-check { transform: scale(1); }

/* ------------------------------------------------------------------------------------------------ cards & tiles */
.card {
  position: relative; min-width: 0; padding: var(--sp-5); border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: var(--sp-5); }
.grid > .card + .card, .stack > .card + .card, .settings-layout > .card + .card { margin-top: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.card-header > div:first-child { flex: 1 1 240px; min-width: 0; }
.card-title { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); font-weight: 600; }
.card-title .icon { color: var(--text-3); }
.card-subtitle { margin: var(--sp-1) 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.card-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.card-flush { padding: 0; overflow: hidden; overflow: clip; }   /* clip: not a scroll box, so table headers can stick to the page */
.card-flush > .card-header { padding: var(--sp-4) var(--sp-5) 0; margin-bottom: var(--sp-4); }
.card-footer { margin: var(--sp-4) calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5)); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-flush > .card-footer { margin: 0; }
.card.is-interactive { cursor: pointer; transition: transform var(--dur) var(--ease-out), box-shadow var(--dur), border-color var(--dur); }
.card.is-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-xs); }
.card-muted { background: var(--surface-2); box-shadow: none; }
.card-fill { display: flex; flex-direction: column; }
.card-fill > .card-grow { flex: 1; display: flex; align-items: center; }
.card-fill > .card-footer { margin-top: auto; }

.stats { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat {
  position: relative; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-4) var(--sp-4); border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur);
}
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.stat-icon { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-fg); }
.stat-icon.is-passed { background: var(--passed-bg); color: var(--passed-fg); }
.stat-icon.is-failed { background: var(--failed-bg); color: var(--failed-fg); }
.stat-icon.is-flaky { background: var(--flaky-bg); color: var(--flaky-fg); }
.stat-icon.is-info { background: var(--info-bg); color: var(--info-fg); }
.stat-icon.is-running { background: var(--running-bg); color: var(--running-fg); }
.stat-value { margin-top: var(--sp-2); font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; color: var(--text); }
.stat-unit { margin-inline-start: 2px; font-size: var(--fs-lg); font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.stat-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); min-height: 30px; font-size: var(--fs-sm); color: var(--text-3); }
.stat-delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 0; padding-inline: var(--sp-1) var(--sp-2); border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.stat-delta.is-good { background: var(--passed-bg); color: var(--passed-fg); }
.stat-delta.is-bad { background: var(--failed-bg); color: var(--failed-fg); }
.stat-delta.is-flat { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ------------------------------------------------------------------------------------------------ badges */
/* One badge per state (components.js STATES): colour + icon + words, never colour alone. Badges never wrap: a long
   run outcome is clipped with an ellipsis (the full text is in its tooltip). */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); height: 22px; max-width: 100%; padding: 0 var(--sp-2); border-radius: var(--r-full);
  border: 1px solid transparent; background: var(--neutral-bg); color: var(--neutral-fg); font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  white-space: nowrap; vertical-align: middle;
}
.badge > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.badge > svg, .badge > .live-dot { flex: none; }
.badge-lg { height: 28px; padding: 0; padding-inline: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); gap: var(--sp-2); }
.badge-run { text-align: start; }
.badge-passed { background: var(--passed-bg); color: var(--passed-fg); }
.badge-failed { background: var(--failed-bg); color: var(--failed-fg); }
.badge-flaky { background: var(--flaky-bg); color: var(--flaky-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-skipped { background: var(--skipped-bg); color: var(--skipped-fg); }
.badge-running { background: var(--running-bg); color: var(--running-fg); }
.badge-review { background: transparent; border-color: currentColor; color: var(--running-fg); }
.badge-notexec { background: transparent; border-color: var(--border-strong); border-style: dashed; color: var(--text-2); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-accent { background: var(--accent-bg); color: var(--accent-fg); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 var(--sp-2); border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.live-dot { position: relative; display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st-running); }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse-ring 1.6s var(--ease-out) infinite; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ------------------------------------------------------------------------------------------------ tables */
/* Table kit (components.js enhanceTables, README "Tables"): a .table-wrap[data-table="name"] gets a density toggle
   (data-density = comfortable | compact), headers that stick (to the page under the top bar, or inside the wrap when
   the table scrolls sideways: .is-scroll-x), and ellipsis + tooltip on [data-truncate] cells. */
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.is-scroll { max-height: var(--table-h, 520px); overflow-y: auto; }
.table-wrap[data-table] { overflow: visible; }
.table-wrap[data-table].is-scroll-x, .table-wrap[data-table].is-scroll { overflow: auto; max-height: var(--table-h, min(70vh, 640px)); overscroll-behavior-x: contain; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th {
  position: sticky; top: 0; z-index: 2; padding: var(--sp-2) var(--sp-4); text-align: start; white-space: nowrap; background: var(--surface-2);
  border-bottom: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  vertical-align: bottom;
}
/* a wrap that does not scroll sideways lets its header stick to the page, right under the sticky top bar */
.table-wrap[data-table]:not(.is-scroll-x):not(.is-scroll) .table th { top: var(--topbar-h); }
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-inline-start: var(--sp-5); }
.table th:last-child, .table td:last-child { padding-inline-end: var(--sp-5); }
.table th.col-num { text-align: end; }
/* density: comfortable 12x16 cells (14 px), compact 8x12 cells (13 px) */
.table-wrap[data-density="comfortable"] .table td { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-md); }
.table-wrap[data-density="comfortable"] .table th { padding: var(--sp-3) var(--sp-4); }
.table-wrap[data-density="compact"] .table td { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.table-wrap[data-density="compact"] .table th { padding: var(--sp-2) var(--sp-3); }
.table-wrap[data-density] .table th:first-child, .table-wrap[data-density] .table td:first-child { padding-inline-start: var(--sp-4); }
.table-wrap[data-density] .table th:last-child, .table-wrap[data-density] .table td:last-child { padding-inline-end: var(--sp-4); }
.table-wrap[data-density="compact"] .cell-sub { margin-top: 0; }
/* long cell text: one line, ellipsis, full text in the tooltip (the kit adds data-tip only while it is clipped) */
.table [data-truncate] { display: block; max-width: var(--trunc-w, 40ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td[data-truncate] { display: table-cell; }
.table-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding: 0 0 var(--sp-2); }
.card-flush > .table-toolbar { padding: 0 var(--sp-4) var(--sp-2); }
.density-toggle { flex: none; }
.density-toggle > button { height: 28px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.table-zebra tbody tr:nth-child(even) td { background: var(--surface-2); }
.table-hover tbody tr { transition: background var(--dur-fast); }
.table-hover tbody tr:hover td { background: var(--surface-3); }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.table tr.is-clickable:focus-visible td { background: var(--accent-soft); }
.table .col-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-shrink { width: 1%; white-space: nowrap; }
.table-compact td { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.table-compact th { padding: var(--sp-2) var(--sp-3); }
.cell-title { display: block; font-weight: 600; color: var(--text); }
.cell-sub { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--text-3); max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chevron { color: var(--text-3); transition: transform var(--dur) var(--ease-out), color var(--dur); }
tr:hover .row-chevron { transform: translateX(calc(3px * var(--dir-sign))); color: var(--text); }

/* ------------------------------------------------------------------------------------------------ tabs, stepper, accordion */
.tabs { position: relative; display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; --tabs-fade: 36px; }
.tabs::-webkit-scrollbar { display: none; }
/* an overflowing strip fades out at the edge(s) that hide more tabs (components.js tabs() sets the classes) */
.tabs.is-scroll-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--tabs-fade)), transparent); mask-image: linear-gradient(to right, #000 calc(100% - var(--tabs-fade)), transparent); }
.tabs.is-scroll-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--tabs-fade)), transparent); mask-image: linear-gradient(to left, #000 calc(100% - var(--tabs-fade)), transparent); }
.tabs.is-scroll-start.is-scroll-end {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--tabs-fade), #000 calc(100% - var(--tabs-fade)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--tabs-fade), #000 calc(100% - var(--tabs-fade)), transparent);
}
.tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); height: 42px; padding: 0 var(--sp-3); border: 0; border-radius: 8px 8px 0 0;
  background: transparent; color: var(--text-2); font-size: var(--fs-md); font-weight: 600; white-space: nowrap; cursor: pointer; transition: color var(--dur-fast), background var(--dur-fast);
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab:focus-visible { outline-offset: -2px; }
.tab[aria-selected="true"] { color: var(--accent-text); }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 var(--sp-2); border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; }
.tab[aria-selected="true"] .tab-count { background: var(--accent-soft); color: var(--accent-text); }
.tabs-ink { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; border-radius: 2px; background: var(--accent); transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out); }
.tab-panel { padding-top: var(--sp-6); animation: rise-in var(--dur-slow) var(--ease-out); }

.stepper { display: flex; list-style: none; margin: 0; padding: 0; gap: 0; }
.step { display: flex; align-items: center; flex: 1 1 0; min-width: 0; }
.step:last-child { flex: 0 0 auto; }
.step:not(:last-child)::after { content: ""; flex: 1; height: 2px; min-width: 16px; margin: 0 var(--sp-2); border-radius: 2px; background: var(--border); transition: background .5s var(--ease-out); }
.step.is-done:not(:last-child)::after { background: var(--accent); }
.step-btn {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2); border: 0; border-radius: 12px; background: transparent;
  color: var(--text-2); text-align: start; cursor: pointer; transition: background var(--dur-fast);
}
button.step-btn:hover { background: var(--surface-3); }
.step-index {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 700; transition: border-color var(--dur-slow) var(--ease-out), background var(--dur-slow) var(--ease-out), color var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out);
}
.step.is-current .step-index { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.is-done .step-index { border-color: var(--primary); background: var(--primary); color: #fff; }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-text b { font-size: var(--fs-sm); font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-text small { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.accordion { display: flex; flex-direction: column; gap: var(--sp-2); }
.accordion-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color var(--dur); }
.accordion-item[open] { border-color: var(--border-strong); }
.accordion-item > summary {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; font-weight: 600; user-select: none;
}
.accordion-item > summary::-webkit-details-marker { display: none; }
.accordion-item > summary:hover { background: var(--surface-2); }
.accordion-item > summary:focus-visible { outline-offset: -2px; }
.accordion-title { flex: 1; min-width: 0; }
.accordion-meta { color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; }
.accordion-chevron { color: var(--text-3); transition: transform var(--dur) var(--ease-out); }
.accordion-item[open] .accordion-chevron { transform: rotate(180deg); }
.accordion-body { padding: var(--sp-1) var(--sp-4) var(--sp-4); animation: rise-in var(--dur) var(--ease-out); }
details.disclosure > summary { cursor: pointer; color: var(--text-2); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: var(--sp-2); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 6px; height: 6px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur); }
details.disclosure[open] > summary::before { transform: rotate(45deg); }

/* ------------------------------------------------------------------------------------------------ overlays */
.modal-backdrop, .drawer-backdrop, .palette-backdrop { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade-in var(--dur) ease-out; }
.modal-backdrop { z-index: 100; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); overflow-y: auto; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; outline: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-xl);
  animation: modal-in var(--dur-slow) var(--ease-out);
}
.modal-sm { max-width: 420px; } .modal-lg { max-width: 760px; } .modal-xl { max-width: 1080px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) 0 var(--sp-1); padding-inline: var(--sp-6) var(--sp-5); }
.modal-title { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.modal-body { padding: var(--sp-2) var(--sp-6) var(--sp-6); overflow-y: auto; }
.modal-text { margin: 0; color: var(--text-2); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-backdrop.is-closing, .drawer-backdrop.is-closing { animation: fade-out .18s ease-in forwards; pointer-events: none; }
.modal-backdrop.is-closing .modal { animation: modal-out .18s ease-in forwards; }

.drawer-backdrop { z-index: 90; display: flex; justify-content: flex-end; }
.drawer-backdrop.is-left { justify-content: flex-start; }
.drawer {
  height: 100%; width: min(var(--drawer-w, 520px), 100vw); display: flex; flex-direction: column; outline: none;
  background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-xl); animation: drawer-in var(--dur-slow) var(--ease-out);
}
.drawer-md { --drawer-w: 520px; } .drawer-lg { --drawer-w: 720px; } .drawer-xl { --drawer-w: 960px; }
.is-left .drawer { border-inline-start: 0; border-inline-end: 1px solid var(--border); animation-name: drawer-in-left; }
.drawer-backdrop.is-closing .drawer { animation: drawer-out .2s ease-in forwards; }
.drawer-backdrop.is-left.is-closing .drawer { animation-name: drawer-out-left; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.drawer-title { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.drawer-subtitle { margin: var(--sp-1) 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.drawer-footer { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); }

/* Toasts sit bottom-right, above any sticky footer bar so they never cover its buttons (wizard Continue, project
   Save, bulk actions). A view with another bottom bar adds data-sticky-footer to it, or sets --toast-offset. */
.toast-stack {
  position: fixed; inset-inline-end: 20px; bottom: var(--toast-offset, 20px); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-2);
  width: min(400px, calc(100vw - 32px)); pointer-events: none; transition: bottom var(--dur) var(--ease-out);
}
body:has(.nr-foot, .pj-savebar.is-dirty, .bulk-bar, .cd-footer, [data-sticky-footer]) { --toast-offset: 88px; }
/* An open dialog or side panel has its buttons bottom-right: toasts move to the bottom-left meanwhile, so a
   "Saved" or "Not saved" notice never covers Save, Revert or Close (phones keep them under the top bar). */
@media (min-width: 641px) {
  body:has(.modal-backdrop, .drawer-backdrop) .toast-stack { inset-inline-end: auto; inset-inline-start: 20px; bottom: 20px; }
}
.toast {
  position: relative; pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3) 0; padding-inline: var(--sp-4) var(--sp-2); overflow: hidden;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); animation: toast-in .36s var(--ease-spring);
}
.toast::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--st-running); }
.toast-success::before { background: var(--st-passed); } .toast-error::before { background: var(--st-failed); } .toast-warning::before { background: var(--st-warning); }
.toast-icon { flex: none; margin-top: 1px; color: var(--running-fg); }
.toast-success .toast-icon { color: var(--passed-fg); } .toast-error .toast-icon { color: var(--failed-fg); } .toast-warning .toast-icon { color: var(--warning-fg); }
.toast-content { flex: 1; min-width: 0; padding-top: 1px; }
.toast-title { display: block; font-size: var(--fs-md); margin-bottom: 1px; }
.toast-text { display: block; font-size: var(--fs-md); color: var(--text-2); word-break: break-word; }
.toast-title + .toast-text { font-size: var(--fs-sm); }
.toast-action { flex: none; }
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }

.tooltip {
  position: fixed; z-index: 300; max-width: 300px; padding: var(--sp-2) var(--sp-2); border-radius: 8px; background: var(--tooltip-bg); color: var(--tooltip-fg);
  font-size: var(--fs-sm); line-height: 1.45; white-space: pre-line; pointer-events: none; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(3px); transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.tooltip.is-visible { opacity: 1; transform: none; }
.tooltip-title { font-weight: 600; margin-bottom: var(--sp-1); }
.tooltip-row { display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.tooltip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tooltip-row b { font-variant-numeric: tabular-nums; font-weight: 700; }
.tooltip-row span { opacity: .78; }

.menu {
  position: fixed; z-index: 150; padding: var(--sp-2); max-height: 70vh; overflow-y: auto; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-lg); animation: menu-in .16s var(--ease-out); transform-origin: top;
  overscroll-behavior: contain; scrollbar-width: thin;
}
.menu.is-above { transform-origin: bottom; animation-name: menu-in-up; }   /* flipped above its trigger (more room there) */
.menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; height: 36px; padding: 0 var(--sp-2); border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font-size: var(--fs-md); text-align: start; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.menu-item .icon { color: var(--text-3); }
.menu-item:hover, .menu-item:focus { background: var(--surface-3); text-decoration: none; }
.menu-item:focus:not(:focus-visible) { outline: none; }
.menu-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.menu-item:disabled { opacity: .5; cursor: not-allowed; }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--failed-fg); }
.menu-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.menu-hint { margin-inline-start: var(--sp-3); color: var(--text-3); font-size: var(--fs-xs); }
.menu-check { color: var(--accent-text) !important; }
.menu-icon-pad { width: 16px; flex: none; }
.menu-sep { height: 1px; margin: var(--sp-2) var(--sp-1); background: var(--border); }
.menu-label { padding: var(--sp-2) var(--sp-2) var(--sp-1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.menu-info { padding: var(--sp-2) var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); max-width: 280px; white-space: normal; }

.palette-backdrop { z-index: 120; display: flex; justify-content: center; align-items: flex-start; padding: 12vh var(--sp-4) var(--sp-4); }
.palette {
  width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xl); animation: palette-in .22s var(--ease-out);
}
.palette-search { flex: none; display: flex; align-items: center; gap: var(--sp-3); height: 58px; padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: var(--fs-lg); }
.palette-list { flex: 1; overflow-y: auto; padding: var(--sp-2); }
.palette-group { padding: var(--sp-2) var(--sp-2) var(--sp-1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.palette-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-2); border-radius: 10px; cursor: pointer; }
.palette-item.is-active { background: var(--accent-soft); }
.palette-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); transition: background var(--dur-fast), color var(--dur-fast); }
.palette-item.is-active .palette-icon { background: var(--primary); color: #fff; }
.palette-text { flex: 1; min-width: 0; }
.palette-title { display: block; font-size: var(--fs-md); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { display: block; font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { flex: none; }
.palette-empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-3); }
.palette-foot { flex: none; display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-3); }

kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--sp-1); border-radius: 5px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; background: var(--surface); color: var(--text-2); font: 600 var(--fs-xs)/1 var(--font-sans); white-space: nowrap;
}
.kbd-group { display: inline-flex; align-items: center; gap: var(--sp-1); }
.kbd-then { margin: 0 var(--sp-1); font-size: var(--fs-xs); color: var(--text-3); }
.shortcut-groups { display: grid; gap: var(--sp-5); }
.shortcut-group { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.shortcut-list { margin: 0; display: grid; gap: 2px; }
.shortcut-list > div { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle); }
.shortcut-list dt { color: var(--text); font-size: var(--fs-md); }
.shortcut-list dd { margin: 0; }

/* ------------------------------------------------------------------------------------------------ loaders & states */
.skeleton { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--sk-1) 0%, var(--sk-2) 50%, var(--sk-1) 100%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
.sk-line { height: 12px; margin: var(--sp-2) 0; }
.sk-title { height: 22px; width: 38%; margin: var(--sp-1) 0 var(--sp-4); }
.sk-value { height: 30px; width: 55%; margin: var(--sp-2) 0; }
.sk-block { height: 160px; }
.skeleton-table .sk-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-4); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle); }
.spinner { display: inline-block; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.spinner-wrap { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-3); font-size: var(--fs-md); }
.spinner-lg .spinner { width: 24px; height: 24px; border-width: 3px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-12) var(--sp-6); text-align: center; }
.empty-icon {
  width: 56px; height: 56px; margin-bottom: var(--sp-2); border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-soft) 50%, transparent);
}
.empty-danger .empty-icon { background: var(--failed-bg); color: var(--failed-fg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--failed-bg) 50%, transparent); }
.empty-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.empty-body { margin: 0; max-width: 480px; color: var(--text-2); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.empty-compact { padding: var(--sp-6) var(--sp-4); gap: var(--sp-2); }
.empty-compact .empty-icon { width: 44px; height: 44px; border-radius: 12px; box-shadow: none; }

.callout { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: 12px; border: 1px solid transparent; font-size: var(--fs-md); }
.callout > .icon { margin-top: 1px; }
.callout-info { background: var(--running-bg); color: var(--running-fg); }
.callout-success { background: var(--passed-bg); color: var(--passed-fg); }
.callout-warning { background: var(--warning-bg); color: var(--warning-fg); }
.callout-danger { background: var(--failed-bg); color: var(--failed-fg); }
.callout-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.callout-title { display: block; margin-bottom: 2px; color: inherit; }
.callout-body { color: var(--text); }
.callout-body a { color: inherit; text-decoration: underline; }

.progress { position: relative; height: 8px; border-radius: var(--r-full); background: var(--chart-track); overflow: hidden; }
.progress-sm { height: 4px; } .progress-lg { height: 12px; }
.progress-bar { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--st-running); transition: width .6s var(--ease-out); overflow: hidden; }
.progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); background-size: 200% 100%; animation: shimmer 1.8s linear infinite; }
.progress-passed .progress-bar { background: var(--st-passed); } .progress-failed .progress-bar { background: var(--st-failed); } .progress-flaky .progress-bar { background: var(--st-flaky); }
.progress.is-indeterminate .progress-bar { width: 35%; animation: indeterminate 1.4s var(--ease-in-out) infinite; }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-track { fill: none; stroke: var(--chart-track); }
.ring-value { fill: none; stroke-linecap: round; transition: stroke-dasharray .9s var(--ease-out); animation: ring-in 1s var(--ease-out) both; }
.ring-text { position: relative; font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding: 0 0 var(--sp-4); padding-inline-start: var(--sp-8); }
.timeline-item::before { content: ""; position: absolute; inset-inline-start: 10px; top: 24px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--border); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-item.is-done::before { background: var(--st-passed); }
.timeline-dot {
  position: absolute; inset-inline-start: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-inverse); transition: border-color var(--dur-slow), background var(--dur-slow), box-shadow var(--dur-slow);
}
.is-done > .timeline-dot { border-color: var(--st-passed); background: var(--st-passed); }
.is-failed > .timeline-dot { border-color: var(--st-failed); background: var(--st-failed); }
.is-skipped > .timeline-dot { border-style: dashed; color: var(--text-3); }
.is-current > .timeline-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.is-current > .timeline-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.2s ease-in-out infinite; }
.timeline-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.is-pending .timeline-title, .is-skipped .timeline-title { color: var(--text-3); }
.timeline-meta { font-size: var(--fs-xs); color: var(--text-3); }
.timeline-body { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; font-size: var(--fs-md); }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); min-width: 0; word-break: break-word; }

/* ------------------------------------------------------------------------------------------------ code & logs */
.code { margin: var(--sp-4) 0; border: 1px solid var(--border); border-radius: 12px; background: var(--code-bg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-1) 0; padding-inline: var(--sp-4) var(--sp-2); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.code-lang { font: 600 var(--fs-xs) var(--font-mono); color: var(--text-3); }
.code pre { margin: 0; padding: var(--sp-4) var(--sp-4); overflow: auto; color: var(--code-fg); font: var(--fs-sm)/1.65 var(--font-mono); tab-size: 4; }
.code-copy.is-copied { color: var(--passed-fg); }
.j-key { color: var(--code-key); } .j-str { color: var(--code-str); } .j-num { color: var(--code-num); } .j-bool, .j-null { color: var(--code-kw); }
.console { border-radius: 12px; overflow: hidden; border: 1px solid var(--console-border); background: var(--console-bg); color: var(--console-fg); box-shadow: var(--shadow-sm); }
.console-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-1) 0; padding-inline: var(--sp-4) var(--sp-2); border-bottom: 1px solid var(--console-border); background: var(--console-bar); }
.console-title { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; color: var(--console-title); }
.console-tools { display: flex; gap: 2px; }
.console-btn { display: inline-flex; align-items: center; gap: var(--sp-1); height: 28px; padding: 0 var(--sp-2); border: 0; border-radius: 6px; background: transparent; color: var(--console-title); font-size: var(--fs-xs); cursor: pointer; }
.console-btn:hover { background: var(--console-hover); color: #fff; }
.console-btn:focus-visible { outline: 2px solid var(--console-focus); outline-offset: -2px; }
.console-btn[aria-pressed="true"] { color: var(--console-accent); }
.console-body { margin: 0; height: var(--console-h, 360px); overflow: auto; padding: var(--sp-3) var(--sp-4); font: var(--fs-sm)/1.65 var(--font-mono); white-space: pre; tab-size: 4; color: var(--console-fg); scrollbar-color: #2c3647 transparent; }
.console-body.is-wrapped { white-space: pre-wrap; word-break: break-word; }
.console-body:focus-visible { outline: 2px solid var(--console-focus); outline-offset: -2px; }
.console-empty { color: var(--console-muted); }
.ln-time { color: var(--console-muted); } .ln-stage { color: #93bcff; font-weight: 600; } .ln-err { color: #ff9393; } .ln-warn { color: #f5c26e; } .ln-ok { color: #70dcb5; } .ln-agent { color: #c6b6ff; }

/* ------------------------------------------------------------------------------------------------ charts */
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: var(--sp-3) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch-line { width: 14px; height: 3px; border-radius: 2px; }
.legend-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-pct { color: var(--text-3); font-weight: 500; }
.chart-figure { margin: 0; min-width: 0; }
.chart-figure > .chart-legend { margin: 0 0 var(--sp-2); }
.chart-host { position: relative; width: 100%; border-radius: 8px; }
.chart-host svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--text-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.is-drawing { stroke-dasharray: 1; animation: draw 1.2s var(--ease-out) both; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-point { stroke-width: 1.5; }
.chart-point.is-entering { animation: fade-in .3s var(--ease-out) both; }
.chart-ref { stroke: var(--text-3); stroke-width: 1.25; stroke-dasharray: 5 4; opacity: .85; }
.chart-ref-label {
  fill: var(--text-2); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums;
  paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round;
}
.chart-end-label { fill: var(--text); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-cross-line { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; opacity: .7; }
.chart-empty { display: grid; place-items: center; height: 100%; min-height: 120px; border-radius: 10px; background: var(--surface-2); color: var(--text-3); font-size: var(--fs-sm); }
.chart-table { margin-top: var(--sp-2); font-size: var(--fs-sm); }
.chart-table > summary { width: max-content; cursor: pointer; color: var(--text-3); font-weight: 600; border-radius: 4px; }
.chart-table > summary:hover { color: var(--accent-text); }
.chart-table .table-wrap { margin-top: var(--sp-2); max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.donut-chart { margin: 0; display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.donut-chart > .chart-legend { flex-direction: column; margin: 0; gap: var(--sp-2); }
.donut { position: relative; flex: none; }
.donut svg { display: block; }
.donut-track { fill: none; stroke: var(--chart-track); }
.donut-seg { fill: none; outline: none; transition: opacity var(--dur-fast); animation: donut-in 1s var(--ease-out) both; cursor: default; }
.donut-seg:hover, .donut-seg.is-active { opacity: .78; }
.donut { border-radius: 50%; }
.donut:focus-visible { outline-offset: 4px; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.donut-center span { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.sparkline { display: block; overflow: visible; flex: none; }
.sparkline-line { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hbars { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.hbar { display: grid; grid-template-columns: minmax(84px, 32%) minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); border-radius: 6px; outline: none; }
.hbar:focus-visible { outline-offset: 2px; }
.hbar-label { font-size: var(--fs-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; }
.hbar-fill { display: block; height: 100%; min-width: 3px; border-radius: 0; border-start-end-radius: 4px; border-end-end-radius: 4px; transform-origin: left; animation: grow-x .9s var(--ease-out) both; }
.hbar:hover .hbar-fill { filter: brightness(1.08); }
.hbar-value { min-width: 3ch; text-align: end; font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.stacked-track { display: flex; gap: 2px; overflow: hidden; border-radius: 4px; }
.stacked-seg { display: block; min-width: 4px; outline: none; transform-origin: left; animation: grow-x .8s var(--ease-out) both; transition: filter var(--dur-fast); }
.stacked-seg:hover, .stacked-seg.is-active { filter: brightness(1.12); box-shadow: inset 0 0 0 2px var(--text); }
.stacked-track:focus-visible { outline-offset: 3px; }
/* failed / error segments of HTML bars carry a hatch: they read as different from passed without colour */
.is-hatched { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 2px, transparent 2px 5px); }
.mini-bar { display: inline-flex; gap: 2px; height: 6px; overflow: hidden; border-radius: 3px; background: var(--chart-track); vertical-align: middle; }
.mini-bar i { display: block; min-width: 2px; }
.mini-bar.is-running { background: linear-gradient(90deg, var(--chart-track) 0%, var(--st-running) 50%, var(--chart-track) 100%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }

/* ------------------------------------------------------------------------------------------------ markdown */
.prose { max-width: 80ch; font-size: var(--fs-lg); line-height: 1.72; color: var(--text); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1 { margin: 0 0 var(--sp-4); font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.prose h2 { margin: var(--sp-10) 0 var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.015em; }
.prose h3 { margin: var(--sp-8) 0 var(--sp-2); font-size: var(--fs-xl); font-weight: 600; }
.prose h4, .prose h5, .prose h6 { margin: var(--sp-6) 0 var(--sp-2); font-size: var(--fs-lg); font-weight: 600; }
.prose h1, .prose h2, .prose h3, .prose h4 { scroll-margin-top: calc(var(--topbar-h) + 20px); }
.prose .is-target { animation: target-flash 1.6s var(--ease-out); border-radius: 6px; }
.prose p { margin: 0 0 var(--sp-4); }
.prose ul, .prose ol { margin: 0 0 var(--sp-4); padding-inline-start: var(--sp-6); }
.prose li { margin: var(--sp-1) 0; }
.prose li > ul, .prose li > ol { margin: var(--sp-1) 0; }
.prose li::marker { color: var(--text-3); }
.prose a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { font-weight: 600; }
.prose blockquote { margin: var(--sp-4) 0; padding: var(--sp-2) var(--sp-4); border-inline-start: 3px solid var(--accent); border-radius: 0; border-start-end-radius: 10px; border-end-end-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { margin: var(--sp-8) 0; }
.prose .md-table-wrap { margin: var(--sp-4) 0; border: 1px solid var(--border); border-radius: 12px; }
.prose .md-table { font-size: var(--fs-md); }
.prose .md-table th { position: static; text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); color: var(--text-2); }
.prose .md-table td { vertical-align: top; }
.prose .md-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.prose .md-table th:first-child, .prose .md-table td:first-child { padding-inline-start: var(--sp-4); }
.md-task-item { list-style: none; margin-inline-start: calc(-1 * var(--sp-6)); display: flex; gap: var(--sp-2); align-items: baseline; }
.md-task { position: relative; top: 2px; display: inline-grid; place-items: center; width: 15px; height: 15px; flex: none; border-radius: 4px; border: 1.5px solid var(--border-strong); }
.md-task.is-done { background: var(--primary); border-color: var(--primary); color: #fff; }
.md-img { display: inline-block; max-width: 100%; height: auto; vertical-align: middle; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.md-figure, .prose .md-figure { margin: var(--sp-4) 0; }
.md-figure > .md-img { display: block; box-shadow: var(--shadow-xs); }
.prose-sm { font-size: var(--fs-md); line-height: 1.65; }
.prose-sm h1, .prose-sm h2, .prose-sm h3 { font-size: var(--fs-lg); margin: var(--sp-4) 0 var(--sp-2); padding: 0; border: 0; }

/* ------------------------------------------------------------------------------------------------ views: dashboard */
.welcome {
  position: relative; overflow: hidden; padding: var(--sp-8) var(--sp-8); border-radius: var(--r-xl); border: 1px solid var(--border);
  background: radial-gradient(1200px 300px at 100% 0%, var(--accent-soft-2), transparent 60%), radial-gradient(600px 240px at 0% 100%, var(--info-bg), transparent 60%), var(--surface);
  box-shadow: var(--shadow-sm);
}
.welcome h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; }
.welcome p { margin: 0; color: var(--text-2); max-width: 64ch; }
.checklist { display: grid; gap: var(--sp-2); margin: var(--sp-6) 0 0; padding: 0; list-style: none; counter-reset: step; }
.check-item {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-4); border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); transition: border-color var(--dur), transform var(--dur) var(--ease-out), box-shadow var(--dur);
}
.check-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.check-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: var(--text-3); font-weight: 700; font-size: var(--fs-sm); background: var(--surface); }
.check-item.is-done .check-mark { border-color: var(--st-passed); background: var(--st-passed); color: var(--text-inverse); }
.check-item.is-done .check-title { color: var(--text-2); }
.check-body { flex: 1; min-width: 0; }
.check-title { display: block; font-weight: 600; }
.check-desc { display: block; font-size: var(--fs-sm); color: var(--text-3); }
.quick-actions { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.quick-action {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-4); border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); box-shadow: var(--shadow-xs); transition: transform var(--dur) var(--ease-out), box-shadow var(--dur), border-color var(--dur);
}
.quick-action:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.quick-action .qa-icon { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-fg); }
.quick-action b { display: block; font-size: var(--fs-md); }
.quick-action small { display: block; font-size: var(--fs-sm); color: var(--text-3); }
.quick-action .icon:last-child { margin-inline-start: auto; color: var(--text-3); transition: transform var(--dur) var(--ease-out); }
.quick-action:hover .icon:last-child { transform: translateX(calc(3px * var(--dir-sign))); color: var(--text); }
.project-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.project-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-subtle); color: var(--text); }
.project-item:last-child { border-bottom: 0; }
.project-item:hover { text-decoration: none; }
.project-item:hover .cell-title { color: var(--accent-text); }
.project-avatar { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); color: #fff; }
.health { display: flex; align-items: center; gap: var(--sp-2); }

/* ------------------------------------------------------------------------------------------------ views: settings */
.settings-layout { display: grid; gap: var(--sp-6); }
.provider-row { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: var(--sp-4) var(--sp-6); padding: var(--sp-5) 0; border-bottom: 1px solid var(--border-subtle); }
.provider-row:first-child { padding-top: var(--sp-1); }
.provider-row:last-child { border-bottom: 0; padding-bottom: var(--sp-1); }
.provider-name { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); font-weight: 600; }
.provider-meta { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.provider-meta p { margin: 0; font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }
.provider-fields { display: grid; gap: var(--sp-3); grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); align-items: start; }
.order-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.order-chip { display: inline-flex; align-items: center; gap: var(--sp-2); height: 28px; padding: 0 var(--sp-2); border-radius: var(--r-full); border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.order-chip:hover { border-style: solid; border-color: var(--accent); color: var(--accent-text); }
.order-chip.is-in { border-style: solid; background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.order-chip .order-n { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--primary); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
/* settings: Your API keys (views/_settings-providers.js) - provider rows like the built-in ones, plus the add form */
.cp-card .card-title .tab-count { margin-inline-start: var(--sp-1); }
.cp-empty { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); margin-bottom: var(--sp-4); border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.cp-empty .icon { flex: none; color: var(--text-3); }
.cp-add { border-top: 1px solid var(--border-subtle); padding-top: var(--sp-5); }
.cp-list:has(.cp-empty) + .cp-add { border-top: 0; padding-top: var(--sp-1); }
.cp-main { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.cp-facts { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--sp-3) var(--sp-5); margin: 0; }
.cp-facts > div { min-width: 0; }
.cp-facts dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.cp-facts dd { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; }
.cp-hint { margin-inline-start: var(--sp-1); }
.cp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.cp-remove { --btn-fg: var(--failed-fg); }
.cp-test { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; margin-inline-start: var(--sp-1); }
.cp-test:empty { display: none; }
.cp-test-detail { overflow-wrap: anywhere; }
.cp-fields { --cols: 2; }
.cp-span { grid-column: 1 / -1; }
.cp-form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding-top: var(--sp-1); }
.cp-row.is-editing .provider-meta p { max-width: 32ch; }
@media (max-width: 1240px) { .cp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-facts > div:first-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .cp-facts { grid-template-columns: minmax(0, 1fr); } .cp-form-actions .btn { flex: 1 1 auto; } }
/* settings: the provider gallery "Add an AI provider" (views/_settings-providers.js) - one tile per platform */
.pg-status { display: flex; flex-direction: column; gap: var(--sp-1); margin-block-end: var(--sp-4); color: var(--text-2); }
.pg-status p { margin: 0; display: flex; align-items: flex-start; gap: var(--sp-2); overflow-wrap: anywhere; }
.pg-status .icon { flex: none; margin-block-start: 2px; color: var(--text-3); }
.pg-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.pg-tile { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-3); border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.pg-tile.is-added { border-color: var(--passed-fg); }
.pg-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; border-radius: 8px; }
.pg-pick:hover .pg-name { color: var(--accent-text); }
.pg-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pg-name { font-weight: 600; color: var(--text); }
.pg-note { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.4; }
.pg-foot, .pg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.pg-many { margin: 0; }
.pg-remove-list { margin: var(--sp-2) 0 0; padding-inline-start: var(--sp-5); color: var(--text-2); }
.result-list { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-4) 0 0; padding: 0; list-style: none; }
.result-item { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-md); animation: rise-in var(--dur-slow) var(--ease-out) both; }
.result-item b { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600; }
.result-item .muted { margin-inline-start: auto; text-align: end; font-size: var(--fs-sm); }
.env-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.env-item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4); border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.env-item .env-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.env-item.is-ok .env-icon { background: var(--passed-bg); color: var(--passed-fg); }
.env-item.is-missing .env-icon { background: var(--warning-bg); color: var(--warning-fg); }
.env-item.is-bad .env-icon { background: var(--failed-bg); color: var(--failed-fg); }
.env-item b { display: block; font-size: var(--fs-md); }
.env-item small { display: block; font-size: var(--fs-sm); color: var(--text-3); word-break: break-word; }
.engine-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-subtle); }
.engine-row:last-child { border-bottom: 0; }
.engine-name { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; }

/* ------------------------------------------------------------------------------------------------ views: docs */
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: var(--sp-6); align-items: start; }
.docs-nav, .docs-toc { position: sticky; top: calc(var(--topbar-h) + 20px); max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; }
.docs-nav .input-with-icon { margin-bottom: var(--sp-2); }
.docs-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.docs-link { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2); border-radius: 10px; color: var(--text-2); transition: background var(--dur-fast), color var(--dur-fast); }
.docs-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.docs-link.is-active { background: var(--accent-soft); color: var(--accent-text); }
.docs-link .icon { margin-top: 2px; color: var(--text-3); }
.docs-link.is-active .icon { color: var(--accent-text); }
.docs-link b { display: block; font-size: var(--fs-md); font-weight: 600; }
.docs-link small { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.docs-article { padding: var(--sp-10) var(--sp-12) var(--sp-12); }
.docs-article-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-6); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.docs-toc-title { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.toc-list { margin: 0; padding: 0; list-style: none; border-inline-start: 2px solid var(--border); }
.toc-link { display: block; margin-inline-start: -2px; padding: var(--sp-1) 0 var(--sp-1) var(--sp-3); border-inline-start: 2px solid transparent; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.4; transition: color var(--dur-fast), border-color var(--dur-fast); }
.toc-link:hover { color: var(--text); text-decoration: none; }
.toc-link.is-active { color: var(--accent-text); border-inline-start-color: var(--accent); font-weight: 600; }
.toc-l3 { padding-inline-start: var(--sp-6); font-size: var(--fs-sm); }
.docs-mobile-nav { display: none; }

/* ------------------------------------------------------------------------------------------------ auth: sign-in page, user menu, roles */
/* login.html: a calm card centred on a subtle branded backdrop; light and dark from the tokens; 360 px safe */
.auth-page { min-height: 100vh; min-height: 100dvh; }
.auth {
  position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: var(--sp-4) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-4) max(var(--sp-4), env(safe-area-inset-left)); overflow: hidden;
}
.auth-backdrop {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -12%, var(--accent-soft-2), transparent 62%),
    radial-gradient(760px 480px at 108% 112%, color-mix(in srgb, var(--series-7) 14%, transparent), transparent 64%),
    var(--bg);
}
.auth-backdrop::after {
  content: ""; position: absolute; inset: 0; opacity: .55;
  background-image: radial-gradient(color-mix(in srgb, var(--text-3) 22%, transparent) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.auth-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--sp-1) 0; }
.auth-brand { pointer-events: none; }
.auth-main { flex: 1; display: grid; place-items: center; padding: var(--sp-6) 0 var(--sp-8); outline: none; }
.auth-card {
  width: min(420px, 100%); padding: var(--sp-8) var(--sp-8) var(--sp-6); border-radius: var(--r-xl); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-xl);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.auth-card.is-ready { animation: auth-in .55s var(--ease-out) both; }
.auth-card-head { margin-bottom: var(--sp-5); }
.auth-badge {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-4); border-radius: 13px;
  background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}
.auth-title { margin: 0 0 var(--sp-2); font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.02em; }
.auth-sub { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; }
.auth-alert { margin-bottom: var(--sp-4); }
.auth-alert .callout { animation: rise-in var(--dur-slow) var(--ease-out); }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-form .input { height: 42px; font-size: var(--fs-lg); }
.auth-form .input-addon-btn { height: 34px; }
.auth-remember { padding: 2px 0; }
.auth-submit { margin-top: var(--sp-1); }
.auth-submit .icon { transition: transform var(--dur) var(--ease-out); }
.auth-submit:hover .icon { transform: translateX(calc(3px * var(--dir-sign))); }
.auth-help { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-5) 0 0; padding-top: var(--sp-4); border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }
.auth-help .icon { flex: none; margin-top: 1px; }
.auth-sso-box { margin-bottom: var(--sp-4); }
.auth-sso { justify-content: center; }
.auth-divider { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-4); color: var(--text-3); font-size: var(--fs-sm); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }
.auth-help a { color: var(--accent, inherit); text-decoration: underline; }
.auth-alt { margin: var(--sp-4) 0 0; padding: var(--sp-4); border-radius: var(--r-lg); background: var(--accent-soft); display: flex; flex-direction: column; gap: var(--sp-3); }
.auth-alt[hidden] { display: none; }
.auth-alt-title { margin: 0; font-weight: 700; display: flex; align-items: center; gap: var(--sp-2); }
.auth-alt-sub { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.auth-alt-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.auth-alt-actions .btn { flex: 1 1 auto; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-1) var(--sp-2); padding: var(--sp-1) 0; font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
@keyframes auth-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.reduce-motion .auth-card.is-ready, .reduce-motion .auth-alert .callout { animation: none; }
@media (prefers-reduced-motion: reduce) { .auth-card.is-ready, .auth-alert .callout { animation: none; } }
@media (max-width: 480px) {
  .auth-main { padding: var(--sp-4) 0 var(--sp-5); place-items: start center; }
  .auth-card { padding: var(--sp-6) var(--sp-4) var(--sp-5); border-radius: var(--r-lg); }
  .auth-title { font-size: var(--fs-2xl); }
  .auth-foot span:last-child, .auth-foot span[aria-hidden] { display: none; }
}
/* login.html, wide screens: the sign-in card beside a showcase of what qa-agent does (a dark branded panel in both
   themes, its illustration drawn inline so it follows these styles). Below 960 px only the card shows. */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; gap: clamp(32px, 4.5vw, 64px); width: min(1120px, 100%); }
.auth-showcase { display: none; }
.auth-card { position: relative; }
.auth-card::before {
  content: ""; position: absolute; top: -1px; inset-inline: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--brand-grad); opacity: .9;
}
@media (min-width: 960px) {
  .auth-layout { grid-template-columns: minmax(0, 1.08fr) minmax(360px, 420px); justify-items: stretch; }
  .auth-layout > .auth-card { justify-self: center; }
  .auth-showcase {
    position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-4);
    padding: 34px 40px 30px; border-radius: 28px; color: #fff;
    background:
      radial-gradient(520px 340px at 92% 18%, rgba(130, 102, 255, .45), transparent 70%),
      radial-gradient(460px 320px at 0% 100%, rgba(56, 116, 255, .35), transparent 70%),
      linear-gradient(155deg, #0a1230 0%, #142468 52%, #3d2a9e 100%);
    box-shadow: 0 40px 90px -30px rgba(20, 36, 104, .55), inset 0 0 0 1px rgba(255, 255, 255, .08);
    animation: auth-in .65s var(--ease-out) both;
  }
  .auth-showcase::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
    background-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: 36px 36px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 45%, #000 15%, transparent 80%);
    mask-image: radial-gradient(ellipse 80% 70% at 70% 45%, #000 15%, transparent 80%);
  }
}
[data-theme="dark"] .auth-showcase { box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 255, 255, .1); }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 0; padding: 5px 12px 5px 10px;
  border-radius: var(--r-full); background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  color: #e4e9ff; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.auth-eyebrow .icon { color: #b9c8ff; }
.auth-hero-title {
  margin: 4px 0 0; max-width: 17ch; font-family: var(--font-display); font-size: clamp(28px, 2.7vw, 38px); font-weight: 700;
  line-height: 1.12; letter-spacing: -.025em; color: #fff; text-wrap: balance;
}
.auth-hero-sub { margin: 0; max-width: 48ch; color: rgba(228, 233, 255, .84); font-size: var(--fs-md); line-height: 1.6; }
.auth-art { margin: 4px -8px 0; }
.auth-art svg { display: block; width: 100%; height: auto; max-height: 230px; overflow: visible; }
/* the illustration's parts (classes on the inline SVG) */
.la-glass { fill: rgba(255, 255, 255, .07); stroke: rgba(255, 255, 255, .18); stroke-width: 1; }
.la-glass-strong { fill: rgba(17, 26, 74, .78); stroke: rgba(255, 255, 255, .2); }
.la-dot { fill: rgba(255, 255, 255, .28); }
.la-pill, .la-chip { fill: rgba(255, 255, 255, .12); }
.la-rule { stroke: rgba(255, 255, 255, .12); stroke-width: 1; }
.la-line { fill: rgba(255, 255, 255, .55); }
.la-line-2 { fill: rgba(255, 255, 255, .24); }
.la-ok { fill: #22c55e; }
.la-fail { fill: #f87171; }
.la-heal { fill: #a78bfa; }
.la-mark, .la-hex-mark { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.la-hex-mark { stroke-width: 4; }
.la-heal-band { fill: rgba(167, 139, 250, .14); stroke: rgba(167, 139, 250, .45); stroke-width: 1; }
.la-heal-ring { fill: none; stroke: #c4b5fd; stroke-width: 1.5; stroke-dasharray: 4 5; transform-box: fill-box; transform-origin: center; animation: la-spin 6s linear infinite; }
.la-chip-heal { fill: rgba(167, 139, 250, .55); }
.la-chip-fail { fill: rgba(248, 113, 113, .55); }
.la-link { fill: none; stroke: rgba(170, 190, 255, .35); stroke-width: 1.5; stroke-dasharray: 3 5; }
.la-link-live { stroke: #c4b5fd; stroke-width: 2; animation: la-flow 1.4s linear infinite; }
.la-orbit { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1; stroke-dasharray: 2 7; transform-box: fill-box; transform-origin: center; animation: la-spin 24s linear infinite; }
.la-hex { stroke: rgba(255, 255, 255, .55); stroke-width: 1.5; filter: drop-shadow(0 10px 22px rgba(80, 90, 255, .55)); }
.la-glow { animation: la-pulse 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.la-spark { fill: #dbe4ff; animation: la-twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.la-spark-2 { animation-delay: -1.1s; }
.la-spark-3 { animation-delay: -2.2s; }
.la-bar { fill: rgba(255, 255, 255, .26); }
.la-report { filter: drop-shadow(0 14px 24px rgba(5, 10, 40, .45)); }
@keyframes la-flow { to { stroke-dashoffset: -16; } }
@keyframes la-spin { to { transform: rotate(360deg); } }
@keyframes la-pulse { 50% { opacity: .55; transform: scale(.9); } }
@keyframes la-twinkle { 50% { opacity: .35; transform: scale(.7); } }
.auth-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.auth-flow li {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  color: #eef1ff; font-size: var(--fs-xs); font-weight: 600; text-align: center; overflow-wrap: anywhere;
}
/* the line from one step's icon to the next (inline-start to inline-end, so it follows right-to-left too) */
.auth-flow li + li::before {
  content: ""; position: absolute; top: 15px; inset-inline-end: calc(50% + 20px); width: calc(100% - 40px); height: 1px;
  background: rgba(255, 255, 255, .32);
}
.auth-flow-icon {
  position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); color: #c9d5ff;
}
.auth-points { display: grid; gap: 8px; margin: 2px 0 0; padding: 14px 0 0; list-style: none; border-top: 1px solid rgba(255, 255, 255, .12); }
.auth-points li { display: flex; align-items: center; gap: 10px; color: rgba(236, 240, 255, .92); font-size: var(--fs-md); }
.auth-points .icon { flex: none; color: #6ee7b7; }
.reduce-motion .auth-showcase, .reduce-motion .auth-showcase * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .auth-showcase, .auth-showcase * { animation: none !important; } }
/* laptop-height screens: the panel keeps to the card's height band (no page scroll at 1280 x 800) */
@media (min-width: 960px) and (max-height: 880px) { .auth-points { display: none; } .auth-main { padding-block: var(--sp-3) var(--sp-4); } }
@media (min-width: 960px) and (max-height: 700px) { .auth-art { display: none; } }
@media (min-width: 960px) and (min-height: 900px) { .auth-art svg { max-height: 290px; } }


/* live password rules (first start, change password) */
.pw-rules { display: grid; gap: var(--sp-1); margin: calc(-1 * var(--sp-2)) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-3); }
.pw-rules li { display: flex; align-items: center; gap: var(--sp-2); transition: color var(--dur); }
.pw-rules li .icon { flex: none; color: var(--border-strong); transition: color var(--dur); }
.pw-rules li.is-met { color: var(--passed-fg); }
.pw-rules li.is-met .icon { color: var(--st-passed); }

/* top bar: the user menu (initials avatar, name, role badge) */
.user-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 38px; margin-inline-start: var(--sp-1); padding: 0; padding-inline: var(--sp-1) var(--sp-2); border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; max-width: 230px;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-2); }
.avatar {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.avatar-lg { width: 44px; height: 44px; font-size: var(--fs-lg); }
.user-btn-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; }
.user-btn-text b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 600; }
.user-btn-chev { color: var(--text-3); flex: none; transition: transform var(--dur) var(--ease-out); }
.user-btn[aria-expanded="true"] .user-btn-chev { transform: rotate(180deg); }
.role-badge {
  display: inline-flex; align-items: center; height: 17px; margin-top: 2px; padding: 0 var(--sp-2); border-radius: var(--r-full);
  background: var(--neutral-bg); color: var(--neutral-fg); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.role-badge[data-role="admin"] { background: var(--info-bg); color: var(--info-fg); }
.role-badge[data-role="tester"] { background: var(--running-bg); color: var(--running-fg); }
@media (max-width: 1080px) { .user-btn-text, .user-btn-chev { display: none; } .user-btn { padding: 0 var(--sp-1); gap: 0; } }

/* write controls the signed-in role cannot use (core.js guardWrites): still visible, dimmed, explained by the tooltip */
[data-write].is-locked { opacity: .5; cursor: not-allowed; filter: saturate(.6); }
.btn[data-write].is-locked:hover { background: var(--btn-bg); }
.btn[data-write].is-locked:active { transform: none; }

/* Settings › Account and › Users */
.account-head { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.account-head b { display: block; font-size: var(--fs-lg); }
.user-cell { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.user-cell .avatar { width: 30px; height: 30px; font-size: var(--fs-xs); }
.user-cell b { display: block; font-weight: 600; }
.users-table td { vertical-align: middle; }
.users-table .role-select { width: auto; min-width: 112px; height: 32px; font-size: var(--fs-sm); }

/* Two-step verification and API tokens (Settings › Account / Users, the forced set-up, the sign-in code step) */
.mfa-steps { margin: 0 0 var(--sp-4); padding-inline-start: var(--sp-5); color: var(--text-2); font-size: var(--fs-sm); display: grid; gap: var(--sp-1); }
.mfa-setup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); margin-bottom: var(--sp-4); }
.mfa-qr { flex: none; width: 188px; height: 188px; padding: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.mfa-qr svg { display: block; width: 100%; height: 100%; }
.mfa-key-box { display: grid; gap: var(--sp-2); min-width: 0; flex: 1 1 180px; }
.mfa-key { display: block; font: 600 var(--fs-md)/1.5 var(--font-mono); letter-spacing: .06em; word-break: break-all; user-select: all; }
.recovery-codes { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.recovery-codes li { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); text-align: center; }
.recovery-codes code { font: 600 var(--fs-md) var(--font-mono); letter-spacing: .08em; background: none; border: 0; padding: 0; user-select: all; }
.token-table td { vertical-align: middle; }
.token-table .cell-sub code { font-size: var(--fs-xs); }
@media (max-width: 480px) { .mfa-qr { margin-inline: auto; } .recovery-codes { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------------------------------------ motion */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes drawer-in { from { transform: translateX(calc(100% * var(--dir-sign))); } }
@keyframes drawer-out { to { transform: translateX(calc(100% * var(--dir-sign))); } }
@keyframes drawer-in-left { from { transform: translateX(calc(-100% * var(--dir-sign))); } }
@keyframes drawer-out-left { to { transform: translateX(calc(-100% * var(--dir-sign))); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-in-top { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(calc(28px * var(--dir-sign))); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes menu-in-up { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes palette-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse-ring { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.8); opacity: 0; } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes donut-in { from { stroke-dasharray: 0 100; } }
@keyframes ring-in { from { stroke-dasharray: 0 100; } }
@keyframes indeterminate { from { inset-inline-start: -35%; } to { inset-inline-start: 100%; } }
@keyframes target-flash { 0% { background: var(--accent-soft-2); } 100% { background: transparent; } }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
.view-enter { animation: view-in .3s var(--ease-out); }
.fade-in { animation: fade-in var(--dur-slow) ease-out both; }
.rise-in { animation: rise-in .45s var(--ease-out) both; }
.stagger > * { animation: rise-in .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
.stagger > :nth-child(2) { --i: 1; } .stagger > :nth-child(3) { --i: 2; } .stagger > :nth-child(4) { --i: 3; } .stagger > :nth-child(5) { --i: 4; }
.stagger > :nth-child(6) { --i: 5; } .stagger > :nth-child(7) { --i: 6; } .stagger > :nth-child(8) { --i: 7; } .stagger > :nth-child(9) { --i: 8; }
.stagger > :nth-child(n+10) { --i: 9; }
.no-entrance .stagger > *, .no-entrance .rise-in, .no-entrance .hbar-fill, .no-entrance .stacked-seg, .no-entrance .donut-seg,
.no-entrance .ring-value, .no-entrance .chart-line.is-drawing, .no-entrance .chart-point.is-entering { animation: none; }
.lift { transition: transform var(--dur) var(--ease-out), box-shadow var(--dur); }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(content) { animation: vt-out .14s ease-in both; }
::view-transition-new(content) { animation: vt-in .3s var(--ease-out) both; }

/* ------------------------------------------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 1080px) {
  .grid-main, .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { width: 220px; }
  .provider-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
}
@media (max-width: 860px) {
  :root { --topbar-h: 56px; }
  .app, .is-collapsed .app { grid-template-columns: minmax(0, 1fr); --sidebar-w: 100%; }
  .sidebar {
    position: fixed; inset: var(--topbar-h) 0 auto 0; height: auto; max-height: calc(100vh - var(--topbar-h) - 24px); z-index: 80; padding: var(--sp-3) var(--sp-4) var(--sp-4);
    border-inline-end: 0; border-bottom: 1px solid var(--border); border-radius: 0 0 20px 20px; box-shadow: var(--shadow-xl);
    transform: translateY(calc(-100% - var(--topbar-h))); visibility: hidden; transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
  }
  .app.nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
  .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-1); margin-top: var(--sp-2); }
  .nav-section { grid-column: 1 / -1; padding: var(--sp-2) var(--sp-2) var(--sp-1); }
  .nav-link.is-active::before { display: none; }
  .sidebar-collapse { display: none; }
  .sidebar-hint { display: none; }
  .is-collapsed .brand-text, .is-collapsed .nav-label, .is-collapsed .nav-section, .is-collapsed .sidebar-card { opacity: 1; pointer-events: auto; }
  .is-collapsed .brand-text { display: flex; }
  .is-collapsed .nav-link { justify-content: flex-start; padding: 0 var(--sp-3); gap: var(--sp-3); }
  .is-collapsed .nav-label { width: auto; flex: 1; }
  .is-collapsed .nav-badge { position: static; }
  .is-collapsed .sidebar-head { flex-direction: row; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-slow); }
  .app.nav-open + .nav-scrim, .nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); z-index: 90; }
  .topbar .topbar-toggle { display: inline-grid; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .search-trigger .search-label, .search-trigger kbd { display: none; }
  .content { padding: var(--sp-5) var(--sp-4) calc(var(--sp-12) + var(--sp-6)); }
  .page-title { font-size: var(--fs-2xl); }
  .page-header { margin-bottom: var(--sp-4); }
  .grid-2, .grid-4, .form-grid, .provider-fields { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .option-cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: var(--sp-4); }
  .card.card-flush, .card-flush { padding: 0; }      /* flush cards (tables) stay flush at every width */
  .card-footer { margin: var(--sp-4) calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)); padding: var(--sp-3) var(--sp-4); }
  .card-flush > .card-header { padding: var(--sp-4) var(--sp-4) 0; }
  .table th:first-child, .table td:first-child { padding-inline-start: var(--sp-4); }
  .table th:last-child, .table td:last-child { padding-inline-end: var(--sp-4); }
  .hide-md { display: none !important; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { display: none; }
  .docs-mobile-nav { display: block; margin-bottom: var(--sp-4); }
  .docs-article { padding: var(--sp-6) var(--sp-4) var(--sp-6); }
  .welcome { padding: var(--sp-6) var(--sp-4); }
  .stepper .step:not(.is-current) .step-text { display: none; }
  .modal-footer { padding: var(--sp-3) var(--sp-4); }
  .modal-header { padding: var(--sp-4) var(--sp-4) var(--sp-1) var(--sp-4); }
  .modal-body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: var(--sp-2); }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .ai-pill { width: 34px; padding: 0; justify-content: center; }
  .ai-pill .ai-pill-text { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .stat { padding: var(--sp-4); }
  .stat-value { font-size: var(--fs-2xl); }
  .stat-foot .sparkline { display: none; }
  /* phones: under the top bar, newest first, clear of sticky footers and the thumb zone */
  .toast-stack { inset-inline-start: 16px; inset-inline-end: 16px; top: calc(var(--topbar-h) + 10px); bottom: auto; width: auto; flex-direction: column-reverse; }
  .toast { animation-name: toast-in-top; }
  .palette-backdrop { padding-top: 8vh; }
  .palette-foot { display: none; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
  .hbar { grid-template-columns: minmax(70px, 38%) minmax(0, 1fr) auto; gap: var(--sp-2); }
  .donut-chart { justify-content: center; }
  .crumbs li:not(:last-child), .crumbs li:last-child .crumb-sep { display: none; }
  .check-item { flex-wrap: wrap; }
  .check-item > .btn { margin-inline-start: var(--sp-12); }
  .check-body { flex: 1 1 calc(100% - 50px); }
  .cell-sub { max-width: 22ch; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------------------------------------ accessibility & print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
}
/* Reduced motion keeps "busy" readable instead of frozen on frame 1: spinners turn slowly (no flashing, no travel),
   an indeterminate bar becomes a static half-tone bar, the loading AI dot stays solid. */
@media (prefers-reduced-motion: reduce) {
  .spinner, .btn.is-loading::after { animation: spin 2.4s linear infinite !important; }
  .progress.is-indeterminate .progress-bar { inset-inline-start: 0; width: 100%; opacity: .4; }
  .progress-bar::after { display: none; }
}
:root.reduce-motion .spinner, :root.reduce-motion .btn.is-loading::after { animation: spin 2.4s linear infinite !important; }
:root.reduce-motion .progress.is-indeterminate .progress-bar { inset-inline-start: 0; width: 100%; opacity: .4; }
:root.reduce-motion .progress-bar::after { display: none; }
@media (forced-colors: active) {
  .badge, .btn, .card, .stat, .chip-check-box, .option-card-body { border: 1px solid CanvasText; }
  :focus-visible { outline-color: Highlight; }
  .nav-link.is-active { outline: 2px solid Highlight; }
}
/* ---------------------------------------------------------------------------------------------- languages
   Japanese: the Japanese system fonts first, so Han characters get Japanese glyph shapes (not the Chinese ones of
   "PingFang SC"). Arabic, Hebrew, Devanagari and other CJK scripts are reached through the stack above. */
:root:lang(ja) {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
}

/* language switch in the sign-in header */
.auth-tools { display: flex; align-items: center; gap: var(--sp-2); }
.auth-lang { width: auto; min-width: 150px; height: 36px; }

/* ---------------------------------------------------------------------------------------------- right to left
   The kit uses logical properties (margin-inline-start, inset-inline-end, text-align: start ...), so <html dir="rtl">
   (ar, he, fa, ur) mirrors the layout by itself. What cannot be logical is here: transforms, gradients, background
   positions and the arrow icons. LTR rendering is unchanged (--dir-sign is 1). */
:root { --dir-sign: 1; }
:root[dir="rtl"] { --dir-sign: -1; }
[dir="rtl"] .icon-dir { scale: -1 1; }
[dir="rtl"] select.input { background-position: left 12px center; }
[dir="rtl"] .hbar-fill, [dir="rtl"] .stacked-seg, [dir="rtl"] .rv-bar-track > i { transform-origin: right; }
[dir="rtl"] details.disclosure > summary::before { transform: rotate(135deg); }
[dir="rtl"] details.disclosure[open] > summary::before { transform: rotate(45deg); }
[dir="rtl"] .tabs.is-scroll-end {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--tabs-fade)), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - var(--tabs-fade)), transparent);
}
[dir="rtl"] .tabs.is-scroll-start {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--tabs-fade)), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - var(--tabs-fade)), transparent);
}
/* plots keep their axes left to right (numbers and time run that way in every language); legends and tables mirror */
[dir="rtl"] .chart-host, [dir="rtl"] .sparkline, [dir="rtl"] .ring { direction: ltr; }
[dir="rtl"] .kbd-group, [dir="rtl"] kbd { direction: ltr; unicode-bidi: isolate; }   /* "Ctrl + K" keeps its order */
/* text that comes from the application under test, code and log lines keep their own direction */
[dir="rtl"] pre, [dir="rtl"] code, [dir="rtl"] kbd, [dir="rtl"] .mono { unicode-bidi: plaintext; }
[dir="rtl"] pre, [dir="rtl"] .code, [dir="rtl"] .console { direction: ltr; text-align: left; }
@media print {
  .sidebar, .topbar, .toast-stack, .route-progress, .page-actions, .docs-nav, .docs-toc { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}
