:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --pro: #059669;
  --pro-soft: #ecfdf5;
  --pro-border: #a7f3d0;
  --con: #e11d48;
  --con-soft: #fff1f2;
  --con-border: #fecdd3;
  --teal: #0d9488;
  --teal-soft: #f0fdfa;
  --teal-border: #99f6e4;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.brand-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.mode-switcher {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-btn .mode-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.mode-btn.active .mode-tag {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Layout */
.workspace {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.tab-panel {
  display: none;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tab-panel.active { display: grid; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
}

.main-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel-card,
.toolbar-card,
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-card { padding: 16px; }
.flex-grow { overflow-y: auto; max-height: calc(100vh - 400px); }

.card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.card-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head-row .card-title { margin-bottom: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

/* Form Controls */
.input, .select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-sm, .select-sm { padding: 6px 10px; font-size: 13px; width: auto; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-row .select { width: 160px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-soft); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #eef2f6; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }
.w-full { width: 100%; }

/* Platform Checkboxes */
.chip-grid { display: flex; flex-wrap: wrap; gap: 5px; }

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.check-chip input { margin: 0; accent-color: var(--primary); }

/* Keyword List */
.kw-list { display: flex; flex-direction: column; gap: 8px; }

.kw-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.kw-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.kw-item.active { border-color: var(--primary); background: var(--primary-soft); }
.kw-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kw-name { font-weight: 700; font-size: 14px; word-break: break-all; }
.kw-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.kw-actions { display: flex; gap: 4px; margin-top: 8px; }

/* Boss Brief Banner (Monitor & Research) */
.boss-brief-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.boss-brief-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.boss-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.boss-headline {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  color: #ffffff;
}

.boss-sub {
  font-size: 13px;
  color: #cbd5e1;
  margin: 8px 0 0;
}

.boss-findings {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.boss-findings ul {
  margin: 6px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
  color: #e2e8f0;
}

.boss-highlights {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.boss-strip {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}

.boss-strip.pro {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #d1fae5;
}

.boss-strip.con {
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #ffe4e6;
}

.boss-strip.advice {
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(253, 224, 71, 0.35);
  color: #fef9c3;
}

.boss-strip strong { color: #fff; }
.boss-strip a { color: inherit; text-decoration: underline; opacity: 0.9; }

.boss-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.boss-actions .btn-light {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.boss-actions .btn-light:hover { background: rgba(255, 255, 255, 0.2); }

/* KPI Row */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-card { padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-value { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.accent-blue { color: var(--primary); }
.accent-teal { color: var(--teal); }
.accent-amber { color: var(--amber); }

/* Toolbar */
.toolbar-card { padding: 12px 14px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.source-status-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
}

.source-pill { padding: 2px 8px; border-radius: 6px; background: #f3f4f6; color: var(--text-secondary); }
.source-pill.ok { background: #ecfdf5; color: #065f46; }
.source-pill.fail { background: #fff1f2; color: #9f1239; }

/* Feed Cards */
.feed-list { display: flex; flex-direction: column; gap: 10px; }

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.feed-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
}

.comment-tag {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid var(--teal-border);
}

.kw-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.feed-time { font-size: 12px; color: var(--text-muted); }
.feed-title { display: block; font-size: 15px; font-weight: 700; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.feed-title:hover { color: var(--primary); text-decoration: underline; }
.feed-snippet { font-size: 13px; color: var(--text-secondary); margin: 0; }
.star-btn { border: none; background: transparent; font-size: 16px; cursor: pointer; color: #cbd5e1; }
.star-btn.starred { color: #f59e0b; }

/* Mind Map Card */
.mindmap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

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

.mindmap-title { font-size: 15.5px; font-weight: 800; }
.mindmap-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.mindmap-legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

.mindmap-viewport {
  width: 100%;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.mindmap-viewport svg {
  display: block;
  transition: transform 0.15s ease;
  transform-origin: top left;
}

.mm-node-clickable { cursor: pointer; }
.mm-node-clickable:hover rect { stroke-width: 2.2; filter: brightness(0.98); }

/* Vertical Accordion Categories (上下可折叠分类) */
.accordion-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.accordion-toolbar h3 { margin: 0; font-size: 16px; font-weight: 800; }

.accordion-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.acc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.acc-card.open { border-color: #93c5fd; }

.acc-header {
  width: 100%;
  border: none;
  background: var(--surface);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.acc-header:hover { background: #f8fafc; }

.acc-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.acc-icon { font-size: 22px; flex-shrink: 0; }
.acc-title { font-size: 15.5px; font-weight: 800; color: var(--text); }
.acc-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.acc-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.stat-pill.pro { background: var(--pro-soft); color: #065f46; }
.stat-pill.con { background: var(--con-soft); color: #9f1239; }
.stat-pill.cmt { background: var(--teal-soft); color: #115e59; }

.acc-chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.acc-card.open .acc-chevron { transform: rotate(180deg); color: var(--primary); }

.acc-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.acc-card.open .acc-body { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; }

.dim-summary-box {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #1e3a8a;
}

.dim-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dim-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #c7d2fe;
}

/* 上下结构的正方 / 反方 / 评论区区块 */
.vertical-block {
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.vertical-block.pro { background: var(--pro-soft); border-color: var(--pro-border); }
.vertical-block.con { background: var(--con-soft); border-color: var(--con-border); }
.vertical-block.cmt { background: var(--teal-soft); border-color: var(--teal-border); }

.block-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vertical-block.pro .block-title { color: #065f46; }
.vertical-block.con .block-title { color: #9f1239; }
.vertical-block.cmt .block-title { color: #115e59; }

.point-list { display: flex; flex-direction: column; gap: 8px; }
.scroll-list-50 {
  max-height: 620px;
  overflow-y: auto;
  padding-right: 6px;
}

.point-item {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
}

.point-claim {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.point-claim:hover { color: var(--primary); text-decoration: underline; }
.point-detail { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.point-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }

.raw-details {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-soft);
}

.raw-details summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.raw-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.raw-details a { color: var(--primary); text-decoration: none; }
.raw-details a:hover { text-decoration: underline; }

/* Stance Bar */
.stance-bar {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  margin: 10px 0 6px;
}
.stance-bar .bar-pro { background: #10b981; }
.stance-bar .bar-neutral { background: #94a3b8; }
.stance-bar .bar-con { background: #f43f5e; }

.stance-legend-dark {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #cbd5e1;
  flex-wrap: wrap;
}

/* Empty & Helpers */
.empty-stage {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty-stage h3 { margin: 0 0 8px; color: var(--text); }
.empty-stage p { max-width: 580px; margin: 0 auto; font-size: 13.5px; }
.empty-hint { font-size: 12.5px; color: var(--text-muted); text-align: center; padding: 12px 8px; }
.badge { background: #e2e8f0; color: #334155; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.warning-banner { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.muted-xs { font-size: 11.5px; color: var(--text-muted); }

/* Modal & Toast */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal.hidden, .hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.modal-card { position: relative; width: min(480px, 92vw); background: var(--surface); border-radius: 14px; padding: 20px; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.icon-btn { border: none; background: transparent; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-desc { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 14px; }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
}

@media (max-width: 1024px) {
  .tab-panel.active { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .acc-head-right { flex-wrap: wrap; }
}
