/* ============================================================
   News Sentry — 暗红新闻情报工作台 (纯色设计)
   背景: #171314  卡片: #211b1c  强调: #b3262d

   目录:
     §1  CSS 变量 (L6)        §2  全局重置 (L69)       §3  滚动条 (L103)
     §4  布局 (L122)           §5  加载动画 (L321)      §6  骨架屏 (L355)
     §7  卡片 + 排版 (L426)    §8  Dashboard (L593)     §9  事件列表 (L706)
     §10 响应式-Desktop (L600) §11 响应式-Tablet (L1124) §12 响应式-Mobile (L1163)
     §13 NLP/Entity (L1576)    §14 运维页面 (L1744)     §15 追踪链 (L1967)
     §16 叙述 + 趋势 + 告警 (L2007) §17 Dashboard增强 (L2047) §18 反馈 (L2056)
     §19 连接设置 (L2111)      §20 三层导航 + Tab (L2273) §21 动效 (L2459)
     §22 Pipeline进度 (L2490) §23 弹窗 (L2543)        §24 导入 (L2638)
     §25 通知/用户管理 (L2811) §26 快捷键面板 (L2906)
   ============================================================ */

/* ── CSS 变量 ────────────────────────────────────────────── */
:root {
  /* ── 暗红新闻室纯色设计 ── */
  --bg-primary: #171314;
  --bg-secondary: #211b1c;
  --bg-tertiary: #2b2324;
  --bg-hover: #342b2c;
  --bg-active: #403334;
  --bg-card: #1f191a;

  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a8;
  --text-muted: #6e6e78;
  --text-accent: #b3262d;
  --text-title: #f5f5f5;

  --accent-primary: #b3262d;
  --accent-secondary: #e03030;
  --accent-tertiary: #2e8b57;
  --accent-blue: #b3262d;
  --accent-blue-dim: rgba(179, 38, 45, 0.1);
  --accent-green: #2e8b57;
  --accent-yellow: #d4a017;
  --accent-red: #e03030;
  --accent-orange: #b3262d;

  --border-color: #3c3032;
  --border-light: #4b3b3d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);

  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --radius-xl: 4px;

  --sidebar-width: 220px;
  --topbar-height: 56px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;

  --bg-glass: var(--bg-secondary);
  --bg-card-hover: #2b2324;
  --accent-glow: none;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);

  /* 排版层级 */
  --font-h1: 1.5rem;
  --font-h2: 1.125rem;
  --font-h3: 0.9375rem;
  --font-body: 0.875rem;
  --font-caption: 0.75rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --page-max-width: 1120px;
  --status-success: #16804b;
  --status-warning: #b26a00;
  --status-danger: #b3262d;
  --status-muted: var(--text-muted);
  --weight-h1: 700;
  --weight-h2: 600;
  --weight-h3: 600;
  --weight-body: 400;
  --weight-caption: 400;
}

/* ── Light Mode ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f7f4f2;
  --bg-secondary: #fffdfb;
  --bg-tertiary: #f1ece8;
  --bg-hover: #eee7e3;
  --bg-active: #e5dad5;
  --bg-card: #fffdfb;

  --text-primary: #1a1a1e;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-accent: #8f1d22;
  --text-title: #111111;

  --accent-primary: #8f1d22;
  --accent-secondary: #cc2020;
  --accent-tertiary: #256d45;
  --accent-blue: #8f1d22;
  --accent-blue-dim: rgba(143, 29, 34, 0.08);
  --status-success: #16804b;
  --status-warning: #9a5b00;
  --status-danger: #8f1d22;
  --status-muted: var(--text-muted);

  --border-color: #d9cfca;
  --border-light: #e8ded8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);

  --bg-glass: #ffffff;
  --bg-card-hover: #f1ece8;
  --accent-glow: none;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 系统偏好: 未手动设置时跟随系统 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg-primary: #f7f4f2;
    --bg-secondary: #fffdfb;
    --bg-tertiary: #f1ece8;
    --bg-hover: #eee7e3;
    --bg-active: #e5dad5;
    --bg-card: #fffdfb;

    --text-primary: #1a1a1e;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-accent: #8f1d22;
    --text-title: #111111;

    --accent-primary: #8f1d22;
    --accent-secondary: #cc2020;
    --accent-tertiary: #256d45;
    --accent-blue: #8f1d22;
    --accent-blue-dim: rgba(143, 29, 34, 0.08);
    --status-success: #16804b;
    --status-warning: #9a5b00;
    --status-danger: #8f1d22;
    --status-muted: var(--text-muted);

    --border-color: #d9cfca;
    --border-light: #e8ded8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);

    --bg-glass: #ffffff;
    --bg-card-hover: #f1ece8;
    --accent-glow: none;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  }
}

/* ── 全局重置 ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-stack);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: #7aabff;
}

/* ── 滚动条 ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg {
  opacity: 1;
}

/* 侧边栏底部健康状态 */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
}

.health-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition-normal);
}
.health-badge.ok .health-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.health-badge.error .health-dot {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* 遮罩层（移动端） */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  }
.sidebar-overlay.visible {
  display: block;
}

/* ============================================================
   主内容区
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.top-bar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  min-width: 0;
  max-width: 100%;
  background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
}

.admin-page-topbar {
  flex: 0 0 var(--topbar-height);
  padding-inline: 24px;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.hamburger-btn:hover {
  color: var(--text-primary);
}

.top-bar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 页面容器 */
.page-container {
  flex: 1;
  padding: 28px;
  min-width: 0;
  max-width: 100%;
  animation: fadeIn var(--transition-slow);
}

.admin-target-context {
  min-width: 0;
}

.admin-target-context.ns-context-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.admin-target-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.admin-target-heading {
  min-width: 0;
}

.admin-target-eyebrow {
  color: var(--text-muted);
  font-size: var(--font-caption);
  margin-bottom: 4px;
  line-height: 1.2;
}

.admin-target-title {
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-target-summary {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: var(--font-caption);
  flex-wrap: wrap;
  min-width: 0;
}

.admin-target-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-target-actions {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.admin-target-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  max-width: 100%;
  scrollbar-width: thin;
}

.admin-target-chip {
  display: grid;
  gap: 2px;
  min-width: 156px;
  max-width: 220px;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.admin-target-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.admin-target-chip.active {
  border-color: var(--accent-primary);
  background: rgba(179, 38, 45, 0.08);
  color: var(--accent-primary);
}

.admin-target-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.admin-target-chip-meta {
  color: var(--text-muted);
  font-size: var(--font-caption);
}

.admin-route-content {
  min-width: 0;
  max-width: 100%;
}

/* ============================================================
   通用组件
   ============================================================ */

/* 加载动画 */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: var(--text-muted);
  gap: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 骨架屏 ─────────────────────────────────────────── */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* 统计卡片骨架 */
.skeleton-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.skeleton-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.skeleton-stat .skeleton-label {
  width: 60%;
  height: 12px;
  margin-bottom: 14px;
}

.skeleton-stat .skeleton-value {
  width: 40%;
  height: 28px;
}

/* 事件卡片骨架 */
.skeleton-event-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-event {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 22px;
}

.skeleton-event .skeleton-title {
  width: 75%;
  height: 16px;
  margin-bottom: 10px;
}

.skeleton-event .skeleton-meta {
  width: 45%;
  height: 12px;
  margin-bottom: 12px;
}

.skeleton-event .skeleton-bar {
  width: 60%;
  height: 8px;
}

/* 卡片 */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card), var(--accent-glow);
}

/* ── 排版层级 ─────────────────────────────────────────── */
.h1 { font-size: var(--font-h1); font-weight: var(--weight-h1); color: var(--text-title); }
.h2 { font-size: var(--font-h2); font-weight: var(--weight-h2); color: var(--text-primary); }
.h3 { font-size: var(--font-h3); font-weight: var(--weight-h3); color: var(--text-primary); }
.body-text { font-size: var(--font-body); font-weight: var(--weight-body); color: var(--text-primary); }
.caption { font-size: var(--font-caption); font-weight: var(--weight-caption); color: var(--text-muted); }

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
}
.stat-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-card), var(--accent-glow);
  background: var(--bg-card-hover);
}

.stat-card .stat-label {
  font-size: var(--font-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: var(--weight-caption);
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: var(--weight-h1);
  line-height: 1.1;
  color: var(--text-title);
}

.stat-card .stat-value.accent-blue { color: var(--accent-blue); }
.stat-card .stat-value.accent-green { color: var(--accent-green); }
.stat-card .stat-value.accent-orange { color: var(--accent-orange); }

/* 分数进度条 */
.score-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-slow);
  /* 颜色由 JS 内联设置 */
}

.score-bar-value {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.tag-source {
  background: rgba(179, 38, 45, 0.08);
  color: var(--accent-blue);
}

.tag-classification {
  background: rgba(234, 179, 8, 0.12);
  color: var(--accent-yellow);
}

/* 水平条形图（CSS only） */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-chart-item {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  align-items: center;
  gap: 12px;
}

.bar-chart-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart-track {
  height: 22px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.bar-chart-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-primary);
  transition: width var(--transition-slow);
  min-width: 2px;
}

.bar-chart-count {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ============================================================
   Dashboard 页面
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* 4-card grid: repeat to 2x2 on wider screens handled by auto-fit below */
@media (min-width: 1101px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--accent-blue);
  border-radius: 2px;
}

/* ============================================================
   事件列表页面
   ============================================================ */

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="search"] {
  appearance: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.85rem;
  font-family: var(--font-stack);
  min-width: 140px;
  transition: border-color var(--transition-fast);
}
.filter-group select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239399b2' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px var(--accent-blue-dim);
}

/* 分数滑块 */
.filter-group input[type="range"] {
  width: 140px;
  accent-color: var(--accent-blue);
  margin-top: 4px;
}

.filter-group .range-value {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--accent-blue);
  font-weight: 600;
}

/* 搜索框 */
.filter-group input[type="search"] {
  min-width: 200px;
}

/* 事件卡片列表 */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-card);
  animation: slideUp 0.3s ease both;
}
.event-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-card), var(--accent-glow);
  transform: translateY(-2px);
}

/* L1: 标题 + 分数 — 最高视觉权重 */
.event-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.event-card-title {
  font-size: var(--font-body);
  font-weight: var(--weight-h3);
  color: var(--text-title);
  line-height: 1.5;
  flex: 1;
}

.event-card-score-badge {
  font-size: var(--font-body);
  font-weight: var(--weight-h1);
  color: var(--accent-blue);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
  font-family: var(--font-mono);
}

.event-card-time {
  font-size: var(--font-caption);
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* L2: 来源 + 时间 + 分类 — 中等视觉权重 */
.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: var(--font-caption);
  color: var(--text-secondary);
}

.event-card-meta .tag-source {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}

.event-card-meta .tag-classification {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
}

/* L3: 分数条 + 实体标签 — 最低视觉权重，移动端隐藏 */
.event-card-scores {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.event-card-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.event-score-item {
  flex: 1;
  min-width: 150px;
}

.event-score-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* 分页器 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  padding: 12px 0;
}

.pagination button {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pagination button:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0 8px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 0.95rem;
}

/* ============================================================
   事件详情页面
   ============================================================ */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.detail-back:hover {
  color: var(--accent-blue);
}

.detail-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.detail-header {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.detail-meta-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-meta-item strong {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-body {
  padding: 24px 28px;
}

.detail-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.detail-score-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.detail-score-card .label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-score-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.detail-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.detail-field-key {
  color: var(--text-muted);
}

.detail-field-value {
  color: var(--text-primary);
  word-break: break-all;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-blue);
  font-size: 0.85rem;
  margin-top: 20px;
  padding: 10px 18px;
  background: var(--accent-blue-dim);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.detail-link:hover {
  background: rgba(179, 38, 45, 0.15);
  color: #7aabff;
}

/* ============================================================
   Toast 通知系统 (队列 + 4 种类型 + 关闭按钮)
   ============================================================ */
.ns-toast {
  position: fixed;
  right: 20px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  max-width: 420px;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.25s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ns-toast-icon { display: flex; flex-shrink: 0; }
.ns-toast-msg { flex: 1; line-height: 1.4; }
.ns-toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.ns-toast-close:hover { opacity: 1; }
.ns-toast-fadeout { opacity: 0; transition: opacity 0.2s; }

.ns-toast-success { background: #14532d; border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }
.ns-toast-success .ns-toast-icon { color: var(--accent-green); }

.ns-toast-error { background: #2d1418; border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.ns-toast-error .ns-toast-icon { color: var(--accent-red); }

.ns-toast-warning { background: #2d2414; border: 1px solid rgba(245, 158, 11, 0.3); color: #fde68a; }
.ns-toast-warning .ns-toast-icon { color: var(--accent-yellow); }

.ns-toast-info { background: #1e293b; border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }
.ns-toast-info .ns-toast-icon { color: var(--accent-blue); }

/* 兼容旧 success-toast */
.success-toast { position: fixed; bottom: 20px; right: 20px; background: #16a34a; color: #fff; padding: 10px 16px; border-radius: var(--radius-md); font-size: 0.85rem; z-index: 9999; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-card); animation: slideUp 0.3s; }
.success-toast .toast-icon { display: flex; }

/* ── 离线横幅 ──────────────────────────────────────────── */

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: var(--accent-yellow);
  color: #1a1d27;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10001;
  animation: slideDown 0.2s ease;
}

/* ── 更新提示横幅 ──────────────────────────────────────── */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
  animation: slideDown 0.3s;
}
.update-banner a { color: #fde68a; font-weight: 600; }
.update-banner strong { color: #fde68a; }

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* ── 键盘导航聚焦 ────────────────────────────────────── */

.event-card.keyboard-focus,
.top-event-row.keyboard-focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Tab 可聚焦的表单字段循环 */
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

/* 分页按钮键盘标识 */
.pagination-prev:focus,
.pagination-next:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ============================================================
   响应式
   ============================================================ */
/* ============================================================
   响应式布局 — 三断点体系
   Desktop ≥1024px | Tablet 768-1023px | Mobile <768px
   ============================================================ */

/* ── Tablet (768-1023px) ─────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 100;
    transition: transform var(--transition-normal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.admin-shell .sidebar:not(.open) {
    display: none !important;
  }

  body.admin-shell .sidebar.open {
    display: flex !important;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .hamburger-btn {
    display: flex;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .connect-card {
    margin: 16px;
    padding: 32px 28px;
  }
}

/* ── Mobile (<768px) ─────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: 48px;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 100;
    width: 260px;
    transition: transform var(--transition-normal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.admin-shell .sidebar:not(.open) {
    display: none !important;
  }

  body.admin-shell .sidebar.open {
    display: flex !important;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .hamburger-btn {
    display: flex;
  }

  /* Top bar */
  .top-bar {
    padding: 0 12px;
    height: var(--topbar-height);
    gap: 10px;
  }

  /* Tab bar */
  .tab-bar {
    padding: 8px 12px 9px;
    overflow-x: visible;
    flex-wrap: wrap;
    -webkit-overflow-scrolling: touch;
  }

  .tab-item {
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .admin-target-context,
  .admin-target-context.ns-context-panel {
    padding: 12px;
    margin-bottom: 14px;
  }

  .admin-target-context-head {
    display: grid;
    gap: 8px;
    align-items: stretch;
  }

  .admin-target-summary {
    justify-content: flex-start;
  }

  .admin-target-actions {
    justify-content: flex-start;
  }

  .admin-target-chips {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .admin-target-chip {
    flex: 1 1 calc(50% - 8px);
    min-width: 138px;
    max-width: 100%;
  }

  /* Page container */
  .page-container {
    padding: 16px 12px;
  }

  .dashboard,
  .dashboard-grid,
  .dashboard-main,
  .dashboard-sidebar,
  .dashboard .card {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard .card {
    overflow-x: auto;
  }

  .ops-actions,
  .ops-source-item {
    flex-wrap: wrap;
  }

  .ops-source-id,
  .ops-source-meta {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .keyword-table {
    width: 100%;
    table-layout: fixed;
  }

  .keyword-table th,
  .keyword-table td {
    padding: 6px 4px;
  }

  .keyword-table th:nth-child(1),
  .keyword-table td:nth-child(1) {
    width: 43%;
  }

  .keyword-table th:nth-child(2),
  .keyword-table td:nth-child(2) {
    width: 22%;
  }

  .keyword-table th:nth-child(3),
  .keyword-table td:nth-child(3) {
    width: 23%;
  }

  .keyword-table th:nth-child(4),
  .keyword-table td:nth-child(4) {
    width: 12%;
  }

  .keyword-table .config-input-sm {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
  }

  .keyword-table .btn-xs {
    width: 24px;
    height: 24px;
    padding: 0;
  }

  /* Stat cards: stack */
  .stat-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-value {
    font-size: 1.4rem;
  }

  /* Event cards: hide L3 on mobile */
  .event-card {
    padding: 14px 16px;
  }

  .event-card-scores,
  .event-card-entities {
    display: none;
  }

  .event-card-header {
    flex-direction: column;
    gap: 4px;
  }

  .event-card-title {
    font-size: 0.875rem;
  }

  /* Dashboard grid */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group select,
  .filter-group input[type="search"],
  .filter-group input[type="text"] {
    min-width: auto;
    width: 100%;
  }

  .filter-group input[type="range"] {
    width: 100%;
  }

  /* Detail page */
  .detail-header {
    padding: 16px 14px 14px;
  }

  .detail-body {
    padding: 14px;
  }

  .detail-score-grid {
    grid-template-columns: 1fr;
  }

  .detail-field {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  /* Pipeline stages */
  .pipeline-stages {
    flex-direction: column;
  }

  .stage-arrow {
    transform: rotate(90deg);
  }

  /* Connect page */
  .connect-card {
    margin: 12px;
    padding: 28px 20px;
  }

  /* Bar chart */
  .bar-chart-item {
    grid-template-columns: 80px 1fr 36px;
    gap: 8px;
  }

  /* Skeleton adjustments */
  .skeleton-stat-cards {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   导航分组标签
   ============================================================ */
.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 14px 4px;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 14px;
}

/* ============================================================
   配置页面通用
   ============================================================ */
.config-notice {
  background: var(--accent-blue-dim);
  border: 1px solid rgba(179, 38, 45, 0.15);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 24px;
  font-size: 0.82rem;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 配置卡片 */
.config-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.config-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  column-gap: 18px;
}

.config-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.config-field:last-child {
  border-bottom: none;
}

.config-field-key {
  color: var(--text-muted);
}

.config-field-value {
  color: var(--text-primary);
  word-break: break-all;
}

/* 开关组件 */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toggle-indicator.on {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.toggle-indicator.off {
  background: var(--text-muted);
}

/* 标签列表 */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.config-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Source 渠道卡片 */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.source-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: border-color var(--transition-fast);
}

.source-card:hover {
  border-color: var(--border-light);
}

.source-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.source-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.source-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 类型筛选标签 */
.type-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.type-filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-stack);
}

.type-filter-btn:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.type-filter-btn.active {
  background: var(--accent-blue-dim);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* 关键词规则表格 */
.keyword-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.keyword-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.keyword-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.keyword-table tr:hover td {
  background: var(--bg-tertiary);
}

/* 路由表格 */
.route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.route-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.route-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.route-table tr:hover td {
  background: var(--bg-tertiary);
}

.route-table .mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ── Phase 33: NLP & Entity 样式 ──────────────────────── */

.sentiment-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.chip-entity {
  background: rgba(179, 38, 45, 0.08);
  color: var(--accent-blue);
}

.chip-entity .chip-type {
  opacity: 0.6;
  font-size: 0.7rem;
  margin-left: 2px;
}

.chip-topic {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.chip-more {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.chip-link {
  text-decoration: none;
  cursor: pointer;
}

.chip-link:hover {
  filter: brightness(1.2);
}

.top-entities-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-entity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
}

.top-entity-item:hover {
  background: var(--border-color);
}

.top-entity-name {
  flex: 1;
  font-weight: 500;
}

.top-entity-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-blue);
}

.nlp-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.nlp-label {
  min-width: 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 2px;
}

.nlp-value {
  flex: 1;
}

.nlp-relations {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.sentiment-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Entity 卡片 ──────────────────────────────────────── */

.entity-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  animation: fadeIn 0.3s ease both;
}

.entity-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.entity-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.entity-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.entity-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.entity-stat strong {
  color: var(--accent-blue);
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Phase 34: 运维页面样式 ──────────────────────────── */

.ops-active-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.ops-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.ops-active-time {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}

.ops-inactive-banner {
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ops-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ops-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-action-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ops-trigger-btn {
  padding: 6px 16px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.ops-trigger-btn:hover { filter: brightness(1.1); }
.ops-trigger-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ops-reload-btn {
  padding: 6px 16px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
}

.ops-reload-btn:hover { background: var(--border-color); }
.ops-reload-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
}

.ops-health-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.ops-health-stat {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  font-size: 0.85rem;
}

.ops-health-ok { border-left: 3px solid #22c55e; }
.ops-health-warn { border-left: 3px solid #f59e0b; }
.ops-health-err { border-left: 3px solid #ef4444; }

.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ops-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 500;
}

.ops-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}

.ops-run-row {
  cursor: pointer;
  transition: background 0.15s;
}

.ops-run-row:hover {
  background: var(--bg-tertiary);
}

.ops-run-id {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.ops-error-count {
  color: #ef4444;
  font-weight: 600;
}

.ops-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
}

.ops-status-completed { background: rgba(34,197,94,0.15); color: #22c55e; }
.ops-status-running { background: rgba(59,130,246,0.15); color: #3b82f6; }
.ops-status-failed { background: rgba(239,68,68,0.15); color: #ef4444; }

.ops-source-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.ops-source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.ops-source-id {
  font-family: var(--font-mono);
  flex: 1;
}

.ops-source-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ops-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.ops-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.ops-summary-key { color: var(--text-muted); }

.ops-errors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ops-error-item {
  padding: 8px 12px;
  background: rgba(239,68,68,0.08);
  border-left: 3px solid #ef4444;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.ops-error-scope {
  font-weight: 600;
  color: #ef4444;
  margin-right: 8px;
}

/* ── Phase 35: 追踪链时间线 ─────────────────────────── */

.chain-header { margin-bottom: 24px; }
.chain-header .back-link { color: var(--primary, #3b82f6); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 8px; }
.chain-header .back-link:hover { text-decoration: underline; }
.chain-header h3 { display: inline; margin-right: 8px; }

.timeline { position: relative; padding-left: 32px; }
.timeline-item { position: relative; padding-bottom: 24px; min-height: 48px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -32px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--bg-primary, #0f1117); z-index: 1; }
.timeline-line { position: absolute; left: -26px; top: 18px; width: 2px; height: calc(100% - 18px); background: var(--border-color, #2a2e3f); }
.timeline-content { padding: 8px 12px; background: var(--bg-secondary, #1a1d27); border-radius: 8px; }
.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.timeline-title { color: var(--text-primary, #e4e6ef); text-decoration: none; font-weight: 500; font-size: 14px; flex: 1; }
.timeline-title:hover { color: var(--accent-primary); }
.timeline-badge { color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.timeline-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary, #9399b2); }
.timeline-id { font-family: var(--font-mono); }

.linked-events-card { margin-top: 16px; }
.links-list { display: flex; flex-direction: column; gap: 8px; }
.link-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-tertiary, #222636); border-radius: 6px; cursor: pointer; font-size: 13px; }
.link-item:hover { background: var(--bg-hover, #2a2e3f); }
.link-direction { font-size: 16px; font-weight: bold; }
.link-type-badge { color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.link-title { flex: 1; color: var(--text-primary, #e4e6ef); }
.link-strength { font-family: var(--font-mono); color: var(--text-secondary, #9399b2); }

.chain-row { cursor: pointer; }
.chain-row:hover { background: rgba(179, 38, 45, 0.06); }
.badge-count { background: var(--accent-primary); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }

.section-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; margin-top: 16px; }
.section-card h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border-color); color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }

/* ── Phase 36: 叙述卡片 ─────────────────────────────── */

.narrative-card { margin-bottom: 20px; }
.narrative-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.narrative-header h3 { margin: 0; }
.btn-regenerate { background: var(--primary, #3b82f6); color: #fff; border: none; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-regenerate:hover { opacity: 0.9; }
.btn-regenerate:disabled { opacity: 0.5; cursor: not-allowed; }
.narrative-text { color: var(--text-primary, #e0e0e0); line-height: 1.6; font-size: 14px; margin-bottom: 8px; }
.narrative-meta { display: flex; gap: 16px; font-size: 11px; color: var(--text-secondary, #888); }
.narrative-summary { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Phase 37: 趋势分析 ─────────────────────────────── */

.trends-page .trends-controls { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.days-toggle { display: flex; gap: 0.25rem; background: var(--bg-secondary); border-radius: 6px; padding: 2px; }
.btn-days { padding: 0.35rem 0.75rem; border: none; background: transparent; color: var(--text-muted); border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.btn-days.active { background: var(--accent-blue); color: #fff; }
.chart-section { margin-bottom: 1.5rem; }
.chart-section h3 { margin-bottom: 0.5rem; color: var(--text-primary); font-size: 0.9rem; font-weight: 600; }
.chart-container { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1rem; height: 300px; }
.topic-table-section { margin-bottom: 1.5rem; }
.topic-table-section h3 { margin-bottom: 0.5rem; color: var(--text-primary); font-size: 0.9rem; font-weight: 600; }
.trend-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 500; }
.badge-rising { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-stable { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.badge-falling { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.hotness-bar { width: 100px; height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.hotness-fill { height: 100%; background: var(--accent-blue); border-radius: 4px; transition: width 0.3s; }

/* ── Phase 38: 智能告警 ─────────────────────────────── */
.alert-item { padding: 10px 14px; margin-bottom: 8px; background: var(--bg-secondary); border-radius: var(--radius-sm); border-left: 3px solid var(--accent-blue); }
.alert-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.alert-type { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.alert-type-badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: rgba(59,130,246,0.15); color: #3b82f6; }
.alert-severity { font-size: 0.75rem; font-weight: 600; }
.alert-message { font-size: 0.85rem; color: var(--text-primary); line-height: 1.4; }
.alert-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.alert-list { display: flex; flex-direction: column; gap: 0; }

/* ── Phase 39: Dashboard 增强 ───────────────────────── */
.today-cards { margin-bottom: 16px; }
.stat-diff { font-size: 0.75rem; margin-top: 4px; }
.diff-up { color: #10b981; }
.diff-down { color: #ef4444; }
.top-events-table { margin-top: 8px; }
.top-event-row:hover { background: var(--bg-hover); }
.score-badge { font-weight: 600; }

/* ── Phase 41: 反馈闭环 + 告警管理 ─────────────────── */
.empty-hint { color: var(--text-muted); font-size: 0.85rem; padding: 1rem 0; }
.feedback-card { margin-top: 16px; }
.feedback-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.feedback-comment-row { display: flex; gap: 8px; align-items: center; }
.feedback-input { flex: 1; padding: 6px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); font-size: 0.85rem; }
.feedback-status { margin-top: 8px; }
.feedback-ok { color: #22c55e; font-size: 0.85rem; }
.feedback-hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.optimize-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.optimize-result { margin-top: 8px; }
.optimize-preview p { font-size: 0.85rem; color: var(--text-primary); margin-bottom: 8px; }
.optimize-applied { color: #22c55e; font-size: 0.85rem; padding: 8px 0; }
.optimize-empty { color: var(--text-muted); font-size: 0.85rem; padding: 8px 0; }
.btn-green { background: #22c55e; color: #fff; }
.btn-green:hover { background: #16a34a; }
.btn-red { background: #ef4444; color: #fff; }
.btn-red:hover { background: #dc2626; }
.admin-form-grid {
  display: grid;
  gap: 14px;
}
.admin-field {
  display: grid;
  gap: 6px;
}
.admin-field-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.admin-control {
  width: min(100%, 320px);
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit;
}
.admin-control:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(179, 38, 45, 0.12);
}
.admin-checkbox-grid,
.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-actions {
  margin-top: 4px;
}
.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.date-range-btns { display: inline-flex; gap: 4px; }
.btn-xs { padding: 2px 6px; font-size: 0.7rem; line-height: 1.2; }
.btn-save { margin-top: 16px; width: 100%; max-width: 200px; }

/* Research workbench */
.research-workbench {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.research-workbench-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.research-workbench-head h2 {
  margin: 4px 0 6px;
  color: var(--text-title);
  font-size: 1.35rem;
  line-height: 1.2;
}

.research-workbench-head p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 720px;
}

.research-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.research-toolbar select {
  min-height: 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 6px 10px;
}

.research-diagnostics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.research-stat,
.research-panel {
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  border-radius: var(--radius-md);
}

.research-stat {
  padding: 12px 14px;
}

.research-stat span,
.research-stat small,
.research-muted,
.research-loading,
.research-queue-meta,
.research-event-meta,
.research-operation small,
.research-operation span,
.research-artifact small,
.research-artifact time,
.research-action-hint {
  color: var(--text-muted);
}

.research-stat strong {
  display: block;
  color: var(--text-title);
  font-size: 1.35rem;
  line-height: 1.25;
  margin-top: 3px;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(240px, 320px);
  gap: 14px;
  align-items: start;
}

.research-panel {
  min-width: 0;
  padding: 14px;
}

.research-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.research-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.research-panel-head span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.research-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 290px);
  overflow: auto;
}

.research-queue-item {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 10px 11px;
  cursor: pointer;
}

.research-queue-item:hover,
.research-queue-item.is-active {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.research-queue-title {
  font-weight: 600;
  line-height: 1.35;
}

.research-queue-meta {
  font-size: 0.78rem;
  line-height: 1.35;
}

.research-detail {
  min-height: 420px;
}

.research-event-head h3 {
  margin: 0 0 8px;
  color: var(--text-title);
  font-size: 1.08rem;
  line-height: 1.35;
}

.research-event-head p {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.research-event-meta,
.research-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.research-actions {
  margin: 14px 0;
}

.research-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.research-action-hint {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: -6px 0 12px;
}

.research-section {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 14px;
}

.research-section h4 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.research-evidence-list,
.research-relation-list,
.research-artifact-timeline,
.research-operation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.research-evidence-item,
.research-relation-item,
.research-artifact,
.research-operation,
.research-inline-empty,
.research-empty-panel,
.research-loading {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 10px;
}

.research-evidence-item,
.research-relation-item,
.research-artifact,
.research-operation {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.research-evidence-item a {
  color: var(--accent-blue);
  text-decoration: none;
}

.research-evidence-item a:hover {
  text-decoration: underline;
}

.research-artifact p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.45;
}

.research-artifact-actions {
  margin-top: 6px;
}

.research-note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.research-note-form label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.research-note-form textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 9px 10px;
  font: inherit;
}

.research-note-form textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.research-empty-panel,
.research-inline-empty,
.research-loading {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .research-layout {
    grid-template-columns: 1fr;
  }

  .research-queue {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .research-workbench-head {
    flex-direction: column;
  }

  .research-toolbar,
  .research-toolbar select,
  .research-toolbar button {
    width: 100%;
  }

  .research-diagnostics {
    grid-template-columns: 1fr 1fr;
  }
}

/* Config edit forms */
.config-field-editable { flex-direction: column; align-items: flex-start; gap: 4px; }
.config-input { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 0.85rem; font-family: var(--font-stack); width: 100%; max-width: 360px; }
.config-input:focus { border-color: var(--accent-blue); outline: none; }
.config-input-sm { width: auto; max-width: 200px; padding: 4px 8px; }
.config-select { cursor: pointer; border-radius: var(--radius-sm); }
.toggle-clickable { cursor: pointer; user-select: none; }
.toggle-clickable:hover { opacity: 0.85; }
.config-tag-removable { display: inline-flex; align-items: center; gap: 4px; }
.tag-remove-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.tag-remove-btn:hover { color: var(--accent-red); }
.kw-add-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.source-edit-panel { margin-top: 10px; padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.source-edit-panel .config-input { margin-bottom: 6px; }
.save-status { margin-top: 8px; }
.save-status-inline { margin-left: 8px; font-size: 0.8rem; }
.save-ok { color: #22c55e; font-size: 0.85rem; }
.save-error,
.config-error { color: var(--accent-red); font-size: 0.85rem; }
.config-error { margin-top: 10px; }
.config-actions { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.dest-edit-fields, .route-edit-fields { margin-top: 10px; padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-sm); }
.dest-edit-fields .config-input, .route-edit-fields .config-input { margin-bottom: 6px; }
.toggle-label { font-size: 0.8rem; margin-left: 4px; }

/* ═══════════════════════════════════════════════════════════
 * v2 新增样式：连接设置页 + 三层导航 + Tab 栏 + 动效 + 弹窗
 * ═══════════════════════════════════════════════════════════ */

/* ── 连接设置页 ────────────────────────────────────── */

.connect-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.connect-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.connect-brand {
  justify-content: center;
  margin-bottom: 12px;
}

.connect-brand-title {
  margin: 0;
}

.connect-subtitle {
  font-size: var(--font-caption);
  color: var(--text-secondary);
  margin: 0 0 28px;
}

.connect-form {
  text-align: left;
}

.connect-field {
  margin-bottom: 14px;
}

.connect-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.connect-field input,
.connect-field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.connect-field input:focus,
.connect-field select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-dim);
}

.connect-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 8px;
}

.connect-btn:hover { box-shadow: 0 2px 8px rgba(179, 38, 45, 0.2); }
.connect-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.connect-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 16px 0 0;
  text-align: center;
}

.connect-error {
  color: var(--accent-red);
  font-size: 0.8rem;
  margin: 12px 0 0;
  text-align: center;
}

/* 服务器状态 */
.connect-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.connect-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.connect-status .status-dot.ok { background: var(--accent-green); }
.connect-status .status-dot.error { background: var(--accent-red); }

/* ── 三层导航 ────────────────────────────────────────── */

.nav-collapsible-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-collapsible-toggle:hover {
  color: var(--text-primary);
}

.nav-collapsible-toggle .toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.nav-collapsible-toggle.expanded .toggle-arrow {
  transform: rotate(180deg);
}

.nav-collapsible .nav-item {
  padding-left: 32px;
}

.nav-badge {
  margin-left: auto;
  background: #f85149;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ── Tab 栏 ──────────────────────────────────────────── */

.tab-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px 11px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-item {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: var(--font-caption);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.tab-item.tab-active {
  color: var(--accent-primary);
  background: rgba(179, 38, 45, 0.08);
  border-color: var(--accent-primary);
  font-weight: 500;
}

/* ── 面包屑 ──────────────────────────────────────────── */

.breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb .bc-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.breadcrumb .bc-tab {
  color: var(--text-primary);
}

/* ── 侧边栏底部状态 ─────────────────────────────────── */

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary, #8b949e);
  flex-shrink: 0;
}

.status-dot.ok {
  background: #3fb950;
  animation: pulse-ring 2s ease-out infinite;
}

.status-dot.error {
  background: #f85149;
  animation: blink 1s infinite;
}

.status-text {
  font-size: 12px;
  color: var(--text-secondary, #8b949e);
}

.footer-heartbeat {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  margin-bottom: 8px;
}

.footer-heartbeat .bar {
  width: 3px;
  height: 16px;
  background: var(--text-secondary, #8b949e);
  border-radius: 1px;
  transition: transform 0.3s;
}

.footer-heartbeat.active .bar {
  background: var(--accent-primary);
  animation: bar-dance 1.2s ease-in-out infinite;
}

.footer-heartbeat.active .bar:nth-child(2) { animation-delay: 0.1s; }
.footer-heartbeat.active .bar:nth-child(3) { animation-delay: 0.2s; }
.footer-heartbeat.active .bar:nth-child(4) { animation-delay: 0.3s; }
.footer-heartbeat.active .bar:nth-child(5) { animation-delay: 0.4s; }
.footer-heartbeat.active .bar:nth-child(6) { animation-delay: 0.5s; }
.footer-heartbeat.active .bar:nth-child(7) { animation-delay: 0.6s; }
.footer-heartbeat.active .bar:nth-child(8) { animation-delay: 0.7s; }

.footer-heartbeat.error .bar {
  background: #f85149;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary, #8b949e);
}

.footer-user {
  font-weight: 500;
}

.footer-settings {
  color: var(--accent-primary);
  text-decoration: none;
  margin-left: auto;
}

.footer-settings:hover {
  text-decoration: underline;
}

/* ── CSS 动效 ────────────────────────────────────────── */

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes blink-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes progress-glow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; filter: brightness(1.3); }
}

@keyframes bar-dance {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.3); }
}

@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 45, 0.3); }
  50% { box-shadow: 0 0 8px 2px rgba(179, 38, 45, 0.15); }
}

@keyframes blink {
  50% { opacity: 0.3; }
}

/* ── Pipeline 进度条 ─────────────────────────────────── */

.pipeline-stages {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 0;
  overflow-x: auto;
}

.stage-box {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 120px;
  text-align: center;
}

.stage-box span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 4px;
  opacity: 0.7;
}

.stage-done {
  background: #23863620;
  color: #3fb950;
  border: 1px solid #23863640;
}

.stage-active {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  border: 1px solid rgba(179, 38, 45, 0.25);
  animation: stage-pulse 2s infinite;
}

.stage-waiting {
  background: #30363d20;
  color: var(--text-secondary, #8b949e);
  border: 1px solid var(--border-color);
}

.stage-arrow {
  color: var(--text-secondary, #8b949e);
  font-size: 16px;
  flex-shrink: 0;
}

/* ── 弹窗 ────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary, #8b949e);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.modal-btn-primary {
  padding: 8px 16px;
  background: #238636;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.modal-btn-primary:hover { background: #2ea043; }

.modal-btn-secondary {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary, #8b949e);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.modal-btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary, #8b949e);
}

/* ── 导入拖放区 ──────────────────────────────────────── */

.import-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text-secondary, #8b949e);
}

.import-dropzone p {
  margin: 0 0 12px;
}

.import-dropzone button {
  padding: 6px 12px;
}

#importJson {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 12px;
  padding: 12px;
  resize: vertical;
  box-sizing: border-box;
}

/* ── 离线横幅 ────────────────────────────────────────── */

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: #f85149;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
}

body.ns-offline .offline-banner {
  display: block !important;
}

/* ── 日期范围选择器 ──────────────────────────────────── */

.date-range-picker {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.date-range-picker button {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-secondary, #8b949e);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.date-range-picker button:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary, #8b949e);
}

.date-range-picker button.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(179, 38, 45, 0.08);
}

.date-range-picker input[type="date"] {
  padding: 5px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
}

.date-range-picker .date-sep {
  color: var(--text-secondary, #8b949e);
  font-size: 12px;
}

/* ── 引导式空状态 ─────────────────────── */

.empty-state-guided {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 480px;
  margin: 2rem auto;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.empty-state-causes {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.empty-state-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-causes ul {
  padding-left: 1.25rem;
}

.empty-state-causes li {
  margin-bottom: 0.25rem;
}

.empty-state-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ── 诊断弹窗表格 ─────────────────────── */

.diagnostics-table {
  width: 100%;
  border-collapse: collapse;
}

.diagnostics-table td {
  padding: 0.5rem 0.5rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border-color);
}

.diagnostics-table td:first-child {
  width: 28px;
  text-align: center;
}

.diagnostics-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 0.8rem;
}

.diagnostics-link:hover {
  text-decoration: underline;
}

/* ── 通知设置 / 用户管理 ─────────────────────────────── */

.notif-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.notif-section h4 {
  font-size: var(--font-body);
  font-weight: var(--weight-h3);
  color: var(--text-primary);
  margin-bottom: 12px;
}

.settings-form .form-field,
.notif-section .form-field {
  margin-bottom: 12px;
}

.settings-form .form-field label,
.notif-section .form-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.settings-form .form-field input,
.notif-section .form-field input,
.notif-section .form-field select {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-sizing: border-box;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table th,
.users-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.users-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sm:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.btn-sm.btn-danger:hover { border-color: var(--accent-red); color: var(--accent-red); }

.form-error {
  color: var(--accent-red);
  font-size: 0.8rem;
  margin-top: 8px;
}

.form-success {
  color: var(--accent-green);
  font-size: 0.8rem;
  margin-top: 8px;
}

.save-ok {
  color: var(--accent-green);
  font-size: 0.85rem;
}

/* ── 快捷键面板 ──────────────────────────────────────── */

.shortcut-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  min-width: 320px;
  animation: fadeIn 0.15s;
}

.shortcut-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-primary);
}

.shortcut-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
}

.shortcut-panel-close:hover { color: var(--text-primary); }

.shortcut-panel-body {
  padding: 12px 20px 16px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.shortcut-row kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--text-primary);
  margin: 0 2px;
}

/* ── §27 新闻流 Feed ────────────────────────────────────── */

.feed-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.feed-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.feed-title {
  font-size: var(--font-h2);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.feed-count {
  font-size: var(--font-caption);
  color: var(--text-muted);
}

.feed-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  --feed-control-height: 28px;
}

.feed-search-input,
.feed-date-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  height: var(--feed-control-height);
  padding: 0 9px;
  font-size: var(--font-caption);
  border-radius: var(--radius-sm);
  font-family: var(--font-stack);
  line-height: var(--feed-control-height);
}

.feed-search-input {
  width: min(240px, 32vw);
}

.feed-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  height: var(--feed-control-height);
  padding: 0 12px;
  font-size: var(--font-caption);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-stack);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.feed-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.feed-channel-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 16px;
}

.feed-channel {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: var(--font-caption);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feed-channel:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.feed-channel.active {
  color: var(--accent-primary);
  background: rgba(179, 38, 45, 0.08);
  border-color: var(--accent-primary);
}

.feed-channel-count {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1;
}

/* ── 视图切换按钮 ── */
.feed-view-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: var(--feed-control-height);
  background: var(--bg-tertiary);
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  padding: 0;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  border-right: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-btn:last-child { border-right: none; }

.view-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.view-btn.active {
  color: var(--accent-primary);
  background: rgba(179, 38, 45, 0.08);
}

@media (max-width: 640px) {
  .feed-toolbar-right {
    justify-content: flex-start;
    width: 100%;
  }

  .feed-search-input {
    width: 100%;
    flex-basis: 100%;
  }

  .feed-date-input {
    flex: 1 1 128px;
    min-width: 0;
  }
}

/* ── 日期分组 ── */
.feed-date-group { margin-bottom: 20px; }

.feed-date-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.feed-date-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.feed-date-text {
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.feed-date-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
}

.feed-date-toggle:hover {
  border-color: var(--border-color);
  background: var(--surface-muted);
  color: var(--text-primary);
}

.feed-date-toggle:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.feed-date-caret::before {
  content: "▾";
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  transform: translateY(-1px);
}

.feed-date-group.is-collapsed .feed-date-caret::before {
  transform: rotate(-90deg) translateX(1px);
}

.feed-date-count {
  font-size: var(--font-caption);
  color: var(--text-muted);
}

.feed-date-content[hidden] {
  display: none;
}

/* ── 来源人格化 ── */
.src-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  border: 1.5px solid;
  border-radius: 2px;
  flex-shrink: 0;
  font-family: var(--font-stack);
}

.src-name {
  font-size: var(--font-caption);
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 0;
  max-width: min(280px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 分类标签 (扁平化) ── */
.cat-tag {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--cat-color, #666) 12%, transparent);
  color: var(--cat-color, #999);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.flat-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  line-height: 1.2;
  white-space: nowrap;
}

.story-tag {
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 32%, var(--border-color));
  font-weight: 600;
}

.feed-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-timeline-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
}

.feed-timeline-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-caption);
  text-align: right;
  padding-top: 12px;
}

.feed-timeline-item {
  background: var(--bg-card, var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  min-width: 0;
}

.feed-timeline-item:hover {
  border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-color));
  background: var(--bg-card-hover, var(--bg-hover));
}

.feed-item-topline {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  min-width: 0;
}

.feed-item-title {
  color: var(--text-primary);
  font-size: var(--font-body);
  font-weight: 650;
  line-height: 1.45;
  text-decoration: none;
}

.feed-item-title:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.feed-item-original-title {
  color: var(--text-tertiary);
  font-size: var(--font-caption);
  line-height: 1.45;
  margin-top: 4px;
  word-break: break-word;
}

.feed-item-summary {
  color: var(--text-secondary);
  font-size: var(--font-caption);
  line-height: 1.55;
  margin-top: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.feed-ai-reason {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: rgba(46, 139, 87, 0.12);
  color: #2e8b57;
  font-size: var(--font-caption);
  line-height: 1.5;
  padding: 8px 10px;
}

/* ── 紧凑视图 ── */
.feed-compact .feed-compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-caption);
  min-width: 0;
}

.feed-compact-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex: 0 0 42px;
}

.feed-compact-src {
  color: var(--text-secondary);
  flex: 0 1 88px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-compact-title {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-compact .flat-tag {
  flex: 0 1 auto;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-compact .score-label {
  flex: 0 0 auto;
}

.feed-compact-title:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

/* ── 推荐标签 ── */
.rec-badge {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.rec-publish { background: rgba(179, 38, 45, 0.15); color: #d65a5f; }
.rec-review { background: rgba(46, 139, 87, 0.15); color: #4cb882; }
.rec-archive { background: rgba(160, 160, 168, 0.12); color: var(--text-muted); }

.score-label {
  font-size: var(--font-caption);
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sent-label {
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sent-pos { color: #4cb882; }
.sent-neg { color: #e05050; }
.sent-neu { color: var(--text-muted); }

/* ── 状态提示 ── */
.feed-loading,
.feed-empty,
.feed-error {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: var(--font-body);
}

.feed-error { color: var(--accent-secondary); }

.feed-footer {
  text-align: center;
  padding: 12px 0;
}

.feed-more {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--font-caption);
}

.feed-more-note {
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .feed-container {
    padding: 0 12px;
  }

  .feed-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .feed-toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .feed-search-input {
    width: min(100%, 260px);
  }

  .feed-timeline-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
  }

  .feed-timeline-item {
    padding: 10px;
  }

  .feed-compact .feed-compact-row {
    column-gap: 8px;
    row-gap: 5px;
  }

  .feed-compact-time {
    flex-basis: 38px;
  }

  .feed-compact-title {
    flex-basis: calc(100% - 46px);
  }

  .feed-compact-src {
    display: none;
  }
}

/* ============================================================
   News Sentry design language primitives
   ============================================================ */
.ns-page {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) 44px;
}

.ns-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.ns-page-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-h1);
  font-weight: var(--weight-h1);
  line-height: 1.28;
  letter-spacing: 0;
}

.ns-page-kicker {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ns-page-subtitle {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: var(--font-body);
}

.ns-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.ns-button,
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.ns-button-primary,
.btn-primary {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: #fff;
}

.ns-button-primary:hover,
.btn-primary:hover {
  border-color: var(--accent-secondary);
  background: var(--accent-secondary);
  color: #fff;
}

.ns-button-secondary,
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.ns-button-secondary:hover,
.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ns-button-danger,
.btn-danger {
  border-color: rgba(179, 38, 45, 0.45);
  background: transparent;
  color: var(--status-danger);
}

.ns-button-danger:hover,
.btn-danger:hover {
  border-color: var(--status-danger);
  background: rgba(179, 38, 45, 0.08);
  color: var(--status-danger);
}

.ns-button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm.btn-danger {
  min-height: auto;
  padding: 4px 10px;
  font-size: 0.75rem;
}

.ns-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}

.ns-tabs a,
.ns-tabs button {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.84rem;
  text-decoration: none;
}

.ns-tabs a.active,
.ns-tabs button.active {
  border-color: var(--accent-primary);
  background: var(--accent-blue-dim);
  color: var(--accent-primary);
  font-weight: 700;
}

.ns-context-panel {
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: var(--space-3);
}

.ns-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.ns-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.ns-table th,
.ns-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.ns-table th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ns-table tr:last-child td {
  border-bottom: 0;
}

.ns-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  align-items: end;
}

.ns-field {
  display: grid;
  gap: 6px;
}

.ns-field label,
.ns-field-title {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.ns-field input,
.ns-field select,
.ns-field textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 8px 10px;
  font: inherit;
}

.ns-empty-state,
.ns-error-state,
.empty-state-guided {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: 44px var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  text-align: center;
}

.ns-empty-state h2,
.ns-error-state h2,
.empty-state-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-h2);
}

.ns-empty-state p,
.ns-error-state p,
.empty-state-causes {
  max-width: 520px;
  margin: 0;
  color: var(--text-secondary);
}

.ns-empty-state-actions,
.ns-error-state-actions,
.empty-state-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
}

.status-pill.ok {
  border-color: rgba(22, 128, 75, 0.35);
  color: var(--status-success);
}

.status-pill.warn {
  border-color: rgba(178, 106, 0, 0.35);
  color: var(--status-warning);
}

.status-pill.danger {
  border-color: rgba(179, 38, 45, 0.38);
  color: var(--status-danger);
}

.status-pill.muted {
  color: var(--status-muted);
}

@media (max-width: 767px) {
  .ns-page {
    padding: 18px 12px 36px;
  }

  .ns-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ns-action-row {
    justify-content: flex-start;
  }

  .ns-action-row .ns-button,
  .ns-action-row .btn-primary,
  .ns-action-row .btn-secondary,
  .ns-action-row .btn-danger {
    width: auto;
  }

  .ns-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ns-tabs a,
  .ns-tabs button {
    white-space: nowrap;
  }
}

/* Target lifecycle workbench */
.target-workbench-page {
  width: 100%;
}

.target-inline-warning {
  margin: 10px 0 14px;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--status-warning);
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 9px 12px;
  font-size: 12px;
}

.target-panel {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.target-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.target-panel h2 {
  margin: 0;
  color: var(--text-primary);
}

.target-panel-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.target-card-id {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.target-compact-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.target-group-list {
  display: grid;
  gap: 18px;
  margin-bottom: 16px;
}

.target-management-group {
  display: grid;
  gap: 8px;
}

.target-management-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.target-management-group-head h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.target-management-group-head span,
.target-topic-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.target-compact-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: 12px;
}

.target-compact-row:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.target-compact-main {
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.target-compact-main strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-topic-label {
  display: block;
  margin-top: 3px;
}

.target-compact-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(48px, 1fr));
  gap: 8px;
}

.target-compact-state {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.target-compact-metrics span,
.target-summary-strip span {
  display: grid;
  gap: 2px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
}

.target-compact-metrics small,
.target-summary-strip small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.target-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 10px;
  min-width: 320px;
}

.target-card,
.target-action-card,
.target-stat,
.social-dimension-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.target-card {
  padding: 16px;
}

.target-card.is-archived,
.muted-row {
  opacity: 0.62;
}

.target-card-head,
.target-card-actions,
.target-hero-actions,
.target-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-card-head {
  justify-content: space-between;
  align-items: flex-start;
}

.target-card h3 {
  margin: 0;
  font-size: 18px;
}

.target-card-stats,
.target-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.target-stat {
  padding: 12px;
}

.target-stat-label,
.target-stat small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.target-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 22px;
}

.target-panel {
  background: transparent;
}

.target-create-panel details {
  width: 100%;
}

.target-create-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.target-create-panel summary::-webkit-details-marker {
  display: none;
}

.target-create-panel summary::after {
  content: "+";
  color: var(--accent-primary);
  font-weight: 700;
}

.target-create-panel details[open] summary {
  margin-bottom: 14px;
}

.target-create-panel details[open] summary::after {
  content: "-";
}

.target-create-panel summary strong,
.target-create-panel summary small {
  display: block;
}

.target-create-panel summary small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.target-action-card,
.target-action-card.as-button {
  color: var(--text-primary);
  text-decoration: none;
}

.target-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.target-action-card {
  display: block;
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.target-action-card.as-button {
  cursor: pointer;
  font: inherit;
}

.target-action-card strong,
.target-action-card span {
  display: block;
}

.target-action-card span {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.target-form.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 12px;
}

.target-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.target-form input,
.target-form select,
.target-form textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 9px 10px;
  font: inherit;
}

.target-form-wide {
  grid-column: 1 / -1;
}

.target-table small,
.social-account span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-check-list {
  display: grid;
  gap: 8px;
}

.target-check,
.social-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.target-check.ok {
  border-color: rgba(22, 128, 75, 0.25);
}

.target-check.warn,
.target-check.bad {
  border-color: rgba(164, 45, 54, 0.25);
}

.social-dimension-list {
  display: grid;
  gap: 14px;
}

.social-dimension-card {
  padding: 14px;
}

.social-account-list {
  display: grid;
  gap: 8px;
}

.target-workbench-empty {
  padding: 48px 0;
  text-align: center;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  min-width: 0;
}

.research-queue {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.research-queue-item {
  width: 100%;
  min-width: 0;
  min-height: 68px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.research-queue-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.research-queue-item.is-active {
  border-color: var(--accent-primary);
  box-shadow: inset 3px 0 0 var(--accent-primary);
}

.research-queue-title,
.research-queue-meta {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.research-queue-title {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.35;
}

.research-queue-meta,
.research-event-meta,
.research-artifact small,
.research-artifact time,
.research-evidence-item small,
.research-relation-item small {
  color: var(--text-muted);
  font-size: 12px;
}

.research-detail,
.research-event {
  min-width: 0;
}

.research-event {
  display: grid;
  gap: var(--space-4);
}

.research-event-head h3 {
  margin: 4px 0 8px;
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.research-event-head p {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.research-event-meta,
.research-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.research-action-hint {
  margin: -8px 0 0;
  color: var(--text-muted);
  font-size: var(--font-caption);
  line-height: 1.45;
}

.research-event-meta span {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  background: var(--bg-primary);
}

.research-section {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-3);
}

.research-section h4,
.research-note-form label {
  margin: 0 0 var(--space-2);
  color: var(--text-primary);
  font-size: var(--font-h3);
}

.research-evidence-list,
.research-relation-list,
.research-artifact-timeline {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.research-evidence-item,
.research-relation-item,
.research-artifact,
.research-inline-empty {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  padding: 10px 12px;
}

.research-evidence-item strong,
.research-evidence-item small,
.research-relation-item span,
.research-artifact strong,
.research-artifact p,
.research-inline-empty span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.research-relation-item {
  display: grid;
  grid-template-columns: minmax(80px, 0.45fr) minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: start;
}

.research-artifact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}

.research-artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  margin-top: 8px;
}

.research-graph-apply {
  min-height: 30px;
  padding: 0 10px;
}

.research-artifact p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-secondary);
}

.research-inline-empty {
  color: var(--text-muted);
}

.research-note-form {
  display: grid;
  gap: var(--space-2);
}

.research-note-form textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
}

.research-detail-empty .target-actions,
.target-workbench-empty .target-actions {
  justify-content: center;
}

.danger-zone {
  border-color: rgba(164, 45, 54, 0.25);
}

@media (max-width: 760px) {
  .research-layout {
    grid-template-columns: 1fr;
  }

  .research-relation-item,
  .research-artifact {
    grid-template-columns: 1fr;
  }

  .target-panel-head,
  .target-card-head,
  .target-card-actions,
  .target-hero-actions,
  .target-actions,
  .target-check,
  .social-account {
    align-items: flex-start;
    flex-direction: column;
  }

  .target-summary-strip {
    width: 100%;
    min-width: 0;
  }

  .target-compact-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .target-compact-metrics {
    width: 100%;
  }

  .target-compact-state {
    order: -1;
  }

  .target-compact-row .target-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .target-compact-row .target-card-actions .btn-primary,
  .target-compact-row .target-card-actions .btn-secondary {
    width: auto;
  }

  .target-card-actions .btn-primary,
  .target-card-actions .btn-secondary,
  .target-actions .btn-primary,
  .target-actions .btn-secondary {
    width: 100%;
  }

  .target-table {
    min-width: 560px;
  }
}
