/* ---------- 片段追问：聊天模式（对话往下追加、输入在底、回答可划词） ---------- */
.ask-transcript { max-height: 48vh; overflow: auto; white-space: normal; }
.ask-transcript .ask-turn-content { cursor: text; }          /* 提示可划词选取 */
.ask-input-row { display: flex; gap: 8px; align-items: flex-end; }
.ask-input-row textarea { flex: 1; resize: none; line-height: 1.55; }
.ask-input-row .primary { white-space: nowrap; }
.ask-turn.assistant.pending .ask-turn-content { color: var(--muted); }
.ask-turn.error .ask-turn-content { color: var(--warn); }

.asset-detail { display: grid; gap: 10px; }
.asset-detail label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.asset-detail input, .asset-detail textarea { color: var(--text); font-size: 14px; }
/* 长标题/长行整段换行展示，不用左右拖动 */
.asset-detail textarea { resize: vertical; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.asset-detail blockquote {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
}

/* ---------- global ask dialog ---------- */
#globalAskDialog { width: min(840px, 94vw); }
#globalAskAnswer { white-space: normal; max-height: 52vh; overflow: auto; }
#globalAskAnswer .section-block { margin-bottom: 8px; }
.ask-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ask-controls label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
/* 检索后端：一键切换，无需展开下拉再选 */
.seg { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.seg-btn { padding: 6px 12px; font-size: 12.5px; color: var(--text-soft); }
.seg-btn:hover { background: var(--accent-tint); border-color: var(--accent-soft); }
.seg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg-btn.on:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ask-sources { border-top: 1px dashed var(--line); padding-top: 8px; display: grid; gap: 4px; }
.ask-sources.hidden { display: none; }
.ask-sources-title { font-size: 12px; color: var(--muted); }
.ask-source { font-size: 12px; color: var(--accent); text-decoration: none; word-break: break-all; }
a.ask-source:hover { text-decoration: underline; }
.ask-gap { color: var(--warn); font-size: 13px; margin-top: 8px; }
.ask-empty-hint {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 13px;
}
.add-url-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--sidebar);
  color: var(--text-soft);
  display: grid;
  gap: 8px;
}
.add-url-result.hidden { display: none; }
.open-new-card {
  justify-self: start;
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--accent);
  font-weight: 600;
}
/* 按需检索面板 */
/* dialog 元素默认限宽 680px，比 .dialog-body.wide 的 760px 窄 → form 溢出被裁。
   用 #id（优先级高于元素选择器）让 dialog 与内部 form 等宽，且 form 填满不溢出。 */
#sourceSearchDialog { width: min(820px, 94vw); }
#sourceSearchDialog .dialog-body { width: 100%; box-sizing: border-box; }
#sourceSearchDialog .dialog-actions { flex-wrap: wrap; row-gap: 10px; }
.dialog-actions .grow { flex: 1; }
/* 简报区：检索候选的 last30days 式综合 + 编号出处 */
.ss-brief { margin: 4px 0 10px; padding: 14px 16px; border: 1px solid var(--border, #e2e2e2);
  border-radius: 10px; background: var(--surface-2, #fafafa); max-height: 46vh; overflow-y: auto; }
.ss-brief.hidden { display: none; }
.ss-brief-head { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ss-save-brief { margin-left: auto; font-size: 0.8em; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--accent, #c0623c); background: transparent; color: var(--accent, #c0623c); cursor: pointer; }
.ss-save-brief:hover:not(:disabled) { background: var(--accent, #c0623c); color: #fff; }
.ss-save-brief:disabled { cursor: default; opacity: 0.85; }
.ss-save-brief.done { border-color: #1e7e34; color: #1e7e34; background: #e6f4ea; }
.ss-brief-body { font-size: 0.92em; line-height: 1.55; }
.ss-cite a { color: var(--accent, #c0623c); text-decoration: none; font-weight: 600; padding: 0 1px; }
.ss-cite a:hover { text-decoration: underline; }
.ss-brief-refs { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border, #e2e2e2); }
.ss-brief-refs-title { font-size: 0.82em; color: var(--muted, #888); margin-bottom: 6px; }
.ss-brief-ref { display: block; font-size: 0.84em; padding: 2px 0; color: var(--text, #333);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-brief-ref:hover { color: var(--accent, #c0623c); }
/* 卡片正文里的 markdown 外链（如简报「参考来源」）—— 显式样式，一眼可点 */
.md-link { color: var(--accent, #c0623c); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.md-link:hover { opacity: 0.8; }
/* 事实闸门 + 印证强度 */
.ss-gate { font-size: 0.72em; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.ss-gate.ok { background: #e6f4ea; color: #1e7e34; }
.ss-gate.soft { background: #fef6e7; color: #b9770e; }
.ss-gate.warn { background: #fdecea; color: #c0392b; }
.ss-gate.unknown { background: #eee; color: #777; }
.ss-ref-strength { display: inline-block; font-size: 0.78em; padding: 0 5px; border-radius: 4px; margin-right: 4px; }
.ss-ref-strength.multi { background: #e6f4ea; color: #1e7e34; }
.ss-ref-strength.single { background: #f3f3f3; color: #999; }
.ss-brief-flags { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #fdf3f1; border: 1px solid #f2cfc7; }
.ss-brief-flags-title { font-size: 0.82em; font-weight: 600; color: #c0392b; margin-bottom: 6px; }
.ss-brief-flag { font-size: 0.84em; padding: 3px 0; line-height: 1.45; }
.ss-flag-status { font-size: 0.78em; font-weight: 600; padding: 0 5px; border-radius: 4px; margin-right: 5px; }
.ss-flag-status.bad { background: #c0392b; color: #fff; }
.ss-flag-status.warn { background: #e67e22; color: #fff; }
.ss-controls { display: flex; align-items: center; gap: 8px; }
.ss-controls select { flex: 0 0 auto; width: auto; }
.ss-controls input { flex: 1; min-width: 0; }
.ss-controls .primary { flex: 0 0 auto; white-space: nowrap; }
.ss-translated { font-size: 12px; }
.ss-translated.hidden { display: none; }
.ss-results { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; }
.ss-empty {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--sidebar);
}
.ss-empty code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-tint);
  color: var(--text);
}
.ss-banner {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
}
.ss-cand {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sidebar);
  cursor: pointer;
}
.ss-cand input[type=checkbox] { width: auto; margin-top: 3px; accent-color: var(--accent); }
.ss-cand-body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.ss-cand-title { font-weight: 600; font-size: 13.5px; line-height: 1.4; }
.ss-cand-meta { font-size: 11.5px; }
.ss-cand-sum { font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-sum-rest.ss-sum-hidden { display: none; }
.ss-sum-toggle { background: none; border: none; padding: 0; margin: 0; font: inherit; font-size: 11.5px; color: var(--accent); cursor: pointer; }
.ss-cand-link { font-size: 11.5px; color: var(--accent); justify-self: start; }
.ss-cand-result { margin-top: 4px; font-size: 12px; }
.seen-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
}
.focus-editor { display: grid; gap: 12px; max-height: 62vh; overflow: auto; }
.focus-row { display: grid; gap: 6px; }
.focus-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
}
.focus-row-head strong { font-size: 13px; }
.focus-row-head span { color: var(--muted); font-size: 12px; }
.focus-row textarea { resize: vertical; min-height: 86px; }

/* ---------- floating selection toolbar ---------- */
.selection-toolbar {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--text);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(20, 20, 19, 0.25);
}
.selection-toolbar button {
  border-color: transparent;
  background: transparent;
  color: #f3f1ea;
  padding: 6px 12px;
}
.selection-toolbar button:hover { background: rgba(255, 255, 255, 0.12); }
.selection-toolbar .primary { background: var(--accent); }
.selection-toolbar.hidden { display: none; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  width: min(680px, 92vw);
  box-shadow: var(--shadow);
  color: var(--text);
}
dialog::backdrop { background: rgba(20, 20, 19, 0.35); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px; display: grid; gap: 13px; }
.dialog-body.wide { width: min(760px, 92vw); }
.dialog-body h2 { font-family: var(--serif); font-weight: 600; margin: 0; font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.app-dialog-body { width: min(520px, 92vw); }
.app-dialog-message {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#appDialogInput.hidden { display: none; }
#appDialogCancel.hidden { display: none; }
.dialog-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
code { background: var(--line-soft); border-radius: 5px; padding: 1px 6px; font-size: 12px; }

#evolveResultDialog { width: min(640px, 92vw); }
.evolve-result-body { gap: 12px; }
.evolve-result {
  display: grid;
  gap: 12px;
}
.evolve-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.evolve-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--sidebar);
}
.evolve-stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  color: var(--text);
}
.evolve-stat span { color: var(--muted); font-size: 12px; }
.evolve-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--panel);
  display: grid;
  gap: 8px;
}
.evolve-block-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.evolve-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.evolve-points { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.evolve-points li { font-size: 13px; line-height: 1.5; }

/* 个人兴趣标签（声明/搜索提炼，可增删）*/
.interest-tags { margin-bottom: 8px; }
.interest-tag {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px 4px 3px 10px;
  background: var(--accent-tint);
  color: var(--accent);
}
.interest-tag:hover { background: var(--accent-soft); }
.interest-pick { border: 0; background: transparent; color: var(--accent); padding: 0; font-size: 12px; }
.interest-pick:hover { border-color: transparent; }
.interest-add { margin-bottom: 6px; }
.interest-add input { font-size: 13px; padding: 7px 10px; }
.evolve-tag {
  border: 0;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12.5px;
}
.evolve-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-soft);
}
.evolve-status .status-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: #e5f3ea;
  color: #2f8a5b;
  font-size: 13px;
}
.evolve-status.muted .status-dot {
  background: var(--line-soft);
  color: var(--muted);
}
.evolve-path {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--line-soft);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ── Twitter 面板（热点/关注分类 + 关注名单管理）────────────────────── */
.twitter-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.twitter-panel.hidden { display: none; }

/* 顶部一行：左侧 热点/关注 切换，右侧 添加关注 */
.tw-bar { display: flex; align-items: center; gap: 10px; }
.tw-bar .subfilters { flex: none; margin: 0; }
.github-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 72%, var(--accent-tint));
}
.github-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.github-filter-group.wide {
  flex: 1 1 100%;
  align-items: flex-start;
  max-width: 100%;
  width: 100%;
}
.filter-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  padding-top: 6px;
}
#githubAges { flex-wrap: wrap; }
#githubSorts { max-width: none; }
#githubPrimaryCategories,
#githubSecondaryCategories {
  flex: 1 1 0;
  width: 0;
  max-width: 100%;
}
#githubPrimaryCategories {
  overflow: hidden;
}
#githubSecondaryCategories {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  padding-bottom: 5px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
#githubSecondaryCategories::-webkit-scrollbar { height: 6px; }
#githubSecondaryCategories::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 999px;
}
#githubSecondaryCategories .subchip {
  flex: 0 0 auto;
}
.tw-add { display: flex; gap: 6px; margin-left: auto; }
.tw-add input { width: 210px; padding: 7px 11px; }
.tw-add .primary { padding: 7px 13px; white-space: nowrap; }
.tw-add button { white-space: nowrap; }

/* 待确认新账号：紧凑横排，一眼可见，行内确认/忽略 */
.author-proposals { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.author-proposals:empty { display: none; }
.proposal-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--accent); text-transform: uppercase; }
.proposal-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 10px;
  border: 1px solid var(--accent-soft);
  background: var(--accent-tint);
  border-radius: 999px;
  font-size: 12.5px;
}
.proposal-chip.proposal-core {
  border-color: #2f8a5b;
  background: rgba(47, 138, 91, .1);
}
.proposal-tier {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #2f8a5b;
  border: 1px solid #2f8a5b;
  border-radius: 4px;
  padding: 0 4px;
}
.twitter-core-tier { margin-left: 2px; }
.proposal-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 2px;
}
.proposal-select-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}
.proposal-check { margin: 0; accent-color: var(--accent); }
.proposal-link {
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}
.proposal-link:hover { color: var(--accent); text-decoration: underline; }
.proposal-chip small { color: var(--muted); font-variant-numeric: tabular-nums; }
.proposal-chip button {
  border: 0; padding: 0; width: 20px; height: 20px; border-radius: 50%;
  font-size: 12px; line-height: 1; display: grid; place-items: center; background: var(--panel);
}
.proposal-chip .ok { color: #2f8a5b; }
.proposal-chip .ok:hover { background: #2f8a5b; color: #fff; }
.proposal-chip .no { color: var(--muted); }
.proposal-chip .no:hover { background: var(--hot-soft); color: var(--hot); }

.author-manager {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.author-manager summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 650;
}
.author-manager summary::marker { color: var(--muted); }
#authorCount {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 17px;
}
.author-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
  padding: 0 10px 10px;
}
.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 4px 5px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sidebar);
  font-size: 12.5px;
}
.author-chip-main {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.author-chip small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mini-core {
  border: 1px solid #2f8a5b;
  border-radius: 4px;
  padding: 0 4px;
  background: rgba(47, 138, 91, .08);
  color: #2f8a5b;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.mini-core:hover { background: rgba(47, 138, 91, .16); }
.chip-x {
  border: 0;
  padding: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--muted);
  line-height: 1;
}
.chip-x:hover { background: var(--hot-soft); color: var(--hot); }

/* 关注作者分组：作者名+其推文直接展开，无需二次点击 */
.author-group {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 12px;
  overflow: hidden;
}
.author-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--line);
}
.author-group-head .avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 14px;
}
.author-group-head .author-id { min-width: 0; flex: 1; }
.author-group-head .card-title { font-size: 14px; }
.author-group-head .chip-x {
  border: 0; background: transparent; color: var(--muted);
  padding: 0 6px; font-size: 16px; line-height: 1; border-radius: 6px;
}
.author-group-head .chip-x:hover { background: var(--hot-soft); color: var(--hot); }

/* 播客：时间线内"同一期"的多张卡聚成一个可折叠合集（默认展开），整体占满一行；内部卡片照常网格平铺 */
.episode-collection {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.episode-collection-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.episode-collection-head .ec-title {
  font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.episode-collection .ec-caret { transition: transform .15s; color: var(--muted); }
.episode-collection.collapsed .ec-caret { transform: rotate(-90deg); }
.episode-collection.collapsed .ec-cards { display: none; }
.episode-collection.collapsed { border-bottom: 1px solid var(--line); }
.ec-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px; }
.kind-badge.seq { background: var(--accent-soft); color: var(--accent-hover); font-variant-numeric: tabular-nums; }

.author-tweets { display: grid; }
.tweet-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.tweet-item:last-child { border-bottom: 0; }
.tweet-item:hover { background: var(--accent-tint); }
.tweet-item.selected { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent); }
.tweet-item.is-read { opacity: .62; }
.tweet-item .tweet-text { flex: 1; min-width: 0; line-height: 1.45; }
.tweet-item .tweet-state { flex: none; font-size: 11px; }
.tweet-item .star { border: 0; background: transparent; padding: 0 2px; flex: none; }

/* 卡片网格里已读项弱化，让未读/新内容更突出 */
.card.is-read { opacity: .66; }
.card.is-read:hover { opacity: 1; }

/* 相对时间徽章：今天/昨天醒目，越旧越淡 */
.time-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .01em;
}
.time-badge.t-today { background: #e3f1e8; color: #2f8a5b; }
.time-badge.t-recent { background: var(--accent-tint); color: var(--accent); }
.time-badge.t-week { background: var(--line-soft); color: var(--text-soft); }
.time-badge.t-old { background: transparent; color: var(--muted); border: 1px solid var(--line); }

