/* AI Launchpad UI.
   Fonts are self-hosted (SIL OFL, licence files in ui/static/ui/fonts/) so font-src 'self' holds. */
@font-face { font-family: "Outfit"; src: url("../fonts/outfit-latin-wght-normal.fdf9c509a809.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/plus-jakarta-sans-latin-wght-normal.7660bd9909fb.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-wght-normal.b058178d7f30.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

/* ===== Tokens ===== */
:root {
  color-scheme: light;
  --bg: #f7f5f0; --bg-2: #efece4; --surface: #ffffff; --surface-2: #fbfaf7; --surface-3: #f3f1eb;
  --ink: #17152b; --ink-2: #4a475c; --ink-3: #6e6a82; --line: #e7e3d9; --line-2: #d3cec1;
  --primary: #5b3df5; --primary-2: #4a2ee0; --primary-ink: #ffffff; --primary-soft: #ece8ff; --primary-text: #4a2ee0;
  --spark: #ff6a3d; --spark-soft: #ffe9e1;
  --ok: #0e7653; --ok-soft: #dcf4ea; --bad: #b92a34; --bad-soft: #fde3e3; --warn: #a15c00; --warn-soft: #fff0d4;
  --run: #1d55d8; --run-soft: #e0eaff; --muted: #6b6880; --muted-soft: #eeecf2;
  --on-solid: #ffffff; /* text on a solid --ok, --bad or --run fill */
  --p1: #2a78d6; --p2: #eb6834; --p3: #1baf7a; --p4: #eda100; --p5: #e87ba4; --p6: #008300; --p7: #6250d6; --p8: #e34948;
  --admin: #f5a524; --admin-nav: #16132a; --admin-nav-2: #221e3b; --admin-nav-ink: #e9e6f7; --admin-nav-ink-2: #a6a0c4; --admin-on: #fff; --admin-nav-line: #2a2545; --admin-nav-line-2: #2d2848; --admin-badge: #ffc65a;
  --radius: 14px; --radius-sm: 10px; --radius-xs: 7px;
  --shadow-1: 0 1px 2px rgba(23, 21, 43, .06), 0 2px 6px rgba(23, 21, 43, .04);
  --shadow-2: 0 2px 4px rgba(23, 21, 43, .05), 0 12px 28px rgba(23, 21, 43, .09);
  --shadow-3: 0 24px 60px rgba(23, 21, 43, .22);
  --display: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #110f18; --bg-2: #181522; --surface: #1c1928; --surface-2: #221f30; --surface-3: #2a2639;
    --ink: #f2f0f9; --ink-2: #c3bed6; --ink-3: #9b96b0; --line: #2e2a3d; --line-2: #3e3851;
    --primary: #8f7dff; --primary-2: #a597ff; --primary-ink: #120f1f; --primary-soft: #2a2352; --primary-text: #b3a8ff;
    --spark: #ff8a63; --spark-soft: #3b1f17;
    --ok: #3fcf9a; --ok-soft: #12352a; --bad: #ff6f73; --bad-soft: #3e1a20; --warn: #f2b440; --warn-soft: #3a2a0d;
    --run: #78a3ff; --run-soft: #1a2747; --muted: #9a95ae; --muted-soft: #2a2638; --on-solid: #120f1f;
    --p1: #3987e5; --p2: #d95926; --p3: #199e70; --p4: #c98500; --p5: #d55181; --p6: #0ca30c; --p7: #9085e9; --p8: #e66767;
    --admin-nav: #0c0a16; --admin-nav-2: #18152a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .35); --shadow-3: 0 24px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #110f18; --bg-2: #181522; --surface: #1c1928; --surface-2: #221f30; --surface-3: #2a2639;
  --ink: #f2f0f9; --ink-2: #c3bed6; --ink-3: #9b96b0; --line: #2e2a3d; --line-2: #3e3851;
  --primary: #8f7dff; --primary-2: #a597ff; --primary-ink: #120f1f; --primary-soft: #2a2352; --primary-text: #b3a8ff;
  --spark: #ff8a63; --spark-soft: #3b1f17;
  --ok: #3fcf9a; --ok-soft: #12352a; --bad: #ff6f73; --bad-soft: #3e1a20; --warn: #f2b440; --warn-soft: #3a2a0d;
  --run: #78a3ff; --run-soft: #1a2747; --muted: #9a95ae; --muted-soft: #2a2638; --on-solid: #120f1f;
  --p1: #3987e5; --p2: #d95926; --p3: #199e70; --p4: #c98500; --p5: #d55181; --p6: #0ca30c; --p7: #9085e9; --p8: #e66767;
  --admin-nav: #0c0a16; --admin-nav-2: #18152a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .35); --shadow-3: 0 24px 60px rgba(0, 0, 0, .6);
}

/* ===== Base ===== */
* { box-sizing: border-box; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend { padding: 0; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 650; line-height: 1.15; }
h2 { font-size: 21px; font-weight: 600; }
h3, .h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 28px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.gauto-s { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .stat .v { font-size: 24px; } }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex: none; }
.ic-sm svg.lucide, svg.lucide.ic-sm { width: 15px; height: 15px; }
.ic-lg svg.lucide { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===== Demo strip ===== */
@media (max-width: 640px) { .wf-head > .picon { display: none; } }

/* ===== Portal shell ===== */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: conic-gradient(from 200deg, #5b3df5, #ff6a3d, #f5a524, #5b3df5); box-shadow: 0 6px 16px rgba(91, 61, 245, .35); }
.brand .logo svg { width: 19px; height: 19px; }
.brand b { font-family: var(--display); font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.brand small { display: block; font-size: 11px; color: var(--ink-3); margin-top: -2px; }
.searchbtn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-3); cursor: pointer; text-align: left; margin-bottom: 8px; }
.searchbtn:hover { border-color: var(--line-2); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-3); background: var(--surface); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; text-decoration: none; position: relative; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); }
/* The count's wrapper is only there to be swapped; it must not affect the link's layout. */
.nav-attn { display: contents; }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 700; background: var(--bad); color: var(--on-solid); border-radius: 99px; padding: 0 7px; }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; padding: 14px 10px 4px; display: flex; align-items: center; }
.nav-h a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.nav .pdot { width: 10px; height: 10px; border-radius: 3px; flex: none; margin: 0 4px; }
.nav .wdot { width: 18px; height: 18px; border-radius: 5px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--pc) 16%, var(--surface)); color: var(--pc); }
.nav .wdot svg { width: 11px; height: 11px; }
.nav-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; padding: 6px 10px 2px; }
.nav-h svg { width: 13px; height: 13px; }
.side .me { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.main { padding: 28px 32px 64px; max-width: 1240px; width: 100%; margin: 0 auto; min-width: 0; }
.topbar-m { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; inset: 0 auto 0 0; top: 0; height: 100vh; width: 280px; z-index: 80; box-shadow: var(--shadow-3); }
  .side.open { display: flex; }
  .topbar-m { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
  .main { padding: 20px 16px 56px; }
  h1 { font-size: 25px; }
}
.scrim { position: fixed; inset: 0; background: rgba(10, 8, 20, .45); z-index: 70; }

/* ===== Admin shell ===== */
.admin-shell .side { background: var(--admin-nav); border-right: 0; color: var(--admin-nav-ink); }
.admin-top { background: var(--admin-nav); color: var(--admin-on); border: 0; }
.admin-top .btn.icon, .admin-on { color: var(--admin-on); }
.admin-me { border-color: var(--admin-nav-line); }
.btn.admin-back { justify-content: flex-start; background: var(--admin-nav-2); color: var(--admin-on); border-color: var(--admin-nav-line-2); }
.admin-me-name { font-weight: 650; color: var(--admin-on); }
.admin-me-role { color: var(--admin-badge); }
.btn.admin-theme { color: var(--admin-nav-ink-2); }
.admin-shell .brand small { color: var(--admin); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.admin-shell .brand .logo { background: linear-gradient(135deg, #f5a524, #ff6a3d); box-shadow: 0 6px 16px rgba(245, 165, 36, .3); color: #1d1206; }
.admin-shell .nav a { color: var(--admin-nav-ink-2); }
.admin-shell .nav a:hover { background: var(--admin-nav-2); color: #fff; }
.admin-shell .nav a[aria-current="page"] { background: rgba(245, 165, 36, .14); color: #ffc65a; }
.admin-shell .nav-h { color: #8c86ab; }
.admin-shell .side .me { border-color: #2a2545; }
.admin-shell .searchbtn { background: var(--admin-nav-2); border-color: #2d2848; color: #a6a0c4; }
.admin-shell .kbd { background: transparent; border-color: #3a3458; color: #a6a0c4; }
.admin-banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--admin) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--admin) 40%, transparent); font-size: 13px; margin-bottom: 20px; }
.admin-banner svg { color: #b36d00; }
:root[data-theme="dark"] .admin-banner svg { color: var(--admin); }
.admin-shell .btn.primary { background: #1f1a3b; color: #fff; }
:root[data-theme="dark"] .admin-shell .btn.primary { background: var(--admin); color: #1d1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .admin-shell .btn.primary { background: var(--admin); color: #1d1206; } :root:not([data-theme="light"]) .admin-banner svg { color: var(--admin); } }

/* ===== Page heads ===== */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
/* With a big icon or avatar in front, centre everything on it, or the title sits low. */
.page-head:has(> .picon, > .avatar) { align-items: center; }
.page-head .grow p { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); }
.crumbs svg { width: 14px; height: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.section-h { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-h h2 { font-size: 18px; }
.section-h .count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); background: var(--surface-3); border-radius: 99px; padding: 1px 8px; }
.section-h a.more { margin-left: auto; font-size: 13px; font-weight: 600; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: transform .12s var(--ease), box-shadow .12s, background .12s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--primary-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn.primary:hover { background: var(--primary-2); }
.btn.spark { background: var(--spark); border-color: transparent; color: #1b0d07; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger.solid { background: var(--bad); color: var(--on-solid); border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.icon { padding: 7px; }
.btn.sm.icon { padding: 5px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-run { min-width: 76px; }

/* ===== Pills, chips, badges ===== */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12.5px; font-weight: 650; white-space: nowrap; line-height: 1.6; }
.pill svg { width: 13px; height: 13px; stroke-width: 2.5; }
.pill.success { background: var(--ok-soft); color: var(--ok); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill.running { background: var(--run-soft); color: var(--run); }
.pill.pending { background: var(--muted-soft); color: var(--ink-2); }
.pill.cancelled, .pill.skipped { background: var(--muted-soft); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.running .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--run) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.chip svg { width: 13px; height: 13px; }
.chip.proj { background: color-mix(in srgb, var(--pc) 13%, var(--surface)); color: var(--ink); border-color: color-mix(in srgb, var(--pc) 30%, transparent); }
.chip.proj .sw { width: 8px; height: 8px; border-radius: 2px; background: var(--pc); }
a.chip:hover { text-decoration: none; filter: brightness(.97); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; letter-spacing: .01em; white-space: nowrap; border: 1px solid var(--line-2); color: var(--ink-2); }
.badge svg { width: 12px; height: 12px; }
.badge.owner { color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.badge.viewer { color: var(--ink-2); }
.badge.runner { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.badge.draft { color: var(--ink-2); background: var(--muted-soft); border-style: dashed; }
.badge.enabled { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.badge.suspended { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.badge.admin { color: #8a5300; border-color: color-mix(in srgb, var(--admin) 60%, transparent); background: color-mix(in srgb, var(--admin) 16%, var(--surface)); }
:root[data-theme="dark"] .badge.admin { color: #ffc65a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.admin { color: #ffc65a; } }
.trig { display: inline-flex; gap: 4px; }
.trig span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); color: var(--ink-2); }
.trig span svg { width: 14px; height: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; background: var(--ac, var(--primary)); }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatars { display: inline-flex; }
.avatars .avatar { border: 2px solid var(--surface); margin-left: -7px; }
.avatars .avatar:first-child { margin-left: 0; }
.picon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--pc) 16%, var(--surface)); color: var(--pc); flex: none; }
.picon.sm { width: 28px; height: 28px; border-radius: 8px; }
.picon.sm svg { width: 15px; height: 15px; }
.picon.lg { width: 56px; height: 56px; border-radius: 16px; }
.picon.lg svg { width: 26px; height: 26px; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card.pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3, .card-h .h3 { font-size: 15px; }
.card-b { padding: 16px 18px; }
.card.hover { transition: transform .15s var(--ease), box-shadow .15s, border-color .15s; cursor: pointer; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.wf-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.wf-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pc); }
.wf-card h3 { font-size: 15.5px; }
.wf-card .desc { color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.wf-card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.pin { color: var(--ink-3); background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 6px; display: inline-grid; }
.pin:hover { color: var(--spark); background: var(--spark-soft); }
.pin.on { color: var(--spark); }
.pin.on svg { fill: var(--spark); }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .v { font-family: var(--display); font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat .d { font-size: 12.5px; color: var(--ink-3); }
.stat.tint { background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 14%, var(--surface)), color-mix(in srgb, var(--pc) 5%, var(--surface))); border-color: color-mix(in srgb, var(--pc) 30%, var(--line)); }
.stat.tint .k { color: var(--ink-2); }
.stat.tint .ti { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--pc); color: #fff; }
.stat.tint .ti svg { width: 14px; height: 14px; }
.stat.tint .d { color: var(--ink-2); }
.stat .d.up { color: var(--ok); } .stat .d.down { color: var(--bad); }

/* ===== Hero ===== */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 14%, var(--surface)) 0%, var(--surface) 55%, color-mix(in srgb, var(--spark) 12%, var(--surface)) 100%); border: 1px solid var(--line); margin-bottom: 24px; }
.hero .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; pointer-events: none; }
.hero h1 { position: relative; }
.hero p { position: relative; color: var(--ink-2); margin-top: 6px; }
.hero .glance { position: relative; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.glance .g { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-1); }
.glance .g b { font-family: var(--display); font-size: 16px; }

/* ===== Tabs & segmented ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--ink-2); font-weight: 600; border: 0; background: none; border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-selected="true"] { color: var(--primary-text); border-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: var(--radius-sm); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-weight: 650; font-size: 13.5px; }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--bad); font-weight: 600; display: flex; gap: 5px; align-items: center; }
.req::after { content: " *"; color: var(--bad); }
.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-width: 0; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input.invalid { border-color: var(--bad); }
textarea.input { min-height: 92px; resize: vertical; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; color: var(--ink-3); width: 17px; height: 17px; pointer-events: none; }
.search .input { padding-left: 36px; }
.search.lg .input { padding: 13px 14px 13px 42px; font-size: 15.5px; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.search.lg svg { left: 15px; width: 19px; height: 19px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.fchip:hover { border-color: var(--ink-3); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.fchip svg { width: 14px; height: 14px; }
.fchip .sw { width: 8px; height: 8px; border-radius: 2px; background: var(--pc); }
select.fsel { padding: 5px 28px 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); padding: 16px; display: flex; align-items: center; gap: 12px; background: var(--surface-2); cursor: pointer; }
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.has { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.locked { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.locked svg { width: 13px; height: 13px; }
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.radio-card { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); }
.radio-card:hover { border-color: var(--line-2); }
.radio-card[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.radio-card b { display: block; font-size: 14px; }
.radio-card small { color: var(--ink-2); font-size: 12.5px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
table.t tr.sel td { background: var(--primary-soft); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
@media (max-width: 720px) {
  table.t.stack thead { display: none; }
  table.t.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.stack td { border: 0; padding: 0; }
  table.t.stack td[data-hide-m] { display: none; }
  table.t.stack td.full { grid-column: 1 / -1; }
}

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--surface-2); }
.li .t1 { font-weight: 600; }
.li .t2 { font-size: 13px; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 22px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* ===== Attention & callouts ===== */
.attn { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.attn .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.attn.bad .ic { background: var(--bad-soft); color: var(--bad); }
.attn.warn .ic { background: var(--warn-soft); color: var(--warn); }
.attn.run .ic { background: var(--run-soft); color: var(--run); }
.attn.ok .ic { background: var(--ok-soft); color: var(--ok); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-3); font-size: 13.5px; color: var(--ink-2); }
.callout.info { background: var(--primary-soft); color: var(--ink); }
.callout.warn { background: var(--warn-soft); color: var(--ink); }
.callout.bad { background: var(--bad-soft); color: var(--ink); }
.callout svg { flex: none; margin-top: 1px; }
.callout.info svg { color: var(--primary-text); } .callout.warn svg { color: var(--warn); } .callout.bad svg { color: var(--bad); }

/* ===== Empty states ===== */
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .art { position: relative; width: 84px; height: 84px; margin-bottom: 6px; }
.empty .art .c1 { position: absolute; inset: 8px; border-radius: 26px; background: var(--primary-soft); transform: rotate(-8deg); }
.empty .art .c2 { position: absolute; right: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--spark-soft); border: 2px solid var(--spark); }
.empty .art .ic { position: absolute; inset: 0; display: grid; place-items: center; color: var(--primary-text); }
.empty .art .ic svg { width: 32px; height: 32px; }
.empty h3 { color: var(--ink); }

/* ===== Project cards (variant B) ===== */
.proj-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.proj-card .band { height: 72px; position: relative; background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 85%, #000 0%), color-mix(in srgb, var(--pc) 55%, var(--spark) 25%)); }
.proj-card .band .pattern { position: absolute; inset: 0; opacity: .22; background-image: radial-gradient(circle at 1px 1px, #fff 1.2px, transparent 0); background-size: 14px 14px; }
.proj-card .band .picon { position: absolute; left: 16px; bottom: -20px; background: var(--surface); box-shadow: var(--shadow-2); width: 46px; height: 46px; border-radius: 14px; }
.proj-card .body { padding: 28px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.proj-card .meta { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.proj-card .meta span { display: inline-flex; gap: 5px; align-items: center; }
.proj-card .meta svg { width: 14px; height: 14px; color: var(--ink-3); }

.action-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; width: 100%; }
.action-card b { display: block; font-size: 15.5px; font-family: var(--display); }
.action-card > svg { color: var(--ink-3); }
.action-card:hover > svg { color: var(--ink); }
.pchip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 6px; border-radius: 99px; background: color-mix(in srgb, var(--pc) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pc) 32%, transparent); font-weight: 650; font-size: 14px; cursor: pointer; color: var(--ink); text-decoration: none !important; transition: transform .12s var(--ease), box-shadow .12s; }
.pchip:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.pchip .pi { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); color: #fff; }
.pchip .pi svg { width: 14px; height: 14px; }
.pchip .n { font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--surface); border-radius: 99px; padding: 0 7px; }
.pchip .pin { padding: 3px; }
.pchip.add { background: transparent; border: 1.5px dashed var(--line-2); color: var(--ink-3); padding: 7px 14px; font-weight: 600; }
.pchip.add:hover { border-color: var(--primary); color: var(--primary-text); box-shadow: none; }
.wf-line { display: grid; grid-template-columns: auto minmax(0, 2fr) minmax(0, 1.2fr) 132px 32px 112px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wf-line:last-child { border-bottom: 0; }
.wf-line:hover { background: var(--surface-2); }
.wf-line .btn-run { min-width: 0; width: 100%; }
@media (max-width: 720px) { .wf-line { grid-template-columns: auto minmax(0, 1fr) auto minmax(76px, auto); } .wf-line .hide-m { display: none; } .wf-line .show-m { display: block !important; } }

.wl-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.7fr) 112px 214px; gap: 14px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.wl-row:last-child { border-bottom: 0; }
.wl-row[data-href] { cursor: pointer; }
.wl-row:hover { background: var(--surface-2); }
.wl-row .nm { font-weight: 650; }
.path { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-3); border-radius: 6px; padding: 2px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.path svg { width: 12px; height: 12px; color: var(--ink-3); }
.path .sep { color: var(--ink-3); margin: 0 1px; }
@media (max-width: 1100px) { .wl-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) 150px; } .wl-row > :nth-child(3) { display: none; } }
@media (max-width: 720px) { .wl-row { grid-template-columns: minmax(0, 1fr) auto; } .wl-row .hide-m, .wl-row .trig.hide-m { display: none; } }

/* ===== Smart list (variant C) ===== */
.group { margin-bottom: 14px; }
.group-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; border-radius: var(--radius-sm); }
.group-h:hover { background: var(--surface-3); }
.group-h .chev { transition: transform .15s; color: var(--ink-3); }
.group-h[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.wf-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.wf-row:last-child { border-bottom: 0; }
.wf-row:hover { background: var(--surface-2); }
.wf-row .nm { font-weight: 650; }
@media (max-width: 720px) { .wf-row { grid-template-columns: minmax(0, 1fr) auto; } .wf-row .hide-m { display: none; } }

/* ===== Workflow header ===== */
.wf-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.wf-head .picon { width: 54px; height: 54px; border-radius: 16px; }
.wf-head .picon svg { width: 26px; height: 26px; }
.wf-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.wf-head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 720px) { .wf-head .actions { margin-left: 0; width: 100%; } }

/* ===== Run detail ===== */
.steps { display: flex; flex-direction: column; }
.step { border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; cursor: pointer; }
.step > button:hover { background: var(--surface-2); }
.step .sn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.step .sn.success { background: var(--ok); color: var(--on-solid); } .step .sn.failed { background: var(--bad); color: var(--on-solid); } .step .sn.running { background: var(--run); color: var(--on-solid); animation: pulse 1.4s infinite; } .step .sn.pending, .step .sn.skipped { background: var(--muted-soft); color: var(--muted); }
.step .sn svg { width: 14px; height: 14px; stroke-width: 3; }
.logs { background: #14121d; color: #e3e0f0; font: 12.5px/1.65 var(--mono); padding: 12px 16px; border-radius: var(--radius-sm); overflow-x: auto; max-height: 360px; overflow-y: auto; }
.logs .ln { display: flex; gap: 12px; white-space: pre-wrap; }
.logs .ts { color: #7f7a99; flex: none; }
.logs .warning { color: #ffcf6b; } .logs .error { color: #ff8b8f; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--spark)); border-radius: 99px; transition: width .4s var(--ease); }

/* ===== Charts ===== */
.chart-card .card-h { flex-wrap: wrap; }
.chart-card .sub { font-size: 12.5px; color: var(--ink-3); }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .xh, .chart .col:hover .xh { opacity: 1; }
.chart .mark { transition: opacity .12s; }
.chart.dim .mark { opacity: .35; }
.chart.dim .mark.on { opacity: 1; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 11px; border-radius: 9px; font-size: 12.5px; box-shadow: var(--shadow-3); max-width: 260px; opacity: 0; transition: opacity .08s; }
.tip.on { opacity: 1; }
.tip b { font-weight: 700; }
.tip .tr { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip .tr i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.spark-wrap { display: flex; align-items: flex-end; gap: 2px; height: 28px; }
.spark-wrap span { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--pc, var(--primary)); opacity: .85; min-height: 2px; }
.ring { --v: 80; --c: var(--ok); width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: attr(data-l); width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink); }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .track { height: 12px; border-radius: 4px; background: transparent; position: relative; }
.hbar .fill { height: 100%; border-radius: 1px 4px 4px 1px; background: var(--c, var(--p1)); min-width: 3px; }

/* ===== Matrix ===== */
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 200px; }
.matrix thead th { font-size: 12px; vertical-align: bottom; background: var(--surface-2); }
.matrix thead th:first-child { background: var(--surface-2); }
.matrix td.cell { cursor: pointer; }
.matrix td.cell:hover { background: var(--primary-soft); }
.mx { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 11.5px; }
.mx.o { background: var(--primary-soft); color: var(--primary-text); }
.mx.v { background: var(--surface-3); color: var(--ink-2); }
.mx.r { background: var(--warn-soft); color: var(--warn); }
.mx.n { color: var(--line-2); }
.mx.wf { gap: 3px; display: inline-flex; background: transparent; border: 1px dashed var(--line-2); color: var(--ink-2); }
.mx.wf svg { width: 11px; height: 11px; }
.vmatrix th.vth { vertical-align: bottom; padding: 8px 4px; min-width: 46px; width: 46px; }
.vmatrix th.vth.sub { background: var(--surface-3); }
.vmatrix .vt { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; max-height: 210px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 650; color: var(--ink); text-align: left; }
.vmatrix th.sub .vt { font-weight: 500; color: var(--ink-2); }
.vbtn { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; padding: 4px 2px; border-radius: 8px; color: var(--ink-3); }
.vbtn:hover { background: var(--surface-3); }
.vbtn[aria-expanded="true"] { background: var(--primary-soft); }
.vmatrix th.corner { vertical-align: bottom; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.vmatrix td.sub { background: color-mix(in srgb, var(--surface-3) 45%, transparent); }
.vmatrix td.cell { white-space: nowrap; }

/* ===== Dialog, drawer, toast, palette ===== */
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(14, 11, 26, .5); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-h { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 12px; }
.dlg-b { padding: 6px 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; border-radius: 18px 0 0 18px; width: min(560px, 100vw); }
dialog.drawer[open] { animation: slide .2s var(--ease); display: flex; flex-direction: column; }
dialog.drawer .dlg-b { overflow-y: auto; flex: 1; }
dialog.drawer .dlg-f { border-radius: 0; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.steps-ind { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-3); font-weight: 600; flex-wrap: wrap; }
.steps-ind span { display: inline-flex; align-items: center; gap: 6px; }
.steps-ind i { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; background: var(--surface-3); font-size: 11.5px; }
.steps-ind .on { color: var(--ink); } .steps-ind .on i { background: var(--primary); color: var(--primary-ink); }
.steps-ind .done i { background: var(--ok); color: var(--on-solid); }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-3); font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; animation: pop .2s var(--ease); }
.toast svg { color: var(--ok); }
.palette-list { max-height: 360px; overflow-y: auto; border-top: 1px solid var(--line); }
.palette-list .li, .hero-results .li { border: 0; border-radius: 9px; margin: 2px 8px; }
.palette-list .li[aria-selected="true"], .hero-results .li[aria-selected="true"] { background: var(--primary-soft); }
.palette-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 10px 18px 4px; }
.popover { position: absolute; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 12px 14px; font-size: 13px; width: 280px; }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 18px; }
.tl .dot { position: absolute; left: -26px; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-2); }
.tl .dot svg { width: 12px; height: 12px; }
.tl .dot.access { border-color: var(--primary); color: var(--primary-text); }
.tl .dot.availability { border-color: var(--ok); color: var(--ok); }
.tl .dot.config { border-color: var(--p2); color: var(--p2); }
.tl .dot.admin { border-color: var(--admin); color: #b36d00; }

/* ===== UI kit ===== */
.swatch { border-radius: 12px; border: 1px solid var(--line); overflow: hidden; font-size: 12px; }
.swatch div { height: 54px; }
.swatch p { padding: 6px 9px; }
.kit-sec { margin-bottom: 44px; scroll-margin-top: 110px; }
.kit-item.stack { grid-template-columns: minmax(0, 1fr); }
.kit-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
.kit-toc .fchip span { margin-right: 2px; }
.kit-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.kit-label { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.kit-label b { font-size: 13.5px; }
.kit-demo { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; }
@media (max-width: 720px) { .kit-item { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.kit-sec > h2 { margin-bottom: 4px; }
.kit-sec > p { color: var(--ink-2); margin-bottom: 14px; }

/* ===== Additions for the real app (not in the prototype) ===== */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 400; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); }
.skip:focus { left: 8px; }
/* Staging marker: a bright pill fixed top-right, so it is hard to miss and never
   pushes the page down. Same solid amber in both themes; dark text for contrast. */
.staging-banner { position: fixed; right: 16px; top: 12px; z-index: 250; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--admin); color: #241500; border: 1px solid #e08e00; box-shadow: 0 6px 18px color-mix(in srgb, var(--admin) 45%, transparent), var(--shadow-2); font-size: 13px; font-weight: 700; line-height: 1.3; }
.staging-banner .sb-dot { width: 8px; height: 8px; border-radius: 50%; background: #241500; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, #fff 45%, transparent); }
.staging-banner .sb-sep { opacity: .55; }
/* Phones: the top bar holds the menu, logo and search, so sit just under it. */
@media (max-width: 860px) { body:has(.topbar-m) .staging-banner { top: 64px; right: 12px; } }
.staging-banner a { color: inherit; text-decoration: underline; }
@media print { .staging-banner { display: none; } }
.nav .navbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font-weight: 550; text-align: left; cursor: pointer; }
.nav .navbtn:hover { background: var(--surface-3); color: var(--ink); }
.admin-shell .nav .navbtn { color: var(--admin-nav-ink-2); }
.admin-shell .nav .navbtn:hover { background: var(--admin-nav-2); color: #fff; }
.main:focus { outline: none; }
.toast.bad svg { color: var(--bad); }
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }

/* ===== Components: basics group ===== */

/* Text for screen readers only, for example why a run button is disabled. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Count bubble outside the side bar (the prototype styled these inline or only inside .nav). */
.count-alert, .count-soft { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 1.6; }
.count-alert { background: var(--bad); color: var(--on-solid); }
.count-soft { font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-3); padding: 1px 8px; }

/* Kit type scale samples: look like h1 to h3 without adding headings to the page outline. */
.type-h1, .type-h2, .type-h3 { font-family: var(--display); letter-spacing: -.01em; }
.type-h1 { font-size: 30px; font-weight: 650; line-height: 1.15; }
.type-h2 { font-size: 21px; font-weight: 600; }
.type-h3 { font-size: 16px; font-weight: 600; }

/* ===== Components: layout group ===== */
   Mostly the prototype's inline styles moved into classes, plus the bits the real
   markup needs (title links inside clickable cards, a screen-reader-only class). */

.minw0 { min-width: 0; }

/* Title links inside clickable cards and rows look like the plain title. */
.card-link { color: inherit; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
[data-href] { cursor: pointer; }

/* Kit helpers: demos that should use the full width. */
.kit-wide { width: 100%; min-width: 0; }
.kit-tab-panel { padding: 4px 2px; }
.kit-demo .tabs { margin: 0; }

/* Flush variants (the prototype kit sets margin:0 inline). */
.crumbs.flush, .section-h.flush, .glance.flush, .wf-head.flush { margin: 0; }
.glance { display: flex; gap: 10px; flex-wrap: wrap; }
.pager.bare { border: 0; padding: 0; }

/* Side bar previews: the side bar's links inside a page. */
.nav-preview { padding: 8px; width: 260px; max-width: 100%; }
.nav-preview .nav-h-t { margin-left: 6px; }
.nav-preview .nav-empty { padding: 2px 10px 6px; }
/* The kit sits inside the admin shell: put the portal look back on the portal preview. */
.admin-shell .nav-preview.portal a { color: var(--ink-2); }
.admin-shell .nav-preview.portal a:hover { background: var(--surface-3); color: var(--ink); }
.admin-shell .nav-preview.portal a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); }
.admin-shell .nav-preview.portal .nav-h { color: var(--ink-3); }
.admin-shell .nav-preview.admin { background: var(--admin-nav); border: 0; color: var(--admin-nav-ink); border-radius: 12px; }

/* Search hero */
.hero-search { text-align: center; padding: 34px 28px; overflow: visible; }
/* The blobs are clipped by their own layer, so the results dropdown can hang below the box. */
.hero-bg { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.hero-search .blob-a { width: 220px; height: 220px; right: -60px; top: -90px; background: radial-gradient(circle, var(--spark), transparent 70%); }
.hero-search .blob-b { width: 180px; height: 180px; right: 140px; bottom: -120px; background: radial-gradient(circle, var(--primary), transparent 70%); }
.hero-search .hero-title { position: relative; font-size: 30px; font-weight: 650; line-height: 1.15; }
.hero-form { max-width: 620px; margin: 18px auto 0; position: relative; }
.hero-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; text-align: left; }
.kit-demo .hero-search { margin: 0; }

/* Headers */
.wf-head-desc { max-width: 72ch; }

/* Cards */
.proj-desc { min-height: 40px; }
.headline { flex-direction: row; align-items: center; gap: 18px; }
a.action-card { text-decoration: none; }

/* Lists */
.wf-line-t { display: block; }
.wl-access { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wl-paths { max-width: 100%; flex-wrap: nowrap; }
.wl-why { padding: 0; }
.wl-more { padding: 1px 6px; flex: none; }
.wl-actions { justify-content: flex-end; }
.run-gap { width: 76px; }
.group-row { gap: 4px; }
.group-hd { margin: 0; font: inherit; flex: 1; min-width: 0; }
.group-h .gt { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
.group-sub { max-width: 46ch; }
ol.timeline { list-style: none; margin: 0; }

/* ===== Components: feedback group ===== */
   Only what the real markup needs beyond the prototype: real inputs inside styled boxes,
   lists that are <ol>/<ul>, and styles the prototype set inline. */


/* Toast levels (ok and bad are in ui.css) */
.toast.warn svg { color: var(--warn); }
.toast.info svg { color: inherit; }

/* Empty state text width, was inline in the prototype */
.empty .empty-text { max-width: 42ch; }

/* File drop zone: a label around a hidden file input */
.dropzone:focus-within { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }

/* List of values box, was inline in the prototype */
.lov { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface); }
.lov:focus-within { outline: 2.5px solid var(--primary); outline-offset: 1px; }
.lov.invalid { border-color: var(--bad); }
.lov .input { border: 0; padding: 4px; width: 140px; flex: 1; min-width: 100px; box-shadow: none; background: transparent; }
.lov .input:focus { outline: none; }
.lov-x { display: inline-grid; place-items: center; border: 0; background: none; padding: 0; margin: 0 -3px 0 0; color: var(--ink-3); cursor: pointer; border-radius: 50%; }
.lov-x:hover { color: var(--ink); }

/* Filter chip count, was inline */
.fchip-n { color: var(--ink-3); }
.fchip[aria-pressed="true"] .fchip-n { color: inherit; opacity: .8; }

/* Choice cards with real radios */
.choice-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice-set legend { padding: 0; margin-bottom: 6px; }
.radio-cards.stacked { grid-template-columns: 1fr; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card:has(input:focus-visible) { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.radio-card svg { flex: none; }

/* Wizard steps as a list */
.steps-ind { list-style: none; margin: 0; padding: 0; }
.steps-ind li { display: inline-flex; align-items: center; gap: 6px; }
.steps-ind .steps-sep { color: var(--ink-3); }

/* Dialog parts */
.dlg-sub { margin-top: 4px; }
.why-reasons { list-style: none; margin: 0; padding: 0; }
.why-ok { color: var(--ok); }
ul.list { list-style: none; margin: 0; padding: 0; }

/* Command palette */
.palette-q { padding: 14px 14px 8px; }
.palette-keys { justify-content: space-between; }
.palette-list a.li, .hero-results a.li { text-decoration: none; color: inherit; }
.palette-list .pal-enter, .hero-results .pal-enter { visibility: hidden; display: inline-flex; }
.palette-list .li[aria-selected="true"] .pal-enter, .hero-results .li[aria-selected="true"] .pal-enter { visibility: visible; }
.palette .search .input::-webkit-search-cancel-button { display: none; }

/* Drawer: let the body scroll between a fixed head and foot */
dialog.drawer #dlg-body, dialog.drawer #dlg-body > [data-dialog-size] { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.drawer-card-h { padding: 10px 14px; }
.drawer-li { padding: 8px 14px; align-items: flex-start; }

/* Wizard summary, was inline */
.wiz-summary { background: var(--primary-soft); border: 0; }
.wiz-plain { font-size: 16px; }

/* Kit only: demos that span the row */
.kit-full { width: 100%; }
.kit-flush { margin: 0; }

/* ===== Components: data group ===== */

/* Text only screen readers get (cell letters, chart table captions). */

/* Sortable table headers: the whole header is the link, arrow shows the direction. */
table.t th .th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
table.t th .th-sort:hover { color: var(--ink); }
table.t th .th-sort svg { width: 13px; height: 13px; }
table.t th[aria-sort="ascending"], table.t th[aria-sort="descending"] { color: var(--ink); }
table.t th.num .th-sort { justify-content: flex-end; }
/* The empty row spans the whole table, also when rows stack on phones. */
table.t tr.empty-row td { padding: 0; }
@media (max-width: 720px) { table.t.stack tr.empty-row { display: block; } }

/* Row headers in chart tables and the access grid look like normal cells. */
table.t th.chart-rowh { text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; font-weight: inherit; background: none; padding: 11px 14px; white-space: normal; border-bottom: 1px solid var(--line); }
table.t tr:last-child th.chart-rowh { border-bottom: 0; }
.vmatrix tbody th { font-weight: inherit; }

/* Access grid: a project header shows "open" or "close" depending on its state. */
.vbtn[aria-expanded="true"] .ax-more, .vbtn[aria-expanded="false"] .ax-less { display: none; }
.vbtn.ax-static { cursor: default; }
.vbtn.ax-static:hover { background: none; }

/* Run steps: a step without log lines is a plain row laid out like the button. */
.step > .step-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.step .step-chev { transition: transform .15s; color: var(--ink-3); }
.step > button[aria-expanded="true"] .step-chev { transform: rotate(180deg); }
.step-logs { margin: 0 16px 14px; }
.logs:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.logs .debug { color: #9d98b8; }

/* Charts: crosshair hidden until hover (the prototype set this inline). */
.chart .xh { opacity: 0; pointer-events: none; }
.chart-box { min-height: 40px; }
/* Without scripting there is no chart to draw, so show the table and hide the toggle. */
@media (scripting: none) {
  .chart-card [data-chart-panel="chart"], .chart-card .seg { display: none; }
  .chart-card [data-chart-panel="table"][hidden] { display: block; }
}

/* A sparkline needs a width when it sits in a flex row of its own. */
.spark-wrap { min-width: 90px; }

/* Keep absolutely positioned screen-reader text inside its scroll box, so it never widens the page. */
.table-wrap, .tabs { position: relative; }
@media (max-width: 720px) {
  .wf-card .foot { flex-wrap: wrap; }
  .wf-card .foot .btn-run { margin-left: auto; }
  .kit-toc { position: static; }
}

/* Contrast (Lighthouse pass): avatars darken their colour so white initials reach 4.5:1 on all 8 colours in both themes. */
.avatar { background: color-mix(in srgb, var(--ac, var(--primary)) 64%, #000); }
/* Dark theme: the solid danger button is light red, so it takes dark text. */

/* Touch screens: small controls get at least a 24px target (WCAG 2.5.8). Desktop look is unchanged. */
@media (pointer: coarse) {
  table.t th .th-sort, .section-h a.more { min-height: 24px; align-items: center; }
  .section-h a.more { display: inline-flex; }
  .btn.sm, .pin, .lov-x { min-width: 24px; min-height: 24px; }
  input[type="checkbox"]:not([role="switch"]) { min-width: 24px; min-height: 24px; }
  /* The switch stays drawn at 22px; an invisible edge makes the tap area 26px tall. */
  .switch::before { content: ""; position: absolute; inset: -2px 0; }
  /* No keyboard on a touch device, so the "Ctrl K" hint only takes room. */
  .searchbtn .kbd { display: none; }
}
