:root {
  /* ===== 对齐 stock-board-journal 平台设计令牌（暖棕主题） ===== */
  --bg: #f3f5fb;
  --panel: #ffffff;
  --border: #e9ecf3;
  --border-soft: #eef1f8;
  --text: #111820;
  --muted: #637180;
  --muted-2: #54616f;
  --primary: #b8862b;
  --primary-2: #b8862b;
  --primary-soft: #faf3e2;
  --primary-grad: linear-gradient(135deg, #b8862b 0%, #b8862b 100%);
  --zhihu: #2b7fff;
  --zhihu-soft: #eaf1f7;
  --xueqiu: #ef4d5a;
  --xueqiu-soft: #fff0ee;
  --weibo: #e9492e;
  --weibo-soft: #fff1ed;
  --taoguba: #0f766e;
  --taoguba-soft: #e9f7f5;
  --zsxq: #1677d2;
  --zsxq-soft: #edf5ff;
  --weread: #18864b;
  --weread-soft: #edf8f2;
  --green: #087348;
  --green-soft: #eaf7f0;
  --red: #e23b48;
  --red-soft: #fff0ee;
  --amber: #c9953a;
  --amber-soft: #faf3e2;
  --teal: #14b8a6;
  --shadow-sm: 0 1px 2px rgba(17,24,32,.05), 0 6px 18px rgba(17,24,32,.06);
  --shadow-md: 0 12px 30px rgba(17,24,32,.12);
  --shadow-lg: 0 24px 60px rgba(15,23,42,.30);
  --radius: 10px;
  --radius-sm: 9px;
  --radius-xs: 8px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  font-family: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC","Source Han Sans SC",system-ui,-apple-system,sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: calc(14px * var(--ui-font-scale, 1.14));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; height: 100vh;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  background: var(--primary-grad); display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(184, 134, 43, .32);
}
.brand .logo svg { width: 21px; height: 21px; color: #fff; }
.brand .name { font-size: calc(15.5px * var(--ui-font-scale, 1.14)); font-weight: 800; letter-spacing: .2px; }
.brand .sub { font-size: calc(11.5px * var(--ui-font-scale, 1.14)); color: var(--muted); margin-top: 1px; }

nav.tabs { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
nav.tabs button {
  display: flex; align-items: center; gap: 12px;
  border: none; background: transparent; color: var(--muted);
  padding: 11px 13px; border-radius: 11px; cursor: pointer;
  font-size: calc(14px * var(--ui-font-scale, 1.14)); font-weight: 600; text-align: left; width: 100%;
  position: relative; transition: background .2s var(--ease), color .2s var(--ease);
}
nav.tabs button svg { width: 19px; height: 19px; flex: 0 0 19px; stroke-width: 2; }
nav.tabs button:hover { background: #f3f5fb; color: var(--text); }
nav.tabs button.active { background: var(--primary-soft); color: var(--primary); }
nav.tabs button.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary-grad);
}
nav.tabs button .tab-count {
  margin-left: auto; font-size: calc(11px * var(--ui-font-scale, 1.14)); font-weight: 700; color: var(--muted);
  background: var(--border-soft); border-radius: 999px; padding: 1px 8px; min-width: 20px; text-align: center;
}
nav.tabs button.active .tab-count { background: rgba(184, 134, 43, .15); color: var(--primary); }

.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border-soft); }
.sidebar-foot .stat { display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--ui-font-scale, 1.14)); color: var(--muted); }
.sidebar-foot .dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(24,169,87,.16); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(24,169,87,.16); }
  50% { box-shadow: 0 0 0 6px rgba(24,169,87,.08); }
}

/* ===== 平台导航分组（与 stock-board-journal 各页互联互通） ===== */
.nav-group { margin-top: 16px; }
.nav-group-title { font-size: calc(11px * var(--ui-font-scale, 1.14)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #607080; padding: 0 13px 8px; }
.plat-nav { display: flex; flex-direction: column; gap: 4px; }
.plat-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  border: none; background: transparent; color: var(--muted);
  padding: 10px 13px; border-radius: 11px; cursor: pointer;
  font-size: calc(14px * var(--ui-font-scale, 1.14)); font-weight: 600; text-align: left; text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.plat-nav .nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; stroke-width: 2; }
.plat-nav .nav-link:hover { background: #f3f5fb; color: var(--text); }
.plat-nav .nav-link.is-current { background: var(--primary-soft); color: var(--primary); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagehead {
  position: sticky; top: 0; z-index: 15;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 17px 26px; display: flex; align-items: center; justify-content: space-between;
}
.pagehead h1 { margin: 0; font-size: calc(19px * var(--ui-font-scale, 1.14)); font-weight: 800; letter-spacing: .2px; }
.pagehead p { margin: 3px 0 0; font-size: calc(12.5px * var(--ui-font-scale, 1.14)); color: var(--muted); }
.pagehead .ph-right { display: flex; align-items: center; gap: 12px; }
.pagehead .ph-badge { font-size: calc(12px * var(--ui-font-scale, 1.14)); color: var(--muted); background: #fff; border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.pagehead .ph-clock { font-size: calc(13px * var(--ui-font-scale, 1.14)); font-weight: 600; color: var(--muted-2); font-variant-numeric: tabular-nums; }

main { max-width: 1220px; width: 100%; margin: 0 auto; padding: 24px 26px 40px; }
.panel { display: none; }
.panel.active { display: block; animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== 卡片 ===== */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 18px;
  transition: box-shadow .2s var(--ease);
}
.card h3 { margin: 0 0 14px; font-size: calc(15px * var(--ui-font-scale, 1.14)); font-weight: 700; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title-row h3 { margin: 0; }

/* ===== 表单 ===== */
.row { display: flex; flex-wrap: wrap; gap: 13px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: calc(12px * var(--ui-font-scale, 1.14)); color: var(--muted); font-weight: 600; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: calc(14px * var(--ui-font-scale, 1.14)); font-family: inherit; background: #fff; color: var(--text); min-width: 160px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-width: 320px; min-height: 64px; resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #d4d9e6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 134, 43, .15);
}
code { background: #f4f6fb; padding: 1px 6px; border-radius: 6px; font-size: calc(12px * var(--ui-font-scale, 1.14)); color: #52607a; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.table-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.category-help { max-width: 720px; margin-top: -5px; font-size: calc(12.5px * var(--ui-font-scale, 1.14)); line-height: 1.6; }
.blogger-table { min-width: 980px; }
.category-select {
  min-width: 116px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: calc(12.5px * var(--ui-font-scale, 1.14));
  font-weight: 650;
}
.category-select.category-latent { border-color: #d7b567; color: #805b18; background: #fff8e8; }
.category-reason {
  min-width: 190px;
  width: min(260px, 28vw);
  min-height: 92px;
  padding: 7px 9px;
  font-size: calc(12.5px * var(--ui-font-scale, 1.14));
  line-height: 1.45;
  resize: vertical;
}
.duplicate-entry { margin-top: 4px; color: #9a6200; font-size: calc(11.5px * var(--ui-font-scale, 1.14)); line-height: 1.4; }

.notify-status { font-size: calc(12.5px * var(--ui-font-scale, 1.14)); color: var(--muted); font-weight: 600; }
.notify-status.good { color: var(--green); }
.notify-status.bad { color: var(--red); }

.err-text {
  font-size: calc(11.5px * var(--ui-font-scale, 1.14)); color: var(--red); background: var(--red-soft);
  padding: 5px 8px; border-radius: 6px; margin-top: 4px;
  line-height: 1.45; max-width: 320px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}

button.btn {
  border: none; border-radius: var(--radius-sm); padding: 10px 17px; cursor: pointer;
  font-size: calc(14px * var(--ui-font-scale, 1.14)); font-weight: 600; background: var(--primary-grad); color: #fff;
  box-shadow: 0 4px 14px rgba(184, 134, 43, .25); transition: filter .15s, transform .05s, box-shadow .15s;
}
button.btn:hover { filter: brightness(1.06); box-shadow: 0 6px 20px rgba(184, 134, 43, .30); }
button.btn:active { transform: translateY(1px); }
button.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--border); box-shadow: none; }
button.btn.ghost:hover { background: var(--primary-soft); border-color: var(--primary); }
button.btn.danger { background: #fff; color: var(--red); border: 1px solid #f0c8c4; box-shadow: none; }
button.btn.danger:hover { background: var(--red-soft); }
button.btn.small { padding: 6px 11px; font-size: calc(12.5px * var(--ui-font-scale, 1.14)); box-shadow: none; }
button.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 徽标 / 标签 ===== */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: calc(12px * var(--ui-font-scale, 1.14)); font-weight: 600; line-height: 1.7; }
.badge.zhihu { background: var(--zhihu-soft); color: var(--zhihu); }
.badge.xueqiu { background: var(--xueqiu-soft); color: var(--xueqiu); }
.badge.weibo { background: var(--weibo-soft); color: var(--weibo); }
.badge.taoguba { background: var(--taoguba-soft); color: var(--taoguba); }
.badge.zsxq { background: var(--zsxq-soft); color: var(--zsxq); }
.badge.weread { background: var(--weread-soft); color: var(--weread); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.err { background: var(--red-soft); color: var(--red); }
.sent-pos { color: var(--red); font-weight: 700; }
.sent-neg { color: var(--green); font-weight: 700; }
.sent-zero { color: var(--muted); font-weight: 600; }

.tag { display: inline-block; border-radius: 7px; padding: 2px 9px; margin: 2px 5px 2px 0; font-size: calc(12px * var(--ui-font-scale, 1.14)); cursor: pointer; transition: background .12s, transform .1s; font-weight: 500; }
.tag:hover { filter: brightness(.97); transform: translateY(-1px); }
.tag.stock { background: var(--xueqiu-soft); color: var(--xueqiu); }
.tag.kw { background: var(--primary-soft); color: var(--primary); }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border-soft); font-size: calc(13px * var(--ui-font-scale, 1.14)); }
th { color: var(--muted); font-weight: 700; background: #fafbfe; font-size: calc(12px * var(--ui-font-scale, 1.14)); letter-spacing: .3px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbff; }

/* ===== 统计条 ===== */
.stats-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.stats-bar .stat-pill {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.stats-bar .stat-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stats-bar .stat-pill .sp-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
}
.stats-bar .stat-pill .sp-icon svg { width: 17px; height: 17px; }
.stats-bar .stat-pill .sp-num { font-size: calc(18px * var(--ui-font-scale, 1.14)); font-weight: 800; line-height: 1; }
.stats-bar .stat-pill .sp-lbl { font-size: calc(11px * var(--ui-font-scale, 1.14)); color: var(--muted); margin-top: 2px; }

/* ===== 发言卡片（历史脉络）===== */
.post {
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 12px; padding: 15px 17px; margin-bottom: 13px; background: #fff;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease), transform .1s;
  animation: slideIn .3s var(--ease) backwards;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.post:hover { box-shadow: var(--shadow-md); }
.post.zhihu { border-left-color: var(--zhihu); }
.post.xueqiu { border-left-color: var(--xueqiu); }
.post.weibo { border-left-color: var(--weibo); }
.post.taoguba { border-left-color: var(--taoguba); }
.post.zsxq { border-left-color: var(--zsxq); }
.post.weread { border-left-color: var(--weread); }
.post .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: calc(12px * var(--ui-font-scale, 1.14)); margin-bottom: 7px; }
.post .avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: calc(12px * var(--ui-font-scale, 1.14)); font-weight: 700; color: #fff;
}
.post .avatar.zhihu { background: var(--zhihu); }
.post .avatar.xueqiu { background: var(--xueqiu); }
.post .avatar.weibo { background: var(--weibo); }
.post .avatar.taoguba { background: var(--taoguba); }
.post .avatar.zsxq { background: var(--zsxq); }
.post .avatar.weread { background: var(--weread); }
.post .title { font-weight: 700; font-size: calc(15px * var(--ui-font-scale, 1.14)); margin: 2px 0 7px; }
.post .post-content-shell .content,
.thread-item .post-content-shell .content {
  display: block;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #2b3340;
}
.post .post-content-shell .content.collapsed,
.thread-item .post-content-shell .content.collapsed {
  position: relative;
  max-height: calc(1.65em * 2);
  overflow: hidden;
}
.post .post-content-shell .content.collapsed::after,
.thread-item .post-content-shell .content.collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.45em;
  background: linear-gradient(transparent, #fff 82%);
  pointer-events: none;
}
.thread-item .post-content-shell .content.collapsed::after {
  background: linear-gradient(transparent, #fafbff 82%);
}
.content-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.content-action {
  border: 1px solid #dfd1ba;
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  padding: 5px 10px;
  font: inherit;
  font-size: calc(12.5px * var(--ui-font-scale, 1.14));
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.content-action:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.content-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.content-action.copy-action {
  border-color: var(--border);
  color: var(--muted-2);
}
.content-action.copy-action:hover {
  border-color: #cfd5e2;
  background: #f7f8fb;
}
.empty-content { color: var(--muted); font-style: italic; }
.post .stats { color: var(--muted); font-size: calc(12px * var(--ui-font-scale, 1.14)); margin-top: 10px; display: flex; gap: 16px; align-items: center; }
a.link { color: var(--primary); text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f2f7 25%, #e6e9f0 50%, #f0f2f7 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-post { border: 1px solid var(--border); border-radius: 12px; padding: 15px 17px; margin-bottom: 13px; }
.skeleton-post .sk-line { height: 14px; border-radius: 6px; margin-bottom: 8px; }
.skeleton-post .sk-line.w30 { width: 30%; }
.skeleton-post .sk-line.w50 { width: 50%; }
.skeleton-post .sk-line.w70 { width: 70%; }
.skeleton-post .sk-line.w90 { width: 90%; }

/* ===== 加载中动画 ===== */
.loading-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 52px 0 64px; color: var(--muted);
}
.loading-box .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border-soft);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
.loading-box .loading-text { font-size: calc(13.5px * var(--ui-font-scale, 1.14)); font-weight: 600; letter-spacing: .02em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 按钮内联加载指示器 */
.btn-spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55); border-top-color: #fff;
  animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}

/* ===== 图表 ===== */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease); }
.chart-box:hover { box-shadow: var(--shadow-md); }
.chart-box.full { grid-column: 1 / -1; }
.chart { width: 100%; height: 286px; }
.chart.tall { height: 340px; }

/* ===== KPI ===== */
.kpi { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 18px; }
.kpi .box {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; min-width: 128px; flex: 1; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .15s var(--ease), box-shadow .15s;
}
.kpi .box:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi .box::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: var(--primary-grad); opacity: .85; }
.kpi .num { font-size: calc(27px * var(--ui-font-scale, 1.14)); font-weight: 800; letter-spacing: .5px; }
.kpi .lbl { color: var(--muted); font-size: calc(12px * var(--ui-font-scale, 1.14)); margin-top: 2px; }

/* ===== 杂项 ===== */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(8px); background: #1b2330; color: #fff; padding: 11px 20px; border-radius: 12px; z-index: 60; opacity: 0; transition: opacity .25s, transform .25s; box-shadow: var(--shadow-md); font-weight: 500; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { color: var(--muted); text-align: center; padding: 44px 20px; font-size: calc(13.5px * var(--ui-font-scale, 1.14)); }
.empty-icon { font-size: calc(36px * var(--ui-font-scale, 1.14)); margin-bottom: 8px; opacity: .5; }
.muted { color: var(--muted); }
.filters { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.discovery-status {
  min-height: 24px;
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: calc(12.5px * var(--ui-font-scale, 1.14));
}
.discovery-status.is-error { color: var(--red); font-weight: 600; }
.discovery-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.discovery-candidates[hidden] { display: none; }
.candidate-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s;
}
.candidate-item:hover {
  border-color: #d9c5a7;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.candidate-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: #fffdf8;
}
.candidate-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: #fff;
  font-size: calc(13px * var(--ui-font-scale, 1.14));
  font-weight: 800;
  background: var(--muted);
}
.candidate-avatar.zhihu { background: var(--zhihu); }
.candidate-avatar.xueqiu { background: var(--xueqiu); }
.candidate-avatar.weibo { background: var(--weibo); }
.candidate-avatar.taoguba { background: var(--taoguba); }
.candidate-avatar.zsxq { background: var(--zsxq); }
.candidate-avatar.weread { background: var(--weread); }
.candidate-main { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.candidate-main b,
.candidate-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.candidate-main small { color: var(--muted); font-size: calc(11.5px * var(--ui-font-scale, 1.14)); }
.candidate-state {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: calc(12px * var(--ui-font-scale, 1.14));
  font-weight: 700;
}
.filter-active-tag {
  display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: 4px 12px; font-size: calc(12px * var(--ui-font-scale, 1.14)); font-weight: 600; margin-left: 8px; cursor: pointer;
  transition: background .12s;
}
.filter-active-tag:hover { background: #f3e7d6; }

/* ===== 话题脉络 ===== */
.topics-layout { display: grid; grid-template-columns: 326px 1fr; gap: 16px; align-items: start; }
.topic-list { max-height: 74vh; overflow-y: auto; padding-right: 4px; }
.topic-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; margin-bottom: 11px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; background: #fff;
}
.topic-card:hover { border-color: #e3d3bf; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.topic-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.topic-card .t-name { font-weight: 700; font-size: calc(15px * var(--ui-font-scale, 1.14)); display: flex; align-items: center; gap: 8px; }
.topic-card .t-meta { color: var(--muted); font-size: calc(12px * var(--ui-font-scale, 1.14)); margin-top: 7px; display: flex; gap: 12px; flex-wrap: wrap; }
.thread-item { position: relative; padding: 0 0 20px 28px; }
.thread-item::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: -4px; width: 2px; background: linear-gradient(180deg, var(--primary), #ecdcc4); }
.thread-item:last-child::before { display: none; }
.thread-item::after { content: ""; position: absolute; left: 3px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.thread-item .t-time { font-size: calc(12px * var(--ui-font-scale, 1.14)); color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.thread-item .t-body { margin-top: 6px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; color: #2b3340; background: #fafbff; border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px 13px; }
.thread-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.thread-head h3 { margin: 0; font-size: calc(17px * var(--ui-font-scale, 1.14)); }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d6dae6; border-radius: 9px; border: 2px solid #fff; }
::-webkit-scrollbar-thumb:hover { background: #c2c8d8; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
  .topics-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: relative;
    flex-direction: row; align-items: center; gap: 8px; padding: 12px 14px; overflow-x: auto;
  }
  .brand { padding: 0 14px 0 4px; flex: 0 0 auto; }
  .brand .sub { display: none; }
  nav.tabs { flex-direction: row; margin-top: 0; flex: 1; }
  nav.tabs button { width: auto; white-space: nowrap; padding: 9px 12px; }
  nav.tabs button::before { display: none; }
  nav.tabs button span { display: none; }
  nav.tabs button .tab-count { display: none; }
  .sidebar-foot { display: none; }
  .pagehead { padding: 14px 16px; }
  .pagehead .ph-clock { display: none; }
  main { padding: 18px 16px 32px; }
  .stats-bar .stat-pill { flex: 1; min-width: 130px; }
}

/* ---------- 系统日志 ---------- */
.log-view {
  margin-top: 14px;
  max-height: 62vh;
  overflow: auto;
  background: #0f1420;
  border: 1px solid #1f2735;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: calc(12.5px * var(--ui-font-scale, 1.14));
  line-height: 1.7;
  color: #c8d0e0;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line { display: flex; gap: 10px; padding: 1px 0; }
.log-line .lt { color: #6b7689; flex: 0 0 auto; }
.log-line .ll { flex: 0 0 64px; font-weight: 700; text-align: center; border-radius: 4px; padding: 0 4px; }
.log-line .lm { flex: 1 1 auto; }
.log-line.lv-DEBUG .ll { color: #8b95a7; }
.log-line.lv-INFO .ll { color: #5aa9ff; }
.log-line.lv-WARNING .ll { color: #f5b942; }
.log-line.lv-ERROR .ll, .log-line.lv-CRITICAL .ll { color: #ff6b75; }
.log-line.lv-ERROR, .log-line.lv-CRITICAL { background: rgba(255, 80, 90, .08); }
.log-empty { color: #6b7689; text-align: center; padding: 30px 0; }

/* ---------- 日期分组（历史脉络） ---------- */
.timeline-day { margin-bottom: 18px; }
.timeline-day-label {
  display: flex; align-items: center; gap: 10px;
  font-size: calc(15px * var(--ui-font-scale, 1.14)); font-weight: 700; color: var(--text);
  margin-bottom: 12px; padding: 6px 4px; border-radius: 8px;
  cursor: pointer; user-select: none; transition: background .15s;
}
.timeline-day-label:hover { background: var(--border-soft); }
.timeline-day-label .tdchevron {
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  transition: transform .2s var(--ease);
}
.timeline-day-label .tdchevron::before {
  content: ""; width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.timeline-day.collapsed .timeline-day-label .tdchevron { transform: rotate(-90deg); }
.timeline-day.collapsed .timeline-day-posts { display: none; }
.timeline-day-label .tdcount {
  margin-left: auto; font-size: calc(12px * var(--ui-font-scale, 1.14)); font-weight: 600;
  color: var(--muted); background: var(--border-soft); border-radius: 999px;
  padding: 2px 10px;
}
.timeline-day-posts {
  padding-left: 9px; border-left: 2px solid var(--border-soft); margin-left: 4px;
}

/* ---------- 回复/原帖展示 ---------- */
.post-reply { border-left: 4px solid var(--primary); }
.reply-badge {
  display: inline-block;
  color: var(--primary);
  font-size: calc(13px * var(--ui-font-scale, 1.14));
  font-weight: 600;
  margin: 8px 0 6px;
}
.reply-content {
  font-size: calc(14.5px * var(--ui-font-scale, 1.14));
  line-height: 1.6;
  color: var(--text);
}
.reply-original {
  margin: 12px 0 6px 0;
  padding: 12px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.reply-original-label {
  font-size: calc(12px * var(--ui-font-scale, 1.14));
  color: var(--muted-2);
  font-weight: 600;
  margin-bottom: 6px;
}
.reply-original-text {
  font-size: calc(13.5px * var(--ui-font-scale, 1.14));
  color: var(--text);
  line-height: 1.55;
}

/* ===== 嵌入雪球分析台：隐藏博主台自身侧边栏，由雪球分析台导航驱动 ===== */
.is-embedded .sidebar { display: none; }
.is-embedded .nav-drawer-button,
.is-embedded .nav-drawer-overlay { display: none !important; }
.is-embedded { height: auto; background: transparent; }
.is-embedded .layout { min-height: 0; height: auto; }
.is-embedded .content { height: auto; }
.is-embedded .pagehead {
  position: static; padding: 0 0 8px; border: 0;
  background: transparent; backdrop-filter: none; justify-content: flex-end;
}
.is-embedded .pagehead > div:first-child { display: none; }
.is-embedded .pagehead .ph-badge { padding: 2px 9px; font-size: calc(11px * var(--ui-font-scale, 1.14)); }
.is-embedded .pagehead .ph-clock { font-size: calc(12px * var(--ui-font-scale, 1.14)); }
.is-embedded main { max-width: none; padding: 0 0 16px; }
.is-embedded .topic-list { max-height: calc(var(--blogger-viewport-height, 700px) * .74); }
.is-embedded .log-view { max-height: calc(var(--blogger-viewport-height, 700px) * .62); }
.is-embedded .research-dialog {
  top: calc(var(--blogger-visible-top, 0px) + 16px); bottom: auto;
  max-height: calc(var(--blogger-visible-height, 600px) - 32px);
  margin: 0 auto;
}
.is-embedded .toast,
.is-embedded .research-notice {
  top: calc(var(--blogger-visible-top, 0px) + var(--blogger-visible-height, 600px) - 80px);
  bottom: auto;
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .layout,
  .content,
  main,
  .card,
  .row,
  .field {
    min-width: 0;
    max-width: 100%;
  }

  main {
    padding: 14px 12px 28px;
  }

  .card,
  .filters {
    padding: 14px;
  }

  .is-embedded main {
    padding: 0 0 16px;
  }

  .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: 100%;
  }

  .row > *,
  .field,
  .field[style] {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
  }

  input,
  select,
  textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
  }

  textarea {
    min-width: 0;
  }

  .field > div[style*="display:flex"] {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .field > div[style*="display:flex"] > .btn {
    flex: 1 1 100%;
    min-height: 44px;
  }

  button.btn {
    min-height: 44px;
  }

  .table-scroll button.btn.small {
    min-width: 44px;
  }

  .blogger-table-scroll {
    overflow: visible;
  }

  .blogger-table {
    display: block;
    min-width: 0;
  }

  .blogger-table thead {
    display: none;
  }

  .blogger-table tbody {
    display: grid;
    gap: 12px;
  }

  .blogger-table tr {
    display: grid;
    grid-template-areas:
      "name name"
      "platform status"
      "category category"
      "reason reason"
      "fetched fetched"
      "error error"
      "actions actions";
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
  }

  .blogger-table tr:hover {
    background: #fff;
  }

  .blogger-table td {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .blogger-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: calc(11.5px * var(--ui-font-scale, 1.14));
    font-weight: 700;
    letter-spacing: .03em;
  }

  .blogger-table td:nth-child(1) { grid-area: name; }
  .blogger-table td:nth-child(2) { grid-area: platform; }
  .blogger-table td:nth-child(3) { grid-area: category; }
  .blogger-table td:nth-child(4) { grid-area: reason; }
  .blogger-table td:nth-child(5) { grid-area: status; }
  .blogger-table td:nth-child(6) { grid-area: fetched; }
  .blogger-table td:nth-child(7) { grid-area: error; }
  .blogger-table td:nth-child(8) { grid-area: actions; flex-direction: row; flex-wrap: wrap; }

  .blogger-table td:nth-child(8)::before {
    flex: 1 1 100%;
  }

  .blogger-table .category-select,
  .blogger-table .category-reason {
    width: 100%;
    min-width: 0;
  }

  .blogger-table .err-text {
    max-width: none;
  }

  #bloggers .card-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #bloggers .card-title-row > a.btn {
    align-self: flex-start;
    white-space: nowrap;
  }

  .research-actions button,
  .research-selected button,
  .research-results button {
    min-height: 44px;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stats-bar .stat-pill {
    min-width: 0;
    padding: 10px 12px;
  }

  code {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .post,
  .thread-item .t-body {
    overflow-wrap: anywhere;
  }

  .content-action {
    min-height: 40px;
    padding: 8px 12px;
  }

  .discovery-candidates {
    grid-template-columns: minmax(0, 1fr);
  }

  .candidate-item {
    min-height: 52px;
  }
}

@media (max-width: 340px) {
  .stats-bar {
    grid-template-columns: minmax(0, 1fr);
  }
}
