    :root {
      /* GitHub Light */
      --bg: #ffffff;
      --surface: #f6f8fa;
      --surface-2: #eaeef2;
      --fg: #1f2328;
      --fg-muted: #656d76;
      --border: #d0d7de;
      --border-muted: #d8dee4;
      --accent: #0969da;
      --accent-hover: #0550ae;
      --accent-subtle: #ddf4ff;
      --success: #1a7f37;
      --success-subtle: #dafbe1;
      --danger: #cf222e;
      --danger-subtle: #ffebe9;
      --warn: #9a6700;
      --warn-subtle: #fff8c5;
      --purple: #8250df;
      --pink: #bf3989;
      --shadow-sm: 0 1px 0 rgba(31,35,40,0.04);
    }
    [data-theme="dark"] {
      --bg: #0d1117;
      --surface: #161b22;
      --surface-2: #21262d;
      --fg: #e6edf3;
      --fg-muted: #8b949e;
      --border: #30363d;
      --border-muted: #21262d;
      --accent: #58a6ff;
      --accent-hover: #79c0ff;
      --accent-subtle: #0c2d6b;
      --success: #3fb950;
      --success-subtle: #033a16;
      --danger: #f85149;
      --danger-subtle: #67060c;
      --warn: #d29922;
      --warn-subtle: #4d3800;
      --purple: #a371f7;
      --pink: #db61a2;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--fg);
      font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      display: grid;
      grid-template-columns: 260px 1fr;
      min-height: 100vh;
    }
    a { color: var(--accent); text-decoration: none; }
    a:hover { text-decoration: underline; }

    /* ───── Sidebar ───── */
    .sidebar {
      background: var(--surface);
      border-right: 1px solid var(--border);
      padding: 16px 12px;
      overflow-y: auto;
      position: sticky;
      top: 0;
      height: 100vh;
    }
    .brand {
      font-weight: 700; font-size: 16px; padding: 4px 10px 14px;
      display: flex; align-items: center; gap: 8px;
      letter-spacing: -0.01em;
    }
    .brand-dot {
      width: 9px; height: 9px; border-radius: 50%;
      background: linear-gradient(135deg, #3fb950 0%, #58a6ff 100%);
      box-shadow: 0 0 8px rgba(63,185,80,0.6);
      animation: brand-pulse 2.4s ease-in-out infinite;
    }
    .brand-name { color: var(--fg); }
    .brand-sub { color: var(--fg-muted); font-weight: 400; font-size: 13px; }
    @keyframes brand-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

    /* ───── Bot Live panel — 实时显示 bot 在干啥 ───── */
    .bot-live-panel {
      background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 10px 8px;
      margin: 0 4px 18px;
    }
    .bot-live-head {
      display: flex; align-items: center; gap: 6px;
      font-size: 11px; color: var(--fg-muted); font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.06em;
      margin-bottom: 8px;
    }
    .bot-live-icon { font-size: 13px; }
    .bot-live-label { flex: 1; }
    .bot-live-pulse {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--fg-muted);
      transition: background 200ms, box-shadow 200ms;
    }
    .bot-live-pulse.live {
      background: var(--success);
      box-shadow: 0 0 8px var(--success);
      animation: bot-pulse 1.6s ease-in-out infinite;
    }
    @keyframes bot-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
    .bot-live-stats {
      display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
      margin-bottom: 8px;
    }
    .bot-stat {
      display: flex; flex-direction: column; align-items: center;
      padding: 6px 4px; background: var(--bg); border-radius: 6px;
      border: 1px solid var(--border-muted);
    }
    .bot-stat-n {
      font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
      color: var(--fg); line-height: 1.1;
    }
    .bot-stat-l { font-size: 10px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
    .bot-stat.running .bot-stat-n { color: var(--success); }
    .bot-stat.pending .bot-stat-n { color: var(--warn); }
    .bot-live-now {
      font-size: 12px;
      padding: 6px 0; border-top: 1px dashed var(--border-muted);
      max-height: 380px; overflow-y: auto;
    }
    .bot-live-empty { color: var(--fg-muted); font-style: italic; text-align: center; padding: 8px 0; font-size: 11px; }

    /* 每个 in_progress entity = 一个 bot-running block */
    .bot-running {
      padding: 6px 4px; border-bottom: 1px dotted var(--border-muted);
      cursor: pointer;
    }
    .bot-running:last-child { border-bottom: none; }
    .bot-running:hover { background: var(--bg); border-radius: 4px; }
    .bot-running-head {
      display: flex; align-items: center; gap: 6px;
      font-size: 12px;
    }
    .bot-running-num { font-weight: 600; color: var(--fg); white-space: nowrap; }
    .bot-running-title { color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bot-running-events { padding: 4px 0 0 18px; }
    .bot-running-event {
      display: flex; gap: 5px; align-items: baseline;
      padding: 2px 0; font-size: 11px; color: var(--fg-muted);
    }
    .bot-running-event.new { background: var(--accent-subtle); animation: flash 600ms ease-out; border-radius: 3px; padding: 2px 4px; }
    @keyframes flash { 0% { background: var(--accent-subtle); } 100% { background: transparent; } }
    .bot-stream-icon { font-size: 11px; opacity: 0.7; flex-shrink: 0; }
    .bot-stream-time { color: var(--fg-muted); font-variant-numeric: tabular-nums; font-size: 10px; min-width: 32px; flex-shrink: 0; }
    .bot-stream-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Loading spinner — 替代 ⚙ emoji */
    .bot-spinner {
      width: 11px; height: 11px;
      border: 2px solid var(--border);
      border-top-color: var(--success);
      border-radius: 50%;
      animation: bot-spin 1s linear infinite;
      flex-shrink: 0;
      display: inline-block;
    }
    @keyframes bot-spin { to { transform: rotate(360deg); } }
    .nav-group { margin-bottom: 18px; }
    .nav-label { font-size: 11px; color: var(--fg-muted); padding: 6px 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
    .nav-item {
      display: flex; align-items: center; justify-content: space-between;
      padding: 6px 10px; border-radius: 6px; cursor: pointer; color: var(--fg);
      font-size: 13px; user-select: none;
    }
    .nav-item:hover { background: var(--bg); }
    .nav-item.active { background: var(--accent-subtle); color: var(--accent); font-weight: 500; }
    .nav-item .count { font-size: 11px; color: var(--fg-muted); }
    .nav-item.active .count { color: var(--accent); }

    .saved-view-row { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
    .saved-view-row:hover { background: var(--bg); }
    .saved-view-row .x { color: var(--fg-muted); opacity: 0; padding: 0 4px; }
    .saved-view-row:hover .x { opacity: 1; }
    .saved-view-row .x:hover { color: var(--danger); }

    /* ───── 横排 filter-bar (在主体顶部) ───── */
    .filter-bar {
      display: flex; flex-direction: column; gap: 6px;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 10px; padding: 8px 10px;
      margin-bottom: 14px;
    }
    .shared-filter-bar { margin-bottom: 8px; }
    .filter-row {
      display: flex; align-items: flex-start; gap: 10px;
      min-height: 26px;
      padding: 2px 0;
    }
    .filter-row-label {
      font-size: 10px; color: var(--fg-muted); font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.06em;
      min-width: 48px; flex-shrink: 0;
      line-height: 22px;  /* 跟 chip 同高便于左对齐 */
    }
    .filter-chips {
      display: flex; gap: 4px 6px; align-items: center;
      flex: 1; flex-wrap: wrap;   /* 超出换行 */
    }
    .chip {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 3px 9px; border-radius: 999px; cursor: pointer;
      font-size: 12px; white-space: nowrap; user-select: none;
      background: var(--bg); color: var(--fg); border: 1px solid var(--border-muted);
      transition: all 100ms;
    }
    .chip:hover { background: var(--surface-2); border-color: var(--border); }
    .chip.active {
      background: var(--accent); color: white; border-color: var(--accent);
      font-weight: 500;
    }
    .chip.active .chip-count { color: rgba(255,255,255,0.85); }
    .chip-count { font-size: 10px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
    .filter-search {
      width: 140px; padding: 3px 9px; border: 1px solid var(--border-muted); border-radius: 999px;
      background: var(--bg); color: var(--fg); font-size: 12px; font-family: inherit;
      flex-shrink: 0;
    }
    .filter-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }

    /* ───── Main ───── */
    main { padding: 16px 24px 56px; overflow-x: hidden; }
    .topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; gap: 16px; }
    .topbar h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
    .topbar h1 .role-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-subtle); color: var(--accent); font-weight: 500; }
    .topbar .right { display: flex; gap: 8px; align-items: center; }
    .search { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; min-width: 280px; }
    .search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
    .btn { font: inherit; cursor: pointer; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); }
    .btn:hover { background: var(--surface); }
    .btn-primary { background: var(--success); color: white; border-color: rgba(31,35,40,0.15); }
    .btn-primary:hover { background: #1f883d; }

    /* ───── Entity tabs (全部 / PR / Issue) ───── */
    .entity-tabs {
      display: flex; gap: 4px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 12px;
    }
    .entity-tab {
      background: transparent; border: none; font: inherit; cursor: pointer;
      padding: 8px 14px;
      color: var(--fg-muted); font-size: 13px; font-weight: 500;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
      display: flex; align-items: center; gap: 6px;
    }
    .entity-tab:hover { color: var(--fg); }
    .entity-tab.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
      font-weight: 600;
    }
    .entity-tab-count {
      font-size: 11px; color: var(--fg-muted);
      background: var(--surface-2); padding: 1px 7px; border-radius: 999px;
      font-variant-numeric: tabular-nums;
    }
    .entity-tab.active .entity-tab-count {
      background: var(--accent-subtle); color: var(--accent);
    }

    /* ───── KPIs (只显示数字, 紧凑, 不可点击 — 筛选交给下面 chips) ───── */
    .kpis {
      display: flex; gap: 8px; margin-bottom: 12px;
      flex-wrap: wrap;
    }
    .kpi {
      background: var(--surface); border: 1px solid var(--border-muted); border-radius: 6px;
      padding: 4px 10px;
      display: flex; align-items: baseline; gap: 6px;
      cursor: default; user-select: none;
    }
    .kpi .label { font-size: 11px; color: var(--fg-muted); }
    .kpi .value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg); }
    .kpi .hint { display: none; }   /* 紧凑卡片不需要 hint */
    .kpi.attention .value { color: var(--warn); }
    .kpi.danger .value { color: var(--danger); }

    /* Pending reviewer — 高亮 GitHub 还没 review 的人 */
    .pending-reviewers {
      background: var(--warn-subtle);
      color: var(--warn);
      padding: 1px 6px; border-radius: 4px;
      font-weight: 500;
    }
    .pending-reviewer {
      color: var(--warn);
      font-weight: 600;
    }
    .pending-reviewer.stale {
      color: var(--accent);
      text-decoration: underline dotted;
    }

    /* ───── Bucket panels ───── */
    .bucket {
      background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
      margin-bottom: 12px;
    }
    .bucket-header {
      display: flex; align-items: center; gap: 10px; padding: 12px 16px;
      cursor: pointer; user-select: none;
      border-bottom: 1px solid transparent;
    }
    .bucket-header:hover { background: var(--surface); }
    .bucket.open .bucket-header { border-bottom-color: var(--border); }
    .bucket-toggle { color: var(--fg-muted); font-size: 12px; width: 12px; display: inline-block; transition: transform 80ms ease-out; }
    .bucket.open .bucket-toggle { transform: rotate(90deg); }
    .bucket-title { font-weight: 600; font-size: 14px; }
    .bucket-count { background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
    .bucket-emoji { font-size: 16px; }
    .bucket-list { display: none; }
    .bucket.open .bucket-list { display: block; }

    .entity-row {
      display: grid;
      grid-template-columns: 24px 1fr auto;
      gap: 12px;
      padding: 10px 16px;
      border-top: 1px solid var(--border-muted);
      align-items: start;
    }
    .entity-row:first-child { border-top: none; }
    .entity-row:hover { background: var(--surface); }
    .entity-icon { color: var(--fg-muted); font-size: 14px; margin-top: 2px; }
    .entity-icon.pr-open { color: var(--success); }
    .entity-icon.pr-merged { color: var(--purple); }
    .entity-icon.pr-closed { color: var(--danger); }
    .entity-icon.issue-open { color: var(--success); }
    .entity-icon.issue-closed { color: var(--purple); }
    .entity-main { min-width: 0; }
    .entity-title { font-weight: 500; font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
    .entity-title .entity-num {
      font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
      font-size: 13px; font-weight: 600;
      color: var(--accent);
      text-decoration: none;
      letter-spacing: -0.01em;
      font-variant-numeric: tabular-nums;
      padding: 0 2px;
    }
    .entity-title a.entity-num:hover { text-decoration: underline; }
    .entity-title .entity-title-link { color: var(--fg); }
    .entity-title .entity-title-link:hover { color: var(--accent); }
    .entity-title .repo-num { color: var(--fg-muted); font-size: 11px; font-weight: 400; padding-left: 4px; }
    .entity-meta {
      display: flex; flex-wrap: wrap; gap: 6px 12px;
      font-size: 12px; color: var(--fg-muted); margin-top: 4px; align-items: center;
    }
    .entity-meta .by { display: inline-flex; gap: 4px; align-items: center; }
    .entity-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
    .label {
      font-size: 11px; padding: 0 7px; border-radius: 999px;
      border: 1px solid var(--border); background: var(--surface);
      line-height: 18px; color: var(--fg);
    }
    .verdict-chip {
      font-size: 11px; padding: 1px 8px; border-radius: 4px;
      background: var(--accent-subtle); color: var(--accent); font-weight: 500;
      border-left: 3px solid var(--accent);
    }
    .verdict-chip.needs-product-review { background: var(--warn-subtle); color: var(--warn); border-left-color: var(--warn); }
    .verdict-chip.ready-to-merge { background: var(--success-subtle); color: var(--success); border-left-color: var(--success); }
    .verdict-chip.requires-rebase { background: var(--danger-subtle); color: var(--danger); border-left-color: var(--danger); }
    .verdict-chip.ci-failed { background: var(--danger-subtle); color: var(--danger); border-left-color: var(--danger); }
    .verdict-chip.duplicate { background: rgba(130,80,223,0.12); color: var(--purple); border-left-color: var(--purple); }
    .verdict-chip.stale-warning { background: var(--surface); color: var(--fg-muted); border-left-color: var(--fg-muted); }
    .verdict-chip.no-action-needed { background: var(--surface); color: var(--fg-muted); border-left-color: var(--border); }

    .entity-aside {
      text-align: right; font-size: 11px; color: var(--fg-muted); white-space: nowrap;
      display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    }
    .entity-aside .wait-time { font-weight: 500; font-variant-numeric: tabular-nums; }
    .entity-aside .wait-time.long { color: var(--warn); }
    .entity-aside .wait-time.very-long { color: var(--danger); }

    /* ───── Theme toggle ───── */
    .theme-toggle { background: none; border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--fg); }

    /* ───── Empty / loading ───── */
    .empty { padding: 32px; text-align: center; color: var(--fg-muted); font-size: 13px; }
    .loading { padding: 64px; text-align: center; color: var(--fg-muted); }

    /* ───── Toolbar ───── */
    .toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
    .toolbar-label { font-size: 12px; color: var(--fg-muted); }
    .sort-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; font-size: 12px; }
    .filter-summary { font-size: 12px; color: var(--fg-muted); }
    .clear-filters { font-size: 12px; color: var(--accent); cursor: pointer; }
    .clear-filters:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════
   Phase 2/3 — Live status + Drawer
   ═══════════════════════════════════════════════════════════════════════ */

/* ───── Live connection indicator (右下角) ───── */
.live-indicator {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--fg-muted);
  z-index: 100;
  box-shadow: var(--shadow-sm);
  user-select: none;
  cursor: default;
}
.live-indicator.hidden { display: none; }
.live-indicator.connecting .live-dot { background: var(--warn); }
.live-indicator.open .live-dot { background: var(--success); }
.live-indicator.closed .live-dot { background: var(--danger); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-muted);
  display: inline-block;
  box-shadow: 0 0 0 0 currentColor;
}
.live-indicator.open .live-dot {
  animation: live-pulse 2s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(26,127,55,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(26,127,55,0); }
  100% { box-shadow: 0 0 0 0 rgba(26,127,55,0); }
}

/* ───── Live chip on entity row ───── */
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
  border-left: 3px solid transparent;
}
.live-chip.queued {
  background: var(--warn-subtle);
  color: var(--warn);
  border-left-color: var(--warn);
}
.live-chip.running {
  background: var(--accent-subtle);
  color: var(--accent);
  border-left-color: var(--accent);
  animation: chip-pulse 1.4s ease-in-out infinite;
}
@keyframes chip-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
.live-chip.done {
  background: var(--success-subtle);
  color: var(--success);
  border-left-color: var(--success);
}

/* ───── Entity row clickable cursor ───── */
.entity-row { cursor: pointer; }
.entity-row.drawer-active { background: var(--accent-subtle); }

/* ───── Drawer overlay (半透明遮罩) ───── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 200;
  opacity: 0;
  transition: opacity 120ms ease-out;
}
[data-theme="dark"] .drawer-overlay { background: rgba(0,0,0,0.5); }
.drawer-overlay.open { opacity: 1; }
.drawer-overlay[hidden] { display: none; }

/* ───── Drawer 容器 ───── */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(720px, 50vw);
  min-width: 360px;
  max-width: 90vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
  box-shadow: -2px 0 24px rgba(0,0,0,0.06);
  overflow-y: auto;
  /* contain scroll chaining: scrolling past drawer's end won't scroll main list */
  overscroll-behavior: contain;
}

/* Drawer resize handle (drag the left edge to change width) */
.drawer-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 202;
  background: transparent;
  transition: background 80ms ease-out;
}
.drawer-resize-handle:hover,
.drawer-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.6;
}
body.drawer-resizing {
  cursor: ew-resize !important;
  user-select: none;
}
body.drawer-resizing * {
  cursor: ew-resize !important;
}
.drawer.resizing {
  transition: none !important;  /* disable width animation while dragging */
}
[data-theme="dark"] .drawer { box-shadow: -2px 0 24px rgba(0,0,0,0.4); }
.drawer.open { transform: translateX(0); }
.drawer[hidden] { display: none; }

/* ───── Drawer head ───── */
.drawer-head {
  position: sticky;
  top: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.drawer-head-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.drawer-icon { font-size: 16px; color: var(--fg-muted); }
.drawer-num {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.drawer-num:hover { text-decoration: underline; }
.drawer-repo {
  font-size: 12px;
  color: var(--fg-muted);
}
.drawer-close {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 16px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1;
}
.drawer-close:hover {
  background: var(--surface);
  color: var(--fg);
}

.drawer-title-row {
  padding: 16px 20px 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
  flex: 1;
  min-width: 0;
}
.drawer-gh {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.drawer-gh:hover { text-decoration: underline; }

.drawer-meta {
  padding: 0 20px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-muted);
}

/* ───── Drawer sections ───── */
.drawer-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-muted);
}
.drawer-section.hidden { display: none; }
.drawer-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.drawer-section-count {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ───── Drawer · Live section ───── */
.drawer-live-body {
  background: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}
.drawer-live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 6px;
}
.drawer-live-status .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.4s ease-out infinite;
}
.drawer-live-meta {
  color: var(--fg-muted);
  font-size: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.drawer-live-meta b { color: var(--fg); font-weight: 500; }

/* ───── Drawer · Timeline (v3: card layout, no dots) ───── */
.drawer-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline-item {
  position: relative;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.timeline-summary {
  color: var(--fg);
  word-break: break-word;
}
.timeline-detail-toggle {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  margin-top: 4px;
  user-select: none;
}
.timeline-detail-toggle:hover { text-decoration: underline; }
.timeline-detail {
  display: none;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--fg);
  max-height: 240px;
  overflow-y: auto;
}
.timeline-item.expanded .timeline-detail { display: block; }
/* Noop group — collapsed lifecycle 巡检 */
.noop-group { opacity: 0.78; border-left-color: var(--border-muted); }
.noop-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--surface-2);
  color: var(--fg-muted);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.noop-summary { color: var(--fg-muted); font-size: 12px; }
.noop-history { padding: 6px 0; display: none; }
.timeline-item.noop-group.expanded .noop-history { display: block; }
.noop-history-row {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  font-size: 11px;
  border-bottom: 1px dotted var(--border-muted);
}
.noop-history-row:last-child { border-bottom: none; }
.noop-history-time { color: var(--fg-muted); white-space: nowrap; font-family: ui-monospace, monospace; }
.noop-history-summary { color: var(--fg); flex: 1; }
.timeline-empty {
  color: var(--fg-muted);
  font-size: 12px;
  padding: 12px 0;
  text-align: center;
}

/* ───── Phase 6: session progress snippets in drawer live section ───── */
.drawer-progress { margin-top: 12px; border-top: 1px solid var(--border-muted); padding-top: 10px; }
.drawer-progress-title { font-size: 11px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.drawer-progress-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; font-size: 12px; }
.drawer-progress-item { display: grid; grid-template-columns: 20px 1fr auto; gap: 6px; padding: 4px 0; align-items: baseline; line-height: 1.4; }
.drawer-progress-item .progress-icon { color: var(--fg-muted); }
.drawer-progress-item .progress-main { word-break: break-word; color: var(--fg); }
.drawer-progress-item .progress-main b { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; }
.drawer-progress-item .progress-main .muted { color: var(--fg-muted); }
.drawer-progress-item .progress-main i { color: var(--fg-muted); font-style: italic; }
.drawer-progress-item .progress-time { color: var(--fg-muted); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ───── Action ⓘ help indicator ───── */
.timeline-action {
  cursor: help;
}
.timeline-action .action-help {
  font-size: 9px;
  color: var(--fg-muted);
  margin-left: 3px;
  opacity: 0.6;
  vertical-align: super;
}
.timeline-action:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}
.timeline-action:hover .action-help {
  opacity: 1;
  color: var(--accent);
}

/* ───── Timeline item layout v2 (clearer hierarchy) ───── */
/* Main row: icon + Chinese description + time */
.timeline-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.timeline-icon { font-size: 13px; color: var(--fg-muted); flex-shrink: 0; }
.timeline-desc {
  flex: 1;
  font-weight: 500;
  color: var(--fg);
  font-size: 13px;
}
.timeline-time {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  flex-shrink: 0;
}

/* Summary: bot 写的具体内容 */
.timeline-summary {
  color: var(--fg);
  font-size: 12px;
  line-height: 1.5;
  padding-left: 22px;
  margin-top: 2px;
}

/* Footer: actor + action 原名 + detail toggle，全部小灰字 */
.timeline-foot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  padding-left: 22px;
  font-size: 10.5px;
  color: var(--fg-muted);
}
.timeline-foot-actor { font-style: italic; }
.timeline-foot-action {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  background: var(--surface);
  padding: 0 5px;
  border-radius: 3px;
  cursor: help;
  border: 1px solid var(--border-muted);
}
.timeline-foot-toggle {
  margin-left: auto;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}
.timeline-foot-toggle:hover { text-decoration: underline; }

/* ───── Timeline direction (receive ← / action →) ───── */
.timeline-arrow {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-weight: 700;
  font-size: 14px;
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  cursor: help;
}
.timeline-item.dir-receive .timeline-arrow { color: var(--fg-muted); }
.timeline-item.dir-action  .timeline-arrow { color: var(--accent); }
.timeline-item.dir-neutral .timeline-arrow { color: var(--border); }

/* Slight background tint to separate receive vs action visually */
.timeline-item.dir-receive { background: linear-gradient(to right, var(--surface) 0%, transparent 60%); padding-left: 4px; border-radius: 4px; }
.timeline-item.dir-action  { background: linear-gradient(to right, var(--accent-subtle) 0%, transparent 60%); padding-left: 4px; border-radius: 4px; }

/* Timeline center line color hint matches direction */
.timeline-item.dir-receive::before { border-color: var(--fg-muted); }
.timeline-item.dir-action::before  { border-color: var(--accent); background: var(--accent); }

/* foot action gets a real tooltip via title (kept) — and now has explanation in it */
.timeline-foot-action { cursor: help; }

/* When the description fallback hits "(暂无说明...)" surface that gently */
.timeline-desc:has-text("(暂无说明") { color: var(--fg-muted); font-style: italic; }

/* ───── Cross-session messaging (bot ⇌ bot coordination) ───── */
.timeline-item.dir-cross_session .timeline-arrow {
  color: var(--purple);
  font-size: 16px;
}
.timeline-item.dir-cross_session {
  background: linear-gradient(to right, rgba(130,80,223,0.08) 0%, transparent 70%);
  padding-left: 4px;
  border-radius: 4px;
  border-left: 2px solid var(--purple);
  margin-left: -2px;
}
.timeline-item.dir-cross_session::before {
  border-color: var(--purple);
  background: var(--purple);
  width: 11px;
  height: 11px;
}
.timeline-item.dir-cross_session .timeline-desc {
  color: var(--purple);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   Trigger items in timeline (synclo 标准化"接收事件"行)
   ═══════════════════════════════════════════════════════════════════════ */
.timeline-item.timeline-event {
  background: linear-gradient(to right, var(--surface) 0%, transparent 75%);
  border-left: 2px solid var(--fg-muted);
  border-radius: 4px;
  padding: 6px 8px 6px 6px;
  margin-left: -2px;
}
.timeline-item.timeline-event .timeline-desc {
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.timeline-item.timeline-event .event-type {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  text-transform: none;
  font-size: 11px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0;
}
.timeline-item.timeline-event .timeline-event-body {
  padding-left: 30px;
  color: var(--fg);
  font-size: 12px;
}
.timeline-item.timeline-event .event-status {
  margin-left: 8px;
  font-size: 11px;
  color: var(--fg-muted);
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   CSS-based custom tooltip (data-tip="...") — appears INSTANTLY on hover
   replaces native HTML title which has 1-2 sec delay
   ═══════════════════════════════════════════════════════════════════════ */
[data-tip] {
  position: relative;
}
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: var(--fg);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 400;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  white-space: pre-line;
  max-width: 360px;
  width: max-content;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  line-height: 1.4;
  text-align: left;
}
[data-tip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 10px;
  border: 4px solid transparent;
  border-top-color: var(--fg);
  z-index: 100;
  pointer-events: none;
}
[data-theme="dark"] [data-tip]:hover::after {
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* override direction tint for trigger items — they're not "bot activity" */
.timeline-item.timeline-event.dir-receive {
  background: linear-gradient(to right, var(--surface) 0%, transparent 75%);
}

/* Trigger item secondary badges */
.event-wrapper {
  margin-left: 8px;
  font-size: 10px;
  color: var(--fg-muted);
  background: var(--bg);
  padding: 0 5px;
  border-radius: 3px;
  border: 1px dashed var(--border-muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  cursor: help;
}
.event-actor {
  font-style: italic;
  font-size: 10.5px;
  color: var(--fg-muted);
  margin-right: 8px;
}

/* Timeline informational note (e.g. "0 events because cross-repo") */
.timeline-note {
  list-style: none;
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg);
}
.timeline-note code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

/* When description fallback is the raw action name (dict miss), style as mono */
.timeline-desc.raw-action {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
}

/* Arrow back to plain text-style (not emoji size) */
.timeline-arrow {
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* ───── Trigger expand panel (watcher node + injected context + payload) ───── */
.trigger-expand {
  display: none;
  margin: 8px 0 0 30px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.timeline-item.timeline-event.expanded .trigger-expand { display: block; }
.trigger-detail-section { margin-bottom: 10px; }
.trigger-detail-section:last-child { margin-bottom: 0; }
.trigger-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.trigger-detail-body { font-size: 12px; color: var(--fg); }
.trigger-node-id, .trigger-watcher-parent code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-muted);
  color: var(--accent);
}
.trigger-watcher-content {
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--surface);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg);
  border-left: 3px solid var(--accent);
}
.trigger-watcher-parent {
  margin-top: 4px;
  font-size: 11px;
  color: var(--fg-muted);
}
.trigger-pre {
  background: var(--surface);
  padding: 6px 8px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  color: var(--fg);
}
.trigger-context-placeholder {
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--fg-muted);
  border: 1px dashed var(--border-muted);
  line-height: 1.5;
}
.trigger-context-placeholder code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--accent);
}

/* ───── Event tree (watcher node ancestry, indented) ───── */
.event-tree {
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-muted);
  font-size: 12px;
}
.tree-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  line-height: 1.5;
}
.tree-row.is-trigger { background: var(--accent-subtle); border-radius: 4px; }
.tree-branch {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--fg-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.tree-role-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}
.tree-role-badge.root {
  background: var(--purple);
  color: white;
}
.tree-role-badge.trigger {
  background: var(--accent);
  color: white;
}
.tree-role-badge.mid {
  background: var(--bg);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 10px;
}
.tree-content {
  flex: 1;
  color: var(--fg);
  min-width: 0;
  word-break: break-word;
}
.tree-children-hint {
  font-size: 10px;
  color: var(--fg-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-muted);
  cursor: help;
  flex-shrink: 0;
}
.tree-id {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--fg-muted);
  cursor: help;
  flex-shrink: 0;
}

/* Trigger context preview pre 块（深字背景, 可滚动） */
.trigger-context-pre {
  max-height: 320px;
  overflow-y: auto;
}
.trigger-context-note {
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg);
}
.trigger-context-note b { color: var(--accent); }

/* Coalesced sub-events inside a trigger row */
.coalesce-badge {
  display: inline-block;
  background: var(--warn);
  color: white;
  font-size: 10px;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 600;
  margin-left: 4px;
  cursor: help;
}
.coalesce-block {
  margin: 6px 0 4px 30px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 4px;
}
.coalesce-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.coalesce-event {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 8px;
  font-size: 11px;
  padding: 2px 0;
  align-items: baseline;
  line-height: 1.4;
}
.coalesce-time {
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.coalesce-type {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--accent);
  font-size: 11px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-muted);
  word-break: break-all;
}
.coalesce-action {
  font-size: 10px;
  color: var(--fg-muted);
  font-style: italic;
}

/* Activity → upstream trigger hint badge */
.timeline-trigger-hint {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-muted);
  margin: 2px 0 4px;
  padding-left: 0;
}
.trigger-hint-type {
  color: var(--accent);
  font-weight: 500;
  cursor: help;
  border-bottom: 1px dashed var(--accent);
}
.trigger-hint-delay {
  font-variant-numeric: tabular-nums;
  font-size: 10px;
}

/* Trigger event payload key fields (作者/标题/body) */
.event-payload-title {
  margin: 4px 0 2px 30px;
  font-size: 13px;
  font-weight: 500;
}
.event-payload-title a {
  color: var(--accent);
  text-decoration: none;
}
.event-payload-title a:hover { text-decoration: underline; }
.event-payload-meta {
  margin: 0 0 2px 30px;
  font-size: 11px;
  color: var(--fg-muted);
}
.event-payload-meta b { color: var(--fg); font-weight: 600; }
.event-action-chip {
  background: var(--surface);
  padding: 0 6px;
  border-radius: 3px;
  border: 1px solid var(--border-muted);
  font-family: ui-monospace, monospace;
  font-size: 10px;
}
.event-payload-body {
  margin: 4px 0 4px 30px;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg);
  border-left: 3px solid var(--border-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 90px;
  overflow: hidden;
  position: relative;
}

/* ───── PR / Issue 视觉区分（左边色条） ───── */
.entity-row {
  position: relative;
  padding-left: 22px;  /* 让色条不重叠主内容 */
}
.entity-row::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--border);
}
/* 色条按 state attr 着色（type 由左侧 PR/ISSUE tag 承担） */
.entity-row[data-state="open"]::before   { background: var(--success); }
.entity-row[data-state="merged"]::before { background: var(--purple); }
.entity-row[data-state="closed"]::before { background: var(--danger); }
.entity-row[data-state="draft"]::before  { background: var(--fg-muted); opacity: 0.6; }
.entity-icon.issue-open, .entity-icon.issue-closed { font-size: 18px; }

/* Activity item 缩进（让它视觉上从属于上面的 trigger） */
.timeline-item:not(.timeline-event) {
  margin-left: 24px;
  border-left: 2px solid var(--border-muted);
  padding-left: 10px;
}
.timeline-item.dir-cross_session {
  /* cross_session 已有 border-left，覆盖 */
  margin-left: 24px;
}

/* PR / ISSUE type badge before number */
.entity-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  margin-right: 4px;
  vertical-align: middle;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.entity-type-badge.type-pr {
  background: rgba(26, 127, 55, 0.12);  /* success-subtle 透明 */
  color: var(--success);
  border: 1px solid rgba(26, 127, 55, 0.4);
}
.entity-type-badge.type-issue {
  background: rgba(130, 80, 223, 0.10);
  color: var(--purple);
  border: 1px solid rgba(130, 80, 223, 0.4);
}
[data-theme="dark"] .entity-type-badge.type-pr {
  background: rgba(63, 185, 80, 0.15);
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.5);
}
[data-theme="dark"] .entity-type-badge.type-issue {
  background: rgba(163, 113, 247, 0.15);
  color: var(--purple);
  border-color: rgba(163, 113, 247, 0.5);
}

/* state tag 加在标题后（OPEN/CLOSED/MERGED/DRAFT） */
.entity-state-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  margin-left: 4px;
  vertical-align: middle;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  border: 1px solid currentColor;
}
.entity-state-tag.s-open    { color: var(--success); background: rgba(26,127,55,0.08); }
.entity-state-tag.s-merged  { color: var(--purple);  background: rgba(130,80,223,0.10); }
.entity-state-tag.s-closed  { color: var(--danger);  background: rgba(207,34,46,0.08); }
.entity-state-tag.s-draft   { color: var(--fg-muted); background: var(--surface); }
[data-theme="dark"] .entity-state-tag.s-open    { background: rgba(63,185,80,0.15); }
[data-theme="dark"] .entity-state-tag.s-merged  { background: rgba(163,113,247,0.15); }
[data-theme="dark"] .entity-state-tag.s-closed  { background: rgba(248,81,73,0.15); }
