/* ============================================================
   ResearchOS — Styles
   Dark intelligence/research aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── RESET & BASE ──────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary:    #0a0e17;
  --bg-secondary:  #0f1420;
  --bg-tertiary:   #151b2b;
  --bg-card:       #1a2035;
  --bg-hover:      #1f2847;
  --bg-active:     #253050;

  --border:        #1e293b;
  --border-light:  #334155;

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --accent-blue:   #3b82f6;
  --accent-cyan:   #06b6d4;
  --accent-green:  #10b981;
  --accent-yellow: #f59e0b;
  --accent-red:    #ef4444;
  --accent-purple: #8b5cf6;
  --accent-indigo: #6366f1;

  --sidebar-width: 280px;
  --header-height: 56px;

  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);

  --transition: 200ms ease;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); font-size: 0.85em; }

/* ── SCROLLBAR ──────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LAYOUT ─────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.sidebar-logo span {
  color: var(--accent-cyan);
}

.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

.sidebar-nav {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9em;
  white-space: nowrap;
  transition: all var(--transition);
}

.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active { background: var(--bg-active); color: var(--accent-cyan); }
.nav-btn .nav-icon { font-size: 1.1em; width: 22px; text-align: center; }

.sidebar-categories {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.category-group {
  margin-bottom: 2px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  user-select: none;
}

.category-header:hover { background: var(--bg-hover); }
.category-icon { font-size: 1.1em; width: 22px; text-align: center; }
.category-name { flex: 1; font-size: 0.85em; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.category-count { font-size: 0.75em; color: var(--text-muted); background: var(--bg-tertiary); padding: 2px 6px; border-radius: 10px; }
.category-chevron { font-size: 0.6em; color: var(--text-muted); transition: transform var(--transition); }
.category-group.collapsed .category-chevron { transform: rotate(-90deg); }
.category-group.collapsed .category-topics { display: none; }

.category-topics {
  padding-left: 8px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 0.88em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.topic-item.active { background: var(--bg-active); color: var(--accent-cyan); }

.topic-status {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.topic-status.status-active { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.topic-status.status-historical { background: var(--accent-yellow); }
.topic-status.status-emerging { background: var(--accent-cyan); }

/* ── MAIN AREA ──────────────────────────────────────────────── */

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── TOP BAR ────────────────────────────────────────────────── */

.topbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#sidebarToggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

#sidebarToggle:hover { color: var(--text-primary); background: var(--bg-hover); }

.search-container {
  flex: 1;
  max-width: 600px;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9em;
  outline: none;
  transition: border-color var(--transition);
}

#searchInput:focus { border-color: var(--accent-cyan); }
#searchInput::placeholder { color: var(--text-muted); }

.search-kbd {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
}

.search-results.visible { display: block; }

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg-hover); }
.search-result-item:last-child { border-bottom: none; }
.search-result-cat { font-size: 0.75em; color: var(--text-muted); }
.search-result-title { font-weight: 500; }

.search-empty { padding: 20px; text-align: center; color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--text-muted);
}

/* ── MAIN CONTENT ───────────────────────────────────────────── */

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── HOME VIEW ──────────────────────────────────────────────── */

.home-view {
  max-width: 1200px;
  margin: 0 auto;
}

.home-header {
  text-align: center;
  padding: 40px 0 30px;
}

.home-title {
  font-size: 2.6em;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 1.1em;
  font-style: italic;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-size: 2em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.8em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.home-section { margin-bottom: 36px; }

.section-heading {
  font-size: 1.2em;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.recent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.recent-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recent-cat { font-size: 0.75em; color: var(--text-muted); margin-bottom: 6px; }
.recent-title { font-weight: 600; font-size: 0.95em; }
.recent-status { font-size: 0.7em; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.recent-status.status-active { color: var(--accent-green); }
.recent-status.status-historical { color: var(--accent-yellow); }

.home-cat-block { margin-bottom: 28px; }
.home-cat-title { font-size: 1.05em; margin-bottom: 12px; color: var(--text-secondary); }

.home-cat-topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.home-topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.home-topic-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.home-topic-title { font-weight: 600; font-size: 1.05em; margin-bottom: 8px; }

.home-topic-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.home-topic-summary {
  font-size: 0.85em;
  color: var(--text-secondary);
  line-height: 1.5;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.status-badge.status-active { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.status-badge.status-historical { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }
.status-badge.status-emerging { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }

.home-footer {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 30px 0;
}

.kbd-hint {
  color: var(--text-muted);
  font-size: 0.85em;
}

kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── TOPIC VIEW ─────────────────────────────────────────────── */

.topic-view {
  max-width: 1100px;
  margin: 0 auto;
}

.topic-header { margin-bottom: 20px; }

.topic-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.breadcrumb-home { cursor: pointer; color: var(--accent-cyan); }
.breadcrumb-home:hover { text-decoration: underline; }
.breadcrumb-sep { font-size: 0.7em; color: var(--text-muted); }

.topic-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.topic-title {
  font-size: 1.8em;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex: 1;
}

.topic-actions { display: flex; gap: 8px; }

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 1.2em;
  transition: all var(--transition);
}

.action-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.action-btn.bookmarked { color: var(--accent-yellow); border-color: var(--accent-yellow); }

.topic-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85em;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items: center;
}

.meta-item::before {
  content: '|';
  margin-right: 16px;
  color: var(--border-light);
}

/* ── TABS ───────────────────────────────────────────────────── */

.topic-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 12px 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9em;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-cyan); border-bottom-color: var(--accent-cyan); }

/* ── TAB CONTENT ────────────────────────────────────────────── */

.tab-content { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.overview-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  line-height: 1.7;
}

.overview-summary h3 {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.overview-summary p { color: var(--text-secondary); }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.overview-card h4 {
  font-size: 0.95em;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.question-list {
  list-style: none;
  padding: 0;
}

.question-list li {
  padding: 6px 0;
  font-size: 0.9em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.question-list li:last-child { border-bottom: none; }

.question-list li::before {
  content: '?';
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: rgba(99,102,241,0.2);
  color: var(--accent-indigo);
  font-weight: 700;
  font-size: 0.75em;
  margin-right: 8px;
  flex-shrink: 0;
}

.connection-list { display: flex; flex-direction: column; gap: 6px; }

.connection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9em;
}

.connection-item:hover { background: var(--bg-hover); }
.connection-label { color: var(--text-muted); font-size: 0.85em; }
.connection-target { color: var(--accent-cyan); font-weight: 500; }

.evidence-bar {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 36px;
  margin-top: 8px;
}

.evidence-for {
  background: rgba(16,185,129,0.25);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: 600;
  min-width: 80px;
}

.evidence-against {
  background: rgba(239,68,68,0.25);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: 600;
  min-width: 80px;
}

/* ── TIMELINE ───────────────────────────────────────────────── */

.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 10px 30px;
}

.timeline-item.left { margin-right: 50%; text-align: right; }
.timeline-item.right { margin-left: 50%; }

.timeline-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  top: 18px;
  box-shadow: 0 0 8px var(--accent-cyan);
}

.timeline-item.left .timeline-dot { right: -6px; }
.timeline-item.right .timeline-dot { left: -6px; }

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all var(--transition);
}

.timeline-card:hover { border-color: var(--accent-cyan); box-shadow: var(--shadow-sm); }

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.timeline-event {
  font-size: 0.9em;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ── PEOPLE ─────────────────────────────────────────────────── */

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.person-card {
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
}

.person-card:hover { border-color: var(--accent-indigo); }

.person-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9em;
  flex-shrink: 0;
  color: white;
}

.person-name { font-weight: 600; font-size: 1em; margin-bottom: 2px; }
.person-role { font-size: 0.82em; color: var(--text-muted); margin-bottom: 8px; }

.person-stance {
  font-size: 0.85em;
  color: var(--text-secondary);
  line-height: 1.5;
  border-left: 2px solid var(--accent-indigo);
  padding-left: 10px;
}

.stance-label { font-weight: 600; color: var(--text-muted); }

/* ── ORGANIZATIONS ──────────────────────────────────────────── */

.orgs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.org-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
}

.org-card:hover { border-color: var(--accent-purple); }

.org-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  background: rgba(139,92,246,0.15);
  color: var(--accent-purple);
  margin-bottom: 10px;
}

.org-name { font-weight: 600; font-size: 1.05em; margin-bottom: 6px; }
.org-role { font-size: 0.88em; color: var(--text-secondary); line-height: 1.5; }

/* ── EVIDENCE ───────────────────────────────────────────────── */

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

.evidence-card {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
}

.evidence-card:hover { border-color: var(--border-light); }

.evidence-type-bar {
  width: 4px;
  flex-shrink: 0;
}

.evidence-card.supporting .evidence-type-bar { background: var(--accent-green); }
.evidence-card.opposing .evidence-type-bar { background: var(--accent-red); }

.evidence-content {
  padding: 18px;
  flex: 1;
}

.evidence-content h4 { margin-bottom: 8px; font-size: 1em; }
.evidence-content p { font-size: 0.9em; color: var(--text-secondary); line-height: 1.6; margin-bottom: 10px; }

.evidence-source {
  font-size: 0.82em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.source-label { font-weight: 600; }

.evidence-link {
  color: var(--accent-cyan);
  font-weight: 500;
}

/* ── SOURCES ────────────────────────────────────────────────── */

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: all var(--transition);
}

.source-card.clickable { cursor: pointer; }
.source-card.clickable:hover { border-color: var(--accent-cyan); }

.source-type-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  white-space: nowrap;
}

.source-info { flex: 1; }
.source-title { font-weight: 600; font-size: 0.95em; margin-bottom: 4px; }

.source-meta {
  display: flex;
  gap: 12px;
  font-size: 0.82em;
  color: var(--text-muted);
}

.source-action {
  font-size: 0.85em;
  color: var(--accent-cyan);
  font-weight: 500;
  white-space: nowrap;
}

/* ── RELATED TOPICS ─────────────────────────────────────────── */

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.related-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-cat { font-size: 0.75em; color: var(--text-muted); margin-bottom: 6px; }
.related-title { font-weight: 600; font-size: 1.05em; margin-bottom: 6px; }
.related-connection { font-size: 0.78em; color: var(--accent-indigo); margin-bottom: 8px; font-style: italic; }
.related-summary { font-size: 0.85em; color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.related-meta { display: flex; gap: 12px; font-size: 0.78em; color: var(--text-muted); }

/* ── NOTES ──────────────────────────────────────────────────── */

.notes-section h3 { margin-bottom: 4px; }
.notes-section .muted { margin-bottom: 16px; }

.notes-textarea {
  width: 100%;
  min-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95em;
  padding: 16px;
  resize: vertical;
  outline: none;
  line-height: 1.7;
}

.notes-textarea:focus { border-color: var(--accent-cyan); }

.notes-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.notes-saved-indicator {
  color: var(--accent-green);
  font-size: 0.85em;
}

/* ── BUTTONS ────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary:hover { background: #22d3ee; text-decoration: none; }

/* ── SOURCE VIEWER MODAL ────────────────────────────────────── */

.source-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.source-viewer {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
}

.sv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.sv-header h2 { font-size: 1.1em; }

.sv-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.sv-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.sv-body { padding: 24px; }

.sv-field {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.sv-field:last-of-type { border-bottom: none; }

.sv-label {
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 60px;
}

.sv-value { color: var(--text-secondary); font-size: 0.95em; }
.sv-link { word-break: break-all; }

.sv-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* ── KNOWLEDGE GRAPH VIEW ───────────────────────────────────── */

.graph-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 48px);
}

.graph-header {
  margin-bottom: 12px;
}

.graph-header h2 { font-size: 1.3em; margin-bottom: 4px; }

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.82em;
  color: var(--text-muted);
}

.legend-item { display: flex; align-items: center; gap: 6px; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.graph-canvas {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  cursor: grab;
}

.graph-canvas:active { cursor: grabbing; }

/* ── ARCHIVE VIEW ───────────────────────────────────────────── */

.archive-view {
  max-width: 1000px;
  margin: 0 auto;
}

.archive-view h2 { font-size: 1.3em; margin-bottom: 4px; }

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82em;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--accent-cyan); color: var(--text-primary); }
.filter-btn.active { background: var(--accent-cyan); color: var(--bg-primary); border-color: var(--accent-cyan); }

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archive-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.archive-item:hover { border-color: var(--border-light); }

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--text-muted);
  min-width: 100px;
  white-space: nowrap;
}

.archive-info { flex: 1; }
.archive-title { font-weight: 500; font-size: 0.92em; margin-bottom: 4px; }

.archive-meta {
  display: flex;
  gap: 10px;
  font-size: 0.78em;
  color: var(--text-muted);
  align-items: center;
}

.archive-type-badge {
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  font-size: 0.9em;
}

.archive-topic {
  color: var(--accent-cyan);
  cursor: pointer;
}

.archive-topic:hover { text-decoration: underline; }

.archive-link {
  color: var(--accent-cyan);
  font-size: 0.85em;
  white-space: nowrap;
}

/* ── BOOKMARKS VIEW ─────────────────────────────────────────── */

.bookmarks-view {
  max-width: 1000px;
  margin: 0 auto;
}

.bookmarks-view h2 { font-size: 1.3em; margin-bottom: 20px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 3em; margin-bottom: 12px; }

.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.bookmark-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.bookmark-card:hover { border-color: var(--accent-yellow); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bookmark-cat { font-size: 0.75em; color: var(--text-muted); margin-bottom: 6px; }
.bookmark-title { font-weight: 600; margin-bottom: 6px; }
.bookmark-summary { font-size: 0.85em; color: var(--text-secondary); line-height: 1.5; }

.bookmark-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2em;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.bookmark-remove:hover { color: var(--accent-red); background: rgba(239,68,68,0.1); }

/* ── NEW TOPIC BUTTON ───────────────────────────────────────── */

.new-topic-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.new-topic-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(6,182,212,0.3); }

/* ── TOPIC EDITOR MODAL ─────────────────────────────────────── */

.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
  padding: 40px 20px;
}

.editor-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 40px;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.editor-header h2 { font-size: 1.2em; }

.editor-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.editor-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.editor-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

/* AI Research Bar */
.ai-research-bar {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(6,182,212,0.1));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-md);
  padding: 20px;
}

.ai-research-bar h3 {
  font-size: 1em;
  margin-bottom: 4px;
  color: var(--accent-indigo);
}

.ai-research-bar .muted { margin-bottom: 14px; }

.ai-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-subject-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95em;
  outline: none;
}

.ai-subject-input:focus { border-color: var(--accent-indigo); }

.ai-research-btn {
  padding: 10px 20px;
  background: var(--accent-indigo);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.ai-research-btn:hover { background: #818cf8; }
.ai-research-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Controls row (depth + settings) */
.ai-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* Depth selector */
.ai-depth-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-depth-selector label {
  font-size: 0.8em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.depth-buttons {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.depth-btn {
  padding: 6px 14px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.depth-btn:last-child { border-right: none; }
.depth-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.depth-btn.active { background: var(--accent-indigo); color: #fff; }

.depth-btn.depth-rabbit {
  position: relative;
}

.depth-btn.depth-rabbit.active {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  animation: rabbitPulse 2s ease-in-out infinite;
}

@keyframes rabbitPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(139,92,246,0); }
  50% { box-shadow: 0 0 12px rgba(139,92,246,0.4); }
}

.ai-settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ai-settings-row label {
  font-size: 0.78em;
  color: var(--text-muted);
}

.ai-settings-row input, .ai-settings-row select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78em;
  outline: none;
}

.ai-settings-row input:focus, .ai-settings-row select:focus { border-color: var(--accent-indigo); }

/* ── PIPELINE STEPS ─────────────────────────────────────────── */

.ai-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 14px;
  padding: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.82em;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.pipeline-step .step-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  flex-shrink: 0;
}

.pipeline-step.active {
  color: var(--accent-cyan);
  background: rgba(6,182,212,0.08);
}

.pipeline-step.done {
  color: var(--accent-green);
}

.pipeline-step.done .step-icon {
  color: var(--accent-green);
  font-weight: 700;
}

.pipeline-step.error {
  color: var(--accent-red);
}

.pipeline-step.error .step-icon {
  color: var(--accent-red);
  font-weight: 700;
}

/* Spinner for active steps */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(6,182,212,0.3);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── SOURCE REPORT ──────────────────────────────────────────── */

.ai-source-report {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.4s ease;
}

.source-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.report-title {
  font-weight: 700;
  font-size: 0.95em;
  color: var(--text-primary);
}

.report-quality {
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quality-exhaustive  { background: rgba(139,92,246,0.2); color: #a78bfa; }
.quality-comprehensive { background: rgba(16,185,129,0.2); color: var(--accent-green); }
.quality-solid       { background: rgba(6,182,212,0.2); color: var(--accent-cyan); }
.quality-basic       { background: rgba(245,158,11,0.2); color: var(--accent-yellow); }
.quality-surface     { background: rgba(239,68,68,0.2); color: var(--accent-red); }

.report-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.report-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.report-stat-number {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.report-stat-label {
  font-size: 0.68em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.report-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.report-breakdown-title {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.report-breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: 0.82em;
}

.report-breakdown-label {
  min-width: 130px;
  color: var(--text-secondary);
}

.report-breakdown-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.report-breakdown-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.report-breakdown-count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 24px;
  text-align: right;
}

.ai-status {
  margin-top: 10px;
  font-size: 0.85em;
  color: var(--accent-cyan);
  min-height: 20px;
}

.ai-status.error { color: var(--accent-red); }

.ai-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
  display: none;
}

.ai-progress-bar.active { display: block; }

.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Form fields */
.editor-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  cursor: pointer;
  user-select: none;
}

.editor-section-header h4 {
  font-size: 0.9em;
  font-weight: 600;
}

.editor-section-header .section-toggle {
  font-size: 0.7em;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.editor-section.collapsed .section-toggle { transform: rotate(-90deg); }
.editor-section.collapsed .editor-section-body { display: none; }

.editor-section-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.editor-row.full { flex-direction: column; }

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.editor-field label {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.editor-field input,
.editor-field select,
.editor-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9em;
  outline: none;
  transition: border-color var(--transition);
}

.editor-field input:focus,
.editor-field select:focus,
.editor-field textarea:focus { border-color: var(--accent-cyan); }

.editor-field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.editor-field textarea.tall { min-height: 140px; }

/* Repeatable items (timeline entries, people, etc.) */
.repeater-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repeater-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.repeater-item input,
.repeater-item textarea {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85em;
  outline: none;
}

.repeater-item textarea {
  min-height: 30px;
  resize: vertical;
}

.repeater-item input:focus,
.repeater-item textarea:focus { border-color: var(--accent-cyan); }

.repeater-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2em;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.repeater-remove:hover { color: var(--accent-red); background: rgba(239,68,68,0.1); }

.repeater-add {
  padding: 6px 14px;
  border: 1px dashed var(--border-light);
  background: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82em;
  transition: all var(--transition);
}

.repeater-add:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* Editor footer */
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.editor-footer-left { display: flex; gap: 10px; }
.editor-footer-right { display: flex; gap: 10px; }

.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9em;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  padding: 10px 20px;
  background: rgba(239,68,68,0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9em;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* Edit/Delete buttons on topic view */
.action-btn.edit-btn { font-size: 0.85em; }

/* ── QUICK RESEARCH MODAL ────────────────────────────────────── */

.quick-research-modal {
  position: relative;
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(6,182,212,0.08);
}

.qr-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.qr-header h2 { font-size: 1.2em; color: var(--text-primary); }
.qr-header .editor-close { position: absolute; top: 16px; right: 16px; }

.qr-body { padding: 20px 24px; }

.qr-input-section { margin-bottom: 16px; }

.qr-subject-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.05em;
  transition: border-color var(--transition);
}

.qr-subject-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6,182,212,0.15);
}

.qr-subject-input::placeholder { color: var(--text-muted); }

.qr-depth-section {
  margin-bottom: 16px;
}

.qr-depth-section label {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.qr-settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82em;
  color: var(--text-muted);
}

.qr-settings-row input {
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.qr-go-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 16px;
}

.qr-go-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(6,182,212,0.3); }
.qr-go-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.qr-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── REFRESH TOPIC ───────────────────────────────────────────── */

.refresh-existing-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.refresh-stat {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.refresh-stat strong {
  color: var(--accent-cyan);
}

.refresh-btn {
  background: rgba(6,182,212,0.1) !important;
  color: var(--accent-cyan) !important;
  border: 1px solid rgba(6,182,212,0.3) !important;
  font-size: 0.85em;
}

.refresh-btn:hover {
  background: rgba(6,182,212,0.2) !important;
  border-color: var(--accent-cyan) !important;
}

.refresh-merge-report {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-md);
}

.merge-report-header {
  font-weight: 600;
  color: var(--accent-green);
  margin-bottom: 10px;
  font-size: 0.95em;
}

.merge-report-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.merge-stat {
  font-size: 0.82em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16,185,129,0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16,185,129,0.2);
}

.merge-total {
  font-size: 0.85em;
  color: var(--text-muted);
}

/* ── RABBIT HOLE / RELATED TOPICS ────────────────────────────── */

.related-section-title {
  font-size: 1em;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.rabbit-hole-title {
  color: var(--accent-purple) !important;
  border-bottom-color: rgba(139,92,246,0.3) !important;
}

.rabbit-hole-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.rabbit-hole-card {
  background: var(--bg-card);
  border: 1px dashed rgba(139,92,246,0.4);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition);
}

.rabbit-hole-card:hover {
  border-color: var(--accent-purple);
  background: var(--bg-hover);
  box-shadow: 0 0 20px rgba(139,92,246,0.1);
}

.rabbit-hole-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
}

.rabbit-hole-status {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rabbit-hole-btn {
  padding: 8px 14px;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.4);
  border-radius: var(--radius-sm);
  color: var(--accent-purple);
  font-family: var(--font-sans);
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: auto;
}

.rabbit-hole-btn:hover {
  background: rgba(139,92,246,0.25);
  border-color: var(--accent-purple);
  box-shadow: 0 0 12px rgba(139,92,246,0.2);
}

/* ── ENHANCED SOURCE VIEWER ──────────────────────────────────── */

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

.sources-total {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-primary);
}

.sources-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-type-pill {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75em;
  color: var(--text-muted);
}

.source-type-pill strong {
  color: var(--accent-cyan);
  margin-left: 2px;
}

.source-card-enhanced {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.source-card-enhanced.clickable { cursor: pointer; }
.source-card-enhanced:hover { border-color: var(--border-light); background: var(--bg-hover); }

.source-type-badge-lg {
  padding: 6px 12px;
  background: rgba(6,182,212,0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.source-info-enhanced {
  flex: 1;
  min-width: 0;
}

.source-title-enhanced {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
  margin-bottom: 8px;
}

.source-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.source-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.source-meta-item.source-meta-url {
  grid-column: 1 / -1;
}

.source-meta-label {
  font-size: 0.7em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-meta-value {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.source-meta-link {
  font-size: 0.8em;
  color: var(--accent-cyan);
  text-decoration: none;
  word-break: break-all;
}

.source-meta-link:hover { text-decoration: underline; }

.source-action-enhanced {
  padding: 8px 14px;
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-size: 0.8em;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.source-action-enhanced.muted {
  background: var(--bg-tertiary);
  border-color: var(--border);
  color: var(--text-muted);
}

/* ── ADMIN BUTTON ──────────────────────────────────────────── */

.admin-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 1.1em;
  transition: all var(--transition);
}

.admin-btn:hover { color: var(--text-primary); background: var(--bg-hover); border-color: var(--border-light); }

/* ── CURIOSITY TOAST ───────────────────────────────────────── */

.curiosity-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(6,182,212,0.1);
  z-index: 2000;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 400px;
}

.curiosity-toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.8em;
  flex-shrink: 0;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
}

.toast-detail {
  font-size: 0.82em;
  color: var(--text-secondary);
}

.toast-promoted {
  font-size: 0.78em;
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 2px;
}

/* ── SEARCH CURIOSITY BUTTON ───────────────────────────────── */

.search-curiosity-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.15));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent-indigo);
  font-family: var(--font-sans);
  font-size: 0.85em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.search-curiosity-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(6,182,212,0.25));
  border-color: var(--accent-indigo);
}

/* ── HOME LOGO & PHILOSOPHY ────────────────────────────────── */

.home-logo {
  font-size: 4em;
  margin-bottom: 8px;
  animation: logoBounce 2s ease-in-out infinite;
}

@keyframes logoBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.home-philosophy {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-top: 6px;
  font-style: italic;
}

/* ── TRENDING BAR (Home) ───────────────────────────────────── */

.trending-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trending-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.trending-item:hover { border-color: var(--accent-yellow); background: var(--bg-hover); }

.trending-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-yellow);
  font-size: 1.1em;
  min-width: 24px;
  text-align: center;
}

.trending-query {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.trending-count {
  font-size: 0.82em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── RECOMMENDATION PREVIEW (Home) ─────────────────────────── */

.recommendation-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.rec-card-mini {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all var(--transition);
}

.rec-card-mini:hover { border-color: var(--accent-indigo); }

.rec-query {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92em;
  margin-bottom: 6px;
}

.rec-stats {
  font-size: 0.78em;
  color: var(--text-muted);
}

.rec-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--accent-cyan);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.rec-more:hover { background: var(--bg-hover); border-color: var(--accent-cyan); }

/* ── TRENDING VIEW ─────────────────────────────────────────── */

.trending-view {
  max-width: 900px;
  margin: 0 auto;
}

.trending-header {
  margin-bottom: 24px;
}

.trending-header h2 {
  font-size: 1.4em;
  margin-bottom: 4px;
}

.curiosity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.curiosity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.curiosity-item:hover { border-color: var(--border-light); background: var(--bg-hover); }

.curiosity-item.recommended { border-left: 3px solid var(--accent-indigo); }
.curiosity-item.approved { border-left: 3px solid var(--accent-green); }
.curiosity-item.researched { border-left: 3px solid var(--accent-cyan); }
.curiosity-item.rejected { border-left: 3px solid var(--accent-red); opacity: 0.6; }

.curiosity-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 1em;
  min-width: 28px;
  text-align: center;
}

.curiosity-info {
  flex: 1;
  min-width: 0;
}

.curiosity-query {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
  margin-bottom: 4px;
}

.curiosity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.curiosity-stat {
  font-size: 0.78em;
  color: var(--text-muted);
}

.curiosity-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.curiosity-status-badge.status-collecting { background: rgba(100,116,139,0.2); color: var(--text-muted); }
.curiosity-status-badge.status-recommended { background: rgba(99,102,241,0.15); color: var(--accent-indigo); }
.curiosity-status-badge.status-approved { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.curiosity-status-badge.status-researched { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.curiosity-status-badge.status-rejected { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.curiosity-status-badge.status-archived { background: rgba(139,92,246,0.15); color: var(--accent-purple); }

.curiosity-trend-bar {
  width: 120px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.curiosity-trend-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-yellow), var(--accent-red));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.curiosity-score {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-yellow);
  font-size: 0.9em;
  min-width: 36px;
  text-align: right;
}

/* ── RECOMMENDATIONS VIEW ──────────────────────────────────── */

.recommendations-view {
  max-width: 1000px;
  margin: 0 auto;
}

.rec-header {
  margin-bottom: 24px;
}

.rec-header h2 {
  font-size: 1.4em;
  margin-bottom: 4px;
}

.rec-section {
  margin-bottom: 30px;
}

.rec-section-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
}

.rec-card:hover { border-color: var(--accent-indigo); }

.rec-card-query {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.05em;
  margin-bottom: 10px;
}

.rec-card-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.rec-stat {
  font-size: 0.82em;
  color: var(--text-muted);
}

.rec-stat strong {
  color: var(--accent-cyan);
}

.rec-card-actions {
  display: flex;
  gap: 8px;
}

.rec-approve-btn {
  flex: 1;
  padding: 8px 12px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent-green);
  font-family: var(--font-sans);
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.rec-approve-btn:hover { background: rgba(16,185,129,0.2); border-color: var(--accent-green); }

.rec-reject-btn {
  padding: 8px 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent-red);
  font-family: var(--font-sans);
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.rec-reject-btn:hover { background: rgba(239,68,68,0.2); border-color: var(--accent-red); }

/* Approved cards */
.rec-approved-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-approved-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.rec-approved-card:hover { border-color: var(--accent-green); background: var(--bg-hover); }

.rec-approved-info { flex: 1; }

.rec-approved-query {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1em;
  margin-bottom: 4px;
}

.rec-approved-stats {
  font-size: 0.82em;
  color: var(--text-muted);
}

.rec-research-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.rec-research-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(6,182,212,0.3); }

/* ── ADMIN MODAL ───────────────────────────────────────────── */

.admin-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.admin-header h2 { font-size: 1.2em; }
.admin-header .muted { flex-basis: 100%; }
.admin-header .editor-close { }

.admin-body {
  padding: 24px;
}

.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.admin-stat {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  color: var(--text-secondary);
}

.admin-stat strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  margin-right: 4px;
}

.admin-section {
  margin-bottom: 24px;
}

.admin-section h3 {
  font-size: 1em;
  margin-bottom: 6px;
}

.admin-section .muted {
  margin-bottom: 12px;
}

.admin-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.admin-queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  transition: all var(--transition);
}

.admin-queue-item:hover { background: var(--bg-hover); }
.admin-queue-item.recommended { border-left: 3px solid var(--accent-indigo); }
.admin-queue-item.approved { border-left: 3px solid var(--accent-green); }
.admin-queue-item.researched { border-left: 3px solid var(--accent-cyan); }
.admin-queue-item.rejected { border-left: 3px solid var(--accent-red); opacity: 0.6; }

.aq-query {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aq-stats {
  display: flex;
  gap: 8px;
  font-size: 0.82em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.aq-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  flex-shrink: 0;
}

.admin-queue-item.recommended .aq-status { background: rgba(99,102,241,0.15); color: var(--accent-indigo); }
.admin-queue-item.approved .aq-status { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.admin-queue-item.researched .aq-status { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.admin-queue-item.rejected .aq-status { background: rgba(239,68,68,0.15); color: var(--accent-red); }

.aq-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.aq-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.75em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.aq-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.aq-btn.promote:hover { color: var(--accent-indigo); border-color: var(--accent-indigo); }
.aq-btn.approve:hover { color: var(--accent-green); border-color: var(--accent-green); }
.aq-btn.research:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.aq-btn.reject:hover { color: var(--accent-red); border-color: var(--accent-red); }

.admin-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-settings-row label {
  font-size: 0.82em;
  color: var(--text-muted);
  font-weight: 600;
}

.admin-settings-row input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85em;
  outline: none;
  min-width: 200px;
}

.admin-settings-row input:focus { border-color: var(--accent-cyan); }

/* ── NAV BADGE ─────────────────────────────────────────────── */

.nav-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  border-radius: 10px;
  margin-left: auto;
}

/* ── TOPIC UPDATE BANNER ───────────────────────────────────── */

.topic-update-banner {
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(6,182,212,0.1));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-md);
  color: var(--accent-indigo);
  font-size: 0.88em;
  font-weight: 500;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.topic-update-banner:hover { background: rgba(99,102,241,0.15); }

.banner-link {
  text-decoration: underline;
  font-weight: 600;
}

/* ── MONITOR BUTTON ────────────────────────────────────────── */

.action-btn.monitored {
  color: var(--accent-green);
  border-color: var(--accent-green);
}

/* ── UPDATES VIEW ──────────────────────────────────────────── */

.updates-view {
  max-width: 1000px;
  margin: 0 auto;
}

.updates-header {
  margin-bottom: 24px;
}

.updates-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.updates-header-top h2 {
  font-size: 1.4em;
  margin-bottom: 4px;
}

.cycle-btn {
  white-space: nowrap;
  padding: 10px 20px;
}

.updates-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.update-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  text-align: center;
  min-width: 100px;
  flex: 1;
}

.update-stat-number {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.update-stat-number.last-cycle {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.update-stat-label {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.updates-section {
  margin-bottom: 30px;
}

.updates-section-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.updates-section .muted {
  margin-bottom: 12px;
}

.update-queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.update-queue-list.compact .update-card { padding: 12px 16px; }

/* ── UPDATE CARD ───────────────────────────────────────────── */

.update-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
}

.update-card:hover { border-color: var(--border-light); }
.update-card.pending { border-left: 3px solid var(--accent-indigo); }
.update-card.approved { border-left: 3px solid var(--accent-green); }
.update-card.applied { border-left: 3px solid var(--accent-cyan); opacity: 0.8; }
.update-card.rejected { border-left: 3px solid var(--accent-red); opacity: 0.5; }

.update-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.update-topic-name {
  font-weight: 600;
  color: var(--accent-cyan);
  cursor: pointer;
  font-size: 1em;
}

.update-topic-name:hover { text-decoration: underline; }

.update-confidence {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.update-confidence.conf-high { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.update-confidence.conf-medium { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }
.update-confidence.conf-low { background: rgba(100,116,139,0.15); color: var(--text-muted); }

.update-time {
  font-size: 0.82em;
  color: var(--text-muted);
  margin-left: auto;
}

.update-changes-summary {
  margin-bottom: 12px;
}

.update-reason {
  font-size: 0.88em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.update-change-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.change-tag {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72em;
  font-weight: 600;
}

.change-tag.sources { background: rgba(6,182,212,0.12); color: var(--accent-cyan); }
.change-tag.timeline { background: rgba(99,102,241,0.12); color: var(--accent-indigo); }
.change-tag.people { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.change-tag.orgs { background: rgba(249,115,22,0.12); color: var(--accent-yellow); }
.change-tag.evidence { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.change-tag.counter { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.change-tag.questions { background: rgba(236,72,153,0.12); color: #ec4899; }
.change-tag.related { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.change-tag.summary { background: rgba(59,130,246,0.12); color: var(--accent-blue); }

.update-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.update-result {
  font-size: 0.82em;
  color: var(--accent-green);
  font-weight: 500;
}

/* ── UPDATE REVIEW MODAL ───────────────────────────────────── */

.update-review-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.ur-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.ur-header h2 { font-size: 1.1em; }

.ur-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-tertiary);
  font-size: 0.85em;
  flex-wrap: wrap;
}

.ur-time { color: var(--text-muted); }

.ur-status {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75em;
  text-transform: uppercase;
  font-weight: 600;
}

.ur-status.status-pending { background: rgba(99,102,241,0.15); color: var(--accent-indigo); }
.ur-status.status-approved { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.ur-status.status-applied { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.ur-status.status-rejected { background: rgba(239,68,68,0.15); color: var(--accent-red); }

.ur-total {
  font-weight: 600;
  color: var(--text-primary);
}

.ur-reason {
  padding: 12px 24px;
  font-size: 0.9em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.ur-body {
  padding: 16px 24px;
}

.ur-section {
  margin-bottom: 20px;
}

.ur-section-title {
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ur-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ur-item {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-light);
}

.ur-item-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.92em;
  margin-bottom: 2px;
}

.ur-item-meta {
  font-size: 0.82em;
  color: var(--text-muted);
  line-height: 1.5;
}

.ur-item-source {
  font-size: 0.78em;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.ur-date {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--accent-cyan);
  margin-right: 8px;
}

.ur-event {
  font-size: 0.9em;
  color: var(--text-secondary);
}

.ur-summary-diff {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ur-summary-old,
.ur-summary-new {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ur-summary-old { background: rgba(239,68,68,0.05); border-left: 3px solid var(--accent-red); }
.ur-summary-new { background: rgba(16,185,129,0.05); border-left: 3px solid var(--accent-green); }

.ur-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── RESEARCH CYCLE MODAL ──────────────────────────────────── */

.cycle-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
}

.cycle-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.cycle-header h2 { font-size: 1.2em; margin-bottom: 4px; }
.cycle-header .editor-close { position: absolute; top: 16px; right: 16px; }

.cycle-body {
  padding: 20px 24px;
}

.cycle-progress {
  margin-bottom: 20px;
}

.cycle-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.cycle-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

.cycle-status {
  font-size: 0.88em;
  color: var(--accent-cyan);
}

.cycle-topics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.cycle-topic {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}

.cycle-topic-icon {
  font-size: 1.1em;
  min-width: 20px;
  text-align: center;
}

.cycle-topic-name {
  flex: 1;
  color: var(--text-primary);
}

.cycle-topic-result {
  font-size: 0.82em;
  font-weight: 500;
}

/* ── MONITORED TOPICS GRID ─────────────────────────────────── */

.monitored-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.monitored-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.monitored-card:hover { border-color: var(--accent-cyan); }

.monitored-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95em;
  margin-bottom: 6px;
}

.monitored-meta {
  display: flex;
  gap: 10px;
  font-size: 0.78em;
  color: var(--text-muted);
}

/* ── TOPIC HISTORY TAB ─────────────────────────────────────── */

.history-header {
  margin-bottom: 16px;
}

.history-monitor-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.history-monitor-badge.active {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.3);
  color: var(--accent-green);
}

.history-pending {
  margin-bottom: 24px;
}

.history-pending h3 {
  font-size: 1em;
  margin-bottom: 10px;
  color: var(--accent-indigo);
}

.history-update-card {
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.history-update-card.pending { border-left: 3px solid var(--accent-indigo); }

.history-update-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.85em;
  color: var(--text-muted);
}

.history-update-reason {
  font-size: 0.88em;
  color: var(--text-secondary);
}

.history-timeline h3 {
  font-size: 1em;
  margin-bottom: 14px;
}

.history-entry {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.history-entry:last-child { border-bottom: none; }

.history-entry-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.history-entry-dot.created { background: var(--accent-cyan); box-shadow: 0 0 6px var(--accent-cyan); }
.history-entry-dot.update { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.history-entry-dot.refresh { background: var(--accent-indigo); box-shadow: 0 0 6px var(--accent-indigo); }

.history-entry-content { flex: 1; }

.history-entry-time {
  font-size: 0.82em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.history-entry-summary {
  font-size: 0.9em;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.history-entry-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.history-change-tag {
  padding: 2px 6px;
  background: rgba(16,185,129,0.1);
  color: var(--accent-green);
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 600;
}

.history-entry-total {
  font-size: 0.78em;
  color: var(--text-muted);
}

/* ── DISCOVERY HOME ────────────────────────────────────────── */

.discovery-home {
  max-width: 1200px;
  margin: 0 auto;
}

.discovery-hero {
  position: relative;
  padding: 48px 40px;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.06), rgba(139,92,246,0.05));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.discovery-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-indigo);
  font-weight: 700;
  margin-bottom: 12px;
  padding: 4px 10px;
  background: rgba(99,102,241,0.1);
  border-radius: 20px;
}

.hero-title {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.3;
}

.hero-summary {
  font-size: 0.95em;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 700px;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hero-stats span {
  font-size: 0.82em;
  color: var(--text-muted);
}

.hero-stats strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.hero-explore-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.hero-explore-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99,102,241,0.3);
}

/* ── PULSE BAR ─────────────────────────────────────────────── */

.pulse-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: wrap;
}

.pulse-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pulse-number {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.pulse-label {
  font-size: 0.82em;
  color: var(--text-muted);
}

.pulse-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 20px;
  font-size: 0.82em;
  color: var(--accent-indigo);
  font-weight: 500;
  cursor: pointer;
  margin-left: auto;
  transition: all var(--transition);
}

.pulse-alert:hover {
  background: rgba(99,102,241,0.15);
}

/* ── DISCOVERY GRID ────────────────────────────────────────── */

.discovery-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.discovery-primary {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.discovery-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.discovery-section {
  min-width: 0;
}

.discovery-heading {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.discovery-heading span:first-child {
  font-size: 1.2em;
}

/* ── DISCOVERY STREAM (trending items) ─────────────────────── */

.discovery-stream {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stream-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.stream-item:hover {
  border-color: var(--accent-indigo);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.stream-rank {
  font-size: 1.3em;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
  font-family: var(--font-mono);
  opacity: 0.5;
}

.stream-info {
  flex: 1;
  min-width: 0;
}

.stream-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-meta {
  font-size: 0.78em;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stream-bar {
  width: 80px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.stream-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  transition: width 0.4s ease;
}

/* ── CONNECTED GRID ────────────────────────────────────────── */

.connected-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.connected-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.connected-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.connected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.connected-cat {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.connected-score {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.connected-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92em;
  margin-bottom: 6px;
  line-height: 1.3;
}

.connected-meta {
  font-size: 0.78em;
  color: var(--text-muted);
}

/* ── SIDEBAR STREAM / CARDS ────────────────────────────────── */

.sidebar-stream {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-card {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-card:hover {
  border-color: var(--accent-indigo);
  background: var(--bg-hover);
}

.sidebar-card-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.88em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-card-meta {
  font-size: 0.75em;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-more {
  display: block;
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82em;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}

.sidebar-more:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

/* ── TOPIC EVOLUTION BAR ───────────────────────────────────── */

.topic-evolution {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.evo-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.evo-icon {
  font-size: 1em;
  opacity: 0.7;
}

.evo-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.evo-value {
  font-size: 0.88em;
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.evo-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 6px;
}

.meta-monitored {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 12px;
  font-size: 0.75em;
  color: var(--accent-green);
  font-weight: 600;
}

/* ── DASHBOARD VIEW (Curiosity Dashboard) ──────────────────── */

.dashboard-view {
  max-width: 1200px;
  margin: 0 auto;
}

.dash-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dash-stat-card {
  flex: 1;
  min-width: 120px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all var(--transition);
}

.dash-stat-card:hover {
  border-color: var(--border-light);
}

.dash-stat-number {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}

.dash-stat-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.dash-primary {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.dash-section {
  min-width: 0;
}

.dash-section-title {
  font-size: 1em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── COMPACT CURIOSITY LIST / ITEMS ────────────────────────── */

.curiosity-list.compact {
  gap: 4px;
}

.curiosity-item.compact,
.curiosity-card.compact {
  padding: 10px 14px;
}

/* ── TRENDING STREAM ───────────────────────────────────────── */

.trending-stream {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── GOVERNMENT SOURCES VIEW ───────────────────────────────── */

.gov-sources-view,
.academic-sources-view {
  max-width: 900px;
}

.gov-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.gov-header-icon {
  font-size: 2em;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99,102,241,0.1);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.gov-header h3 {
  font-size: 1.2em;
  margin-bottom: 2px;
}

/* ── GOVERNMENT POSITION CARD ──────────────────────────────── */

.gov-position-card {
  background: var(--bg-card);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  overflow: hidden;
}

.gov-position-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.05));
  border-bottom: 1px solid var(--border);
}

.gov-position-header h4 {
  font-size: 1.05em;
  color: var(--text-primary);
}

.gov-position-body {
  padding: 20px;
}

.gov-position-text {
  font-size: 0.95em;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent-indigo);
  border-radius: var(--radius-sm);
}

.gov-agencies-grid {
  margin-bottom: 20px;
}

.gov-agencies-grid h5,
.gov-position-timeline h5 {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.gov-agency-row {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.gov-agency-row:last-child { border-bottom: none; }

.gov-agency-name {
  font-weight: 600;
  color: var(--accent-cyan);
  font-size: 0.88em;
  min-width: 180px;
  flex-shrink: 0;
}

.gov-agency-position {
  font-size: 0.88em;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── GOVERNMENT POSITION TIMELINE ──────────────────────────── */

.gov-position-timeline {
  margin-top: 16px;
}

.gov-timeline-entry {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.gov-timeline-entry:last-child { border-bottom: none; }

.gov-timeline-date {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--accent-indigo);
  font-weight: 600;
  min-width: 110px;
  flex-shrink: 0;
}

.gov-timeline-position {
  font-size: 0.88em;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── GOVERNMENT DOCUMENT CARDS ─────────────────────────────── */

.gov-documents-section {
  margin-bottom: 24px;
}

.gov-documents-section h4 {
  font-size: 1em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.gov-doc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gov-doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
}

.gov-doc-card:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.gov-doc-card.clickable { cursor: pointer; }

.gov-doc-card.academic-doc { border-left: 3px solid #6366f1; }
.gov-doc-card.archive-doc { border-left: 3px solid #f59e0b; }

.gov-doc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.gov-doc-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(99,102,241,0.12);
  color: var(--accent-indigo);
}

.gov-doc-type-badge.academic-badge {
  background: rgba(139,92,246,0.12);
  color: var(--accent-purple);
}

.gov-doc-type-badge.archive-badge {
  background: rgba(245,158,11,0.12);
  color: var(--accent-yellow);
}

.gov-doc-classification {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gov-class-unclassified {
  background: rgba(16,185,129,0.12);
  color: var(--accent-green);
}

.gov-class-declassified {
  background: rgba(245,158,11,0.12);
  color: var(--accent-yellow);
}

.gov-class-public {
  background: rgba(6,182,212,0.12);
  color: var(--accent-cyan);
}

.gov-class-classified {
  background: rgba(239,68,68,0.12);
  color: var(--accent-red);
}

.gov-doc-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1em;
  margin-bottom: 8px;
  line-height: 1.4;
}

.gov-doc-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.gov-doc-agency,
.gov-doc-date {
  font-size: 0.82em;
  color: var(--text-muted);
}

.gov-doc-summary {
  font-size: 0.88em;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.gov-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82em;
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.gov-doc-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.gov-doc-nolink {
  font-size: 0.78em;
  color: var(--text-muted);
  font-style: italic;
}

.gov-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}

.gov-empty p:first-child {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ── SOURCE CATEGORIZATION ─────────────────────────────────── */

.source-transparency-note {
  padding: 10px 16px;
  background: rgba(6,182,212,0.05);
  border: 1px solid rgba(6,182,212,0.15);
  border-radius: var(--radius-sm);
  font-size: 0.82em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.sources-categorized {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.source-category-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.source-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.source-category-icon {
  font-size: 1.2em;
}

.source-category-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92em;
  flex: 1;
}

.source-category-count {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  padding: 2px 8px;
  background: rgba(6,182,212,0.1);
  border-radius: 10px;
}

.source-category-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Source type pill colors */
.source-pill-government { border-color: rgba(99,102,241,0.3); color: var(--accent-indigo); }
.source-pill-academic { border-color: rgba(139,92,246,0.3); color: var(--accent-purple); }
.source-pill-archive { border-color: rgba(245,158,11,0.3); color: var(--accent-yellow); }
.source-pill-book { border-color: rgba(16,185,129,0.3); color: var(--accent-green); }
.source-pill-news { border-color: rgba(6,182,212,0.3); color: var(--accent-cyan); }
.source-pill-corporate { border-color: rgba(249,115,22,0.3); color: var(--accent-yellow); }
.source-pill-independent { border-color: rgba(100,116,139,0.3); color: var(--text-muted); }

/* Source badge colors by category */
.source-badge-government { background: rgba(99,102,241,0.12); color: var(--accent-indigo); }
.source-badge-academic { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.source-badge-archive { background: rgba(245,158,11,0.12); color: var(--accent-yellow); }
.source-badge-book { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.source-badge-news { background: rgba(6,182,212,0.12); color: var(--accent-cyan); }
.source-badge-corporate { background: rgba(249,115,22,0.12); color: var(--accent-yellow); }
.source-badge-independent { background: rgba(100,116,139,0.12); color: var(--text-muted); }
.source-badge-other { background: rgba(100,116,139,0.08); color: var(--text-muted); }

/* Government doc meta highlight */
.meta-gov {
  color: var(--accent-indigo) !important;
  font-weight: 600;
}

/* ── CONTINUE EXPLORING (Rabbit Hole Engine) ──────────────── */

.continue-exploring {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.continue-exploring h3 {
  font-size: 1.15em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.explore-section {
  margin-bottom: 20px;
}

.explore-section-label {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-indigo);
  font-weight: 700;
  margin-bottom: 10px;
}

.explore-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.explore-card {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.explore-card::before {
  content: '🐇';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.9em;
  opacity: 0;
  transition: opacity var(--transition);
}

.explore-card:hover {
  border-color: var(--accent-indigo);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.15);
}

.explore-card:hover::before {
  opacity: 0.6;
}

.explore-card-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92em;
  margin-bottom: 6px;
  line-height: 1.3;
}

.explore-card-path {
  font-size: 0.78em;
  color: var(--text-muted);
  line-height: 1.5;
}

.explore-card-multi {
  font-size: 0.72em;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-top: 6px;
}

/* ── RESPONSIVE (discovery) ────────────────────────────────── */

@media (max-width: 1024px) {
  .discovery-grid,
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .discovery-sidebar,
  .dash-sidebar {
    order: -1;
  }
}

@media (max-width: 640px) {
  .discovery-hero {
    padding: 28px 20px;
  }
  .hero-title {
    font-size: 1.2em;
  }
  .pulse-bar {
    gap: 12px;
    padding: 10px 16px;
  }
  .connected-grid {
    grid-template-columns: 1fr;
  }
}

/* ── LANDING PAGE ──────────────────────────────────────────── */

.landing-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.landing-hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.landing-rabbit {
  font-size: 4em;
  margin-bottom: 12px;
  animation: landingBounce 2s ease infinite;
}

@keyframes landingBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing-title {
  font-size: 2.8em;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #f8fafc, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-tagline {
  font-size: 1.15em;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 580px;
  margin: 0 auto;
}

/* What is this */
.landing-what {
  margin: 40px 0;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.landing-what-header {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.landing-what-text {
  font-size: 0.95em;
  color: var(--text-secondary);
  line-height: 1.9;
  max-width: 680px;
  margin: 0 auto;
}

.landing-what-text strong {
  color: var(--text-primary);
}

.landing-what-text em {
  color: var(--accent-indigo);
  font-style: normal;
  font-weight: 600;
}

/* Four pillars */
.landing-pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.landing-pillar {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.landing-pillar:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
}

.pillar-icon {
  font-size: 1.8em;
  margin-bottom: 10px;
}

.pillar-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1em;
  margin-bottom: 8px;
}

.pillar-text {
  font-size: 0.85em;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Topic previews */
.landing-preview {
  margin-bottom: 40px;
}

.landing-preview-label {
  text-align: center;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 16px;
}

.landing-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.landing-topic-card {
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.landing-topic-card:hover {
  border-color: var(--accent-indigo);
  background: var(--bg-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.15);
}

.landing-topic-cat {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.landing-topic-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.landing-topic-summary {
  font-size: 0.78em;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.landing-topic-stats {
  display: flex;
  gap: 10px;
  font-size: 0.7em;
  color: var(--text-muted);
}

.landing-topic-stats span {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

/* Stats bar */
.landing-stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.landing-stat {
  font-size: 0.88em;
  color: var(--text-muted);
}

.landing-stat strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 1.3em;
  margin-right: 4px;
}

/* CTA */
.landing-cta {
  text-align: center;
}

.landing-enter-btn {
  padding: 16px 48px;
  font-size: 1.1em;
  font-weight: 700;
  font-family: var(--font-sans);
  color: #fff;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}

.landing-enter-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(99,102,241,0.4);
}

.landing-cta-sub {
  margin-top: 12px;
  font-size: 0.78em;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .landing-title { font-size: 1.8em; }
  .landing-pillars { grid-template-columns: 1fr; }
  .landing-preview-grid { grid-template-columns: 1fr; }
  .landing-stats-bar { gap: 16px; }
}

/* ── BETA BANNER ────────────────────────────────────────────── */

.beta-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 4px 0;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #8b5cf6, #6366f1);
  background-size: 300% 100%;
  animation: betaShimmer 8s ease infinite;
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

@keyframes betaShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body:has(.beta-banner) .app-layout {
  padding-top: 24px;
}

body:has(.beta-banner) .sidebar {
  padding-top: 28px;
}

/* ── ADMIN LOGIN MODAL ──────────────────────────────────────── */

.admin-login-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  max-width: 400px;
  width: 90%;
  margin: auto;
  padding: 0;
  position: relative;
}

.admin-login-header {
  padding: 24px 24px 12px;
  position: relative;
}

.admin-login-header h2 {
  margin-bottom: 8px;
}

.admin-login-header .editor-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.admin-login-body {
  padding: 12px 24px 24px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { width: 0; min-width: 0; border-right: none; }
  .timeline-item { width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; text-align: left !important; padding-left: 30px !important; }
  .timeline::before { left: 10px; }
  .timeline-item .timeline-dot { left: 4px !important; right: auto !important; }
  .home-cat-topics { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr; }
  .topic-title { font-size: 1.3em; }
}
