/* ============================================================
   StepScore · components.css
   按钮 / 卡片 / 标签 / 表格 / 表单 / 浮层 / 代码 / 图表
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.08s var(--ease);
}
.btn:hover { border-color: #bfc8bd; background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .ic { color: var(--ink-3); }
.btn--primary {
  background: linear-gradient(180deg, #127a63 0%, var(--brand) 55%, var(--brand-deep) 100%);
  border-color: var(--brand-deep);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(10, 79, 65, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn--primary .ic { color: rgba(255, 255, 255, 0.9); }
.btn--primary:hover { background: var(--brand-deep); color: #fff; border-color: var(--brand-ink); }
.btn--soft { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-ink); }
.btn--soft .ic { color: var(--brand); }
.btn--soft:hover { background: var(--brand-soft-2); border-color: var(--brand-line); color: var(--brand-ink); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn--danger { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.btn--danger:hover { background: #f7dedb; color: #922e27; }
.btn--accent { background: var(--accent-soft); border-color: #eed7b8; color: var(--accent-deep); }
.btn--accent:hover { background: #f8e7cf; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn--xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; gap: 4px; }
.btn--lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: 11px; }
.btn--block { width: 100%; }
.btn--icon { width: 34px; padding: 0; }
.btn--icon.btn--sm { width: 29px; }
.btn--loading { pointer-events: none; opacity: 0.8; }
.btn--loading .ic { animation: spin 0.9s linear infinite; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 550;
}
.link-btn:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 3px; }
.link-btn .ic { transition: transform 0.16s var(--ease); }
.link-btn:hover .ic { transform: translateX(2px); }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card--pad { padding: 18px; }
.card--pad-lg { padding: 22px; }
.card--flush { overflow: hidden; }
.card--soft { background: var(--surface-2); }
.card--brand {
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(140deg, #0f6e59, #0a4f41 70%, #093f35);
  border-color: #0a4f41;
  color: #eaf4ef;
}
.card--brand .card-title { color: #fff; }
.card--brand .muted { color: rgba(234, 244, 239, 0.66); }
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.card-hd--flush { border-bottom: 0; padding-bottom: 0; }
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card-title .ic { color: var(--ink-3); }
.card-sub { margin-top: 3px; font-size: 11.5px; color: #3f5148; overflow-wrap: anywhere; }
.card-bd { padding: 16px 18px; }
.card-bd--tight { padding: 10px 12px; }
.card-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-hover { transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease); }
.card-hover:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ---------- 标签 / 徽标 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip--brand { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-ink); }
.chip--amber { background: var(--accent-soft); border-color: #f0ddc2; color: var(--accent-deep); }
.chip--blue { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.chip--violet { background: var(--violet-soft); border-color: #ded7f0; color: var(--violet); }
.chip--ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.chip--bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.chip--warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.chip--ghost { background: transparent; }
.chip--dark { background: var(--ink); border-color: var(--ink); color: #fff; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tag--mono { font-family: var(--mono); font-size: 10px; }
.tag--brand { background: var(--brand-soft); color: var(--brand-ink); }
.tag--amber { background: var(--accent-soft); color: var(--accent-deep); }
.tag--outline { background: transparent; border: 1px solid var(--line); }

/* 三值判定 */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  white-space: nowrap;
}
.verdict .ic { width: 12px; height: 12px; }
.verdict--pass { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.verdict--fail { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.verdict--unknown {
  background: #fbf2e0;
  border-color: var(--warn-line);
  border-style: solid;
  color: #8b5900;
}
.verdict--none { background: var(--surface-3); border-color: var(--line); color: var(--ink-4); }
.verdict-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.verdict--pass .verdict-dot { background: var(--ok); }
.verdict--fail .verdict-dot { background: var(--bad); }
.verdict--unknown .verdict-dot { background: var(--warn); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-3);
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.status-pill--ok { background: var(--ok-soft); color: var(--ok); }
.status-pill--warn { background: var(--warn-soft); color: var(--warn); }
.status-pill--bad { background: var(--bad-soft); color: var(--bad); }
.status-pill--info { background: var(--info-soft); color: var(--info); }
.status-pill--brand { background: var(--brand-soft); color: var(--brand-ink); }

.diff {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.diff::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.diff--easy { color: var(--ok); }
.diff--medium { color: var(--accent-deep); }
.diff--hard { color: var(--bad); }
.diff--l1 { color: #15803d; }
.diff--l2 { color: #65a30d; }
.diff--l3 { color: #ca8a04; }
.diff--l4 { color: #ea580c; }
.diff--l5 { color: #dc2626; }

/* ---------- 统计卡 ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 16px;
  min-width: 0;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 11.5px; color: var(--ink-3); font-weight: 550; letter-spacing: 0.02em; }
.stat-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-3);
}
.stat-ico--brand { background: var(--brand-soft); color: var(--brand); }
.stat-ico--amber { background: var(--accent-soft); color: var(--accent-deep); }
.stat-ico--blue { background: var(--info-soft); color: var(--info); }
.stat-ico--bad { background: var(--bad-soft); color: var(--bad); }
.stat-value {
  font-size: 27px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.stat-value small { font-size: 12px; font-weight: 550; color: var(--ink-4); letter-spacing: 0; }
.stat-foot { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-4); }
.trend-up { color: var(--ok); font-weight: 600; }
.trend-down { color: var(--bad); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow: auto; }
.table {
  width: 100%;
  font-size: 12.5px;
  border-collapse: separate;
  border-spacing: 0;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--ink-2); }
.table th .ic { display: inline-block; vertical-align: -2px; margin-left: 2px; }
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table .cell-main { font-weight: 600; color: var(--ink); font-size: 13px; }
.table .cell-sub { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.table .num { font-variant-numeric: tabular-nums; }
.table--compact td { padding: 8px 12px; }
.table--compact th { padding: 8px 12px; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .score-cell { font-weight: 700; font-size: 13.5px; }

/* ---------- 筛选 / 搜索 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.16s var(--ease);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--line-2); color: var(--ink); }
.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 600;
}
.filter-chip .count {
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filter-chip.active .count { background: rgba(255, 255, 255, 0.16); color: #fff; }

.field-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-4);
  min-width: 220px;
}
.field-search:focus-within { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.field-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 12.5px; color: var(--ink); }

/* ---------- 标签页 ---------- */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 550;
  transition: all 0.16s var(--ease);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: var(--shadow-xs);
}
.tab .count { font-size: 10px; color: var(--ink-4); font-weight: 600; }
.tab-line {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}
.tab-line .tab {
  height: 40px;
  padding: 0 2px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: none;
  box-shadow: none;
  font-size: 13px;
}
.tab-line .tab.active { border-bottom-color: var(--brand); color: var(--brand-ink); background: none; }
a.tab { text-decoration: none; }
a.tab:hover { text-decoration: none; }

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  gap: 2px;
}
.segmented button {
  height: 27px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 550;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-xs); }
.segmented--verdict button.active[data-v="PASS"] { color: var(--ok); }
.segmented--verdict button.active[data-v="FAIL"] { color: var(--bad); }
.segmented--verdict button.active[data-v="UNKNOWN"] { color: var(--warn); }

/* ---------- 进度 / 环 ---------- */
.progress {
  position: relative;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.5s var(--ease);
}
.progress--amber > i { background: var(--accent); }
.progress--bad > i { background: var(--bad); }
.progress--thin { height: 4px; }
.progress--tall { height: 8px; }
.meter { display: flex; gap: 3px; }
.meter > i { height: 6px; flex: 1; border-radius: 2px; background: var(--surface-3); }

.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(20, 40, 30, 0.08); }
.ring-bar { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }
.ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-align: center;
}
.ring-value { font-size: 26px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-value small { font-size: 11px; font-weight: 550; color: var(--ink-4); margin-left: 1px; letter-spacing: 0; }
.ring-label { font-size: 10px; color: var(--ink-4); margin-top: 5px; letter-spacing: 0.05em; }
.ring--sm .ring-value { font-size: 18px; }
.ring--sm .ring-label { font-size: 9px; margin-top: 3px; }

/* ---------- 空状态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 42px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty-ico {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-4);
  margin-bottom: 2px;
}
.empty-title { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.empty-desc { font-size: 12px; color: #3f5148; max-width: 320px; line-height: 1.6; }

/* ---------- 提示 / 告警 ---------- */
.alert {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.alert .alert-ico { flex: none; margin-top: 1px; color: var(--ink-3); }
.alert-title { font-weight: 650; color: var(--ink); font-size: 12.5px; }
.alert-body { min-width: 0; }
.alert-body p + p { margin-top: 3px; }
.alert--warn { background: var(--warn-soft); border-color: var(--warn-line); }
.alert--warn .alert-ico { color: var(--warn); }
.alert--bad { background: var(--bad-soft); border-color: var(--bad-line); }
.alert--bad .alert-ico { color: var(--bad); }
.alert--ok { background: var(--ok-soft); border-color: var(--ok-line); }
.alert--ok .alert-ico { color: var(--ok); }
.alert--info { background: var(--info-soft); border-color: var(--info-line); }
.alert--info .alert-ico { color: var(--info); }
.alert--brand { background: var(--brand-soft); border-color: var(--brand-soft-2); }
.alert--brand .alert-ico { color: var(--brand); }

.callout {
  padding: 11px 13px;
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--brand-soft);
  font-size: 12px;
  line-height: 1.65;
  color: var(--brand-ink);
}

/* ---------- 下拉 / 浮层 ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s var(--ease);
}
.dropdown-hd {
  padding: 8px 10px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
  transition: background 0.12s var(--ease);
}
.dropdown-item:hover { background: var(--surface-3); color: var(--ink); }
.dropdown-item .ic { color: var(--ink-4); }
.dropdown-item .right-hint { margin-left: auto; color: var(--ink-4); font-size: 11px; }
.dropdown-item--danger { color: var(--bad); }
.dropdown-item--danger .ic { color: var(--bad); }
.dropdown-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.dropdown-item .notif-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---------- 模态 / 抽屉 / Toast ---------- */
body.has-overlay #app,
body.has-overlay #login-screen,
body.has-overlay #password-screen,
body.has-overlay #task-banner { pointer-events: none; }
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 25, 21, 0.42);
  backdrop-filter: blur(3px);
  animation: fade-in 0.18s var(--ease);
}
@media (max-width: 720px) {
  .overlay { padding: 12px; }
  .modal, .drawer { max-height: calc(100vh - 24px); }
}
.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: pop-in 0.2s var(--ease);
  overflow: hidden;
}
.modal--lg { width: min(880px, 100%); }
.modal--xl { width: min(1060px, 100%); }
.modal--sm { width: min(420px, 100%); }
.modal-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.modal-sub { margin-top: 3px; font-size: 12px; color: var(--ink-4); line-height: 1.55; }
.modal-bd { padding: 18px 20px; overflow: auto; }
.modal-ft {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-ft .left { margin-right: auto; display: flex; align-items: center; gap: 8px; }

.drawer-overlay { justify-content: flex-end; padding: 0; }
.drawer {
  width: min(460px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slide-left 0.24s var(--ease);
  border-left: 1px solid var(--line);
}
.drawer--wide { width: min(600px, 100%); }
@keyframes slide-left { from { transform: translateX(28px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-bd { flex: 1; overflow: auto; padding: 18px 20px; }
.drawer-ft {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 240px;
  max-width: 400px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--ink);
  color: #edf3ee;
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.24s var(--ease);
  pointer-events: auto;
}
.toast .ic { color: #9fd8c3; }
.toast--warn { background: #5d4312; border-color: #7d5a17; }
.toast--warn .ic { color: #f3ce8c; }
.toast--bad { background: #571f1b; border-color: #7c2c26; }
.toast--bad .ic { color: #f0a9a1; }
.toast--info { background: #1c3a57; border-color: #2b537c; }
.toast--info .ic { color: #a9ccef; }
.toast.is-out { animation: fade-in 0.2s var(--ease) reverse forwards; }

/* 简易提示气泡 */
.tip { position: relative; }
.tip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  white-space: nowrap;
  pointer-events: none;
  animation: fade-in 0.14s var(--ease);
}

/* ---------- 表单 ---------- */
.form-grid { display: grid; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row--inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.label .req { color: var(--bad); }
.label .opt-tag { margin-left: auto; font-weight: 400; color: var(--ink-4); font-size: 10.5px; }
.hint { font-size: 11.5px; color: var(--ink-4); line-height: 1.55; }
.hint--warn { color: var(--warn); }
.input, .textarea, .select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input, .select { height: 37px; padding: 0 11px; }
.textarea { padding: 9px 11px; line-height: 1.65; resize: vertical; min-height: 76px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366776e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input--code { font-family: var(--mono); font-size: 12px; }

.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

.switch {
  position: relative;
  width: 36px;
  height: 21px;
  border-radius: var(--r-full);
  border: 0;
  background: var(--line-2);
  transition: background 0.18s var(--ease);
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s var(--ease);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(15px); }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
}
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card {
  flex: 1 1 0;
  min-width: 110px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  text-align: left;
  transition: all 0.16s var(--ease);
}
.radio-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.radio-card.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.radio-card b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.radio-card.active b { color: var(--brand-ink); }
.radio-card span { display: block; font-size: 10.5px; color: var(--ink-4); margin-top: 2px; }

/* ---------- 步骤条 ---------- */
.stepper { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 9px; }
.step-num {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
.step-label { font-size: 12px; font-weight: 550; color: var(--ink-4); white-space: nowrap; }
.step.active .step-num { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.active .step-label { color: var(--ink); font-weight: 650; }
.step.done .step-num { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.step.done .step-label { color: var(--ink-3); }
.step-line { width: 42px; height: 1px; background: var(--line); margin: 0 12px; }
.step.done + .step-line { background: var(--brand-line); }

/* ---------- 代码 ---------- */
.code {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.72;
  color: var(--ink-2);
  tab-size: 4;
}
.code-view {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fbfcf9;
  overflow: auto;
}
.code-view--dark {
  background: #101a16;
  border-color: #1d2c26;
  color: #d7e4dc;
}
.code-inner { display: flex; min-width: max-content; }
.code-gutter {
  flex: none;
  padding: 13px 0;
  text-align: right;
  user-select: none;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}
.code-view--dark .code-gutter { border-color: #22322b; background: #0d1613; }
.code-gutter span {
  display: block;
  padding: 0 10px 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.72;
  color: var(--ink-4);
}
.code-pre { flex: 1; padding: 13px 18px 13px 14px; margin: 0; overflow: visible; }
.code-line { display: block; white-space: pre; padding: 0 8px; margin: 0 -8px; border-radius: 4px; }
.code-line.is-hit {
  background: #fdf1dc;
  box-shadow: inset 2px 0 0 var(--accent);
}
.code-view--dark .code-line.is-hit { background: rgba(194, 118, 44, 0.16); }
.code-line.is-dim { opacity: 0.38; }
.code-line.is-clickable { cursor: pointer; }
.code-line.is-clickable:hover { background: var(--surface-3); }
.code-line .ln-mark { color: var(--accent-deep); font-weight: 700; margin-left: 6px; font-family: var(--font); font-size: 10px; }

/* 语法着色 */
.tok-kw { color: #9a3d8f; font-weight: 550; }
.tok-str { color: #a75a1d; }
.tok-num { color: #35689e; }
.tok-com { color: #8b978f; font-style: italic; }
.tok-fn { color: #0e6b57; }
.tok-typ { color: #6b5aa6; }
.tok-op { color: #7b6a5e; }
.code-view--dark .tok-kw { color: #d6a9d0; }
.code-view--dark .tok-str { color: #e5b98b; }
.code-view--dark .tok-num { color: #8fb8e6; }
.code-view--dark .tok-com { color: #6f8379; }
.code-view--dark .tok-fn { color: #7fd0b4; }
.code-view--dark .tok-typ { color: #b9a9e8; }

/* ---------- 编辑区 ---------- */
.editor-shell {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fbfcf9;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.editor-toolbar .spacer { flex: 1; }
.editor-body {
  position: relative;
  display: flex;
  min-height: 380px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(242, 244, 238, 0.65) 0 46px, transparent 46px);
}
.editor-gutter {
  flex: none;
  width: 46px;
  padding: 12px 0;
  text-align: right;
  user-select: none;
  overflow: hidden;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.72;
}
.editor-gutter span { display: block; padding-right: 11px; }
.editor-scroll {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: auto;
}
.editor-pre, .editor-ta {
  margin: 0;
  padding: 12px 16px 48px 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.72;
  tab-size: 4;
  white-space: pre;
  word-wrap: normal;
  min-height: 100%;
}
.editor-pre { position: absolute; inset: 0; pointer-events: none; color: var(--ink-2); min-width: max-content; }
.editor-ta {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  border: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--ink);
  outline: none;
  overflow: hidden;
}
.editor-ta::selection { background: rgba(14, 107, 87, 0.18); color: transparent; }
.editor-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 11px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-4);
}
.editor-foot .ok { color: var(--ok); }

/* 控制台 */
.console {
  border-top: 1px solid var(--line);
  background: var(--surface);
  max-height: 250px;
  overflow: auto;
}
.console-hd {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-3);
}
.console-bd { padding: 11px 13px; font-family: var(--mono); font-size: 11.5px; line-height: 1.8; }
.console-line { display: flex; gap: 8px; align-items: baseline; }
.console-line .idx { color: var(--ink-4); width: 20px; flex: none; text-align: right; }
.console-line .msg { min-width: 0; }
.console-line .ok { color: var(--ok); }
.console-line .bad { color: var(--bad); }
.console-line .dim { color: var(--ink-4); }
.console .test-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--font);
  font-size: 12px;
  color: var(--ink-2);
}
.console .test-row:last-child { border-bottom: 0; }
.console .test-idx {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  width: 24px;
}
.console .test-name { flex: 1; min-width: 0; }
.console .test-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }

/* ---------- 性质行 ---------- */
.prop-group + .prop-group { margin-top: 18px; }
.prop-group-hd {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 4px;
}
.prop-group-title { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.01em; }
.prop-group-meta { margin-left: auto; font-size: 11px; color: var(--ink-4); }
.prop-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.prop-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 13px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: background 0.14s var(--ease);
}
.prop-row:last-child { border-bottom: 0; }
.prop-row:hover { background: var(--surface-2); }
.prop-row.is-open { background: var(--surface-2); }
.prop-row-main { flex: 1; min-width: 0; }
.prop-name { font-size: 12.5px; font-weight: 550; color: var(--ink-2); line-height: 1.5; }
.prop-name .core-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0 5px;
  height: 16px;
  border-radius: 4px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 9.5px;
  font-weight: 700;
  vertical-align: 1px;
}
.prop-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.prop-weight {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  padding-top: 1px;
  min-width: 34px;
  text-align: right;
}
.prop-expand {
  border-top: 1px dashed var(--line);
  padding: 12px 13px 13px 44px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-2);
}
.prop-expand .kv { display: flex; gap: 8px; padding: 3px 0; }
.prop-expand .kv b { flex: none; width: 70px; color: var(--ink-4); font-weight: 550; font-size: 11px; padding-top: 1px; }
.prop-expand .kv span { min-width: 0; line-height: 1.6; }
.prop-expand .evidence-quote {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.65;
}
.prop-expand .actions { display: flex; gap: 8px; margin-top: 10px; }
.channel-list {
  margin: 6px 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.channel-item {
  display: grid;
  grid-template-columns: 88px 92px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 11.5px;
}
.channel-item:last-child { border-bottom: 0; }
.channel-name { color: var(--ink-2); font-weight: 600; }
.channel-evidence { color: var(--ink-4); line-height: 1.55; }
.channel-agg {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.6;
}
.channel-agg b { color: var(--ink-2); }

/* ---------- 自评流水线 ---------- */
.pipeline { display: flex; flex-direction: column; gap: 0; }
.pipe-step {
  display: flex;
  gap: 11px;
  padding: 8px 0;
  position: relative;
}
.pipe-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 30px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}
.pipe-ico {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-4);
  flex: none;
  z-index: 1;
}
.pipe-step.done .pipe-ico { background: var(--brand-soft); color: var(--brand); }
.pipe-step.running .pipe-ico { background: var(--accent-soft); color: var(--accent-deep); }
.pipe-step.running .pipe-ico .ic { animation: spin 1s linear infinite; }
.pipe-title { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.5; }
.pipe-desc { font-size: 10.5px; color: var(--ink-4); margin-top: 1px; }
.pipe-step.pending .pipe-title { color: var(--ink-4); font-weight: 500; }

/* ---------- 列表条目 ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  transition: background 0.12s var(--ease);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.clickable { cursor: pointer; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.list-item-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item-side { display: flex; align-items: center; gap: 10px; flex: none; }

/* ---------- 上传区 ---------- */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 20px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone .up-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}
.upload-zone b { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.upload-zone span { font-size: 11px; color: var(--ink-4); }

/* ---------- 数据条 / 迷你图 ---------- */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { flex: none; width: 92px; font-size: 11.5px; color: var(--ink-3); }
.bar-track { flex: 1; height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #2b8f76); transition: width 0.8s var(--ease); }
.bar-fill--amber { background: linear-gradient(90deg, var(--accent), #daa25c); }
.bar-fill--blue { background: linear-gradient(90deg, var(--info), #6a99c8); }
.bar-fill--bad { background: linear-gradient(90deg, var(--bad), #d1776e); }
.bar-value { flex: none; width: 38px; text-align: right; font-size: 11px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.spark { display: inline-block; vertical-align: middle; overflow: visible; }

.heatmap { display: grid; gap: 3px; }
.hm-cell {
  height: 26px;
  border-radius: 4px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  color: var(--ink-4);
  cursor: default;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.hm-cell:hover { transform: scale(1.1); box-shadow: var(--shadow-sm); z-index: 1; }
.hm-label { font-size: 10.5px; color: var(--ink-3); display: flex; align-items: center; padding-right: 8px; white-space: nowrap; }
.hm-head { font-size: 10px; color: var(--ink-4); writing-mode: vertical-rl; text-align: left; padding: 0 2px; height: 96px; display: flex; align-items: flex-end; }
.legend { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-4); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- 进度点 / 时间线 ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 4px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-2);
}
.tl-item.is-done::before { background: var(--brand); border-color: var(--brand); }
.tl-item.is-active::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tl-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }

/* ---------- 小工具 ---------- */
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.bullet { display: flex; gap: 7px; font-size: 12px; color: var(--ink-2); line-height: 1.65; }
.bullet::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 8px; flex: none; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mono-block {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-2);
  overflow-x: auto;
  white-space: pre;
}
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
.loading-line {
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 25%, #e9ece4 37%, var(--surface-3) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.3s ease infinite;
}

/* 分数色阶 */
.score-tone--high { color: var(--ok); }
.score-tone--mid { color: var(--accent-deep); }
.score-tone--low { color: var(--bad); }

/* 置信度 */
.conf { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-4); }
.conf-track { width: 42px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.conf-track i { display: block; height: 100%; border-radius: 4px; background: var(--ok); }
.conf-track i.mid { background: var(--accent); }
.conf-track i.low { background: var(--bad); }
