* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* 导航项 */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #475569;
  transition: all .15s ease;
}
.nav-item:hover { background: #f1f5f9; color: #0f172a; }
.nav-item.active {
  background: linear-gradient(90deg, #ecfdf5, #d1fae5);
  color: #047857;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(16,185,129,0.12);
}
.nav-item.active svg { color: #059669; }

/* 按钮 */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white; font-weight: 500; font-size: 14px;
  transition: all .15s ease; cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(16,185,129,0.5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -4px rgba(16,185,129,0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  background: white; border: 1px solid #e2e8f0;
  color: #475569; font-weight: 500; font-size: 14px;
  transition: all .15s ease; cursor: pointer;
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  color: #475569; font-weight: 500; font-size: 14px;
  transition: all .15s ease; cursor: pointer;
}
.btn-ghost:hover { background: #f1f5f9; }

.btn-link {
  color: #059669; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: color .15s ease;
}
.btn-link:hover { color: #047857; }

/* Input */
.input-base {
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid #e2e8f0; background: white;
  transition: all .15s ease; outline: none;
}
.input-base:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

.date-picker-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid #e2e8f0; background: #fff;
  font-size: 13px; color: #334155; cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
  min-width: 150px; text-align: left;
}
.date-picker-btn::before {
  content: '';
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat center;
}
.date-picker-btn:hover { border-color: #10b981; }

.dp-overlay {
  position: fixed; inset: 0; z-index: 999;
}
.dp-popup {
  position: absolute; z-index: 1000;
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.15), 0 0 0 1px rgba(15,23,42,0.05);
  padding: 16px; width: 296px;
  animation: dpIn .15s ease;
}
@keyframes dpIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dp-header-title { font-size: 14px; font-weight: 600; color: #0f172a; }
.dp-nav {
  display: flex; align-items: center; gap: 0;
}
.dp-nav button {
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; color: #475569;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.dp-nav button:hover { background: #f1f5f9; }
.dp-weekdays {
  display: grid; grid-template-columns: repeat(7,1fr);
  text-align: center; font-size: 11px; color: #94a3b8;
  font-weight: 500; margin-bottom: 4px;
}
.dp-days {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 2px;
}
.dp-day {
  width: 36px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 13px;
  color: #334155; display: flex; align-items: center; justify-content: center;
  transition: background .1s; margin: 0 auto;
}
.dp-day:hover { background: #f1f5f9; }
.dp-day.is-today { font-weight: 700; color: #059669; }
.dp-day.is-selected { background: #059669; color: #fff; font-weight: 600; }
.dp-day.is-selected:hover { background: #047857; }
.dp-day.other-month { color: #cbd5e1; }
.dp-day.has-data::after {
  content: ''; position: absolute; bottom: 2px;
  width: 4px; height: 4px; border-radius: 50%; background: #10b981;
}
.dp-day { position: relative; }

.checkbox {
  width: 16px; height: 16px; border-radius: 4px;
  accent-color: #10b981;
}

/* 卡片 */
.stat-card {
  background: white; padding: 20px 22px;
  border-radius: 16px;
  box-shadow: 0 4px 14px 0 rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -8px rgba(16,185,129,0.18); }
.stat-label { font-size: 12px; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.stat-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.step-card {
  background: linear-gradient(180deg, #f8fafc, white);
  border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 20px 22px; transition: all .18s ease;
}
.step-card:hover { border-color: #a7f3d0; box-shadow: 0 8px 24px -12px rgba(16,185,129,0.25); }
.step-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: #d1fae5; color: #047857;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* Log 区 */
.log-line {
  padding: 2px 0; line-height: 1.7;
}
.log-line.info { color: #94a3b8; }
.log-line.success { color: #34d399; }
.log-line.warn { color: #fbbf24; }
.log-line.error { color: #f87171; }
.log-line .ts { color: #64748b; margin-right: 8px; }

/* Toast */
.toast {
  padding: 10px 16px; border-radius: 10px;
  background: white; box-shadow: 0 10px 30px -6px rgba(0,0,0,0.18);
  border: 1px solid #e2e8f0;
  font-size: 14px; display: flex; align-items: center; gap: 10px;
  animation: toast-in .2s ease;
  min-width: 240px; max-width: 360px;
}
.toast.success { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.toast.error { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.toast.info { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal */
#modal.show { display: flex; animation: fade-in .15s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
#modal-content { animation: pop-in .18s ease; }
@keyframes pop-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* 文章卡片 */
.article-card {
  position: relative;
  background: white; border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid #eef2f7;
  transition: all .18s ease;
}
/* 标题两行截断（不依赖 Tailwind JIT） */
.article-title-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.4;
  max-height: 2.8em;
}
.article-card:hover {
  border-color: #a7f3d0;
  box-shadow: 0 6px 18px -8px rgba(16,185,129,0.2);
}
.article-card.is-new {
  border-color: #a7f3d0;
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 30%);
}
.article-content {
  white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.7; color: #475569;
  background: #f8fafc; border-radius: 8px; padding: 10px 12px;
  max-height: 360px; overflow-y: auto;
}

/* 状态徽章 */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px; font-weight: 500;
  line-height: 1.4;
}
.badge-new   { background: #d1fae5; color: #047857; }
.badge-old   { background: #f1f5f9; color: #64748b; }
.badge-fail  { background: #fee2e2; color: #b91c1c; }
.badge-count { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-info  { background: #f1f5f9; color: #475569; }
.badge-tag   { background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; }
.badge-cat   { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }   /* 标签词表 categories */
.badge-sec   { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }   /* 简报栏目 section */

/* 主题检索关键词高亮 */
mark { background: #fde68a; color: #78350f; border-radius: 3px; padding: 0 1px; }

/* 划词解释 */
.explain-btn {
  position: absolute; z-index: 60;
  background: #1e293b; color: #fff;
  font-size: 12px; line-height: 1; padding: 6px 10px;
  border-radius: 8px; cursor: pointer; user-select: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  white-space: nowrap;
}
.explain-btn:hover { background: #0f172a; }
.explain-pop {
  position: absolute; z-index: 61;
  width: min(420px, calc(100vw - 48px));
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15,23,42,.16);
  padding: 14px 16px; font-size: 13px; color: #334155; line-height: 1.7;
}
.explain-pop .explain-term { font-weight: 600; color: #0f172a; margin-bottom: 6px; }
.explain-pop .explain-body { white-space: pre-wrap; max-height: 320px; overflow-y: auto; }
.explain-pop .explain-srcs { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }
.explain-pop .explain-srcs a {
  display: block; font-size: 12px; color: #2563eb; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px;
}
.explain-pop .explain-srcs a:hover { text-decoration: underline; }
.explain-pop .explain-meta { margin-top: 8px; font-size: 11px; color: #94a3b8; }

/* 笔记 */
.note-box textarea {
  width: 100%; min-height: 72px; resize: vertical;
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px;
  padding: 8px 10px; font-size: 13px; color: #422006; line-height: 1.6;
}
.note-box textarea:focus { outline: 2px solid #f59e0b33; }
.note-hint { font-size: 11px; color: #94a3b8; }
.note-toggle-on { color: #b45309 !important; font-weight: 600; }

/* 设置页分组 tab */
.stab-btn {
  padding: 7px 16px; font-size: 14px; font-weight: 500; color: #64748b;
  border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  background: transparent; transition: all .12s;
}
.stab-btn:hover { color: #0f172a; background: #f1f5f9; }
.stab-active, .stab-active:hover { color: #fff; background: #10b981; }

/* 文章概要卡片 */
.sum-card {
  background: white; border-radius: 14px;
  border: 1px solid #eef2f7;
  padding: 16px 18px;
  transition: all .18s ease;
}
.sum-card:hover {
  border-color: #a7f3d0;
  box-shadow: 0 8px 24px -10px rgba(16,185,129,0.22);
  transform: translateY(-1px);
}
.sum-card-hot {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 35%);
}
.sum-card-hot:hover { border-color: #fcd34d; }

/* 抓取偏好 chip */
.pref-chip {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.4;
}
.pref-chip.chip-on   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.pref-chip.chip-off  { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; }
.pref-chip.chip-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.pref-chip.chip-info { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }

/* 价值评分 */
.score-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  line-height: 1.4;
}
.score-3 { background: #fef3c7; color: #b45309; }
.score-2 { background: #dbeafe; color: #1d4ed8; }
.score-1 { background: #f1f5f9; color: #64748b; }

/* 摘要块 */
.summary-block {
  margin-top: 10px;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

/* 观点图（poster）嵌入摘要块 */
.summary-block > .article-poster {
  position: relative;
  margin: -2px 0 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  cursor: zoom-in;
  transition: transform .15s ease, box-shadow .15s ease;
  max-height: 340px;
}
.summary-block > .article-poster:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.25);
}
.summary-block > .article-poster img {
  display: block;
  max-width: 100%;
  max-height: 324px;
  width: auto;
  height: auto;
  margin: 0;
  object-fit: contain;
}
.summary-block > .article-poster.article-poster-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border: 1px dashed #a7f3d0;
}
.summary-block > .article-poster.article-poster-failed {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  background: linear-gradient(135deg, #fff1f2, #fef2f2);
  border: 1px dashed #fecaca;
}
.article-poster-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.article-poster:hover .article-poster-hint { opacity: 1; }

.article-poster-pending,
.article-poster-failed {
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border: 1px dashed #a7f3d0;
}
.article-poster-failed {
  background: linear-gradient(135deg, #fff1f2, #fef2f2);
  border-color: #fecaca;
}
.poster-pending-inner,
.poster-failed-inner {
  text-align: center;
  color: #475569;
  padding: 18px;
  line-height: 1.6;
}
.poster-pending-dot {
  width: 28px; height: 28px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid #a7f3d0;
  border-top-color: #10b981;
  animation: poster-spin 0.9s linear infinite;
}
@keyframes poster-spin { to { transform: rotate(360deg); } }
.poster-retry-btn {
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.poster-retry-btn:hover { background: #fef2f2; border-color: #ef4444; }

/* 架构图 draw.io 渲染区 */
.summary-block > .article-diagram {
  position: relative;
  margin: -2px 0 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  height: 240px;
  cursor: pointer;
}
.summary-block > .article-diagram iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
  pointer-events: none;
}
.article-diagram-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(transparent, rgba(255,255,255,0.92));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 11px;
  color: #64748b;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .2s ease;
}
.summary-block > .article-diagram:hover .article-diagram-hint {
  opacity: 1;
}
.article-diagram-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
  z-index: 3;
}
.article-diagram-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  border: 0;
  cursor: pointer;
  transition: background .15s ease;
}
.article-diagram-toolbar button:hover {
  background: rgba(15, 23, 42, 0.85);
}
.article-diagram-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 18px;
  border-radius: 8px;
  margin: -2px 0 12px 0;
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px dashed #bfdbfe;
  color: #1d4ed8;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.article-diagram-empty:hover {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-color: #93c5fd;
}
.article-diagram-empty.is-loading {
  cursor: progress;
  color: #64748b;
  background: linear-gradient(135deg, #f1f5f9, #f8fafc);
  border-color: #e2e8f0;
}

/* 阅读页 · 展示模式切换按钮 */
.sum-mode-btn, .opt-mode-btn {
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
}
.sum-mode-btn.active, .opt-mode-btn.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.poster-viewer {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  max-height: 90vh;
}
.poster-viewer img {
  max-height: 85vh;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px -20px rgba(15, 23, 42, 0.4);
  display: block;
}

/* 卡片右上角的观点图角标 */
.poster-corner {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  transition: all .15s ease;
  z-index: 2;
  user-select: none;
}
.poster-corner svg { flex-shrink: 0; }
.poster-corner.is-done {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.poster-corner.is-done:hover {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
  transform: translateY(-1px);
}
.poster-corner.is-loading {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  cursor: default;
}
.poster-corner.is-fail {
  background: #fff1f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.poster-corner.is-fail:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.poster-corner.is-empty {
  background: #fff;
  color: #64748b;
  border: 1px dashed #cbd5e1;
}
.poster-corner.is-empty:hover {
  background: #ecfdf5;
  color: #059669;
  border-color: #10b981;
  border-style: solid;
}
.poster-corner.is-empty:disabled,
.poster-corner.is-empty.is-loading,
.poster-corner.is-done:disabled,
.poster-corner.is-done.is-loading {
  opacity: 0.6;
  cursor: progress;
  pointer-events: none;
}
.poster-corner-spin {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #a7f3d0;
  border-top-color: #10b981;
  animation: poster-spin 0.9s linear infinite;
}
.summary-block .summary-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-top: 12px;
  margin-bottom: 6px;
  line-height: 1.4;
}
.summary-block .summary-section-title:first-child {
  margin-top: 0;
}
.summary-block .summary-idea {
  font-size: 13px;
  color: #334155;
  line-height: 1.75;
}
.summary-block .summary-points {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: point;
  font-size: 13px;
  line-height: 1.75;
  color: #334155;
}
.summary-block .summary-points li {
  counter-increment: point;
  position: relative;
  padding-left: 28px;
  margin-top: 6px;
}
.summary-block .summary-points li:first-child {
  margin-top: 0;
}
.summary-block .summary-points li::before {
  content: counter(point);
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.25);
}
.summary-block .summary-meta {
  margin-top: 8px;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}
.summary-block .summary-reader {
  margin-top: 6px;
  font-size: 11px; color: #64748b;
}
.summary-error {
  margin-top: 10px;
  font-size: 12px; color: #b91c1c;
  background: #fef2f2; border-radius: 8px;
  padding: 6px 10px;
}

/* Markdown 简报排版 */
.markdown-body {
  color: #1e293b;
  font-size: 15px;
  line-height: 1.85;
}
.markdown-body h1 {
  font-size: 24px; font-weight: 700; color: #0f172a;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}
.markdown-body h2 {
  font-size: 20px; font-weight: 700; color: #0f172a;
  margin: 28px 0 12px;
  padding-left: 12px; border-left: 4px solid #10b981;
}
.markdown-body h3 {
  font-size: 16px; font-weight: 600; color: #047857;
  margin: 20px 0 8px;
}
.markdown-body p { margin: 8px 0; }
.markdown-body ul, .markdown-body ol {
  padding-left: 22px; margin: 6px 0;
}
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin: 3px 0; }
.markdown-body strong { color: #0f172a; font-weight: 700; }
.markdown-body code {
  background: #f1f5f9; color: #047857;
  padding: 1px 6px; border-radius: 4px;
  font-size: 13px; font-family: ui-monospace, "SF Mono", monospace;
}
.markdown-body blockquote {
  border-left: 4px solid #10b981;
  background: #f0fdf4; color: #475569;
  padding: 8px 14px; margin: 12px 0;
  border-radius: 0 8px 8px 0;
}
.markdown-body hr {
  border: 0; border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}
.markdown-body a {
  color: #059669; text-decoration: none;
}
.markdown-body a:hover { text-decoration: underline; }

.article-ref {
  display: inline-flex; align-items: center;
  background: #ecfdf5; color: #047857;
  border: 1px solid #a7f3d0;
  padding: 0 6px; margin: 0 2px;
  border-radius: 5px;
  font-size: 12px; font-weight: 600;
  font-family: ui-monospace, "SF Mono", monospace;
  text-decoration: none !important;
  transition: all .15s ease;
}
.article-ref:hover {
  background: #a7f3d0;
  transform: translateY(-1px);
}

.idx-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px;
  font-size: 13px;
  transition: background .15s ease;
}
.idx-row:hover { background: #f8fafc; }
.idx-row .idx-num {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px; font-weight: 600;
  background: #ecfdf5; color: #047857;
  padding: 1px 7px; border-radius: 5px;
  min-width: 36px; text-align: center;
}
.idx-row .idx-flash {
  animation: flash 1.4s ease;
}
@keyframes flash {
  0%   { background: #fef3c7; }
  100% { background: transparent; }
}

/* 辅助 */
.line-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* 浮动动画 */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.pulse-dot { animation: pulse-dot 1.2s ease-in-out infinite; }
.pulse-dot-bg {
  position: relative;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

/* 媒体（播客 / PPT） */
.media-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all .18s ease;
}
.media-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 8px 24px -14px rgba(59,130,246,0.28);
}
.media-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.media-card-body {
  font-size: 13px; color: #475569;
  min-height: 40px;
}
.media-sub-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  line-height: 1.4;
  background: #f1f5f9; color: #64748b;
  white-space: nowrap;
}

/* 媒体进度条（running 状态） */
.media-progress {
  width: 100%; height: 4px;
  background: #e2e8f0; border-radius: 999px;
  overflow: hidden; position: relative;
}
.media-progress-bar {
  position: absolute; top: 0; bottom: 0; left: -40%;
  width: 40%;
  background: linear-gradient(90deg, #60a5fa, #10b981);
  border-radius: 999px;
  animation: media-progress-slide 1.6s ease-in-out infinite;
}
@keyframes media-progress-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

.media-card audio {
  outline: none;
  border-radius: 8px;
}
.media-card iframe {
  border: 0;
  background: #f8fafc;
}

/* 子任务失败时的重试按钮 */
.media-sub-retry-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 8px;
  background: #fff1f2; color: #e11d48;
  border: 1px solid #fecdd3;
  cursor: pointer; transition: all .15s ease;
}
.media-sub-retry-btn:hover { background: #ffe4e6; border-color: #fda4af; }
.media-sub-retry-btn:disabled { opacity: .5; cursor: not-allowed; }

.media-sub-retry-link {
  font-size: 12px; color: #64748b;
  padding: 4px 6px; cursor: pointer;
  background: transparent; border: 0;
  transition: color .15s ease;
}
.media-sub-retry-link:hover { color: #334155; text-decoration: underline; }
.media-sub-retry-link:disabled { opacity: .5; cursor: not-allowed; text-decoration: none; }

.st-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}
.st-badge-icon {
  font-size: 9px;
  font-weight: 700;
}
.st-badge-ok {
  background: #f0fdf4;
  color: #15803d;
}
.st-badge-fail {
  background: #fef2f2;
  color: #b91c1c;
}
.st-badge-run {
  background: #eff6ff;
  color: #1d4ed8;
}
.st-badge-skip {
  background: #f1f5f9;
  color: #94a3b8;
}

/* 可点击徽标 */
.st-badge-btn {
  border: 0;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.st-badge-btn:hover {
  filter: brightness(.96);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.15);
}
.st-badge-btn:active {
  transform: translateY(0);
  filter: brightness(.92);
}
.st-badge-btn:disabled {
  cursor: wait;
  opacity: .8;
}
.st-badge-btn.is-spinning svg {
  animation: st-badge-spin 0.9s linear infinite;
}
.st-badge-run svg {
  animation: st-badge-spin 1.4s linear infinite;
}
@keyframes st-badge-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 提示词多模板 chip */
.tpl-chip {
  padding: .25rem .6rem;
  border-radius: 9999px;
  font-size: .8rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.tpl-chip:hover { background: #e2e8f0; }
.tpl-chip-active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0284c7;
}

/* ===== 只读模式（未登录访客） ===== */
#readonly-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.92);
  color: #f1f5f9;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(6px);
}
#readonly-banner .ro-login {
  flex-shrink: 0;
  padding: 4px 14px;
  border-radius: 9999px;
  background: #0ea5e9;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
#readonly-banner .ro-login:hover {
  background: #0284c7;
}

/* 只读模式：写操作控件（按钮 / 输入框 / 下拉框）灰显并禁止点击。
   仅作用于主内容区 #view；查看 / 搜索 / 筛选 / 导航类控件用 .ro-keep 放行。
   后端已对写接口做权限校验，这里是前端的视觉与交互兜底。 */
body.read-only #view .btn-primary:not(.ro-keep),
body.read-only #view .btn-secondary:not(.ro-keep),
body.read-only #view .btn-ghost:not(.ro-keep),
body.read-only #view .btn-danger:not(.ro-keep),
body.read-only #view .ro-lock:not(.ro-keep),
body.read-only #view .opt-mode-btn:not(.ro-keep),
body.read-only #view input:not(.ro-keep),
body.read-only #view textarea:not(.ro-keep),
body.read-only #view select:not(.ro-keep) {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(0.4);
  background-color: #f1f5f9;
  box-shadow: none !important;
  transform: none !important;
}

/* 只读模式：设置页隐藏「连接 & 凭证」分组（凭证、AI 摘要等敏感配置） */
body.read-only #settings-tabs [data-stab="conn"],
body.read-only #view [data-stab="conn"] {
  display: none !important;
}
