:root {
  --bg: #0b0d13;
  --bg-elevated: #12151f;
  --bg-card: #161a27;
  --bg-hover: #1e2436;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #eef1f8;
  --text-secondary: #9aa3b8;
  --text-muted: #6b7389;
  --primary: #5b8cff;
  --primary-hover: #7aa2ff;
  --primary-soft: rgba(91, 140, 255, 0.14);
  --success: #3dd68c;
  --success-soft: rgba(61, 214, 140, 0.14);
  --warning: #f5b942;
  --warning-soft: rgba(245, 185, 66, 0.14);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.14);
  --accent: #a78bfa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --sidebar-w: 248px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Boot splash */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(800px 400px at 50% 30%, rgba(91, 140, 255, 0.12), transparent 60%),
    var(--bg);
  z-index: 1000;
}
.boot-card { text-align: center; }
.boot-title { font-size: 20px; font-weight: 700; margin-top: 14px; letter-spacing: -0.02em; }
.boot-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.boot-bar {
  width: 160px;
  height: 3px;
  margin: 18px auto 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.boot-bar > i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8cff, #a78bfa);
  animation: bootSlide 1.1s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

#app {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 8% -12%, rgba(91, 140, 255, 0.1), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(167, 139, 250, 0.07), transparent 50%),
    var(--bg);
}

/* macOS hiddenInset 标题栏：为红绿灯预留安全区 + 整窗可拖 */
.titlebar-drag {
  display: none;
}
html.is-darwin {
  --titlebar-h: 52px;
  --traffic-safe-left: 78px;
}
html.is-darwin .titlebar-drag {
  display: block;
  position: fixed;
  top: 0;
  /* 从红绿灯右侧开始，左侧完全留给系统控件与窗口菜单 */
  left: var(--traffic-safe-left);
  right: 0;
  height: var(--titlebar-h);
  z-index: 40;
  -webkit-app-region: drag;
  background: transparent;
}
/* 侧栏顶栏空区也可拖（红绿灯下方空白） */
html.is-darwin .sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--titlebar-h);
  -webkit-app-region: drag;
  /* 左侧红绿灯命中区不抢事件 */
  clip-path: inset(0 0 0 var(--traffic-safe-left));
  pointer-events: none;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(11, 13, 19, 0.78);
  backdrop-filter: blur(16px);
  padding: 18px 12px;
  position: relative;
  z-index: 1;
}
html.is-darwin .sidebar {
  /* 品牌区整体下移，不再与红绿灯重叠 */
  padding-top: calc(var(--titlebar-h) + 6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
}
html.is-darwin .brand {
  -webkit-app-region: drag;
  /* 略收紧，给标题栏更干净的呼吸感 */
  padding-top: 2px;
  padding-bottom: 14px;
}
html.is-darwin .brand-mark {
  /* 略小一号，避免视觉抢红绿灯 */
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(91, 140, 255, 0.24);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #5b8cff, #a78bfa);
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.3);
}
.brand-mark.lg { width: 56px; height: 56px; font-size: 18px; margin: 0 auto; border-radius: 16px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ready-mini {
  margin: 0 6px 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.ready-mini-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ready-mini-top strong { color: var(--primary-hover); font-size: 12px; }
.ready-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.ready-track > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8cff, #3dd68c);
  transition: width 0.4s ease;
}

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  text-align: left;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 600;
}
.nav-icon { width: 20px; text-align: center; opacity: 0.9; }

.sidebar-footer { padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.lang-switch {
  display: inline-flex;
  align-self: stretch;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  gap: 2px;
}
.lang-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
}
.lang-switch.settings-lang {
  max-width: 280px;
  align-self: flex-start;
}
.lang-switch.settings-lang .lang-btn {
  font-size: 13px;
  padding: 8px 14px;
}

.loop-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
.loop-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
}
.loop-pill.on .dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.2);
}
.loop-pill.on { color: var(--success); border-color: rgba(61, 214, 140, 0.25); }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 28px 10px;
  gap: 16px;
}
html.is-darwin .topbar {
  /* 与侧栏标题栏高度对齐，主区也可拖动窗口 */
  padding-top: calc(var(--titlebar-h) + 8px);
  -webkit-app-region: drag;
}
html.is-darwin .topbar-actions,
html.is-darwin .topbar-actions * {
  -webkit-app-region: no-drag;
}
/* 可交互控件统一禁止拖拽，避免按钮点不动 */
html.is-darwin button,
html.is-darwin a,
html.is-darwin input,
html.is-darwin select,
html.is-darwin textarea,
html.is-darwin .nav-item,
html.is-darwin .ready-mini,
html.is-darwin .loop-pill,
html.is-darwin .modal,
html.is-darwin .drawer,
html.is-darwin .toasts {
  -webkit-app-region: no-drag;
}
.topbar h1 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  flex: 1;
  overflow: auto;
  padding: 12px 28px 32px;
}

/* Buttons */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, #5b8cff, #6c7cff);
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(91, 140, 255, 0.28);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.success {
  background: var(--success-soft);
  border-color: rgba(61, 214, 140, 0.35);
  color: var(--success);
}
.btn.danger {
  background: var(--danger-soft);
  border-color: rgba(255, 107, 122, 0.35);
  color: var(--danger);
}
.btn.ghost { background: transparent; position: relative; }
.btn.icon { padding: 8px 10px; min-width: 36px; justify-content: center; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

.badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.badge.hidden { display: none; }

/* Cards / grids */
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1.15fr 1fr; }
.grid.form { grid-template-columns: 1fr 1fr; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1100px) {
  .grid.stats, .grid.three { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.main, .content, #app {
  min-width: 0;
}
.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary-soft);
  pointer-events: none;
}
.stat-label { color: var(--text-secondary); font-size: 12px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.stat-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* Checklist */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.check-item:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.check-item.done { opacity: 0.72; }
.check-box {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  margin-top: 1px;
}
.check-item.done .check-box {
  background: var(--success-soft);
  border-color: rgba(61, 214, 140, 0.45);
  color: var(--success);
}
.check-body { flex: 1; min-width: 0; }
.check-title { font-weight: 600; font-size: 13px; }
.check-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-state .icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 22px;
}
.empty-state h4 { font-size: 16px; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 13px; max-width: 360px; margin: 0 auto 16px; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sk-line { height: 12px; margin-bottom: 10px; }
.sk-line.lg { height: 28px; width: 40%; }
.sk-card { height: 96px; }

/* Tables / lists */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.02); }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover {
  background: rgba(255,255,255,0.02);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 8px;
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  flex-shrink: 0;
}
.item-main { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.threat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.threat-high { background: var(--danger-soft); color: var(--danger); }
.threat-mid { background: var(--warning-soft); color: var(--warning); }
.threat-low { background: var(--success-soft); color: var(--success); }

.threat-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  min-width: 72px;
}
.threat-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3dd68c, #f5b942, #ff6b7a);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  margin: 2px 4px 2px 0;
}
.chip.blue { background: var(--primary-soft); color: var(--primary-hover); }
.chip.purple { background: rgba(167, 139, 250, 0.15); color: #c4b5fd; }
.chip.green { background: var(--success-soft); color: var(--success); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-pending { background: var(--warning); }
.status-confirmed { background: var(--success); }
.status-rejected { background: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
input.is-invalid, textarea.is-invalid, select.is-invalid {
  border-color: rgba(255, 107, 122, 0.55);
}
textarea { min-height: 90px; resize: vertical; }
select { cursor: pointer; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .spacer { flex: 1; min-width: 8px; }
.toolbar select { width: auto; min-width: 120px; max-width: 160px; }

/* Competitor layout fix + viz */
.comp-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.viz-panel {
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(40, 60, 120, 0.18), transparent 70%),
    linear-gradient(180deg, #0c101c 0%, #080a12 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  overflow: hidden;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(91, 140, 255, 0.06) inset,
    0 24px 48px rgba(0, 0, 0, 0.35);
}
.viz-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.viz-toolbar .seg {
  display: inline-flex;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 11px;
  overflow: hidden;
  padding: 2px;
  gap: 2px;
}
.viz-toolbar .seg button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 9px;
  transition: all 0.15s ease;
}
.viz-toolbar .seg button:hover { color: var(--text); }
.viz-toolbar .seg button.active {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.35), rgba(107, 155, 255, 0.2));
  color: #dbe7ff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(91, 140, 255, 0.2);
}
.viz-axis-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.viz-axis-pick label { display: flex; align-items: center; gap: 6px; }
.viz-axis-pick select {
  width: auto;
  min-width: 110px;
  padding: 6px 8px;
  font-size: 12px;
  background: rgba(0,0,0,0.35);
  border-color: rgba(255,255,255,0.1);
}
.viz-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 360px;
  height: min(52vh, 520px);
  aspect-ratio: 16 / 9;
  max-height: 560px;
  width: 100%;
  min-width: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 55%, rgba(60, 90, 160, 0.12), transparent 65%);
}
.viz-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}
.viz-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-secondary);
  background: rgba(8, 10, 18, 0.72);
  z-index: 2;
}
.viz-empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 8px;
}
.viz-empty p {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 36ch;
  line-height: 1.5;
  margin: 0 auto;
}
.viz-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.viz-axis-hud {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 4;
  pointer-events: none;
}
.viz-axis-hud .ah {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(8, 10, 18, 0.65);
}
.viz-axis-hud .ah.x { color: #93c5fd; border-color: rgba(107, 155, 255, 0.35); }
.viz-axis-hud .ah.y { color: #5eead4; border-color: rgba(45, 212, 191, 0.35); }
.viz-axis-hud .ah.z { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.35); }

.viz-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  max-width: 160px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(10, 12, 20, 0.78);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.viz-label .viz-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.viz-label .viz-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}
.viz-label-comp.hot {
  border-color: rgba(251, 113, 133, 0.45);
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.2);
}
.viz-label-comp.hot .viz-pct {
  background: rgba(244, 63, 94, 0.25);
  color: #fda4af;
}
.viz-label:hover {
  border-color: rgba(107, 155, 255, 0.55);
  box-shadow: 0 6px 20px rgba(91, 140, 255, 0.2);
  transform: translateY(-1px);
}
.viz-label-self {
  max-width: 220px;
  padding: 5px 12px 5px 6px;
  font-weight: 600;
  font-size: 12px;
  background: linear-gradient(135deg, rgba(59, 111, 255, 0.35), rgba(20, 30, 60, 0.85));
  border: 1px solid rgba(107, 155, 255, 0.55);
  color: #dbe7ff;
  box-shadow: 0 0 24px rgba(91, 140, 255, 0.3);
  z-index: 5;
  pointer-events: auto;
  border-radius: 999px;
}
.viz-label-self .self-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  margin-right: 2px;
  font-size: 10px;
  background: linear-gradient(135deg, #5b8cff, #7aa2ff);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}
.viz-label-self.secondary {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.28), rgba(10, 30, 28, 0.85));
  border-color: rgba(45, 212, 191, 0.45);
  color: #ccfbf1;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.22);
  font-weight: 500;
  font-size: 11px;
}
.viz-label-self .self-badge.teal {
  background: linear-gradient(135deg, #14b8a6, #2dd4bf);
}
.viz-label-target {
  max-width: 240px;
  padding: 5px 12px 5px 6px;
  font-weight: 600;
  font-size: 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.35), rgba(40, 28, 8, 0.88));
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fef3c7;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.35);
  z-index: 6;
  pointer-events: auto;
  border-radius: 999px;
}
.viz-label-target .self-badge.gold {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1c1000;
}
.product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.product-item:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.product-item.active {
  border-color: rgba(91, 140, 255, 0.45);
  background: var(--primary-soft);
}
.product-item .meta { flex: 1; min-width: 0; }
.product-item .name { font-weight: 600; }
.product-item .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 11px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  align-items: center;
}
.viz-legend .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  box-shadow: 0 0 6px currentColor;
}
.viz-hint {
  padding: 0 16px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.viz-grad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.viz-grad i {
  display: block;
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #34d399, #fbbf24, #fb7185, #f43f5e);
}

/* Card list instead of broken wide table */
.comp-grid {
  display: grid;
  /* 自适应列宽：不强制拉扁，也不让格子比内容最小宽度更窄到溢出 */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  align-items: start;
}
.comp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer;
  min-width: 0;
}
.comp-card:hover {
  border-color: rgba(91, 140, 255, 0.35);
  transform: translateY(-1px);
}
.comp-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.comp-card-head .item-main {
  min-width: 0;
  flex: 1;
}
.comp-card-head .threat-pill {
  flex-shrink: 0;
}
.comp-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 12px;
  min-width: 0;
}
/* Grid 子项必须 min-width:0，否则 nowrap/长文案会冲破邻格 */
.comp-card-meta > * {
  min-width: 0;
  overflow: hidden;
}
.comp-card-meta .k {
  color: var(--text-muted);
  margin-bottom: 2px;
  font-size: 11px;
}
.comp-card-meta .v {
  color: var(--text-secondary);
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.comp-card-meta .v.is-short {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.comp-card-meta .price-main {
  color: var(--text);
  font-weight: 550;
}
.comp-card-meta .price-range {
  color: var(--text-muted);
  font-size: 11px;
}
.comp-card-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 52px;
  overflow: hidden;
  min-width: 0;
}
.comp-card-channels .chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comp-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Higher-dim table: scrollable, no clip */
.dim-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.dim-table-wrap .table {
  min-width: 900px;
}
.dim-table-wrap th,
.dim-table-wrap td {
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.view-tabs button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.view-tabs button.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 600;
}

/* Roadmap */
.rm-doc { display: flex; flex-direction: column; gap: 0; }
.rm-hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(91, 140, 255, 0.2);
  background:
    radial-gradient(ellipse 80% 80% at 0% 0%, rgba(91, 140, 255, 0.18), transparent 55%),
    linear-gradient(135deg, #12182a 0%, #0c101c 100%);
}
@media (max-width: 960px) {
  .rm-hero { grid-template-columns: 1fr; }
}
.rm-kicker {
  font-size: 12px;
  color: #93c5fd;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.rm-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.rm-summary {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 13.5px;
}
.rm-north {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(61, 214, 140, 0.1);
  border: 1px solid rgba(61, 214, 140, 0.25);
  color: #a7f3d0;
  font-size: 13px;
}
.rm-north span {
  display: inline-block;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rm-meta-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 10px;
  align-content: start;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}
.rm-meta-card .k { color: var(--text-muted); }
.rm-soft { background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent); }
.rm-quote {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
  color: #e8edf8;
}
.rm-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) {
  .rm-timeline { grid-template-columns: 1fr; }
}
.rm-phase {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}
.rm-phase-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(91, 140, 255, 0.06);
}
.rm-step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  background: linear-gradient(135deg, #5b8cff, #7aa2ff);
  color: #fff;
  flex-shrink: 0;
}
.rm-phase-name { font-weight: 700; font-size: 14px; }
.rm-phase-theme { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rm-phase-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.rm-block h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.rm-block ul, .rm-ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.rm-beat-grid { display: flex; flex-direction: column; gap: 10px; }
.rm-beat-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.rm-stack { display: flex; flex-direction: column; gap: 8px; }
.rm-pill {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  font-size: 12.5px;
  line-height: 1.45;
}
.rm-history { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.rm-hist-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 12px;
}
.rm-hist-item:hover { border-color: rgba(91,140,255,0.4); background: var(--bg-hover); }
.rm-hist-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-hist-item .s { color: var(--text-muted); flex-shrink: 0; }
.chip.orange { background: var(--warning-soft); color: var(--warning); }
.chip.red { background: var(--danger-soft); color: var(--danger); }

/* 规格书拖拽上传 */
.drop-zone {
  margin-top: 12px;
  border: 1.5px dashed var(--border-strong, rgba(255,255,255,0.18));
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  cursor: pointer;
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: rgba(91, 140, 255, 0.55);
  background: rgba(91, 140, 255, 0.06);
}
.drop-zone.drag-over {
  border-color: rgba(91, 140, 255, 0.9);
  background: rgba(91, 140, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
.drop-zone.busy {
  opacity: 0.7;
  pointer-events: none;
}
.drop-zone-inner {
  padding: 28px 20px;
  text-align: center;
  user-select: none;
}
.drop-zone-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
  opacity: 0.9;
}
.drop-zone-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.drop-zone-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 520px;
  margin: 0 auto;
}

/* 规格书解析确认 */
.spec-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.spec-field-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.spec-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.spec-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.spec-field:hover { border-color: var(--border-strong); }
.spec-field.on {
  border-color: rgba(91, 140, 255, 0.4);
  background: var(--primary-soft);
}
.spec-field input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.spec-field-body { flex: 1; min-width: 0; }
.spec-field-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.spec-field-val {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: rgba(91, 140, 255, 0.06); }

.scan-log-box {
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
}
.scan-log-line {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #9fd6a8;
}
.scan-log-line .t { color: var(--text-muted); }
.scan-log-line .m { color: #c8e6c9; word-break: break-word; }
.scan-log-line .p { color: #8ab4ff; }

/* Fix generic table overflow in content */
.card.table-card {
  padding: 0;
  overflow: hidden;
}
.card.table-card .table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.card.table-card table {
  min-width: 720px;
}

/* 逐产品对比表 */
.compare-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.compare-empty { max-width: 640px; }
.compare-table-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.compare-table {
  min-width: 980px;
  font-size: 12.5px;
}
.compare-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #12151f;
  white-space: nowrap;
}
.compare-table td.num,
.compare-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 12px;
}
.compare-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-card);
  min-width: 140px;
  max-width: 180px;
}
.compare-table thead .sticky-col {
  z-index: 3;
  background: #12151f;
}
.compare-table tbody tr {
  cursor: pointer;
}
.compare-table tbody tr:hover td {
  background: rgba(91, 140, 255, 0.06);
}
.compare-table tr.compare-best td {
  background: rgba(91, 140, 255, 0.07);
}
.compare-table .compare-reason {
  max-width: 220px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.compare-table .threat-high { color: var(--danger); }
.compare-table .threat-mid { color: var(--warning); }
.compare-table .threat-low { color: var(--success); }

.param-compare-table .param-val {
  max-width: 220px;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}
.param-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.param-status.st-same { background: var(--success-soft); color: var(--success); }
.param-status.st-diff { background: var(--warning-soft); color: var(--warning); }
.param-status.st-ours_only { background: var(--primary-soft); color: var(--primary-hover); }
.param-status.st-theirs_only { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.param-status.st-ours_higher { background: var(--warning-soft); color: var(--warning); }
.param-status.st-theirs_higher { background: var(--danger-soft); color: var(--danger); }
.param-row.status-same { opacity: 0.72; }

/* 威胁进度 */
.threat-progress {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(91, 140, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(91, 140, 255, 0.08), rgba(167, 139, 250, 0.06)),
    var(--bg-card);
}
.threat-progress.hidden { display: none !important; }
.threat-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.threat-progress-top span {
  color: var(--text-secondary);
  min-width: 0;
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}
.threat-progress-top strong {
  font-family: var(--mono);
  color: var(--primary-hover);
  font-variant-numeric: tabular-nums;
}
.threat-vs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.threat-vs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  min-width: 0;
}
.threat-vs-row.is-primary {
  border-color: rgba(91, 140, 255, 0.35);
  background: var(--primary-soft);
}
.threat-vs-name {
  font-size: 12.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.threat-vs-score {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--primary-hover);
  font-variant-numeric: tabular-nums;
}
.threat-vs-meta {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.scan-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 980px) {
  .scan-layout { grid-template-columns: 1fr; }
}
.scan-form-card,
.scan-log-card {
  min-width: 0;
  max-width: 100%;
}
.scan-form-actions {
  gap: 12px;
  align-items: flex-end;
}
.scan-form-actions .muted { flex: 1; min-width: 0; }
.scan-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.scan-log-head h3 { margin: 0; }

.scan-console {
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  min-height: 180px;
  max-height: min(42vh, 360px);
  overflow: auto;
  color: #9fd6a8;
  min-width: 0;
}
.scan-console .line { margin-bottom: 4px; opacity: 0.9; }
.scan-console .line.warn { color: var(--warning); }
.scan-console .line.err { color: var(--danger); }
.scan-console .line.info { color: #8ab4ff; }
.scan-log-placeholder {
  padding: 18px 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}
.scan-log-row {
  display: grid;
  grid-template-columns: 64px 52px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-width: 0;
}
.scan-log-row:last-child { border-bottom: none; }
.scan-log-time {
  color: var(--text-muted);
  font-size: 11px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.scan-log-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  white-space: nowrap;
}
.scan-log-badge.stage-start { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.scan-log-badge.stage-discover { background: rgba(167,139,250,0.16); color: #c4b5fd; }
.scan-log-badge.stage-enrich { background: rgba(251,191,36,0.14); color: #fcd34d; }
.scan-log-badge.stage-threat { background: rgba(244,114,182,0.14); color: #f9a8d4; }
.scan-log-badge.stage-verify { background: rgba(45,212,191,0.14); color: #5eead4; }
.scan-log-badge.stage-done { background: rgba(61,214,140,0.14); color: #86efac; }
.scan-log-badge.stage-error { background: rgba(255,107,122,0.16); color: #fda4af; }
.scan-log-badge.stage-info { background: rgba(91,140,255,0.12); color: #93c5fd; }
.scan-log-msg {
  color: #c8e6c9;
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.scan-log-row.level-warn .scan-log-msg { color: #fde68a; }
.scan-log-row.level-err .scan-log-msg,
.scan-log-row.is-err .scan-log-msg { color: #fecdd3; }
.scan-log-row.level-ok .scan-log-msg { color: #bbf7d0; }
.scan-log-row.level-pulse .scan-log-msg { color: #93c5fd; font-style: italic; }
.scan-log-row.level-item .scan-log-msg { color: #e9d5ff; }
.scan-log-row.level-work .scan-log-msg { color: #bae6fd; }

/* 扫描实时状态条 */
.scan-pipeline-head-main { min-width: 0; flex: 1; }
.scan-live-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}
.scan-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.scan-pipeline.running .scan-live-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.18);
  animation: scanLivePulse 1.2s ease-in-out infinite;
}
.scan-pipeline.done .scan-live-dot { background: var(--success); }
.scan-pipeline.error .scan-live-dot {
  background: var(--danger);
  animation: scanLivePulse 0.6s ease-in-out infinite;
}
.scan-live-text { color: var(--text-secondary); font-weight: 600; }
.scan-live-sep { opacity: 0.45; }
.scan-elapsed {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--primary-hover);
}
.scan-activity {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  color: var(--text-muted);
}
.btn.is-loading {
  opacity: 0.85;
  pointer-events: none;
  position: relative;
}
.btn.is-loading .btn-label::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: scanLivePulse 0.8s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes scanLivePulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin: 12px 0;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5b8cff, #a78bfa);
  border-radius: inherit;
  transition: width 0.3s ease;
}

/* ===== 扫描流水线指示灯 ===== */
.scan-hero-card {
  margin-bottom: 16px;
  padding: 18px 20px 16px;
  background:
    radial-gradient(900px 220px at 10% -40%, rgba(91, 140, 255, 0.14), transparent 55%),
    radial-gradient(700px 200px at 90% 0%, rgba(167, 139, 250, 0.1), transparent 50%),
    var(--bg-card);
  overflow: hidden;
}

.scan-pipeline {
  --lamp-size: 18px;
  --pipe-cyan: #38bdf8;
  --pipe-violet: #a78bfa;
  --pipe-amber: #fbbf24;
  --pipe-rose: #f472b6;
  --pipe-teal: #2dd4bf;
  --pipe-lime: #4ade80;
  position: relative;
}

.scan-pipeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.scan-pipeline-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.scan-pipeline-sub {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text);
  max-width: 52ch;
  line-height: 1.45;
}
.scan-pipeline-pct {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--primary-hover);
  min-width: 4.2ch;
  text-align: right;
  tabular-nums: lining-nums;
  font-variant-numeric: tabular-nums;
}
.scan-pipeline.idle .scan-pipeline-pct { color: var(--text-muted); }
.scan-pipeline.done .scan-pipeline-pct { color: var(--success); }
.scan-pipeline.error .scan-pipeline-pct { color: var(--danger); }

.scan-pipeline-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 6px 4px 4px;
}

.scan-pipe-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  z-index: 1;
  min-width: 0;
}
.scan-pipe-step[data-color="cyan"]  { --lamp: var(--pipe-cyan); }
.scan-pipe-step[data-color="violet"]{ --lamp: var(--pipe-violet); }
.scan-pipe-step[data-color="amber"] { --lamp: var(--pipe-amber); }
.scan-pipe-step[data-color="rose"]  { --lamp: var(--pipe-rose); }
.scan-pipe-step[data-color="teal"]  { --lamp: var(--pipe-teal); }
.scan-pipe-step[data-color="lime"]  { --lamp: var(--pipe-lime); }

.scan-pipe-link {
  position: absolute;
  top: calc(var(--lamp-size) / 2 + 2px);
  right: 50%;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
}
.scan-pipe-link > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  overflow: hidden;
  position: relative;
}
/* 已完成段：连线点亮 */
.scan-pipe-step.done .scan-pipe-link > i,
.scan-pipe-step.active .scan-pipe-link > i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--lamp) 35%, transparent), var(--lamp));
  box-shadow: 0 0 10px color-mix(in srgb, var(--lamp) 40%, transparent);
}

.scan-lamp {
  position: relative;
  width: var(--lamp-size);
  height: var(--lamp-size);
  flex-shrink: 0;
  z-index: 2;
}
.scan-lamp-core {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.55), transparent 42%),
              radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--lamp) 55%, #1a1f2e), #0d1018 78%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.18),
    inset 0 -2px 4px rgba(0,0,0,0.45);
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.scan-lamp-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--lamp) 28%, transparent);
  opacity: 0.35;
  transition: opacity 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.scan-lamp-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--lamp) 45%, transparent), transparent 68%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.scan-pipe-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0 4px;
}
.scan-pipe-meta strong {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.scan-pipe-meta span {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* idle：全体微弱呼吸 */
.scan-pipeline.idle .scan-lamp-core {
  animation: scanLampBreathe 2.8s ease-in-out infinite;
}
.scan-pipeline.idle .scan-pipe-step:nth-child(1) .scan-lamp-core { animation-delay: 0s; }
.scan-pipeline.idle .scan-pipe-step:nth-child(2) .scan-lamp-core { animation-delay: 0.2s; }
.scan-pipeline.idle .scan-pipe-step:nth-child(3) .scan-lamp-core { animation-delay: 0.4s; }
.scan-pipeline.idle .scan-pipe-step:nth-child(4) .scan-lamp-core { animation-delay: 0.6s; }
.scan-pipeline.idle .scan-pipe-step:nth-child(5) .scan-lamp-core { animation-delay: 0.8s; }
.scan-pipeline.idle .scan-pipe-step:nth-child(6) .scan-lamp-core { animation-delay: 1s; }

/* done 灯：常亮 */
.scan-pipe-step.done .scan-lamp-core {
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.75), transparent 40%),
              radial-gradient(circle at 50% 50%, var(--lamp), color-mix(in srgb, var(--lamp) 55%, #0a0c12));
  border-color: color-mix(in srgb, var(--lamp) 70%, white);
  box-shadow:
    0 0 12px color-mix(in srgb, var(--lamp) 55%, transparent),
    inset 0 1px 2px rgba(255,255,255,0.35);
  animation: none;
}
.scan-pipe-step.done .scan-lamp-glow { opacity: 0.55; }
.scan-pipe-step.done .scan-lamp-ring {
  opacity: 0.75;
  border-color: color-mix(in srgb, var(--lamp) 65%, transparent);
}
.scan-pipe-step.done .scan-pipe-meta strong { color: var(--text); }

/* active 灯：强闪 + 外环脉冲 */
.scan-pipe-step.active .scan-lamp-core {
  background: radial-gradient(circle at 35% 30%, #fff, transparent 42%),
              radial-gradient(circle at 50% 50%, #fff 0%, var(--lamp) 42%, color-mix(in srgb, var(--lamp) 40%, #000) 100%);
  border-color: #fff;
  box-shadow:
    0 0 16px color-mix(in srgb, var(--lamp) 80%, transparent),
    0 0 32px color-mix(in srgb, var(--lamp) 35%, transparent);
  animation: scanLampBlink 0.9s ease-in-out infinite;
}
.scan-pipe-step.active .scan-lamp-ring {
  opacity: 1;
  border-color: var(--lamp);
  animation: scanRingPulse 1.2s ease-out infinite;
}
.scan-pipe-step.active .scan-lamp-glow {
  opacity: 1;
  animation: scanGlowPulse 1.1s ease-in-out infinite;
}
.scan-pipe-step.active .scan-pipe-meta strong {
  color: var(--lamp);
  text-shadow: 0 0 18px color-mix(in srgb, var(--lamp) 45%, transparent);
}
.scan-pipe-step.active .scan-pipe-meta span { color: var(--text-secondary); }

/* error */
.scan-pipe-step.error {
  --lamp: var(--danger);
}
.scan-pipe-step.error .scan-lamp-core {
  background: radial-gradient(circle at 35% 30%, #fff, transparent 40%),
              radial-gradient(circle, var(--danger), #4a1018);
  border-color: #ffb4bc;
  animation: scanLampBlink 0.55s ease-in-out infinite;
  box-shadow: 0 0 18px rgba(255, 107, 122, 0.65);
}
.scan-pipe-step.error .scan-lamp-ring {
  border-color: var(--danger);
  opacity: 1;
  animation: scanRingPulse 0.8s ease-out infinite;
}
.scan-pipe-step.error .scan-lamp-glow { opacity: 1; }

/* 运行时扫描光束：来回扫过轨道 */
.scan-pipeline-sweep {
  display: none;
  position: absolute;
  top: calc(6px + var(--lamp-size) / 2);
  left: 4%;
  width: 18%;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(91, 140, 255, 0.05),
    rgba(167, 139, 250, 0.45),
    rgba(91, 140, 255, 0.05),
    transparent
  );
  filter: blur(4px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}
.scan-pipeline.running .scan-pipeline-sweep {
  display: block;
  animation: scanSweep 2.4s ease-in-out infinite;
}

.scan-progress-bar {
  margin: 16px 0 0;
  height: 6px;
  background: rgba(255,255,255,0.05);
}
.scan-pipeline.running .scan-progress-bar > i {
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6, #4ade80);
  background-size: 200% 100%;
  animation: scanBarShimmer 2s linear infinite;
}
.scan-pipeline.done .scan-progress-bar > i {
  background: linear-gradient(90deg, #3dd68c, #5b8cff);
}
.scan-pipeline.error .scan-progress-bar > i {
  background: linear-gradient(90deg, #ff6b7a, #f5b942);
}

@keyframes scanLampBreathe {
  0%, 100% { opacity: 0.45; filter: brightness(0.85); }
  50% { opacity: 0.85; filter: brightness(1.15); }
}
@keyframes scanLampBlink {
  0%, 100% {
    filter: brightness(1.05);
    transform: scale(1);
  }
  45% {
    filter: brightness(1.55);
    transform: scale(1.08);
  }
  55% {
    filter: brightness(0.75);
    transform: scale(0.96);
  }
}
@keyframes scanRingPulse {
  0% { transform: scale(0.92); opacity: 0.95; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}
@keyframes scanGlowPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.12); }
}
@keyframes scanSweep {
  0% { left: 2%; opacity: 0.2; }
  15% { opacity: 0.9; }
  50% { left: 78%; opacity: 0.85; }
  85% { opacity: 0.9; }
  100% { left: 2%; opacity: 0.2; }
}
@keyframes scanBarShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@media (max-width: 1100px) {
  .scan-pipe-meta span { display: none; }
  .scan-pipeline-track { gap: 2px; }
}

.dim-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.dim-row .label { color: var(--text-secondary); }
.dim-row .val { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.dim-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.dim-track > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5b8cff, #a78bfa);
  border-radius: inherit;
}

/* Modal / Drawer */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 340px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 90;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.drawer.hidden { display: none; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-body { flex: 1; overflow: auto; padding: 12px 16px; }
.notify-item {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.notify-item .t { font-weight: 600; font-size: 13px; }
.notify-item .b { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.notify-item .time { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

/* Onboarding */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(10px);
  padding: 24px;
}
.onboarding.hidden { display: none; }
.onboarding-card {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.onboarding-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-bottom: 22px;
}
.onboarding-progress > i {
  display: block;
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, #5b8cff, #a78bfa);
  transition: width 0.3s ease;
}
.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}
.ob-step-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.ob-step-desc {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.6;
}
.ob-features {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.ob-feature {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.ob-feature strong { display: block; font-size: 13px; }
.ob-feature span { font-size: 12px; color: var(--text-muted); }

/* Toasts */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  font-size: 13px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.muted { color: var(--text-muted); }
.empty-hint { text-align: center; padding: 28px 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.section-gap { margin-top: 16px; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.linkish { color: var(--primary-hover); cursor: pointer; text-decoration: none; }
.linkish:hover { text-decoration: underline; }
.kv {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin: 10px 0;
}
.kv .k { color: var(--text-muted); }
.pre-box {
  background: #0a0c12;
  border-radius: 10px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--text-secondary);
  max-height: 180px;
  overflow: auto;
}
.hidden { display: none !important; }
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 13px;
}
.banner.warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(245, 185, 66, 0.25);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
