/* ===== 设计令牌 (Design Tokens) ===== */
:root {
  /* 默认：深色调 (Dark Theme Tokens) */
  --bg: #090b10;
  --bg-subtle: #0f121a;
  --bg-card: #131722;
  --bg-card-hover: #181d2b;
  --bg-elevated: #1e2436;
  --line: #23293a;
  --line-strong: #2f374d;
  --line-subtle: #191e2b;

  --fg: #edf0f7;
  --fg-dim: #9aa5b8;
  --fg-mute: #626c80;

  --primary: #4f8eff;
  --primary-hover: #3b7bf0;
  --primary-glow: rgba(79, 142, 255, 0.25);
  --primary-light: rgba(79, 142, 255, 0.12);

  --success: #2ecb72;
  --success-glow: rgba(46, 203, 114, 0.25);
  --success-light: rgba(46, 203, 114, 0.12);

  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);

  --danger: #f43f5e;
  --danger-light: rgba(244, 63, 94, 0.12);

  --bonus: #a855f7;
  --bonus-light: rgba(168, 85, 247, 0.12);

  --grade-s: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --grade-a: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --grade-b: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  --grade-c: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  --grade-d: linear-gradient(135deg, #f87171 0%, #dc2626 100%);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --term-bg: #0b0d13;
  --term-header: #11141c;
  --term-fg: #c5cde0;
  --modal-backdrop: rgba(0, 0, 0, 0.65);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  
  color-scheme: dark;
}

/* 浅色调令牌 (Light Theme Tokens) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8fafc;
    --bg-subtle: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-elevated: #e2e8f0;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --line-subtle: #edf2f7;

    --fg: #0f172a;
    --fg-dim: #475569;
    --fg-mute: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.2);
    --primary-light: rgba(37, 99, 235, 0.08);

    --success: #16a34a;
    --success-glow: rgba(22, 163, 74, 0.2);
    --success-light: rgba(22, 163, 74, 0.1);

    --warning: #d97706;
    --warning-light: rgba(217, 119, 6, 0.1);

    --danger: #e11d48;
    --danger-light: rgba(225, 29, 72, 0.1);

    --bonus: #9333ea;
    --bonus-light: rgba(147, 51, 234, 0.1);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    --term-bg: #1e293b;
    --term-header: #0f172a;
    --term-fg: #f1f5f9;
    --modal-backdrop: rgba(15, 23, 42, 0.45);

    color-scheme: light;
  }
}

/* 强制浅色属性 [data-theme="light"] */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-elevated: #e2e8f0;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --line-subtle: #edf2f7;

  --fg: #0f172a;
  --fg-dim: #475569;
  --fg-mute: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.2);
  --primary-light: rgba(37, 99, 235, 0.08);

  --success: #16a34a;
  --success-glow: rgba(22, 163, 74, 0.2);
  --success-light: rgba(22, 163, 74, 0.1);

  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.1);

  --danger: #e11d48;
  --danger-light: rgba(225, 29, 72, 0.1);

  --bonus: #9333ea;
  --bonus-light: rgba(147, 51, 234, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --term-bg: #1e293b;
  --term-header: #0f172a;
  --term-fg: #f1f5f9;
  --modal-backdrop: rgba(15, 23, 42, 0.45);

  color-scheme: light;
}

/* 强制深色属性 [data-theme="dark"] */
:root[data-theme="dark"] {
  --bg: #090b10;
  --bg-subtle: #0f121a;
  --bg-card: #131722;
  --bg-card-hover: #181d2b;
  --bg-elevated: #1e2436;
  --line: #23293a;
  --line-strong: #2f374d;
  --line-subtle: #191e2b;

  --fg: #edf0f7;
  --fg-dim: #9aa5b8;
  --fg-mute: #626c80;

  --primary: #4f8eff;
  --primary-hover: #3b7bf0;
  --primary-glow: rgba(79, 142, 255, 0.25);
  --primary-light: rgba(79, 142, 255, 0.12);

  --success: #2ecb72;
  --success-glow: rgba(46, 203, 114, 0.25);
  --success-light: rgba(46, 203, 114, 0.12);

  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);

  --danger: #f43f5e;
  --danger-light: rgba(244, 63, 94, 0.12);

  --bonus: #a855f7;
  --bonus-light: rgba(168, 85, 247, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --term-bg: #0b0d13;
  --term-header: #11141c;
  --term-fg: #c5cde0;
  --modal-backdrop: rgba(0, 0, 0, 0.65);

  color-scheme: dark;
}

/* ===== 基础复位 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; overflow: hidden; }
body {
  font: 14px/1.55 var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.2s ease;
}

.hidden { display: none !important; }
.muted-text { color: var(--fg-dim); font-size: 13px; font-weight: 400; }
.text-danger { color: var(--danger) !important; }
.mono { font-family: var(--font-mono); }

/* ===== 登录页面 ===== */
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  position: relative;
  background: radial-gradient(circle at 50% 30%, var(--bg-card) 0%, var(--bg) 70%);
}
.login-bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
}
.login-card {
  width: 380px;
  padding: 36px 32px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(140deg, #4f8eff 0%, #9333ea 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(79, 142, 255, 0.35);
}
.login-card h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub {
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 16px;
  text-align: left;
}
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
input[type="text"], input[type="password"], input:not([type]) {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
  font-size: 13.5px;
  transition: all 0.2s ease;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.control-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-dim);
  cursor: pointer;
}
.control-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.err {
  color: var(--danger);
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
}

/* ===== 按钮设计体系 ===== */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
}
.btn:active, button:active { transform: translateY(1px); }
.btn:disabled, button:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary, button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover, button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  color: var(--fg);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}
.btn-ghost, button.ghost {
  background: transparent;
  color: var(--fg-dim);
  border-color: transparent;
}
.btn-ghost:hover, button.ghost:hover {
  background: var(--bg-card-hover);
  color: var(--fg);
}
.btn-danger, button.danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger:hover, button.danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.block-btn, button.block { width: 100%; }
.icon-btn {
  background: transparent;
  border: none;
  padding: 7px;
  color: var(--fg-dim);
  border-radius: var(--radius-sm);
}
.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--fg);
}

/* ===== 顶部导航栏 (TopBar) ===== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
.topbar {
  height: 56px;
  flex: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topbar-brand strong { font-size: 14px; font-weight: 700; color: var(--fg); }
.topbar-brand span { font-size: 11px; color: var(--fg-mute); }
.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: linear-gradient(140deg, #4f8eff 0%, #9333ea 100%);
  color: #fff;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-btn {
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--fg);
}
.nav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-icon { margin-right: 6px; font-size: 14px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-switch-btn {
  font-size: 15px;
  padding: 6px 8px;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 12.5px;
}
.status-dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
}

/* ===== 核心工作区容器 ===== */
.app-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.view-wrapper {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.view-wrapper.full-view {
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 32px 48px;
}

/* ===== 渠道商评测布局 ===== */
.ep-sidebar {
  width: 290px;
  flex: none;
  background: var(--bg-subtle);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ep-side-head {
  padding: 14px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line-subtle);
}
.search-bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--fg-mute);
  pointer-events: none;
}
.search-bar input {
  padding-left: 30px;
  font-size: 12.5px;
  height: 32px;
}
.primary-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.primary-btn:hover { background: var(--primary-hover); }

.ep-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ep-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: all 0.15s ease;
}
.ep-item:hover {
  background: var(--bg-card);
  border-color: var(--line);
  transform: translateX(2px);
}
.ep-item.active {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-light);
}
.ep-item .row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ep-item .name-group {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}
.ep-item .name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-item .url {
  font: 11px var(--font-mono);
  color: var(--fg-mute);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-item .row2 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--fg-dim);
}
.tag.g-S { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); font-weight: 700; }
.tag.g-A { background: rgba(52, 211, 153, 0.15); color: #34d399; border-color: rgba(52, 211, 153, 0.3); font-weight: 600; }
.tag.g-B { background: rgba(96, 165, 250, 0.15); color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); }
.tag.g-C { background: rgba(251, 146, 60, 0.15); color: #fb923c; border-color: rgba(251, 146, 60, 0.3); }
.tag.g-D { background: rgba(248, 113, 113, 0.15); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.ep-side-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line-subtle);
  font-size: 11.5px;
}

.ep-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 48px;
}
.empty-state {
  text-align: center;
  max-width: 440px;
  margin: 18vh auto 0;
}
.empty-icon-box {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.8;
}
.big-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* 渠道商详情卡片 */
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.panel-header-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.title-row h1 {
  font-size: 20px;
  font-weight: 700;
}
.endpoint-sub {
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 5px;
  font-family: var(--font-mono);
}
.header-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.more-actions-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

/* 状态药丸 (Status Chips) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--fg-dim);
}
.chip.running {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.12);
  animation: pulse-border 1.8s infinite;
}
.chip.ok {
  color: var(--success);
  border-color: rgba(46, 203, 114, 0.4);
  background: var(--success-light);
}
.chip.failed {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.4);
  background: var(--danger-light);
}
.chip.cancelled, .chip.queued {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--warning-light);
}
@keyframes pulse-border {
  0%, 100% { border-color: rgba(96, 165, 250, 0.3); }
  50% { border-color: rgba(96, 165, 250, 0.8); }
}

/* 探针卡片 */
.probe-card {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  animation: slide-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.probe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.probe-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.probe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--fg-mute);
  cursor: pointer;
  padding: 0 4px;
}
.btn-close:hover { color: var(--fg); }
.probe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.probe-stat {
  background: var(--bg-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.probe-stat .label { font-size: 11.5px; color: var(--fg-mute); }
.probe-stat .value { font-size: 15px; font-weight: 600; margin-top: 4px; font-family: var(--font-mono); }

/* 综合评分与统计网格 */
.metric-dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}
.score-card-hero {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}
.score-ring-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex: none;
}
.score-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-track {
  fill: none;
  stroke: var(--bg-subtle);
  stroke-width: 8;
}
.score-indicator {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s;
}
.score-number-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}
.score-grade-badge {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 4px;
}
.score-meta .meta-label { font-size: 12px; color: var(--fg-mute); font-weight: 500; }
.score-meta .meta-desc { font-size: 13.5px; font-weight: 600; color: var(--fg); margin-top: 4px; }

.stats-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.metric-tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.metric-tile .k { font-size: 12px; color: var(--fg-dim); margin-bottom: 6px; }
.metric-tile .v { font-size: 22px; font-weight: 700; font-family: var(--font-mono); }
.metric-tile .v small { font-size: 12px; color: var(--fg-mute); font-weight: 400; margin-left: 4px; }

/* 工作区 Tabs 卡片 */
.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.tabs-nav {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}
.tab-item {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-dim);
  border-radius: 0;
}
.tab-item:hover { color: var(--fg); }
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-icon { margin-right: 6px; }
.tab-content { padding: 20px; }

/* 阶段进度条与状态药丸 */
.pipeline-progress-box {
  margin-bottom: 16px;
}
.stage-pills-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--fg-mute);
}
.stage-pill .s-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.stage-pill.running {
  color: var(--primary);
  border-color: rgba(79, 142, 255, 0.4);
  background: var(--primary-light);
}
.stage-pill.running .s-dot {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  animation: pulse-dot 1.2s infinite;
}
.stage-pill.ok {
  color: var(--success);
  border-color: rgba(46, 203, 114, 0.4);
  background: var(--success-light);
}
.stage-pill.ok .s-dot { background: var(--success); }
.stage-pill.failed {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.4);
  background: var(--danger-light);
}
.stage-pill.failed .s-dot { background: var(--danger); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.progress-bar-container {
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary) 0%, #a855f7 100%);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: width 0.35s ease;
}

/* 终端控制台 (Terminal) */
.terminal-container {
  background: var(--term-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--term-header);
  border-bottom: 1px solid var(--line);
}
.term-dots { display: flex; gap: 6px; }
.term-dot { width: 10px; height: 10px; border-radius: 50%; }
.term-dot.red { background: #ef4444; }
.term-dot.yellow { background: #f59e0b; }
.term-dot.green { background: #10b981; }
.term-title { font-family: var(--font-mono); font-size: 11.5px; color: #94a3b8; }
.term-controls { display: flex; align-items: center; gap: 12px; }
.term-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: #94a3b8;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}
.term-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.log-screen {
  height: 48vh;
  min-height: 280px;
  overflow-y: auto;
  padding: 16px;
  font: 12px/1.65 var(--font-mono);
  color: var(--term-fg);
  tab-size: 4;
}
.log-screen.wrap { white-space: pre-wrap; word-break: break-all; }
.log-progress { color: #60a5fa; font-weight: 500; }
.log-error { color: #f87171; font-weight: 600; }
.log-success { color: #34d399; }
.log-warn { color: #fbbf24; }

/* 报告与产物 */
.report-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.file-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  list-style: none;
}
.file-card-item {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}
.file-card-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.file-card-item a { color: inherit; text-decoration: none; }
.file-card-item .fname { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--fg); }
.file-card-item .fmeta { font-size: 11.5px; color: var(--fg-mute); margin-top: 3px; }

/* ===== 全局看板、面板卡片通用 ===== */
.view-header {
  margin-bottom: 24px;
}
.view-header.with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.view-title { font-size: 22px; font-weight: 700; }

.overview-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.overview-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-box-header {
  margin-bottom: 16px;
}
.panel-box-header.with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-box-header h2 { font-size: 15px; font-weight: 600; color: var(--fg); }

/* 天梯排行与最近运行列表 */
.rank-list, .recent-list { display: grid; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}
.rank-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--line);
  transform: translateX(3px);
}
.rank-row .no { font: 700 13px var(--font-mono); color: var(--fg-mute); }
.rank-row .nm { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .sc { font: 700 14px var(--font-mono); color: var(--fg); }
.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}
.recent-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--line);
}
.recent-row .t { margin-left: auto; font: 12px var(--font-mono); color: var(--fg-mute); }

/* 表格体系 */
.table-wrap { overflow-x: auto; }
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.custom-table th, .custom-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.custom-table th {
  background: var(--bg-subtle);
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.custom-table tr:hover td {
  background: var(--bg-subtle);
}

/* 对比选择与对比条 */
.cmp-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cmp-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.cmp-pick-item:hover { border-color: var(--line-strong); }
.cmp-pick-item.on {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.cmp-bars-container { display: grid; gap: 12px; }
.bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 16px;
}
.bar-track {
  height: 18px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary) 0%, #a855f7 100%);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar-row .sc { font: 700 13.5px var(--font-mono); text-align: right; }

/* 状态胶囊 */
.cap-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}
.cap-pass { background: rgba(52, 211, 153, 0.15); color: #16a34a; }
.cap-bonus { background: rgba(168, 85, 247, 0.15); color: #9333ea; }
.cap-partial { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.cap-fail { background: rgba(244, 63, 94, 0.15); color: #e11d48; }
.cap-na, .cap-skip { background: rgba(107, 114, 128, 0.15); color: #64748b; }

/* ===== 弹窗体系 (Dialog) ===== */
.custom-dlg {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--fg);
  padding: 24px;
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.custom-dlg.small-dlg { width: 360px; }
.custom-dlg::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
}
.dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dlg-header h2 { font-size: 17px; font-weight: 700; }
.dlg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.stage-picker-list {
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}
.stage-picker-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
}
.stage-picker-list li:hover { background: var(--bg-card-hover); }
.picker-quick-actions { display: flex; gap: 8px; margin-bottom: 12px; }

/* ===== 浮动通知 (Toast) ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 24px);
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(244, 63, 94, 0.5); color: var(--danger); }

/* 响应式媒体查询 */
@media (max-width: 1100px) {
  .metric-dashboard { grid-template-columns: 1fr; }
  .overview-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-dual-grid { grid-template-columns: 1fr; }
  .ep-sidebar { width: 250px; }
}
