/* ============ Design tokens ============ */
:root {
  --bg: #f6f6fb;
  --bg-glow: rgba(124, 108, 255, 0.10);
  --surface: #ffffff;
  --surface-2: #f3f3f9;
  --surface-3: #ebebf4;
  --border: #e6e6f0;
  --border-strong: #d6d6e4;
  --text: #0f1022;
  --muted: #5a5e76;
  --faint: #8d91a8;
  --accent: #5b4cf5;
  --accent-2: #06b6d4;
  --accent-soft: #efedff;
  --accent-text: #4a3cd8;
  --grad: linear-gradient(135deg, #7c6cff 0%, #5b4cf5 45%, #4338ca 100%);
  --grad-hero-1: rgba(124, 108, 255, 0.28);
  --grad-hero-2: rgba(6, 182, 212, 0.22);
  --grad-hero-3: rgba(236, 72, 153, 0.14);
  --grid-line: rgba(15, 16, 34, 0.045);
  --good: #16a34a;
  --good-soft: #e8f7ee;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #c27803;
  --warn-soft: #fdf4de;
  --heat-l: 90%;
  --heat-s: 70%;
  --heat-text: #10122a;
  --shadow-sm: 0 1px 2px rgba(16, 18, 42, 0.05);
  --shadow: 0 1px 2px rgba(16, 18, 42, 0.04), 0 8px 24px -8px rgba(16, 18, 42, 0.10);
  --shadow-lg: 0 24px 60px -20px rgba(40, 30, 120, 0.35);
  --ring: 0 0 0 4px rgba(91, 76, 245, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #090a12;
    --bg-glow: rgba(124, 108, 255, 0.14);
    --surface: #11121c;
    --surface-2: #181a27;
    --surface-3: #202233;
    --border: #232538;
    --border-strong: #30334a;
    --text: #eceef8;
    --muted: #a2a6bf;
    --faint: #747a96;
    --accent: #8d80ff;
    --accent-2: #22d3ee;
    --accent-soft: #1f1c45;
    --accent-text: #b4abff;
    --grad-hero-1: rgba(124, 108, 255, 0.30);
    --grad-hero-2: rgba(34, 211, 238, 0.16);
    --grad-hero-3: rgba(236, 72, 153, 0.14);
    --grid-line: rgba(255, 255, 255, 0.04);
    --good: #4ade80;
    --good-soft: #0f2a1b;
    --bad: #ff6b6f;
    --bad-soft: #321417;
    --warn: #fbbf24;
    --warn-soft: #2e2410;
    --heat-l: 19%;
    --heat-s: 34%;
    --heat-text: #f3f4fb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    --ring: 0 0 0 4px rgba(141, 128, 255, 0.2);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #090a12;
  --bg-glow: rgba(124, 108, 255, 0.14);
  --surface: #11121c;
  --surface-2: #181a27;
  --surface-3: #202233;
  --border: #232538;
  --border-strong: #30334a;
  --text: #eceef8;
  --muted: #a2a6bf;
  --faint: #747a96;
  --accent: #8d80ff;
  --accent-2: #22d3ee;
  --accent-soft: #1f1c45;
  --accent-text: #b4abff;
  --grad-hero-1: rgba(124, 108, 255, 0.30);
  --grad-hero-2: rgba(34, 211, 238, 0.16);
  --grad-hero-3: rgba(236, 72, 153, 0.14);
  --grid-line: rgba(255, 255, 255, 0.04);
  --good: #4ade80;
  --good-soft: #0f2a1b;
  --bad: #ff6b6f;
  --bad-soft: #321417;
  --warn: #fbbf24;
  --warn-soft: #2e2410;
  --heat-l: 19%;
  --heat-s: 34%;
  --heat-text: #f3f4fb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 4px rgba(141, 128, 255, 0.2);
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  word-spacing: 0.05em;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ============ Shell ============ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.shell.auth-mode { grid-template-columns: 1fr; }
.shell.auth-mode .sidebar { display: none; }
.shell.auth-mode .container { max-width: none; padding: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(91, 76, 245, 0.7);
}
.brand-mark svg { width: 20px; height: 20px; stroke-width: 2.1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15.5px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text span { color: var(--faint); font-size: 12px; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.live-card {
  display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 14px;
  background: var(--good-soft); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 25%, transparent);
}
.live-card:hover { text-decoration: none; filter: brightness(0.98); }
.live-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.live-text strong { font-size: 13px; }
.live-text span { font-size: 12px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: live 1.6s infinite; flex: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.user-box { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.user-box-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 2px 4px; border-radius: 9px; color: inherit; }
.user-box-link:hover { background: var(--surface-3); text-decoration: none; }
.user-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--grad); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.user-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .icon-btn { width: 30px; height: 30px; margin-left: 0; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--muted); font-weight: 500; font-size: 13px; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link svg { width: 16px; height: 16px; }
.side-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.sidebar-divider { border: 0; border-top: 1px solid var(--border); margin: 2px 4px 6px; }
.theme-toggle { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-toggle button { display: grid; place-items: center; height: 30px; border: 0; background: transparent; border-radius: 9px; color: var(--faint); cursor: pointer; }
.theme-toggle button svg { width: 16px; height: 16px; }
.theme-toggle button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.main { min-width: 0; }
.container { max-width: 1280px; margin: 0 auto; padding: 28px 32px 96px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand-text span { display: none; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 10px; }
  .nav a span { display: none; }
  .live-card { padding: 7px 10px; }
  .live-text span { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .sidebar-divider { display: none; }
  .side-link span { display: none; }
  .user-box { padding: 4px; background: none; border: none; }
  .user-meta { display: none; }
  .theme-toggle { width: 108px; }
  .container { padding: 20px 16px 80px; }
}

/* ============ Layout helpers ============ */
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.grid-new { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.sticky { position: sticky; top: 24px; }
@media (max-width: 1100px) { .grid-new { grid-template-columns: 1fr; } .sticky { position: static; } }

/* ============ Hero ============ */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 30px 32px; margin-bottom: 22px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero::before {
  content: ''; position: absolute; inset: -60% -20%; z-index: -2;
  background:
    radial-gradient(32% 45% at 18% 35%, var(--grad-hero-1), transparent 70%),
    radial-gradient(28% 40% at 82% 25%, var(--grad-hero-2), transparent 70%),
    radial-gradient(30% 40% at 60% 95%, var(--grad-hero-3), transparent 70%);
  filter: blur(10px);
  animation: drift 22s ease-in-out infinite alternate;
}
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(ellipse 80% 90% at 30% 0%, #000 30%, transparent 80%);
}
@keyframes drift { from { transform: translate3d(-3%, -2%, 0) rotate(0deg); } to { transform: translate3d(3%, 3%, 0) rotate(6deg); } }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; margin-bottom: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent-text);
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
}
.eyebrow svg { width: 14px; height: 14px; }
.hero h1 .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin-top: 8px; color: var(--muted); font-size: 15px; max-width: 640px; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hstat {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); border: 1px solid var(--border); backdrop-filter: blur(8px);
}
.hstat .ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.hstat .ic svg { width: 16px; height: 16px; }
.hstat b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hstat span { display: block; font-size: 12px; color: var(--muted); }

/* ============ Cards & sections ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.section-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.section-head .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.section-head .titles p { color: var(--muted); font-size: 13px; }
.section-body { padding: 20px 22px; }
.step {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 6px 16px -6px rgba(91, 76, 245, 0.65);
}
.label-cap { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -10px rgba(91, 76, 245, 0.8); }
.btn-primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08); border-color: transparent; }
.btn-xl { height: 52px; width: 100%; font-size: 15.5px; border-radius: 14px; }
.btn-xl svg { width: 18px; height: 18px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 11px 0 0 11px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 11px 11px 0; }

/* ============ Pills / badges ============ */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; stroke-width: 2.4; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill.wrap { white-space: normal; height: auto; padding: 3px 9px; line-height: 1.35; }
button.pill { border: 0; cursor: pointer; font-family: inherit; }
button.pill.accent.on { background: var(--accent); color: #fff; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============ Vendor mark ============ */
.vmark {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px;
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 12px -6px var(--c2);
}
.vmark.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.vmark.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; }
.vstack { display: flex; }
.vstack .vmark { border: 2px solid var(--surface); margin-left: -8px; }
.vstack .vmark:first-child { margin-left: 0; }

/* ============ Toolbar / inputs ============ */
.input, .select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.textarea { height: auto; padding: 10px 12px; line-height: 1.55; resize: vertical; min-height: 44px; font-family: var(--font); }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.sys-box { gap: 0; }
.sys-box summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 700; font-size: 13px; padding: 2px 0; }
.sys-box summary::-webkit-details-marker { display: none; }
.sys-box summary svg { width: 15px; height: 15px; color: var(--faint); }
.sys-box summary .chev { margin-left: auto; transition: transform 0.2s; }
.sys-box[open] summary .chev { transform: rotate(90deg); }
.sys-box[open] summary { margin-bottom: 8px; }
.tl-edit { margin-left: auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; flex: none; }
.tl-edit:hover { color: var(--accent-text); border-color: var(--accent); }
.tl-edit svg { width: 13px; height: 13px; }
.mode-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .mode-pick { grid-template-columns: 1fr; } }
.mode-opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all 0.15s;
}
.mode-opt:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.mode-opt:focus-visible { outline: none; box-shadow: var(--ring); }
.mode-opt .ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; background: var(--surface-2); color: var(--muted); }
.mode-opt b { display: block; font-size: 14px; }
.mode-opt > span:nth-child(2) > span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mode-opt .m-check { margin-left: auto; }
.mode-opt.on { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.mode-opt.on .ic { background: var(--grad); color: #fff; }
.mode-opt.on .m-check { background: var(--grad); border-color: transparent; color: #fff; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.acard { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all 0.15s; }
.acard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.acard:focus-visible { outline: none; box-shadow: var(--ring); }
.acard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: linear-gradient(0deg, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent), var(--surface); }
.acard.on .m-check { background: var(--grad); border-color: transparent; color: #fff; }
.acard-top { display: flex; gap: 12px; align-items: center; }
.acard-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.acard-stats span { display: inline-flex; align-items: center; gap: 5px; }
.acard-stats svg { width: 13px; height: 13px; color: var(--faint); }
.tcard.agent { border-color: color-mix(in srgb, var(--accent-2) 35%, var(--border)); }
.trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.trace li { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.trace li.err { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.trace summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 13px; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace details[open] summary { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.trace details > :not(summary) { margin-left: 12px; margin-right: 12px; }
.trace details[open] { padding-bottom: 12px; }
.trace .output { max-height: 220px; font-size: 12px; }
.ws-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.ws-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; font-weight: 700; font-size: 13.5px;
  color: var(--muted); background: color-mix(in srgb, var(--surface) 78%, transparent); border: 1px solid var(--border);
}
.ws-tab svg { width: 16px; height: 16px; }
.ws-tab:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.ws-tab.on { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 8px 22px -10px rgba(91, 76, 245, 0.8); }
.ws-tab.on .pill { background: rgba(255, 255, 255, 0.22); color: #fff; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.ws-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); transition: box-shadow 0.15s, border-color 0.15s; }
.ws-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ws-desc { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ws-actions { margin-top: auto; padding-top: 4px; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tool-chips .pill { font-family: var(--mono); font-weight: 500; }
.tool-chips .pill.off { opacity: 0.45; text-decoration: line-through; }
.panel.wide { width: min(1040px, 100%); }
.overlay.center .panel.wide { width: min(1040px, 100%); }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; padding: 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; background: var(--surface); border: 1px solid transparent; cursor: pointer; font-size: 13px; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.pick .faint { font-size: 12px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; }
.var-chips .pill { cursor: pointer; border: 0; font-family: var(--mono); font-weight: 500; }
.var-chips .pill:hover { background: var(--accent-soft); color: var(--accent-text); }
.vars { display: flex; flex-direction: column; gap: 6px; }
.var-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; }
.var-row .icon-btn { margin-left: 0; }
.file-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 8px; }
.file-row .row { flex-wrap: nowrap; }
.file-row .icon-btn { margin-left: 0; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check-inline + .check-inline { margin-top: 8px; }
.field .check-inline { display: flex; }
.req-box { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.req-box summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 600; font-size: 13px; }
.req-box summary::-webkit-details-marker { display: none; }
.req-box summary .chev { margin-left: auto; transition: transform 0.2s; }
.req-box[open] summary .chev { transform: rotate(90deg); }
.req-box .output { max-height: 360px; font-size: 12px; }
.price-head, .price-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px; gap: 10px; align-items: center; }
.price-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); padding: 0 2px 4px; }
.price-row { padding: 6px 2px; border-bottom: 1px dashed var(--border); }
.price-row .pr-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.price-row .pr-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .price-head, .price-row { grid-template-columns: minmax(0, 1fr) 90px 90px; } }
.validity { border-radius: 16px; padding: 14px 18px; border: 1px solid var(--border); background: var(--surface); }
.validity.good { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); background: color-mix(in srgb, var(--good-soft) 60%, var(--surface)); }
.validity.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.validity.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface)); }
.validity .v-head { display: flex; gap: 12px; align-items: flex-start; }
.validity .v-head svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.validity.good .v-head svg { color: var(--good); } .validity.warn .v-head svg { color: var(--warn); } .validity.bad .v-head svg { color: var(--bad); }
.validity .v-head b { display: block; font-size: 15px; }
.validity .v-head span { color: var(--muted); font-size: 13px; }
.validity ul { margin: 10px 0 0 34px; padding: 0; font-size: 13px; }
.validity li { margin: 3px 0; }
.validity li.fatal { color: var(--bad); font-weight: 600; }
.validity li.warn { color: var(--text); }
.validity li.info { color: var(--muted); }
.res-btn.neutral { background: var(--surface-2); color: var(--muted); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 36px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button {
  border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13px; transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented.full { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }

/* ============ Model picker ============ */
.group + .group { margin-top: 22px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.group-head h3 { display: flex; align-items: center; gap: 8px; }
.group-head .hint { color: var(--faint); font-size: 12.5px; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.mcard {
  position: relative; display: flex; gap: 12px; align-items: center; padding: 13px 14px; min-height: 72px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
}
.mcard:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.mcard input { position: absolute; opacity: 0; pointer-events: none; }
.mcard:has(input:focus-visible) { box-shadow: var(--ring); }
.mcard.selected { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface); box-shadow: 0 0 0 1px var(--accent), 0 10px 24px -14px rgba(91, 76, 245, 0.7); }
.mcard.disabled { cursor: not-allowed; }
.mcard.disabled:hover { transform: none; box-shadow: none; border-color: var(--border); }
.mcard.disabled .vmark { filter: grayscale(0.85); opacity: 0.55; }
.mcard.disabled .m-name { color: var(--muted); }
.m-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.m-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sub { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-check {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); color: transparent; transition: all 0.15s;
}
.m-check svg { width: 13px; height: 13px; stroke-width: 3; }
.mcard.selected .m-check { background: var(--grad); border-color: transparent; color: #fff; }
.mcard.disabled .m-check { opacity: 0.4; }
.m-reason { display: flex; align-items: center; gap: 5px; color: var(--warn); font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-reason svg { width: 12px; height: 12px; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px 18px; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: 14px;
}
.empty .ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--faint); }

/* ============ Test picker ============ */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-items: start; }
.tcard {
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.tcard.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: linear-gradient(0deg, color-mix(in srgb, var(--accent-soft) 60%, transparent), transparent), var(--surface); }
.tcard.part { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.tcard-main { display: flex; gap: 12px; align-items: center; padding: 13px 14px; cursor: pointer; }
.tcard .ic {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--surface-2); color: var(--muted); transition: all 0.15s;
}
.tcard.on .ic, .tcard.part .ic { background: var(--grad); color: #fff; }
.tcard .t-name { font-weight: 700; text-transform: capitalize; }
.tcard .t-sub { color: var(--faint); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcard .m-check { margin-left: auto; }
.tcard.on .m-check { background: var(--grad); border-color: transparent; color: #fff; }
.tcard.part .m-check { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.tcard-more {
  display: flex; align-items: center; gap: 4px; width: 100%; padding: 8px 14px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; border-radius: 0 0 14px 14px;
}
.tcard-more:hover { color: var(--accent-text); background: var(--surface-2); }
.tcard-more svg { width: 14px; height: 14px; transition: transform 0.2s; }
.tcard.open .tcard-more svg { transform: rotate(90deg); }
.tlist { display: none; padding: 4px 14px 12px; }
.tcard.open .tlist { display: block; }
.tlist label { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; font-size: 13px; cursor: pointer; }
.tlist input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }

/* ============ Login ============ */
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: center; padding: 60px 56px;
  color: #fff; background: linear-gradient(150deg, #241a6e 0%, #4f3fd6 45%, #0891b2 130%);
}
.auth-brand-bg { position: absolute; inset: -20%; z-index: -1; }
.auth-brand-bg::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(38% 55% at 20% 20%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(32% 45% at 85% 15%, rgba(34, 211, 238, 0.45), transparent 70%),
    radial-gradient(38% 55% at 30% 100%, rgba(236, 72, 153, 0.28), transparent 70%);
  filter: blur(10px);
  animation: drift 24s ease-in-out infinite alternate;
}
.auth-brand-bg::after {
  content: ''; position: absolute; inset: 0; opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 75% 75% at 50% 40%, #000 40%, transparent 85%);
}
.auth-brand-inner { max-width: 440px; }
.auth-logo {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24); backdrop-filter: blur(6px);
}
.auth-logo svg { width: 26px; height: 26px; }
.auth-brand-inner h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.auth-tagline { margin: 12px 0 36px; font-size: 15.5px; line-height: 1.55; opacity: 0.88; max-width: 380px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.auth-points li { display: flex; align-items: flex-start; gap: 14px; font-size: 14px; line-height: 1.5; opacity: 0.95; }
.auth-point-ic {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; margin-top: 1px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.2);
}
.auth-point-ic svg { width: 15px; height: 15px; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: var(--bg); }
.auth-form-inner { width: 100%; max-width: 380px; text-align: center; }
.auth-form-inner h2 { font-size: 24px; letter-spacing: -0.02em; }
.auth-form-inner form { text-align: left; }
.auth-form-inner .field + .field { margin-top: 14px; }
.auth-form-inner .btn { margin-top: 20px; }
.auth-form-inner .notice { margin-top: 14px; text-align: left; }
.auth-icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 20px;
  background: var(--good-soft); color: var(--good);
}
.auth-icon svg { width: 26px; height: 26px; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 36px 24px; min-height: 240px; }
  .auth-brand-inner h1 { font-size: 26px; }
  .auth-tagline { margin-bottom: 22px; font-size: 14px; }
  .auth-points { display: none; }
  .auth-form-side { padding: 32px 20px 60px; }
}

/* ============ Launch panel ============ */
.launch { overflow: hidden; }
.launch-head { padding: 20px 22px 0; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 16px; }
.launch-head > .notice { margin-top: 16px; }
.launch-head > .notice + .field { margin-top: 16px; }
.field > label { font-weight: 700; font-size: 13px; }
.field .hint { color: var(--faint); font-size: 12px; }
.estimate {
  position: relative; overflow: hidden; margin: 20px 0 16px; padding: 18px; border-radius: 16px;
  background: var(--grad); color: #fff; box-shadow: 0 14px 32px -16px rgba(91, 76, 245, 0.9);
}
.estimate::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 65%);
}
.estimate .label { font-size: 12px; font-weight: 600; opacity: 0.85; }
.estimate .big { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.estimate .big small { font-size: 15px; font-weight: 600; opacity: 0.85; letter-spacing: 0; margin-left: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips span { padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); font-size: 12px; font-weight: 600; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.notice + .notice { margin-top: 8px; }
.notice svg { width: 16px; height: 16px; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--accent-soft); color: var(--accent-text); }
.notice a { color: inherit; font-weight: 700; text-decoration: underline; }
.launch-foot { padding: 0 22px 22px; }
.keys-box { border-top: 1px solid var(--border); }
.keys-box summary { display: flex; align-items: center; gap: 8px; padding: 14px 22px; cursor: pointer; list-style: none; font-weight: 600; font-size: 13px; color: var(--muted); }
.keys-box summary::-webkit-details-marker { display: none; }
.keys-box summary svg { width: 16px; height: 16px; }
.keys-box summary .chev { margin-left: auto; transition: transform 0.2s; }
.keys-box[open] summary .chev { transform: rotate(90deg); }
.keys-inner { padding: 0 22px 18px; }
.keys { display: flex; flex-direction: column; gap: 2px; }
.keys .kr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.keys .kr:last-child { border-bottom: 0; }
.keys .k { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

.onboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.onboard .o { display: flex; gap: 11px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border); }
.onboard .o .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 12.5px; flex: none; }
.onboard .o p { font-size: 13px; color: var(--muted); }
.onboard .o b { color: var(--text); display: block; margin-bottom: 2px; }

/* ============ Progress page ============ */
.prog-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 30px; align-items: center; }
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 168px; height: 168px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .pct { font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-top: 18px; }
.stat { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .label svg { width: 14px; height: 14px; }
.stat .value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.good .value { color: var(--good); }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }
@media (max-width: 700px) { .prog-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .prog-hero .row { justify-content: center; } }

.pm-row { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; }
.pm-row + .pm-row { border-top: 1px solid var(--border); }
.pm-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.pm-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.track > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.5s ease; }
.track.good > span { background: linear-gradient(90deg, #22c55e, #16a34a); }
@media (max-width: 640px) { .pm-row { grid-template-columns: 1fr auto; } .pm-row .track { grid-column: 1 / -1; order: 3; } }

.feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 22px; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed li.new { animation: slideIn 0.45s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); background: var(--accent-soft); } to { opacity: 1; transform: none; } }
.feed .f-main { min-width: 0; }
.feed .f-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .f-main span { display: block; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .f-lat { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.log {
  max-height: 280px; overflow: auto; margin: 0; padding: 14px; border-radius: 12px;
  background: var(--surface-2); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere;
}
.collapse summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 600; color: var(--muted); }
.collapse summary::-webkit-details-marker { display: none; }
.collapse summary .chev { margin-left: auto; transition: transform 0.2s; }
.collapse[open] summary .chev { transform: rotate(90deg); }

/* ============ Results ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .meta { color: var(--muted); margin-top: 6px; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13.5px; }
.page-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.page-head .meta svg { width: 14px; height: 14px; color: var(--faint); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.back svg { width: 15px; height: 15px; }

.champion-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1000px) { .champion-grid { grid-template-columns: 1fr; } }
.champion {
  position: relative; overflow: hidden; isolation: isolate; padding: 26px; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, #2a1f7a 0%, #4b3bd6 45%, #6d5dfc 75%, #0891b2 130%);
  box-shadow: var(--shadow-lg);
}
.champion::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(40% 60% at 90% 10%, rgba(255, 255, 255, 0.25), transparent 70%),
    radial-gradient(30% 50% at 10% 110%, rgba(34, 211, 238, 0.45), transparent 70%);
}
.champion::after {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(120deg, transparent 20%, #000 90%);
}
.champion .crown { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 12px; font-weight: 700; letter-spacing: 0.03em; }
.champion .crown svg { width: 14px; height: 14px; color: #fde68a; }
.champion .who { display: flex; align-items: center; gap: 14px; margin: 18px 0 20px; }
.champion .who .vmark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5); }
.champion .who h2 { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.champion .who p { opacity: 0.8; font-size: 13px; overflow-wrap: anywhere; }
.champion .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.champion .kpi { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
.champion .kpi span { display: block; font-size: 11.5px; opacity: 0.8; font-weight: 600; }
.champion .kpi b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .champion .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.podium { display: flex; flex-direction: column; }
.podium .pr { display: flex; align-items: center; gap: 12px; padding: 13px 18px; }
.podium .pr + .pr { border-top: 1px solid var(--border); }
.podium .pr .main { flex: 1; min-width: 0; }
.podium .pr .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pr .main span { display: block; font-size: 12px; color: var(--muted); }
.podium .pr .score { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.medal { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12px; font-weight: 800; flex: none; background: var(--surface-2); color: var(--muted); }
.medal.m1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #4a2c00; }
.medal.m2 { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #1e293b; }
.medal.m3 { background: linear-gradient(135deg, #fcd9b8, #c2703d); color: #3b1d06; }

.winners { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.winner { display: flex; gap: 12px; align-items: center; padding: 15px 16px; }
.winner .ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; }
.winner .ic svg { width: 19px; height: 19px; }
.winner .t { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.winner .p { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner .v { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.winner .body { min-width: 0; }
.ic-violet { background: #efedff; color: #5b4cf5; }
.ic-cyan { background: #e0f7fb; color: #0891b2; }
.ic-amber { background: #fdf3dc; color: #b45309; }
.ic-green { background: #e5f6ec; color: #15803d; }
.ic-pink { background: #fde7f1; color: #be185d; }
:root[data-theme='dark'] .ic-violet { background: #1f1c45; color: #b4abff; }
:root[data-theme='dark'] .ic-cyan { background: #0c2a33; color: #67e8f9; }
:root[data-theme='dark'] .ic-amber { background: #2e2410; color: #fcd34d; }
:root[data-theme='dark'] .ic-green { background: #0f2a1b; color: #86efac; }
:root[data-theme='dark'] .ic-pink { background: #331325; color: #f9a8d4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .ic-violet { background: #1f1c45; color: #b4abff; }
  :root:not([data-theme='light']) .ic-cyan { background: #0c2a33; color: #67e8f9; }
  :root:not([data-theme='light']) .ic-amber { background: #2e2410; color: #fcd34d; }
  :root:not([data-theme='light']) .ic-green { background: #0f2a1b; color: #86efac; }
  :root:not([data-theme='light']) .ic-pink { background: #331325; color: #f9a8d4; }
}

.viz-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; }
@media (max-width: 1000px) { .viz-grid { grid-template-columns: 1fr; } }
.radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 18px 20px; }
.radar { width: 100%; max-width: 360px; height: auto; overflow: visible; stroke: none; }
.radar text { stroke: none; }
.radar .web { fill: none; stroke: var(--border); stroke-width: 1; }
.radar .axis { stroke: var(--border); stroke-width: 1; }
.radar .ax-label { fill: var(--muted); font-size: 11.5px; font-weight: 600; font-family: var(--font); }
.radar .series { stroke-width: 2.2; fill-opacity: 0.12; stroke-linejoin: round; transition: opacity 0.15s; }
.radar .pt { stroke: var(--surface); stroke-width: 1.5; }
.radar-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12.5px; }
.radar-legend span { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radar-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.chart { padding: 18px 20px; }
.chart:nth-child(odd) { border-right: 1px solid var(--border); }
.chart:nth-child(n + 3) { border-top: 1px solid var(--border); }
@media (max-width: 700px) { .charts { grid-template-columns: 1fr; } .chart:nth-child(odd) { border-right: 0; } .chart + .chart { border-top: 1px solid var(--border); } }
.chart-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.chart-head .ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; }
.chart-head .ic svg { width: 15px; height: 15px; }
.chart-head .dir { margin-left: auto; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 36%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 500; }
.bar-row .bt { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-row .bf { height: 100%; border-radius: inherit; background: color-mix(in srgb, var(--accent) 45%, var(--surface-3)); transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bar-row.best .bf { background: var(--grad); }
.bar-row.best .name { color: var(--text); font-weight: 700; }
.bar-row .v { min-width: 68px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-note { color: var(--faint); font-size: 12px; margin-top: 12px; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { position: sticky; top: 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }
.model-cell { min-width: 200px; }
.model-cell .mc { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.model-cell .mc span { overflow-wrap: anywhere; }
.ibar { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.ibar .track { flex: 1; height: 7px; }
.ibar .v { min-width: 50px; text-align: right; font-weight: 600; }

.heat td.cell { text-align: center; font-weight: 700; min-width: 92px; border-left: 3px solid var(--surface); }
.heat td.cell[data-p] { background: hsl(calc(var(--p) * 1.2) var(--heat-s) var(--heat-l)); color: var(--heat-text); }
.heat tbody tr:hover td.cell[data-p] { filter: brightness(0.97); }
.heat th.c { text-align: center; }

.matrix td.res { text-align: center; padding: 6px; min-width: 116px; }
.res-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px; width: 100%;
  padding: 8px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; background: var(--surface-2);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.res-btn:hover { transform: translateY(-1px); border-color: currentColor; box-shadow: var(--shadow); }
.res-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.res-btn .s { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; }
.res-btn .s svg { width: 13px; height: 13px; stroke-width: 2.6; }
.res-btn .l { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.res-btn.pass { background: var(--good-soft); color: var(--good); }
.res-btn.fail { background: var(--bad-soft); color: var(--bad); }
.res-btn.error { background: var(--warn-soft); color: var(--warn); }
.matrix .test-name { min-width: 240px; }
.matrix .test-name b { display: block; font-weight: 600; }
.matrix .test-name small { display: block; color: var(--faint); text-transform: capitalize; font-size: 12px; }
.matrix th.p { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12px; }
.matrix th.p .vmark { margin: 0 auto 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============ History ============ */
.runs { display: flex; flex-direction: column; }
.run-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 16px 22px; border-bottom: 1px solid var(--border); color: inherit; transition: background 0.12s;
}
.run-item:last-child { border-bottom: 0; }
.run-item:hover { background: var(--surface-2); text-decoration: none; }
.run-item .title { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.run-item .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 3px; }
.run-item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.run-item .best { font-size: 12.5px; color: var(--muted); }
.run-item .best b { color: var(--text); }
.run-item-del { flex: none; }
.icon-btn.confirm-armed { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
@media (max-width: 700px) {
  .run-item { grid-template-columns: 1fr auto; }
  .run-item .right { align-items: flex-start; text-align: left; grid-column: 1 / 2; }
  .run-item-del { grid-row: 1 / 3; }
}

/* ============ Overlay ============ */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 20, 0.5); backdrop-filter: blur(4px); display: flex; justify-content: flex-end; animation: fade 0.18s ease; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.panel { background: var(--surface); height: 100%; width: min(760px, 100%); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideLeft 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.overlay.center .panel { height: auto; max-height: min(88vh, 920px); border-radius: 22px; width: min(920px, 100%); border: 1px solid var(--border); animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slideLeft { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.panel-head .titles { min-width: 0; }
.panel-head h2 { overflow-wrap: anywhere; }
.panel-head p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.panel-body { padding: 18px 22px; overflow: auto; flex: 1; }
.panel-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; margin-left: auto; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.6; cursor: default; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
.attempt { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.attempt + .attempt { margin-top: 14px; }
.attempt-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.attempt-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.kvs div { padding: 9px 11px; border-radius: 11px; background: var(--surface-2); }
.kvs span { display: block; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.kvs b { font-variant-numeric: tabular-nums; }
.assertions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.assertions li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); font-size: 13px; }
.assertions .mk { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.assertions .mk svg { width: 12px; height: 12px; stroke-width: 3; }
.assertions .mk.ok { background: var(--good-soft); color: var(--good); }
.assertions .mk.no { background: var(--bad-soft); color: var(--bad); }
.assertions .why { color: var(--muted); overflow-wrap: anywhere; display: block; margin-top: 2px; }
.output { margin: 0; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 440px; overflow: auto; line-height: 1.6; }

.rm-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.rm-toolbar .search { flex: 1; min-width: 220px; }
.rm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.rm-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: all 0.12s; }
.rm-item:hover { border-color: var(--border-strong); }
.rm-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.rm-item input { position: absolute; opacity: 0; pointer-events: none; }
.rm-item.selected .m-check { background: var(--grad); border-color: transparent; color: #fff; }
.rm-item .id { font-weight: 600; overflow-wrap: anywhere; font-size: 13px; }
.rm-item .caps { color: var(--faint); font-size: 11.5px; }
.rm-item .body { flex: 1; min-width: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 500; cursor: pointer; }
.check-inline input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ============ Toast / skeleton ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 9px;
  background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); font-weight: 600; font-size: 13.5px; animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast svg { width: 16px; height: 16px; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes toastIn { from { transform: translate(-50%, 10px); opacity: 0; } }
.skel { border-radius: 14px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

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